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

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	rep(i,n) cin >> v[i];
	vector<int> pre(n);
	vector<int> suf(n);
	pre[0] = v[0];
	suf[n-1] = v[n-1];

	rep(i,n-1) {
		pre[i+1] = gcd(pre[i], v[i+1]);
		suf[n-1-i-1] = gcd(suf[n-1-i], v[n-1-i-1]);
	}

	ll ans = max(pre[n-2], suf[1]);
	for (int i = 1; i < n-1; i++) {
		ans = max(ans, gcd(pre[i-1], suf[i+1]));
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:26: error: no matching function for call to 'max(ll&, std::common_type_t<int, int>)'
   36 |                 ans = max(ans, gcd(pre[i-1], suf[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:36:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'std::common_type_t<int, int>' {aka 'int'})
   36 |                 ans = max(ans, gcd(pre[i-1], suf[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:36:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   36 |                 ans = max(ans, gcd(pre[i-1], suf[i+1]));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
template <typename T>
ll extGCD(T a, T b) {
  if (b == 0) {
    return a;
  }
  ll d = extGCD(b, a % b);
  return d;
}
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> L(N + 1), R(N + 1);
  REP(i, N) { cin >> A[i]; }
  L[0] = 0;
  REP(i, N) { L[i + 1] = extGCD(L[i], A[i]); }
  R[N] = 0;
  for (int i = N - 1; i >= 0; i--) {
    R[i] = extGCD(R[i + 1], A[i]);
  }
  int ans = 0;
  REP(i, N) { ans = max<ll>(ans, extGCD(L[i], R[i + 1])); }
  cout << ans << endl;
}

Compiler output:
a.cc:3:17: error: 'atcoder' is not a namespace-name
    3 | using namespace atcoder;
      |                 ^~~~~~~
Language: C++

#include <bits/stdc++.h>

//#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
template <typename T>
ll extGCD(T a, T b) {
  if (b == 0) {
    return a;
  }
  ll d = extGCD(b, a % b);
  return d;
}
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> L(N + 1), R(N + 1);
  REP(i, N) { cin >> A[i]; }
  L[0] = 0;
  REP(i, N) { L[i + 1] = extGCD(L[i], A[i]); }
  R[N] = 0;
  for (int i = N - 1; i >= 0; i--) {
    R[i] = extGCD(R[i + 1], A[i]);
  }
  int ans = 0;
  REP(i, N) { ans = max<ll>(ans, extGCD(L[i], R[i + 1])); }
  cout << ans << endl;
}

Compiler output:
a.cc:5:17: error: 'atcoder' is not a namespace-name
    5 | using namespace atcoder;
      |                 ^~~~~~~
Language: C++

#include <bits/stdc++.h>

#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
template <typename T>
ll extGCD(T a, T b) {
  if (b == 0) {
    return a;
  }
  ll d = extGCD(b, a % b);
  return d;
}
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> L(N + 1), R(N + 1);
  REP(i, N) { cin >> A[i]; }
  L[0] = 0;
  REP(i, N) { L[i + 1] = extGCD(L[i], A[i]); }
  R[N] = 0;
  for (int i = N - 1; i >= 0; i--) {
    R[i] = extGCD(R[i + 1], A[i]);
  }
  int ans = 0;
  REP(i, N) { ans = max<ll>(ans, extGCD(L[i], R[i + 1])); }
  cout << ans << endl;
}

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

#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

int gcd(int a, int b) {
    if (b == 0) return a;
    else 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;
  }
  int a = gcd(A[0], A[1]);
  rep(i, n) a = gcd(a, A[i]);
  rep(i, n) A[i] /= a;
  int b1 = gcd(A[0], A[1]);
  int b2 = gcd(A[0], A[2]);
  int b3 = gcd(A[1], A[2]);
  auto f = [&](int b) {
    bool skiped = false;
    rep(i, n) {
      int tmp = gcd(b, A[i]);
      if (tmp == 1 && !skiped) {
        skiped = true;
      } else {
        b = tmp;
      }
    }
    return b;
  }
  int b = f(b1);
  b = max(b, f(b2));
  b = max(b, f(b3));
  int ans = a * b;
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:3: error: expected ',' or ';' before 'int'
   41 |   int b = f(b1);
      |   ^~~
a.cc:42:3: error: 'b' was not declared in this scope
   42 |   b = max(b, f(b2));
      |   ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

int gcd(int a, int b) {
    if (b == 0) return a;
    else 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;
  }
  int a = gcd(A[0], A[1]);
  rep(i, n) a = gcd(a, A[i]);
  rep(i, n) A[i] /= a;
  int b1 = gcd(A[0], A[1]);
  b2 = gcd(A[0], A[2]);
  b3 = gcd(A[1], A[2]);
  auto f = [&](int b) {
    bool skiped = false;
    rep(i, n) {
      int tmp = gcd(b, A[i]);
      if (tmp == 1 && !skiped) {
        skiped = true;
      } else {
        b = tmp;
      }
    }
    return b;
  }
  int b = f(b1);
  b = max(b, f(b2));
  b = max(b, f(b3));
  int ans = a * b;
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:3: error: 'b2' was not declared in this scope; did you mean 'b1'?
   27 |   b2 = gcd(A[0], A[2]);
      |   ^~
      |   b1
a.cc:28:3: error: 'b3' was not declared in this scope; did you mean 'b1'?
   28 |   b3 = gcd(A[1], A[2]);
      |   ^~
      |   b1
a.cc:41:3: error: expected ',' or ';' before 'int'
   41 |   int b = f(b1);
      |   ^~~
a.cc:42:3: error: 'b' was not declared in this scope
   42 |   b = max(b, f(b2));
      |   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  rep(i,n) cin >> a[i];

  //sort(a.begin(),a.end());
  vector<long long> l(n);
  rep(i,n-1) l[i+1] = gcd(l[i], a[i]);

  reverse(a.begin(),a.end());
  vector<long long> r(n);
  rep(i,n-1) r[i+1] = gcd(r[i], a[i]);
  reverse(r.begin(), r.end());

  int ans = 0;
  rep(i,n) ans = max(ans,gcd(l[i], r[i]));

  cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: no matching function for call to 'max(int&, std::common_type_t<long long int, long long int>)'
   26 |   rep(i,n) ans = max(ans,gcd(l[i], r[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:26:21: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::common_type_t<long long int, long long int>' {aka 'long long int'})
   26 |   rep(i,n) ans = max(ans,gcd(l[i], r[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:26:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |   rep(i,n) ans = max(ans,gcd(l[i], r[i]));
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <stack>
using namespace std;

#define mySwap(a, b) {int temp = a; a = b; b = temp;}

typedef long long ll;
const int MAXN = 1e5+10;

int h[MAXN], ans[MAXN];

int main() {
	int n;
	scanf("%d", &n);
	for (int i=1; i<=n; i++)
		scanf("%d", &h[i]);
	
	stack<int> st;
	for (int i=n; i>=1; i--) {
		while (!st.empty() && h[st.top()]<=h[i]) {
			st.pop();
		}
		
		if (st.empty()) {
			ans[i] = min(n-i, h[i]);
		}
		else {
			ans[i] = min(h[i], st.top()-i-1);
		}
		st.push(i);
	}
	for (int i=1; i<=n; i++)
		printf("%d ", ans[i]);
	return 0;
}

=======================================

#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <stack>
using namespace std;

#define mySwap(a, b) {int temp = a; a = b; b = temp;}

typedef long long ll;
const int MAXN = 1e5+10;

int preGcd[MAXN], postGcd[MAXN], num[MAXN];

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

int main() {
	int n;
	scanf("%d", &n);
	for (int i=1; i<=n; i++) {
		scanf("%d", &num[i]);
	}
	preGcd[1] = num[1];
	postGcd[n] = num[n];
	for (int i=2; i<=n; i++) {
		preGcd[i] = gcd(num[i], preGcd[i-1]);
	}
	for (int i=n-1; i>=1; i--) {
		postGcd[i] = gcd(num[i], postGcd[i+1]);
	}
	
	//int ans = max(preGcd[n], postGcd[1]);
	int ans = max(preGcd[n-1], postGcd[2]);
	for (int i=2; i<n; i++)
		ans = max(ans, gcd(preGcd[i-1], postGcd[i+1]));
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc:41:1: error: expected unqualified-id before '==' token
   41 | =======================================
      | ^~
a.cc:54:11: error: redefinition of 'const int MAXN'
   54 | const int MAXN = 1e5+10;
      |           ^~~~
a.cc:12:11: note: 'const int MAXN' previously defined here
   12 | const int MAXN = 1e5+10;
      |           ^~~~
a.cc:68:5: error: redefinition of 'int main()'
   68 | int main() {
      |     ^~~~
a.cc:16:5: note: 'int main()' previously defined here
   16 | int main() {
      |     ^~~~
Language: C++

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

#define debug(x) (cerr << #x << " = " << x << endl;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define FOR(it, b, e) for (typeof(b) it = (b); it != (e); ++it)
#define MSET(c, v) memset(c, v, sizeof(c))

const int INF = 0x3F3F3F3F;
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const double EPS = 1e-10;

inline int cmp(double x, double y = 0)
{
  if (fabs(x - y) < EPS)
    return 0;
  return x > y ? 1 : -1;
}

const int maxn = 2e5 + 100;
int a[maxn], gcd[maxn];

int main()
{
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for(int i = 1 ; i <= n; i++)
  {
    cin >> a[i];
    gcd[i] = __gcd(gcd[i - 1], a[i]);
  }
  int g = 0;
  int ans = 0;
  for(int i = n ; i >= 1 ; i--)
  {
    auto c = __gcd(gcd[i - 1], g);
    ans = max(ans, c);
    g = __gcd(g, a[i]);
  }
  cout << ans << endl;
  return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: reference to 'gcd' is ambiguous
   34 |     gcd[i] = __gcd(gcd[i - 1], a[i]);
      |     ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:24:14: note:                 'int gcd [200100]'
   24 | int a[maxn], gcd[maxn];
      |              ^~~
a.cc:34:20: error: reference to 'gcd' is ambiguous
   34 |     gcd[i] = __gcd(gcd[i - 1], a[i]);
      |                    ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:24:14: note:                 'int gcd [200100]'
   24 | int a[maxn], gcd[maxn];
      |              ^~~
a.cc:40:20: error: reference to 'gcd' is ambiguous
   40 |     auto c = __gcd(gcd[i - 1], g);
      |                    ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:24:14: note:                 'int gcd [200100]'
   24 | int a[maxn], gcd[maxn];
      |              ^~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int N;
  cin >> N;
  vector<ll> A(N);
  REP(i, N) cin >> A[i];
  
  vector<ll> L(N);
  vector<ll> R(N);
  ll lgcd=A[0];
  ll rgcd=A[N-1];
  L[0]=lgcd;
  R[N-1]=rgcd;
  FOR(i,1,N){
    lgcd=gcd(lgcd,A[i]);
    L[i]=lgcd;
  }
  REPR(i,N-2){
    rgcd=gcd(rgcd,A[i]);
    R[i]=rgcd;
  }
  
  ll MAX = 0;
  REP(i,N){
    if(i!=0&&i!=N-1){
      ll x = gcd(L[i-1],R[i+1])
      MAX=max(MAX,x);
    }else if(i==0){
      MAX=max(MAX,R[1]);
    }else{
      MAX=max(MAX,L[N-2]);
    }
  }

  cout << MAX << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:7: error: expected ',' or ';' before 'MAX'
   38 |       MAX=max(MAX,x);
      |       ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rng(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:23:21: error: no matching function for call to 'max(ll&, std::common_type_t<int, int>)'
   23 |   rep(i,n) ans = max(ans,gcd(l[i],r[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:23:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'std::common_type_t<int, int>' {aka 'int'})
   23 |   rep(i,n) ans = max(ans,gcd(l[i],r[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:23:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   23 |   rep(i,n) ans = max(ans,gcd(l[i],r[i+1]));
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n),gcdl(n),gcdr(n);
    rep(i,n) cin>>a[i];
    gcdl[0]=a[0],gcdr[n-1]=a[n-1];
    for(ll i=1,i<n;i++) gcdl[i]=gcd(gcdl[i-1],a[i]);
    for(ll i=n-2;i>=0;i--) gcdr[i]=gcd(gcdr[i+1],a[i]);
    ll mx=gcdr[1];
    for(ll i=1;i<n-1;i++) mx=max(mx,gcd(gcdl[i-1],gcdr[i+1]));
    mx=max(mx,gcdl[n-2]);
    cout<<mx<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: expected ';' before '<' token
   15 |     for(ll i=1,i<n;i++) gcdl[i]=gcd(gcdl[i-1],a[i]);
      |                 ^
      |                 ;
a.cc:15:17: error: expected primary-expression before '<' token
Language: C++

#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll mn=1e9,mni;
    for(ll i=1;i<n;i++){
        if(gcd(a[0],a[i])<mn){
            mn=gcd(a[0],a[i]);
            mni=i;
        }
    }
    ll gcd0=a[1],gcdi=a[0];
    for(ll i=2,i<n;i++) gcd0=gcd(gcd0,a[i]);
    for(ll i=1;i<n;i++){
        if(i==mni) continue;
        else gcdi=gcd(gcdi,a[i]);
    }
    cout<<max(gcd0,gcdi)<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:17: error: expected ';' before '<' token
   22 |     for(ll i=2,i<n;i++) gcd0=gcd(gcd0,a[i]);
      |                 ^
      |                 ;
a.cc:22:17: error: expected primary-expression before '<' token
Language: C++

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

ll gcd(ll m, ll n) {//最大公約数
    if (n == 0)return m;
    return gcd(n, m % n);
}//gcd


template <typename T>
class SegmentTree
{
private:
  using Fn = function<T(T, T)>;
  int N;
  vector<T> dat;
  T unit;
  Fn func;

public:
  SegmentTree() {}
  SegmentTree(int n_, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    while (N < n_)
      N *= 2;
    dat.assign(2 * N - 1, unit);
  }
  SegmentTree(const vector<T> &v, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    int sz = v.size();
    while (N < sz)
      N *= 2;
    dat.resize(2 * N - 1);
    for (int i = 0; i < N; ++i)
      dat[i + N - 1] = (i < sz ? v[i] : unit);
    for (int i = N - 2; i >= 0; --i)
      dat[i] = func(dat[i * 2 + 1], dat[i * 2 + 2]);
  }

  // k 番目の要素を a に変更
  void update(int k, T a)
  {
    k += N - 1;
    dat[k] = a;
    while (k > 0)
    {
      k = (k - 1) / 2;
      dat[k] = func(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }

  // k 番目の要素を取得
  T get(int k) { return dat[k + N - 1]; }

  // 区間 [l, r) の和を取得
  T query(int l, int r)
  {
    T vl = unit, vr = unit;
    for (l += (N - 1), r += (N - 1); l < r; l >>= 1, r >>= 1)
    {
      if ((l & 1) == 0)
        vl = func(vl, dat[l]);
      if ((r & 1) == 0)
        vr = func(vr, dat[--r]);
    }
    return func(vl, vr);
  }
};
int main(){
    ll n;
    cin >> n;
    auto c=[](ll a, ll b) { return gcd(a, b); };
    SegmentTree<ll> sg(n,c,0);
   rep(i,n) {
        ll x;
        cin>>x;
        sg.update(i,x);
    }
    ll ans=0;
    rep(i,n){
        ll kotae=gcd(sg.query(0, i), sg.query(i, n));
        if(ans>kotae){
          ans=kotae;
          return true;
        }
      return false
    }
}
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:19: error: expected ';' before '}' token
   90 |       return false
      |                   ^
      |                   ;
   91 |     }
      |     ~              
a.cc: At global scope:
a.cc:93:5: error: 'cout' does not name a type
   93 |     cout<<ans<<endl;
      |     ^~~~
a.cc:94:1: error: expected declaration before '}' token
   94 | }
      | ^
Language: C++

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

ll gcd(ll m, ll n) {//最大公約数
    if (n == 0)return m;
    return gcd(n, m % n);
}//gcd


template <typename T>
class SegmentTree
{
private:
  using Fn = function<T(T, T)>;
  int N;
  vector<T> dat;
  T unit;
  Fn func;

public:
  SegmentTree() {}
  SegmentTree(int n_, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    while (N < n_)
      N *= 2;
    dat.assign(2 * N - 1, unit);
  }
  SegmentTree(const vector<T> &v, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    int sz = v.size();
    while (N < sz)
      N *= 2;
    dat.resize(2 * N - 1);
    for (int i = 0; i < N; ++i)
      dat[i + N - 1] = (i < sz ? v[i] : unit);
    for (int i = N - 2; i >= 0; --i)
      dat[i] = func(dat[i * 2 + 1], dat[i * 2 + 2]);
  }

  // k 番目の要素を a に変更
  void update(int k, T a)
  {
    k += N - 1;
    dat[k] = a;
    while (k > 0)
    {
      k = (k - 1) / 2;
      dat[k] = func(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }

  // k 番目の要素を取得
  T get(int k) { return dat[k + N - 1]; }

  // 区間 [l, r) の和を取得
  T query(int l, int r)
  {
    T vl = unit, vr = unit;
    for (l += (N - 1), r += (N - 1); l < r; l >>= 1, r >>= 1)
    {
      if ((l & 1) == 0)
        vl = func(vl, dat[l]);
      if ((r & 1) == 0)
        vr = func(vr, dat[--r]);
    }
    return func(vl, vr);
  }
};
int main(){
    ll n;
    cin >> n;
    auto c=[](ll a, ll b) { return gcd(a, b); };
    SegmentTree<ll> sg(n,c,0);
   rep(i,n) {
        ll x;
        cin>>x;
        sg.update(i,x);
    }
    ll ans=0;
    rep(i,n){
        ll kotae=gcd(sg.query(0, i), sg.query(i, n));
        if(ans>kotae){
          ans=kotae;
          return true;
        }
      return false
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:19: error: expected ';' before '}' token
   90 |       return false
      |                   ^
      |                   ;
   91 |     }
      |     ~
Language: C++

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;
template <typename T>
T GCD(T x, T y)
{
    if (x < y)
    {
        const ll a = x;
        x = y;
        y = a;
    }
    ll b = 100000;
    while (b)
    {
        b = x % y;
        x = y;
        y = b;
    }
    return x;
}

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n;
cin >> n;
vector<ll> nums(n);
vector<ll> evens,odds;
rep(i,n){
    cin >> nums[i];
    if(nums[i] % 2){
        odds.emplace_back(nums[i]);
    }else{
        evens.emplace_back(nums[i]);
    }
}
sort(evens.rbegin(),evens.rend());
sort(odds.rbegin(),odds.rend());
if(evens.size() == 1){
    ll ans = odds[0];
    rep(i,odds.size())
    ans = GCD<ll>(odds[i],ans);
    cout << ans << endl;
    return 0;
}
else if(odds.size() == 1){
    ll ans = evens[0];
    rep(i,evens.size())
    ans = GCD<ll>(evens[i],ans);
    cout << ans << endl;
    return 0;
}
else{
    sort(nums.rbegin(),nums.rend());
    for(ll i = 0; i < n; i++){
        ll ans = nums[0];
        for(ll i = 0; i < n; i++){
            ans = GCD<ll>(ans,nums[i]);
        }
        cout << ans << endl;
    }
}

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

#include<stdio.h>
int main(){
   int n,cnt,min,min2;
  scanf("%d",&n);
  int a[n];
  for(int i = 0;i < n;i++){
    scanf("%d",&a[i]);
  }
  min = a[0];
  min2 = a[1];
  for(int i = 1;i<n;i++){
     if(min > a[i]){
       min2 = max;
       min = a[i];
     } 
    if(min < a[i] && min2 > a[i]){
      min2 = a[i];
    }
  }

  while(min2 > 0){
    cnt = 0;
    for(int i = 0;i < n;i++){
      if(a[i]%min2 != 0){
        cnt++;
      }
    }
    if(cnt <= 1){
      printf("%d\n",min2);
      min2 = 0;
    }
    min2 --;
  }
}


Compiler output:
main.c: In function 'main':
main.c:13:15: error: 'max' undeclared (first use in this function)
   13 |        min2 = max;
      |               ^~~
main.c:13:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
  int n,cnt,tmp;
  scanf("%d",&n);
  int a[n];
  for(int i = 0;i < n;i++){
    scanf("%d",&a[i]);
  }
  int flag = 0;
  while(flag != 1){
    cnt = 0;
    for(int i = n;i > 0;i--){
      if(a[i]%i != 0){
        cnt ++;
        tmp = i;
      }
    }
    if(cnt > 1){
      flag = 1;
      printf("%d",temp);
    }
  }
}

    
    


Compiler output:
main.c: In function 'main':
main.c:20:19: error: 'temp' undeclared (first use in this function); did you mean 'tmp'?
   20 |       printf("%d",temp);
      |                   ^~~~
      |                   tmp
main.c:20:19: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
  int n,cnt;
  scanf("%d",&n);
  int a[n];
  for(int i = 0;i < n;i++){
    scanf("%d",&a[i]);
  }
  int flag = 0;
  while(flag != 1){
    cnt = 0;
    for(int i = n;i > 0;i--){
      if(a[i]%i != 0){
        cnt ++;
      }
    }
    if(cnt > 1){
      flag = 1;
      printf("%d",i);
    }
  }
}

    
    


Compiler output:
main.c: In function 'main':
main.c:19:19: error: 'i' undeclared (first use in this function)
   19 |       printf("%d",i);
      |                   ^
main.c:19:19: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
  int n,cnt;
  scanf("%d",&n);
  int a[n];
  for(int i = 0;i < n;i++){
    scanf("%d",&a[i]);
  }
  cnt = 3;
  while(cnt > 1)
  for(int i = n;i > 0;i--){
    if(a[i]%i != 0){
      cnt ++;
    }
  }
  if(cnt > 1){
    printf("%d",i);
  }
}
    
    

Compiler output:
main.c: In function 'main':
main.c:17:17: error: 'i' undeclared (first use in this function)
   17 |     printf("%d",i);
      |                 ^
main.c:17:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int gcd(int x,int y){
  int r;
  while(x){
    r=b%a;
    b=a;
    a=r;
  }
  return b;
}
  
int main(){
  int n;
  scanf("%d\n",&n);
  int a[n];
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  int g=a[0],max=0;
  for(int i=1;i<n;i++){
    g=gcd(g,a[i]);
    if(max < a[0]){
      max = a[0];
    }
  }
  int cnt;
  int r;
  for(int i=1;i<max;i++){
    cnt=0;
    g=g+i;
    for(int j=0;j<n;j++){
    	if(a[j]%g == 0){
          	cnt++;
        }
    }
    if(cnt == n-1){
       r=g;
    }
  }
  printf("%d\n",r);
}

Compiler output:
main.c: In function 'gcd':
main.c:6:7: error: 'b' undeclared (first use in this function)
    6 |     r=b%a;
      |       ^
main.c:6:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:9: error: 'a' undeclared (first use in this function)
    6 |     r=b%a;
      |         ^
Language: C

#include<stdio.h>
int gcd(int x,int y){
  int r;
  while(x){
    r=b&a;
    b=a;
    a=r;
  }
  return b;
}
  
int main(){
  int n;
  scanf("%d",&n);
  int a[n];
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  int g=a[0],max=0;
  for(int i=1;i<n;i++){
    g=gcd(g,a[i]);
    if(max < a[0]){
      max = a[0];
    }
  }
  int cnt;
  int r;
  for(int i=1;i<max;i++){
    cnt=0;
    g=g+i;
    for(int j=0;j<max;j++){
    	if(a[j]%g == 0){
          	cnt++;
        }
    }
    if(cnt == n-1){
       r=g;
    }
  }
  printf("%d\n",r);
}

Compiler output:
main.c: In function 'gcd':
main.c:5:7: error: 'b' undeclared (first use in this function)
    5 |     r=b&a;
      |       ^
main.c:5:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:9: error: 'a' undeclared (first use in this function)
    5 |     r=b&a;
      |         ^
Language: C

#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int a[n];
  for(int i=0;i<n;i++){
    scanf("%d",a[i]);
  }
  int g=a[0],max=0;
  for(int i=1;i<n;i++){
    g=gcd(g,a[i]);
    if(max < a[0]){
      max = a[0];
    }
  }
  int cnt;
  int r;
  for(int i=1;i<max;i++){
    cnt=0;
    g=g+i;
    for(int j=0;j<max;j++){
    	if(a[j]%g == 0){
          	cnt++;
        }
    }
    if(cnt == n-1){
       r=g;
    }
  }
  printf("%d\n",r);
}

Compiler output:
main.c: In function 'main':
main.c:11:7: error: implicit declaration of function 'gcd' [-Wimplicit-function-declaration]
   11 |     g=gcd(g,a[i]);
      |       ^~~
Language: C

#include<stdio.h>
int main(){
  int n;
  scanf("%d",%n);
  int a[i];
  for(int i=0;i<n;i++){
    scanf("%d",a[i]);
  }
  int g=a[0],max=0;
  for(int i=1;i<n;i++){
    g=gcd(g,a[i]);
    if(max < a[0]){
      max = a[0];
    }
  }
  int cnt;
  int r;
  for(int i=1;i<max;i++){
    cnt=0;
    g=g+i;
    for(int j=0;j<max;j++){
    	if(a[j]%g == 0){
          	cnt++;
        }
    }
    if(cnt == n-1){
       r=g;
    }
  }
  printf("%d\n",r);
}
  

Compiler output:
main.c: In function 'main':
main.c:4:14: error: expected expression before '%' token
    4 |   scanf("%d",%n);
      |              ^
main.c:5:9: error: 'i' undeclared (first use in this function)
    5 |   int a[i];
      |         ^
main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:7: error: implicit declaration of function 'gcd' [-Wimplicit-function-declaration]
   11 |     g=gcd(g,a[i]);
      |       ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, n) for(int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define riverse(v) reverse((v).begin(), (v).end())
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vll = vector<ll>;
const ll MOD = 1e9+7;
vi alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m',
               'n','o','p','q','r','s','t','u','v','w','x','y','z'};

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


int main() {
	ll N;
  	cin >> N;
  	vll a(N+1);
  	repp(i,N)cin>>a[i];
  	vll L(N+1);
  	L[0]=0;
  	vll R(N+2);
  	R[N+2]=0;
  	vll ans(N+1);
  	rep(i,N){
    	L[i+1]=gcd(A[i],L[i]);
    }
  	for(int i=N+1;i>=1;i--){
    	R[i]=gcd(R[i+1],A[i])
    }
  	repp(i,N){
    	ans[i]=gcd(L[i],R[i+1]);
    }
  	sort(ans);
  	riverse(ans);
  	cout << ans[0] << endl;
}

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

#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

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

  ll n;
  vector < ll > a(n + 1), lt(n + 1), rt(n + 1);
  for(int i = 1; i <= n; i++) cin >> a[i];
  lt[1] = a[i];
  rt[n] = a[n];
  for(int i = 2; i <= n; i++) lt[i] = __gcd(a[i], lt[i - 1]);
  for(int i = n - 1; i > 0; i--) rt[i] = __gcd(a[i], rt[i + 1]);
  
  ll ans = max(rt[2], lt[n - 1]);
  for(int i = 1; i < n; i++){
    ans = max(ans, __gcd(lt[i - 1], rt[i + 1]));
  }
  
  cout << ans << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'i' was not declared in this scope
   14 |   lt[1] = a[i];
      |             ^
Language: Java

import java.util.*;
public class Main {
    public static long gcd(long x,long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static long lcm(long x,long y){                                                              
        return x*y/gcd(x,y);                                                                                                                                                                                                                
    }
    public static long fac(long x){
        if(x==0) return 1;
        return x*fac(x-1);
    }
    public static long per(long x,long y){
        return fac(x)/fac(x-y);      
    }
    public static long com(long x,long y){
        return per(x,y)/fac(y);      
    }
    public static long com2(long x,long y){
        if(y==0 || y==x) return 1;
        if(x < y) return 0;
        return com2(x-1,y-1)+com2(x-1,y);
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();       
		long [] in = new long [a]; 
        long [] l = new long [a+1];
        long [] r = new long [a+1];
        long [] ans = new long [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }
		l[0]= 0;
        r[a]= 0;
        for(int i=1;i<=a;i++){l[i]=gcd(l[i-1],a[i]);}
        for(int i=a-1;i>=0;i--){r[i]=gcd(r[i+1],a[i]);}
        for(int i=0;i<a;i++){ans[i]=gcd(l[i],r[i+1]);}
        long b = 0;
        for(int i=0;i<a;i++){b=Math.max(b,ans[i]);                                              
                            }       
		System.out.println(b);
	}
}


Compiler output:
Main.java:38: error: array required, but int found
        for(int i=1;i<=a;i++){l[i]=gcd(l[i-1],a[i]);}
                                               ^
Main.java:39: error: array required, but int found
        for(int i=a-1;i>=0;i--){r[i]=gcd(r[i+1],a[i]);}
                                                 ^
2 errors
Language: Java

import java.util.*;
public class Main {
    public static long gcd(long x,long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static long lcm(long x,long y){                                                              
        return x*y/gcd(x,y);                                                                                                                                                                                                                
    }
    public static long fac(long x){
        if(x==0) return 1;
        return x*fac(x-1);
    }
    public static long per(long x,long y){
        return fac(x)/fac(x-y);      
    }
    public static long com(long x,long y){
        return per(x,y)/fac(y);      
    }
    public static long com2(long x,long y){
        if(y==0 || y==x) return 1;
        if(x < y) return 0;
        return com2(x-1,y-1)+com2(x-1,y);
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();       
		long [] in = new long [a]; 
        long [] l = new long [a+1];
        long [] r = new long [a+1];
        long [] ans = new long [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }
		l[0]= 0;
        r[a]= 0;
        for(int i=1;i<=a;i++){l[i]=gcd(l[i-1],a[i]);}
        for(int i=a-1;i>=0;i--){r[i]=gcd(r[i+1],a[i]);}
        for(int i=0;i<a;i++){ans[i]=gcd(l[i],r[i+1])}
        long b = 0;
        for(int i=0;i<a;i++){b=Math.max(b,ans[i]);                                              
                            }       
		System.out.println(b);
	}
}

Compiler output:
Main.java:40: error: ';' expected
        for(int i=0;i<a;i++){ans[i]=gcd(l[i],r[i+1])}
                                                    ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using Graph = vector<vector<LL>>;

long long gcd(long long a, long long b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
long long chmax(long long a,long long b){
  a = max(a,b);
}
long long chmin(long long a, long long b){
  a = min(a,b);
}
vector<bool> seen;
void dfs(const Graph &G, int v) {
    seen[v] = true;

    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue;
        dfs(G, next_v);
    }
}



int main() {
  LL n,k=-1,sum=0,a=0,b=0,c=0,d=0,ans=0;
  LL MOD = 1000000007;
  LL INF = 1LL << 60;
  LL h[1000001];
  string S="",T="",U="";
  cin >> n;
  cin >> h[0];
  a = h[0];
  for(LL i=1;i<n;i++){
    cin >> h[i];
    a = gcd(a,h[i-1]);
    ans = chamx(ans,a);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'long long int chmax(long long int, long long int)':
a.cc:12:1: warning: no return statement in function returning non-void [-Wreturn-type]
   12 | }
      | ^
a.cc: In function 'long long int chmin(long long int, long long int)':
a.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
   15 | }
      | ^
a.cc: In function 'int main()':
a.cc:40:11: error: 'chamx' was not declared in this scope; did you mean 'chmax'?
   40 |     ans = chamx(ans,a);
      |           ^~~~~
      |           chmax
Language: C++

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using Graph = vector<vector<LL>>;

long long gcd(long long a, long long b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
long long chmax(long long a,long long b){
  a = max(a,b);
}
long long chmin(long long a, long long b){
  a = min(a,b);
}
vector<bool> seen;
void dfs(const Graph &G, int v) {
    seen[v] = true;

    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue;
        dfs(G, next_v);
    }
}



int main() {
  LL n,k=-1,sum=0,a=0,b=0,c=0,d=0,ans=0;
  LL MOD = 1000000007;
  LL INF = 1LL << 60;
  LL h[1000001];
  string S="",T="",U="";
  cin >> n;
  cin >> h[0];
  a = h[0];
  for(LL i=1,i<n;i++){
    cin >> h[i];
    a = gcd(a,h[i-1]);
    ans = chamx(ans,a);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'long long int chmax(long long int, long long int)':
a.cc:12:1: warning: no return statement in function returning non-void [-Wreturn-type]
   12 | }
      | ^
a.cc: In function 'long long int chmin(long long int, long long int)':
a.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
   15 | }
      | ^
a.cc: In function 'int main()':
a.cc:37:15: error: expected ';' before '<' token
   37 |   for(LL i=1,i<n;i++){
      |               ^
      |               ;
a.cc:37:15: error: expected primary-expression before '<' token
a.cc:40:11: error: 'chamx' was not declared in this scope; did you mean 'chmax'?
   40 |     ans = chamx(ans,a);
      |           ^~~~~
      |           chmax
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

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

int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i,n){
    cin >> a[i];
  }
  ll ans=0;
  vl LG(n),RG(n);
  LG[0]=a[0];
  RG[n-1]=a[n-1];
  FOR(i,1,n-2){
    LG[i]=gcd(LG[i-1],a[i]);
    RG[n-1-i]=gcd(a[n-1-i],RG[n-i]);
  }
  rep(i,n){
    if(i==0){
      ans=max(ans,RG[1]);
    }
    else if(i==n-1){
      ans=max(ans,LG[n-2]);
    }
    else{
      ll z=GCD(LG[i-1],RG[i+1]);
      ans=max(ans,z);
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:12: error: 'GCD' was not declared in this scope
   48 |       ll z=GCD(LG[i-1],RG[i+1]);
      |            ^~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define lb long double
#define vec vector<int>
#define vec2 vector<vector<int>>
#define set setprecision
#define mod 1000000007
#define pi 3.14159265
#include<numeric>
using namespace std;
int gcd(int a, int b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
int lcm(int a, int b)
{
	return a * b / gcd(a, b);
}
ll pow(ll a, ll b) {
	ll k = b % 30000, h = b / 30000, s = 1;
	rip(i, 30000)s = (s * a) % mod; ll j = 1;
	if (h != 0)rip(i, h)j = j * s % mod;
	if (k != 0)rip(i, k)j = j * a % mod;
	return(j);
}
int main() {
	int n;
	cin >> n;
	else {
		vec a(n);
		rip(i, n)cin >> a[i];
		int p[100009], r[100009];
		int l = a[0];//subetenosaidaikouyakusuu
		rip(i, n) {
			l = gcd(l, a[i]);
			p[i] = l;
		}
		int k = a[n - 1];
		rip(i, n) {
			int j = n - 1 - i;
			k = gcd(k, a[j]);
			r[j] = k;
		}
		p[-1] = l;
		r[n] = l;
		int maxx = 0;
		rip(i, n) {
			maxx = max(maxx, gcd(p[i - 1], r[i + 1]));
		}
		cout << maxx << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: 'else' without a previous 'if'
   37 |         else {
      |         ^~~~
Language: C++

#include <cstring>
#include <bits/stdc++.h>
using namespace std;
int main(){
long long counter1,counter2;
counter1=0;
counter2=0;
long long counter3=0;
long long N;
cin>>N;
vector<long long>a(N);
vector<long long>b(N+1);
vector<long long>c(N+1);
vector<long long>d(N);
b.at(0)=0;c.at(N-1)=0;
for (int i=0;i<N;i++){
cin>>a.at(i);}
for (int i=0;i<N;i++){
b.at(i+1)=GCD(b.at(i),a.at(i));}
for (int i=N-1;i>=0;i--){
c.at(i)=GCD(c.at(i+1),a.at(i));}

for (int i=0;i<N;i++){
counter1=max(GCD(b.at(i),c.at(i+1)),counter1);
cout<<counter1<<endl;}}




Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: 'GCD' was not declared in this scope
   19 | b.at(i+1)=GCD(b.at(i),a.at(i));}
      |           ^~~
a.cc:21:9: error: 'GCD' was not declared in this scope
   21 | c.at(i)=GCD(c.at(i+1),a.at(i));}
      |         ^~~
a.cc:24:14: error: 'GCD' was not declared in this scope
   24 | counter1=max(GCD(b.at(i),c.at(i+1)),counter1);
      |              ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

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 ans = 0;
  for (int i = 0; i < N; i++) {
    int x = gcd(left[i], right[i+1]);
    if (ans > x){
      ans = x;
    }
  }
  cout << ans << endl;
}

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

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}

int main(){
  int n;cin >> n;
  vl a(n);
  rep(i,n) cin >> a[i];
  //gcd(それ以外)のmaxが欲しい
  vl l(n);
  vl r(n);
  l[0]=a[0];
  rep2(i,1,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]);
  
  ll M=0;
  M=max(r[1],r[n-2]);
  rep2(i,1,n-1)M=max(M,__gcd(l[i-1],r[i+1]));
  cout << M << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:20: error: '___gcd' was not declared in this scope
   28 |   rep2(i,1,n) l[i]=___gcd(l[i-1],a[i]);
      |                    ^~~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int calc_gcd(int a, int b);
int calc_gcd_list(vector<int> A, int pass_index);

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

    int max_gcd = 0;

    for(int i=0;i<A.size();i++){
        int gcd = calc_gcd_list(A, i, max_gcd);
        if(max_gcd < gcd)max_gcd = gcd;
    }

    cout << max_gcd << endl;
}

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

int calc_gcd_list(vector<int> A, int pass_index, int max_gcd){
    int gcd = (pass_index!=0)?A.at(0):A.at(1);
    for(int i=0;i<A.size()-1;i++){
        if(i==pass_index)continue;
        if((i==A.size()-2)&&(pass_index==A.size()-1))break;
        int comp = (i+1!=pass_index)?A.at(i+1):A.at(i+2);
        gcd = calc_gcd(gcd, comp);
        if(gcd <= max_gcd)break;
    }
    return gcd;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:32: error: too many arguments to function 'int calc_gcd_list(std::vector<int>, int)'
   18 |         int gcd = calc_gcd_list(A, i, max_gcd);
      |                   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
a.cc:7:5: note: declared here
    7 | int calc_gcd_list(vector<int> A, int pass_index);
      |     ^~~~~~~~~~~~~