Harryxun/stf_run huggingface dataset:
def arrayF(n): 
    F=[0]*(n+1) 
    i=2 
    while i*i<=n:
        if F[i] == 0: 
            k=i*i
            while k <= n:
                if F[k] == 0:
                    F[k] = i
                k += i
        i += 1 
    return F


def factorization(x, F): 
    primeFactors = []
    while F[x] > 0:
        primeFactors.append(F[x])
        x //= F[x] 
    if x != 1:
        primeFactors.append(x)
    return set(primeFactors)

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

amax = max(A)
F  = arrayF(amax)

P = Counter()
P = [0] *  (amax+1)
for a in A:
    for p in factorization(a,  F):
        P[p] += 1
p_max = max(P)
if  p_max <= 1:
    print('pairwise coprime')
elif  p_max <  n:
    print('setwise coprime')
else:
    print('not coprime')

### FIXED CODE ###

def arrayF(n): 
    F=[0]*(n+1) 
    i=2 
    while i*i<=n:
        if F[i] == 0: 
            k=i*i
            while k <= n:
                if F[k] == 0:
                    F[k] = i
                k += i
        i += 1 
    return F


def factorization(x, F): 
    primeFactors = []
    while F[x] > 0:
        primeFactors.append(F[x])
        x //= F[x] 
    if x != 1:
        primeFactors.append(x)
    return set(primeFactors)

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

amax = max(A)
F  = arrayF(amax)

P = [0] *  (amax+1)
for a in A:
    for p in factorization(a,  F):
        P[p] += 1
p_max = max(P)
if  p_max <= 1:
    print('pairwise coprime')
elif  p_max <  n:
    print('setwise coprime')
else:
    print('not coprime')
from bisect import bisect_left, bisect_right
from collections import deque
 
N = int(input())
A = list(map(int, input().split(" ")))
A.sort()
A = deque(A)
ans = 0
t_max = len(bin(A[-1])) - 2
for t in range(t_max, 0, -1):	
  	if len(A) < 2: break
    while len(bin(A[-1])) - 2 > t:
        A.pop()
        if len(A) < 2: break
    if len(A) < 2: break
    pow2 = 1 << t
    A_tmp = deque()
    while t == len(bin(A[-1])) - 2:
        r = A.pop()
        idx = bisect_left(A, pow2 - r)
        for _ in range(idx):
            A_tmp.appendleft(A.popleft())
        if len(A) == 0: break
        if A[0] + r == pow2:
            A.popleft()
            ans += 1
        if len(A) < 2: break
    A.extendleft(A_tmp)
                    
print(ans)

### FIXED CODE ###

from bisect import bisect_left, bisect_right
from collections import deque

N = int(input())
A = list(map(int, input().split(" ")))
A.sort()
A = deque(A)
ans = 0
t_max = len(bin(A[-1])) - 2
for t in range(t_max, 0, -1):
    if len(A) < 2: break
    while len(bin(A[-1])) - 2 > t:
        A.pop()
        if len(A) < 2: break
    if len(A) < 2: break
    pow2 = 1 << t
    A_tmp = deque()
    while t == len(bin(A[-1])) - 2:
        r = A.pop()
        idx = bisect_left(A, pow2 - r)
        for _ in range(idx):
            A_tmp.appendleft(A.popleft())
        if len(A) == 0: break
        if A[0] + r == pow2:
            A.popleft()
            ans += 1
        if len(A) < 2: break
    A.extendleft(A_tmp)
                    
print(ans)
n,k=map(int,input().split())
a=list(map(int,input().split()))
from collections import Counter
c=Counter()
c[1]+=1

cycle_num=-1
i=0
cnt=0
b=[]
while cnt<2*10**5+1:
  c[a[i]]+=1
  b.append(a[i])
  if c[a[i]]>1 or a[i]==1:
    cycle_num=a[i]
    break
  i=a[i]-1
  cnt+=1
