Problem p03290 (python)

Fixed submission:
d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(d)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
        else:
            rest = j
    if score < g:
        need = (g - score - 1) // (100*(rest+1)) + 1
        if need > p[rest][0] - 1: # 0だったところの中で一番大きいところの問題数-1よりも必要手数が多かったら初めに戻る
            continue
        else:
            num += need
    ans = min(ans, num)
print(ans)

Buggy submission (verdict: Runtime Error):
d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(n)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
        else:
            rest = j
    if score < g:
        need = (g - score) // (100*(rest+1))
        if need > p[rest][0] - 1: # 0だったところの中で一番大きいところの問題数-1よりも必要手数が多かったら初めに戻る
            continue
        else:
            num += need
    ans = min(ans, num)
print(ans)

Buggy submission (verdict: Runtime Error):
    d, g = map(int, input().split())
    pc = [list(map(int, input().split())) for _ in range(d)]
     
    ans = 1000
    for i in range(1 << d):
    	score = 0
    	num = 0
    	rest = 0
    	for j in range(d):
    		if ((i >> j) & 1) == 1:
    			score += pc[j][0]*100*(j+1) + pc[j][1]
    			num += pc[j][0]
    		else:
    			rest = j
    	if score < g:
    		need = (g-score-1)//(100*(rest+1)) + 1
    		if need > pc[rest][0]-1:
    			continue
    		else:
    			num += need
    	ans = min(ans, num)
     
    print(ans)

Buggy submission (verdict: Runtime Error):
    d, g = map(int, input().split())
    pc = [list(map(int, input().split())) for _ in range(d)]
     
    ans = 1000
    for i in range(1 << d):
    	score = 0
    	num = 0
    	rest = 0
    	for j in range(d):
    		if ((i >> j) & 1) == 1:
    			score += pc[j][0]*100*(j+1) + pc[j][1]
    			num += pc[j][0]
    		else:
    			rest = j
    	if score < g:
    		need = (g-score-1)//(100*(rest+1)) + 1
    		if need > pc[rest][0]-1:
    			continue
    		else:
    			num += need
    	ans = min(ans, num)
     
    print(ans)

Buggy submission (verdict: Runtime Error):
    d, g = map(int, input().split())
    pc = [list(map(int, input().split())) for _ in range(d)]
     
    ans = 1000
    for i in range(1 << d):
    	score = 0
    	num = 0
    	rest = 0
    	for j in range(d):
    		if ((i >> j) & 1) == 1:
    			score += pc[j][0]*100*(j+1) + pc[j][1]
    			num += pc[j][0]
    		else:
    			rest = j
    	if score < g:
    		need = (g-score-1)//(100*(rest+1)) + 1
    		if need > pc[rest][0]-1:
    			continue
    		else:
    			num += need
    	ans = min(ans, num)
     
    print(ans)

Buggy submission (verdict: Runtime Error):
d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(n)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
        else:
            rest = j
    if score < g:
        need = (g - score - 1) // (100*(rest+1))
        if need > p[rest][0] - 1: # 0だったところの中で一番大きいところの問題数-1よりも必要手数が多かったら初めに戻る
            continue
        else:
            num += need
    ans = min(ans, num)
print(ans)

Buggy submission (verdict: Runtime Error):
d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(n)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
        else:
            rest = j
    if score < g:
        need = (g - score) // (100*(rest+1))
        if need > p[rest][0] - 1: # 0だったところの中で一番大きいところの問題数-1よりも必要手数が多かったら初めに戻る
            continue
        else:
            num += need
    ans = min(ans, num)
print(ans)

Buggy submission (verdict: Runtime Error):
d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(n)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
            print("num:",num)
        else:
            rest = j
            print("rest:",rest)
    if score < g:
        need = (g - score) // (100*(rest+1))
        if need > p[rest][0] - 1: # 0だったところの中で一番大きいところの問題数-1よりも必要手数が多かったら初めに戻る
            print("need:", need)
            continue
        else:
            num += need
            print("num2:",num)
    ans = min(ans, num)
    print("ans:", ans)
print(ans)