qyliang/CodeNanoFix huggingface dataset:
Buggy code:
def main():
    d, g = map(int, input().split())
    pc = [list(map(int, input().split())) for _ in range(d)]

    n = len(pc)
    ans = float("inf")

    for i in range(2**n):
        point, cnt = 0, 0
        for j in range(n):
            if (i>>j) & 1:
                point += (j+1)*100*pc[j][0] + pc[j][1]
                cnt += pc[j][0]
        if point >= g:
            ans = min(ans, cnt)
        # print(cnt, point)
        else:
            for j in range(n+1, -1, -1):
                if (i >> j) & 1:
                    continue
                else:
                    for k in range(pc[j][0]):
                        if point >= g:
                            ans = min(ans, cnt)
                            break
                        point += (j+1)*100
                        cnt += 1
    print(ans)


if __name__ == "__main__":
    main()


Fixed code:
def main():
    d, g = map(int, input().split())
    pc = [list(map(int, input().split())) for _ in range(d)]

    n = len(pc)
    ans = float("inf")

    for i in range(2**n):
        point, cnt = 0, 0
        for j in range(n):
            if (i>>j) & 1:
                point += (j+1)*100*pc[j][0] + pc[j][1]
                cnt += pc[j][0]
        if point >= g:
            ans = min(ans, cnt)
        # print(cnt, point)
        else:
            for j in range(n-1, -1, -1):
                if (i >> j) & 1:
                    continue
                else:
                    for k in range(pc[j][0]):
                        if point >= g:
                            ans = min(ans, cnt)
                            break
                        point += (j+1)*100
                        cnt += 1
    print(ans)


if __name__ == "__main__":
    main()
Buggy code:
D,G = map(int,input().split())
p = [0]*int(D)
c = [0]*int(D)
for i in range(D):
  p[i],c[i] = map(int,input().split())
ans = 1e9
for i in range(2**D):
  s = 0
  num = 0
  rest_max = -1
  for j in range(D):
    if (i>>j)&1:
      s += 100 * (j+1) * p[j] + c[j]
      num += p[j]
    else:
      rest_max = j
  if s<G:
    s1 = 100 * (rest_max + 1)
    need = (G - s + s1 - 1) / s1
    if need >= p[rest_max]:
      continue
    num += need
  ans = min(ans, num)
print(ans)

Fixed code:
D,G = map(int,input().split())
p = [0]*int(D)
c = [0]*int(D)
for i in range(D):
  p[i],c[i] = map(int,input().split())
ans = 1e9
for i in range(2**D):
  s = 0
  num = 0
  rest_max = -1
  for j in range(D):
    if (i>>j)&1:
      s += 100 * (j+1) * p[j] + c[j]
      num += p[j]
    else:
      rest_max = j
  if s<G:
    s1 = 100 * (rest_max + 1)
    need = int((G - s + s1 - 1) / s1)
    if need >= p[rest_max]:
      continue
    num += need
  ans = min(ans, num)
print(ans)
Buggy code:
d, g = map(int, input().split())

p = []
c = []
ans = []
cnt = 0
ss = 0
for _ in range(d):
    pp, cc = map(int, input().split())

    p.append(pp)
    c.append(cc)



for x in range(2**d):
    ss = 0
    cnt = 0
    for i in range(d):
        if (x>>i)&1:

            ss += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    print("a",ss)
    if ss>=g:
        ans.append(cnt)

    else:
        print("c")
        for l in range(d)[::-1]:
            print(l)
            print(x>>l)
            if  ((x >> l) & 1):
                continue

            for _ in range(p[l]):
                ss += (l+1)*100
                print("b",ss)
                cnt += 1

                if ss>=g:
                    ans.append(cnt)
                    break

print(min(ans))














Fixed code:
d, g = map(int, input().split())

p = []
c = []
ans = []
cnt = 0
ss = 0
for _ in range(d):
    pp, cc = map(int, input().split())

    p.append(pp)
    c.append(cc)