# print(b)
# print(cycle_num)
cycle=[]
b=[1]+b
for i,bb in enumerate(b):
  if bb==cycle_num:
    cycle=b[i:]
    break
  else:
    if i!=0:
      k-=1
    if k==0:
      print(bb)
      exit(0)
# print(cycle)
# syuuki=len(cycle)-1
syuuki=len(cycle)
print(cycle[(k%syuuki)+1])


### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
visited=[]
o=(n+1)*[-1]
cycle,l=1,0
v=1
while o[v]==-1:
  o[v]=len(visited)
  visited.append(v)
  v=a[v-1]
cycle=len(visited)-o[v]
l=o[v]
if k<l:
  print(visited[k])
else:
  k-=l
  k%=cycle
  print(visited[l+k])
N = int(input())
SP = [(i + 1, input().split()) for i in range(N)]
P = [[0, 0, 0] for _ in range(N)]
for i in range(N):
    P[i][0] = SP[i][0]
    P[i][1] = SP[i][1][0]
    P[i][2] = int(SP[i][1][1])
P.sort(key=lambda x: x[1][1], reverse=True)
P.sort(key=lambda x: x[1][0])

for p in P:
    print(p[0])


### FIXED CODE ###

N = int(input())
SP = [(i + 1, input().split()) for i in range(N)]
P = [[0, 0, 0] for _ in range(N)]
for i in range(N):
    P[i][0] = SP[i][0]
    P[i][1] = SP[i][1][0]
    P[i][2] = int(SP[i][1][1])
P.sort(key=lambda x: x[2], reverse=True)
P.sort(key=lambda x: x[1])

for p in P:
    print(p[0])
#!/usr/bin/env python3

import itertools
import sys


DELTAS = [(0, 1), (1, 0), (0, -1), (-1, 0)]


def in_stage(h, w, r, c):
    return 0 <= r < h and 0 <= c < w


def in_place_solve(h, w, stage):
    ops = []
    for r0, c0 in itertools.product(range(h), range(w)):
        tr, tc = None, None
        if stage[r0][c0] % 2 == 0:
            continue
        for dr, dc in DELTAS:
            r, c = r0 + dr, c0 + dc
            if in_stage(h, w, r, c) and stage[r][c] % 2 == 1:
                tr, tc = r, c
                break
        else:
            for dr, dc in DELTAS:
                r, c = r0 + dr, c0 + dc
                if in_stage(h, w, r, c):
                    tr, tc = r, c
                    break
        ops.append((r0 + 1, c0 + 1, tr + 1, tc + 1))
        stage[r0][c0] -= 1
        stage[tr][tc] += 1
    return ops


def main():
    h, w = (int(x) for x in input().split())
    stage = [[int(x) for x in input().split()] for _ in range(h)]
    # print("Before: ", file=sys.stderr)
    # print(*stage, sep="\n", file=sys.stderr)
    ops = in_place_solve(h, w, stage)
    # print("After: ", file=sys.stderr)
    # print(*stage, sep="\n", file=sys.stderr)
    print(len(ops))
    for y0, x0, y, x in ops:
        print(y0, x0, y, x)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3

import itertools
import sys


DELTAS = [(0, 1), (1, 0), (0, -1), (-1, 0)]


def in_stage(h, w, r, c):
    return 0 <= r < h and 0 <= c < w


def in_place_solve(h, w, stage):
    ops = []
    for r0, c0 in itertools.product(range(h), range(w)):
        tr, tc = None, None
        if stage[r0][c0] % 2 == 0:
            continue
        for dr, dc in DELTAS:
            r, c = r0 + dr, c0 + dc
            if in_stage(h, w, r, c) and stage[r][c] % 2 == 1:
                tr, tc = r, c
                break
        else:
            for dr, dc in DELTAS:
                r, c = r0 + dr, c0 + dc
                if in_stage(h, w, r, c):
                    tr, tc = r, c
                    break
        if tr is None or tc is None:
            continue
        ops.append((r0 + 1, c0 + 1, tr + 1, tc + 1))
        stage[r0][c0] -= 1
        stage[tr][tc] += 1
    return ops


