Language: C++

#include<iostream>
#include<cstdio>
using namespace std;

int div = 1000000007;
long long fac[100002];

void calc_fac(){
    fac[0] = 1;
    for(int i = 1; i < 100002; i++){
        fac[i] = fac[i-1] * i % div;
    }
}

long long pow(long long a, long long n){
    if(n==1){return a%div;}
    long long half_pow = pow(a, n/2);
    if(n%2){
        return half_pow * half_pow % div *a %div;
    }else{
        return half_pow * half_pow % div;
    }
}

long long inv(long long a){
    return pow(a, div-2);
}
    
long long c(int n, int k){
    return fac[n]*inv(fac[k]) %div *inv(fac[n-k])%div;
}

int main(){
    int n, a[100001], cnt_a[100001] = {0}, dup;
    cin >> n;
    for(int i = 0; i < n+1; i++){
        scanf("%d", a+i);
        cnt_a[a[i]]++;
        if(cnt_a[a[i]] > 1){
            dup = a[i];
        }
    }
    int p, q, cnt=0;
    for(int i = 0; i < n+1; i++){
        if(a[i] == dup && cnt == 0){
            p = i;
            cnt++;
        }else if(a[i] == dup && cnt > 0){
            q = i;
        }
    }

    calc_fac();

    /*
    cout << c(3, 2) << endl;
    cout << c(4, 2) << endl;
    cout << c(10, 2) << endl;
    cout << fac[10] << " " << (fac[10]*inv(2)%div)*inv(8)%div <<endl;
    cout<<inv(2) << " " << inv(8) << endl;
    */
    //cout << c(2, 2) << endl;
    

    for(int k = 1; k <= n+1; k++){
        int ans = c(n+1, k);
        if((p+n-q) >= 0 && (k-1) >= 0 && p+n-q >= k-1){
            ans -= c(p+n-q, k-1);
        }
        //cout << p << " " << q << endl;
        ans %= div;
        cout << ans << endl;
    }

    
    return 0;
    
}

Compiler output:
a.cc:5:5: error: 'int div' redeclared as different kind of entity
    5 | int div = 1000000007;
      |     ^~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:992:14: note: previous declaration 'div_t div(int, int)'
  992 | extern div_t div (int __numer, int __denom)
      |              ^~~
a.cc: In function 'void calc_fac()':
a.cc:11:31: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator%'
   11 |         fac[i] = fac[i-1] * i % div;
      |                  ~~~~~~~~~~~~~^~~~~
a.cc: In function 'long long int pow(long long int, long long int)':
a.cc:16:22: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator%'
   16 |     if(n==1){return a%div;}
      |                     ~^~~~
a.cc:19:36: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator%'
   19 |         return half_pow * half_pow % div *a %div;
      |                ~~~~~~~~~~~~~~~~~~~~^~~~~
a.cc:21:36: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator%'
   21 |         return half_pow * half_pow % div;
      |                ~~~~~~~~~~~~~~~~~~~~^~~~~
a.cc: In function 'long long int inv(long long int)':
a.cc:26:22: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   26 |     return pow(a, div-2);
      |                   ~~~^~
a.cc: In function 'long long int c(int, int)':
a.cc:30:31: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator%'
   30 |     return fac[n]*inv(fac[k]) %div *inv(fac[n-k])%div;
      |            ~~~~~~~~~~~~~~~~~~~^~~~
a.cc: In function 'int main()':
a.cc:71:16: error: overloaded function with no contextual type information
   71 |         ans %= div;
      |                ^~~