#include #include using namespace std; using namespace atcoder; istream &operator>>(istream &is, modint &a) { long long v; is >> v; a = v; return is; } ostream &operator<<(ostream &os, const modint &a) { return os << a.val(); } istream &operator>>(istream &is, modint998244353 &a) { long long v; is >> v; a = v; return is; } ostream &operator<<(ostream &os, const modint998244353 &a) { return os << a.val(); } istream &operator>>(istream &is, modint1000000007 &a) { long long v; is >> v; a = v; return is; } ostream &operator<<(ostream &os, const modint1000000007 &a) { return os << a.val(); } typedef long long ll; typedef vector> Graph; typedef pair pii; typedef pair pll; #define FOR(i,l,r) for (int i = l;i < (int)(r); i++) #define rep(i,n) for (int i = 0;i < (int)(n); i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define my_sort(x) sort(x.begin(), x.end()) #define my_max(x) *max_element(all(x)) #define my_min(x) *min_element(all(x)) template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = (1<<30) - 1; const ll LINF = (1LL<<62) - 1; const int MOD = 998244353; const int MOD2 = 1e9+7; const double PI = acos(-1); vector di = {1,0,-1,0}; vector dj = {0,1,0,-1}; #ifdef LOCAL # include # define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else # define debug(...) (static_cast(0)) #endif // FFT // https://trap.jp/post/1386/ // 原始根 // https://sen-comp.hatenablog.com/entry/2021/02/06/180310 using mint = modint998244353; vector fft(vector A, mint root){ const int N = A.size(); if(N == 1) return A; vector even(N / 2), odd(N / 2); for(int i = 0; i < (N / 2); i++){ even[i] = A[2 * i]; odd[i] = A[2 * i + 1]; } even = fft(even, root * root); odd = fft(odd, root * root); mint zeta = 1; for(int i = 0; i < (N / 2); i++){ A[i] = even[i] + odd[i] * zeta; A[i + (N / 2)] = even[i] - odd[i] * zeta; zeta *= root; } return A; } vector ifft(vector A, mint iroot){ const int N = A.size(); if(N == 1) return A; vector even(N / 2), odd(N / 2); for(int i = 0; i < (N / 2); i++){ even[i] = A[2 * i]; odd[i] = A[2 * i + 1]; } even = fft(even, iroot * iroot); odd = fft(odd, iroot * iroot); mint invN = 1 / mint(N); mint izeta = 1; for(int i = 0; i < (N / 2); i++){ A[i] = (even[i] + odd[i] * izeta) * invN; A[i + (N / 2)] = (even[i] - odd[i] * izeta) * invN; izeta *= iroot; } return A; } // vector convolution(vector a, vector b){ // int n = 1; // int m = a.size() + b.size() - 1; // while(n <= m) n <<= 1; // a.resize(n, 0); // b.resize(n, 0); // // mint root = mint(3).pow(998244352 / n); // vector A = fft(a, root); // vector B = fft(b, root); // for(int i = 0; i < n; i++) A[i] *= B[i]; // // vector C = ifft(A, 1 / root); // C.resize(m); // return C; // } vector operator+(const vector &a, const vector &b){ vector res(max((int)a.size(), (int)b.size())); for(int i = 0; i < (int)a.size(); i++) res[i] = res[i] + a[i]; for(int i = 0; i < (int)b.size(); i++) res[i] = res[i] + b[i]; return res; } vector operator+(mint constant, const vector &a){ vector res((int)a.size()); res[0] = constant; for(int i = 0; i < (int)a.size(); i++) res[i] = res[i] + a[i]; return res; } vector operator+(const vector &a, mint constant){ vector res((int)a.size()); res[0] = constant; for(int i = 0; i < (int)a.size(); i++) res[i] = res[i] + a[i]; return res; } vector operator-(const vector &a, const vector &b){ vector res(max((int)a.size(), (int)b.size())); for(int i = 0; i < (int)a.size(); i++) res[i] = res[i] + a[i]; for(int i = 0; i < (int)b.size(); i++) res[i] = res[i] - b[i]; return res; } vector operator-(mint constant, const vector &a){ vector res((int)a.size()); res[0] = constant; for(int i = 0; i < (int)a.size(); i++) res[i] = res[i] - a[i]; return res; } vector operator-(const vector &a, mint constant){ vector res((int)a.size()); for(int i = 0; i < (int)a.size(); i++) res[i] = a[i]; res[0] = res[0] - constant; return res; } vector operator*(mint coef, const vector &a){ vector res((int)a.size()); for(int i = 0; i < (int)a.size(); i++) res[i] = a[i] * coef; return res; } vector operator*(const vector a, const vector b){ return convolution(a, b); } // Library Chechker vector fps_inv(vector a){ int n = (int)a.size(); int d = 1; vector g = {mint(a[0]).inv()}; vector f = {a[0]}; while(d < n){ d <<= 1; g.resize(d, 0); while((int)f.size() < min(d, n)) f.push_back(a[(int)f.size()]); // g_{n+1} = 2 * g_n - f * g_n * g_n g = 2 * g - f * g * g; g.resize(d, 0); } return g; } vector operator/(const vector &a, const vector &b){ return convolution(a, fps_inv(b)); } vector operator/(mint constant, const vector &a){ return constant * fps_inv(a); } vector operator/(const vector &a, mint constant){ vector res((int)a.size()); for(int i = 0; i < (int)a.size(); i++) res[i] = a[i] / constant; return res; } vector fps_diff(vector a){ int n = (int)a.size(); assert(n > 0); vector res(n, 0); for(int i = 0; i < n - 1; i++){ res[i] = a[i + 1] * (mint)(i + 1); } return res; } vector fps_integral(vector a){ int n = (int)a.size(); assert(n > 0); vector res(n + 1, 0); for(int i = 1; i <= n; i++){ res[i] = a[i - 1] / (mint)i; } return res; } // Library Checker vector fps_log(vector a){ assert(a[0] == 1); int n = (int)a.size(); vector a_inv = fps_inv(a); vector a_diff = fps_diff(a); vector res = fps_integral(a_inv * a_diff); res.resize(n); return res; } // Library Checker vector fps_exp(vector a){ assert(a[0] == 0); int n = (int)a.size(); int d = 1; vector g = {1}; vector f = {a[0]}; while(d < n){ d <<= 1; g.resize(d, 0); while((int)f.size() < min(d, n)) f.push_back(a[(int)f.size()]); g = g * (1 - fps_log(g) + f); g.resize(d, 0); } return g; } int main(){ cin.tie(0); ios_base::sync_with_stdio(false); ll N, K; cin >> N >> K; vector F(N + 1); for(ll j = -N; j <= N; j++){ ll deg = (K + 1) * j * (3 * j - 1) / 2; if(deg < 0 || deg > N) continue; if(abs(j) % 2) F[deg]--; else F[deg]++; } vector G(N + 1); for(ll j = -N; j <= N; j++){ ll deg = j * (3 * j - 1) / 2; if(deg < 0 || deg > N) continue; if(abs(j) % 2) G[deg]--; else G[deg]++; } vector ans = F / G; FOR(X, 1, N + 1) cout << ans[X] << (X == N ? "\n" : " "); }