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

import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
from sys import flags
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
x=list(input())
cnt=Counter(x)
x=int("".join(x),2)
# print(x)
# print(math.log2(2*10**5))
# print(cnt)
def wari(now):
    tmp=cnt["1"]
    # print(flag,tmp)
    if flag==1:
        tmp-=1
    else:
        tmp+=1
    # print(tmp)
    if tmp==0:
        return 0
    now%=tmp
    ans=1
    while now:
        cnt2=Counter(bin(now))
        now%=cnt2["1"]
        ans+=1
    return ans

for i in range(n):
    flag=0
    if x&1<<(n-1-i):
        flag=1
        x-=pow(2,(n-1-i))
    else:
        flag=0
        x+=pow(2,(n-1-i))
    # now=int("".join(x),2)
    # print(x)
    print(wari(x))
    # print(x&1<<(n-1-i))
    if x&1<<(n-1-i):
        x-=pow(2,(n-1-i))
    else:
        x+=pow(2,(n-1-i))
    # print(x)

### FIXED CODE ###

import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
from sys import flags
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
x=list(input())
cnt=Counter(x)
x2=int("".join(x),2)
one=cnt["1"]
# print(x)
# print(math.log2(2*10**5))
# print(cnt)
# print(x2,one)
lst=[0]*(2*10**5+10)
# lst[0]=-1
flaglst=[0,0]
if one-1!=0:
    flaglst[0]=x2%(one-1)
flaglst[1]=x2%(one+1)
# print(flaglst)

for i in range(2*10**5):
    now=i+1
    ans=0
    while now:
        cnt2=0
        m=0
        while now>=pow(2,m):
            if now&1<<m:
                cnt2+=1
            m+=1
        now%=cnt2
        ans+=1
    lst[i+1]=ans
# # print(lst[:100])

for i in range(n):
    tmp=0
    if x[i]=="1":
        tmp=flaglst[0]
        if one-1!=0:
            tmp-=pow(2,n-1-i,one-1)
            tmp%=one-1
        else:
            print(0)
            continue
    else:
        tmp=flaglst[1]
        tmp+=pow(2,n-1-i,one+1)
        tmp%=one+1
    # print(tmp,pow(2,n-1-i),one)

    print(lst[tmp]+1)
### BUGGY CODE ###

import fractions 
import math
from functools import reduce

#最大公約数
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

#インプット
n = int(input())
a = list(map(int,input().split()))

