Problem p03290 (python)

Fixed submission:
n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

ans = []

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出(逆順)
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく(逆順)
howmany = [List[i][0] for i in range(n-1, -1, -1)] #回数も逆順に出しておく

for i in range(2**n):
    s = 0
    m = 0
    max = 0 #残りの中で最も得点の単位が大きいもの
    for j in range(n):
        if((i >> j) & 1):
            max += 1
            s += max_score[j]
            m += howmany[j]
    if(s >= g):
        ans.append(m)
    else:
        if(max < n):
            rest = g - s
            k = -(-rest // score[max]) #最も得点の単位の高い問題を何問解くか
            if(k < howmany[max]):
                m += k
                ans.append(m)

print(min(ans))

Buggy submission (verdict: Runtime Error):
n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

pre_ans = 0
ans = 0
a = 0
res = 0
x = 0

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出(逆順)
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく(逆順)
howmany = [List[i][0] for i in range(n-1, -1, -1)] #回数も逆順に出しておく

while(ans <= g):
    pre_ans = ans
    ans += max_score[a]
    a += 1
    
for i in range(a):
    res += howmany[i]
    
rest = g - ans
#x = -(-rest // score[a])
if rest > 0:
    x = rest // score[a]

#print(max_score)
#print(score)
#print(howmany)
#print(res)
#print(x)
print(res + x)

Buggy submission (verdict: Runtime Error):
n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

ans = 0
a = 0
res = 0

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出(逆順)
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく(逆順)
howmany = [List[i][0] for i in range(n-1, -1, -1)]

while(ans + max_score[a] <= g):
    ans += max_score[a]
    a += 1

for i in range(a):
    res += howmany[i]
    
rest = g - ans
x = -(-rest // score[a])
x = rest // score[a]
    
#print(max_score)
#print(score)
#print(howmany)
#print(res)
print(res + x)

Buggy submission (verdict: Runtime Error):
n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

ans = 0
a = 0
res = 0

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出(逆順)
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく(逆順)
howmany = [List[i][0] for i in range(n-1, -1, -1)]

while(ans + max_score[a] <= g):
    ans += max_score[a]
    a += 1

for i in range(a):
    res += howmany[i]
    
rest = g - ans
x = -(-rest // score[a])
    
#print(max_score)
#print(score)
#print(howmany)
#print(res)
print(res + x)

Buggy submission (verdict: Runtime Error):
n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

ans = 0
a = 0
res = 0

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく

while(ans + max_score[a] <= g):
    ans += max_score[a]
    a += 1

for i in range(a):
    res += List[n - a][0]
    
rest = g - ans
x = -(-rest // score[a])
    
print(res + x)

Buggy submission (verdict: Runtime Error):
n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in rage(n)]

ans = 0
a = 0
res = 0

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく

while(ans + max_score[a] <= g):
    ans += max_score[a]
    a += 1

for i in range(a):
    res += List[n - a][0]
    
rest = g - ans
x = -(-rest // score[a])
    
print(res + x)