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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<vector<int>> B(N,vector<int>(N));
  
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      B.at(i).at(j) = A.at(j);
    }
  }
  B.at(0).at(0) = A.at(N);
  for(int i = 1; i < N; i++) {
    B.at(i).at(i) = A.at(i-1);
  }
  
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N-1; j++) {
      B.at(i).at(j+1) = gcd(B.at(i).at(j), B.at(i).at(j+1));
    }
  }
  int ans = 0;
  for(int i = 0; i < N; i++) {
    ans = max(ans,B.at(i));
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type&)'
   30 |     ans = max(ans,B.at(i));
      |           ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:30:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'})
   30 |     ans = max(ans,B.at(i));
      |           ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:30:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   30 |     ans = max(ans,B.at(i));
      |           ~~~^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<vector<int>> B(N,vector<int>(N));
  
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      B.at(i).at(j) = A.at(j);
    }
  }
  B.at(0).at(0) = A.at(N);
  for(int i = 1; i < N; i++) {
    B.at(i).at(i) = A.at(i-1);
  }
  
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N-1; j++) {
      B.at(i).at(j+1) = gcd(B.at(i).at(j), B.at(i).at(j+1));
    }
  }
  int ans = 0;
  for(int i = 0; i < N; i++) {
    ans = max(ans,B.at(i-1));
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type&)'
   30 |     ans = max(ans,B.at(i-1));
      |           ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:30:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'})
   30 |     ans = max(ans,B.at(i-1));
      |           ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:30:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   30 |     ans = max(ans,B.at(i-1));
      |           ~~~^~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<vector<int>> B(N,vector<int>(N));
  
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      B.at(i).at(j) = A.at(j);
    }
  }
  B.at(0).at(0) = A.at(N);
  for(int i = 1; i < N; i++) {
    B.at(i).at(i) = A.at(i-1);
  }
  
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N-1; j++) {
      B.at(i).at(j+1) = gcd(B.at(i).at(j), B.at(i).at(j+1));
    }
  }
  int ans = 0;
  for(int i = 0; i < N; i++) {
    ans = max(ans,B.at(N-1));
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type&)'
   30 |     ans = max(ans,B.at(N-1));
      |           ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:30:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'})
   30 |     ans = max(ans,B.at(N-1));
      |           ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:30:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   30 |     ans = max(ans,B.at(N-1));
      |           ~~~^~~~~~~~~~~~~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <iomanip>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
#include <math.h>
#include <numeric>
#include <stack>
using namespace std;

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

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

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

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

	int res = 0;
	for (int i = 0; i < N; ++i) {
		int l = left[i];
		int r = right[i + 1];

		chmax(res, GCD(l, r));
	}
	cout << res << endl;
}

