Problem:
 Score : 300 points    Problem Statement A programming competition site AtCode provides algorithmic problems.
Each problem is allocated a score based on its difficulty.
Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.
These p_1 + … + p_D problems are all of the problems available on AtCode.  A user of AtCode has a value called total score .
The total score of a user is the sum of the following two elements:   Base score: the sum of the scores of all problems solved by the user.  Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D) .   Takahashi, who is the new user of AtCode, has not solved any problem.
His objective is to have a total score of G or more points.
At least how many problems does he need to solve for this objective?      Constraints  1 ≤ D ≤ 10  1 ≤ p_i ≤ 100  100 ≤ c_i ≤ 10^6  100 ≤ G  All values in input are integers.  c_i and G are all multiples of 100 .  It is possible to have a total score of G or more points.         Input Input is given from Standard Input in the following format:  D  G  p_1  c_1  :  p_D  c_D       Output Print the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).        Sample Input 1 2 700
3 500
5 800      Sample Output 1 3  In this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100 -point problems is 500 points, and the perfect bonus for solving all the 200 -point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.  One way to achieve this objective is to solve four 200 -point problems and earn a base score of 800 points. However, if we solve three 100 -point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.       Sample Input 2 2 2000
3 500
5 800      Sample Output 2 7  This case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200 -point problems, and by solving two 100 -point problems additionally we have the total score of 2000 points.       Sample Input 3 2 400
3 500
5 800      Sample Output 3 2  This case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200 -point problems to achieve the objective.       Sample Input 4 5 25000
20 1000
40 1000
50 1000
30 1000
1 1000      Sample Output 4 66  There is only one 500 -point problem, but the perfect bonus can be earned even in such a case.

Solution (Python):
d,g = map(int,input().split())
p,c = [0]*d,[0]*d
import math

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

ans = 10**9
for i in range(2**d):
    ls = ""
    for j in range(d):
        if (i>>j)&1:
            ls = "1"+ls
        else:
            ls = "0"+ls
    score = 0
    cnt = 0
    ls = list(ls)
    for i in range(d):
        if ls[(d-1)-i] == "1":
            score += 100*(i+1)*p[i] + c[i]
            cnt += p[i]
    if score>=g:
        ans = min(ans,cnt)
    else:
        index = d-1 - ls.index("0")
        maximum = p[index]
        score = g - score
        if maximum>=math.ceil(score/((index+1)*100)):
            cnt +=math.ceil(score/((index+1)*100))
            ans = min(ans,cnt)
        else:
            pass


print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(100000)
inf = float('inf')

def dfs(h, s):
    
    if h == D:
        tmp = 0
        p = 0
        ans = 0
        for i, c in enumerate(s):
            if c == '0':
                tmp = i
            else:
                ans += pc[i][0]
                p += (i+1) * 100 * pc[i][0] + pc[i][1]
        for i in range(pc[tmp][0]-1):
            if p < G:
                p += (tmp + 1) * 100
                ans += 1
        if p < G:
            return inf
        else:
            return ans
    tmp1 = dfs(h+1, s + '0')
    tmp2 = dfs(h+1, s + '1')
    return min(tmp1, tmp2)


D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
print(dfs(0, ''))

Solution (Python):

import sys
input = sys.stdin.readline

def ans(g, i, L):
    
    if i == 0:  
        return float("inf")

    n = min(g // (i * 100), L[i][0])  
    s = n * i * 100  

    
    if n == L[i][0]:
        s += L[i][1]

    
    if s < g:
        n += ans(g - s, i - 1, L)

    
    return min(n, ans(g, i - 1, L))


def main():
    d, g = list(map(int, input().rstrip().split()))
    arr = [0] + [list(map(int, input().rstrip().split())) for _ in range(d)]
    print(ans(g, d, arr))


if __name__ == "__main__":
    main()

Solution (Python):

def ans(g, i, L):
    
    if i == 0:  
        return float("inf")

    n = min(g // (i * 100), L[i][0])  
    s = n * i * 100  

    
    if n == L[i][0]:
        s += L[i][1]

    
    if s < g:
        n += ans(g - s, i - 1, L)

    
    return min(n, ans(g, i - 1, L))


def main():
    d, g = list(map(int, input().rstrip().split()))
    arr = [0] + [list(map(int, input().rstrip().split())) for _ in range(d)]
    print(ans(g, d, arr))


if __name__ == "__main__":
    main()

Solution (Python):
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(D)]
ans = 10**5

for i in range(2**D):
  score = 0
  tmp = 0
  solved = [False]*D
  for j in range(D):
    if (i>>j) & 1:
      score += (j+1) * 100 * pc[j][0] + pc[j][1]
      tmp += pc[j][0]
      solved[j] = True
  if score >= G:
    ans = min(ans, tmp)
  else:
    for k in range(D-1,-1,-1):
      if solved[k] == False:
        l = 0
        while score < G and l < pc[k][0]:
          score += (k+1)*100
          tmp += 1
          l += 1
        if score >= G:
          ans = min(ans, tmp)
          break
print(ans)

Solution (Python):
D,G = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(D)]

