Buggy python submission (verdict: Runtime Error):
import math

N_H = list(map(int, input().split()))

a_b= [list(map(int, input().split())) for _ in range(N_H[0])]
length =len(a_b)

a= [a_b[i][0] for i in range(length)]
b= [a_b[i][1] for i in range(length)]

counter = 0
i = 0
pattern = 0


a_max = max(a)
a_max_idx = a.index(a_max)
b_a_max_idx = b[a_max_idx]

b.pop(a_max_idx)

b.sort()
b.reverse()

    
while True:
    if N_H[1] <= b[a_max_idx]:
        print(1)
        break
    
    if N_H[1] <= b_a_max_idx:
        counter += 1
        print(counter)
        break

    if i <= length-2:    
        if b[i] > a_max:
            N_H[1] -= b[i]

            i += 1

            counter += 1

            if N_H[1] <= 0:
                print(counter)
                break
        else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break
    else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break



Fixed submission:
import math

N_H = list(map(int, input().split()))

a_b= [list(map(int, input().split())) for _ in range(N_H[0])]
length =len(a_b)

a= [a_b[i][0] for i in range(length)]
b= [a_b[i][1] for i in range(length)]

counter = 0
i = 0
pattern = 0


a_max = max(a)
b_max = max(b)
a_max_idx = a.index(a_max)
b_a_max_idx = b[a_max_idx]

b.pop(a_max_idx)

b.sort()
b.reverse()

    
while True:
    if N_H[1] <= b_max and counter == 0:
        counter += 1
        print(counter)
        break
    
    if N_H[1] <= b_a_max_idx:
        counter += 1
        print(counter)
        break

    if i <= length-2:    
        if b[i] > a_max:
            N_H[1] -= b[i]

            i += 1

            counter += 1

            if N_H[1] <= 0:
                print(counter)
                break
        else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break
    else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break

Buggy python submission (verdict: Runtime Error):
import math

N_H = list(map(int, input().split()))

a_b= [list(map(int, input().split())) for _ in range(N_H[0])]
length =len(a_b)

a= [a_b[i][0] for i in range(length)]
b= [a_b[i][1] for i in range(length)]

counter = 0
i = 0
pattern = 0


a_max = max(a)
a_max_idx = a.index(a_max)
b_a_max_idx = b[a_max_idx]

b.pop(a_max_idx)

b.sort()
b.reverse()

if N_H[1] <= b[a_max_idx]:
    print(1)
    
while True:
    if N_H[1] <= b_a_max_idx:
        counter += 1
        print(counter)
        break

    if i <= length-2:    
        if b[i] > a_max:
            N_H[1] -= b[i]

            i += 1

            counter += 1

            if N_H[1] <= 0:
                print(counter)
        else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break
    else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break



Fixed submission:
import math

N_H = list(map(int, input().split()))

a_b= [list(map(int, input().split())) for _ in range(N_H[0])]
length =len(a_b)

a= [a_b[i][0] for i in range(length)]
b= [a_b[i][1] for i in range(length)]

counter = 0
i = 0
pattern = 0


a_max = max(a)
b_max = max(b)
a_max_idx = a.index(a_max)
b_a_max_idx = b[a_max_idx]

b.pop(a_max_idx)

b.sort()
b.reverse()

    
while True:
    if N_H[1] <= b_max and counter == 0:
        counter += 1
        print(counter)
        break
    
    if N_H[1] <= b_a_max_idx:
        counter += 1
        print(counter)
        break

    if i <= length-2:    
        if b[i] > a_max:
            N_H[1] -= b[i]

            i += 1

            counter += 1

            if N_H[1] <= 0:
                print(counter)
                break
        else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break
    else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break

Buggy python submission (verdict: Runtime Error):
import math

N_H = list(map(int, input().split()))

a_b= [list(map(int, input().split())) for _ in range(N_H[0])]
length =len(a_b)

a= [a_b[i][0] for i in range(length)]
b= [a_b[i][1] for i in range(length)]

counter = 0
i = 0
pattern = 0


a_max = max(a)
a_max_idx = a.index(a_max)
b_a_max_idx = b[a_max_idx]

b.pop(a_max_idx)

b.sort()
b.reverse()

if N_H[1] <= b[a_max_idx]:
    print(1)
    
while True:
    if N_H[1] <= b_a_max_idx:
        counter += 1
        print(counter)
        break

    if i <= length-2:    
        if b[i] > a_max:
            N_H[1] -= b[i]

            i += 1

            counter += 1

            if N_H[1] <= 0:
                print(counter)
    else:
        counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
        print(counter)
        break


Fixed submission:
import math

N_H = list(map(int, input().split()))

a_b= [list(map(int, input().split())) for _ in range(N_H[0])]
length =len(a_b)

a= [a_b[i][0] for i in range(length)]
b= [a_b[i][1] for i in range(length)]

counter = 0
i = 0
pattern = 0


a_max = max(a)
b_max = max(b)
a_max_idx = a.index(a_max)
b_a_max_idx = b[a_max_idx]

b.pop(a_max_idx)

b.sort()
b.reverse()

    
while True:
    if N_H[1] <= b_max and counter == 0:
        counter += 1
        print(counter)
        break
    
    if N_H[1] <= b_a_max_idx:
        counter += 1
        print(counter)
        break

    if i <= length-2:    
        if b[i] > a_max:
            N_H[1] -= b[i]

            i += 1

            counter += 1

            if N_H[1] <= 0:
                print(counter)
                break
        else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break
    else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break

Buggy python submission (verdict: Runtime Error):
import math

N_H = list(map(int, input().split()))

a_b= [list(map(int, input().split())) for _ in range(N_H[0])]
length =len(a_b)

a= [a_b[i][0] for i in range(length)]
b= [a_b[i][1] for i in range(length)]

counter = 0
i = 0
pattern = 0


a_max = max(a)
a_max_idx = a.index(a_max)
b_a_max_idx = b[a_max_idx]

b.pop(a_max_idx)

b.sort()
b.reverse()

if N_H[1] <= b[a_max_idx]:
    print(1)
    
while True:
    if N_H[1] <= b_a_max_idx:
        counter += 1
        print(counter)
        break

    if i < length-1:    
        if b[i] > a_max:
            N_H[1] -= b[i]


            i += 1

            counter += 1

            if N_H[1] <= 0:
                print(counter)
    else:
        counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
        print(counter)
        break


Fixed submission:
import math

N_H = list(map(int, input().split()))

a_b= [list(map(int, input().split())) for _ in range(N_H[0])]
length =len(a_b)

a= [a_b[i][0] for i in range(length)]
b= [a_b[i][1] for i in range(length)]

counter = 0
i = 0
pattern = 0


a_max = max(a)
b_max = max(b)
a_max_idx = a.index(a_max)
b_a_max_idx = b[a_max_idx]

b.pop(a_max_idx)

b.sort()
b.reverse()

    
while True:
    if N_H[1] <= b_max and counter == 0:
        counter += 1
        print(counter)
        break
    
    if N_H[1] <= b_a_max_idx:
        counter += 1
        print(counter)
        break

    if i <= length-2:    
        if b[i] > a_max:
            N_H[1] -= b[i]

            i += 1

            counter += 1

            if N_H[1] <= 0:
                print(counter)
                break
        else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break
    else:
            counter += math.ceil((N_H[1]-b_a_max_idx)/a_max)+1
            print(counter)
            break