Compiler output:
a.cc: In function 'bool chmax(T&, T)':
a.cc:17:53: error: expected '(' before '{' token
   17 | template<class T> inline bool chmax(T& a, T b) { if {a < b; return 1; } return 0; }
      |                                                     ^
      |                                                     (
Language: C++

import math
# from functools import reduce
# def gcd_list(numbers):
#     return reduce(math.gcd, numbers)

n=int(input())

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

left=[0]*(n+1)
right=[0]*(n+1)

left[1]=a[0]
right[n-1]=a[n-1]

for i in range(1,n):
    left[i+1]=math.gcd(left[i],a[i])
    right[n-1-i]=math.gcd(right[n-i],a[n-i-1])

# print(left)
# print(right)
last=[0]*n
last[0]=right[1]

for i in range(1,n-1):
    last.append(math.gcd(left[i],right[n-i]))

last[n-1]=left[n-1]

print(max(last))

Compiler output:
a.cc:2:3: error: invalid preprocessing directive #from
    2 | # from functools import reduce
      |   ^~~~
a.cc:3:3: error: invalid preprocessing directive #def; did you mean #ifdef?
    3 | # def gcd_list(numbers):
      |   ^~~
      |   ifdef
a.cc:4:7: error: invalid preprocessing directive #return
    4 | #     return reduce(math.gcd, numbers)
      |       ^~~~~~
a.cc:20:3: error: invalid preprocessing directive #print
   20 | # print(left)
      |   ^~~~~
a.cc:21:3: error: invalid preprocessing directive #print
   21 | # print(right)
      |   ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include"stdafx.h"
#include<iostream>
#include<vector>
using namespace std;

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

int main()
{
	int N;
	cin >> N;
	vector<int> A(N + 4, 0);
	int ans = 0, tempL, tempR, tempA;

	for (auto &x : A) cin >> x;

	vector<int> L(N + 1, 0), R(N + 1, 0);
	for (int i = 0; i < N; i++)L[i + 1] = gcd(L[i], A[i]);
	for (int i = N - 1; i >= 0; i--)R[i] = gcd(R[i + 1], A[i]);
	for (int i = 0; i < N; i++)
	{
		int m = gcd(L[i], R[i + 1]);
		ans = max(ans, m);
	}
	/*for (int i = 2; i < N + 2; i++)
	{
		vector<int> cA(A);
		for (int j = 1; j < i; j++)
		{
			tempL = gcd(cA[j - 1], cA[j]);
			cA[j] = tempL;
		}

		for (int j = N + 2; i < j; j--)
		{
			tempR = gcd(cA[j], cA[j + 1]);
			cA[j] = tempR;
		}
		tempA = gcd(tempL, tempR);
		ans = tempA > ans ? tempA : ans;
	}*/
	cout << ans << endl;
	return 0;
}

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

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

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

int main()
{
	int N;
	cin >> N;
	vector<int> A(N);
	int ans, temp;

	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	A[0] = 1;
	for (int i = 0; i < N - 1; i++)
	{
		temp = gcd(A[i], A[i + 1]);
		ans = temp > ans?temp:ans
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:42: error: expected ';' before '}' token
   30 |                 ans = temp > ans?temp:ans
      |                                          ^
      |                                          ;
   31 |         }
      |         ~
Language: C++

#include"stdafx.h"
#include<iostream>
#include<vector>
using namespace std;

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

int main()
{
	int N;
	cin >> N;
	vector<int> A(N);
	int ans, temp;

	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	A[0] = 1;
	for (int i = 0; i < N - 1; i++)
	{
		temp = gcd(A[i], A[i + 1]);
		ans = temp > ans?temp:ans
	}
	cout << ans << endl;
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int man(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0;i < N;i++){
    cin >> A.at(i);
  }
  for(int j = 1;1;j++){
    int countG = 0;
    for(int k = 0;k < N;k++){
      if(A.at(k) % j != 0){
        countG++;
      }
    }
    if(countG == 1){
      cout << j << endl;
      break;
    }
    if(j == A.at(N - 1)){
      cout << A.at(N - 1) << endl;
    }
  }
}

Compiler output:
a.cc: In function 'int man()':
a.cc:25:1: warning: no return statement in function returning non-void [-Wreturn-type]
   25 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

//
// Created by Hideaki Imamura on 2019-06-06.
//

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll gcd(ll m, ll n) {
    if (m < n) {
        ll tmp = m;
        m = n;
        n = tmp;
    }
    while (n > 0) {
        ll tmp = n;
        n = m % n;
        m = tmp;
    }
    return m;
}
./a
int main() {
    ll n, a;
    vector <ll> as;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        as.push_back(a);
    }

    ll l[100010], r[100010];
    l[0] = 0;
    r[n] = 0;
    for (int i = 0; i <= n-1; ++i) {
        l[i+1] = gcd(l[i], as[i]);
    }
    for (int i = n - 1; i >= 0; --i) {
        r[i] = gcd(r[i+1], as[i]);
    }

    vector<ll> m;
    for (int i = 0; i <= n - 1; ++i) {
        m.push_back(gcd(l[i], r[i+1]));
    }

    ll res = *std::max_element(m.begin(), m.end());

    cout << res << endl;

    return 0;
}

Compiler output:
a.cc:23:1: error: expected unqualified-id before '.' token
   23 | ./a
      | ^
Language: C++

import math


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

left = [0 for i in range(N+1)]
right = [0 for i in range(N+1)]

for i in range(N):
    left[i] = math.gcd(left[i-1], A[i])

for i in reversed(range(N)):
    right[i] = math.gcd(right[i+1], A[i])

ans = 1

for i in range(N):
    l = left[i-1]
    r = right[i+1]
    if math.gcd(l, r) > ans:
        ans = math.gcd(l, r)

print(ans)



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

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int gcd(int a,int b){
   if(b==0){
       return a;
   }else{
       return gcd(b,a%b);
   }
}
int main()
{
   int N;
   cin >> N;
   int first[100000] = {};
   int last[100000] = {};
   int A[100000] = {};
   int a[100000] = {};
   for(int i=0;i<N;i++){
       cin >> A[i];
       a[i] = A[i];
   }
   reverse(a,a+N);
for(int i=0;i<N;i++){
first[i+1] = gcd(A[i],first[i]);
}
for(int i=0;i<N;i++){
last[i+1] = gcd(a[i],last[i]);
}
int ans = 0;
   for(int i=0;i<=N;i++){
       ans = max(ans,gcd(first[i],last[N-1-i]));
   }
   cout << ans << endl;
   return 0;
}

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

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
using namespace std;
const int INF = 1e9;
using lint = long long;
const lint LINF = 1e18;
const lint MOD = 1e9 + 7;
// const lint MOD = 998244353;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}
 
int main() {
  int n; cin >> n;
  vector<int> a(n):
  rep(i,n) cin >> a[i];
  vector<int> l(n),r(n);
  rep(i,n-1) l[i+1] = gcd(l[i], a[i]);
  for(int i = n-1; i >= 0; i--) r[i-1] = gcd(r[i], a[i]);
  int ans = 1;
  rep(i,n) ans = max(ans, gcd(l[i],r[i]));
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:19: error: expected ',' or ';' before ':' token
   40 |   vector<int> a(n):
      |                   ^
a.cc:41:7: error: 'i' was not declared in this scope
   41 |   rep(i,n) cin >> a[i];
      |       ^
a.cc:10:34: note: in definition of macro 'rep'
   10 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                  ^
Language: C++

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

int gcd(int a, int b) {
  if (b > a) {
    swap(a, b);
  }

  if (b == 1) {
    return 1;
  }

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

  return b;
}

bool is_prime(int n) {
  if (n == 1) {
    return false;
  }

  if (n == 2) {
    return true;
  }

  if (n % 2 == 0) {
    return false;
  }

  double sqrt_n = sqrt(n);
  for (int i = 3; i < sqrt_n; i += 2) {
    if (n % i == 0) {
      return true;
    }
  }

  return false;
}

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

  int prime_count = 0;
  int max_prime = 2;

  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);

    if (is_prime(A.at(i))) {
      prime_count++;
      max_prime = A.at(i);
    }

    if (prime_count == 3) {
      cout << 1 << endl;
      return 0;
    }
  }

  for (prime_count == 2) {
    cout << max_prime << endl;
    return 0;
  }

  int max_gcd = 1;

  for (int i = 0; i < N; i++) {
    int tmp_gcd = (i == 0) ? A.at(1) : A.at(0);
    for (int k = 1; k < N; k++) {
      if (i == k) {
        continue;
      }
      tmp_gcd = gcd(tmp_gcd, A.at(k));
    }
    max_gcd = max(max_gcd, tmp_gcd);
  }

  cout << max_gcd << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:24: error: expected ';' before ')' token
   68 |   for (prime_count == 2) {
      |                        ^
      |                        ;
a.cc:75:3: error: expected primary-expression before 'for'
   75 |   for (int i = 0; i < N; i++) {
      |   ^~~
a.cc:73:19: error: expected ')' before 'for'
   73 |   int max_gcd = 1;
      |                   ^
      |                   )
   74 | 
   75 |   for (int i = 0; i < N; i++) {
      |   ~~~              
a.cc:68:7: note: to match this '('
   68 |   for (prime_count == 2) {
      |       ^
a.cc:86:11: error: 'max_gcd' was not declared in this scope
   86 |   cout << max_gcd << endl;
      |           ^~~~~~~
Language: Java

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class GCDOnBlackboard {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] Ai = new int[N];
        List<ArrayList<Integer>> AiList = new ArrayList<>();
        List<Integer> GreatestCommonDivisorList = new ArrayList<>();
        int notMatch = 0;

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

            Ai[i] = sc.nextInt();
        }

        //Aiごとに素因数分解
        for (int i = 0; i < N; i++) {

            ArrayList<Integer> factoring = new ArrayList<>();

            for(int n = 2; n < Ai[i]; n++) {

                if(Ai[i] % n == 0) {

                    factoring.add(n);
                }

                AiList.add(factoring);
            }
        }

        int hoge = 0;

        //NC2回の全ての組み合わせに対して最大公約数をListに格納
        while (hoge < N-1) {

            int foo = hoge + 1;
            Integer GreatestCommonDivisor = 0;

            while(foo < N-1) {

                for (int n = 0; n < AiList.get(hoge).size(); n++) {

                    for (int nextAi = 0; nextAi < AiList.get(foo+1).size(); nextAi++) {

                        if(AiList.get(hoge).get(n) == AiList.get(foo+1).get(nextAi)) {

                            GreatestCommonDivisor = AiList.get(hoge).get(n);
                        }
                    }

                foo++;
                }
            }

            GreatestCommonDivisorList.add(GreatestCommonDivisor);

            if(GreatestCommonDivisor.equals(0)) {

                notMatch++;
            }
            hoge++;
        }

        //GreatestCommonDivisorListのsizeと最大公約数がない場合に応じてansを出力
        if (notMatch >= 2) {

            System.out.println(1);
        } else if ( N == 2) {

            if (Ai[0] >= Ai[1]) {

                System.out.println(Ai[0]);
            } else {

                System.out.println(Ai[1]);
            }
        } else {

            int max = 0;

            for (int i = 0; i < GreatestCommonDivisorList.size(); i++) {

                if (max < GreatestCommonDivisorList.get(i)) {

                    max = GreatestCommonDivisorList.get(i);
                }
            }

            System.out.println(max);
        }

        sc.close();
    }
}


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

