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

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

long gcd(long a, long b) {
	int l = 0;
	while (true) {
		l++;
		if (l%a == 0 && l%b == 0) {
			break;
		}
	}
	return a*b / l;
}

int main() {
	int N;
	cin >> N;
	vector<long> vec(N);
	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);
	}
	long P = 1;
	for (int i = 0; i < N; i++) {
		P *= vec.at(i);
	}
	int maxi = 1;
	for (int i = 0; i < N; i++) {
		int R = vec.at(i);
		vec.at(i) = P;
		long G = P;
		for (int k = 0; k < N; k++) {
			G = gcd(G, vec.at(k));
		}
		maxi = max(maxi, G);
		vec.at(i) = R;
	}
	cout << maxi << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:27: error: no matching function for call to 'max(int&, long int&)'
   34 |                 maxi = max(maxi, G);
      |                        ~~~^~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:34:27: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   34 |                 maxi = max(maxi, G);
      |                        ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:34:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   34 |                 maxi = max(maxi, G);
      |                        ~~~^~~~~~~~~
Language: C++

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

int gcd(int a, int b) {
	int l = 0;
	while (true) {
		l++;
		if (l%a == 0 && l%b == 0) {
			break;
		}
	}
	return a*b / l;
}

int main() {
	int N;
	cin >> N;
	vector<int> vec(N);
	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);
	}
	int P = 1;
	for (int i = 0; i < N; i++) {
		P *= vec.at(i);
	}
	int maxi = 1;
	for (int i = 0; i < N; i++) {
		int R = vec.at(i);
		vec.at(i) = P;
		int G = P;
		for (int k = 0; k < N; k++) {
			G = gcd(G,vec.at(k))
		}
		maxi = max(maxi,G);
		vec.at(i) = R;
	}
	cout << maxi << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:45: error: expected ';' before '}' token
   32 |                         G = gcd(G,vec.at(k))
      |                                             ^
      |                                             ;
   33 |                 }
      |                 ~
Language: C++

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

int gcd(int a, int b) {
	int l = 0;
	while (true) {
		l++;
		if (l%a == 0 && l%b == 0) {
			break;
		}
	}
	return a*b / l;
}

int main() {
	int N;
	cin >> N;
	vector<int> vec(N);
	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);
	}
	int P = 1;
	for (int i = 0; i < N; i++) {
		P *= vec.at(i);
	}
	int maxi = 1;
	for (int i = 0; i < N; i++) {
		int R = vec.at(i);
		vec.at(i) = P;
		int G = P;
		for (int k = 0; k < N; k++) {
			G = gcd(G,vect.at(k))
		}
		maxi = max(maxi,G)
		vec.at(i) = R;
	}
	cout << maxi << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:35: error: 'vect' was not declared in this scope; did you mean 'vec'?
   32 |                         G = gcd(G,vect.at(k))
      |                                   ^~~~
      |                                   vec
a.cc:34:35: error: expected ';' before 'vec'
   34 |                 maxi = max(maxi,G)
      |                                   ^
      |                                   ;
   35 |                 vec.at(i) = R;
      |                 ~~~
Language: C++

#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
typedef vector<ll> vll;

int N;
vll A;
ll left_cum[100001], right_cum[100001];