for x in range(2**d):
    ss = 0
    cnt = 0
    for i in range(d):
        if (x>>i)&1:

            ss += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    if ss>=g:
        ans.append(cnt)

    else:
        for l in range(d)[::-1]:
            if  ((x >> l) & 1):
                continue

            for _ in range(1,p[l]):
                ss += (l+1)*100
                cnt += 1

                if ss>=g:
                    ans.append(cnt)
                    break

print(min(ans))
Buggy code:
import itertools as it
D, G = map(int, input().split())
P, C = [], []
for _ in range(D):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c)
A = it.permutations([i for i in range(D)])
ans = 10**9
for a in A:
    S, i, sub_ans = 0, 0, 0
    while 1:
        if S + (a[i] + 1) * 100 * P[a[i]] < G:
            S += (a[i] + 1) * 100 * P[a[i]]
            sub_ans += P[a[i]]
            S += C[a[i]]
        else:
            x = (G - S) // ((a[i] + 1) * 100)
            if S + (a[i] + 1) * x < G:
                x += 1
            sub_ans += x
            S += (a[i] + 1) * x
        S += C[a[i]]
        if S >= G:
            if sub_ans < ans:
                ans = sub_ans
            break
        i += 1
print(ans)


Fixed code:
import itertools as it
D, G = map(int, input().split())
P, C = [], []
for _ in range(D):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c)
A = it.permutations([i for i in range(D)])
ans = 10**9
for a in A:
    S, i, sub_ans = 0, 0, 0
    while 1:
        if S + (a[i] + 1) * 100 * P[a[i]] < G:
            S += (a[i] + 1) * 100 * P[a[i]]
            sub_ans += P[a[i]]
        else:
            x = (G - S) // ((a[i] + 1) * 100)
            if S + (a[i] + 1) * 100 * x < G:
                x += 1
            sub_ans += x
            S += (a[i] + 1) * 100 * x
        S += C[a[i]]
        if S >= G:
            if sub_ans < ans:
                ans = sub_ans
            break
        i += 1
print(ans)
Buggy code:
import math

D,G = map(int,input().split())
d = [list(map(int,input().split())) for i in range(D)]

A = []
for i in range(D):
    A.append(100*(i+1)*d[i][0] + d[i][1])

ans = 0
for i in range(D):
    ans += d[i][0]

for i in range(2**D):
    a = 0
    g = 0
    B = []
    for j in range(D):
        if (i >> j) & 1:
            a += A[j]
            g += d[j][0]
        else:
            B.append(j)
    b = 0
    for j in B:
        b = max(b,A[j])

    if G-b < a <= G:
        c = max(B)
        e = math.ceil((G-a)/(100*(c+1)))
        if e > d[c][0]:
            continue
        else:
            ans = min(ans,g+e)

print(ans)

Fixed code:
import math

D,G = map(int,input().split())
d = [list(map(int,input().split())) for i in range(D)]

A = []
for i in range(D):
    A.append(100*(i+1)*d[i][0] + d[i][1])

ans = 0
for i in range(D):
    ans += d[i][0]

for i in range(2**D):
    a = 0
    g = 0
    B = []
    for j in range(D):
        if (i >> j) & 1:
            a += A[j]
            g += d[j][0]
        else:
            B.append(j)
    b = 0
    for j in B:
        b = max(b,A[j])

    if G-b < a < G+b:
        c = max(B)
        e = math.ceil((G-a)/(100*(c+1)))
        if e <= 0:
            ans = min(ans,g)
        elif e > d[c][0]:
            continue
        else:
            ans = min(ans,g+e)

print(ans)
Buggy code:
D,G=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(D)]

ans=float('inf')
for i in range(2**D):
  score=0
  b=0
  cnt=0
  for j in range(D):
    if ((i>>j)&1):
      score+=100*(j+1)*pc[j][0]+pc[j][1]
      cnt+=pc[j][0]
    else:
      b=j
    for k in range(pc[b][0]):
      if score>=G and cnt<ans:
        ans=cnt
      score+=(b+1)*100
      cnt+=1