def main():
    h, w = (int(x) for x in input().split())
    stage = [[int(x) for x in input().split()] for _ in range(h)]
    # print("Before: ", file=sys.stderr)
    # print(*stage, sep="\n", file=sys.stderr)
    ops = in_place_solve(h, w, stage)
    # print("After: ", file=sys.stderr)
    # print(*stage, sep="\n", file=sys.stderr)
    print(len(ops))
    for y0, x0, y, x in ops:
        print(y0, x0, y, x)


if __name__ == '__main__':
    main()
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
ans = 0
for i in range(n):
    j = i+1
    k = n
    while w < k:
        if a[i]<a[j]+a[k]:
            ans += k-j
            j += 1
        else:
            k -= 1
print(ans)


### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
ans = 0
for i in range(n-2):
    j = i+1
    k = n-1
    while j < k:
        if l[i]<l[j]+l[k]:
            ans += k-j
            j += 1
        else:
            k -= 1
print(ans)
N = int(input())
H = map(int, input().solit())

max = 0
count = 0
for n in range(N-1)
  if H[n] >= H[n+1]:
    count += 1
  else:
    if count > max:
      max = count
    count = 0
print(max)

### FIXED CODE ###

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

max = 0
count = 0
for n in range(N-1):
  if H[n] >= H[n+1]:
    count += 1
    if count > max:
      max = count
  else:
    count = 0
print(max)
class binaryTree:
    def __init__(self,key,p=None,l=None,r=None):
        self.key = key
        self.p = p
        self.l = l
        self.r = r

N = int(input())
treelist = [list(input().split()) for i in range(N)]
root = None

def inorder(root):
    x = root
    if x == None:
        return
    inorder(x.l)
    
    global inlist
    inlist.append(x.key)
    
    inorder(x.r)

def insert(root,z):
    y = None
    x = root
    while x != None:
        y = x
        if z.key < x.key:
            x = x.l
        else:
            x = x.r
    z.p = y

    if y == None:
        root = z
    elif z.key < y.key:
        y.l = z
    else:
        y.r = z
    return root
    
def outorder(root):
    x = root
    if x == None:
        return
    global outlist
    outlist.append(x.key)
    
    outorder(x.l)
    outorder(x.r)

for data in treelist:
    if data[0] == "insert":
        z = binaryTree(int(data[1]))
        root = insert(root,z)
        
    if data[0] == "print":
        inlist = []
        outlist = []
        
        inorder(root)
        indata = " " + " ".join([str(num) for num in inlist])
        print(indata)
 
        outorder(root)
        outdata = " " + " ".join([str(num) for num in outist])
        print(outdata)


### FIXED CODE ###

class binaryTree:
    def __init__(self,key,p=None,l=None,r=None):
        self.key = key
        self.p = p
        self.l = l
        self.r = r

N = int(input())
treelist = [list(input().split()) for i in range(N)]
root = None

def inorder(root):
    x = root
    if x == None:
        return
    inorder(x.l)
    
    global inlist
    inlist.append(x.key)
    
    inorder(x.r)

def insert(root,z):
    y = None
    x = root
    while x != None:
        y = x
        if z.key < x.key:
            x = x.l
        else:
            x = x.r
    z.p = y

    if y == None:
        root = z
    elif z.key < y.key:
        y.l = z
    else:
        y.r = z
    return root
    
def outorder(root):
    x = root
    if x == None:
        return
    global outlist
    outlist.append(x.key)
    
    outorder(x.l)
    outorder(x.r)

for data in treelist:
    if data[0] == "insert":
        z = binaryTree(int(data[1]))
        root = insert(root,z)
        
    if data[0] == "print":
        inlist = []
        outlist = []
        
        inorder(root)
        indata = " " + " ".join([str(num) for num in inlist])
        print(indata)
 
        outorder(root)
        outdata = " " + " ".join([str(num) for num in outlist])
        print(outdata)
