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

from heapq import heappush, heappushpop

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

max_score = float('-inf')
a_list_1_init = []
a_list_2_init = []
for i in a[0:N]:
    heappush(a_list_1_init, i)
for i in list(reversed(a))[0:N]:
    heappush(a_list_2_init, -i)

sum_1_init = sum(a_list_1_init)
sum_2_init = sum(a_list_2_init)
for i in range(N, 2 * N + 1):
    a_list_1 = list(a_list_1_init)
    a_list_2 = list(a_list_2_init)
    sum_1 = sum_1_init
    sum_2 = sum_2_init
    for k in a[N:i]:
        l = heappushpop(a_list_1, k)
        sum_1 += k - l
    for k in a[i:2*N]:
        l = heappushpop(a_list_2, -k)
        sum_2 += -k - l
    score = sum_1 + sum_2
    if score > max_score:
        max_score = score

print(max_score)

### FIXED CODE ###

from heapq import heappush, heappushpop

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

a_list_1 = []
a_list_2 = []
for i in a[0:N]:
    heappush(a_list_1, i)
for i in list(reversed(a))[0:N]:
    heappush(a_list_2, -i)

sum_1 = sum(a_list_1)
sum_2 = sum(a_list_2)
sum_arr_1 = [0] * (N + 1)
sum_arr_1[0] = sum_1
sum_arr_2 = [0] * (N + 1)
sum_arr_2[-1] = sum_2
for k in range(N, 2 * N):
    l = heappushpop(a_list_1, a[k])
    sum_1 += a[k] - l
    sum_arr_1[k - N + 1] = sum_1

for k in reversed(range(N, 2 * N)):
    l = heappushpop(a_list_2, -a[k])
    sum_2 += -a[k] - l
    sum_arr_2[k - N] = sum_2

max_score = float('-inf')
for s1, s2 in zip(sum_arr_1, sum_arr_2):
    score = s1 + s2
    if score > max_score:
        max_score = score

print(max_score)
### BUGGY CODE ###

n = int(input())
S = input()
D = {}
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            Si = str(S[i] + S[j] + S[k])
            if (Si) not in D:
                D[Si] = 1
print(len(D))

### FIXED CODE ###

n = int(input())
S = input()
ct = 0

for i in range(10):
    if str(i) in S:
        p = S.index(str(i))
        Si = S[p+1 :]
        for j in range(10):
            if str(j) in Si:
                q = Si.index(str(j))
                Sj = Si[q+1 :]
                for k in range(10):
                    if str(k) in Sj:
                        ct += 1
print(ct)
### BUGGY CODE ###

mod=10**9+7
s=input()
n=len(s)
dp=[13*[0]for _ in range(n)]
if s[0]=="?":dp[0]=[1]*10+[0]*3
else:dp[0][int(s[0])]=1
for i in range(1,n):
  for j in range(13):
    if s[i]=="?":
      for k in range(10):
        dp[i][(10*j+k)%13]+=dp[i-1][j]
        dp[i][(10*j+k)%13]%=mod
    else:
      dp[i][(10*j+int(s[i]))%13]+=dp[i-1][j]
      dp[i][(10*j+int(s[i]))%13]%=mod
print(dp[-1][5])

### FIXED CODE ###

s=input()
n=len(s)
dp=[13*[0]for _ in range(n)]
if s[0]=="?":dp[0]=10*[1]+[0]*3
else:dp[0][int(s[0])]+=1
for i in range(1,n):
  if s[i]!="?":
    for j in range(13):
      dp[i][(j*10+int(s[i]))%13]=dp[i-1][j]
  else:
    for j in range(13):
      for k in range(10):
        dp[i][(j*10+k)%13]+=dp[i-1][j]
  for j in range(13):dp[i][j]%=10**9+7
print(dp[-1][5])
### BUGGY CODE ###

H, W, M = map(int, input().split())
h = [0 for i in range(H)]
w = [0 for i in range(W)]
dp = [[0 for i in range(W)] for j in range(H)]

for i in range(M):
    hh, ww = map(int, input().split())
    w[ww - 1] += 1
    dp[hh - 1][ww - 1] += 1

for i in range(H):
    h[i] = sum(dp[i])

hhh = max(h)
www = max(w)
hhhh = [i for i, x in enumerate(h) if x == hhh]
wwww = [i for i, x in enumerate(w) if x == www]
check = 0