print(ans)

Fixed code:
D,G=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(D)]

ans=float('inf')
for i in range(2**D):
  score=0
  b=0
  cnt=0
  for j in range(D):
    if ((i>>j)&1):
      score+=100*(j+1)*pc[j][0]+pc[j][1]
      cnt+=pc[j][0]
    else:
      b=j
  for k in range(pc[b][0]):
    if score>=G and cnt<ans:
      ans=cnt
    score+=(b+1)*100
    cnt+=1
print(ans)
Buggy code:
d,g = map(int,input().split())
p,c = [],[]
ans = float('inf')
for i in range(d):
    x,y = map(int,input().split())
    p.append(x)
    c.append(y)
for i in range((1<<d)):
    tmp,cnt = 0,0
    for j in range(d):
        if i&(1<<j):
            tmp = tmp + 100*(j+1)*p[j]+c[j]
            cnt += p[j]
    if tmp>=g:
        if cnt<ans: print(cnt);ans=cnt
    else:
        for j in range(d-1,-1,-1):
            if i&(1<<j): continue
            for k in range(p[j]):
                if tmp>=g: break
                tmp = tmp + 100*(j+1)
                cnt+=1
        if cnt<ans: ans = cnt
print(ans)

Fixed code:
d,g = map(int,input().split())
p,c = [],[]
ans = float('inf')
for i in range(d):
    x,y = map(int,input().split())
    p.append(x)
    c.append(y)
for i in range((1<<d)):
    tmp,cnt = 0,0
    for j in range(d):
        if i&(1<<j):
            tmp = tmp + 100*(j+1)*p[j]+c[j]
            cnt += p[j]
    if tmp>=g:
        if cnt<ans: ans=cnt
    else:
        for j in range(d-1,-1,-1):
            if i&(1<<j): continue
            for k in range(p[j]):
                if tmp>=g: break
                tmp = tmp + 100*(j+1)
                cnt+=1
        if cnt<ans: ans = cnt
print(ans)
Buggy code:

def solve():
    d = 0
    c = 0
    for i in range(D):
        d += p[i][0]
    dp = [[0]*(d+1) for i in range(D)]
    for i in range(D):
        for j in range(p[i][0]+1):
            if i == 0:
                if j == p[i][0]:
                    dp[i][j] += p[i][1]
                dp[i][j] += 100*j
            else:
                for k in range(c+1):
                    if j == p[i][0]:
                        dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1)+p[i][1])
                    else:
                        dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1))
        c += p[i][0]
    for i in range(d+1):
        if dp[D-1][i]>=G:
            print(i)
            break    
    
if __name__=="__main__":
    D,G = list(map(int, input().split()))
    pc = [list(map(int, input().split())) for _ in range(D)]
    solve()


Fixed code:

def solve():
    d = 0
    c = 0
    for i in range(D):
        d += p[i][0]
    dp = [[0]*(d+1) for i in range(D)]
    for i in range(D):
        for j in range(p[i][0]+1):
            if i == 0:
                if j == p[i][0]:
                    dp[i][j] += p[i][1]
                dp[i][j] += 100*j
            else:
                for k in range(c+1):
                    if j == p[i][0]:
                        dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1)+p[i][1])
                    else:
                        dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1))
        c += p[i][0]
    for i in range(d+1):
        if dp[D-1][i]>=G:
            print(i)
            break    
    
if __name__=="__main__":
    D,G = list(map(int, input().split()))
    p = [list(map(int, input().split())) for _ in range(D)]
    solve()
Buggy code:
INF = 10 ** 10

D, G = map(int, input().split())
pairs = [map(int, input().split()) for _ in range(D)]
ps, cs = zip(*pairs)

minimumsolve = INF

