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

from collections import Counter

n=int(input())
a=list(map(int,input().split()))
ans=0
l=[]
r=[]
for i,j in enumerate(a):
    l.append(i+j)
    r.append(i-j)

#ref = dict(Counter(r))
#ans = 0
#for i in l:
#    ans += ref.get(i, 0)
#print(ans)

for i in l:
    ans+=r.count(i)
    
print(ans)

### FIXED CODE ###

from collections import Counter

n=int(input())
a=list(map(int,input().split()))
ans=0
l=[]
r=[]
for i,j in enumerate(a):
    l.append(i+j)
    r.append(i-j)

#ref = dict(Counter(r))
#ans = 0
#for i in l:
#    ans += ref.get(i, 0)
#print(ans)
b=Counter(r)
for i in l:
    ans+=b.get(i,0)

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

I = lambda :list(map(int,input().split()))

n,=I()
l = sorted(I())
g=[0]*(10**6+1)
an=0
for i in range(n):
  x=l[i];f=1
  for j in range(1,int(x**0.5)+1):
    if x%j==0:
      if g[j] or g[x//j]:
        f=0;break
  g[x]=1
  if f and (i!=n-1 and l[i+1]!=l[i]):
    an+=1
  elif f and i==n-1:
    an+=1
print(an)

### FIXED CODE ###

n,a=int(input()),sorted(list(map(int,input().split())))
m,s=a[-1],[0]*(a[-1]+1)
for i in a:
  s[i]+=1
for i in set(a):
	if s[i]:
		for j in range(i*2,m+1,i):s[j]=0
print(s.count(1))
### BUGGY CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
t = [0]
ans = 0
v = 0
for i in range(len(a)):
    v += a[i]
    t.append(v)
for i in range(len(t)-1):
    for j in range(i+1, len(t)):
        if (t[j]-t[i]) % m == 0:
            ans += 1
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
t = [0]
v = 0
b = {0:1}
for i in range(n):
    v = (v + a[i]) % m
    if v in b.keys():
        b[v] += 1
    else:
        b[v] = 1
ans = 0
for i in b.values():
    ans += i * (i-1) / 2
print(int(ans))
### BUGGY CODE ###

import copy
N = int(input())
S = input()
ans = 0

for i in range(N-3):
    A = ["R", "G", "B"]
    A.remove(S[i])
    for k in range(i+3, N):
        B = copy.copy(A)
        if S[i] != S[k]:
            B.remove(S[k])
            ans += S[i+1:k].count(B[0])
            if (k-i) % 2 == 0:
                if S[int((k-i)/2 + i)] == B[0]:
                    ans -= 1


print(ans)

### FIXED CODE ###

import copy
N = int(input())
S = input()

R = set()
G = set()
B = set()

for i in range(N):
    if S[i] == "R":
        R.add(i)
    elif S[i] == "G":
        G.add(i)
    else:
        B.add(i)

ans = len(R)*len(G)*len(B)

for r in R:
    for g in G:
        L = g - r
        if g + L in B:
            ans -= 1
        if r - L in B:
            ans -= 1
        if L % 2 == 0 and L//2 + r in B:
            ans -= 1
            



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

class obj:
    def __init__(self, N):
        self.fa = [i for i in range(N)]
    def find(self, x):
        if x == self.fa[x]:
            return x
        else:
            self.fa[x] = self.find(self.fa[x])
            return self.fa[x]

N = int(input())
node = [{"x":0, "y":0, "id":i} for i in range(N)]
edge = [{"u":0, "v":0, "d":0} for i in range(2*(N-1))]
ob = obj(N)
for i in range(N):
    node[i]["x"], node[i]["y"] = map(int, input().split())
    node[i]["id"] = i

xnode = sorted(node, key=lambda x:x["x"])
for i in range(N-1):
    edge[i]["u"] = xnode[i]["id"]
    edge[i]["v"] = xnode[i+1]["id"]
    edge[i]["d"] = xnode[i+1]["x"] - xnode[i]["x"]
ynode = sorted(node, key=lambda x:x["y"])
for i in range(N-1):
    edge[i+N-1]["u"] = ynode[i]["id"]
    edge[i+N-1]["v"] = ynode[i+1]["id"]
    edge[i+N-1]["d"] = ynode[i+1]["y"] - ynode[i]["y"]
dedge = sorted(edge, key=lambda x:x["d"])
ans = 0
for i in range(2*(N-1)):
    if ob.find(dedge[i]["u"]) != ob.find(dedge[i]["v"]):
        ans += dedge[i]["d"]
        ob.fa[ob.fa[dedge[i]["u"]]] = ob.fa[dedge[i]["v"]]
    if all([x==ob.fa[0] for x in ob.fa]):
        break
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(int(2e9))
class obj:
    def __init__(self, N):
        self.fa = [i for i in range(N)]
    def find(self, x):
        if x == self.fa[x]:
            return x
        else:
            self.fa[x] = self.find(self.fa[x])
            return self.fa[x]

N = int(input())
node = [{"x":0, "y":0, "id":i} for i in range(N)]
edge = [{"u":0, "v":0, "d":0} for i in range(2*(N-1))]
ob = obj(N)
for i in range(N):
    node[i]["x"], node[i]["y"] = map(int, input().split())
    node[i]["id"] = i

xnode = sorted(node, key=lambda x:x["x"])
for i in range(N-1):
    edge[i]["u"] = xnode[i]["id"]
    edge[i]["v"] = xnode[i+1]["id"]
    edge[i]["d"] = xnode[i+1]["x"] - xnode[i]["x"]
ynode = sorted(node, key=lambda x:x["y"])
for i in range(N-1):
    edge[i+N-1]["u"] = ynode[i]["id"]
    edge[i+N-1]["v"] = ynode[i+1]["id"]
    edge[i+N-1]["d"] = ynode[i+1]["y"] - ynode[i]["y"]
dedge = sorted(edge, key=lambda x:x["d"])
ans = 0
for i in range(2*(N-1)):
    if ob.find(dedge[i]["u"]) != ob.find(dedge[i]["v"]):
        ans += dedge[i]["d"]
        ob.fa[ob.fa[dedge[i]["u"]]] = ob.fa[dedge[i]["v"]]
print(ans)
### BUGGY CODE ###

from collections import deque
h,w,k = list(map(int, input().split()))
x1,y1,x2,y2 = list(map(int, input().split()))
x1,y1,x2,y2 = x1-1,y1-1,x2-1,y2-1
c = [[]*w for _ in range(h)]
dp = [[0]*w for _ in range(h)]
que = deque()
for i in range(h):
  for j,s in enumerate(input()):
    c[i].append(s)
    if s != '.':
      dp[i][j] = -1

ans = 0
dp[x1][y1] = 1
que.append((x1,y1))
dx = [1,0,-1,0]
dy = [0,1,0,-1]

while que:
  p = que.popleft()
  #if (p[0] == x2) & (p[1] == y2):
  #  break
  for i in range(4):
    nx = p[0] + dx[i]
    ny = p[1] + dy[i]
    if (nx>=0) & (nx<=(h-1)) & (ny>=0) & (ny<=(w-1)):
      cnt = 1
      while (dp[nx][ny] == 0) | (dp[nx][ny] >= (dp[p[0]][p[1]] + 1)):
        que.append((nx,ny))
        dp[nx][ny] = dp[p[0]][p[1]] + 1
        cnt += 1
        nnx = nx + dx[i]
        nny = ny + dy[i]
        if (nnx<0) | (nnx>(h-1)) | (nny<0) | (nny>(w-1)) | (cnt > k):
          break
        nx = nnx
        ny = nny

if dp[x2][y2] != 0:
  print(dp[x2][y2]-1)
else:
  print(-1)

### FIXED CODE ###

#import heapq
from collections import deque
h,w,k = list(map(int, input().split()))
x1,y1,x2,y2 = list(map(int, input().split()))
x1,y1,x2,y2 = x1-1,y1-1,x2-1,y2-1
dp = [[-1]*w for _ in range(h)]
#que = []
que = deque()
c = [input() for _ in range(h)]

dp[x1][y1] = 0
#heapq.heappush(que, (dp[x1][y1], [x1,y1]))
que.append((x1,y1))
dx = [1,0,-1,0]
dy = [0,1,0,-1]
while que:
  x,y=que.popleft()
  if x==x2 and y==y2:
    exit(print(dp[x][y]))
  for dx,dy in [[1,0],[-1,0],[0,-1],[0,1]]:
    for i in range(1,k+1):
      xx=x+dx*i
      yy=y+dy*i
      if not(0<=xx<h and 0<=yy<w) or c[xx][yy]=="@":break
      if 0<=dp[xx][yy]<=dp[x][y]:break
      if dp[xx][yy]==-1:que.append((xx,yy))
      dp[xx][yy]=dp[x][y]+1
print(-1)
### BUGGY CODE ###

x=str(input())
while "ST" in x:
    x.strip("ST")
print(len(x))


### FIXED CODE ###

x = list(input())
c = 0
for i in x:
  if i == "S":
    c += 1
  elif c>0:
    c -= 1
print(2*c)
### BUGGY CODE ###

from collections import defaultdict


N = int(input())
A = list(map(int, input().split())) 
MOD = 10**9 + 7
def primes(num):
    if num == 1:
        d = defaultdict(int)
        d[1] = 1
        return d

    i = 2
    d = defaultdict(int)
    while i * i <= num:
        while num % i == 0:
            num //= i
            d[i] += 1
        i += 1
    if num > 1:
        d[num] += 1

    return d

d = primes(A[0])

for a in A[1:]:
    tmp_d = primes(a)
    dk = set(d.keys())
    tmp_dk = set(tmp_d.keys())
    dk = dk | tmp_dk
    for k in dk:
        d[k] = max(d[k], tmp_d[k])

lcm = 1

for k in d.keys():
    lcm *= pow(k, d[k])


ans = 0
for a in A:
    ans += (lcm // a)
ans %= MOD

print(ans)


### FIXED CODE ###

from fractions import gcd


def main():
        
    N = int(input())
    A = list(map(int, input().split())) 
    MOD = 10**9 + 7


    l = 1

    for a in A:
        l = l * a // gcd(l, a)


    ans = 0
    for a in A:
        ans += (l // a)
    ans %= MOD

    print(ans)


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

def match(c1, c2):
    return c1 == "?" or c2 == "?" or c1 == c2

M = 2000
a = input().rstrip()
b = input().rstrip()
c = input().rstrip()
A = len(a)
B = len(b)
C = len(c)

ab = [False] * 20000
ac = [False] * 20000
bc = [False] * 20000

for i in range(A):
    for j in range(B):
        if not match(a[i], b[j]):
            ab[i - j + 10000] = True
for i in range(A):
    for j in range(C):
        if not match(a[i], c[j]):
            ac[i - j + 10000] = True
for i in range(B):
    for j in range(C):
        if not match(b[i], c[j]):
            bc[i - j + 10000] = True

ans = 3 * M
for i in range(-2 * M, 2 * M + 1):
    for j in range(-2 * M, 2 * M + 1):
        if not ab[i + 10000] and not ac[j + 10000] and not bc[j - i + 10000]:
            print("match", i, j)
            l = min(0, min(i, j))
            r = max(A, min(B + i, C + j))
            ans = min(ans, r - l)
            print("ans", ans)

print(ans)

### FIXED CODE ###

def match(c1, c2):
    return c1 == "?" or c2 == "?" or c1 == c2

M = 2000
a = input().strip()
b = input().strip()
c = input().strip()
A = len(a)
B = len(b)
C = len(c)

ab = [0] * 20000
ac = [0] * 20000
bc = [0] * 20000

for i in range(A):
    for j in range(B):
        if not match(a[i], b[j]):
            ab[i - j + 10000] = 1
for i in range(A):
    for j in range(C):
        if not match(a[i], c[j]):
            ac[i - j + 10000] = 1
for i in range(B):
    for j in range(C):
        if not match(b[i], c[j]):
            bc[i - j + 10000] = 1

ans = A + B + C
for i in range(-2 * M, 2 * M + 1):
    for j in range(-2 * M, 2 * M + 1):
        if (not ab[i + 10000]) and (not ac[j + 10000]) and (not bc[j - i + 10000]):
            l = min(0, i, j)
            r = max(A, B + i, C + j)
            ans = min(ans, r - l)

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

# coding: utf-8
# Your code here!
import math

def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

N = int(input())
a = [list(map(int, input().split())) for _ in range(N)]
ctr = 0

for i in range(N):
    for j in range(a[i][0], a[i][1] + 1, 2):
        if is_prime(j) and is_prime((j + 1) // 2):
            ctr += 1
    print(ctr)
    ctr = 0

### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys
import math
from itertools import chain

def input():
    return sys.stdin.readline().rstrip()

def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

Q = int(input())
a = [list(map(int, input().split())) for _ in range(Q)]
s = []
min_num = min(list(chain.from_iterable(a)))
max_num = max(list(chain.from_iterable(a)))
ctr = 0

for j in range(min_num, max_num + 1, 2):
    if is_prime(j) and is_prime((j + 1) // 2):
        s.append(j)

for i in range(Q):
    for k in s:
        if k >= a[i][0] and k <= a[i][1]:
            ctr += 1
    print(ctr)
    ctr = 0
### BUGGY CODE ###

N = input()
a = map(int,input().split())
ans = 1
for i in a:
    ans *= i
if ans > 10**18:
    print(-1)
else:
    print(ans)


### FIXED CODE ###

def aaa(a_list):
    ans = 1
    for i in a_list:
        ans = ans * i
        if ans > 10**18:
            return -1
    return ans

N = input()
a = input().split()
a = [int(i) for i in a]

if 0 in a:
    print(0)
else:
    print(aaa(a))
### BUGGY CODE ###

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

if a==b==c:
    print(0)
    exit()
    
for i in range(k):
    a_=b+c
    b_=a+c
    c_=a+b
    if abs(a_-b_) > 10**18:
        print('Unfair')
        exit()
    a=a_
    b=b_
    c=c_

if k==0:
    print(a-b)
else:
    print(a_-b_)


### FIXED CODE ###

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

if a==b==c:
    print(0)
    exit()
    
a_=b+c
b_=a+c
c_=a+b

if k==0:
    print(a-b)
elif k%2==0:
    print(a-b)
else:
    print(a_-b_)
### BUGGY CODE ###

n = int(input())
ListP = [n+1] + [int(i) for i in input().split()] + [n+1]
#ListPos = [ListP.index(i) for i in range(1, n+1)]
points = 0
for i in (range(0, n-1)):
	countHigh1 = 0
	countHigh2 = 0
	countLow1 = 0
	countLow2 = 0
	j = k = l = ListP.index(i+1)
	#print(j)
	while(True):
		j += 1
		if (ListP[j] > i+1):
			countHigh1 = j - l
			break
	while(True):
		if (j == n+1):
			countHigh2 = 0
			break
		j += 1
		if (ListP[j] > i+1):
			countHigh2 = j - (l + countHigh1)
			break
	while(True):		
		k -= 1
		if (ListP[k] > i+1):
			countLow1 = l - k
			break
	while(True):
		if (k == 0):
			break
		k -= 1
		if (ListP[k] > i+1):
			countLow2 = (l - countLow1) - k
			break
	points += (i+1) * (countLow1 * countHigh2 + countHigh1 * countLow2)
	#print(points, countLow1, countHigh2, countHigh1, countLow2)
print(points)

### FIXED CODE ###

n = int(input())
p = [int(i) for i in input().split()]

pos_list = [0] * n
for ind, i in enumerate(p):
	pos_list[i-1] = ind

left_nextInd = list(range(-1, n-1)) + [-1, -1]
right_nextInd = list(range(1, n+1)) + [n, n]

answer = 0
for i in range(1, n):
	ind = pos_list[i-1]
	l1 = left_nextInd[ind]
	l2 = left_nextInd[l1]
	r1 = right_nextInd[ind]
	r2 = right_nextInd[r1]

	answer += i * ((ind-l1) * (r2-r1) + (r1-ind) * (l1-l2))

	left_nextInd[r1] = l1
	right_nextInd[l1] = r1
print(answer)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
cnt0=[0]*60
cnt1=[0]*60
mod=10**9+7
for i in a:
  for j in range(60):
    if (i>>j)&1:
      ans+=(cnt0[j]*(1<<j))%mod
    else:
      ans+=(cnt1[j]*(1<<j))%mod
  for j in range(60):
    if (i>>j)&1:
      cnt1[j]+=1
    else:
      cnt0[j]+=1
ans%=mod
print(ans)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
cnt0=[0]*60
cnt1=[0]*60
mod=10**9+7
tp=[0]*60
for i in range(60):
  tp[i]=(1<<i)%mod
for i in range(60):
    x=1<<i
    one=sum(1 for j in a if j&x)
    ans+=tp[i]*one*(n-one)
print(ans%mod)
### BUGGY CODE ###

n, q = input().split()
q = int(q)
S = input()
for i in range(q):
    l, r = input().split()
    l = int(l)
    r = int(r)
    print(S[l-1:r].count("AC"))

### FIXED CODE ###

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

S = list(input())

A = [0]

for i in range(1, n+1):
    # if S[i-1:i]:
    if S[i-2:i] == ['A', 'C']:
        A.append(A[-1] + 1)
    else: 
        A.append(A[-1])
# print(A[1:])
A = A[1:]
for i in range(q):
    a, b = map(int, input().split())
    print(A[b-1] - A[a-1])
### BUGGY CODE ###

def main():
    from fractions import gcd

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

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
        ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    from fractions import gcd

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

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

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

s = input()
K = int(input())
l = []
for c in range(1, len(s)+1):
  l += list(set([s[i:i+c] for i in range(len(s)-c+1)]))
print(sorted(l)[K-1])

### FIXED CODE ###

from collections import deque
S = input()
K = int(input())
ans = deque([])
for i in range(K):
  for j in range(len(S) - i):
    ans.append(S[j:j+i+1])
print(sorted(set(ans))[K-1])
### BUGGY CODE ###

from collections import defaultdict
import sys

sys.setrecursionlimit(10**9)

N, Q = map(int, input().split())
G = defaultdict(list)
for i in range(N - 1):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1  # 0-indexed
    G[a].append(b)
    G[b].append(a)

# print('G', G)

V = [0] * N
for _ in range(Q):
    p, x = map(int, input().split())
    p = p - 1  # 0-indexed
    V[p] += x


def dfs(v, p):
    if p != -1:
        V[v] += V[p]
    for idx in G[v]:
        if idx == p:
            continue
        dfs(idx, v)


dfs(0, -1)

# print('V', V)

print(' '.join(map(str, V)))


### FIXED CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N, Q = map(int, input().split())
G = defaultdict(list)
for i in range(N - 1):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1  # 0-indexed
    G[a].append(b)
    G[b].append(a)

# print('G', G)

V = [0] * N
for _ in range(Q):
    p, x = map(int, input().split())
    p = p - 1  # 0-indexed
    V[p] += x


def dfs(v, p):
    if p != -1:
        V[v] += V[p]
    for idx in G[v]:
        if idx == p:
            continue
        dfs(idx, v)


dfs(0, -1)

# print('V', V)

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

n, k = map(int, input().split())
alist = list(map(int, input().split()))
t = [0] * 40
for a in alist:
  for i in range(40):
    t[i] += a & 1
    a >>= 1
result = 0
for i in range(0, k + 1):
  j = i
  m = 1
  s = 0
  for l in range(40):
    if j & 1 == 0:
      s += m * t[l]
    else:
      s += m * (n - t[l])
    j >>= 1
    m <<= 1
  result = max(result, s)
print(result)


### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))

bcs = [0] * 41
for i in range(N):
  a = A[i]
  for j in range(41):
    if a & (1 << j) != 0:
      bcs[j] += 1

X = 0
for i in range(40, -1, -1):
  if bcs[i] >= N - bcs[i]:
    continue  
  t = 1 << i
  if X + t <= K:
    X += t

result = 0
for i in range(N):
  result += X ^ A[i]
print(result)
### BUGGY CODE ###

from collections import defaultdict
n = int(input())
if n <= 1:
    print(0)
else:
    prime = True
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            prime = False
            break
    if prime:
        print(1)
    else:
        store = defaultdict(int)
        num = 2
        while num <= n:
            if n % num == 0:
                store[num] += 1
                n = n // num
            else:
                num += 1
        count = 0
        for v in store.values():
            k = v
            for i in range(1, v+1):
                if k >= i:
                    k -= i
                    count += 1
                else:
                    break
        print(count)


### FIXED CODE ###

import math
from collections import defaultdict

def isPrime(num):
    prime = True
    save = num
    save2 = None
    for i in range(2, int(math.sqrt(num))+1):
        if num % i == 0:
            prime = False
            save = i
            save2 = num // i
            break
    return prime, save, save2

store = defaultdict(int)

def solve(num):
    check, num1, num2 = isPrime(num)
    if check == True:
        global store
        store[num1] += 1
    if check == False:
        solve(num1)
        solve(num2)

n = int(input())
if n <= 1:
    print(0)
else:
    count = 0
    solve(n)
    for key, v in store.items():
        for i in range(1, v+1):
            if store[key] >= i:
                store[key] -= i
                count += 1
            else:
                break
    print(count)
### BUGGY CODE ###

n = int(input())
a,b = map(int,input().split())
for _ in range(n-1):
    c,d = map(int,input().split())
    deltaA = 0
    deltaB = d/c * (a + deltaA) - b 
    #print(deltaA,deltaB)
    while deltaB < 0 or int(deltaB) != deltaB:
        deltaA += 1
        deltaB = d/c * (a + deltaA) - b 
        #print(deltaA,deltaB)
    a += int(deltaA)
    b += int(deltaB)
#print(a,b)
print(a+b)

### FIXED CODE ###

n = int(input())
a,b = 1,1
for _ in range(n):
    x,y = map(int,input().split())
    k = -min(-a//x,-b//y)
    a = k*x
    b = k*y
print(a+b)
### BUGGY CODE ###

import re

N,Q = list(map(int,input().split()))
s = input()
lis=[]


for i in range(len(s)):
    count = len(re.findall(r'AC', s[:i+1]))
    lis.append(count)
for i in range(Q):
    l,r = list(map(int,input().split()))
    print(lis[r-1]-lis[l-1])

### FIXED CODE ###

import re
 
N,Q = list(map(int,input().split()))
s = input()
lis=[0]
 
count = 0
for i in range(1,len(s)):
    if s[i-1] == 'A' and s[i] == 'C':
        count +=1
    lis.append(count)
for i in range(Q):
    l,r = list(map(int,input().split()))
    print(lis[r-1]-lis[l-1])
### BUGGY CODE ###

K = input()
N = len(K)
D = int(input())
Y = [0] * D
P = 10**9+7
a = 0
for i in range(N):
    nY = [0] * D
    c = int(K[i])
    for j in range(10):
        if j < c:
            nk = (j+a)%D
            nY[nk] += 1

        for k in range(D):
            nk = (j+k)%D
            nY[nk] += Y[k]
        
    a = (a+c) % D
    Y = nY
print((Y[0] - 1 + (a==0)) % P)


### FIXED CODE ###

K = input()
N = len(K)
D = int(input())
Y = [0] * D
P = 10**9+7
a = 0
for i in range(N):
    nY = [0] * D
    c = int(K[i])
    for j in range(10):
        if j < c:
            nk = (j+a) % D
            nY[nk] = (nY[nk] + 1) % P

        for k in range(D):
            nk = (j+k) % D
            nY[nk] = (nY[nk] + Y[k]) % P
        
    a = (a+c) % D
    Y = nY
print((Y[0] - 1 + (a==0)) % P)
### BUGGY CODE ###

N,K,Q = map(int,input().split())
A = []
P = []

for i in range(Q):
    A.append(int(input()))
for i in range(N):
    P.append(K)

for ans in A:
    for index,value in enumerate(P):
        if (ans-1)==index:
            continue
        P[index]-=1

for value in P:
    if value<=0:
        print('No')
    else:
        print('Yes')


### FIXED CODE ###

N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
P = [K-Q]*N


for i in range(Q):
    P[A[i]-1]+=1

for value in P:
    if value<=0:
        print('No')
    else:
        print('Yes')
### BUGGY CODE ###

import sys
import numpy as np
sys = sys.stdin.buffer.readline
N = int(input())
A = np.array(list(map(int, input().split())))


def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)


v = A[0]
for a in A:
    v = gcd(v, a)

for d in range(2, max(A)):
    if np.count_nonzero(A % d == 0) >= 2:
        if v == 1:
            print('setwise coprime')
        else:
            print('not coprime')
        exit()
print('pairwise coprime')


### FIXED CODE ###

import sys


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def is_prime_MR(n):
    d = n - 1
    d = d // (d & -d)
    L = [2, 7, 61] if n < 1 << 32 else [
        2, 3, 5, 7, 11, 13, 17
    ] if n < 1 << 48 else [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]
    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 find_factor_rho(n):
    m = 1 << n.bit_length() // 8
    for c in range(1, 99):

        def f(x):
            return (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 is_prime_MR(g):
                return g
            elif is_prime_MR(n // g):
                return n // g
            return find_factor_rho(g)


def prime_factor(n):
    i = 2
    ret = {}
    rhoFlg = 0
    while i * i <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
        if k:
            ret[i] = k
        i += i % 2 + (3 if i % 3 == 1 else 1)
        if i == 101 and n >= 2**20:
            while n > 1:
                if is_prime_MR(n):
                    ret[n], n = 1, 1
                else:
                    rhoFlg = 1
                    j = find_factor_rho(n)
                    k = 0
                    while n % j == 0:
                        n //= j
                        k += 1
                    ret[j] = k
    if n > 1:
        ret[n] = 1
    if rhoFlg:
        ret = {x: ret[x] for x in sorted(ret)}
    return ret


input = sys.stdin.buffer.readline

N = int(input())
A = list(map(int, input().split()))
g = 0
for a in A:
    g = gcd(g, a)

if g > 1:
    print('not coprime')
    exit()

X = [0] * 1001001
for a in A:
    for p in prime_factor(a):
        if X[p]:
            print('setwise coprime')
            exit()
        X[p] = 1

print('pairwise coprime')