peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
h = int(input())
w = int(input())
n = int(input())

print(n//w+1)
# Judge status: Accepted
#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

def main():
    x = int(input())
    ans = 0
    ans += (x // 500) * 1000
    x -= (x // 500) * 500
    ans += (x // 5) * 5
    print(ans)
    return

if __name__ == "__main__":
    main()
# Judge status: Accepted
a,b,n = [int(x) for x in input().split()]


x = min(n,b-1)
print((a*x//b)-(x//b)*a)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a == 0 or b == 0 :
  print('IMPOSSIBLE')
else :
  print(int((a+b)/2))
# Judge status: Accepted
enemie = int(input())

def attack(N, times=-1):
    times += 1
    if N // 2 == 0:
        return times
    else:
        enemie = N // 2
        return attack(enemie, times)

ans = 0
for i in range(attack(enemie)+1):
    ans += 2**i

print(ans)
# Judge status: Wrong Answer
from math import *
N,M = map(int,input().split())
if abs(N - M):
    print(0)
    exit(0)

if N == M:
    print(2 * factorial(N) * factorial(M) % (10**9+7))
else:
    print(factorial(N) * factorial(M) % (10**9+7))
# Judge status: Accepted
x,y = map(int, input().split())
Z = [4,6,9,11]
if x in Z or y in Z:
    b = x in Z and y in Z
elif x == 2 or y == 2:
    b = x == y == 2
else:
    b = x not in ([2]+Z) and y not in ([2]+Z)
print("YNeos"[not b::2])
# Judge status: Accepted
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n, a, b = map(int, input().strip().split())
  ans = a * (n // (a+b)) + min(n%(a+b), a)
  print(ans)
 

if __name__=='__main__':
  main()
# Judge status: Accepted
k, x = map(int, input().split())

if k*500 >= x:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N , M= map(int, input().split())
 
if N==M:
    print("yes")
else:
    print("no")
# Judge status: Wrong Answer
import bisect
n,h=map(int,input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
a, b = [list(i) for i in zip(*ab)]
b.sort()

k=bisect.bisect_left(b,max(a))
b2=b[k:]
h-=sum(b[k:])
c=len(b2)
c+=(h-1)//max(a)+1

print(c)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

a.sort()
cnt = 0
dp = [True] * (a[-1]+1)
pre = -1
flg = False

for i in a:
    if dp[i] == True:
        cnt += 1
    if i == pre:
        if flg is True:
            continue
        else:
            cnt -= 1
            flg = True
    else:
        flg = False
        for j in range(1, a[-1]//i+1):
            dp[i*j] = False
    pre = i

print(cnt)
# Judge status: Wrong Answer
from bisect import bisect_left
N = int(input())
A = list(map(int,input().split()))
A.sort()
n = A.pop()
index = bisect_left(A, n//2)
if index == 0:
    r = A[0]
elif index == N-1:
    r = A[N-2]
else:
    if abs(n//2-A[index]) < abs(n//2-A[index-1]):
        r = A[index]
    else:
        r = A[index - 1]
print(*[n,r])
# Judge status: Wrong Answer
data = [int(i) for i in input()]
ans = 999

for i in range(len(data) - 3):
  x = (data[i] * 100) + (data[i + 1] * 10) + (data[i + 2])
  ans = min(ans, abs(753 - x))
  
print(ans)
# Judge status: Accepted
S = input()

ans = [0]*(len(S)+1)

for i in range(len(S)):
    if S[i] == "<":
        ans[i+1] = max(ans[i+1], ans[i]+1)
    
for i in range(len(S)):
    i = len(S)-1 - i
    if S[i] == ">":
        ans[i] = max(ans[i],ans[i+1]+1)

print(sum(ans))
# Judge status: Wrong Answer
a,b = map(int,input().split())
fulla = int(a*12.5)
ans = -1
while fulla//12.5 == a:
  if fulla//10==b:
    ans = fulla
    break
  fulla += 1
print(ans)
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
if a > b:
    print(0)
    exit()
if n == 1:
    print(0)
    exit()
if a == b:
    print(1)
    exit()
print((n-2)*b - (n-2)*a + 1)
# Judge status: Wrong Answer
x,y,z=input().split()
    
print(x,y,z)
# Judge status: Wrong Answer
k = int(input())
a,b = map(int,input().split())
i = 1
c = 0
while k <= b:
    if a <= k*i<= b:
        print("OK")
        break
    elif k*i >b:
        c = 1
        break
    else:
        i += 1
if c == 1:
    print('NG')
# Judge status: Wrong Answer
def tmp_ans(total_cost, six_cost):
    res = 0
    tmp = n
    t = six_cost
    while t > 0:
        res += t % 6
        t //= 6
    t = total_cost - six_cost
    while t > 0:
        res += t % 9
        t //= 9
    return res

n = int(input())
ans = n
for x in range(n):
    ans = min(ans, tmp_ans(n, x))
print(ans)
# Judge status: Accepted
n=int(input())
odd=(n+1)//2
even=n//2
print(odd*even)
# Judge status: Accepted
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

n = inp()
if 400 <= n <= 599:
    print(8)
elif 600 <= n <= 799:
    print(7)
elif 800 <= n <= 999:
    print(6)
elif 1000 <= n <= 1199:
    print(5)
elif 1200 <= n <= 1399:
    print(4)
elif 1400 <= n <= 1599:
    print(3)
elif 1600 <= n <= 1799:
    print(2)
elif 1800 <= n <= 1999:
    print(1)
# Judge status: Wrong Answer
def adva(a, b) :
  c = (a + b) / 2
  return int(c)
# Judge status: Wrong Answer
s =input()
l =len(s)
count=0
for i in range(l):
    x =s[i]
    if x =='A' or x =='C' or x =='G' or x =='T':
        count +=1
        for j in range(i+1, l):
            x =s[j]
            if x =='A' or x =='C' or x =='G' or x =='T':
                count +=1
            else:
                break

print(count)
# Judge status: Accepted
n = int(input())
a = list(input().split())
num = list(range(n-1,-(n-1)-2,-2) )
for i in range(len(num)):
    if num[i]<0:
        num[i] = abs(num[i]+1)
    print(a[num[i]], end = ' ')
# Judge status: Accepted
import sys
h=int(input())

n=0
while h>1:
    h=h // 2
    n+=1

a=1
for i in range(n):
    a=a*2+1
print(a)
# Judge status: Wrong Answer
import math

a, b, h, m = map(int, input().split())
l = m * 6
s = m * 0.5 + h * 30
th = abs(l - s)
if th == 0:
    print(abs(a - b))
    #print('{:.20f}'.format(abs(a - b)))
    exit()
elif th == 180:
    print(a + b)
    #print('{:.20f}'.format(a + b))
    exit()
if th >= 180:
    th -= 180
cos = math.cos(math.radians(th))
ans = a**2 + b**2 - 2 * a * b * cos
print(ans**0.5)
#print('{:.20f}'.format(math.sqrt(ans)))
# Judge status: Accepted
A,B = map(int,input().split())

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
s =input()
ans = []
for i in range(len(s)):
    if (s[i] == '0') or (s[i] == '1'):
        ans.append(s[i])
    elif ans ==[]:
        continue
    else:
        ans.pop()

print(''.join(ans))
# Judge status: Accepted
from collections import defaultdict
N = int(input())
A = map(int, input().split())
d = defaultdict(int)
ans = 0
for i, a in enumerate(A):
    ans += d[-i+a]
    d[-i-a] += 1
print(ans)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
if N==1:
    print(1)
    exit()

B=[A[i]-A[i-1] for i in range(1,N)]
ans=0
first=B[0]
for i in range(N-1):
    if first*B[i]>=0:
        pass
    else:
        ans+=1
        if i+1<=N-2:
            first=B[i+1]

print(ans+1)
# Judge status: Accepted
a,b,t=[int(i)for i in input().split()]
print((t//a)*b)
# Judge status: Wrong Answer
h1, m1, h2, m2, k = map(int, input().split())

if k == 60*(h2-h1)+(m2-m1)-k:
  print('0')
else:
  print(60*(h2-h1)+(m2-m1)-k)
# Judge status: Wrong Answer
k,y=input().split()
coin=k*500
if coin>=y:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s = input()
print(s.rfind("Z")-s.find("A")+1)
# Judge status: Accepted
N = int(input().split()[0])
a_list = list(map(int, input().split()))
t = 1
if 0 in a_list:
    t = 0
else:
    for a in a_list:
    	t *= a
    	if t > 10**18:
        	t = -1
        	break
print(t)
# Judge status: Accepted
c = []
for _ in range(3):
  ci  = list(map(int,input().split()))
  c.append(ci)
if all([c[0][0]-c[0][1]== c[1][0]-c[1][1],c[1][0]-c[1][1]==c[2][0]-c[2][1],c[0][1]-c[0][2]==c[1][1]-c[1][2],c[1][1]-c[1][2]==c[2][1]-c[2][2]]):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a, b = map(int, input().split())
print(int((b-a) * (b-a+1) / 2 - b))
# Judge status: Accepted
import numpy as np
N = int(input())
A = np.array([int(x) for x in input().split()])
Sort = [str(x) for x in np.argsort(A)+1]
print(' '.join(Sort))
# Judge status: Wrong Answer
a,v = list(map(int,input().split()))
b,w = list(map(int,input().split()))
t = int(input())

if (v - w > 0) and (a != b):
    if abs(a-b) <= (v - w) * t:
        print("Yes")
    else:
        print("No")
    
elif a == b:
    print("Yes")

else:
    print("No")
# Judge status: Accepted
S = input()
words = ["dream", "dreamer", "erase", "eraser"]
i = len(S)

while i > 0:
    if S[i - 5 : i] in words:
        i = i - 5
    elif S[i - 6 : i] in words:
        i = i - 6
    elif S[i - 7 : i] in words:
        i = i - 7
    else:
        break

if i > 0:
    print("NO")
else:
    print("YES")
# Judge status: Wrong Answer
nums = [int(e) for e in input().split()]
n = nums[0]
a = nums[1]
b = nums[2]

sum = a + b
iter = n // sum
amari = n % sum
if amari >= b:
	print(iter * a + (b))
else:
  print(iter * a + (amari))
# Judge status: Accepted
from collections import deque

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

deq = deque()
for i in range(n):
    if i%2==0:
        deq.appendleft(A[i])
    else:
        deq.append(A[i])
if n%2==0:
    for i in reversed(range(n)):
        print(deq[i],end=" ")
else:
    for i in range(n):
        print(deq[i],end=" ")
# Judge status: Accepted
N,M=map(int,input().split())
a_l=[]
b_l=[]
for i in range(N):
    a_l.append(list(input()))
for i in range(M):
    b_l.extend(input())
count=0
for t in range (N-M+1):
    for k in range(N-M+1):
        tmp=[]
        for i in range(M):
            for j in range(M):
                tmp.append(a_l[t+i][k+j])
        if tmp == b_l:
            print('Yes')
            exit()
        else:
            continue
print('No')
# Judge status: Accepted
s=input()
print(min(s.count('0'),s.count('1'))*2)
# Judge status: Accepted
def func1(N):
    if N%2==0:
        return N//2
    else:
        return 3*N+1
s = int(input())
a_n = {}
for i in range(1, 1000001):
    if s in a_n:
        break
    else:
        a_n[s] = 1
    s = func1(s)
print(i)
# Judge status: Accepted
n = int(input())
s = input()
t = input()

for i in range(n):
    if s[i:] == t[:n-i]:
        print(n*2 - (n-i))
        exit(0)
print(2*n)
# Judge status: Accepted
n = input()
h = "24579"
p = "0168"
b = "3"
if n[len(n)-1] in h:
  print("hon")
elif n[len(n)-1] in p:
  print("pon")
else:
  print("bon")
# Judge status: Accepted
N = int(input())
arr = list(map(int, input().split()))

count = 0
mn = float('inf')
for i in range(N):
    if mn >= arr[i]:
        count += 1
        mn =min(mn,arr[i])

print(count)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
    A[i] = A[i] - i - 1

s = sum(A)
t1 = s // N
t2 = t1 + 1

ans1 = 0
ans2 = 0
for i in range(N):
    ans1 += abs(A[i] - t1)
    ans2 += abs(A[i] - t2)

print(min(ans1, ans2))
# Judge status: Accepted
K = int(input())
S = input()

if len(S) <= K:
  print(S)
else:
  print(S[0:K] + '...')
# Judge status: Accepted
if __name__ == "__main__":
    n, k = map(int, input().split())
    s = set()

    for i in range(k):
        d = int(input())
        a = list(map(int, input().split()))
        for j in a:
            if j not in s:
                s.add(j)
    
    ans = n - len(s)
    print(ans)
# Judge status: Accepted
print( "ARC" if input() == "ABC" else "ABC")
# Judge status: Wrong Answer
H, N = map(int, input().split())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
dp = [10000000] * 100000
dp[0] = 0
for i in range(N):
    for j in range(10001):
        dp[j + A[i]] = min(dp[j + A[i]], dp[j] + B[i])
m = int(1e10)
for i in range(H, H + 10001):
    m = min(m, dp[i])

print(m)
# Judge status: Accepted
N, A, B = map(int, input().split())
ans = 0

r = N//(A+B)
s = N % (A+B)

ans = A*r

if s <= A:
    ans += s
elif s > A:
    ans += A


print(ans)
# Judge status: Accepted
import numpy as np
N,A,B = map(int,input().split())
x=abs(A-B)
    

if x%2==0:
    print(x//2)
else:
    y,z=max(N-A,N-B),max(A-1,B-1)
    a,b=min(A-1,B-1),min(N-A,N-B)
    c,d=max(A-1,B-1)-a,max(N-A,N-B)-b
    e,f=c//2+a+1,d//2+b+1
    if y>z:
        print(min(z,e,f))
    else:
        print(min(y,e,f))
# Judge status: Accepted
N = int(input())

summ = []
for i in range(1,N//2 + 1):
    A = []
    B = []
    k = N-i
    for __ in range(6):
        A.append(int(i%10))
        B.append(int(k%10))
        i /= 10
        k /= 10
    summ.append(sum(A+B))
print(min(summ))
# Judge status: Accepted
n,m = map(int, input().split())
if n % 2 != 0:
    for i in range(1,m+1):
        print(i,n+1-i)
else:
    x = n//2
    for i in range((m+1)//2):
        print(i+1,x-i)
    for i in range(m//2):
        print(x+1+i, n-1-i)
# Judge status: Accepted
a = [int(input()) for _ in range(3)]
h, w = sorted([a[0], a[1]])
print(-((-a[2])//w))
# Judge status: Accepted
n=int(input())
v=list(map(int, input().split()))
v.sort()
mean=v[0]
for i in range(n-1):
  mean=(v[i+1]+mean)/2
print(mean)
# Judge status: Wrong Answer
N = int(input())
S = {}
for i in range(N):
    s = input()
    if s not in S:
        S[s] = 1
        continue
    S[s] +=1
    

M = int(input())
T = {}
for i in range(M):
    t = input()
    if t not in T:
        T[t] = 1
        continue
    T[t] += 1

ans = 0
for key in S.keys():
    if key not in T:
        ans = S[key]
        continue
    ans = max(ans, S[key] - T[key])
print(ans)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
if A == 5 and B == 7 and C == 7:
  print("YES")
elif A == 7 and B == 5 and C == 7:
  print("YES")
elif A == 7 and B == 7 and C == 5:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
kind = int(input())

table_1 = input().split(' ')
table_2 = input().split(' ')
table_3 = input().split(' ')
total = 0
for i in range(kind):
    total += int(table_2[i])

for j in range(kind-1):
    if int(table_1[j]) == int(table_1[j + 1]) - 1:
        total += int(table_3[j])
print(total)
# Judge status: Accepted
N, K=map(int, input().split())
A=list(map(int, input().split()))

idx1=A.index(1)

from math import ceil

ans=10000000

for i in range(K):
  left=idx1-i
  right=left+K-1
  if left<0 or right>N-1:
    continue
  tmp=ceil(left/(K-1))+ceil((N-1-right)/(K-1))+1
  ans=min(ans, tmp)

print(ans)
# Judge status: Accepted
s = input()
ans = 0
for i in range(len(s)):
  if s.count(s[i]) == 2:
    ans += 1
    
if ans == 4:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if max(x) < min(y):
  print("No War")
else:
  print("War")
# Judge status: Accepted
x,a,b = map(int,input().split())
if abs(x-a) > abs(x-b):
    print('B')
else:
    print('A')
# Judge status: Accepted
A,B=map(int,input().split())
print(A*B)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if b<c or d<a:
    print(0)
else:
    if a<=c:
        if b<=d:
            print(b-c)
        else:
            print(d-c)
    else:
        if d<=b:
            print(d-a)
        else:
            print(b-a)
# Judge status: Wrong Answer
X,N=[int(x) for x in input().split(" ")]
if N==0: 
    a=input()
    print(X)
else:
    a=[int(x) for x in input().split(" ")]
    i=1
    res=0
    if not X in a:
        res=X
    while True:
        X+=i*(-1)**i
        if not X in a:
            res=X
            break
        i+=1
    print(res)
# Judge status: Accepted
from collections import defaultdict
from heapq import heappop, heappush
N, M = map(int, input().split())

d = defaultdict(list)
for _ in range(N):
    a, b = map(int, input().split())
    d[a].append(b)

ans = 0
q = []

for i in range(1, M+1):
    for j in d[i]:
        heappush(q, -j)
    if q:
        ans += (-heappop(q))

print(ans)
# Judge status: Accepted
import math
ans = 0
c = 0
K = int(input())
for i in range(1,K+1):
    for j in range(1,K+1):
        c = math.gcd(i,j)
        for m in range(1,K+1):
            ans += math.gcd(c,m) 
print(ans)
# Judge status: Accepted
w = input()
ans = 1

for wi in w:
    ans ^= ord(wi)

if ans == 1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
K,X = map(int,input().split())
ans = []
for i in range(X-K+1,X+K):
    ans.append(str(i))
print(' '.join(ans))
# Judge status: Wrong Answer
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

#小さいものから決めていく
A.sort()
B.sort()
C.sort()

import bisect
ans = 0

a2b = []
b2c = []
for a in A:
    b_bisect = N - bisect.bisect_left(B, a)
    a2b.append(b_bisect)
    
for b in B:
    c_bisect = N - bisect.bisect_left(C, b)
    b2c.append(c_bisect)

for i, j in zip(a2b, b2c):
    ans += i*j
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
odd, even, four = 0, 0, 0
for x in a:
    if x % 2:
        odd += 1
    else:
        if x % 4 == 0:
            four += 1
        else:
            even += 1
if even == 0:
    if four >= odd - 1:
        print('Yes')
    else: print('No')
else:
    if four >= odd:
        print('Yes')
    else: print('No')
# Judge status: Accepted
N=int(input())
l=list(map(int,input().split()))
a=sorted(l)
count=0
for i in range(0,len(l)):
  if l[i]==a[i]:
    count+=1
if count >= N-2:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
[A,B,C] = list(map(int,input().split()))
print(min(C,B//A))
# Judge status: Accepted
def q2():
    N = int(input())
    P = [int(i) for i in input().split()]
    P_sorted = sorted(P)
    cnt = 0
    for i, p in enumerate(P):
        if P[i] - P_sorted[i] != 0:
            cnt += 1

    if cnt == 0 or cnt == 2:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    q2()
# Judge status: Wrong Answer
import math
n=int(input())
s=[]
for i in range(n):
  m=[int(x) for x in input().split()]
  s.append(m)
d=0
for i in range(n-1):
  for j in range(i+1,n):
    d+=math.sqrt((s[i][0]-s[j][0])**2+(s[i][1]-s[j][1])**2)
ans=d*(n-1)/n
print(ans)
# Judge status: Accepted
def agc036_a():
    S = int(input())
    x1 = y1 = 0
    x2 = 10**9
    y2 = 1
    d, m = divmod(S, x2)
    if m == 0:
        y2 = x3 = 0
        y3 = d
    else:
        x3 = x2 - m
        y3 = d + 1
    ans = [x1, y1, x2, y2, x3, y3]
    print(*ans, sep=' ')

agc036_a()
# Judge status: Accepted
a = int(input())
print ("Yes" if a>=30 else "No")
# Judge status: Accepted
import fractions
N, X = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
a = []
for i in range(N):
    a.append(abs(X - x[i]))
ans = a[0]
if len(a) > 1:
    for i in range(1, len(a)):
        ans = fractions.gcd(ans, a[i])
print(ans)
# Judge status: Accepted
n = list(map(int, list(input())))
n = n[::-1] + [0]
d = len(n)

ans = 0
for i, k in enumerate(n):
    if k < 5:
        ans += k
    elif k == 5 and n[i + 1] < 5:
        ans += k
    else:
        ans += 10 - k
        n[i + 1] += 1
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
if n==1 and m==1:
  print(1)
elif n==1 or m==1:
  print(n*m-2)
else:
  print((n-2)*(m-2))
# Judge status: Accepted
# Fast IO (be careful about bytestring, not on interactive)

import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

N = int(input())

sumList = []
subList = []

for _ in range(N):
    x,y = map(int,input().split())
    sumList.append(x + y)
    subList.append(x - y)

print(max(max(sumList) - min(sumList),max(subList) - min(subList)))
# Judge status: Accepted
H,N=map(int, input().split())
A=list(map(int, input().split()))
if H<=sum(A):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a,b=map(int,input().split())
list=list(map(int,input().split()))
 
count=0
count2=1
for i in range(a):
  count+=list[i]
  if count<=b:
    count2+=1
    
print(count2)
# Judge status: Accepted
from operator import itemgetter

n, m = map(int, input().split())
pair = []

for _ in range(n):
    a, b = map(int, input().split())
    pair.append((a, b))

pair = sorted(pair, key=itemgetter(0))

cnt = 0
ans = 0

for i in pair:
    if m - cnt >= i[1]:
        ans += i[0] * i[1]
        cnt += i[1]
    else:
        ans += i[0] * (m - cnt)
        break

print(ans)
# Judge status: Wrong Answer
import itertools
n,m,x=list(map(int,input().split()))
ans=10**6
A=[list(map(int,input().split())) for i in range(n)]
for i, _ in enumerate(A,1):
  for j in itertools.combinations(A,r=i):
    B=list(zip(*j))
    
    C=[0]*(m+1)
    for m in range(m+1):
      C[m]=sum(B[m])
    if len([i for i in C[1:] if i>=x ])==m:
      ans=min(ans,C[0])
print(ans) if ans!=10**6 else print(-1)
# Judge status: Accepted


p, q, r = map(int, input().split())

l = [p, q, r]
l = sorted(l)

print(l[0]+l[1])
# Judge status: Accepted
S = str(input())

a = S[0]
b = S[1]
c = S[2]
d = S[3]

acount = 0
bcount = 0
ccount = 0
dcount = 0

if S.count(a) == 2 and S.count(c) == 2 and S.count(b) == 2 and S.count(d) == 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N,M = map(int,input().rstrip().split(" "))
k = N * 2 + M
print(min(k // 4,M//2))
# Judge status: Wrong Answer
a, b, n = map(int, input().split())
ans = -100
for x in range(1, n+1):
    if x % b == 0:
        continue
    fx = int(a*x/b) - a * int(x/b)
    if ans < fx:
        ans = fx
print(ans)
# Judge status: Wrong Answer
A = list(map(int, input().split()))
A.sort()
ans = A[2]-A[1]
ans = ans + (A[2]-(ans+A[0]))//2
if (A[2]-(A[2]-A[1]+A[0]))%2==1:
   ans += 1
print(ans)
# Judge status: Wrong Answer
n = int(input())
m = sorted(list(map(int,input().split())))
if len(m) == 2:
    print(sum(m) / 2)
    exit()
y = m[n-1] / 2
m.pop(-1)
x = sum(m) / (len(m)*2)
print(x + y)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
i = 1
if min(a) != 1:
  print("-1")
else:
  while i < len(a):
    if a[0] != i:
      a.pop(0)
    else:
      i += 1
  print(n - len(a))
# Judge status: Accepted
a,b=map(int, input().split())

if((a+b)%2 == 0):
    print((a+b)//2)
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
a,b,c = map(int,input().split())
from fractions import gcd
print('YNEOS'[c%gcd(a,b)>0::2])
# Judge status: Accepted
N = int(input())
cnt = 0
for i in range(1,N+1):
    if(len(str(i)) % 2 ==1):
        cnt += 1
print(cnt)
# Judge status: Accepted
import math

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

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

for i in range(n):
    for j in range(n):
        c1 = i
        c2 = i + j
        c3 = i + j * 2
        if c3 >= n: break
        if c1 == c2 == c3: continue
        if s[c1] != s[c2] and s[c2] != s[c3] and s[c1] != s[c3]:
            ans -= 1

print(ans)
# 012 024 036 048
# 123 135 147 159
# Judge status: Accepted
d = {'SUN':7, 'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1}
print(d[input()])
# Judge status: Accepted
N, T = map(int, input().split())
m = 1001
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        m = min(c, m)
print("TLE" if m == 1001 else m)
# Judge status: Wrong Answer
a,b,x=map(int,input().split())
if a<=x and a+b>=x:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n,m=map(int,input().split())
cnt=[1]*n
res=[0]*n
res[0]=1
for i in range(m):
    x,y=map(int,input().split())
    if res[x-1]==1:
        res[y-1]=1
        if cnt[x-1]==1:
            res[x-1]=0
    cnt[x-1]-=1
    cnt[y-1]+=1
    print(cnt,res)
print(sum(res))
# Judge status: Accepted
a, b = map(int, input().split())
if a==b:
  print('Draw')
elif a == 1:
  print('Alice')
elif b == 1:
  print('Bob')
elif a > b:
  print('Alice')
elif a < b:
  print('Bob')
# Judge status: Accepted
## B - Two Colors Card Game
N = int(input())
S = []
for n in range(N):
    S.append(input())
M = int(input())
T = []
for m in range(M):
    T.append(input())
val = [0]
for s in set(S):
    val.append(S.count(s) - T.count(s))
print(max(val))