Problem:
Score : 700 points

Problem Statement

Takahashi throws N dice, each having K sides with all integers from 1 to K. The dice are NOT pairwise distinguishable.
For each i=2,3,...,2K, find the following value modulo 998244353:

The number of combinations of N sides shown by the dice such that the sum of no two different sides is i.

Note that the dice are NOT distinguishable, that is, two combinations are considered different when there exists an integer k such that the number of dice showing k is different in those two.

Constraints

1 \leq K \leq 2000

2 \leq N \leq 2000

K and N are integers.

Input

Input is given from Standard Input in the following format:

K N

Output

Print 2K-1 integers. The t-th of them (1\leq t\leq 2K-1) should be the answer for i=t+1.

Sample Input 1

3 3

Sample Output 1

7
7
4
7
7

For i=2, the combinations (1,2,2),(1,2,3),(1,3,3),(2,2,2),(2,2,3),(2,3,3),(3,3,3) satisfy the condition, so the answer is 7.

For i=3, the combinations (1,1,1),(1,1,3),(1,3,3),(2,2,2),(2,2,3),(2,3,3),(3,3,3) satisfy the condition, so the answer is 7.

For i=4, the combinations (1,1,1),(1,1,2),(2,3,3),(3,3,3) satisfy the condition, so the answer is 4.

Sample Input 2

4 5

Sample Output 2

36
36
20
20
20
36
36

Sample Input 3

6 1000

Sample Output 3

149393349
149393349
668669001
668669001
4000002
4000002
4000002
668669001
668669001
149393349
149393349

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = 998244353ll;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

const int N = 4005;

int k, n;
ll f[N], inv[N], dp[N][N], s[N][N];

inline ll bp(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b & 1)
			res = res * a % mod;
		a = sqr(a) % mod;
		b >>= 1;
	}
	return res;
}

inline ll c(int n, int k) {
	return f[n] * inv[n - k] % mod * inv[k] % mod;
}

inline ll calc(int sum, int cnt) {
	if (cnt <= 0) return (sum == 0 ? 1 : 0);
	return c(sum + cnt - 1, cnt - 1);
}

inline void add(ll &x, ll y) {
	x += y;
	if (x >= mod)
		x -= mod;
}

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	//cin.tie(NULL);
	//cout.tie(NULL);
	//ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;

	f[0] = inv[0] = 1;

	for (int i = 1; i < N; i++) {
		f[i] = f[i - 1] * i % mod;
		inv[i] = bp(f[i], mod - 2);
	}

	cin >> k >> n;

	dp[0][0] = s[0][0] = 1;

	for (int i = 0; i <= n; i++) {
		s[i][0] = 1;
		for (int j = 1; j <= k; j++) {
			if (j)
				add(dp[i][j], dp[i][j - 1]);
			if (i) {
				add(dp[i][j], s[i - 1][j - 1]);
				add(dp[i][j], s[i - 1][j - 1]);
				add(s[i][j], s[i - 1][j]);
			}
			add(s[i][j], dp[i][j]);
		}
	}

	for (int i = 2; i <= k + k; i++) {
		ll ans = 0;
		int cnt = 0;
		for (int j = 1; j < i - j; j++)
			cnt += (i - j <= k);
		int tot = cnt + cnt + (!(i & 1));
		if (i & 1) {
			for (int j = 0; j <= n; j++) {
				ans = (ans + dp[j][cnt] * calc(n - j, k - tot)) % mod;
			}
		}
		else {
			for (int j = 0; j <= n; j++) {
				ans = (ans + dp[j][cnt] * calc(n - j, k - tot)) % mod;
				if (j < n)
					ans = (ans + dp[j][cnt] * calc(n - j - 1, k - tot)) % mod;
			}
		}
		cout << ans << "\n"; 
	}

	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}