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

n=int(input())
s=list(map(ord,list(input())))
R=[0]
G=[0]
B=[0]
for i in s:
  R.append(R[-1])
  G.append(G[-1])
  B.append(B[-1])
  if i==82:R[-1]+=1
  elif i==71:G[-1]+=1
  else:B[-1]+=1
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    if s[i]==s[j]:continue
    if 82 not in [s[i],s[j]]:
      ans+=R[-1]-R[j]
      if j+(j-i)<n:
        if s[j+(j-i)]==82:ans-=1
    elif 71 not in [s[i],s[j]]:
      ans+=G[-1]-G[j]
      if j+(j-i)<n:
        if s[j+(j-i)]==71:ans-=1
    else:
      ans+=B[-1]-B[j]
      if j+(j-i)<n:
        if s[j+(j-i)]==66:ans-=1
print(ans)


### FIXED CODE ###

n=int(input())
s=input()
R=[0]
G=[0]
B=[0]
for i in s:
  R.append(R[-1])
  G.append(G[-1])
  B.append(B[-1])
  if i=="R":R[-1]+=1
  elif i=="G":G[-1]+=1
  else:B[-1]+=1
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    if s[i]==s[j]:continue
    if "R" not in [s[i],s[j]]:
      ans+=R[-1]-R[j]
      if j+(j-i)<n:
        if s[j+(j-i)]=="R":ans-=1
    if "G" not in [s[i],s[j]]:
      ans+=G[-1]-G[j]
      if j+(j-i)<n:
        if s[j+(j-i)]=="G":ans-=1
    if "B" not in [s[i],s[j]]:
      ans+=B[-1]-B[j]
      if j+(j-i)<n:
        if s[j+(j-i)]=="B":ans-=1
print(ans)
### BUGGY CODE ###

def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  n = int(input())
  if n < 4:
    print(0)
    exit()
  ans = 0
  s = list(input())
  for i, a in enumerate(s):
    j = i+1
    k = i+2
    for bi, b in enumerate(s[j:]):
      bb = bi+j
      for ci, c in enumerate(s[k:]):
        cc = ci+k
        if i < bb < cc:
          if a == b or b == c or a == c:
            continue
          if bb - i == cc - bb:
            continue
          ans += 1
  print(ans)          
import math
import fractions
import collections
import itertools
from functools import reduce
main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
import bisect


# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    n = int(input())
    s = input()
    R, G, B = [], [], []
    for i in range(n):
        index = i+1
        if s[i] == "R":
            R.append(index)
        elif s[i] == "G":
            G.append(index)
        elif s[i] == "B":
            B.append(index)
    all_count = len(R)*len(G)*len(B)
    count = 0
    # j - i != k - j
    # k = 2j - i
    for i in range(n):
        for j in range(i+1, n):
            if s[i] == s[j]:
                continue
            k = 2*j - i
            if k >= n:
                continue
            if s[k] == s[i] or s[k] == s[j]:
                continue
            count += 1
    print(all_count - count)

def bi(num, a, b, x):
    print((a * num) + (b * len(str(b))))
    if (a * num) + (b * len(str(b))) <= x:
        return False
    return True

def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


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

import numpy as np
N, K, Q = map(int, input().split())
S = []
for _ in range(Q):
    S.append(int(input())) 
P=np.array([K]*N)
b=np.array([0]*N)
for i in range(Q):
  a=np.array([-1]*N)
  a[S[i]-1]=0
  b +=a
P +=b
for i in range(N):
  if P[i] <= 0:
    print("No")
  else:
    print("Yes")

### FIXED CODE ###

import numpy as np
N, K, Q = map(int, input().split())
S = []
for _ in range(Q):
    S.append(int(input())) 
P=[K]*N
for i in range(Q):
  P[S[i]-1]+=1
P = np.array(P)
P -= Q
for i in range(N):
  if P[i] <= 0:
    print("No")
  else:
    print("Yes")
### BUGGY CODE ###

import numpy as np

N = int(input())
A = list(map(int, input().split()))
digit = np.zeros(60)
for a in A:
    binary = np.array(list(map(int, bin(a)[-1:1:-1])))
    digit[0:len(binary)] += binary