for i in range(1 << D):
    solve = 0
    score = 0
    for j in range(D):
        if i & 1 << j:
            solve += ps[j]
            score += ps[j] * 100 * (j+1) + cs[j]
    if score < G:
        for j in range(D-1, -1, -1):
            if not i & 1 << j:
                neededsolve = (G - score) // (100*(j+1))
                if neededsolve >= ps[j]:
                    solve = INF
                    break
                else:
                    solve += neededsolve
                    #score doesn't have to be updated
    minimumsolve = min(minimumsolve, solve)

print(minimumsolve)




Fixed code:

from math import ceil
INF = 10 ** 10

D, G = map(int, input().split())
pairs = [map(int, input().split()) for _ in range(D)]
ps, cs = zip(*pairs)

minimumsolve = INF

for i in range(1 << D):
    solve = 0
    score = 0
    for j in range(D):
        if i & 1 << j:
            solve += ps[j]
            score += ps[j] * 100 * (j+1) + cs[j]
    if score < G:
        for j in range(D-1, -1, -1):
            if not i & 1 << j:
                neededsolve = ceil((G - score) / (100*(j+1)))
                if neededsolve >= ps[j]:
                    solve = INF
                    break
                else:
                    solve += neededsolve
                    #score doesn't have to be updated
                    break
    minimumsolve = min(minimumsolve, solve)

print(minimumsolve)
Buggy code:
import itertools

d,g = map(int,input().split())
    
arr = []
    
for i in range(d):
    arr.append(list(map(int,input().split())))
    
ans = 10**10

