Problem p03472 (python)

Fixed submission:
n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
A = max(a)
s = list()
for i in range(n):
    if b[i] > A:
        s.append(b[i])
s.sort()
s.reverse()
c = sum(s)
if c < h:
    print(len(s) + (h-c)//A + [1,0][(h-c)%A==0])
else:
    S = 0
    for i in range(len(s)):
        S += s[i]
        if S >= h:
            print(i+1)
            break

Buggy submission (verdict: Runtime Error):
n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
A = max(a)
s = set()
for i in range(n):
    if b[i] > A:
        s.add(b[i])
s = (list(s).sort()).reverse()
c = sum(s)
if c < h:
    print((h-c)//A + [1,0][(h-c)%A==0])
else:
    cnt = 0
    l = 0
    for i in range(len(s)):
        cnt += s[i]
        l += 1
        if cnt >= h:
            break
    print(l)

Buggy submission (verdict: Runtime Error):
n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
A = max(a)
c = h//A + [1,0][h%A==0]
if sum(b) >= h:
    c0 = 1
    d = 0
    e = list(reversed(sorted(b)))
    i = 0
    while d < h:
        d += e[i] 
        c0 += 1
        i += 1
        if e[i] < A:
            print(c0+(h-d-e[i])//A+[1,0][(h-d-e[i])%A==0])
            exit()
    c = min(c,c0)
print(c)

Buggy submission (verdict: Runtime Error):
n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
A = max(a)
c = h//A + [1,0][h%A==0]
if sum(b) >= h:
    c0 = 1
    d = 0
    e = list(reversed(sorted(b)))
    i = 0
    while d < h:
        d += e[i] 
        c0 += 1
        i += 1
        if e[i] < A:
            print(c0+(h-d)//A+[1,0][(h-d)%A==0])
            exit()
    c = min(c,c0)
print(c)

Buggy submission (verdict: Runtime Error):
n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
c = h//max(a) + [1,0][h%max(a)==0]
if sum(b) >= h:
    c0 = 1
    d = 0
    e = list(reversed(sorted(b)))
    while d < h:
        d += e[i] 
        c0 += 1
        i += 1
    c = min(c,c0)
print(c)

Buggy submission (verdict: Runtime Error):
n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
c = h//max(a) + [1,0][h%max(a)==0]
if sum(b) >= h:
    c0 = 1
    d = 0
    e = reversed(sorted(b))
    while d < h:
        d += e[i] 
        c0 += 1
        i += 1
    c = min(c,c0)
print(c)

Buggy submission (verdict: Runtime Error):
n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
c = h//max(a) + [1,0][h%max(a)==1]
if sum(b) >= h:
    c0 = 0
    d = 0
    e = reversed(sorted(b))
    while d < h:
        d += e[i] 
        c0 += 1
        i += 1
    c = min(c,c0)
print(c)

Buggy submission (verdict: Runtime Error):
n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
c = h//max(a) + [0,1][h%max(a)]
if sum(b) >= h:
    c0 = 0
    d = 0
    e = reversed(sorted(b))
    while d < h:
        d += e[i] 
        c0 += 1
        i += 1
    c = min(c,c0)
print(c)

Buggy submission (verdict: Runtime Error):
n,h =map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
c = h//max(a) + 1
if sum(b) >= h:
    c0 = 0
    d = 0
    e = reversed(sorted(b))
    while d < h:
        d += e[i] 
        c0 += 1
        i += 1
    c = min(c,c0)
print(c)

Buggy submission (verdict: Runtime Error):
n,h =map(int,input().split())
a,b = [0]*n,[0]*n
c = h//max(a) + 1
if sum(b) >= h:
    c0 = 0
    d = 0
    e = reversed(sorted(b))
    while d < h:
        d += e[i] 
        c0 += 1
        i += 1
    c = min(c,c0)
print(c)

Buggy submission (verdict: Runtime Error):
a,b = [0]*n,[0]*n
c = h//max(a) + 1
if sum(b) >= h:
    c0 = 0
    d = 0
    e = reversed(sorted(b))
    while d < h:
        d += e[i] 
        c0 += 1
    c = min(c,c0)
print(c)