Language: C++

#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

int inv[MAX_N],fac[MAX_N],finv[MAX_N];

void make()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2;i<MAX_N;i++){
		inv[i] = MOD - (ll)inv[MOD%i] * (MOD/i) % MOD;
		fac[i] = (ll)fac[i-1] * i % MOD;
		finv[i] = (ll)finv[i-1] * inv[i] % MOD;
	}
}

int comb(int a,int b)
{
	if(a<b || b<0){
		return 0;
	}
	return (ll)fac[a] * ((ll)finv[b] * finv[a-b] % MOD) % MOD;
}

int add(int x,int y)
{
    return (x+y)%MOD;
}

int sub(int x,int y)
{
    return (x+MOD-y)%MOD;
}

int mul(int x,int y)
{
    return (ll)x*y%MOD;
}

int mod_pow(int a, int n, int mod){
    int ret = 1;
	while(n){
		if(n & 1) ret = (long long)ret * a % mod;
		a = (long long)a * a % mod;
		n >>= 1;
	}
	return ret;
}

template<int mod, int primitive_root>
class NTT {
public:
	int get_mod() const { return mod; }
	void _ntt(vector<int>& a, int sign){
		const int n = (int)a.size();
		const int g = 3; //g is primitive root of mod
		int h = mod_pow(g, (mod - 1) / n, mod); // h^n = 1
		if(sign == -1) h = mod_pow(h, mod-2, mod); //h = h^-1 % mod
        int s,x,m,j,k;
        int i = 0;
		for(j = 1; j < n - 1; ++j){
			for(k = n >> 1; k >(i ^= k); k >>= 1);
			if (j < i) swap(a[i], a[j]);
		}
		for (m = 1; m < n; m *= 2){
			const int m2 = 2 * m;
			const int base = mod_pow(h, n / m2, mod);
			int w = 1;
			for(x = 0; x < m; x++){
				for(s = x; s < n; s += m2){
					unsigned int u = a[s];
					unsigned int d = (long long)a[s + m] * w % mod;
					a[s] = (u + d) % mod;
					a[s + m] = (u + mod - d) % mod;
				}
				w = (long long)w * base % mod;
			}
		}
	}
	void ntt(vector<int>& input){
		_ntt(input, 1);
	}
	void intt(vector<int>& input){
		_ntt(input, -1);
		const int n_inv = mod_pow((int)(input.size()), mod-2, mod);
		for(auto& x : input) x = (long long)x * n_inv % mod;
	}
	void convolution(const vector<int>& a, const vector<int>& b, vector<int>& _a, vector<int>& _b){
		int ntt_size = 1;
		while (ntt_size < (int)(a.size()) + (int)(b.size())) ntt_size *= 2;
        _a = a, _b = b;
		_a.resize(ntt_size); _b.resize(ntt_size);
		ntt(_a), ntt(_b);
		for(int i = 0; i < ntt_size; i++){
			_a[i] = (long long)_a[i] * _b[i] % mod;
		}
		intt(_a);
	}
};

typedef NTT<167772161, 3> NTT_1;
typedef NTT<469762049, 3> NTT_2;
typedef NTT<1224736769, 3> NTT_3;

void convolution(const vector<int>& a, const vector<int>& b, vector<int>& res){
	NTT_1 ntt1; NTT_2 ntt2; NTT_3 ntt3;
    vector<int> x,_x,y,_y,z,_z;
	ntt1.convolution(a, b, x, _x), ntt2.convolution(a, b, y, _y), ntt3.convolution(a, b, z, _z);
	const int m1 = ntt1.get_mod(), m2 = ntt2.get_mod(), m3 = ntt3.get_mod();
	const int m1_inv_m2 = mod_pow(m1, m2-2, m2);
	const int m12_inv_m3 = mod_pow((long long)m1 * m2 % m3, m3-2, m3);
	const int m12_mod = (long long)m1 * m2 % MOD;
	res.resize((int)(x.size()));
	for(int i = 0; i < (int)(x.size()); i++){
	    int v1 = ((long long)y[i] + m2 - x[i]) *  m1_inv_m2 % m2;
	    int v2 = ((long long)z[i] + m3 - (x[i] + (long long)m1 * v1) % m3) * m12_inv_m3 % m3;
	    res[i] = (x[i] + (long long)m1 * v1 + (long long)m12_mod * v2) % MOD;
	}
}

int cnt[MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vi a(n);
    rep(i,n+1){
        cin >> a[i];
        cnt[a[i]]++;
    }
    int l = -1, r = -1;
    rep(i,n+1){
        if(cnt[a[i]] == 2){
            if(l < 0){
                l = i;
            }else{
                r = i;
            }
        }
    }
    make();
    vi x(l+1),y(n-r+1),res;
    rep(i,len(x)){
        x[i] = comb(l,i);
    }
    rep(i,len(y)){
        y[i] = comb(n-r,i);
    }
    fast_int32mod_convolution(x,y,res);
    srep(k,1,n+2){
        int ans = add(add(comb(n-1,k),mul(2,comb(n-1,k-1))),comb(n-1,k-2));
        cout << sub(ans,(k-1<len(res))?(res[k-1]):(0)) << "\n";
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:189:5: error: 'fast_int32mod_convolution' was not declared in this scope
  189 |     fast_int32mod_convolution(x,y,res);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~