Language: C++

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<vector>
#include<numeric>
#include<set>
#include<algorithm>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
#define rep(i, n) for (i32 i = 0; i < (i32)(n); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;
int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    i32 n;
    cin >> n;
    vector<i32> a(n);
    i32 lim = 0;
    set<i32> st;
    rep(i,n){
        cin >> a[i];
        lim = max(lim,a[i]);
        st.insert(a[i]);
    }
    if(st.size() < n){
        i32 k = a[0];
        for(i32 i = 0; i < n; i++){
            k = gcd(a[i],k);
        }
        if(k == 1){
            cout << "setwise coprime" << endl;
        }else{
            cout << "not coprime" << endl;
        }
        return 0;
    }
    vector<i32>rec(lim + 1,0);
    reverse(all(a));
    bool as = true;
    rep(i,n){
        if(a[i] != 1) {
            bool flag = true;
            for (i32 j = 1; j * j <= a[i]; ++j) {
                if (a[i] % j == 0) {
                    ++rec[j];
                    if (a[i] / j != j) ++rec[a[i] / j];
                    if((rec[a[i] / j] >= 2 || (j != 1 && rec[j] >= 2))){
                        flag = false;
                        break;
                    }
                }
            }
            if(!flag){
                as = false;
                break;
            }
        }
    }
    i32 k = a[0];
    rep(i,n){
        k = gcd(k,a[i]);
    }
    for(i32 i = 2; i <= lim; ++1){
        if(rec[i] >= 2)as = false;
    }
    if(as && k == 1){
        cout << "pairwise coprime" << endl;
    }
    else if(!as && k == 1){
        cout << "setwise coprime" << endl;
    }else{
        cout << "not coprime" << endl;
    }
}


Compiler output:
a.cc:10:13: error: 'int_fast32_t' does not name a type
   10 | using i32 = int_fast32_t;
      |             ^~~~~~~~~~~~
a.cc:11:13: error: 'int_fast64_t' does not name a type
   11 | using i64 = int_fast64_t;
      |             ^~~~~~~~~~~~
a.cc:15:16: error: 'i64' was not declared in this scope
   15 | using P = pair<i64,i64>;
      |                ^~~
a.cc:15:20: error: 'i64' was not declared in this scope
   15 | using P = pair<i64,i64>;
      |                    ^~~
a.cc:15:23: error: template argument 1 is invalid
   15 | using P = pair<i64,i64>;
      |                       ^
a.cc:15:23: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:19:5: error: 'i32' was not declared in this scope
   19 |     i32 n;
      |     ^~~
a.cc:20:12: error: 'n' was not declared in this scope
   20 |     cin >> n;
      |            ^
a.cc:21:15: error: template argument 2 is invalid
   21 |     vector<i32> a(n);
      |               ^
a.cc:22:8: error: expected ';' before 'lim'
   22 |     i32 lim = 0;
      |        ^~~~
      |        ;
a.cc:23:12: error: template argument 2 is invalid
   23 |     set<i32> st;
      |            ^
