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

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
ll GCD(ll a,ll b) { return b ? GCD(b, a%b) : a; }
int main(){
  ll n;cin>>n;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  vector<ll> left(n+1,0),right(n+1,0);
  rep(i,n) left[i+1]=GCD(left[i],v[i]);
  for(ll i=n-1;i>=0;i--) right[i]=GCD(right[i+1],v[i]);
  ll ans=0;
  rep(i,n) chmax(ans,GCD(left[i],right[i+1]));
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: 'chmax' was not declared in this scope
   14 |   rep(i,n) chmax(ans,GCD(left[i],right[i+1]));
      |            ^~~~~
Language: C++

#include<bits_stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
ll GCD(ll a,ll b) { return b ? GCD(b, a%b) : a; }
int main(){
  ll n;cin>>n;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  vector<ll> left(n+1,0),right(n+1,0);
  rep(i,n) left[i+1]=GCD(left[i],v[i]);
  for(ll i=n-1;i>=0;i--) right[i]=GCD(right[i+1],v[i]);
  ll ans=0;
  rep(i,n) chmax(ans,GCD(left[i],right[i+1]));
  cout<<ans<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
    int a[n]; for (int i = 0; i < n; ++i) cin >> a[i];
  	multiset<int> s;
  	multiset<int> q[n];
  	for (int i = 0; i < n; i++) {
		int c = a[i];
      	for (int j = 2; j <= c; j++) {
        	while (c % j == 0) {
            	s.insert(j);
              	q[i].insert(j);
              	c /= j;
            }
        }
      	if (c > 1) {
        	s.insert(c);
          	q[i].insert(c);
        }
    }
  	int ans = 1;
  	for (int i = 0; i < n; i++) {
     	for (int j : q[i]) s.remove(*s.lower_bound(j));
      	if (!s.empty()) ans = max(ans, *prev(s.end()));
      	for (int j : q[i]) s.insert(j);
    }
  	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:30: error: 'class std::multiset<int>' has no member named 'remove'
   24 |         for (int j : q[i]) s.remove(*s.lower_bound(j));
      |                              ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)      for(int i=0;i<n;i++)
#define repn(i,n)     for(int i=1;i<=n;i++)
#define rrep(i,n)      for(int i=n-1;i>=0;i--)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
/*-----------------------------------------------------------------------------------------------*/
const int N = 1e5+10;
int n;
int a[N],b[N],x,ans=0;
int main()
{
    _SAD()
    cin>>n;
    rep(i,n) cin>>a[i];
    x=a[n-1];
    rrep(i,n)
    {
        x=__gcd(x,a[i]);
        b[i]=x;
    }
    ans=max(k,b[1]);
    x=a[0];
    repn(i,n-2)
    {
        ans=max(ans,__gcd(x,b[i+1]));
        x=__gcd(x,a[i]);
    }
    cout<<ans<<nl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:13: error: 'k' was not declared in this scope
   32 |     ans=max(k,b[1]);
      |             ^
Language: C++

N = int(input())
A=sorted(list(map(int,input().split())))
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
def gcdlist(lista):
    if len(lista) == 1:
        return lista[0]
    else:
        from functools import reduce
        return reduce(gcd,lista)
first = A.pop(0)
ans = []
for i in range(first,A[0]+1):
    A[0] = i
    ans.append(gcdlist(A))
print(max(ans))

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

import sys
from fractions import gcd
input = sys.stdin.readline

def init(init_val):
	#set_val from input
	for i in range(n):
		seg[i+num-1]=init_val[i]
		
	for i in range(num-2,-1,-1):
		seg[i]=gcd(seg[2*i+1],seg[2*i+2])
	
def update(k,x):
	k+= num - 1 
	seg[k]=x;
	while k:
		k = (k-1)//2
		seg[k]=gcd(seg[2*i+1],seg[2*i+2])
		

def query(p,q):
	if q<=p:
		return ide_else
	p+= num-1
	q+= num-2
	res=ide_else
	while q-p>1:
		if p&1 == 0:res = gcd(res,seg[p])
		if q&1 == 0:
			res = gcd(res,seg[1])
			q-=1
	if p == q:res = gcd(res,seg[p])
	else:res = gcd(gcd(res,seg[p]),seq[q])
	return res
	
n = int(input())
a = tuple(map(int.input().split()))

#basic element
ide_else = 0

num = 2**(n-1).bit_length()
seg = [ide_else]*2*num
init(a)

ans = -1
for i in range(n):
	ans = max(ans,gcd(query(0,i),query(i+1,n)))
	
print(ans)
		
 
      


Compiler output:
a.cc:6:10: error: invalid preprocessing directive #set_val
    6 |         #set_val from input
      |          ^~~~~~~
a.cc:39:2: error: invalid preprocessing directive #basic
   39 | #basic element
      |  ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:16:9: error: expected unqualified-id before 'while'
   16 |         while k:
      |         ^~~~~
Language: C++

import sys
from fractions import gcd
input = sys.stdin.readline

def init(init_val):
	#set_val from input
	for i in range(n):
		seg[i+num-1]=init_val[i]
		
	for i in range(num-2,-1,-1):
		seg[i]=gcd(seg[2*i+1],seg[2*i+2])
	
def update(k,x):
	k+= num - 1 
	seg[k]=x;
	while k:
		k = (k-1)//2
		seg[k]=gcd(seg[2*i+1],seg[2*i+2])
		

def query(p,q):
	if q<=p:
		return ide_else
	p+= num-1
	q+= num-2
	res=ide_else
	while q-p>1:
		if p&1 == 0:res = gcd(res,seg[p])
		if q&1 == 0:
			res = gcd(res,seg[1])
			q-=1
	if p == q:res = gcd(res,seg[p])
	else:res = gcd(gcd(res,seg[p]),seq[q])
	return res
	
n = int(input())
a = tuple(map(int.input().split()))

#basic element
ide_else = 0

num = 2**(n-1).bit_length()
seg = [ide_else]*2*num
init(a)

ans = -1
for i in range(n):
	ans = max(ans,gcd(query(0,i),query(i+1,n)))
	
print(an)
		
 
      


Compiler output:
a.cc:6:10: error: invalid preprocessing directive #set_val
    6 |         #set_val from input
      |          ^~~~~~~
a.cc:39:2: error: invalid preprocessing directive #basic
   39 | #basic element
      |  ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:16:9: error: expected unqualified-id before 'while'
   16 |         while k:
      |         ^~~~~
Language: Java

import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   int[] a = new int[N];
   for(int i=0;i<N;i++) 
   {
     a[i]= sc.nextInt();
   }
   
   int[] forans = new int[N];
   int tmp =0;
   for(int i=0;i<N;i++)
   {
     tmp=a[0];
     for(int k=0;k<i;k++)
     {         
        tmp = gcd(tmp,a[k]);
     }
     for(int k=i+1;k<N;k++)
     {
        tmp = gcd(tmp,a[k]);
     }
     forans[i]=tmp;
   }
   Arrays.sort(forans);
   
   System.out.println(forans[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:20: error: incompatible types: possible lossy conversion from long to int
        tmp = gcd(tmp,a[k]);
                 ^
Main.java:24: error: incompatible types: possible lossy conversion from long to int
        tmp = gcd(tmp,a[k]);
                 ^
2 errors
Language: C++

N = int(input())
l = list(map(int, input().split()))
l_gcd = [None] * N
l_gcd[0] = l[0]


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


for i in range(1, N):
    l_gcd[i] = gcd(l_gcd[i-1], l[i])

r_gcd = [None] * N
r_gcd[-1] = l[-1]

for i in range(2, N+1):
    r_gcd[-i] = gcd(r_gcd[-i+1], l[-i])

max_gcd = max(l_gcd[-2], r_gcd[1])

for i in range(1, N-1):
    max_gcd = max(max_gcd, gcd(l_gcd[i-1], r_gcd[i+1]))

print(max_gcd)

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

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> vect(n,0);
  // storing in vector
  for (int i = 0; i < n; i++)
    cin >> vect[i];
   vector<int> l(n,0),r(n,0);
  // base initialization
  l[0] = vect[0];
  r[n-1] = vect[n-1];
  // finding gcd (from right and left side)
  for(int i = 1; i < n; i++){
   	l[i] = __gcd(l[i-1],vect[i]);
    r[n-i-1] = __gcd(r[n-i],vect[n-i-1]);
  }
  // tactic
  l.push_front(0);
  r.push_back(0);
  int maxi = 0;
  int temp;
  for (int i = 1; i < n; i++){
  	temp = __gcd(l[i-1], r[i+1]);
    (temp > maxi)? maxi = temp : maxi = maxi;
  }
  cout << maxi << '\n';

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'class std::vector<int>' has no member named 'push_front'
   22 |   l.push_front(0);
      |     ^~~~~~~~~~
Language: C++

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<set>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(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 main() {
	int N = getint();
	int A[100000];
	rep(i, N) A[i] = getint();

	set<int> ST;
	int M = sqrt(A[0]);
	for (int i = M; i >= 1; i--) {
		if (A[0] % i == 0) {
			ST.insert(i);
			ST.insert(A[0] / i);
		}
	}
	M = sqrt(A[1]);
	for (int i = M; i >= 1; i--) {
		if (A[1] % i == 0) {
			ST.insert(i);
			ST.insert(A[1] / i);
		}
	}
	for (auto itr = ST.rbegin(); itr != ST.rend(); itr++) {
		int k = 0;
		rep(i, N) {
			if (A[i] % (*itr)) k++;
			if (k > 1) break;
		}
		if (k <= 1) {
			printf("%d", *itr);
			break;
		}
	}

	Would you please return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: 'sqrt' was not declared in this scope
   43 |         int M = sqrt(A[0]);
      |                 ^~~~
Language: C++

//http://drken1215.hatenablog.com/entry/2019/04/27/224100_1

#include <iostream>
#include <vector>
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; }

signed main() {
  cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

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

    // 累積 GCD (左と右両方)
    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:14:18: error: 'setprecision' was not declared in this scope
   14 |     cout<<fixed<<setprecision(15);
      |                  ^~~~~~~~~~~~
a.cc:5:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    4 | #include <vector>
  +++ |+#include <iomanip>
    5 | using namespace std;
Language: C++

//http://drken1215.hatenablog.com/entry/2019/04/27/224100_1

#include <iostream>
#include <vector>
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() {
  	cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

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

    // 累積 GCD (左と右両方)
    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:14:18: error: 'setprecision' was not declared in this scope
   14 |     cout<<fixed<<setprecision(15);
      |                  ^~~~~~~~~~~~
a.cc:5:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    4 | #include <vector>
  +++ |+#include <iomanip>
    5 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int abc(int a,int b){
  int n;
  if(b==0)return a;
  while(a%b!=0){
    n=a%b;
    a=b;
    b=n;
  }
  return b;
}
int main() {
  int  n;
  cin>>n;
  vector<int> a(n),s(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    int h=0;
    int g=i+1;
    vector<int> l(n+10);
    l[0]=a[0];
    if(i==0) l[0]=0;
    vector<int> r(n+10);
    while(h+1<i){
      l[h+1]=abc(l[h],a[h+1]);
      h++;
    }
    r[g]=a[g];
    while(g+1<n){
      r[g+1]=abc(r[g],a[g+1]);
      g++;
    }
    
    s[i]=abc(l[h],r[g]);
    
  }
  int ans=0;
  for(int i=0;i<n;i++){
    ans=max(s[i],ans);
    
  }
  cout<<ans<<endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:45:19: error: expected '}' at end of input
   45 |   cout<<ans<<endl;
      |                   ^
a.cc:13:12: note: to match this '{'
   13 | int main() {
      |            ^
Language: C

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

int gcd(int x, int y)
{
    if(x < y)   swap(x, y);
    if(y == 0)  return x;

    return gcd(x % y, 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){
        L[i] = R[i] = A[i];
    }
    for(int i = 1; i < N; i++){
        L[i] = gcd(L[i-1], L[i]);
        R[N-i-1] = gcd(R[N-i-1], R[N-i]);
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
        if(i == 0){
            ans = max(ans, R[i+1]);
            continue;
        }
        if(i == N-1){
            ans = max(ans, L[i-1]);
            continue;
        }
        ans = max(ans, gcd(L[i-1], R[i+1]));
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <cstdio>
#include <vector>

using namespace std;

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

int main()
{
    int N;
    scanf("%d", &N);
    vector<int> v(N);

    for (int i = 0; i < N; i++)
    {
        scanf("%d", &v[i]);
    }

    if (N == 2)
    {
        printf("%d\n", max(v[0], v[i]));
        return 0;
    }

    int gcd = v[0];
    for (int i = 1; i < N; i++)
    {
        gcd = get_gcd(gcd, v[i]);
    }

    for (int i = 0; i < N; i++)
    {
        v[i] /= gcd;
    }

    int agcd = v[0];
    bool updated = false;
    for (int i = 1; i < N; i++)
    {
        int tmp_gcd = get_gcd(agcd, v[i]);
        if (!updated && tmp_gcd == 1)
        {
            //skip
            updated = true;
        }
        else
        {
            agcd = tmp_gcd;
        }
    }

    int aagcd = v[N - 1];
    updated = false;
    for (int i = N - 2; i >= 0; i--)
    {
        int tmp_gcd = get_gcd(aagcd, v[i]);
        if (!updated && tmp_gcd == 1)
        {
            updated = true;
        }
        else
        {
            aagcd = tmp_gcd;
        }
    }

    printf("%d\n", max(agcd, aagcd) * gcd);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:36: error: 'i' was not declared in this scope
   26 |         printf("%d\n", max(v[0], v[i]));
      |                                    ^
Language: Java

package main.java.tasks;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.io.PrintWriter;

public class Task {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int n = in.nextInt();
        int res = -1;
        int[] ar = new int[n];
        for (int i = 0; i < n; i++) {
            ar[i] = in.nextInt();
        }
        int[] gcd_nat = new int[n];
        int[] gcd_rev = new int[n];
        gcd_nat[0] = ar[0];
        gcd_rev[n - 1] = ar[n - 1];
        for (int i = 1; i < n; i++) {
            gcd_nat[i] = gcd(gcd_nat[i - 1], ar[i]);
            gcd_rev[n - 1 - i] = gcd(gcd_rev[n - i], ar[n - 1 - i]);
        }
        for (int i = 1; i < n-1; i++) {
            res = Math.max(gcd(gcd_nat[i-1], gcd_rev[i+1]),res);
        }
        res = Math.max(res,gcd_nat[n-2]);
        res = Math.max(res,gcd_rev[1]);

        out.println(res);
    }

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


}


Compiler output:
Main.java:8: error: class Task is public, should be declared in a file named Task.java
public class Task {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
#include <math.h>

using namespace std;
#define rep(i,n) for (int i = 0; i < n; i++)
#define vi vector<int>

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; }

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

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  vi a(n); rep(i, n) cin >> a[i];
  vi lgcd(n),rgcd(n);

  lgcd[0] = a[0];
  for (int i = 1; i < n; i++) lgcd[i] = gcd(lgcd[i-1],a[i-1]);

  rgcd[n-1] = a[n-1];
  for (int i = n-2; i >= 0; i--) rgcd[i] = gcd(rgcd[i+1],a[i+1]);

  int ans = 0;
  chmax(ans,rgcd[0]);// i = 0 は別処理
  for(int i = 1; i < n-1; i++){
    chmax(ans, gcd(lgcd[i],rgcd[i]));
  }
  chmax(ans, lgcd[n-1]);// i = n-1 も別処理

  std::cout << ans << '\n';
}


Compiler output:
a.cc:16:7: error: 'll' does not name a type
   16 | const ll INF = 1LL << 60;
      |       ^~
Language: C++

#include <bits/stdc++.h> 
using namespace std; 
  
// Function to return the maximized gcd 
// after removing a single element 
// from the given array 
long long MaxGCD(long long a[], long long n) 
{ 
  
    // Prefix and Suffix arrays 
    int Prefix[n + 2]; 
    int Suffix[n + 2]; 
  
    // Single state dynamic programming relation 
    // for storing gcd of first i elements 
    // from the left in Prefix[i] 
    Prefix[1] = a[0]; 
    for (int i = 2; i <= n; i += 1) { 
        Prefix[i] = __gcd(Prefix[i - 1], a[i - 1]); 
    } 
  
    // Initializing Suffix array 
    Suffix[n] = a[n - 1]; 
  
    // Single state dynamic programming relation 
    // for storing gcd of all the elements having 
    // greater than or equal to i in Suffix[i] 
    for (int i = n - 1; i >= 1; i -= 1) { 
        Suffix[i] = __gcd(Suffix[i + 1], a[i - 1]); 
    } 
  
    // If first or last element of 
    // the array has to be removed 
    int ans = max(Suffix[2], Prefix[n - 1]); 
  
    // If any other element is replaced 
    for (int i = 2; i < n; i += 1) { 
        ans = max(ans, __gcd(Prefix[i - 1], Suffix[i + 1])); 
    } 
  
    // Return the maximized gcd 
    return ans; 
} 

int main()
{
long long n;
long long a[n];
for(int i=0;i<n;i++)
cin>>a[i];
cout<<MaxGCD(a,n);
return 0;
}


Compiler output:
a.cc: In function 'long long int MaxGCD(long long int*, long long int)':
a.cc:19:26: error: no matching function for call to '__gcd(int&, long long int&)'
   19 |         Prefix[i] = __gcd(Prefix[i - 1], a[i - 1]);
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
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:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:19:26: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('int' and 'long long int')
   19 |         Prefix[i] = __gcd(Prefix[i - 1], a[i - 1]);
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:29:26: error: no matching function for call to '__gcd(int&, long long int&)'
   29 |         Suffix[i] = __gcd(Suffix[i + 1], a[i - 1]);
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:29:26: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('int' and 'long long int')
   29 |         Suffix[i] = __gcd(Suffix[i + 1], a[i - 1]);
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

long long gcd(long long x, long long y) {
    long long a = min(x, y), b = max(x, y);
    if (b % a == 0)
        return a;
    
    return (gcd(a, ba));
}

int main() {
    long long n, *a;
    cin >> n;
    a = new long long[n];
    for (int i =0; i < n;i++)
        cin >> a[i];

    long long *r = new long long[n], *l = new long long[n];

    l[0] = a[0];
    r[n-1] = a[n-1];

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

    long long ans = r[1];

    for (long long i = 1; i < n-1; i++) {
        long long x = gcd(l[i-1], r[i+1]);
        ans = max(ans, x);
    }

    ans = max(l[n-2], ans);

    cout << ans << endl;

    return 0;
}

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

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:40: error: no match for call to '(std::vector<int>) (int&)'
   16 |   for (int i = 0; i < n ; i++) cin >> a(i);
      |                                       ~^~~
Language: C++

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:26: error: expected primary-expression before ',' token
   16 |   for (int i = 0; i < n ;, i++) cin >> a(i);
      |                          ^
a.cc:16:41: error: no match for call to '(std::vector<int>) (int&)'
   16 |   for (int i = 0; i < n ;, i++) cin >> a(i);
      |                                        ~^~~
Language: C++

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: expected ';' before '<' token
   16 |   for (int i = 0, i < n, i++) cin >> a(i);
      |                    ^~
      |                    ;
a.cc:16:21: error: expected primary-expression before '<' token
   16 |   for (int i = 0, i < n, i++) cin >> a(i);
      |                     ^
a.cc:16:29: error: expected ';' before ')' token
   16 |   for (int i = 0, i < n, i++) cin >> a(i);
      |                             ^
      |                             ;
a.cc:16:39: error: no match for call to '(std::vector<int>) (int&)'
   16 |   for (int i = 0, i < n, i++) cin >> a(i);
      |                                      ~^~~
Language: C++

#include <iosteam>
#include <algorithm>

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

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

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

import java.util.*;
 
public class Main{
	
	static int gcd(int a, int b){
		if(a<b){
			int temp= a;
			a=b;
			b=temp;
		}
		if(b==0) return a;
		return gcd(a%b,b);
	}
	
	
	public static void main(String []args){
	    Scanner sc= new Scanner(System.in);
	    
		int n=sc.nextInt();
		int[] A = new int [n];
		int[] L = new int [n];
		int[] R = new int [n];
		
		for(int i=0;i<n; i++){
		    A[i]=sc.nextInt();
		}
		
		L[0]=0;
		R[0]=0;
		
		for (int i=1; i<n; i++){
		    L[i]=gcd(L[i-1],A[i-1]);
		    R[i]=gcd(R[i-1],A[n-i]);
		    
		}
		
		int gcd=0;
		
		for (int i=0; i<n; i++){
		    int temp=gcd(L[i], R[n-i-1]);
		    
		    if(gcd<temp){
		        gcd=temp;
		    }
		    
		}
		System.out.println(gcd);
		
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main{
      | ^~~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
  int N, s, max = 0, flg = 1;
  cin >> N;
  int A[N], gcd[N];
  //A[i]以外のN - 1個の要素の最大公約数をgcd[i]とする。そのうちの最大値が今回の回答である。
  
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    gcd[i] = A[0];
  }
  gcd[0] = A[1];
  
  for(int i = 0; i < N; i++) {
    s = A[i];
    A[i] = 0;
    for(int j = 1; j <= s; j++) {
      for(int k = 0; k < N; k++) {
        if(A[k] % j != 0) {flg = 0; break;}
      }
      if(flg) gcd[i] = j;
      flg = 1;
    }
    A[i] = s;
  }
  
  for(int i = 0; i < N; i++) {
    if(gcd[i] > max) max = gcd[i];
  }
  
  cout << max;
  return 0;
}
  
  cout << max;
  return 0;
}

Compiler output:
a.cc:37:3: error: 'cout' does not name a type
   37 |   cout << max;
      |   ^~~~
a.cc:38:3: error: expected unqualified-id before 'return'
   38 |   return 0;
      |   ^~~~~~
a.cc:39:1: error: expected declaration before '}' token
   39 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
  
int gcd(int a, int b) {
  if(a > b) swap(a,b);
  if( a == 0) return b;
  else return gcd(b%a,a);
}

int main () {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> r(n+1);
  vector<int> l(n+1);
  rep(i,n) cin a.at(i);
  for(int i=1;i<=n;i++)
    r.at(i) = gcd(r.at(i),a.at(i-1));
  for(int i=n-1;i>=0;i--) 
    l.at(i) = gcd(l.at(i+1),a.at(i));
  int ans;
  rep(i,n) ans = max(ans,gcd(r.at(i),l.at(i+1));
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:15: error: expected ';' before 'a'
   17 |   rep(i,n) cin a.at(i);
      |               ^~
      |               ;
a.cc:23:48: error: expected ')' before ';' token
   23 |   rep(i,n) ans = max(ans,gcd(r.at(i),l.at(i+1));
      |                     ~                          ^
      |                                                )
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
typedef pair<int,int> P;
using vi=vector<long long>;
using vvi=vector<vector<long long>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const int inf=1000000009;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}

gcd(int a,int b){
  while(true){
  if(b==0)return a;
  if(a>b)swap(a,b);
  b=b%a;
  }
}
int main(){
  int n;cin>>n;
  int ans=inf;
  vi v(n),l(n),r(n);
  rep(i,n)cin>>v[i];
  l[0]=v[0];
  for(int i=1;i<n;i++){
    l[i]=gcd(v[i],l[i-1]);
  }
  r[n-1]=v[n-1];
  for(int i=n-2;i>=0;i--){
    r[i]=gcd(v[i],r[i+1]);
  }
  rep(i,n){
    chmin(ans,gcd(l[i-1],r[i+1]));
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc:11:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   11 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |            ^~~~
a.cc:11:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   11 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |                    ^~~~
a.cc:12:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   12 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |            ^~~~
a.cc:12:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   12 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |                    ^~~~
a.cc:14:1: error: ISO C++ forbids declaration of 'gcd' with no type [-fpermissive]
   14 | gcd(int a,int b){
      | ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
typedef pair<int,int> P;
using vi=vector<long long>;
using vvi=vector<vector<long long>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const int inf=1000000009;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}

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


Compiler output:
a.cc:11:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   11 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |            ^~~~
a.cc:11:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   11 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |                    ^~~~
a.cc:12:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   12 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |            ^~~~
a.cc:12:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   12 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |                    ^~~~
a.cc: In function 'int main()':
a.cc:16:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   ans=inf;
      |   ^~~
      |   abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
int64_t gcd(int64_t a,int64_t b) {
    if(a < b) {
        swap(a,b);
    }
    int64_t r = a;
    while(b != 0) {
        r = a % b;
        swap(b,r);
    }
    return r;
}
int main() {
  int n;
  cin >> n;
  vector<int64_t> A(n);
  for(int i = 0;i < n;i++) {
    cin >> A.at(i);
  }
  int64_t max = 0;
  int64_t GCD = 0;
  for(int i = 0;i < n;i++) {
    GCD = gcd(GCD,A.at(j));
  }
  int min_i = n;
  int min = GCD;
  for(int i = 0;i < n;i++) {
    if(gcd(GCD,A.at(i)) < min) {
      min = gcd(GCD,A.at(i));
      min_i = i;
    }
  }
  int64_t g = 0;
  for(int i = 0;i < n;i++) {
    if(i == min_i) {
      continue;
    }
    g = gcd(g,A.at(i));
  }
  cout << g << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:24: error: 'j' was not declared in this scope
   24 |     GCD = gcd(GCD,A.at(j));
      |                        ^
Language: C++

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

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	int min1(pow(10,9)), min2(pow(10, 9));
	for (auto& i : a) {
		cin >> i;
		if (i < min1) {
			min2 = min1;
			min1 = i;
		}
		else if (i < min2) {
			min2 = i;
		}
	}

	set<int> candidate;
	candidate.insert(1);
	for (int i = 2; i <= min1; ++i) {
		if (min1 % i == 0) {
			candidate.insert(i);
		}
	}
	for (int i = 2; i <= min2; ++i) {
		if (min2 % i == 0) {
			candidate.insert(i);
		}
	}

	int ret = 1;
	for (auto i = candidate.rbegin(); i != candidate.rend(); ++i) {
		int count = 0;
		for (auto& j : a) {
			if (j % *i) {
				if (count) {
					++count;
					break;
				}
				++count;
			}
		}
		if (count < 2) {
			ret = *i;
			break;
		}
	}

	cout << ret << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: 'pow' was not declared in this scope
   11 |         int min1(pow(10,9)), min2(pow(10, 9));
      |                  ^~~
Language: C++

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

int gcd(int a,int b) {
  if (a%b == 0) {
    return b;
  }else if (b%a == 0) {
    return a;
  }else if (a > b) {
    return gcd(a,a%b);
  }else{
    return gcd(b,b%a);
  }
}
  
int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  vector<int> W(N);
  for (int i=0; i<N; ++i) {
    cin >> V.at(i);
  }
  vector<int> A(N-1);
  vector<int> B(N-1);
  A.at(0) = V.at(0);
  for (int i=1; i<N-1; ++i) {
    A.at(i) = gcd(A.at(i-1),V.at(i));
  }
  B.at(0) = V.at(N-1)
  for (int i=1; i<N-1; ++i) {
    B.at(i) = gcd(A.at(N-i-1),B.at(i-1));
  }
  for (int i=0; i<N; ++i) {
    if (i == 0) {
      W.at(i) = B.at(N-2);
    }else if (i == N) {
      W.at(i) = A.at(N-2);
    }else{
      W.at(i) = gcd(A.at(i-1),B.at(N-i-2));
    }
  }
  int a = W.at(0);
  for (int i=1; i<N; ++i) {
    if (a < W.at(i)) {
      a = W.at(i);
    }
  }
  cout << a << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:22: error: expected ';' before 'for'
   30 |   B.at(0) = V.at(N-1)
      |                      ^
      |                      ;
   31 |   for (int i=1; i<N-1; ++i) {
      |   ~~~                 
a.cc:31:17: error: 'i' was not declared in this scope
   31 |   for (int i=1; i<N-1; ++i) {
      |                 ^
Language: Java

import java.util.*;

public class Main{
  static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] array = new int[n];

    for(int i=0; i<n; i++){
      array[i] = sc.nextInt();
    }

    int a = array[0];
    int b = array[n-1];
    int ans =0;
    int max_ans = 0;
    int pp;
    int ss;

    int[] l_gcd = new int[n];
    l_gcd[0] = array[0];
    for(int i=1; i<n-1; i++){
      l_gcd[i] = gcd(l_gcd[i-1],a[i]);
    }

    int[] r_lcd = new int[n];
    r_lcd[n-1] = a[n-1];

    for(int i=n-2; i>0; i--){
      r_lcd[i] = gcd(r_lcd[i+1],a[i]);
    }
    for(int i=0; i<n-2; i++){
      ans = gcd(l_gcd[i],r_lcd[i+2]);
      if(ans>max_ans){
        max_ans = ans;
      }
    }
    System.out.println(max_ans);






  }
}

Compiler output:
Main.java:25: error: array required, but int found
      l_gcd[i] = gcd(l_gcd[i-1],a[i]);
                                 ^
Main.java:29: error: array required, but int found
    r_lcd[n-1] = a[n-1];
                  ^
Main.java:32: error: array required, but int found
      r_lcd[i] = gcd(r_lcd[i+1],a[i]);
                                 ^
3 errors
Language: Java

import java.util.*;

public class Main{
  static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] array = new int[n];

    for(int i=0; i<n; i++){
      array[i] = sc.nextInt();
    }

    int a = array[0];
    int b = array[n-1];
    int ans =0;
    int max_ans = 0;
    int pp;
    int ss;

    int[] l_gcd = new int[n];
    l_gcd[0] = array[0];
    for(int i=1; i<n-1; i++){
      l_gcd[i] = gcd(l_gcd[i-1],a[i]);
    }

    int[] r_lcd = new int[n];
    r_lcd[n-1] = a[n-1];

    for(int i=n-2 i>0; i--){
      r_lcd[i] = gcd(r_lcd[i+1],a[i]);
    }
    for(int i=0; i<n-2; i++){
      ans = gcd(l_gcd[i],r_lcd[i+2])
      if(ans>max_ans){
        max_ans = ans;
      }
    }
    System.out.println(max_ans);






  }
}

Compiler output:
Main.java:31: error: ';' expected
    for(int i=n-2 i>0; i--){
                 ^
Main.java:35: error: ';' expected
      ans = gcd(l_gcd[i],r_lcd[i+2])
                                    ^
2 errors
Language: C++

#include <iostream>
using namespace std;
#define Nmax 100000

int n;
int a[Nmax];

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

int Lgcd(int i)
{
	if (i <= 0) return 0;
	return gcd(Lgcd(i - 1), a[i - 1]);
}

int Rgcd(int i)
{
	if (i >= n) return 0;
	return gcd(Rgcd(i + 1), a[i]);
}

int main()
{
	cin >> n; 
	for (int i = 0; i < n; i++) {
		scanf_s("%d", &a[i]);
	}

	int m = 0;

	for (int i = 0; i < n; i++) {
		int mi = gcd(Lgcd(i), Rgcd(i + 1));
		if (mi > m) m = mi;
	}

	printf("%d\n", m);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   37 |                 scanf_s("%d", &a[i]);
      |                 ^~~~~~~
      |                 scanf
Language: Java

import java.util.*;

public class Main{
  static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] array = new int[n];

    for(int i=0; i<n; i++){
      array[i] = sc.nextInt();
    }

    int a = array[0];
    int b = array[n-1];
    int ans =0;
    int max_ans = 0;
    int pp;
    int ss;

    for(int i=0; i<n; i++){
      pp =array[0];
      ss =array[n-1];
      uu = 0;
      if(i==0){
         ans = array[1];
         for(int j=2; j<n; j++){
           ans = gcd(ans,array[j]);
         }
       }else if(i>0 && i<n-1){
         for(int j=1; j<i; j++){//左側のgcd
           pp = gcd(pp,array[j]);
         }
         for(int j=n-2; j>i; j--){//右側のgcd
           ss = gcd(ss,array[j]);
         }
         ans = gcd(pp,ss);

       }else if(i==n-1){
         for(int j=1; j<n-1; j++){
           ans = array[0];
           ans = gcd(ans,array[j]);
         }
       }

       if(ans>max_ans){
         max_ans = ans;
       }



    }
    System.out.println(max_ans);
  }
}

Compiler output:
Main.java:25: error: cannot find symbol
      uu = 0;
      ^
  symbol:   variable uu
  location: class Main
1 error
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

long long gcd(long long n1, long long n2)
{
    if (n1 < n2) std::swap(n1, n2);

    long long m;
    do {
        m = n1 % n2;
        n1 = n2;
        n2 = m;
    } while(m != 0);

    return b;
}

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

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

    std::vector<long long> L(N+1);
    L[0] = 0;
    for (int i = 0; i < N; i++) {
        L[i+1] = gcd(L[i], A[i]);
    }

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

    long long max_g = 0;
    for (int i = 0; i < N; i++) {
        max_g = std::max(max_g, gcd(L[i], R[i]));
    }

    std::cout << max_g << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'long long int gcd(long long int, long long int)':
a.cc:17:12: error: 'b' was not declared in this scope
   17 |     return b;
      |            ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

long long gcd(long long n1, long long n2)
{
    if (n1 < n2) std::swap(n1, n2);
    long long m;
    do {
        m = n1 % n2;
        n1 = n2;
        n2 = m;
    } while(m != 0);

    return b;
}

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

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

    long long max_g = 0;
    for (int i = 0; i < N; i++) {
        long long g = (i == 0) ? A[1] : A[0];
        for (int j = 0; j < N; j++) {
            if (j == i) continue;
            g = gcd(g, A[j]);
        }
        max_g = std::max(max_g, g);
    }

    std::cout << max_g << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'long long int gcd(long long int, long long int)':
a.cc:16:12: error: 'b' was not declared in this scope
   16 |     return b;
      |            ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

long long gcd(long long n1, long long n2)
{
    long long b = std::max(n1, n2);
    long long s = std::min(n1, n2);

    long long m
    do {
        m = b % s;
        b = s;
        s = m;
    } while(m != 0);

    return b;
}

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

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

    long long max_g = 0;
    for (int i = 0; i < N; i++) {
        long long g = (i == 0) ? A[1] : A[0];
        for (int j = 0; j < N; j++) {
            if (j == i) continue;
            if (g < 0);
            g = gcd(g, A[j]);
        }
        max_g = std::max(max_g, g);
    }

    std::cout << max_g << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'long long int gcd(long long int, long long int)':
a.cc:11:5: error: expected initializer before 'do'
   11 |     do {
      |     ^~
a.cc:15:13: error: 'm' was not declared in this scope
   15 |     } while(m != 0);
      |             ^
Language: C++

//https://atcoder.jp/contests/abc125/tasks/abc125_c
#include <iostream>
#include <vector>
//#include <numeric>
using namespace std;
//解説みた
int Gcd(int a,int b)
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
    }
}

int gcd(int a,int b){
    while (true){
        if (a>b){
            a-=b;
        }else if(b>a){
            b-=a;
        }else{
            return a;
        }
    }
}

int getMax(int a,int b,int c){
    if(a>=b){
        if(c>=a){
            return c;
        }else if(b>=c){
            return a;
        }
    }else{
        if(c>=b){
            return c;
        }
    }
    return b;
}

int Check3Gcd(int a,int b, int c){
    int d1,d2,d3;
    int b1=b;
    d1=CheckGcd(a,b);
    d2=CheckGcd(b,c);
    d3=CheckGcd(a,c);
    return getMax(d1,d2,d3);
}

int main(){
    int N;
    cin >> N;
    int *V = new int[N];
    for(int i = 0; i<N;i++){
    cin >> V[i];
    }
    if(N==2){
        if(V[0]>V[1]){
            cout<<V[0]<<endl;
        }else{
            cout << V[1]<<endl;
        }
        return 0;
    }

    int *L = new int[N-1];
    int *R = new int[N-1];
    L[0]=gcd(V[0],V[1]);
    R[0]=gcd(V[N-1],V[N-2]);
    for(int i=1;i<N-4;i++){
        L[i]=gcd(L[i-1],V[i+1]);
        R[i]=gcd(R[i-1],V[N-2-i]);
    }
    L[N-3]=V[0];
    R[N-3]=V[N-1];
    for(int i=1;i<N-2;i++){
        L[N-3]=gcd(L[N-3],V[i]);
        R[N-3]=gcd(R[N-3],V[N-i-1]);
    }

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

    int Max=0;
    for(int i=0;i<N-4;i++){
        if (Max<gcd(L[i],R[N-i-5])){
            Max=gcd(L[i],R[N-i-5]);
        }
    }

    if(Max<gcd(L[N-3],V[N-1]))Max=gcd(L[N-3],V[N-1]);
    if(Max<gcd(R[N-3],V[0]))Max=gcd(R[N-3],V[0]);
    if(Max<L[N-2])Max=L[N-2];
    if(Max<R[N-2])Max=R[N-2];



/*
    for(int i=0;i<N-1;i++){
        cout<<L[i]<<",";
    }
    cout<<gcd(L[N-3],V[N-1]);
    cout <<endl;
    for(int i=0;i<N-1;i++){
        cout<<R[i]<<",";
    }
    cout<<gcd(R[N-3],V[0]);
    cout <<endl;
    */
    

    cout << Max << endl;
    return 0;

}

Compiler output:
a.cc: In function 'int Gcd(int, int)':
a.cc:15:24: error: 'gcd' was not declared in this scope; did you mean 'Gcd'?
   15 |                 return(gcd(b,a%b));
      |                        ^~~
      |                        Gcd
a.cc: In function 'int Check3Gcd(int, int, int)':
a.cc:49:8: error: 'CheckGcd' was not declared in this scope; did you mean 'Check3Gcd'?
   49 |     d1=CheckGcd(a,b);
      |        ^~~~~~~~
      |        Check3Gcd
Language: C++

//https://atcoder.jp/contests/abc125/tasks/abc125_c
#include <iostream>
using namespace std;
int CheckGcd(int a,int b){
    while (b!=a){
        if (a>b){
            a-=b;
        }else{
            b-=a;
        }   
    }
    return a;
}

int getMax(int a,int b,int c){
    if(a>=b){
        if(c>=a){
            return c;
        }else if(b>=c){
            return a;
        }
    }
    return b;
}

int Check3Gcd(int a,int b, int c){
    int d1,d2,d3;
    int b1=b;
    d1=CheckGcd(a,b);
    d2=CheckGcd(b,c);
    d3=CheckGcd(a,c);
    return getMax(d1,d2,d3);
}

int main(){
    int N;
    cin >> N;
    int *V = new int[N];
    for(int i = 0; i<N;i++){
    cin >> V[i];
    if(N==2){
        if(V[0]>V[1]){
            cout<<V[0]<<endl;
        }
        cout << V[1]<<endl;
        return 0;
    }


    for(int i=0;i<N-2;i++){
        V[i+2]=Check3Gcd(V[i],V[i+1],V[i+2]);
    }

    cout << V[N-1] << endl;
    return 0;
}

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

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

public class　Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n]; int[] G = new int[n];
		int[] GL = new int[n]; int[] GR = new int[n];

		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		GL[0] = 0; GR[n-1] = 0;

		for(int i = 1; i < n; i++) {
			GL[i] = gcm(GL[i-1], a[i-1]);
			GR[n-i-1] = gcm(GR[n-i],a[n-i]);
		}

		for(int i =0; i < n; i++)
			G[i] = gcm(GR[i],GL[i]);

		Arrays.parallelSort(G);

		System.out.println(G[n-1]);

		sc.close();
	}

	public static int gcm(int a, int b) {
		if(a == 0 || b == 0) return Math.max(a, b);
		if(a < b)  {
			return gcm(b, a);
		}else {
			if(a%b == 0) {
				return b;
			}else {
				return gcm(b, a%b);
			}
		}
	}
}

Compiler output:
Main.java:4: error: illegal character: '\u3000'
public class?Main{
            ^
1 error