Language: C++

#include <algorithm> //STLͨ���㷨
#include <cmath> //������ѧ����
#include <cstdio> //��������/�������
#include <iostream> //����������/���
#include <cstring> //�ַ�������
#include <string> //�ַ�����
#include <ctime> //�������ʱ��ĺ���
#define itn int
#define fro for
#define ll long long
#define reg register
#define inf 1234567890
#define rep(i,a,b,c) for (int i=a;i<=b;i+=c)
/*#include <bitset> //STLλ������
#include <cstype> //�ַ�����
#include <cerrno> //���������
#include <complex> //������
#include <clocale> //���屾�ػ�����
#include <cstdlib> //������������ڴ���亯��
#include <deque> //STL˫�˶�������
#include <exception> //�쳣������
#include <fstream> //�ļ�����/���
#include <functional> //STL�������㺯��(���������)
#include <limits> //�����������������ֵ����
#include <list> //STL�����б�����
#include <map> //STLӳ������
#include <iomanip> //����������/���
#include <ios> //��������/���֧��
#include <iosfwd> //����/���ϵͳʹ�õ�ǰ������
#include <istream> //����������
#include <ostream> //���������
#include <queue> //STL��������
#include <set> //STL��������
#include <sstream> //�����ַ�������
#include <stack> //STL��ջ����
#include <stdexcept> //��׼�쳣��
#include <streambuf> //�ײ�����/���֧��
#include <utility> //STLͨ��ģ����
#include <vector> //STL��̬��������
#include <cwchar.h>//���ַ�����������/���
#include <cwctype.h> //���ַ�����*/

using namespace std;

int ans;

int max(int x,int y){return x>y?x:y;}

int min(int x,int y){return x<y?x:y;}

int abs(int x){return x>0?x:-x;}

int gcd(int x,int y){return (!y)?x:gcd(y,x%y);}

void exgcd(int a,int b,int &d,int &x,int &y){if (!b){d=a,x=1,y=0;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}

int quick_power(ll a,int b){ll r=1;for (;b;b>>=1,a=a*a)if (b&1) r=r*a;return r;}

inline char read() {
	static const int IN_LEN = 1000000;
	static char buf[IN_LEN], *s, *t;
	return (s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin), (s == t ? -1 : *s++) : *s++);
}
template<class T>
inline void read(T &x) {
	static bool iosig;
	static char c;
	for (iosig = false, c = read(); !isdigit(c); c = read()) {
		if (c == '-') iosig = true;
		if (c == -1) return;
	}
	for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');
	if (iosig) x = -x;
}

char sr[10000000],z[20];int C=-1,Z=0;
void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(int x){
	if (x<0) sr[++C]='-',x=-x;
	while(z[++Z]=x%10+48,x/=10);

	while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
//int find(int x){return fa[x]=fa[x]==x?x:find(fa[x]);}

//void add(int x,int y,int z){to[++cnt]=y;v[cnt]=z;Next[cnt]=head[x];head[x]=cnt;}

const int N=100100;
int n,a[N],b[N];
int isprime(int x)
{
	for (int i=2;1ll*i*i<=x;i++)
		if (x%i==0)
			return 0;
	return 1;
}

int ok(int p)
{
	if (a[0]%p) return 0;
	for (int i=0;i<=n;i++) b[i]=a[i];
	for (int i=n;i>=p-1;i--)
		(b[i-(p-1)]+=b[i])%=p,b[i]=0;
	for (int i=0;i<=n;i++)
		if (b[i]%p)
			return 0;
	return 1;
}

int main()
{
	read(n);
	int G=0;
	for (int i=0;i<=n;i++)
	{
		read(a[i]);
		G=gcd(G,abs(a[i]));
	}
	reverse(a,a+n+1);
	vector <int> res;
	for (int i=2;1ll*i*i<=G;i++)
		if (G%i==0)
		{
			res.push_back(i);
			while (G%i==0) G/=i;
		}
	if (G>1) res.push_back(G);
	for (int i=2;i<=n;i++)
		if (isprime(i)&&ok(i))
			res.push_back(i);
	sort(res.begin(),res.end());
	res.erase(unique(res.begin(),res.end()),res.end());
	for (auto it:res) print(it);
	Ot();
	return 0;
}









Compiler output:
a.cc: In function 'int main()':
a.cc:120:9: error: 'vector' was not declared in this scope
  120 |         vector <int> res;
      |         ^~~~~~
a.cc:8:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    7 | #include <ctime> //�������ʱ��ĺ���
  +++ |+#include <vector>
    8 | #define itn int
a.cc:120:17: error: expected primary-expression before 'int'
  120 |         vector <int> res;
      |                 ^~~
a.cc:124:25: error: 'res' was not declared in this scope; did you mean 'reg'?
  124 |                         res.push_back(i);
      |                         ^~~
      |                         reg
a.cc:127:18: error: 'res' was not declared in this scope; did you mean 'reg'?
  127 |         if (G>1) res.push_back(G);
      |                  ^~~
      |                  reg
a.cc:130:25: error: 'res' was not declared in this scope; did you mean 'reg'?
  130 |                         res.push_back(i);
      |                         ^~~
      |                         reg
a.cc:131:14: error: 'res' was not declared in this scope; did you mean 'reg'?
  131 |         sort(res.begin(),res.end());
      |              ^~~
      |              reg