for i in hhhh:
    if check == 1:
        break
    for j in wwww:
        if dp[i][j] == 0:
            check = 1
            break
print(hhh + www - (1 - check))


### FIXED CODE ###

H, W, M = map(int, input().split())
h = [0 for i in range(H)]
w = [0 for i in range(W)]
DP = set()
for i in range(M):
    hh, ww = map(int, input().split())
    h[hh - 1] += 1
    w[ww - 1] += 1
    DP.add((hh - 1, ww - 1))

hhh = max(h)
www = max(w)
hhhh = [i for i, x in enumerate(h) if x == hhh]
wwww = [i for i, x in enumerate(w) if x == www]
check = 0

for i in hhhh:
    for j in wwww:
        if (i, j) not in DP:
            print(hhh + www)
            exit()
print(hhh + www - 1)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

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

counter = 0

for p in range(n):
    for q in range(n - p):
        for r in range(n - p - q):
            a = s[p]
            b = s[p + q]
            c = s[p + q + r]
            if a != b and b != c and c != a and q != r:
                # print(a, b, c, p, q, r)
                counter += 1
print(counter)

### FIXED CODE ###

# -*- coding: utf-8 -*-

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

r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')

counter = r_cnt * g_cnt * b_cnt

for i in range(n):
    for p in range(n):
        j = i + p
        k = j + p
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            counter -= 1
print(counter)
### BUGGY CODE ###


N = int(input())
S = input()

idxs = [i for i in range(N)]

ris = [i for i, s in enumerate(S) if s == "R"]
gis = [i for i, s in enumerate(S) if s == "G"]
bis = [i for i, s in enumerate(S) if s == "B"]

ans = 0
for ri in ris:
    for gi in gis:
        for bi in bis:
            i, j, k = sorted([ri, gi, bi])
            if k - j != j - i:
                ans += 1



"""
for i in range(N):
    for j in range(i, N):
        for k in range(j, N):
            if j - i != k - j:
                if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                    ans += 1
"""


print(ans)

### FIXED CODE ###


N = int(input())
S = input()

ris = [i for i, s in enumerate(S) if s == "R"]
gis = [i for i, s in enumerate(S) if s == "G"]
bis = [i for i, s in enumerate(S) if s == "B"]

all = len(ris) * len(gis) * len(bis)

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        k = 2*j - i
        if 0 <= k < N:
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                cnt += 1

ans = all - cnt


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

k = int(input())
s = input()
L = len(s)
mod = 10**9+7

com = [1]*(k+1)
p25 = [1]*(k+1)
p26 = [1]*(k+1)

for i in range(k):
  com[i+1] = com[i]*(L+i)//(i+1)
  p25[i+1] = p25[i]*25%mod
  p26[i+1] = p26[i]*26%mod

ans = 0
for p in range(k+1):
  chk = com[p]%mod
  chk *= p25[p]%mod
  chk *= p26[k-p]%mod
  ans += chk
  ans %= mod
  
print(ans)

### FIXED CODE ###

k = int(input())
s = input()
L = len(s)
mod = 10**9+7

MAX = 2*10**6
fact = [1]*(MAX+1)
for i in range(1, MAX+1):
    fact[i] = (fact[i-1]*i) % mod

