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

#include<iostream>
#include<vector>

using std::cin;
using std::cout;
using std::endl;

template<class T,class F>
struct segment_tree{
  std::vector<T> data;
  int n;
  F f;
  T identity;
  segment_tree(){}
  segment_tree(int sz,T ide,F _f):f(_f),identity(ide){
    n = 1;while(n<sz)n<<=1;
    data.resize(2*n,identity);
  }
  segment_tree(std::vector<T> const& v,T ide,F _f):f(_f),identity(ide){
    build(v);
  }
  void build(std::vector<T> const& v){
    int sz = v.size();
    n = 1;while(n<sz)n<<=1;
    data.resize(2*n,identity);
    for(int i=0;i<sz;++i)data[i+n]=v[i];
    for(int i=n-1;i>0;--i)data[i]=f(data[i<<1|0],data[i<<1|1]
  }
  void set(int i,T x){
    i += n;
    data[i] = x;
    while(i&&i>>=1)data[i] = f(data[i<<1|0],data[i<<1|1]);
  }
  T query(int l,int r)const{
    l += n, r += n;
    T x = identity;
    while(l<r){
      if(l&1)x = f(x,data[l++]);
      if(r&1)x = f(x,data[--r]);
      l>>=1, r>>=1;
    }
    return x;
  }
  T operator[](int i)const{
    return data[i+n];
  }
};
template<class T,class F>
auto make_segtree(int n,T ide,F f){
  return segment_tree<T,F>(n,ide,f);
}
template<class T,class F>
auto make_segtree(std::vector<T>const& v,T ide,F f){
  return segment_tree<T,F>(v,ide,f);
}

signed main(){
  int n;
  cin>>n;
  std::vector<int64_t> a(n);
  for(auto& ai:a)cin>>ai;
  auto gcd = [](auto a,auto b){
    while(1){
      if(a==0)return b;
      if(b==0)return a;
      a %= b;
      std::swap(a,b);
    }
  };
  auto seg = make_segtree<int64_t>(a,0,gcd);
  int64_t ans = 1;
  for(int i=0;i<n;++i){
    seg.set(i,a[i]);
    ans = std::max(ans,seg.query(0,n));
    seg.set(i,a[i]);
  }
  cout<<(ans)<<endl;
}

Compiler output:
a.cc:78:2: error: expected '}' at end of input
   78 | }
      |  ^
a.cc:9:20: note: to match this '{'
    9 | struct segment_tree{
      |                    ^
a.cc: In member function 'void segment_tree<T, F>::build(const std::vector<T>&)':
a.cc:28:3: error: expected ')' before '}' token
   28 |   }
      |   ^
a.cc:27:36: note: to match this '('
   27 |     for(int i=n-1;i>0;--i)data[i]=f(data[i<<1|0],data[i<<1|1]
      |                                    ^
a.cc: At global scope:
a.cc:78:2: error: expected ';' at end of input
   78 | }
      |  ^
      |  ;
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:
a.cc:1:21: warning: extra tokens at end of #include directive
    1 | #include <iostream> #include <algorithm> #include <string>
      |                     ^
a.cc: In function 'int main()':
a.cc:22:4: error: 'reverse' was not declared in this scope
   22 |    reverse(a,a+N);
      |    ^~~~~~~
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

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

struct segtree{
  int n;
  vector<ll> dat;
  segtree(int n_){
    init(n_);
  }
  void init(int n_){
    n=1;
    while(n<n_) n*=2;
    dat.resize(2*n-1);
    for(int i=0;i<2*n-1;i++) dat[i]=0;
  }
  void update(int k,ll a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=gcd(dat[k*2+1],dat[k*2+2]);
    }
  }
  ll get(int a,int b,int k=0,int l=0,int r=-1){
    if(r<0) r=n;
    if(r<=a||b<=l){
      cout << "r:"<<r<<"a:"<<a<<"b:"<<b<<"l:"<<l << endl;
      return 1;
    }
    if(a<=l&&r<=b) return dat[k];
    else{
      ll vl=get(a,b,k*2+1,l,(l+r)/2);
      ll vr=get(a,b,k*2+2,(l+r)/2,r);
      return (vl,vr);
    }
  }
};

