#include #include #include #include #include using namespace std; //https://judge.yosupo.jp/submission/53740 using Fp = atcoder::modint998244353; using Fps = std::vector; int sz(const Fps& a) { return a.size(); } Fps operator-(Fps a) { for (auto&& e : a) e = -e; return a; } Fps& operator+=(Fps& a, const Fps& b) { if (sz(a) < sz(b)) a.reserve(sz(b)), a.resize(sz(b)); for (int i = 0; i < sz(b); ++i) a[i] += b[i]; return a; } Fps operator+(Fps a, const Fps& b) { return std::move(a += b); } Fps& operator-=(Fps& a, const Fps& b) { if (sz(a) < sz(b)) a.reserve(sz(b)), a.resize(sz(b)); for (int i = 0; i < sz(b); ++i) a[i] -= b[i]; return a; } Fps operator-(Fps a, const Fps& b) { return std::move(a -= b); } Fps& operator*=(Fps& a, Fp b) { for (auto&& e : a) e *= b; return a; } Fps operator*(Fps a, Fp b) { return std::move(a *= b); } Fps operator*(Fp a, Fps b) { return std::move(b *= a); } Fps& operator/=(Fps& a, Fp b) { b = b.inv(); for (auto&& e : a) e *= b; return a; } Fps operator/(Fps a, Fp b) { return std::move(a /= b); } Fps operator*(const Fps& a, const Fps& b) { Fps res = atcoder::convolution(a, b); res.resize(std::max(sz(a), sz(b))); return res; } Fps& operator*=(Fps& a, const Fps& b) { return a = a * b; } Fps inv(const Fps& a) { Fps res{a[0].inv()}; for (res.reserve(sz(a)); sz(res) < sz(a);) { Fps buf(2 * sz(res)), fres(sz(buf)); std::copy(a.begin(), a.begin() + std::min(sz(buf), sz(a)), buf.begin()); std::copy(res.begin(), res.end(), fres.begin()); atcoder::internal::butterfly(buf); atcoder::internal::butterfly(fres); for (int i = 0; i < sz(buf); ++i) buf[i] *= fres[i]; atcoder::internal::butterfly_inv(buf); std::fill(buf.begin(), buf.begin() + sz(res), 0); atcoder::internal::butterfly(buf); for (int i = 0; i < sz(buf); ++i) buf[i] *= fres[i]; atcoder::internal::butterfly_inv(buf); Fp coeff = -Fp((1 - Fp::mod()) / sz(buf)).pow(2); for (int i = sz(res); i < std::min(sz(buf), sz(a)); ++i) res.push_back(buf[i] * coeff); } return res; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N,K; cin>>N>>K; Fps P(N+1,Fp::raw(0)); P[0]=1; for(int n=1;n*(3*n-1)/2<=N;n++) { P[n*(3*n-1)/2]+=n%2==0?1:-1; } for(int n=-1;n*(3*n-1)/2<=N;n--) { P[n*(3*n-1)/2]+=n%2==0?1:-1; } Fps Q(N+1,Fp::raw(0)); for(int i=0;i*(K+1)<=N;i++)Q[i*(K+1)]=P[i]; Q*=inv(P); for(int i=1;i<=N;i++)cout<