inv = [1]*(MAX+1)
for i in range(2, MAX+1):
    inv[i] = inv[mod % i]*(mod-mod//i) % mod

fact_inv = [1]*(MAX+1)
for i in range(1, MAX+1):
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod

def comb(n, k):
    if n < k:
        return 0
    return fact[n] * fact_inv[n-k] * fact_inv[k] % mod
  
p25 = [1]*(k+1)
p26 = [1]*(k+1)

for i in range(k):
  p25[i+1] = p25[i]*25%mod
  p26[i+1] = p26[i]*26%mod

ans = 0
for p in range(k+1):
  chk = p25[p]*comb(L-1+p,L-1)%mod
  chk *= p26[k-p]%mod
  ans += chk
  ans %= mod
  
print(ans)
### BUGGY CODE ###

n,k,q=(int(x) for x in input().split())
a=[]
p=[]
for i in range(0,q):
    temp=int(input())
    a.append(temp)
border=-k+q
for j in range(0,n):
    if a.count(j+1)>border:
        print('Yes')
    else:
        print('No')

#print(p)


### FIXED CODE ###

n,k,q=(int(x) for x in input().split())
a=[]
p=[0]*n
for i in range(0,q):
    temp=int(input())
    p[temp-1]+=1
border=-k+q

res = '\n'.join('Yes' if p[j]> border else 'No' for j in range(0,n))

print(res)
### BUGGY CODE ###

import math
K = int(input())

ans=0

for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            t=math.gcd(a,b)
            t=math.gcd(t,c)
            ans+=t

print(ans)

### FIXED CODE ###

import math
K = int(input())

ans=0

for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            t=math.gcd(a,b)
            t=math.gcd(t,c)
            ans+=t

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

from collections import deque
# from collections import Counter
# from fractions import gcd # >=Python3.5 # lcm（最小公倍数） = (a*b)//gcd(a,b)
# from fractions import Fraction
# from math import gcd # <Python3.5
# from math import sqrt

# input = sys.stdin.readline
# def main():

#---------------------------------------------------------

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

road = [[] for i in range(n)]
cnt  = [0 for i in range(n)]

for i in range(n-1):
    a,b = map(int,input().split())
    road[a-1].append(b-1)
    road[b-1].append(a-1)

dist = [-1]*n
que  = deque()
dist[0] = 0
que.append(0)

while(len(que)!=0):
    # BFS/DFS
    v = que.popleft()
    for r in road[v]:
        if dist[r]!=-1:
            continue
        dist[r] = dist[v] + 1
        que.append(r)

for i in range(q):
    idx,v = map(int,input().split())
    for j in range(n):
        if j == idx-1:
            cnt[j] += v
        if dist[j] > dist[idx-1]:
            cnt[j] += v

print(*cnt)

### FIXED CODE ###

from collections import deque
# from collections import Counter
# from itertools import accumulate
# from fractions import gcd # >=Python3.5 # lcm（最小公倍数） = (a*b)//gcd(a,b)
# from fractions import Fraction
# from math import gcd # <Python3.5
# from math import sqrt

# input = sys.stdin.readline
# def main():

#---------------------------------------------------------

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

road = [[] for _ in range(n)]
cnt  = [0 for _ in range(n)]

for i in range(n-1):
    a,b = map(int,input().split())
    road[a-1].append(b-1)
    road[b-1].append(a-1)

for i in range(q):
    idx,v = map(int,input().split())
    cnt[idx-1] += v

dist = [-1]*n
que  = deque()
dist[0] = 0
que.append(0)

while(len(que)!=0):
    # BFS/DFS
    v = que.pop()
    for r in road[v]:
        if dist[r]!=-1:
            continue
        dist[r] = dist[v] + 1
        cnt[r] += cnt[v]
        que.append(r)

print(*cnt)
### BUGGY CODE ###

n = int(input())
boss = [0] + list(map(int, input().split()))
#print(boss)
for i in range(n):
    print(boss.count(i+1))

### FIXED CODE ###

n = int(input())
dicti = {}
boss = list(map(int, input().split()))
for i in boss:
    if i in dicti:
        dicti[i] += 1
    else:
        dicti[i] = 1
#print(dicti)
for j in range(1,n+1):
    try:
        print(dicti[j])
    except:
        print(0)
### BUGGY CODE ###

mod = 998244353

N, K = list(map(int, input().split()))
move = []
for _ in range(K):
    L, R = list(map(int, input().split()))
    for i in range(L, R+1):
        move.append(i)
dp = [0]*(2*N+10)
dp[0] = 1
for i in range(N):
    tmp = dp[i]
    for m in move:
        dp[i+m] += tmp
        dp[i+m] %= mod
print(dp[N-1])

### FIXED CODE ###

mod = 998244353

N, K = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(K)]
dp = [0]*(2*N+10)
dp[0] = 1
tmp = 0
for i in range(N):
    tmp += dp[i]
    tmp %= mod
    for L, R in S:
        dp[i+L] += tmp
        dp[i+R+1] -= tmp
print(dp[N-1]%mod)
### BUGGY CODE ###

N, M = map(int, input().split())
X = list(map(int, input().split()))

points = X[:]
rem = N
points.sort()

if M<=N:
    ans = 0