a.cc:23:12: error: template argument 3 is invalid
a.cc:24:9: error: expected ';' before 'i'
   24 |     rep(i,n){
      |         ^
a.cc:12:28: note: in definition of macro 'rep'
   12 | #define rep(i, n) for (i32 i = 0; i < (i32)(n); ++i)
      |                            ^
a.cc:24:9: error: 'i' was not declared in this scope
   24 |     rep(i,n){
      |         ^
a.cc:12:35: note: in definition of macro 'rep'
   12 | #define rep(i, n) for (i32 i = 0; i < (i32)(n); ++i)
      |                                   ^
a.cc:26:9: error: 'lim' was not declared in this scope
   26 |         lim = max(lim,a[i]);
      |         ^~~
a.cc:27:12: error: request for member 'insert' in 'st', which is of non-class type 'int'
   27 |         st.insert(a[i]);
      |            ^~~~~~
a.cc:29:11: error: request for member 'size' in 'st', which is of non-class type 'int'
   29 |     if(st.size() < n){
      |           ^~~~
a.cc:30:12: error: expected ';' before 'k'
   30 |         i32 k = a[0];
      |            ^~
      |            ;
a.cc:31:16: error: expected ';' before 'i'
   31 |         for(i32 i = 0; i < n; i++){
      |                ^~
      |                ;
a.cc:31:24: error: 'i' was not declared in this scope
   31 |         for(i32 i = 0; i < n; i++){
      |                        ^
a.cc:32:13: error: 'k' was not declared in this scope
   32 |             k = gcd(a[i],k);
      |             ^
a.cc:34:12: error: 'k' was not declared in this scope
   34 |         if(k == 1){
      |            ^
a.cc:41:15: error: template argument 2 is invalid
   41 |     vector<i32>rec(lim + 1,0);
      |               ^
a.cc:41:20: error: 'lim' was not declared in this scope
   41 |     vector<i32>rec(lim + 1,0);
      |                    ^~~
a.cc:41:29: error: expression list treated as compound expression in initializer [-fpermissive]
   41 |     vector<i32>rec(lim + 1,0);
      |                             ^
a.cc:13:20: error: request for member 'begin' in 'a', which is of non-class type 'int'
   13 | #define all(a) (a).begin(),(a).end()
      |                    ^~~~~
a.cc:42:13: note: in expansion of macro 'all'
   42 |     reverse(all(a));
      |             ^~~
a.cc:13:32: error: request for member 'end' in 'a', which is of non-class type 'int'
   13 | #define all(a) (a).begin(),(a).end()
      |                                ^~~
a.cc:42:13: note: in expansion of macro 'all'
   42 |     reverse(all(a));
      |             ^~~
a.cc:44:9: error: expected ';' before 'i'
   44 |     rep(i,n){
      |         ^
a.cc:12:28: note: in definition of macro 'rep'
   12 | #define rep(i, n) for (i32 i = 0; i < (i32)(n); ++i)
      |                            ^
a.cc:44:9: error: 'i' was not declared in this scope
   44 |     rep(i,n){
      |         ^
a.cc:12:35: note: in definition of macro 'rep'
   12 | #define rep(i, n) for (i32 i = 0; i < (i32)(n); ++i)
      |                                   ^
a.cc:47:21: error: expected ';' before 'j'
   47 |             for (i32 j = 1; j * j <= a[i]; ++j) {
      |                     ^~
      |                     ;
a.cc:47:29: error: 'j' was not declared in this scope
   47 |             for (i32 j = 1; j * j <= a[i]; ++j) {
      |                             ^
a.cc:63:8: error: expected ';' before 'k'
   63 |     i32 k = a[0];
      |        ^~
      |        ;
a.cc:64:9: error: expected ';' before 'i'
   64 |     rep(i,n){
      |         ^
a.cc:12:28: note: in definition of macro 'rep'
   12 | #define rep(i, n) for (i32 i = 0; i < (i32)(n); ++i)
      |                            ^
a.cc:64:9: error: 'i' was not declared in this scope
   64 |     rep(i,n){
      |         ^
a.cc:12:35: note: in definition of macro 'rep'
   12 | #define rep(i, n) for (i32 i = 0; i < (i32)(n); ++i)
      |                                   ^
a.cc:65:9: error: 'k' was not declared in this scope
   65 |         k = gcd(k,a[i]);
      |         ^
a.cc:67:12: error: expected ';' before 'i'
   67 |     for(i32 i = 2; i <= lim; ++1){
      |            ^~
      |            ;
a.cc:67:20: error: 'i' was not declared in this scope
   67 |     for(i32 i = 2; i <= lim; ++1){
      |                    ^
a.cc:67:32: error: lvalue required as increment operand
   67 |     for(i32 i = 2; i <= lim; ++1){
      |                                ^
a.cc:70:14: error: 'k' was not declared in this scope
   70 |     if(as && k == 1){
      |              ^