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 (Clang 3.8.0) (judge verdict: Runtime Error)

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) //std::cerr<< #x <<": "<<x<<"\n"
#define debug2(x,y) std::cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<"\n"
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}

int mod = 998244353;

int main() {
  int k, n;
  cin >> k >> n;
  vvll table(n+1, vll(n+1, 0LL));
  rep (i, n+1) {
    table[1][i] = 1;
  }
  FOR (i, 1, n+1) {
    table[i][0] = 1;
  }
  FOR (i, 2, n+1) {
    FOR (j, 1, n+1) {
      table[i][j] = table[i][j-1] + table[i-1][j];
      table[i][j] %= mod;
    }
  }
  vvll comb(n+1, vll(n+1, 0LL));
  comb[0][0] = comb[1][0] = comb[1][1] = 1;
  FOR (i, 2, n+1) {
    comb[i][0] = 1;
    comb[i][i] = 1;
    FOR (j, 1, i) {
      comb[i][j] = (comb[i-1][j-1] + comb[i-1][j]) % mod;
    }
  }
  vll po2(n+1, 1LL);
  FOR (i, 1, n+1) {
    po2[i] = po2[i-1] * 2 % mod;
  }
  /*
  debug(table);
  debug(comb);
  */

  vll answers(2*k+1, 0LL);

  FOR (i, 2, 2*k+1) {
    debug(i);
    ll ans = 0;
    int ma = min(i-1, k);
    int mi = i - ma;
    int p = (ma - mi + 1) / 2;
    int q = (i-1)%2; // if i is even dice must have i/2
    int r = k - (ma - mi + 1);
    debug(p); debug(q); debug(r);
    rep (ip, p+1) {
      debug(ip);
      ll select = comb[p][ip] * po2[ip] % mod;
      debug(select);
      int n2 = n - ip;
      ll add;
      if (n2 < 0) {
        add = 0;
      } else {
        add = select * table[ip+r][n2] % mod;
      }
      ll add2 = 0;
      if (q == 1) {
        int n3 = n - ip - 1;
        if (n3 >= 0) {
          add2 = select * table[ip+r][n3] % mod;
        }
      }
      debug(add);
      debug(add2);
      ans = (ans + add + add2) % mod;
    }

    answers[i] = ans;
  }
  debug(answers);

  FOR (i, 2, 2*k+1) {
    printf("%lld\n", answers[i]);
  }

  return 0;
}