Language: C++

#include <bits/stdc++.h>
#include <boost/functional/hash.hpp>

#define debug 0
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,(n) - 1)
#define rep1(i,n) repU(i,1,(n))
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define ins insert
#define emp emplace
#define era erase
#define fir first
#define sec second

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;
typedef tuple<int,int,int> tiii;

const int dir[][2] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int mod = 998244353;
const int inf32 = (1 << 30) - 1;
const ll inf64 = (1LL << 62) - 1;

template <class T, class U> T qceil(T x, U y) { return x > 0 ? (x - 1) / y + 1 : x / y; }
template <class T, class U> bool parity(T x, U y) { return x & 1 ^ y & 1 ^ 1; }
template <class T, class U> bool chmax(T &m, U x) { if(m < x) { m = x; return 1; } return 0; }
template <class T, class U> bool chmin(T &m, U x) { if(m > x) { m = x; return 1; } return 0; }
template <class T> bool cmprs(T &v) {
    T tmp = v;
    sort(all(tmp));
    tmp.erase(unique(all(tmp)),end(tmp));
    for(auto it = begin(v); it != end(v); ++it) *it = l_bnd(all(tmp),*it) - begin(tmp) + 1;
    return v.size() > tmp.size();
}

ll modpow(ll n, ll e, ll m = mod){
	ll res = 1;
	n %= m;
	e %= (m - 1);
	while(e) {
		if(e & 1) res = res * n % m;
		n = n * n % m;
		e >>= 1;
	}
	return res;
}

ll modinv(ll n, ll m = mod){ return modpow(n,m - 2,m); }

void fact_table(vct<ll> &fact, int n, ll m = mod){
	fact.resize(n + 1);
	fact[0] = 1;
	rep(i,n) fact[i + 1] = fact[i] * (i + 1) % m;
}

void fact_inv_table(vct<ll> &fact_inv, vct<ll> &fact, int n, ll m = mod){
	fact_inv.resize(n + 1);
	rep(i,n + 1) fact_inv[i] = modinv(fact[i],m);
}

oid comb_table(vct<vct<ll>> &comb, vct<ll> &fact, vct<ll> &fact_inv, int t, int s = 0, ll m = mod){
	fact_table(fact,t,m);
	fact_inv_table(fact_inv,fact,t,m);
	comb.resize(t + 1);
	repU(n,s,t) {
		comb[n].resize(n + 1);
		if(n > s) {
			comb[n][0] = comb[n][n] = 1;
			rep(i,1 + n / 2) comb[n][i] = comb[n][n - i] = (comb[n - 1][i] + comb[n - 1][i - 1]) % m;
		} else {
			rep(i,1 + n / 2) {
				ll rev = fact_inv[i] * fact_inv[n - i] % m;
				comb[n][i] = comb[n][n - i] = rev * fact[n] % m;
			}
		}
	}
}

void comb_table(vct<ll> &comb, vct<ll> &fact, vct<ll> &fact_inv, int n, ll m = mod){
	fact_table(fact,n,m);
	fact_inv_table(fact_inv,fact,n,m);
	comb.resize(n + 1);
	rep(i,1 + n / 2) {
		ll rev = fact_inv[i] * fact_inv[n - i] % m;
		comb[i] = comb[n - i] = rev * fact[n] % m;
	}
}

ll ans[5010],f[5010],N,K,mem1[5010] = {};
vct<ll> fac1,fac2,ifac1,ifac2;
vct<vct<ll>> comb;

ll calc(int n,int r){
    if(n < r || r < 0 || n < 0) return 0;
    return comb[n][r];
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> K >> N;
    comb_table(comb1,fac1,ifac1,N + K + 2);
    rep(i,K * 2) if(i < N) f[i] = (i - 1)/2; else f[i] = f[2 * N - i];
    for(int q = 1; q <= 2 * K;q++){
        ll sum = 0;
        if(q & 1){
           rep(i,f[q] + 1){
               sum += modpow(2,i) * calc(-1 +N + K - 2 * f[q],-1+K - 2 * f[q] + i);
               sum %= mod;
           }
           if(q > 1) cout << ans[q] = sum << endl;
        }else{
           rep(i,f[q-1] + 1){
               sum += modpow(2,i) * calc(-1 +N + K - 1 - 2 * f[q-1],-1+K - 1 - 2 * f[q-1] + i);
               sum %= mod;
           }
           rep(i,f[q-1] + 1){
               sum += modpow(2,i) * calc(-1 +N-1 + K - 1 - 2 * f[q-1],-1+K -1 - 2 * f[q-1] + i);
               sum %= mod;
           }
           cout << sum << endl;
        }
    }
}


Compiler output:
a.cc:2:10: fatal error: boost/functional/hash.hpp: No such file or directory
    2 | #include <boost/functional/hash.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.