print(sum([(lcm_list(a))//x for x in a])%((10**9)+7))

### FIXED CODE ###

import fractions
 
import math
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
n = int(input())
a = list(map(int,input().split()))

c=0

z=lcm_list(a)

for i in range(0,n):
  c+=(z//a[i])
#print(z)
print(c%((10**9)+7))
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
if 0 in a:
  print(0)
  quit()
ans = 1
for i in a:
    ans *= i
if ans <= 10 ** 18:
    print(ans)
else:
    print(-1)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
import sys
limit = 10 ** 18
if 0 in a:
    print(0)
    sys.exit()
else:
    ans = 1
    for i in range(n):
        ans *= a[i]
        if ans > limit:
            print(-1)
            sys.exit()
    print(ans)
### BUGGY CODE ###

# coding: utf-8
s = input()
k = int(input())
sb_str = []
for i in range(len(s)+1):
    for j in range(1+i,len(s)+1):
        if i < j:
            sb_str.append(s[i:j])

sb_str = list(set(sb_str))
sb_str.sort()
print(sb_str[k-1])


### FIXED CODE ###

# coding: utf-8
s = input()
k = int(input())
sb_str = []
for i in range(len(s)+1):
    for j in range(1+i,len(s)+1):
        if len(s[i:j]) > 5:
            break
        if i < j:
            sb_str.append(s[i:j])

sb_str = list(set(sb_str))
sb_str.sort()
print(sb_str[k-1])
### BUGGY CODE ###

N = int(input())
A_list = list(map(int,input().split()))
cnt = 0
for i in range(1,N):
    for j in range(i+1, N+1):
        cnt += A_list[i-1] * A_list[j-1]
#        if cnt >= (10**9 + 7):
print(cnt % (10**9 + 7))

### FIXED CODE ###

from itertools import accumulate
N = int(input())
A_list = list(map(int,input().split()))
B_list = A_list[::-1]
C_list = list(accumulate(B_list))
D_list = C_list[::-1]
cnt = 0
for i in range(1,N):
    cnt += (A_list[i-1] * D_list[i]) % (10**9 + 7)

    if cnt >= (10**9 + 7):
        cnt -= (10**9 + 7)
print(cnt)
### BUGGY CODE ###

from sys import stdin
import math
import itertools
import re
import sys
sys.setrecursionlimit(10**8)
 
 
def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]
 
dp = {}
T = {}
 
def solve(input_string):
    S = input_string[1]
    intMatrix = makeIntMatrix(input_string[2:])
    #print(input_string[2:])
    for line in intMatrix:
        L, R = line
        #print(l, r)
        #print(S[l:r+1])
        #cnt = len(re.findall(r'AC', S[l-1:r]))
        D = R - L
        totalCnt = cntAC(R-1, R, D, S, 0)
        print(totalCnt)
    return
 

def cntAC(l, r, D, S, cnt):
    global dp
    global T
    if r-l == D+1:
        return cnt
    if str(l)+str(r) not in T:
        T[str(l)+str(r)] = S[l-1:r]
        t = T[str(l)+str(r)]
    if str(l)+str(r) not in dp:
        #print(t)
        dp[str(l)+str(r)] = len(t.split('AC'))-1
        cnt = dp[str(l)+str(r)]
        return cntAC(l-1, r, D, S, cnt)
    else:
        cnt = dp[str(l)+str(r)]
        return cntAC(l-1, r, D, S, cnt)
 
 
def main():
    input_lines = stdin.readlines()
    answer = solve(input_lines)
    #print(answer)
 
 
if __name__ == '__main__':
    main()


### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t=[0]*(N+1)
for i in range(N):
  t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
  l, r = map(int, input().split())
  print(t[r-1] - t[l-1])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)
n,m = map(int,input().split())
e = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    e[a].append(b)
    e[b].append(a)
qv = int(input())
Q = [list(map(int,input().split())) for i in range(qv)]
Q = Q[::-1]
l = [[0]*(11) for i in range(n+1)]
for v,d,c in Q:
    if l[v][d] > 0:
        continue
    l[v][d] = c
dic = {}
color = [0]*(n+1)

left = [i for i in range(1,n+1)]
num = 0
while num < qv and left:
    v,d,c = Q[num]
    if v not in dic:
        for i in range(10,-1,-1):
            if l[v][i] > 0:
                M = i
                break
        dic[v] = [set() for i in range(M+1)]
        s = set()
        s.add(v)
        dic[v][0] |= s
        dist = [float("INF")]*(n+1)
        dist[v] = 0
        q = [v]
        for i in range(1,M+1):
            nq = []
            for now in q:
                for nex in e[now]:
                    if dist[nex]<= i:
                        continue
                    nq.append(nex)
                    dist[nex] = i
                    s.add(nex)
            dic[v][i] |= s
            q = nq
    nl = []
    
    for i in left:
        if i in dic[v][d]:
            color[i] = c
        else:
            nl.append(i) 
    num += 1
    
    left = nl
    
for i in color[1:]:
    print(i)

### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(10**6)
n,m = map(int,input().split())
e = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    e[a].append(b)
    e[b].append(a)
qv = int(input())
Q = [list(map(int,input().split())) for i in range(qv)]

color = [0]*(n+1)
used = [-1]*(n+1)

for v,d,c in Q[::-1]:
    if used[v] > d:
        continue
    
    q = deque([[v,d]])
    while q:
        now, dis = q.popleft()
        if dis < 0:
            continue
        if color[now] == 0:
            color[now] = c
        for nex in e[now]:
            if used[nex] < dis-1:
                used[nex] = dis-1
                q.append([nex,dis-1])
    
for i in color[1:]:
    print(i)
### BUGGY CODE ###

import sys

n, m = map(int, input().split())
bridge = list(map(int, sys.stdin.read().split()))
total = n*(n-1)//2
ans =[total]
u = [i for i in range(n+1)]
size = [1 for i in range(n+1)]
rank = [1 for i in range(n+1)]
def check(x, y):
    return find(x) != find(y)

def find(x):
    if x == u[x]:
        return x
    else:
        u[x] = find(u[x])
        return u[x]

for x , y in zip(bridge[-2::-2],bridge[::-2]):
    if check(x, y):
        X = find(x)
        Y = find(y)
        total -= size[X] * size[Y]
        ans += [total]
        if rank[X] == rank[Y]:
            X, Y = sorted([X,Y])
            u = [Y if i == X else i for i in u]
            rank =[x+1 if u[i] == u[Y] else x for i, x in enumerate(rank)]
        else:
            if rank[X] > rank[Y]:
                X, Y = sorted([X,Y])
            rank =[x+1 if u[i] == u[Y] else x for i, x in enumerate(rank)]
            u = [Y if i == u[X] else i for i in u]
        size[Y] += size[X]

    else:
        ans += [total]

print(*ans[-2::-1], sep="\n")


### FIXED CODE ###

import sys
n , m, *e = map(int,sys.stdin.read().split())
total = n*(n-1)//2
ans =[total]
u = [-1]*(n+1)

def find(x):
    if u[x] < 0 :
        return x
    else:
        return find(u[x])

for x , y in zip(e[-2:1:-2],e[:1:-2]):
    x = find(x)
    y = find(y)
    x, y = sorted((x, y))
    if x != y:
        total -= u[x] * u[y]
        u[x] += u[y]
        u[y] = x
    ans += [total]

print(*ans[::-1], sep="\n")
### BUGGY CODE ###

import sys
input = sys.stdin.readline
import numpy as np
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
BC = [[int(x) for x in input().split()] for _ in range(M)]
A = np.array(sorted(A),np.int64)
BC = sorted(BC,key=lambda x:x[1])
for i in BC:
    B, C = i
    C_in = np.searchsorted(A,C,side="left")
    last = min(C_in,B)
    A[:last] = C
    A.sort()
print(A.sum())

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
BC = [[int(x) for x in input().split()] for _ in range(M)]
BC = sorted(BC, reverse = True, key = lambda x:x[1])
N2 = N
D = []
for i in BC:
    temp = min(N2,i[0])
    D += [i[1]] * temp
    N2 -= temp
    if not N2:
        break
A += D
A.sort()
print(sum(A[len(A) - N:]))
### BUGGY CODE ###

#Make a Rectangle
N = int(input())
A = list(map(int, input().split()))

a = sorted(list(set(A)), reverse=True)
b = []
for ai in a:
    c = A.count(ai)
    b += [ai]*(c//2)
    if (len(b)>=4):
        break
b+=[0,0]

print(b[0]*b[1])

### FIXED CODE ###

#Make a Rectangle
N = int(input())
A = list(map(int, input().split()))

a = sorted(A, reverse=True)
b = []

i = 0
while i<N-1:
    if ( a[i]==a[i+1] ):
        b+=[a[i]]
        i+=2
    else:
        i+=1
    if (len(b)>1):
        break

if (len(b)<2):
    print(0)
else:
    print(b[0]*b[1])
### BUGGY CODE ###

N=int(input())
a=input().split()
count =0
ans=0
while(count%N==0):
 for i in range(N):
  a[i]=int(a[i])
  if(a[i]%2==0):
    a[i]=int(a[i]/2)
    count +=1
    ans=count
  else:
    break
ans=int(ans/N)
print(ans)

### FIXED CODE ###

N = int(input())
A = input().split()
judge = 1 #1:継続, 0:終了
count = 0

while(judge):
  for i in range(N):
   A[i] = int(A[i])
   if(A[i]%2 == 1):
    judge = 0
    break
   else:
    A[i] = A[i]/2
    count += 1

print(int(count/N))
### BUGGY CODE ###

#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
n = int(input())
a = list(map(int, input().split()))
ans = a[0]

for i in range(1,n):
    ans = ans * a[i]

if ans <= 1000000000000000000:
 print(ans)
else:
 print("-1")


### FIXED CODE ###

#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
n = int(input())
a = list(map(int, input().split()))
sort = sorted(a)
ans = sort[0]

for i in range(1,n):
    if ans <= 1000000000000000000:
        ans = ans * sort[i]

if ans <= 1000000000000000000:
 print(ans)
else:
 print("-1")
### BUGGY CODE ###

s = input()
t = input()
ls, lt = len(s), len(t)
dp = [[0 for _ in range(lt+1)] for _ in range(ls+1)]
for i in range(1, ls+1):
    for j in range(1, lt+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = max(dp[i-1][j-1]+1, dp[i-1][j], dp[i][j-1])
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])
i, j = ls, lt
ans = []
while(i > 0 and j > 0):
    if dp[i][j] == dp[i-1][j-1] + 1:
        ans.append(s[i-1])
        i -= 1
        j -= 1
    elif dp[i][j] == dp[i-1][j]:
        i -= 1
    else:
        j -= 1
ans.reverse()
print(str(''.join(ans)))


### FIXED CODE ###

s = input()
t = input()
ls = len(s)
lt = len(t)
dp = [[0 for _ in range(lt+1)] for _ in range(ls+1)]
for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])
#back trace
ans = []
while i >= 0 and j >= 0:
    if dp[i+1][j+1] == dp[i][j] + 1 and s[i] == t[j]:
        ans.append(s[i])
        i -= 1
        j -= 1
    elif dp[i+1][j+1] == dp[i+1][j]:
        j -= 1
    else: i -= 1
