peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
K, N = map(int, input().split())
A = list(map(int, input().split()))
long = A[0] + K - A[N-1]

for i in range(N-1):
    if long < A[i+1]-A[i]:
        long = A[i+1]-A[i]

print(K-long)
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
s=input()
cnt=0
for i in range(n):
    if s[i] == 'a' and cnt < a+b:
        print('Yes')
        cnt+=1
    elif s[i] == 'b' and cnt < a+b and cnt <=b:
        print('Yes')
        cnt+=1
    elif s[i] == 'c':
        print('No')
    else:
        print('No')
# Judge status: Accepted
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break
print(i)
# Judge status: Wrong Answer
S = input()
T = input()
cond = (1 <= len(S) <= 10) and len(S) == len(T) - 1
print('Yes' if cond else 'No')
# Judge status: Accepted
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
b = set(b)
g = [0]*9
for i in range(3):
  for j in range(3):
    if a[i][j] in b:
      g[i*3+j] = 1
for i,j,k in [[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6],[0,1,2],[3,4,5],[6,7,8]]:
  if g[i]==g[j]==g[k]==1:
    print('Yes')
    exit()
print('No')
# Judge status: Accepted
x,a=map(int,input().split())
y,b=map(int,input().split())
t=int(input())
if(abs(x-y)<=t*(a-b)):
    print('YES')
else:
    print("NO")
# Judge status: Accepted
def a753(x):

    return "YES" if x == 3 or x == 5 or x == 7 else "NO"

def main():
    x = int(input())
    print(a753(x))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
s = input()
print("Yes" if all(s.index(i) % 2 == 1 and i in "RUD" or s.index(i) % 2 == 0 and i in "LUD" for i in s) else "No")
# Judge status: Accepted
l,r=map(int,input().split())
ans = 2018
for i in range(l,r+1):
    for j in range(l,r+1):
        if i<j:
            ans = min(ans,(i*j)%2019)
            if ans == 0:
                print(0)
                exit()
print(ans)
# Judge status: Wrong Answer
#入力例は合うがWAになる

S = input()
T = input()

if [S[0],S[1],S[2]] == [T[2],T[1],T[0]]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
s = input()

sum_e = s.count("E")
sum_w = s.count("W")

cnt_e, cnt_w = 0, 0

ans = 10 ** 6
for x in s:
    if x == "E":
        cnt_e += 1
        ans = min(ans, cnt_w + (sum_e - cnt_e))
    if x == "W":
        ans = min(ans, cnt_w + (sum_e - cnt_e))
        cnt_w += 1

print(ans)
# Judge status: Accepted
s = input()
if s[-1] == 's':
  print(s+'es')
else:
  print(s+'s')
# Judge status: Accepted
import itertools

(N, M, Q) = [int(n) for n in input().split()]
reqs = []
for _ in range(Q):
    a, b, c, d = [int(n) for n in input().split()]
    a -= 1
    b -= 1
    reqs.append((a, b, c, d))

ans = 0

for A in itertools.combinations_with_replacement(range(1, M+1), N):
    score = 0
    for a, b, c, d in reqs:
        if A[b] - A[a] == c:
            score += d
    ans = max(score, ans)
    #print('A = {} score = {}'.format(A, score))
print(ans)
# Judge status: Accepted
import itertools
n=int(input())

jyunretu=[]
for i in range(1,n+1):
    jyunretu.append(str(i))
p = itertools.permutations(jyunretu, n)

jyunretulist=[]
for i in p:
    jyunretulist.append(list(i))
    
p=input().split()
q=input().split()

for i ,youso in enumerate(jyunretulist):
    if youso==p:
        a=i
    if youso==q:
        b=i
print(abs(a-b))
# Judge status: Wrong Answer
S=input()
T="keyence"
if S[:7]==T:
    print("YES")
    exit()
for i in range(len(S)-1):
    for j in range(i,len(S)-1):
        if S[:i]+S[j:]==T:
            print("YES")
            exit()