else:
    import queue
    q = queue.Queue()
    q.put([[] for _ in range(N)])

    import sys
    INT_MAX = sys.maxsize
    ans = INT_MAX

    import itertools
    for v in itertools.combinations(list(range(1, M)),N-1):
        v = list(v)
        v.insert(0,0)
        v.append(M)
        #print(v)
        cost_sum = 0
        for i in range(1, len(v)):
            sub_p = points[v[i-1]:v[i]]
            cost = sub_p[-1] - sub_p[0]
            #print(sub_p, cost)
            cost_sum += cost
        ans = min(ans, cost_sum)

print(ans)





    




### FIXED CODE ###

N, M = map(int, input().split())
X = list(map(int, input().split()))

if M <= N:
    ans = 0
else:
    points = X[:]
    points.sort()

    diff_p = []
    for i in range(1, len(points)):
        diff_p.append(points[i] - points[i-1])

    diff_p.sort()
    #print(diff_p)

    ans = sum(diff_p[:M-N])
print(ans)
### BUGGY CODE ###

N = int(input())
alist = list(map(int, input().split()))
Sum_a = 0
for i in range(N):
  Sum_j = 0
  for j in range(i+1, N):
    Sum_j += alist[j]
  Sum_j = int(Sum_j % (1e9+7))
  Sum_a += alist[i] * Sum_j
print(int(Sum_a % (1e9+7)))

### FIXED CODE ###

N = int(input())
alist = list(map(int, input().split()))
import numpy as np
Sum_a = 0
Sum_j_list = np.cumsum(alist)
for i in range(N-1):
  Sum_j = int((Sum_j_list[N-1] - Sum_j_list[i]) % int(1e9+7))
  Sum_a += (alist[i] * Sum_j) % int(1e9+7)
print(int(Sum_a % int(1e9+7)))
### BUGGY CODE ###

X, Y, A, B, C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
d = 0
x = 0
y = 0

while x < X and y < Y:
    a = max(p)
    b = max(q)
    c = max(r)
    if a >= c:
        d += a
        x += 1
        p.remove(a)
    elif b >= c:
        d += b
        y += 1
        q.remove(b)
    elif c > a >= b:
        d += c
        y += 1
        r.remove(c)
    elif c > b > a:
        d += c
        x += 1
        r.remove(c)

while x < X:
    p.extend(r)
    d += max(p)
    x += 1
    p.remove(max(p))
while y < Y:
    q.extend(r)
    d += max(q)
    y += 1
    q.remove(max(q))
print(d)

### FIXED CODE ###

X, Y, A, B, C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort()
p.reverse()
q.sort()
q.reverse()
del p[X:]
del q[Y:]
p.extend(q)
p.extend(r)
p.sort()
p.reverse()
del p[X+Y:]
d = sum(p)
print(d)
### BUGGY CODE ###

n,m = map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
absort=sorted(ab,key=lambda x:(x[0],-x[1]))

ans=0
temp=[]
for i in range(1,m+1):
    while absort:
        if absort[0][0]<=i:
            temp.append(absort[0][1])
            del absort[0]
        else:
            break
    if temp:
        tmpmax=max(temp)
        ans+=tmpmax
        temp.remove(tmpmax)

print(ans)


### FIXED CODE ###

import heapq

n,m = map(int,input().split())
ab=[[] for _ in range(m)]
for i in range(n):
    a,b=map(int,input().split())
    if a < m+1:
        ab[a-1].append(-b)

h=[]
ans=0
for i in range(m):
    for j in ab[i]:
        heapq.heappush(h,j)
    if len(h)==0:
        continue
    ans+=heapq.heappop(h)*(-1)
print(ans)
### BUGGY CODE ###

K,S = map(int,input().split())
count = 0
for x in range(0,K+1):
    for y in range(0,K+1):
        for z in range(0,K+1):
            if x+y+z==S:
                count+=1

print(count)

### FIXED CODE ###

K,S = map(int,input().split())
sum=0
for x in range(0,K+1):
    for y in range(0,K+1):
        z = S-x-y

        if z>=0 and z<=K:
            sum+=1


print(sum)
### BUGGY CODE ###

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
P = 1
Q = 0 if 1 in A else 1
for i in range(N-1):
  p = 0 if i+2 in A else P+Q
  P, Q = Q%(10**9+7), p%(10**9+7)
print(Q)

### FIXED CODE ###

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
L = [0]*(N+1)
for a in A:
  L[a]=-1
