peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
l,r = map(int,input().split())

ans = 2018
if r - l >= 2019:
    ans = 0
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            temp = (i*j) % 2019
            if ans > temp:
                ans = temp

print(ans)
# Judge status: Accepted
n = int(input())
s = input()

r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')

ans = r_cnt * g_cnt * b_cnt

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1

print(ans)
# Judge status: Accepted
from math import floor as fl

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

for i in range(10000):
    if fl(i * 8 / 100) == A and fl(i / 10) == B:
        print(i)
        break
else:
    print(-1)
# Judge status: Accepted
import sys
N = int(input())
BA = []
for _ in range(N):
    a, b = map(int, input().split())
    BA.append([b, a])
BA.sort()
time=0
for i in range(N):
    time+=BA[i][1]
    
    if time>BA[i][0]:
        print("No")
        sys.exit()
print("Yes")
# Judge status: Accepted
k,x = map(int,input().split())
a = []
for i in range(x-k+1,x+k):
    a.append(i)
print(*a)
# Judge status: Wrong Answer
X, K, D = map(int, input().split())

cnt = X // D
ans1 = X - cnt * D
ans2 = abs(ans1 - D)

if cnt < K:
  if (K - cnt)%2 == 0:
    print(ans1)
  else:
    print(ans2)
else:
  if X >= 0:
    print(X - K * D)
  else:
    print(X + K * D)
# Judge status: Wrong Answer
A,B,K = map(int,input().split())

ans =[]
for i in range(1,100):
  if A%i == 0 and B%i == 0:
    ans.append(i)

print(ans[K-1])
# Judge status: Accepted
import collections as ct
n = int(input())
s_c = ct.Counter([input() for i in range(n)])
m = int(input())
t_c = ct.defaultdict(int, ct.Counter([input() for i in range(m)]))
ans = max([s_c[k] - t_c[k] for k in s_c])
print(max(ans, 0))
# Judge status: Accepted
# 2020/07/01
# AtCoder Beginner Contest 149 - C

# Input
x = int(input())
slist = [0] * 100005

for i in range(2, 100000):
    if slist[i] == 0:
        j = i + i
        while(j < 100004):
            slist[j] = 1
            j = j + i

sidx = x
while(x < 100004):
    if slist[x] == 0:
        ans = x
        break
    x = x + 1

# Output
print(ans)
# Judge status: Accepted
x,y = map(int,input().split())
mod = 10**9 + 7

move = x+y
if move %3 !=0:
  print(0)
  exit()
move //= 3
  
x,y = x-move, y-move

if x < 0 or y < 0:
  print(0)
  exit()
  
ans = 1
for i in range(min(x,y)):
  ans *= (x+y-i)
  ans *= pow(i+1,mod-2,mod)
  ans %= mod
print(ans)
# Judge status: Wrong Answer
N, x = [int(i) for i in input().split(" ")]
lst = [int(i) for i in input().split(" ")]

lst.sort(reverse = True)
cnt = 0

for i in range(0,N):
  if x >= lst[i]:
    x -= lst[i]
    cnt += 1
  else:
    break
    
print(cnt)
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 10:13:10 2020

@author: Kanaru Sato
"""

N = int(input())
H = list(map(int, input().split()))
record = 0
count = 0

for i in range(0,N-1):
    if H[i] >= H[i+1]:
        count += 1
    else:
        record = max(count,record)
        count = 0

ans = max(record,count)

print(ans)
# Judge status: Wrong Answer
N = int(input())
num = [1, 2, 3, 4, 5, 6, 7, 8, 9]
x = 0
for i in range(8):
  if N/(9-i) in num:
    x += 1
  else:
    x += 0
    
if x!= 0:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
from collections import Counter
s = Counter(input())
t = Counter(input())

if len(s) != len(t):
    print("No")
    exit()
for x,y in zip(s.values(), t.values()):
    if x != y:
        print("No")
        exit()
print("Yes")
# Judge status: Wrong Answer
N = int(input())
if N >= 105 and N % 2 == 1:
  print(1)
else:
  print(0)
# Judge status: Accepted
def get_ints():
    return list(map(int, input().split()))

n, m = get_ints()
digits = [-1 for i in range(n)]

for i in range(m):
    s, c = get_ints()
    s -= 1
    if digits[s] >= 0 and digits[s] != c:
        print(-1)
        exit(0)
    digits[s] = c

if digits[0] == 0:
    if n == 1:
        print(0)
    else:
        print(-1)
    exit(0)

if n > 1 and digits[0] == -1:
    digits[0] = 1

print(''.join(map(lambda x: str(max(0, x)), digits)))
# Judge status: Wrong Answer
n, k, q = map(int, input().split())
points = [k] * n
a = []
for i in range(q):
    a.append(int(input())-1)
for cand in a:
    points[cand] += 1
points = [i-q for i in points]
ans = ["YES" if i > 0 else "NO" for i in points]
print(*ans, sep="\n")
# Judge status: Wrong Answer
l = list (map (int, input().strip().split()))
for i in l:
    if i==0:
        print(i+1)
# Judge status: Accepted
N = int(input())
L = list(map(int,input().split()))
P = round(sum(L) / N)
A = []
for i in L:
  x = (i - P)*(i-P)
  A.append(x)
print(sum(A))
# Judge status: Accepted
N = int(input())
S = list(input())

print("".join(chr(65+(ord(s)-65+N)%26) for s in S))
# Judge status: Accepted
n,m=map(int,input().split())
if n*2>m:
    print(m//2)
else:
    print(n+(m-n*2)//4)
# Judge status: Accepted
S = input()
res = 0

for i in range((len(S)//2)):
    if S[i] != S[len(S)-i-1]:
        res += 1

print(res)
# Judge status: Accepted
n,c,k=map(int,input().split())
T=[int(input()) for i in range(n)]
T.sort()
ans=0; now=0; nowc=0
for  ii in range(n):
    if now>=T[ii] and nowc<c: nowc+=1; continue
    now=T[ii]+k
    nowc=1
    ans+=1
print(ans)
# Judge status: Accepted
from sys import exit

N = int(input())

for i in input().split():
    if int(i) % 2 == 0:
        if int(i) % 3 != 0 and int(i) % 5 != 0:
            print('DENIED')
            exit()

print('APPROVED')
# Judge status: Wrong Answer
# 問題文
# シカのAtCoDeerくんは二つの正整数 a,bを見つけました。
# aとbの積が偶数か奇数か判定してください。

# 制約
# 1 <= a,b <= 10000
# a,bは整数


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

# 積が奇数なら、0dd と偶数なら Even と出力

if a * b % 2 == 0:
    print('Even')
else:
    print('0dd')
# Judge status: Wrong Answer
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

def main():
	x=II()
	q,r=divmod(x,11)

	ans=2*q+1+(r>6)

	print(ans)


if __name__ == "__main__":
	main()
# Judge status: Wrong Answer
N = int(input())
rate = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
p = [0] * 9

A = [int(a) for a in input().split(" ")]
A.sort()

j = 0
for i in range(len(A)):
  while j < 8:
    if rate[j] <= A[i] < rate[j + 1]:
      p[j] = 1
      break
    else:
      j += 1
  if j == 8:
    p[8] = len(A[i:])
    break

print(str(sum(p[:8])) + " " + str(sum(p)))
# Judge status: Accepted
n=int(input())
import math
l= n-1
for i in range (1,int(math.sqrt(n))+1):
  if n % i ==0 and i+ n/i -2<l:
    l = i + n/i -2
print(int(l))
# Judge status: Wrong Answer
a=input()
b=input()
c=b.split()
d=map(int,c)
main=list(d)
sum=0
print(main)
for i in range(len(main)-2):
    stool=main[i]-main[i+1]
    if stool>0:
        main[i+1]+=stool
        sum+=stool

stool=main[len(main)-2]-main[len(main)-1]
if stool>0:
    sum+=stool
    main[len(main)-1]+=stool

print(sum)
# Judge status: Accepted
D = int(input())

if D == 25:
    print("Christmas")
if D == 24:
    print("Christmas Eve")
if D == 23:
    print("Christmas Eve Eve")
if D == 22:
    print("Christmas Eve Eve Eve")
# Judge status: Wrong Answer
N, M = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(N)]
c = [list(map(int, input().split())) for _ in range(M)]
for i in range(N):
    m = 0
    for j in range(M):
        if abs(s[i][0]-c[m][0]) + abs(s[i][1]-c[m][1]) > abs(s[i][0]-c[j][0]) + abs(s[i][1]-c[j][1]):
            m = j
    print(j+1)
# Judge status: Wrong Answer
a,b = map(int, input().split())

if a<5:
    print(0)
elif  6<=a<13:
    print(int(b/2))
elif a>=13:
    print(int(b))
# Judge status: Accepted
N,K=map(int,(input().split()))
li=[]
m=set(input())
for j in range(N,100000):
    if len(set(m & set(str(j))))==0:
        print(j)
        break
# Judge status: Accepted
N, K = map(int, input().split())
*A, = map(int, input().split())

def f(t):
    if t!=0:
        c = 0
        for i in A:
            c += i//t if i!=t else 0
        return c<=K
    else:
        return all(i<=t for i in A)

left, right = -1, 10**10
while right-left>1:
    m = (right+left)//2
    if f(m):
        right = m
    else:
        left = m

print(right)
# Judge status: Accepted
S=list(input())
s=S[:4]+S[5:7]+S[8:]
print("Heisei" if int(''.join(s))<=20190430 else "TBD")
# Judge status: Accepted
n,m=map(int, input().split())

a = [(int(i)) for i in range(m, m+n)]
t=100000
ne = False
for i in range(len(a)):
    if t>abs(a[i]):
        inde = i
        t=abs(a[i])
a[inde]=0
print(sum(a))
# Judge status: Accepted
#!/usr/bin/env python

def main():
    s = input() + "#"
    t = input()
    m = len(s)
    n = len(t)

    c_max = 0
    for i in range(m-n):
        cnt = 0
        for j in range(n):
            if s[i+j] == t[j]:
                cnt += 1
        if cnt > c_max:
            c_max = cnt

    print(n - c_max)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
ans=0
ans+=9 if n>=10 else n
ans+=900 if n>=1000 else max(n-99,0)
ans+=90000 if n>=100000 else max(n-9999,0)
print(ans)
# Judge status: Wrong Answer
a = int(input());b = int(input());c = int(input());x = int(input())
s = 0
n = 0
counter = 0

for i in range(a):
  for j in range(b):
    for k in range(c):
      s = 500*i + 100*j + 50*k
      if s == x:
        counter += 1
      
for s in range(c):
  for t in range(b):
    for u in range(a):
      n = 50*s + 100*t + 500*u
      if n == x:
        counter += 1
        
print(counter)
# Judge status: Wrong Answer
s = input().split()
print(len(set(s))-1)
# Judge status: Accepted
def tc(arr):
    tn = arr[0]/arr[2]
    return "Yes" if tn<=arr[1] else "No"





u = list(map(int, input().split()))
print(tc(u))
# Judge status: Accepted
n = int(input())
sum_i = 0  # 問題のインデックスの合計
i = 0
while sum_i < n:
    i += 1
    sum_i += i
for ans in range(1, i+1):
    if ans == sum_i - n:
        continue
    print(ans)
# Judge status: Wrong Answer
a, b, c, d = map(int,input().split())

if abs(a -c) <= d:
    print("Yes")
elif abs(a - b) <= d and (b - c) <= d:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
H_1, M_1, H_2, M_2, K = map(int, input().split())

H_ = H_2 * 60 + M_2 - K
H = H_ - (H_1*60+M_2)
print(H)
# Judge status: Accepted
k = int(input())
if k==1 or k==7:
  print(1)
elif k%2==0:
  print(-1)
else:
  cnt = 1
  pre = 7
  while(True):
    surp = (pre*10+7)%k
    cnt += 1
    if surp==0:
      break
    if cnt>1000000:
      cnt = -1
      break
    pre = surp
  print(cnt)
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

B = [(a, i + 1) for i, a in enumerate(A)]
B.sort()

ans = [j for _, j in B]

print(*ans)
# Judge status: Accepted
n = int(input())
res = 10 ** 15
for i in range(1, int(n ** .5) + 1):
    if n % i == 0:
        j = n // i
        res = min(res, i + j - 2)
print(res)
# Judge status: Accepted
s = input()
K = int(input())

for i in range(len(s)-1):
    z2a = (ord('z') + 1 - ord(s[i])) % 26
    if z2a <= K:
        s = s[:i] + 'a' + s[i+1:]
        K -= z2a

print(s[:len(s)-1] + chr(((ord(s[len(s)-1]) - ord('a')) + K % 26) % 26 + ord('a')))
# Judge status: Accepted
n,d = map(int, input().split())
if n % (2*d+1) == 0:
    print(n // (2*d+1))
else:
    print(n // (2*d+1) + 1)
# Judge status: Accepted
import sys

num = sys.stdin.readline().split(' ')
N = int(num[0])
Y = int(num[1])


for x in range(N+1):
    for y in range(N+1):
        if 10000 * x + 5000 * y + 1000*(N-x-y) == Y and N-x-y >= 0:
            print(str(x)+' '+str(y)+' '+str(N-x-y))
            sys.exit()
        else:
            continue

print('-1 -1 -1')
# Judge status: Accepted
import bisect

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

a.sort()

idx = bisect.bisect_left(a,a[-1]/2)

if idx == 0:
    print(a[-1],a[idx])
else:
    x,y = a[idx-1],a[idx]
    if y - a[-1]/2 < a[-1]/2 - x:
        print(a[-1],y)
    else:
        print(a[-1],x)
# Judge status: Accepted
s = input()
s = list(s)
t = input()
t = list(t)

l = []
for i in range(len(s)-len(t)+1) :
    moji = s[i]
    for j in range(len(t)-1) :
        moji += s[i+j+1]
    l.append(moji)
    moji = ""
c = 0
ans = 1000
for i in range(len(l)):
    c = 0
    for j in range(len(t)):
        if l[i][j] != t[j] :
            c += 1
    if ans > c :
        ans = c
print(ans)
# Judge status: Accepted
n=int(input())
s=input()

ans=s.count("R")*s.count("G")*s.count("B")

for i in range(n):
    for j in range(n):
        k=i+j
        l=k+j
        if l >= n:
            break
        if s[i]!=s[k] and s[k]!=s[l] and s[l]!=s[i]:
            ans -= 1

print(ans)
# Judge status: Accepted
a = list(map(int, input().split()))

if a.count(5) == 2 and a.count(7) == 1:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
def main():
    X = int(input())
    A = 1
    B = 0
    while A <= 100:
        for B in range(A-1, A*(-1)-1, -1):    
            x = A ** 5 - B ** 5
            # print(A, B, x)
            if x == X:
                print(A, B, sep=" ")
                return
        # break
        A += 1

if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if k < n:
  print(k*x+(n-k)*y)
else:
  print(n*x)
# Judge status: Accepted
w, a, b = map(int, input().split())

if b+w < a:
    print(a-b-w)
elif a+w < b:
    print(b-a-w)
else:
    print(0)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()
ans = 0
i = 0

while i<N:
    lim = T[i]+K
    ans += 1
    cnt = 0
    
    while i<N and cnt<C and T[i]<lim:
        i += 1
        cnt += 1
        
print(ans)
# Judge status: Wrong Answer
target = input().split()
target = [int(i) for i in target]
arr = input().split()
arr = [int(i) for i in arr]

if len(arr)==0:
  print(target[0])
else:
  i=0
  while(1):
    if target[0]-i in arr:
      i+=1
    else:
      print(target[0]-i)
      break
# Judge status: Accepted
S=input()
N=len(S)
if N%2==0:
    T0=S[:N//2]+S[:N//2][::-1]
    T1=S[::-1][:N//2]+S[::-1][:N//2][::-1]
else:
    T0=S[:N//2]+S[N//2]+S[:N//2][::-1]
    T1=S[::-1][:N//2]+S[N//2]+S[::-1][:N//2][::-1]
count0=0
count1=0
for n in range(N):
    if S[n]!=T0[n]:
        count0+=1
    if S[n]!=T1[n]:
        count1+=1
print(min(count0,count1))
# Judge status: Accepted
import sys
import math
import bisect

def main():
    n, m = map(int, input().split())
    if n < 10:
        m += 100 * (10 - n)
    print(m)

if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m = map(int,input().split())
ls_a = list(map(int,input().split()))

days = n - sum(ls_a)
if days < 0:
    print(-1)
else:
    print(days)
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))

def f():
    global h
    for i in range(n - 1, 0, -1):
        diff = h[i - 1] - h[i]
        
        if diff >= 2:
            return 'No'
        elif diff == 1:
            h[i - 1] = h[i - 1] - 1
    
    return 'Yes'

print(f())
# Judge status: Wrong Answer
n=int(input())
if n%4==0:
    print("Yes")
elif (n-4*(n//4))%7==0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N=int(input())
A = [int(x) for x in input().split()]
x=1
flg=0
for i in range(N):
  x=x*A[i]
  if x>10**18:
    flg=1
    break
if flg==1:
  print(-1)
else:
  print(x)
"""
3
101 9901 999999000001
"""
# Judge status: Wrong Answer
s = input()
end = []
for i in s:
    if (end.count(i)==0):
        end.append(i)
    else:
        print("no")
        exit()
print("Yes")
# Judge status: Accepted
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


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


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():

    c = input()

    print(chr(ord(c) + 1))


main()
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

INF = 10 ** 10

n = int(input())
h = [0] + list(map(int, input().split()))
dp = [INF] + [INF] * n
dp[1] = 0

def chmin(dp_table, index, value):
    if dp_table[index] > value:
        dp_table[index] = value

for i in range(2, n+1):
    chmin(dp, i, dp[i-1] + abs(h[i] - h[i-1]))
    chmin(dp, i, dp[i-2] + abs(h[i] - h[i-2]))

print(dp[n])
# Judge status: Accepted
A, B = map(int, input().split())

if A <= 8 and B <= 8:
    print('Yay!')
else:
    print(':(')
# Judge status: Accepted
a,b = map(int,input().split())
print(max(a+a-1,a+b,b+b-1))
# Judge status: Wrong Answer
N = int(input())
S = input()

right_white = S.count(".")
left_black = 0

ans = float("inf")
for i in range(N):
    if S[i] == ".":
        right_white -= 1
    else:
        left_black += 1
    ans = min(ans, right_white+left_black)

print(ans)
# Judge status: Accepted
S=input()
sn = "N" in S
se = "E" in S
ss = "S" in S
sw = "W" in S
if (sn==ss) and (se==sw):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a,b=map(int,input().split())
if a<b:
    ct=b
    b-=1
else :
    ct=a
    a-=1
if a<b:
    ct+=b
else:
    ct+=a
print(ct)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
lis = [0]*n
for i in range(n-1):
    if a[i] > a[i+1]:
        lis[i] = -1
b = a[::-1]
for i in range(n-1):
    if b[i] < b[i+1]:
        lis[i] = 1
lis[-1] = -1
m = 1000
k = 0
for i in range(n):
    if lis[i] == 1:
        k += m//a[i]
        m = m%a[i]
    elif lis[i] == -1:
        m += k*a[i]
        k = 0
print(m)
# Judge status: Wrong Answer
a, b = map(int, input().split())

print(a)
print(b)

answer = a * b

print(answer)
# Judge status: Accepted
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(D)]
lastday=[0 for j in range(26)]
points=[0 for i in range(D)]
t=[0 for i in range(D)]

# first day
lastday=[lastday[i]+1 for i in range(26)]
firstday=s[0].index(max(s[0]))
lastday[firstday]=0
t[0]=firstday+1

for days in range(1,D):
    temp=[s[days][i]-c[i]*lastday[i] for i in range(26)]
    today=temp.index(min(temp))
    lastday=[lastday[i]+1 for i in range(26)]
    lastday[today]=0
    t[days]=today+1

for ts in t:
    print(ts)
# Judge status: Wrong Answer
n = int(input())
s = list(input() for i in range(n))

ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
    if s[i] == "AC":
        ac+=1
    elif s[i] == "WA":
        wa += 1
    elif s[i] == "TLE":
        tle += 1
    else:
        re += 1

print("AC ×", str(ac))
print("WA ×",str(wa))
print("TLE ×",str(tle))
print("RE ×",str(re))
# Judge status: Accepted
Q, H, S, D = map(int, input().split())
N = int(input())
S = min(S, 4*Q, 2*H)
D = min(D, 2*S)
print(D*(N//2) if N % 2 == 0 else D*(N//2) + S)
# Judge status: Accepted
S, W = map(int, input().split())
if S <= W:
  print('unsafe')
else:
  print('safe')
# Judge status: Wrong Answer
n = int(input())
s = input()
e = s.count("E")
w = n - e
ans = 10**9
if s[0] == "W":
    cnt = e
else:
    cnt = w
num = cnt
for i in range(n-1):
    if s[i] == s[i+1] and s[i] == "E":
        cnt -= 1
    elif s[i] == s[i+1]:
        cnt += 1
    #print(i,cnt)
    ans = min(ans,cnt,num)
    ans = max(ans,0)
print(max(ans,0))
# Judge status: Accepted
num = list(map(int, input().split()))
ans = 1000
for i in range(3):
  t = num[i-1] + num[i]
  ans = min(t, ans)
print(ans)
# Judge status: Wrong Answer
N,M=map(int,input().split())
P=[[] for i in range(N+1)]
for i in range(M):
  a,b=map(int,input().split())
  P[a].append(b)
  P[b].append(a)
#AB=[list(map(int,input().split())) for i in range(M)]
ans=[0]*N
con=set()
now=[1]
while now!=[]:
  _now=[]
  for n in now:
    for p in P[n]:
      if p in con:
        continue
      ans[p-1]=n
      _now.append(p)
      con.add(p)
    #con.add(n)
  now=_now
print('yes')
for a in ans[1:]:
  print(a)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
out = "No"
SBA = sum(B)-sum(A)
if SBA>=0:
    cnt = 0
    for i in range(N):
        if A[i]<B[i]:
            cnt += (B[i]-A[i]+1)//2
    if cnt<=SBA:
        out = "Yes"
print(out)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

count = 1
num_count = 1
num_count_list = list()
for i in range(1, n):
    if(a[i] == a[i - 1]):
        num_count += 1
    else:
        num_count_list.append(num_count)
        num_count = 1
        count += 1

num_count_list.append(num_count)

num_count_list.sort()
result = 0
if(count > k):
    loop = count - k

    for i in range(loop):
        result += num_count_list[i]

print(result)
# Judge status: Accepted
a, b, c = map(int, input().split())
from fractions import gcd
if c % gcd(a, b) == 0:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
import math

def lcm(a, b):
    return (a * b) // math.gcd(a, b)
def div2(n):
    return bin(n)[::-1].find("1")

n, m = map(int, input().split())
a = list(map(int, input().split()))
ans = a[0]
count = div2(a[0])
for i in range(1, len(a)):
    if count != div2(a[i]):
        print(0)
        exit()
    ans = lcm(ans, a[i])
ans //= 2
print((m // ans + 1) // 2)
# Judge status: Accepted
INF = float('inf')
MAX_N = 110
MAX_W = 10**5 + 100

N, W = map(int, input().split())
w, v = [0]*N, [0]*N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = [[0]*MAX_W for _ in range(MAX_N)]

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

        dp[i][j] = max(dp[i][j], dp[i-1][j])

print(dp[N][W])
# Judge status: Wrong Answer
s = input()
l = s[:2]
r = s[2:]

if(int(l) <=12 and int(r) <= 12):
    print('AMBIGUOUS')
else :
    if(int(l) <= 12):
        print('MMYY')
    else:
        if(int(r) <= 12):
            print('YYMM')
        else:
            print('NA')
# Judge status: Accepted
X = int(input())
fif = [i**5 for i in range(200)]
for i in range(len(fif)):
    B5 = fif[i] - X
    if abs(B5) in fif:
        index = fif.index(abs(B5))
        B = B5//abs(B5) * index
        break

print(i, B)
# Judge status: Wrong Answer
N,M = list(map(int,input().split()))
l_n = input()
l_a = [0] * (N+1)
for i in range(N):
    l_a[i+1] = l_a[i] + (1 if l_n[i:i+2] == 'AC' else 0)
print(l_a)
for i in range(M):
    l,r = map(int,input().split())
    print(l_a[r-1]-l_a[l-1])
# Judge status: Accepted
import numpy as np
N,W = map(int,input().split())
w,v = [],[]
for i in range(N):
    a,b = map(int,input().split())
    w += [a]
    v += [b]
dp = np.zeros(W+1,dtype = int)
for i in range(N):
    dp[w[i]:] = np.maximum(dp[:-w[i]]+v[i],dp[w[i]:])
print(dp[-1])
# Judge status: Accepted
A, B, C = map(int, input().split())

if C -(A-B) > 0:
    print(C -(A-B))
else:
    print(0)
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
s = input()
print(len(s))
total_cnt = 0
b_cnt = 0
ans = ["No"]*n

for i in range(n):
    if total_cnt >= a+b:
        break
    if s[i] == "c":
        continue
    if s[i] == "a":
        total_cnt += 1
        ans[i] = "Yes"
    if s[i] == "b":
        b_cnt += 1
        if b_cnt <= b:
            ans[i] = "Yes"

for i in range(n):
    print(ans[i])
# Judge status: Wrong Answer
s=input()
a=int(s[:2])
b=int(s[2:])
if 1<=a<=12 and 1<=b<=12:
	print("AMBIGUOUS")
elif 1<=a<=12 and (12<b or b==0):
	print("MMYY")
elif (12<a or a==0) and 1<=b<=12:
	print("YYMM")
else:
	print("NA")
# Judge status: Accepted
N, M = map(int, input().split(" "))
A = list(map(int, input().split(" ")))
sum_votes = sum(A)
count = 0
for i in range(N):
    if not sum_votes > A[i] * 4 * M:
        count += 1
if count >= M:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
A, B, N = map(int, input().split())
x = B-1 if B-1 > N else N
print(A*x//B-A*(x//B))