Buggy python submission (verdict: Time Limit Exceeded):
N,HP=map(int,input().split())
listK=[]
listN=[]
 
for i in range(N):
    k,n=map(int,input().split())
    listK.append(k)
    listN.append(n)
listK.sort(reverse=True)
listN.sort(reverse=True)
cnt=0
for i in range(N):
    if listN[i]>=max(listK):
        HP-=listN[i]
        cnt+=1
        if HP<=0:
            print(cnt)
            exit()
    else:
        break
 
cnt+=int((HP+listK[0]-1)/(listK[0]))
print(cnt)

Fixed submission:
n,h=map(int,input().split())
slash=[]
throw=[]
for i in range(n):
    x,y=map(int,input().split())
    slash.append(x)
    throw.append(y)
 
slash.sort(reverse=True)
throw.sort(reverse=True)
attack=0
for i in range(n):
    if throw[i]>=slash[0]:
        h-=throw[i]
        attack+=1
        if h<=0:
            print(attack)
            exit()
    else :
        break
 
attack+=int((h+slash[0]-1)/(slash[0]))
print(attack)

Buggy python submission (verdict: Time Limit Exceeded):
N,HP=map(int,input().split())
listK=[]
listN=[]

for i in range(N):
    k,n=map(int,input().split())
    listK.append(k)
    listN.append(n)
listK.sort(reverse=True)
listN.sort(reverse=True)
cnt=0
for j in range(N):
    if listN[j]>=max(listK):
        HP-=listN[j]
        cnt+=1
        if HP<=0:
            print(cnt)
            exit()
    else:
        break

cnt+=int((HP+listK[0]-1)/(listK[0]))
print(cnt)


Fixed submission:
n,h=map(int,input().split())
slash=[]
throw=[]
for i in range(n):
    x,y=map(int,input().split())
    slash.append(x)
    throw.append(y)
 
slash.sort(reverse=True)
throw.sort(reverse=True)
attack=0
for i in range(n):
    if throw[i]>=slash[0]:
        h-=throw[i]
        attack+=1
        if h<=0:
            print(attack)
            exit()
    else :
        break
 
attack+=int((h+slash[0]-1)/(slash[0]))
print(attack)

Buggy python submission (verdict: Time Limit Exceeded):
N,HP=map(int,input().split())
listK=[]
listN=[]

for i in range(N):
    k,n=map(int,input().split())
    listK.append(k)
    listN.append(n)
listK.sort(reverse=True)
listN.sort(reverse=True)
cnt=0
for j in range(N):
    if listN[j]>=max(listK):
        HP=HP-listN[j]
        cnt+=1
        if HP<=0:
            print(cnt)
            exit()
    else:
        break

cnt+=int((HP+listK[0]-1)/(listK[0]))
print(cnt)


Fixed submission:
n,h=map(int,input().split())
slash=[]
throw=[]
for i in range(n):
    x,y=map(int,input().split())
    slash.append(x)
    throw.append(y)
 
slash.sort(reverse=True)
throw.sort(reverse=True)
attack=0
for i in range(n):
    if throw[i]>=slash[0]:
        h-=throw[i]
        attack+=1
        if h<=0:
            print(attack)
            exit()
    else :
        break
 
attack+=int((h+slash[0]-1)/(slash[0]))
print(attack)

Buggy python submission (verdict: Time Limit Exceeded):
N,HP=map(int,input().split())
listK=[]
listN=[]

for i in range(N):
    k,n=map(int,input().split())
    listK.append(k)
    listN.append(n)
listK.sort(reverse=True)
listN.sort(reverse=True)
cnt=0
for j in range(N):
    if listN[j]>=max(listK):
        HP=HP-listN[j]
        cnt+=1
        if HP<=0:
            print(cnt)
            exit()
    else:
        break

if HP%(listK[0])==0:
    print(cnt+int(HP/listK[0]))
else:
    print(cnt+1+int(HP/listK[0]))

Fixed submission:
n,h=map(int,input().split())
slash=[]
throw=[]
for i in range(n):
    x,y=map(int,input().split())
    slash.append(x)
    throw.append(y)
 
slash.sort(reverse=True)
throw.sort(reverse=True)
attack=0
for i in range(n):
    if throw[i]>=slash[0]:
        h-=throw[i]
        attack+=1
        if h<=0:
            print(attack)
            exit()
    else :
        break
 
attack+=int((h+slash[0]-1)/(slash[0]))
print(attack)

Buggy python submission (verdict: Time Limit Exceeded):
N,HP=map(int,input().split())
listK=[]
listN=[]

for i in range(N):
    k,n=map(int,input().split())
    listK.append(k)
    listN.append(n)
list1=[]
for j in range(N):
    if listN[j]>=max(listK):
        list1.append(listN[j])
        
list1.sort(reverse=True)

if HP<=sum(list1):
    cnt=0
    for x in range(len(list1)):
        HP=HP-list1[x]
        cnt+=1
        if HP<=0:
            print(cnt)
            exit()
else:
    HP=HP-sum(list1)
    cnt=len(list1)
    if HP%max(listK)==0:
        print(int(cnt+HP/(max(listK))))
    else:
        print(int(cnt+HP/(max(listK)))+1)

Fixed submission:
n,h=map(int,input().split())
slash=[]
throw=[]
for i in range(n):
    x,y=map(int,input().split())
    slash.append(x)
    throw.append(y)
 
slash.sort(reverse=True)
throw.sort(reverse=True)
attack=0
for i in range(n):
    if throw[i]>=slash[0]:
        h-=throw[i]
        attack+=1
        if h<=0:
            print(attack)
            exit()
    else :
        break
 
attack+=int((h+slash[0]-1)/(slash[0]))
print(attack)