L[0] = 1
L[1] += 1
for i in range(2, N+1):
  if L[i]==-1:
    L[i]=0
  else:
    L[i] = L[i-1]+ L[i-2]
print(L[-1]%(10**9+7))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N=int(input())
A=list(map(int,input().split()))
X=[None]*N
for i in range(N) :
    X[i]=str(A.index(i+1)+1)
print(" ".join(X))

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
X=[None]*N
for i in range(N) :
    X[A[i]-1]=i+1
print(*X)
### BUGGY CODE ###

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

def is_ok(mat):
    n = len(mat)
    for i in range(n):
        for j in range(n):
            if mat[i][j] != mat[j][i]:
                return False
    return True

count = 0
A = 1
for B in range(N):
    next_S = [S[(i+B) % N] for i in range(N)]
    if is_ok(next_S):
        count += 1

print(count * N)

### FIXED CODE ###

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

def is_ok(mat):
    n = len(mat)
    for i in range(n):
        for j in range(i, n):
            if mat[i][j] != mat[j][i]:
                return False
    return True

count = 0
A = 1
for B in range(N):
    next_S = [S[(i+B) % N] for i in range(N)]
    if is_ok(next_S):
        count += 1

print(count * N)
### 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 = [[] for _ in range(h)]
dp = [[-1]*w for _ in range(h)]
que = deque()
c = [input() for _ in range(h)]

dp[x1][y1] = 0
#heapq.heappush(que, (dp[x1][y1], [x1,y1]))
que.append((dp[x1][y1], [x1,y1]))
dx = [1,0,-1,0]
dy = [0,1,0,-1]
while que:
  #p= heapq.heappop(que)
  p = que.popleft()
  p = p[1]
  if (p[0] == x2) & (p[1] == y2):exit(print(dp[x2][y2]))
  for i in range(4):
    for j in range(1,k+1):
      nx = p[0] + dx[i]*j
      ny = p[1] + dy[i]*j
      if not ((0 <= nx < h) & (0 <= ny < w)):break
      if c[nx][ny] == '@':break
      if 0 <= dp[nx][ny] <= dp[p[0]][p[1]]:break
      dp[nx][ny] = dp[p[0]][p[1]] + 1
      #heapq.heappush(que, (dp[nx][ny], [nx,ny]))
      que.append((dp[nx][ny], [nx,ny]))

if dp[x2][y2] != 0:
  print(dp[x2][y2])
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 ###

def main():
    from itertools import product
    n=int(input())
    s=input()
    
    cnt=0
    num='0123456789'
    for pw in product(num,repeat=3):
        j=0
        for i in range(n):
            if pw[j]==s[i]:
                j+=1
                if j==3:
                    cnt+=1
                    break
    
    print(cnt) 
if __name__=='__main__':
    main()

### FIXED CODE ###

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

N=[str(i).zfill(3) for i in range(1000)]

cnt=0
for n in N:
  n0=s.find(n[0])
  if n0==-1:
    continue
  n1=s.find(n[1],n0+1)
  if n1==-1:
    continue
  n2=s.find(n[2],n1+1)
  if n2!=-1:
    cnt+=1
print(cnt)
### BUGGY CODE ###

N=int(input())
S=input()
def zalgo(S):
    a=[0]*len(S)
    c=0
    for i in range(1,len(S)):
        if i+a[i-c]<c+a[c]:
            a[i]=a[i-c]
        else:
            j=max(0,c+a[c]-i)
            while i+j<len(S) and S[j]==S[i+j]:
                j+=1
            a[i]=j
    a[0]=len(S)
    return a
r=0
for i in range(N):
    a=zalgo(S[i:])
    for j in range(N-i):
        r=max(r,min(a[j],j))
print(r)

### FIXED CODE ###

N=int(input())
S=input()
l,u=0,N
while l+1<u:
    m=(l+u)//2
    s=set()
    for i in range(N-m*2+1):
        s.add(S[i:i+m])
        if S[i+m:i+m*2] in s:
            l=m
            break
    if l!=m:
        u=m
print(l)
### BUGGY CODE ###

M=10**9+7
s=input()
dp=[[0 for i in range(13)] for j in range(len(s)+1)]
dp[0][0]=1
for i in range(1,len(s)+1):
  r=[0 for _ in range(13)]
  if s[-i]=='?':
    for j in range(10):
      t=j*(10**(i-1))
      r[t%13]=1
    for k in range(13):
      for l in range(13):
        dp[i][(k+l)%13]+=dp[i-1][k]*r[l]
  else:
    t=int(s[-i])*(10**(i-1))
    r[t%13]=1
    for k in range(13):
      for l in range(13):
        dp[i][(k+l)%13]+=dp[i-1][k]*r[l]