ans.reverse()
print(''.join(ans))
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[0]*N
count=0
for i in range(N):
    for j in range(N):
        if A[i]%A[j]==0:
            count+=1
    if count==1:
        B[i]=1
    else:
        B[i]=0
    count=0
print(sum(B))

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[0]*(max(A)+1)
count=0
for i in A:
    for j in range(0,len(B),i):
        B[j]+=1
for k in A:
    if B[k]==1:
        count+=1
print(count)
### BUGGY CODE ###

import fractions
N=int(input())
a=list(map(int,input().split()))
mod=10**9+7
c=a[0]
for i in range(1, N):
    c=c*a[i]//fractions.gcd(c,a[i])
b=0
for k in a:
    b+=c//k
    b%=mod
print(b)

### FIXED CODE ###

from fractions import gcd
def main():
    N=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    b=0
    c=1
    for a in A:
        c=c*a//gcd(c,a)
    c%=mod
    for a in A:
        b+=c*pow(a,mod-2,mod)
    print(b%mod)
if __name__=="__main__":
    main()
### BUGGY CODE ###

import math
from decimal import *
mod = 10 ** 9 + 7


N = int(input())

sosuu = [2,3,5, 7]
for i in range(2, N+1):
    if i % 2 == 0 or i % 3 == 0 or i == 5 or i % 7 == 0:
        continue
    for j in range(2,i+1):
        if j == i:
            sosuu.append(i)
        if i % j == 0:
            break

