Buggy python submission (verdict: Runtime Error):
import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**3
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    used = [False] * 1000
    ans = True
    for x in arr:
        for p in primes:
            while x % p == 0:
                if used[p]:
                    ans = False
                    return ans
                while x % p == 0:
                    x //= p
                used[p] = True
    return ans


ans1 = np.all([sum(cnt[i::i]) <= 1 for i in range(2, 10**6+1)])


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif ans1:
    print("pairwise coprime")
else:
    print("setwise coprime")

Fixed submission:
import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**6 + 1
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    cnt = np.bincount(arr)
    for p in primes:
        if (cnt[p::p]).sum() > 1:
            return False
    else:
        return True


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif solve(arr, primes):
    print("pairwise coprime")
else:
    print("setwise coprime")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


n = int(input())
arr = np.array(list(map(int, input().split())))


def solve(arr):
    cnt = np.bincount(arr)
    return np.all([cnt[i::i].sum() <= 1 for i in range(2, 10**6+1)])


ans1 = solve(arr)
ans2 = np.gcd.reduce(arr) == 1

if ans1 and ans2:
    print("pairwise coprime")
elif ans2:
    print("setwise coprime")
else:
    print("not coprime")

Fixed submission:
import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**6 + 1
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    cnt = np.bincount(arr)
    for p in primes:
        if (cnt[p::p]).sum() > 1:
            return False
    else:
        return True


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif solve(arr, primes):
    print("pairwise coprime")
else:
    print("setwise coprime")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**3 + 1
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)

used = [False] * 1002
ans1 = True
flg = False
for x in arr:
    for p in primes:
        while x > 1 and x % p == 0:
            if used[p]:
                ans1 = False
                flg = True
                break
            while x % p == 0:
                x //= p
            used[p] = True
        if flg:
            break
    if flg:
        break


ans2 = np.gcd.reduce(arr) == 1

if ans1 and ans2:
    print("pairwise coprime")
elif ans2:
    print("setwise coprime")
else:
    print("not coprime")

Fixed submission:
import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**6 + 1
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    cnt = np.bincount(arr)
    for p in primes:
        if (cnt[p::p]).sum() > 1:
            return False
    else:
        return True


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif solve(arr, primes):
    print("pairwise coprime")
else:
    print("setwise coprime")

Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = np.array(list(map(int, input().split())))


@njit
def solve(arr):
    for i in range(arr.shape[0] - 1):
        if np.gcd(arr[i], arr[i + 1]) != 1:
            ans1 = False
            break
    else:
        ans = True
    return ans


ans1 = solve(arr)
ans2 = np.gcd.reduce(arr) == 1

if ans1 and ans2:
    print("pairwise coprime")
elif ans2:
    print("setwise coprime")
else:
    print("not coprime")

Fixed submission:
import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**6 + 1
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    cnt = np.bincount(arr)
    for p in primes:
        if (cnt[p::p]).sum() > 1:
            return False
    else:
        return True


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif solve(arr, primes):
    print("pairwise coprime")
else:
    print("setwise coprime")

Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
arr = np.array(list(map(int, input().split())))

def solve()
for i in range(arr.shape[0] - 1):
    if np.gcd(arr[i], arr[i + 1]) != 1:
        ans1 = False
        break
else:
    ans1 = True

ans2 = np.gcd.reduce(arr) == 1

if ans1 and ans2:
    print("pairwise coprime")
elif ans2:
    print("setwise coprime")
else:
    print("not coprime")

Fixed submission:
import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**6 + 1
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    cnt = np.bincount(arr)
    for p in primes:
        if (cnt[p::p]).sum() > 1:
            return False
    else:
        return True


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif solve(arr, primes):
    print("pairwise coprime")
else:
    print("setwise coprime")

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
from collections import Counter

n = int(input())
arr = list(map(int, input().split()))

a = 1
result = []
for x in arr:
    y = gcd(a, x)
    result.append(y)
    a = a * x // y

if result.count(1) == len(arr):
    print("pairwise coprime")
    sys.exit()

if len(Counter(result[1:])) == 1:
    print("not coprime")
else:
    print("setwise coprime")

Fixed submission:
import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**6 + 1
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    cnt = np.bincount(arr)
    for p in primes:
        if (cnt[p::p]).sum() > 1:
            return False
    else:
        return True


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif solve(arr, primes):
    print("pairwise coprime")
else:
    print("setwise coprime")

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
import sys

n = int(input())
arr = list(map(int, input().split()))

a = 1
result = []
for x in arr:
    y = gcd(a, x)
    result.append(y)
    a = a * x // y


if result.count(1) == len(arr):
    print("pairwise coprime")
    sys.exit()

a = 1
result2 = []
for x in result[1:]:
    y = gcd(a, x)
    result2.append(y)
    a = a * x // y

if result2.count(1) == len(arr) - 1:
    print("setwise coprime")
else:
    print("not coprime")

Fixed submission:
import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**6 + 1
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    cnt = np.bincount(arr)
    for p in primes:
        if (cnt[p::p]).sum() > 1:
            return False
    else:
        return True


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif solve(arr, primes):
    print("pairwise coprime")
else:
    print("setwise coprime")

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
import sys

n = int(input())
arr = list(map(int, input().split()))

a = 1
result = []
for x in arr:
    y = gcd(a, x)
    result.append(y)
    a = a * x // y


if result.count(1) == len(arr):
    print("pairwise coprime")
    sys.exit()

a = 1
result2 = []
for x in result[1:]:
    y = gcd(a, x)
    result2.append(y)
    a = a * x // y

if result2.count(1) == len(arr) - 1:
    print("setwise coprime")
else:
    print("not coprime")

Fixed submission:
import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**6 + 1
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    cnt = np.bincount(arr)
    for p in primes:
        if (cnt[p::p]).sum() > 1:
            return False
    else:
        return True


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif solve(arr, primes):
    print("pairwise coprime")
else:
    print("setwise coprime")