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=...
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,int> mp;
  int fi=-1,si=-1;//2回出てくる要素の位置
  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((long long)n+1,(long long)k);
    sur = comb((long long)fi+(long long)n-1-(long long)si,(long long)k-1);
    ans = mod(ans - sur);
    cout<<ans<<endl;
    sur = 0;
  }
  return 0;
  
}

Compiler output:
a.cc:29:15: error: 'SIZE' was not declared in this scope
   29 | long long inv[SIZE+1];//各iの逆元を格納する配列。
      |               ^~~~
a.cc:30:15: error: 'SIZE' was not declared in this scope
   30 | long long kai[SIZE+1];//i!のmodを格納する配列。
      |               ^~~~
a.cc:31:18: error: 'SIZE' was not declared in this scope
   31 | long long invkai[SIZE+1];//各i!の逆元を格納する配列。
      |                  ^~~~
a.cc: In function 'void invinit()':
a.cc:34:5: error: 'inv' was not declared in this scope; did you mean 'int'?
   34 |     inv[1]=1;
      |     ^~~
      |     int
a.cc:35:20: error: 'SIZE' was not declared in this scope
   35 |     for(int i=2;i<=SIZE;i++){
      |                    ^~~~
a.cc:39:5: error: 'kai' was not declared in this scope
   39 |     kai[0]=invkai[0]=1;
      |     ^~~
a.cc:39:12: error: 'invkai' was not declared in this scope
   39 |     kai[0]=invkai[0]=1;
      |            ^~~~~~
a.cc:40:20: error: 'SIZE' was not declared in this scope
   40 |     for(int i=1;i<=SIZE;i++){
      |                    ^~~~
a.cc: In function 'long long int comb(long long int, long long int)':
a.cc:50:16: error: 'kai' was not declared in this scope
   50 |     return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
      |                ^~~
a.cc:50:27: error: 'invkai' was not declared in this scope
   50 |     return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
      |                           ^~~~~~
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,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,int> mp;
      |       ^~~
a.cc:62:5: error: 'mp' was not declared in this scope
   62 |     mp[a[i]]++;
      |     ^~
a.cc:79:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   79 |     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:79:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   79 |     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)
      |     ^~~~