Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

//「オイラーのふるい」。pnには素数の数が、primesには順番に素数が、
//eulnumsにはその整数を割り切る最小の素数が入る。
//ある数からeulnumsを割っていくとその数の素因数分解が可能。
int pn = 0;
int primes[1600000];
int eulnums[1600000];

void eulerprime(int n) {
    fill(eulnums, eulnums + n + 1, 0);
    for (int i = 2; i <= n; i++) {
        if (eulnums[i] == 0) {
            eulnums[i] = i;
            primes[pn] = i;
            pn++;
        }

        for (int j = 0; i * primes[j] <= n; j++) {
            eulnums[i * primes[j]] = primes[j];
            if (i % primes[j] == 0) {
                break;
            }
        }
    }
}

bool bo[1000010];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A[N];
    REP(i, 0, N) {
        cin >> A[i];
    }
    ll setg = A[0];
    REP(i, 0, N) {
        setg = gcd(setg, A[i]);
    }
    if (setg > 1) {
        cout << "not coprime" << endl;
        return 0;
    }
    eulerprime(1000010);
    bool ok = true;
    REP(i, 0, N) {
        while (A[i] != 1) {
            ll p = eulnums[A[i]];
            if (bo[p]) {
                ok = false;
                break;
            }
            while (A[i] % p == 0) {
                A[i] /= p;
            }
            bo[p] = true;
        }
        if (!ok) {
            break;
        }
    }
    yesno(ok, "pairwise coprime", "setwise coprime");
}
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

//「オイラーのふるい」。pnには素数の数が、primesには順番に素数が、
//eulnumsにはその整数を割り切る最小の素数が入る。
//ある数からeulnumsを割っていくとその数の素因数分解が可能。
int pn = 0;
int primes[1600000];
int eulnums[1600000];

void eulerprime(int n) {
    fill(eulnums, eulnums + n + 1, 0);
    for (int i = 2; i <= n; i++) {
        if (eulnums[i] == 0) {
            eulnums[i] = i;
            primes[pn] = i;
            pn++;
        }

        for (int j = 0; i * primes[j] <= n; j++) {
            eulnums[i * primes[j]] = primes[j];
            if (i % primes[j] == 0) {
                break;
            }
        }
    }
}

bool bo[1000010];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A[N];
    REP(i, 0, N) {
        cin >> A[i];
    }
    ll setg = A[0];
    REP(i, 0, N) {
        setg = gcd(setg, A[i]);
    }
    if (setg > 1) {
        cout << "not coprime" << endl;
        return 0;
    }
    eulerprime(1000010);
    bool ok = true;
    REP(i, 0, N) {
        while (A[i] != 1) {
            ll p = eulnums[A[i]];
            if (bo[p]) {
                ok = false;
                break;
            }
            while (A[i] % p == 0) {
                A[i] /= p;
            }
            bo[p] = true;
        }
        if (!ok) {
            break;
        }
    }
    yesno(ok, "pairwise coprime", "setwise coprime");
}


Compiler output:
a.cc:170:5: error: redefinition of 'int dx [4]'
  170 | int dx[4] = {1, 0, -1, 0};
      |     ^~
a.cc:44:5: note: 'int dx [4]' previously defined here
   44 | int dx[4] = {1, 0, -1, 0};
      |     ^~
a.cc:171:5: error: redefinition of 'int dy [4]'
  171 | int dy[4] = {0, 1, 0, -1};
      |     ^~
a.cc:45:5: note: 'int dy [4]' previously defined here
   45 | int dy[4] = {0, 1, 0, -1};
      |     ^~
a.cc:172:8: error: redefinition of 'double pi'
  172 | double pi = 3.141592653589793;
      |        ^~
a.cc:46:8: note: 'double pi' previously defined here
   46 | double pi = 3.141592653589793;
      |        ^~
