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 cnt = 0;
        i32 k = 0;
        for(auto v:st){
            if(cnt == 0)k = v;
            else k = gcd(k,v);
        }
        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]);
    }

    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 'cnt'
   30 |         i32 cnt = 0;
      |            ^~~~
      |            ;
a.cc:31:12: error: expected ';' before 'k'
   31 |         i32 k = 0;
      |            ^~
      |            ;
a.cc:32:20: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   32 |         for(auto v:st){
      |                    ^~
      |                    std::begin
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:4:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:32:20: error: 'end' was not declared in this scope; did you mean 'std::end'?
   32 |         for(auto v:st){
      |                    ^~
      |                    std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
a.cc:33:16: error: 'cnt' was not declared in this scope; did you mean 'int'?
   33 |             if(cnt == 0)k = v;
      |                ^~~
      |                int
a.cc:33:25: error: 'k' was not declared in this scope
   33 |             if(cnt == 0)k = v;
      |                         ^
a.cc:34:18: error: 'k' was not declared in this scope
   34 |             else k = gcd(k,v);
      |                  ^
a.cc:36:12: error: 'k' was not declared in this scope
   36 |         if(k == 1){
      |            ^
a.cc:43:15: error: template argument 2 is invalid
   43 |     vector<i32>rec(lim + 1,0);
      |               ^
a.cc:43:20: error: 'lim' was not declared in this scope
   43 |     vector<i32>rec(lim + 1,0);
      |                    ^~~
a.cc:43:29: error: expression list treated as compound expression in initializer [-fpermissive]
   43 |     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:44:13: note: in expansion of macro 'all'
   44 |     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:44:13: note: in expansion of macro 'all'
   44 |     reverse(all(a));
      |             ^~~
a.cc:46:9: error: expected ';' before 'i'
   46 |     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:46:9: error: 'i' was not declared in this scope
   46 |     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:49:21: error: expected ';' before 'j'
   49 |             for (i32 j = 1; j * j <= a[i]; ++j) {
      |                     ^~
      |                     ;
a.cc:49:29: error: 'j' was not declared in this scope
   49 |             for (i32 j = 1; j * j <= a[i]; ++j) {
      |                             ^
a.cc:53:71: error: expected ')' before '{' token
   53 |                     if((rec[a[i] / j] >= 2 || (j != 1 && rec[j] >= 2)){
      |                       ~                                               ^
      |                                                                       )
a.cc:57:17: error: expected primary-expression before '}' token
   57 |                 }
      |                 ^
a.cc:65:8: error: expected ';' before 'k'
   65 |     i32 k = a[0];
      |        ^~
      |        ;
a.cc:66:9: error: expected ';' before 'i'
   66 |     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:66:9: error: 'i' was not declared in this scope
   66 |     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:67:9: error: 'k' was not declared in this scope
   67 |         k = gcd(k,a[i]);
      |         ^
a.cc:70:14: error: 'k' was not declared in this scope
   70 |     if(as && k == 1){
      |              ^