Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().strip().split()))

m = len(bin(max(a))[2:])
t = [0] * (m)

for i in range(n):
    bin_str_i = [int(s) for s in list(bin(a[i])[2:])]
    l = len(bin_str_i)
    for j in range(l):
        t[m - j - 1] += bin_str_i[l - j - 1]
x = ''
for j in range(m):
    if t[j] % 2 == 0:
        x += '0'
    else:
        x += '1'

x = int(x, 2)
for i in range(n):
    ans = a[i] ^ x
    if i < n - 1:
        print(ans,end=' ')
    else:
        print(ans)



### FIXED CODE ###

n = int(input())
a = list(map(int, input().strip().split()))

x = 0
for i in range(n):
    x = x ^ a[i]
#print(bin(c))


#x = int(x, 2)
for i in range(n):
    ans = a[i] ^ x
    if i < n - 1:
        print(ans,end=' ')
    else:
        print(ans)
### BUGGY CODE ###

n=int(input())
A=list(map(int,input().split()))
m=float('inf')
for i in range(len(A)):
    m=min(m,abs(sum(A[0:i])-sum(A[i:n])))
print(m)


### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
ans=float('INF')
sa=[0]
for i,a in enumerate(A):
    sa.append(sa[i]+a)
for i in range(n+1):
    ans=min(ans,abs(sa[i]-(sa[-1]-sa[i])))
print(ans)
### BUGGY CODE ###

# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = list(map(int, input().split()))
    print(*[S.index(i + 1) + 1 for i in range(N)])


if __name__ == "__main__":
    main()


### FIXED CODE ###

# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))

    result = []
    for i, a in enumerate(A, start=1):
        result.append([i, a])
    result = sorted(result, key=lambda x: x[1])

    print(*[i for i, a in result])


if __name__ == "__main__":
    main()
### BUGGY CODE ###

from itertools import chain, combinations
import copy

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


def powerset(iterable):
    s = list(iterable)
    return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))


def is_mono(a):
    if len(a) < 2:
        return True
    for i in range(len(a) - 1):
        if a[i + 1] < a[i]:
            return False
    return True


def can_mono(a):
    for m in powerset(range(len(a))):
        b = copy.deepcopy(a)
        for i in m:
            b[i] -= 1
            if is_mono(b):
                return True
    return False


if can_mono(a):
    result = 'Yes'
else:
    result = 'No'
print("{}".format(result))

### FIXED CODE ###

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


def can_mono(a):
    len_a = len(a)
    for i in range(len_a - 2):
        if a[i + 1] < a[i] - 1:
            return False
        if a[i + 1] < a[i]:
            for j in range(i + 1, len_a - 1):
                if a[j + 1] < a[i + 1]:
                    return False
                if a[j + 1] > a[i + 1]:
                    break
                if a[j + 1] == a[i + 1]:
                    continue
    return True


if can_mono(a):
    result = 'Yes'
else:
    result = 'No'
print("{}".format(result))
### BUGGY CODE ###

S = input()
K = int(input())

N = len(S)

memo = set()
for i in range(N):
    for j in range(i, N):
        memo.add(S[i:j + 1])

print(sorted(memo)[K - 1])

### FIXED CODE ###

S = input()
K = int(input())

N = len(S)

memo = []
for i in range(N):
    for d in range(1, min(K, N - i) + 1):
        memo.append(S[i:i + d])

print(sorted(set(memo))[K - 1])
### BUGGY CODE ###

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

# print(a)
li = []
for i in range(1, n + 1):
    li.append(a.index(i) + 1)

    # print(a.index(i) + 1, end=" ")

print(*li)


### FIXED CODE ###

import numpy as np

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

npa = np.array(a)
print(*(np.argsort(npa) + 1))
### BUGGY CODE ###

inf = input().split()
N = int(inf[0])
M = int(inf[1])
cards = [int(a) for a in input().split()]
for i in range(M):
  inf = input().split()
  C = int(inf[0])
  B = int(inf[1])
  cards += [B]*C

cards.sort(reverse=True)

print(sum(cards[:N]))

### FIXED CODE ###

from collections import defaultdict
inf = input().split()
N = int(inf[0])
W = int(inf[1])
dic = defaultdict(int)

line = input().split()

for a in line:
    dic[int(a)] += 1

for w in range(W):
    inf = input().split()
    b = int(inf[0])
    c = int(inf[1])
    dic[c] += b
    
keys = list(dic.keys())

keys.sort(reverse=True)