ans = 0
mod = 10**9+7
digit = digit * (N - digit) % mod
for i in range(60):
    ans += int(digit[i]) * pow(2, i, mod)
    ans %= mod
print(ans)


### FIXED CODE ###

import numpy as np

N = int(input())
A = list(map(int, input().split()))
A = np.array(A, dtype=np.int64)
ans = 0
mod = 10**9+7
i = 1
while i < (1 << 60):
    count = np.count_nonzero(A & i)
    ans += count * (N-count) * i
    ans %= mod
    i <<= 1
print(ans)
### BUGGY CODE ###

n, p = map(int, input().split())

s = input()

ruisekiwa = [0 for _ in range(0, n + 1)]
if 10 % p == 0:
    ans = 0
    for i in range(0, n):
        if (ord(s[i]) - ord('0')) % p == 0:
            ans += i + 1
    print(ans)
    exit()

ten = 1
for _i in range(0, n):
    i = n - _i - 1
    ruisekiwa[n - i] = ((ord(s[i]) - ord('0')) * ten + ruisekiwa[n - i - 1]) % p
    ten *= 10

ans = 0
cnt = [0 for _ in range(0, p)]
for i in range(0, n+1):
    ans += cnt[ruisekiwa[i]]
    cnt[ruisekiwa[i]] += 1

print(ans)


### FIXED CODE ###

n, p = map(int, input().split())

s = input()

ruisekiwa = [0 for _ in range(0, n + 1)]
if 10 % p == 0:
    ans = 0
    for i in range(0, n):
        if (ord(s[i]) - ord('0')) % p == 0:
            ans += i + 1
    print(ans)
    exit()

ten = 1
for _i in range(0, n):
    i = n - _i - 1
    ruisekiwa[n - i] = ((ord(s[i]) - ord('0')) * ten + ruisekiwa[n - i - 1]) % p
    ten *= 10
    ten %= p

ans = 0
cnt = [0 for _ in range(0, p)]
for i in range(0, n+1):
    ans += cnt[ruisekiwa[i]]
    cnt[ruisekiwa[i]] += 1

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

N = int(input())
A_str = input()
A_str_list = A_str.split()
A = [int(A_str_list[i]) for i in range(N)]
sum = 0
for i in range(N):
    for j in range(N-i-1):
        # print(i+j+1, A[i+j+1])
        sum += A[i]*A[i+j+1]
# print(sum)
mod = sum % (10**9+7)
print(mod)

### FIXED CODE ###

import numpy as np
N = int(input())
A_str = input()
A_str_list = A_str.split()
A = np.array([int(A_str_list[i]) for i in range(N)])
sum = 0
mod = 1000000007
res = np.cumsum(A)
res = [np.mod((res[-1]-res[i]), mod) for i in range(N)]
# print(res)
for i in range(N):
    sum += np.mod(res[i]*A[i], mod)
print(np.mod(sum, mod))
### BUGGY CODE ###

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

ans = 0
for j in range(1, n):
    m = s[j]
    for i in range(j):
        l = s[i]
        for k in range(j + 1, n):
            r = s[k]
            if 2 * j == i + k:
                continue
            else:
                if m != l and m != r and l != r:
                    ans += 1

print(ans)


### FIXED CODE ###

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

r = sum([1 for x in s if x == 'R'])
g = sum([1 for x in s if x == 'G'])
b = sum([1 for x in s if x == 'B'])
ans = r * g * b

for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i
        if j < k <= n - 1:
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans -= 1

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

a = []
while True:
    inp = input()
    if inp[0] == "i":
        a.append(int(inp[7:]))
    elif inp == "extract":
        a.sort()
        print(a.pop())
    else:
        break

### FIXED CODE ###

import heapq

a = []
while True:
    inp = input().split()
    if inp[0] == "insert":
        heapq.heappush(a, -int(inp[1]))
    elif inp[0] == "extract":
        print(-heapq.heappop(a))
    else:
        break
### BUGGY CODE ###

a, b, k = map(int, input().split())
l = [i for i in range(a, b+1)]

if len(l) <= 2*k:
    print('\n'.join(map(str,l)))
else:
    print('\n'.join(map(str, l[:k])))
    print('\n'.join(map(str, l[len(l)-k:])))

### FIXED CODE ###

a, b, k = map(int, input().split())

c = a
while c < a + k and c <= b:
    print(c)
    c += 1
