Buggy python submission (verdict: Time Limit Exceeded):

def count(P, idx, score, G, mn, cnt):
    # print(idx, score, mn, cnt)
    if score >= G and mn > cnt:
        return cnt
    if idx == 0:
        return mn
    for i in range(P[idx][0]+1):
        tmp = P[idx][1] if i == P[idx][0] else 0
        # print(idx, i)
        mn = count(P, idx-1, score+idx*100*i+tmp, G, mn, cnt+i)
    return mn

D,G = map(int, input().split())
P = [0]
for i in range(D):
    p,c = map(int, input().split())
    P.append([p,c])
print(count(P, D, 0, G, 10**9, 0))


Fixed submission:
from math import ceil
d,g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = float('INF')
inf = float('INF')
for i in range(2**d):
    tmp = 0
    cnt = 0
    for j in range(d):
        p,c = pc[j]
        if i & (1 << j):
            tmp += p * (j+1) * 100 + c
            cnt += p
    if g <= tmp and cnt < ans:
        ans = cnt
    if g > tmp:
        tmp_cnt = inf 
        tmp_ = 0
        gg = (g - tmp) / 100
        for j in range(d):
            p,c = pc[j]
            if i & (1 << j):
                continue
            if ceil(gg / (j+1)) < min(p,tmp_cnt):
                cc = ceil(gg / (j+1))
                tmp_ = cc * (j+1) * 100
                tmp_cnt = cc
            elif gg - c / 100 <= p * (j+1) and p < tmp_cnt:
                tmp_ = p * (j+1) * 100 + c
                tmp_cnt = p
        if g <= tmp + tmp_ and cnt + tmp_cnt < ans:
            ans = cnt + tmp_cnt

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def count(P, idx, score, G, mn, cnt):
    # print(idx, score, mn, cnt)
    if score >= G and mn > cnt:
        return cnt
    if idx > len(P)-1:
        return mn
    for i in range(P[idx][0]+1):
        tmp = P[idx][1] if i == P[idx][0] else 0
        # print(idx, i)
        mn = count(P, idx+1, score+idx*100*i+tmp, G, mn, cnt+i)
    return mn

D,G = map(int, input().split())
P = [0]
for i in range(D):
    p,c = map(int, input().split())
    P.append([p,c])
print(count(P, 1, 0, G, 10**9, 0))


Fixed submission:
from math import ceil
d,g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = float('INF')
inf = float('INF')
for i in range(2**d):
    tmp = 0
    cnt = 0
    for j in range(d):
        p,c = pc[j]
        if i & (1 << j):
            tmp += p * (j+1) * 100 + c
            cnt += p
    if g <= tmp and cnt < ans:
        ans = cnt
    if g > tmp:
        tmp_cnt = inf 
        tmp_ = 0
        gg = (g - tmp) / 100
        for j in range(d):
            p,c = pc[j]
            if i & (1 << j):
                continue
            if ceil(gg / (j+1)) < min(p,tmp_cnt):
                cc = ceil(gg / (j+1))
                tmp_ = cc * (j+1) * 100
                tmp_cnt = cc
            elif gg - c / 100 <= p * (j+1) and p < tmp_cnt:
                tmp_ = p * (j+1) * 100 + c
                tmp_cnt = p
        if g <= tmp + tmp_ and cnt + tmp_cnt < ans:
            ans = cnt + tmp_cnt

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

def count(P, idx, score, G, mn, cnt):
    # print(idx, score, mn, cnt)
    if score >= G and mn > cnt:
        return cnt
    if idx > len(P)-1:
        return mn
    for i in range(P[idx][0]+1):
        tmp = P[idx][1] if i == P[idx][0] else 0
        # print(idx, i)
        mn = count(P, idx+1, score+idx*100*i+tmp, G, mn, cnt+i)
    return mn

D,G = map(int, input().split())
P = [0]
for i in range(D):
    p,c = map(int, input().split())
    P.append([p,c])
print(count(P, 1, 0, G, 10**9, 0))


Fixed submission:
from math import ceil
d,g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = float('INF')
inf = float('INF')
for i in range(2**d):
    tmp = 0
    cnt = 0
    for j in range(d):
        p,c = pc[j]
        if i & (1 << j):
            tmp += p * (j+1) * 100 + c
            cnt += p
    if g <= tmp and cnt < ans:
        ans = cnt
    if g > tmp:
        tmp_cnt = inf 
        tmp_ = 0
        gg = (g - tmp) / 100
        for j in range(d):
            p,c = pc[j]
            if i & (1 << j):
                continue
            if ceil(gg / (j+1)) < min(p,tmp_cnt):
                cc = ceil(gg / (j+1))
                tmp_ = cc * (j+1) * 100
                tmp_cnt = cc
            elif gg - c / 100 <= p * (j+1) and p < tmp_cnt:
                tmp_ = p * (j+1) * 100 + c
                tmp_cnt = p
        if g <= tmp + tmp_ and cnt + tmp_cnt < ans:
            ans = cnt + tmp_cnt

print(ans)