count = 0
ans = 0
for k in keys:
    while dic[k]>0:
        if count == N:
            break
        ans += k
        dic[k] -= 1
        count += 1
    if count == N:
        break

print(ans)
### BUGGY CODE ###

n = int(input())
li = list(map(int,input().split()))
ans = 0
for i in range(n):
    if i > 0:
        while li[i-1] > li[i]:
            li[i]+=1
            ans += 1

print(ans)


### FIXED CODE ###

n = int(input())
li = list(map(int,input().split()))
ans = 0
for i in range(n):
    if i > 0:
        if  li[i-1] > li[i]:
            ans += li[i-1]-li[i]
            li[i] += (li[i-1]-li[i])

print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline


def main():
    H, W, K = map(int, input().split())
    cake = [[0]*W for _ in range(H)]
    sb = []
    for y in range(H):
        s = input().strip()
        for x, c in enumerate(s):
            if c == "#":
                sb.append((y, x))

    for i, (y, x) in enumerate(sb):
        cake[y][x] = i+1

    for i, (y, x) in enumerate(sb):
        for x in range(1, W):
            if cake[y][x] == 0:
                cake[y][x] = cake[y][x-1]
        for x in range(W-2, -1, -1):
            if cake[y][x] == 0:
                cake[y][x] = cake[y][x+1]

    for y in range(1, H):
        for x in range(W):
            if cake[y][x] == 0:
                cake[y][x] = cake[y-1][x]
    for y in range(H-2, -1, -1):
        for x in range(W):
            if cake[y][x] == 0:
                cake[y][x] = cake[y+1][x]

    for c in cake:
        print(*c)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    H, W, K = map(int, input().split())
    cake = [[0]*W for _ in range(H)]
    sb = []
    for y in range(H):
        s = input().strip()
        for x, c in enumerate(s):
            if c == "#":
                sb.append((y, x))
    for i, (y, x) in enumerate(sb):
        cake[y][x] = i + 1

    for i, s in enumerate(sb):
        i += 1
        y = s[0]
        x0 = x1 = s[1]
        for x in range(s[1]-1, -1, -1):
            if cake[y][x] != 0:
                break
            cake[y][x] = i
            x0 = x
        for x in range(s[1]+1, W):
            if cake[y][x] != 0:
                break
            cake[y][x] = i
            x1 = x
        for y in range(s[0]-1, -1, -1):
            if cake[y][x0:x1+1].count(0) != x1-x0+1:
                break
            for x in range(x0, x1+1):
                cake[y][x] = i
        for y in range(s[0]+1, H):
            if cake[y][x0:x1+1].count(0) != x1-x0+1:
                break
            for x in range(x0, x1+1):
                cake[y][x] = i
    for c in cake:
        print(*c)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import numpy as np
# 初期入力
import sys
input = sys.stdin.readline
N,K = (int(i) for i in input().split())
A = list(map(int, input().split()))
#B =np.zeros(N)
A =np.array(A,dtype=np.int64)
#
l =0
r =N
if N <=K:
    B=np.full(N,N)
