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

from heapq import heappop,heappush
l = []
r = []
Q = int(input())
ans = 0
l_s = 0
r_s = 0
_,m,b = map(int,input().split())
ans += b
n = 0
for i in range(1,Q):
    s = input()
    if s != '2':
        _,a,b = map(int,s.split())
        ans += b
        if n == 0:
            c,d = sorted([m,a])
            heappush(l,-c)
            heappush(r,d)
            l_s += c
            r_s += d
            m1 = c
        else:
            c,d = heappop(l),heappop(r)
            l_s += c
            r_s -= d
            c = -c
            if n%2 == 1:
                c,m,d = sorted([a,c,d])
                heappush(l,-c)
                heappush(r,d)
                l_s += c
                r_s += d
            else:
                c,m1,m2,d = sorted([m,a,c,d])
                heappush(l,-c)
                heappush(l,-m1)
                heappush(r,d)
                heappush(r,m2)
                l_s += c
                r_s += d
                l_s += m1
                r_s += m2
        n += 1
    else:
        if n == 0:
            print('{} {}'.format(m,ans))
        elif n == 1:
            print('{} {}'.format(m1,r_s-l_s+ans))
        elif n%2 == 0:
            print('{} {}'.format(m,r_s-l_s+ans))
        else:
            print('{} {}'.format(m1,r_s-l_s+ans))

### FIXED CODE ###

from heapq import heappop,heappush
l = []
r = []
Q = int(input())
ans = 0
l_s = 0
r_s = 0
_,m,b = map(int,input().split())
ans += b
n = 0
for i in range(1,Q):
    s = input()
    if s != '2':
        _,a,b = map(int,s.split())
        ans += b
        if n == 0:
            c,d = sorted([m,a])
            heappush(l,-c)
            heappush(r,d)
            l_s += c
            r_s += d
            m1 = c
        else:
            c,d = heappop(l),heappop(r)
            l_s += c
            r_s -= d
            c = -c
            if n%2 == 1:
                c,m,d = sorted([a,c,d])
                heappush(l,-c)
                heappush(r,d)
                l_s += c
                r_s += d
            else:
                c,m1,m2,d = sorted([m,a,c,d])
                heappush(l,-c)
                heappush(l,-m1)
                heappush(r,d)
                heappush(r,m2)
                l_s += c
                r_s += d
                l_s += m1
                r_s += m2
        n += 1
    else:
        if n == 0:
            print('{} {}'.format(m,ans))
        elif n == 1:
            print('{} {}'.format(m1,r_s-l_s+ans))
        elif n%2 == 0:
            print('{} {}'.format(m,r_s-l_s+ans))
        else:
            print('{} {}'.format(m1,r_s-l_s+ans))
### BUGGY CODE ###

int_n = int(input())
ar_int_a = list(map(int, input().split()))

st_int_group = set(ar_int_a)
max_count = 0

for i in st_int_group:
    current = ar_int_a.count(i) + ar_int_a.count(i - 1) + ar_int_a.count(i + 1)
    max_count = current if max_count <= current else max_count

print(max_count)





### FIXED CODE ###

from collections import defaultdict

int_n = int(input())
ar_int_a = list(map(int, input().split()))

d_cnt = defaultdict(int)
for w in ar_int_a:
    d_cnt[w] += 1


st_int_group = set(ar_int_a)
max_count = 0

for i in st_int_group:
    max_count = max(d_cnt[i] + d_cnt[i - 1] + d_cnt[i + 1], max_count)

print(max_count)
### BUGGY CODE ###

from functools import lru_cache
N,W=map(int,input().split())
weights,profits = [0]*N, [0]*N
for i in range(N):
    weights[i],profits[i] = map(int,input().split())

@lru_cache(None)
def knapsack_recursive(capacity, currentIndex):
    if capacity <= 0 or currentIndex >= len(profits): return 0
    profit = 0
    if weights[currentIndex] <= capacity:
        profit = profits[currentIndex] + knapsack_recursive(capacity - weights[currentIndex], currentIndex + 1)
    tmp = knapsack_recursive(capacity, currentIndex + 1)
    if tmp > profit:
        profit = tmp  
    return profit
  
def main():
    res = knapsack_recursive(W, 0)
    print(res)
if __name__ == "__main__":
	main()

### FIXED CODE ###

def main():
  n, w = [int(e) for e in input().split()]
  t = [-1 for i in range(w + 1)]
  t[w] = 0
  for _ in range(n):
    nw, nv = [int(e) for e in input().split()]
    for i in range(nw, w + 1):
      if t[i] == -1:
        continue
      if t[i - nw] < t[i] + nv:
        t[i - nw] = t[i] + nv
  print(max(t))
main()
### BUGGY CODE ###

s = input()
q = s.count("?")
# 先頭i文字で数えられるもののうちあまりがjであるものの数
dp = [[0 for _ in range(13)] for _ in range(len(s))]

for i, v in enumerate(s):
    if i == 0:
        if v == '?':
            for j in range(10):
                dp[0][j] += 1
        else:
            dp[0][int(v)] += 1
    else:
        if v == '?':
            for j in range(13):
                if dp[i-1][j] > 0:
                    for k in range(10):
                        dp[i][(10 * j + k) % 13] += dp[i-1][j]
                dp[i][j] = dp[i][j] % 1000000007
        else:
            for j in range(13):
                if dp[i-1][j] > 0:
                    dp[i][(10 * j + int(v)) % 13] += dp[i - 1][j]
                dp[i][j] = dp[i][j] % 1000000007

print(dp[len(s)-1][5] % 1000000007)

### FIXED CODE ###

s = input()
q = s.count("?")
ans = [0] * 13
ans[0] = 1

for v in s:
    dp = [0] * 13
    for j in range(13):
        dp[(j * 10) % 13] = ans[j] % 1000000007
    dp += dp
    for j in range(13):
        if v == '?':
            ans[j] = sum(dp[j+4:j+14])
        else:
            ans[j] = dp[j - int(v)]

print(ans[5] % 1000000007)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
S=sys.stdin.readline().strip()
N=len(S)
mod=10**9+7

dp=[ [ 0 for j in range(13) ] for i in range(N) ]

for i,x in enumerate(S[::-1]):  #i桁目
    if i==0:
        if x!="?":
            x=int(x)
            dp[i][(x*pow(10,i,13))%13]=1
        else:
            for x in range(10):
                dp[i][(x*pow(10,i,13))%13]=1
    else:
        if x!="?":
            x=int(x)
            for j in range(13):
                dp[i][(x*pow(10,i,13)+j)%13]+=dp[i-1][j]
        else:
            for j in range(13):
                for x in range(10):
                    dp[i][(x*pow(10,i,13)+j)%13]+=dp[i-1][j]
print dp[N-1][5]%mod


### FIXED CODE ###

S=raw_input()
S=S[::-1]
l=len(S)

dp=[ 0 for j in range(13) ]
dp[0]=1

mod=10**9+7

dp2=[ 0 for _ in range(13) ]

keta=1

for i in range(1,l+1):
	dp2=[0]*13
	for j in range(13):
		if dp[j]!=0:
			if S[i-1]=="?":
				for k in range(10):
					next=(k*keta+j)%13 
					dp2[next]+=dp[j]
					dp2[next]%=mod
			else:
				k=int(S[i-1])
				next=(k*keta+j)%13
				dp2[next]+=dp[j]
				dp2[next]%=mod

	dp=dp2
	keta=(keta*10)%13

print dp[5]
### BUGGY CODE ###

n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
for i in range(n,0,-1):
    t=sum([1 for a in ans if a%i==0])
    if t%2!=al[i-1]:
        ac+=1
        ans.add(i)
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))

### FIXED CODE ###

n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
tl=[0]*n
for i in range(n,0,-1):
    if tl[i-1]%2!=al[i-1]:
        ac+=1
        ans.add(i)
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                tl[j-1]+=1
                if j**2==i:
                    continue
                tl[i//j-1]+=1
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))
### BUGGY CODE ###

import sys
input = sys.stdin.readline


def question():
    n, q = list(map(int, input().split()))
    s = input()
    lr = [list(map(int, input().split())) for i in range(q)]
    a = [(s[i]=="A" and s[i+1] =="C") for i in range(n-1)]
    for i in range(q):
        print(sum(a[lr[i][0]-1:lr[i][1]-1]))


question()

### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np
import bisect
left = bisect.bisect_left
right = bisect.bisect_right

def question():
    n, q = list(map(int, input().split()))
    s = input()
    lr = [list(map(int, input().split())) for i in range(q)]
    a = [i for i in range(n-1) if s[i:i+2]=="AC"]

    for i in range(q):
        left_index = left(a, lr[i][0]-1)
        right_index = right(a, lr[i][1]-2)
        print(right_index - left_index)

question()
### BUGGY CODE ###

l,r = map(int,input().split())
ans = int(2018)
for i in range(l,r):
    for j in range(l+1,r+1):
        if((i*j)%2019 < ans):
            ans = (i*j)%2019
print(ans)

### FIXED CODE ###

import sys
l,r = map(int,input().split())
ans = int(2018)
if(r-l > 2020):
    print(0)
    sys.exit()
else:
    for i in range(l,r):
        for j in range(l+1,r+1):
            if((i*j)%2019 < ans):
                ans = (i*j)%2019
print(ans)
### BUGGY CODE ###

import bisect
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''

def main():
	N, Q = map(int, input().split())
	S, T, X = [0] * N, [0] * N, [0] * N
	
	for i in range(N):
		S[i], T[i], X[i] = map(int, input().split())
		
	D = [int(input()) for _ in range(Q)]
	
	event = [] #工事と人を１つのリストで管理: (時間, 出来事の種類, [工事の位置])
	#出来事の種類: (0: 工事の終了、1: 工事の開始、2: 人)
	working = [] #現在行われている工事のリスト
	n = 0 #現在行われている工事の数
	
	for i in range(Q):
		event.append((D[i], 2))
		
	for i in range(N):
		bisect.insort(event, (S[i] - X[i] - 0.5, 1, X[i]))
		bisect.insort(event, (T[i] - X[i] - 0.5, 0, X[i]))
		
	for l in event:
		if l[1] == 1:
			bisect.insort(working, l[2])
			n += 1
		elif l[1] == 0:
			del working[bisect.bisect(working, l[2]) - 1]
			n -= 1
		else:
			if n > 0:
				print(working[0])
			else:
				print(-1)
				
main()

### FIXED CODE ###

import bisect
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''

N, Q = map(int, input().split())
S, T, X = [0] * N, [0] * N, [0] * N
work = []

for i in range(N):
	S[i], T[i], X[i] = map(int, input().split())
	work.append((X[i], S[i] - X[i], T[i] - X[i]))

D = [int(input()) for _ in range(Q)]

work.sort()
ans = [-1] * Q
skip = [-1] * Q

for i in range(N):
	left = bisect.bisect_left(D, work[i][1])
	right = bisect.bisect_left(D, work[i][2])
	
	while left < right:
		if skip[left] == -1:
			skip[left] = right
			ans[left] = work[i][0]
			left += 1
		else:
			left = skip[left]					
		
for i in ans:
	print(i)
### BUGGY CODE ###

