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

import heapq
f=lambda:map(int,input().split())
V,E,L=f()
G=[[] for _ in [0]*(V+1)]
# G=[]

for _ in range(E):
    s,t,d=f()
    if d<=L:
        G[s].append((t,(0,d)))
        G[t].append((s,(0,d)))
    
INF=float('inf')

def dijk(s,t):
    q=[((INF,INF),i) for i in range(V+1)]
    # q[i]:点i+1の現状のコスト
    q[s]=((0,0),s)
    heapq.heapify(q)

    res=[(INF,INF)]*(V+1)
    while q:
        C,p=heapq.heappop(q)
        if C<res[p]:
            res[p]=C
        else:
            continue
        if p==t:
            break
        for np,D in G[p]:
            costA=res[np]
            d=D[1]+C[1]
            if d>L:
                costB=(1+C[0]+D[0],D[1])
            else:
                costB=(C[0]+D[0],d)
            heapq.heappush(q,(min(costA,costB),np))
    return res[t][0] if res[t][0]<INF else -1

Q=int(input())
for _ in [0]*Q:
    s,t=f()
    print(dijk(s,t))

### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

f=lambda:map(int,input().split())
N,M,L=f()
G=[[0]*N for _ in [0]*N]
for _ in [0]*M:
    a,b,c=f()
    G[a-1][b-1]=c
    G[b-1][a-1]=c
    
csr=csr_matrix(G)

D=floyd_warshall(csr)
INF=float('inf')
G=[[INF]*N for _ in [0]*N]
for i in range(N):
    for j in range(N):
        if i!=j and D[i][j]<=L:
            G[i][j]=1
            G[j][i]=1
csr=csr_matrix(G)
res=floyd_warshall(csr)
Q=int(input())
for _ in [0]*Q:
    s,t=f()
    r=res[s-1][t-1]
    print(int(r-1) if r<INF else -1)
### BUGGY CODE ###

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

t = sorted(t)[::-1]
biggest = t[0]
for i in range(biggest, 10**18+1, biggest):
    ok = True
    for j in t[1:]:
        if i%j != 0:
            ok = False
            break
    if ok == True:
        break
    
print(i)
            

### FIXED CODE ###

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))
    
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

def lcm(a, b):
    return a*b//gcd(a, b)

result = 1
for i in range(n):
    result = lcm(result, t[i])
    
print(result)
### BUGGY CODE ###

x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

r = []

for i in range(x):
  for j in range(y):
    for h in range(z):
      r.append(a[i]+b[j]+c[h])
list.sort(r,reverse=True)
for i in range(k):
  print(r[i])

### FIXED CODE ###

x,y,z,k = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
b = sorted(list(map(int,input().split())),reverse=True)
c = sorted(list(map(int,input().split())),reverse=True)

r = []
for i in range(x):
  for j in range(y):
    for h in range(z):
      if (i+1)*(j+1)*(h+1) > k:
                break
      r.append(a[i]+b[j]+c[h])
list.sort(r,reverse=True)
for i in range(k):
  print(r[i])
### BUGGY CODE ###

n = int(input(''))

l = len(str(n))
s = 0
for i in range(len(str(n))):
    j = l-i-1
    y = n//10**j
    n -= y*10**j
    s+=y

if s%9==0:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

n = input('')

s=0
for c in n:
    s+=int(c)

if s%9==0:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
dp=[0 for i in range(n)]
dp[0]=0
for i in range(1,n):
    x=l[i]
    dp[i]=min((dp[j]+abs(x-l[j])) for j in range(max(0,i-k),i))
print(dp[-1])

### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int, input().split()))
v=[0]*n
for i in range(1,n):
	u = h[i]
	v[i] = min([v[j] + abs(h[j]-u) for j in range(max(0, i-k), i)])
print(v[n-1])
### BUGGY CODE ###

import bisect

Q=int(input())

