peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
S, T = input().split()
A, B = map( int, input().split() )
U    = input()

if( S==U ):
    A-=1
if( T==U ):
    B-=1

print( str(A)+" "+str(B) )
# Judge status: Accepted
s = int(input())

m = 10**9
x = (m-s%m)%m
y = (s+x)//m
print(0,0,m,1,x,y)
# Judge status: Accepted
a, b, c, x, y = map(int, input().split())

# ABを買わない、AorBを買わない、AandBを買わない
if x >= y:
    print(min(x*a + y*b, 2*y*c + (x - y)*a, 2*x*c))
else:
    print(min(x*a + y*b, 2*x*c + (y - x)*b, 2*y*c))
# Judge status: Accepted
s = input()

if int(s[5:7]) <=4:
  print("Heisei")
else:
  print("TBD")
# Judge status: Accepted
N,W = map(int,input().split())

dp = [0]*(W+1)
for _ in range(N):
    w,v = map(int,input().split())
    for k in reversed(range(w,W+1)):
        dp[k] = max(dp[k], dp[k-w]+v)

print(dp[W])
# Judge status: Accepted

A,B,M =map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = []
for m in range(M):
    x.append([int(i) for i in input().split()])
_min = min(a)+min(b)
		
for i in x:
    _min = min( (a[i[0]-1]+b[i[1]-1] - i[2]),_min)
print(_min)
# Judge status: Accepted
print(7-['SUN','MON','TUE','WED','THU','FRI','SAT'].index(input()))
# Judge status: Accepted
data=str(input("")).split(" ")
D=int(data[0])
T=int(data[1])
S=int(data[2])

if D<=T*S:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
BC=[]
for i in range (0, Q):
    BC.append([int(i) for i in input().split()])

#print(BC)
yoso_count=[]
for i in range(1,10**5+1):
    yoso_count.append([i,0])

sum = 0
for a in A:
    yoso_count[int(a)-1][1] += 1
    sum += a

#print(yoso_count,sum)

for bc in BC:
    sum += (bc[1] - bc[0])*yoso_count[bc[0]-1][1]
    yoso_count[bc[1]-1][1] += yoso_count[bc[0]-1][1]
    yoso_count[bc[0]-1][1] = 0
    print(sum)
# Judge status: Wrong Answer
k = int(input())

if k%2==0:
  print((k/2)**2)
else:
  print((k+1)*(k-1)/4)
# Judge status: Wrong Answer
#B - Sum of Three Integers
K,S = map(int,input().split())
#0<=S<=3K
res = 0
for X in range(0,K+1):
    if X > S:
        break
    for Y in range(0,K+1):
        if X + Y > S:
            break
        elif 0<=(X + Y - S) and (X + Y - S) <= K:
            res += 1
print(res)
# Judge status: Wrong Answer
n, x = map(int, input().split())
a = list(map(int, input().split()))
c = 0
for i in range(n-1):
	if a[i] + a[i+1] > x:
		if x > a[i]:
			c += a[i+1]-x
			a[i+1] -= a[i+1]-x
		else:
			c += a[i+1]
			a[i+1] = 0
			c += a[i]-x
			a[i] -= a[i]-x
print (c)
# Judge status: Wrong Answer
import sys
N=int(input())
for i in range(1,N):
    if i**2>N:
        print((i-1)**2)
        sys.exit()
    else:
        pass
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s = input()
    if s[-1] != 's':
        print(s+'s')
    else:
        print(s+'es')

if __name__=='__main__':
    main()
# Judge status: Accepted
N=int(input())

def zent(N):
    for i in range(1,10):
        for j in range(1,10):
            if j*i==N:
                return print("Yes")
    return print("No")
zent(N)
# Judge status: Wrong Answer
a,b,c,d = map(int, input().split())
if a >=0:
    if c > 0:
        print(b * d)
    elif d < 0:
        print(a * d)
    else:
        print(b*d)
else:
    if c > 0:
        print(b * c)
    elif d < 0:
        print(a * c)
    else:
        print(a * c)
# Judge status: Wrong Answer
A,B = map(int, input().split())
if A > 8 or B > 8:
    print("Yay!")
else:
    print(":(")
# Judge status: Accepted
a,b,c,d = map(int,input().split())
print(max(min(b,d)-max(a,c),0))
# Judge status: Wrong Answer
s = int(input())

dp = [1] + [0] * s
for i in range(3, s + 1):
    dp[i] = dp[i - 1] + dp[i - 3]
print(dp[s])
# Judge status: Accepted
x,y = map(int,input().split())
if x == y:
  print("Yes")
else:
  if (x == 4 or x == 6 or x == 9 or x == 11) and (y == 4 or y == 6 or y == 9 or y == 11):
    print("Yes")
  elif (x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10 or x == 12) and (y == 1 or y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12):
    print("Yes")
  else:
    print("No")
# Judge status: Accepted
N, M = map(int, input().split())

A = list(set(map(int, input().split(" "))))
G = A.copy()
 
while not any(x % 2 for x in G):
    G = [i // 2 for i in G]
 
if not all(x % 2 for x in G):
    print(0)
    exit(0)
    
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    return a * b // gcd(a, b)
    
total = 1

for x in A:
    total = lcm(total, x // 2)

print((M // total + 1) // 2)
# Judge status: Accepted
a, b = map(int, input().split())
if a <= 5:
    print('0')
elif a <= 12:
    print(b // 2)
else:
    print(b)
# Judge status: Accepted
L,R,d = map(int,input().split())

cnt=0
for i in range(L,R+1):
    if i%d==0:
        cnt+=1
print(cnt)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
if max(a) < sum(a):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a=input()
a1=input()
a2=input()
a=a.split()
a1=a1.split(" ")
a1=sorted(list(map(int,a1)))
a2=a2.split()
a2=sorted(list(map(int,a2)))
l=[]
v=int(a1[0])+int(a2[0])
l.append(v)

for i in range(int(a[2])):
    dis=input()
    dis=dis.split()
    c=int(a1[int(dis[0])-1])+int(a2[int(dis[1])-1])-int(dis[2])
    l.append(c)
l1=sorted(set(l))
print(l1[0])
# Judge status: Accepted
x=input()
if x.islower():
  print('a')
else:
  print('A')
# Judge status: Accepted
from math import ceil
n, m = map(int, input().split())
a = list(map(int, input().split()))
c = ceil(sum(a) / (4 * m))
d = 0
for e in a:
    if e >= c:
        d += 1
        if d == m:
            print('Yes')
            exit(0)
print('No')
# Judge status: Accepted
n = int(input())

x = 800 * n
y = (n //15) * 200

print(x-y)
# Judge status: Accepted
N=int(input())
T, A=map(int, input().split())
H=list(map(int, input().split()))
def kion(x):
  return T-x*0.006
ans=[abs(A-kion(h)) for h in H]
p=ans.index(min(ans))+1
print(p)
# Judge status: Accepted
n, a, b = map(int, input().split())
t = a + b
s = input()
for c in s:
    if c=='a' and t>0:
        print('Yes')
        t -= 1
    elif c=='b' and t>0 and b>0:
        print('Yes')
        t -= 1
        b -= 1
    else:
        print('No')
# Judge status: Accepted
import sys

O = list(input())
E = list(input())
if len(O) - len(E) == 1:
    E.append('')
for o, e in zip(O, E):
    sys.stdout.write(o + e)
print()
# Judge status: Accepted
n,a,b = list(map(int,input().split()))

MOD = 10**9+7

def comb(n,r,MOD):
    x = n+1
    y = min(r,n-r)
    
    numer = 1
    denom = 1
    
    for i in range(1,r+1):
        numer = numer*(x-i)%MOD
        denom = denom*(i)%MOD
    
    return numer * pow(denom,MOD-2,MOD) % MOD

nCa = comb(n,a,MOD)
nCb = comb(n,b,MOD)

ans = pow(2,n,MOD)-1 - nCa - nCb

if ans < 0:
    print((ans+MOD)%MOD)
else:
    print(ans%MOD)
# Judge status: Wrong Answer
n, k =map(int,input().split())
data = list(map(int,input().split()))
data = sorted(data)
cnt = 0
for var in data:
    if var <= k:
        cnt += 1
        k = k-var
       
    else:
        continue
print(cnt)
# Judge status: Wrong Answer
n, k = map(int, input().split())
print(n % k)
# Judge status: Wrong Answer
a,b = map(int,input().split())

num = int(str(a)+str(b))
ans = 'No'

for i in range(101):
    if num == i*i:
        ans = 'Yes'
        break
        
print(ans)
# Judge status: Accepted
import sys
row = sys.stdin.readline

def read_ints(row):
    return list(map(int, row().split()))
  
S, T = row().rstrip().split() 
print(T+S)
# Judge status: Accepted
W, H, N = map(int, input().split())
sx, sy, gx, gy = 0, 0, W, H

for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        sx = max(sx, x)
    elif a == 2:
        gx = min(gx, x)
    elif a == 3:
        sy = max(sy, y)
    else:
        gy = min(gy, y)

dx, dy = gx-sx, gy-sy
if dx <= 0 or dy <= 0:
    print(0)
else:
    print(dx*dy)
# Judge status: Accepted
s = input()
t = input()

ans = 0
for i in range(len(s) - len(t) + 1):
    cnt = 0
    for check_t, work in zip(t, s[i:i+len(t)]):
        if check_t == work:
            cnt+=1
    ans = max(ans, cnt)
print(len(t) - ans)
# Judge status: Accepted
n,x=map(int, input().split())
a=[0]+list(map(int, input().split()))
ans=0
for i in range(n):
  eat=max(a[i]+a[i+1]-x,a[i+1]-2*x,0)
  ans+=eat
  a[i+1]-=eat
print(ans)
# Judge status: Accepted
n = n = int(input())
a = [int(_) for _ in input().split()]

b1 = b2 = b4 = 0

for c in a:
    if c % 4 == 0:
        b4 += 1
    elif c % 2 == 0:
        b2 = -1
    else:
        b1 += 1

if b1 <= b4+b2+1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]

for i in range(N):
    d = []
    for j in range(M):
        d.append(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]))
    print(d.index(min(d)) + 1)
# Judge status: Accepted
N=int(input())
s=["".join(sorted(input())) for i in range(N)]
s.sort()
ans=0
t=0
for i in range(N):
  if s[t]!=s[i]:
    ans+=(i-t)*(i-t-1)//2
    t=i
i+=1
ans+=(i-t)*(i-t-1)//2

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

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

ans = right_white + left_black
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: Wrong Answer
n,k = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]
a,b = [list(i) for i in zip(*l)]
p = 0
for i in range(n):
    p += b[i]
    if p >= k:
        print(a[i])
        break
# Judge status: Accepted
A,B,C,D=map(int,input().split())
if B<=C or D<=A:
    print(0)
else:
    large=max(A,C)
    small=min(B,D)
    print(small-large)
# Judge status: Accepted
a=list(sorted(map(int,input().split()))[::-1])
print("Yes" if a[0]==a[1]+a[2] else "No")
# Judge status: Accepted
N = int(input())
a = N // (10**9)
b = N % (10**9)
if b != 0:
    print(0,0,1000000000,1,1000000000-b,a+1)
else:
    print(0,0,1000000000,0,0,a)
# Judge status: Accepted
n,a,b=map(int,input().split())

count=0
for i in range(1,n+1):
  j=i
  t=0
  while(i//10>=0and i>0):
    t+=i%10
    i=i//10
  if(t>=a and t<=b):
    count+=j
    
print(count)
# Judge status: Wrong Answer
s=input()
for i in range(26):
  if not chr(ord('a')+i) in s:
    print(chr(ord('a')+i))
    break
else:
  print('NONE')
# Judge status: Wrong Answer
s = input()

n = len(s)
L = [0]*(n+1)
for i in range(n-1):  
  if s[i]=='>' and s[i+1]=='<':
    j = i+1
    c = 1
    while j<n and s[j]=='<':
      L[j+1] = max(c,L[j+1])
      c += 1
      j += 1      
  
  j = i+1
  c = 1
  while j>=0 and s[j]=='>':
    L[j] = max(c,L[j])
    c += 1
    j -= 1            
    
print(sum(L))
# Judge status: Accepted
L=int(input())
print(((10**6)*(L**3)//27)/(10**6))
# Judge status: Wrong Answer
N = int(input())
A = list()
for i in range(N):
  A.append(int(input()))
ma = max(A)
for i in range(N):
  if ma != A[i]:
    print(ma)
  else:
    A[i] = 0
    print(max(A))
# Judge status: Accepted
N=int(input())
S=str(input())

r=S.count('R')
g=S.count('G')
b=S.count('B')


ans=r*g*b
dib=0
m=0

for i in range(N-2):
    m=(N+i)//2+1
    for j in range(i+1,m):
            dib=j-i
            if j+dib<=N-1:
                if S[i]!=S[j] and S[i]!=S[j+dib] and S[j]!=S[j+dib]:
                    ans=ans-1
            
print(ans)
# Judge status: Accepted
import sys
import os

def file_input():
    f = open('ARC069/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    N,M=map(int, input().split())

    if N*2>=M:
        print(str(M//2))
    else:
        M-=N*2
        print(str(N+M//4))

if __name__ == '__main__':
    main()
# Judge status: Accepted
N,A,B = map(int,input().split())
if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    print(min(A+B-1,2*N-A-B+1) // 2)
# Judge status: Accepted
n=int(input())
a=int(input())
print("Yes" if (n%500)<=a else "No")
# Judge status: Wrong Answer
x = int(input())
if x//100 < x%100:
	print(0)
else:
	print(1)
# Judge status: Accepted
S = sorted(list(str(input())))
T = sorted(list(str(input())),reverse=True)

if S < T:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from collections import Counter

w = input()
dic = Counter(w)
if all(v%2==0 for v in dic.values()):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for i in range(n)]

l = sorted(a)
same = 1
count = 0
for i in range(1, n):
    if l[i] == l[i - 1]:
        same += 1
        continue
    if same % 2 == 1:
        count += 1
    same = 1
if l[n - 1] != l[n - 2]:
    count += 1
print(count)
# Judge status: Accepted
a,b=map(int,input().split())

a=(a+b)%24
print(a)
# Judge status: Wrong Answer
ins = list(map(int, input().split()))
N = ins[0]
L = ins[1]
Ss = []

for i in range(N):
  Ss.append(input().strip())

Ss.sort()

print(' '.join(Ss))
# Judge status: Wrong Answer
n ,d = map(int,input().split())

ans = 0
for i in range(n):
    x,y = map(int,input().split())
    if d**2 <= x**2 + y**2 :
        ans += 1

print(ans)
# Judge status: Accepted
N,A,B = map(int,input().split())
if (B-A) % 2 == 0:
    print((B-A)//2)
else:
    print(min(A-1,N-B)+1 + (B-A-1)//2)
# Judge status: Accepted
n = int(input())
a = [0] * 4
for loop in range(n):
    s = input()
    if s == 'AC':
        a[0] += 1
    if s == 'WA':
        a[1] += 1
    if s == 'TLE':
        a[2] += 1
    if s == 'RE':
        a[3] += 1
s = ['AC', 'WA', 'TLE', 'RE']
for i in range(4):
    print(s[i], 'x', a[i])
# Judge status: Accepted
R = int(input())
import math
print(2*R*math.pi)
# Judge status: Wrong Answer
N = int(input()) 
x = N * 800 
y = N / 15 * 200 

print(int(x-y))
# Judge status: Accepted
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

li = rl()
for i in range(len(li)):
  if li[i] == 0:
    print(i+1)
    exit()
# Judge status: Accepted
import sys

N, M = map(int, input().split())
X = list(map(int, sys.stdin.readline().rsplit()))

X.sort()
tmp = [0] * (M - 1)
for i in range(M - 1):
    tmp[i] = X[i + 1] - X[i]
tmp.sort()

if N >= M:
    print(0)
else:
    print(sum(tmp[0:M - N]))
# Judge status: Accepted
A, B, K = map(int, input().split())

if 2*K-1 >= B-A+1:
    for i in range(A, B+1):
        print(i)
else:

    for i in range(A, A+K):
        print(i)

    for i in range(B-K+1, B+1):
        print(i)
# Judge status: Accepted
N = int(input())

xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]

x_c = [x + y for (x, y) in zip(x, y)]
y_c = [x - y for (x, y) in zip(x, y)]

ans = max(x_c) - min(x_c)

ans_1 = max(y_c) - min(y_c)

if ans < ans_1:
    ans = ans_1

print(ans)
# Judge status: Accepted
n=int(input())
i=0
while i*(i+1)//2<n:
  i+=1
no=i*(i+1)//2-n
for j in range(1,i+1):
  if j!=no:
    print(j)
# Judge status: Accepted
h = int(input())

for i in range(41):
    if h < 2**i:
        print(2**i-1)
        quit()
# Judge status: Wrong Answer
s = input()
a = s.index('A')
z = s.index('Z')
print(len(s[a:z+1]))
# Judge status: Accepted
import sys
input = sys.stdin.readline

a = [int(x) for x in input().split()]

a.sort()

a, b, c = a

a += (c - b)
ans = c - b

if (c - a) % 2 == 0:
    ans += (c - a) // 2
else:
    ans += 1
    ans += (c + 1 - a) // 2

print(ans)
# Judge status: Accepted
s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == s:
    print(a-1, b)
else:
    print(a, b-1)
# Judge status: Accepted
a, b, k = list(map(int, input().split()))
if b - a + 1 > 2 * k:
    [print(i) for i in range(a, a + k)]
    [print(i) for i in range(b - k + 1, b + 1)]
else:
    [print(i) for i in range(a, b + 1)]
# Judge status: Accepted
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]

h.sort()
ans = 10**10

for i in range(N - K + 1):
    ans_ = h[i + K - 1] - h[i]
    ans = min(ans, ans_)

print(ans)
# Judge status: Accepted
S = input()
ans = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        c = True
        for k in range(i, j+1):
            if S[k]!='A' and S[k]!='C' and S[k]!='G' and S[k]!='T':
                c = False
        if c and ans < j-i+1:
            ans = j-i+1
print(ans)
# Judge status: Wrong Answer
n=int(input())

if n==1:
  print(1)
else:
  if n%2==0:
    print(n//2+1,n//2-1)
  else:
    print(n//2+1,n//2)
# Judge status: Accepted
from collections import deque
n=int(input())
a=list(map(int,input().split()))
b=deque([])
for i in range(n):
    if i%2==0:
        b.appendleft(a[i])
    else:
        b.append(a[i])

if n%2==0:
    b=list(b)[::-1]

print(*b)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1, n - 1):
    if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1]:
        ans += 1
print(ans)
# Judge status: Wrong Answer
ret = "Yes" if int(input()) >= 30 else "No"
# Judge status: Accepted
n = int(input())
v = list(map(int,input().split()))
v.sort()
max = v[0]
for i in range(len(v)-1):
    max = (max + v[i+1])/2
print(max)
# Judge status: Wrong Answer
n=int(input())
a=0
for i in range(1,n):
  for j in range(1,n):
    if str(i)[0]==str(j)[-1] and str(i)[-1]==str(j)[0]:
      a=a+1
print(a)
# Judge status: Accepted
s = {i:list(input()) for i in "abc"}
x = "a"
while s[x]:
    x = s[x].pop(0)
print(x.upper())
# Judge status: Wrong Answer
a,b=list(map(int,input().split()))
print(a*b)
# Judge status: Accepted
[a,b,c]=[int(i) for i in input().split()]
[d,e,f]=[int(j) for j in input().split()]
[g,h,i]=[int(k) for k in input().split()]
t=0
if d-a == e-b and e-b == f-c:
  t+=1
if g-d == h-e and h-e == i-f:
  t+=1
if b-a == e-d and e-d == h-g:
  t+=1
if c-b == f-e and f-e == i-h:
  t+=1
if t== 4:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
def resolve():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
    not_good = []
    for i in range(M):
        A, B = map(lambda x: int(x) - 1, input().split())
        if H[A] > H[B]:
            not_good.append(B)
        elif H[A] < H[B]:
            not_good.append(A)
        elif H[A] == H[B]:
            not_good.extend([A, B])
    print(N - len(set(not_good)))

resolve()
# Judge status: Accepted
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    L = list(map(int, input().split()))
    L.sort()
    ans = 0
    for i in range(N):
        right = i + 2
        for left in range(i+1, N):
            while right < N and L[right] < L[i] + L[left]:
                right += 1
            ans += right - (left+1)
            if left == right:right += 1
    print(ans)
if __name__ == "__main__":
    main()
# Judge status: Accepted
n, k = map( int, input().split() )
a = [ 0 ] + list( map( int, input().split() ) )

now = 1
visited = [ 1, -1 ] + [ -1 ] * ( n - 1 )
diary = [ -1, 0 ] + [ -1 ] * ( n - 1 )

for i in range( 1, k+1 ):
    now = a[ now ]
    visited[ i ] = now
    if diary[ now ] != -1:
        cycle = i - diary[ now ]
        d = ( k - i ) % cycle
        now = visited[ diary[ now ] + d ]
        break
    else:
        diary[ now ] = i

print( now )
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
l=[0]*N
for i in range(N):
    if a[i]%4:
        if a[i]%2:l[i]=1
        else:l[i]=2
    else:l[i]=4
print('Yes'if(l.count(1)+(l.count(2)%2)+1)//2<=l.count(4)else'No')
# Judge status: Accepted
S, W = list(map(int, input().split()))

ans = "unsafe"
if S > W:
    ans = "safe"

print(ans)
# Judge status: Accepted
s = input()
k = int(input())
n = len(s)
cnt = 0
for i in range(n):
    if s[i] !="1":
        break
    cnt+=1
if k<=cnt:
    print(1)
else:
    print(s[cnt])
# Judge status: Accepted
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 200000

for i in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x-1] + b[y-1] - c)


ans = min(ans, min(a) + min(b))

print(ans)
# Judge status: Accepted
N = int(input())
X = [tuple(map(int, input().split())) for _ in range(N)]
X = reversed(X)

ans = 0
for a, b in X:
    a += ans
    if a % b == 0:
        continue
    ans += b - a % b
print(ans)
# Judge status: Wrong Answer
N = int(input())
An_all = input().split()
An = []
for i in range(N):
    An.append(int(An_all[i]))

mult = 1
for i in range(N):
    mult = mult * An[i]

if mult >= 10e18:
    print(-1)
else:
    print(mult)
# Judge status: Accepted
N,K,S = map(int,input().split())

pad = [10**9,10**9-1][(S == 10**9)]
l = ([S]*K)
l.extend([pad]*(N-K))

print(" ".join(map(str,l)))
# Judge status: Accepted
N = int(input())
H = []
for _ in range(N):
    h = tuple(map(int, input().split()))
    H.append(h)

dp = [H[0]]
for i in range(1, N):
    dp.append([
        max(dp[i-1][1] + H[i][0], dp[i-1][2] + H[i][0]),
        max(dp[i-1][0] + H[i][1], dp[i-1][2] + H[i][1]),
        max(dp[i-1][0] + H[i][2], dp[i-1][1] + H[i][2]),
    ])
print(max(dp[-1]))
# Judge status: Accepted
n = int(input())

nums = list(map(int, input().split()))
l = [int(x) for x in range(1, n + 1)]

remain = [0]
count = 0

for i in nums:
    if i == remain[-1] + 1:
        remain.append(i)
    else:
        count += 1

if nums == l:
    print(0)
elif (count > 0) and (count != n):
    print(count)
else:
    print(-1)
# Judge status: Wrong Answer
N,A,B=map(int,input().split())
if A<B:
  print(0)
if N==1 and A!=B:
  print(0)
else:
  print((N-2)*(B-A)+1)
# Judge status: Wrong Answer
s = input()
n = len(s)
A = []
for i in range(100):
    A.append(str(2019*i))

ans = 0
for a in A:
    for i in range(n):
        if i+len(a) <= n:
            if a == s[i:i+len(a)]:
                ans += 1
print(ans)
# Judge status: Accepted
from collections import Counter
N = int(input())
S = input()

rgb_cnt = Counter(S)
ans = rgb_cnt["R"] * rgb_cnt["G"] * rgb_cnt["B"] 

for i in range(1,N-1):
    max_dist = min(i,N-i-1)
    m = S[i]
    for d in range(1,max_dist+1): # 中心からの距離
        l = S[i-d]
        r = S[i+d]
        if (l!=m and r!=m and l!= r):
            ans -= 1
print(ans)
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
if a%b==0:
  print(a/b)
else:
  print(int(a/b)+1)
# Judge status: Wrong Answer
n=int(input())
s=input()

ans=s.count('E')
pin=ans

for i in range(1,n):
  if s[i-1]=='W':
    pin+=1
  if s[i]=='E':
    pin-=1
  ans=min(ans,pin)
  
print(ans)
# Judge status: Accepted
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K, Q, *A = map(int, read().split())
point = [K - Q] * (N + 1)

for i in A:
    point[i] += 1
ans = '\n'.join('Yes' if i > 0 else 'No' for i in point[1:])
print(ans)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()
import math

X = int(input())

ans = False
money = 100
year = 0
while money < X:
    money += money // 100
    year += 1

print(year)
# Judge status: Accepted
import numpy as np
import bisect
X = int(input())
A = np.cumsum(range(1, 10 ** 5))
idx = bisect.bisect_left(A, X)
print(idx + 1)
# Judge status: Accepted
def main():
    N = int(input())
    A = [int(input()) for i in range(N)]
    ans = 0
    for i in range(N):
        ans += A[i]//2
        A[i] %= 2
        if i < N - 1 and A[i] > 0 and A[i+1] > 0:
            ans += 1
            A[i] -= 1
            A[i+1] -= 1
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
stations = str(input())
bus = False
for i in range(0, len(stations)-2):
    if(stations[i] != stations[i+1]):
        bus = True

if(bus):
    print('Yes')
else:
    print('No')