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

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
using ll = long long;


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

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

int lb=1, ub = 1000000001;
    while( ub-lb > 1 ){
        int mid = (lb + ub) / 2;
        if (C(mid, A)) {
            lb = mid;
        } else {
            ub = mid;
        }

cout << lb;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: expected ')' before ';' token
   20 | for(int i=0; i<N; i++;){
      |    ~                 ^
      |                      )
a.cc:20:23: error: expected primary-expression before ')' token
   20 | for(int i=0; i<N; i++;){
      |                       ^
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:16:12: note: to match this '{'
   16 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
using ll = long long;


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

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

int lb=1, ub = 1000000001;
    while( ub-lb > 1 ){
        int mid = (lb + ub) / 2;
        if (C(mid, A)) {
            lb = mid;
        } else {
            ub = mid;
        }

cout << lb;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: expected ')' before ';' token
   20 | for(int i=0; i<N; i++;) cin >> A[i];
      |    ~                 ^
      |                      )
a.cc:20:23: error: expected primary-expression before ')' token
   20 | for(int i=0; i<N; i++;) cin >> A[i];
      |                       ^
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:16:12: note: to match this '{'
   16 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
using ll = long long;


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

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

int lb=1, ub = 1000000001;
    while( ub-lb > 1 ){
        int mid = (lb + ub) / 2;
        if (C(mid, A)) {
            lb = mid;
        } else {
            ub = mid;
        }

cout << lb;
return 0;
}

Compiler output:
a.cc: In function 'bool C(int, std::vector<int>)':
a.cc:9:29: error: expected ';' before ')' token
    9 | for(int i=0; i<v.size(), i++){
      |                             ^
      |                             ;
a.cc: In function 'int main()':
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:16:12: note: to match this '{'
   16 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
using ll = long long;


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

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

int lb=1, ub = 1000000001;
    while( ub-lb > 1 ){
        int mid = (lb + ub) / 2;
        if (C(mid, A)) {
            lb = mid;
        } else {
            ub = mid;
        }

cout << lb;
return 0;
}

Compiler output:
a.cc: In function 'bool C(int, std::vector<int>)':
a.cc:9:29: error: expected ';' before ')' token
    9 | for(int i=0; i<v.size(), i++){
      |                             ^
      |                             ;
a.cc:13:12: error: expected ';' before '}' token
   13 | return true
      |            ^
      |            ;
   14 | }
      | ~           
a.cc: In function 'int main()':
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:16:12: note: to match this '{'
   16 | int main() {
      |            ^
Language: C++

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

using namespace std;

int main()
{
    using ll = long long;
    
    int n;
    cin >> n;
    
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    vector<ll> b(n), c(n);
    b[0] = a[0];
    c[n - 1] = a[n - 1];
    
    for (int i = 1; i < n; i++) {
        b[i] = __gcd(b[i - 1], a[i]);
        c[n - i - 1] = __algo_gcd(c[n - i], a[n - i - 1]);
    }
    
    ll ans = 0;
    
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            ans = max(ans, c[i + 1]);
        } else if (i == n - 1) {
            ans = max(ans, b[i - 1]);  
        } else {
            ans = max(ans, __gcd(b[i - 1], c[i + 1]));   
        }
    }
    
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:24: error: '__algo_gcd' was not declared in this scope
   25 |         c[n - i - 1] = __algo_gcd(c[n - i], a[n - i - 1]);
      |                        ^~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int gcd(int a, int b) {
  if (a > b) {
    int t = a;
    a = b;
    b = t;
  }
  while(b) {
    a = a % b;
    int t = a;
    a = b;
    b = a;
  }
  return a;
}
int main () {
  int A[100005];
  int N;
  cin >> N;
  for (int i = 1; i <= N; i ++) cin >> A[i];
  int L[100005];
  int R[100004];
  L[N + 1] = 0;
  R[0] = 0;
  for (int i = 1; i <= N; i ++) {
    L[i] = gcd(L[i - 1], A[i]);
  }
  for (int j = N; j > 0; j --) {
    R[i] = gcd(R[i + 1], A[i]);
  }
  int ans = 1000000001;
  for (int i = 1; i <= N; i ++) {
    int k = gcd(L[i - 1], R[i + 1]);
    if (ans > k) ans = k;
  }
  cout << ans << endl;
}


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

#incude<iostream>
using namespace std;
int gcd(int a, int b) {
  if (a > b) {
    int t = a;
    a = b;
    b = t;
  }
  while(b) {
    a = a % b;
    t = a;
    a = b;
    b = a;
  }
  return a;
}
int main () {
  int A[100005];
  int N;
  cin >> N;
  for (int i = 1; i <= N; i ++) cin >> A[i];
  int L[100005];
  int R[100004];
  L[N + 1] = 0;
  R[0] = 0;
  for (int i = 1; i <= N; i ++) {
    L[i] = gcd(L[i - 1], A[i]);
  }
  for (int j = N; j > 0; j --;) {
    R[i] = gcd(R[i + 1], A[i]);
  }
  int ans = 1000000001;
  for (int i = 1; i <= N; i ++) {
    int k = gcd(L[i - 1], R[i + 1]);
    if (ans > k) ans = k;
  }
  cout << ans << endl;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #incude; did you mean #include?
    1 | #incude<iostream>
      |  ^~~~~~
      |  include
a.cc: In function 'int gcd(int, int)':
a.cc:11:5: error: 't' was not declared in this scope
   11 |     t = a;
      |     ^
a.cc: In function 'int main()':
a.cc:20:3: error: 'cin' was not declared in this scope
   20 |   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 | #incude<iostream>
a.cc:29:30: error: expected ')' before ';' token
   29 |   for (int j = N; j > 0; j --;) {
      |       ~                      ^
      |                              )
a.cc:29:31: error: expected primary-expression before ')' token
   29 |   for (int j = N; j > 0; j --;) {
      |                               ^
a.cc:37:3: error: 'cout' was not declared in this scope
   37 |   cout << ans << endl;
      |   ^~~~
a.cc:37:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:18: error: 'endl' was not declared in this scope
   37 |   cout << ans << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #incude<iostream>
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int EA(int a,int b){
    if (a%b==0){
        return ;
      }else{
        return EA(b,a%b);
      }
}
int main(){
  int N;
  cin>>N;
  int A[N];
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  int tmp1[N+1];
  int tmp2[N+1];
  tmp1[0]=1;
  tmp2[0]=1;

  for(int i=0;i<N;i++){
    tmp1[i+1] = EA(tmp1[i],A[i]);
  }
  //tmp2[i]:後ろからi番目までの最大公約数
  for(int i=0;i<N;i++){
    tmp2[i+1] = EA(tmp2[i],A[N-1-i]);
  }
  int ans = 0;
  for(int i=0;i<N;i++){
    ans = max(ans,EA(tmp1[i],tmp2[N-1-i]));
  }
  cout<<ans<<"\n";
}


Compiler output:
a.cc: In function 'int EA(int, int)':
a.cc:7:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
    7 |         return ;
      |         ^~~~~~
Language: Java

import java.time.Instant;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class Main {
	public static void main(String[] args){

		Long ans = 0l;
		Scanner sc = new Scanner(System.in);
		Long N = sc.nextLong();
		List<Long> aList = new ArrayList<>();

		for(Long i=0l; i<N; i++){
			aList.add(sc.nextLong());
		}

		aList = aList.stream().distinct().collect(Collectors.toList());


		if(aList.size()==2){
			System.out.println(Math.max(aList.get(0), aList.get(1)));
			return;

		}

		if(aList.size() == 1){
			System.out.println(aList.get(0));
			return;
		}

		//long tmpAns = gcd(aList.toArray(new Long[aList.size()]));
		//aList = aList.stream().map(n -> n/tmpAns).collect(Collectors.toList());



		for(Long i=0l; i<N; i++){
			Long tmp = aList.get(0);
			aList.remove(0);
			ans = Math.max(ans, gcd(aList.toArray(new Long[aList.size()])));
			aList.add(tmp);
		}

		ans = ans * tmpAns;
		System.out.println(ans);
	}

	public static final Long gcd(final Long... param) {
	    final int len = param.length;
	    Long g = biGcd(param[0], param[1]);
	    for (int i = 1; i < len - 1; i++) {
	        g = biGcd(g, param[i + 1]);
	    }
	    return g;
	}

	public static final long biGcd(Long a, Long b) {
	    //a > b にする（スワップ）
	    if (a < b) {
	        Long tmp = a;
	        a = b;
	        b = tmp;
	    }

	    //ユークリッドの互除法
	    Long r = -1l;
	    while (r != 0) {
	        r = a % b;
	        a = b;
	        b = r;
	    }

	    return a;    //b には r=0 の値が入るため、a を返す
	}
}


Compiler output:
Main.java:44: error: cannot find symbol
		ans = ans * tmpAns;
		            ^
  symbol:   variable tmpAns
  location: class Main
1 error
Language: C++


#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}


int n;
int a[110000];
int ans=-1;


void f(int s,bool b,int m){
  if(s<ans) return;
  if(n==m){
    ans=max(ans,s);
    return;
  }

  if(!b)
    f(s,true,m+1);

  f(__gcd(s,a[m]),b,m+1);
}

int main(){
  cin>>n;
  if(n==3) return;
  rep(i,n){
    cin>>a[i];
  }


  f(a[0],false,1);
  f(a[1],true,2);

  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:12: error: return-statement with no value, in function returning 'int' [-fpermissive]
   50 |   if(n==3) return;
      |            ^~~~~~
Language: Java

import java.util.*;

public class C {
    public static long gcd(long a, long b) {
        while (b != 0) {
            long tmp = b;
            b = a % b;
            a = tmp;
        }

        return a;
    }

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

        int n = sc.nextInt();

        int[] nums = new int[n];

        HashMap<Integer, Integer> divs = new HashMap<>();

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

        int[] prefixGCD = new int[n - 1];

        prefixGCD[0] = nums[0];

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

        int best = prefixGCD[n - 2];
        int runningGCDsuffix = nums[n - 1];

        for (int i = n - 2; i > 0; i--) {
            best = Math.max(best, (int) gcd(runningGCDsuffix, prefixGCD[i - 1]));
            runningGCDsuffix = (int) gcd(runningGCDsuffix, nums[i]);
        }

        best = Math.max(best, runningGCDsuffix);

        System.out.println(best);
    }
}

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

#include <bits/stdc++.h>
using namespace std;
#define INF 1e9

long long int gcd(long long int m, long long int n)
{
  long long int temp;
  while (m % n != 0)
    {
      temp = n;
      n = m % n;
      m = temp;
    }
  return n;
}

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

  vector<int> A;
  A.reserve(N);
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.emplace_back(a);
  }

  if (N == 2) {
    cout << max(A[0], A[1]) << endl;
    return 0;
  }
  sort(A.begin(), A.end());

  vector<int> B;
  B.reserve(N);
  for (int i = 1; i < N; i++) {
    int b = gcd(A[0], a[i]);
    B.emplace_back(b);
  }
  sort(B.rbegin(), B.rend());

  vector<int> C;
  C.reserve(N);
  for (int i = 0; i < N; i++) {
    if (i == 1) continue;
    int c = gcd(A[1], A[i]);
    C.emplace_back(c);
  }
  sort(C.rbegin(), C.rend());

  cout << max(B[1], C[1]) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:23: error: 'a' was not declared in this scope
   38 |     int b = gcd(A[0], a[i]);
      |                       ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map>       // pair
#include <string>
#include <stdio.h>
#include <numeric>
using namespace std;

int euclidean_gcd(int a, int b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}

int main(int argc, const char *argv[])
{
    int N;
    cin >> N;
    vector<int> A(N);


    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    if(N == 2)
    {
        cout<<max(A[0],A[1]);
        return 0;
    }
    int num_c = A[0];
    A.push_back(num_c);

    vector<int> GCD_p (N);

    for (int i = 0; i < N; i++)
    {
        GCD_p[i] = euclidean_gcd(A[i],A[i+1]);
        // cout<<GCD_p[i]<<endl;
    }

    int num = GCD_p.size();
    int o_GCD = 0;

    sort(GCD_p.begin(), GCD_p.end(), std::greater<int>());

    int GCD_out1 = GCD_p[N-3];
    vector<int> GCD_p_2 (N);
        for (int i = 1; i < N-1; i++)
    {
        GCD_p_2[i] = euclidean_gcd(A[i],A[i+1]);
        // cout<<GCD_p[i]<<endl;
    }

    int num = GCD_p.size();
    int o_GCD = 0;

    sort(GCD_p_2.begin(), GCD_p_2.end(), std::greater<int>());
 int GCD_out2 = GCD_p_2[N-3];

 cout<<max(GCD_out1,GCD_out2);
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:59:9: error: redeclaration of 'int num'
   59 |     int num = GCD_p.size();
      |         ^~~
a.cc:46:9: note: 'int num' previously declared here
   46 |     int num = GCD_p.size();
      |         ^~~
a.cc:60:9: error: redeclaration of 'int o_GCD'
   60 |     int o_GCD = 0;
      |         ^~~~~
a.cc:47:9: note: 'int o_GCD' previously declared here
   47 |     int o_GCD = 0;
      |         ^~~~~
Language: C++

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

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

	int min = 1000000001;
    int now = 0;
    int ans = 0;

    int cand = 0;
    sort(a, a+n);
    for (int i = 1; i < n; ++i){
        if (a[i]%a[1]!=0){
            break;
        }
        if (i==n-1){
            cand = a[1];
        }
    }

    for (int i = 0; i < n; ++i){
        for (int k = 0; k < n; ++k){
            if (a[k]!=0&&a[k]<min){
                min = a[k];
            }
        }

        int zero_num = 0;
        for (int i = 0; i < n; ++i){
            a[i] = a[i]%min;
            if (a[i]==0){
                zero_num++;
            }
        }
//        sort(a, a+n);

        if (zero_num==n||zero_num==n-1){
//            cout << zero_num << endl;
            sort(a, a+n);
            ans = max(min, a[n-1], cand);
            break;
        }else if(zero_num==n-2){
            sort(a, a+n);
/*
            cout << min << endl;
            cout << zero_num << endl;
            cout << a[n-1] << " " << a[n-2] << endl;
*/
            ans = max(a[n-1], a[n-2], cand);
            break;
        }
    }
    cout << ans << endl;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:48:22:   required from here
   48 |             ans = max(min, a[n-1], cand);
      |                   ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

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

    int min = 1000000001;
    int now = 0;
    int ans = 0;

    int cand = 0;
    sort(a, a+n);
    for (int i = 1; i < n; ++i){
        if (a[i]%a[1]!=0){
            break;
        }
        if (i==n-1){
            cand = a[1];
        }
    }

    for (int i = 0; i < n; ++i){
        for (int k = 0; k < n; ++k){
            if (a[k]!=0&&a[k]<min){
                min = a[k];
            }
        }

        int zero_num = 0;
        for (int i = 0; i < n; ++i){
            a[i] = a[i]%min;
            if (a[i]==0){
                zero_num++;
            }
        }
//        sort(a, a+n);

        if (zero_num==n||zero_num==n-1){
//            cout << zero_num << endl;
            sort(a, a+n);
            ans = max(min, a[n-1], cand);
            break;
        }else if(zero_num==n-2){
            sort(a, a+n);
/*
            cout << min << endl;
            cout << zero_num << endl;
            cout << a[n-1] << " " << a[n-2] << endl;
*/
            ans = max(a[n-1], a[n-2], cand);
            break;
        }
    }
    cout << ans << endl;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:48:22:   required from here
   48 |             ans = max(min, a[n-1], cand);
      |                   ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
int gcd(int a,int b)
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
    }
}
int main() {
int N,i,j;
  cin>>N;
  int A[N];
  int B[N];
  for(i=0;i<N;i++){
  cin>>A[i];
    B[i]=A[i-1];
  }
  B[0]=A[1];
    for(i=1;i<N;i++){
    B[i]=A[i-1];
  }
  for(j=0;j<N;i++){
  for(i=0;i<N;j++){
  if(i!=j){
  B[j]=gcd(A[i],B[j]);
    if(b[0]>B[j]) break;
  }
    
  }
    B[0]=max(B[0],B[j]);
  }

cout<<B[0]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:8: error: 'b' was not declared in this scope
   37 |     if(b[0]>B[j]) break;
      |        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000001
#define MOD 1e9+7
ll res=0;

ll gcd(ll a,ll b){
    ll c;
    if (a < b) {
        a+=b; b=a-b; a-=b;
    }

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


int main(){
	ll n;
	cin>>n;
	ll a[n];
	ll sum=0;
	for(ll i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	ll ans=gcd(a[0],a[1]);
	for(ll i=2;i<n;i++){
		ans=gcd(ans,a[i]);
	}
	sort(a,a+n,greater<ll>());
	ll tmp=sum;
	for(ll i=0;i<n;i++){
		tmp = sum;
		tmp -= a[i];
		if(i>0)ans = max(ans , gcd(a[0],tmp));
		else ans = max(ans , gcd(a[1],tmp));
	}
	sort(a,a+n);
	ll tmp=sum;
	for(ll i=0;i<n;i++){
		tmp = sum;
		tmp -= a[i];
		if(i>0)ans = max(ans , gcd(a[0],tmp));
		else ans = max(ans , gcd(a[1],tmp));
	}

	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:12: error: redeclaration of 'll tmp'
   45 |         ll tmp=sum;
      |            ^~~
a.cc:37:12: note: 'll tmp' previously declared here
   37 |         ll tmp=sum;
      |            ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,i,j;
    cin>>a;
    vector<int> number;
    for(i=0;i<a;i++)
    {
        int t;
        cin>>t;
        number.push_back(t);
    }
    if(a==2){
        b=number[0];
        c=number[1];
        while(1){
            int d=b%c;
            if(d==0){
                cout<<c<<endl;
                return 0;
            }
            b=c;
            c=d;
        }
    }
    sort(number.begin(),number.end());
    vector<int> mainasu;
    for(i=0;i<a-1;i++){
        int p=number[i+1]-number[i];
        if(p==0)
        p=1000000001;
        if(i>0){
            if(p==number[i]-number[i-1])
            p=number[i+1]-number[i-1];
        }
        mainasu.push_back(p);
    }
    if(number[0]>1){
    int o=number[0];
    }
    mainasu.push_back(o);
    sort(mainasu.begin(),mainasu.end());
    int d=mainasu[0];
    int e = mainasu[1];
    if(d==1000000001||e==100000001){
        for(i=0;i<a-1;i++){
            int p=number[i+1]-number[i];
            if(p==0){
                cout<<number[i]<<endl;
                return 0;
            }
        }
    }
    int check=0;
    for(i=0;i<a;i++){
        if(number[i]%d!=0)
        check++;
        if(check>1){
            d=1;
            break;
        }
    }
    check=0;
    for(i=0;i<a;i++){
        if(number[i]%e!=0)
        check++;
        if(check>1){
            e=1;
            break;
        }
    }
    if(d<e)
    cout<<e<<endl;
    else
    cout<<d<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:23: error: 'o' was not declared in this scope
   41 |     mainasu.push_back(o);
      |                       ^
Language: C++

#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
vector<int> get_primes(int n) {
  vector<int> primes, notPrimes(floor(sqrt(n)),0);
  for (int i = 2; i*i <= n; i++) {
    if (notPrimes[i]==1) continue;
    primes.push_back(i);
    for (int j = i*2; j <= n; j+=i) {
      notPrimes[j] = 1;
    }
  }
  return primes;
}

signed main() {
  int N;
  cin >> N;
  
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin>>a[i];
  
  vector<int> gcd(N);
  for (int i = 1; i < N; i++) {
    gcd[i] = __gcd(a[i-1],a[i]);
  }
  gcd[0] = __gcd(a[0],a[N-1]);
  
  int cnt = 0, ans = INF;
  for (int i = 0; i < N; i++) {
    if (gcd[i] == 1) {
      cnt++;
    } else {
      ans = min(gcd[i], ans);
    }
  }
  
  if (cnt >= 3) {
    ans = 1;
  } else if (cnt == 2) {
    
  } else {
    cnt = 0, ans1 = INF
    for (int i = 0; i < N; i++) {
      if (gcd[i] == ans) {
        cnt++;
      } else {
        ans1 = min(ans1, gcd[i]);
      }
    }
    if (cnt >= 3) {

    } else {
      ans = ans1; 
    }
  }
  cout << ans << endl; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:14: error: 'ans1' was not declared in this scope; did you mean 'ans'?
   45 |     cnt = 0, ans1 = INF
      |              ^~~~
      |              ans
a.cc:46:21: error: 'i' was not declared in this scope
   46 |     for (int i = 0; i < N; i++) {
      |                     ^
Language: C++

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

int gojo(int x,int y){
  if(x<y){
    int u =x;
    x=y;
    y=u;
  }
  int r=x%y;
  while(r!=0){
    a=b;
    b=r;
    r=a%b;
  }
  return r;
}

int koubai(vector<int> a);

int main(){
  
  int a=0,b,c,X,Y,n;
  cin>>n;
  vector<int> s(n),t(n),A(n);
  for(int i=0;i<n;i++){
    cin>>s.at(i);
  }
  vector<int> t(n)=s;
  for(int i=0;i<n;i++){
    t.erase(t.begin()+i);
    if(a<koubai(t);){
      a=koudbai(t);
    }
  }
  cout<<a<<endl;
}
int koubai(vector<int> a){
  int u=a.at(0);
  for(int i=1;i<n;i++){
    u=gojo(u,a.at(i);)
  }
  return u;
}
    
    
  


Compiler output:
a.cc: In function 'int gojo(int, int)':
a.cc:12:5: error: 'a' was not declared in this scope
   12 |     a=b;
      |     ^
a.cc:12:7: error: 'b' was not declared in this scope
   12 |     a=b;
      |       ^
a.cc: In function 'int main()':
a.cc:29:15: error: redeclaration of 'std::vector<int> t'
   29 |   vector<int> t(n)=s;
      |               ^
a.cc:25:20: note: 'std::vector<int> t' previously declared here
   25 |   vector<int> s(n),t(n),A(n);
      |                    ^
a.cc:32:20: error: expected primary-expression before ')' token
   32 |     if(a<koubai(t);){
      |                    ^
a.cc:33:9: error: 'koudbai' was not declared in this scope; did you mean 'koubai'?
   33 |       a=koudbai(t);
      |         ^~~~~~~
      |         koubai
a.cc: In function 'int koubai(std::vector<int>)':
a.cc:40:17: error: 'n' was not declared in this scope
   40 |   for(int i=1;i<n;i++){
      |                 ^
a.cc:41:21: error: expected ')' before ';' token
   41 |     u=gojo(u,a.at(i);)
      |           ~         ^
      |                     )
a.cc:41:22: error: expected primary-expression before ')' token
   41 |     u=gojo(u,a.at(i);)
      |                      ^
Language: C

#include<stdio.h>

int main(void){
  int i, n, check;
  int premin, min, ecou = 0, ocou = 0;
  
  scanf("%d", &n);
  int a[n];
  for(i = 0;i < n;i++){
    scanf("%d", &a[i]);
  }
  min = a[0];
  premin = a[0];
  for(i = 1;i < n;i++){
    if(min > a[i]){
      premin = min;
      min = a[i];
      check = i;
    }
  }
  int eche, oche;
  for(i = 0;i < n;i++){
    if(a[i] % 2 == 0){
      ecou++;
      eche = i;
    }
    else{
      ocou++;
      oche = i;
    }
  }

  if(ecou == 0 || ocou == 0){
    a[check] = premin;
    for(i = 0;i < n;i++){
      if(a[i] % premin != 0){
        premin--;
        if(premin <= 0){
          premin = 1;
        }
        i = 0;
      }
    }
    printf("%d\n", premin);
    return 0;
  }
  else if((ecou > 1 && ocou == 1) || (ecou == 1 && ocou > 1)){
    if(ecou > ocou){
      a[oche] = min;
    }
    else{
      a[eche] = min;
    }
    for(i = 0;i < n;i++){
      if(a[i] % min != 0){
        min--;
        if(min <= 0){
          min = 1;
        }
        i = 0;
      }
    }
  }
  else{
    a[check] = premin;
    for(i = 0;i < n;i++){
      if(a[i] % min != 0){
        min--;
        if(min <= 0){
          min = 1;
        }
        i = 0;
      }
    }
  printf("%d\n", min);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:77:1: error: expected declaration or statement at end of input
   77 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
long long a[100001],c,f,n,z,x,maxz=0;
long long s;
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>a[i];
    l=2;
    r=n;
    s=a[1];
    while(l!=r)
    {
        if(__gcd(s,a[l])<__gcd(s,a[r])){
            r--;
            s=__gcd(s,a[r+1]);
        }
        else{
            l++;
            s=_gcd(s,a[l-1]);
        }
    }
    maxz=max(maxz,s);
    s=a[n];
    l=1;
    r=n-1;
    while(l!=r)
    {
        if(__gcd(s,a[l])<__gcd(s,a[r])){
            r--;
            s=__gcd(s,a[r+1]);
        }
        else{
            l++;
            s=_gcd(s,a[l-1]);
        }
    }
    maxz=max(s,maxz);
    cout<<maxz<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'l' was not declared in this scope
   12 |     l=2;
      |     ^
a.cc:13:5: error: 'r' was not declared in this scope
   13 |     r=n;
      |     ^
a.cc:23:15: error: '_gcd' was not declared in this scope
   23 |             s=_gcd(s,a[l-1]);
      |               ^~~~
a.cc:38:15: error: '_gcd' was not declared in this scope
   38 |             s=_gcd(s,a[l-1]);
      |               ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, a, b, r;
    int min = 2147483647, pos = 0;
    cin >> n;
    int array[n];
    for (size_t i = 0; i < n; i++)
    {
        cin >> array[i];
    }
    sort(array, array + n);
    // for (size_t i = 0; i < n - 1; i++)
    // {
    //     a = array[i];
    //     for (size_t j = i + 1; j < n - 1; j++)
    //     {
    //         b = array[i];
    //         while ((r = a % b) != 0)
    //         {
    //             a = b;
    //             b = r;
    //         }
    //         if (min > b)
    //         {
    //             min = b;
    //             pos = i;
    //         }
    //     }
    // }
    for (size_t i = 0; i < n; i++)
    {
        if (array[i] < 2)
            continue;
        else if (array[i] == 2)
            pos = i;
        else if (num % 2 == 0)
            continue;
        double sqrtNum = sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                // 素数ではない
                continue;
            }
        }
        pos = i;
    }

    array[pos] = array[n - 1];
    a = array[0];
    cout << "min" << min << endl;
    cout << "pos" << pos << endl;

    for (size_t i = 0; i < n; i++)
    {
        cout << "array" << array[i] << endl;
    }

    for (size_t i = 0; i < n - 1; i++)
    {
        b = array[i + 1];
        while ((r = a % b) != 0)
        {
            a = b;
            b = r;
        }
        a = b;
    }

    cout << b << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:18: error: 'num' was not declared in this scope; did you mean 'enum'?
   40 |         else if (num % 2 == 0)
      |                  ^~~
      |                  enum
a.cc:42:31: error: 'num' was not declared in this scope; did you mean 'enum'?
   42 |         double sqrtNum = sqrt(num);
      |                               ^~~
      |                               enum
Language: Java

import java.util.Scanner;

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

	int n = scan.nextInt();
	int[] a = new int[n];
	int[] gcd = new int[n];
	int[] gcd2 = new int[n];

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

	int count = 0;
	int gcd[0] = a[0];
	for(int i = 1; i < n; i++){
	    int tmp = koyaku(gcd[i-1], a[i]);  //最大公約数
	    //最大公約数が1
	    if(tmp == 1 && i <= n-2){
		//その次の最大公約数も1
		if(koyaku(a[i], a[i+1]) == 1){
		    gcd[i] = koyaku(gcd[i-1], a[i+1]);
		    gcd[i+i] = koyaku(gcd[i-1], a[i+1]);
		}
		//その次の最大公約数 != 1
		else{
		    gcd[i] = koyaku(a[i], a[i+1]);
		    gcd[i+1] = koyaku(a[i], a[i+1]);
		    gcd[i-1] = koyaku(a[i], a[i+1]);
		}
		i++;
		count++;
	    }
	}

	if(count >= 2){
	    System.out.println(1);
	}else if(count == 1){
	    System.out.println(gcd[n-1]);
	}else{
	    //前準備
	    for(int i = 0; i < n; i++){
		gcd2[i] = a[i] / gcd[n-1];
	    }
	    
	    int count2 = 0;
	    for(int i = 1; i < n; i++){
		int tmp = koyaku(gcd2[i-1], gcd2[i]);  //最大公約数
		//最大公約数が1
		if(tmp == 1 && i <= n-2){
		    //その次の最大公約数も1
		    if(koyaku(gcd2[i], gcd2[i+1]) == 1){
			gcd2[i] = koyaku(gcd2[i-1], gcd2[i+1]);
			gcd2[i+1] = koyaku(gcd2[i-1], gcd2[i+1]);
		    }
		    //その次の最大公約数 != 1
		    else{
			int hoge = koyaku(gcd2[i], gcd2[i+1]);
			gcd2[i] = hoge;
			gcd2[i+1] = hoge;
			gcd2[i-1] = hoge;
		    }
		    i++;
		    count2++;
		}
	    }

	    if(count >= 2){
		System.out.println(gcd[n-1]);
	    }else if(count == 1){
		System.out.println(gcd[n-1]*gcd2[n-1]);
	    }
	}
	
    }
    
    static int koyaku(int a, int b){
	if(a < b){
	    int tmp = a;
	    a = b;
	    b = tmp;
	}

	while(b != 0){
	    int tmp = a % b;
	    a = a/b;
	    b = tmp;
	}

	return a;
    }
}



Compiler output:
Main.java:17: error: ']' expected
	int gcd[0] = a[0];
	        ^
Main.java:17: error: not a statement
	int gcd[0] = a[0];
	              ^
2 errors
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;

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

int main() {
  INIT;
  
  int n,judge=0,imax =0;
  std::vector<int> a;
  cin >> n
  REP(i,n){
    int f;
    cin >>f;
    a.push_back(f)
  }
  sort(a.begin(), a.end());
  
  REP(i,2){
    REP(j,n){
      if(a[i] % j == 0){
        REP(k,n){
          if(a[k] % j != 0){
            j++;
            judge = 1;
            break;
          }
        }
        if(judge == 0){
          imax += j;
        }
        a[i] /=j;
        j--;
      }
      else if(a[i] == 1){
        break;
      } 
    }
  }
  
  cout <<  << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: expected ';' before 'for'
   21 |   cin >> n
      |           ^
      |           ;
a.cc:22:7: error: 'i' was not declared in this scope
   22 |   REP(i,n){
      |       ^
a.cc:4:34: note: in definition of macro 'FOR'
    4 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
      |                                  ^
a.cc:22:3: note: in expansion of macro 'REP'
   22 |   REP(i,n){
      |   ^~~
a.cc:51:12: error: expected primary-expression before '<<' token
   51 |   cout <<  << endl;
      |            ^~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>

using namespace std;

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

int main() {
	int n, ans;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	a.erase(unique(a.begin(), a.end()), a.end());
	if (a.size() == 1) {
		cout << a[0] << endl;
		return 0;
	}
	ans = a[0];
	for (int i = 0; i < a.size(); ++i) {
		ans = min(ans, gcd(ans, a[i]));
	}
	cout << and << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:21: error: expected identifier before '<<' token
   36 |         cout << and << endl;
      |                     ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int gcd (int a, int b, int ans){
  int r = a % b;
  if(r!=0) {
  	if (r<ans) return r;
    return gcd(b,r,ans);
  }
  return b;
}
 
int gcda(int a, int b,int ans) {
  if(a<b){
    int tmp = a;
    a = b;
    b = tmp;
  }
  return gcd(a,b,ans);
}
 
int main(){
  int n;
  int list[n];
  int ans = 0;
  cin >> n;
  for (int i=n-1; i>=0; i--) {
    int l;
    cin >> l;
    list[i] = l;
  }
  
  for (int i=0; i<n; i++) {
    int gcd2 = 0;
  	for (int j=0; j<n; j++) {
      if(j==i) continue;
      if (gcd2==0) {
        gcd2=list[j];
        continue;
      }
      if (list[j]<ans) {
      	gcd2 = list[j];
        break;
      }
      gcd2 = gcda(gcd2,list[j],ans);
      if (gcd2<ans) break;
    }
    if (gcd2>ans) ans = gcd2;
  }
  
  cout << ans << endl;
}
#include <bits/stdc++.h>
using namespace std;

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

int gcda(int a, int b,int ans) {
  if(a<b){
    int tmp = a;
    a = b;
    b = tmp;
  }
  return gcd(a,b,ans);
}
 
int main(){
  int n;
  int list[n];
  int ans = 0;
  cin >> n;
  for (int i=n-1; i>=0; i--) {
    int l;
    cin >> l;
    list[i] = l;
  }
  
  for (int i=0; i<n; i++) {
    int gcd2 = 0;
  	for (int j=0; j<n; j++) {
      if(j==i) continue;
      if (gcd2==0) {
        gcd2=list[j];
        continue;
      }
      if (list[j]<ans) {
      	gcd2 = list[j];
        break;
      }
      gcd2 = gcda(gcd2,list[j],ans);
      if (gcd2<ans) break;
    }
    if (gcd2>ans) ans = gcd2;
  }
  
  cout << ans << endl;
}


Compiler output:
a.cc:56:5: error: redefinition of 'int gcd(int, int, int)'
   56 | int gcd (int a, int b, int ans){
      |     ^~~
a.cc:4:5: note: 'int gcd(int, int, int)' previously defined here
    4 | int gcd (int a, int b, int ans){
      |     ^~~
a.cc:65:5: error: redefinition of 'int gcda(int, int, int)'
   65 | int gcda(int a, int b,int ans) {
      |     ^~~~
a.cc:13:5: note: 'int gcda(int, int, int)' previously defined here
   13 | int gcda(int a, int b,int ans) {
      |     ^~~~
a.cc:74:5: error: redefinition of 'int main()'
   74 | int main(){
      |     ^~~~
a.cc:22:5: note: 'int main()' previously defined here
   22 | int main(){
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int main(){
  ll n,i,j,min=(ll)1e9,min2;
  cin>>n;
  vector<ll> a(n),b(n),c(n),d(n);
  for(i=0;i<n;i++){
	cin>>a[i];
  }
  b[0]=a[0];
  c[0]=a[0];
  for(i=1;i<n;i++){
    b[i]=gcd(b[i-1],a[i]);
    c[i]=lcm(c[i-1],a[i]);
  }
  ll ans=b[n-1],count;
  while(c[n-1]%b[n-1]==0){
    c[n-1]/b[n-1];
  }
  for(i=2;i<n;i++){
    count==0;
 
        if(c[n-1]%pow(i,n-1)==0){
          
      
      break;
    
        }
  }


  cout<<i*b[n-1]<<endl;

    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   26 |         if(c[n-1]%pow(i,n-1)==0){
Language: C

#include<stdio.h>
int main(void){
    int i,N,A[100000];
    int tmp,j,k;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    
int w=1,x=0,p[N],z,ans;

while(w<1000000000){
    while(z==0||z==1||x<=N-1){
        p[x]=A[x]%w;
        if(p[x]==0){
            
        }
        else{
            z++;
        }
        
        if(p[N-1]==0){
            ans=x;
        }
        else{

        }
        x++;
    
    }
    printf("%d",ans);        
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:33:1: error: expected declaration or statement at end of input
   33 | }
      | ^
Language: C++

include <bits/stdc++.h>

using namespace std;
int main(){
  int N;
  cin >>N;
  vector<int> A(N);
   int x;
  for(int i=0;i<N;i++){
 cin >>A.at(i);
  } 
  sort(A.begin(),A.end());
  vector<int> AA;
  vector<int> BB;
  for(int i=1;i<=A.at(0);i++){if(A.at(0)%i==0){AA.push_back(i);}}
  for(int i=1;i<=A.at(1);i++){if(A.at(1)%i==0){BB.push_back(i);}}  
   int counta=0;
   int countb=0;
   int Ax=1,Bx=1;
  
  for(int i=0;i<AA.size();i++){
    counta=0;
    for(int j=0;j<A.size();j++){
      if(A.at(j)%AA.at(i)!=0){counta++;} 
    }
    if(counta<=1){Ax=AA.at(i);}
  }
  
    for(int i=0;i<BB.size();i++){
     countb=0;
    for(int j=0;j<A.size();j++){
      if(A.at(j)%BB.at(i)!=0){countb++;}
    }
    if(countb<=1){Bx=BB.at(i);}
  }     
  
    int ans=max(Ax,Bx);
         cout <<ans<<endl;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >>N;
      |   ^~~
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> A(N);
      |   ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> A(N);
      |          ^~~
a.cc:10:8: error: 'A' was not declared in this scope
   10 |  cin >>A.at(i);
      |        ^
a.cc:12:8: error: 'A' was not declared in this scope
   12 |   sort(A.begin(),A.end());
      |        ^
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |   sort(A.begin(),A.end());
      |   ^~~~
      |   short
a.cc:13:10: error: expected primary-expression before 'int'
   13 |   vector<int> AA;
      |          ^~~
a.cc:14:10: error: expected primary-expression before 'int'
   14 |   vector<int> BB;
      |          ^~~
a.cc:15:48: error: 'AA' was not declared in this scope
   15 |   for(int i=1;i<=A.at(0);i++){if(A.at(0)%i==0){AA.push_back(i);}}
      |                                                ^~
a.cc:16:48: error: 'BB' was not declared in this scope
   16 |   for(int i=1;i<=A.at(1);i++){if(A.at(1)%i==0){BB.push_back(i);}}
      |                                                ^~
a.cc:21:17: error: 'AA' was not declared in this scope; did you mean 'Ax'?
   21 |   for(int i=0;i<AA.size();i++){
      |                 ^~
      |                 Ax
a.cc:29:19: error: 'BB' was not declared in this scope; did you mean 'Bx'?
   29 |     for(int i=0;i<BB.size();i++){
      |                   ^~
      |                   Bx
a.cc:37:13: error: 'max' was not declared in this scope
   37 |     int ans=max(Ax,Bx);
      |             ^~~
a.cc:38:10: error: 'cout' was not declared in this scope; did you mean 'countb'?
   38 |          cout <<ans<<endl;
      |          ^~~~
      |          countb
a.cc:38:22: error: 'endl' was not declared in this scope
   38 |          cout <<ans<<endl;
      |                      ^~~~
Language: C++


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a),i##Len_=(b);i<i##Len_;i++)

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    REP(i, N) {
        cin >> X[i];
    }
    //maxsearch
    int maxAA = 0;
    REP(i, N) {
        if (maxAA < X[i]) maxAA = X[i];
    }
    int count = maxAA;
    while (count--){
    int ppp = 0;
    REP(i, N) {
        int c = count % X[i];
        //あまりぜろでなければ
        if (c　!= 0) ppp++;

        if(ppp == 0 || ppp == 1) break;
    }
    cout << count << endl;
    }
}



Compiler output:
a.cc:26:13: error: extended character 　 is not valid in an identifier
   26 |         if (c　!= 0) ppp++;
      |             ^
a.cc: In function 'int main()':
a.cc:26:13: error: 'c\U00003000' was not declared in this scope
   26 |         if (c　!= 0) ppp++;
      |             ^~~
Language: C++

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

int main() {
  int N,n;
  n=0;
  cin >> N;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  vector<int>vec(A.at(1));
  for(int i=1;i<A.at(1)&&A.at(i)!=0;i++){
    for(int j=0;j<N;j++){
      if((A.at(j)%i)!=0){
        vec.at(i)++;
      }
      if(vec.at(i)>1){
       for(int k=i;k<A.at(i);k=k+i){
         A.at(k)=0;
        break;
      }
    }
    if(vec.at(i)<=1){
      n=i;
    }
  }
    cout << n << endl;
}





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

#include <stdio.h>
#include <string.h>

#define MAX 100001

long f(long a, long b)
{
  if (b == 0) return a;
  return f(b, a % b);
}
 
int main()
{
  long n, a[MAX], gcd, ans = 1, an[MAX];
  int i, j;

  memset(an, 0, sizeof(an));

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

  for (i = 0; i < n; i++) {
    gcd = (i != 0 ? a[0] : a[1]);
    for (j = 1; j < n; j++) {
      if (gcd <= ans) break;
      if (i == j) continue;
      if (an[j] == 0){
	gcd = f(gcd, a[j]);
	an[j] = gcd;
      } else {
	gcd = an[j];
    }
    ans = (ans > gcd ? ans : gcd);
  }

  printf("%ld\n", ans);
  
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:40:1: error: expected declaration or statement at end of input
   40 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
long long a[100001],c,f,n,z,x,minz=0;
long long s;
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>a[i];
    l=2;
    r=n;
    s=a[1];
    while(l!=r)
    {
        if(__gcd(s,a[l])<__gcd(s,a[r])){
            r--;
            s=__gcd(s,a[r+1]);
        }
        else{
            l++;
            s=_gcd(s,a[l-1]);
        }
    }
    maxz=max(maxz,s);
    s=a[n];
    l=1;
    r=n-1;
    while(l!=r)
    {
        if(__gcd(s,a[l])<__gcd(s,a[r])){
            r--;
            s=__gcd(s,a[r+1]);
        }
        else{
            l++;
            s=_gcd(s,a[l-1]);
        }
    }
    maxz=max(s,maxz);
    cout<<maxz<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'l' was not declared in this scope
   12 |     l=2;
      |     ^
a.cc:13:5: error: 'r' was not declared in this scope
   13 |     r=n;
      |     ^
a.cc:23:15: error: '_gcd' was not declared in this scope
   23 |             s=_gcd(s,a[l-1]);
      |               ^~~~
a.cc:26:5: error: 'maxz' was not declared in this scope
   26 |     maxz=max(maxz,s);
      |     ^~~~
a.cc:38:15: error: '_gcd' was not declared in this scope
   38 |             s=_gcd(s,a[l-1]);
      |               ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,i,j;
    cin>>a;
    vector<int> number;
    for(i=0;i<a;i++)
    {
        int t;
        cin>>t;
        number.push_back(t);
    }
    if(a==2){
        b=number[0];
        c=number[1];
        while(1){
            int d=b%c;
            if(d==0){
                cout<<c<<endl;
                return 0;
            }
            b=c;
            c=d;
        }
    }
    sort(number.begin(),number.end());
    vector<int> mainasu;
    for(i=0;i<a-1;i++){
        int p=number[i+1]-number[i];
        if(p==0)
        p=1000000001;
        if(i>0){
            if(p==number[i]-number[i-1])
            p=number[i+1]-number[i-1];
        }
        mainasu.push_back(p);
    }
    if(number[0]>1)
    int o=number[0];
    mainasu.push_back(o);
    sort(mainasu.begin(),mainasu.end());
    int d=mainasu[0];
    int e = mainasu[1];
    if(d==1000000001||e==100000001){
        for(i=0;i<a-1;i++){
            int p=number[i+1]-number[i];
            if(p==0){
                cout<<number[i]<<endl;
                return 0;
            }
        }
    }
    int check=0;
    for(i=0;i<a;i++){
        if(number[i]%d!=0)
        check++;
        if(check>1){
            d=1;
            break;
        }
    }
    check=0;
    for(i=0;i<a;i++){
        if(number[i]%e!=0)
        check++;
        if(check>1){
            e=1;
            break;
        }
    }
    if(d<e)
    cout<<e<<endl;
    else
    cout<<d<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:23: error: 'o' was not declared in this scope
   40 |     mainasu.push_back(o);
      |                       ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int gcd2(int a,int b){
  while(1){
    if(a>b){
      a=a%b;
      if(b%a==0) return a;
    }
    else{
      b=b%a;
      if(a%b==0) return b;
    }
  }
}
int main(){
  int n,i,max,buf;
  cin>>n;
  int a[n],r[n],l[n];
  for(i=0;i<n;i++) cin>>a[i];
  l[1]=a[0];
  r[n-2]=a[n-1];

  for(i=0;i<n-2;i++){
    l[i+2]=gcd2(l[i+1],a[i]);
    r[n-i-3]=gcd2(r[n-i-2],a[n-1-i]);
  }

  max=l[n-2];
  for(i=0;i<n;i++){
    buf=gcd2(l[n-3],r[]);
    if(buf>max) max=buf;
  }
  buf=r[0];
  if(buf>max) max=buf;
  cout<<max<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:23: error: expected primary-expression before ']' token
   32 |     buf=gcd2(l[n-3],r[]);
      |                       ^