int main(){
  int n; cin >> n;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  segtree st(n);
  rep(i,n){
    st.update(i,a[i]);
  }
  ll ans=-1;
  rep(i,n){
    if(i+1<n) st.update(i,a[i+1]);
    else st.update(i,a[i-1]);
    chmax(ans,st.dat[0]);
    st.update(i,a[i]);
  }
  cout << ans << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n,j) for (int i = n; j<=i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
const int INF = 1e9;
typedef pair<ll,ll> P;

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

int main(){
  ll N,ans;cin>>N;
  vector<ll> vec(N),L(N),R(N);
  REP(i,0,N){cin>>vec[i];}
  L[0]=vec[0];R[N-1]=vec[N-1];
  REP(i,0,N-1){L[i+1]=gcd(L[i],vec[i+1]);}
  RREP(i,N-1,1){R[i-1]=gcd(R[i],vec[i-1]);}
  ans=max(R[1],L[N2]);
  REP(i,1,N-1){ans=max(ans,gcd(L[i-1],R[i+1]));}
  print(ans)
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: 'N2' was not declared in this scope; did you mean 'N'?
   28 |   ans=max(R[1],L[N2]);
      |                  ^~
      |                  N
Language: C++

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

const int size = 1e5+10
int gcdleft[size], gcdright[size], a[size];

int main() {
	int n, result=0;
	cin >> n;
	// int a[n+1], gcdleft[n+1], gcdright[n+2];
	for(int i = 1; i<n+1; i++){
		cin >> a[i];
		gcdleft[i] = __gcd(a[i], gcdleft[i-1]);
	}

	for(int i = n; i>-1; i--){
		gcdright[i] = __gcd(a[i], gcdright[i+1]);
	}

	for(int i = 1; i<n; i++){
		result = max(result, __gcd(gcdleft[i-1], gcdright[i+1]));
	}
	cout << result << '\n';		
}


Compiler output:
a.cc:5:1: error: expected ',' or ';' before 'int'
    5 | int gcdleft[size], gcdright[size], a[size];
      | ^~~
a.cc: In function 'int main()':
a.cc:12:24: error: 'a' was not declared in this scope
   12 |                 cin >> a[i];
      |                        ^
a.cc:13:17: error: 'gcdleft' was not declared in this scope
   13 |                 gcdleft[i] = __gcd(a[i], gcdleft[i-1]);
      |                 ^~~~~~~
a.cc:17:17: error: 'gcdright' was not declared in this scope
   17 |                 gcdright[i] = __gcd(a[i], gcdright[i+1]);
      |                 ^~~~~~~~
a.cc:17:37: error: 'a' was not declared in this scope
   17 |                 gcdright[i] = __gcd(a[i], gcdright[i+1]);
      |                                     ^
a.cc:21:44: error: 'gcdleft' was not declared in this scope
   21 |                 result = max(result, __gcd(gcdleft[i-1], gcdright[i+1]));
      |                                            ^~~~~~~
a.cc:21:58: error: 'gcdright' was not declared in this scope
   21 |                 result = max(result, __gcd(gcdleft[i-1], gcdright[i+1]));
      |                                                          ^~~~~~~~
Language: C++

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

int size = 1e5+10
int gcdleft[size], gcdright[size], a[size];

int main() {
	int n, result=0;
	cin >> n;
	// int a[n+1], gcdleft[n+1], gcdright[n+2];
	for(int i = 1; i<n+1; i++){
		cin >> a[i];
		gcdleft[i] = __gcd(a[i], gcdleft[i-1]);
	}

	for(int i = n; i>-1; i--){
		gcdright[i] = __gcd(a[i], gcdright[i+1]);
	}

	for(int i = 1; i<n; i++){
		result = max(result, __gcd(gcdleft[i-1], gcdright[i+1]));
	}
	cout << result << '\n';		
}

Compiler output:
a.cc:5:1: error: expected ',' or ';' before 'int'
    5 | int gcdleft[size], gcdright[size], a[size];
      | ^~~
a.cc: In function 'int main()':
a.cc:12:24: error: 'a' was not declared in this scope
   12 |                 cin >> a[i];
      |                        ^
a.cc:13:17: error: 'gcdleft' was not declared in this scope
   13 |                 gcdleft[i] = __gcd(a[i], gcdleft[i-1]);
      |                 ^~~~~~~
a.cc:17:17: error: 'gcdright' was not declared in this scope
   17 |                 gcdright[i] = __gcd(a[i], gcdright[i+1]);
      |                 ^~~~~~~~
a.cc:17:37: error: 'a' was not declared in this scope
   17 |                 gcdright[i] = __gcd(a[i], gcdright[i+1]);
      |                                     ^
a.cc:21:44: error: 'gcdleft' was not declared in this scope
   21 |                 result = max(result, __gcd(gcdleft[i-1], gcdright[i+1]));
      |                                            ^~~~~~~
a.cc:21:58: error: 'gcdright' was not declared in this scope
   21 |                 result = max(result, __gcd(gcdleft[i-1], gcdright[i+1]));
      |                                                          ^~~~~~~~
Language: C++

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

int gcdleft[1e5+10], gcdright[1e5+10], a[1e5+10];

int main() {
	int n, result=0;
	cin >> n;
	// int a[n+1], gcdleft[n+1], gcdright[n+2];
	for(int i = 1; i<n+1; i++){
		cin >> a[i];
		gcdleft[i] = __gcd(a[i], gcdleft[i-1]);
	}

	for(int i = n; i>-1; i--){
		gcdright[i] = __gcd(a[i], gcdright[i+1]);
	}

	for(int i = 1; i<n; i++){
		result = max(result, __gcd(gcdleft[i-1], gcdright[i+1]));
	}
	cout << result << '\n';		
}

Compiler output:
a.cc:4:16: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    4 | int gcdleft[1e5+10], gcdright[1e5+10], a[1e5+10];
      |             ~~~^~~
a.cc:4:16: error: could not convert '(1.0e+5 + (double)10)' from 'double' to 'long unsigned int'
    4 | int gcdleft[1e5+10], gcdright[1e5+10], a[1e5+10];
      |             ~~~^~~
      |                |
      |                double
a.cc:4:16: error: size of array 'gcdleft' has non-integral type 'double'
a.cc:4:34: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    4 | int gcdleft[1e5+10], gcdright[1e5+10], a[1e5+10];
      |                               ~~~^~~
a.cc:4:34: error: could not convert '(1.0e+5 + (double)10)' from 'double' to 'long unsigned int'
    4 | int gcdleft[1e5+10], gcdright[1e5+10], a[1e5+10];
      |                               ~~~^~~
      |                                  |
      |                                  double
a.cc:4:34: error: size of array 'gcdright' has non-integral type 'double'
a.cc:4:45: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    4 | int gcdleft[1e5+10], gcdright[1e5+10], a[1e5+10];
      |                                          ~~~^~~
a.cc:4:45: error: could not convert '(1.0e+5 + (double)10)' from 'double' to 'long unsigned int'
    4 | int gcdleft[1e5+10], gcdright[1e5+10], a[1e5+10];
      |                                          ~~~^~~
      |                                             |
      |                                             double
a.cc:4:45: error: size of array 'a' has non-integral type 'double'
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int nmax = 1e5 + 5;

int pref[nmax], suff[nmax];

int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> v[i];
	pref[1] = v[1];
	for (int i = 2; i <= n; i++)
		pref[i] = __gcd(pref[i - 1], v[i]);
	suff[n] = v[n];
	for (int i = n - 1; i >= 1; i--)
		suff[i] = __gcd(suff[i + 1], v[i]);
	int mx = pref[n-1];
	for (int i = 1; i <= n - 2; i++)
		mx = max(mx, __gcd(pref[i], suff[i + 2]));
	mx = max(mx, suff[2]);
  	cout<<mx;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: 'v' was not declared in this scope
   14 |                 cin >> v[i];
      |                        ^
a.cc:15:19: error: 'v' was not declared in this scope
   15 |         pref[1] = v[1];
      |                   ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int nmax = 1e5 + 5;

int pref[nmax], suff[nmax];

int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> v[i];
	pref[1] = v[1];
	for (int i = 2; i <= n; i++)
		pref[i] = __gcd(pref[i - 1], v[i]);
	suff[n] = v[n];
	for (int i = n - 1; i >= 1; i--)
		suff[i] = __gcd(suff[i + 1], v[i]);
	int mx = pref[n-1];
	for (int i = 1; i <= n - 2; i++)
		mx = max(mx, __gcd(pref[i], suff[i + 2]));
	mx = max(mx, suff[2]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: 'v' was not declared in this scope
   14 |                 cin >> v[i];
      |                        ^
a.cc:15:19: error: 'v' was not declared in this scope
   15 |         pref[1] = v[1];
      |                   ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long ll;

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

bool is_prime(ll n) {
    ll k = pow(n, 0.5) + 1;
    for (ll i = 2; i < k; i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

ll total_gcd(vector<ll> A) {
    ll ans = A[0];
    for (ll a : A) {
        ans = gcd(ans, a);
    }
    return ans;
}

ll main() {
    ll N;
    cin >> N;
    ll prime_index = -1;
    ll prime_count = 0;
    vector<ll> A = vector<ll>();
    for (ll i = 0; i < N; i++) {
        ll a;
        cin >> a;
        A.emplace_back(a);
        if (is_prime(a)) {
            prime_count += 1;
            prime_index = i;
        }
    }
    if (prime_count == 0) {
        ll g = total_gcd(A);
        prime_index = -1;
        prime_count = 0;
        for (ll i = 0; i < N; i++) {
            A[i] /= g;
            if (is_prime(A[i])) {
                prime_count += 1;
                prime_index = i;
            }
        }
        if (prime_count != 1) {
            cout << g << endl;
        } else {
            A.erase(A.begin() + prime_index);
            cout << total_gcd(A) * g << endl;
        }
    } else if (prime_count >= 2) {
        cout << 1 << endl;
    } else {
        A.erase(A.begin() + prime_index);
        cout << total_gcd(A) << endl;
    }

    return 0;
}

Compiler output:
a.cc:4:21: error: expected ';' before 'll'
    4 | using ll = long long ll;
      |                     ^~~
      |                     ;
a.cc:6:1: error: 'll' does not name a type
    6 | ll gcd(ll a, ll b) {
      | ^~
a.cc:13:15: error: 'll' was not declared in this scope
   13 | bool is_prime(ll n) {
      |               ^~
a.cc:23:1: error: 'll' does not name a type
   23 | ll total_gcd(vector<ll> A) {
      | ^~
a.cc:31:1: error: 'll' does not name a type
   31 | ll main() {
      | ^~
Language: C

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

int gcd(int n1, int n2) {
	return (n2 == 0) ? n1 : gcd(n2, n1 % n2);
}

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

	if (n == 2) {
		cout << max(a[0], a[1]) << endl;
		return 0;
	}

	int min_gcd = 10e9, all_gcd = gcd(a[0], a[1]);
	int keep = 0;
	for (int i = 2; i < n; i++) {
		all_gcd = gcd(all_gcd, a[i]);
		if (min_gcd > all_gcd) {
			min_gcd = all_gcd;
			keep = i;
		}
	}

	int zero_out = gcd(a[1], a[2]);
	int one_out = gcd(a[0], a[2]);
	for (int i = 3; i < n; i++) {
		zero_out = gcd(zero_out, a[i]);
		one_out = gcd(one_out, a[i]);
	}

	all_gcd = gcd(a[0], a[1]);
	for (int i = 2; i < n; i++) {
		if (i == keep)
			continue;
		all_gcd = gcd(all_gcd, a[i]);
	}

	int ans;
	ans = max(all_gcd, max(zero_out, one_out));

	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<bits/stdc++.h>
#define ford(i,a,b) for(int i=(a);i>=b;i--)
#define rep(i,a,b) for(int i=(a);(i)<=(b);(i)++)
#define ll long long
#define re return
#define mp map<int,int>
#define N 200005
#define pq priority_queue<ll>
using namespace std;
int a[N],l[N],r[N];
int main() {
	int n; int ans=0;
	cin>>n;
	rep(i,1,n)cin>>a[i];
	l[1]=a[1],r[n]=a[n];
	rep(i,2,n) l[i]=__gcd(l[i-1],a[i])
	ford(i,n-1,1) r[i]=__gcd(r[i+1],a[i]);
	rep(i,1,n) 
		ans=max(ans,__gcd(l[i-1],r[i+1]));
	cout<<ans;
	re 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:43: error: expected ';' before 'for'
   16 |         rep(i,2,n) l[i]=__gcd(l[i-1],a[i])
      |                                           ^
      |                                           ;
a.cc:17:14: error: 'i' was not declared in this scope
   17 |         ford(i,n-1,1) r[i]=__gcd(r[i+1],a[i]);
      |              ^
a.cc:2:35: note: in definition of macro 'ford'
    2 | #define ford(i,a,b) for(int i=(a);i>=b;i--)
      |                                   ^
Language: C++

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

using namespace std;

void GCDonBlackboard()
{
  int n;
  cin >> n;
  vector<int> a(n);

  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  

  int max = 0;
  for (int i = 0; i < a.size(); i++)
  {
    for (int j = i+1; j < a.size(); j++)
      if (max < calc_Greatest_common_divisor(a[i], a[j])) max = calc_Greatest_common_divisor(a[i], a[j]);
  }
  cout << max << endl;
  return;
}


int main()
{
  GCDonBlackboard();
}

Compiler output:
a.cc: In function 'void GCDonBlackboard()':
a.cc:24:17: error: 'calc_Greatest_common_divisor' was not declared in this scope
   24 |       if (max < calc_Greatest_common_divisor(a[i], a[j])) max = calc_Greatest_common_divisor(a[i], a[j]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}



template<class T> T gcd(T x, T y) {
	return (y ? gcd(y, x % y) : x);
}
template<class T> class segtree {
    int n = 1;
    vector<T> dat;
    T def = 0; //Default value

public:
    segtree(int _n) {
        while (n < _n)n *= 2;
        dat.resize(2 * n - 1, def);
    }
    segtree(vector<T> a) {
        int _n = a.size();
        while (n < _n)n *= 2;
        dat.resize(2 * n - 1, def);
        rep(i, 0, _n)dat[i + n - 1] = a[i];
        rREP(i, 0, n - 1)dat[i] = fun(dat[2 * i + 1], dat[2 * i + 2]);
    }


    T fun(T x, T y) { 
        if (x == 0 || y == 0)return max(x, y);
        return gcd(x, y); 
    }

    //assignment,chmin,chmax,etc...
    void update(int i, T a) {
        i += n - 1;
        dat[i] = a;
        while (i > 0) {
            --i /= 2;
            dat[i] = fun(dat[2 * i + 1], dat[2 * i + 2]);
        }
    }


    T value(int a, int b, int k, int l, int r) {
        if (b <= l || r <= a)return def;
        if (a <= l && r <= b)return dat[k];
        T s = value(a, b, 2 * k + 1, l, (l + r) / 2);
        T t = value(a, b, 2 * k + 2, (l + r) / 2, r);
        return fun(s, t);
    }
    T value(int a, int b) { return value(a, b, 0, 0, n); }

    T operator[](int k) { return dat[k + n - 1]; }
};

int main() {
	init();

	int N; cin >> N;

    segtree<int> seg(N);
    rep(i, N) {
        int a; cin >> a;
        seg.update(i, a);
    }

    int ans = seg.value(0, N);
    rep(i, N) {
        int a = seg.value(0, i);
        if (i == 0)a = 0;
        int b = seg.value(i + 1, N);
        if (i == N - 1)b = 0;
        chmax(ans, gcd(a, b));
    }
    cout << ans << "\n";


	return 0;
}

Compiler output:
a.cc:53:21: error: macro "rep" passed 3 arguments, but takes just 2
   53 |         rep(i, 0, _n)dat[i + n - 1] = a[i];
      |                     ^
a.cc:6:9: note: macro "rep" defined here
    6 | #define rep(i,n) REP(i,0,n)
      |         ^~~
a.cc: In constructor 'segtree<T>::segtree(std::vector<_Tp>)':
a.cc:53:9: error: 'rep' was not declared in this scope
   53 |         rep(i, 0, _n)dat[i + n - 1] = a[i];
      |         ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1 << 21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:37:7: error: 'i' was not declared in this scope
   37 |     r[i] = 0;
      |       ^
Language: C++

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

int main(){
	int n.cin >> n;
	vector<int> l(n + 5, 0);
	vector<int> r(n + 5, 0);
	vector<int> arr(n + 5, 0);
	int ans = INT_MIN;
	for(int i = 1;i <= n;i++){
		scanf("%d", arr[i]);
		l[i] = __gcd(arr[i], l[i - 1]);
	}
	for(int i = n - 1;i >= 0;i--)r[i] = __gcd(arr[i], r[i + 1];
	for(int i = 1;i < n;i++)ans = max(__gcd(l[i - 1], r[i + 1]), ans);
	cout << ans;
}
// make pair, tuple
// make pair, tuple
// 
// __gcd(int, int);
// lcm = a * b / __gcd(a, b);
// 
// bool isPrime(int n){
//       if(n <= 1)return false;
//       if(n <= 3)return true;
//       if(n % 2 == 0 || n % 3 == 0)return false;
//       for(int i = 5;i * i <= n;i += 6){
//             if(n % i == 0 || n % (i + 2) == 0)return false;
//       }
//       return true;
// }
// int countSubString(string s, string temp){
//       int ans = 0;
//       size_t f = s.find(temp);
//       while(f != string::npos){
//             ans++;
//             f = s.find(temp, f + 1);
//       }
//       return ans;
// }
// 
// #Count leading & trailing zero of an integer bits
// __builtin_clz(n);
// __builtin_clzll(n);
//
// #Count 1s bits of an integer
// __builtin_popcount(n);
// __builtin_popcountll(n);
//
// #Error checking
// assert(n == 3);
// 
// #Error Printing
// cerr << "Some thing";

// #binary exponentiation
// long long binpow(long long a, long long b) {
//     long long res = 1;
//     while (b > 0) {
//         if (b & 1)
//             res = res * a;
//         a = a * a;
//         b >>= 1;
//     }
//     return res;
// }


Compiler output:
a.cc: In function 'int main()':
a.cc:5:14: error: expected initializer before '.' token
    5 |         int n.cin >> n;
      |              ^
a.cc:6:23: error: 'n' was not declared in this scope
    6 |         vector<int> l(n + 5, 0);
      |                       ^
a.cc:14:67: error: expected ')' before ';' token
   14 |         for(int i = n - 1;i >= 0;i--)r[i] = __gcd(arr[i], r[i + 1];
      |                                                  ~                ^
      |                                                                   )
Language: C++

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

int main() {
  int n;
  cin >> n;
  map<int,int>mp;
  vector<int>a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());
  rep(i,2){
    for(int j=1;j*j<=a[i];j++){
      if(a[i]%j==0){
        mp[j]++;
        if(j!=a[i]/j)mp[a[i]/j]++;
      }
    }
  }
  for(int i=2;i<n;i++){
    auto(j:mp){
      if(a[i]%j.first==0){
        mp[j.first]++;
        if(j.first!=a[i]/j.first)mp[a[i]/j.first]++;
      }
    }
  }
  int ans=1;
  for(auto p mp){  
    if(p.second==n || p.second==n-1){
      if(ans<p.first)ans=p.first;
    }
  }
  
  cout << ans << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:11: error: found ':' in nested-name-specifier, expected '::'
   24 |     auto(j:mp){
      |           ^
      |           ::
a.cc:24:10: error: 'j' was not declared in this scope
   24 |     auto(j:mp){
      |          ^
a.cc:24:5: warning: 'auto(x)' only available with '-std=c++2b' or '-std=gnu++2b' [-Wc++23-extensions]
   24 |     auto(j:mp){
      |     ^~~~~~~~~~
a.cc:32:13: error: expected ';' before 'mp'
   32 |   for(auto p mp){
      |             ^~~
      |             ;
a.cc:32:14: error: could not convert 'mp' from 'std::map<int, int>' to 'bool'
   32 |   for(auto p mp){
      |              ^~
      |              |
      |              std::map<int, int>
a.cc:32:16: error: expected ';' before ')' token
   32 |   for(auto p mp){
      |                ^
      |                ;
a.cc:33:8: error: use of 'p' before deduction of 'auto'
   33 |     if(p.second==n || p.second==n-1){
      |        ^
a.cc:33:23: error: use of 'p' before deduction of 'auto'
   33 |     if(p.second==n || p.second==n-1){
      |                       ^
a.cc:34:14: error: use of 'p' before deduction of 'auto'
   34 |       if(ans<p.first)ans=p.first;
      |              ^
a.cc:34:26: error: use of 'p' before deduction of 'auto'
   34 |       if(ans<p.first)ans=p.first;
      |                          ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  map<ll,int>mp;
  vector<ll>a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());
  rep(i,2){
    for(int j=1;j*j<=a[i];j++){
      mp[j]++;
      if(j!=a[i]/j)mp[a[i]/j]++;
    }
  }
  for(int i=2;i<n;i++){
    auto(j:mp){
      if(a[i]%j.first==0){
        mp[j.first]++;
        if(j.first!=a[i]/j.first)mp[a[i]/j.first]++;
      }
    }
  }
  int ans=1;
  for(auto p=mp.begin();p!=mp.end();p++){  
    if(p->second==n || p->second==n-1){
      if(ans<p.first)ans=p.first;
    }
  }
  
  cout << ans << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: found ':' in nested-name-specifier, expected '::'
   22 |     auto(j:mp){
      |           ^
      |           ::
a.cc:22:10: error: 'j' was not declared in this scope
   22 |     auto(j:mp){
      |          ^
a.cc:22:5: warning: 'auto(x)' only available with '-std=c++2b' or '-std=gnu++2b' [-Wc++23-extensions]
   22 |     auto(j:mp){
      |     ^~~~~~~~~~
a.cc:32:16: error: 'struct std::_Rb_tree_iterator<std::pair<const long long int, int> >' has no member named 'first'
   32 |       if(ans<p.first)ans=p.first;
      |                ^~~~~
a.cc:32:28: error: 'struct std::_Rb_tree_iterator<std::pair<const long long int, int> >' has no member named 'first'
   32 |       if(ans<p.first)ans=p.first;
      |                            ^~~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<long> A(N), L(N), R(N);
  for (int i = 0, a; cin >> a; i++) A.at(i) = a, L.at(i) = (!i) ? a : __gcd(L.at(i - 1), a);
  for (int i = N - 1; i >= 0; i--) R.at(i) = (i == N - 1) ? A.at(N - 1) : __gcd(R.at(i + 1), A.at(i));
  long ans = max(L.at(1), R.at(1));
  for (int i = 1; i + 1 < N; i++) ans = max(ans, __gcd(L.at(i - 1), R.at(i + 1)));
  cout << ans << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:76: error: no matching function for call to '__gcd(__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type&, int&)'
    8 |   for (int i = 0, a; cin >> a; i++) A.at(i) = a, L.at(i) = (!i) ? a : __gcd(L.at(i - 1), a);
      |                                                                       ~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:8:76: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long int' and 'int')
    8 |   for (int i = 0, a; cin >> a; i++) A.at(i) = a, L.at(i) = (!i) ? a : __gcd(L.at(i - 1), a);
      |                                                                       ~~~~~^~~~~~~~~~~~~~~~
Language: C++

from fractions import gcd


class SegmentTree():
    _data = []
    _offset = 0

    def __init__(self, size):
        t = 1
        while t <= size:
            t *= 2
        self._offset = t - 1
        self._data = [0] * (t * 2 - 1)

    def update(self, index, value):
        i = self._offset + index
        self._data[i] = value
        while i >= 1:
            i = (i - 1) // 2
            self._data[i] = gcd(self._data[i * 2 + 1], self._data[i * 2 + 2])

    def _query(self, start, stop, index, left, right):
        if right <= start or stop <= left:
            return 0
        if start <= left and right <= stop:
            return self._data[index]
        a = self._query(start, stop, index * 2 + 1, left, (left + right) // 2)
        b = self._query(start, stop, index * 2 + 2, (left + right) // 2, right)
        return gcd(a, b)

    def query(self, start, stop):
        return self._query(start, stop, 0, 0, self._offset + 1)


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

st = SegmentTree(N)
for i in range(N):
    st.update(i, A[i])

result = st.query(1, N)
for i in range(1, N - 1):
    result = max(result, gcd(st.query(0, i), st.query(i + 1, N)))
result = max(result, gcd(st.query(0, i), st.query(0, N - 1)))
print(result)


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

#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

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

    return gcd_ori(b, a % b);
}

int main() {
    int n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a.at(i);

    if(n==2){
       ll tmp;
       tmp = max(a.at(0), a.at(1));
       cout << tmp << endl; 
       return 0;
    }

    sort(a.begin(), a.end());
    ll gcdn = a.at(0);
    rep(i, n){
        gcdn = gcd_ori(a.at(i), gcdn);
    }
    
    ll allgcd2 = a.at(1);
    for(int i=2; i<n; i++){
        allgcd2 = gcd_ori(a.at(i), allgcd2);
    }
    ll allgcd = a.at(0);
    
    int cnt = 0;
    rep(i, n){
        if(i==0) continue;
        ll tmp;
        tmp = gcd_ori(a.at(i), allgcd); 

        if(gcdn==tmp && cnt==0){
            a.at(i) = allgcd;
            tmp = allgcd;
            cnt++;
        }
        else if(gcdn==tmp && cnt==1){
            allgcd = gcdn;
            break;
        }
        
        allgcd = tmp;
    }
    

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

int mcd(int a, int b){
	int rest = 1;
	
	if(a > b){
		while(b!= 0){
			rest = b;
			b = a%b;
			a = rest;
		}
		
		return rest;
	}
	if(b > a){
		while(a!= 0){
			rest = a;
			a = b%a;
			b = rest;
		}
		
		return rest;
	}
	if(b==a){
		return b;
	}
	
}

int main(){
	
	int n;cin>>n;
	int* a = new int[n];
	int r;
	
	for(int i= 0; i < n; i++){
		cin>>a[i];
	}
	int cont = 0;
	r = mcd(a[0],a[1]);
	
	for(int i= 2; i <n; i++){
		
		r = mcd(r, a[i]);
	}
	
	cout <<  r;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:15: error: 'cin' was not declared in this scope
   30 |         int n;cin>>n;
      |               ^~~
a.cc:45:9: error: 'cout' was not declared in this scope; did you mean 'cont'?
   45 |         cout <<  r;
      |         ^~~~
      |         cont
a.cc: In function 'int mcd(int, int)':
a.cc:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
Language: C++

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

int main() {
    int n; cin >>n;
    vector<int>v(n+1, 0);
    for(int i = 1; i <= n ; i++){
        cin >> v[i];
    }
    vector<int>p(n+1);
    p[0] = v[0];
    for(int i = 1; i <= n; i++){
        p[i] = __gcd(p[i-1],v[i]);
    }
    vector<int>s(n+2);
    s[n+1] = v[0];
    for(int i = n; i > 0; i--){
        s[i] = __gcd(s[i+1],v[i]);
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans = max(ans, __gcd(p[i-1],s[i+1]));
    }
    cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int>v(n+1, 0);
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int>v(n+1, 0);
      |            ^~~
a.cc:9:16: error: 'v' was not declared in this scope
    9 |         cin >> v[i];
      |                ^
a.cc:11:12: error: expected primary-expression before 'int'
   11 |     vector<int>p(n+1);
      |            ^~~
a.cc:12:5: error: 'p' was not declared in this scope
   12 |     p[0] = v[0];
      |     ^
a.cc:12:12: error: 'v' was not declared in this scope
   12 |     p[0] = v[0];
      |            ^
a.cc:16:12: error: expected primary-expression before 'int'
   16 |     vector<int>s(n+2);
      |            ^~~
a.cc:17:5: error: 's' was not declared in this scope
   17 |     s[n+1] = v[0];
      |     ^
Language: C++

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

int main() {
    int n; cin >>n;
  	//prefix index 0 w/ value 0.
    vector<int>v(n+1, 0);
    for(int i = 1; i <= n ; i++){
        cin >> v[i];
    }
    //pref vector, index 1
    vector<int>p(n+1);
    p[0] = v[0];
    for(int i = 1; i <= n; i++){
        p[i] = __gcd(p[i-1],v[i]);
        //cout<< "Pre: " << __gcd(p[i-1],v[i]) << endl;
    }
    //suff, last index
    vector<int>s(n+2);
  	//last index to 0.
    s[n+1] = v[0];
    for(int i = n; i > 0; i--){
        s[i] = __gcd(s[i+1],v[i]);
        //cout<< "Suff: " <<__gcd(s[i+1],v[i]) << endl;
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans = max(ans, __gcd(p[i-1],s[i+1]));
        //cout << "Ans: " << ans << endl;
    }
    cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<int>v(n+1, 0);
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:8:12: error: expected primary-expression before 'int'
    8 |     vector<int>v(n+1, 0);
      |            ^~~
a.cc:10:16: error: 'v' was not declared in this scope
   10 |         cin >> v[i];
      |                ^
a.cc:13:12: error: expected primary-expression before 'int'
   13 |     vector<int>p(n+1);
      |            ^~~
a.cc:14:5: error: 'p' was not declared in this scope
   14 |     p[0] = v[0];
      |     ^
a.cc:14:12: error: 'v' was not declared in this scope
   14 |     p[0] = v[0];
      |            ^
a.cc:20:12: error: expected primary-expression before 'int'
   20 |     vector<int>s(n+2);
      |            ^~~
a.cc:22:5: error: 's' was not declared in this scope
   22 |     s[n+1] = v[0];
      |     ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

vector<bool> valid;
vector<ll> nums;

void backtrack(ll gcd, ll n){
	if()
}

ll totalGCD(ll n){
	ll gcd = 0;
	for(ll i=0; i<n; i++){
		if(valid[i]) gcd = __gcd(gcd,nums[i]);
	}
	return gcd;
}

int main(){
	ll n;
	ll max = 1;
	cin >> n;

	nums.resize(n);
	valid.resize(n,1);
	for(ll i=0; i<n; i++) cin >> nums[i];

	for(ll i=0; i<n; i++){
		valid[i] = 0;
		ll gcd = 0;
		for(ll j=0; j<n; j++){
			if(valid[j]) gcd = __gcd(gcd,nums[j]);
		}
		if(gcd>max) max=gcd;
		valid[i] = 1;
	}

	cout << max << endl;

	return 0;
}

Compiler output:
a.cc: In function 'void backtrack(ll, ll)':
a.cc:11:12: error: expected primary-expression before ')' token
   11 |         if()
      |            ^
a.cc:12:1: error: expected primary-expression before '}' token
   12 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll gcd_n(vector<ll> &numbers) {
  ll GCD;
  GCD = numbers[0];
  for (int i = 1; i < numbers.size(); i++) {
    GCD = gcd(GCD, numbers[i]);
  }
  return GCD;
}
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  sort(A.begin(), A.end());
  ll GCD_N = gcd_n(A);

  if (GCD_N == 1) {
    for (int i = 0; i < N - 2; i++) {
      if (gcd(A[i], A[i + 1]) == 1 && gcd(A[i + 1], A[i + 2]) == 1) {
        A[i + 1] = A[i];
        break;
      } else if (gcd(A[i], A[i + 1]) == 1) {
        A[i] = A[i + 1];
        break;
      } else {
        A[i + 2] = A[i];
        break;
      }
    }
  } else {
    ll GCD = gcd(A[0], A[1]);
    for (int i = 1; i < N; i++) {
      if (GCD_N == gcd(GCD, A[i])) {
        A[i] = A[i - 1];
        break;
      }
      GCD = gcd(GCD, A[i]);
    }
  }

  cout << gcd_n(A) << endl;
  return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<long> data(N), front(N), back(N);
  for(int i = 0; i < N; i++)cin >> data.at(i);
  front.at(N - 1) = data.at(N - 1);
  back.at(0) = data.at(0);
  for(int i = 1; i < N; i++){
    back.at(i) = __gcd(back.at(i - 1), data.at(i));
    front.at(N - 1 - i) = __gcd(back.at(N - i), data.at(N - 1 - i));
  }
  for(int i = 0; i < N; i++){
    if(i == 0){
      ans = max(ans, front.at(i + 1));
    } else if (i == N - 1){
      ans = max(ans, back.at(N - 2));
    } else {
      ans = max(ans, __gcd(front.at(i + 1), back.at(N - 2)));
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |       ans = max(ans, front.at(i + 1));
      |       ^~~
      |       abs
a.cc:18:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |       ans = max(ans, back.at(N - 2));
      |       ^~~
      |       abs
a.cc:20:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |       ans = max(ans, __gcd(front.at(i + 1), back.at(N - 2)));
      |       ^~~
      |       abs
a.cc:23:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long n,a[100001],c[100001]; 
int main()
{
	cin>>n;
	for(long long i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(long long i=0;i<n;i++)
	{
		long long cnt=0;
		for(long long j=0;j<n;j++)
		{
			long long b[100000];
			if(j==i)
			{
				j++;
			}
			b[cnt]=a[j];
			cnt++;
		}
		long long gcd=b[0][i];
		for(long long j=1;j<cnt;j++)
		{
			gcd=__gcd(b[j],gcd);
		}
		c[i]=gcd;
	}
	long long Max=c[0];
	for(long long i=1;i<n;i++)
	{
		Max=max(Max,c[i]);
	}
	cout<<Max<<"\n";
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
long long n,a[100001],c[100001]; 
int main()
{
	cin>>n;
	for(long long i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(long long i=0;i<n;i++)
	{
		long long cnt=0;
		for(long long j=0;j<n;j++)
		{
			int b[1000000];
			if(j==i)
			{
				j++;
			}
			b[cnt]=a[j];
			cnt++;
		}
		long long gcd=b[0][i];
		for(long long j=1;j<cnt;j++)
		{
			gcd=__gcd(b[j],gcd);
		}
		c[i]=gcd;
	}
	long long Max=c[0];
	for(long long i=1;i<n;i++)
	{
		Max=max(Max,c[i]);
	}
	cout<<Max<<"\n";
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
long long n,a[100001],c[100001]; 
int main()
{
	cin>>n;
	for(long long i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(long long i=0;i<n;i++)
	{
		long long cnt=0;
		for(long long j=0;j<n;j++)
		{
			int b[1000000000];
			if(j==i)
			{
				j++;
			}
			b[cnt]=a[j];
			cnt++;
		}
		long long gcd=b[0][i];
		for(long long j=1;j<cnt;j++)
		{
			gcd=__gcd(b[j],gcd);
		}
		c[i]=gcd;
	}
	long long Max=c[0];
	for(long long i=1;i<n;i++)
	{
		Max=max(Max,c[i]);
	}
	cout<<Max<<"\n";
	return 0;
}

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

#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <cmath>
#include <iomanip>
#define rep(i,n) for (int i = 0; i < (n); ++i)

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;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

template <class T>
inline bool chmin(T& a, T b)
{
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T& a, T b)
{
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
T GCD(T x, T y)
{
    return (y ? GCD<T>(y, x % y) : x);
}



int main() {
    int main()
    {
        int N;
        cin >> N;
        vector<int> a(N);
        rep(i, N) cin >> a.at(i);

        vector<int> left(N + 1, 0), right(N + 1, 0);
        // left[p]:= [0, p)の最大公約数
        // right[p]:= [p, N)の最大公約数
        for (int i = 0; i < N; i++) {
            left.at(i + 1) = GCD(left.at(i), a.at(i));
        }
        for (int i = N - 1; i >= 0; i--) {
            right.at(i) = GCD(right.at(i + 1), a.at(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;
    }


    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:44:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   44 |     int main()
      |             ^~
a.cc:44:13: note: remove parentheses to default-initialize a variable
   44 |     int main()
      |             ^~
      |             --
a.cc:44:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:45:5: error: a function-definition is not allowed here before '{' token
   45 |     {
      |     ^
Language: C++

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

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

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

typedef long long ll;

#define MAX_N 10000

struct Edge {
    int to;
    int weight;
    Edge(int t, int w)
        : to(t)
        , weight(w)
    {
    }
};
using Graph = vector<vector<int>>;
using Graph_e = vector<vector<Edge>>;

vector<int> dx = { 1, 0, -1, 0 };
vector<int> dy = { 0, 1, 0, -1 };
typedef pair<int, int> P;

template <typename T>
T GCD(T x, T y)
{
    return (y ? GCD<T>(y, x % y) : x);
}

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A.at(i);
    // N-1個の最大公約数の最大値を求めればいい

    //left[i]はa.at(0)からa.at(i-1)(i番目)までの最大公約数
    vector<int> left(N + 1, a.at(0));
    rep(i, N)
    {
        left.at(i + 1) = GCD<int>(left.at(0), a.at(i));
    }
    vector<int> right(N + 1, a.at(N - 1));
    rep(i, N)
    {
        left.at(i + 1) = GCD<int>(left.at(i), a.at(N - 1 - i));
    }

    int max = -INF_32;

    for (int i = 1; i < N; i++) {
        chmax(max, GCD<int>(left.at(i), right.at(N - i)));
    }

    cout << max << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:65:29: error: 'a' was not declared in this scope
   65 |     vector<int> left(N + 1, a.at(0));
      |                             ^
Language: C++

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

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

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

typedef long long ll;

#define MAX_N 10000

struct Edge {
    int to;
    int weight;
    Edge(int t, int w)
        : to(t)
        , weight(w)
    {
    }
};
using Graph = vector<vector<int>>;
using Graph_e = vector<vector<Edge>>;

vector<int> dx = { 1, 0, -1, 0 };
vector<int> dy = { 0, 1, 0, -1 };
typedef pair<int, int> P;

template <template T>
T GCD(T x, T y)
{
    return (y ? GCD(y, x % y) : x);
}

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A.at(i);
    // N-1個の最大公約数の最大値を求めればいい

    // A.at(0)だけ仲間はずれのとき
    int max = A.at(1);
    for (int j = 2; j < N; j++) {
        max = GCD<int>(max, A.at(j));
    }

    for (int i = 1; i < N; i++) {
        int gcd = A.at(0);
        for (int j = 0; j < N; j++) {
            if (j == i)
                continue;
            gcd = GCD<int>(gcd, A.at(j));
        }
        chmax(max, gcd);
    }

    cout << max << endl;
}


Compiler output:
a.cc:50:20: error: expected '<' before 'T'
   50 | template <template T>
      |                    ^
a.cc:50:20: error: 'T' has not been declared
a.cc:51:1: error: expected 'class' or 'typename' before 'T'
   51 | T GCD(T x, T y)
      | ^
a.cc:51:3: error: expected '>' before 'GCD'
   51 | T GCD(T x, T y)
      |   ^~~
a.cc:52:1: error: expected unqualified-id before '{' token
   52 | {
      | ^
a.cc: In function 'int main()':
a.cc:67:15: error: 'GCD' was not declared in this scope
   67 |         max = GCD<int>(max, A.at(j));
      |               ^~~
a.cc:67:19: error: expected primary-expression before 'int'
   67 |         max = GCD<int>(max, A.at(j));
      |                   ^~~
a.cc:75:19: error: 'GCD' was not declared in this scope
   75 |             gcd = GCD<int>(gcd, A.at(j));
      |                   ^~~
a.cc:75:23: error: expected primary-expression before 'int'
   75 |             gcd = GCD<int>(gcd, A.at(j));
      |                       ^~~