def solve(n, tbl):
    ans = 0
    for i, row_i in enumerate(tbl):
        for j in range(i + 1, n):
            row_j = tbl[j]
            ij = row_i[j]
            mind = min(ik + kj for ik, kj in zip(row_i, row_j) if ik and kj)
            if ij > mind:
                return -1
            if ij < mind:
                ans += ij
    return ans


n = int(input())
tbl = [list(map(int, input().split())) for _ in range(n)]
print(solve(n, tbl))


### FIXED CODE ###

def solve(n, tbl):
    ans = 0
    for i, row_i in enumerate(tbl):
        for j in range(i + 1, n):
            row_j = tbl[j]
            ij = row_i[j]
            mind = min((ik + kj for ik, kj in zip(row_i, row_j) if ik and kj), default=float('inf'))
            if ij > mind:
                return -1
            if ij < mind:
                ans += ij
    return ans


n = int(input())
tbl = [list(map(int, input().split())) for _ in range(n)]
print(solve(n, tbl))
n,k = map(int,input().split())
hn = list(map(int,input().split()))
hn_s = hn.sort()
attack = 0

if k>=n:
  print("0")

elif k<n:
  for _ in range(n-k):
    hn_s.pop(-1)
  print(str(sum(hn_s)))

### FIXED CODE ###

n,k = map(int,input().split())
hn = sorted(list(map(int,input().split())))

attack = 0

if k>=n:
  print(attack)

elif k<n:
  print(sum(hn[0:n-k]))
input = int(input())
nums = []
for _ in range(input):
  nums.append(int(input()))
print(0)


### FIXED CODE ###

N = int(input())
p = []
for _ in range(N):
    p.append(int(input()))
 
pmax = max(p)
ans = int(sum(p)-pmax/2)
print(ans)
R = int(raw_input())

if R <1200:
	print('ABC')
elif 1200<=R<2800:
	print('ARC')
else :
	print('AGC')

### FIXED CODE ###

R = int(input())

if R <1200:
	print('ABC')

elif R<2800:
	print('ARC')

else :
	print('AGC')
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0:
    while r*R + g*G <= N:
        if (r*R + g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)


### FIXED CODE ###

R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0
    while r*R + g*G <= N:
        if (N - r*R - g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)
import itertools
n = int(input())
a = [0] * n
xy = []
for i in range(n):
    a[i] = int(input())
    x_y = []
    for j in range(a[i]):
        x_y.append(list(map(int,input().split())))
    xy.append(x_y)

ans = 0
for it in itertools.product([0,1],repeat=n):
    li = [0] * n
    for i in range(len(a)):
        for k in range(n):
            for j in range(a[i]):
                if it[k] == 1:
                    if xy[k][j][1]==0:
                        li[xy[k][j][0]-1] = -1
                    else:
                        li[xy[k][j][0]-1] = 1
    flg = True                        
    for l in range(n):
        if li[l] == -1 and it[l] == 1 or li[l] == 1 and it[l] == -1 or li[l] == 1 and it[l] == 0:
            flg = False
    if flg:

        if ans < sum(it):
            ans = sum(it)
print(ans)

### FIXED CODE ###

n = int(input())
shougen=[[-1]*(n+1) for _ in range(n+2)]
for i in range(1,n+1):
  a = int(input())
  for j in range(a):
    x,y = map(int, input().split())
    shougen[i][x]=y
 
ans=0
for i in range(2**n):
  f=True
  for j in range(n):
    if i>>j & 1:
      for k,s in enumerate(shougen[j+1][1:],start=0):
        if s == 1 and not i>>k & 1:
          f=False
        if s == 0 and i>>k & 1:
          f=False
  else:
    if f:
      ans=max(ans, str(bin(i)).count("1"))
 
print(ans)
from collections import Counter

n = int(input())
s = [input() for i in range(n)]
s = Counter(s)
s = s.most_common()

