qyliang/CodeNanoFix huggingface dataset:
Buggy code:
#2-1-1 #ABC104C
d,g = map(int,input().split())
q={}
comp={}
p={}
minsolve=0
for i in range(d):
    a,b=map(int,input().split())
    q[i]=a
    p[i]=100*(i+1)
    comp[i]=100*(i+1)*a+b
    minsolve+=a
    
solve=[0 for _ in range(d)]
def roop(s,check,point,solved,minsolve):
    solve=s.copy()
    solve2=s.copy()
    if check==d:
        if 0 in solve:
            solverev=solve.copy()
            solverev.reverse()
            idx=d-solverev.index(0)-1
            shold=min(0,1+(g-point-1)//p[idx])
            if q[idx]>shold and shold>=0:
                solved+=shold
                minsolve=min(minsolve,solved)
        return minsolve

    minsolve=roop(solve,check+1,point,solved,minsolve)
    solve2[check]+=1
    minsolve=roop(solve2,check+1,point+comp[check],solved+q[check],minsolve)
    return minsolve

print(roop(solve,0,0,0,minsolve))

Fixed code:
d,g = map(int,input().split())
q={}
comp={}
p={}
minsolve=0
for i in range(d):
    a,b=map(int,input().split())
    q[i]=a
    p[i]=100*(i+1)
    comp[i]=100*(i+1)*a+b
    minsolve+=a
    
solve=[0 for _ in range(d)]
def roop(s,check,point,solved,minsolve):
    solve=s.copy()
    solve2=s.copy()
    if check==d:
        if point>g:
            minsolve=min(minsolve,solved)
            return minsolve
        if 0 in solve:
            solverev=solve.copy()
            solverev.reverse()
            idx=d-solverev.index(0)-1
            shold=1+(g-point-1)//p[idx]
            if q[idx]>shold and shold>=0:
                solved+=shold
                minsolve=min(minsolve,solved)
        return minsolve

    minsolve=roop(solve,check+1,point,solved,minsolve)
    solve2[check]+=1
    minsolve=roop(solve2,check+1,point+comp[check],solved+q[check],minsolve)
    return minsolve

print(roop(solve,0,0,0,minsolve))
Buggy code:
N = input().split()
N = [int(i) for i in N]
pi = [0 for i in range(N[0])]
ci = [0 for i in range(N[0])]
for i in range(N[0]):
    buf = input().split()
    pi[i] = int(buf[0])
    ci[i] = int(buf[1])

num_min = 10*100
G_new = N[1]

flag= [0 for i in range(N[0])]
for i in range(0, pow(2, N[0])):
    G_new = N[1]
    count = 0
    #print(bin(i))
    for j in range(N[0]):
        flag[j] = (i>>j & 1)
        if(flag[j]==1):
            G_new -= ci[j]
            G_new -= 100*(j+1)*pi[j]
            count += pi[j]
    #print(flag)

    if(G_new<=0):
        if(count < num_min):
            num_min = count
            #print(count)
            break
    else:
        for j in range(N[0]):
            if((flag[N[0]-1-j])==0):
                if(G_new - 100*(N[0]-j)*pi[N[0]-1-j] <= 0):
                    count += -(-G_new//(100*(N[0]-j)))
                    if(count < num_min):
                        num_min = count
                break

    
print(num_min)


Fixed code:
N = input().split()
N = [int(i) for i in N]
pi = [0 for i in range(N[0])]
ci = [0 for i in range(N[0])]
for i in range(N[0]):
    buf = input().split()
    pi[i] = int(buf[0])
    ci[i] = int(buf[1])

num_min = 10*100
G_new = N[1]

flag= [0 for i in range(N[0])]
for i in range(0, pow(2, N[0])):
    G_new = N[1]
    count = 0
    #print(bin(i))
    for j in range(N[0]):
        flag[j] = (i>>j & 1)
        if(flag[j]==1):
            G_new -= ci[j]
            G_new -= 100*(j+1)*pi[j]
            count += pi[j]
    #print(flag)

    if(G_new<=0):
        #print(i, flag)
        if(count < num_min):
            #print(count)
            num_min = count
            #print(count)
    else:
        for j in range(N[0]):
            if((flag[N[0]-1-j])==0):
                #print(i, flag, N[0]-1-j, G_new, pi[N[0]-1-j], count, -(-G_new//(100*(N[0]-j)))   )
                if(G_new - 100*(N[0]-j)*pi[N[0]-1-j] < 0):
                    count += -(-G_new//(100*(N[0]-j)))
                    if(count < num_min):
                       # print(count)
                        num_min = count
                break

    
print(num_min)
Buggy code:
# https://atcoder.jp/contests/abc104/tasks/abc104_c


def solve(D, G, ps, cs):
  ans = 100000000
  for mask in range(1 << D):
    s = 0
    num = 0
    rest_max = -1
    for i in range(D):
      if mask >> i & 1:
        s += 100 * (i+1) * ps[i] + cs[i]
        num += ps[i]
      else:
        rest_max = i
    if s < G:
      s1 = 100 * (rest_max + 1)
      need = (G - s + s1 - 1) / s1
      if need >= ps[rest_max]:
        continue
      num += need
    ans = min(ans, num)
  return ans
  

if __name__ == '__main__':
  D, G = map(int, input().split(' '))
  ps = []
  cs = []
  for i in range(D):
    p, c = map(int, input().split(' '))
    ps.append(p)
    cs.append(c)
  print(solve(D, G, ps, cs))
  

Fixed code:
# https://atcoder.jp/contests/abc104/tasks/abc104_c


def solve(D, G, ps, cs):
  ans = 100000000
  for mask in range(1 << D):
    s = 0
    num = 0
    rest_max = -1
    for i in range(D):
      if mask >> i & 1:
        s += 100 * (i+1) * ps[i] + cs[i]
        num += ps[i]
      else:
        rest_max = i
    if s < G:
      s1 = 100 * (rest_max + 1)
      need = int((G - s + s1 - 1) / s1)
      if need >= ps[rest_max]:
        continue
      num += need
    ans = min(ans, num)
  return ans
  

if __name__ == '__main__':
  D, G = map(int, input().split(' '))
  ps = []
  cs = []
  for i in range(D):
    p, c = map(int, input().split(' '))
    ps.append(p)
    cs.append(c)
  print(solve(D, G, ps, cs))
Buggy code:
#! env python
# -*- coding: utf-8 -*-

from collections import defaultdict
import sys, heapq, bisect, math, itertools, string, queue, datetime

# atcoder.main
# Date: 2020/06/20
# Filename: main 
# Author: acto_mini

sys.setrecursionlimit(10 ** 8)
INF = float('inf')

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

for bit in range(1 << D):
    count = 0
    sum = 0
    left_over = set(range(1, D + 1))

    for i in range(D):
        if bit & (1 << i):
            sum += PC[i][0] * (i + 1) * 100 + PC[i][1]
            count += PC[i][0]
            left_over.discard(i + 1)

    if sum < G:
        use = max(left_over)
        n = min(PC[use - 1][0], -((G - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= G:
        ans = min(ans, count)

print(ans)


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

from collections import defaultdict
import sys, heapq, bisect, math, itertools, string, queue, datetime

# atcoder.main
# Date: 2020/06/20
# Filename: main 
# Author: acto_mini

sys.setrecursionlimit(10 ** 8)
INF = float('inf')

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

for bit in range(1 << D):
    count = 0
    sum = 0
    left_over = set(range(1, D + 1))

    for i in range(D):
        if bit & (1 << i):
            sum += PC[i][0] * (i + 1) * 100 + PC[i][1]
            count += PC[i][0]
            left_over.discard(i + 1)

    if sum < G:
        use = max(left_over)
        n = min(PC[use - 1][0], -(-(G - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= G:
        ans = min(ans, count)

print(ans)
Buggy code:
import math

D,G = map(int, input().split())
l=[list(map(int,input().split())) for i in range(D)]
lst=[[(i+1)*100]*(l[i][0]-1) + [(i+1)*100 + l[i][1]] for i in range(len(l))]
ans = 100*D
dis = 100000*D
for i in range(1<<D):
    print(bin(i))
    point,num,maxp=0,0,0
    for j in range(D):
        if (i>>j)&1:
            num+=len(lst[j])
            point+=sum(lst[j])
        else:
            maxp=j
    if point + (maxp+1)*100*(len(lst[maxp])-1) >= G:
        mq = max(0,math.ceil((G-point)/((maxp+1)*100)))
        ans = min(ans, num+mq)
print(int(ans))

Fixed code:
import math

D,G = map(int, input().split())
l=[list(map(int,input().split())) for i in range(D)]
lst=[[(i+1)*100]*(l[i][0]-1) + [(i+1)*100 + l[i][1]] for i in range(len(l))]
ans = 100*D
dis = 100000*D
for i in range(1<<D):
    point,num,maxp=0,0,0
    for j in range(D):
        if (i>>j)&1:
            num+=len(lst[j])
            point+=sum(lst[j])
        else:
            maxp=j
    if point + (maxp+1)*100*(len(lst[maxp])-1) >= G:
        mq = max(0,math.ceil((G-point)/((maxp+1)*100)))
        ans = min(ans, num+mq)
print(int(ans))
Buggy code:
import sys 
sys.setrecursionlimit(10**6)

def dfs(i,sum,count,nokori):
  global ans
  if i==g:
    if sum<g:
      use=max(nokori)
      n=min(pc[n-1][1],-(-(g-sum)//100*use)
      count+=n
      sum+=n*100*use

    if sum>=g:
      ans=min(ans,count)

  else:
    dfs(i+1,sum,count,nokori)
    dfs(i+1,sum+pc[i][0]*100*(i+1)+pc[i][1],count+pc[i][0],nokori-(i+1))

d,g=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(d)]
ans=float('inf')

dfs(0,0,0,set(range(1,d+1))

print(ans)  

Fixed code:
import sys 
sys.setrecursionlimit(10**8)

def dfs(i,sum,count,nokori):
  global ans
  if i==d:
    if sum<g:
      use=max(nokori)
      n=min(pc[use-1][0],-(-(g-sum)//(100*use)))
      count +=n
      sum +=n*100*use

    if sum>=g:
      ans=min(ans,count)

  else:
    dfs(i+1,sum,count,nokori)
    dfs(i+1,sum+pc[i][0]*100*(i+1)+pc[i][1],count+pc[i][0],nokori-{i+1})

d,g=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(d)]
ans=float('inf')

dfs(0,0,0,set(range(1,d+1)))

print(ans)
Buggy code:
d, g = map(int, input().split())
p = []
c = []
su = []
ans = 1000
for i in range(d):
  a,b = map(int, input().split())
  p.append(a)
  c.append(b)
  su.append(a*100*(i+1)+b)
bit = [1,2,4,8,16,32,64,128,256,512]
for i in range(1024):
  count = 0
  for j in range(d):
    if i & bit[j] == 0:
      continue
    score += su[j]
    count += p[j]
  if score < g:
    continue
  for j in range(d):
    if i & bit[j] == 0 or score - su[j] >= g:
      continue
    rest = g - (score - su[j])
    count_tmp = count - p[j] + math.ceil(rest / ((d+i)*100))
    ans = min(ans, count_tmp)
print(ans)

Fixed code:
import math
d, g = map(int, input().split())
p = []
c = []
su = []
ans = 1000
for i in range(d):
  a,b = map(int, input().split())
  p.append(a)
  c.append(b)
  su.append(a*100*(i+1)+b)
bit = [1,2,4,8,16,32,64,128,256,512]
for i in range(int(math.pow(2,d))):
  count = 0
  score = 0
  for j in range(d):
    if i & bit[j] == 0:
      continue
    score += su[j]
    count += p[j]
  if score < g:
    continue
  for j in range(d):
    if i & bit[j] == 0 or score - su[j] >= g:
      continue
    rest = g - (score - su[j])
    count_tmp = min(count , count - p[j] + math.ceil(rest / ((j+1)*100)))
    ans = min(ans, count_tmp)
print(ans)
Buggy code:
D,G=map(int,input().split())

p=[0]*D
c=[0]*D

for i in range(D):
    p[i],c[i]=map(int,input().split())
ans=10e+9

for i in range(2**D):
    sum=0
    q=0
    for j in range(D):
        if(i>>j & 1):
            sum+=(j+1)*100*p[j]+c[j]
            q+=p[j]
        else:
            rest_max=j
    if(sum<G):
        r1=100*(rest_max+1)
        need=-(-(G-sum)//r1)
        if(need>=p[rest_max]-1):
            continue
        q+=need
        sum+=need*r1
    
    if(sum>=G):
        ans=min(ans,q)

print(ans)

Fixed code:
D,G=map(int,input().split())

p=[0]*D
c=[0]*D

for i in range(D):
    p[i],c[i]=map(int,input().split())
ans=10e+9

for i in range(2**D):
    sum=0
    q=0
    for j in range(D):
        if(i>>j & 1):
            sum+=(j+1)*100*p[j]+c[j]
            q+=p[j]
        else:
            rest_max=j
    if(sum<G):
        r1=100*(rest_max+1)
        need=-(-(G-sum)//r1)
        if(need>p[rest_max]-1):
            continue
        q+=need
        sum+=need*r1
    
    if(sum>=G):
        ans=min(ans,q)

print(ans)
Buggy code:
D, G = map(int, input().split())
P = []
C = []
ans = 10 ** 10
for i in range(D):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c)

for i in range(2 ** D):
    a = 0
    b = 0
    for j in range(D):
        if i >> j & 1 :
            a += 100 * P[j] * (j + 1) + C[j]
            b += P[j]
    for k in range(D - 1, -1, -1):
        if (i >> k) & 1:
            continue
        if b >= G:
            break
        for l in range(P[k]):
             a += 100 * (k + 1)
             b += 1
             if a >= G:
                 break
    ans = min(ans, b)
print(ans)

Fixed code:
D, G = map(int, input().split())
P = []
C = []
ans = 10 ** 9
for i in range(D):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c)

for i in range(2 ** D):
    a = 0
    b = 0
    for j in range(D):
        if (i >> j) & 1 :
            a += 100 * P[j] * (j + 1) + C[j]
            b += P[j]
    for k in range(D - 1, -1, -1):
        if (i >> k) & 1:
            continue
        if a >= G:
            break
        for l in range(P[k]):
            a += 100 * (k + 1)
            b += 1
            if a >= G:
                break
    ans = min(ans, b)
print(ans)
Buggy code:
D, G = map(int, input().split())
PC = [tuple(map(int, input().split())) for _ in range(D)]

res = float("inf")
for bit in range(1 << D):
    sum = 0
    num = 0
    for i in range(D):
        if ((bit >> i) & 1):
            sum += (i + 1) * 100 * PC[i][0] + PC[i][1]
            num += PC[i][0]
    if sum >= G:
        res = min(res, num)
    for i in range(D - 1, -1, -1):
        if ((bit >> i) & 1):
            continue
        for j in range(PC[i][0] - 1):
            sum += (i + 1) * 100
            num += 1
        if sum >= G:
            res = min(res, num)
            break
print(res)


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

res = float("inf")
for bit in range(1 << D):
    summ = 0
    num = 0
    for i in range(D):
        if ((bit >> i) & 1):
            summ += (i + 1) * 100 * PC[i][0] + PC[i][1]
            num += PC[i][0]
    if summ >= G:
        res = min(res, num)
    for i in range(D - 1, -1, -1):
        if ((bit >> i) & 1):
            continue
        for _ in range(PC[i][0] - 1):
            summ += (i + 1) * 100
            num += 1
            if summ >= G:
                res = min(res, num)
                break
print(res)
Buggy code:
d, g = map(int, input().split())
p_and_c = [list(map(int, input().split())) for _ in range(d)]
min_number = 1000
for i in range(2**d):
    score = 0
    number = 0
    p_and_c_copy = p_and_c.copy()
    rest_num = set(range(1, d+1))
    for j in range(d):
        if i & (1 << j):
            number += p_and_c_copy[j-d][0]
            score += p_and_c_copy[j-d][1] + 100 * (j+1) * p_and_c_copy.pop(j-d)[0]
            rest_num.discard(j+1)
    print(score)
    if p_and_c_copy:
        for k in range(p_and_c_copy[-1][0]):
            if score >= g:
                break
            score += 100 * max(rest_num)
            number += 1
        else:
            continue
    min_number = min(min_number, number)
print(min_number)

Fixed code:
d, g = map(int, input().split())
p_and_c = [list(map(int, input().split())) for _ in range(d)]
min_number = 1000
for i in range(2**d):
    score = 0
    number = 0
    p_and_c_copy = p_and_c.copy()
    rest_num = set(range(1, d+1))
    for j in range(d):
        if i & (1 << j):
            number += p_and_c_copy[j-d][0]
            score += p_and_c_copy[j-d][1] + 100 * (j+1) * p_and_c_copy.pop(j-d)[0]
            rest_num.discard(j+1)
    if p_and_c_copy:
        for k in range(p_and_c_copy[-1][0]):
            if score >= g:
                break
            score += 100 * max(rest_num)
            number += 1
        else:
            continue
    min_number = min(min_number, number)
print(min_number)
Buggy code:
D, G = map(int, input().split())
dic = [0]*(D+1)
for i in range(D):
  p, c = map(int, input().split())
  dic[i+1] = (p,c)
ans = 10**9
for i in range(1,2**D):
  ls = []
  x = i
  v = 0
  count = 0
  for j in range(D):
    if x%2==1:
      ls += [j+1]
    x = x>>1
  for h in ls:
    p, c = dic[h]
    v += p*h*100 + c
    count += p
  if G>v:
    a = ls[0]
    if a==1:
      continue
    a = a-1
    m =dic[a][0]
    while m:
      v += a*100
      count += 1
      m -= 1
      if v>=G:
        break
    else:
      continue
  if count<ans:
    ans = count
print(ans)

Fixed code:
D, G = map(int, input().split())
dic = [0]*(D+1)
for i in range(D):
  p, c = map(int, input().split())
  dic[i+1] = (p,c)
ans = 10**9
for i in range(2**D):
  ls = []
  x = i
  v = 0
  count = 0
  for j in range(D):
    if x%2==1:
      ls += [j+1]
    x = x>>1
  for h in ls:
    p, c = dic[h]
    v += p*h*100 + c
    count += p
  if G>v:
    for j in range(D, 0, -1):
      if not j in ls:
        break
    else:
      continue
    m = dic[j][0]
    while m>1:
      v += j*100
      count += 1
      m -= 1
      if v>=G:
        break
    else:
      continue
  if count<ans:
    ans = count
print(ans)
Buggy code:
difficulties, goal = map(int, input().split())

pcs = [list(map(int, input().split())) for _ in range(difficulties)]

total_problem = 0
new_dp = [0] * 1001

for d, pc in enumerate(pcs, 1):
    dp = new_dp

    problem, complete = pc
    total_problem += problem

    score = {x: x*100*d for x in range(problem)}
    score[problem] = problem * 100 * d +complete

    for i in range(1, total_problem + 1):
        for j in range(0, i + 1):
            if i - j > problem:
                continue
            else:
                new_dp[i] = max(new_dp[i], dp[d-1][j] + score[i-j])

for i, a in enumerate(new_dp):
    if a >= goal:
        print(i)
        exit()


Fixed code:
difficulties, goal = map(int, input().split())

pcs = [list(map(int, input().split())) for _ in range(difficulties)]

dp = [[0] * 1102 for _ in range(difficulties + 1)]

total_problem = 0
for d, pc in enumerate(pcs, 1):
    problem, complete = pc
    total_problem += problem

    score = {x: x*100*d for x in range(problem)}
    score[problem] = problem * 100 * d +complete

    for i in range(1, total_problem + 1):
        for j in range(0, i + 1):
            if i - j > problem:
                dp[d][i] = max(dp[d][i], dp[d - 1][j])
            else:
                dp[d][i] = max(dp[d][i], dp[d-1][j] + score[i-j])

for i, a in enumerate(dp[difficulties]):
    if a >= goal:
        print(i)
        exit()
Buggy code:
from itertools import product
D, G = map( int, input().split())
P = []
C = []
SUM = []
for i in range(D):
    p, c = map( int, input().split())
    P.append(p)
    SUM.append(p*100*(i+1) + c)

ans = 1000
for X in product(range(2), repeat = D):
    cnt = 0
    com = 0
    K = []
    for i in range(D):
        if X[i] == 1:
            cnt += P[i]
            com += SUM[i]
        else:
            K.append(i)
    if com >= G:
        ans = min(ans, cnt)
    else:
        for k in K:
            need = min((G-com)//(100*(k+1))+1,P[k]-1)
            kcnt = cnt + need
            kcom = com + need*100*(k+1)
            if kcom >= G:
                ans = min(ans,kcnt)
print(ans)

Fixed code:
from itertools import product
D, G = map( int, input().split())
P = []
C = []
SUM = []
for i in range(D):
    p, c = map( int, input().split())
    P.append(p)
    SUM.append(p*100*(i+1) + c)

ans = 1000
for X in product(range(2), repeat = D):
    cnt = 0
    com = 0
    K = []
    for i in range(D):
        if X[i] == 1:
            cnt += P[i]
            com += SUM[i]
        else:
            K.append(i)
    if com >= G:
        ans = min(ans, cnt)
    else:
        for k in K:
            need = min((G-com-1)//(100*(k+1))+1,P[k]-1)
            kcnt = cnt + need
            kcom = com + need*100*(k+1)
            if kcom >= G:
                ans = min(ans,kcnt)
print(ans)
Buggy code:

D,G = map(int,list(input().split()))

p_tatal = []
for i in range(D):
    p,c = map(int,list(input().split()))
    p_tatal.append([p,p*(i+1)*100+c])

ans = 10**18
for i in range(2**D):
    binary = bin(i)[2:].zfill(D)
    tatal = 0
    cnt = 0
    for j in range(D):
        if binary[j]=='1':
            tatal += p_tatal[j][1]
            cnt += p_tatal[j][0]
        else:
            not_use = j
    print(tatal,cnt)   
    if tatal >= G:
#        print(cnt)
        ans = min(ans,cnt)
    elif tatal < G <=  tatal +(p_tatal[not_use][0]-1)*(not_use+1)*100:
        cnt += (G - tatal)// ((not_use+1)*100)
#        print(cnt)
        ans = min(ans,cnt)
    else:
        continue
        

print(ans)    



Fixed code:

D,G = map(int,list(input().split()))

p_tatal = []
for i in range(D):
    p,c = map(int,list(input().split()))
    p_tatal.append([p,p*(i+1)*100+c])

ans = 10**18
for i in range(2**D):
    binary = bin(i)[2:].zfill(D)
    tatal = 0
    cnt = 0
    for j in range(D):
        if binary[j]=='1':
            tatal += p_tatal[j][1]
            cnt += p_tatal[j][0]
        else:
            not_use = j
#    print(1tatal,cnt)   
    if tatal >= G:
#        print(cnt)
        ans = min(ans,cnt)
    elif tatal < G <=  tatal +(p_tatal[not_use][0]-1)*(not_use+1)*100:
        cnt += -(-(G - tatal)// ((not_use+1)*100))
#        print(cnt)
        ans = min(ans,cnt)
    else:
        continue
        

print(ans)
Buggy code:
[d,g]=list(map(int,input().split()))
pc=[]
for i in range(d):
    kari=list(map(int,input().split()))
    pc.append(kari)
gokei=[]
for i in range(d):
    gokei.append(100*(i+1)*pc[i][0]+pc[i][1])

kosumin=10000
for i in range(1<<d):
    score=0
    kosu=0
    jmax=0
    siyouzumi=[]
    for j in range(d):
        if ((i>>j)&1)==1:
            score+=gokei[j]
            kosu+=pc[j][0]
            siyouzumi.append(j)

    if score>=g:
        if kosumin>kosu:
            kosumin=kosu
    if score<g:
        a=d-1
        while True:
            if a==-1:
                break
            if not a in siyouzumi:
                saidai=a
                break
            a-=1
        if a==-1:
            continue

        for k in range(pc[saidai][0]):
            score+=(saidai+1)*100
            kosu+=1
            if k==pc[saidai][0]-1:
                score+=pc[saidai][1]
            if score>=g:
                break
        if kosumin>kosu:
            kosumin=kosu
print(kosumin)
                




Fixed code:
[d,g]=list(map(int,input().split()))
pc=[]
for i in range(d):
    kari=list(map(int,input().split()))
    pc.append(kari)
gokei=[]
for i in range(d):
    gokei.append(100*(i+1)*pc[i][0]+pc[i][1])

kosumin=10000
for i in range(1<<d):
    score=0
    kosu=0
    jmax=0
    siyouzumi=[]
    for j in range(d):
        if ((i>>j)&1)==1:
            score+=gokei[j]
            kosu+=pc[j][0]
            siyouzumi.append(j)

    if score>=g:
        if kosumin>kosu:
            kosumin=kosu
    if score<g:
        a=d-1
        while True:
            if a==-1:
                break
            if not a in siyouzumi:
                saidai=a
                break
            a-=1
        if a==-1:
            continue

        for k in range(pc[saidai][0]):
            score+=(saidai+1)*100
            kosu+=1
            if k==pc[saidai][0]-1:
                score+=pc[saidai][1]
            if score>=g:
                break
        if score>=g and kosumin>kosu:
            kosumin=kosu
print(kosumin)