criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;

long long gcd(long long p, long long q){
long long temp;
if(p<q){temp=p;p=q;q=temp;}
if(q==0){return p;}
if(p%q==0){return q;}else{return gcd(q,p-q);}
}

void solve(long long N, std::vector<long long> A){
    
long long temp=0;

for(int i=0;i<N;i++){long long temp1=0,temp2=0;
for(int j=0;j<i-1;j++){temp1=gcd(A[j],temp1);}
for(int k=N-1;i<k;k-=1){temp2=gcd(A[k],temp2);}
A[i]=gcd(temp1,temp2);
if(temp<A[i]){temp=A[i];}
}
printf(“%lld\n”,temp);
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Compiler output:
a.cc:21:8: error: extended character “ is not valid in an identifier
   21 | printf(“%lld\n”,temp);
      |        ^
a.cc:21:13: error: stray '\' in program
   21 | printf(“%lld\n”,temp);
      |             ^
a.cc:21:14: error: extended character ” is not valid in an identifier
   21 | printf(“%lld\n”,temp);
      |              ^
a.cc: In function 'void solve(long long int, std::vector<long long int>)':
a.cc:21:8: error: '\U0000201c' was not declared in this scope
   21 | printf(“%lld\n”,temp);
      |        ^
a.cc:21:10: error: 'lld' was not declared in this scope
   21 | printf(“%lld\n”,temp);
      |          ^~~
Language: C

#include <stdio.h>

int gcd(int a, int b)
{
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}

int main(void)
{
    int i, n, r, max = 1;
    scanf("%d", &n);
    int a[n], GL[n], GR[n];

    for ( i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }

    GL[0] = a[0];
    for ( i = 0; i < n - 1; i++)
    {
        GL[i + 1] = gcd(GL[i], a[i + 1]);
    }
  
    GR[n - 1] = a[n - 1];
    for ( i = n - 1; i > 0; i--)
    {
        GR[i - 1] = gcd(GR[i], a[i - 1]);
    }

    for ( i = 0; i < n - 2; i++)
    {
        if(max < gcd(GL[i], GR[i + 2])){
            max = gcd(GL[i], GR[i + 2]);
        }
    }
    
    printf("%d\n", max);
    return 0;
}

Compiler output:
main.c: In function 'gcd':
main.c:5:11: error: 'r' undeclared (first use in this function)
    5 |     while(r = a % b){
      |           ^
main.c:5:11: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <numeric>
using namespace std;
#define MAX_N 400
#define MAX_S 100010

template<class T> inline bool chmax(T& a, T b) { if(a < b) {a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if(a > b) {a = b; return true; } return false; }
const long long INF = 1LL << 60;

int euclidean_gcd(int a, int b) {
    if(a < b) return euclidean_gcd(b, a);
    int r;
    if (b) {
        while ((r=a%b)) {
            a = b;
            b = r;
        }
        return b;
    } else {
        return a;
    }
}

// Input
int N;
int A[MAX_N];

int GCD[MAX_N] = {0};

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (i != j) {
                // cout << i << j <<"check:\t" << GCD[i] << "\t" << A[j] <<endl;
                GCD[i] = euclidean_gcd(GCD[i], A[j]);
                // cout << i << j << "check:\t" << GCD[i] << "\t" << A[j] <<endl;
            }
        }
    }

    long long temp = 0;
    for (int i = 0; i < N; i++) {
        chmax(temp, GCD[i]);
    }
    cout << temp << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:14: error: no matching function for call to 'chmax(long long int&, int&)'
   50 |         chmax(temp, GCD[i]);
      |         ~~~~~^~~~~~~~~~~~~~
a.cc:10:31: note: candidate: 'template<class T> bool chmax(T&, T)'
   10 | template<class T> inline bool chmax(T& a, T b) { if(a < b) {a = b; return true; } return false; }
      |                               ^~~~~
a.cc:10:31: note:   template argument deduction/substitution failed:
a.cc:50:14: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   50 |         chmax(temp, GCD[i]);
      |         ~~~~~^~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a > b) swap(a, b);
  while (a != 0) {
	tie(a, b) = make_pair(b, a%b);
  }
  return b;
}
int main() {
  int N;
  vector<int> can; can.clear();
  unordered_map<int, int> m; m.clear();
  cin >> N;
  for(int i = 0, ai; i < N; i++) {
    cin >> ai;
    m[ai]++;
  }
  int pre = 0;
  for (const auto &it: m) {
    if (it.second >= 2) pre = gcd(ans, it.first);
    else can.push_back(it.first);
  }
  int ans = 1, tmp;
  sort(can.begin(), can.end());
  for (const int &t: can) {
    tmp = pre;
    for (const int &i: can) {
      tmp = gcd(tmp, i);
      if (tmp <= ans) break;
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:35: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     if (it.second >= 2) pre = gcd(ans, it.first);
      |                                   ^~~
      |                                   abs
Language: C++

#include<iostream>
using namespace std;
int gcd(int a,int b);

int main()
{
  int n,m;
  int *a;
  int *l;
  int *r;
  int gcd_tmpl,gcd_max;
  gcd_max=0;
  cin>>m;
  n=100000;
  a=(int*)malloc(sizeof(int)*(n+1));
  l=(int*)malloc(sizeof(int)*(n+1));
  r=(int*)malloc(sizeof(int)*(n+1));
  for(int i=0;i<n;i++)
    {
      cin>>a[i];
    }
  //  a[n]=a[0];
  gcd_tmpl=a[0];
  int gcd_tmpr=a[n-1];
  int m=n-2;
  for(int jl=0;jl<m;jl++){
   gcd_tmpl=gcd(a[jl],gcd_tmpl);
    l[jl]=gcd_tmpl;
    //    cout<<"l="<<l[jl]<<endl;
  }
  for(int jr=n-1;jr>0;jr--){
    gcd_tmpr=gcd(a[jr],gcd_tmpr);
    r[jr-1]=gcd_tmpr;
    //    cout<<"r="<<r[jr]<<endl;
  }
  int gcd_tmp=0;
  for(int k=0;k<m;k++){
    gcd_tmp=gcd(l[k],r[k+1]);
    if(gcd_tmp>gcd_max){
      gcd_max=gcd_tmp;
    }
  }
  if(gcd_max<l[n-2]){
    gcd_max=l[n-2];
  }
  if(gcd_max<r[0]){
    gcd_max=r[0];
  }
  /*int a_tmp;
    for(int j=0;j<n;j++){
    a_tmp=a[j];
    gcd_tmp=a[j+1];
    a[j]=gcd_tmp;
    // cout<<"gcdtmp="<<gcd_tmp<<endl;
    for(int j2=0;j2<n;j2++){
      gcd_tmp=gcd(a[j2],gcd_tmp);
      //cout<<"a[j2]="<<a[j2]<<endl;
      if(gcd_tmp<gcd_max){
	break;
      }
    }
    if(gcd_max<gcd_tmp){
      gcd_max=gcd_tmp;
  }
    //cout<<gcd_max<<endl;
    //cout<<gcd_tmp<<endl;
    a[j]=a_tmp;
    }*/
  if(n==2){
    if(a[0]>a[1]){
      gcd_max=a[0];
  }
  else{
    gcd_max=a[1];
  }
}
  cout<<gcd_max<<endl;
  return 0;
}
int gcd(int a,int b){
  int tmp;
  while(a!=0){
  if(a<b){
    tmp=a;
    a=b;
    b=tmp;
  }
  a=a%b;
  } 
  return b;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:7: error: redeclaration of 'int m'
   25 |   int m=n-2;
      |       ^
a.cc:7:9: note: 'int m' previously declared here
    7 |   int n,m;
      |         ^
Language: C++

#include <limits.h>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <sstream>
#include <string>
#include <vector>

namespace test {
std::string to_string(char val) {
    return std::string(1, val);
    // return std::string{val};
}
}  // namespace test

using namespace std;

int main(void) {
    int n; int *a; cin >> n; a = new int[n+2]; for(int i = 1; i <= n; i++) cin >> a[i];
    int result = 1;

    int *left, *right; left = new int[n+2], right = new int[n+2];

    for(int i = 1; i <= n; i++){
        left[i] = gcd(a[i], left[i - 1]);
    }

    for(int i = n; i >= 0; i--){
        right[i] = gcd(a[i], right[i + 1]);
    }

    int result = 0;
    for(int i = 1; i <=n; i++){
        result = max(gcd(left[i - 1],right[i + 1]) , result);
    }

    cout << result << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: redeclaration of 'int result'
   35 |     int result = 0;
      |         ^~~~~~
a.cc:23:9: note: 'int result' previously declared here
   23 |     int result = 1;
      |         ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
//typedef long long ll;
#include <boost/multiprecision/cpp_int.hpp> typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

vector<ll> add(ll k){
    vector<ll>res;
    for(ll i=1;i*i<=k;i++){
        if(k%i==0){
            res.pb(i);res.pb(k/i);
        }
    }
    return res;
}

int main(){fastio
    ll n;cin>>n;
    vector<ll> a;
    rep(i,0,n-1){
        ll k;cin>>k;a.pb(k);
    }
    vector<ll>v,vv;
    v=add(a[0]);vv=add(a[1]);
    for(auto x:vv)v.pb(x);
    ll ans=0;
    for(auto x:v){
        ll count=0;
        for(auto y:a){
            if(y%x!=0){
                count++;
            }
        }
        if(count<=1)Max(ans,x);
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc:4:45: warning: extra tokens at end of #include directive
    4 | #include <boost/multiprecision/cpp_int.hpp> typedef boost::multiprecision::cpp_int ll;
      |                                             ^~~~~~~
a.cc:4:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    4 | #include <boost/multiprecision/cpp_int.hpp> typedef boost::multiprecision::cpp_int ll;
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
//typedef long long ll;
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

vector<ll> add(ll k){
    vector<ll>res;
    for(ll i=1;i*i<=k;i++){
        if(k%i==0){
            res.pb(i);res.pb(k/i);
        }
    }
    return res;
}

int main(){fastio
    ll n;cin>>n;
    vector<ll> a;
    rep(i,0,n-1){
        ll k;cin>>k;a.pb(k);
    }
    vector<ll>v,vv;
    v=add(a[0]);vv=add(a[1]);
    for(auto x:vv)v.pb(x);
    ll ans=0;
    for(auto x:v){
        ll count=0;
        rep(i,0,n-1){
            if(a[i]%x!=0){
                count++;
            }
        }
        if(count<=1)Max(ans,x);
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc:4:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    4 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
//typedef long long ll;
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

vector<ll> add(ll k){
    vector<ll>res;
    for(ll i=1;i*i<=k;i++){
        if(k%i==0){
            res.pb(i);res.pb(k/i);
        }
    }
    return res;
}

int main(){fastio
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    vector<ll>v,vv;
    v=add(a[0]);vv=add(a[1]);
    for(auto x:vv)v.pb(x);
    ll ans=0;
    for(auto x:v){
        ll count=0;
        rep(i,0,n-1){
            if(a[i]%x!=0){
                count++;
            }
        }
        if(count<=1)Max(ans,x);
    }
    cout<<ans<<endl;
    return 0;
}



Compiler output:
a.cc:4:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    4 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
 int gcd(int a,int b);
int main(){
	int n;
	int num[10000];
	int gcdNum[10000];
	int max =1;
	std::cin>>n;
	for(int i=0;i<n;i++){
	    std::cin>>num[i];
	    if(num[i]==1){
	        std::cout<<1;
	        return 0;
	    }
	    for( i=2;i<num[i];++i ) {
	        if( num[i]%i==0 ) {
	            max=(num[i]>max)num[i]:max;
	            break;
	        }
        }
	}
	if(max >1){
	        std::cout<<max;
	        return 0;
	}
	for(int i=0;i<n;i++){
	    gcdNum[i]=(i!=0)?num[0]:num[1];
	    for(int j=0;j<n;j++){
    	    if(j!=i){
                gcdNum[i]=gcd(gcdNum[i],num[j]);	
    	    }
	    } 
	    max=(gcdNum[i]>max)?(gcdNum[i]):(max);
	}
	std::cout<<max;
  	return 0;
}
int gcd(int a,int b)
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:37: error: expected ';' before 'num'
   17 |                     max=(num[i]>max)num[i]:max;
      |                                     ^~~
      |                                     ;
Language: C++

#include <iostream>
 int gcd(int a,int b);
int main(){
	int n;
	int num[10000];
	int gcdNum[10000];
	std::cin>>n;
	for(int i=0;i<n;i++){
	    std::cin>>num[i];
	}
	for(int i=0;i<n;i++){
	    if(i!=0){
	        gcdNum[i] = num[0];
	    }else{
	        gcdNum[i] = num[1];
	    }
	    for(int j=0;j<n;j++){
    	    if(j!=i){
                gcdNum[i]=gcd(gcdNum[i],num[j]);	    
    	    }
	    } 
	}
	int max =0;
	for(int i=0;i<n;i++){
	    max=(gcdNum[i]>max)?(gcdNum[i]):(max);
	}
	std::cout<<max;
  	return 0;
}
int gcd(int a,int b)
{
    while(1){
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		a=b;
		b= a%b;
    }
}

Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:31:1: note: to match this '{'
   31 | {
      | ^
Language: C++

#include<iostream>
using namespace std;
int gcd(int a,int b);

int main()
{
  int n;
  int *a;
  int *l;
  int *r;
  int gcd_tmpl,gcd_max;
  gcd_max=0;
  cin>>n;
  a=(int*)malloc(sizeof(int)*(n+1));
  l=(int*)malloc(sizeof(int)*(n+1));
  r=(int*)malloc(sizeof(int)*(n+1));
  for(int i=0;i<n;i++)
    {
      cin>>a[i];
    }
  //  a[n]=a[0];
  gcd_tmpl=a[0];
  int gcd_tmpr=a[n-1];
  int m=n-2;
  for(int jl=0;jl<m;jl++){
    gcd_tmpl=gcd(a[jl],gcd_tmpl);
    l[jl]=gcd_tmpl;
    //    cout<<"l="<<l[jl]<<endl;
  }
  for(int jr=n-1;jr>0;jr--){
    gcd_tmpr=gcd(a[jr],gcd_tmpr);
    r[jr-1]=gcd_tmpr;
    //    cout<<"r="<<r[jr]<<endl;
  }
  int gcd_tmp=0;
  for(int k=0;k<m;k++){
    gcd_tmp=gcd(l[k],r[k+1]);
    if(gcd_tmp>gcd_max){
      gcd_max=gcd_tmp;
    }
  }
  if(gcd_max<l[n-2]){
    gcd_max=l[n-2];
  }
  if(gcd_max<r[0]){
    gcd_max=r[0];
  }
  /*int a_tmp;
    for(int j=0;j<n;j++){
    a_tmp=a[j];
    gcd_tmp=a[j+1];
    a[j]=gcd_tmp;
    // cout<<"gcdtmp="<<gcd_tmp<<endl;
    for(int j2=0;j2<n;j2++){
      gcd_tmp=gcd(a[j2],gcd_tmp);
      //cout<<"a[j2]="<<a[j2]<<endl;
      if(gcd_tmp<gcd_max){
	break;
      }
    }
    if(gcd_max<gcd_tmp){
      gcd_max=gcd_tmp;
  }
    //cout<<gcd_max<<endl;
    //cout<<gcd_tmp<<endl;
    a[j]=a_tmp;
    }*/
  if(a[0]<a[1]){{
    cout<<a[1];
  }
  else{
    cout<<a[0];
  }}
  else{
  cout<<gcd_max<<endl;
  }
  return 0;
}
int gcd(int a,int b){
  int tmp;
  while(a!=0){
  if(a<b){
    tmp=a;
    a=b;
    b=tmp;
  }
  a=a%b;
  } 
  return b;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:71:3: error: expected '}' before 'else'
   71 |   else{
      |   ^~~~
a.cc:68:16: note: to match this '{'
   68 |   if(a[0]<a[1]){{
      |                ^
a.cc: At global scope:
a.cc:74:3: error: expected unqualified-id before 'else'
   74 |   else{
      |   ^~~~
a.cc:77:3: error: expected unqualified-id before 'return'
   77 |   return 0;
      |   ^~~~~~
a.cc:78:1: error: expected declaration before '}' token
   78 | }
      | ^
Language: C++

#include<iostream>
using namespace std;
int gcd(int a,int b);

int main()
{
  int n;
  int *a;
  int *l;
  int *r;
  int gcd_tmpl,gcd_max;
  gcd_max=0;
  cin>>n;
  if(n==2){
    if(a[0]<a[1]){
      cout<<a[1];
    }
    else{
      cout<<a[0];
    }
    break;
  }
  a=(int*)malloc(sizeof(int)*(n+1));
  l=(int*)malloc(sizeof(int)*(n+1));
  r=(int*)malloc(sizeof(int)*(n+1));
  for(int i=0;i<n;i++)
    {
      cin>>a[i];
    }
  //  a[n]=a[0];
  gcd_tmpl=a[0];
  int gcd_tmpr=a[n-1];
  int m=n-2;
  for(int jl=0;jl<m;jl++){
    gcd_tmpl=gcd(a[jl],gcd_tmpl);
    l[jl]=gcd_tmpl;
    //    cout<<"l="<<l[jl]<<endl;
  }
  for(int jr=n-1;jr>0;jr--){
    gcd_tmpr=gcd(a[jr],gcd_tmpr);
    r[jr-1]=gcd_tmpr;
    //    cout<<"r="<<r[jr]<<endl;
  }
  int gcd_tmp=0;
  for(int k=0;k<m;k++){
    gcd_tmp=gcd(l[k],r[k+1]);
    if(gcd_tmp>gcd_max){
      gcd_max=gcd_tmp;
    }
  }
  if(gcd_max<l[n-2]){
    gcd_max=l[n-2];
  }
  if(gcd_max<r[0]){
    gcd_max=r[0];
  }
  /*int a_tmp;
    for(int j=0;j<n;j++){
    a_tmp=a[j];
    gcd_tmp=a[j+1];
    a[j]=gcd_tmp;
    // cout<<"gcdtmp="<<gcd_tmp<<endl;
    for(int j2=0;j2<n;j2++){
      gcd_tmp=gcd(a[j2],gcd_tmp);
      //cout<<"a[j2]="<<a[j2]<<endl;
      if(gcd_tmp<gcd_max){
	break;
      }
    }
    if(gcd_max<gcd_tmp){
      gcd_max=gcd_tmp;
  }
    //cout<<gcd_max<<endl;
    //cout<<gcd_tmp<<endl;
    a[j]=a_tmp;
    }*/
  cout<<gcd_max<<endl;
  return 0;
}
int gcd(int a,int b){
  int tmp;
  while(a!=0){
  if(a<b){
    tmp=a;
    a=b;
    b=tmp;
  }
  a=a%b;
  } 
  return b;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: break statement not within loop or switch
   21 |     break;
      |     ^~~~~
Language: C++

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

int gcd(int a, int b){
  if (a > b){
    if (b == 0){
      return a;
    }
    return gcd(b, a % b);
  } else{
    if (a == 0){
      return b;
    }
    return gcd(a, b % a);
  }
}

int main(){
  int N;
  cin >> N;
  int A[N];
  for (int i=0; i<N; i++){
    cin >> A[i];
  }

  // if (N == 2){
  //   if (A[0] < A[1]){
  //     cout << A[1] << endl;
  //   } else{
  //     cout << A[0] << endl;
  //   }
  //   return 0;
  // }
  //
  // int output = 0;
  // // 一つのぞいた時の最大公約数
  // for (int j=0; j<N; j++){
  //   int tmp = 0;
  //   if (j==0){
  //     tmp = A[1];
  //     for (int i=2; i<N; i++){
  //       tmp = gcd(tmp, A[i]);
  //     }
  //   } else{
  //     tmp = A[0];
  //     for (int i=1; i<N; i++){
  //       if (i == j){
  //         continue;
  //       } else{
  //         tmp = gcd(tmp, A[i]);
  //       }
  //     }
  //   }
  //   if (output < tmp){
  //     output = tmp;
  //   }
  // }

  // 順番に公約数を求めるとはやい
  int L[N+1];
  int R[N+1];
  L[0] = 0;
  R[N] = 0;

  for (int i=0; i<N; i++){
    L[i+1] = gcd(L[i], A[i]);
  }
  for (int i=N-1; i>=0; i--){
    R[i] = gcd(R[i+1], A[i]);
  }

  int output = 0;
  for (int i=0; i<N; i++){
    m = gcd(L[i], R[i+1]);
    if (output < m){
      output = m;
    }
  }
  cout << output << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:75:5: error: 'm' was not declared in this scope
   75 |     m = gcd(L[i], R[i+1]);
      |     ^
Language: C++

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

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

int gcd(int a, int b)
{
    if(b == 0) return a;
    return gcd(b, a % b);
}

int main()
{
    int N;
    int A[100001];
    int l_pre[100002];
    int l_post[100002];

    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
    }

    vector<int> l_pre(N + 2);
    for(int i = 1; i <= N; i++) {
        l_pre[i] = gcd(A[i], l_pre[i - 1]);
        IFD cout << l_pre[i] << " ";
    }
    IFD cout << endl;

    vector<int> l_post(N + 2);
    for(int i = N; i >= 1; i--) {
        l_post[i] = gcd(l_post[i + 1], A[i]);
        IFD cout << l_post[i] << " ";
    }
    IFD cout << endl;

    int ans = -1;
    for(int i = 1; i <= N; i++) {
        ans = max(ans, gcd(l_pre[i - 1], l_post[i + 1]));
    }

    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: conflicting declaration 'std::vector<int> l_pre'
   29 |     vector<int> l_pre(N + 2);
      |                 ^~~~~
a.cc:21:9: note: previous declaration as 'int l_pre [100002]'
   21 |     int l_pre[100002];
      |         ^~~~~
a.cc:36:17: error: conflicting declaration 'std::vector<int> l_post'
   36 |     vector<int> l_post(N + 2);
      |                 ^~~~~~
a.cc:22:9: note: previous declaration as 'int l_post [100002]'
   22 |     int l_post[100002];
      |         ^~~~~~
Language: C++

//
//ABC125 C-GCD on Blackboard
//URL-https://atcoder.jp/contests/abc125/tasks/abc125_c
//参考：Ichijyou

//解き方
//累積GCDを使用する
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main() {
  int N;
  cin >> N;
  int A[100000];
  for(int i=0; i<N; ++i) {
    cin >> A[i];
  }

  int gcd1[100000], gcd2[100000];

  gcd1[0] = A[0];
  for(int i=1; i<N; ++i) {
    gcd[i] = __gcd(gcd1[i-1], A[i]);
  }
  gcd2[N-1] = A[N-1];
  for(int i=N-2; i>=0; --i) {
    gcd2[i] = __gcd(gcd2[i+1], A[i]);
  }

  //選ばないもの
  int g, ans = 0;
  for(int i=1; i<N-1; ++i) {
    g = __gcd(gcd1[i-1], gcd2[i+1]);
    if(g>ans)
      ans = g;
  }

  cout << max ({ gcd1[N-2], gcd2[1], ans}) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:8: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   26 |     gcd[i] = __gcd(gcd1[i-1], A[i]);
      |        ^
Language: C++

#include <limits.h>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <sstream>
#include <string>
#include <vector>

namespace test {
std::string to_string(char val) {
    return std::string(1, val);
    // return std::string{val};
}
}  // namespace test

using namespace std;

int main(void) {
    int n; int *a; cin >> n; a = new int[n+2]; for(int i = 1; i <= n; i++) cin >> a[i];
    int result = 1;

    int *left, *right; left = new int[n+2], right = new int[n+2];

    for(int i = 1; i <= n; i++){
        left[i] = gcd(a[i], left[i - 1]);
    }

    for(int i = n; i >= 0; i--){
        right[i] = gcd(a[i], right[i + 1]);
    }

    int result = 0;
    for(int i = 1; i <= j; i++){
        result = max(gcd(left[i - 1],right[i + 1]) , result);
    }

    cout << result << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: redeclaration of 'int result'
   35 |     int result = 0;
      |         ^~~~~~
a.cc:23:9: note: 'int result' previously declared here
   23 |     int result = 1;
      |         ^~~~~~
a.cc:36:25: error: 'j' was not declared in this scope
   36 |     for(int i = 1; i <= j; i++){
      |                         ^
Language: C++

N = int(input())
A = list(map(int,input().split()))

def gcd(m, n):
  while n:
    m, n = n, m%n
  return m

L = [0] * N
for i in range(N-1):
  L[i+1] = gcd(L[i], A[i])

R = [0] * N
for i in range(N-1, -1, -1):
  R[i-1] = gcd(R[i], A[i])

ans = 0
for i in range(N):
  ans = max(ans, gcd(L[i], R[i]))
print(ans)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<iomanip>
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;

int gcd(int x, int y) {
	if (x < y)gcd(y, x);
	int r;
	while (r = x % y) {
		x = y;
		y = r;
	}
	return y;
}


int main() {
	int n, a[100000], tmp, c, ans = 0, t = 0;

	cin >> n;
	rep(i, n)cin >> a[i];

	c = a[0];
	rep(i, n) {
		c = gcd(c, a[i]);
	}
	//a∀の最大公約数をtmp(>0)とする;
	tmp = c;
	
	c = a[0];
	rep(i, n) {
		c = gcd(c, a[i]);
		if (tmp == c) {
			t = i;	//gcdがtmpになるとき,a[i]のiを保存;
			break;
		}
	}
	//除外すべきは a[i] または a[i-1] である;

	//a[i]を除外するとき;
	c = a[0];
	for (int j = 1; j < n; j++) {
		if (j == t)continue;
		c = gcd(c, a[j]);
	}
	//a[i-1]を除外するとき;
	ans = a[n-1];
	for (int j = 0; j < n; j++) {
		if (j == t-1)continue;
		ans = gcd(ans, a[j]);
	}

	//a[0]を除外するとき;
	int ans1 = a[1];
	for (int j = 1; j < n; j++)
		ans1 = gcd(ans1, a[j]);

	ans = max(ans, c, ans1);

	cout << ans << endl;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 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/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:63:11:   required from here
   63 |         ans = max(ans, c, ans1);
      |               ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include "bits/stdc++.h"

using namespace std;

int i;

int gcd(int x, int y){
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main(){
  int N;
  cin >> N;
  vector<int> A(N), L(N), R(N);
  for (i = 0; i < N; i++){
    cin >> A[i]; 
  }
  for (i = 0; i < N-1; i++){
    L[i+1] = gcd(L[i], A[i]);
  }
  vector<int> R(N+1, 0);
  for (i = N-1; i >= 1; i--){
    R[i-1] = gcd(R[i], A[i]);
  }
  int ans = 0;
  for (i = 0; i < N; i++){
    ans = max(ans, gcd(L[i], R[i]));
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: error: redeclaration of 'std::vector<int> R'
   22 |   vector<int> R(N+1, 0);
      |               ^
a.cc:15:27: note: 'std::vector<int> R' previously declared here
   15 |   vector<int> A(N), L(N), R(N);
      |                           ^
Language: C++

#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

int gcd(int a, int b) {
    int v0 = a, v1 = b, v2 = a % b;
    while (v2 != 0) {
        v0 = v1;
        v1 = v2;
        v2 = v0 % v1;
    };
    return v1;
}


int main() {
    int N;
    cin >> N;
    vector<int> A(N),L(N),R(N),M(N);
    for (int i=0; i<N; i++) {
        cin >> A[i];
    }
    
    
    L[0]=A[0];
    for (int i=1; i<N; i++) {
        L[i]=gcd(L[i-1], A[i]);
    }
    
    R[N-1]=A[N-1];
    for (int i=1; i<N; i++) {
        R[N-1-i]=gcd(R[N-i], A[N-1-i]);
    }
    
    M[0]=R[1];
    M[N-1]=L[N-2];
    for (int i=1; i<N-1; i++) {
        M[i]=gcd(L[i-1], R[i+1]);
    }
    
    int max=0;
    for (int i=0; i<N; i++) {
        if (max<M[i]) {
            max=M[i];
        }
    }
    cout << max << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'cin' was not declared in this scope
   23 |     cin >> N;
      |     ^~~
a.cc:8:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    7 | #include <map>
  +++ |+#include <iostream>
    8 | using namespace std;
a.cc:52:5: error: 'cout' was not declared in this scope
   52 |     cout << max << endl;
      |     ^~~~
a.cc:52:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <bits/stdc++.h>
using namespace std;

int euclidean(int a, int b){
    int a1 = max(a,b);
    int a2 = min(a,b);
    if(a2 == 0) return 0;
    int a3 = a1%a2;
    for(;a3 > 0;){
        a1 = a2;
        a2 = a3;
        a3 = a1%a2;
    }
    return a2;
}

int main(void){
    int N;
    cin>>N;
    vector<int> A(N,0);5
    vector<int> L(N+1);
    vector<int> R(N+1);
    for(int i=0; i<N; i++){
        cin>>A[i];
    }
    for(int i = 1, L[0] = 0; i<=N; i++){
        L[i] = euclidean(L[i-1],A[i-1]);
    }
    for(int i = N-1, R[N] = 0; i>=0; i++){
        R[i] = euclidean(R[i+1],A[i]);
    }

    int gcd = 0;
    for(int i = 0; i<N; i++){
        gcd = max(gcd, euclidean(L[i],R[i+1]))
    }
    cout<< gcd <<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: expected ';' before 'vector'
   20 |     vector<int> A(N,0);5
      |                         ^
      |                         ;
   21 |     vector<int> L(N+1);
      |     ~~~~~~               
a.cc:26:27: error: array must be initialized with a brace-enclosed initializer
   26 |     for(int i = 1, L[0] = 0; i<=N; i++){
      |                           ^
a.cc:29:29: error: array must be initialized with a brace-enclosed initializer
   29 |     for(int i = N-1, R[N] = 0; i>=0; i++){
      |                             ^
a.cc:35:34: error: 'L' was not declared in this scope
   35 |         gcd = max(gcd, euclidean(L[i],R[i+1]))
      |                                  ^
Language: C++

#include <cstdint>
#include <algorithm>
#include <functional>
#include <iostream>
#include <sstream>
#include <vector>
#include <boost/math/common_factor_rt.hpp>

using Vec = std::vector<int>;

int calc_gcd(const Vec& vec, size_t excluded) {
    int g = 0;
    for (size_t i = 0; i < n; ++i) {
        if (i != excluded) {
            auto v = vec.at(i);
            if (g == 0) {
                g = v;
            } else {
                g = boost::math::gcd(g, v);
            }
        }
    }
    return g;
}

int exec(const Vec& vec) {
    size_t n = vec.size();
    int g = 0;
    for(size_t i = 0; i < n; ++i) {
        g = std::max(g, calc_gcd(vec, i));
    }
    return g;
}

int main(int argc, char* argv[]) {
    size_t n = 0;
    std::string line;
    std::getline(std::cin, line);
    std::istringstream isa(line);
    isa >> n;

    std::getline(std::cin, line);
    std::istringstream isb(line);
    Vec vec;
    for(size_t i=0; i<n; ++i) {
        int a;
        isb >> a;
        vec.push_back(a);
    }

    std::cout << exec(vec) << "\n";
    return 0;
}


Compiler output:
a.cc:7:10: fatal error: boost/math/common_factor_rt.hpp: No such file or directory
    7 | #include <boost/math/common_factor_rt.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#define max(a,b) ((a) < (b) ? (b) : (a))
#define min(a,b) ((a) > (b) ? (b) : (a))

int gcd(int x, int y){
	int ans = 0;
	int m = max(x,y);
	int n = min(x,y);
	while(n != 0){
		int temp = n;
		n = m % n;
		m = temp;
	}
	ans = m;
	return ans;
}


int main(){
	int N;
	int A[100000] = {};
	int max = -1;
	scanf("%d",&N);
	for(int i = 0; i < N; i ++){
		scanf("%d",&A[i]);
	}

	int head[100000] = {};
	int back[100000] = {};
	head[0] = back{N} = 0;

	for(int i = 0; i < N - 1; i ++){
		head[i + 1] = gcd(head[i],A[i]);
	}

	for(int i = N; i > 0; i --){
		back[i - 1] = gcd(back[i],A[i]);
	}

	for(int i = 0; i < N - 1; i ++){
		if(max < gcd(head[i],back[i + 1])){
			max = gcd(head[i],back[i + 1]);
		}
	}

	printf("%d",max);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:30:17: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
   30 |         head[0] = back{N} = 0;
      |                 ^
main.c:30:23: error: expected ';' before '{' token
   30 |         head[0] = back{N} = 0;
      |                       ^
      |                       ;
Language: C++

#include <cstdint>
#include <algorithm>
#include <functional>
#include <iostream>
#include <sstream>
#include <vector>
#include <boost/math/common_factor_rt.hpp>

using Vec = std::vector<int>;

int calc_gcd(const Vec& vec) {
    int g = boost::math::gcd(vec.at(0), vec.at(1));
    for (const auto& value : vec) {
        g = boost::math::gcd(g, value);
    }
    return g;
}

int sub(const Vec& vec) {
    if (vec.size() == 1) {
        return vec.at(0);
    }

    if (vec.size() == 2) {
        return calc_gcd(vec);
    }

    if (vec.size() == 3) {
        Vec v0 {vec.at(0), vec.at(1)};
        Vec v1 {vec.at(1), vec.at(2)};
        Vec v2 {vec.at(2), vec.at(0)};
        Vec gs {calc_gcd(v0), calc_gcd(v1), calc_gcd(v2)};
        return *std::max_element(gs.begin(), gs.end());
    }

    auto n = vec.size() / 2;
    Vec left = std::vector<int>(vec.begin(), vec.begin() + n);
    Vec right = std::vector<int>(vec.begin() + n, vec.end());
    int gcd_left = calc_gcd(left);
    int gcd_right = calc_gcd(right);

    if (gcd_left <= 1) {
        return sub(right);
    }

    return sub(left);
}

int exec(Vec& vec) {
    int g = calc_gcd(vec);
    for (auto& value : vec) {
        value /= g;
    }

    return g * sub(vec);
}

int main(int argc, char* argv[]) {
    size_t n = 0;
    std::string line;
    std::getline(std::cin, line);
    std::istringstream isa(line);
    isa >> n;

    std::getline(std::cin, line);
    std::istringstream isb(line);
    Vec vec;
    for(size_t i=0; i<n; ++i) {
        int a;
        isb >> a;
        vec.push_back(a);
    }

    std::cout << exec(vec) << "\n";
    return 0;
}


Compiler output:
a.cc:7:10: fatal error: boost/math/common_factor_rt.hpp: No such file or directory
    7 | #include <boost/math/common_factor_rt.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

// SeeAlso: https://atcoder.jp/contests/abc125/tasks/abc125_c

#include <bits/stdc++.h>

typedef long long ll;

#define MAX 100000

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()


using namespace std;

int N;
ll A[MAX];

int temp;
int removenum = MAX + 1;
ll ans = 1;

int gcd(int a, int b) {
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    
    return b ? gcd(b, a % b) : a;
}

int main() {

    cin >> N;

    REP(i, N) {
        cin >> A[i];
    }

    int R[MAX+1], L[MAX+1];

    L[0] = 0;
    R[N+1] = 0;
    REP(i, N) {
        L[i+1] = grc(L[i], A[i]);
        R[i] = grc(R[i+1], A[i]);
    }

    REP(i, N) {
        ans = max(ans, grc(R[i+1], L[i]));    
    }

    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:18: error: 'grc' was not declared in this scope
   51 |         L[i+1] = grc(L[i], A[i]);
      |                  ^~~
a.cc:56:24: error: 'grc' was not declared in this scope
   56 |         ans = max(ans, grc(R[i+1], L[i]));
      |                        ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(int I = int((B)-1); I >= int(A); --I)
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}

int main(){
	int N,ans=0;
	cin >> N;
	vector<int> a(N),gcdb(N),gcdf(N);
	FOR(i,0,N)cin>>a[i];
	gcdf[0] = a[0];
	FOR(i,1,N){
		gcdf[i] = gcd(a[i],gcdf[i-1]);
	}
	gcdb[N-1] = a[N-1];
	FORR(i,0,N-1){
		gcdb[i] = gcd(a[i],gcdb[i+1]);
	}
	ans = max(gcdb[1],gcdf[N-2]);
	FOR(i,1,N-1){
		ans = max(ans,gcd(gcdb[i+1],gcdf[i-1]));
	}
	cout << ans << endl;
}


Compiler output:
a.cc:5:1: error: 'll' does not name a type
    5 | ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
      | ^~
Language: C++

package main
import "fmt"

const INF = 1000000000

func gcd(a, b int) int {
    if a < b {
        a, b = b, a
    }
    if a % b == 0 {
        return b
    }
    return gcd(b, a % b)
}

func main(){
    var n int
    fmt.Scan(&n)
    aArray := make([]int, n)
    for i := range aArray {
        fmt.Scan(&aArray[i])
    }
    
    gcdMin0 := aArray[0]
    iMin0 := 0
    for i := 1; i < n; i++ {
        if gcdMin0 > gcd(gcdMin0, aArray[i]) {
            gcdMin0 = gcd(gcdMin0, aArray[i])
            iMin0 = i
        }
    }
    gcdMin1 := aArray[1]
    for i := 2; i < n; i++ {
        if gcdMin1 > gcd(gcdMin1, aArray[i]) {
            gcdMin1 = gcd(gcdMin1, aArray[i])
        }
    }
    
    var iSkip int
    switch {
    case gcdMin0 == gcdMin1:
        iSkip = iMin0
    case gcdMin0 < gcdMin1:
        iSkip = 0
    default:
        iSkip = 1
    }
    
    if iSkip == 0 {
        ans := aArray[1]
        for i := 2; i < n; i++ {
            ans = gcd(ans, aArray[i])
        }
        fmt.Println(ans)
        return
    }
    ans := aArray[0]
    for i := 1; i < n; i++ {
        if i == iSkip {
            continue
        }
        ans = gcd(ans, aArray[i])
    }
    fmt.Println(ans)
}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:16:1: error: 'func' does not name a type
   16 | func main(){
      | ^~~~
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <utility>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

const ll INF = 1e18+7;
#define all(v) v.begin(),v.end()
#define repi(i,m,n) for(ll i = m;i < n;i++)
#define rep(i,n) repi(i,0,n)
typedef pair<ll,ll> P;
#define fi first
#define se second

//Range Minimum(Maximum) Query (RMQ)
//Big Range Query
//セグメント木 P(x, y) = P(値, 要素番号)
//インデックス取得したい場合: seg.update(k, k)
class SegmentTree{
public:
	ll n = 1;
	vector<P> seg[1];		//0:最大	1:最小
	void init(ll N){		//N要素のセグメントツリー作成
		while(n < N)n *= 2;
		rep(i,1)seg[i].resize(2*n);
		fill(all(seg[0]), P(-1, -1));
	}
  ll gcd(ll a, ll b) {
    if(a==-1)return b;
    if(b==-1)return a;
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}
  P cmp_gcd(P x, P y){		//比較関数
		P zz;
    zz.fi=gcd(x.fi,y.fi);
    zz.se=x.se;
		return zz;
	}
	void update(ll k, ll x, bool flag=false){		//kの値をxに変更
		k += n-1;
		seg[0][k] = P(x, k-(n-1));
		if(flag){seg[0][k] = P(-1, -1);}
		while(k > 0){
			k = (k-1)/2;
			seg[0][k] = cmp_gcd(seg[0][k*2+1], seg[0][k*2+2]);
		}
	}
	P calc(ll a, ll b, ll k, ll l, ll r, ll f){
		if(b <= l || r <= a)return P(-1, -1);
		if(a <= l && r <= b)return seg[f][k];
		P vl = calc(a, b, k*2+1, l, (l+r)/2, f);
		P vr = calc(a, b, k*2+2, (l+r)/2, r, f);
		return cmp_gcd(vl, vr);
	}
	void erase(ll k){update(k, -1, true);}
	ll get_gcd(ll a, ll b){return calc(a, b, 0, 0, n, 0).fi;}
};


int main(){
  SegmentTree st;
  ll nn;
  cin>>nn;
  ll ans=0;
  vector<ll>v(nn,0);
  for(ll i=0;i<nn;i++){
    cin>>v[i];
  }
  st.init(nn);
  for(ll i=0;i<nn;i++){
    st.update(i,v[i]);
  }

  for(ll i=0;i<nn;i++){
    st.update(i,-1);
    ans=max(ans,seg.seg[0][0].fi);
    st.update(i,v[i]);
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:17: error: 'seg' was not declared in this scope; did you mean 'se'?
   90 |     ans=max(ans,seg.seg[0][0].fi);
      |                 ^~~
      |                 se
Language: C++

#include <iostream>
#include <cassert>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <unordered_map>
#include <set>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int64_t> a;
	for (int i = 0; i < n; ++i) {
		int64_t ai;
		cin >> ai;
		a.push_back(ai);
	}
	set<int64_t> divs;
	for (int64_t i = 1; i <= (int)sqrt(a[0]+1.0); ++i) {
		if (a[0] % i == 0) {
			divs.insert(i);
			divs.insert(a[0]/i);
		}
	}
	for (int64_t i = 1; i <= (int)sqrt(a[1] + 1.0); ++i) {
		if (a[1] % i == 0) {
			divs.insert(i);
			divs.insert(a[0] / i);
		}
	}
	vector<int64_t> candidate;
	for (auto ite = divs.begin(); ite != divs.end(); ite++) {
		int64_t val = (*ite);
		int notdiv = 0;
		for (unsigned int i = 0; i < a.size(); ++i) {
			if (a[i] % val != 0) {
				notdiv++;
			}
			if (notdiv >= 2) {
				break;
			}
		}
		if (notdiv < 2) {
			candidate.push_back(val);
		}
	}
	sort(candidate.rbegin(), candidate.rend());
	cout << candidate[0] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:39: error: 'sqrt' was not declared in this scope
   23 |         for (int64_t i = 1; i <= (int)sqrt(a[0]+1.0); ++i) {
      |                                       ^~~~
a.cc:29:39: error: 'sqrt' was not declared in this scope
   29 |         for (int64_t i = 1; i <= (int)sqrt(a[1] + 1.0); ++i) {
      |                                       ^~~~
Language: C++

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

long long gcd(long long a, long long b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

long long max(long long a, long long b){
    if (a > b) return a;
    else return b;
}

int main(void){
    // Your code here!
   int N;
   cin >> N;
   long long A[N];
   for(int i = 0; i < N; i++) cin >> A[i];
   
   long long dpl[N+1];
   long long dpr[N+1];
   
   dpl[0] = A[0];
   dpr[0] = A[N-1];
   for(int i = 0; i < N; i++){
       dpl[i+1] = gcd(dpl[i], A[i]);
   }
   
   for(int i = 0; i < N; i++){
       dpr[i+1] = gcd(dpr[i], A[N-1-i]);
   }
   

   int maxv = 0;
   for(int i = 2; i <= N-1; i++){
       maxv = max(maxv, gcd(dpl[i-1], dpr[N-i]));
   }
   
   maxv = max(maxv, dpr[N-1]);
   maxv = max(maxv. dpl[N-1]);

   cout << maxv << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:21: error: request for member 'dpl' in 'maxv', which is of non-class type 'int'
   42 |    maxv = max(maxv. dpl[N-1]);
      |                     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

int eucl(int a, int b){
    if(a == 0){
        return a;
    }
    else
    {
        // cout << b << " "<< b%a << endl;
        return eucl(b % a, a);
    }
}

int main(){
    int N;
    cin >> N;
    std::vector<int> value(N);
    std::vector<int> gcd_r(N);
    std::vector<int> gcd_l(N);
    for(int i=0; i < N; i++){
        cin >> value.at(i);
    }

    gcd_l.at(0) = value.at(i)
    gcd_r.at(N-1) = value.at(N - 1)
    for(int i=1; i < N; i++){
        gcd_l.at(i) = eucl(value.at(i), gcd_l.at(i - 1));
    }
    for(int i=1; i < N; i++){
        gcd_r.at(N - i - 1) = eucl(value.at(N - i -1), gcd_r.at(N-i))
    }
    int max_gcd = gcd_r.at(1));
    int gcd_tmp;
    for(int i = 1; i <  N- 1; i++){
        gcd_tmp = gcd_l.at(i - 1) + gcd_r.at(i + 1);
        max_gcd = max(max_gcd, gcd_tmp)
    }
    gcd_tmp = gcd_l.at(N - 1);
    max_gcd = max(max_gcd, gcd_tmp)

    cout << max_gcd << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:28: error: 'i' was not declared in this scope
   25 |     gcd_l.at(0) = value.at(i)
      |                            ^
a.cc:31:70: error: expected ';' before '}' token
   31 |         gcd_r.at(N - i - 1) = eucl(value.at(N - i -1), gcd_r.at(N-i))
      |                                                                      ^
      |                                                                      ;
   32 |     }
      |     ~                                                                 
a.cc:33:30: error: expected ',' or ';' before ')' token
   33 |     int max_gcd = gcd_r.at(1));
      |                              ^
a.cc:37:40: error: expected ';' before '}' token
   37 |         max_gcd = max(max_gcd, gcd_tmp)
      |                                        ^
      |                                        ;
   38 |     }
      |     ~                                   
a.cc:40:36: error: expected ';' before 'cout'
   40 |     max_gcd = max(max_gcd, gcd_tmp)
      |                                    ^
      |                                    ;
   41 | 
   42 |     cout << max_gcd << endl;
      |     ~~~~
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	private void solve() {
		int n = nextInt();
		long[]a = new long [n];
		for(int i=0;i<n;i++)a[i]=nextLong();
		long[] L = new long[n+1];
		long[] R = new long[n+1];
		long[] res = new long[n];

		for (int i=0;i<n;i++)L[i+1]=gcd(L[i],a[i]);
		for (int i=n;i>0;i--)R[i-1]=gcd(R[i],a[i-1]);
		for (int i=0;i<n;i++)res[i]=gcd(L[i],R[i+1]);
		Arrays.sort(res);
		System.out.println(res[n-1]);
	}

	static long gcd(long m,long n) {
		if (m<n) return gcd(n,m);
		if (n==0)return m;
		return gcd(n,m%n);
	}
}

Compiler output:
Main.java:12: error: cannot find symbol
		int n = nextInt();
		        ^
  symbol:   method nextInt()
  location: class Main
Main.java:14: error: cannot find symbol
		for(int i=0;i<n;i++)a[i]=nextLong();
		                         ^
  symbol:   method nextLong()
  location: class Main
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+1;
ll a[N],b[N];
ll n;
inline  ll r(){
	char ch;
	ll ans=0,f = 1;
	ch = getchar();
	while(ch>'9' || ch<'0'){if(ch=='-') f*=-1; ch = getchar(); 	}
	while(ch>='0' && ch<='9'){ans = ans*10	+ ch - '0';  ch = getchar();}
	return ans*f;
}
ll GCD(ll a,ll b){
	if(b==0)
		return a;
	GCD(b,a%b);
}

int main (){
	n = r();
	ll ans = 0;
	ll qishu = 0;
	int j=0,k=0;
	ll GCD2=0;
	for(int i=1;i<=n;i++){
		ll x;
		x= r();	
		if(x%2==1){
			a[j] = x;j++;
			GCD(GCD2,x);
		}
		else{
			b[k] = x; k++;
			ans = GCD(ans,x);
		//	cout<<x<<endl;
		}
	}
	if(k==0){
		cot<<GCD2<<endl;
		return 0;
	}
	j--;
	if(j==0 || j==1){
		cout<<ans<<endl;
		return 0;
	}
	if(j==2){
		ll m = max(a[1],a[2]);
		ans = GCD(ans,x);
		return 0;
	}
	if(j>2){
		cout<<1<<endl;
	}

	
/*	k--;
	ans = GCD(b[k],b[k-1]);
	for(int i=k-2;i>1;i--){
		ans = GCD(ans,b[i]);
	}*/
	//cout<<ans;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:17: error: 'cot' was not declared in this scope; did you mean 'cos'?
   41 |                 cot<<GCD2<<endl;
      |                 ^~~
      |                 cos
a.cc:51:31: error: 'x' was not declared in this scope
   51 |                 ans = GCD(ans,x);
      |                               ^
a.cc: In function 'll GCD(ll, ll)':
a.cc:18:12: warning: control reaches end of non-void function [-Wreturn-type]
   18 |         GCD(b,a%b);
      |         ~~~^~~~~~~