soinsuu_num = [0 for i in range(len(sosuu))]

for i in range(1, N+1):
    if i == 1:
        continue
    temp = i
    for j in range(len(sosuu)):
        while temp % sosuu[j] == 0 and temp != 1:
            soinsuu_num[j] += 1
            temp = Decimal(temp) / Decimal(sosuu[j])

ans = 1
for i in soinsuu_num:
    if i != 0:
        ans = ans * (i + 1) % mod

print(ans)

### FIXED CODE ###

import math
from decimal import *
mod = 10 ** 9 + 7


N = int(input())

sosuu = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]
for i in range(2, N+1):
    if i % 2 == 0 or i % 3 == 0 or i == 5 or i % 7 == 0 or i % 11 == 0 or i%13 == 0 or i%17 == 0\
            or i%19 == 0 or i%23 == 0 or i%29 == 0 or i%31 == 0 or i%37 == 0:
        continue
    for j in range(2,i+1):
        if j == i:
            sosuu.append(i)
        if i % j == 0:
            break

soinsuu_num = [0 for i in range(len(sosuu))]

for i in range(1, N+1):
    if i == 1:
        continue
    temp = i
    for j in range(len(sosuu)):
        while temp % sosuu[j] == 0 and temp != 1:
            soinsuu_num[j] += 1
            temp = Decimal(temp) / Decimal(sosuu[j])
        if temp == 1:
            break

ans = 1
for i in soinsuu_num:
    if i != 0:
        ans = ans * (i + 1) % mod

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

# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

h,w = map(int,readline().split())
sh,sw = map(int,readline().split())
gh,gw = map(int,readline().split())
b = read().split()

