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

S = input()
Rindex = [i for i,x in enumerate(S) if x == 'R']
Lindex = [i for i,x in enumerate(S) if x == 'L']
res = [0 for i in range(len(S))]
for i in range(len(S)):
    if S[i] == 'R':
        a = [x for x in Lindex if x>i]
        c = a[0] - i - 1
        if c%2 == 0:
            res[a[0] - 1] += 1
        else:
            res[a[0]] += 1
    else:
        a = [x for x in Rindex if x<i]
        c = i - a[-1] - 1
        if c%2 == 0:
            res[a[-1] + 1] += 1
        else:
            res[a[-1]] += 1
for i,r in enumerate(res):
    if i != len(res) -1:
        print(r, end=" ")
    else:
        print(r)

### FIXED CODE ###

S = input()
Rnum = S.split('L')
Rnum = [len(i) for i in Rnum if i != '']
Lnum = S.split('R')
Lnum = [len(i) for i in Lnum if i != '']
res = [0]*len(S)
count = 0
for i,r in enumerate(Rnum):
    l = Lnum[i]
    res[r+count-1] = int((r+1)/2) + int(l/2)
    res[r+count] = int(r/2) + int((l+1)/2)
    count += r+l
for i,r in enumerate(res):
    if i!= len(res)-1:
        print(r,end=' ')
    else:
        print(r)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(200001)

N, Q = map(int, input().split())

edge = [[] for i in range(N)]
ans = [0] * N
query = [0] * N

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

for q in range(Q):
    p, x = map(int, input().split())
    query[p-1] += x

is_visited = [False] * N

def dfs(cur, q):
    is_visited[cur] = True
    q = q + query[cur]
    ans[cur] += q

    for next in edge[cur]:
        if is_visited[next]:
            continue
        dfs(next, q)

dfs(0, 0)

print(*ans)

### FIXED CODE ###

N, Q = map(int, input().split())

edge = [[] for i in range(N)]
ans = [0] * N
query = [0] * N

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

for q in range(Q):
    p, x = map(int, input().split())
    query[p-1] += x

is_visited = [False] * N
stack = [(0,0)]

while len(stack) != 0:
    cur, q = stack.pop()
    is_visited[cur] = True

    q = q + query[cur]
    ans[cur] += q

    for next in edge[cur]:
        if is_visited[next]:
            continue
        stack.append((next, q))

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

from itertools import accumulate

INF = float('inf')

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

accAs = [0] + list(accumulate(As))

dp = [[0] * (N) for _ in range(N)]
for num in range(2, N+1):
    for i in range(N-num+1):
        cost = INF
        for j in range(1, num):
            cost = min(cost, dp[i][i+j-1] + dp[i+j][i+num-1])
        dp[i][i+num-1] = accAs[i+num] - accAs[i] + cost

print(dp[0][N-1])


### FIXED CODE ###

from itertools import accumulate

INF = float('inf')

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

accAs = [0] + list(accumulate(As))

dp = [[0] * (N) for _ in range(N)]
for num in range(2, N+1):
    for i in range(N-num+1):
        cost = INF
        for j in range(1, num):
            cost = min(cost, dp[i][i+j-1] + dp[i+j][i+num-1])
        dp[i][i+num-1] = accAs[i+num] - accAs[i] + cost

print(dp[0][N-1])
### BUGGY CODE ###

import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]

heapq.heapify(A)

for b, c in BC:
    cnt = 0
    for _ in range(b):
        p = heapq.heappop(A)
        if p > c:
            heapq.heappush(A, p)
            break
        else:
            cnt += 1

    _ = [heapq.heappush(A, c) for _ in range(cnt)]

print(sum(A))


### FIXED CODE ###

N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
BC = [list(map(int, input().split())) for _ in range(M)]

# n番目の要素でソートsort
BC = sorted(BC, reverse=True, key=lambda x: x[1])

m = A[0]
D = []
for b, c in BC:
    if c > m:
        _ = [D.append(c) for i in range(b)]
    else:
        continue
    if len(D) > N:
        break

