#include "bits/stdc++.h" #include using namespace std; using namespace boost::multiprecision; int bit_count(const cpp_int& num) { int count = 0; const auto& limbs = num.backend().limbs(); for (size_t i = 0; i < num.backend().size(); ++i) { count += __builtin_popcountll(limbs[i]); } return count; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n, f; cin >> n >> f; vector a(n), b(n), c(n); for (auto&& i : a) cin >> i; for (auto&& i : b) cin >> i; for (auto&& i : c) cin >> i; cpp_int bs = 1; for (int i = 0; i < n; ++i) { cpp_int bs2 = bs << a[i]; bs2 |= bs << b[i]; bs2 |= bs << c[i]; bs = move(bs2); cout << bit_count(bs) << "\n"; } }