def main():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    c = list(map(int, input().split()))

    ans = -float('inf')
    for i in range(n):
        start, count = i, 1
        val = c[start]
        while p[start]-1 != i:
            start = p[start]-1
            count += 1
            val += c[start]

        start = i
        if val > 0:
            a = (k//count-1)*val
            if a > ans:
                ans = a
            num = k%count+count
        else:
            a = 0
            num = min(k, count)

        for j in range(num):
            start = p[start]-1
            a += c[start]
            if a > ans:
                ans = a
    print(ans)

main()


### FIXED CODE ###

from numba import jit
@jit
def main():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    c = list(map(int, input().split()))
    ans = -10**10
    
    for i in range(n):
        start, count = i, 1
        val = c[start]
        while p[start]-1 != i:
            start = p[start]-1
            count += 1
            val += c[start]

        start = i
        if val > 0:
            a = (k//count-1)*val
            ans = max(a, ans)
            num = k%count+count
        else:
            a = 0
            num = min(k, count)

        for _ in range(num):
            start = p[start]-1
            a += c[start]
            ans = max(a, ans)
    print(int(ans))

main()
### BUGGY CODE ###

n = int(input())
A = list(map(int,input().split()))
q = int(input())
ansList = [0]*q

for i in range(q):
    b,c = map(int,input().split())
    for j in range(n):
        if A[j] == b:
            A[j] = c
    ansList[i]  = sum(A)


[print(ans) for ans in ansList]

### FIXED CODE ###

from collections import Counter
n = int(input())
A = list(input().split())
q = int(input())
ansList = [0]*q
d = Counter(A)
Sum = sum(map(int,A))

for i in range(q):
    b,c = input().split()
    Sum = Sum - int(b)*d[b] + int(c)*d[b]
    if b in d:
        if c in d:
            d[c] += d.pop(b)
        else:
            d[c] = d.pop(b)
    ansList[i]  +=  Sum

[print(ans) for ans in ansList]
### BUGGY CODE ###

def main():
    n,m = map(int,input().split())
    l = [list(map(int,input().split())) for i in range(n)]
    ans = [0]*(m)

    l.sort(key = lambda x: x[1],reverse=True)

    for i in range(n):
        a,b = l[i]
        
        for j in range(a-1,m):
            if ans[j] == 0:
                ans[j] = b
                break
    print(sum(ans))


main()

### FIXED CODE ###

def main():
    import heapq
    n,m = map(int,input().split())
    l = [list(map(int,input().split())) for i in range(n)]
    l.sort()
    q = []
    ans = 0
    now = 0
    for i in range(1,m+1):
        for j in range(now,n):
            if l[j][0] <= i:
                heapq.heappush(q,-l[j][1])
                now = j+1 
            else:
                now = j
                break
        if q:
            ans -= heapq.heappop(q)
       
    print(ans)

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


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

town_loop = [1]

for i in range(k):
    next_town = alist[town_loop[i]-1]

    try:
        loop_start = town_loop.index(next_town)
        break
    except ValueError:
        town_loop.append(next_town)

if len(town_loop) == k+1:
    print(town_loop[k])
else:
    o = len(town_loop) - loop_start
    print(town_loop[((k-loop_start) % o) + loop_start])


### FIXED CODE ###


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

town_loop = [1]
used = [-1] * n

for i in range(k):
    next_town = alist[town_loop[i]-1]

    if used[next_town-1] == -1:
        town_loop.append(next_town)
        used[next_town-1] = 1
    else:
        break

loop_start = town_loop.index(next_town)
if len(town_loop) == k+1:
    print(town_loop[k])
else:
    o = len(town_loop) - loop_start
    print(town_loop[((k-loop_start) % o) + loop_start])
### BUGGY CODE ###

n=int(input())
 
ans=0
for i in range(1,n+1):
       if i%10==0:
              continue
       for j in range(1,n+1):
              if str(i)[0]==str(j)[-1] and str(i)[-1]==str(j)[0]:
                     ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
ans=0
dic={}
for i in range(1,n+1):
    s=str(i)
    d=(s[0],s[-1])
    if d not in dic.keys():
        dic[d] = 1
    else:
        dic[d] += 1
 
for a in dic.keys():
    b = (a[1],a[0])
    if b in dic.keys():
        ans += dic[a]*dic[(a[1],a[0])]
 
print(ans)
### BUGGY CODE ###

n = int(input())
s = input()
seq = list(set(list(s)))
genkai_list = []
for i in range(0,1000):
    if 0 <= i <= 9:
        ap = "00" + str(i)
        genkai_list.append(ap)
    elif 10 <= i <= 99:
        ap = "0" + str(i)
        genkai_list.append(ap)
    else:
        genkai_list.append(str(i))
avcodelist = genkai_list
ans = []
for a in range(len(genkai_list)):
    for i in range(len(s)):
        if s[i] == avcodelist[a][0]:
            for j in range(i + 1, len(s)):
                if s[j] == avcodelist[a][1]:
                    for k in range(j + 1, len(s)):
                        if s[k] == avcodelist[a][2]:
                            ans.append((avcodelist[a][0], avcodelist[a][1], avcodelist[a][2]))
print(len(set(ans)))

### FIXED CODE ###

n = int(input())
s = list(input())
genkai_list = []
for i in range(0,1000):
    if 0 <= i <= 9:
        ap = "00" + str(i)
        genkai_list.append(ap)
    elif 10 <= i <= 99:
        ap = "0" + str(i)
        genkai_list.append(ap)
    else:
        genkai_list.append(str(i))
count = 0
for a in genkai_list:
    try:
        s_ = s[s.index(a[0])+1:]
        s__ = s_[s_.index(a[1])+1:]
        if a[2] in s__:
            count += 1
    except:
        continue
print(count)
### BUGGY CODE ###

N = int(input())
a = []
for i in range(N):
    num = int(input())
    if(num not in a):
        a.append(num)
    else:
        a.remove(num)
print(len(a))

### FIXED CODE ###

N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
A = sorted(A)
cnt = 1
ans = 0

for i in range(N-1):
    if(A[i] == A[i+1]):
        cnt += 1
        continue
    ans += cnt % 2
    cnt = 1

if(cnt % 2 == 1):
    ans += 1

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

N = int(raw_input())
A = map(int, raw_input().split())
A = map(lambda x: format(x, '060b'), A)
MOD = 10**9 + 7

count = dict()
for i in range(60):
    zeros = len([a[i] for a in A if a[i] == '0'])
    ones = N - zeros
    count[i] = zeros*ones

mod_val = dict()
curr = 1
for i in range(60):
    mod_val[i] = curr % MOD
    curr = (2*curr) % MOD

ans = 0
for i in count:
    ans = (ans + count[i]*mod_val[59-i]) % MOD

print ans


### FIXED CODE ###

import numpy as np

N = int(raw_input())
A = np.array(map(int, raw_input().split()))
# A = map(lambda x: format(x, '060b'), A)
MOD = 10**9 + 7

count = dict()
for i in range(60):
    # zeros = len([a[i] for a in A if a[i] == '0'])
    zeros = np.count_nonzero((A>>i)&1)
    ones = N - zeros
    count[i] = zeros*ones

mod_val = dict()
curr = 1
for i in range(60):
    mod_val[i] = curr % MOD
    curr = (2*curr) % MOD

ans = 0
for i in count:
    ans = (ans + count[i]*mod_val[i]) % MOD

print ans
### BUGGY CODE ###

N = int(input())

for h in range(1, 3501):

    for n in range(1, 3501):

        if (4*h*n - N*n - N*h) ==0:
            continue

        w = N*h*n/(4*h*n - N*n - N*h)
        flag = w.is_integer()
        # print(flag)
        
        if flag and w>0:
            print(h, n, int(w))
            exit()

### FIXED CODE ###

N = int(input())

for h in range(1, 3501):

    for n in range(1, 3501):

        if (4*h*n - N*n - N*h)<=0:
            continue

        w = N*h*n/(4*h*n - N*n - N*h)
        flag = w.is_integer()
        # print(flag)
        
        if flag and w>0:
            print(h, n, int(w))
            exit()
### BUGGY CODE ###

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


### FIXED CODE ###

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

n = int(input())
aaa = list(map(int, input().split()))
dp = [[[0, 0] for _ in range(n + 1)] for _ in range(n + 1)]
for w in range(1, n + 1):
    for l in range(n - w + 1):
        r = l + w
        # take left
        dpl = dp[l + 1][r]
        tl_x = aaa[l] + dpl[1]
        tl_y = dpl[0]
        tl_score = tl_x - tl_y
        # take_right
        dpr = dp[l][r - 1]
        tr_x = aaa[r - 1] + dpr[1]
        tr_y = dpr[0]
        tr_score = tr_x - tr_y
        dpc = dp[l][r]
        if tl_score > tr_score:
            dpc[0] = tl_x
            dpc[1] = tl_y
        else:
            dpc[0] = tr_x
            dpc[1] = tr_y
print(dp[0][n][0] - dp[0][n][1])


### FIXED CODE ###

n = int(input())
aaa = list(map(int, input().split()))
dp = [[0] * (n + 1) for _ in range(n + 1)]
for w in range(1, n + 1):
    for l in range(n - w + 1):
        r = l + w
        dpl = -dp[l + 1][r] + aaa[l]
        dpr = -dp[l][r - 1] + aaa[r - 1]
        dp[l][r] = max(dpl, dpr)
print(dp[0][n])
### BUGGY CODE ###

import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
N, K = map(int, input().split())
mod = 10 ** 9 + 7
h = 1
t = set()
while h * h <= N:
  t.add(N // h)
  t.add(h)
  h += 1
t = sorted(t)
#print(t)
tt = []
for x in t:
  tt.append(N // x)

dp = [[0] * len(t) for _ in range(K + 1)]
dp[0][0] = 1
for i in range(K):
  for j in range(len(t)):
    k = bl(t, tt[j])
    dp[i + 1][k] += dp[i][j]
    dp[i + 1][k] %= mod
  #print(dp)
  for k in range(len(t) - 1, 0, -1):
    dp[i + 1][k - 1] += dp[i + 1][k]
    dp[i + 1][k - 1] %= mod
  for k in range(1, len(t)):
    rng = (t[k] - t[k - 1]) % mod
    dp[i + 1][k] *= rng
    dp[i + 1][k] %= mod
  #print(dp)
res = 0
#print(dp)
for j in range(len(t)):
  res += dp[-1][j]
  res %= mod
print(res)

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, K = map(int, input().split())
mod = 10 ** 9 + 7
h = 1
t = set()
while h * h <= N:
  t.add(N // h)
  t.add(h)
  h += 1
t = sorted(t)
#print(len(t))
tt = []
for x in t:
  tt.append(N // x)

dp = [[0] * len(t) for _ in range(K + 1)]
dp[0][0] = 1
for i in range(K):
  for j in range(len(t)):
    k = len(t) - j - 1
    dp[i + 1][k] += dp[i][j]
    dp[i + 1][k] %= mod
  #print(dp)
  for k in range(len(t) - 1, 0, -1):
    dp[i + 1][k - 1] += dp[i + 1][k]
    dp[i + 1][k - 1] %= mod
    rng = (t[k] - t[k - 1]) % mod
    dp[i + 1][k] *= rng
    dp[i + 1][k] %= mod

  #print(dp)
res = 0
#print(dp)
for j in range(len(t)):
  res += dp[-1][j]
  res %= mod
print(res)
### BUGGY CODE ###

if __name__ == '__main__':
    N = int(input())
    S = input()
    cnt = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            for k in range(j+1, N):
                if (S[i] != S[j] and S[i] != S[k] and S[j] != S[k]) and j - i != k - j:
                    cnt += 1
    print(cnt)

### FIXED CODE ###

from collections import Counter

def get_k(i, j):
    return 2*j - i

if __name__ == '__main__':
    N = int(input())
    S = input()
    C = Counter(S) 
    eq_cnt = 0
    cnt = C['R'] * C['G'] * C['B']
    for i in range(N):
        for j in range(i+1, N):
            k = get_k(i, j)
            if k >= N: continue
            if (S[i] != S[j] and S[i] != S[k] and S[j] != S[k]):
                eq_cnt += 1
    print(cnt - eq_cnt)
### BUGGY CODE ###

import collections
from collections import deque

def tree(s):
    flag=True
    INF=-10**9
    dis = [INF for i in range(n)]
    dis[s]=0
    def bfs():
        d = deque()
        d.append(s)
        while len(d):
            x = d.popleft()
            for i,j in vec[x]:
                if dis[i] == INF:
                    dis[i]=dis[x]+j
                    d.append(i)
                else:
                    if dis[i]==dis[x]+j:
                        continue
                    else:
                        print('No')
                        exit()
        return flag
    return bfs()


n,m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(m)]
vec= [[] for i in range(n)]

for i in range(m):
    vec[a[i][0]-1].append((a[i][1]-1,a[i][2]))
    vec[a[i][1]-1].append((a[i][0]-1,-a[i][2]))

INF=float('inf')
visited=[INF]*n

for i in range(n):
    if visited[i]==INF:
        if tree(i):
            continue
print('Yes')

### FIXED CODE ###

import collections
from collections import deque

def Dfs(now):
    flag = True
    d = deque()
    d.append(now)
    visited[now]=0
    while len(d):
        now = d.pop()
        for i,j in vec[now]:
            if visited[i]==INF:
                d.append(i)
                visited[i]=visited[now]+j
            else:
                if visited[i]==visited[now]+j:
                    continue
                else:
                    flag=False
                    break
    return flag


n,m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(m)]
vec= [[] for i in range(n)]

for i in range(m):
    vec[a[i][0]-1].append((a[i][1]-1,a[i][2]))
    vec[a[i][1]-1].append((a[i][0]-1,-a[i][2]))

INF=float('inf')
visited=[INF]*n

for i in range(n):
    if visited[i]==INF:
        if not Dfs(i):
            print('No')
            exit()
print('Yes')
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from collections import Counter

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

for i in range(1,n+1):
    print(a.count(i))

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import Counter

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

"""
for i in range(1,n+1):
    print(a.count(i))
"""

S = Counter(a)

for i in range(1,n+1):
    print(S[i])