Language: C++

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrep(i,a,b) for(int i=(int)(a);i>=(int)(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
using ll = long long; constexpr int inf = INT_MAX / 2; constexpr ll infl = 1LL << 60;
template<class T>void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T>void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T>void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T>void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
 
void _main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, 0, N) cin >> A[i];
 
  if (N == 2) {
    cout << max(A[0], A[1]) << endl;
    return;
  }
  if (N < 1000) {
    int ans = 1;
    rep(i, 0, N) {
      int t;
      if (i == 0) t = gcd(A[1], A[2]);
      else if (i == 1) t = gcd(A[0], A[2]);
      else t = gcd(A[0], A[1]);
      rep(j, 0, N) {
        if (i == j) continue;
        chmax(t, gcd(t, A[i]));
      }
      chmax(ans, t);
    }
    cout << ans << endl;
    return;
  }
  int i2 = N/4;
  int i3 = N/2;
  int i4 = N/4*3;
  int sum1 = A[0];
  int sum2 = A[i2];
  int sum3 = A[i3];
  int sum4 = A[i4];
  rep(i, 0, i2) sum1 = gcd(sum1, A[i]);
  rep(i, 0, i3) sum2 = gcd(sum2, A[i]);
  rep(i, 0, i4) sum3 = gcd(sum3, A[i]);
  rep(i, 0, N)  sum4 = gcd(sum4, A[i]);
  int gcd1 = gcd(gcd(sum2,sum3),sum4);
  int gcd2 = gcd(gcd(sum1,sum3),sum4);
  int gcd3 = gcd(gcd(sum1,sum2),sum4);
  int gcd4 = gcd(gcd(sum1,sum2),sum3);

  int ans = 1;
  rep(i, 0, N) {
    int t;
    if (i < i2) {
      t = gcd1;
      rep(j, 0, i2) {
        if (i == j) continue;
        t = gcd(t, A[i]);
      }
    } else if (i < i3) {
      t = gcd2
      rep(j, i2, i3) {
        if (i == j) continue;
        t = gcd(t, A[i]);
      }
    } else if (i < i4) {
      t = gcd3
      rep(j, i3, i4) {
        if (i == j) continue;
        t = gcd(t, A[i]);
      }
    } else {
      t = gcd4
      rep(j, i4, N) {
        if (i == j) continue;
        t = gcd(t, A[i]);
      }
    }
    chmax(ans, t);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'void _main()':
a.cc:69:15: error: expected ';' before 'for'
   69 |       t = gcd2
      |               ^
      |               ;
a.cc:70:11: error: 'j' was not declared in this scope
   70 |       rep(j, i2, i3) {
      |           ^
a.cc:2:39: note: in definition of macro 'rep'
    2 | #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
      |                                       ^
a.cc:75:15: error: expected ';' before 'for'
   75 |       t = gcd3
      |               ^
      |               ;
a.cc:76:11: error: 'j' was not declared in this scope
   76 |       rep(j, i3, i4) {
      |           ^
a.cc:2:39: note: in definition of macro 'rep'
    2 | #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
      |                                       ^
a.cc:81:15: error: expected ';' before 'for'
   81 |       t = gcd4
      |               ^
      |               ;
a.cc:82:11: error: 'j' was not declared in this scope
   82 |       rep(j, i4, N) {
      |           ^
a.cc:2:39: note: in definition of macro 'rep'
    2 | #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
      |                                       ^