Language: C++

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
#include <assert.h>
#include <unordered_set>
 
struct Vector {
    int size, lastptr, *array;
};
void init(struct Vector* vector, int n) {
    vector->array = (int *) calloc (n, sizeof(int));
    vector->size = n;
    vector->lastptr = 0;
    assert(vector->array && "init broken");
}
void resize(struct Vector* vector) {
    vector->array = (int *) realloc(vector->array, 2*vector->size);
    vector->size *= 2;
}
void push_back(struct Vector* vector, int a) {
    if (vector->lastptr == vector->size) {
        resize(vector);
        push_back(vector, a);
    } else {
        vector->array[vector->lastptr++] = a;
    }
}
//void delete(struct Vector* vector) {free(vector->array);}
int gcd(int a, int b) {if (b == 0) {return a;}return gcd(b, a%b);}
 
bool pairwise=true, setwise=false;
int pot[1000001], N, arr[1000000];
bool vis[1000001];
bool chk[1000001];
void sieve() {
    int i, j;
    pot[0]=1;
    pot[1]=1;
    for (i=2; i <= 1000000; i+=2) {
        pot[i] = 2;
    }
    for (i=3; i <= 1000000; i+=2) {
        if (!pot[i]) {
            for (j=1; i*j <= 1000000; j++) {
                if (!pot[i*j]) {
                    pot[i*j] = i;
                }
            }
        }
    }
}
int main(void) {
    sieve();
    scanf("%d", &N);
    int i;
    for (i=0; i < N; ++i) {
        scanf("%d", arr+i);
    }
    int pairgcd = gcd(arr[0], arr[1]);
    for (i=2; i < N; i++) {
        pairgcd = gcd(pairgcd, arr[i]);
    }
    if (pairgcd == 1) setwise=true;
    //struct Vector vec[N];
    unordered_set<int> st[N];
    for (i=0; i < N; i++) {
        int x = *(arr+i);
        memset(chk, false, sizeof(chk));
        //init(&vec[i], 1000001);
        while(x > 1) {
            st[i].insert(pot[x]);
            x /= pot[x];
        }
        int j=0;
        /*for (j=0; j < vec[i].lastptr; j++) {
            if (vis[vec[i].array[j]]) {
                pairwise = false;
            }
            vis[vec[i].array[j]] = true;
        }*/
      	for (int num: st[i]) {
          if (vis[num]) {
            pairwise=false;
          }
          vis[num] = true;
        }
        //delete(&vec[i]);
    }
    if (pairwise) {
        printf("pairwise coprime\n");
    } else if (setwise) {
        printf("setwise coprime\n");
    } else {
        printf("not coprime\n");
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:5: error: 'unordered_set' was not declared in this scope
   68 |     unordered_set<int> st[N];
      |     ^~~~~~~~~~~~~
a.cc:68:5: note: suggested alternatives:
In file included from /usr/include/c++/14/unordered_set:41,
                 from a.cc:8:
/usr/include/c++/14/bits/unordered_set.h:104:11: note:   'std::unordered_set'
  104 |     class unordered_set
      |           ^~~~~~~~~~~~~
/usr/include/c++/14/unordered_set:65:13: note:   'std::pmr::unordered_set'
   65 |       using unordered_set
      |             ^~~~~~~~~~~~~
a.cc:68:19: error: expected primary-expression before 'int'
   68 |     unordered_set<int> st[N];
      |                   ^~~
a.cc:74:13: error: 'st' was not declared in this scope; did you mean 'std'?
   74 |             st[i].insert(pot[x]);
      |             ^~
      |             std
a.cc:84:23: error: 'st' was not declared in this scope; did you mean 'std'?
   84 |         for (int num: st[i]) {
      |                       ^~
      |                       std