Language: C++

using namespace std;

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

int main(){
    int N;cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;++i){
        cin>>a[i];
    }
    vector<int> l(N),r(N);
    for(int i=0;i<N-1;++i){
        cout << l.size() << "1st output" << endl;
        l[i+1]=gcd(l[i],a[i]);
    }
    for(int i=N-1;i>=1;--i){
        cout << r.size() << "2nd output" << endl;
        r[i-1]=gcd(r[i],a[i]);
    }
    int ans=1;
    for(int i=0;i<N;++i){
        ans=max(ans, gcd(l[i],r[i]));
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: 'cin' was not declared in this scope
    9 |     int N;cin>>N;
      |           ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:10:5: error: 'vector' was not declared in this scope
   10 |     vector<int> a(N);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:10:12: error: expected primary-expression before 'int'
   10 |     vector<int> a(N);
      |            ^~~
a.cc:12:14: error: 'a' was not declared in this scope
   12 |         cin>>a[i];
      |              ^
a.cc:14:12: error: expected primary-expression before 'int'
   14 |     vector<int> l(N),r(N);
      |            ^~~
a.cc:16:9: error: 'cout' was not declared in this scope
   16 |         cout << l.size() << "1st output" << endl;
      |         ^~~~
a.cc:16:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:17: error: 'l' was not declared in this scope
   16 |         cout << l.size() << "1st output" << endl;
      |                 ^
a.cc:16:45: error: 'endl' was not declared in this scope
   16 |         cout << l.size() << "1st output" << endl;
      |                                             ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:17:25: error: 'a' was not declared in this scope
   17 |         l[i+1]=gcd(l[i],a[i]);
      |                         ^
a.cc:20:9: error: 'cout' was not declared in this scope
   20 |         cout << r.size() << "2nd output" << endl;
      |         ^~~~
a.cc:20:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:17: error: 'r' was not declared in this scope
   20 |         cout << r.size() << "2nd output" << endl;
      |                 ^
a.cc:20:45: error: 'endl' was not declared in this scope
   20 |         cout << r.size() << "2nd output" << endl;
      |                                             ^~~~
a.cc:20:45: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:21:25: error: 'a' was not declared in this scope
   21 |         r[i-1]=gcd(r[i],a[i]);
      |                         ^
a.cc:25:26: error: 'l' was not declared in this scope
   25 |         ans=max(ans, gcd(l[i],r[i]));
      |                          ^
a.cc:25:31: error: 'r' was not declared in this scope
   25 |         ans=max(ans, gcd(l[i],r[i]));
      |                               ^
a.cc:25:13: error: 'max' was not declared in this scope
   25 |         ans=max(ans, gcd(l[i],r[i]));
      |             ^~~
a.cc:27:5: error: 'cout' was not declared in this scope
   27 |     cout << ans << endl;
      |     ^~~~
a.cc:27:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:20: error: 'endl' was not declared in this scope
   27 |     cout << ans << endl;
      |                    ^~~~
a.cc:27:20: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'