Language: C++

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int gcd(int a,int b){
    if ( ( 0 == a ) || ( 0 == b ) )
		return 0;
	
    if (a<b){
        swap(a,b);        
    }
    if(a%b==0){
        return b;
    }
    else{
        
    return gcd(a,a%b);
    }
}


int main() {
    int N;
    int a[100010];
    cin>>N;
    for(int i=0;i<N;i++) cin>>a[i];
    vector<int> front(N+1);
    vector<int> back(N+1);
    front[0]=a[0];
    back[0]=a[N-1];
    for(int i=0;i<N;i++){
        front[i+1]=gcd(a[i],front[i]);
        back[i+1]=gcd(a[N-i-1],back[i]);
        //cerr<<front[i+1]<<" "<<back[i+1]<<endl;
    }
    int tmp1=back[N-1];
    back[0]=front[N-1];
    front[0]=tmp1;
    int ans=front[N];
    for(int i=0;i<N;i++){
        int tmp=gcd(front[i],back[N-i-1]);
        cerr<<front[i]<<" "<< back[N-i-1]<<endl;
        ans=max(ans,tmp);
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int gcd(int a,int b){
    if ( ( 0 == a ) || ( 0 == b ) )
		return 0;
	
    if (a<b){
        swap(a,b);        
    }
    if(a%b==0){
        return b;
    }
    else{
        
    return gcd(a,a%b);
    }
}


int main() {
    int N;
    int a[100010];
    cin>>N;
    for(int i=0;i<N;i++) cin>>a[i];
    vector<int> front(N+1);
    vector<int> back(N+1);
    front[0]=a[0];
    back[0]=a[N-1];
    for(int i=0;i<N;i++){
        front[i+1]=gcd(a[i],front[i]);
        back[i+1]=gcd(a[N-i-1],back[i]);
        //cerr<<front[i+1]<<" "<<back[i+1]<<endl;
    }
    int tmp1=back[N-1];
    back[0]=front[N-1];
    front[0]=tmp1;
    int ans=0;
    for(int i=0;i<N;i++){
        int tmp=gcd(front[i],back[N-i-1]);
        //cerr<<tmp<<" "<<front[i]<<" "<< back[N-i-1]<<endl;
        ans=max(ans,tmp);
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc:101:31: error: redefinition of 'template<class T> bool chmax(T&, T)'
  101 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:29:31: note: 'template<class T> bool chmax(T&, T)' previously declared here
   29 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:102:31: error: redefinition of 'template<class T> bool chmin(T&, T)'
  102 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:30:31: note: 'template<class T> bool chmin(T&, T)' previously declared here
   30 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:103:39: error: redefinition of 'template<class T1, class T2> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>)'
  103 | template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
      |                                       ^~~~~~~~
a.cc:31:39: note: 'template<class T1, class T2> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>)' previously declared here
   31 | template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
      |                                       ^~~~~~~~
a.cc:105:28: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>)'
  105 | template<class T> ostream& operator << (ostream &s, vector<T> P)
      |                            ^~~~~~~~
a.cc:33:28: note: 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>)' previously declared here
   33 | template<class T> ostream& operator << (ostream &s, vector<T> P)
      |                            ^~~~~~~~
a.cc:107:28: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<std::vector<_Tp> >)'
  107 | template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
      |                            ^~~~~~~~
a.cc:35:28: note: 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<std::vector<_Tp> >)' previously declared here
   35 | template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
      |                            ^~~~~~~~
a.cc:109:28: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, std::set<T>)'
  109 | template<class T> ostream& operator << (ostream &s, set<T> P)
      |                            ^~~~~~~~
a.cc:37:28: note: 'template<class T> std::ostream& operator<<(std::ostream&, std::set<T>)' previously declared here
   37 | template<class T> ostream& operator << (ostream &s, set<T> P)
      |                            ^~~~~~~~
a.cc:111:39: error: redefinition of 'template<class T1, class T2> std::ostream& operator<<(std::ostream&, std::map<T1, T2>)'
  111 | template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
      |                                       ^~~~~~~~
a.cc:39:39: note: 'template<class T1, class T2> std::ostream& operator<<(std::ostream&, std::map<T1, T2>)' previously declared here
   39 | template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
      |                                       ^~~~~~~~
a.cc:119:5: error: redefinition of 'int gcd(int, int)'
  119 | int gcd(int a,int b){
      |     ^~~
a.cc:47:5: note: 'int gcd(int, int)' previously defined here
   47 | int gcd(int a,int b){
      |     ^~~
a.cc:136:5: error: redefinition of 'int main()'
  136 | int main() {
      |     ^~~~
a.cc:64:5: note: 'int main()' previously defined here
   64 | int main() {
      |     ^~~~