# ansの初期化
ans = []
ans.append(s[0][0])
cnt = s[0][1]

for i in range(1, n):
  if (s[i][1] < cnt):
    break
  else:
    ans.append(s[i][0])

for s in sorted(ans):
  print(s)

### FIXED CODE ###

from collections import Counter

n = int(input())
s = [input() for i in range(n)]
s = Counter(s)
s = s.most_common()

# ansの初期化
ans = []
ans.append(s[0][0])
cnt = s[0][1]

if (len(s) != 1):
  for i in range(1, n):
    if (s[i][1] < cnt):
      break
    else:
      ans.append(s[i][0])

for s in sorted(ans):
  print(s)
n, m = map(int, input().split())
h = list(map(int, input().split()))
pairs = [list(map(int, input().split())) for _ in range(m)]

ans = [1] * n

for i in range(m):
    if h[pairs[i][0] - 1] < h[pairs[i][1] - 1]:
        ans[pairs[i][0] - 1] = 0
    elif h[pairs[i][0] - 1] = h[pairs[i][1] - 1]:
        ans[pairs[i][0] - 1] = 0
        ans[pairs[i][1] - 1] = 0 
    else:
        ans[pairs[i][1] - 1] = 0      

print(sum(ans))

### FIXED CODE ###

n, m = map(int, input().split())
h = list(map(int, input().split()))
pairs = [list(map(int, input().split())) for _ in range(m)]

ans = [1] * n

for i in range(m):
    if h[pairs[i][0] - 1] < h[pairs[i][1] - 1]:
        ans[pairs[i][0] - 1] = 0
    elif h[pairs[i][0] - 1] == h[pairs[i][1] - 1]:
        ans[pairs[i][0] - 1] = 0
        ans[pairs[i][1] - 1] = 0 
    else:
        ans[pairs[i][1] - 1] = 0      

print(sum(ans))
#coding:utf-8

S = input()

N = len(S)
ans = 0
SR = []
if S[0] == '0':
	for i in range(int(N/2)):
		SR.append('0')
		SR.append('1')
else:
	for i in range(int(N/2)):
		SR.append('1')
		SR.append('0')

for i in range(N):
	if S[i] != SR[i]:
		ans += 1
		
print(ans)
			


### FIXED CODE ###

#coding:utf-8

S = input()
N = len(S)
ans = 0
SR = []
if S[0] == '0':
	for i in range(N):
		SR.append('0')
		SR.append('1')
else:
	for i in range(N):
		SR.append('1')
		SR.append('0')

for i in range(N):
	if S[i] != SR[i]:
		ans += 1
		
print(ans)
a,b = list(map(int,input().split()))
print(a+b) if 24 > a+b else prin(a+b-24)

### FIXED CODE ###

a,b = list(map(int,input().split()))
print(a+b) if 24 > a+b else print(a+b-24)
N = int(input())
B = list(map(int,input().split()))

def func(B,i,C):
    if(C[0:i].count(True) + 1 >= B[i]): #左の入力済みを数える
        print(B[i])
        C[i] = True
        next = -1
        for j in range(N-1,-1,-1):
            if C[j] == False:
                next = j
                break
        if next == -1:
            return
        func(B,next,C)
    else:
        for next in range(i-1,-1,-1):
            if C[j] == False:
                func(B,next,C)
                break
        

flag = 0
for i in range(N):
    if B[i] > i + 1:
        flag = -1
        break

if(flag == -1):
    print(-1)
else:
    C = [False] * N
    func(B,N-1,C)

### FIXED CODE ###

N = int(input())
b = list(map(int,input().split()))
tmp = b[:]
ans = []
i = N-1
while i >= 0:
    if tmp[i] == 1:
        tmp[i] = float('inf')
        ans.append(b[i])
        while i < N:
            tmp[i] -= 1
            i += 1
    i -= 1
if len(ans) == N:
    for i in ans:
        print(i)
else:
    print(-1)
