peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N = int(input())
S = list(input())
maxCommon = 1
for i in range(1, N):
    # print(set(S[0:i]))
    # print(set(S[i:]))
    #print(set(S[0:i]) & set(S[i:]))

    commonNum = len(list(set(S[0:i]) & set(S[i:])))
    if commonNum > maxCommon:
        maxCommon = commonNum
print(maxCommon)
# Judge status: Accepted
S = [input() for _ in range(5)]
T = []
U = []
for i in range(5):
  T.append(S[i])
  if int(T[i][-1]) == 0:
    U.append(9)
  else:
    U.append(int(T[i][-1]))
del T[U.index(min(U))]
import math
a = 0
for i in range(4):
  a += math.ceil(int(T[i])*0.1)*10
a += int(S[U.index(min(U))])
print(a)
# Judge status: Accepted
n, k = map(int, input().split())
print(1-(k-n)//(k-1))
# Judge status: Wrong Answer
import fractions
import math

n,X= map(int,input().split())
x = list(map(int, input().split()))
x.append(X)

difflis = [0] * (n)

for i in range(n):
    difflis[i] = math.fabs(x[i+1] - x[i])

ans = difflis[0]
for i in range(i,len(difflis)):
    ans = fractions.gcd(ans,difflis[i])
print(int(ans))
# Judge status: Wrong Answer
N = int(input())
dp = [float('inf')]*(N+1)
dp[0] = 0
for i in range(N+1):
    if i+1 <= N:
        dp[i] = min(dp[i],dp[i-1]+1)
    for j in range(1,N+1):
        if i < 6**j:
            break
        dp[i] = min(dp[i-6**j]+1,dp[i])
    for k in range(1,N+1):
        if i < 9**k:
            break
        dp[i] = min(dp[i-9**k]+1,dp[i])
print(dp[N])
# Judge status: Accepted
n,a,b = map(int,input().split())

if (b-a)%2 == 0:
    print((b-a)//2)
    exit()

print(min(b,n-a+1,a+(b-a)//2,n-b+1 + (b-a-1)//2) )
# Judge status: Accepted
X = int(input())
dp = [False] * (X+1)
dp[0] = True
def judge(i, j):
    if i >= j:
        return dp[i-j]
    else:
        return False
    
for i in range(1, X+1):
    dp[i] = judge(i, 100) or judge(i, 101) or judge(i, 102) or judge(i, 103) or judge(i, 104) or judge(i, 105)
        
print(int(dp[X]))
# Judge status: Wrong Answer
S=input()
N=len(S)
Slis=[]
for i in range(N):
  Slis+=[int(S[i])]
T=[int(S[i:]) for i in range(N)]
MOD=[0 for i in range(2019)]
for i in range(N):
  tmp=T[i]%2019
  MOD[tmp]+=1
ans=0
for i in range(2019):
  tmp=MOD[i]
  ans+=tmp*(tmp-1)//2
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
lst = list(map(int, input().split()))
lst.sort()
print(sum(lst[:k]))
# Judge status: Accepted
from bisect import bisect_left

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

L.sort()

ans = 0
for i in range(N - 2):
  a = L[i]
  for j in range(i + 1, N - 1):
    b = L[j]
    c = bisect_left(L, a + b)
    ans += c - j - 1

print(ans)
# 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 = (10**8)*4
    result = 0
    for j in range(m):
        if abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]) < d:
            d = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
            result = j+1
    print(result)
# Judge status: Wrong Answer
# import bisect
# from collections import Counter, defaultdict, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())
    if n < 1000:
        print("ABC"+str(n).zfill(3))
    else:
        n -= 999
        print("ABD"+str(n).zfill(3))

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

ans = 0

for n in range(1, N + 1):
    if len(str(n)) % 2 == 1:
        ans += 1

print(ans)
# Judge status: Accepted
def Ryuka(n):
    L = [2,1]
    for i in range(n-1):
        L.append(L[len(L)-1]+L[len(L)-2])

    return L[len(L)-1]

def main():
    N = int(input())
    print(Ryuka(N))

if __name__ == "__main__":
    main()
# Judge status: Accepted
S = input()
print("2018"+S[4::])
# Judge status: Wrong Answer
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7
MAX = 10**18
MIN = -10**18

n,k= map(int,input().split())
d = list(map(int,input().split()))
able = [True]*10
for i in range(k):
    able[d[i]] = False
n = str(n)
ans = ""
for i in range(len(n)):
    s = int(n[i])
    for j in range(len(able)):
        if able[j] == False:
            continue
        if s<=j:
            ans += str(j)
            break
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+B-1+1)//2, (N-A+N-B+1)//2))
# Judge status: Accepted
import math
N = int(input())
a = min([int(input()) for _ in range(5)])
print(4+math.ceil(N/a))
# Judge status: Accepted
n,m=map(int,input().split())
a=[1]*n
b=[0]*n
b[0]=1
for _ in range(m):
    x,y=map(int,input().split())
    x-=1
    y-=1
    if a[x]>1:
        if b[x]==1:
            b[y]=1
        a[x]-=1
        a[y]+=1
    else:
        if b[x]==1:
            b[x]=0
            b[y]=1
        a[x]-=1
        a[y]+=1
print(sum(b))
# Judge status: Accepted
s=sum(list(map(int,input().split())))
if s<=21:
  print("win")
else:
  print("bust")
# Judge status: Accepted
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
ans=1
i=0
for i in range(n):
  d+=l[i]
  if d<=x:
    
    ans+=1
    #print(d)
  else:
    break
  
print(ans)
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))
l2 = [i for i in l if i % 2 == 0]
l3 = [i for i in l2 if i % 3 == 0]
l4 = [i for i in l2 if i % 5 == 0]
l5 = list(set(l4+l3))
if len(l5) != len(l2):
    print('DENIED')
else:
    print('APPROVED')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

def ruiseki(a):
    right, left = [], []
    l, r = 0, 0
    for i in range(n):
        l += a[i]
        left.append(l)
    
        r += a[-(i+1)]
        right.append(r)
    return left, right[::-1]

l, r = ruiseki(a)
ans = [abs(l[i] - r[i+1]) for i in range(n-1)]
print(min(ans))
# Judge status: Wrong Answer
import sys
s=0
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a=sum(A)
b=sum(B)
if a>b:
  print("No")
  sys.exit()
for i in range(N):
  if A[i]-B[i]>0:
    s+=A[i]-B[i]
if b-a<s:
  print("No")
  sys.exit()
else:
  print("Yes")
# Judge status: Accepted
A, B, C = map(int, input().split())

#%%
m = 1
while True:
    if (A * m) % B == 0:
        ans = 'NO'
        break
    elif (A * m) % B == C:
        ans = 'YES'
        break
    m += 1

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

for s in "abc":
  if s not in S:
    print("No")
    exit()
print("Yes")
# Judge status: Accepted
n, m = map(int, input().split())
ab = []
for _ in range(n):
    a, b = map(int, input().split())
    ab.append((a, b))
ab.sort()
ans = 0
for a, b in ab:
    buy = [m, b][0 <= m-b]
    m -= buy
    ans += a*buy
print(ans)
# Judge status: Wrong Answer
N = int(input())
qustions = []
summation = [0]*(N+1)
for i in range(N):
    tmp = int(input())
    summation[i + 1] = summation[i] + tmp
max = 0
for i in range(N+1):
    for j in range(N+1):
        diff = summation[j] - summation[i]
        if diff % 10 == 0:
            diff = 0
        if diff > max:
            max = diff
print(max)
# Judge status: Wrong Answer
n=int(input())
s=input()
# 数値(1〜26)→アルファベット(a〜z)
n2a = lambda c: chr(c+64).lower()
al=[]
for i in range(1,27):
  c=s.count(n2a(i))
  if c!=0:
    al.append(c)
def func(nums):
  if len(nums)==1:
    return nums[0]
  elif len(nums)==2:
    return nums[0]+nums[1]+nums[0]*nums[1]
  else:
    num=func(nums[1:])
    return nums[0]+num+nums[0]*num
print(func(al))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, (input().split())))
a.append(0)
mon = 1000
kab = 0
x = 0
for i in range(n):
    if a[i] <= a[i+1]:
        kab += mon//a[i]
        mon += kab*(a[i+1]-a[i])
print(mon)
# Judge status: Wrong Answer
N, X, T = map(int, input().split())
print((N//X+1)*T)
# Judge status: Accepted
s = input().split()[1]
result = 'A{}C'.format(s[0])
print(result)
# Judge status: Accepted
def main():
    a, b, c = map(int, input().split())
    total = b // a
    if total > c:
        print(c)
    else:
        print(total)

main()
# Judge status: Wrong Answer
a,v = map(int,input().split())
b, w= map(int,input().split())
t = int(input())
A = a+(t*v)
B = b+(t*w)
if a == b:
    print('YES')
elif a < b:
    if B < A:
        print('YES')
    else:
        print('NO')
else:
    A = a-(t*v)
    B = b-(t*w)
    if A <= B:
        print('YES')
    else:
        print('NO')
# Judge status: Wrong Answer
def main():
	n = int(input())
	arr = list(map(int,input().split()))
	for i in range(len(arr)-1):
		if arr[i]>arr[i+1]:
			arr[i]-=1
	for i in range(len(arr)-1):
		if arr[i]>arr[i+1]:
			print("No")
			return
	print("Yes")
	return


main()


# 1 2 3 4 5
# 1 3 3 4 5
# 1 4 3 4 5
# Judge status: Wrong Answer
menu=[]
menu2=[]
total=False
c=0
total2=0
for i in range(5):
    a=int(input())
    menu.append(a)
    menu2.append(a%10)
    if a%10==0:
        total2+=1
for i in range(1,10):
    for k in range(5):
        if menu2[k]==i:
            total=True
            c=k
            break
    if total==True:
        break
print(sum(menu)+10*(4-total2)-sum(menu2)+menu2[c])
# Judge status: Wrong Answer
K = int(input())
A, B = [int(i) for i in input().split()]

if B // K - A // K >= 1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a, b, c = map(int, input().split())
if 4*a*b < (c-a-b)**2 and c-a-b > 0:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N = str(input())
if "9" in N:
  ans = "YES"
else:
  ans ="NO"
print(ans)
# Judge status: Wrong Answer
n,K = map(int,input().split())
p = min(n,K-1)
ans = 0
chk = [1]*(K-1)
k = K
for i in range(14):
  k /= 2
  if k == int(k):
    q = int(k*2-k-1)
  else:
    q = int(k*2-k)
  for i in range(q):
    chk[i] += 1
  if k <= 1:
    break
    
#print(chk)
for i in range(p):
  ans += float(1/(2**chk[i]*n))
  #print(ans)
ans += max(0,(n-K+1)/n)
print(ans)
# Judge status: Accepted
s=int(input())
mod = 10**9+7

dp = [0]*(s+1)
dp[0] = 1
x = 0

for i in range(1,s+1):
  if i-3>=0:
    x += dp[i-3]
    x %= mod
  dp[i]=x
print(dp[s])
# Judge status: Accepted
from itertools import permutations

N = int(input())
lx, ly = [], []
for _ in range(N):
    xi, yi = list(map(int, input().split()))
    lx.append(xi)
    ly.append(yi)

fN = 1
for i in range(1, N + 1):
    fN *= i

mcost = 0
for x in permutations(list(range(N))):
    cost = 0.0
    for i in range(len(x) - 1):
        dij = ((lx[x[i]] - lx[x[i + 1]]) ** 2 + (ly[x[i]] - ly[x[i + 1]]) ** 2) ** 0.5
        cost += dij
    mcost += cost / fN
print(mcost)
# Judge status: Wrong Answer
nums = list(map(int, input().split()))

print(nums.count(1))
# Judge status: Accepted
N,A,B=map(int,input().split())
if (B-A)%2:
    print(min(A-1,N-B)+1+(B-A-1)//2)
else:
    print((B-A)//2)
# Judge status: Accepted
N=int(input())
if N%2==0:
  print(float(1/2))
else:
  print(float(1-(N-1)/2/N))
# Judge status: Accepted
S = str(input())
list_S = list(S)
length = len(list_S)
xxx = ["x"] * len(list_S)

print("".join(xxx))
# Judge status: Accepted
A,B,C=map(int,input().split())

if C-(A-B)<=0:
    print(0)
else:
    print(C-(A-B))
# Judge status: Accepted
A,B,C,D = list(map(int,input().split()))
T = -(-C//B)
AO = -(-A//D)
print('Yes' if T<=AO else 'No')
# Judge status: Wrong Answer
import math
d=10**5+1
n,x=map(int, input().split())
a=[int(x) for x in input().split()]
a.append(x)
a.sort()

for i in range(n-1):
    D=math.gcd(a[i+1]-a[i],a[i+2]-a[i])
    if D<d:
        d=D

if x==1:
    d=abs(a[1]-a[0])
        
print(d)
# Judge status: Wrong Answer
list = input().split()
N = int(list[0])
K = int(list[1])
i = K
s = 0

def sum(a,b):
    i=0
    i = (a + b)*(b - a + 1)/2
    return i

while i <= N + 1:
    #print(sum(N-i+1,N) + sum(0,i-1))
    s = s + sum(N-i+1,N) - sum(0,i-1) + 1
    i += 1
print(s)
# Judge status: Accepted
from sys import stdin
import math


def combinations_count(n, r):

    # print(n)
    # print(r)
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


S = int(stdin.readline().rstrip())

if S < 3:
    print(0)
else:
    x = S // 3
    y = S % 3
    count = 0

    for i in range(x):
        j = i + 1
        count = count + combinations_count((S - (3 * j) + 1) + i - 1, i)

    print(count % (10 ** 9 + 7))
# Judge status: Accepted
s = input()

res = "abcdefghijklmnopqrstuvwxyz"

for i in range(len(s)):
    res = res.replace(s[i], "")
if len(res) == 0:
    print("None")
else:
    print(res[0])
# Judge status: Accepted
import sys
def I():
    return int(sys.stdin.readline().rstrip())

N = I()

L = []
for i in range(N+1):
    if i == 0:
        L.append(2)
    elif i == 1:
        L.append(1)
    else:
        L.append(L[-1]+L[-2])
print(L[-1])
# Judge status: Accepted
from collections import Counter
n = int(input())
a = Counter(list(map(int, input().split())))

ans = 0
for x,y in a.items():
  cnt = y
  if x-1 in a: cnt += a[x-1]
  if x+1 in a: cnt += a[x+1]
  if cnt > ans: ans = cnt
print(ans)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
b = list(map(int, read().split()))
cnt = 0
for aa, bb in zip(a, b):
    v = bb - aa
    if bb > aa:
        v //= 2
    cnt += v
if cnt >= 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))

ans = 0
c = 0
for i in range(n):
    if p[i] == i+1:
        c += 1
    if p[i] != i+1:
        if c > 1:
            ans += c - 1
        elif c == 1:
            ans += c
        c = 0

if c == n:
    ans += c- 1 

print(ans)
# Judge status: Wrong Answer
n, m, k = map(int, input().split())
for i in range(n):
  for j in range(m):
    if i * m + (n - 2 * i) * j == k:
      print("Yes")
      exit()
print("No")
# Judge status: Accepted
k,x=map(int,input().split())
for i in range(x-k+1,x+k):
    print(i, end=" ")
# Judge status: Accepted
n,m = map(int,input().split())
li = list(map(int,input().split()))
soutouhyou = sum(li)
tokuhyou = soutouhyou/(4*m)
num = sum(x >= tokuhyou for x in li)
if num >= m:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
print(a-k,b) if a>=k else print(0,a+b-k)
# Judge status: Accepted
str_list = list(input())

for i in range(len(str_list)):
	if(str_list[i] == "?"):
		str_list[i] = "D"
o_str = "".join(str_list)
print(o_str)
# Judge status: Wrong Answer
X = int(input())
if X == 3 or X == 5 or X == 7:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a = int(input())
s = input()

if a >= 3200:
    print(s)
elif a < 3200:
    print("red")
# Judge status: Accepted
li = sorted(list(map(int, input().split())))
print(li[2]*10+li[0]+li[1])
# Judge status: Wrong Answer
List=0
for i in range(3):
    List+=sum(list(list(map(int, input().split()))))

#print(List)
if List%3==0 :
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N,M = map(int,input().split())
X = list(map(int,input().split()))
x = []
ans = 0
X.sort()
if N >= M:
  print(0)
  exit()
for i in range(M-1):
  x.append(abs(X[i]-X[i+1]))
xx = sorted(x,reverse=True)
for j in range(N-1):
  xx[j] = 0
ans = sum(xx)
print(ans)
# Judge status: Accepted
S = input()

if S =='ABC':
  print('ARC')
else:
  print('ABC')
# Judge status: Accepted
A, B, C = map(int, input().split())
S = A * B * C
long = max(A, B, C)
S //= long
diff = S if long % 2 != 0 else 0
print(diff)
# Judge status: Accepted
li = list(input())

lik = li[1::2]
lig = li[0::2]
a = 0
b = 0


if 'L' in lig:
    a = a + 1

if 'R' in lik:
    b = b + 1

if a + b == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S,W = map(int,input().split())

if W >= S:
    print('unsafe')
else:
    print('safe')
# Judge status: Wrong Answer
D=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for i in range(D)]
# Judge status: Accepted
N = int(input())
As = list(map(int, input().split()))

money = 1000
for i in range(1, N):
    if As[i] > As[i-1]:
        n = money // As[i-1]
        money = money - (As[i-1] * n) + (As[i] * n)
print(money)
# Judge status: Wrong Answer
K = int(input())
x = 7
count = 1
if K % 2 == 0:
  print("-1")
  exit(0)
for i in range(10**5):
  if x % K == 0:
    print(count)
    exit(0)
  else:
    x = 10*x + 7
    count += 1
print("-1")
# Judge status: Accepted
from math import degrees,atan2
a,b,x=map(int,input().split())
if a**2*b/2>=x:
    height=2*x/(a*b)
    print(degrees(atan2(b,height)))
else:
    height=2*(a**2*b-x)/a**2
    print(degrees(atan2(height,a)))
# Judge status: Accepted
import math
x,y = map(int,input().split())
tmp = 1
while x*(2**tmp) <= y:
    tmp += 1
print(tmp)
# Judge status: Wrong Answer
alph = input()
print(ord(alph)+1)
# Judge status: Wrong Answer
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))

m = max(A)
c = A.count(m)
if c == 1:
    m2 = sorted(set(A))[1]
    for i in A:
        print (m) if i != m else print(m2)
else:
    for _ in range(n):
        print (m)
# Judge status: Accepted
N,M = map(int, input().split())
A = [[] for i in range(N)]
for i in range(M):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    A[a].append(b)
    A[b].append(a)

if len(A[0])+len(A[-1]) != len(set(A[0]+A[-1])):
        print("POSSIBLE")
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
n,k = map(int,input().split())
a_list = list(map(int,input().split()))
a = 0
t = 1
d = 0
hoge_list = []
hoge_set = set()
while a < k:
  hoge_list.append(t)
  hoge_set.add(t)
  t = a_list[t-1]
  a += 1
  if t in hoge_set:
    b = hoge_list.index(t)
    d += 1
    break
if d == 0:
  print(t)
else:
  e = (k-b)%(a-b)
  print(hoge_list[b+e])
# Judge status: Wrong Answer
from itertools import product
import numpy as np
a = int(input())
b = int(input())
c = int(input())
x = int(input())

a = ', '.join([str(sum(el)) for el in 
               product(
                   np.arange(a+1)*500, np.arange(b+1)*100, np.arange(c+1)*50
               )]) + ', '
print(a.count(
    ', {},'.format(x)
))
# Judge status: Accepted
m = int(input())%10
if m in [2,4,5,7,9]:
    print("hon")
elif m in [0,1,6,8]:
    print("pon")
else:
    print("bon")
# Judge status: Accepted
import math
N = int(input())
while N>=1:
    max = math.ceil((-1+(1+8*N)**0.5)/2)
    print(max)
    N -= max
# Judge status: Accepted
s = list(input())
s.sort()
print('Yes'if s[0] == 'a' and s[1] == 'b' and s[2] == 'c' else 'No')
# Judge status: Wrong Answer
a, b, c, d = map(lambda x: int(x), input().split())

if a - c <= d:
  print('Yes')
elif abs(a - b) <= d and abs(b - c) <= d:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n = str(input())
num = 0
for i in range(len(n)):
  num += int(n[i])
if num % 9 == 0:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n, m = map(int,input().split())
box = [[1,0] for i in range(n)]#個数、赤の可能性
box[0][1] = 1
ans = 1

for i in range(m):
    x, y = map(int,input().split())
    if box[x-1][0] == 0:
        continue
    box[x-1][0] -= 1
    box[y-1][0] += 1
    if box[x-1][1] == 1:
        if box[y-1][1] == 0:
            box[y-1][1] = 1
            ans += 1
        if box[x-1][0] == 0:
            ans -= 1

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

k = 100000000000000000000
for i in range(len(S)-2):
    k = min(k, abs(753-(100*int(S[i])+10*int(S[i+1])+int(S[i+2]))))

print(k)
# Judge status: Accepted
import sys
import bisect
N = int(input())
L = list(map(int, input().split()))
LS = sorted(L)
ans = 0
for i in range(N):
  for j in range(N):
    if i < j:
      index = bisect.bisect_left(LS,LS[i]+LS[j])
      ans += index-j-1 

print(ans)
# Judge status: Accepted
A, B, C, X, Y = map(int, input().split())
    

if X >= Y:
    ans = min(A*X + B*Y, 2*C*Y + A*(X-Y), 2*C*X)
else:
    ans = min(A*X + B*Y, 2*C*X + B*(Y-X), 2*C*Y)

print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3
h, w = map(int, input().split())
print(((h + 1) // 2) * ((w + 1) // 2) + (h // 2) * (w - ((w + 1) // 2)))
# Judge status: Accepted
import numpy as np

xx, yy = map(int, input().split())

B = [(0, 0), (1, 0), (0, 1), (1, 1)]

ans = float("inf")
for i, j in B:
    x, y = xx, yy
    # print(f"i, j, {i}{j}")
    if i:
        x *= -1
    if j:
        y *= -1
    if y >= x:
        ans = min(ans, y-x + i + j)
    # print(ans)

print(ans)
# Judge status: Accepted
from sys import stdin
import math
a=stdin.readline()

for k in range(0,len(a)):
    if a[k]=='?':
        print('D',end='')
    else:
        print(a[k],end='')
# Judge status: Wrong Answer
N, L, *inputs = input().split()

inputs.sort()
"".join(inputs)
print(inputs);
# Judge status: Accepted
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

alist = []
ans = 0

for i in range(X):
    alist.append(p[i])
    
for j in range(Y):
    alist.append(q[j])
    
for k in range(C):
    alist.append(r[k])
    
alist.sort(reverse=True)
    
for k in range(X+Y):
    ans += alist[k]

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

h = []
for _ in range(N):
    h.append(int(input()))
h.sort()

min = float("inf")
for i in range(N-K+1):
    temp = h[K+i-1]-h[i]
    if min > temp:
        min = temp

print(min)
# Judge status: Wrong Answer
n, k, q = map(int, input().split())
#print(n,k,q)
l = [0] * n
#print(l)
katen = [0] * q
my_append = katen.append
for i in range(q):
    my_append(int(input()))
#print(katen)

my_pop = l.pop
my_insert = l.insert
for j in katen:
    x = my_pop(j-1)
    my_insert(j-1, x+1) 
#print(l)

for y in range(n):
    if l[y] > q-k:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
N,M = map(int,list(input().split()))
i_list = [0]*M
for i in range(N):
    s = list(input().split())
    for j in range(int(s[0])):
        i_list[int(s[j])-1] += 1
counter = 0
for i in range(M):
    if i_list[i] == N:
        counter += 1   
    
print(counter)
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))
mi = n+2
ans = 0
for i in a:
   if mi > i:
      ans+=1
      
   mi=min(i,mi)

print(ans)
# Judge status: Accepted
import sys
def S(): return sys.stdin.readline().rstrip()
S = S()
ans = 1
compared = S[0]
now = ''
for x in S[1:]:
    now += x
    if compared!=now:
        ans +=1
        compared = now
        now = ''
print(ans)
# Judge status: Accepted
S = input()
man = 0
cnt = 0
l = ['A', 'C', 'G', 'T']
for s in S:
    res = False
    for i in l:
        if s == i:
            cnt += 1
            res = True
    if res == False:
        cnt = 0
    if man < cnt:
        man = cnt
print(man)
# Judge status: Wrong Answer
n=list([i for i in range(5)])
a=int(input())
b=0
for i in n:
  if i==i:
    break
  elif i-i<0:
    break
  elif i-i>k:
    b+=1
if b>0:
  print(':(')
else:
  print('Yay!')
# Judge status: Accepted
def main():
    from math import ceil
    n, h, *ab = map(int, open(0).read().split())

    *c, = map(lambda x: -x, ab[::2])
    d = sorted(c + ab[1::2], key=abs, reverse=True)
    ans = 0
    for x in d:
        if x < 0:
            ans += ceil(h / abs(x))
            break

        h -= x
        ans += 1
        if h <= 0:
            break

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N=int(input())
L=list(map(int,input().split()))
A=sorted(L)
if A[-1]<(sum(A))-A[-1]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
arr = [int(x) for x in input().split()]
s = len(arr)
cnt = 0
if s == 1 or s == 2:
  print(0)
else:
  for i in (0,s - 2):
    for j in (i, s - 1):
      for k in (j, s):
        l = []
        l.append(i)
        l.append(j)
        l.append(k)
        l.sort()
        i = l[2]
        j = l[1]
        k = l[0]
        if i < j + k:
          cnt += 1
  print(cnt)