print(dp[-1][5]%M)

### FIXED CODE ###

mod=10**9+7
s=input()
dp=[[0]*13 for _ in range(len(s)+1)]
dp[0][0]=1
r=[i%13 for i in range(130)]

for i in range(len(s)):
  if s[i]=='?':
    for j in range(13):
      for k in range(10):
        dp[i+1][r[j*10+k]]+=dp[i][j]
  else:
    t = int(s[i])
    for j in range(13):
      dp[i+1][r[j*10+t]] += dp[i][j]

  for k in range(13):
    dp[i+1][k] %= mod

print(dp[len(s)][5])
### BUGGY CODE ###

n=int(input())
A=list(map(int,input().split()))
for i in range(1,n+1):
    print(A.count(i))



### FIXED CODE ###

import collections
n=int(input())
A=list(map(int,input().split()))
cli=collections.Counter(A)
for i in range(1,n+1):
    print(cli[i])
### BUGGY CODE ###

import numpy as np

N=int(input())


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

sum=a[0]

for i in range(1,N):
    sum = sum*a[i]

if sum<=1000000000000000000:
    print(sum)
else:
    print('-1')


### FIXED CODE ###

import numpy as np

N = int(input())

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

sum = a[0]


if 0 in a:
    print('0')
    exit()

for i in range(1, N):
    sum = sum * a[i]
    if sum > 10**18:
        print('-1')
        exit()

print(sum)
### BUGGY CODE ###

n,m = map(int,input().split())
l, r = map(int,input().split())
set1 = set([i for i in range(l,r+1)])
for i in range(m-1):
    l, r = map(int,input().split())
    set2 = set([i for i in range(l,r+1)])
    set1 = set1 & set2
print(len(set1))

### FIXED CODE ###

n,m = map(int,input().split())
L0, R0 = map(int,input().split())
for i in range(m-1):
    l, r = map(int,input().split())
    L0 = max(L0,l)
    R0 = min(R0,r)

if L0 <= R0:
    print(R0-L0+1)
else:
    print(0)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(300000)
from collections import Counter
def divisors(n, sort=False):
    """
    nの約数をO(√n)で列挙する
    """
    d = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d.append(i)
            if i != n // i:
                d.append(n//i)
    if sort:
        d.sort()
    return d
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()
A = LMI()

div = set(A)
cnt = Counter(A)
ans = 0
for a in A:
    if cnt[a] >= 2:
        continue
    flg = True
    for d in divisors(a):
        if d == a:
            continue
        if d in div:
            flg = False
            break
    if flg:
        ans += 1
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(300000)
from collections import Counter

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()
A = LMI()

div = set(A)
cnt = Counter(A)
M = max(A)
ng = [False] * (M + 1)
for a in A:
    n = a * 2
    while n <= M:
        ng[n] = True
        n += a
ans = 0
for a in A:
    if cnt[a] >= 2:
        continue
    if ng[a]:
        continue
    ans += 1

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

s = raw_input()
p = s.find('ST')
while p != -1:
    s = s[:p] + s[p+2:]
    p = s.find('ST')
print len(s)


### FIXED CODE ###

s = raw_input()
p = 0
m = 0
for c in s:
    if c == 'S':
        p -= 1
    elif c == 'T':
        p += 1
    m = max(m,p)
print m*2
### BUGGY CODE ###

N,K,Q=map(int,input().split())
ans=[]
L=[]
for _ in range(N):
    L.append(0)
for _ in range(Q):
  ans.append(int(input()))
for k in range(N):
  L[k]=ans.count(k+1)
for j in range(N):
  if K-(Q-L[j])>0:
    print('Yes')
  else:
    print('No')
            
 
  

### FIXED CODE ###

N,K,Q=map(int,input().split())
ans=[]
L=[]
for _ in range(N):
    L.append(0)
for _ in range(Q):
  ans.append(int(input()))
for k in range(Q):
  L[ans.pop()-1]+=1
for j in range(N):
  if K-(Q-L[j])>0:
    print('Yes')
  else:
    print('No')