stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
/*

 * Author: Dumbear

 * Created Time:  2011/8/31 12:33:48

 * File Name: A.cpp

 */

#include <iostream>

#include <cstdio>

#include <cstring>

#include <cmath>

#include <cstdlib>

#include <algorithm>

#include <vector>

using namespace std;

#define out(v) cerr << #v << ": " << (v) << endl

#define SZ(v) ((int)(v).size())

const int maxint = -1u>>1;

template <class T> bool get_max(T& a, const T &b) {return b > a? a = b, 1: 0;}

template <class T> bool get_min(T& a, const T &b) {return b < a? a = b, 1: 0;}



int n, m, s[110];



bool solve();



int main() {

    while (solve());

    return 0;

}



bool solve() {

    scanf("%d%d", &n, &m);

    if (n == 0 && m == 0)

        return false;

    for (int i = 0; i < m; ++i)

        scanf("%d", &s[i]);

    for (int i = 0; i < n; ++i) {

        for (int j = 0; j < m; ++j) {

            int c;

            scanf("%d", &c);

            s[j] -= c;

        }

    }

    for (int i = 0; i < m; ++i)

        if (s[i] < 0) {

            puts("No");

            return true;

        }

    puts("Yes");

    return true;

}

// Optimized solution to the same problem (faster):
#include<cstdio>



int s[110],n,m;



int main()

