Language: C++

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e6+5; 
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}

ll raise(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

const int k=168;
ll n, a[N], gcd;
int primes[k] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};
map <int,int> m;

void solve()
{
	bool pairwise=true;
    cin >> n >> a[0]; gcd=a[0]; 
    for (int i=1; i<n; ++i) {
    	cin >> a[i], gcd = __gcd(a[i],gcd);
    	if (pairwise) {
    		for (int j=0; j<k; ++j) {
	    		if (a[i]%primes[j]==0) {
	    			m[primes[j]]++;
	    			if (m[primes[j]]>1) pairwise=false;
	    		}
	    	}
    	}
    }
    if (pairwise) {
    	nout("pairwise coprime");
    }else if (gcd==1) {
    	nout("setwise coprime");
    }else nout("not coprime");

    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:44:23: error: reference to 'gcd' is ambiguous
   44 |     cin >> n >> a[0]; gcd=a[0];
      |                       ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:37:13: note:                 'long long int gcd'
   37 | ll n, a[N], gcd;
      |             ^~~
a.cc:46:22: error: reference to 'gcd' is ambiguous
   46 |         cin >> a[i], gcd = __gcd(a[i],gcd);
      |                      ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:37:13: note:                 'long long int gcd'
   37 | ll n, a[N], gcd;
      |             ^~~
a.cc:46:39: error: reference to 'gcd' is ambiguous
   46 |         cin >> a[i], gcd = __gcd(a[i],gcd);
      |                                       ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:37:13: note:                 'long long int gcd'
   37 | ll n, a[N], gcd;
      |             ^~~
a.cc:58:15: error: reference to 'gcd' is ambiguous
   58 |     }else if (gcd==1) {
      |               ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:37:13: note:                 'long long int gcd'
   37 | ll n, a[N], gcd;
      |             ^~~