c = max(b-k+1, c)
while c <= b:
    print(c)
    c += 1
### BUGGY CODE ###

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    l = len(bin(max(A))[2:])
    mask = int("1"*N, 2)
    for i in range(N):
        A[i] = list(bin(A[i])[2:].zfill(l))
    cols = [list(c) for c in zip(*A)]
    #print(A)
    #print(cols)
    colssum = [c.count("1") for c in cols]
    for i in range(l):
        if (colssum[i]-int(cols[i][0])) % 2 == int(A[0][i]):
            cols[i] = "".join(cols[i])
        else:
            cols[i] = bin(int("".join(cols[i]), 2) ^ mask)[2:].zfill(N)
    #print(cols)
    ans = ["".join(a) for a in zip(*cols)]
    #print(ans)
    print(*(map(lambda x: int(x, 2), ans))) 
    


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    B = A[0]
    for i in range(1, N):
        B = B^A[i]
    ans = []
    for i in range(N):
        ans.append(B^A[i])
    print(*ans)

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

N=int(input())
A=[int(input()) for _ in range(N)]
B=[]
for i in range(N):
    if A[i] not in B:
        B.append(A[i])
    else:
        B.remove(A[i])
print(len(B))


### FIXED CODE ###

from collections import Counter
N=int(input())
A=[int(input()) for _ in range(N)]
X=Counter(A)
ans=0
for i in X.values():
    if i%2==1:
        ans+=1
print(ans)
### BUGGY CODE ###

a,b=map(int,input().split())
c=[int(x) for x in input().split()]
se=set()
import itertools
ok=False
for j in range(b):
    for i in itertools.permutations(c,r=j+1):
        se.add(i)
    for i in se:
        if sum(i)>=a:
            ok=True
            break
    if ok:
        break
        
if ok:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b=map(int,input().split())
c=[int(x) for x in input().split()]

if sum(c)>=a:
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def S(): return sys.stdin.readline().rstrip()

N,S = map(int,S().split())
A = [0] + LI()
mod = 998244353

from collections import defaultdict

dp = defaultdict(int)

# dp[i][j] = A_1からA_iまでを用いて和がj

for i in range(N+1):
    for j in range(S+1):
        if i == 0:
            dp[(i,0)] = 1
        else:
            if j >= A[i]:
                dp[(i,j)] = (dp[(i-1,j)]*2 + dp[(i-1,j-A[i])]) % mod
            else:
                dp[(i,j)] = dp[(i-1,j)]*2 % mod

print(dp[(N,S)])

### FIXED CODE ###

import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def S(): return sys.stdin.readline().rstrip()

N,S = map(int,S().split())
A = [0] + LI()
mod = 998244353

dp = [[0]*(S+1) for _ in range(N+1)]

# dp[i][j] = {A_1,…,A_i}の部分集合の部分集合で、和がjとなるものの個数

for i in range(N+1):
    for j in range(S+1):
        if i == 0:
            dp[i][0] = 1
        else:
            if j >= A[i]:
                dp[i][j] = (dp[i-1][j]*2 + dp[i-1][j-A[i]]) % mod
            else:
                dp[i][j] = dp[i-1][j]*2 % mod

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

import itertools

def comb(n, r):
    return len(list(itertools.combinations(range(n), r)))

n = int(input())
s = []
for i in range(n):
    sin = input()
    sin = list(sin)
    sin.sort()
    sin = ''.join(sin)
    s.append(sin)

ss = set(s)
count = 0
for u in ss:
    al = s.count(u)
    # s.remove
    count += comb(al, 2)
print(count)

### FIXED CODE ###

import itertools

def comb(n, r):
    return len(list(itertools.combinations(range(n), r)))

def get_runlength(s): # ex) s = 'RRLLLLRLRLRLRR'
    ret = []
    count = 1
    for i in range(len(s)):
        if i == len(s) - 1:
            ret.append((s[i], count))
            continue
        if s[i] == s[i + 1]:
            count += 1
        else:
            ret.append((s[i], count))
            count = 1
    return ret

n = int(input())
dic = {}
for i in range(n):
    sin = input()
    sin = list(sin)
    sin.sort()
    sin = ''.join(sin)
    try:
        dic[sin] += 1
    except:
        dic[sin] = 1

