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

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

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

int main(){
    long long n, i, r1, r2, tem;
    cin >> n;
    long long a[n];
    for(i=0; i<n; i++){
        cin >> a[i];
    }
    r1 = a[0];
    tem = gcd(a[0],a[1]);
    for(i=2; i<n; i++){
        if(tem > gcd(a[i],r1)){
            r1 = tem; 
        }else{
            r1 = gcd(a[i],r1);
        }
        tem = gcd(tem, a[i]);
    }
    tem = 0
    r2 = a[1];
    tem = gcd(a[0],a[1]);
    for(i=2; i<n; i++){
        if(tem > gcd(a[i],r2)){
            r2 = tem; 
        }else{
            r2 = gcd(a[i],r2);
        }
        tem = gcd(tem, a[i]);
    }
    cout << max(r1,r2);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:12: error: expected ';' before 'r2'
   32 |     tem = 0
      |            ^
      |            ;
   33 |     r2 = a[1];
      |     ~~
Language: C++

#include <cstdlib>
#include <iostream>
#include <memory>

using namespace std;
int calcGCD(int *list, int len);

int calcGCD(int *list, int len)
{
  int c = len;

  // ユークリッドの互除法を末尾2要素にかける
  int v = list[c - 1] % list[c - 2];
  if (v == 0)
  {
    if (c == 2)
    {
      return list[c - 2];
    }
    // 2要素の最大公約数が決まったら、配列を更新して再帰
    return calcGCD(list, len - 1);
  }

  list[c - 1] = list[c - 2];
  list[c - 2] = v;
  return calcGCD(list, len);
}

int gcd(int *list, int len)
{
  int c = len;
  if (c == 0)
    return 0;
  else if (c == 1)
    return list[0];
  return calcGCD(list, len);
}

int main()
{
  std::cin.tie(0);

  int N;
  cin >> N;

  int *A = nullptr;
  A = new int[N];
  int min = 1000 * 000 * 000;
  int secondMin = 1000 * 1000 * 1000;

  for (int index = 0; index < N; index++)
  {
    cin >> A[index];
  }
  int maxGCD = 1;
  int *cp = nullptr;
  cp = new int[N];
  int currentGCD = 1;
  int tmp;
  memcpy(cp, A, N * __SIZEOF_INT__);
  for (int removeIndex = 0; removeIndex < N; removeIndex++)
  {
    tmp = cp[removeIndex];
    cp[removeIndex] = cp[N - 1];
    cp[N - 1] = tmp;

    currentGCD = gcd(cp, N - 1);

    if (maxGCD < currentGCD)
    {
      maxGCD = currentGCD;
    }
    tmp = cp[removeIndex];
    cp[removeIndex] = cp[N - 1];
    cp[N - 1] = tmp;
  }
  cout << maxGCD << endl;
  return EXIT_SUCCESS;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:3: error: 'memcpy' was not declared in this scope
   60 |   memcpy(cp, A, N * __SIZEOF_INT__);
      |   ^~~~~~
a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <memory>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> A;
int func(int);
int main(){
  int N,z,a,b,k=0;
  cin >> N;
  for(int i=0;i<N;i++){
  	cin >> z;
    A.push_back(z);
  }
  sort(A.begin(), A.end(),greater<int>());
  if(N>2){
    A.erase(v.begin());
    for(int i=0;i<N-2;i++){
      func(A[i+1]);
      k++;
    }
  }
  cout << func(A[k+1]);
}
int func(int n){
  int r,j=1;
  r = A[0] % A[1];
  while(r!=0){
    A[j] = n;
    n = r;
    r = A[j] % n;
    j++;
  }
  return n;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: 'v' was not declared in this scope
   16 |     A.erase(v.begin());
      |             ^
Language: C++

#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <numeric>
using namespace std;

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

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

    vector<int> B(N);
    for(int i = 0;i<N;i++){
        if(i == N - 1){
            B[i] = gcd(B[N-1],B[0]);
        }else{
            B[i] = gcd(B[i] ,B[i+1]);
        }
    }

    sort(B.begin(),B.end());

    cout << B[2] << endl;

}

Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:14:22: error: expected ';' before '}' token
   14 |     return gcd(b,a%b)
      |                      ^
      |                      ;
   15 | }
      | ~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> A;
int func(int);
int main(){
  int N,z,a,b,k=0;
  cin >> N;
  for(int i=0;i<N;i++){
  	cin >> z;
    A.push_back(z);
  }
  sort(A.begin(), A.end(),greater<int>());
  if(N>2){
    v.erase(v.begin());
    for(int i=0;i<N-2;i++){
      func(A[i+1]);
      k++;
    }
  }
  cout << func(A[k+1]);
}
int func(int n){
  int r,j=1;
  r = A[0] % A[1];
  while(r!=0){
    A[j] = n;
    n = r;
    r = A[j] % n;
    j++;
  }
  return n;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'v' was not declared in this scope
   16 |     v.erase(v.begin());
      |     ^
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <bitset>
#include <numeric>
#include <math.h>
#include <tuple>
#include <queue>
#include <set>

using namespace std;

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

int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);

    int N;

    cin >> N;

    vector<long long> A(N);

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

    if(N > 2){

    long long gcd_for_all =0;

    gcd_for_all = gcd(A[0], A[1]);

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

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

    long long gcd_1left = 0;
    long long gcd_tmp = 0;
    bool exist_disjoint = false;

    gcd_tmp = gcd(A[0], A[1]);

    if(gcd_tmp == 1){
        // 0番目を抜かして最大値
        log long gcd_ind0left = 0;
        gcd_ind0left = gcd(A[1], A[2]);
        for(int i = 3; i < N; i++){
            gcd_ind0left = gcd(gcd_ind0left, A[i]);
        }

        // 1番目を抜かして最大値
        log long gcd_ind1left = 0;
        gcd_ind1left = gcd(A[0], A[2]);
        for(int i = 3; i < N; i++){
            gcd_ind1left = gcd(gcd_ind1left, A[i]);
        }
        
        gcd_1left = max(gcd_ind1left, gcd_ind0left);

        cout << gcd_1left * gcd_for_all << endl;

    }else{
        // A[0], A[1]の最大公約数が1じゃなかったとき
        gcd_1left = gcd(A[0], A[1]);

        for(int i = 2; i < N; i++){
            gcd_tmp = gcd(gcd_1left, A[i]);
            if(gcd_tmp == 1){
                if(exist_disjoint){
                    gcd_1left = 1;
                    break;
                }else{
                    exist_disjoint = true;
                }
            }else{
                gcd_1left = gcd_tmp;
            }
        }
        cout << gcd_1left * gcd_for_all << endl;
    
    }
    }else{
        cout << max(A[0], A[1]) << endl;
    }
  
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:12: error: expected ';' before 'long'
   62 |         log long gcd_ind0left = 0;
      |            ^~~~~
      |            ;
a.cc:62:34: error: statement cannot resolve address of overloaded function
   62 |         log long gcd_ind0left = 0;
      |                                  ^
a.cc:63:9: error: 'gcd_ind0left' was not declared in this scope; did you mean 'gcd_1left'?
   63 |         gcd_ind0left = gcd(A[1], A[2]);
      |         ^~~~~~~~~~~~
      |         gcd_1left
a.cc:69:12: error: expected ';' before 'long'
   69 |         log long gcd_ind1left = 0;
      |            ^~~~~
      |            ;
a.cc:69:34: error: statement cannot resolve address of overloaded function
   69 |         log long gcd_ind1left = 0;
      |                                  ^
a.cc:70:9: error: 'gcd_ind1left' was not declared in this scope; did you mean 'gcd_1left'?
   70 |         gcd_ind1left = gcd(A[0], A[2]);
      |         ^~~~~~~~~~~~
      |         gcd_1left
Language: C++

#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <numeric>
using namespace std;

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

    vector<int> B(N);
    for(int i = 0;i<N;i++){
        if(i == N - 1){
            B[i] = gcd(B[N-1],B[0]);
        }else{
            B[i] = gcd(B[i] ,B[i+1]);
        }
    }

    sort(B.begin(),B.end());

    cout << B[2] endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: expected ';' before 'endl'
   31 |     cout << B[2] endl;
      |                 ^~~~~
      |                 ;
Language: C++

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

using namespace std;

int main() {

    long long N;
    cin >> N;

    vector<long long 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());

    N = A.size();

    // 1 個数を弾く
    if (N == 1) {
        cout << A[0] << endl;
        return 0;
    }


    vector<long long int> original(N);
    original = A;

    long long int result = 1;
    long long int max = A[N - 1];


    long long int borderLine;
    borderLine = (N > 3) ? A[2] : A[N - 1];


    bool didChangeFinal = false;
    for (int i = 2; i < borderLine; ++i) {

        bool didChange = false;

        if (didChangeFinal) {
            didChange = true;
        }


        int continuFlug = false;
        for (int j = 0; j < N; ++j) {
            // 全部割れるか確認
            long long int num = A[j];
            if (num % i == 0) {
                A[j] = num / i;
            } else {

                if (didChange) {
                    // 交換したけどダメだった
                    didChange = false;
                    A = original;
                    continuFlug = true;
                    continue;
                } else {
                    //  初回のダメ
                    didChange = true;
                    A[j] = max / 2;
                }
            }
        }

        //
        if (continuFlug) {
            continue;
        }

        if (didChange) {
            didChangeFinal = true;
        }

        // 最後までわりきれた
        original = A;

        result *= i;
        borderLine = (N > 3) ? A[2] : A[N - 1];
        i = 1;
    }


    cout << result << endl;

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |     sort(A.begin(), A.end());
      |     ^~~~
      |     short
a.cc:18:13: error: 'unique' was not declared in this scope
   18 |     A.erase(unique(A.begin(), A.end()), A.end());
      |             ^~~~~~
Language: C++

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

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

int main(){
    long long n, i, r, a, b, c, tem;
    cin >> n;
    cin >> a >> b;
    r = a*b/gcd(a,b);
    tem = gcd(a,b);
    for(i=1; i<n; i++){
        cin >> c;
        if(tem > gcd(a,r)){
            r = tem; 
        }else{
            r = gcd(a,r);
        }
        tem = gcd(tem, a);
    }
    if(r = r = a*b/gcd(a,b)){
        r = max(a,b)
    }
    cout << r;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:21: error: expected ';' before '}' token
   31 |         r = max(a,b)
      |                     ^
      |                     ;
   32 |     }
      |     ~
Language: C++

from fractions import gcd
from functools import reduce
import copy
def find_gcd(list):
    x = reduce(gcd, list)
    return x


n=int(input())
a=list(map(int,input().split()))

ans=0
for i in range(n):
    b=copy.copy(a)
    del b[i]
    g=find_gcd(b)
    ans=max(ans,g)
print(ans)

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from fractions import gcd
      | ^~~~
Language: C++

#include "Program.h"


namespace Temp
{

	void Program::Main(std::vector<std::wstring> &args)
	{
		int N;
		int M;

		N = std::stoi(Console::ReadLine());

		std::vector<std::wstring> input;
		std::getline(std::wcin, input)->Split(L' ');
		auto A = std::vector<int>(N);
		for (int h = 0; h < N; h++)
		{
			A[h] = std::stoi(input[h]);
		}

		int Za;
		int Zb;
		auto B = std::vector<int>(N);

		int Ans = 0;

		for (int h = 0; h < N; h++)
		{


			for (int i = 0; i < N; i++)
			{
				B[i] = A[i];
			}
			for (int i = 0; i < N - 1; i++)
			{
				if (h <= i)
				{
					B[i] = B[i + 1];
				}
			}

			int Counter = N - 2;

			auto BAns = std::vector<int>(N);



				while (Counter > -2)
				{
				for (int i = 0; i < Counter; i++)
				{
					Za = B[i];
					Zb = B[i + 1];

					int Z = 1;

					while (Z > 0)
					{
						Z = Za % Zb;
						Za = Zb;
						Zb = Z;

					}
					//Console.WriteLine(Za);
					B[i] = Za;

				}
				Counter--;
				}

				if (Ans < B[0])
				{
				Ans = B[0];
				}

		}
		//

		std::wcout << Ans << std::endl;
	}
}


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

import java.util.Scanner;
// 回答時間内に収まるかのチェック回答
public class MainC {

	public static void main(String[] args) {
		int N = 0, maxGCD = 0, gcd = 0;

		try (Scanner scanner = new Scanner(System.in)) {

			N = scanner.nextInt();
			int[] value = new int[N];

			for (int i = 0; i < N; i++) {
				value[i] = scanner.nextInt();
			}

			for (int i = 0; i < N; i++) {
				for (int j = i + 1; j < N; j++) {
					gcd = gcd(value[i], value[j]);
					maxGCD = Math.max(maxGCD, gcd);
				}
			}

			System.out.println(maxGCD);

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	// https://atcoder.jp/contests/agc018/submissions/1450553
	static int gcd(int x,int y)
	{
		return y>0?gcd(y,x%y):x;
	}
}


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

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

using namespace std;


long saidaikouyakusuu(long a, long b) {
	if (a < b) swap(a, b);
	while (a%b > 0) {
		long c = a % b;
		a = b; b = c;
	}
	return b;
}

int main()
{
	int n;
	cin >> n;
	vector<long> a(n);
	long k;
	long answer = 0;
	long yakusuu = 0;
	long kari_a[2];
	long min;


	if (n == 3) {
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		answer = saidaikouyakusuu(a[0], a[1]);
		for (int i = 0; i < n-1; i++) {
			long x = saidaikouyakusuu(a[i], a[2]);
			answer = max(answer, x);
		}
		cout << answer << endl;
		return 0;

	}

	cin >> a[0] >> a[1];
	yakusuu = saidaikouyakusuu(a[0], a[1]);
	kari_a[0] = LONG_MAX;
	min = yakusuu;
	for (int i = 2; i < n; i++) {
		cin >> a[i];
		long l = saidaikouyakusuu(a[i],yakusuu);
		if (l < min) {
			kari_a[0] = min;
			min = l;
		}
		else if (l < kari_a[0]) {
			kari_a[0] = l;
		}
	}



	yakusuu = saidaikouyakusuu(a[n-2], a[n-1]);
	kari_a[1] = LONG_MAX;
	min = yakusuu;
	for (int i = 0; i < n-2; i++) {
		long l = saidaikouyakusuu(a[i], yakusuu);
		if (l <= min) {
			kari_a[1] = min;
			min = l;
		}
		else if (l < kari_a[1]) {
			kari_a[1] = l;
		}
	}



	answer = max(kari_a[0],kari_a[1]);

	cout << answer << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:21: error: 'LONG_MAX' was not declared in this scope
   46 |         kari_a[0] = LONG_MAX;
      |                     ^~~~~~~~
a.cc:5:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <iterator>
  +++ |+#include <climits>
    5 |
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> A;
int func(int);
int main(){
  int N,z,a,b;
  cin >> N;
  for(int i=0;i<N;i++){
  	cin >> z;
    A.push_back(z);
  }
  sort(A.begin(), A.end(),greater<int>());
  for(int i=0;i<N-2;i++){
    func(A[i+1]);
  }
  cout << func(A[i+1]);
}
int func(int n){
  int r,i=1;
  r = A[0] % A[1];
  while(r!=0){
    A[i] = n;
    n = r;
    r = A[i] % n;
    i++;
  }
  return n;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: 'i' was not declared in this scope
   18 |   cout << func(A[i+1]);
      |                  ^
Language: C

#include <stdio.h>
#include <math.h>


int main(void){
    int n,g=1,count=0,counter=0;;
    int i,j;
    long a[100];
    double b[100];

    scanf("%d",&n);
    for(i=0; i<n; i++){
        scanf("%ld",&a[i]);
    }
    while(counter==0){
        for(i=0; i<n; i++){
            b[i] = (double) (a[i] / g);
            if(ceil(b[i]) != floor(b[i])&&count==0){
                a[i] = 0;
                b[i] = 0;
                count = 1;
            }else if(ceil(b[i]) != floor(b[i])&&count==1){
                counter = 1;
                break;
            }
        }
        if(couter == 1) break;
        g++;
    }
    printf("%d\n",g);
    

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:27:12: error: 'couter' undeclared (first use in this function); did you mean 'counter'?
   27 |         if(couter == 1) break;
      |            ^~~~~~
      |            counter
main.c:27:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> A;
int func(int);
int main(){
  int N,z,a,b,i=1;
  cin >> N;
  for(int i=0;i<N;i++){
  	cin >> z;
    A.push_back(z);
  }
  sort(A.begin(), A.end(),greater<int>());
  for(int i=0;i<N-2;i++){
    func(A[i+1]);
  }
  cout << func(A[i+1]);
}
int func(int n){
  int r;
  r = A[0] % A[1];
  while(r!=0){
    A[i] = n;
    n = r;
    r = A[i] % n;
    i++;
  }
  return n;
}
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> A;
int func(int);
int main(){
  int N,z,a,b;
  cin >> N;
  for(int i=0;i<N;i++){
  	cin >> z;
    A.push_back(z);
  }
  sort(A.begin(), A.end(),greater<int>());
  for(int i=0;i<N-2;i++){
    func(A[i+1]);
  }
  cout << func(A[i+1]);
}
int func(int n){
  int r,i=1;
  r = A[0] % A[1];
  while(r!=0){
    A[i] = n;
    n = r;
    r = A[i] % n;
    i++;
  }
  return n;
}

Compiler output:
a.cc: In function 'int func(int)':
a.cc:24:7: error: 'i' was not declared in this scope
   24 |     A[i] = n;
      |       ^
a.cc: At global scope:
a.cc:35:13: error: redefinition of 'std::vector<int> A'
   35 | vector<int> A;
      |             ^
a.cc:5:13: note: 'std::vector<int> A' previously declared here
    5 | vector<int> A;
      |             ^
a.cc:37:5: error: redefinition of 'int main()'
   37 | int main(){
      |     ^~~~
a.cc:7:5: note: 'int main()' previously defined here
    7 | int main(){
      |     ^~~~
a.cc: In function 'int main()':
a.cc:48:18: error: 'i' was not declared in this scope
   48 |   cout << func(A[i+1]);
      |                  ^
a.cc: At global scope:
a.cc:50:5: error: redefinition of 'int func(int)'
   50 | int func(int n){
      |     ^~~~
a.cc:20:5: note: 'int func(int)' previously defined here
   20 | int func(int n){
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  vector<long long> P = {2, 3, 5};
  for (int i = 7; i < 150000; i += 2)
  {
    bool flg = true;
    for (int j = 1; j < P.size() && P.at(j) * P.at(j) <= i; j++)
    {
      if (i % P.at(j) == 0) {flg = false; break;}
    }
    if (flg) P.push_back(i);
  }
  
  //for (int i = 0; i < P.size(); i++) cout << P.at(i) << " ";
  
  //return 0;
  
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) 
  {
    cin >> A.at(i);
  }
  
  long long ans;
  if (N == 2) ans = max(A.at(0), A.at(1));
  else
  {
  
    vector<int> ANS(N, 1);
    int ans0 = 1;
    for (int i = 0; i < P.size(); )
    {
      long long p = P.at(i);
      int ng = 0;
      int ngpl = -1;
      bool flg = true;
      for (int j = 0; j < N; j++)
      {
        if (A.at(j) % p != 0) {ngpl = j; ng++;}
        if (ng > 1) {flg = false; i++; break;}
      }
    
      if (flg)
      {
        for (int j = 0; j < N; j++)
        {
          if (j != ngpl) A.at(j) /= p;
        }
        if (ngpl >= 0) ANS.at(ngpl) *= p;
        else ans0 *= p;
      }
    }
  
    for (int i = 0; i < N; i++)
    {
      chmax(ans, ans0 * ANS.at(i));
    }
    
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:12: error: no matching function for call to 'chmax(long long int&, int)'
   71 |       chmax(ans, ans0 * ANS.at(i));
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:8:25: note: candidate: 'template<class T> bool chmax(T&, T)'
    8 | template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
      |                         ^~~~~
a.cc:8:25: note:   template argument deduction/substitution failed:
a.cc:71:12: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   71 |       chmax(ans, ans0 * ANS.at(i));
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define pb push_back
#define pu push
#define mp make_pair
#define fi first
#define sc second

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// ユークリッドの互除法
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(ALL(a));
    ll mgcd1 = 0, mgcd2 = 0, mgcd = 3;
    for(ll i = 0; i < n; i++) {
        if(i == n / 2) continue;
        mgcd1 = gcd(a[i], mgcd1);
    }
    for(ll i = 0; i < n; i++) {
        if(i == (n / 2) + 1) continue;
        mgcd2 = gcd(a[i], mgcd2);
    }
    for(ll i = 1; i < n; i++) {
        mgcd3 = gcd(a[i], mgcd3);
    }
    ll ans = max(mgcd1, mgcd2);
    ll ans = max(mgcd3, ans);
    COUT(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:9: error: 'mgcd3' was not declared in this scope; did you mean 'mgcd'?
   65 |         mgcd3 = gcd(a[i], mgcd3);
      |         ^~~~~
      |         mgcd
a.cc:68:8: error: redeclaration of 'll ans'
   68 |     ll ans = max(mgcd3, ans);
      |        ^~~
a.cc:67:8: note: 'll ans' previously declared here
   67 |     ll ans = max(mgcd1, mgcd2);
      |        ^~~
a.cc:68:18: error: 'mgcd3' was not declared in this scope; did you mean 'mgcd'?
   68 |     ll ans = max(mgcd3, ans);
      |                  ^~~~~
      |                  mgcd
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> A;
int func(int);
int main(){
  int N,z,a,b,i=1;
  cin >> N;
  for(int i=0;i<N;i++){
  	cin >> z;
    A.push_back(z);
  }
  sort(A.begin(), A.end(),greater<int>());
  for(int i=0;i<N-2;i++){
    func(A[i+1]);
  }
  cout << func(A[i+1]);
}
int func(int n){
  int r;
  r = A[0] % A[1];
  while(r!=0){
    A[i] = n;
    n = r;
    r = A[i] % n;
    i++;
  }
  return n;
}

Compiler output:
a.cc: In function 'int func(int)':
a.cc:24:7: error: 'i' was not declared in this scope
   24 |     A[i] = n;
      |       ^
Language: C++

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);



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

    sort(a.begin(),a.end(),greater<int>());

    for(int i = 0; i < n; i++){
        int count = 0;
        for(int j = 0; j < n; j++){
            if (a[j] % a[i] != 0) {
                count++;
                if (count >= 2) break;
            }
        }
        if (count <= 1) {
            cout << a[i] << endl;
            return 0;
        }
    }

    for (int i = 1; i < a[n-1] / 2 0;i++){
        int mod = a[n-1] / i;
        int count = 0;
        for(int j = 0; j < n; j++){
            if (a[j] % mod != 0) {
                count++;
                if (count >= 2) break;
            }
        }
        if (count <= 1) {
            cout << i << endl;
            return 0;
        }

    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:35: error: expected ';' before numeric constant
   33 |     for (int i = 1; i < a[n-1] / 2 0;i++){
      |                                   ^~
      |                                   ;
a.cc:33:37: error: expected ')' before ';' token
   33 |     for (int i = 1; i < a[n-1] / 2 0;i++){
      |         ~                           ^
      |                                     )
a.cc:33:38: error: 'i' was not declared in this scope
   33 |     for (int i = 1; i < a[n-1] / 2 0;i++){
      |                                      ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <ctring.h>
using namespace std;

int main()
{
    int n, i, a[100000], p, j;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    if(n==2)
    {
        i=a[1];
    }
    else
    {
    for(i=a[1];;i--)
    {
        p=1;
        for(j=0;j<n;j++)
        {
            if(a[j]%i!=0)
            {
               p=p+1;
            }
            if(p==3)
            break;
        }
        if(p==1||p==2)
            break;
    }
    }
    printf("%d\n",i);
    return 0;
}


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

n = int(input())
lis = list(map(int,input().split()))
lis.sort(reverse=True)
answer = 0
i = lis[1]
while True:
  liss = []
  for j in range(n):
    liss.append(lis[j]%i)
  if liss.count(0) >= n-1:
    answer = i
    break
  i -= 1
print(answer)


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

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

int main () {
	long long N;
	long long M;
	M=0;
	cin >> N;
	vector <int> V(N);
	for (int i = 0; i < N; ++i){
		cin >> V[i];
	}
	sort(V.begin(),V.end());

	for (int i = 0; i < N; ++i){
		if (V[-1] == 0 || V[i] == 0){
			M=0; 
		} 
  
        else if (V[-1] == V[i]) {
          M=V[-1]; 
        }
        else if (V[-1] > V[i]) {
		  M=(V[-1]-V[i], V[i])
        }
        else {
        	M=(V[-1], V[i]-V[-1])
        }

	}
	cout << M;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:39: error: expected ';' before '}' token
   24 |                   M=(V[-1]-V[i], V[i])
      |                                       ^
      |                                       ;
   25 |         }
      |         ~                              
a.cc:27:24: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   27 |                 M=(V[-1], V[i]-V[-1])
      |                        ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
a.cc:27:38: error: expected ';' before '}' token
   27 |                 M=(V[-1], V[i]-V[-1])
      |                                      ^
      |                                      ;
   28 |         }
      |         ~
Language: C++

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

int main() {
  int n, x, y, z = 0, count = 0;
  cin >> n;

  vector<int> a(n);
  for(i = 0; i < n; i++){
    cin >> a.at(n);
  }
  
  x = a.at(0);
  for(i = 1; i < n; i++){
    y = a.at(i);
    while(x % y != 0){
      z = x % y;
      x = y;
      y = z;
    }
    if(y == 1 && i != n - 1){
      count++;
      y = a.at(i + 1);
    }
    x = y;
  }
  
  if(count > 1){
    cout << 1 << endl;
  }
  else{
    cout << x << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   for(i = 0; i < n; i++){
      |       ^
a.cc:14:7: error: 'i' was not declared in this scope
   14 |   for(i = 1; i < n; i++){
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

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

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    if (N == 2)
    {
        cout << max(A[0], A[1]) << endl;
        return 0;
    }
    vector<int> tmp1, tmp2;
    map<int, int> mp1, mp2;

    int ans = 0;
    reps(i, 1, N)
    {
        int x = gcd(A[0], A[i]);
        if (mp1[x] == 0)
            tmp1.push_back(x);
        mp1[x]++;
    }
    rep(i, tmp1.size())
    {
        if (mp1[tmp1[i]] < N - 2)
            continue;
        ans = max(ans, tmp1[i]);
    }

    rep(i, 2, N)
    {
        int x = gcd(A[1], A[i]);
        if (mp2[x] == 0)
            tmp2.push_back(x);
        mp2[x]++;
    }
    rep(i, tmp2.size())
    {
        if (mp2[tmp2[i]] < N - 2)
            continue;
        ans = max(ans, tmp2[i]);
    }
    if (ans == 0)
        ans = 1;
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc:46:16: error: macro "rep" passed 3 arguments, but takes just 2
   46 |     rep(i, 2, N)
      |                ^
a.cc:5:9: note: macro "rep" defined here
    5 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:46:5: error: 'rep' was not declared in this scope
   46 |     rep(i, 2, N)
      |     ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int 
int main(){
  int N,z,a,b,r,i=1;
  vector<int> A;
  cin >> N;
  for(int i=0;i<N;i++){
  	cin >> z;
    A.push_back(z);
  }
  sort(A.begin(), A.end(),greater<int>());
  for(int i=0;i<N-1;i++){
    func(A[i+1]);
  }
  cout << func(A[i+1]);
}
int func(int n){
  r = A[0] % A[1];
  while(r!=0){
    A[i] = n;
    n = r;
    r = A[i] % n;
    i++;
  }
  return n;
}

Compiler output:
a.cc:5:1: error: two or more data types in declaration of 'main'
    5 | int
      | ^~~
a.cc: In function 'int func(int)':
a.cc:21:3: error: 'r' was not declared in this scope
   21 |   r = A[0] % A[1];
      |   ^
a.cc:21:7: error: 'A' was not declared in this scope
   21 |   r = A[0] % A[1];
      |       ^
a.cc:23:7: error: 'i' was not declared in this scope
   23 |     A[i] = n;
      |       ^
Language: C++

#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int n;
  cin>>n;
  vector<int> A(n);
  vector<int> L(n);
  vector<int> R(n);
  rep(i,n)cin>>A[i];
  L[0]=A[0];
  repeat(1,i,n)
    L[i]=gcd(L[i-1],A[i]);
  R[n-1]=A[n-1];
  for(int i=n-2; i>=0; i--) {
    R[i]=gcd(R[i+1],A[i]);
  }
  int ans=R[1];
  for(int i=1; i<n-1; i++) {
    ans=max(ans,gcd(L[i-1],R[i+1]));
  }
  ans=max(ans,L[n-2]);
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:12: error: 'i' was not declared in this scope
   28 |   repeat(1,i,n)
      |            ^
a.cc:6:35: note: in definition of macro 'repeat'
    6 | #define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
      |                                   ^
a.cc:28:10: error: lvalue required as increment operand
   28 |   repeat(1,i,n)
      |          ^
a.cc:6:48: note: in definition of macro 'repeat'
    6 | #define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
      |                                                ^
Language: C++

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  long long n,a[100000],b[100000]={},ans=1;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    for(int j=1; j<=a[i]; j++) {
      if(a[i]%j==0) {
        b[j-1]++;
      }
      if(b[j-1]>=n-1) {
        ans=max(ans,j);
      }
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: no matching function for call to 'max(long long int&, int&)'
   15 |         ans=max(ans,j);
      |             ~~~^~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:15:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   15 |         ans=max(ans,j);
      |             ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:15:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |         ans=max(ans,j);
      |             ~~~^~~~~~~
Language: Java

import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n, x, y, tmp,m,m1;
    m=m1=0;
    n = sc.nextInt();
    int v[] = new int[n];
    int tmp[] = new int[n];
    for(int i=0;i<n;i++){
    	v[i]=sc.nextInt();
    }
    if(v[0]>v[1]){
    	x=v[0];
    	y=v[1];
    }
    else{
    	x=v[1];
    	y=v[0];
    }
    while((tmp[0] = x % y) != 0){
    	x = y;
    	y = tmp[0];
    }
    for(int i=2;i<n;i++){
    	if(tmp[i-2] > v[i]){
    		x = tmp[i-2];
    		y = v[i];
    	}
    	else{
    		x = v[i];
    		y = tmp[i-2];
    	}
    	while((tmp[i-1] = x % y) != 0){
    		x = y;
    		y = tmp[i-1];
    	}
    }
    for(int i=0;i<n-1;i++){
    	if(m>tmp[i])
    		m=tmp[i];
    	else if(m1>tmp[i])
    		m1=tmp[i];
    }
    System.out.println(m1);
  }
}


Compiler output:
Main.java:10: error: variable tmp is already defined in method main(String[])
    int tmp[] = new int[n];
        ^
1 error
Language: Java

import java.util.*;
import java.io.*;

public class Main{
    public static int gojo(int a,int b){
        if(a%b==0)return b;
        return gojo(b,a%b);
    }
    public static void main(String[] args)throws IOException{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] ary=new int[n];
        for(int i=0;i<n;i++)ary[i]=sc.nextInt();
        sc.close();
        int maxnum=0;
        for(int i=0;i<n-1;i++){
            for(int j=i+1;j<n;j++){
                int gt=gojo(Math.max(ary[i],ary[j]),Math.min(ary[i],ary[j]))
                if(maxnum<gt){
                    maxnum=gt;
                }
            }
        }
        System.out.println(maxnum+"\n");
    }
}

Compiler output:
Main.java:18: error: ';' expected
                int gt=gojo(Math.max(ary[i],ary[j]),Math.min(ary[i],ary[j]))
                                                                            ^
1 error
Language: Java

import java.util.*;

public class GCDonBlackboard {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int cnt = sc.nextInt();
		int[] A = new int[cnt];
		int amari = 1;
		int yaku = 0;
		int tmp1 = 0;
		int tmp2 = 0;
		
		
		for(int i = 0;i < cnt; i++) {
			A[i] = sc.nextInt();
		}
		Arrays.sort(A);
		for(int i = 0;i < cnt-1; i++) {
			tmp1 = A[cnt - 1];
			tmp2 = A[cnt -i -2];
			while(amari != 0) {
				amari = tmp1 % tmp2;
				tmp1 = tmp2;
				tmp2 = amari;
			}
			if(yaku < tmp1) {
				yaku = tmp1;
			}
			amari = 1;
		}
		System.out.println(yaku);
	}

}


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

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int g,ans=0;
    for(int i=0;i<n;i++){
        if(i==0){
            g=a[1];
        }
        else{
            g=a[0];
        }
        for(int j=0;j<n;i++){
            if(i!=j){
                g=__gcd(g,a[i]);
            }
        }
        ans=max(ans,g);
    }
    cout<< ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:24: error: no matching function for call to '__gcd(int&, ll&)'
   30 |                 g=__gcd(g,a[i]);
      |                   ~~~~~^~~~~~~~
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:30:24: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('int' and 'long long int')
   30 |                 g=__gcd(g,a[i]);
      |                   ~~~~~^~~~~~~~
Language: C++

#include <stdio.h>
#include <mmsystem.h>

int gcd(int a, int b) {
	return b ? gcd(b, a%b) : a;
}

int main() {
	int N;
	scanf("%d",&N);
	int a[N];
	for (int i = 0; i < N; i++) {
		scanf("%d",&a[i]);
	}
	int ans = gcd(a[0],a[1]);
	if (N > 2) {
		for (int i = 2; i < N - 1; i++) {
			ans = gcd(ans, a[i]);
		}
		for (int i = 0; i < N - 1; i++) {
			int g = a[N-1],j = 0;
			while(j < N - 1) {
				if (j == i) {
					j++;
					continue;
				}
				g = gcd(g,a[j]);
				j++;
			}
			if (ans < g) ans = g;
			j = 0;
		}
	}
	else if (N == 2) ans = (a[0] >= a[1]) ? a[0] : a[1];
	printf("%d\n",ans);
	return 0;
}

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

import functools
from fractions import Fraction

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

ans = 1
for i in range(N):
    tmp = A.copy()
    tmp.pop(i)
    ag = int(functools.reduce(fractions.gcd, tmp))
    if ag > ans:
        ans = ag

print(ans)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import functools
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: Java

import java.util.*;
import java.io.*;

public class Aim{
    public static int gojo(int a,int b){
        if(a%b==0)return b;
        return gojo(b,a%b);
    }
    public static void main(String[] args)throws IOException{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] ary=new int[n];
        for(int i=0;i<n;i++)ary[i]=sc.nextInt();
        sc.close();
        int maxnum=0;
        for(int i=0;i<n-1;i++){
            for(int j=i+1;j<n;j++){
                if(maxnum<gojo(Math.max(ary[i],ary[j]),Math.min(ary[i],ary[j]))){
                    maxnum=gojo(Math.max(ary[i],ary[j]),Math.min(ary[i],ary[j]));
                }
            }
        }
        System.out.println(maxnum+"\n");
    }
}

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

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

int fun(int a, int b) {
    if (b == 0)
        return a;

    return fun(b, a % b);
}

int main() {
  int N, i, answer;
  cin >> N;
  vector<int> A(N);
  for (i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  int gcd = A[0];
  int no_look = A[0];
  int tmp1, tmp2;
  for (i = 0; i < N; i++) {
    if (A[i] % gcd == 0) {
      continue;
    }
    if ((tmp1 = fun(A[i], gcd)) < (tmp2 = fun(no_look, gcd))) {
      no_look = A[i];
      gcd = tmp2;
    } else {
      gcd = tmp1;
    }
  }
  if (gcd == A[0]) {
    int gcd2 = A[1];
    for (i = 2; i < N; i++) {
      gcd2 = fun(A[i], gcd2)
    }
    if (gcd2 > gcd) gcd = gcd2;
  }
  answer = gcd;
  cout << answer << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:29: error: expected ';' before '}' token
   38 |       gcd2 = fun(A[i], gcd2)
      |                             ^
      |                             ;
   39 |     }
      |     ~
Language: C++

#include <iostream>
#include <vector>
#include <deque>
#include <climits>
#include <cmath>
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<long long int>
#define vc vector<char>
#define vs vector<string>
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(i = (a); i < (n); i++)
#define fi(i,a,n) for(i = (a); i <= (n); i++)
#define F first
#define S second


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


int main(){
    int n;
    cin>>n;
    vi v(n);
    for(ll i=0;i<n;i++){
        cin>>v[i];
    }
    vi a(n);
    vi b(n);
    vi c(n);
    a[0] = v[0];
    for(ll i=1;i<n;i++){
        a[i] = gcd(a[i-1],v[i]);
    }

    b[n-1] = v[n-1];
    for(ll i=(n-2);i>=0;i--){
        b[i] = gcd(b[i+1],v[i]);
    }

    c[0] = b[1];
    c[n-1] = a[n-2];

    for(ll i=1;i<n-1;i++){
        c[i] = gcd(a[i-1],b[i+1]);
    }



    sort(c.begin(),c.end());

    cout<<c[n-1]<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   57 |     sort(c.begin(),c.end());
      |     ^~~~
      |     sqrt
Language: C

#include <stdio.h>
int main(){
  int n,tmp,r;
  int *ptr;
int lea=1;
int sec=1000000000
   scanf("%d",&n);
  ptr = (int*)malloc( sizeof(int)*n);
  for(int s=0;s<n;s++){
    scanf("%d",ptr[s]);
  }
  for(int i=0;i<(n-1);i++){
    for(int a=1;a<n;a++){
  if(ptr[i]<ptr[a]){
    tmp = *ptr[i];
    *ptr[i] = *ptr[a];
    *ptr[a] = tmp;
  }
  r = ptr[i] % ptr[a];
  while(r!=0){
    *ptr[i] = *ptr[a];
    *ptr[a] = r;
    r = *ptr[i] % ptr[a];
  }
if((lea<r)&&(r<sec)){
sec=r;
}
}
}
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:4: error: expected ',' or ';' before 'scanf'
    7 |    scanf("%d",&n);
      |    ^~~~~
main.c:8:15: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
    8 |   ptr = (int*)malloc( sizeof(int)*n);
      |               ^~~~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | int main(){
main.c:8:15: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
    8 |   ptr = (int*)malloc( sizeof(int)*n);
      |               ^~~~~~
main.c:8:15: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:15:11: error: invalid type argument of unary '*' (have 'int')
   15 |     tmp = *ptr[i];
      |           ^~~~~~~
main.c:16:5: error: invalid type argument of unary '*' (have 'int')
   16 |     *ptr[i] = *ptr[a];
      |     ^~~~~~~
main.c:16:15: error: invalid type argument of unary '*' (have 'int')
   16 |     *ptr[i] = *ptr[a];
      |               ^~~~~~~
main.c:17:5: error: invalid type argument of unary '*' (have 'int')
   17 |     *ptr[a] = tmp;
      |     ^~~~~~~
main.c:21:5: error: invalid type argument of unary '*' (have 'int')
   21 |     *ptr[i] = *ptr[a];
      |     ^~~~~~~
main.c:21:15: error: invalid type argument of unary '*' (have 'int')
   21 |     *ptr[i] = *ptr[a];
      |               ^~~~~~~
main.c:22:5: error: invalid type argument of unary '*' (have 'int')
   22 |     *ptr[a] = r;
      |     ^~~~~~~
main.c:23:9: error: invalid type argument of unary '*' (have 'int')
   23 |     r = *ptr[i] % ptr[a];
      |         ^~~~~~~