Language: C++

#include<bits/stdc++.h>
using namespace std;
#define maxn 10010
#define maxp 40000
vector<int> pp;
int notp[maxp];
int n,a[maxn];
void pre()
{
        for(int i=2;i<maxp;i++)
        {
                if(!notp[i])notp[i]=i,pp.push_back(i);
                for(int j=0;j<(int)pp.size() && 1ll*i*pp[j]<maxn;j++)
                {
                        notp[i*pp[j]]=pp[j];
                        if(i%pp[j]==0)break ;
                }
        }
//      for(int i=2;i<50;i++)printf("%d: %d\n",i,notp[i]);
}
vector<int> ans;
int cnt[maxn];
int main()
{
        pre();
        scanf("%d",&n);
        for(int i=n;i>=0;i--)scanf("%d",&a[i]);
        int g=0;
        for(int i=0;i<=n;i++)g=__gcd(g,a[i]);
        for(int i=0;i<=n;i++)a[i]/=g;
        for(int i=0;i<(int)pp.size() && g>1;i++)
        {
                if(g%pp[i]==0)
                {
                        ans.push_back(pp[i]);
                        while(g%pp[i]==0)g/=pp[i];
                }
        }
        if(g>1)ans.push_back(g);
                for(int p : pp)
                {
                        if(p-1>n)break ;
//                      printf("p = %d\n",p);
                        if(a[0]%p!=0)continue ;
                                memset(cnt,0,sizeof(cnt));
                                for(int i=0;i<=n;i++)
                                        (cnt[i%(p-1)]+=(a[i]%p+p)%p)%=p;
                                bool flag=1;
                                for(int i=0;i<p-1;i++)
                                        if(cnt[i]%p!=0){flag=0;break;}
                                if(flag)ans.push_back(p);
                }
        sort(ans.begin(),ans.end());
        ans.resize(unique(ans.begin(),ans.end())-ans.begin());
        for(int p : ans)printf("%d ",p);puts("");
        return 0;
}
ltf0501@DESKTOP-6SCNVA6:/mnt/c/Users/User/Desktop/程式暫存$ fg
vim PE.cpp

[3]+  Stopped                 vim PE.cpp
ltf0501@DESKTOP-6SCNVA6:/mnt/c/Users/User/Desktop/程式暫存$ cat PE.cpp
#include<bits/stdc++.h>
using namespace std;
#define maxn 10010
#define maxp 40000
vector<int> pp;
int notp[maxp];
int n,a[maxn];
void pre()
{
        for(int i=2;i<maxp;i++)
        {
                if(!notp[i])notp[i]=i,pp.push_back(i);
                for(int j=0;j<(int)pp.size() && 1ll*i*pp[j]<maxn;j++)
                {
                        notp[i*pp[j]]=pp[j];
                        if(i%pp[j]==0)break ;
                }
        }
//      for(int i=2;i<50;i++)printf("%d: %d\n",i,notp[i]);
}
vector<int> ans;
int cnt[maxn];
int main()
{
        pre();
        scanf("%d",&n);
        for(int i=n;i>=0;i--)scanf("%d",&a[i]);
        int g=0;
        for(int i=0;i<=n;i++)g=__gcd(g,a[i]);
        for(int i=0;i<=n;i++)a[i]/=g;
        g=abs(g);
        for(int i=0;i<(int)pp.size() && g>1;i++)
        {
                if(g%pp[i]==0)
                {
                        ans.push_back(pp[i]);
                        while(g%pp[i]==0)g/=pp[i];
                }
        }
        if(g>1)ans.push_back(g);
                for(int p : pp)
                {
                        if(p-1>n)break ;
//                      printf("p = %d\n",p);
                        if(a[0]%p!=0)continue ;
                                memset(cnt,0,sizeof(cnt));
                                for(int i=0;i<=n;i++)
                                        (cnt[i%(p-1)]+=(a[i]%p+p)%p)%=p;
                                bool flag=1;
                                for(int i=0;i<p-1;i++)
                                        if(cnt[i]%p!=0){flag=0;break;}
                                if(flag)ans.push_back(p);
                }
        sort(ans.begin(),ans.end());
        ans.resize(unique(ans.begin(),ans.end())-ans.begin());
        for(int p : ans)printf("%d ",p);puts("");
        return 0;
}

Compiler output:
a.cc:58:8: error: stray '@' in program
   58 | ltf0501@DESKTOP-6SCNVA6:/mnt/c/Users/User/Desktop/程式暫存$ fg
      |        ^
a.cc:62:8: error: stray '@' in program
   62 | ltf0501@DESKTOP-6SCNVA6:/mnt/c/Users/User/Desktop/程式暫存$ cat PE.cpp
      |        ^
a.cc:58:1: error: 'ltf0501' does not name a type
   58 | ltf0501@DESKTOP-6SCNVA6:/mnt/c/Users/User/Desktop/程式暫存$ fg
      | ^~~~~~~
a.cc:67:13: error: redefinition of 'std::vector<int> pp'
   67 | vector<int> pp;
      |             ^~
a.cc:5:13: note: 'std::vector<int> pp' previously declared here
    5 | vector<int> pp;
      |             ^~
a.cc:68:5: error: redefinition of 'int notp [40000]'
   68 | int notp[maxp];
      |     ^~~~
a.cc:6:5: note: 'int notp [40000]' previously declared here
    6 | int notp[maxp];
      |     ^~~~
a.cc:69:5: error: redefinition of 'int n'
   69 | int n,a[maxn];
      |     ^
a.cc:7:5: note: 'int n' previously declared here
    7 | int n,a[maxn];
      |     ^
a.cc:69:7: error: redefinition of 'int a [10010]'
   69 | int n,a[maxn];
      |       ^
a.cc:7:7: note: 'int a [10010]' previously declared here
    7 | int n,a[maxn];
      |       ^
a.cc:70:6: error: redefinition of 'void pre()'
   70 | void pre()
      |      ^~~
a.cc:8:6: note: 'void pre()' previously defined here
    8 | void pre()
      |      ^~~
a.cc:83:13: error: redefinition of 'std::vector<int> ans'
   83 | vector<int> ans;
      |             ^~~
a.cc:21:13: note: 'std::vector<int> ans' previously declared here
   21 | vector<int> ans;
      |             ^~~
a.cc:84:5: error: redefinition of 'int cnt [10010]'
   84 | int cnt[maxn];
      |     ^~~
a.cc:22:5: note: 'int cnt [10010]' previously declared here
   22 | int cnt[maxn];
      |     ^~~
a.cc:85:5: error: redefinition of 'int main()'
   85 | int main()
      |     ^~~~
a.cc:23:5: note: 'int main()' previously defined here
   23 | int main()
      |     ^~~~