Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
//もう二度とつかわん//
//    ↓ ↓　↓　　 //
#define ll long long
//    ↑　↑　↑    //
//フェルマー方程式の恨み//
#define rep(i,n) for(int i=0;i<n;i++)
#define ggr getchar(); getchar();return 0;
using namespace std;
ll gcd(ll x, ll y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll n;
ll a[114514];
ll left[114514];
ll right[114514];
signed main() {
	ll inf = -1;
	cin >> n;
	rep(i, n)cin >> a[i];
	left[0] = a[0];
	rep(i, n - 1) {
		left[i + 1] = gcd(left[i], a[i + 1]);
	}
	right[0] = a[n - 1];
	for (int i = n - 1; i >= 1; i--) {
		right[i + 1] = gcd(right[i], a[i - 1]);
	}
	for (int i = (n + 1) / 2; i < n; i++) {
		inf = max(inf, gcd(left[i], right[i]));
	}
	if (n % 2 == 0)cout << inf << endl;
	else cout << max({ inf,left[n / 2],right[n / 2] }) << endl;
	ggr
}




Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: reference to 'left' is ambiguous
   32 |         left[0] = a[0];
      |         ^~~~
In file included from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:26:4: note:                 'long long int left [114514]'
   26 | ll left[114514];
      |    ^~~~
a.cc:34:17: error: reference to 'left' is ambiguous
   34 |                 left[i + 1] = gcd(left[i], a[i + 1]);
      |                 ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:26:4: note:                 'long long int left [114514]'
   26 | ll left[114514];
      |    ^~~~
a.cc:34:35: error: reference to 'left' is ambiguous
   34 |                 left[i + 1] = gcd(left[i], a[i + 1]);
      |                                   ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:26:4: note:                 'long long int left [114514]'
   26 | ll left[114514];
      |    ^~~~
a.cc:36:9: error: reference to 'right' is ambiguous
   36 |         right[0] = a[n - 1];
      |         ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:27:4: note:                 'long long int right [114514]'
   27 | ll right[114514];
      |    ^~~~~
a.cc:38:17: error: reference to 'right' is ambiguous
   38 |                 right[i + 1] = gcd(right[i], a[i - 1]);
      |                 ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:27:4: note:                 'long long int right [114514]'
   27 | ll right[114514];
      |    ^~~~~
a.cc:38:36: error: reference to 'right' is ambiguous
   38 |                 right[i + 1] = gcd(right[i], a[i - 1]);
      |                                    ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:27:4: note:                 'long long int right [114514]'
   27 | ll right[114514];
      |    ^~~~~
a.cc:41:36: error: reference to 'left' is ambiguous
   41 |                 inf = max(inf, gcd(left[i], right[i]));
      |                                    ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:26:4: note:                 'long long int left [114514]'
   26 | ll left[114514];
      |    ^~~~
a.cc:41:45: error: reference to 'right' is ambiguous
   41 |                 inf = max(inf, gcd(left[i], right[i]));
      |                                             ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:27:4: note:                 'long long int right [114514]'
   27 | ll right[114514];
      |    ^~~~~
a.cc:44:32: error: reference to 'left' is ambiguous
   44 |         else cout << max({ inf,left[n / 2],right[n / 2] }) << endl;
      |                                ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:26:4: note:                 'long long int left [114514]'
   26 | ll left[114514];
      |    ^~~~
a.cc:44:44: error: reference to 'right' is ambiguous
   44 |         else cout << max({ inf,left[n / 2],right[n / 2] }) << endl;
      |                                            ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:27:4: note:                 'long long int right [114514]'
   27 | ll right[114514];
      |    ^~~~~
a.cc:44:25: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   44 |         else cout << max({ inf,left[n / 2],right[n / 2] }) << endl;
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided