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

h,w,m = map(int, input().split())
bh = []
bw = []
l_num = [0]*h
c_num = [0]*w
for i in range(m):
    i1, i2 = map(int, input().split())
    bh.append(i1)
    bw.append(i2)
    l_num[i1-1] = l_num[i1-1] + 1
    c_num[i2-1] = c_num[i2-1] + 1

#print(l_num,c_num)

l_candi = [i for i, v in enumerate(l_num) if v == max(l_num)]
c_candi = [i for i, v in enumerate(c_num) if v == max(c_num)]

#print(l_candi,c_candi)

t = 0
for k in range(m):
    if bh[k]-1 in l_candi and bw[k]-1 in c_candi:
        t = t + 1

if t < len(l_candi)*len(c_candi):
    print(max(l_num)+max(c_num))
else:
    print(max(l_num)+max(c_num)-1)

### FIXED CODE ###

h,w,m = map(int, input().split())
bh = []
bw = []
l_num = [0]*h
c_num = [0]*w
for i in range(m):
    i1, i2 = map(int, input().split())
    bh.append(i1)
    bw.append(i2)
    l_num[i1-1] = l_num[i1-1] + 1
    c_num[i2-1] = c_num[i2-1] + 1

#print(l_num,c_num)

max_l_num = max(l_num)
max_c_num = max(c_num)
l_candi = [i for i, v in enumerate(l_num) if v == max_l_num]
c_candi = [i for i, v in enumerate(c_num) if v == max_c_num]

#print(l_candi,c_candi)

t = 0
for k in range(m):
    if l_num[bh[k]-1] == max_l_num and c_num[bw[k]-1] == max_c_num:
        t = t + 1

if t < len(l_candi)*len(c_candi):
    print(max_l_num+max_c_num)
else:
    print(max_l_num+max_c_num-1)
### BUGGY CODE ###

A, B, N = map(int, input().split())  # 入力

ans = None

for _x in range(N):
    x = _x + 1
    s = int((A * x) / B) - A * int(x / B)
    if ans == None:
        ans = s
    elif s > ans:
        ans = s

print(ans)


### FIXED CODE ###

A, B, N = map(int, input().split())  # 入力

ans = None
a_max = None

for _x in range(1):
    x = min((B - 1), N) * (_x+1)
    if x > N:
        break
    # print(x)
    a = x/B-int(x / B)
    # print(int(a * A))
    sa = int(a*A)
    # s = int((A * x) / B) - A * int(x / B)
    if a_max == None:
        a_max = sa
    elif sa > a_max:
        a_max = sa

print(a_max)
### BUGGY CODE ###

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

def lcm(x, y):
    return (x * y) // gcd(x, y)

N, M = map(int, input().split())
S = input()
T = input()

lcm_num = lcm(N,M)
lN = lcm_num // N
lM = lcm_num // M

for i in range(lcm_num):
    if i == 0 or (i%(lN) == 0 and i%(lM) == 0):
        if S[i//lN] == T[i//lM]:
            continue
        else:
            print(-1)
            exit()

print(lcm_num)


### FIXED CODE ###

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

def lcm(x, y):
    return (x * y) // gcd(x, y)

N, M = map(int, input().split())
S = input()
T = input()

lcm_num = lcm(N,M)
lN = lcm_num // N
lM = lcm_num // M
gcd_num = lN * lM

for i in range(0,lcm_num,gcd_num):
    if S[i//lN] == T[i//lM]:
        continue
    else:
        print(-1)
        exit()

print(lcm_num)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	n = II()
	a = LI()
	a = [0]+a
	dp = [[[-10**9,-10**9] for _ in range(n//2+2)] for _ in range(n+1)]
	dp[1][1][1]=a[1]
	for i in range(0,2):
		dp[i][0]=[0,0]
	for i in range(1,n+1):
		dp[i][(i-1)//2][0]=max(dp[i-1][(i-1)//2][0], dp[i-1][(i-1)//2][1])
		dp[i][(i-1)//2][1]=max(dp[i-1][(i-1)//2-1][0]+a[i], dp[i-2][(i-1)//2-1][0]+a[i])
		dp[i][i//2][0]=max(dp[i-1][i//2][0], dp[i-1][i//2][1])
		dp[i][i//2][1]=max(dp[i-1][i//2-1][0]+a[i], dp[i-2][i//2-1][0]+a[i])
		dp[i][(i+1)//2][1]=max(dp[i-1][(i+1)//2-1][0]+a[i], dp[i-2][(i+1)//2-1][0]+a[i])
	print(max(dp[n][n//2]))
if __name__ == '__main__':
	main()

### FIXED CODE ###

import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	n = II()
	a = LI()
	a = [0]+a
	dp_t = defaultdict(lambda: -10**18)
	dp_f =  defaultdict(lambda: -10**18)
	dp_f[(0,0)]=0
	for i in range(1,n+1):
		dp_f[(i,(i-1)//2)]=max(dp_f[(i-1,(i-1)//2)], dp_t[(i-1,(i-1)//2)])
		dp_t[(i,(i-1)//2)]=dp_f[(i-1,(i-1)//2-1)]+a[i]
		dp_f[(i,(i-1)//2+1)]=max(dp_f[(i-1,(i-1)//2+1)], dp_t[(i-1,(i-1)//2+1)])
		dp_t[(i,(i-1)//2+1)]=dp_f[(i-1,(i-1)//2)]+a[i]
	print(max(dp_t[(n,n//2)],dp_f[(n,n//2)]))
if __name__ == '__main__':
	main()
### BUGGY CODE ###

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

for i in range(a,b+1):
    if i%c == 0:
        counter += 1
    else:
        continue
print(counter)

### FIXED CODE ###

a,b,x=map(int, input().split())
i = a//x
j = b//x
if a%x==0:
    print(j-i+1)
else:
    print(j-i)
### BUGGY CODE ###

try:
	while True:
		j = 0
		n = input()
		ans = [1] * (n + 1);
		ans[0] = ans[1] = 0;
		for i in xrange(3, n + 1, 2):
			if i * 2 > n:
				break
			if ans[i] != 0:
				for j in xrange(2 * i, n + 1, i):
					ans[j] = 0
		for k in xrange(2 * 2, n + 1, 2):
			ans[k] = 0
		print sum(ans)
except EOFError:
	pass

### FIXED CODE ###

def prime_count(n):
	j = 0
	ans = [1] * (n + 1)
	ans[0] = ans[1] = 0
	for i in xrange(3, n + 1, 2):
		if i * 2 > n:
			break
		if ans[i] != 0:
			for j in xrange(2 * i, n + 1, i):
				ans[j] = 0
	for k in xrange(2 * 2, n + 1, 2):
		ans[k] = 0
	print sum(ans)

try:
	while True:
		n = input()
		prime_count(n)
except EOFError:
	pass
### BUGGY CODE ###

N,M=map(int,input().split())
P=[[0]*(N+1) for i in range(N+1)]
for i in range(M):
  a,b=map(int,input().split())
  P[a][b]=b
  P[b][a]=a
#AB=[list(map(int,input().split())) for i in range(M)]
ans=[0]*N
con=set()
now=[1]
while now!=[]:
  _now=[]
  for n in now:
    for p in P[n]:
      if p>0 and p not in con:
        ans[p-1]=n
        _now.append(p)
        con.add(p)
    #con.add(n)
  now=_now
print('Yes')
for a in ans[1:]:
  print(a)

### FIXED CODE ###

N,M=map(int,input().split())
P=[[] for i in range(N+1)]
for i in range(M):
  a,b=map(int,input().split())
  P[a].append(b)
  P[b].append(a)
#AB=[list(map(int,input().split())) for i in range(M)]
ans=[0]*N
con=set()
now=[1]
while now!=[]:
  _now=[]
  for n in now:
    for p in P[n]:
      if p in con:
        continue
      ans[p-1]=n
      _now.append(p)
      con.add(p)
    #con.add(n)
  now=_now
print('Yes')
for a in ans[1:]:
  print(a)
### BUGGY CODE ###

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

### FIXED CODE ###

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

import sys
n = int(sys.stdin.readline())
total = 0
for i in range(1, n):
    total +=i
print(total)

### FIXED CODE ###

import sys
n = int(sys.stdin.readline())
print(n*(n-1)//2)
### BUGGY CODE ###

n,k=map(int,input().split())
ans=0
for i in range(n+1):
  for j in range(n+1):
    for l in range(n+1):
      if i+j+l==k:
        ans+=1
print(ans)


### FIXED CODE ###

n,k=map(int,input().split())
ans=0
for i in range(n+1):
  for j in range(n+1):
    if 0<=k-i-j<=n:
      ans+=1
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
from math import gcd
from functools import reduce

from random import randint

def find_gcd(list):
    x = reduce(gcd, list)
    return x


def solve(N: int, A: "List[int]"):
    # A = list(set(A))

    q2 = True
    for a in A:
        for b in A:
            if a!=b and gcd(a, b) != 1:
                q2 = False
                break

    q1 = reduce(gcd, A) == 1


    if q1 and q2:
        print('pairwise coprime')
    elif q1:
        print('setwise coprime')
    else:
        print('not coprime')
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"

    solve(N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import collections
from math import gcd
from functools import reduce

from random import randint

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

def find_gcd(list):
    x = reduce(gcd, list)
    return x

def find_lcm(list):
    x = reduce(lambda a,b: lcm(a,b)% MOD, list)
    return x

D = [None for _ in range(10**6)]
MOD = 10**9 + 7
def solve(N: int, A: "List[int]"):

    q1 = reduce(gcd, A) == 1

    def SieveOfEratosthenes(n): 
        prime = [i for i in range(n + 1)] 
        p = 2
        while (p * p <= n): 
            if (prime[p] == p): 
                for i in range(p * 2, n + 1, p): 
                    prime[i] = p
            p += 1
        prime[0]= 0
        prime[1]= 1
        return prime

    D = SieveOfEratosthenes(10**6)
    s = set([])
    q2 = True
    for a in A:
        facs = set([])
        while True:            
            facs.add(D[a])
            a = a // D[a]
            if D[a] == a:
                facs.add(D[a])
                break

        for fac in facs:
            if fac in s:
                if fac != 1 and fac != 0:
                    q2 = False
            s.add(fac)


    if q1 and q2:
        print('pairwise coprime')
    elif q1:
        print('setwise coprime')
    else:
        print('not coprime')
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"

    solve(N, A)

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

N=int(input())
A=list(map(int,input().split()))
a=1
if 0 in A:
    print(0)
else:
    for i in range(N):
        a*=A[i]
    if a>(int(10**18)):
        print(-1)
    else:
        print(a)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
a=1
if 0 in A:
    print(0)
else:
    for i in range(N):
        a*=A[i]
        if a>1000000000000000000:
          print(-1)
          break
    else:
        print(int(a))
### BUGGY CODE ###

n = int(input())
s = raw_input()
d = []
for i in range(0,n):
    c = s[0:i].count('W')+s[i+1:n].count('E')
    d.append(c)
print(min(d))

### FIXED CODE ###

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

a = [(0,0) for _ in range(n + 1)]
b = []
for i in range(n):
    if s[i] == "W":
        a[i+1] = (a[i][0] + 1,a[i][1])
    else:
        a[i+1] = (a[i][0],a[i][1] + 1)
    b.append(a[i+1][1]-a[i+1][0])
    
ans = s[0:b.index(max(b))].count('W') + s[b.index(max(b))+1:].count('E')
print(ans)
### BUGGY CODE ###

s=input()
q=int(input())
r = False
for i in range(q):
    tmp = list(input().split(' '))
    if tmp[0]=='1':
        r = not r
    elif (not r and tmp[1]=='1') or (r and tmp[1] =='2'):
        s = tmp[2]+s
    else:
        s = s + tmp[2]
if not r:
    print(s)
else:
    print(s[::-1])

### FIXED CODE ###

from collections import deque
s=deque(list(input()))
q=int(input())
r = False
for i in range(q):
    tmp = list(input().split(' '))
    if tmp[0]=='1':
        r = not r
    elif (not r and tmp[1]=='1') or (r and tmp[1] =='2'):
        s.appendleft(tmp[2])
    else:
        s.append(tmp[2])
if not r:
    for i in s:
        print(i,end='')
else:
    for i in reversed(s):
        print(i,end='')
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
assert len(A) == N
total = 0
sumA = []
for i,ai in enumerate(A):
  sumA.append(sum(A[i+1:]))

for i,ai in enumerate(A):
  total += ai * sumA[i]
print(total % (10 ** 9 + 7))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
assert len(A) == N
total = 0
sum_A = sum(A)
for i,ai in enumerate(A):
  sum_A -= ai
  total += ai * sum_A
print(total % (10 ** 9 + 7))
### BUGGY CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    res = 1
    for i in a:
        res *= i
    if res <= 10 ** 18:
        print(res)
    else:
        print(-1)
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_s = sorted(a)
    res = 1
    for i in a_s:
        res *= i
        if res == 0:
            print(0)
            break
        if res > 10 ** 18:
            print(-1)
            break
    if res > 0 and res <= 10 ** 18:
        print(res)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys

INF = float('inf')

N, W = map(int, sys.stdin.readline().split())

items = [] * N

for i in range(N):
    w, v = map(int, sys.stdin.readline().split())
    items.append([w,v])
    
dp = [[INF for i in range(W+1)] for j in range(N+1)] #dp[i][j]: i:N+1, j: W+1, iまでの品物を用いて大きさwまでの価値の合計

for i in range(W+1):
    dp[0][i] = 0
    
for i in range(N+1):
    dp[i][0] = 0
    
for i in range(1, N+1):
    for j in range(1, W+1):
        if j - items[i-1][0] >= 0:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-items[i-1][0]] + items[i-1][1])
        else:
            dp[i][j] = dp[i-1][j]

print(dp[N][W])

### FIXED CODE ###

from collections import Counter
from itertools import product

N, W = map(int, input().split())
items = {}
weight = []

for i in range(N):
    w, v = map(int, input().split())
    weight.append(w)
    
    if items.get(w, None) is None:
        items[w] = []
    items[w].append(v)
    items[w] = sorted(items[w], reverse = True)

cnt = Counter(weight)

w_num = [] #各重さの個数。組み合わせのために使う。[range(0,2), range(0,3), range(0,2)]のような出力
w_set = [] # 重さは w0 <= wi <= w0+3の４通りしかない

for w in range(weight[0], weight[0] + 4):
    if cnt[w] == 0:
        continue
    
    w_num.append(range(cnt[w] + 1))
    w_set.append(w)

ans = 0

for i in product(*w_num):
    w = sum(map(lambda x: x[0] * x[1], zip(i, w_set)))
    if 1 > w or w > W:
        continue
    v = sum([sum(items[k][:j]) for j, k in zip(i, w_set)])
    if ans < v:
        ans = v

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

import math

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def factorize(n):
    primes = set()
    for p in Ps:
        if p * p > n:
            break
        while n % p == 0:
            n //= p
            primes.add(p)
    if n > 1:
        primes.add(n)
    return primes

Ps = primes(10 ** 6)
n = int(input())
As = list(map(int, input().split()))

# setwiseFlag
gcd = As[0]
for a in As:
  gcd = math.gcd(gcd, a)
setwiseFlag = (gcd == 1)

# pairwiseFlag
pairwiseFlag = True
target = set()
for a in As:
  primes = factorize(a)
  if len(primes & target) > 0:
    pairwiseFlag = False
  target |= primes

if pairwiseFlag:
  print('pairwise coprime')
elif setwiseFlag:
  print('setwise coprime')
else:
  print('not coprime')


### FIXED CODE ###

import bisect
import math

n = int(input())
As = list(map(int, input().split()))
As.sort()

# cons = 10 ** 6
# is_prime = [True] * (cons + 1)
# is_prime[0] = False
# is_prime[1] = False
# for i in range(2, int(cons**0.5) + 1):
#     if not is_prime[i]:
#         continue
#     for j in range(i * 2, cons + 1, i):
#         is_prime[j] = False
# Ps = [i for i in range(cons + 1) if is_prime[i]]
def eratosthenes(n):
    is_prime = [0, 0] + [1] * (n - 1)
    for i in range(int(n**0.5) + 1):
        if is_prime[i] == 0:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = 0
    return [i for i, pi in enumerate(is_prime) if pi == 1]
Ps = eratosthenes(10 ** 6)

def factorize(n):
    primes = set()
    for p in Ps:
        if p * p > n:
            break
        while n % p == 0:
            n //= p
            primes.add(p)
    if n > 1:
        primes.add(n)
    return primes

gcd = As[0]
for a in As:
  gcd = math.gcd(gcd, a)
setwiseFlag = (gcd == 1)

pairwiseFlag = True
target = set()
for a in As:
  primes = factorize(a)
  if len(primes & target) > 0:
    pairwiseFlag = False
  target |= primes

if pairwiseFlag:
  print('pairwise coprime')
elif setwiseFlag:
  print('setwise coprime')
else:
  print('not coprime')
### BUGGY CODE ###

from bisect import bisect_left
import itertools
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
A.sort()
t=0
for i in range(N):
    while True:
        if 2**t<=A[i]<2**(t+1):
            break
        t+=1
    B[i]=2**(t+1)-A[i]
i=N-1
count=0
while i>0:
    b=bisect_left(A,B[i])
    if A[b]==B[i] and b!=i:
        A.pop(b)
        B.pop(b)
        count+=1
        i-=2
    else:
        A=A[:i]
        B=B[:i]
        i-=1
print(count) 

### FIXED CODE ###

from bisect import bisect_left
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
A.sort()
t=0
for i in range(N):
    while 2**t<=A[i]:
        if 2**t<=A[i]<2**(t+1):
            break
        t+=1
    B[i]=2**(t+1)-A[i]
i=N-1
count=0
flag=[0]*N
for i in range(N-1,0,-1):
    if flag[i]==1:
        continue
    flag[i]=1
    b=bisect_left(A,B[i])
    if A[b]==B[i] and flag[b]==0:
        flag[i]=1
        flag[b]=1
        A[b]-=1
        count+=1
print(count)
### BUGGY CODE ###

s = input()

m = 1000000007
dp = [0] * 4
dp[0] = 1

for c in s:
  if c=='A':
    dp[1] += dp[0]
  elif c=='B':
    dp[2] += dp[1]
  elif c=='C':
    dp[3] += dp[2]
  elif c=='?':
    dp = [dp[0]*3, dp[0]+dp[1]*3, dp[1]+dp[2]*3, dp[2]+dp[3]*3]

print(dp[3]%m)

### FIXED CODE ###

s = input()

m = 1000000007
dp = [0] * 4
dp[0] = 1

for c in s:
  if c=='A':
    dp[1] += dp[0]
  elif c=='B':
    dp[2] += dp[1]
  elif c=='C':
    dp[3] += dp[2]
  elif c=='?':
    dp = [(dp[0]*3)%m, (dp[0]+dp[1]*3)%m, (dp[1]+dp[2]*3)%m, (dp[2]+dp[3]*3)%m]

print(dp[3]%m)
### BUGGY CODE ###

from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split()) 
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def f(k,p):
  acc = n 
  for i in range(len(b)):
    if b[i]>p:
      acc -= b[i]-p 
    else:
      break
  return (acc >= k*p)

n = inn()
a = inl()
h = {}
for x in a:
  if x in h:
    h[x] += 1
  else:
    h[x] = 1
b = []
for x in h:
  b.append(h[x])
b.sort(reverse=True)

#ddprint(b)

for k in range(1,n+1):
  mn = 0
  mx = n//k + 1
  while mx > mn+1:
    mid = (mn+mx)//2
    if f(k,mid):
      mn = mid 
    else:
      mx = mid 
  print(mn)


### FIXED CODE ###

from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split()) 
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def f(k,p):
  return (c[p] >= k*p)

def ff(k,p):
  acc = n 
  for i in range(len(b)):
    if b[i]>p:
      acc -= b[i]-p 
    else:
      break
  return (acc >= k*p)

n = inn()
a = inl()
h = {}
for x in a:
  if x in h:
    h[x] += 1
  else:
    h[x] = 1
b = []
for x in h:
  b.append(h[x])
b.sort(reverse=True)

#ddprint(b)

c = [0]*(n+1)
for p in range(1,n+1):
  acc = n 
  for i in range(len(b)):
    if b[i]>p:
      acc -= b[i]-p 
    else:
      break
  c[p] = acc


for k in range(1,n+1):
  mn = 0
  mx = n//k + 1
  while mx > mn+1:
    mid = (mn+mx)//2
    if f(k,mid):
      mn = mid 
    else:
      mx = mid 
  print(mn)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
q=int(input())
for i in range(q):
    b,c=map(int,input().split())
    for l in range(n):
        if a[l]==b:
            a[l]=c
    print(sum(a))
            

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
q=int(input())
ans=sum(a)
L=[0]*(10**5+1)
for i in range(n):
    L[a[i]]+=1
for i in range(q):
    b,c=map(int,input().split())
    num=L[b]
    L[b]=0
    L[c]+=num
    ans-=num*b
    ans+=num*c
    print(ans)
### BUGGY CODE ###

import math
Q = int(input())
num_ranges = [list(map(int, input().split())) for _ in range(Q)]

primes = [2]


def is_prime(num):
    # 今まででた素数で割っていくと、自身が素数かどうかわかる
    if num == 1:
        return False
    if primes[-1] <= math.ceil(math.sqrt(num)):
        for i in range(primes[-1], math.ceil(math.sqrt(num)) + 1):
            is_prime = True
            # 今まででた素数で割っていくと、自身が素数かどうかわかる
            for p in primes:
                if i % p == 0:
                    is_prime = False
            if is_prime:
                primes.append(i)
    for p in primes:
        # 全てprimesを見るのは時間が勿体無いので、自身よりも大きいもの・もしくは同じになったら抜ける.
        # もし素数でないのであれば、p<nの間にあるはず。ない状態で、同じ数値まで来た場合も素数
        if num <= p:
            return True
        if num % p == 0:
            return False
    return True


def check(num):
    if is_prime(num) and is_prime((num + 1) / 2):
        return True
    else:
        return False


for start, end in num_ranges:
    count = 0
    for i in range(start, end + 1):
        if i % 2 == 0:
            continue
        if check(i):
            # print(i)
            count += 1
    print(count)


### FIXED CODE ###

from itertools import accumulate
INF = float('inf')


def prime_numbers(n):
    if n < 2:
        return []

    m = (n + 1) // 2
    p = [True] * m
    for i in range(1, int((n ** 0.5 - 1) / 2) + 1):
        if p[i]:
            for j in range(2 * i * (i + 1), m, 2 * i + 1):
                p[j] = False

    a = [2 * i + 1 for i in range(m) if p[i]]
    a[0] = 2
    return a


N = 10 ** 5
P = set(prime_numbers(N))
# これが素数
# print(P)
P = [n for n in P if (n + 1) // 2 in P]
# 自身 + 1 //2 も素数であるもののみに絞る
# print(P)
a = [0] * (N + 1)
for n in P:
    # likenumberは1にする
    a[n] = 1
# 累積和に変換
a = list(accumulate(a))


Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    print(a[r] - a[l - 1])
### BUGGY CODE ###

n,a,b=map(int, input().split())
s=list(input())
num=0
s_b=[i for i,x in enumerate(s) if x=='b']
for i in range(n):
  if num<a+b:
    if s[i]=='c':
      print('No')
    elif s[i]=='a':
      num+=1
      print('Yes')     
    else:
      if s_b.index(i)<b:
        num+=1
        print('Yes')
      else:
        print('No')   
  else:
    print('No')

### FIXED CODE ###

n,a,b=map(int, input().split())
s=list(input())
num=0
num_f=0
qual=[]
for i in range(n):
  if num<a+b:
    if s[i]=='a':
      num+=1
      qual.append('Yes')     
    elif s[i]=='b' and num_f<b:
      num+=1
      num_f+=1
      qual.append('Yes')
    else:
      qual.append('No')   
  else:
    qual.append('No')
for i in range(n):
  print(qual[i])
### BUGGY CODE ###

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


### FIXED CODE ###

n=int(input())
a = list(map(int,input().split()))
c=[0]*n
for i in a:
    c[i-1]+=1
for j in c:
    print(j)