ans = 10**9
for b in range(1<<D):
    score = 0
    ac = 0
    for k in range(D):
        if b&(1<<k):
            p,c = src[k]
            score += c + p*100*(k+1)
            ac += p
    if score >= G:
        ans = min(ans,ac)
        continue
    for k in range(D-1,-1,-1):
        if b&(1<<k)==0:
            p,c = src[k]
            if score + p*(k+1)*100 < G:
                score += p*(k+1)*100
                ac += p
            else:
                rem = score- G
                ac -= rem//((k+1)*100)
                ans = min(ans,ac)
print(ans)

Solution (Python):
import math
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)
  
ans = []  
def solve(s):
  global ans
  if len(s) == d:
    total = 0
    cnt = 0
    for i in range(len(s)):
      total += int(s[i]) * (ps[i]*(i+1)*100 + cs[i]) 
      cnt += int(s[i]) * ps[i]
    if total >= g:
      
      ans.append(cnt)
      return
    else:
      
      s = s[::-1]
      idx = s.find("0")
      if s == -1:
        return
      
      if math.ceil((g-total) /  ((d-idx)*100)) < ps[d-1-idx]:
        cnt += math.ceil((g-total) /  ((d-idx)*100))
        
        ans.append(cnt)
        return
      else:
        
        return
      return
  solve(s+"0")
  solve(s+"1")

  
solve("")
print(min(ans))

Solution (Python):
D, G = map(int, input().split())

p = []
c = []

for i in range(D):
    x, y = map(int, input().split())
    p.append(x)
    c.append(y)

ans = sum(p)

for i in range(2 ** D):
    score = 0
    tmp = 0
    notuse = [0] * D
    for j in range(D):
        if ((i >> j) & 1):
            score += (100 * (j + 1) * p[j] + c[j])
            tmp += p[j]
            notuse[j] += 1
    if score < G:
        k = D - 1
        while notuse[k] == 1:
            k -= 1
        for l in range(p[k] - 1):
            score += 100 * (k + 1)
            tmp += 1
            if score >= G:
                break
        if tmp < ans and score >= G:
            ans = tmp
    else:
        if tmp < ans:
            ans = tmp

print(ans)

Solution (Python):
D,G = map(int, input().split())

p = []
c = []

for i in range(D):
    x,y = map(int, input().split())
    p.append(x)
    c.append(y)

ans = sum(p)
for i in range(2**D):
    score = 0
    tmp = 0
    notuse = [0]*D
    for j in range(D):
        if ((i >> j) & 1):
            score += (100*(j+1)*p[j] + c[j])
            tmp += p[j]
            notuse[j] += 1
    if score < G:
        k = D-1
        while notuse[k] == 1:
            k -= 1
        for l in range(p[k]-1):
            score += 100*(k+1)
            tmp += 1
            if score >= G:
                break
        if tmp < ans and score >= G:
            ans = tmp
    else:
        if tmp < ans:
                ans = tmp

print(ans)

Solution (Python):
D, G = map(int, input().split())

N = []
C = []
for _ in range(D):
    n, c = map(int, input().split())
    N.append(n)
    C.append(c)

min_answered = 100**D + 5


for i in range(pow(2, D)):

    points = 0
    n_answered = 0
    rest_i = []  

    for j in range(D):
        
        if (i >> j) & 1:
            points += N[j] * (j+1) * 100 + C[j] 
            n_answered += N[j]

        
        else:
            rest_i.append(j)

    
    if rest_i:
        max_i = max(rest_i)  
        max_n = N[max_i]     
        max_p = 100 * (max_i + 1)  

        
        while points < G and max_n > 0:
            points += max_p
            n_answered += 1
            max_n -= 1

    
    if points >= G:
        min_answered = min(min_answered, n_answered)

print(min_answered)

Solution (Python):

d,g=map(int,input().split())
p,c=[0]*d,[0]*d

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

ans=float('inf')

for i in range(2**d):
    s=0
    cnt=0
    rest_max=-1
    for j in range(d):
        if (i>>j)&1:
            s+=100*(j+1)*p[j]+c[j]
            cnt+=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
        cnt+=need
    ans=min(ans,cnt)
print(ans)

Solution (Python):
d,g = map(int,input().split())
p=[]
c=[]
for i in range(d):
    pp,cc=map(int,input().split())
    p.append(pp)
    c.append(cc)
ans =100000
for i in range(2**d):
    score=0
    cnt=0
    other=[]
    bina = format(i,"b").zfill(d)
    for j in range(len(bina)):
        if bina[j]=="1":
            score += p[j]*100*(j+1) + c[j]
            cnt+=p[j]
        else:
            other.append(j)
    if score<g:
        x = g-score
        k = other[-1]
        if (p[k]-1)*(k+1)*100<x:
            continue
        cnt += -(-x//(100*(k+1)))
    ans = min(ans,cnt)
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(100000)
inf = float('inf')

def dfs(h, s, D, G, pc):
    
    if h == D:
        tmp = 0
        p = 0
        ans = 0
        for i, c in enumerate(s):
            if c == '0':
                tmp = i
            else:
                ans += pc[i][0]
                p += (i+1) * 100 * pc[i][0] + pc[i][1]
        for i in range(pc[tmp][0]-1):
            if p < G:
                p += (tmp + 1) * 100
                ans += 1
        if p < G:
            return inf
        else:
            return ans
    tmp1 = dfs(h+1, s + '0', D, G, pc)
    tmp2 = dfs(h+1, s + '1', D, G, pc)
    return min(tmp1, tmp2)


D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
print(dfs(0, '', D, G, pc))

Solution (Python):
D, G = map(int, input().split())
PC = [list(map(int,input().split())) for i in range(D)]

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 1):
        continue
      else:
        ck.append(j)
    if ck == []:
      continue
    ckm = max(ck)
    for k in range(PC[ckm][0]):
      t += (ckm+1)*100
      c += 1
      if t >= G:
        l.append(c)
        break
      
print(min(l))

Solution (Python):
import numpy as np

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

PC = []
ans = 10 ** 9

for _ in range(D):
    PC.append(list(map(int, input().split())))

PC = np.array(PC)

for i in range(2 ** D):
    score = 0
    count = 0

    for j in range(D):
        if (i >> j) & 1:
            score += (j+1) * 100 * PC[j,0] + PC[j,1]
            count += PC[j,0]

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

    if score < G:
      for k in range(D):
            sub_score = 0
            sub_count = 0

            if ~(i >> k) & 1:
                for _ in range(PC[k,0] - 1):
                    sub_score += (k+1) * 100
                    sub_count += 1
                    if sub_score >= (G - score):
                        ans = min(ans, count+sub_count)
                        break

print(ans)

Solution (Python):
INF = float("inf")
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

D, G = nl()
problems = []
for i in range(D):
    p, c = nl()
    problems.append([p, c])

min_count = INF
import itertools
for p in itertools.product([False, True], repeat=D):
    point = 0
    count = 0
    max_false = -1
    for i in range(D):
        if not p[i]:
            max_false = i
        else:
            point += 100*(i+1)*problems[i][0] + problems[i][1]
            count += problems[i][0]
    if max_false == -1:
        if count < min_count:
            min_count = count
        continue
    if point + 100*(max_false+1)*(problems[max_false][0]-1) < G:
        continue
    left = max(G - point, 0)
    if left > 0:
        count += left // (100*(max_false+1))
        if left % (100*(max_false+1)) > 0:
            count += 1
    if count < min_count:
        min_count = count
print(min_count)

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

def f(g, i):
    
    if i == -1:
        return 10000000
    n = min(g // ((i + 1) * 100), point[i][0])
    s = n * (i + 1) * 100
    if n == point[i][0]:
        s += point[i][1]
    if s < g:
        n += f(g - s, i - 1)
    return min(n, f(g, i - 1))
print(f(g, d-1))

Solution (Python):
d, g = map(int, input().split())
test = []
point = []
for i in range(1, d+1):
    p, c = map(int, input().split())
    test.append([p, c])
    point.append([c + (p * i * 100), p])
inf = 10 ** 9
ans = inf
for i in range(2 ** d):
    b = bin(i)[2:]
    b = (d - len(b)) * "0" + b
    temp = 0
    calc = 0
    for j, bb in enumerate(b):
        if bb == "1":
            calc += point[j][0]
            temp += point[j][1]
    if calc >= g:
        ans = min(ans, temp)
    else:
        j_temp = b.rfind("0")
        if (g - calc) <= (test[j_temp][0] - 1) * (j_temp + 1) * 100:
            if (g - calc) % ((j_temp + 1) * 100) == 0:
                ans = min(ans, temp + ((g - calc) // ((j_temp + 1) * 100)))
            else:
                ans = min(ans, temp + ((g - calc) // ((j_temp + 1) * 100)) + 1)
print(ans)

Solution (Python):
d, g = map(int, input().split())
p = []
c = []
for i in range(d):
    e1, e2 = map(int, input().split())
    p.append(e1)
    c.append(e2)

ans = float('inf')
for i in range(2**d):
    total = 0
    num = 0
    for j in range(d):
        if (i >> j) & 1:
            total += c[-(j+1)] + p[-(j+1)] * (d - j) * 100
            num += p[-(j+1)]
    if total >= g:
        ans = min(ans, num)
    else:
        for j in range(d):
            if (i >> j) & 1:
                continue
            for k in range(p[-(j+1)]):
                if total >= g:
                    break
                total += (d-j) * 100
                num += 1
    ans = min(ans, num)

print(ans)

Solution (Python):




D,G = map(int,input().split())
P = [None]
C = [None]
full_score = [None]

for i in range(1,D+1):
  p,c = map(int,input().split())
  P.append(p)
  C.append(c)
  full_score.append(100*i*p + c)

INF = 10 ** 18
def F(i = 1, G = G):
  
  if G <= 0:
    return 0
  if i == D+1:
    return INF
  full_upper = sum(full_score[i+1:])
  
  x = F(i+1, G)
  
  y = P[i] + F(i+1, G - full_score[i])
  
  if 100 * i * P[i] + full_upper < G:
    z = INF
  else:
    z = sum(P[i+1:]) + max(0, (G - full_upper + 100*i - 1) // (100*i))
  return min(x,y,z)

answer = F()
print(answer)

Solution (Python):
D,G=map(int,input().split()) 
box=[] 
for i in range(D): 
    box.append(list(map(int,input().split()))) 
box.insert(0,[0,0]) 
info=[[0,0] for i in range(2**D)] 
info2=[[0]*(D+1) for i in range(2**D)] 

for i in range(2**D): 
    for j in range(1,D+1): 
        if (i>>(j-1))&1: 
            info[i][0]+=box[j][1]+j*100*box[j][0] 
            info[i][1]+=box[j][0] 
            info2[i][j]=box[j][0] 

for i in range(2**D):
    score=G-info[i][0]
    if score<=0:
        continue
    else:
        n=D
        while score>0:
            num=box[n][0]-info2[i][n] 
            
            
            if num!=0:
                for j in range(1,num+1):
                    score -= 100*n
                    info[i][1]+=1 
                    if j==num: 
                        score-=box[n][1]
                    if  score<=0:
                        break
            n-=1
            
l=len(info)
for i in range(l-1):
    min=info[i][1]
    m=info[i]
    t=i
    for j in range(i+1,l):
        if min>info[j][1]:
            min=info[j][1]
            t=j
    info[i]=info[t]
    info[t]=m
print(info[0][1])

Solution (Python):
D, G = map(int, input().split())
pclist = [list(map(int, input().split())) for x in range(D)]

n = len(pclist)

cnt = 0
for i in range(2**n):
  total = 0
  tmp = 0
  l = [0]*n
  for j in range(n):
    if (i >> j) & 1:
      total = total + 100*(j+1) * pclist[j][0] + pclist[j][1]
      tmp = tmp + pclist[j][0]
      l[j] = 1
  
  if total >= G:
    if cnt == 0 or cnt > tmp:
      cnt = tmp
  else:
    for k in range(n):
      if l[k] == 1:
        continue
      else:
        for g in range(1, pclist[k][0]):
          addP = 100 * (k+1) * g
          if G - total <= addP:
            if cnt == 0 or cnt > tmp + g:
              cnt = tmp + g
print(cnt)

Solution (Python):
D, G = map(int, input().split())
A = [tuple(map(int, input().split())) for _ in range(D)]

ans = 10**9
for i in range(2**D):
    pt = 0
    tmp = 0
    qmax = -1
    for j, k in enumerate('{0:0{1}b}'.format(i, D)[::-1]):
        if k == '1':
            pt += A[j][0] * (j+1)*100 + A[j][1]
            tmp += A[j][0]
        else:
            qmax = j
    if pt >= G:
        ans = min(ans, tmp)
    elif qmax >= 0:
        for l in range(A[qmax][0]-1):
            pt += 100*(qmax+1)
            tmp += 1
            if pt >= G:
                ans = min(ans, tmp)
                break
print(ans)

Solution (Python):
d,g=map(int, input().split())
p=[list(map(int, input().split())) for i in range(d)]
x=[]
for i in range(2**d):
    t=0
    u=0
    v=[]
    for k in range(d):
        v.append(k)
    for j in range(d):
        if ((i>>j)&1):
            t+=p[j][0]*100*(j+1)+p[j][1]
            u+=p[j][0]
            v[j]=0
    if t>=g:
        x.append(u)
    else:
        for l in range(p[max(v)][0]):
            if t+(max(v)+1)* 100*l<g<=t+(max(v)+1)* 100*(l+1):
                x.append(u+l+1)
print(min(x))

Solution (Python):
D,G = map(int,input().split())
G = G//100
pc = []

for i in range(D):
    p,c = map(int,input().split())
    pc.append((p,c//100))

ans = 1e9

for i in range(1<<D):
    points = 0
    cost = 0
    for j in range(D):
        jbit = ((i>>j)&1)
        
        points += jbit*( (j+1)*pc[j][0] + pc[j][1])
        cost += jbit * pc[j][0]
        
    if points >= G:
        ans = min(ans,cost)
        continue
    res = G - points
    for k in range(D-1,-1,-1):
        kbit = ((i>>k)&1)
        if not kbit:
            test = (res+k) // (k+1)
            
            if test <= pc[k][0]-1:
                res = 0
                cost += test
                ans = min(ans, cost)
            else:
                res -= (k+1)*(pc[k][0]-1)
                cost += pc[k][0]-1
    
print(ans)

Solution (Python):
d,g=map(int, input().split())
p=[list(map(int, input().split())) for i in range(d)]
x=[]
for i in range(2**d):
    t=0
    u=0
    v=[]
    for k in range(d):
        v.append(k)
    for j in range(d):
        if ((i>>j)&1):
            t+=p[j][0]*100*(j+1)+p[j][1]
            u+=p[j][0]
            v[j]=0
    if i==0:
        for j in range(d):
            for k in range(p[j][0]):
                if (j+1)*k<g<=(j+1)*(k+1):
                    x.append(j+1)
    if t>=g:
        x.append(u)
    else:
        for l in range(p[max(v)][0]):
            if t+(max(v)+1)* 100*l<g<=t+(max(v)+1)* 100*(l+1):
                x.append(u+l+1)
print(min(x))

Solution (Python):
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(D)]
ans = 100 ** 11
for i in range(2**D):
    score = 0
    count = 0
    bit = format(i, 'b').zfill(D)
    for j, b in enumerate(bit):
        if int(b):
            score += pc[j][0] * (100 * (j+1)) + pc[j][1]
            count += pc[j][0]
    if score < G:
      	for j in range(D-1, -1, -1):
            if not int(bit[j]):
                for k in range(pc[j][0]-1):
                    if score >= G:
                        break
                    score += 100 * (j+1)
                    count += 1
    
    if score >= G:
	    ans = min(ans, count)
    
print(ans)

Solution (Python):
from math import ceil
D,G = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(D)]
result = []
for i in  range(2**D):
    ans = 0
    cnt = 0
    num = format(i,"b").zfill(D)
    for j in range(D,0,-1):

        if num[j-1] == "1" :
            ans += para[j-1][0] *100*j + para[j-1][1]
            cnt += para[j-1][0]
            
        else : pass

    if ans >= G :
        result.append(cnt)
    else :
        for j in range(D,0,-1):
            if num[j-1] == "1" : pass
            else : 
                if G <= ans + (para[j-1][0]-1)*100*(j):
                    cnt += ceil((G-ans)/(100*(j)))
                    result.append(cnt) 
                
print(min(result))

Solution (Python):
D, G = map(int, input().split())
P, C = [-1] * D, [-1] * D
ans = float('inf')

for i in range(D):
    P[i], C[i] = map(int, input().split())


for i in range(2**D):
    comb = list(map(int, format(i, 'b').zfill(D)))
    count = 0
    score = 0
    not_max_indx = -1
    for j, buy_max in enumerate(comb):
        if buy_max:
            count += P[j]
            score += 100 * (j + 1) * P[j]
            score += C[j]
        else:
            not_max_indx = j

    if score >= G:
        ans = min(ans, count)
        continue

    
    if not_max_indx == -1:
        continue

    rest = G - score
    price = 100 * (not_max_indx + 1)
    count_tmp = rest // price if rest % price == 0 else (rest // price) + 1
    if count_tmp >= P[not_max_indx]:
        continue
    count += count_tmp
    ans = min(ans, count)
print(ans)

Solution (Python):
D,G=map(int,input().split())
pc=[list(map(int,input().split())) for _ in range(D)]
lis=[]
for i in range(2**D):
    a=("0"*D+bin(i)[2:])[-D:]
    ans=[0,0]
    for j in range(D):
        if a[j]=="1":
            ans[0]+=pc[j][0]
            ans[1]+=pc[j][1]+(j+1)*100*pc[j][0]
    if ans[1]<G:
        for j in range(D-1,-1,-1):
            if a[j]=="0":
                p=(G-ans[1]-1)//((j+1)*100)+1
                if p<pc[j][0]:
                    ans[0]+=p
                    ans[1]+=p*(j+1)*100
                else:
                    ans=[0,0]
                break
    lis.append(ans)
print(min([a[0] for a in lis if a[1]>=G]))

Solution (Python):
d,g=map(int,input().split())
p = [list(map(int,input().split())) for __ in range(d)]
ans_l = []
min_num = 1001

for i in range(2**d):
    num=0
    pt=0
    q=-1
    for j in range(d):
        if ((i>>j)&1):
            num+=p[j][0]
            pt+=p[j][0]*(j+1)*100+p[j][1]
        else:
            q=j
    if pt>=g:
        ans_l.append([num,pt])
    elif q > -1:
        for k in range(p[q][0]):
            num+=1
            pt+=(q+1)*100
            if pt>=g:
                ans_l.append([num, pt])
ans_l.sort()
print(ans_l[0][0])

Solution (Python):
def count_line(l, k):
    i, p, c = l
    total = 0
    count = 0
    for j in range(p):
        if total >= k:
            return count
        
        total += i * 100
        count += 1
        if j == p - 1:
            total += c
    return count


def choice_line(i, f, total_count, total_score):
    f_copy = f.copy()
    if i == D:
        if total_score == G:
            m_c.append(total_count)
        elif total_score < G:
            for l in L:
                j = l[0]
                k = G - total_score
                if not j in f and k <= t_L[j-1]:
                    m_c.append(total_count + count_line(l, k))
        return
        
    choice_line(i + 1, f_copy, total_count, total_score)
    f_copy.append(i + 1)
    choice_line(i + 1, f_copy, total_count + L[i][1], total_score + t_L[i])


D, G = map(int, input().split())
L = []
t_L = []
m_c = []

for i in range(1, D + 1):
    p, c = map(int, input().split())
    L.append([i, p, c])
    total = p * i * 100 + c
    t_L.append(total)
   
choice_line(0, [], 0, 0)
print(min(m_c))

Solution (Python):
import math

D, G = map(int, input().split())
G = G // 100

N = [0] * D
score = [0] * D

for i in range(D):
    N[i], b = map(int, input().split())
    score[i] = (i + 1)*N[i] + (b // 100)

ans = G

for d in range(1 << D):
    g = G
    c = 0
    idx = -1
    for i in range(D):
        if (d >> i) & 1:
            g -= score[i]
            c += N[i]
        else:
            idx = i
    if g > 0 and g - (idx + 1) * (N[idx] - 1) <= 0:
        tmp_c = math.ceil(g / (idx + 1))
        if tmp_c <= N[idx]:
            c += tmp_c
            g -= tmp_c * (idx + 1)
    
    if g <= 0:
        ans = min(ans, c)
print(ans)

Solution (Python):

D,G = map(int,input().split())
p_c_list=[]
for i in range(D):
    p,c = map(int,input().split())
    p_c_list.append([p,c])
answer_sum = 99999



for i in range(2**D):
    total = 0
    answer = 0
    moji = format(i,'b').zfill(D)
    
    
    for k in range(D):
        if int(moji[k]) == 1:
            total += (k+1)*100*p_c_list[k][0] + p_c_list[k][1]
            answer += p_c_list[k][0]
            
    if total >= G:
        if answer_sum >= answer:
            answer_sum = answer
    else:
        D_remain = moji.rfind('0')
        p_remain = int((G-total)/((D_remain+1)*100)+0.9999)
        if p_remain < p_c_list[D_remain][0]:
            answer += p_remain
            if answer_sum >= answer:
                answer_sum = answer
print(answer_sum)

Solution (Python):
import itertools as ite
import math
d,g=list(map(int,input().split()))
question=[]
for i in range(d):
    question.append(list(map(int,input().split())))

ans=1000
for pattarn in ite.product([0,1],repeat=d):
    score=0
    max_notsolve=-1
    solvednum=0
    for i in range(d):
        if pattarn[i]==1:
            score += question[i][0]*(i+1)*100+question[i][1]
            solvednum+=question[i][0]
        else:
            max_notsolve=max(max_notsolve,i)
    if score >= g:
        ans=min(ans,solvednum)
    else:
        if max_notsolve==-1:
            continue
        elif g-score > question[max_notsolve][0]*(max_notsolve+1)*100:
            continue
        else:
            solvednum+=math.ceil((g-score)/((max_notsolve+1)*100))
    ans=min(ans,solvednum)
print(ans)

Solution (Python):
from math import ceil
D,G=map(int,input().split())
pc=[]
ans=[]
for _ in range(D):
    pc.append(list(map(int,input().split())))

for n in range(2**D):
    X=format(n,'b').zfill(D)
    Sum=0
    solved=0
    for k in range(D):
        if X[k]=="1":
             Sum+=100*(k+1)*pc[k][0]+pc[k][1]
             solved+=pc[k][0]
    if Sum>=G:
        ans.append(solved)
    else:
        for i in range(D):
            if X[D-i-1]=="1":
                pass
            else:
                if Sum+(pc[D-i-1][0]-1)*100*(D-i)<G:
                    pass
                else:
                    ans.append(solved+ceil((G-Sum)/(100*(D-i))))

print(min(ans))

Solution (Python):
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 = float('inf')

for i in range(1<<D):
    tmp_score = 0
    cnt = 0
    max_value = -1
    for j in range(D):
        if (i >> j) & 1 == 1:
            tmp_score += 100 * (j + 1) * p[j] + c[j]
            cnt += p[j]
        else:
            max_value = j

    if tmp_score < G:
        for k in range(1,p[max_value]):
            tmp_score += 100 * (max_value + 1)
            cnt += 1
            if tmp_score >= G:
                break
    
    if tmp_score >= G:
        if ans > cnt:
            ans = cnt

print(ans)

Solution (Python):

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


ans_num = 1000000000
for i in range(2**d):
  bit = format(i,'0'+str(d)+'b')
  score = 0
  ans = 0
  for j in range(d):
    if bit[j] == '1':
      score += questions[j][1] + 100*questions[j][0]*(j+1)
      ans += questions[j][0]
  if score >= g:
    if ans < ans_num:
      ans_num = ans
  else:
    for j in range(d-1, -1, -1):
      if bit[j] == '0':
        p, c = questions[j]
        for k in range(p):
          score += 100 * (j + 1)
          ans += 1
          if score >= g:
            break
        else:
          continue
        break
    if score >= g and ans < ans_num:
        ans_num = ans



print(ans_num)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

import pdb

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    D, G = LI()
    p, c = [], []
    for _ in range(D):
        _p, _c = LI()
        p.append(_p)
        c.append(_c)

    min_num_solved = inf
    
    for i in range(1 << D):
        point = 0
        num_solved = 0
        unsolved_max = 0
        for j in range(D):
            solve_all = (i >> j) & 1
            if solve_all:
                point += (j+1) * 100 * p[j] + c[j]        
                num_solved += p[j]
            else:
                unsolved_max = max(unsolved_max, j)
         
        if point < G:
            residue = G - point
            p_num = p[unsolved_max]
            while residue > 0 and p_num > 0:
                residue -= (unsolved_max+1) * 100 
                p_num -= 1
                num_solved += 1
            if residue > 0:
                continue
        min_num_solved = min(min_num_solved, num_solved)
    print(min_num_solved)    



main()