print("NO")
# Judge status: Wrong Answer
n, k, q = map(int,input().split())
a = [0 for i in range(n)]
for i in range(q):
  x = int(input())
  a[x-1] += 1
for i in range(n):
  print("Yes" if a[i] > k else "No")
# Judge status: Accepted
L,R,d=map(int,input().split())
print(R//d-(L-1)//d)
# Judge status: Accepted
N = int(input())
print((N+1)/N/2 if N%2==1 else 1/2)
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))
a_list=[0]*(n+1)
for i in a:
  a_list[i]+=1
ans1=[0]*(n+1)
ans2=[0]*(n+1)
for i,m in enumerate(a_list):
  if m>=2:
    ans1[i]=m*(m-1)//2
    ans2[i]=(m-2)*(m-1)//2
all=sum(ans1)
for i in a:
  print(all-ans1[i]+ans2[i])
# Judge status: Wrong Answer
w=input()
count1=0
for i in range(0,len(w)):
	a=w.count(w[i])
	if(a%2==0):
		count1+=1
	elif(a%2 != 0):
		count1-=1
		
if(count1>0):
	print("Yes")
elif(count1<0):
	print("No")
# Judge status: Accepted
a, b, c = map(int, input().split())
if a + b + c > 21:
    print("bust")
else:
    print("win")
# Judge status: Accepted
n,m=map(int,input().split())
a={}
s=[]
for i in range(m):
    p,y=map(int,input().split())
    if p not in a:
        a[p]=[]
    a[p].append(y)
    s.append((p,y))
b={}
for i in a.keys():
    a[i].sort()
    for j in range(len(a[i])):
        b[(i,a[i][j])]=j+1
for p,y in s:
    print(str(p).zfill(6)+str(b[(p,y)]).zfill(6))
# Judge status: Wrong Answer
a,b,c = map(int, input().split())

if 22 > a+b+c > 0:
  print("Win")
  
else :
  print("bust")
# Judge status: Accepted
a, b, c = input().split()

a, b = b, a
a, c = c, a

ans = (" ").join([a, b, c])
print(ans)
# Judge status: Wrong Answer
H, N = map(int,input().split())
A_list = list(map(int, input().split()))

judge = 'Yes' if sum(A_list)>H else 'No'

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

w = [0]*n
e = [0]*n
if s[0] == "W": w[0] = 1
else: e[0] = 1
for i in range(1,n):
  if s[i] == "W":
    w[i] = w[i-1]+1
    e[i] = e[i-1]
  else:
    w[i] = w[i-1]
    e[i] = e[i-1]+1

ans = float("inf")
for i in range(n):
  t = 0
  if i != 0: t += w[i-1]
  if i != n-1: t += e[-1] - e[i]
  if t < ans: ans = t
print(ans)
# Judge status: Accepted
S = input()

for i in range(ord('a'), ord('a') + 26):
    if chr(i) not in S:
        print(chr(i))
        break
else:
    print('None')
# Judge status: Accepted
import bisect

n = int(input())
a,b,c = [list(sorted(map(int, input().split())))  for _ in range(3)]

ans = 0
for i in range(n):
    x = bisect.bisect_left(a, b[i])
    y = len(c) - bisect.bisect_right(c, b[i])
    ans += x*y
print(ans)
# Judge status: Accepted
from math import pi

R = int(input())

print(2*R*pi)
# Judge status: Wrong Answer
N = int(input())

sum = 0

for i in range(N):
    if not (i%3 == 0 or i%5 == 0):
        sum += i

print(sum)
# Judge status: Wrong Answer
x = int(input())

i = 0
a = 100
while a < x:
  a += a/100
  i += 1
print(i)
# Judge status: Accepted
import math
H, A = [int(x) for x in input().split()]
print(math.ceil(H/A))
# Judge status: Wrong Answer
n,m = map(int,input().split())
li = list(map(int,input().split()))
tmp_li = []
for _ in range(m):
    b,c = map(int,input().split())
    tmp_li.append([c,b])
tmp_li.sort(reverse=True)
#print(tmp_li)
count = 0
for t in tmp_li:
    li += [t[0]]*t[1]
    count += t[1]
    if count + t[1]>=n:
        break
li.sort(reverse=True)
print(sum(li[:n]))
# Judge status: Accepted
import numpy as np

N, M, X = [int(x) for x in input().split()]
books = []
ans = 10 ** 7
for i in range(N):
  books.append([int(x) for x in input().split()])
books = np.array(books)
for i in range(1,2**N):
  t = np.array([0]*(M+1))
  for j in range(N):
    if i & 1 == 1:
      t = t + books[j]
    i = i >> 1
  s = min(t[1:])
  if min(t[1:]) >= X:
    if t[0] < ans:
      ans = t[0]
  #print(ans)
if ans == 10 ** 7:
  print(-1)
else:
  print(ans)
# Judge status: Accepted
s = input()
n = len(s)
print("x"*n)
# Judge status: Wrong Answer
n, m = map(int, input().split())
py = [list(map(int, input().split())) for i in range(m)]
py.sort(key=lambda x: x[1])
now = py[0][0]
count = 0
for i in range(m):
    if now == py[i][0]:
        count += 1
    else:
        now = py[i][0]
        count = 1
    print("{:04}".format(py[i][0]) + "{:04}".format(count))
# Judge status: Wrong Answer
cat, unknown, guess = map(int, input().split())
if guess > cat:
    if cat + unknown < guess:
        print('NO')
    else:
        print('YES')
else:
    if guess + unknown > cat:
        print('NO')
    else:
        print('YES')
# Judge status: Wrong Answer

c=input()

if c =="a"or"i"or"u"or"e"or"o":
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
a, b = map(int, input().split())

val = [0] * 1000
for i in range(1, 1000):
    val[i] = val[i - 1] + i

n = b - a - 1
ans = val[n] - a
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
if n == 1:
    if m == 1:
        ans = 1
    else:
        ans = m - 2
elif m == 1:
    ans = n - 2
else:
    ans = (n - 2)*(m - 2)
print(ans)
# Judge status: Accepted
import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

N = int(input())
A = np.array(input().split(), np.int)
#print(A)

cnt = 0
for i in range(61):
    B = (A>>i)&1
    z = np.count_nonzero(B)
    cnt += z*(N-z)*(2**(i))
    cnt %= MOD

print(cnt)
# Judge status: Accepted
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

A.sort()

ans = max(A)
for i in range(N-1):
    ans = min(ans, gcd(A[i], A[i+1]))

print(ans)
# Judge status: Wrong Answer
n = int(input())

print(n*3.14)
# Judge status: Wrong Answer
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
print("YNeos"[sum([sum(a)/(4*m)>=a[i] for i in range(m)])==m::2])
# Judge status: Accepted
n=int(input())
ans=""

if n==0:print(0);exit()
while n!=0:
    ans +=str(n%2)
    n=-(n//2)

print(ans[::-1])
# Judge status: Accepted
SD=list(input())
T=list(input())

for i in reversed(range(len(SD)-len(T)+1)):
  #print(SD[i:i+len(T)])
  for j in range(len(T)):    
    if SD[i+j]!="?" and SD[i+j]!=T[j]:
      break
  else:
    for j in range(len(T)):
      if SD[i+j]=="?":
        SD[i+j]=T[j]
    for j in range(len(SD)):
      if SD[j]=="?":
        SD[j]="a"
    print("".join(SD))
    break
else:
  print("UNRESTORABLE")
# Judge status: Accepted
import math
a,b = map(int,input().split())
x = (a + b)/2
print(math.ceil(x))
# Judge status: Accepted
n = int(input())
s = input()
ss = s
while ss.count('()'):
    ss = ss.replace('()', '')
left, right = ss.count('('), ss.count(')')
print('(' * right + s + ')' * left)
# Judge status: Accepted
N = int(input())
d = sorted(map(int, input().split()))
length = len(d)

print(
    0 if length % 2 == 1 else d[length//2] - d[length//2 - 1]
)
# Judge status: Wrong Answer
n = int(input())

dic = {}
for i in range(1,50000):
    dic[int(i * 1.08)] = i
print(dic)

if n in dic:
    print(dic[n])
else:
    print(':(')
# Judge status: Accepted
N = int(input())
L = sorted([int(x) for x in input().split()])

ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue
            if L[k] < L[i] + L[j]:
                ans += 1

print(ans)
# Judge status: Accepted
N = input()

ans = 0
for n in N:
    ans = (ans + int(n)) % 9
if ans == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
A=[0]*N; B=[0]*N;
for i in range(N):
  A[i]=int(input())
  B[i]=A[i]
B.sort(reverse=True)
for j in range(N):
  if A[j]==B[0] :
    print(B[1])
  else :
    print(B[0])
# Judge status: Accepted
n, k = [int(x) for x in input().split()]

if n % k == 0:
    print(0)
else:
    print(1)
# Judge status: Accepted
import heapq

n = int(input())
list_score = []
for i in range(n):
    list_score.append(int(input()))

list_ans = list_score.copy()
list_ans.sort()


for i in range(n):
    a = list_score[i]
    if a == list_ans[-1]:
        print(list_ans[-2])
    else:
        print(list_ans[-1])
# Judge status: Accepted
import math
n,d=map(int,input().split())
x=d*2+1
print(math.ceil(n/x))
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
 
CurrentMoney = 1000

for i in range(N - 1):
    Stocks = 0
    if A[i] < A[i+1]:
        Stocks = CurrentMoney // A[i]
    CurrentMoney += (A[i + 1] - A[i]) * Stocks

print(CurrentMoney)
# Judge status: Accepted
st = [s for s in input().split()]
ab = [int(s) for s in input().split()]
u = input()

if u == st[0]:
  print(int(ab[0]-1),int(ab[1]))
else:
  print(int(ab[0]),int(ab[1]-1))
# Judge status: Wrong Answer
a,b=map(int,input().split())
c=a+b

if a%3==0 or b&3==0 or c%3==0:
  print("Possible")
else:
  print("Impossibele")
# Judge status: Wrong Answer
n = int(input())
if n % 2 == 1: print(0)
else:
    ans = 0
    n /= 2
    while n:
        ans += n / 5
        n /= 5
    print(ans)
# Judge status: Wrong Answer
nStr = input()

if nStr[0] == 9 or nStr[1] == 9:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

dic = {}
cnt = 0

for x in A:
    if x not in dic.keys():
        dic[x] = 1
    else:
        dic[x] += 1

dic = sorted(dic.items(), reverse=True)

ans = 0
for i in range(len(dic)):
    if dic[i][1] >= 2:
        if cnt == 1:
          ans = t*dic[i][0]
          break 
        if cnt == 0:
            t = dic[i][0]
            cnt = 1
print(ans)
# Judge status: Wrong Answer
A,B,C=map(int,input().split())

diff = A-B
if diff-C >= 0:
  print(diff-C)
else:
  print(C-diff)
# Judge status: Accepted
N,M=map(int,input().split())
AC=[0]*(N+1)
WA=[0]*(N+1)
for i in range(M):
    p,S=input().split()
    p=int(p)
    if S=='WA' and AC[p]==0:
        WA[p]+=1
    if S=='AC' and AC[p]==0:
        AC[p]+=1
        
#結局正解できなかった場合はWA=0になる
for j in range(N+1):
    WA[j] = WA[j]*AC[j]
    
print(sum(AC),sum(WA))
# Judge status: Accepted
n = int(input())
v = list(map(int, input().split()))

while len(v) > 1:
  v = sorted(v)
  v1 = v.pop(0)
  v2 = v.pop(0)
  v.append((v1+v2)/2)
print(v[0])
# Judge status: Wrong Answer
def dist(p1,p2):
  r=0
  for a,b in zip(p1,p2):
    r+=(a-b)**2
  return r

def isSqrt(n):
  i=1
  while i*i<n:
    i+=1
  return i==n
    
N,D = map(int,input().split())
P=[list(map(int,input().split())) for _ in range(N)]
ans=0
for i in range(N):
  for j in range(i):
    d = dist(P[i],P[j])
    if isSqrt(d):
      ans+=1
print(ans)
# Judge status: Accepted
a,b = map(int, input().split())
if a>9 or b>9:
    print('-1')
else:
    print(a*b)
# Judge status: Accepted
k = int(input())

if k % 2 != 0:
    print((k//2)* ((k//2)+1))
else:
    print((k//2)**2)
# Judge status: Wrong Answer
N = int(input())
A = [0] * (N + 1)
B = [0] * (N + 1)

count = 0

for i in range(1, N + 1):
  A[i], B[i] = map(int, input().split())

if N % 2 == 1:
  centerA = A[(N + 1) // 2]
  centerB = B[(N + 1) // 2]
else:
  centerA = (A[N // 2] + A[N // 2 + 1]) / 2
  centerB = (B[N // 2] + B[N // 2 + 1]) / 2

#print(centerA, centerB)  

if N % 2 == 1:
  count = centerB - centerA + 1
else:
  count = (centerB - centerA) * 2 + 1

print(int(count))
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
a1 = max(a)
half = a1/2
a2 = 0
for t in a:
  if abs(a2-half) > abs(t-half):
    a2 = t
print('{} {}'.format(a1, a2))
# Judge status: Wrong Answer
from collections import Counter

a = input()
a_list = list(map(int, input().split()))
 
# 要素数の数え上げと取り出し
num_counter = Counter(a_list)
num_keys = sorted(num_counter.keys(), reverse=True)

big = 0
small = 0

for i in num_keys:
  x = num_counter[i]
  if x >= 4:
    if big == 0:
      big = small = i
    elif big != 0 and small == 0:
      small = i
  elif x == 3 or x == 2:
    if big == 0:
      big = i
    elif big != 0 and small == 0:
      small = i
  if big != 0 and small != 0:
    break
print(big, small, big * small)
# Judge status: Accepted
a = input()
b = input()
if a[::-1]==b:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
# Payment
N = int(input())
print((10000 - N) % 1000)
# Judge status: Accepted
N=str(input())
a=list(N)
if '7' in a:
	print('Yes')
else:
	print('No')
# Judge status: Wrong Answer
k = int(input())
ans = 0

def by8(n,ans):
    n = n-1
    if n > 1:
        ans += (n*7)
        ans = by8(n,ans)
    elif n == 1:
        ans += (n*7)
    return(ans)


ans = 0
ans = by8(k,ans)
ans += k
print(ans)
# Judge status: Accepted
import sys
from collections import Counter
w = list(input())
C = Counter(w)
for k, v in C.items():
    if v % 2 == 1:
        print('No')
        sys.exit()
print('Yes')
# Judge status: Wrong Answer
import math

n = int(input())

print(int(math.floor(n**0.5)))
# Judge status: Accepted
N = int(input())

robots = []
for i in range(N):
    x, l = map(int, input().split())
    robots.append([x-l, x+l])

robots.sort(key=lambda x: x[1])

count = 0
max_arm = -float("inf")
for robo in robots:
    if robo[0] < max_arm:
        count += 1
    else:
        max_arm = robo[1]

print(N - count)
# Judge status: Wrong Answer
s=set()
l = [0] * ( 10 ** 5 + 1 )
N = int(input())
A = list(map(int, input().split()))
for i in range(len(A)):
  l[A[i]] += 1
  s.add(A[i])
Q = int(input())
for i in range(Q):
  B, C = map(int, input().split())
  l[C] += l[B]
  s.add(C)
  s.discard(B)
  sum=0
  for i in s:
    sum += i * l[i]
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ar = list(reversed(a))
b = []
c = []

if len(a)%2 == 0:
    for i in range(len(a)//2):
        b.append(ar[i*2])
        c.append(a[i*2])
else:
    for i in range(-(-(len(a))//2)):
        if i == len(a)//2:
            b.append(ar[(i*2)])
        else:
            b.append(ar[i*2])
            c.append(a[(i*2)+1])

print(' '.join(map(str, b+c)))
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
cnt = 0
for i in range(1,b+1):
    if a*i % b == c:
        cnt += 1
if cnt == 1:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
ret = 1
for i in range(n):
  ret = (ret * (i + 1)) % 1000000007
print(ret)
# Judge status: Accepted
N = int(input())
ans = 10**12 
for a in range(0,int(N**0.5)):
    a += 1
    if N%a == 0:
        b = N//a
        
        ans = min(ans,a+b-2)
print(ans)
# Judge status: Wrong Answer
N=int(input())
h=list(map(int,input().split()))

dp=[0]*(N)

for i in range(1,N):
    if i==1:
        dp[i]=abs(h[i]-h[i-1])
    else:
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp)
# Judge status: Accepted
arr = list(map(int, input().split()))
arr.sort()
if (arr[0] == 5) and (arr[1] == 5) and (arr[2] == 7):
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
x = int(input())
for a in range(-120,121):
    for b in range(-120,121):
        if a**5 - b**5 == x:
            print(a,b)
            break
# Judge status: Accepted
#069_C
n = int(input())
a = list(map(int, input().split()))

mod1, mod2, mod4 = [0] * 3
for ai in a:
    if ai % 4 == 0:
        mod4 += 1
    elif ai % 2 == 0:
        mod2 +=1
    else:
        mod1 +=1
        
if mod2 == 0:
    print('No' if mod1 > mod4 + 1 else 'Yes')
else:
    print('No' if mod1 > mod4 else 'Yes')
# Judge status: Accepted
MOD=10**9+7
N=int(input())
ans=1
nine=1
eight=1
for i in range(N):
    ans*=10
    ans%=MOD
    nine*=9
    nine%=MOD
    eight*=8
    eight%=MOD
nine*=2
nine%=MOD
ans-=nine
ans%=MOD
ans+=eight
ans%=MOD
print(ans)
# Judge status: Accepted
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
#======================================================#
def main():
    n = II()
    s = IS()
    cnt_b = 0
    cnt_w = s.count('.')
    cnt = cnt_w
    for si in s:
        if si == '#':
            cnt_b += 1
        else:
            cnt_w -= 1
        cnt = min(cnt, cnt_b+cnt_w)
    print(cnt)

if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
readline=sys.stdin.readline

N=readline().rstrip()

sums = 0
for i in range(len(N)):
  sums += int(N[i])
  sums %= 9
  
if sums % 9 == 0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
C = {}
cnt = 0
for i in range(N):
    a = A[i]
    if a>N:
        cnt += 1
    else:
        if a not in C:
            C[a]=0
        C[a] += 1
for a in C:
    if a>C[a]:
        cnt += C[a]
    elif a<C[a]:
        cnt += C[a]-a
print(cnt)
# Judge status: Accepted
s=input()

if s.islower():
  print('a')
else:
  print('A')
# Judge status: Wrong Answer
N = int(input())
point = list(map(int,input().split()))

if max(point)<sum(point):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N,M = map(int,input().split())
MAX = int(M**(1/2))
ans = 0
for i in range(MAX,0,-1):
    if M % i == 0:
        j = M // i
        if j >= N:
            ans = max(ans,i)
        if i >= N:
            ans = max(ans,j)
print(ans)
# Judge status: Wrong Answer
print('vowel' if input() in ['aeiou'] else 'consonant')
# Judge status: Accepted
K,A,B=map(int,input().split())
c=1

if A+2<B:
    if K<=A:
        print(1+K)
    else:
        K-=A-1
        c+=A-1
    #    print(c)
        if K%2:
            K-=1
            c+=1
        c+=K//2*(B-A)
        print(c)
else:
    print(1+K)
# Judge status: Wrong Answer
S = str(input())
if S == "ABC":
  print("ARC")
else:
  print("ARC")
# Judge status: Accepted
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

read = sys.stdin.buffer.read

n, *A = map(int, read().split())

now = 1000
for i in range(n-1):
    if A[i+1] > A[i]:
        now += (A[i+1] - A[i])*(now // A[i])
print(now)
# Judge status: Wrong Answer
str = input()
list = list(str)
abc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
i = 0
while abc[i] in str:
    if i < 25:
        i += 1
    else:
        break

if i < 26:
    print(abc[i])
else:
    print("None")
    print(i)
# Judge status: Accepted
N, K = map(int, input().split())
r = [False for _ in range(N+1)]
b = [1 for _ in range(N+1)]
r[1] = True
r_cnt = 1
for _ in range(K):
  x, y = map(int, input().split())
  b[x] -= 1
  b[y] += 1
  if r[x]:
    if b[x] == 0:
      r[x] = False
      r_cnt -= 1
    if not r[y]:
      r[y] = True
      r_cnt += 1
print(r_cnt)
# Judge status: Wrong Answer
a,b=[int(i) for i in input().split()]
if a==b:
  print(a**2)
else:
  print(max(a,b)*max(a-1,b-1))
# Judge status: Wrong Answer

N = int(input())

S = input()

strLen = len(S)

if strLen <= N :
    print(S)
else :
    result = S[0 : N]
    index = 0
    while index < (strLen - N):
        index = index + 1
        result += '.'
    print(result)
# Judge status: Accepted
N,M,K = map(int,input().split())
ans = 'No'
flag = False
for x in range(M+1):
    if flag:
        break
    for y in range(N+1):
        if (N-y)*x+(M-x)*y == K:
            ans = 'Yes'
            flag = True
            break
print(ans)
# Judge status: Wrong Answer
import numpy as np
X, N = map(int, input().split())
if N > 0:
  l1=list(map(int,input().split()))
else:
  l1=[]
ans = X
l2 = np.array([i for i in range(1,11)])

l3 = set(l1) ^ set(l2)  

for item in l3:
#  print("item",item)
#  print("X-item",(X - item)**2)
#  print("X-ans",(X - ans)**2)  
  if ((X - item) ** 2) == ((X - ans) ** 2):
    if item < ans:
      ans = item
  elif  ((X - item) ** 2) < ((X - ans) ** 2):
    ans = item
print(ans)
# Judge status: Wrong Answer
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = []
for i in range(N):
	b.append(int(input()))
	
yoko = A
tate = [[], [], []]
for row in A:
	for i in range(3):
		tate[i].append(row[i])
naname = [[A[0][0], A[1][1], A[2][2]]]

all = yoko + tate + naname



for kumi in all:
	for i in range(3):
		chk = 0
		if kumi[i] in b:
			chk += 1
		if chk == 3:
			print("Yes")
		break
	if chk == 3:
		break

if chk != 3:
	print("No")
# Judge status: Accepted
from collections import Counter
c = Counter(input())
for x in c:
    if c[x] % 2 == 1:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
O = list(input())
E = list(input())+[""]
o = len(O)
x =[]
for i in range(o):
  ans = O[i] + E[i]
  x.append(ans)

print("".join(x))
# Judge status: Accepted
nList = sorted(list(map(int,input().split())),reverse=True)
k = int(input())

print(nList[0]*2**k+(nList[1]+nList[2]))