Harryxun/stf_run huggingface dataset:
n = int(input())
As = [int(input()) for _ in range(n)]
visited = [-1 for i in range(n)]


def rec(visited, prev_i, i, depth):
    if visited[i] >= 0:
        return visited[i]
    if As[i] == 2:
        visited[i] = 1
        return depth
    if prev_i == As[i] - 1:
        visited[i] = 0
        return visited[i]
    visited[i] = rec(visited, i, As[i] - 1, depth + 1)
    return visited[i]


ret = rec(visited, -1, 1 - 1, 1)
if ret == 0:
    ret = -1
print(ret)



### FIXED CODE ###

n = int(input())
As = [int(input()) for _ in range(n)]
cnt = 0
current_button = 0
for _ in range(n):
    current_button = As[current_button] - 1
    cnt += 1
    if current_button == 1:
        break
if current_button != 1:
    print(-1)
else:
    print(cnt)
N = int(input())
S = input()
count = 0
for i, s in enumerate(S.split("#")):
     if i == 0:
         continue
     else:
         count += s.count(".")
if count > S.count("#"):
    count = S.count("#")
print(count)


### FIXED CODE ###

A, B, C = map(int, input().split())
if A <= C and C <= B :
    print("Yes")
elif B <= C and C <= A :
    print("Yes")
else:
    print("No")
NK = list(map(int, input().split()))
P = list(map(int, input().split()))
S =[0] * (NK[0] - NK[1])
S[0] = sum(P[0:(NK[1])])

for i in range(NK[0] - NK[1] - 1):
    S[i+1] = S[i] - P[i] + P[i+NK[1]]

print((max(S) + NK[1]) / 2)


### FIXED CODE ###

N, K = map(int, input().split())
P = list(map(int, input().split()))
S =[0] * (N - K + 1)
S[0] = sum(P[0:K])

for i in range(1, N - K + 1):
    S[i] = S[i-1] - P[i-1] + P[i+K-1]

print((max(S) + K) / 2)
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
list1 = []
ame = A[0]
for i in range(N-1):
  list1.append(sum(A[:i+1])+sum(B[i:]))
print(max(list1))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
list1 = []
ame = A[0]
for i in range(N-1):
  list1.append(sum(A[:i+1])+sum(B[i:]))
  
if list1 == []:
  print(A[0]+B[0])
else:
  print(max(list1))
import math
N, M = map(int, input().split())
S = list(input())
T = list(input())

lcm = (N * M) // math.gcd(N, M)
ans = lcm
ansS = ["0"]*lcm
ansT = ["0"]*lcm
Sp = lcm//N
Tp = lcm//M

for i in range(Sp*lcm):
    if Sp*i > lcm:
        break
    if i > N-1:
        break
    ansS[Sp*i] = S[i]

for i in range(Tp*lcm):
    if Tp*i > lcm:
        break
    if i > M-1:
        break
    ansT[Tp*i] = T[i]

for i in range(lcm):
    if ansS[i] == "0" or ansT[i] == "0":
        continue
    if ansS[i] != ansT[i]:
        ans = -1
        break

print(ans)


### FIXED CODE ###

import math
N, M = map(int, input().split())
S = list(input())
T = list(input())
lcm = (N * M) // math.gcd(N, M)
ans = lcm
Sp = lcm//N
Tp = lcm//M
lcmlcm = (Sp * Tp) // math.gcd(Sp, Tp)
owari = min(Sp*N, M*Tp)
for i in range(0, owari, lcmlcm):
    if S[i//Sp] != T[i//Tp]:
        ans = -1
        break
print(ans)
import math
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())
print((2*N)//math.gcd(2,N))

### FIXED CODE ###

import math
import fractions
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

#N,K=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())
print((2*N)//fractions.gcd(2,N))
def dfs(lis,cnt,n):
    if sum(lis)>100:
        return cnt
 
    if(len(lis)==3):
        ans=lis[0]**2+lis[1]**2+lis[2]**2+lis[0]*lis[1]+lis[1]*lis[2]+lis[2]*lis[0]
        if(ans==n):
            cnt+=1
        return cnt
    
    for v in range(1,100):
        lis.append(v)
        cnt=dfs(lis,cnt,n)
        lis.pop()
    
    return cnt
 
 
n= int(input())
for i in range(1,n+1):
    cnt = 0
    print(dfs([],cnt,i))

### FIXED CODE ###

l,r,d = map(int,input().split())
cnt=0
for i in range(l,r+1):
    if i%d == 0:
        cnt+=1
print(cnt)
s = input()
print(s[0] + s.length-2 + s[-1]) 

### FIXED CODE ###

s = input()
print(s[0] + str(len(s)-2) + s[-1])
a = int(input().split())
b = int(input().split())
print(a*b,(a+b)*2)

### FIXED CODE ###

a,b=[int(i) for i in input().split()]
print(a*b,(a+b)*2)
N = int(input())
S = list(map(int,list(str(N))))
if len(S)==1:
  if N<=5:
    print(N)
    exit()
  else:
    print(10-N+1)
    exit()
ans = [0]*(len(S)+1)
for i in range(len(S)-1):
  s_1 = int(S[i])
  s_2 = int(S[i+1])
  if (s_1>=6)or((s_1==5)and(s_2>=6)):
    if s_2<=4:
      ans[i]=1
      ans[i+2]=s_2
    else:
      ans[i]=1
  else:
    if s_1==5:
      ans[i+1]=5
      ans[i+2]=s_2
    else:
      if s_2<=5:
        ans[i+1]=s_1
        ans[i+2]=s_2
      else:
        ans[i+1]=s_1+1

a = sum(ans)
ans = int(''.join(map(str,ans)))
ans = ans-N
a += sum(map(int,list(str(ans))))
print(a)

### FIXED CODE ###

S = input()[::-1]
l = len(S)
dp = [[0]*2 for _ in range(l+1)]
for i in range(l):
  dp[i+1][0]=min(dp[i][0]+int(S[i]),dp[i][1]+int(S[i])+1)
  if i!=0:
    dp[i+1][1]=min(dp[i][0]+10-int(S[i]),dp[i][1]+10-(int(S[i])+1))
  else:
    dp[i+1][1]=dp[i][0]+10-int(S[i])
print(min(dp[-1][0],dp[-1][1]+1))
#!/usr/bin/env python3
n, m, q  = map(int, input().split())
abcd  = [tuple(map(int, input().split())) for i in range(q)]

ans = 0

def check(A):
    global ans
    max_ = 0

    # 点数計算
    for (a, b, c, d) in abcd:
        if A[b-1] - A[a-1] == c:
            max_ += d

    # 最大値更新
    ans = max(ans, max_)

def suretu(A=[], st=1):
    # 再帰的に数字を1つずつ足してって数列生成
    for i in range(st, 11):
        if len(A) == m: # 数列完成
            check(A)
            return
        else:
            suretu(A + [i], i)

    return ans

print(suretu())


### FIXED CODE ###

#!/usr/bin/env python3
n, m, q  = map(int, input().split())
abcd  = [tuple(map(int, input().split())) for i in range(q)]

ans = 0

def check(A):
    global ans
    max_ = 0

    # 点数計算
    for (a, b, c, d) in abcd:
        if A[b-1] - A[a-1] == c:
            max_ += d

    # 最大値更新
    ans = max(ans, max_)

def suretu(A=[], st=1):
    # 再帰的に数字を1つずつ足してって数列生成
    for i in range(st, m+1):
        if len(A) == n: # 数列完成
            check(A)
            return
        else:
            suretu(A + [i], i)

    return ans

print(suretu())
n = int(input()
s = dict()
for i in range(n):
    si = input()
    if si in s:
        s[si] +=1
    else:
        s[si] = 0
l = max(s.values())
ans = []
for i in s:
    if s[i] == 1:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)

### FIXED CODE ###

from collections import  Counter
n = int(input())
a  = [input() for i in range(n)]
cnt = Counter(a)
l = max(cnt.values())
ans = [s for s,c in cnt.items()if c ==l]
ans.sort()
print('\n'.join(ans))
S = input()
power = 0
answer = 0
temps = int(S)
while True:
    temps = temps/10
    power += 1
    if temps < 10:
        break

SS = list(S)

for i in range(1 << power):
    output = []
    for j in range(power):
        if (i>>j)&1 == 1:
            output.append(SS[j])
            output.append('+')
        else:
            output.append(SS[j])
    output.append(SS[power])
    temp_string = ''.join(output)
    answer += eval(temp_string)
    output.clear()
    
print(answer)

### FIXED CODE ###

S = input()
power = 0
answer = 0
temps = int(S)
while True:
    if temps < 10:
        break
    temps = temps/10
    power += 1

SS = list(S)

for i in range(1 << power):
    output = []
    for j in range(power):
        if (i>>j)&1 == 1:
            output.append(SS[j])
            output.append('+')
        else:
            output.append(SS[j])
    output.append(SS[power])
    temp_string = ''.join(output)
    answer += eval(temp_string)
    
print(answer)
N = int(input())
list1 = []
for i in range(N):
    list1.append(int(input))
list2 = []
for i in range(N):
    list2.append(int(input))
x = 0
for i in range(N):
    x = list1[i] - list2[i]
    if x >> 0:
         y += x
print(y)

### FIXED CODE ###

N = int(input())
list1 = input().split()
list2 = input().split()
x = 0
y = 0
for i in range(N):
    x = int(list1[i]) - int(list2[i])
    if x > 0:
         y += x
print(y)
n = int(input())
tt = []
for i in range(n):
    tt.append(int(input()))
    
ss = int(1)

for i in tt:
    p = []
    p.append(ss)
    p.append(i)
    q = list(sorted(p))
    while q[1] % q[0] != 0:
        r = [q[1] % q[0] , q[0]]
        s = list(sorted(r))
        q[0] = s[0]
        q[1] = s[1]

        
    ss = int(ss * i / q[0])

print(int(ss))

### FIXED CODE ###

n = int(input())
tt = []
for i in range(n):
    tt.append(int(input()))
    
ss = 1

for i in tt:
    p = []
    p.append(int(ss))
    p.append(int(i))
    q = list(sorted(p))
    while q[1] % q[0] != 0:
        r = [q[1] % q[0] , q[0]]
        s = list(sorted(r))
        q[0] = int(s[0])
        q[1] = int(s[1])

        
    ss = int(ss * i) // q[0]

print(ss)
while True:
    text = raw_input("a b : ")
    a, b = text.split()
    print int(a) + int(b)

### FIXED CODE ###

while True:
    try:
        text = raw_input()
        a, b = text.split()
        print int(a) + int(b)
    except EOFError:
        break
import sys
input = sys.stdin.readline
a, b, c = map(int, input().split())
k = int(input())
def two(num):
  for i in range(1,8):
    if (2**(i-1)<=num) & (num<2**(i)):
      return i
ab = two(a/b)
b_ = b*2**ab
b_c = two(b_/c)

if k>=(ab+b_c):
  print("Yes")
else:
  print("No")
  

### FIXED CODE ###

import sys
input = sys.stdin.readline
a, b, c = map(int, input().split())
k = int(input())
def two(num):
  for i in range(1,8):
    if (2**(i-1)<=num) & (num<2**(i)):
      return i
  return 0
ab = two(a/b)
b_ = b*2**ab
b_c = two(b_/c)

if k>=(ab+b_c):
  print("Yes")
else:
  print("No")
n = int(input())

if n = 0:
  print(2)
  exit()
if n = 1:
  print(1)
  exit()

xx = 2
x = 1
for i  in range(n-1):
  ans = xx + x
  xx = x
  x = ans

print(ans)

### FIXED CODE ###

n = int(input())

if n == 0:
  print(2)
  exit()
if n == 1:
  print(1)
  exit()

xx = 2
x = 1
for i in range(n-1):
  ans = xx + x
  xx = x
  x = ans

print(ans)
a, b = map(int, iput().split())
print(gcd(a, b))

### FIXED CODE ###

x, y = map(int, input().split())
while True:
  if x >= y:
    x = x % y
  else:
    y = y % x
  if x % y == 0:
    print(y)
    break
  elif y % x == 0:
    print(x)
    break
print(int(input()) + int(input())//2)

### FIXED CODE ###

x,y = map(int,input().split())
print(x+y//2)
A, B = list(map(int,input()))
def button(A, B):
  if A > B:
    result = A
    return([A - 1, B, result])
  elif A == B:
    result = A
    return([A - 1, B, result])
  else:
    result = B
    return([A, B - 1, result])
 
A, B, result_1 = button(A, B)
A, B, result_2 = button(A, B)
 
print(result_1 + result_2)

### FIXED CODE ###

A, B = list(map(int,input().split()))
def button(A, B):
  if A > B:
    result = A
    return([A - 1, B, result])
  elif A == B:
    result = A
    return([A - 1, B, result])
  else:
    result = B
    return([A, B - 1, result])
 
A, B, result_1 = button(A, B)
A, B, result_2 = button(A, B)
 
print(result_1 + result_2)
N, M = map(int,input().split())
pairs = []
for i in [0]*M:
    inp = sorted(list(map(int,input().split())))
    if inp not in pairs:
        pairs.append(inp)
def solver(N,M,pairs):
    group_list = []
    max_len = 1
    for i in pairs:
        pair = sorted(i)
        for j in range(len(group_list)):
            if pair[1] in group_list[j]:
                break
            elif pair[0] in group_list[j]:
                group_list[j].append(pair[1])
                if max_len < len(group_list[j]):
                    max_len = len(group_list[j])
                break
        else:
            if max_len < 2:
                max_len = 2
            group_list.append(pair)
    return max_len
print(solver(N,M,pairs))


### FIXED CODE ###

D, T, S = map(int,input().split())
if D / S <= T:
    print("Yes")
else:
    print("No")
S=list(input())                                                                                                                                        
T=list(input())                                                                                                                                        
                                                                                                                                                       
T_size = len(T)                                                                                                                                        
                                                                                                                                                       
def match_num(x):                                                                                                                                      
    return T_size - sum([1 for a,t in zip(x, T) if a==t])                                                                                              
                                                                                                                                                       
b=[]                                                                                                                                                   
for i in range(len(S)-T_size):                                                                                                                         
    b.append(match_num(S[i:i+T_size]))                                                                                                                 
                                                                                                                                                       
print(min(b))

### FIXED CODE ###

s=input()
t=input()
s=list(s)
t=list(t)

size = len(t)
ms = []
for i in range(len(s)-size+1):
    # print(s[i:i+size])
    m = sum([a==b for a,b in zip(s[i:i+size], t)])
    ms.append(m)

print(size - max(ms))
n=int(input())
node=[-1 for i in range(n)]
g=[[] for i in range(n)]
def color(par,i,ini):
  if node[i]>-1:
    return
  else:
    if par==-1:
      node[i]=0
    else:
      node[i]=abs(node[par]-ini)
  for j in range(len(g[i])):
    color(i,g[i][j][0],g[i][j][1])
  return
for i in range(n-1):
  u,v,w=map(int,input().split())
  u-=1
  v-=1
  w%=2
  g[u].append([v,w])
  g[v].append([u,w])
for i in range(n):
  color(-1,i,0)
for i in range(n):
  print(node[i])

### FIXED CODE ###

n=int(input())
node=[-1 for i in range(n)]
g=[[] for i in range(n)]
for i in range(n-1):
  u,v,w=map(int,input().split())
  u-=1
  v-=1
  w%=2
  g[u].append([v,w])
  g[v].append([u,w])
queue=[0]
node[0]=0
while len(queue)>0:
  t=queue.pop()
  for v,w in g[t]:
    if node[v]>-1:
      continue
    node[v]=node[t]^w
    queue.append(v)
for i in range(n):
  print(node[i])
a, b = gets.split.map(&:to_i)
print(a*b)

### FIXED CODE ###

x,y = map(int,input().split())
print(x*y)
def judge(S):
	S_list  = list(str(S))  #list化
	
	i_pure = None
	for i in S_list:
		if i == i_pure:
			return 'Bad'
		i_pure = i

	return 'Good'


# S = ['3776','8080','1333','0024']

S = stdin.readline()
# for s in S:
# 	print(judge(s))

print(judge(S))

### FIXED CODE ###

from sys import stdin

def judge(S):
	S_list  = list(str(S))  #list化
	
	i_pure = None
	for i in S_list:
		if i == i_pure:
			return 'Bad'
		i_pure = i

	return 'Good'


# S = ['3776','8080','1333','0024']

S = stdin.readline()
# for s in S:
# 	print(judge(s))

print(judge(S))
n,m = map(int,input().split())
ans = [0]*n

for i in range(3):
    a,b = map(int,input().split())
    if a == 1 and b == 0:
        print(-1)
        exit()
    if ans[a-1] == 0:
        ans[a-1] = b
    else:
        if b != ans[a-1]:
            print(-1)
            exit()
if ans[0] == 0:
    ans[0] = 1
print(*ans,sep="")


### FIXED CODE ###

n,m = map(int,input().split())
ans = [0]*n

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

for i in range(1000):
    if len(str(i)) == n:
        
        check = True
        for j,k in l:
            if int(str(i)[j-1]) != k:
                check = False
                
        if check:
            print(i)
            exit()
print(-1)
n=int(input())
s=input()
t=input()
if s==t:
    print(n)
else:
    ans=2*n
    f=True
    for i in range(n):
        for j range(i+1):
            if t[j]==a[n-1-i+j]:
                f=False
        if !f:
            break
        ans-=1
    print(ans)

### FIXED CODE ###

n=int(input())
s=input()
t=input()
i=0
while n>i:
    if i==0 and s==t:
        break
    if t[:-i]==s[i:]:
        break
    i+=1
print(n+i)
s = map(int, input().split())
s.sort()
print(s[0] + s[1])


### FIXED CODE ###

a = [int(_) for _ in input().split()] 
a.sort()
print(a[0] + a[1])
from collections import Counter
S = list(input())
S = Counter(S)
S = list(S.keys())
S.sort()
for i in range(26):
    alph = chr(ord("a") + i)
    #print(alph)
    if S[i] != chr(ord("a") + i):
        print(alph)
        exit()
print("None")


### FIXED CODE ###

from collections import Counter
S = list(input())
S = Counter(S)
S = list(S.keys())
S.sort()
for i in range(26):
    alph = chr(ord("a") + i)
    #print(alph)
    if i == len(S):
        print(chr(ord("a") + i))
        exit()
    elif S[i] != chr(ord("a") + i):
        print(alph)
        exit()

print("None")
h, n = map(int, input().split())

S = []
for _ in range(n):
    D = list(map(int, input().split()))
    S.append(D)

dic={}

def rec(magic, nokori,sum_mp):

    if str(magic)+"_"+str(nokori) in dic:
        return dic[str(magic)+"_"+str(nokori)]

    if nokori<=0:
        return sum_mp
    if magic >= len(S):
        return 10**9

    dmg = S[magic][0]
    mp  = S[magic][1]

    min_mp = min(
        rec(magic  ,nokori-dmg,sum_mp+mp), # use this magic, and check this magic again
        rec(magic+1,nokori-dmg,sum_mp+mp), # use this magic, and check next magic                    rec(magic+1,nokori,sum_mp       ), # don't use this magic, and check next magic
        )

    dic[str(magic)+"_"+str(nokori)] = min_mp
    return min_mp

print(rec(0,h,0))

### FIXED CODE ###

h, n = map(int, input().split())
s = []
for _ in range(n):
    D = list(map(int, input().split()))
    s.append(D)

dp = [[10**10 for i in range(h+1)] for j in range(n+1)]
dp[0][0] = 0

for i in range(n):
    dmg=s[i][0]
    mp=s[i][1]
    for j in range(h+1):
        dp[i+1][j] = min(dp[i+1][j],dp[i][j])
        dp[i+1][min(j+dmg,h)] = min(dp[i+1][min(j+dmg,h)], dp[i+1][j]+mp)

print(dp[-1][-1])
A,B,C = map(int,input().split())

if A+B <= C
    print("Yes")
else:
    print("No")
     




### FIXED CODE ###

A,B,C = map(int,input().split())

if A+B >= C:
    print("Yes")
else:
    print("No")
lis = [1,2,3]
print(lis.remove(input()).remove(input()))

### FIXED CODE ###

print(6-int(input())-int(input()))
n=int,input()
k=int,input()
s=input()
S=s[0:k-1]+s[k-1].lower()+s[k:]
print(S)


### FIXED CODE ###

n,k=map(int,input().split())
s=input()
S=s[0:k-1]+s[k-1].lower()+s[k:]
print(S)
import sys
input = sys.stdin.readline
from operator import itemgetter

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

from collections import Counter

CA=Counter(A)
CB=Counter(B)

U=[]

for ca in CA:
    if CA[ca]>0 and CB[ca]>0:
        if CA[ca]+CB[ca]>N:
            print("No")
            sys.exit()
        U.append([min(CA[ca],CB[ca]),ca,CA[ca]+CB[ca]])

U.sort(key=itemgetter(2),reverse=True)

ANSDICT=dict()

ind1=0

#print(U)

for ind0 in range(len(U)):
    if U[ind0][0]==0:
        continue

    while U[ind0][0]>0:

        while ind1<=ind0:
            ind1+=1

        while ind1<len(U) and U[ind1][0]==0:
            ind1+=1

        if ind1==len(U):
            break

        while U[ind1][0]>0:
            U[ind0][0]-=1
            U[ind1][0]-=1

            if U[ind0][1] in ANSDICT:
                ANSDICT[U[ind0][1]].append(U[ind1][1])
            else:
                ANSDICT[U[ind0][1]]=[U[ind1][1]]

            if U[ind1][1] in ANSDICT:
                ANSDICT[U[ind1][1]].append(U[ind0][1])
            else:
                ANSDICT[U[ind1][1]]=[U[ind0][1]]

ANS=[-1]*N

for i in range(N):
    a=A[i]
    if a in ANSDICT and len(ANSDICT[a])!=0:
        
        x=ANSDICT[a].pop()
        ANS[i]=x
        CB[x]-=1

for c,x,_ in U:
    if c!=0:
        cc=c
        xx=x
        break

for i in range(N):
    if ANS[i]==-1 and A[i]!=xx:
        ANS[i]=xx
        cc-=1
        CB[xx]-=1

        if cc==0:
            break

ind=0
for cb in CB:
    while CB[cb]!=0:
        while ANS[ind]!=-1:
            ind+=1
        ANS[ind]=cb
        CB[cb]-=1

print("Yes")
print(*ANS)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

from collections import Counter

CA=Counter(A)
CB=Counter(B)

H=[]

for ca in CA:
    if CA[ca]>0 and CB[ca]>0:
        if CA[ca]+CB[ca]>N:
            print("No")
            sys.exit()
        H.append((-(CA[ca]+CB[ca]),ca))

import heapq
heapq.heapify(H)

ANSDICT=dict()

while len(H)>=2:
    c1,x1=heapq.heappop(H)
    c1=-c1

    c2,x2=heapq.heappop(H)
    c2=-c2

    if x1 in ANSDICT:
        ANSDICT[x1].append(x2)
    else:
        ANSDICT[x1]=[x2]

    if x2 in ANSDICT:
        ANSDICT[x2].append(x1)
    else:
        ANSDICT[x2]=[x1]

    CA[x1]-=1
    CA[x2]-=1
    CB[x1]-=1
    CB[x2]-=1

    if CA[x1]>0 and CB[x1]>0:
        heapq.heappush(H,(-(c1-2),x1))

    if CA[x2]>0 and CB[x2]>0:
        heapq.heappush(H,(-(c2-2),x2))

ANS=[-1]*N

for i in range(N):
    a=A[i]
    if a in ANSDICT and len(ANSDICT[a])!=0:
        
        x=ANSDICT[a].pop()
        ANS[i]=x

if H:
    cc,xx=H[0]
    cc=-cc

    for i in range(N):
        if ANS[i]==-1 and A[i]!=xx:
            ANS[i]=xx
            CB[xx]-=1

            if CB[xx]==0:
                break

ind=0
for cb in CB:
    while CB[cb]!=0:
        while ANS[ind]!=-1:
            ind+=1
        ANS[ind]=cb
        CB[cb]-=1

print("Yes")
print(*ANS)
a, b= map(int, input().split())


c = (a*b)
d = (a+b)*2

print( c, d)


### FIXED CODE ###

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


c = (a*b)
d = (a+b)*2

print( c, d)
a =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1]


### FIXED CODE ###

a =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1])
def main():
    N, C, K = map(int, input().split())
    T = [int(input()) for _ in range(N)]
    ans = 0
    i = 0
    j = 0
    T.sort()
    if len(T) == 1:
        ans = 1
        return(ans)

    while True:
        if T[j] + K >= T[i+1]:
            i = i + 1
            if i == N-1:
                ans += 1
                return (ans)
            for h in range(C-2):
                if T[j] + K >= T[i+1]:
                    if h == C-3:
                        ans += 1
                        i += 2
                        j = i
                        if j >= N-1:
                            return(ans)
                        break
                    else:
                        i += 1
                        continue
                elif T[j] + K < T[i + 1]:
                    j = i + 1
                    i = i + 1
                    ans = 1
                    break

        elif T[j] + K < T[i+1]:
            ans += 1
            i += 1
            j = i
            if j == N-1:
                ans += 1
                return(ans)

print(main())


### FIXED CODE ###

def main():
    N, C, K = map(int, input().split())
    T = list(int(input()) for _ in range(N))

    T.sort()

    ans = 0
    temp = T[0]
    cnt = 1

    for i in range(1,N):
        if temp + K < T[i] or C == cnt:
            ans += 1
            temp = T[i]
            cnt = 1
        else:
            cnt += 1

    ans += 1
    return (ans)

print(main())
n,m=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
  a[i],b[i]=map(int,input().split())
for j in range(m):
  print(a.count(m+1)+b.count(m+1))

### FIXED CODE ###

n,m=map(int,input().split())
a=[0]*m
b=[0]*m
for i in range(m):
  a[i],b[i]=map(int,input().split())
for j in range(n):
  print(a.count(j+1)+b.count(j+1))