Language: C++

#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a > b) swap(a, b);
  while (a != 0) {
	tie(a, b) = { b, a%b };
  }
  return b;
}
int main() {
  int N;
  vector<int> can; can.clear();
  unordered_map<int, int> m; m.clear();
  cin >> N;
  for(int i = 0, ai; i < N; i++) {
    cin >> ai;
    m[ai]++;
  }
  int pre = 0;
  for (const auto &it: m) {
    if (it.second >= 2) pre = gcd(ans, it.first);
    else can.push_back(it.first);
  }
  int ans = 1, tmp;
  sort(can.begin(), can.end());
  for (const int &t: can) {
    tmp = pre;
    for (const int &i: can) {
      tmp = gcd(tmp, i);
      if (tmp <= ans) break;
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:6:30: error: no match for 'operator=' (operand types are 'std::tuple<int&, int&>' and '<brace-enclosed initializer list>')
    6 |         tie(a, b) = { b, a%b };
      |                              ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/tuple:2355:9: note: candidate: 'template<class _U1, class _U2> std::__enable_if_t<((bool)__assignable<const _U1&, const _U2&>()), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(const std::tuple<_U1, _U2>&) [with _U2 = _U1; _T1 = int&; _T2 = int&]'
 2355 |         operator=(const tuple<_U1, _U2>& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:2355:9: note:   template argument deduction/substitution failed:
a.cc:6:30: note:   couldn't deduce template parameter '_U1'
    6 |         tie(a, b) = { b, a%b };
      |                              ^
/usr/include/c++/14/tuple:2365:9: note: candidate: 'template<class _U1, class _U2> std::__enable_if_t<((bool)__assignable<_U1, _U2>()), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(std::tuple<_U1, _U2>&&) [with _U2 = _U1; _T1 = int&; _T2 = int&]'
 2365 |         operator=(tuple<_U1, _U2>&& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:2365:9: note:   template argument deduction/substitution failed:
a.cc:6:30: note:   couldn't deduce template parameter '_U1'
    6 |         tie(a, b) = { b, a%b };
      |                              ^
/usr/include/c++/14/tuple:2375:9: note: candidate: 'template<class _U1, class _U2> std::__enable_if_t<((bool)__assignable<const _U1&, const _U2&>()), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U2 = _U1; _T1 = int&; _T2 = int&]'
 2375 |         operator=(const pair<_U1, _U2>& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:2375:9: note:   template argument deduction/substitution failed:
a.cc:6:30: note:   couldn't deduce template parameter '_U1'
    6 |         tie(a, b) = { b, a%b };
      |                              ^
/usr/include/c++/14/tuple:2386:9: note: candidate: 'template<class _U1, class _U2> std::__enable_if_t<((bool)__assignable<_U1, _U2>()), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U2 = _U1; _T1 = int&; _T2 = int&]'
 2386 |         operator=(pair<_U1, _U2>&& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:2386:9: note:   template argument deduction/substitution failed:
a.cc:6:30: note:   couldn't deduce template parameter '_U1'
    6 |         tie(a, b) = { b, a%b };
      |                              ^
/usr/include/c++/14/tuple:2332:7: note: candidate: 'std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(std::__conditional_t<((bool)__assignable<const _T1&, const _T2&>()), const std::tuple<_T1, _T2>&, const std::__nonesuch&>) [with _T1 = int&; _T2 = int&; std::__conditional_t<((bool)__assignable<const _T1&, const _T2&>()), const std::tuple<_T1, _T2>&, const std::__nonesuch&> = const std::tuple<int&, int&>&]'
 2332 |       operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
      |       ^~~~~~~~
/usr/include/c++/14/tuple:2334:52: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::__conditional_t<true, const std::tuple<int&, int&>&, const std::__nonesuch&>' {aka 'const std::tuple<int&, int&>&'}
 2332 |       operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2333 |                                 const tuple&,
      |                                 ~~~~~~~~~~~~~       
 2334 |                                 const __nonesuch&> __in)
      |                                 ~~~~~~~~~~~~~~~~~~~^~~~
/usr/include/c++/14/tuple:2343:7: note: candidate: 'std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(std::__conditional_t<((bool)__assignable<_T1, _T2>()), std::tuple<_T1, _T2>&&, std::__nonesuch&&>) [with _T1 = int&; _T2 = int&; std::__conditional_t<((bool)__assignable<_T1, _T2>()), std::tuple<_T1, _T2>&&, std::__nonesuch&&> = std::tuple<int&, int&>&&]'
 2343 |       operator=(__conditional_t<__assignable<_T1, _T2>(),
      |       ^~~~~~~~
/usr/include/c++/14/tuple:2345:47: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::__conditional_t<true, std::tuple<int&, int&>&&, std::__nonesuch&&>' {aka 'std::tuple<int&, int&>&&'}
 2343 |       operator=(__conditional_t<__assignable<_T1, _T2>(),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2344 |                                 tuple&&,
      |                                 ~~~~~~~~       
 2345 |                                 __nonesuch&&> __in)
      |                                 ~~~~~~~~~~~~~~^~~~
a.cc: In function 'int main()':
a.cc:21:35: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     if (it.second >= 2) pre = gcd(ans, it.first);
      |                                   ^~~
      |                                   abs