D.append(0)

for i, d in enumerate(D):
    if i >= N:
        break
    if A[i] < d:
        A[i] = d
    else:
        break

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

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

for _ in range(k):
    b = [0] * (n + 2)
    for i in range(n):
        b[max(0, i - a[i])] += 1
        b[min(n + 1, i + a[i] + 1)] -= 1
    a[0] = b[0]
    cnt = 0
    for i in range(1, n):
        a[i] = a[i - 1] + b[i]
        if a[i] == n:
            cnt += 1

    if cnt == n:
        break

print(*a)


### FIXED CODE ###

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

for _ in range(k):
    b = [0] * (n + 2)
    for i in range(n):
        b[max(0, i - a[i])] += 1
        b[min(n + 1, i + a[i] + 1)] -= 1
    a[0] = b[0]
    cnt = a[0]
    for i in range(1, n):
        a[i] = a[i - 1] + b[i]
        cnt += a[i]

    # print(*a)
    if cnt == n**2:
        break

print(*a)
### BUGGY CODE ###

N = int(input())
*L, = map(int, input().split())
L.sort()
count = 0
for a in reversed(range(0, N)):
  for b in range(1, a):
    range_c = L[:b]
    key = L[a] - L[b]
    left = -1
    right = len(range_c)
    while right - left > 1:
      mid = int((left + right) / 2)
      if range_c[mid] > key:
        right = mid
      else:
        left = mid
    count += len(range_c)-right
print(count)

### FIXED CODE ###

N = int(input())
*L, = map(int, input().split())
L.sort()
count = 0
for a in reversed(range(0, N)):
  for b in range(1, a):
    range_c = L[:b]
    key = L[a] - L[b]
    left = -1
    right = len(range_c)
    while right - left > 1:
      mid = int((left + right) / 2)
      if range_c[mid] > key:
        right = mid
      else:
        left = mid
    count += len(range_c)-right
print(count)
### BUGGY CODE ###

import numpy as np

n,k,q = map(int,input().split())
A = []
ans = np.array([k]*n)
tmp = np.array([1]*n)
for _ in range(q):
    a = int(input())
    A.append(a)

for i in A:
    ans -= tmp
    ans[i-1] += 1

for j in ans:
    if j >= 1:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

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


if k <= q:
    
    A = []
    for _ in range(q):
        a = int(input())
        A.append(a)

    ans = [0]*n

    from collections import Counter
    cnt = Counter(A)
    for key,v in cnt.items():
        if v >= q-k+1:
            ans[key-1] = 1

    for i in range(n):
        if ans[i] == 0:
            print('No')
        else:
            print('Yes')
        
else:
    for _ in range(n):
        print('Yes')
### BUGGY CODE ###

import numpy as np
n, k = map(int,input().split())
a = np.array([int(i) for i in input().split()])
best = 0
for i in range(k+1):
    aa = np.array([i for w in range(len(a))])
    tmp = np.sum(a ^ aa)
    if best < tmp:
        best = tmp
print(best)

### FIXED CODE ###

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

# 最大値を取るf(x)のxを求める
# digitsは下位桁 < 上位桁で1になっているbitをカウントする
digits = [0] * 40
for i in range(40):
    for a in A:
        if (a >> i) & 1:
            digits[i] += 1

# Kを考慮してmax_xを求める方法がわからない
# 桁ごとに最適なbitはすでにわかっていて、他の桁のbitに影響を受けることはないので、
# 上位桁から見ていって、Kが1になっている部分ならフラグを立てる
# 上位桁から見てKが1のbitが出てから、K:1,max_x:0のフラグを立てたら、その桁より下位桁のbitはなんでもよくなる
check_K = True
max_x = 0
for i, d in enumerate(reversed(digits)):
    i = 40 - i - 1
    if check_K and K < pow(2, i):
        continue
    if d <= (N-d) and ((K >> i) & 1 == 1 or not check_K):
        max_x += 2 ** i
    elif (K >> i) & 1 == 1:
        check_K = False
    