count = 0
for v in dic.values():
    count += v * (v - 1) / 2
count = int(count)
print(count)
### BUGGY CODE ###

import numpy as np

n = map(int, raw_input().split())

x = map(int, raw_input().split())
n = n[0]
ans = []

x = np.asarray(x)
for i in range(n):
    one_ans = 0
    multiple = -1
    for j in range(n):
        one_ans += x[(i+j)%n] * multiple
        multiple *= -1
    one_ans += 2*x[i]
    ans.append(int(one_ans))
last = ans.pop()
ans.insert(0, last)
print ' '.join(map(str, ans))


### FIXED CODE ###

import numpy as np

n = map(int, raw_input().split())

x = map(int, raw_input().split())
n = n[0]
ans = []

x = np.asarray(x)
double_x = 2 * x
x0 = 0
multiple = 1
for j in range(n):
    x0 += x[j] * multiple
    multiple *= -1
ans.append(x0)
for i in range(0, n-1):
    ans.append(double_x[i] - ans[i])

print ' '.join(map(str, ans))
### BUGGY CODE ###

s = list(input())
n = len(s)
s = s+['z','z']
mem = []
c = 0
run = 0
i=0
while(i<n):
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
        c+=1
        s[i] = 'B'
        s[i + 1] = 'C'
        s[i + 2] = 'A'
        mem.append(i+2)
        run=1
        i+=3
    else:
        i+=1
        if s[i]=='A':
            mem.append(i)

while(run):
    run = 0
    m = -1
    for i in range(len(mem)):
        idex = mem[i]
        if s[idex] == 'A' and s[idex + 1] == 'B' and s[idex + 2] == 'C' and i>m:
            c += 1
            s[idex] = 'B'
            s[idex + 1] = 'C'
            s[idex + 2] = 'A'
            mem.append(i + 2)
            run = 1
            mem[i]= idex+2
            m=idex+2
print(c)

### FIXED CODE ###

s = input()
s= s.replace('BC','D')
a=0
d=0
ans=0
t=''
for i in range(len(s)):
    if s[i] =='A':
        a+=1
    elif s[i]=='D':
        ans+=a
    else:
        a=0
print(ans)
### BUGGY CODE ###

def divisor(n): 
    i = 1
    s = 0
    while i * i <= n:
        if n%i == 0:
          if n // i == i:
            s += 1
          else:
            s += 2
        i += 1
    return s

N = int(input())
s = 0
for i in range(1, N):
  d = divisor(i)
  s += d
print(s)


### FIXED CODE ###

N = int(input())
s = 0
for i in range(1, N):
  b = (N - 1) // i
  s += b
print(s)
### BUGGY CODE ###

import heapq
def main():
    N, Q = map(int, input().split())
    ls = []
    lt = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        ls.append((s-x, x))
        lt.append((t-x, x))
    ls.sort(reverse=True, key=lambda x: x[0])
    lt.sort(reverse=True, key=lambda x: x[0])
    dh = []
    dl = []
    heapq.heapify(dh)
    heapq.heapify(dl)
    for i in range(Q):
        d = int(input())
        while len(ls) > 0 and ls[-1][0] <= d:
            s, x = ls.pop()
            heapq.heappush(dl, x)
        while len(lt) > 0 and lt[-1][0] <= d:
                t, x = lt.pop()
                heapq.heappush(dh, x)
        while len(dl) > 0 and len(dh) > 0 and dl[0] == dh[0]:
            heapq.heappop(dl)
            heapq.heappop(dh)
        if not dl:
            print('-1')
        else:
            print(dl[0])
main()


### FIXED CODE ###

import heapq
def main():
    N, Q = map(int, input().split())
    l = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        l.append((s-x, 1, x))
        l.append((t-x, 0, x))
    for i in range(Q):
        d = int(input())
        l.append((d, 2, i))
    r = [-1] * Q
    l.sort()
    h = []
    se = set()
    for a, b, c in l:
        if b == 0:
            se.remove(c)
        elif b == 1:
            se.add(c)
            heapq.heappush(h, c)
        else:
            while h and h[0] not in se:
                heapq.heappop(h)
            r[c] = h[0] if h else -1
    print('\n'.join(map(str, r)))
            