b=0
a=[]
min=0
tmp=0
j=0
for i in range(Q):
    que=list(map(int,input().split()))
    if que[0]==1:
        j+=1
        b+=que[2]
        a.insert(  bisect.bisect_left(a,que[1]), que[1] )

        p= bisect.bisect_left(a,tmp)
        q= bisect.bisect_right(a,tmp)
        if p>j-p:
            min+=abs(que[1]-tmp)-abs(a[p-1]-tmp) 
            tmp=a[p-1]
        elif p==j-p:
            min+=abs(que[1]-tmp)
            tmp=a[p-1]

        else:
            q= bisect.bisect_right(a,tmp)
            if q<j-q:
                min+=abs(que[1]-tmp)-abs(a[q]-tmp) 
                tmp=a[q]
            else:min+=abs(que[1]-tmp)

    elif que[0]==2:
        print(tmp,min+b)

### FIXED CODE ###

import bisect
import heapq 

Q=int(input())

que=list(map(int,input().split()))
b=que[2]
l,r=[-que[1]],[que[1]]
heapq.heapify(l)
heapq.heapify(r)
a=0
tmp=que[1]
j=1
for i in range(Q-1):
    que=list(map(int,input().split()))
    if que[0]==1:
        j+=1
        b+=que[2]
        q1=que[1]
        if j%2==0:
            if q1<-l[0]:
                heapq.heappushpop(l,-q1)
            else:
                heapq.heappushpop(r,q1)

        else:
            if q1<-l[0]:
                heapq.heappush(l,-q1)
                heapq.heappush(r,-l[0])
            else:
                heapq.heappush(r,q1)
                heapq.heappush(l,-r[0])
        

        if -l[0]!=r[0]: a+=abs(tmp-q1)
        else: a+=abs(tmp-q1)-abs(-l[0]-tmp)
        tmp=-l[0]

    elif que[0]==2:
        print(tmp,a+b)
### BUGGY CODE ###

k,s=input().split()
k=int(k)
s=int(s)
cnt=0
for x in range(k+1):
  for y in range(x,k+1):
    for z in range(y,k+1):
      if x+y+z==s:
        if x==y and y==z:
	        cnt+=1
        elif x==y or y==z or x==z:
          cnt+=3
        else:
          cnt+=6
print(cnt)

### FIXED CODE ###

k,s=input().split()
k=int(k)
s=int(s)
cnt=0
for x in range(k+1):
  for y in range(k+1):
    z=s-x-y
    if z>=0 and z<=k:
      cnt+=1
print(cnt)
### BUGGY CODE ###

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

pair = n*(n - 1)/2
not_4 = 0
ans = 'Yes'
for i in range(len(a)):
  for j in range(len(a)):
    
    if i == j or a[i]%4 == 0 or a[j]%4 == 0:
      continue
    else:  
      if a[i]*a[j]%4 != 0:
        not_4 += 1
      
      if not_4 >= pair:
        ans = 'No'
        break
    
print(ans)

### FIXED CODE ###

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

four = 0
two = 0
one = 0
for i in a:
  if i%4 == 0:
    four += 1
  elif i%2 == 0 and i%4 != 0:
    two += 1
  elif i%2 != 0:
    one += 1

if four >= one or four + 1 >= two//2 + two%2 + one or n == two:
  print('Yes')
else:
  print('No')
### BUGGY CODE ###

import numpy as np
N, M = map(int, input().split())
x = np.array([list(map(int, input().split())) for i in range(N)])
minprice = min(x[0:,0])
number = np.argmin(x[0:,0])
price = 0
while True:
    if M <= x[number][1]:
        price += int(minprice * M)
        break
    else:
        price += minprice * x[number][1]
        M -= x[number][1]
        x = np.delete(x, number, 0)
        minprice = min(x[0:,0])
        number = np.argmin(x[0:,0])
print(price)


### FIXED CODE ###

N, M = map(int, input().split())
x = sorted([list(map(int, input().split())) for i in range(N)])
i = 0
minprice = x[i][0]
minnumber = x[i][1]
price = 0
while True:
    if M <= minnumber:
        price += minprice * M
        break
    else:
        price += minprice * minnumber
        M -= minnumber
        i += 1
        minprice = x[i][0]
        minnumber = x[i][1]
print(price)
### BUGGY CODE ###

n = int(input())


l, r = 0, n

re = input(0)
if re=="Vacant": exit()

for i in range(19):
    mid = (l+r)//2
    tmp = input(mid)
    if tmp=="Vacant": exit()

    if re==tmp:
        l = mid
        re = tmp
    else:
        if abs(l-mid) in [1, n-1]:
            l = mid
            re = tmp
        else: r = mid