#include <iostream>
#include <vector>
#include <map>

using namespace std;

typedef long long ll;

const ll MAX_N = 1e5+10;

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

int main(int argc, char const *argv[])
{
    ll n, a[MAX_N], max_gcd;
    vector<pair<ll, ll> > pvec;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }

    max_gcd = gcd(a[0], a[1]);

    for (int i = 2; i < n; ++i) {
        ll pre_gcd = max_gcd;
        max_gcd = gcd(max_gcd, a[i]);
        if (max_gcd < pre_gcd) {
            pvec.emplace_back(make_pair(max_gcd, i));
            max_gcd = pre_gcd;
        }
        else {
            if (i==2) {
                if (gcd(a[0], a[2]) < gcd(a[1], a[2])) {
                    pvec.emplace_back(make_pair(gcd(a[0], a[2]), 0));
                    max_gcd = gcd(a[1], a[2]);
                }
                else {
                    pvec.emplace_back(make_pair(gcd(a[1], a[2]), 1));
                    max_gcd = gcd(a[0], a[2]);
                }
            }
        }
    }
    sort(pvec.begin(), pvec.end());
    if (pvec.size()>1) {
        max_gcd = pvec[1].first;
    }
    
    cout << max_gcd << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:47:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   47 |     sort(pvec.begin(), pvec.end());
      |     ^~~~
      |     short
