Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

vector<ll> sum;
void pre_process(vector<ll> &a, vector<ll> &s) {  //累積和のvector
    ll n = (ll)a.size();
    s.assign(n + 1, 0);
    s[0] = a[0];
    for (ll i = 0; i < n; i++) {
        s[i + 1] = gcd(s[i], a[i]);
    }
}

vector<ll> prime_num(5000010, 0);
vector<bool> prime(5000010, true);
bool ans = false;
void isprime(ll N) {
    if (N >= 0) prime[0] = false;
    if (N >= 1) prime[1] = false;
    for (ll i = 2; i * i <= N; i++) {
        if (!prime[i]) {
            continue;
        }

        ll cnt = 0;
        cnt += prime_num[i];

        for (ll j = i * i; j <= N; j += i) {
            prime[j] = false;
            cnt += prime_num[j];
        }

        // if (i == 2) cout << cnt << endl;
        if (cnt >= 2) {
            ans = true;
            break;
        }
    }
}

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    bool ans1 = false, number = 1;
    rep(i, n) {
        if (i == 0)
            number = a[i];
        else
            number = gcd(number, a[i]);
        cin >> a[i];
        prime_num[a[i]]++;
    }

    isprime(5000000);
    if (number == 1) {  // gcd=1;

        if (ans == true) {
            cout << "setwise coprime\n";
        } else {
            cout << "pairwise coprime\n";
        }
    } else {
        cout << "not coprime\n";
    }

    return 0;
}

Compiler output:
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: In instantiation of 'constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = bool; _Nn = long long int; common_type_t<_Mn, _Nn> = long long int]':
a.cc:83:25:   required from here
   83 |             number = gcd(number, a[i]);
      |                      ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/numeric:177:28: error: static assertion failed: std::gcd arguments must not be bool
  177 |       static_assert(_Mn(2) == 2 && _Nn(2) == 2,
      |                     ~~~~~~~^~~~
/usr/include/c++/14/numeric:177:28: note: the comparison reduces to '(1 == 2)'
/usr/include/c++/14/numeric:180:46: error: use of deleted function 'void std::__detail::__abs_r(bool) [with <template-parameter-1-1> = long long int]'
  180 |       const _Ct __m2 = __detail::__abs_r<_Ct>(__m);
      |                        ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/numeric:129:27: note: declared here
  129 |   template<typename> void __abs_r(bool) = delete;
      |                           ^~~~~~~
/usr/include/c++/14/numeric:180:46: note: use '-fdiagnostics-all-candidates' to display considered candidates
  180 |       const _Ct __m2 = __detail::__abs_r<_Ct>(__m);
      |                        ~~~~~~~~~~~~~~~~~~~~~~^~~~~