a,b,c=map(str,input().split())
if b=='-':
  print(int(a)-int(c))
else:
  print(int(a)+int(b))

### FIXED CODE ###

a,b,c=map(str,input().split())
if b=='-':
  print(int(a)-int(c))
else:
  print(int(a)+int(c))
a,b,c,d = map(int,input().split())
while(True):
    c-=b
    if(c<=0):
        print("Yes")
        exit()
    a-=d:
    if(a<=0):
        print("No")
        exit()    

### FIXED CODE ###

a,b,c,d = map(int,input().split())
while(True):
    c-=b
    if(c<=0):
        print("Yes")
        exit()
    a-=d
    if(a<=0):
        print("No")
        exit()
# 小さいのでメモ化再帰でいけるか？
# （[ここまでの回答数, ここまでの点数]みたいなやつ）
d, g = map(int, input().split())
memo = {}
points, bonus = [], []
for _ in range(d):
    p, c = map(int, input().split())
    points.append(p)
    bonus.append(c)


def f(c, p):
    if (c, p) in memo:
        return memo[(c, p)]
    if p >= g:
        return c
    ret = 10 ** 10
    for i in range(d):
        if points[i] == 1:
            points[i] = 0
            ret = min(ret, f(c + 1, p + (i + 1) * 100 + bonus[i]))
            points[i] = 1
        elif points[i] > 1:
            points[i] -= 1
            ret = min(ret, f(c + 1, p + (i + 1) * 100))
            points[i] += 1
        else:
            continue
    memo[(c, p)] = ret
    return ret


print(f(0, 0))


### FIXED CODE ###

# 未知のアルゴリズムか天才系DPかと思ってすぐ諦めて解説読んでしまった

d, g = map(int, input().split())
points = []
for _ in range(d):
    p, c = map(int, input().split())
    points.append((p, c))
ans = 10**12
for bit in range(2**d):
    arr = [False] * d
    for i in range(d):
        if bit >> i & 1 == 1:
            arr[i] = True
    tmp_sum = 0
    count = 0
    for i in range(d):
        if arr[i]:
            # kompuli-to
            tmp_sum += points[i][1]
            tmp_sum += (i + 1) * 100 * points[i][0]
            count += points[i][0]
    if tmp_sum < g:
        # 達成できるまで得点の高いやつからやっていく
        for i in range(d - 1, -1, -1):
            if arr[i]:
                # すでにkompuli-toしてるので
                continue
            used = 0
            for j in range(points[i][0]):
                if tmp_sum < g:
                    tmp_sum += (i + 1) * 100
                    count += 1
                    used += 1
            if used == points[i][0]:
                tmp_sum += points[i][1]
            if tmp_sum >= g:
                break
    ans = min(ans, count)
print(ans)
n = int(input())
a = list(map(int, input().split()))
b=[]

a = a[::-1]
for i in range(n):
    b.append(a.pop(-1))
    b = b[::-1]
    print(b)

for i in range(len(b)):
    print(b[i], end=" ")

### FIXED CODE ###

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

if n % 2 == 0:
    for i in range(n - 1, 0, -2):
        b.append(a[i])
    for i in range(0, n, 2):
        b.append(a[i])
else:
    for i in range(n - 1, -1, -2):
        b.append(a[i])
    for i in range(1, n, 2):
        b.append(a[i])

for i in range(len(b)):
    print(b[i], end=" ")
n = int(input().split())
a = list(map(int,input().split()))
now = 1
for i in range(n):
    if a[i] == now:
        now += 1
if now == 1:
    print(-1)
else:
    print(n-now+1)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
now = 1
for i in range(n):
    if a[i] == now:
        now += 1
if now == 1:
    print(-1)
else:
    print(n-now+1)
def depth(num)
 for x[num] 
n = raw_input
for i in range(n):
 all = map(int,raw_input().split())
 num = all[0]
 x[i] = all[1]
 if all[1] != 0:
  ne[i] = all[2:]
