Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
//using namespace std;

//typedef long long ll;
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

//配列のSIZEは問題ごとに定義する必要がある。
const int SIZE=100010;
long long inv[SIZE+1];//各iの逆元を格納する配列。
long long kai[SIZE+1];//i!のmodを格納する配列。
long long invkai[SIZE+1];//各i!の逆元を格納する配列。
const int MOD=i_7;
void invinit(){//上の配列を初期化する関数。
    inv[1]=1;
    for(int i=2;i<=SIZE;i++){
        inv[i] = MOD - ((MOD/i)*inv[MOD%i])%MOD;
    }
    
    kai[0]=invkai[0]=1;
    for(int i=1;i<=SIZE;i++){
        kai[i]=(kai[i-1]*i)%MOD;
        invkai[i]=(invkai[i-1]*inv[i])%MOD;
    }
}

long long comb(long long a, long long b){
    if(b<0 || a<b){
        return 0;
    }
    return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
}

int main(){
  invinit();
  int n;
  cin>>n;
  int a[n];
  map<int> mp;
  int fi=-1,si=-1;
  REP(i,n){
    cin>>a[i];
    mp[a[i]++];
    if(mp[a[i]]==2){
      si=i;
    }
  }
  REP(i,n){
    if(a[i]==a[si]){
      fi=i;
      break;
    }
  }
  long long ans;
  long long sur=0;
  REPP(k,n+1){
    ans = comb(n+1,k);
    REP(i,k){
      if(i<=fi && k-1-i<=n-1-si){
        sur += mod(comb(fi,i)*comb(n-1-si,k-1-i));
      }
    }
    ans = mod(ans - sur);
    cout<<ans<<endl;
    sur = 0;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   56 |   cin>>n;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:58:3: error: 'map' was not declared in this scope
   58 |   map<int> mp;
      |   ^~~
a.cc:58:3: note: suggested alternatives:
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152:
/usr/include/c++/14/bits/stl_map.h:102:11: note:   'std::map'
  102 |     class map
      |           ^~~
/usr/include/c++/14/map:89:13: note:   'std::pmr::map'
   89 |       using map
      |             ^~~
a.cc:58:7: error: expected primary-expression before 'int'
   58 |   map<int> mp;
      |       ^~~
a.cc:62:5: error: 'mp' was not declared in this scope
   62 |     mp[a[i]++];
      |     ^~
a.cc:83:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   83 |     cout<<ans<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:83:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   83 |     cout<<ans<<endl;
      |                ^~~~
      |                std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~