for i in itertools.product((0,1),repeat=d**2):
    score=0
    num=0
    index=0
    
    for j in range(d):
        if i[j]==1:
            score += (j+1)*100*arr[j][0] + arr[j][1]
            num +=arr[j][0]
        else:
            index = max(j,index)
    
    if g - score <=0:
        ans = min(ans,num)
    
    elif g - score <= (index+1) *100*(arr[index][0]-1):
        num+= -(-(g-score)//(100*(index+1)))
        ans =min(ans,num)

print(ans)

Fixed code:
import itertools

d,g = map(int,input().split())
    
arr = []
    
for i in range(d):
    arr.append(list(map(int,input().split())))
    
ans = 10**10

for i in itertools.product((0,1),repeat=d):
    score=0
    num=0
    index=0
    
    for j in range(d):
        if i[j]==1:
            score += (j+1)*100*arr[j][0] + arr[j][1]
            num +=arr[j][0]
        else:
            index = max(j,index)
    
    if g - score <=0:
        ans = min(ans,num)
    
    elif g - score <= (index+1) *100*(arr[index][0]-1):
        num+= -(-(g-score)//(100*(index+1)))
        ans =min(ans,num)

print(ans)
Buggy code:
D, G = map(int, input().split())
PC = [tuple(map(int, input().split())) for _ in range(D)]
minNum = 10**3

for i in range(2**D):
    point = 0
    num = 0
    leftOvers = []
    for j in range(D):
        if ((i>>j) & 1):
            num += PC[j][0]
            point += PC[j][1] + 100 * (j+1) * PC[j][0]
        else:
            leftOvers.extend([100*(j+1)]*PC[j][0])

    while point < G:
        point += leftOvers.pop()
        num += 1
    minNum = min(num, minNum)
print(minNum)


Fixed code:
D, G = map(int, input().split())
PC = [tuple(map(int, input().split())) for _ in range(D)]
minNum = 10**3

for i in range(2**D):
    point = 0
    num = 0
    leftOvers = []
    for j in range(D):
        if ((i>>j) & 1):
            num += PC[j][0]
            point += PC[j][1] + 100 * (j+1) * PC[j][0]
        else:
            leftOvers.extend([100*(j+1)]*PC[j][0])

    while point < G:
        if not leftOvers:
            break
        point += leftOvers.pop()
        num += 1
    minNum = min(num, minNum)
print(minNum)
Buggy code:
import itertools

def all_comb(iterable):
    for i in range(0, len(iterable) + 1):
        comb = itertools.combinations(iterable, i)
        for pair in comb:
            yield(pair)

def min_solve(goal_point, solve, pc_list):
    solve_point = sum([pc[0] * pc[2] + pc[1] for pc in solve])
    solve_num = sum([pc[0] for pc in solve])
    nc_solve = set(pc_list) - set(solve)
    if solve_point > goal_point:
        return float('Inf')
    if solve_point == goal_point:
        return solve_num
    nc_solve_max = max(nc_solve, key=lambda pc:pc[2])
    if solve_point + (nc_solve_max[0] - 1) * nc_solve_max[2]  >= goal_point:
	min_solve = int((goal_point - solve_point) / nc_solve_max[2] + solve_num)
        return min_solve
    else:
        return float('Inf')

if __name__=='__main__':
    D, G = map(int, input().split())
    pc_list = []
    for i in range(D):
	(p, c) = map(int, input().split())
	pc_list.append((p, c, (i + 1) * 100))
    min_num = min([min_solve(G, solve, pc_list) for solve in all_comb(pc_list)])
    print(min_num)


Fixed code:
import itertools
import math

def all_comb(iterable):
    for i in range(0, len(iterable) + 1):
        comb = itertools.combinations(iterable, i)
        for pair in comb:
            yield(pair)

def min_solve(goal_point, solve, pc_list):
    solve_point = sum([pc[0] * pc[2] + pc[1] for pc in solve])
    solve_num = sum([pc[0] for pc in solve])
    nc_solve = set(pc_list) - set(solve)
    if solve_point >= goal_point:
        return solve_num
    nc_solve_max = max(nc_solve, key=lambda pc:pc[2])
    if solve_point + (nc_solve_max[0] - 1) * nc_solve_max[2]  >= goal_point:
        min_solve = int(math.ceil((goal_point - solve_point) / nc_solve_max[2] + solve_num))
        return min_solve
    else:
        return float('Inf')

if __name__=='__main__':
    D, G = map(int, input().split())
    pc_list = []
    for i in range(D):
        (p, c) = map(int, input().split())
        pc_list.append((p, c, (i + 1) * 100))
    min_num = min([min_solve(G, solve, pc_list) for solve in all_comb(pc_list)])
    print(min_num)
Buggy code:
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pdb
import sys
F = sys.stdin

D, G = map(int,F.readline().split())
p = []
c = []
all_score = []
maisu = 0
ans = 0
sum = 0
all_selected = [0]*D
for k in range(D):
    p1, c1 = map(int,F.readline().split())
    p.append(p1)
    c.append(c1)
    all_score.append(100 * k * p1 + c1)

for bit in range(1<<D):
    for i in range(D):
        if bit & (1<<i):
            all_selected[i] = 1
            sum += all_score[i]
            maisu += p[i]

    nokori = G - sum
    if nokori <= 0:
        if ans == 0:
            ans = maisu
        else:
            ans = min(ans, maisu)
        continue
    for j in range(D)[::-1]:
        if all_selected[j] == 0:
            nokorimaisu = (nokori // (100 * j)) + 1
            if nokorimaisu <= p[j]:
                maisu += nokorimaisu
                if ans == 0:
                    ans = maisu
                else:
                    ans = min(ans, maisu)
            break



    all_selected = [0]*D
    maisu = 0
    sum = 0

print(ans)


Fixed code:
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pdb
import sys
import math
F = sys.stdin

D, G = map(int,F.readline().split())
p = []
c = []
all_score = []
maisu = 0
ans = 0
sum = 0
all_selected = [0]*D
for k in range(D):
    p1, c1 = map(int,F.readline().split())
    p.append(p1)
    c.append(c1)
    all_score.append(100 * (k+1) * p1 + c1)

for bit in range(1<<D):
    for i in range(D):
        if bit & (1<<i):
            all_selected[i] = 1
            sum += all_score[i]
            maisu += p[i]

    nokori = G - sum
    if nokori <= 0:
        if ans == 0:
            ans = maisu
        else:
            ans = min(ans, maisu)
        all_selected = [0]*D
        maisu = 0
        sum = 0
        continue

    for j in range(D)[::-1]:
        if all_selected[j] == 0:
            nokorimaisu = math.ceil(nokori / (100 * (j+1)))
            if nokorimaisu <= p[j]:
                maisu += nokorimaisu
                if ans == 0:
                    ans = maisu
                else:
                    ans = min(ans, maisu)
            break

    all_selected = [0]*D
    maisu = 0
    sum = 0

print(ans)
Buggy code:
d,g = map(int,input().split())
li = []

for i in range(d):
    p,c = map(int,input().split())
    li.append([p,c])

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt += memo2//(100*(j+1))
                    ttl += (memo2//(100*(j+1)))*(100*(j+1))
                else:
                    cnt += memo2//(100*(j+1))+1
                    ttl += (memo2//(100*(j+1))+1)*(100*(j+1))
                break
    if ttl >= g:
        ans = min(ans,cnt)
    
    if ans == cnt:
        print(memo,ttl)
    

print(ans)



Fixed code:
d,g = map(int,input().split())
li = []

for i in range(d):
    p,c = map(int,input().split())
    li.append([p,c])

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt2 = min(memo2//(100*(j+1)),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                    #print(44444444)
                else:
                    cnt2 = min(((memo2//(100*(j+1)))+1),li[j][0]-1)
                    #print(((memo2//(100*(j+1)))+1))
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                break
    if ttl >= g:
        ans = min(ans,cnt)
"""   
    if ans == cnt:
        print(memo,ttl,111111)
"""   
    

print(ans)
Buggy code:
D,G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]

ans = float("inf")
for i in range(2**D):
    sum = 0
    count = 0
    rem = set(range(1,D+1))
    for j in range(D):
        if (i >> j) & 1:
            sum += pc[j][0]*100*j+pc[j][1]
            count += pc[j][0]
            rem.discard(j+1)
    if sum < G:
        k = max(rem)-1
        n = min(pc[k][0],-(-(G-sum)//((k+1)*100))
        count += n
        sum += n*100*(k+1)
    if sum >= G:
        ans = min(ans,count)

print(ans)
        


Fixed code:
D,G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]

#print(pc)
ans = float("inf")

for i in range(2**D):
    sum = 0
    count = 0
    rem = set(range(1,D+1))
    for j in range(D):
        if (i >> j) & 1:
            sum += pc[j][0]*100*(j+1)+pc[j][1]
            count += pc[j][0]
            rem.discard(j+1)
    if sum < G:
        k = max(rem)-1
        n = min(pc[k][0],-(-(G-sum)//((k+1)*100)))
        count += n
        sum += n*100*(k+1)
    if sum >= G:
        ans = min(ans,count)

print(ans)
Buggy code:
d, g = map(int, input().split())
lst = []
for _ in range(d):
  lst.append([int(i) for i in input().split()])

res = 1000
for i in range(1 << d):
  s = 0
  c = 0
  for j in range(d):
    if i >> j & 1:
      s += 100 * (j + 1) * lst[j][0] + lst[j][1]
      c += lst[j][0]
    else:
      last = j
    if s < g:
      s100 = 100 * (j + 1)
      need = (g - s - 1) // s100 + 1
      if need > lst[j][0]:
        continue
      c += need
    if res > c:
      res = c
print(res)

Fixed code:
d, g = map(int, input().split())
lst = []
for _ in range(d):
  lst.append([int(i) for i in input().split()])

res = 1000
for i in range(1 << d):
  s = 0
  c = 0
  for j in range(d):
    if i >> j & 1:
      s += 100 * (j + 1) * lst[j][0] + lst[j][1]
      c += lst[j][0]
    else:
      last = j
  if s < g:
    s100 = 100 * (last + 1)
    need = (g - s - 1) // s100 + 1
    if need > lst[last][0]:
      continue
    c += need
  if res > c:
    res = c
print(res)