### FIXED CODE ###

n = int(input())


l, r = 0, n

print(0, flush=True)
re = input()
if re=="Vacant": exit()

for i in range(19):
    mid = (l+r)//2
    print(mid, flush=True)
    tmp = input()
    if tmp=="Vacant": exit()

    p = abs(l-mid)%2

    if (re!=tmp and p) or (re==tmp and p-1):
        l = mid
        re = tmp
    else:
        if abs(l-mid) in [1, n-1]:
            l = mid
            re = tmp
        else: r = mid
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
ans = 1

for i in range(len(a)):
    ans *= a[i]
    
if ans > (1000000000000000000):
    print(-1)
else:
    print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
ans = 1

if 0 in a:
    print(0)
else:
    for i in range(len(a)):
        ans *= a[i]
        if ans > (1000000000000000000):
            print(-1)
            sys.exit()
    else:
        print(ans)
### BUGGY CODE ###

n=int(input())

for a in range(1,n**2+1):
    if n%a==0:
        b=n//a
        sa=str(a)
        sb=str(b)
        if a<=b:
             ans=len(sb)
        else:
            break

print(ans)

### FIXED CODE ###

n=int(input())

for a in range(1,int(n**0.5+1)):
    if n%a==0:
        b=n//a
        sa=str(a)
        sb=str(b)
        if a<=b:
             ans=len(sb)
        else:
            break

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

N, M = map(int, input().split())
edges = [[0, 0] for _ in range(M)]
for i in range(M):
    edges[i][0], edges[i][1] = map(int, input().split())

stack = list(range(1, N+1))
# dp[n]: nに到達する最長のパス
dp = [0] * N
while stack:
    n = stack.pop()
    childs = [edge[1] for edge in edges if edge[0] == n]
    for nc in childs:
        if dp[nc-1] < dp[n-1] + 1:
            stack.append(nc)
            dp[nc-1] = dp[n-1] + 1

print(max(dp))


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N, M = map(int, input().split())
childs = [[] for _ in range(N)]
for i in range(M):
    p, c = map(int, input().split())
    childs[p-1].append(c-1)

depth = [-1] * N
def dfs(n):
    if depth[n] != -1:
        return depth[n]
    if childs[n]:
        depth[n] = max((dfs(nc) for nc in childs[n])) + 1
    else:
        depth[n] = 0
    return depth[n]

print(max((dfs(n) for n in range(N))))
### BUGGY CODE ###

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

while m>0:
    max_a_ind=a.index(max(a))
    a[max_a_ind]=a[max_a_ind]//2
    m-=1

print(sum(a))


### FIXED CODE ###

from heapq import heappop,heappush,heapify
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7) 
 
n,m = map(int,input().split())
a = [int(x) for x in input().split()]
 
a_minus = [-x for x in a]
heapify(a_minus)
 
pop = lambda: -heappop(a_minus)
push = lambda x: heappush(a_minus,-x)
 
for _ in range(m):
    x = pop()
    push(x//2)
 
print(-sum(a_minus))
### BUGGY CODE ###

import sys
from functools import lru_cache

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def modInverse(a, p):
    return pow(a, p - 2, p)


@lru_cache(maxsize=None)
def modBinomial(n, k, p):
    numerator = 1
    for i in range(k):
        numerator = (numerator * (n - i)) % p

    denominator = 1
    for i in range(1, k + 1):
        denominator = (denominator * i) % p

    return (numerator * modInverse(denominator, p)) % p


def main():
    N, K = [int(x) for x in input().split()]
    MOD = 10 ** 9 + 7

    a = min(N - 1, K)

    ans = 1
    for i in range(1, a + 1):
        ans += (modBinomial(N, i, MOD) * modBinomial(N - 1,  N - i - 1, MOD)) % MOD

    print(ans % MOD)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

def cmb(n, r, p):
    global fact, factinv
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p


def main():
    N, K = [int(x) for x in input().split()]
    MOD = 10 ** 9 + 7

    a = min(N - 1, K)

    global fact, factinv, inv
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % MOD)
        inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
        factinv.append((factinv[-1] * inv[-1]) % MOD)

    ans = 1
    for i in range(1, a + 1):
        ans += cmb(N, i, MOD) * cmb(N - 1, N - i - 1, MOD) % MOD

    print(ans % MOD)


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

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

    N, Q = MI()
    c = LI()

    seg = [set()]*(2*N)
    for i in range(N):
        seg[i+N] = {c[i]}
    for i in range(N-1,0,-1):
        seg[i] = seg[i << 1] | seg[i << 1 | 1]

    def fold(L, R):  # [L,R)の区間取得
        L += N
        R += N
        vL = set()
        vR = set()
        while L < R:
            if L & 1:
                vL = vL | seg[L]
                L += 1
            if R & 1:
                R -= 1
                vR = seg[R] | vR
            L >>= 1
            R >>= 1
        return len(vL | vR)

    for i in range(Q):
        l, r = MI()
        print(fold(l - 1, r))

