Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define fori(a,b) for(int i=a;i<b;i++)
#define forj(a,b) for(int j=a;j<b;j++)
#define ford(b,a) for(int i=b;i>=a;i--)
typedef pair<int, int> pi;
#define PI 3.14159265359
#define vi vector<int>
long long mod=1000000007;
//int count=INT_MAX;
 
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};
// int gcd(int a, int b){ 
//     if (a == 0LL) 
//         return b;  
//     return gcd(b % a, a);  
// } 
set<int> m;
int primeFactors(int n)  
{  
    // Print the number of 2s that divide n  
    //vi ans;
    //int x=n;
    if(n%2==0){  
        if(m.find(2)!=m.end()){
            //cout<<2<<"@ ";
            return 0;
        }
        else{
            //cout<<2<<" ";
            m.insert(2);
        }
    } 
    while (n % 2 == 0)  
    {  
        
        //ans.pb(2);//cout << 2 << " ";  
        n = n/2;  
    }
       
    // n must be odd at this point. So we can skip  
    // one element (Note i = i +2)  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        if(n%i==0){
            if(m.find(i)!=m.end()){
               // cout<<i<<" ";
                return 0;
            }
            else{
                //cout<<i<<" ";
                m.insert(i);
            }
        } 
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            
            //ans.pb(i);//cout << i << " ";  
            n = n/i;  
        }  
           
    }  
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2){
        if(m.find(n)!=m.end()){
            //cout<<n<<"# ";
            return 0;
        }
        else{
            //cout<<n<<" ";
            m.insert(n);
        }
    }  
        //ans.pb(n);//cout << n << " ";
    return 1;
    //sort(ans.begin(),ans.end());    
    //return ans;      
} 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int testcases=1;
    //cin>>testcases;
    //cout<<t;
    //scanf("%d",&t);
    //int t=testcases;
    while(testcases--){
        int n;
        cin>>n;
        int a[n];
        //set<int> s;
        m.clear();
        int tmp=0;
        fori(0,n){
            cin>>a[i];
            // if(s.find(a[i])!=s.end()){
            //     tmp=1;
            // }
            // else{
            //     s.insert(a[i]);
            // }
        }
        // if(tmp){
        //     cout<<"not coprime\n";
        //     continue;
        // }
        //set<vi> m;
        int pc=1;
        int sc=1;
        //int tmp=0;
        fori(0,n){
            //cout<<"(";
            int t=primeFactors(a[i]);
            //cout<<")";
            if(!t){
                pc=0;
                break;
            }
            // if(m.find(t)!=m.end()){
            //     pc=0;
            // }
            // else{
            //     m.insert(t);
            // }
        }
        m.clear();
        if(pc){
            cout<<"pairwise coprime\n";
            continue;
        }
        int g=a[0];
        fori(1,n){
            g=__gcd(g,a[i])//gcd(max(g,a[i]),min(g,a[i]));

        }
        if(g==1){
            cout<<"setwise coprime\n";
        }
        else{
            cout<<"not coprime\n";
        }
    }               

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:148:28: error: expected ';' before '}' token
  148 |             g=__gcd(g,a[i])//gcd(max(g,a[i]),min(g,a[i]));
      |                            ^
      |                            ;
  149 | 
  150 |         }
      |         ~