Buggy python submission (verdict: Time Limit Exceeded):
N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
B.sort()
B.reverse()
C = 0
while H > 0:
    if B == []:
        C += int(-(-H//Ma))
        H = 0
    else:
        if Ma >= B[0]:
            C += int(-(-H//Ma))
            H = 0
        else:
            C += 1
            H -= B[0]
            B = B[1:]
print(C)

Fixed submission:
N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
B.sort()
B.reverse()
i = 0
Mb = B[0]
while Mb > Ma and H > 0:
  i += 1
  H -= Mb
  if i == N:
    Mb = 0
  else:
    Mb = B[i]
if H <= 0:
  print(i)
else:
  print(i+int(-(-H//Ma)))

Buggy python submission (verdict: Time Limit Exceeded):
N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
B.sort()
B.reverse()
C = 0
while H > 0:
    if B == []:
        C += int(-(-H//Ma))
        H = 0
    else:
        Mb = max(B)
        if Ma >= Mb:
            C += int(-(-H//Ma))
            H = 0
        else:
            C += 1
            H -= Mb
            B.remove(Mb)
print(C)

Fixed submission:
N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
B.sort()
B.reverse()
i = 0
Mb = B[0]
while Mb > Ma and H > 0:
  i += 1
  H -= Mb
  if i == N:
    Mb = 0
  else:
    Mb = B[i]
if H <= 0:
  print(i)
else:
  print(i+int(-(-H//Ma)))

Buggy python submission (verdict: Time Limit Exceeded):
N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
C = 0
while H > 0:
    if B == []:
        C += int(-(-H//Ma))
        H = 0
    else:
        Mb = max(B)
        if Ma >= Mb:
            C += int(-(-H//Ma))
            H = 0
        else:
            C += 1
            H -= Mb
            B.remove(Mb)
print(C)

Fixed submission:
N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
B.sort()
B.reverse()
i = 0
Mb = B[0]
while Mb > Ma and H > 0:
  i += 1
  H -= Mb
  if i == N:
    Mb = 0
  else:
    Mb = B[i]
if H <= 0:
  print(i)
else:
  print(i+int(-(-H//Ma)))

Buggy python submission (verdict: Time Limit Exceeded):
N,H = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
C = 0
Ma = max(A)
while H > 0:
    if B == []:
        C += int(-(-H//Ma))
        H = 0
    else:
        Mb = max(B)
        if Ma > Mb:
            C += int(-(-H//Ma))
            H = 0
        else:
            C += 1
            H -= Mb
            B.remove(Mb)
print(C)

Fixed submission:
N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
B.sort()
B.reverse()
i = 0
Mb = B[0]
while Mb > Ma and H > 0:
  i += 1
  H -= Mb
  if i == N:
    Mb = 0
  else:
    Mb = B[i]
if H <= 0:
  print(i)
else:
  print(i+int(-(-H//Ma)))

Buggy python submission (verdict: Time Limit Exceeded):
N,H = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
C = 0
while H > 0:
    Ma = max(A)
    if B == []:
        C += int(-(-H//Ma))
        H = 0
    else:
        Mb = max(B)
        if Ma > Mb:
            C += int(-(-H//Ma))
            H = 0
        else:
            C += 1
            H -= Mb
            B.remove(Mb)
print(C)

Fixed submission:
N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
B.sort()
B.reverse()
i = 0
Mb = B[0]
while Mb > Ma and H > 0:
  i += 1
  H -= Mb
  if i == N:
    Mb = 0
  else:
    Mb = B[i]
if H <= 0:
  print(i)
else:
  print(i+int(-(-H//Ma)))

Buggy python submission (verdict: Time Limit Exceeded):
N,H = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
C = 0
while H > 0:
    C += 1
    Ma = max(A)
    if B == []:
        H -= Ma
    else:
        Mb = max(B)
        if Ma > Mb:
            H -= Ma
        else:
            H -= Mb
            B.remove(Mb)
print(C)

Fixed submission:
N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
B.sort()
B.reverse()
i = 0
Mb = B[0]
while Mb > Ma and H > 0:
  i += 1
  H -= Mb
  if i == N:
    Mb = 0
  else:
    Mb = B[i]
if H <= 0:
  print(i)
else:
  print(i+int(-(-H//Ma)))