if __name__ == '__main__':
    main()


### FIXED CODE ###

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

    N,Q = MI()
    c = [0] + LI()
    lr = []
    for i in range(Q):
        l,r = MI()
        lr.append((i,l,r))

    from operator import itemgetter

    lr = sorted(lr,key=itemgetter(2))  # 右端rでソート
    a = 0
    d = {}  # d[i] = 玉iが現れた最も右の位置
    ANS = [0]*Q


    class BIT():
        def __init__(self, init_value):
            self.n = len(init_value)
            self.tree = [0] * (self.n + 1)
            for i in range(1, self.n + 1):
                x = init_value[i - 1]
                while i <= self.n:
                    self.tree[i] += x
                    i += i & (-i)

        def update(self, i, x):  # i(1-index)番目の値を+x
            while i <= self.n:
                self.tree[i] += x
                i += i & (-i)
            return

        def query(self, i):  # 1番目からi(1-index)番目までの和を返す
            res = 0
            while i > 0:
                res += self.tree[i]
                i -= i & (-i)
            return res


    bit = BIT([0]*N)  # 最も右に現れた玉の位置を管理
    for i in range(1,N+1):
        if not c[i] in d.keys():
            d[c[i]] = i
            bit.update(i,1)
        else:
            bit.update(d[c[i]],-1)
            d[c[i]] = i
            bit.update(i, 1)
        while a <= Q-1 and lr[a][2] == i:
            j,l,r = lr[a]
            ANS[j] = bit.query(r)-bit.query(l-1)
            a += 1

    print(*ANS,sep='\n')


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

N, M = map(int, input().split())
l, r = map(int, input().split())
cards = list(range(l, r+1))

for i in range(1, M):
    l, r = map(int, input().split())
    cards_new = list(range(l, r+1))
    cards = set(cards) & set(cards_new)

print(len(cards))

### FIXED CODE ###

N, M = map(int, input().split())
l_max, r_min = 0, 100000000

for i in range(0, M):
    l, r = map(int, input().split())
    if l > l_max:
        l_max = l
    if r < r_min:
        r_min = r

print(max(0, r_min-l_max+1))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n = int(input())
A = []
for i in range(n):
    rs = list(map(int, input().split()))
    rs = [r-1 for r in rs]
    A.append(rs)

cnts = [0] * n
days = 1
while True:
    tekis = []
    # print("Day",days, cnts)
    fin = 0
    for cnt,a in zip(cnts, A):
        if cnt == n-1: 
            tekis.append(-1)
            fin += 1
        else: 
            tekis.append(a[cnt])
    if fin == n: 
        print(days-1)
        exit()
    # 敵の敵が自分だったらマッチング成立
    flg = False
    matched = [False] * n
    for i,teki in enumerate(tekis):
        if matched[teki] or teki==-1:continue
        if tekis[teki] == i:
            cnts[i] += 1
            matched[i] = True
            cnts[teki] += 1
            matched[teki] = True
            flg = True
            # print("{}vs{}".format(i,teki))
    # マッチングが一つも成立しない
    if days > 5000:
        print(-1)
    if not flg:
        print(-1)
        exit()
    days += 1


### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import defaultdict, deque
n = int(input())
X = 10000
INF = 1 << 50
edges = defaultdict(list)
edges_r = defaultdict(list)
def topological_sort(G):

    cnt_in = defaultdict(int)
    for k in G.keys():
        for v in G[k]:
            cnt_in[v] += 1
    # print(cnt_in)
    res = []
    # 入次数==0
    q = deque([i for i in list(G.keys()) if cnt_in[i]==0])
    while len(q) > 0:
        v = q.popleft()
        res.append(v)
        for next_v in G[v]:
            # 入次数を下げていく
            cnt_in[next_v] -= 1
            # 入次数が0に残ったところを次に追加
            if cnt_in[next_v] == 0:
                q.append(next_v)
    # トポソ不可能！
    if len(G) != len(res):
        print(-1)
        exit()
    return res

for i in range(n):
    r = list(map(int, input().split()))
    # 初期
    mn = min(i, r[0]-1)
    mx = max(i, r[0]-1)
    prev = mn * n + mx
    for e in r[1:]:
        e -= 1
        mn = min(i,e)
        mx = max(i,e)
        now = mn*n+mx
        edges[prev].append(now)
        edges_r[now].append(prev)
        prev = now
vs = topological_sort(edges)

# トポソの順番で経路長を入れていく
used = [0] * n**2
# for V in vs:
#     if used[V]: continue
#     used[V] = 1
#     q = deque([V])
#     while len(q) > 0:
#         v = q.popleft()
#         for u in edges[v]: 
#             if used[u] <= used[v]:
#                 q.append(u)
#                 used[u] = max(used[u], used[v] + 1)

for V in vs:
    if used[V]:continue
    used[V] = 1
    mx = 1
    for b in edges_r[V]:
        mx = max(mx, used[b]+1)
    used[V] = mx
# print(used)
print(max(used))
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
B = [0]*(max(A))

for i in A:
    B[i-1] += 1

ans = 0
for i in range(1,max(A)+1):
    if B[i-1] == 0:
        continue
    if B[i-1] == 1:
        ans += 1
    for j in range(2 * i,max(A)+1,i):
        B[j-1] = 0

print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
maxA = max(A)
B = [0]*(maxA)

for i in A:
    B[i-1] += 1

ans = 0
for i in sorted(A):
    if B[i-1] == 0:
        continue
    if B[i-1] == 1:
        ans += 1
    for j in range(i,maxA+1,i):
        B[j-1] = 0

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

from itertools import combinations
MOD = 10**9 + 7
n=int(input())
a=list(map(int,input().split()))
sum=0
for x,y in combinations(a,2):
   sum+= x*y%MOD
   ans=sum%MOD
print(ans)

### FIXED CODE ###

mod = 10**9 + 7
n=int(input())
s=list(map(int,input().split()))
s2=sum(map(lambda x: x ** 2,s))
ans=(((sum(s))**2)-(s2))//2%mod
print(ans)
### BUGGY CODE ###

from scipy.sparse.csgraph import csgraph_from_dense,dijkstra
import sys
input=sys.stdin.readline
n,m,s,t=map(int,input().split())
ey=[[10**10]*n for _ in range(n)]
es=[[10**10]*n for _ in range(n)]
for i in range(m):
  u,v,a,b=map(int,input().split())
  ey[u-1][v-1]=a
  ey[v-1][u-1]=a
  es[u-1][v-1]=b
  es[v-1][u-1]=b
gy=csgraph_from_dense(ey,null_value=10**10)
gs=csgraph_from_dense(es,null_value=10**10)
dy=dijkstra(gy,indices=s-1)
ds=dijkstra(gs,indices=t-1)
accumb=[10*10]*n
accumb[n-1]=int(dy[n-1]+ds[n-1])
for i in range(1,n):
  accumb[n-i-1]=int(min(dy[n-i-1]+ds[n-i-1],accumb[n-i]))
money=10**15
for i in range(n):
  print(money-accumb[i])

### FIXED CODE ###

import sys
import heapq
input=sys.stdin.readline
def dijkstra_heap(s,edge):
    #始点sから各頂点への最短距離
    d = [float("inf")] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d
n,m,s,t=map(int,input().split())
ey=[[] for _ in range(n)]
es=[[] for _ in range(n)]
for i in range(m):
  u,v,a,b=map(int,input().split())
  ey[u-1].append([a,v-1])
  ey[v-1].append([a,u-1])
  es[u-1].append([b,v-1])
  es[v-1].append([b,u-1])