sh -= 1; sw -= 1; gh -= 1; gw -= 1

#print(b)

from collections import deque

def nbd(nh,nw,cost,dv):
    if 0 <= nh < h and 0 <= nw < w and b[nh][nw]==".":
        dv += cost
        if dv < res[nh][nw]:
            res[nh][nw] = dv
            if cost: q.append((dv,nh,nw))
            else: q.appendleft((dv,nh,nw))
    return 


INF = 1<<30
res = [[INF]*w for _ in range(h)] #startからの最短距離
res[sh][sw] = 0
q = deque([(0,sh,sw)]) #(そこまでの距離、点)
while q:
    dv,vh,vw = q.popleft()
    if res[vh][vw] < dv: continue
    if vh==gh and vw==gw: break
    nbd(vh-1,vw,0,dv)
    nbd(vh,vw-1,0,dv)
    nbd(vh+1,vw,0,dv)
    nbd(vh,vw+1,0,dv)

    nbd(vh-1,vw-1,1,dv)
    nbd(vh-1,vw+1,1,dv)
    nbd(vh+1,vw-1,1,dv)
    nbd(vh+1,vw+1,1,dv)

    for i in range(-2,3):
        nbd(vh-2,vw+i,1,dv)
        nbd(vh+2,vw+i,1,dv)

    for i in range(-1,2):
        nbd(vh+i,vw-2,1,dv)
        nbd(vh+i,vw+2,1,dv)
    
    #print(res)
        
ans = res[gh][gw]
if ans != INF:
    print(ans)
else:
    print(-1)







### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

h,w = map(int,readline().split())
sh,sw = map(int,readline().split())
gh,gw = map(int,readline().split())
b = read().split()

sh -= 1; sw -= 1; gh -= 1; gw -= 1

#print(b)

from collections import deque

def nbd(nh,nw,dv):
    if dv < res[nh][nw]:
        res[nh][nw] = dv
        q.appendleft((dv,nh,nw))
    return 




INF = 1<<30
res = [[INF]*w for _ in range(h)] #startからの最短距離
res[sh][sw] = 0
q = deque([(0,sh,sw)]) #(そこまでの距離、点)
while q:
    dv,vh,vw = q.popleft()
    if res[vh][vw] < dv: continue
    if vh==gh and vw==gw: break
    
    if vh and b[vh-1][vw]==".":
        nbd(vh-1,vw,dv)
    if vw and b[vh][vw-1]==".":
        nbd(vh,vw-1,dv)
    if vh+1<h and b[vh+1][vw]==".":
        nbd(vh+1,vw,dv)
    if vw+1<w and b[vh][vw+1]==".":
        nbd(vh,vw+1,dv)
    
    for i in range(-2,3):
        nh = vh+i
        if nh < 0 or nh >= h: continue
        for j in range(-2,3):
            nw = vw + j
            if nw < 0 or nw >= w: continue
            if abs(i)+abs(j) > 1:
                if b[nh][nw] == "." and dv+1 < res[nh][nw]:
                    res[nh][nw] = dv+1
                    q.append((dv+1,nh,nw))


ans = res[gh][gw]
if ans != INF:
    print(ans)
else:
    print(-1)
### BUGGY CODE ###

class PrimeChecker(object):
    def __init__(self):
        self.primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53]
    
    def isPrime(self, n):
        if n in self.primes:
            return True
        elif n < 53:
            return False
        else:
            for i in self.primes:
                if n % i == 0:
                    return False
            for i in range(53, n//2, 2):
                if n % i == 0:
                    return False
            self.primes.append(n)
            return True


N = int(input())
count = 0
primeChecker = PrimeChecker()
for _ in range(N):
    if primeChecker.isPrime(int(input())):
        count += 1
print(count)




### FIXED CODE ###

f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))
### BUGGY CODE ###


from functools import reduce

N = int(input())
AS = map(int, input().split())

ans = reduce(lambda a,b: a*b, list(AS))

if ans > pow(10, 18):
    print(-1)
else:
    print(ans)


### FIXED CODE ###


import sys
from functools import reduce

input = sys.stdin.readline

N = int(input())
A = input().rstrip().split()