Language: C++

#include <vector>
using namespace std;
 
long long int gcd(long long int a,long long int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
 
int main()
{
	long long int n; cin>>n;
	long long int a[1000001];
	for(long long int i=0;i<n;i++) cin>>a[i];
	
	long long int l[1000001],r[1000001];
	
	l[0]=a[0],r[n-1]=a[n-1];
	
	for(long long int i=1,j=n-2;i<n;i++,j--)
	{
	   l[i]=gcd(l[i-1],a[i]);
	   r[j]=gcd(r[j+1],a[j]);
	}
	long long int m=0;
	for(long long int i=1;i<=n-2;i++) m=max(m,gcd(l[i-1],r[i+1]));
	
	m=max(m,l[n-2]);
	m=max(m,r[1]);
	cout<<m<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:26: error: 'cin' was not declared in this scope
   12 |         long long int n; cin>>n;
      |                          ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <vector>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:30:9: error: 'cout' was not declared in this scope
   30 |         cout<<m<<endl;
      |         ^~~~
a.cc:30:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:18: error: 'endl' was not declared in this scope
   30 |         cout<<m<<endl;
      |                  ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <vector>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C

#include<stdio.h>
int min(int x,int y){
  if(x<y){
    return x;
  }
  else
    return y;
}
int main(void){
  int N,i,j,k,a,b,c,z,tmp;
  scanf("%d",&N);
  int A[N],B[N*(N-1)/2];
  for(i=0;i<N;i++){
    scanf("%d",&N);
  }
  for(i=0;i<N-1;i++){
    for(j=i+1;j<N;j++){
      a=A[i];
      b=A[j];
      z=min(a,b);
      c=0;
      for(k=1;k<=z;k++){
        if(a%k==0&&b&k==0)
          c=k;
      }
      if(i!=0){
        B[j-1+(N-1)*i-i*(i-1)/2]=c;
      }
      else
        B[j-1]=c;
    }
  }
  for(i=0;i<(((n-1)*n/2)-1);i++){
    if(B[i]<B[i+1]){
      tmp=B[i];
      B[i]=B[i+1];
      B[i+1]=tmp;
    }
  }
  printf("%d",B[((n-1)*n/2-1)]);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:33:16: error: 'n' undeclared (first use in this function)
   33 |   for(i=0;i<(((n-1)*n/2)-1);i++){
      |                ^
main.c:33:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

typedef long long ll;
typedef unsigned long long ull;

template <typename T>
T gcd( T m, T n ){
    if ( ( 0 == m ) || ( 0 == n ) ) return 0;

    while( m != n ){
        if ( m > n ) m %= n;
        else         n %= m;

        if(m == 0) return n;
        if(n == 0) return m;
    }
    return m;
}-


int main()
{
    ll N;
    cin >> N;
    set<ll> onePassed;
    ll Ai;
    cin >> Ai;
    ll aGCD = Ai;
    onePassed.insert(Ai);
    cin >> Ai;
    onePassed.insert(Ai);
    aGCD = gcd(aGCD, Ai);
    for(int i=2;i<N;i++){
        cin >> Ai;
        set<ll> tmp;
        for(auto v : onePassed){
            tmp.insert(gcd(Ai, v));
        }
        tmp.insert(aGCD);
        onePassed = tmp;
        aGCD = gcd(aGCD, Ai);
    }
    cout<<*onePassed.rbegin()<<endl;

    return 0;
}

Compiler output:
a.cc:19:2: error: expected unqualified-id before '-' token
   19 | }-
      |  ^
Language: C++

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

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

int main(){
    int n, ans;
    ans = 0;

    vector<int> aa(n);
    vector<int> ll(n+1);
    vector<int> rr(n+1);

    ll[0] = 0;
    rr[0] = 0;

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

    for(int i=0;i<n;i++){
        ll[i+1] = gcd(ll[i], aa[i]);
        rr[i+1] = gcd(rr[i], aa[n-i-1]);
    }

    for(int i=0;i<n;i++){
        ans = max(gcd(ll[i], rr[n-i-1]));
    }

    cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:18: error: no matching function for call to 'max(int)'
   30 |         ans = max(gcd(ll[i], rr[n-i-1]));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/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, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:30:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   30 |         ans = max(gcd(ll[i], rr[n-i-1]));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
Language: C++

#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
  if(a>b){gcd(b,a);}
  else if(a==0){return b;}
  else{gcd(a,b%a);}
}
int main(){
  int n,ans;
  ans=0;
  cin>>n;
  vector<int> a(n);
  vector<int> l(n+1);
  vector<int> r(n+1);
  l[0]=0;
  r[n]=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  //i番目が抜けてることにしたい
  for(int i=1;i<=n;i++){
    l[i]=gcd(l[i-1],c[i-1]);
    r[i-1]=gcd(r[i],c[n-i]);
    ans=max(ans,gcd(l[i],r[i]));
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:21: error: 'c' was not declared in this scope
   22 |     l[i]=gcd(l[i-1],c[i-1]);
      |                     ^
a.cc: In function 'int gcd(int, int)':
a.cc:7:1: warning: control reaches end of non-void function [-Wreturn-type]
    7 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
  if(a>b){gcd(b,a);}
  else if(a==0){return b;}
  else{gcd(a,b%a);}
}
int main(){
  int n,ans;
  ans=0;
  cin>>n;
  vector<int> a(n);
  vector<int> l(n+1);
  vector<int> r(n+1);
  l(0)=0;
  r(n)=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  //i番目が抜けてることにしたい
  for(int i=1;i<=n;i++){
    l[i]=gcd(l[i-1],c[i-1]);
    r[i-1]=gcd(r[i],c[n-i]);
    ans=max(ans,gcd(l[i],r[i]));
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:4: error: no match for call to '(std::vector<int>) (int)'
   15 |   l(0)=0;
      |   ~^~~
a.cc:16:4: error: no match for call to '(std::vector<int>) (int&)'
   16 |   r(n)=0;
      |   ~^~~
a.cc:22:21: error: 'c' was not declared in this scope
   22 |     l[i]=gcd(l[i-1],c[i-1]);
      |                     ^
a.cc: In function 'int gcd(int, int)':
a.cc:7:1: warning: control reaches end of non-void function [-Wreturn-type]
    7 | }
      | ^
Language: C++

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

int GCD(int a, int b) {
    while (b != 0) {
        int t = a % b;
        a = b;
        b = t;
    }
    return a;
}

int a[100000];

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

    int i = 2;
    while (true) {
        int t = res * i, cnt = 0;
        for (int j = 0; j < n; j++) {
            if (a[j] % t) {
                cnt++;
            }
            if (cnt > 1) {
                break;
            }
        }
        if (cnt > 1) {
            break;
        }
        i++;
    }

    cout << res * (i - 1);
    return 0;
}


Compiler output:
a.cc:16:5: error: 'cin' does not name a type
   16 |     cin >> n >> a[0];
      |     ^~~
a.cc:18:5: error: expected unqualified-id before 'for'
   18 |     for (int i = 1; i < n; i++) {
      |     ^~~
a.cc:18:21: error: 'i' does not name a type
   18 |     for (int i = 1; i < n; i++) {
      |                     ^
a.cc:18:28: error: 'i' does not name a type
   18 |     for (int i = 1; i < n; i++) {
      |                            ^
a.cc:24:5: error: expected unqualified-id before 'while'
   24 |     while (true) {
      |     ^~~~~
a.cc:40:5: error: 'cout' does not name a type
   40 |     cout << res * (i - 1);
      |     ^~~~
a.cc:41:5: error: expected unqualified-id before 'return'
   41 |     return 0;
      |     ^~~~~~
a.cc:42:1: error: expected declaration before '}' token
   42 | }
      | ^
Language: C++

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

const int INF = 1e9;

vector<int> get_divisions(int ai) {
  vector<int> d;
  for (int j=1; j<=(int)sqrt(ai); j++) {
    if (ai % j == 0) {
      d.push_back(j);
      if (j != ai / j){
        d.push_back(ai/j);
      }
    }
  }
  return d;
}
int main() {
  int n;
  cin>>n;
  int a[n];
  for (int i=0; i<n; i++) {
    cin>>a[i];
  }
  if (n == 2) {
    cout<<max(a[0], a[1])<<endl;
    return;
  }
  sort(a, a+n);
  vector<int> x = get_divisions(a[0]);
  vector<int> y = get_divisions(a[1]);
  vector<int> z = get_divisions(a[2]);

  map<int, int> tmp;
  for (int xi: x) {
    ++tmp[xi];
  }
  for (int yi: y) {
    ++tmp[yi];
  }
  for (int zi: z) {
    ++tmp[zi];
  }

  map<int, int> m;
  vector<int> nums;
  for (auto tmpi: tmp) {
    if (tmpi.second >= 2) {
      m[tmpi.first] = tmpi.second;
      nums.push_back(tmpi.first);
    }
  }

  for (int i=3; i<n; i++) {
    for (int ni: nums) {
      if (a[i] % ni == 0) {
        ++m[ni];
      }
    }
  }
  int ans = 1;

  for (auto mi: m) {
    if (mi.second >= n - 1) {
      ans = max(ans, mi.first);
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   27 |     return;
      |     ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b){
	while(1) {
		if(a < b) swap(a, b);
		if(!b) break;
		a %= b;
	}
	return a;
}

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

	long long gcd,ans;
	{
		gcd=a[1];
		for(int j=2; j<n; j++)gcd=gcd(gcd,a[j]);
		ans=gcd;
	}
	for(int i=1; i<n; i++){
		gcd=a[0];
		for(int j=1; j<n; j++)if(i!=j)gcd=gcd(gcd,a[j]);
		ans=max(ans,gcd);
	}
	
	cout << ans << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:46: error: 'gcd' cannot be used as a function
   21 |                 for(int j=2; j<n; j++)gcd=gcd(gcd,a[j]);
      |                                           ~~~^~~~~~~~~~
a.cc:26:54: error: 'gcd' cannot be used as a function
   26 |                 for(int j=1; j<n; j++)if(i!=j)gcd=gcd(gcd,a[j]);
      |                                                   ~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long gcd();

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

	long long gcd,ans;
	{
		gcd=a[1];
		for(int j=2; j<n; j++)gcd=gcd(gcd,a[j]);
		ans=gcd;
	}
	for(int i=1; i<n; i++){
		gcd=a[0];
		for(int j=1; j<n; j++)if(i!=j)gcd=gcd(gcd,a[j]);
		ans=max(ans,gcd);
	}
	
	cout << ans << endl;
	
	return 0;
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:46: error: 'gcd' cannot be used as a function
   14 |                 for(int j=2; j<n; j++)gcd=gcd(gcd,a[j]);
      |                                           ~~~^~~~~~~~~~
a.cc:19:54: error: 'gcd' cannot be used as a function
   19 |                 for(int j=1; j<n; j++)if(i!=j)gcd=gcd(gcd,a[j]);
      |                                                   ~~~^~~~~~~~~~
Language: C++

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

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

	long long gcd,ans;
	{
		gcd=a[1];
		for(int j=2; j<n; j++)gcd=gcd(gcd,a[j]);
		ans=gcd;
	}
	for(int i=1; i<n; i++){
		gcd=a[0];
		for(int j=1; j<n; j++)if(i!=j)gcd=gcd(gcd,a[j]);
		ans=max(ans,gcd);
	}
	
	cout << ans << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:46: error: 'gcd' cannot be used as a function
   13 |                 for(int j=2; j<n; j++)gcd=gcd(gcd,a[j]);
      |                                           ~~~^~~~~~~~~~
a.cc:18:54: error: 'gcd' cannot be used as a function
   18 |                 for(int j=1; j<n; j++)if(i!=j)gcd=gcd(gcd,a[j]);
      |                                                   ~~~^~~~~~~~~~
Language: C++

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

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

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

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

    vector<int> l(n+2), r(n+2), m(n+1);
    l[0] = 0; r[n+1] = 0; m[0] = 0;
    for (int i=1; i < n+1; i++) l[i] = gcd(l[i-1], a[i-1]);
    for (int i=n; i > 0; i--) r[i] = gcd(r[i+1], a[i]);
    for (int i=1; i < n+1; i++) m[i] = gcd(l[i], r[i+1]);
    cout << *max_element(m.begin(), m.end()) << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: 'max_element' was not declared in this scope
   25 |     cout << *max_element(m.begin(), m.end()) << endl;
      |              ^~~~~~~~~~~
Language: C++

import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for(int i = 0;i<n;i++){
            a[i] = Integer.parseInt(sc.next());
        }
        if(n == 2){
            if(a[0] < a[1]){
                System.out.println(a[1]);
            }else{
                System.out.println(a[0]);
            }
        }else{
            Arrays.sort(a);
            int min = gcd(a[0],a[2]);
            int gcd = Integer.MAX_VALUE;
            int tmp = 0;
            for(int i = 0;i<n-1;i++){
                tmp = gcd(a[i],a[i+1]);
                if(min > tmp){
                    gcd = min;
                    min = tmp;
                }
            }
            System.out.println(gcd);
        }
    }

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

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

import java.util.*;
public class Main {
  static int gcd( int a , int b ){
    return b>0?gcd(b,a%b):a;
  }
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();

    int[] num;
    num = new int[N];
    for ( int i = 0 ; i < N ; i++ ){
      num[i] = sc.nextInt();
    }
    
    int[] GCDs;
    GCDs = new int[N];
    
    for (int i = 0 ; i < N ; i++){
      if (i==0){int GCD = num[1];}
      else {int GCD = num[0];}
      for ( int k = 0 ; k < N ; k++ ){
        if ( i==k ){continue;}
        GCD = gcd ( num[k] , GCD );
      }
      GCDs[i] =GCD;
    }

    int max = 0;
    for(int i = 0; i < GCDs.length ; i++) {
        if(max < GCDs[i]) {
            max = GCDs[i];
        }
    }
  }
}

Compiler output:
Main.java:24: error: cannot find symbol
        GCD = gcd ( num[k] , GCD );
        ^
  symbol:   variable GCD
  location: class Main
Main.java:24: error: cannot find symbol
        GCD = gcd ( num[k] , GCD );
                             ^
  symbol:   variable GCD
  location: class Main
Main.java:26: error: cannot find symbol
      GCDs[i] =GCD;
               ^
  symbol:   variable GCD
  location: class Main
3 errors
Language: C++

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

int main() {
    int N, M;

    cin >> N;
    vector<int> A(N);

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

    cout << "1" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: 'Val' was not declared in this scope
   12 |         cin >> Val[i];
      |                ^~~
a.cc:14:5: error: 'Val' was not declared in this scope
   14 |     Val[0] = 1;
      |     ^~~
Language: C++

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

int main() {
    int N, M;

    cin >> N;
    vector<int> A(N);

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: 'Val' was not declared in this scope
   12 |         cin >> Val[i];
      |                ^~~
a.cc:14:5: error: 'Val' was not declared in this scope
   14 |     Val[0] = 1;
      |     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,i,mx=0;
int a[n+1];
int l[n+2],r[n+2];
int main(){
    cin>>n;
    for(i=1;i<=n;i++) cin>>a[i];
  	for(i=1;i<=n;i++){
  		l[i]=__gcd(l[i-1],a[i]);
	}
  	for(i=n;i>=1;i--){
  		r[i]=__gcd(r[i+1],a[i]);
	}
	for(i=1;i<=n;i++){
		mx=max(mx,__gcd(l[i-1],r[i+1]));
	}
	cout<<mx;
    return 0;
}

Compiler output:
a.cc:4:8: error: size of array 'a' is not an integral constant-expression
    4 | int a[n+1];
      |       ~^~
a.cc:5:8: error: size of array 'l' is not an integral constant-expression
    5 | int l[n+2],r[n+2];
      |       ~^~
a.cc:5:15: error: size of array 'r' is not an integral constant-expression
    5 | int l[n+2],r[n+2];
      |              ~^~
Language: C

#include "stdio.h"

void load(void);
int calc(void);

int main(void){
  //load();
  long test;
  scanf("%d", &test)
  printf("%d", test);
}

void load(void){
  char s[6][20];
  int count = 0;
  
  while(count < 6){
    scanf("%s\n", s[count]);
    count++;
  }
  
}

int calc(void){
}

Compiler output:
main.c: In function 'main':
main.c:9:21: error: expected ';' before 'printf'
    9 |   scanf("%d", &test)
      |                     ^
      |                     ;
   10 |   printf("%d", test);
      |   ~~~~~~
Language: C

#include "stdio.h"

int gojo(int, int);

int main(void){
  int N, A[100000], r, rmax;
  scanf("%d\n", &N);
  for(int i = 0;i < N;i++){
    scanf("%d ", &A[i]);
  }
  r = A[1];
  for(int j = 2;j < N;j++){
      r = gojo(r, A[j]);
  }
  rmax = r;
  for(int i = 1;i < N;i++){
    r = A[0]
    for(int j = 1;j < N;j++){
      if(j != i){
        r = gojo(r, A[j]);
      }
    }
    if(rmax < r){
      rmax = r;
    }
  }
  printf("%d", rmax);
  return 0;
}

int gojo(int a, int b){
  int r;
  if(a < b){
    r = b;
    b = a;
    a = r;
  }
  while(1){
    if(a % b == 0){
      break;
    }else{
      r = a % b;
      a = b;
      b = r;
    }
  }
  return b;
}

Compiler output:
main.c: In function 'main':
main.c:17:13: error: expected ';' before 'for'
   17 |     r = A[0]
      |             ^
      |             ;
   18 |     for(int j = 1;j < N;j++){
      |     ~~~
Language: C++

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

const int N = 1e5 + 9;

vector< int > ar;

int main(){
    int n;
    cin >> n;
    for( int i = 0; i < n; i++ ) {
        int num;
        cin >> num;
        ar.push_back( num );
    }
    sort( ar.begin(), ar.end() );

    for( int i = 0; i < N * 1000; i++ ){

    }
    cout << i << endl;

//    for( int i = ar[ 1 ]; i > 0; i-- ){
//
//        for( int j  )
//    }



    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:13: error: 'i' was not declared in this scope
   21 |     cout << i << endl;
      |             ^
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> s(n);
  for(int i = 0; i < n; i++){
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  for(int i = s[1]; i > 0; i--){
    int x = 0;
    for(int j = 0; j < n; j++){
      if(s[j]%i != 0){
        x++;
      }
    }
    if(x == 1 || x == 0;){
      cout << s[i] << endl;
      break;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: expected primary-expression before ')' token
   19 |     if(x == 1 || x == 0;){
      |                         ^
Language: C++

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

int n;
int* a;
map<string, int> cache;

int _gcd(int a, int b) {
	return (b > 0) ? _gcd(b, a % b) : a;
}

int gcd(int a, int b) {
	string key = to_string(a) + ':' + to_string(b);
	if (cache.count(key)) {
		return cache[key];
	}
	else {
		int g = _gcd(a, b);
		cache[key] = g;
		return g;
	}
}

int getMaxGCD(int i) {
	int g = (i == 0) ? a[1] : a[0];
	for (int j = 0; j < n; j++) {
		if (j != i) {
			g = gcd(g, a[j]);
		}
		if (g == 1) {
			break;
		}
	}

	return g;
}

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

	int h = 0;
	int m = 0;
	int midx = 0;
	for (int i = 0; i < n; i++) {
		h = getMaxGCD(i);
		if (h > m) {
			midx = i;
			m = h;
		}
	}
	cout << m;
	return 0;
}


Compiler output:
a.cc:8:1: error: 'map' does not name a type
    8 | map<string, int> cache;
      | ^~~
a.cc: In function 'int gcd(int, int)':
a.cc:16:13: error: 'cache' was not declared in this scope
   16 |         if (cache.count(key)) {
      |             ^~~~~
Language: C++

using namespace std;
int gcm(int a, int b);
int main () {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> gcm_res(N); // gcm except for A[i]
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    gcm_res[i] = A[0];
  }
  gcm_res[0] = A[1];  

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      
      if (i==j) {
	continue;
      }
      //cout<<i<<" "<<j<<" "<<A[i]<<" "<<gcm_res[j]<<endl;
      gcm_res[j] = gcm(A[i], gcm_res[j]);
    }
  }

  int gcm_max = 0;
  for (int i = 0; i < N; i++) {
    if (gcm_max < gcm_res[i]) {
      gcm_max = gcm_res[i];
    }
  }
  cout<<gcm_max<<endl;
  return 0;
}

int gcm(int a, int b) {
  if (a < b) {
    int temp = a;
    a = b;
    b = temp;
  }
  
  while (a%b != 0) {
    int a_temp = a;
    a = b;
    b = a_temp%b;
  }

  return b;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> N;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> A(N);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:6:10: error: expected primary-expression before 'int'
    6 |   vector<int> A(N);
      |          ^~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> gcm_res(N); // gcm except for A[i]
      |          ^~~
a.cc:9:12: error: 'A' was not declared in this scope
    9 |     cin >> A[i];
      |            ^
a.cc:10:5: error: 'gcm_res' was not declared in this scope
   10 |     gcm_res[i] = A[0];
      |     ^~~~~~~
a.cc:12:3: error: 'gcm_res' was not declared in this scope
   12 |   gcm_res[0] = A[1];
      |   ^~~~~~~
a.cc:12:16: error: 'A' was not declared in this scope
   12 |   gcm_res[0] = A[1];
      |                ^
a.cc:31:3: error: 'cout' was not declared in this scope
   31 |   cout<<gcm_max<<endl;
      |   ^~~~
a.cc:31:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:18: error: 'endl' was not declared in this scope
   31 |   cout<<gcm_max<<endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;