dy=dijkstra_heap(s-1,ey)
ds=dijkstra_heap(t-1,es)
accumb=[10*10]*n
accumb[n-1]=int(dy[n-1]+ds[n-1])
for i in range(1,n):
  accumb[n-i-1]=int(min(dy[n-i-1]+ds[n-i-1],accumb[n-i]))
money=10**15
for i in range(n):
  print(money-accumb[i])
### BUGGY CODE ###

from math import gcd
def eratosthenes(N):
    from collections import deque
    work = [True] * (N+1)
    work[0] = False
    work[1] = False
    ret = []
    for i in range(N+1):
        if work[i]:
            ret.append(i)
            for j in range(2* i, N+1, i):
                work[j] = False
    return ret

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

def main():
    N = int( input())
    A = list( map( int, input().split()))
    # A.sort()
    g = A[0]
    for a in A:
        g = gcd(a, g)
    if g > 1:
        print("not coprime")
        return
    # for i in range(N-1):
    #     if A[i] == A[i+1]:
    #         print("setwise coprime")
    #         return
    E = eratosthenes(10**3)
    for e in E:
        cnt = 0
        for i in range(N):
            if A[i]%e == 0:
                cnt += 1
            while A[i]%e == 0:
                A[i] //= e
        if cnt > 1:
            print("setwise coprime")
            return
    A.sort()
    for i in range(N-1):
        if A[i] == A[i+1] and A[i] > 1:
            print("setwise coprime")
            return
    print("pairwise coprime")
    
    
if __name__ == '__main__':
    main()


### FIXED CODE ###

from math import gcd
def eratosthenes(N):
    from collections import deque
    work = [True] * (N+1)
    work[0] = False
    work[1] = False
    ret = []
    for i in range(N+1):
        if work[i]:
            ret.append(i)
            for j in range(2* i, N+1, i):
                work[j] = False
    return ret

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

def main():
    N = int( input())
    A = list( map( int, input().split()))
    g = A[0]
    for a in A:
        g = gcd(a, g)
    if g > 1:
        print("not coprime")
        return
    E = eratosthenes(10**3)
    EE = [0]*len(E)
    R = []
    for a in A:
        for i, e in enumerate(E):
            if a%e == 0:
                if EE[i] > 0:
                    print("setwise coprime")
                    return
                EE[i] = 1
            while a%e == 0:
                a //= e
        if a > 1:
            R.append(a)
    R.sort()
    for i in range(len(R)-1):
        if R[i] == R[i+1]:
            print("setwise coprime")
            return
    print("pairwise coprime")
    
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

import math

k = int(input())

result = 0

for a in range(1, k+1):
  for b in range(1, k+1):
    for c in range(1, k+1):
      result += math.gcd(math.gcd(a, b), c)

print(result)

### FIXED CODE ###

import math
import itertools

k = int(input())
result = 0

for a in range(1, k+1):
  for b in range(a+1, k+1):
    for c in range(b+1, k+1):
      r = math.gcd(math.gcd(a, b), c)
      r *= 6
      result += r

for a in range(1, k+1):
  for b in range(a+1, k+1):
    r = math.gcd(a, b)
    r *= 6
    result += r
    
for a in range(1, k+1):
  result += a

print(result)
### BUGGY CODE ###

X=int(input())
#幅
from collections import deque
def dfs_2(start,goal):
  q = deque([])   # スタック
  q.append([start])
  flg = 0
  while flg==0:
    p = q.popleft()         # スタック取りだし（先頭）
    jp = len(p)
#    if p[-1]-jp == goal or p[-1]+jp == goal:
    if p[-1]+jp == goal:
      return jp
    else:
      p0 = [p[-1]]
      pp = [p[-1]+jp]
#      pm = [p[-1]-jp]
      q.append(p+pp)# スタック追加
#      q.append(p+pm)
      q.append(p+p0)

print(dfs_2(0,X))

### FIXED CODE ###

X=int(input())
s=0
for t in range(X+1):
  s+=t
  if s>=X:
    print(t)
    break
### BUGGY CODE ###

ans = 0
k, s = map(int,input().split()) 
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ans += 1

print(ans)

### FIXED CODE ###

k,s = map(int,input().split())
cnt = 0
for x in range(k+1):
  for y in range(k+1):
    if 0<=s - x - y <= k :

      cnt += 1
print(cnt)