Language: C++

#include <bits/stdc++.h>
#include <fstream>
#include <stdlib.h>
#include <ctime>
using namespace std;
typedef long long ll;

//ifstream fin("input.txt");
//ofstream fout("output.txt");
ll gds(ll x,ll y){
    if(y == 0) return x;
    if(x%y==0) return y;
    else return gds(y,x%y);
}

ll prime[100000];
ll sz;

ll a[100000];
int main(){
    //ios_base::sync_with_stdio(false);
    //cout<<fixed<<setprecision(20);
    int n;
    cin>>n;
    for(int i=0;i<n+1;i++) cin>>a[n-i];
    
    sz=0;
    
    for(ll p=2;p<=n;p++){
        bool det=0;
        for(int i=0;i<sz;i++)if(p%prime[i]==0){
           det=1;
           break;
        } 
        if(det==0){
            prime[sz]=p;
            sz++;
        }
        if(sz>10000) break;
    }
    //for(int i=0;i<sz;i++) cout<<prime[i]<<" ";
    ll s=0;
    for(int i=0;i<=n;i++){
        s=gds(s,abs(a[i]));
    }
    //cout<<s;
    set <ll> ans;
    ll siz=sqrt(s)+10;
    ll d;
    for(d=2;d<=min(s,siz);d++){
        if(s%d==0){
            ans.insert(d);
            while(s%d==0)s/=d;
        }
    }
    if(s!=1){
        ans.insert(s);
    }
    for(int i=0;i<=n;i++){
        a[i]/=s;
    }
    
    for(int i=0;i<sz;i++){
        ll p=prime[i];
        //cout<<p<<'\n';
        if(a[0]%p!=0) continue;
        bool det=1;
        for(ll s=0;s<min(p,100);s++){
            srand( time( 0 ) );
            j=rand()%p;
            j+=p;
            j%=p;
            
            ll sum=0;
            ll d=1;
            for(int k=0;k<=n;k++){
                sum+=d*a[k];
                sum%=p;
                d*=j;
                d%=p;
            }
            sum+=p;
            sum%=p;
           // cout<<sum;
            if(sum != 0){
                det=0;
                break;
            }
        }
        if(det){
            ans.insert(p);
        }
    }
    std::set<ll>::iterator it;
    for (it=ans.begin(); it!=ans.end(); ++it) cout << *it << '\n';
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:25: error: no matching function for call to 'min(ll&, int)'
   68 |         for(ll s=0;s<min(p,100);s++){
      |                      ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:68:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   68 |         for(ll s=0;s<min(p,100);s++){
      |                      ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:68:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   68 |         for(ll s=0;s<min(p,100);s++){
      |                      ~~~^~~~~~~
a.cc:70:13: error: 'j' was not declared in this scope
   70 |             j=rand()%p;
      |             ^