code:
#include <bits/stdc++.h> #define ll long long #define setIO(s) freopen(s".in","r",stdin) using namespace std; int n; const ll mod=167772161,G=3,N=400006; ll f[N<<1],g[N<<1],fac[N],inv[N]; ll qpow(ll x,ll y) { ll tmp=1ll; while(y) { if(y&1) tmp=tmp*x%mod; y>>=1,x=x*x%mod; } return tmp; } void NTT(ll *a,int len,int flag) { int i,j,k,mid; for(i=k=0;i<len;++i) { if(i>k) swap(a[i],a[k]); for(j=len>>1;(k^=j)<j;j>>=1); } for(mid=1;mid<len;mid<<=1) { ll wn=qpow(G,(mod-1)/(mid<<1)); if(flag==-1) wn=qpow(wn,mod-2); for(i=0;i<len;i+=(mid<<1)) { ll w=1ll; for(j=0;j<mid;++j) { ll x=a[i+j],y=w*a[i+mid+j]%mod; a[i+j]=(x+y)%mod,a[i+j+mid]=(x-y+mod)%mod; w=w*wn%mod; } } } if(flag==-1) { ll re=qpow(len,mod-2); for(i=0;i<len;++i) a[i]=a[i]*re%mod; } } int main() { // setIO("input"); scanf("%d",&n); fac[0]=1ll; inv[0]=1ll; int i,j,limit=1; for(i=1;i<=n;++i) fac[i]=fac[i-1]*1ll*i%mod, inv[i]=qpow(fac[i],mod-2); for(i=0;i<=n;++i) { g[i]=qpow(i,n)*inv[i]%mod; if(i&1) f[i]=mod-inv[i]; else f[i]=inv[i]; } for(;limit<=2*(n+1);limit<<=1); NTT(f,limit,1),NTT(g,limit,1); for(i=0;i<limit;++i) f[i]=f[i]*g[i]%mod; NTT(f,limit,-1); for(i=0;i<=n;++i) printf("%lld ",f[i]); return 0; }