{

    int i,j,k,l;

    bool pass;

    while (1)

    {

        scanf("%d%d",&n,&m);

        if (n==0&&m==0) break;

        for (i=0;i<m;i++)

            scanf("%d",&s[i]);

        for (i=0;i<n;i++)

            for (j=0;j<m;j++)

            {

                scanf("%d",&k);

                s[j]-=k;

            }

        pass=true;

        for (i=0;i<m;i++)

            if (s[i]<0)

            {

                pass=false;

                break;

            }

        if (pass) printf("Yes\n");

        else printf("No\n");

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
/*

 * Author: FreePascal

 * Created Time:  2011-8-31 12:36:01

 * File Name: a.cpp

 */

#include <iostream>

#include <cstdio>

#include <cstring>

#include <cmath>

#include <cstdlib>

#include <algorithm>

#include <vector>

#include <queue>

#include <map>

#include <set>

#include <deque>

#include <list>

#include <stack>

using namespace std;

#define out(v) cerr << #v << ": " << (v) << endl

#define SZ(v) ((int)(v).size())

const int maxint = -1u>>1;

template <class T> bool get_max(T& a, const T &b) {return b > a? a = b, 1: 0;}

template <class T> bool get_min(T& a, const T &b) {return b < a? a = b, 1: 0;}



const int maxn = 1000 + 100;

int n,m,s[maxn],b[maxn][maxn];

int main() {

    while (scanf("%d%d",&n,&m) != EOF){

        if (n == 0 && m == 0) break;

        for (int i = 0; i < m; i++) scanf("%d",&s[i]);

        for (int i = 0; i < n; i++)

            for (int j = 0; j < m; j++) scanf("%d",&b[i][j]);

        bool flag = true;

        for (int i = 0; i < m; i++){

            int sum = 0;

            for (int j = 0; j < n; j++) sum += b[j][i];

            if (sum > s[i]) {

                flag = false;

                break;

            }

        }

        if (!flag) puts("No");

        else puts("Yes");

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>



int s[110],n,m;



int main()

{

    int i,j,k,l;

    bool pass;

    while (1)

    {

        scanf("%d%d",&n,&m);

        if (n==0&&m==0) break;

        for (i=0;i<m;i++)

            scanf("%d",&s[i]);

        for (i=0;i<n;i++)

            for (j=0;j<m;j++)

            {

                scanf("%d",&k);

                s[j]-=k;

            }

        pass=true;

        for (i=0;i<m;i++)

            if (s[i]<0)

            {

                pass=false;

                break;

            }

        if (pass) printf("Yes\n");

        else printf("No\n");

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

	int N,K;

	while(1)

	{

		cin >> N;

		cin >> K;

		int temp;

		if(N == 0 && K==0)break;

		int *A = new int[K];

		int *B = new int[K];

		bool flag = true;

		for(int i=0;i<K;i++)

		{

			B[i] = 0;

		}

		for(int i=0;i<K;i++)

		{

			cin >> A[i];

		}

		for(int i=0;i<N;i++)

		{

			for(int i=0;i<K;i++)

			{

				cin >> temp;

				B[i] += temp;

			}

		}

		for(int i=0;i<K;i++)

		{

			if(B[i]>A[i])

			{

				flag = false;

				break;

			}

		}

		if(flag == false)

		{

			cout << "No" << endl;

		}

		else

		{

			cout << "Yes" << endl;

		}

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>



int s[110],n,m;



int main()

{

    int i,j,k,l;

    bool pass;

    while (1)

    {

        scanf("%d%d",&n,&m);

        if (n==0&&m==0) break;

        for (i=0;i<m;i++)

            scanf("%d",&s[i]);

        for (i=0;i<n;i++)

            for (j=0;j<m;j++)

            {

                scanf("%d",&k);

                s[j]-=k;

            }

        pass=true;

        for (i=0;i<m;i++)

            if (s[i]<0)

            {

                pass=false;

                break;

            }

        if (pass) printf("Yes\n");

        else printf("No\n");

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main(){

	int N,K,i,j,*S,B,a;

	while(a=1,cin>>N>>K,N||K){

		S=new int[K];

		for(i=K;i--;)cin>>S[i];

		for(i=0;i<N;++i)for(j=K;j--;)cin>>B,S[j]-=B,S[j]<0?a=0:0;

		cout<<(a?"Yes":"No")<<endl;

	}

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int N,K,i,j,S[100],B,a;

	while(a=1,scanf("%d %d",&N,&K),N||K){

		for(i=K;i--;)scanf("%d",S+i);

		for(i=N;i--;)for(j=K;j--;)scanf("%d",&B),S[j]-=B,S[j]<0?a=0:0;

		puts(a?"Yes":"No");

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main(){

	int N,K,i,j,*S,B,a;

	while(a=1,cin>>N>>K,N||K){

		S=new int[K];

		for(i=K;i--;)cin>>S[i];

		for(i=N;i--;)for(j=K;j--;)cin>>B,S[j]-=B,S[j]<0?a=0:0;

		cout<<(a?"Yes":"No")<<endl;

	}

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int N,K,i,j,S[100],B,a;

	while(a=1,scanf("%d %d",&N,&K),N||K){

		for(i=K;i--;)scanf("%d",S+i);

		for(i=N;i--;)for(j=K;j--;)scanf("%d",&B),S[j]-=B,S[j]<0?a=0:0;

		puts(a?"Yes":"No");

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main(){

	int N,K,i,j,S[100],B,a;

	while(a=1,cin>>N>>K,N||K){

		for(i=K;i--;)cin>>S[i];

		for(i=N;i--;)for(j=K;j--;)cin>>B,S[j]-=B,S[j]<0?a=0:0;

		cout<<(a?"Yes":"No")<<endl;

	}

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int N,K,i,j,S[100],B,a;

	while(a=1,scanf("%d %d",&N,&K),N||K){

		for(i=K;i--;)scanf("%d",S+i);

		for(i=N;i--;)for(j=K;j--;)scanf("%d",&B),S[j]-=B,S[j]<0?a=0:0;

		puts(a?"Yes":"No");

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<vector>

#include<list>

#include<algorithm>

#include<iostream>

#include<string>

#include<cstdio>

#include<cstdlib>

#include<cstring>

#include<cmath>

using namespace std;

int main(){

  int i,j;

  int s[100],b,m,n;

  while(cin>>n>>m&&n+m){

    for(i=0;i<m;i++)

      cin>>s[i];

    for(i=0;i<n;i++){

      for(j=0;j<m;j++){

	cin>>b;

	s[j]-=b;

      }

    }

    for(i=0;i<m;i++){

      if(s[i]<0)

	break;

    }

    if(i==m)

      cout<<"Yes"<<endl;

    else

      cout<<"No"<<endl;

  }

  return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int main(){

  int h,i,j;

  int n,m;

  while(scanf("%d%d",&n,&m),n||m){

    int s[100];

    for(i=0;i<m;++i)

      scanf("%d",s+i);

    h=1;

    for(i=0;i<n;++i){

      for(j=0;j<m;++j){

	int b;

	scanf("%d",&b);

	if(h){

	  s[j]-=b;

	  if(s[j]<0)

	    h=0;

	}

      }

    }

    if(h)

      puts("Yes");

    else

      puts("No");

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int n, m, x, s[100];

int main() {

	while(cin >> n >> m, n + m) {

		for(int i = 0; i < m; i++) cin >> s[i];

		for(int i = 0; i < n; i++) {

			for(int j = 0; j < m; j++) cin >> x, s[j] -= x;

		}

		int f = 1;

		for(int i = 0; i < m; i++) {

			if(s[i] < 0) f = 0;

		}

		cout << (f ? "Yes" : "No") << endl;

	}

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

int n, m, x, s[100];

int main() {

	while(scanf("%d%d", &n, &m), n + m) {

		for(int i = 0; i < m; i++) scanf("%d", s + i);

		for(int i = 0; i < n; i++) {

			for(int j = 0; j < m; j++) scanf("%d", &x), s[j] -= x;

		}

		int f = 1;

		for(int i = 0; i < m; i++) {

			if(s[i] < 0) f = 0;

		}

		puts(f ? "Yes" : "No");

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

using namespace std;



int main(){

	int n, k, s, b;

	

	while( cin >> n >> k , n || k ){

		vector<int> S;

		for(int i=0 ; i<k ; i++ ){

			cin >> s;

			S.push_back(s);

		}

		for(int i=0 ; i<n ; i++ ){

			for(int j=0 ; j<k ; j++ ){

				cin >> b;

				S[j] -= b;

			}

		}

		bool flag = true;

		for(int i=0 ; i<k ; i++ ){

			if( S[i] < 0 ){

				flag = false;

			}

		}

		cout << ( (flag)? "Yes" : "No" ) << endl;

	}

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

using namespace std;



int main(){

	int n,k,b,s[101],i,j;

	

	for(;scanf("%d%d",&n,&k),n|k;){

		for(i=0;i<k;i++)

			scanf("%d",s+i);

		for(i=0;i<n;i++){

			for(j=0;j<k;j++){

				scanf("%d",&b);

				s[j]-=b;

			}

		}

		b=1;

		for(i=0;i<k;)

			if(s[i++]<0)

				b=0;

		puts(b?"Yes":"No");

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstring>

#include <iostream>

using namespace std;

const int maxn = 1e6 + 5;

int vis[maxn], prime[maxn], notPrime[maxn], num[maxn];

int total, n, maxx = 0, ans = 0, tmp;

void getPrime(int sum) {

    for (int i = 2; i <= sum; i++) {

        if (!notPrime[i]) {

            prime[++total] = i;

        }

        for (int j = 1; prime[j] * i <= sum; j++) {

            notPrime[i * prime[j]] = prime[j];

            if (i % prime[j] == 0)

                break;

        }

    }

}



void getInit() {

    memset(vis, 0, sizeof(vis));

    memset(notPrime, 0, sizeof(notPrime));

    memset(vis, 0, sizeof(vis));

}



int main() {

    getInit();

    scanf("%d", &n);

    for (int i = 1; i <= n; i++) {

        scanf("%d", &num[i]);

        maxx = max(maxx, num[i]);

    }

    getPrime(maxx);

    for (int i = 1; i <= n; i++) {

        while (notPrime[num[i]]) {

            tmp = notPrime[num[i]];

            vis[tmp]++;

            ans = max(ans, vis[tmp]);

            while (num[i] % tmp == 0)

                num[i] /= tmp;

        }

        if (num[i] != 1) {

            vis[num[i]]++;

            ans = max(ans, vis[num[i]]);

        }

    }

    if (ans <= 1)

        printf("pairwise coprime\n");

    else if (ans < n)

        printf("setwise coprime\n");

    else

        printf("not coprime\n");

    getchar();

    getchar();

    return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

int n,arr[1000005],p[1000005],d;

int main()

{

	cin>>n;

	for(int i=1;i<=n;i++) cin>>arr[i];

	d=arr[1];

	for(int i=2;i<=n;i++) d=__gcd(d,arr[i]);

	if(d!=1) 

	{

		cout<<"not coprime"<<endl;

		return 0;

	}

	for(int i=1;i<=n;i++)

	{

		int k=arr[i];

		for(int j=1;j<=sqrt(k);j++)

		{

			if(k%j==0) 

			{

				if(j!=1&&p[j]==1||p[k/j]==1) 

				{

					cout<<"setwise coprime"<<endl;

					return 0;

				}

				p[j]++,p[k/j]++;

			}

		}

	}

	cout<<"pairwise coprime"<<endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define REP(i,p,n) for(ll i=p;i<ll(n);++i)

#define rep(i,n) REP(i,0,n)



using ll = long long;

using pll = pair<ll, ll>;



const ll MAXN = 1000001;

bool P[MAXN];

bool S[MAXN];



template<typename T> T gcdraw(T a, T b) { return a ? gcdraw(b%a, a) : b; }

template<typename T> T gcd(T a, T b)

{

    const auto aa = abs(a), bb = abs(b);

    return aa > bb ? gcdraw(aa, bb) : gcdraw(bb, aa);

}



int main()

{

    ll N;

    cin >> N;



    vector<ll> A(N);

    rep (i, N) { cin >> A[i]; }



    vector<ll> PS = { 1, 2 };

    for (ll i=3;i*i<=MAXN;i+=2) if (!P[i])

    {

        for (ll j=2*i;j<=MAXN;j+=i) { P[j] = true; }

        PS.emplace_back(i);

    }



    bool isPairwise = true;



    ll cur = A[0];



    for (ll i=0;i<N;++i)

    {

        if (isPairwise) for (const auto& p: PS)

        {

            if (A[i] < p * p) { break; }

            if (A[i] % p) { continue; }



            const auto x = p;

            const auto y = A[i] / p;



            if (x != 1 && S[x]) { isPairwise = false; }

            if (y != 1 && S[y]) { isPairwise = false; }



            S[x] = true;

            S[y] = true;

        }



        cur = gcd(cur, A[i]);

    }



    const auto isSetwise = cur == 1;



    if (isPairwise)     { cout << "pairwise coprime" << endl; }

    else if (isSetwise) { cout << "setwise coprime" << endl; }

    else                { cout << "not coprime" << endl; }



    return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



#define REP(i,p,n) for(ll i=p;i<ll(n);++i)

#define rep(i,n) REP(i,0,n)



using ll = long long;

using pll = pair<ll, ll>;



const ll MAXN = 1000001;

bool P[MAXN];

bool S[MAXN];



template<typename T> T gcdraw(T a, T b) { return a ? gcdraw(b%a, a) : b; }

template<typename T> T gcd(T a, T b)

{

    const auto aa = abs(a), bb = abs(b);

    return aa > bb ? gcdraw(aa, bb) : gcdraw(bb, aa);

}



int main()

{

    ll N;

    cin >> N;



    vector<ll> A(N);

    rep (i, N) { cin >> A[i]; }



    vector<ll> PS = { 1, 2 };

    for (ll i=3;i*i<=MAXN;i+=2) if (!P[i])

    {

        for (ll j=2*i;j*j<=MAXN;j+=i) { P[j] = true; }

        PS.emplace_back(i);

    }



    bool isPairwise = true;



    ll cur = A[0];



    for (ll i=0;i<N;++i)

    {

        if (isPairwise) for (const auto& p: PS)

        {

            if (A[i] < p * p) { break; }

            if (A[i] % p) { continue; }



            const auto x = p;

            const auto y = A[i] / p;



            if (x != 1 && S[x]) { isPairwise = false; }

            if (y != 1 && S[y]) { isPairwise = false; }



            S[x] = true;

            S[y] = true;

        }



        cur = gcd(cur, A[i]);

    }



    const auto isSetwise = cur == 1;



    if (isPairwise)     { cout << "pairwise coprime" << endl; }

    else if (isSetwise) { cout << "setwise coprime" << endl; }

    else                { cout << "not coprime" << endl; }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



map<long, long> pf(long n) {

  map<long, long> ma;

  for (long i = 2; i * i <= n; i++) {

    while (n % i == 0) ma[i]++, n /= i;

  }

  if (n != 1) ma[n]++;

  return ma;

}



int main() {

  cin.tie(nullptr);

  ios::sync_with_stdio(false);

  long N;

  cin >> N;

  vector<long> A(N);

  for (long i = 0; i < N; i++) cin >> A.at(i);

  sort(A.begin(), A.end());

  bool diff1 = 0;

  for (long i = 1; i < N; i++) {

    if (A.at(i) - A.at(i - 1) == 1) diff1 = 1;

  }



  bool B = 1;

  vector<long> cnt(1e6+1);

  for (auto a : A) {

    for (auto [b, c] : pf(a)) {

      if (cnt.at(b)) B = 0;

      cnt.at(b) += c;

    }

  }

  if (B) return cout << "pairwise coprime" << "\n", 0;



  long G = 0;

  for (long i = 0; i < N; i++) {

    G = gcd(G, A.at(i));

  }



  if (G == 1) return cout << "setwise coprime" << "\n", 0;



  cout << "not coprime" << "\n";

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



int main() {

  cin.tie(nullptr);

  ios_base::sync_with_stdio(false);

  

  int N;

  cin >> N;

  vector<int> A(N);

  for (int i = 0; i < N; i++) cin >> A.at(i);



  int G = 0;

  for (auto a : A) G = gcd(G, a);

  if (G > 1) return cout << "not coprime" << "\n", 0;



  auto pf = [&](long n) {

    map<long, int> ret;

    for (long i = 2; i * i <= n; i++) {

      while (n % i == 0) ret[i]++, n /= i;

    }

    if (n != 1) ret[n]++;

    return ret;

  };



  vector<bool> B(1e6+1);

  for (int i = 0; i < N; i++) {

    for (auto [a, b] : pf(A.at(i))) {

      if (B.at(a)) return cout << "setwise coprime" << "\n", 0;

      else B.at(a) = true;

    }

  }

  cout << "pairwise coprime" << "\n";

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



map<long, long> pf(long n) {

  map<long, long> ma;

  for (long i = 2; i * i <= n; i++) {

    while (n % i == 0) ma[i]++, n /= i;

  }

  if (n != 1) ma[n]++;

  return ma;

}



int main() {

  cin.tie(nullptr);

  ios::sync_with_stdio(false);

  long N;

  cin >> N;

  vector<long> A(N);

  for (long i = 0; i < N; i++) cin >> A.at(i);



  bool B = 1;

  vector<long> cnt(1e6+1);

  for (auto a : A) {

    for (auto [b, c] : pf(a)) {

      if (cnt.at(b)) {

        B = 0;

        goto NG;

      }

      cnt.at(b)++;

    }

  }

  NG:;

  if (B) return cout << "pairwise coprime" << "\n", 0;



  long G = 0;

  for (long i = 0; i < N; i++) G = gcd(G, A.at(i));

  if (G == 1) cout << "setwise coprime" << "\n", 0;

  else cout << "not coprime" << "\n";

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



int main() {

  cin.tie(nullptr);

  ios_base::sync_with_stdio(false);

  

  int N;

  cin >> N;

  vector<int> A(N);

  for (int i = 0; i < N; i++) cin >> A.at(i);



  int G = 0;

  for (auto a : A) G = gcd(G, a);

  if (G > 1) return cout << "not coprime" << "\n", 0;



  auto pf = [&](long n) {

    map<long, int> ret;

    for (long i = 2; i * i <= n; i++) {

      while (n % i == 0) ret[i]++, n /= i;

    }

    if (n != 1) ret[n]++;

    return ret;

  };



  vector<bool> B(1e6+1);

  for (int i = 0; i < N; i++) {

    for (auto [a, b] : pf(A.at(i))) {

      if (B.at(a)) return cout << "setwise coprime" << "\n", 0;

      else B.at(a) = true;

    }

  }

  cout << "pairwise coprime" << "\n";

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



map<int, int> pf(int n) {

  map<int, int> ma;

  for (int i = 2; i * i <= n; i++) {

    while (n % i == 0) ma[i]++, n /= i;

  }

  if (n != 1) ma[n]++;

  return ma;

}



int main() {

  cin.tie(nullptr);

  ios::sync_with_stdio(false);

  int N;

  cin >> N;

  vector<int> A(N);

  for (int i = 0; i < N; i++) cin >> A.at(i);



  vector<int> cnt(1e6+1);

  for (auto a : A) {

    for (auto [b, c] : pf(a)) {

      if (cnt.at(b)) goto NG;

      cnt.at(b)++;

    }

  }

  return cout << "pairwise coprime" << "\n", 0;

  NG:;

  int G = 0;

  for (int i = 0; i < N; i++) G = gcd(G, A.at(i));

  if (G == 1) cout << "setwise coprime" << "\n", 0;

  else cout << "not coprime" << "\n";

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



int main() {

  cin.tie(nullptr);

  ios_base::sync_with_stdio(false);

  

  int N;

  cin >> N;

  vector<int> A(N);

  for (int i = 0; i < N; i++) cin >> A.at(i);



  int G = 0;

  for (auto a : A) G = gcd(G, a);

  if (G > 1) return cout << "not coprime" << "\n", 0;



  auto pf = [&](long n) {

    map<long, int> ret;

    for (long i = 2; i * i <= n; i++) {

      while (n % i == 0) ret[i]++, n /= i;

    }

    if (n != 1) ret[n]++;

    return ret;

  };



  vector<bool> B(1e6+1);

  for (int i = 0; i < N; i++) {

    for (auto [a, b] : pf(A.at(i))) {

      if (B.at(a)) return cout << "setwise coprime" << "\n", 0;

      else B.at(a) = true;

    }

  }

  cout << "pairwise coprime" << "\n";

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



map<int, int> pf(int n) {

  map<int, int> ma;

  for (int i = 2; i * i <= n; i++) {

    while (n % i == 0) ma[i]++, n /= i;

  }

  if (n != 1) ma[n]++;

  return ma;

}



int main() {

  cin.tie(nullptr);

  ios_base::sync_with_stdio(false);

  int N;

  cin >> N;

  vector<int> A(N);

  for (int i = 0; i < N; i++) cin >> A.at(i);



  vector<int> cnt(1e6+1);

  for (auto a : A) {

    for (auto [b, c] : pf(a)) {

      if (cnt.at(b)) goto NG;

      cnt.at(b)++;

    }

  }

  return cout << "pairwise coprime" << "\n", 0;

  NG:;

  int G = 0;

  for (int i = 0; i < N; i++) G = gcd(G, A.at(i));

  if (G == 1) cout << "setwise coprime" << "\n";

  else cout << "not coprime" << "\n";

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



int main() {

  cin.tie(nullptr);

  ios_base::sync_with_stdio(false);

  

  int N;

  cin >> N;

  vector<int> A(N);

  for (int i = 0; i < N; i++) cin >> A.at(i);



  int G = 0;

  for (auto a : A) G = gcd(G, a);

  if (G > 1) return cout << "not coprime" << "\n", 0;



  auto pf = [&](long n) {

    map<long, int> ret;

    for (long i = 2; i * i <= n; i++) {

      while (n % i == 0) ret[i]++, n /= i;

    }

    if (n != 1) ret[n]++;

    return ret;

  };



  vector<bool> B(1e6+1);

  for (int i = 0; i < N; i++) {

    for (auto [a, b] : pf(A.at(i))) {

      if (B.at(a)) return cout << "setwise coprime" << "\n", 0;

      else B.at(a) = true;

    }

  }

  cout << "pairwise coprime" << "\n";

}

// Fastest known solution for this problem: