CodeEff/ECCO huggingface dataset:
# Original solution
from sys import stdin
input = stdin.readline
 
A,V = input().rstrip().split()
B,W = input().rstrip().split()
T = int(input().rstrip())
A,V,B,W = int(A),int(V),int(B),int(W)
s=0
if V<=W:
  print('NO')
  s=1
else:
  for t in range(T):
    if B<A:
      A-=V
      B-=W
      if B>=A:
        print('YES')
        s=1
        break
    else:
      A+=V
      B+=W
      if B<=A:
        print('YES')
        s=1
        break
if s!=1:
  print('NO')

# Optimized solution
from sys import stdin
input = stdin.readline
 
A,V = input().rstrip().split()
B,W = input().rstrip().split()
T = int(input().rstrip())
A,V,B,W = int(A),int(V),int(B),int(W)
s=0
L1=A-B
L2=B-A
S=V-W
if V<=W:
  print('NO')
  s=1
else:
    if B<A:
      if L1/S<=T:
        print('YES')
      else:print('NO')
    else:
      if L2/S<=T:
        print('YES')
      else:print('NO')
# Original solution

import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return list(map(int,input().split()))
def ii():
    return int(eval(input()))
sys.setrecursionlimit(10**9)
A,VA = mips()
B,VB = mips()
T = ii()
if A <= B:
    d1 = A + VA * T
    d2 = B + VB * T
    if d1 >= d2:
        print("YES")
    else:
        print("NO")
else:
    d2 = B - VB * T
    d1 = A - VA * T
    if d1 <= d2:
        print("YES")
    else:
        print("NO")

# Optimized solution
import sys
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return list(map(int,input().split()))
def ii():
    return int(eval(input()))
sys.setrecursionlimit(10**9)
A,VA = mips()
B,VB = mips()
T = ii()
if A <= B:
    d1 = A + VA * T
    d2 = B + VB * T
    if d1 >= d2:
        print("YES")
    else:
        print("NO")
else:
    d2 = B - VB * T
    d1 = A - VA * T
    if d1 <= d2:
        print("YES")
    else:
        print("NO")
# Original solution
A, V = [int(n) for n in input().split()]
B, W = [int(n) for n in input().split()]
T = int(eval(input()))

if V <= W:
    print('NO')
    exit()


va = [A + V * t for t in range(1, T+1)]
va.extend([A - V * t for t in range(1, T+1)])
vb = [B + W * t for t in range(1, T+1)]
vb.extend([B - W * t for t in range(1, T+1)])

for a in va:
    for b in vb:
        if a == b:
            print('YES')
            exit()
print('NO')


# Optimized solution
A, V = [int(n) for n in input().split()]
B, W = [int(n) for n in input().split()]
T = int(eval(input()))

if V <= W:
    print('NO')
    exit()

d = abs(A - B)

if V > W and d <= (V - W) * T:
    print('YES')
else:
    print('NO')
# Original solution
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

from decimal import Decimal
a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(eval(input()))
if a == b:
    print("YES")
elif v <= w:
    print("NO")
elif a < b and w*t + b > v*t + a:
    print("NO")
elif a < b and -(w*t) + b < -(v*t) + a:
    print("NO")
else:
    now_a = a
    now_b = b
    for i in range(1, t+1):
        if now_a < now_b:
            now_a += v
            now_b += w
        else:
            now_a -= v
            now_b -= w
        if now_a == now_b:
            print("YES")
            exit()
        else:
            pass
    print("NO")

# Optimized solution
a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(eval(input()))
if (v-w)*t >= abs(a-b):
    print("YES")
else:
    print("NO")
# Original solution
a,v = list(map(int, input().split()))
b,w = list(map(int, input().split()))
T = int(eval(input()))
if v == w:
  print("NO")
  exit()

for i in range(0,T+1):
  if a == b:
    print("YES")
    exit()
  else:
    if a < b:
      a = a+v
      b = b+w
    else:
      a = a-v
      b = b-w
    
print("NO")

# Optimized solution
a,v = list(map(int,input().split()))
b,w = list(map(int,input().split()))
T = int(eval(input()))
if abs((b-a))<=(v-w)*T:
	print("YES")
else:
	print("NO")
# Original solution
a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(eval(input()))

dist = abs(b - a)
mys = v - w

for i in range(t):
  dist -= mys
  if dist <= 0:
    print("YES")
    exit()
print("NO")

# Optimized solution
a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(eval(input()))

dist = abs(b - a)
mys = v - w

if mys * t >= dist:
  print("YES")
else:
  print("NO")
# Original solution
A, V = list(map(int, input().split()))
B, W = list(map(int, input().split()))
T = int(eval(input()))

ok = False
for i in range(T+1):
    if A + (V*T) >= B + (W*T):
        ok = True

if ok:
    print("YES")
else:
    print("NO")


# Optimized solution
A, V = list(map(int, input().split()))
B, W = list(map(int, input().split()))
T = int(eval(input()))

if V<=W:
    print("NO")
    import sys
    sys.exit()
import math
if abs(B-A)/(V-W) <= T:
    print("YES")
else:
    print("NO")
# Original solution
n=int(eval(input()))
nn=n
l=len(str(n))
k=0
for i in range(n):
    k+=n%10
    n=n//10
print((['No','Yes'][nn%k==0]))

# Optimized solution
n=int(eval(input()))
nn=n
l=len(str(n))
k=0
for i in range(n):
    k+=n%10
    n=n//10
    if(n == 0):
        break
print((['No','Yes'][nn%k==0]))
# Original solution
N = int(eval(input()))

S = str(N)
total = 0
for s in S:
    total += int(s)

print(("Yes" if N%total==0 else "No"))

# Optimized solution
N = int(eval(input()))

S,N2 = 0,N
while N2 >= 1:
    S += N2%10
    N2 //= 10

print(("Yes" if N%S==0 else "No"))
# Original solution
# -*- coding: utf-8 -*-
# 標準入力を取得
N = int(eval(input()))

# 求解処理


def S(n: int) -> int:
    return sum(map(int, str(n)))


ans = str()
if N % S(N) == 0:
    ans = "Yes"
else:
    ans = "No"

# 結果出力
print(ans)


# Optimized solution
# -*- coding: utf-8 -*-

def get_input() -> int:
    """
    標準入力を取得する.

    Returns:\n
        int: 標準入力
    """
    N = int(eval(input()))

    return N


def S(n: int) -> int:
    """
    各桁の和を取得する.

    Args:\n
        n (int): 整数

    Returns:\n
        int: 各桁の和
    """
    return sum(map(int, str(n)))


def main(N: int) -> None:
    """
    メイン処理.

    Args:\n
        N (int): 整数(1 <= N <= 10**9)
    """
    # 求解処理
    ans = str()
    if N % S(N) == 0:
        ans = "Yes"
    else:
        ans = "No"

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    N = get_input()

    # メイン処理
    main(N)
# Original solution
def sum_digit(num):
    sum = 0
    while num > 0:
        sum += num % 10
        num //= 10
    return sum

N = int(eval(input()))
S = sum_digit(N)
if N % S == 0:
    print("Yes")
else:
    print("No")

# Optimized solution
def sum_digit(num):
    sum = 0
    while num > 0:
        sum += num % 10
        num //= 10
    return sum

N = int(eval(input()))
print(("Yes" if N % sum_digit(N) == 0 else "No"))
# Original solution
n = int(eval(input()))
a = list(str(n))
s = sum([int(a[i]) for i in range(len(a))])
if n%s==0:
    print('Yes')
else:
    print('No')

# Optimized solution
n = int(eval(input()))
a = list(str(n))
c = 0
for i in range(len(a)):
    c+=int(a[i])
if n%c==0:
    print('Yes')
else:
    print('No')
# Original solution
N = int(eval(input()))
sum = 0
a = N
while a > 0:
    sum += a % 10
    a = a // 10

if N % sum == 0:
    print('Yes')
else:
    print('No')



# Optimized solution
n = str(eval(input())); print(("Yes" if int(n) % sum([int(n[i]) for i in range(len(n))]) == 0 else "No"))
# Original solution
N = int(eval(input()))

L = len(str(N))
S = sum([N // 10**i for i in range(1, N+1)])

if N % S == 0:
    print("Yes")
else:
    print("No")

# Optimized solution
N = str(eval(input()))


S = sum([int(i) for i in N])

if int(N) % S == 0:
    print("Yes")
else:
    print("No")
# Original solution
N = int(eval(input()))
if(N%sum(map(int,str(N))) == 0):
  print("Yes")
else:
  print("No")

# Optimized solution
N = int(eval(input()))
if(N%sum(list(map(int,str(N)))) == 0):
  print("Yes")
else:
  print("No")
# Original solution
import queue
while 1:
    n,k=list(map(int,input().split()))
    if n==0:break
    a=queue.deque(int(eval(input())) for _ in range(k))
    m=sum(a)
    for i in range(n-k):
        a.popleft()
        a.append(int(eval(input())))
        m=max(m,sum(a))
    print(m)

# Optimized solution
import queue
while 1:
    n,k=list(map(int,input().split()))
    if n==0:break
    a=queue.deque(int(eval(input())) for _ in range(k))
    m=b=sum(a)
    for i in range(n-k):
        c=a.popleft()
        d=int(eval(input()))
        a.append(d)
        b+=d-c
        m=max(b,m)        
    print(m)
# Original solution
while True:
    n,k=list(map(int,input().split()))
    if n==k==0:break
    L=[eval(input()) for i in range(n)]
    maxInt=-100000
    for i in range(n-k):
        maxInt=max(maxInt,sum(L[i:i+k]))
    print(maxInt)

# Optimized solution
while True:
    n,k=list(map(int,input().split()))
    if n==k==0:break
    L=[eval(input()) for i in range(n)]
    maxInt=-10000000
    temp=sum(L[:k])
    for i in range(k,n):
        maxInt=max(maxInt,temp)
        temp=temp+L[i]-L[i-k]
    print(maxInt)
# Original solution
while True:
  n,k = list(map(int,input().split()))
  if n == 0 and k == 0:
    break
  lst = []
  for i in range(n):
    lst.append(int(eval(input())))
  count = 0
  for i in range(k):
    count += lst[i]
  ans = count
  for i in range(k, n):
    count += lst[i]
    count -= lst[i - k]
    ans = max(ans,count)
  print(ans)



# Optimized solution
def main():
  while True:
    n,k = list(map(int,input().split()))
    if n == 0 and k == 0:
      break
    lst = []
    for i in range(n):
      lst.append(int(eval(input())))
    count = 0
    for i in range(k):
      count += lst[i]
    ans = count
    for i in range(k, n):
      count += lst[i]
      count -= lst[i - k]
      ans = max(ans,count)
    print(ans)

if __name__ == '__main__':
  main()
# Original solution
from collections import deque
while True:
    n, k = list(map(int, input().split()))
    if n==0:break
    a = deque(int(eval(input())) for _ in range(k))
    ans = sum(a)
    for _ in range(n-k):
        a.popleft()
        a.append(int(eval(input())))
        tmp = sum(a)
        if ans < tmp: ans = tmp
    print(ans)

# Optimized solution
from collections import deque
while True:
    n, k = list(map(int, input().split()))
    if n==0:break
    a = deque(int(eval(input())) for _ in range(k))
    ans=tmp=sum(a)
    for _ in range(n-k):
        x = a.popleft()
        y = int(eval(input()))
        a.append(y)
        tmp += y - x
        ans = max(ans, tmp)
    print(ans)
# Original solution
import sys

#fp = open("input.txt", "r")
fp = sys.stdin

while True:
    req = list(map(int, fp.readline()[:-1].split(" ")))
    if req[0] + req[1] == 0:
        break

    n = req[0]
    k = req[1]

    sum_max = 0
    num_list = []
    
    for i in range(n):
        num = int(fp.readline()[:-1])
        num_list.append(num)
        if k > 0:
            sum_max += num
            k -= 1
            continue
        else:
            num_list.pop(0)
            sum_tmp = sum(num_list)
            if sum_tmp > sum_max:
                sum_max = sum_tmp

    print(sum_max)

# Optimized solution
import sys

#fp = open("input.txt", "r")
fp = sys.stdin

while True:
    req = list(map(int, fp.readline()[:-1].split(" ")))
    if req[0] + req[1] == 0:
        break

    n = req[0]
    k = req[1]

    sum_max = 0
    sum_prev = 0
    num_list = []
    
    for i in range(n):
        num = int(fp.readline()[:-1])
        num_list.append(num)
        if k > 0:
            sum_max += num
            k -= 1
            sum_prev = sum_max
            continue
        else:
            sum_tmp = sum_prev + num - num_list.pop(0)
            sum_prev = sum_tmp
            if sum_tmp > sum_max:
                sum_max = sum_tmp

    print(sum_max)
# Original solution
# coding: utf-8
# Your code here!
n,H=list(map(int,input().split()))
S=[]
for i in range(n):
    
    S.append(list(map(int,input().split())))
    
a=[]
b=[]
for i in range(n):
    a.append(S[i][0])
    
for i in range(n):
    if(max(a)<S[i][1]):
        b.append(S[i][1])

b.sort()
b.reverse()
k=0
count=0
while H>0:
    if len(b)>k:
        H-=b[k]
        k+=1
        count+=1
    else:
        
        count+=H//max(a)
        if(H%max(a)!=0):
            count+=1
        H=0

print(count)


# Optimized solution
# coding: utf-8
# Your code here!
n,H=list(map(int,input().split()))
S=[]
for i in range(n):
    
    S.append(list(map(int,input().split())))
    
a=[]
b=[]
for i in range(n):
    a.append(S[i][0])

maxa=max(a)    
for i in range(n):
    if(maxa<S[i][1]):
        b.append(S[i][1])

b.sort()
b.reverse()
k=0
count=0
lenb=len(b)
while H>0:
    if lenb>k:
        H-=b[k]
        k+=1
        count+=1
    else:
        
        count+=H//maxa
        if(H%maxa!=0):
            count+=1
        H=0

print(count)
# Original solution
n,h=list(map(int,input().split()))
ab=[list(map(int,input().split())) for i in range(n)]
a_max=0
b=[]
ans=0
kaisuu=0
for i in range(n):
  if a_max<ab[i][0]:
    a_max=ab[i][0]
for i in range(n):
  b.append(ab[i][1])
b.sort(reverse=True)
i=0
while True:
  if len(b)>i and a_max<b[i]:
    h-=b[i]
    kaisuu+=1
  else:
    if h%a_max==0:
      kaisuu+=(h//a_max)
    else:
      kaisuu+=((h//a_max)+1)
    break
  if h<=0:
    break
  i+=1
print(kaisuu)  

# Optimized solution
n,h=list(map(int,input().split()))
A=[]
B=[]
for i in range(n):
  a,b=list(map(int,input().split()))
  A.append(a)
  B.append(b)
A=max(A)
B.sort(reverse=True)
count=0
for i in B:
  if A>i:
    break
  else:
    if h>0:
      h-=i
      count+=1
    else:
      break
if h%A==0 and h>0:
  print((count+h//A))
elif h%A!=0 and h>0:
  print((count+h//A+1))
else:
  print(count)
# Original solution
n,h=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(n)]
a=[l[i][0] for i in range(n)]
maxA=max(a)
b=[l[i][1] for i in range(n)]
b.sort()
b.reverse()
damage=0
count=0
f=0
for i in range(n):
  if damage>=h:
    f=1
    break
  else:
    if b[i]>max(a):
      damage+=b[i]
      count+=1
    else:
      break
if f==1:
  print(count)
else:
  count+=((h-damage-1)//maxA)+1
  print(count)

# Optimized solution
n,h=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(n)]
a=set()
for i in range(n):
  a.add(l[i][0])
maxA=max(a)
b=[]
for i in range(n):
  if l[i][1]>maxA:
    b.append(l[i][1])
b.sort()
b.reverse()
damage=0
count=0
f=0
for i in range(len(b)):
  if damage>=h:
    f=1
    break
  else:
    if b[i]>maxA:
      damage+=b[i]
      count+=1
    else:
      break
if f==1:
  print(count)
else:
  count+=((h-damage-1)//maxA)+1
  print(count)
# Original solution
N, H = list(map(int,input().split()))
L = []
maxi = 0
for _ in range(N):
    a,b = list(map(int,input().split()))
    maxi = max(maxi, a)
    L.append((a,b))
L = [x for x in L if x[1] > maxi]
L = sorted(L,key = lambda x:x[1],reverse=True)
throw = 0
for i in range(len(L)):
    throw += L[i][1]
    if throw >= H:
        print((i + 1))
        quit()
from math import ceil
print((ceil((H - throw) / maxi) + len(L)))
    


# Optimized solution
N, H = list(map(int,input().split()))
L = []
maxi = 0
for _ in range(N):
    a,b = list(map(int,input().split()))
    maxi = max(maxi, a)
    L.append(b)
 
L = sorted([x for x in L if x > maxi],reverse=True)
throw = 0
for i in range(len(L)):
    throw += L[i]
    if throw >= H:
        print((i + 1))
        quit()
from math import ceil
print((ceil((H - throw) / maxi) + len(L)))
# Original solution
import sys

N, H = list(map(int, sys.stdin.readline().split()))

katanas = []
for i in range(N):
    a, b = list(map(int, sys.stdin.readline().split()))
    katanas.append((a, b, i))

sk = sorted(katanas, reverse=True)
max_k = sk[0][0]

katanas.sort(key = lambda x:x[1], reverse=True)
ans = 0
i = 0
while H > 0:
    if i < N and katanas[i][1] > max_k:
        H -= katanas[i][1]
        i += 1
        ans += 1
    else:
        tmp = (H - 1) // max_k + 1
        H -= tmp * max_k
        ans += tmp
        
print(ans)

# Optimized solution
import sys

input = sys.stdin.readline

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

max_a = sorted(katanas, reverse=True)[0][0]
throws = []
for a, b in katanas:
    if max_a < b:
        throws.append(b)

ans = 0
for b in sorted(throws, reverse=True):
    H -= b
    ans += 1
    if H <= 0:
        print(ans)
        sys.exit()

print((ans + (H - 1) // max_a + 1))
# Original solution
n,h=list(map(int,input().split()))
A=[]
B=[]
C=[]
for i in range(n):
    a,b=list(map(int,input().split()))
    A.append(a)
    B.append(b)
amax=max(A)
for i in range(n):
    if amax<=B[i]:
        C.append(B[i])
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
cnt=0
ans=0
for i in range(len(C)):
    if ans<h:
        ans+=C[i]
    else:
        break
    cnt+=1
if ans<h:
    if ((h-ans)//amax)*amax>=h-ans:
        cnt+=(h-ans)//amax
    else:
        cnt+=(h-ans)//amax+1
        
print(cnt)

# Optimized solution
n,h=list(map(int,input().split()))
A=[]
B=[]
C=[]
for i in range(n):
    a,b=list(map(int,input().split()))
    A.append(a)
    B.append(b)
amax=max(A)
for i in range(n):
    if amax<=B[i]:
        C.append(B[i])
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
cnt=0
ans=0
for i in range(len(C)):
    if ans<h:
        ans+=C[i]
    else:
        break
    cnt+=1
if ans<h:
    if ((h-ans)//amax)*amax<h-ans:
        cnt+=(h-ans)//amax+1
    else:
        cnt+=(h-ans)//amax
        
print(cnt)
# Original solution
N, H = ( int(i) for i in input().split() )
ka = []
kb = []
for i in range(N):
	a, b = ( int(i) for i in input().split() )
	ka.append(a)
	kb.append(b)
	
kb.sort()
kb.reverse()

hp = H
res = 0
for b in kb:
	if b < max(ka):
		continue
	hp = hp - b
	res += 1
	if hp <= 0:
		break
else:
	res += (hp + max(ka) - 1)//max(ka)
	
print(res)
		

# Optimized solution
N, H = ( int(i) for i in input().split() )
ka = []
kb = []
for i in range(N):
	a, b = ( int(i) for i in input().split() )
	ka.append(a)
	kb.append(b)
	
kb.sort()
kb.reverse()
ma = max(ka)

hp = H
res = 0
for b in kb:
	if b < ma:
		continue
	hp = hp - b
	res += 1
	if hp <= 0:
		break
else:
	res += (hp + ma - 1)//ma
	
print(res)
# Original solution
from math import ceil
n, h = list(map(int, input().split()))
a = []
b = []
for i in range(n):
  p, q = list(map(int, input().split()))
  a.append(p)
  b.append(q)
b.sort(reverse=1)
ans=0
m=max(a)
while(h>0 and len(b) != 0):
  if b[0] < m:
    break
  h-=b[0]
  b.pop(0)
  ans+=1
if h>0:
  ans+=ceil(h/m)
print(ans)

# Optimized solution
from math import ceil
n, h = list(map(int, input().split()))
a = []
b = []
for i in range(n):
  p, q = list(map(int, input().split()))
  a.append(p)
  b.append(q)
b.sort(reverse=1)
ans=0
m=max(a)
for i in b:
  if i < m or h<=0:
    break
  h-=i
  ans+=1
if h>0:
  ans+=ceil(h/m)
print(ans)
# Original solution
N, H = list(map(int, input().split()))
slash = 0
Throw = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    slash = max(slash, a)
    if b > a: Throw.append(b)    
#slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその剣をダメージが大きい順に投げる
import heapq as hq
Throw = [-th for th in Throw if th > slash]
hq.heapify(Throw)

dmg, cnt = 0, 0
while len(Throw) != 0:
    if dmg >= H: break
    dmg += -hq.heappop(Throw)
    cnt += 1
if dmg < H:
    from math import ceil
    cnt += ceil((H-dmg)/slash)
print(cnt)

# Optimized solution
N, H = list(map(int, input().split()))
slash = 0
Throw = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    slash = max(slash, a)
    if b > a: Throw.append(b)    
#slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその刀をダメージが大きい順に投げる
Throw = sorted([th for th in Throw if th > slash], reverse=True)
dmg, cnt = 0, 0
for throw in Throw:
    if dmg >= H: break
    dmg += throw
    cnt += 1
if dmg < H:
    from math import ceil
    cnt += ceil((H-dmg)/slash)
print(cnt)
# Original solution
N, H = list(map(int, input().split()))
slash = 0
Throw = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    slash = max(slash, a)
    if b > a: Throw.append(b)    
#slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその刀をダメージが大きい順に投げる
Throw = sorted([th for th in Throw if th > slash], reverse=True)
dmg, cnt = 0, 0
for throw in Throw:
    if dmg >= H: break
    dmg += throw
    cnt += 1
if dmg < H:
    from math import ceil
    cnt += ceil((H-dmg)/slash)
print(cnt)

# Optimized solution

def main():
    with open(0) as f:
        N, H = list(map(int, f.readline().split()))
        ab = list(map(int, f.read().split()))
    max_slash = max(ab[0::2])
    throw = sorted([x for x in ab[1::2] if x > max_slash], reverse=True)
    cnt = 0
    for t in throw:
        if H <= 0:
            break
        H += -t
        cnt += 1
    if H > 0:
        cnt += (H+max_slash-1)//max_slash
    print(cnt)

main()
# Original solution
import math
N, H = list(map(int, input().split()))
A = []
B = []
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

amax = max(A)
# 最強の振り刀より強い攻撃力を持つものを抽出
B = list([x for x in B if x > amax])
B.sort(reverse=True)

ans = 0
while H > 0:
    # まだ投げれる
    if not B == []:
        H -= B[0]
        del B[0]
    # もう投げれない
    else:
        ans += math.ceil(H/amax)
        break
    ans += 1

print(ans)


# Optimized solution
import math
N, H = list(map(int, input().split()))
A = []
B = []
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

amax = max(A)
# 最強の振り刀より強い攻撃力を持つものを抽出
B = list([x for x in B if x > amax])
B.sort()

ans = 0
while H > 0:
    # まだ投げれる
    if B:
        H -= B.pop()
    # もう投げれない
    else:
        ans += math.ceil(H/amax)
        break
    ans += 1

print(ans)
# Original solution
import sys
input=sys.stdin.readline
import math

def main():
    N,H = list(map(int, input().split()))
    X = []
    k = 0 # 切る刀
    for _ in range(N):
        a,b = list(map(int, input().split()))
        X.append((a,b))
        k = max(k,a)

    TK = [] # 強い投げ刀
    for x in X:
        if x[1] > k:
            TK.append(x)
    TK.sort(key=lambda x: x[1])

    ans = 0
    while H>0:
        if TK:
            H -= TK.pop()[1]
            ans += 1
        else:
            ans += math.ceil(H/k)
            break
    print(ans)

if __name__ == '__main__':
    main()


# Optimized solution
import sys
input=sys.stdin.readline
import math

def main():
    N,H = list(map(int, input().split()))
    X = []

    k = 0 # （最強の）振り刀（の攻撃力）
    for _ in range(N):
        a,b = list(map(int, input().split()))
        X.append((a,b))
        k = max(k,a)

    TK = [x for x in X if x[1] > k] # 強い投げ刀のリスト
    TK.sort(key=lambda x: x[1])

    ans = 0
    while H > 0:
        if TK:
            H -= TK.pop()[1]
            ans += 1
        else:
            ans += math.ceil(H/k)
            break
    print(ans)

if __name__ == '__main__':
    main()
# Original solution
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right,bisect_left
from itertools import accumulate

def main():
    N, H = list(map(int, input().split()))
    a = [None] * N
    b = [None] * N
    for i in range(N):
        a[i], b[i] = list(map(int, input().split()))
    a.sort()
    b.sort()
    i = bisect_left(b,a[N-1])
    c = list(accumulate(b[i:][::-1]))
    # print(c)
    M = len(c)
    count = bisect_left(c,H)
    if count < M:
        print((count+1))
    else:
        print((count + (H-c[M-1] + a[N-1]-1)//a[N-1]))

if __name__ == "__main__":
    main()


# Optimized solution
from heapq import heappop, heappush

N, H = list(map(int, input().split()))
a = [None] * N
b = [None] * N
for i in range(N):
    a[i], b[i] = list(map(int, input().split()))

a.sort()
b.sort()
q = []
for i in range(N):
    if b[i] > a[-1]:
        heappush(q, -b[i])

ans = 0
while q:
    H += heappop(q)
    ans += 1
    if H <= 0:
        print(ans)
        exit()

print((ans + (H+a[-1]-1)//a[-1]))