main()
### BUGGY CODE ###

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cap = [a, b, c, d, e]
city = [n, 0, 0, 0, 0, 0]

t = 0
while city[5] != n:
    schedule = [0, 0, 0, 0, 0, 0]
    t += 1
    for i in range(len(cap)):
        if city[i] < cap[i]:
            schedule[i + 1] += city[i]
            schedule[i] -= city[i]
        else:
            schedule[i] -= cap[i]
            schedule[i + 1] += cap[i]
    for i in range(len(schedule)):
        city[i] += schedule[i]
print(t)

### FIXED CODE ###

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cap = [a, b, c, d, e]

min_pos = 0
for p in range(len(cap)):
    if cap[p] < cap[min_pos]:
        min_pos = p

if n % cap[min_pos] == 0:
    print(4 + n // cap[min_pos])
else:
    print(5 + n // cap[min_pos])
### BUGGY CODE ###

import heapq

n, m = [int(v) for v in input().split(' ')]

costs = []
links = []
for i in range(n):
    costs.append([0] * i)
    links.append(set())

for i in range(m):
    l, r, c = [int(v) for v in input().split(' ')]
    l -= 1
    r -= 1

    for j in range(l, r):
        for k in range(j + 1, r + 1):
            c0 = costs[k][j]
            if c0 == 0 or c0 > c:
                costs[k][j] = c
                links[k].add(j)


h = []
heapq.heappush(h, (0, n-1))
closed = n
while len(h) > 0:
    c0, n0 = heapq.heappop(h)
    if closed <= n0:
        continue
    closed = n0
    if n0 == 0:
        print(c0)
        exit()

    for n1 in links[n0]:
        c1 = costs[n0][n1]
        heapq.heappush(h, (c0 + c1, n1))

print("-1")



### FIXED CODE ###

import heapq

n, m = [int(v) for v in input().split(' ')]

links = []
for i in range(n):
    links.append([])

for i in range(m):
    l, r, c = [int(v) for v in input().split(' ')]
    l -= 1
    r -= 1
    links[r].append((l, c))

h = []
heapq.heappush(h, (0, n-1))
closed = 0
while len(h) > 0:
    c0, n0 = heapq.heappop(h)
    if (closed & (1 << n0)) != 0:
        continue
    closed |= (1 << n0)
    if n0 == 0:
        print(c0)
        exit()

    for n1, c1 in links[n0]:
        if (closed & (1 << n1)) != 0:
            continue
        heapq.heappush(h, (c0 + c1, n1))

    n2 = n0 + 1
    if n2 < n:
        if (closed & (1 << n2)) == 0:
            heapq.heappush(h, (c0, n2))

print("-1")
### BUGGY CODE ###

#2
def chmin(a,b):
    if a>b:
        return b
    else:
        return a

N,K=map(int,input().split())
H=[int(x) for x in input().split()]

dp=[float("inf")]*N
dp[0]=0

for i in range(N):
    for j in range(1,K+1):
        if i+j<N:
            dp[i+j]=chmin(abs(H[i+j]-H[i])+dp[i],dp[i+j])
        else:
            break
print(dp[-1])

### FIXED CODE ###

#2
def chmin(a,b):
    if a>b:
        return b
    else:
        return a

N,K=map(int,input().split())
H=[int(x) for x in input().split()]

dp=[float("inf")]*N
dp[0]=0

for i in range(N):
    for j in range(1,K+1):
        if i+j<N:
            dp[i+j]=chmin(abs(H[i+j]-H[i])+dp[i],dp[i+j])
        else:
            break
print(dp[-1])
### BUGGY CODE ###

N = int(input())
l = len(str(N))
sum = 0

while True:
    a = N // 10**(l-1)
    N -= 10 ** (l-1) * a
    sum += a
    l -= 1
    if l < 0:
        break
if sum % 9 == 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N = str(input())
N = list(N)
N = [int(i) for i in N]

if sum(N) % 9 == 0:
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
h.insert(0,0) #index調整

dp = [1<<64] * (n+1)
dp[1] = 0

for i in range(2,n+1):
    for j in range(1,k+1):
        if i - j >= 1:
            dp[i] = min(dp[i-j]+abs(h[i]-h[i-j]), dp[i])
            
print(dp[n])

### FIXED CODE ###

import numpy as np

n, k = map(int, input().split())
h = np.array([0] + list(map(int, input().split()))) # index調整
dp = np.zeros(n+1,dtype=np.int)

for i in range(2,n+1):
    start = 1 if i - k < 1 else i - k
    dp[i] = min((dp[start:i]+np.abs(h[i]-h[start:i])))            
print(dp[n])
### BUGGY CODE ###

import sys
input=sys.stdin.readline


def main():
    N, S = map(int, input().split())
    *A, = map(int, input().split())
    dp = [[0]*(3001) for _ in range(N+1)]
    MOD = 998244353
    ans = 0

    dp[0][0] = pow(2, N, MOD)
    for i in range(1, N+1):    
        for j in range(3001):
            dp[i][j] += dp[i-1][j]
            if j-A[i-1]>=0:
                dp[i][j] += dp[i-1][j-A[i-1]]*pow(2, MOD-2, MOD)
            dp[i][j] %= MOD

    print(dp[N][S])


main()

### FIXED CODE ###

import sys
input=sys.stdin.readline


def main():
    N, S = map(int, input().split())
    *A, = map(int, input().split())
    dp = [[0]*(3001) for _ in range(N+1)]
    MOD = 998244353
    m = pow(2, MOD-2, MOD)
    dp[0][0] = pow(2, N, MOD)
    for i in range(1, N+1):    
        for j in range(3001):
            dp[i][j] += dp[i-1][j]
            if j-A[i-1]>=0:
                dp[i][j] += dp[i-1][j-A[i-1]]*m
            dp[i][j] %= MOD

    print(dp[N][S])


main()
### BUGGY CODE ###

import math
def a(n):
    arr = set()
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.add(i)

    if temp!=1:
        arr.add(temp)
    if arr==[]:
        arr.add(n)
    return arr
N=int(input())
L=list(map(int,input().split()))
L=list(set(L))
gc=L[0]
for i in L:
  gc=math.gcd(i,gc)
  if gc==1:
    break
if gc!=1:
  print("not coprime")
  exit()
ans=set()
for i in L:
  if a(i)&ans!=set():
    print("setwise coprime")
    exit()
  ans=a(i)|ans
print("pairwise coprime")

### FIXED CODE ###

def gcd(a, b):
    while b: a, b = b, a % b
    return a
def isPrimeMR(n):
    d = n - 1
    d = d // (d & -d)
    L = [2]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1: continue
        while y != n - 1:
            y = (y * y) % n
            if y == 1 or t == n - 1: return 0
            t <<= 1
    return 1
def findFactorRho(n):
    m = 1 << n.bit_length() // 8
    for c in range(1, 99):
        f = lambda x: (x * x + c) % n
        y, r, q, g = 2, 1, 1, 1
        while g == 1:
            x = y
            for i in range(r):
                y = f(y)
            k = 0
            while k < r and g == 1:
                ys = y
                for i in range(min(m, r - k)):
                    y = f(y)
                    q = q * abs(x - y) % n
                g = gcd(q, n)
                k += m
            r <<= 1
        if g == n:
            g = 1
            while g == 1:
                ys = f(ys)
                g = gcd(abs(x - ys), n)
        if g < n:
            if isPrimeMR(g): return g
            elif isPrimeMR(n // g): return n // g
            return findFactorRho(g)
def primeFactor(n):
    i = 2
    ret = {}
    while i*i <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
        if k: ret[i] = k
        i += 1 + i % 2
        if i == 101 and n >= 2 ** 20:
            while n > 1:
                if isPrimeMR(n):
                    ret[n], n = 1, 1
                else:
                    rhoFlg = 1
                    j = findFactorRho(n)
                    k = 0
                    while n % j == 0:
                        n //= j
                        k += 1
                    ret[j] = k
    if n > 1:return {n} 
    return set(ret)
def main():
    n=int(input())
    a=list(map(int,input().split()))
    g=a[0]
    for i in a[1:]:g=gcd(g,i)
    if g!=1:
        print("not coprime")
        exit()
    ans=0
    s=set()
    for i in a:
        p=primeFactor(i)
        ans+=len(p)
        s|=p
    if ans!=len(s):print("setwise coprime")
    else:print("pairwise coprime")
if __name__ == "__main__":
    main()