#print(max_x)
ans = 0
for a in A:
    ans += a ^ max_x

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

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

m = []

cnt = 1
for i in range(n-1):
    if(s[i] != s[i+1]):
        m.append(cnt)
        cnt = 1
    else:
        cnt += 1

m.append(cnt)

sums = []

ans = 0

l = 0
r = 0
turn = 0

sums.append(0)
for i in range(len(m)):
    sums.append(sums[i] + m[i])

if(2*k + 1 >= len(m)):
    ans = n - 1
else:
    for i in range(len(m) - (2 * k + 1)):
        ansi = 0
        for j in range(0, i):
            ansi += m[j]-1
        for j in range(i+2*k+1, len(m)):
            ansi += m[j]-1
        ansi += sums[i+2*k+1] - sums[i] - 1
        ans = max(ans, ansi)
print(ans)


### FIXED CODE ###

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

m = []

cnt = 1
for i in range(n-1):
    if(s[i] != s[i+1]):
        m.append(cnt)
        cnt = 1
    else:
        cnt += 1

m.append(cnt)

sums = []

ans = 0

l = 0
r = 0
turn = 0

sums.append(0)
for i in range(len(m)):
    sums.append(sums[i] + m[i])

if(2*k + 1 >= len(m)):
    ans = n - 1
else:
    for i in range(len(m) - (2 * k + 1)):
        ansi = 0
        ansi += sums[i] - sums[0] - i
        ansi += sums[len(m)] - sums[i+2*k+1] - (len(m) - (2 * k + 1))
        ansi += sums[i+2*k+1] - sums[i] - 1
        ans = max(ans, ansi)
print(ans)
### BUGGY CODE ###

#D
N=int(input())
S=str(input())
count=0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if j-i!=k-j and S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
                count+=1
print(count)

### FIXED CODE ###

N=int(input())
S=list(str(input()))
r=S.count('R')
g=S.count('G')
b=S.count('B')
count=0

for i in range(int((N-3)/2)+1):
    for k in range(N-i*2-3+1):
        if S[k]!=S[k+i+1] and S[k]!=S[k+2*i+2] and S[k+i+1]!=S[k+2*i+2]:
            count+=1
print(r*g*b-count)
### BUGGY CODE ###

def main():
  N, M = map(int, input().split())
  edge = [[] for _ in range(N)]
  for i in range(M):
    u, v = map(int, input().split())
    edge[u-1].append(v-1)
  d = [-1]*N
  S, T = map(int, input().split())
  d[S-1] = 0
  que = [S-1]
  while len(que)>0:
    now = que.pop(0)
    for i in edge[now]:
      for j in edge[i]:
        for k in edge[j]:
          if d[k] == -1:
            que.append(k)
            d[k] = d[now]+1 
  print(d[T-1])
  
if __name__ == "__main__":
  main()

### FIXED CODE ###

def main():
  N, M = map(int, input().split())
  edge = [[[] for _ in range(3)] for _ in range(N)]
  for i in range(M):
    u, v = map(int, input().split())
    edge[u-1][0].append([v-1,1])
    edge[u-1][1].append([v-1,2])
    edge[u-1][2].append([v-1,0])
  d = [[-1]*3 for _ in range(N)]
  S, T = map(int, input().split())
  d[S-1][0] = 0
  que = [[S-1, 0]]
  while len(que)>0:
    now = que.pop(0)
    for nex in edge[now[0]][now[1]]:
      if d[nex[0]][nex[1]] != -1:continue
      d[nex[0]][nex[1]] = d[now[0]][now[1]]
      if now[1] == 2:
        d[nex[0]][nex[1]] += 1
      que.append(nex)
  print(d[T-1][0])
  
if __name__ == "__main__":
  main()
### BUGGY CODE ###

# python3
# -*- coding: utf-8 -*-
import sys
import math
import bisect
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
lmtx = lambda h: [list(map(int, lmis())) for _ in range(h)]
sys.setrecursionlimit(1000000000)


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


# main
n = ii()
alist = lmis()

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


### FIXED CODE ###

# python3
# -*- coding: utf-8 -*-
import sys
import math
import bisect
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
lmtx = lambda h: [list(map(int, lmis())) for _ in range(h)]
sys.setrecursionlimit(1000000000)


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


# main
n = ii()
alist = lmis()

jlist = [0] * (n+1)

for i in range(n-1):
    jlist[alist[i]] += 1

for j in jlist[1:]:
    print(j)
### BUGGY CODE ###

buf = input().split()
N = int(buf[0])
M = int(buf[1])
Q = int(buf[2])
import numpy as np
train = np.zeros((N+1, N+1))
for i in range(M):
	buf = input().split()
	L = int(buf[0])
	R = int(buf[1])
	a = np.ones((N-L+1, N-R+1))
	b = np.zeros((N-L+1, R))
	c = np.zeros((L, N+1))
	d = np.concatenate((c, np.concatenate((b, a), axis=1)), axis=0)
	train += d
#print(train)
for i in range(Q):
	buf = input().split()
	p = int(buf[0])
	q = int(buf[1])
	r = train[q][q] - train[p-1][q] -train[q][p-1] + train[p-1][p-1]
	print(int(r))# your code goes here

### FIXED CODE ###

import numpy as np
N, M, Q = map(int, input().split())

train = np.zeros((N, N))
for i in range(M):
	L, R = map(int, input().split())
	train[N-L][R-1] += 1
train = np.cumsum(np.cumsum(train, axis=0), axis=1)

for _ in range(Q):
	p, q = map(int, input().split())
	print(int(train[N-p][q-1]))
### BUGGY CODE ###

import copy, itertools

N, M, R = map(int, input().split())
r = [x-1 for x in list(map(int, input().split()))]

way_cost = [[float('inf')]*N for _ in range(N)]

for idx in range(N):
    way_cost[idx][idx] = 0

for _ in range(M):
    a, b, c = map(int, input().split())
    way_cost[a-1][b-1] = c
    way_cost[b-1][a-1] = c

# ワーシャルフロイド法で全ての街同士の最短距離を求める
shortest_path_cost = copy.deepcopy(way_cost)
for between_point in range(N):
    for start_point in range(N):
        for end_point in range(N):
            shortest_path_cost[start_point][end_point] \
            = min(shortest_path_cost[start_point][end_point], \
            shortest_path_cost[start_point][between_point]+shortest_path_cost[between_point][end_point])

# 巡回ルートを総当りで調べ、最小コストを出力する
route_list = list(itertools.permutations(r))

for route in route_list:
    route_list.remove(route[::-1])

ans = float('inf')
for route in route_list:
    cost = 0
    for idx in range(R-1):
        cost += shortest_path_cost[route[idx]][route[idx+1]]
        if cost >= ans:
            break
    ans = min(ans,cost)

print(ans)

### FIXED CODE ###

import copy, itertools
from scipy.sparse.csgraph import floyd_warshall

N, M, R = map(int, input().split())
r = [x-1 for x in list(map(int, input().split()))]

way_cost = [[float('inf')]*N for _ in range(N)]

for idx in range(N):
    way_cost[idx][idx] = 0

for _ in range(M):
    a, b, c = map(int, input().split())
    way_cost[a-1][b-1] = c
    way_cost[b-1][a-1] = c

# ワーシャルフロイド法で全ての街同士の最短距離を求める
shortest_path_cost = floyd_warshall(csgraph=way_cost, directed=False)

# 巡回ルートを総当りで調べ、最小コストを出力する
route_list = list(itertools.permutations(r))

ans = float('inf')
for route in route_list:
    cost = 0
    for idx in range(R-1):
        cost += shortest_path_cost[route[idx]][route[idx+1]]
    ans = min(ans,cost)

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

import random
import math

def is_prime(x):
    if x < 2:
        return False
    if x == 2 or x == 3 or x == 5:
        return True
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0:
        return False
    
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True

# スペース区切りの整数の入力
Q = int(input())

for i in range(Q):
    l, r = map(int, input().split())
    ans = 0
    
    for num in range(l, r+1, 2):
        if is_prime(num) and is_prime((num + 1)//2):
            ans += 1
    
    print(ans)

### FIXED CODE ###

def sieve_of_eratosthenes(ub):
    # O(n loglog n) implementation.
    # returns prime numbers <= ub.
    if ub < 2:
        return []
    prime = [True]*(ub+1)
    prime[0] = False
    prime[1] = False
    p = 2
    while p*p <= ub:
        if prime[p]:
            # don't need to check p+1 ~ p^2-1 (they've already been checked).
            for i in range(p*p, ub+1, p):
                prime[i] = False
        p += 1
    return prime

Q = int(input())
primes = sieve_of_eratosthenes(10**5)
cum_sum = [0]*(10**5+1)
for i in range(1, 10**5+1):
    if primes[i] and primes[(i+1) // 2]:
        cum_sum[i] = cum_sum[i-1] + 1
    else:
        cum_sum[i] = cum_sum[i-1]

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

def comb(n, r, p):
    x = 1
    for i in range(1, r + 1):
        x *= (n - i + 1) * pow(i, p - 2, p) % p
    return x % p

X, Y = map(int, input().split())
a = (2*X - Y)/3
b = (2*Y - X)/3
 
if (X+Y)%3 != 0:
    ans = 0
 
elif a<0 or b<0:
    ans = 0
 
else:
    ans = comb(int(a + b), int(a), 10**9 + 7)
print(ans)

### FIXED CODE ###

X, Y = map(int, input().split())

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


a = (2*X - Y)/3
b = (2*Y - X)/3

if (X+Y)%3 != 0:
    ans = 0

elif a<0 or b<0:
    ans = 0

else:
    ans = cmb(int(a + b), int(a), 10**9 + 7)

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

def main():
  
  n,w=map(int,input().split())
  item=[[0,0]]+[list(map(int,input().split())) for _ in range(n)]
  DP=[[0]*(w+1) for _ in range(n+1)]
  for i in range(n+1):
    weight=item[i][0]
    value=item[i][1]
    for j in range(w+1):
      if j<weight:
        DP[i][j]=DP[i-1][j]
      else:
        DP[i][j]=max(DP[i-1][j],DP[i-1][j-weight]+value)
        
  print(DP[n][w])
      
if __name__=="__main__":
  main()

### FIXED CODE ###

n,w=map(int,input().split())
goods=[list(map(int,input().split())) for _ in range(n)]
DP=[[0]*(w+1) for _ in range(n+1)]
for i in list(range(n))[::-1]:
  wi,vi=goods[i][0],goods[i][1]
  for j in range(w+1):
    if j<wi:
      DP[i][j]=DP[i+1][j]
    else:
      DP[i][j]=max(DP[i+1][j],DP[i+1][j-wi]+vi)
print(DP[0][w])
### BUGGY CODE ###

def resolve():
    n = int(input())
    a = tuple(map(int,input().split()))
    ans = [a.index(i+1)+1 for i in range(n)]
    print(' '.join(map(str,ans)))
resolve()

### FIXED CODE ###

def resolve():
    n = int(input())
    a = tuple(map(int,input().split()))
    attend = [0]*n
    for i,j in enumerate(a):
        attend[j-1] = i+1
    print(*attend)
resolve()
### BUGGY CODE ###

s = input()
S = len(s)

mod = 10**9+7

#全ての余りを確認する
dp = [[0 for i in range(13)]for j in range(S)]

if s[0] == "?":
    for i in range(10):
        dp[0][i%13] += 1
else:
    dp[0][int(s[0])%13] += 1

for i in range(1,S):
    if s[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i][(10*k+j)%13] += dp[i-1][k]
    else:
        for k in range(13):
            dp[i][(10*k+int(s[i]))%13] += dp[i-1][k]

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

### FIXED CODE ###

s = input()
S = len(s)

mod = 10**9+7

#全ての余りを確認する
dp = [[0 for i in range(13)]for j in range(S)]

if s[0] == "?":
    for i in range(10):
        dp[0][i%13] += 1
else:
    dp[0][int(s[0])%13] += 1

for i in range(1,S):
    if s[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i][(10*k+j)%13] += dp[i-1][k]%mod
    else:
        for k in range(13):
            dp[i][(10*k+int(s[i]))%13] += dp[i-1][k]%mod
            
print(dp[-1][5]%mod)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        # 親の番号 根なら要素数(負の数)

    def find(self, x):
        """木の根を求める"""
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
        """xとyの属する集合を併合"""
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        """xとyが同じ集合に属するか否か"""
        return self.find(x) == self.find(y)

    def size(self, x):
        """グループのサイズを返す"""
        return -self.parents[self.find(x)]

N, M, K = map(int, input().split())

l = [[False] * N for _ in range(N)]
pena = [0] * N

uf = UnionFind(N)
for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    uf.unite(A, B)
    l[A][B] = True
    l[B][A] = True
    pena[A] += 1
    pena[B] += 1

for _ in range(K):
    C, D = map(int, input().split())
    C -= 1
    D -= 1
    if not l[C][D] and uf.same(C, D):
        pena[C] += 1
        pena[D] += 1

ans = [0] * N

for i in range(N):
    ans[i] = uf.size(i) - pena[i] - 1

print(*ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        # 親の番号 根なら要素数(負の数)

    def find(self, x):
        """木の根を求める"""
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
        """xとyの属する集合を併合"""
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        """xとyが同じ集合に属するか否か"""
        return self.find(x) == self.find(y)

    def size(self, x):
        """グループのサイズを返す"""
        return -self.parents[self.find(x)]

N, M, K = map(int, input().split())

uf = UnionFind(N)
ans = [0] * N
for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    uf.unite(A, B)
    ans[A] -= 1
    ans[B] -= 1

for i in range(N):
    ans[i] += uf.size(i) - 1

for _ in range(K):
    C, D = map(int, input().split())
    C -= 1
    D -= 1
    if uf.same(C, D):
        ans[C] -= 1
        ans[D] -= 1

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

N, K = map(int, input().split())
hs = list(map(int, input().split()))
cs = [0]
for i in range(1, N):
  ccs = []
  for j in range(1, min(i, K)+1):
    c = cs[i-j]+abs(hs[i]-hs[i-j])
    ccs.append(c)
  c = min(ccs)
  cs.append(c)
r = cs[-1]
print(r)


### FIXED CODE ###

N, K = map(int, input().split())
hs = list(map(int, input().split()))
cs = [0]
for i in range(1, N):
  ccs = []
  for j in range(1, min(i, K)+1):
    c = cs[i-j]+abs(hs[i]-hs[i-j])
    ccs.append(c)
  c = min(ccs)
  cs.append(c)
r = cs[-1]
print(r)
### BUGGY CODE ###

n, k = map(int, input().split())
a_l = list(map(int, input().split())
)
import sys
def g():
    m_l = [0] * (n+1)

    r = 0
    for a in a_l:
        if m_l[a] == 0: r += 1
        m_l[a] += 1

    if r <= k:
        print(0)
        sys.exit(0)

    mn = 0
    
    while True:
        mm = min(i for i in m_l if i > 0)

        for i in range(n+1):
            if mm == m_l[i]:
                mn += mm
                r -= 1
                m_l[i] = 0

                if r <= k: return mn
        
print(g())


### FIXED CODE ###

n, k = map(int, input().split())
a_l = list(map(int, input().split()))
           
import sys
import numpy as np

def g():
    m_l = np.array([0]*(n+1))

    r = 0
    for a in a_l:
        if m_l[a] == 0: r += 1
        m_l[a] += 1

    if r <= k:
        print(0)
        sys.exit(0)

    mn = 0
    while True:
        ma = np.ma.masked_equal(m_l, 0, copy=False)
        a = np.where(m_l == ma.min())[0]

        for i in a:
            mn += m_l[i]
            r -= 1
            m_l[i] = 0

            if r <= k: return mn
        
print(g())