Language: C++

#include <iostream>
#include <algorithm>

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

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++) l[i+1] = gcd(l[i], a[i]);
  for (int i = n-1; i >= 1;i--) 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;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   11 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:12:3: error: 'vector' was not declared in this scope
   12 |   vector<int> a(n);
      |   ^~~~~~
a.cc:12:10: error: expected primary-expression before 'int'
   12 |   vector<int> a(n);
      |          ^~~
a.cc:13:20: error: expected ';' before '<' token
   13 |   for (int i = 0, i < n, i++) cin >> a(i);
      |                    ^~
      |                    ;
a.cc:13:21: error: expected primary-expression before '<' token
   13 |   for (int i = 0, i < n, i++) cin >> a(i);
      |                     ^
a.cc:13:29: error: expected ';' before ')' token
   13 |   for (int i = 0, i < n, i++) cin >> a(i);
      |                             ^
      |                             ;
a.cc:13:38: error: 'a' was not declared in this scope
   13 |   for (int i = 0, i < n, i++) cin >> a(i);
      |                                      ^
a.cc:14:10: error: expected primary-expression before 'int'
   14 |   vector<int> l(n), r(n);
      |          ^~~
a.cc:15:33: error: 'l' was not declared in this scope
   15 |   for (int i = 0; i < n-1; i++) l[i+1] = gcd(l[i], a[i]);
      |                                 ^
a.cc:15:52: error: 'a' was not declared in this scope
   15 |   for (int i = 0; i < n-1; i++) l[i+1] = gcd(l[i], a[i]);
      |                                                    ^
a.cc:16:33: error: 'r' was not declared in this scope
   16 |   for (int i = n-1; i >= 1;i--) r[i-1] = gcd(r[i], a[i]);
      |                                 ^
a.cc:16:52: error: 'a' was not declared in this scope
   16 |   for (int i = n-1; i >= 1;i--) r[i-1] = gcd(r[i], a[i]);
      |                                                    ^
a.cc:19:24: error: 'l' was not declared in this scope
   19 |     ans = max(ans, gcd(l[i],r[i]));
      |                        ^
a.cc:19:29: error: 'r' was not declared in this scope
   19 |     ans = max(ans, gcd(l[i],r[i]));
      |                             ^
a.cc:19:11: error: 'max' was not declared in this scope; did you mean 'std::max'?
   19 |     ans = max(ans, gcd(l[i],r[i]));
      |           ^~~
      |           std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:21:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   21 |   cout << ans << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:21:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   21 |   cout << ans << endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~