for i in range(n)
 depth(i)
 
 

### FIXED CODE ###

def depth(s, time):
    time += 1
    flag[s] = 1
    d[s] = time
    for i in range(1, n+1):
        if G[s][i] == 1:
            if flag[i] == 0:
                depth(i, time)
                time = f[i]
    f[s] = time + 1
 
n = int(raw_input())
G = [[0 for i in range(n+1)] for j in range(n+1)]
d = [0 for i in range(n+1)]
f = [0 for i in range(n+1)]
 
for i in range(n):
    v = map(int, raw_input().split())
    for j in range(v[1]):
        G[v[0]][v[2+j]] = 1
 
flag = [0 for i in range(n+1)]
for i in range(1, n+1):
    if flag[i] == 0:
        depth(i, max(f))
 
for i in range(1, n+1):
    print(str(i) + " " + str(d[i]) + " " + str(f[i]))
n = int(input())
A = [int(input()) for i in range(n)]

B = []

for a in A:
    if a % 10 != 0:
        B.append(a)

ans = sum(A)
if ans % 10 == 0:
    ans -= min(B)
    

print(ans)

### FIXED CODE ###

n = int(input())
A = [int(input()) for i in range(n)]

B = []

for a in A:
    if a % 10 != 0:
        B.append(a)

ans = sum(A)
if ans % 10 == 0 and len(B) != 0:
    ans -= min(B)
elif ans % 10 == 0 and len(B) == 0:
    ans = 0
    

print(ans)
S = input();
 
if S[2]==S[3] and S[4]==S[5]:
  print("Yes");
else:
  print("No");


### FIXED CODE ###

N,M = (int(a) for a in input().split());
A = input();

A = A.split();


B = [int(s) for s in A];

sum = sum(B)

line = sum/4/M
point = 0;
length = len(B);

for i in range(length):
    if B[i] >= line:
        point += 1;
    else:
        pass;
    
if point >= M:
    print("Yes");
else:
    print("No");
import math
n, m = input().split()
print(math.ceil(n/m))

### FIXED CODE ###

import math
n, m = map(int, input().split())
print(math.ceil(n/m))
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
l.sort()

ans=0
c=0
for i in range(n-1):
    if len(l)>0 and l[c]==l[c+1]:
        l.pop(c)
        l.pop(c)
    else:
        c+=1
if len(l)==n:
    print(n)
else:
    print(len(l))

### FIXED CODE ###

n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
l.sort()
l.append(10000000000000000000000)
f=1
ans=0
for i in range(n):
    if l[i]==l[i+1]:
        f+=1
    else:
        ans+=f%2
        f=1
print(ans)
N,M=map(int,input().split())
AC=[0]*N
WA=[0]*M

for i in range(M):
    s,p=input().split()
    s=int(s)-1
    if AC[s]==0:
        if p=='AC':
            AC[s]+=1
        else:
            WA[s]+=1
        
    
    
print(sum(AC),sum(WA))

### FIXED CODE ###

N,M=map(int,input().split())
AC=[0]*N
WA=[0]*N

for i in range(M):
    p,s=input().split()
    p=int(p)-1
    if AC[p]==0:
        if s=='AC':
            AC[p]+=1
        else:
            WA[p]+=1

for i in range(N):
    if AC[i]==0:
        WA[i]=0
    
print(sum(AC),sum(WA))
N ,M = map(int, input().split())
List = list(map(int, input().split()))
stand = 1 / (4 * M) * sum(List)
arr = []
for i in range(List):
  if List[i] >= stand:
    arr.append(List[i])
if len(arr) >= M:
  print("Yes")
else:
  print("No")
  

### FIXED CODE ###

N ,M = map(int, input().split())
List = list(map(int, input().split()))
stand = 1 / (4 * M) * sum(List)
arr = []
for i in range(len(List)):
  if List[i] >= stand:
    arr.append(List[i])
if len(arr) >= M:
  print("Yes")
else:
  print("No")