int main(){
  cin>>N;
  for (int i=0;i<N;++i){ll a;cin>>a;A.push_back(a);}

  left_cum[0]=A[0];right_cum[N-1]=A[N-1];
  for (int i=1;i<N;++i){
    left_cum[i]=__gcd(left_cum[i-1], A[i]);
    right_cum[N-i-1]=__gcd(right_cum[N-i], A[N-i]);
  }

  ll ans=max(left_cum[N-2], rigth_cum[1]);
  if(N==2){cout << ans << endl;return 0;}
  for (int i=1;i<N-2;++i){
    ll tmp=__gcd(left_cum[i-1], right_cum[i+1]);
    ans=max(ans, tmp);
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:20:29: error: 'rigth_cum' was not declared in this scope; did you mean 'right_cum'?
   20 |   ll ans=max(left_cum[N-2], rigth_cum[1]);
      |                             ^~~~~~~~~
      |                             right_cum
Language: C++

#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
typedef vector<ll> vll;

int N;
vll A;
ll left_cum[100001], right_cum[100001];

int main(){
  cin>>N;
  for (int i=0;i<N;++i){ll a;cin>>a;A.push_back(a);}

  left_cum[0]=A[0];rigth_cum[N-1]=A[N-1];
  for (int i=1;i<N;++i){
    left_cum[i]=__gcd(left_cum[i-1], A[i]);
    right_cum[N-i-1]=__gcd(right_cum[N-i], A[N-i]);
  }

  ll ans=max(left_cum[N-2], rigth_cum[1]);
  if(N==2){cout << ans << endl;return 0;}
  for (int i=1;i<N-2;++i){
    ll tmp=__gcd(left_cum[i-1], right_cum[i+1]);
    ans=max(ans, tmp);
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: 'rigth_cum' was not declared in this scope; did you mean 'right_cum'?
   14 |   left_cum[0]=A[0];rigth_cum[N-1]=A[N-1];
      |                    ^~~~~~~~~
      |                    right_cum
Language: C++

#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
typedef vector<ll> vll;
const ll INF=1e9+1;

int N;
vll A;
ll left_cum[1e5+1], right_cum[1e5+1];

int main(){
  cin>>N;
  for (int i=0;i<N;++i){ll a;cin>>a;A.push_back(a);}

  left_cum[0]=A[0];rigth_cum[N-1]=A[N-1];
  for (int i=1;i<N;++i){
    left_cum[i]=__gcd(left_cum[i-1], A[i]);
    right_cum[N-i-1]=__gcd(right_cum[N-i], A[N-i]);
  }

  ll ans=max(left_cum[N-2], rigth_cum[1]);
  if(N==2){cout << ans << endl;return 0;}
  for (int i=1;i<N-2;++i){
    ll tmp=__gcd(left_cum[i-1], right_cum[i+1]);
    ans=max(ans, tmp);
  }

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

Compiler output:
a.cc:9:16: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    9 | ll left_cum[1e5+1], right_cum[1e5+1];
      |             ~~~^~
a.cc:9:16: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
    9 | ll left_cum[1e5+1], right_cum[1e5+1];
      |             ~~~^~
      |                |
      |                double
a.cc:9:16: error: size of array 'left_cum' has non-integral type 'double'
a.cc:9:34: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    9 | ll left_cum[1e5+1], right_cum[1e5+1];
      |                               ~~~^~
a.cc:9:34: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
    9 | ll left_cum[1e5+1], right_cum[1e5+1];
      |                               ~~~^~
      |                                  |
      |                                  double
a.cc:9:34: error: size of array 'right_cum' has non-integral type 'double'
a.cc: In function 'int main()':
a.cc:15:20: error: 'rigth_cum' was not declared in this scope; did you mean 'right_cum'?
   15 |   left_cum[0]=A[0];rigth_cum[N-1]=A[N-1];
      |                    ^~~~~~~~~
      |                    right_cum
Language: C++

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

int gcdLeft[100100];
int gcdRight[100100];
int a[100100];

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

int main(){
    int n;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> a[i];
        gcdLeft[i] = gcd(a[i], gcdLeft[i-1]);
    }
    for(int i=n; i>0; i--){
        gcdRight[i] = gcd(a[i], gcdRight[i+1]);
    }

    int ma = 0;
    for(int i=1; i<=n; i++){
        ma = max(ma, gcd(gcdLeft[i-1], gcdRight[i+1]));
    }
    cout << ma << endl;
}

Compiler output:
a.cc:1:10: fatal error: bins/stdc++.h: No such file or directory
    1 | #include <bins/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int N;
vector<int> V(N);

int Left(int i){
    if(i<=1){
        return 0;
    }
    else{
        return Euclidean(Left(i-1),V[i-1]);
    }
}

int Right(int i){
    if(i>=N-1){
        return 0;
    }
    else{
        return Euclidean(Right(i+1),V[i+1]);
    }
}

int Euclidean(int x,int y){
    int tmp,r;
    if (x==0){
        return y;
    }
    else if (y==0){
        return x;
    }
    else{
        if(x<y){
            tmp=x;
            x=y;
            y=tmp;
        }
        r=x%y;
        while(r!=0){
            x=y;
            y=r;
            r=x%y;
        }
        return y;
    }
}

int main(void){

int GCDMAX=0;
cin >> N;
for (int i=0; i<N; i++) cin >> V[i];


for (int i=0; i<N; i++){
    int GCD = Euclidean(Left(i),Right(i));
    if(GCDMAX<GCD){
        GCDMAX=GCD;
    }
}


return 0;
}

Compiler output:
a.cc: In function 'int Left(int)':
a.cc:14:16: error: 'Euclidean' was not declared in this scope
   14 |         return Euclidean(Left(i-1),V[i-1]);
      |                ^~~~~~~~~
a.cc: In function 'int Right(int)':
a.cc:23:16: error: 'Euclidean' was not declared in this scope
   23 |         return Euclidean(Right(i+1),V[i+1]);
      |                ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
 
int main() {
    
    // 1. 入力情報取得.
    int N;
    cin >> N;
    LL A[N + 1];
    A[0] = 0;
    for(int i = 1; i < N + 1; i++) cin >> A[i];
    
    // 2. 解説通り.
    // L[0], L[1], L[2], ... , L[N + 1]
    // R[0], R[1], R[2], ... , R[N + 1]
    // を用意する.
    LL L[N + 2], R[N + 2];
    L[0] = 0, R[N + 1] = 0;
    for(int i = 0; i <= N; i++) L[i + 1] = __gcd(L[i], A[i]);
    for(int i = N; i >= 0; i--) R[i] = __gcd(R[i + 1], A[i]);
    
    // 3. 解説通り.
    LL ans = 0;
    for(int i = 0; i <= N; i++) ans = max(ans, __gcd(L[i], R[i + 1]));
    
    // 4. 後処理.
    cout << ans << endl;
    return 0;
    


Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: expected '}' at end of input
   29 |     return 0;
      |              ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll factor[(int) 10e9]={0};
void f(ll k) {
  for (int i=1;i<=(int) sqrt(k);++i) {
    if (k%i==0) {
      factor[i-1]++;
      factor[k/i-1]++;
    }
  }
}
int main () {
  ll n, a, A=0; cin>>n;
  for (int i=0;i<n;++i) {
    cin>>a;
    f(a);
    A=max(A, a);
  }
  for (int i=A;i>=1;--i) {
    if (factor[i-1]>=n-1) {
      cout<<i;
      return 0;
    }
  }
}

Compiler output:
a.cc:4:11: error: size of array 'factor' exceeds maximum object size '9223372036854775807'
    4 | ll factor[(int) 10e9]={0};
      |           ^~~~~~~~~~
Language: C++

#include "pch.h"
#include <iostream>
#include <vector>

using namespace std;

int gcd(int a, int b);

int main(void)
{
	int answer = 0;
	int n;

	cin >> n;

	int a[n];

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	int max = 0;
	for (int i = 0; i < n; i++) {
		int div = (i != 0) ? a[0] : a[1];
		for (int j = 1; j < n; j++) {
			if (i == j) continue;
			div = gcd(div, a[j]);
		}
		if (div > max) {
			max = div;
		}
	}

	cout << max;
}

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

	return b;
}

Compiler output:
a.cc:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

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

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);
  rep(i,n) cin>>a[i];
  vector<int> l(n), r(n);
  rep(i,n-1) l[i+1] = gcd(l[i], a[i]);
  for(int i = n-1; i >= 1;  --i) r[i-1] = gcd(r[i], a[i]);
  int ans = 1;
  rep(i,n) ans = max(ans, gcd(l[i], r[i]));
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: 'i' was not declared in this scope
   13 |   rep(i,n) cin>>a[i];
      |       ^
a.cc:13:3: error: 'rep' was not declared in this scope
   13 |   rep(i,n) cin>>a[i];
      |   ^~~
Language: C++

    #include<iostream>
    using namespace std;

    int gcd (int argA, int argB){
        if (argB == 0){
            return argA;
        }
        return gcd(argB, argA%argB);
    }

    int *sortBubble(int n, int *a){
        int temp = 0;
        for (int i = 0; i < (n - 1); ++i)
            for (int j = 0; j < (n - 1); -- j)
                if(a[ j - 1 > a[j]]){
                    temp = a[j - 1];
                    a[j - 1] = a[j];
                    a[j] = temp;
                }
        return a;        
    }

    int main()
    {
        //Input
        int n;
        cin >> n;
        int a[n];
        int *sortedA;
        for(int i = 0; i < n; ++i) cin >>a[i];

        sortedA = sortBubble(n, a);

        int resultGcp = 0;
        resultGcp = gcd(a[0], a[1]);
        for(int p = 2; p < n; ++p){
            resultGcp = gcd(a[p], resultGcp)
        }

        // 出力
        cout << resultGcp<<endl;
        return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:37:45: error: expected ';' before '}' token
   37 |             resultGcp = gcd(a[p], resultGcp)
      |                                             ^
      |                                             ;
   38 |         }
      |         ~
Language: C++

    #include<iostream>
    using namespace std;

    int gcd (int argA, int argB){
        if (argB == 0){
            return argA;
        }
        return gcd(argB, argA%argB);
    }

    int *sortBubble(int n, int *a){
        int temp = 0;
        for (int i = 0; i < (n - 1); ++i)
            for (int j = 0; j < (n - 1); -- j)
                if(a[ j - 1 > a[j]]){
                    temp = a[j - 1];
                    a[j - 1] = a[j];
                    a[j] = temp;
                }
        return a;        
    }

    int main()
    {
        //Input
        int n;
        cin >> n;
        int a[n];
        for(int i = 0; i < n; ++i) cin >>a[i];

        a = sortBubble(n, a);

        int resultGcp = 0;
        resultGcp = gcd(a[0], a[1])
        for(int p = 2; p<n; ++p){
            resultGcp = gcd(a[p], resultGcp)
        }

        // 出力
        cout << resultGcp<<endl;
        return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:31:11: error: incompatible types in assignment of 'int*' to 'int [n]'
   31 |         a = sortBubble(n, a);
      |         ~~^~~~~~~~~~~~~~~~~~
a.cc:34:36: error: expected ';' before 'for'
   34 |         resultGcp = gcd(a[0], a[1])
      |                                    ^
      |                                    ;
   35 |         for(int p = 2; p<n; ++p){
      |         ~~~                         
a.cc:35:24: error: 'p' was not declared in this scope
   35 |         for(int p = 2; p<n; ++p){
      |                        ^
Language: C++

    #include<iostream>
    using namespace std;

    int gcd (int argA, int argB){
        if (argB == 0){
            return argA;
        }
        return gcd(argB, argA%argB);
    }

    int sortBubble(int n, int a[]){
        int temp = 0;
        for (int i = 0; i < (n - 1); ++i)
            for (int j = 0; j < (n - 1); -- j)
                if(a[ j - 1 > a[j]]){
                    temp = a[j - 1];
                    a[j - 1] = a[j];
                    a[j] = temp;
                }
        return a;        
    }

    int main()
    {
        //Input
        int n;
        cin >> n;
        int a[n];
        for(int i = 0; i < n; ++i) cin >>a[i];

        a = sortBubble(n, a);

        int resultGcp = 0;
        resultGcp = gcd(a[0], a[1])
        for(int p = 2; p<n; ++p){
            resultGcp = gcd(a[p], resultGcp)
        }

        // 出力
        cout << resultGcp<<endl;
        return 0;
    }

Compiler output:
a.cc: In function 'int sortBubble(int, int*)':
a.cc:20:16: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   20 |         return a;
      |                ^
      |                |
      |                int*
a.cc: In function 'int main()':
a.cc:31:11: error: incompatible types in assignment of 'int' to 'int [n]'
   31 |         a = sortBubble(n, a);
      |         ~~^~~~~~~~~~~~~~~~~~
a.cc:34:36: error: expected ';' before 'for'
   34 |         resultGcp = gcd(a[0], a[1])
      |                                    ^
      |                                    ;
   35 |         for(int p = 2; p<n; ++p){
      |         ~~~                         
a.cc:35:24: error: 'p' was not declared in this scope
   35 |         for(int p = 2; p<n; ++p){
      |                        ^
Language: C++

    #include<iostream>
    using namespace std;

    int gcd (int argA, int argB){
        if (argB == 0){
            return argA;
        }
        return gcd(int argB, int argA%argB);
    }

    int sortBubble(int n, int a){
        int temp = 0;
        for (int i = 0; i < (n - 1); ++i)
            for (int j = 0; j < (n - 1); -- j)
                if(a[ j - 1 > a[j]]){
                    temp = a[j - 1];
                    a[j - 1] = a[j];
                    a[j] = temp;
                }
        return a;        
    }

    int main()
    {
        //Input
        int n;
        cin >> n;
        int a[n];
        for(int i = 0; i < n; ++i) cin >>a[i];

        a = sortBubble(n, a);

        int resultGcp = 0;
        resultGcp = gcd(a[0], a[1])
        for(int p = 2; p<n; ++p){
            resultGcp = gcd(a[p], resultGcp)
        }

        // 出力
        cout << resultGcp<<endl;
        return 0;
    }

Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:8:20: error: expected primary-expression before 'int'
    8 |         return gcd(int argB, int argA%argB);
      |                    ^~~
a.cc:8:30: error: expected primary-expression before 'int'
    8 |         return gcd(int argB, int argA%argB);
      |                              ^~~
a.cc: In function 'int sortBubble(int, int)':
a.cc:15:32: error: invalid types 'int[int]' for array subscript
   15 |                 if(a[ j - 1 > a[j]]){
      |                                ^
a.cc:16:29: error: invalid types 'int[int]' for array subscript
   16 |                     temp = a[j - 1];
      |                             ^
a.cc:17:22: error: invalid types 'int[int]' for array subscript
   17 |                     a[j - 1] = a[j];
      |                      ^
a.cc:17:33: error: invalid types 'int[int]' for array subscript
   17 |                     a[j - 1] = a[j];
      |                                 ^
a.cc:18:22: error: invalid types 'int[int]' for array subscript
   18 |                     a[j] = temp;
      |                      ^
a.cc: In function 'int main()':
a.cc:31:27: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   31 |         a = sortBubble(n, a);
      |                           ^
      |                           |
      |                           int*
a.cc:11:31: note:   initializing argument 2 of 'int sortBubble(int, int)'
   11 |     int sortBubble(int n, int a){
      |                           ~~~~^
a.cc:31:11: error: incompatible types in assignment of 'int' to 'int [n]'
   31 |         a = sortBubble(n, a);
      |         ~~^~~~~~~~~~~~~~~~~~
a.cc:34:36: error: expected ';' before 'for'
   34 |         resultGcp = gcd(a[0], a[1])
      |                                    ^
      |                                    ;
   35 |         for(int p = 2; p<n; ++p){
      |         ~~~                         
a.cc:35:24: error: 'p' was not declared in this scope
   35 |         for(int p = 2; p<n; ++p){
      |                        ^
Language: C++

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

template<class T> inline bool chmax(T& a,T &b){if(a<b){a=b;return 1;}return 0;}
int GCD(int a,int b) {return b ? GCD(b,a%b):a;}

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

    vector<int> left(N+1,0),right(N+1,0);
    for(int i=0;i<N;i++) left[i+1]=GCD(left[i],a[i]);
    for(int i=N-1;i>=0;--i) right[i]=GCD(right[i+1],a[i]);

    int res =0;
    for(int i=0;i<N;i++){
        int l=left[i];
        int r=right[i+1];
        chmax(res,GCD(l,r));
    }
    cout<<res<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   20 |         chmax(res,GCD(l,r));
      |                   ~~~^~~~~
a.cc:4:45: note:   initializing argument 2 of 'bool chmax(T&, T&) [with T = int]'
    4 | template<class T> inline bool chmax(T& a,T &b){if(a<b){a=b;return 1;}return 0;}
      |                                          ~~~^
Language: C++

using namespace std;

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

int main(){
    int N;
    cin >> N;

    vector<int> A(N);

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

    int gcd_n,max=0;

    for (int i=0; i<N; i++){
        if (i == 0) gcd_n = A[1];
        else gcd_n = A[0];
        
        for (int j=0; j<N; j++){
            if (i == j) continue;
            else gcd_n = gcd(gcd_n,A[j]);
        }
        if (gcd_n > max){
            max = gcd_n;
        }
    }
    cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'cin' was not declared in this scope
   18 |     cin >> N;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:20:5: error: 'vector' was not declared in this scope
   20 |     vector<int> A(N);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:20:12: error: expected primary-expression before 'int'
   20 |     vector<int> A(N);
      |            ^~~
a.cc:23:16: error: 'A' was not declared in this scope
   23 |         cin >> A[i];
      |                ^
a.cc:29:29: error: 'A' was not declared in this scope
   29 |         if (i == 0) gcd_n = A[1];
      |                             ^
a.cc:30:22: error: 'A' was not declared in this scope
   30 |         else gcd_n = A[0];
      |                      ^
a.cc:34:36: error: 'A' was not declared in this scope
   34 |             else gcd_n = gcd(gcd_n,A[j]);
      |                                    ^
a.cc:40:5: error: 'cout' was not declared in this scope
   40 |     cout << max << endl;
      |     ^~~~
a.cc:40:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:40:20: error: 'endl' was not declared in this scope
   40 |     cout << max << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>


using namespace std;

int MinNonZero(vector<int> &v,int &min){
  for(int i=0;i<v.size();i++)
    if(v[i]>0){
      min=v[i];
      break;
    }
  for(int i=0;i<v.size();i++)
    if(min>v[i]&&v[i]>0)
      min=v[i];
  return min;
}

int GCD(vector<int>& v,int &min){
  min = MinNonZero(v);
  bool flag = true;
  for(int i=0;i<v.size();i++){
    if(0!=(v[i]%min)){
      v[i] = v[i] % min;
      flag = false;
    }
  }
  if( flag == true ) return min;
  GCD(v,min);
}

int main(int argv, char** argc) {
  int N;
  int max=0,t;
  int min;
  cin >> N;
  vector<int> A(N),a(N-1);
  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(j>i) a[j-1]=A[j];
      else if(j<i) a[j]=A[j];
      else continue;
    }
    t=GCD(a,min);
    if(max<t)max=t;
  }
  cout << max;
  return 0;
}


Compiler output:
a.cc: In function 'int GCD(std::vector<int>&, int&)':
a.cc:23:19: error: too few arguments to function 'int MinNonZero(std::vector<int>&, int&)'
   23 |   min = MinNonZero(v);
      |         ~~~~~~~~~~^~~
a.cc:10:5: note: declared here
   10 | int MinNonZero(vector<int> &v,int &min){
      |     ^~~~~~~~~~
a.cc:32:6: warning: control reaches end of non-void function [-Wreturn-type]
   32 |   GCD(v,min);
      |   ~~~^~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<int> bb(n);
    for(int i=0; i<n; ++i){ cin >> bb[i];   }
    
    if(n==2){
        cout << (bb[0] > bb[1] ? bb[0] : bb[1]) << endl;
        return 0;
    }
    
    vector<int> g(n);
    for(int i=0; i<n; ++i){
        int tmp = bb[i];
        if(i != n-1){
            bb[i] = bb[n-1];
        }else{
            bb[i] = bb[0];
        }
        int gg = gcd(bb[0], bb[1]);
        for(int j=2; j<n; ++j){ if((bb[j] % g) != 0){   gg = gcd(bb[j], g);   }   }
        g[i] = gg;
        bb[i] = tmp;
        
    }
    
    cout << *max_element(g.begin(), g.end()) << endl;
    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:43: error: no match for 'operator%' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>')
   26 |         for(int j=2; j<n; ++j){ if((bb[j] % g) != 0){   gg = gcd(bb[j], g);   }   }
a.cc:26:65: error: no matching function for call to 'gcd(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, std::vector<int>&)'
   26 |         for(int j=2; j<n; ++j){ if((bb[j] % g) != 0){   gg = gcd(bb[j], g);   }   }
      |                                                              ~~~^~~~~~~~~~
In file included from a.cc:3:
/usr/include/c++/14/numeric:173:5: note: candidate: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
/usr/include/c++/14/numeric:173:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/move.h:37,
                 from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/type_traits: In substitution of 'template<class ... _Tp> using std::common_type_t = typename std::common_type::type [with _Tp = {int, std::vector<int, std::allocator<int> >}]':
/usr/include/c++/14/numeric:173:5:   required by substitution of 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = int; _Nn = std::vector<int>]'
a.cc:26:65:   required from here
   26 |         for(int j=2; j<n; ++j){ if((bb[j] % g) != 0){   gg = gcd(bb[j], g);   }   }
      |                                                              ~~~^~~~~~~~~~
/usr/include/c++/14/type_traits:2719:11: error: no type named 'type' in 'struct std::common_type<int, std::vector<int, std::allocator<int> > >'
 2719 |     using common_type_t = typename common_type<_Tp...>::type;
      |           ^~~~~~~~~~~~~
Language: C++

#include <cstdio>
#include <string>
#include <iostream>
#include <vector>


using namespace std;

int GreatestCommonDivisor(int &a, int &b, int &dum){
  if(a>b){
    if(a%b==0)return b;
    dum=a%b;
    return GreatestCommonDivisor(b,dum);
  }else{
    if(b%a==0)return a;
    dum=b%a;
    return GreatestCommonDivisor(a,dum);
  }
  return 1;
}


int main(int argv, char** argc) {
  int N;
  cin >> N;
  int A[N];
  int max=1,cp=1;
  int dum;
  for(int i=0;i<N;i++)cin>>A[i];
  for(int i=0;i<N;i++)
    for(int j=i;j<N-1;j++){
      cp = GreatestCommonDivisor(A[j],A[j+1],dum);
      if(max<cp)max=cp;
    }

  cout << max;


  return 0;
}

Compiler output:
a.cc: In function 'int GreatestCommonDivisor(int&, int&, int&)':
a.cc:13:33: error: too few arguments to function 'int GreatestCommonDivisor(int&, int&, int&)'
   13 |     return GreatestCommonDivisor(b,dum);
      |            ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:9:5: note: declared here
    9 | int GreatestCommonDivisor(int &a, int &b, int &dum){
      |     ^~~~~~~~~~~~~~~~~~~~~
a.cc:17:33: error: too few arguments to function 'int GreatestCommonDivisor(int&, int&, int&)'
   17 |     return GreatestCommonDivisor(a,dum);
      |            ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:9:5: note: declared here
    9 | int GreatestCommonDivisor(int &a, int &b, int &dum){
      |     ^~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>

using namespace std;

int gcd(int a, int b){

  int c = max(a, b);
  int d = min(a, b);
  if(c%d == 0) return d;
  else return gcd(d, c%d);
  
}

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

  int ans = 0;
  int GCD = A[1];
  for(int i=1; i<N; i++) GCD = gcd(GCD, A[i]);
  ans = GCD;
  
  for(int remove=1; remove<N; remove++){
    GCD = A[0];
    for(int j=0; j<N; j++){
      if(remove != j) GCD = gcd(GCD, A[j]);
      if(ans > GCD) break;
    ans = max(ans, GCD);
  }

  cout << ans << endl;

  return 0;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:2: error: expected '}' at end of input
   38 | }
      |  ^
a.cc:14:11: note: to match this '{'
   14 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include <cmath>
using namespace std;
typedef long long  ll;

 ll gcd(ll a,ll b){
     if(b==0)
     return a;

     return gcd(b,a%b);
 }

 int main(){
     int n; ll a[n];
     cin >> n;
     for(int i=0;i<n;i++) cin >> a[i];
     //左右からgcdを取っていく
     ll left[n],right[n];
     left[0]=0; right[n]=0;
     for(int i=0;i<n;i++) left[i+1]=gcd(left[i],a[i]);
     for(int i=n-1;i>=0;i--) right[i]=gcd(right[i+1],a[i]);
     
     ll ans=0;
     //i番目を消した時の全gcdのmax
     for(int i=0;i<n;i++){
         int tmp=gcd(left[i],right[i+1]);
         ans=max(ans,tmp);
     }
     cout << ans <<endl;
     return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: no matching function for call to 'max(ll&, int&)'
   34 |          ans=max(ans,tmp);
      |              ~~~^~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:34:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |          ans=max(ans,tmp);
      |              ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:34:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |          ans=max(ans,tmp);
      |              ~~~^~~~~~~~~
Language: C++

#include<iostream>
using namespace std;

int A[100001], N;

int gcd(int a, int b){
  int c = max(a,b);
  int d = min(a,b);
  if ( d == 0){
    return c;
  }
  int r = c % d;
  while(r!=0){
    c = d;
    d = r;
    r = c % d;
  }
  return d;
}

int L(int k){
  if (k == 0){
    return 0;
  } else {
    return gcd(L(k-1), A[k-1]);
  }
}

int R(int k){
  if (k == N+1){
    return 0;
  } else {
  return gcd(R(k+1), A[k]);
  }
}

int solve(int k){
  return gcd(L(k), R(k+1));
}

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

  int max_gcd = 1;

  for ( int i = 0; i < N; i++){
    tmp = solve(i);
    if (max_gcd < tmp){
      max_gcd = tmp;
    }
  }

  cout << max_gcd << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:5: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   48 |     tmp = solve(i);
      |     ^~~
      |     tm
Language: C++

#include <iostream>
#include<algorithm>

using namespace std;

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

int main(){
  int n;
  cin >> n;
  int a[n],i;
  for(i=0;i<n;i++) cin >> a[i];
  int l[n],r[n];
  l[1] = a[0];
  for(i=2;i<n;i++) l[i] = gcd(l[i-1],a[i-1]);
  r[1] = a[n-1];
  for(i=2;i<n;i++) r[i] = gcd(r[i-1],a[n-i]);
  l[0] = r[n-1];
  r[0] = l[n-1];
  int ans=1;
  for(i=0;i<n;i++) if(ans<gcd(l[i],r[n-1-i])) ans = gcd(l[i],r[n-1-i]);
  cout << ans << endl;
}
  


Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:9:5: error: 'i' was not declared in this scope
    9 |     i=a;
      |     ^
Language: C++

#include <iostream>

using namespace std;

int lcd(int*,int,int,int);

int main()
{
  int N;
  cin >> N;

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

  int l;
  if(N==2){
     if(A[0]>A[1]) cout << A[0] << endl;
     else cout << A[1] << endl;
  } else {
     int max = lcd(A, N, 0, 1);
     for(int i=1;i<N;i++){
        l = lcd(A, N, i);
        if(max<l){
           max = l;
        }
     }
     cout << max << endl;
  }
}

int lcd(int *A, int N, int n){
   int max=1, l=2;
   int B[N];
   for(int i=0;i<N;i++) B[i]=A[i];
   int flag=0;
   while(true){
      for(int i=0;i<N;i++){
         if(i==n){
           continue;
         } 
         if(B[i]<l){
           goto endloop;
         }
      }
      for(int i=0;i<N;i++){
         if(i==n) continue;
         if(B[i]%l!=0){
            flag=1;
            break;
         } else {
            flag=0;
         }
      }

      if(flag==0){
         max*=l;
         for(int i=0;i<N;i++){
            if(i==n) continue;
            B[i] /= l;
         }
      } else {
         l++;
      }
   }
endloop:
      return max;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: too few arguments to function 'int lcd(int*, int, int, int)'
   22 |         l = lcd(A, N, i);
      |             ~~~^~~~~~~~~
a.cc:5:5: note: declared here
    5 | int lcd(int*,int,int,int);
      |     ^~~
Language: C++

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

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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

int gcd_of_vector(vector<int> A, int begin, int end){
  int result = A[begin];
  for(int i=begin;i<end;i++){
    result = gcd(A[i],result);
  }
  return result;
}

int gcd_of_vector_with_skip(vector<int> A, int skip){
  int result = A[0];
  if(skip==0)result=A[1];
  for(int i=1;i<A.size();i++){
    if(i==skip)continue;
    result = gcd(A[i],result);
  }
  return result;
}

int main() {
  int gcd1,gcd2,ans,N=getint();
  vector<int> A(N);
  for(int i=0;i<N;i++)A[i]=getint();

  if(N>=100){
    ans=1000000010;
    random_shuffle(A.begin(),A.end());
    gcd1 = gcd_of_vector(A,1,N/2);
    gcd2 = gcd_of_vector(A,N/2,N);
    ans = max(gcd1,gcd2)
  }else{
    ans=0;
    for(int i=0;i<N;i++){
      ans=max(ans,gcd_of_vector_with_skip(A,i));
    }
  }

  cout<<ans<<"\n";

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:19: warning: 'void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
   49 |     random_shuffle(A.begin(),A.end());
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4492:5: note: declared here
 4492 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~
a.cc:52:25: error: expected ';' before '}' token
   52 |     ans = max(gcd1,gcd2)
      |                         ^
      |                         ;
   53 |   }else{
      |   ~
Language: C++

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

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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

int gcd_of_vector(vector<int> A, int begin, int end){
  int result = A[begin];
  for(int i=begin;i<end;i++){
    result = gcd(A[i],result);
  }
  return result;
}

int gcd_of_vector_with_skip(vector<int> A, int skip){
  int result = A[0];
  if(skip==0)result=A[1];
  for(int i=1;i<A.size();i++){
    if(i==skip)continue;
    result = gcd(A[i],result);
  }
  return result;
}

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

  if(N>=100){
    ans=1000000010;
    for(int i=0;i<1;i++){
      //random_shuffle(A.begin(),A.end());
      gcd1 = gcd_of_vector(A,1,N/2);
      gcd2 = gcd_of_vector(A,N/2,N);
      ans = min(ans,max(gcd1,gcd2));
    }
  }else{
    ans=0;
    for(int i=0;i<N;i++){
      ans=max(ans,gcd_of_vector_with_skip(A,i));
    }
  }

  cout<<ans<<"\n";

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   48 |     ans=1000000010;
      |     ^~~
      |     abs
a.cc:51:7: error: 'gcd1' was not declared in this scope; did you mean 'gcd'?
   51 |       gcd1 = gcd_of_vector(A,1,N/2);
      |       ^~~~
      |       gcd
a.cc:52:7: error: 'gcd2' was not declared in this scope; did you mean 'gcd'?
   52 |       gcd2 = gcd_of_vector(A,N/2,N);
      |       ^~~~
      |       gcd
a.cc:56:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   56 |     ans=0;
      |     ^~~
      |     abs
a.cc:62:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   62 |   cout<<ans<<"\n";
      |         ^~~
      |         abs
Language: C

#include<stdio.h>
int gcd(int a,int b){
    if(a<b)return gcd(b,a);
    return b?gcd(b,a%b):a;
}
int main(){
    int a[100000],b[100000],c[100000],i,n,q,r=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&a[i]);
    b[0]=a[0];
    for(i=1;i<n-1;i++)b[i]=gcd(b[i-1],a[i]);
    c[n-1]=a[n-1];
    for(i=n-2;i--;)b[i]=gcd(c[i+1],a[i]);
    r=c[1];
    if(r<b[n-2])r=b[n-2];
    for(i=1;i<n-1;i++){
        if(r<(q=gcd(b[i-1],c[i+1]))r=q;
    }
    printf("%d",r);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:36: error: expected ')' before 'r'
   17 |         if(r<(q=gcd(b[i-1],c[i+1]))r=q;
      |           ~                        ^
      |                                    )
main.c:18:5: error: expected expression before '}' token
   18 |     }
      |     ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

long long gcd(long long a,long long b){
  if(a<b) return gcd(b,a);
  return a?gdc(a%b,a):b;
}

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

  cout<<ans<<endl;


  return 0;
}



Compiler output:
a.cc: In function 'long long int gcd(long long int, long long int)':
a.cc:9:12: error: 'gdc' was not declared in this scope; did you mean 'gcd'?
    9 |   return a?gdc(a%b,a):b;
      |            ^~~
      |            gcd
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;

int gcd(long m ,long n){
while(m!=n){
    if(m>n)m=m-n;
    else n=n-m;
}
return m;

}

int main(){
    int N;
cin >>N;
vector<long> A;
long x;
for(int i=0;i<N;i++){
    cin >>x;
    A.push_back(A);
   }
   A.sort(A.begin(),A.end());
long l[N-1];
for(int i=1;i<N;i++){
    l[i-1]=gcd(A[0],A[i]);
   }
long r[N-1];
for(int i=1;i<N;i++){
    r[i-1]=gcd(A[N-1],A[i-1]);
   }
long G=0;
if(N==1){
    G=A[0];
    cout <<G <<endl;
    return 0;

}
else if(N==2){
    G=max(A[0],A[1]);
    cout <<G <<endl;
    return 0;
}
else if (N==3){
    long g;
    g=gcd(A[0],A[1]);
    G=max(G,g);
    g=gcd(A[1],A[2]);
    G=max(G,g);
    g=gcd(A[2],A[0]);
    G=max(G,g);
    cout <<G <<endl;
    return 0;
}
else{
G=max(G,r[1]);//1番目を書き換える
G=max(G,l[N-3]);//N番目を書き換える
long g;
for(int i=1;i<N-1;i++){//2~N−１番目を書き換える
g=gcd(l[i-1],r[i]);
G=max(G,g);
}
cout <<G <<endl;
 return 0;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: no matching function for call to 'std::vector<long int>::push_back(std::vector<long int>&)'
   25 |     A.push_back(A);
      |     ~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long int; _Alloc = std::allocator<long int>; value_type = long int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::vector<long int>' to 'const std::vector<long int>::value_type&' {aka 'const long int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long int; _Alloc = std::allocator<long int>; value_type = long int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::vector<long int>' to 'std::vector<long int>::value_type&&' {aka 'long int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:27:6: error: 'class std::vector<long int>' has no member named 'sort'
   27 |    A.sort(A.begin(),A.end());
      |      ^~~~
Language: C++

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

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

int main()
{
    //input
    int N;
    vector<int> A(N);
    vector<int> J(N - 1);
    vector<int> K(N);
    int max=0;

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

    //calc

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

    L[0] = K[1];
    L[N-1] = J[N - 2];
    for (int i = 1; i < N-1;i++){
        if (max < gcd(J[i - 1], K[i + 1])){
            max = gcd(J[i - 1], K[i + 1]);
        }
    }
    cout << max << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:5: error: 'L' was not declared in this scope
   44 |     L[0] = K[1];
      |     ^
Language: Java

import java.util.Scanner;

class Main {

  public static final long INF = Long.MAX_VALUE / 4;

  public static long gcd(long a, long b) {
    if (a < b) {
      long tmp = a;
      a = b;
      b = tmp;
    }
    if (b == 0) {
      return a;
    }
    long r = a % b;
    while (r != 0) {
      a = b;
      b = r;
      r = a % b;
    }
    return b;
  }

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    long[] A = new long[N];
    for (int i = 0; i < N; i++) {
      A[i] = scanner.nextLong();
    }
    long[] L = new long[N + 1];
    long[] R = new long[N + 1];
    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]);
    }
    long[] ans = new long[N];
    for (int i = 0; i < N; i++) {
      ans[i] = gcd(L[i], R[i + 1]);
    }
    long max = 0;
    for (long m : ans) {
      max = Math.max(max, m);
    }
    System.out.println(max);

  }

}
ajdflakj

Compiler output:
Main.java:53: error: reached end of file while parsing
ajdflakj
^
1 error
Language: C++

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

int gcd(int p, int q){
int 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(int N, std::vector<int> A){
    
int temp=0;

for(int i=0;i<N;i++){int 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(“%d\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(){
    int N;
    scanf("%d",&N);
    std::vector<int> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%d",&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(“%d\n”,temp);
      |        ^
a.cc:21:11: error: stray '\' in program
   21 | printf(“%d\n”,temp);
      |           ^
a.cc:21:12: error: extended character ” is not valid in an identifier
   21 | printf(“%d\n”,temp);
      |            ^
a.cc: In function 'void solve(int, std::vector<int>)':
a.cc:21:8: error: '\U0000201c' was not declared in this scope
   21 | printf(“%d\n”,temp);
      |        ^
a.cc:21:10: error: 'd' was not declared in this scope
   21 | printf(“%d\n”,temp);
      |          ^