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

n = int(input())
h = list(map(int,input().split()))
a = 0
b = 0
x = [0]*n

def sakana(p, q):
    for i in range(n-1):
        if p[i]>p[i+1] and q[i]==0:
            p[i]=p[i]-1
            q[i]=1

if n==1:
    print("Yes")
else:
    while b<100000:
        sakana(h, x)
        b = b+1

    for j in range(n-1):
        if h[j]>h[j+1]:
            print("No")
            break
        a = a+1
    if a==n-1:
        print("Yes")

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
a = 0
b = 0
x = [0]*n

if n==1:
    print("Yes")
else:
    for i in range(n-1):
        if h[i]>h[i+1]:
            h[i]=h[i]-1
            x[i]=1

    for k in range(n-1):
        if h[n-k-1]<h[n-k-2] and x[n-k-2]==0:
            h[n-k-2]=h[n-k-2]-1


    for j in range(n-1):
        if h[j]>h[j+1]:
            print("No")
            break
        a = a+1
    if a==n-1:
        print("Yes")
### BUGGY CODE ###

import numpy as np
from numpy.linalg import solve
N=int(input())
a=list(map(int, input().split()))
for i in range(N):
  a[i]=a[i]*2
X=[[0 for j in range(N)] for i in range(N)]
for i in range(N-1):
    X[i][i]=1
    X[i][i+1]=1
X[N-1][0]=1
X[N-1][N-1]=1
a=np.array(a)
X=np.array(X)
b=solve(X,a)
for i in range(N):
  print(int(b[i]), end=" ")
    

### FIXED CODE ###

N=int(input())
a=list(map(int, input().split()))
for i in range(N):
    a[i]=a[i]*2
b=[0 for i in range(N)]
sum1=0
for i in range(N-1):
    if i%2==0:
        sum1+=a[i]
    else:
        sum1+=a[i]*(-1)
ans=(sum1+a[N-1])/2
b[0]=ans
for i in range(N-1):
    b[i+1]=a[i]-b[i]
for i in range(N):
    print(int(b[i]), end=" ")
### BUGGY CODE ###

import math
import copy
N = int(input())
ans = 1
for i in range(2, N // 2 + 1):
    n = copy.deepcopy(N)
    while n >= i:
        if (n % i == 0):
            n = n // i
        else:
            n = n % i
        if n == 1:
            ans += 1
if N // 2 + 1 < N - 1:
    ans += 1
print(ans)


### FIXED CODE ###

import math
import copy
def prime_factorize(n):
    a = [n]
    for i in range(2, math.floor(n ** 0.5) + 1):
        if n % i == 0:
            a.append(i)
            if n // i != i:
                a.append(n // i)
    return a

N = int(input())
prime_n = prime_factorize(N)
prime_n_1 = prime_factorize(N - 1)

ans = 0
for i in prime_n:
    n = copy.deepcopy(N)
    while (n % i) == 0:
            n = n // i
    if (n % i) == 1:
        ans += 1
ans += len(prime_n_1)
if N > 2:
    print(ans)
else:
    print(1)
### BUGGY CODE ###

from scipy.sparse.csgraph import shortest_path
import sys
import numpy as np
def input():
    return sys.stdin.readline().strip()
 
N = int(input())
 
graph = [[0 for i in range(N)] for j in range(N)]
 
for i in range(N-1):
    a,b,c = map(int,input().split())
    graph[a-1][b-1] = c
    graph[b-1][a-1] = c

Q,K = map(int,input().split())
dist = shortest_path(np.array(graph),indices=K-1)

for i in range(Q):
    x,y = map(int,input().split())
    print(int(dist[x-1]+dist[y-1]))


### FIXED CODE ###

import heapq

"""
https://juppy.hatenablog.com/entry/2019/02/18/%E8%9F%BB%E6%9C%AC_python_%E3%83%97%E3%83%A9%E3%82%A4%E3%82%AA%E3%83%AA%E3%83%86%E3%82%A3%E3%82%AD%E3%83%A5%E3%83%BC%28heapq%29%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%83%97%E3%83%AA%E3%83%A0%E6%B3%95
"""

def dijkstra_heap(s,edge):
    #始点sから各頂点への最短距離
    d = [10**10]*n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d
 
################################
N = int(input())
n = N
w = N
 
edge = tuple([] for i in range(n))
#edge[i] : iから出る道の[重み,行先]の配列
for i in range(w-1):
    a,b,c = map(int,input().split())
    edge[a-1].append([c,b-1])
    edge[b-1].append([c,a-1])


Q,K = map(int,input().split())
dist = dijkstra_heap(K-1,edge)
 
for i in range(Q):
    x,y = map(int,input().split())
    print(int(dist[x-1]+dist[y-1]))
### BUGGY CODE ###

import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())

def gcd(A, B):
    if B > A:
        return gcd(B, A)
    while B != 0:
        A, B = B, A - B
    return A

def test_gcd():
    assert gcd(8, 4) == 4


A, B, K = tuple(li())
count = 0
g = gcd(A, B)
for num in range(g, 0, -1):
    if A % num == 0 and B % num == 0:
        count += 1
        if count == K:
            print(num)
            break



### FIXED CODE ###

import sys
stdin = sys.stdin
from math import sqrt

def li(): return map(int, stdin.readline().split())




A, B, K = tuple(li())
count = 0
g = min(A, B)
can = []
cnt = 0
for i in range(1, g + 1):
    if A % i == 0 and B % i == 0:
        
        
        can.append(i)



print(can[-K])
### BUGGY CODE ###

import heapq
def SME(Whole,start,end,L,ANS):
    A = []
    if end > N : end = N
    count = 0
    count2 = 0
    for i,x in enumerate(Whole[start:end]):
        heapq.heappush(A,[x,i])
    for j in range(start,end):
        a = heapq.heappop(A)
        tmp = count
        for i in range(L):
            idx = a[1] + i
            try :
                if ANS[idx] == 0 and idx < end:
                    ANS[idx] = a[0]
                    count += 1
            except IndexError : continue
        if count == tmp : count2 += 1
        if count2 > 400 : break
    for i in range(L):
        if ANS[i] == 0 : ANS[i] = min(Whole[:i+1])
    for i in range(L,N):
        if ANS[i] == 0 : ANS[i] = min(Whole[i+1-L:i+1])
    return ANS

[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ANS = [0]*N
start = 0
K = L * int(N ** 0.3 + 2 )
if K > N : K = N
end = K
while (end <= N):
    ANS = SME(A, start, end, L, ANS)
    start = end
    end += K 
for i in ANS[L-1:-1]:print(i, end=" ")
print(ANS[-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
### BUGGY CODE ###

from collections import Counter
from itertools import combinations
N = int(input())
S = input()
MOD = 10**9 + 7

C = Counter(S)
ans = 0
for i in range(1, N+1):
    for prod in combinations(C.values(), i):
        a = 1
        for p in prod:
            a *= p
            a %= MOD
        ans += a
        ans %= MOD

print(ans)     


### FIXED CODE ###

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


prod = 1
for char in set(s):
    num = s.count(char)
    prod *= (num + 1)

print((prod - 1) % (pow(10, 9) + 7))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)

#=====================================
class Tree():
  def __init__(self):
    self.root = None
    self.children = set()
    self.counter = 0

  def add_child(self, child):
    self.children.add(child)
  
  def reconstruct(self, root=None):
    if root in self.children:
      self.root = root
      self.children.remove(root)
    for child in self.children:
      child.reconstruct(self)
  
  def add_count(self, x):
    self.counter += x

  def recalc_count(self):
    if self.root:
      self.counter += self.root.counter
    for child in self.children:
      child.recalc_count()

#=====================================
def solve():
  n,q = [int(i) for i in input().split()]
  trees = [Tree() for i in range(n)]

  for _ in range(n-1):
    a,b = [int(i) for i in input().split()]
    trees[a-1].add_child(trees[b-1])
    trees[b-1].add_child(trees[a-1])

  trees[0].reconstruct()

  for _ in range(q):
    p,x = [int(i) for i in input().split()]
    trees[p-1].add_count(x)

  trees[0].recalc_count()
  
  print(*[trees[i].counter for i in range(n)])

#=====================================
if __name__ == '__main__':
  solve()

### FIXED CODE ###

N, Q = map(int, input().split())
graph = [[] for i in range(200010)]
ans = [0 for i in range(200010)]
import sys
#sys.setrecursionlimit(100000)
sys.setrecursionlimit(10**7)
#
readline = sys.stdin.readline


for _ in range(N - 1):
    #a, b = map(int, input().split())
    a, b = map(int, readline().split())
    a -= 1
    b -= 1

    graph[a].append(b)
    graph[b].append(a)

for _ in range(Q):
    #p, x = map(int, input().split())
    p, x = map(int, readline().split())
    p -= 1

    ans[p] += x

def dfs(node, frm=-1):
    for to in graph[node]:
        if to == frm:
            continue
        ans[to] += ans[node]
        dfs(to, node)
dfs(0)

print(*ans[:N])
### BUGGY CODE ###

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

pn_cn = []
pn_cn_dict = {}


for _ in range(m):
    pn, cn = map(int, input().split())
    cities = pn_cn_dict.get(pn)
    if cities is None:
        cities = [cn]
    else:
        cities.append(cn)
    pn_cn_dict[pn] = cities
    pn_cn.append((pn, cn))

for k in pn_cn_dict:
    c = pn_cn_dict[k]
    c = sorted(c)
    pn_cn_dict[k] = c

for pn, cn in pn_cn:
    ci = pn_cn_dict[pn].index(cn) + 1
    print("{:06}{:06}".format(pn, ci))




### FIXED CODE ###

import bisect

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

pn_cn = []
pn_cn_dict = {}


for _ in range(m):
    pn, cn = map(int, input().split())
    cities = pn_cn_dict.get(pn)
    if cities is None:
        cities = [cn]
    else:
        cities.append(cn)
    pn_cn_dict[pn] = cities
    pn_cn.append((pn, cn))

for k in pn_cn_dict:
    c = pn_cn_dict[k]
    c = sorted(c)
    pn_cn_dict[k] = c

for pn, cn in pn_cn:
    ci = bisect.bisect(pn_cn_dict[pn], cn)
    print("{:06}{:06}".format(pn, ci))
### BUGGY CODE ###

n, m = map(int, input().split())
des = []
first = []
second = []
a = 1
for i in range(0, m):
	b = (list(map(int, input().split())))
	if b[0] == 1:
		first.append(b[1])
		if b[1] in second:
			print('POSSIBLE')
			a = 0
			break
	if b[1] == n:
		second.append(b[0])
		if b[0] in first:
			print('POSSIBLE')
			a = 0
			break
		
if a:
	print('IMPOSSIBLE')

### FIXED CODE ###

n, m = map(int, input().split())
des= [0]*(n+1)
a = 1
for i in range(0, m):
	b = (list(map(int, input().split())))
	if b[0] == 1:
		des[b[1]] += 1
		if des[b[1]] == 2:
			print('POSSIBLE')
			a = 0
			break
	if b[1] == n:
		des[b[0]] += 1
		if des[b[0]] == 2:
			print('POSSIBLE')
			a = 0
			break
		
if a:
	print('IMPOSSIBLE')
### BUGGY CODE ###

# youtubeバージョン
import sys
from heapq import *
from bisect import *

input = sys.stdin.readline

def f(n, q):
    xst = []
    for i in range(n):
        s, t, x = map(int, input().split())
        xst.append([x, s - x, t - x])
    xst.sort()

    ds = []
    dis=[]
    ans = [-1] * q
    for i in range(q):
        d = int(input())
        ds.append(d)
        dis.append([d, i])
    ds.sort()
    dis.sort()

    for x, s, t in xst:
        i=bisect_left(ds,s)
        nd=len(ds)
        while i<nd:
            if ds[i]<t:
                ai=dis[i][1]
                ans[ai]=x
                del ds[i]
                del dis[i]
                nd-=1
            else:
                break

    print(*ans,sep="\n")


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


### FIXED CODE ###

import sys
from bisect import *

input = sys.stdin.readline

def f(n, q):
    xst = []
    for i in range(n):
        s, t, x = map(int, input().split())
        xst.append([x, s - x, t - x])
    xst.sort()

    ds = []
    for i in range(q):
        d = int(input())
        ds.append(d)

    ans = [-1] * q
    jump = [-1] * q

    for x, s, t in xst:
        i = bisect_left(ds, s)
        fi = bisect_left(ds, t)
        while i < fi:
            if jump[i] != -1:
                i = jump[i]
            else:
                ans[i] = x
                jump[i] = fi
                i += 1

    print(*ans, sep="\n")

n, q = map(int, input().split())
f(n, q)
### BUGGY CODE ###

import numpy as np

MOD = 10**9 + 7
def solve(n, a, p=60):
    s = np.zeros(p, dtype=int)
    t = np.zeros(p, dtype=int)
    a = a[::-1]
    for i in range(n):
        mask = bin(a[i])[2:].zfill(p)[::-1]
        mask = np.asarray(list(mask), dtype=int)
        s += mask
        t += mask * (i+1-s) + (1-mask) * s
    res = 0
    for j in range(p):
        res += int(t[j]) * (2**j)
    return res % MOD

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

### FIXED CODE ###

MOD = 10**9 + 7
def solve(n, a, p=60):
    res, m = 0, 1
    for i in range(p):
        y = sum(x & m for x in a) // m
        res += y * (n-y) * m
        m *= 2
    return res % MOD

n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))
### BUGGY CODE ###

N, M = map(int,input().split())
lst=[None]*M
for i in range(M):
    p, S=input().split()
    lst[i]=(int(p), S)

#print(N, M, lst)
#count AC
AC_count = 0
WA_count = 0
AC_check={}
for i in range(M-1,-1,-1):
    #print(i)
    if lst[i][1]=='AC':
        AC_check[lst[i][0]-1]=i
#print(AC_check)

AC_count=len(AC_check)

for k, v in AC_check.items():
        #AC_count += 1
        WA_count+=lst[:v].count((k+1, 'WA'))

print(AC_count, WA_count)

### FIXED CODE ###

N, M = map(int,input().split())
lst=[None]*M
for i in range(M):
    p, S=input().split()
    lst[i]=(int(p), S)

stop_set=set()

WA_count=0
AC_count=0
from collections import defaultdict
WA_dict = defaultdict(lambda: 0)

for el in lst:
    if not el[0] in stop_set:
        if el[1]=='AC':
            AC_count+=1
            stop_set.add(el[0])
        else:
            WA_dict[el[0]] +=1
#print(dict(WA_dict))

new_set=set(WA_dict.keys())&stop_set
#print(new_set)
WA_count=sum([WA_dict[i] for i in new_set])
print(AC_count, WA_count)
### BUGGY CODE ###

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

list = []
p = 0

for a in range(1,n+1):
    x = int(a/k)
    y = int((n+a)/k)
    for i in range(x+1,y+1):
            if  (i*k-a+i*k-a) % k ==0:
                p = p + (y-x)
            else:
                pass

print(p)

### FIXED CODE ###

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

list = []
p = 0

for a in range(1,n+1):
    x = int(a/k)
    y = int((n+a)/k)
    if  2*a % k ==0:
        p = p + (y-x)**2
    else:
        pass

print(p)
### BUGGY CODE ###

from collections import deque

n = int(input())
ab = [list(map(int, input().split())) for _ in range(n-1)]

c = [[] for _ in range(n)]
for a, b in ab:
    a, b = a-1, b-1
    c[a].append(b)
    c[b].append(a)

s = 0
for i in range(n):
    if len(c[i]) > s:
        s = i

e = [0] * n
l = [[0] * n for _ in range(n)]
q = deque()
q.append((s, 0))
while q:
    f, v = q.pop()
    e[f] = 1
    j = 1
    for i in c[f]:
        if e[i] == 0:
            if j == v:
                j += 1
            q.appendleft((i, j))
            l[min(f, i)][max(f, i)] = j
            j += 1

ans = []
for a, b in ab:
    a, b = a-1, b-1
    ans.append(l[a][b])

print(max(ans))
for i in ans:
    print(i)

### FIXED CODE ###

def main():
    import sys
    readline = sys.stdin.buffer.readline

    from collections import deque

    n = int(readline())
    ab = [list(map(int, readline().split())) for _ in range(n-1)]

    l = [[] for _ in range(n+1)]
    for a, b in ab:
        l[a].append(b)
        l[b].append(a)

    parents = [-1] * (n+1)
    order = []
    q = deque()
    q.append(1)
    while q:
        c = q.pop()
        order.append(c)
        for i in l[c]:
            if i == parents[c]:
                continue
            parents[i] = c
            q.append(i)
    
    color = [-1] * (n+1)
    for i in order:
        ng = color[i]
        c = 1
        for j in l[i]:
            if j == parents[i]:
                continue
            if c == ng:
                c += 1
            color[j] = c
            c += 1
    
    ans = []
    for a, b in ab:
        if a == parents[b]:
            ans.append(color[b])
        else:
            ans.append(color[a])

    print(max(ans))
    print('\n'.join(list(map(str, ans))))

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

n, q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n - 1)]
px = [list(map(int, input().split())) for _ in range(q)]

from collections import defaultdict
g = defaultdict(list)
for a, b in ab:
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

adder = defaultdict(int)
for p, x in px:
    p -= 1
    adder[p] += x

ans = [float('inf')] * n
ans[0] = adder[0]
qu = [0]

while qu:
    cur = qu.pop()

    for target in g[cur]:
        if ans[target] == float('inf'):
            ans[target] = ans[cur] + adder[target]
            qu.append(target)

for _ans in ans:
    print(_ans)


### FIXED CODE ###

from sys import stdin
from collections import defaultdict

if __name__ == '__main__':
    n, q = map(int, stdin.readline().rstrip().split())
    ab = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n - 1)]
    px = [list(map(int, stdin.readline().rstrip().split())) for _ in range(q)]

    g = defaultdict(list)
    for a, b in ab:
        a -= 1
        b -= 1
        g[a].append(b)
        g[b].append(a)

    adder = defaultdict(int)
    for p, x in px:
        p -= 1
        adder[p] += x

    ans = [float('inf')] * n
    ans[0] = adder[0]
    qu = [0]

    while qu:
        cur = qu.pop()

        for target in g[cur]:
            if ans[target] == float('inf'):
                ans[target] = ans[cur] + adder[target]
                qu.append(target)

    for _ans in ans:
        print(_ans)
### BUGGY CODE ###

n, k = map(int, input().split())
s = list(map(int, input()))
a = []
c = 1
m = 0
for i in range(n):
    if s[i] == c:
        m += 1
    else:
        a.append(m)
        c = 1 - c
        m = 1
a.append(m)
if len(a) % 2 == 0:
    a.append(0)
r = len(a) // 2
if k >= r:
    print(n)
else:
    print(max(sum(a[2*i:2*(i+k)+1]) for i in range(r-k+1)))

### FIXED CODE ###

n, k = map(int, input().split())
s = list(map(int, input()))
x = [0]
if s[0] == 0:
    x.append(0)
for i in range(n-1):
    if s[i] != s[i+1]:
        x.append(i+1)
x.append(n)
if s[n-1] == 0:
    x.append(n)
r = len(x) // 2 - 1
if k >= r:
    print(n)
else:
    print(max(x[2*(i+k)+1]-x[2*i] for i in range(r-k+1)))
### BUGGY CODE ###

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

### FIXED CODE ###

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

N = int(input())
H = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
	now = 0
	for j in range(i, N - 1):
		if H[j] >= H[j + 1]:
			now += 1
		else:
			break
	ans = max(ans, now)
print(ans)


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
ans = 0
now = 0
for i in range(1, N):
	if H[i - 1] >= H[i]:
		now += 1
		ans = max(ans, now)
	else:
		now = 0
print(ans)
### BUGGY CODE ###

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

x = [[] for i in range(n+1)]

for i in range(m):
    x1, y1 = [int(i) for i in input().split()]
    x[x1].append(y1)
    x[y1].append(x1)

ans = [10**10] * n
ans[0] = 0
root = [10**10] * n
root[0] = 0

from collections import deque
q = deque() # FIFOキューの作成
for i in x[1]:
    q.append((1,i))#現在の深さ、次に行ける所
    root[i-1] = 1

while q:
    a,b = q.popleft() #aが現在の位置　bが次に行く所

    if (ans[a-1] + 1) < ans[b-1]:
        root[b-1] = a
    ans[b - 1] = min(ans[a - 1] + 1, ans[b - 1])

    for i in x[b]:
        if ans[i-1] > (ans[a-1]+1):
            q.append((b,i))


for i in ans[1:]:
    if i == 10**10:
        print("No")
        exit()

print("Yes")
for i in root[1:]:
    print(i)


### FIXED CODE ###

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

x = [[] for i in range(n+1)]

for i in range(m):
    x1, y1 = [int(i) for i in input().split()]
    x[x1].append(y1)
    x[y1].append(x1)

ans = [10**10] * n
ans[0] = 0
root = [10**10] * n
root[0] = 0

from collections import deque
q = deque() # FIFOキューの作成
for i in x[1]:
    q.append((1,i))#現在の深さ、次に行ける所
    root[i-1] = 1

while q:
    a,b = q.popleft() #aが現在の位置　bが次に行く所
    #ここを簡略化したい
    if (ans[a-1] + 1) < ans[b-1]:
        root[b-1] = a
        ans[b - 1] = ans[a - 1] + 1
    else:
        continue

    for i in x[b]:
        if ans[i-1] > (ans[a-1]+1):
            q.append((b,i))


for i in ans[1:]:
    if i == 10**10:
        print("No")
        exit()

print("Yes")
[print(i) for i in root[1:]]
### BUGGY CODE ###

n, m, k = list(map(int, input().split()))
ns = list(map(int, input().split()))
ms = list(map(int, input().split()))

nss = [sum(ns[:i]) for i in range(n+1)]
mss = [sum(ms[:i]) for i in range(m+1)]

mx = 0
for i in range(n + 1):
    if nss[i] > k:
        break

    j = -1
    for v in mss:
        if nss[i] + v > k:
            break
        j += 1
    mx = max(mx, i + j)

print(mx)


### FIXED CODE ###

n, m, k = list(map(int, input().split()))
ns = list(map(int, input().split()))
ms = list(map(int, input().split()))

nss = [0]
for i, v in enumerate(ns):
    nss.append(nss[i] + ns[i])

mss = [0]
for i, v in enumerate(ms):
    mss.append(mss[i] + ms[i])

mx = 0
j = m
for i in range(n + 1):
    if nss[i] > k:
        break

    while mss[j] > k - nss[i]:
        j -= 1
    
    mx = max(mx, i + j)

print(mx)
### BUGGY CODE ###

s = str(input())
loop = int(input())

rev = 0
for i in range(loop):
    queries = input().split()
    if len(queries) == 1:
        rev = (rev+1) % 2
    else:
        type = int(queries[1])
        c = str(queries[2])
        if (type + rev) % 2 == 1:
            s = c + s
        else:
            s = s + c
if rev == 1:
    s = s[::-1]
print(s)



### FIXED CODE ###

from collections import deque

s = deque((str(input())))
loop = int(input())

rev = 0
for i in range(loop):
    queries = input().split()
    if len(queries) == 1:
        rev = (rev+1) % 2
    else:
        type = int(queries[1])
        c = str(queries[2])
        if (type + rev) % 2 == 1:
            s.appendleft(c)
        else:
            s.append(c)
if rev == 1:
    print("".join(reversed(list(s))))
else:
    print("".join(list(s)))
### BUGGY CODE ###

n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
sa=[]
ka=0
sb=[]
kb=0
for i in range(n):
  if ka+a[i]<=k:
    ka+=a[i]
    sa.append(a[i])
  else:
    break
for i in range(m):
  if kb+b[i]<=k:
    kb+=b[i]
    sb.append(b[i])
  else:
    break
ans=max(len(sa),len(sb))
for i in range(len(sa)):
  if sa[i]>k:
    break
  while kb+sa[i]>k:
    kb-=sb[-1]
    sb.pop(-1)
  sb=[sa[i]]+sb
  kb+=sa[i]
  if ans<len(sb):
    ans=len(sb)
print(ans)


### FIXED CODE ###

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

sa=[]
ka=0
sb=[]
kb=0
for i in range(n):
  if ka+a[i]<=k:
    ka+=a[i]
    sa.append(a[i])
  else:
    break
for i in range(m):
  if kb+b[i]<=k:
    kb+=b[i]
    sb.append(b[i])
  else:
    break
ans=max(len(sa),len(sb))
tb=[]
for i in range(len(sa)):
  if sa[i]>k:
    break
  while kb+sa[i]>k:
    kb-=sb[-1]
    sb.pop(-1)
  tb.append(sa[i])
  kb+=sa[i]
  if ans<(len(sb)+len(tb)):
    ans=(len(sb)+len(tb))
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
del a[n:len(a)-1]
for i in range(n):
    count = 0
    for j in a:
        if i+1 == j:
            count += 1
    print(count)


### FIXED CODE ###

import sys
import collections
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
for i in range(n):
    print(c[i+1])