Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORit(it,a) for(auto it=a.begin();it!=a.end();it++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define vec vector
#define pb push_back
#define pop pop_back
#define all(x) x.begin(),x.end()
#define testcases ll t;cin>>t;while(t--)
#define mem(a,k) memset(a,k,sizeof(a))
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define rt return
#define br break
#define ct continue
#define elif else if
#define ii pair<ll,ll>
#define arrin(a,n,index) for(int i=index;i<n;i++)cin>>a[i]
#define vecin(a,n,index) for(int i=index;i<n;i++)cin>>a[i]
#define arrout(a,n,index) for(int i=index;i<n;i++)cout<<a[i]<<" ";cout<<endl;
#define vecout(a,n,index) for(int i=index;i<n;i++)cout<<a[i]<<" ";cout<<endl;
//ll mod = 1000000007;
int s[1000001] = {0};
int visit[1000001] = {0};
void sieve() {
	int maxn = 1000000;
	for (int i = 1; i <= maxn; i++)s[i] = -1;
	for (int i = 2; i <= maxn; i++) {
		if (s[i] == -1) {
			for (int j = i; j <= maxn; j += i) {
				if (s[j] == -1)s[j] = i;
			}
		}
	}

}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	// START FROM HERE :)
	sieve();
	int n; cin >> n; int a[n]; arrin(a, n, 0);
	int setg = a[0], flag = 1;
	//bitset <1000001> f[n];
	FOR(i, 1, n)setg = __gcd(setg, a[i]);
	FOR(i, 0, n) {
		while (a[0] != 1) {
			visit[s[a[0]]] = 1;
			a[0] /= s[a[0]];
		}
	}
	FOR(i, 1, n) {
		vec <int> v;
		while (a[i] != 1) {
			if (binary_search(all(v), s[a[i]]) == false)v.pb(s[a[i]]);
			a[i] /= s[a[i]];
		}
		FOR(k, 0, v.size()) {
			if (visit[v[k]] == 0)visit[v[k]] = 1;
			else flag = 0;

		}
		if (flag == 0)br;

	}
	if (flag == 1)cout << "pairwise coprime\n";
	elif(flag == 0 && setg == 1)cout << "setwise coprime\n";
	else cout << "not coprime\n";

}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:25: error: reference to 'visit' is ambiguous
   55 |                         visit[s[a[0]]] = 1;
      |                         ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:27:5: note:                 'int visit [1000001]'
   27 | int visit[1000001] = {0};
      |     ^~~~~
a.cc:66:29: error: reference to 'visit' is ambiguous
   66 |                         if (visit[v[k]] == 0)visit[v[k]] = 1;
      |                             ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:27:5: note:                 'int visit [1000001]'
   27 | int visit[1000001] = {0};
      |     ^~~~~
a.cc:66:46: error: reference to 'visit' is ambiguous
   66 |                         if (visit[v[k]] == 0)visit[v[k]] = 1;
      |                                              ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:27:5: note:                 'int visit [1000001]'
   27 | int visit[1000001] = {0};
      |     ^~~~~