a.cc:173:4: error: redefinition of 'll mod'
  173 | ll mod = 1000000007;
      |    ^~~
a.cc:47:4: note: 'll mod' previously defined here
   47 | ll mod = 1000000007;
      |    ^~~
a.cc:174:5: error: redefinition of 'int intmax'
  174 | int intmax = 2147483647;
      |     ^~~~~~
a.cc:48:5: note: 'int intmax' previously defined here
   48 | int intmax = 2147483647;
      |     ^~~~~~
a.cc:175:5: error: redefinition of 'int intmin'
  175 | int intmin = -2147483648;
      |     ^~~~~~
a.cc:49:5: note: 'int intmin' previously defined here
   49 | int intmin = -2147483648;
      |     ^~~~~~
a.cc:176:4: error: redefinition of 'll llmax'
  176 | ll llmax = 9223372036854775807;
      |    ^~~~~
a.cc:50:4: note: 'll llmax' previously defined here
   50 | ll llmax = 9223372036854775807;
      |    ^~~~~
a.cc:177:4: error: redefinition of 'll llmin'
  177 | ll llmin = -9223372036854775807;
      |    ^~~~~
a.cc:51:4: note: 'll llmin' previously defined here
   51 | ll llmin = -9223372036854775807;
      |    ^~~~~
a.cc:178:5: error: redefinition of 'int iinf'
  178 | int iinf = intmax / 8;
      |     ^~~~
a.cc:52:5: note: 'int iinf' previously declared here
   52 | int iinf = intmax / 8;
      |     ^~~~
a.cc:179:4: error: redefinition of 'll inf'
  179 | ll inf = llmax / 8;
      |    ^~~
a.cc:53:4: note: 'll inf' previously declared here
   53 | ll inf = llmax / 8;
      |    ^~~
a.cc:180:8: error: redefinition of 'double eps'
  180 | double eps = 1e-12;
      |        ^~~
a.cc:54:8: note: 'double eps' previously defined here
   54 | double eps = 1e-12;
      |        ^~~
a.cc:181:6: error: redefinition of 'void yesno(bool, std::string, std::string)'
  181 | void yesno(bool ok, string yes = "Yes", string no = "No") {
      |      ^~~~~
a.cc:55:6: note: 'void yesno(bool, std::string, std::string)' previously defined here
   55 | void yesno(bool ok, string yes = "Yes", string no = "No") {
      |      ^~~~~
a.cc:192:5: error: redefinition of 'int pn'
  192 | int pn = 0;
      |     ^~
a.cc:66:5: note: 'int pn' previously defined here
   66 | int pn = 0;
      |     ^~
a.cc:193:5: error: redefinition of 'int primes [1600000]'
  193 | int primes[1600000];
      |     ^~~~~~
a.cc:67:5: note: 'int primes [1600000]' previously declared here
   67 | int primes[1600000];
      |     ^~~~~~
a.cc:194:5: error: redefinition of 'int eulnums [1600000]'
  194 | int eulnums[1600000];
      |     ^~~~~~~
a.cc:68:5: note: 'int eulnums [1600000]' previously declared here
   68 | int eulnums[1600000];
      |     ^~~~~~~
a.cc:196:6: error: redefinition of 'void eulerprime(int)'
  196 | void eulerprime(int n) {
      |      ^~~~~~~~~~
a.cc:70:6: note: 'void eulerprime(int)' previously defined here
   70 | void eulerprime(int n) {
      |      ^~~~~~~~~~
a.cc:214:6: error: redefinition of 'bool bo [1000010]'
  214 | bool bo[1000010];
      |      ^~
a.cc:88:6: note: 'bool bo [1000010]' previously declared here
   88 | bool bo[1000010];
      |      ^~
a.cc:216:5: error: redefinition of 'int main()'
  216 | int main() {
      |     ^~~~
a.cc:90:5: note: 'int main()' previously defined here
   90 | int main() {
      |     ^~~~