elif np.any(A >=N//2+1) and  N//5*4 <=K:
    B=np.full(N,N)
else:
    for j in range(K):
        B =np.zeros(N,dtype=np.int64)
        for i in range(N):
            index =A[i]
            if i-index <0:
                l=0
            else:
                l =i -index
            if i +index >N:
                r =N 
            else:
                r =i +index +1
            B[l:r] +=1 
            if np.all(B >=N):
                print(*B)
                sys.exit(0)
        A =B

    
print(*B)

### FIXED CODE ###

# imos法
# 長さNの1次元配列において、「ある連続する区間に、ある数vを足す」という操作をK回繰り返した結果を高速で求める
# 
    
# 初期入力
    
import sys
input = sys.stdin.readline
N,K = (int(i) for i in input().split())
A = list(map(int, input().split()))
    
    
l =0
r =N
cumulative_sum =[0]*N
#操作数が電球の数より多いとき
if N <=K:
    A=[N]*N
# imos法
else:
    for j in range(K):
        B =[0]*(N+1)
        for i in range(N):
            index =A[i]
            if i-index <0:
                l=0
            else:
                l =i -index
            if i +index +1 >=N:
                r =N 
            else:
                r =i +index +1
            B[l] +=1 
            B[r] -=1
        #累積和(imos法) 
        from itertools import accumulate
        del B[-1]
        A =list(accumulate(B))
        if sum(A) ==N*N:
            print(*A)
            sys.exit(0)
    
print(*A)
### BUGGY CODE ###

N,K = map(int,input().split())
p = list(map(int,input().split()))
total = 0
if N != K:
  for i in range(N-K+1):
    tmp = sum(p[i:i+K])
    if tmp > total:
      total = tmp
else:
  total = sum(p)
total = K + total
print(total/2)

### FIXED CODE ###

N,K = map(int,input().split())
p = list(map(int,input().split()))
total = sum(p[0:K])
tmp = total
if N != K:
  for i in range(N-K):
    tmp = tmp - p[i] + p[i+K]
    if tmp > total:
      total = tmp
else:
  total = sum(p)
total = K + total
print(total/2)
### BUGGY CODE ###

n = int(input())
v = list(map(int,input().split()))
even = [[v[i], 0] for i in range(n) if (i+1)%2 == 0]
odd = [[v[i], 0] for i in range(n) if (i+1)%2 == 1]
for i in range(n):
    for j in range(n):
        if (i+1) % 2 == 0 and (j+1) % 2 == 0:
            if even[i//2][0] == even[j//2][0]:
                even[i//2][1] += 1
        elif (i+1) % 2 == 1 and (j+1) % 2 == 1:
            if odd[i//2][0] == odd[j//2][0]:
                odd[i//2][1] += 1
even = sorted(even, key = lambda x: x[1],reverse = True)
odd = sorted(odd, key = lambda x: x[1],reverse = True)
#print(even)
#print(odd)
if even == odd:
    print(n//2)
elif even[0][0] != odd[0][0]:
    print(n - even[0][1] - odd[0][1])
elif even[0][1] >= odd[0][1]:
    for i in range(n//2):
        if odd[i][0] != even[0][0]:
            print(n - even[0][1] - odd[i][1])
            break
else:
    for i in range(n//2):
        if even[i][0] != odd[0][0]:
            print(n - even[i][1] - odd[0][1])
            break
        

### FIXED CODE ###

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

vo = [0] * (10**5 + 1)
ve = [0] * (10**5 + 1)

for i in range(n):
    if (i+1) % 2 == 0:
        ve[v[i]] += 1
    else:
        vo[v[i]] += 1
ve1 = sorted(ve, reverse = True)
vo1 = sorted(vo, reverse = True)
if vo.index(max(vo)) != ve.index(max(ve)):
    print(n - max(vo) - max(ve))
    
elif max(vo) > max(ve):    
    print(n - max(vo) - ve1[1])
elif max(vo) < max(ve):
    print(n - max(ve) - vo1[1])
else:
    print(n - max(vo) - max(ve1[1], vo1[1]))
### BUGGY CODE ###

n=int(input())
A=list(map(int,input().split()))
a=0
b=0
c=0
d=sum(A)
for i in range(n):
  if A[i]==1:
    a=a+1
  elif A[i]==2:
    b=b+1
c=n-a-b
i=0
dp=[[[0]*(n+3) for i in range(n+3)] for j in range(n+3)]
for k in range(1,c+2):
  for j in range(1,n-k-i+4):
    for i in range(1,n-k-j+4):
      if i+j+k!=3:
        dp[i][j][k]=(dp[i-1][j][k]*(i-1)+dp[i+1][j-1][k]*(j-1)+dp[i][j+1][k-1]*(k-1)+n)/(i+j+k-3)
print(dp[a+1][b+1][c+1])

### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
a=0
b=0
c=0
d=sum(A)
for i in range(n):
  if A[i]==1:
    a=a+1
  elif A[i]==2:
    b=b+1
c=n-a-b
i=1
dp=[[[0]*(n+2) for i in range(n+2)] for j in range(n+2)]
for k in range(c+1):
  for j in range(n-k-a+1):
    for i in range(n-k-j+1):
      if i==0 and j==0 and k==0:
        continue
      dp[k][j][i]=(dp[k][j][i-1]*i+dp[k][j-1][i+1]*j+dp[k-1][j+1][i]*k+n)/(i+j+k)
print(dp[c][b][a])
### BUGGY CODE ###

N,M=map(int, input().split())
A,B=[],[]
for i in range(N):
    a,b=map(int, input().split())
    A.append(a)
    B.append(b)

R,S=M,0
while R!=0:
    mloc=A.index(min(A))
    AA=A.pop(mloc)
    BB=B.pop(mloc)
    if BB>=R:
        S+=AA*R;R=0
    else:
        S+=AA*BB;R-=BB
print(S)



### FIXED CODE ###

N,M=map(int, input().split())
A,B=[],[]
for i in range(N):
    A.append(list(map(int, input().split())))
A.sort(key=lambda x:x[0])
R,S=M,0
for a in A:
    if a[1]>=R:
        S+=a[0]*R;R=0
    else:
        S+=a[0]*a[1];R-=a[1]
    if R==0: break
print(S)
### BUGGY CODE ###

import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

input = sys.stdin.readline


def main():
    N = int(input())
    L = list(map(int, input().split()))
    min_l = min(L)

    ans = 0

    for a in range(N):

        for b in range(a+1, N):
            # if L[a] >= L[b]:
            #     continue

            for c in range(b+1, N):
                if L[a] < L[b] + L[c] and L[b] < L[c] + L[a] and L[c] < L[a] + L[b]:
                    ans += 1

    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
import bisect
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce, reduce
sys.setrecursionlimit(20000000)

input = sys.stdin.readline


def main():
    N = int(input())
    L = list(map(int, input().split()))
    L.sort()

    ans = 0

    for a in range(N):

        for b in range(a+1, N-1):
            ab = L[a] + L[b]
            i = bisect.bisect_left(L, ab) - 1

            ans += i - b

    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###


from functools import reduce
from math import gcd

#a = [12, 18, 24]
#b = reduce(gcd, a)


K = int(input())
cnt = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            a = [i,j,k]
            b = reduce(gcd,a)
            cnt = cnt+b
print(cnt)




### FIXED CODE ###

from functools import reduce
from math import gcd

#a = [12, 18, 24]
#b = reduce(gcd, a)


K = int(input())
cnt = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            a = [i,j,k]
            b = reduce(gcd,a)
            cnt = cnt+b
print(cnt)
### BUGGY CODE ###

n = int(input())
def sqe(a, b, c):
    """ 2次方程式を解く  """
    D = (b**2 - 4*a*c) ** (1/2)
    x_1 = (-b + D) / (2 * a)
    x_2 = (-b - D) / (2 * a)

    return x_1, x_2
  
for i in range(1,n+1):
  cnt = 0
  for x in range(1,100):
    for y in range(1,100):
      if x**2+y**2+x*y>i:
        break
      x_1,x_2 = sqe(1,x+y,x**2+y**2+x*y-i)
      if x_1.is_integer() and x_1>=1:
        cnt += 1
      elif x_2.is_integer() and x_2>=1:
        cnt += 1
  print(cnt)

### FIXED CODE ###

n = int(input())
def solve(n):
  l = [0]*(n**3)
  for x in range(1,n+1):
    for y in range(1,n+1):
      for z in range(1,n+1):
        l[x**2+y**2+z**2+x*y+y*z+z*x] += 1
  return l
l = solve(100)
print(*l[1:n+1])
### BUGGY CODE ###

from bisect import bisect_left, bisect_right
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()


def check(x):
    # k番目の数がx以下であるか
    # x以下の数字がk個以上あるか
    cnt = 0
    for i, ai in enumerate(a):
        if ai > 0:
            idx = bisect_right(a, x // ai)
            cnt += max(idx - i - 1, 0)
        elif ai < 0:
            idx = bisect_left(a, -(x // abs(ai)))
            # cnt += n - idx
            cnt += n - max(idx, i + 1)
        else:
            # ai == 0
            if x >= 0:
                cnt += n - i - 1

        if cnt >= k:
            return True
    # print('check', x, cnt)
    return cnt >= k


lb = -10**18  # False
ub = +10**18  # True
while ub - lb > 1:
    mid = (ub + lb) // 2
    # print(lb, ub)
    if check(mid):
        ub = mid
    else:
        lb = mid

print(ub)


### FIXED CODE ###

from bisect import bisect_left, bisect_right
import sys
input = sys.stdin.readline

n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

a_minus = a_zero = a_plus = 0
for i in range(n):
    if a[i] > 0:
        a_plus += 1
    elif a[i] == 0:
        a_zero += 1
    else:
        a_minus += 1

aa_minus = a_minus * a_plus
aa_zero = a_zero * (n - a_zero) + a_zero * (a_zero - 1) // 2


def check_minus(x):
    # k番目の数がx(<0)以下であるか
    # x以下の数字がk個以上あるか
    cnt = 0
    j = a_minus + a_zero
    for i in range(a_minus):
        # a[i] < 0
        while j < n and a[i] * a[j] > x:
            j += 1
        cnt += n - j

    return cnt >= k


def check_plus(x):
    # k番目の数がx(>0)以下であるか
    # x以下の数字がk個以上あるか

    def func(b, m):
        # 昇順ソート済みの数列b (長さm)
        # 掛け算してx以下となる数を求める
        c = 0
        j = m - 1
        for i in range(m):
            while j > 0 and b[i] * b[j] > x:
                j -= 1
            c += max(j - i, 0)
        return c

    cnt = aa_minus + aa_zero
    cnt += func(a[-a_plus:], a_plus)
    cnt += func(list(reversed(a[:a_minus])), a_minus)
    return cnt >= k


if k <= aa_minus:
    # k番目の数は負の数
    lb = a[0] * a[-1] - 1  # False
    ub = 0  # True
    while ub - lb > 1:
        mid = (ub + lb) // 2
        if check_minus(mid):
            ub = mid
        else:
            lb = mid

    ans = ub
elif k <= aa_minus + aa_zero:
    # k番目の数は0
    ans = 0
else:
    # k番目の数はプラス
    lb = 0  # False
    ub = max(a[0]**2, a[-1]**2) + 1  # True
    while ub - lb > 1:
        mid = (ub + lb) // 2
        if check_plus(mid):
            ub = mid
        else:
            lb = mid

    ans = ub

print(ans)
### BUGGY CODE ###

from collections import defaultdict
N, S = map(int, input().split())
A = tuple(map(int, input().split()))

mod = 998244353
U = 3000

pow2 = [1] * (U + 1)
for i in range(1, U + 1):
    pow2[i] = pow2[i - 1] * 2 % mod

dp = defaultdict(int)
U = 3000*3000
dp[(0, 0)] = 1
for a in A:
    newDP = defaultdict(int)
    for (sm, cnt), v in dp.items():
        # 追加しない
        newDP[(sm, cnt)] += v
        newDP[(sm, cnt)] %= mod
        # 追加する
        if sm+a <= S:
            newDP[(sm+a, cnt + 1)] += v
            newDP[(sm+a, cnt + 1)] %= mod
    dp = newDP

ans = 0
for i in range(N + 1):
    ans = (ans + pow2[N - i] * dp[(S, i)]) % mod
print(ans)

### FIXED CODE ###

import numpy as np
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
fft = np.fft.rfft
ifft = np.fft.irfft
mod = 998244353

N, S = map(int, input().split())
A = list(map(int, input().split()))
U = 3003

dp = np.zeros(U+10, dtype=np.int64)
dp[0] = 1
for a in A:
    newDP = dp.copy() * 2
    newDP[a:] += dp[:-a]
    newDP %= mod
    dp = newDP

print(dp[S])
### BUGGY CODE ###

from queue import Queue

N = int(input())
P = list(map(int,input().split()))

MAP = [[min(i, j, N-i-1, N-j-1) for i in range(N)] for j in range(N)]

d = [[1 for i in range(N)] for j in range(N)]

tx = [1, 0, -1, 0]
ty = [0, 1, 0, -1]

ans = 0

for p in P:
    x = (p-1) // N
    y = (p-1) % N
    d[x][y] = 0
    cnt = float('INF')
    for i in range(4):
        nx = x + tx[i]
        ny = y + ty[i]
        if 0 <= nx < N and 0 <= ny < N:
            cnt = min(cnt, MAP[nx][ny] + d[nx][ny])
        else:
            cnt = min(cnt, 0)
    
    ans += MAP[x][y]
    
    MAP[x][y] = cnt
    
    q = Queue()
    
    q.put((x, y, cnt))
    
    while not q.empty():
        x, y, cnt = q.get()
        for i in range(4):
            nx = x + tx[i]
            ny = y + ty[i]
            if 0 <= nx < N and 0 <= ny < N and MAP[nx][ny] > MAP[x][y] + d[x][y]:
                MAP[nx][ny] = MAP[x][y] + d[x][y]
                q.put((nx, ny, cnt + d[x][y]))
    

print(ans)

### FIXED CODE ###

from collections import deque

N = int(input())
P = list(map(int,input().split()))

MAP = [min(i, j, N-i-1, N-j-1) for i in range(N) for j in range(N)]

d = [1] * (N ** 2)

ans = 0

def update(np, p):
    if MAP[np] > MAP[p] + d[p]:
        q.append(np)
        MAP[np] = MAP[p] + d[p]

for p in P:
    p -= 1
    
    d[p] = 0
    
    ans += MAP[p]
    
    q = deque()
    
    q.append(p)
    
    while len(q) != 0:
        p = q.popleft()
        if p % N != N-1:
            update(p+1, p)
        if p % N != 0:
            update(p-1, p)
        if p // N != N-1:
            update(p+N, p)
        if p // N != 0:
            update(p-N, p)

print(ans)
### BUGGY CODE ###

import math

MOD = 10 ** 9 + 7
n, a, b = list(map(int, input().split(" ")))


def cmb(r):
    total = 1
    for i in range(r):
        total *= (n - i) % MOD
    return total * pow(math.factorial(r), MOD - 2, MOD) % MOD


total = pow(2, n, MOD)
a_total = cmb(a)
b_total = cmb(b)
print((total - a_total - b_total - 1) % MOD)

### FIXED CODE ###

from math import factorial
N, A, B = map(int, input().split())
MOD = 10 ** 9 + 7

def calc(n):
    ret = 1
    for i in range(n):
        ret = ret * (N - i) % MOD
    return ret * pow(factorial(n), MOD - 2, MOD) % MOD

print(max(0, (pow(2, N, MOD) - ((calc(A) + calc(B)) % MOD) - 1) % MOD))
### BUGGY CODE ###

#!/usr/bin/env pypy3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import math,sys

n = int(sys.stdin.readline())
a = tuple(map(int,sys.stdin.readline().split()))
#n = int(input())
#a = list(map(int,input().split()))
g = math.gcd(a[0],a[1])
for i in range(2,n):
    g = math.gcd(g,a[i])
M = max(a)
acc = a[0]
for i in range(n):
    acc = math.gcd(acc,a[i])
if acc != 1:
    print("not coprime")
    exit()

LIMIT=max(a)
minPrime = [0]*(LIMIT+1)
minPrime[1] = 1
def make():
    for i in range(2,LIMIT+1):
        if minPrime[i] == 0:
            minPrime[i] = i
            #print(i)
            for j in range(i+i,LIMIT+1,i):
                #print(i,j)
                if minPrime[j] == 0:
                    minPrime[j] = i
make()
def factrial(N):
     ret = []
     while minPrime[N] != N:
         ret.append(minPrime[N])
         N = N//minPrime[N]
     if N != 1:
         ret.append(N)
     return ret

judge = set([])
pc = True

pairwise = True
p = set() #all prime

for e in a:
    if not pairwise:
        break
    f = set(factrial(e))
    #print(p,f)
    if p & f != set():
        pc = False
        #pairwise = False
        print("setwise coprime")
        exit(0)
    p = p | f
# for i in a:
#     if not pc:
#         break
#     asf = set(factrial(i))

#     if judge & asf != set():
#         pc = False
#     judge |= asf
if pc:
    print("pairwise coprime")
elif g == 1:
    print("setwise coprime")
else:
    print("not coprime")


### FIXED CODE ###

import math
from collections import defaultdict
pc = True
n = int(input())
a = list(map(int,input().split()))
g = math.gcd(a[0],a[1])
for i in range(2,n):
    g = math.gcd(g,a[i])
M = max(a)
class Sieve_of_Eratosthenes:
    def __init__(self, N):
        self.sieve = [-1] * (N+1)
 
        for i in range(2,N+1):
            if self.sieve[i] == -1:
                for j in range(1,1+N//i):
                    self.sieve[i*j] = i
 
    def isprime(self, num):
        if num <= 1:
            return False
        else:
            return self.sieve[num] == num
 
    def factorization(self, num):
        ret = set([])
        while num != 1:
            div = self.sieve[num]
            ret.add(div)
            num //= div
        return ret
 
sofe = Sieve_of_Eratosthenes(M)
ddic = defaultdict()
judge = set([])
 
for i in a:
    if not pc:
        break
    asf = sofe.factorization(i)
    
    if judge & asf != set():
        pc = False
    judge |= asf
if pc:
    print("pairwise coprime")
elif g == 1:
    print("setwise coprime")
else:
    print("not coprime")
### BUGGY CODE ###

n = int(input())
s = list(input())

min = n
for i in range(n):
    count = 0
    for j in range(n):
        if j == i:
            continue
        elif ((j < i and s[j] != "E")
            or (j > i and s[j] != "W")):
            count += 1
    if count < min:
        min = count

print(min)


### FIXED CODE ###

n = int(input())
s = list(input())

min = n
count = 0
for i in range(1, n):
    if s[i] == "E":
        count += 1
min = count

for i in range(1, n):
    if s[i] == "E":
        count -= 1
    if s[i-1] == "W":
        count += 1

    if count < min:
        min = count

print(min)