def main():
    result = 1
    if '0' in A:
        return 0

    for a in A:
        a = int(a)
        result *= a

        if result > pow(10, 18):
            return -1

    return result

ans = main()
print(ans)
### BUGGY CODE ###

import math

lst = []
while True:
    try:
        a, b = map(int, input().split())
        lst.append(int(math.log(10, a+b))+1)
    except EOFError:
        for i in lst:
            print(i)

### FIXED CODE ###

import math

lst = []
while True:
    try:
        a, b = map(int, input().split())
        lst.append(int(math.log10(a+b))+1)
    except EOFError:
        for i in lst:
            print(i)
        break
### BUGGY CODE ###

S = input()
L = len(S)

mod = 2019
dp = [0]*(L)
zero = 0
for l in range(L):
    t = int(S[-l:])%mod
    dp[l] = t
    if t==0:
        zero+=1

l = len(set(dp))
print(L-l+zero)

### FIXED CODE ###

S = list(input())[::-1]
L = len(S)
from collections import defaultdict

mod = 2019
t = 0
dic = defaultdict(int)
ans = 0
for l in range(L):
    t += pow(10, l, mod)*int(S[l])%mod
    t %= mod
    ans += dic[t]
    dic[t] += 1
    if t==0:
        ans += 1

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

import sys
n = int(input())
a = [int(i) for i in sys.stdin]
a.sort()
b = list(set(a))
count=0
for i in range(len(b)):
  if a.count(b[i])%2!=0:
    count+=1
print(count)

    


### FIXED CODE ###

import sys
n = int(input())
a = [int(i) for i in sys.stdin]
a.sort()
dict = {}
for i in range(n):
  if a[i] in dict:
    del dict[a[i]]
  else: 
  	dict[a[i]]=0
print(len(dict))
### BUGGY CODE ###

import math

n = int(input())
A = list(map(int,input().split()))
mod = 10**9+7

A.sort()

lcm = A[0]
for i in range(1,n):
    lcm = (lcm*A[i])//math.gcd(lcm,A[i])


ans = 0
for i in range(n):
    ans += lcm // A[i]
    ans %= mod
print(ans)






### FIXED CODE ###

import math
from collections import defaultdict

n = int(input())
A = list(map(int,input().split()))
mod = 10**9+7

divisor_primes = defaultdict(int)

def prime_factrizer(n):
    arr = []
    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.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

for a in A:
    factrized_a = prime_factrizer(a)
    for prime in factrized_a:
        divisor_primes[prime[0]] = max(divisor_primes[prime[0]],prime[1])

invs = [1] * (max(A) + 1)
for i in range(2, max(A) + 1):
    invs[i] = mod - invs[mod % i] * (mod//i) % mod

lcm = 1
for key in divisor_primes.keys():
    power = divisor_primes[key]
    div = 1
    for i in range(power):
        div *= key
        div %= mod
    lcm *= div

ans = 0

for a in A:
    ans += invs[a]
    ans %= mod
ans *= lcm
ans %= mod
print(ans)
### BUGGY CODE ###

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

counts = [0 for _ in range(max(A)+1)]
for a in A:
  counts[a] += 1

integers = [1 for _ in range(max(A)+1)]
integers[0] = 0
integers[1] = 0
max_count = 0
for i in range(max(A)+1):
  if integers[i] >= 1:
    count = 0
    for j in range(i,max(A)+1,i):
      count += counts[j]
      integers[j] = 0
    max_count = max(max_count,count)

if max_count == N:
  answer = 'not coprime'
elif max_count >= 2:
  answer = 'setwise coprime'
else:
  answer = 'pairwise coprime'

print(answer)

### FIXED CODE ###

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

def get_count(p):
  integers = [1 for _ in range(p+1)]
  integers[0] = 0
  integers[1] = 0
  counts = [0 for _ in range(p+1)]
  for a in A:
    counts[a] += 1
  answer = 0
  for i in range(p+1):
    if integers[i] >= 1:
      count = 0
      for j in range(i,p+1,i):
        count += counts[j]
        integers[j] = 0
      answer = max(answer,count)
  return answer

count = get_count(max(A))
if count == N:
  answer = 'not coprime'
elif count >= 2:
  answer = 'setwise coprime'
else:
  answer = 'pairwise coprime'

print(answer)