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=list(map(int,input().split()))
li=[]
P=[]
Bonus=[]
for i in range(D):
   p,c=list(map(int,input().split()))
   P.append(p)
   Bonus.append(c)

for i in range(1<<D):
   E=[d for d in range(D)]
   output=[]
   for j in range(D):
      if((i>>j)&1)==1:
         output.append(j)
   Not_output=list(set(E)-set(output))
   Not_output.sort(reverse=True)

   score=0
   solve_problems=0
   
   for i in output:
      score+=P[i]*100*(i+1)
      score+=Bonus[i]
      solve_problems+=P[i]
   
   for i in Not_output:
      if score>=G:
         break

      elif score+(P[i]-1)*100*(i+1)<G:
         score+=(P[i]-1)*100*(i+1)
         solve_problems+=(P[i]-1)
      else:
         while(True):
            score+=100*(i+1)
            solve_problems+=1
            if(score>=G):
               break

   if score>=G:
      li.append(solve_problems)
print(min(li))

Solution (Python):
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]

ans = float("inf")
for b in range(1<<d):
    m = set(range(1, d+1))
    c = 0
    s = 0
    for i in range(d):
        if b & (1<<i):
            c += pc[i][0]
            s += 100*(i+1)*pc[i][0] + pc[i][1]
            m.discard(i+1)
    if s >= g:
        ans = min(ans, c)
        continue
    while s < g and m:
        p = pc[max(m)-1][0]
        for _ in range(p):
            c += 1
            s += 100*max(m)
            if s >= g:
                break
        m.discard(max(m))
    ans = min(ans, c)
print(ans)

Solution (Python):
D, G = map(int, input().split())
arr = []
n = 0
for i in range(D):
    arr.append([int(c) for c in input().split()])
    n += arr[i][0]

ans = 1e9

for bit in range(1 << D):
    sum = 0
    num = 0
    rest_max = -1
    for i in range(D):
        if bit & 1 << i:
            sum += 100 * (i + 1) * arr[i][0] + arr[i][1]
            num += arr[i][0]
        else:
            rest_max = i

    if sum < G:
        p = 100 * (rest_max + 1)
        need = (G - sum + p - 1) // p
        if need >= arr[rest_max][0]:
            continue
        num += need
    ans = min(ans, num)

print(ans)

Solution (Python):
D,G=map(int,input().split())
G=G//100
p=[]
c=[]
for i in range(D):
    pp,cc=map(int,input().split())
    p.append(pp)
    c.append(cc//100)

ans=float("INF")
for i in range(1<<D):
    cnt=0
    toku=0
    for j in range(D):
        if 1&i>>j:
            toku+=p[j]*(j+1)+c[j]
            cnt+=p[j]
    
    if toku>=G:
        ans=min(ans,cnt)
        
    else:
        for j in range(D-1,-1,-1):
            if 1&i>>j==False:
                for k in range(p[j]-1):
                    toku+=j+1
                    cnt+=1
                    if toku>=G:
                        ans=min(ans,cnt)
print(ans)

Solution (Python):
D,G=map(int,input().split())
G=G//100
p=[]
c=[]
for i in range(D):
    pp,cc=map(int,input().split())
    p.append(pp)
    c.append(cc//100)

ans=float("INF")
for i in range(1<<D):
    cnt=0
    toku=0
    for j in range(D):
        if 1&i>>j:
            toku+=p[j]*(j+1)+c[j]
            cnt+=p[j]
    
    if toku>=G:
        ans=min(ans,cnt)
        
    else:
        for j in range(D-1,-1,-1):
            if 1&i>>j:
                continue
            for k in range(p[j]-1):
                toku+=j+1
                cnt+=1
                if toku>=G:
                    ans=min(ans,cnt)
print(ans)

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

d,g = LI()
pc = [LI() for _ in range(d)]
ans = inf
for i in range(2**d):
    b = [0]*d
    for j in range(d):
        if (i >> j) & 1:
            b[j] = 1
    tmp = 0
    cnt = 0
    for j in range(d):
        if b[j]:
            tmp += pc[j][0]*(j+1)*100 + pc[j][1]
            cnt += pc[j][0]
    if tmp >= g:
        ans = min(ans,cnt)
        continue
    tmp2 = 0
    for j in range(d):
        if not b[j]:
            tmp2 = max(tmp2,j)
    x,y = divmod((g-tmp),(tmp2+1)*100)
    if x > pc[tmp2][0]:
        continue
    cnt += x + (y != 0)
    ans = min(ans,cnt)
print(ans)

Solution (Python):
import itertools
import math


D, G = map(int, input().split())
basic = []
bonus = {}
p_c_list = []
for i in range(1, D+1):
    p, c = map(int, input().split())
    p_c_list.append([p, c])


min_count = float("inf")
for ans in itertools.product([0, 1], repeat=D):
    point = 0
    count = 0
    for idx, a in enumerate(ans):
        point += (p_c_list[idx][0]*(100*(idx + 1)) + p_c_list[idx][1])*a
        count += p_c_list[idx][0]*a

    if point < G:
        for idx, a in enumerate(reversed(ans)):
            if a == 0:
                plus_count = math.ceil((G - point) / ((D-idx)*100))
                
                if plus_count >=  p_c_list[D-idx-1][0]:
                    count = float("inf")
                    point = 0
                else:
                    count += plus_count
                    point = G
                break
    
    if point >= G:
        min_count = min(min_count, count)

print(min_count)

Solution (Python):
import math

d,g = map(int,input().split())

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

for bit in range(1<<d):
  sum = 0
  count = 0
  f = set(range(1,d+1))
  
  for i in range(d):
    if bit & (1<<i):
      sum += (i+1)*l[i][0]*100 + l[i][1]
      count += l[i][0]
      f.discard(i+1)
      
  if sum < g:
    x = max(f)
    n = min(l[x-1][0], math.ceil((g-sum)/(x*100)))
    sum += n*100*x
    count += n
    
  if sum >= g:
    ans = min(ans,count)
    
print(ans)

Solution (Python):
D,G = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(D)]
mincount = 1000
for i in range(2**D):
	Tcount = 0
	Tscore = 0
	for j in range(D):
		if((i>>j)&1):
			Tscore += l[j][0]*(j+1)*100 + l[j][1]
			Tcount += l[j][0]
	if Tscore >= G:
		if Tcount <= mincount:
			mincount = Tcount
	else:
		for j in range(D):
			AFcount = 0
			if(((~i)>>(D-j-1))&1):
				while Tscore < G and AFcount<=l[D-j-1][0]:
					Tscore += (D-j)*100
					Tcount += 1
					AFcount += 1
			if Tscore >= G:
				if Tcount <= mincount:
					mincount = Tcount
				break
print(mincount)

Solution (Python):

def calc(i):
    sum_problems = 0
    for j in range(D):
        if i & (1 << j):
            sum_problems += p[j]
    num_problems[i] = sum_problems

nums=list(map(int,input().split()))
D = nums[0]
G = nums[1]
p = []
c = []

num_problems = [1000] * (1 << D)

for i in range(D):
    nums=list(map(int,input().split()))
    p.append(nums[0])
    c.append(nums[1])


for i in range(1 << D):
    sum_tmp = 0
    
    for j in range(D):
        if i & (1 << j):
            sum_tmp += p[j] * (j + 1) * 100 + c[j]
    
    if sum_tmp >= G:
        calc(i)
        
    else:
        j = D-1
        sum_res = 0
        while j > -1:
            if not (i & (1 << j)):
                for k in range(p[j]):
                    sum_tmp += 100 * (j + 1)
                    sum_res += 1
                    if sum_tmp >= G:
                        break
            j -= 1
            if sum_tmp >= G:
                calc(i)
                num_problems[i] += sum_res
                break
            
print(min(num_problems))

Solution (Python):

import sys
from math import ceil

def solve(D: int, G: int, p: "List[int]", c: "List[int]"):
    answer = 1000
    
    for i in range(2**D):
        tmpans = 0
        score = 0
        com_problem = []

        for j in range(D):
            if i & 1<<j:
                score += p[j]*100*(j+1)+c[j]
                tmpans += p[j]
                com_problem.append(j)
        if score >= G:
            answer = min(answer,tmpans)
        else:

            for probrem_index in range(D-1,-1,-1):
                if probrem_index in com_problem:
                    continue

                if (G-score)>100*(probrem_index+1)*(p[probrem_index]-1):
                    break
                else:
                    tmpans += ceil((G-score) / (100*(probrem_index+1)))
                    answer = min(answer,tmpans)
                    break

    print(answer)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    D = int(next(tokens))  
    G = int(next(tokens))  
    p = [int()] * (D)  
    c = [int()] * (D)  
    for i in range(D):
        p[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(D, G, p, c)

if __name__ == '__main__':
    main()

Solution (Python):
D, G = map(int, input().split())
table = []
for i in range(D):
    p,c = map(int, input().split())
    table.append((i+1,p,c))
ans = 10**3
for i in range(1<<D):
    count = 0
    score = 0
    remain = []
    for j in range(D):
        d,p,c = table[j]
        if i & (1<<j):
            score += 100*(d)*p+c
            count += p
        else:
            remain.append((d,p,c))
    if score < G:
        remain.sort(reverse=True)
        d,p,c = remain[0]
        while score < G and p > 0:
            score += 100*d
            count += 1
            p -= 1
    if score >= G:
        ans = min(ans,count)
print(ans)

Solution (Python):
D, G = map(int, input().split())
p = [0 for _ in range(D)]
c = [0 for _ in range(D)]
for i in range(D):
    p[i], c[i] = map(int, input().split())

score_sum = [0 for _ in range(D)]
for i in range(D):
    score_sum[i] = (i + 1) * 100 * p[i] + c[i]


def calc(i, g):
    if g <= 0:
        return 0
    if i == D:
        return 10 ** 7
    
    x = calc(i + 1, g)
    y = p[i] + calc(i + 1, g - score_sum[i])
    upper_sum = sum(score_sum[i + 1:])
    if 100 * (i + 1) * p[i] + upper_sum < g:
        z = 10 ** 7
    else:
        z = sum(p[i + 1:]) + max(0, (g - upper_sum + 100 * (i + 1) - 1) // (100 * (i + 1)))
    return min(x, y, z)


def solve():
    ans = calc(0, G)
    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
D, G = map(int, input().split())
table = []
for i in range(D):
    p,c = map(int, input().split())
    table.append((i+1,p,c))

ans = 10**3
for i in range(1<<D):
    score = 0
    count = 0
    remain = []
    for j in range(D):
        a,p,c = table[j]
        if i & (1<<j):
            score += a*100*p+c
            count += p
        else:
            remain.append((a,p,c))
    if score >= G:
        ans = min(count,ans)
    else:
        remain.sort(reverse=True)
        a,p,c = remain[0]
        for k in range(p):
            score += a*100
            count += 1
            if score >= G:
                ans = min(count,ans)
print(ans)

Solution (Python):
import math

D, G = [int(x) for x in input().split()]
P = [[int(x) for x in input().split()] for i in range(D)]

min_ = 1e+8
for bit in range(2**D):
  score = 0
  n_solved = 0
  rest = -1
  for i in range(D):
    if bit >> i & 1: 
      score += (i + 1) * 100 * P[i][0] + P[i][1]
      n_solved += P[i][0]
    else:
      rest = i
  if G > score:
    s1 = 100 * (rest + 1)
    need = (G - score + s1 - 1) // s1
    if need >= P[rest][0]:
      continue
    n_solved += need
  min_ = min(min_, n_solved)
print(min_)

Solution (Python):

def dfs(i, total, S, remain):
    global ans
    if i == D:
        if S < G:
           use = max(remain)
           N = min(L[use-1][0], -(-(G-S)//(100*use)))
           S += 100 * N * use
           total += N
           
        if S >= G:
           ans = min(ans, total)
    else:
        dfs(i+1, total, S, remain)
        dfs(i+1, total + L[i][0], S + 100 * (i+1) * L[i][0] + L[i][1], remain - {i+1})

D, G = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(D)]
ans = 10 ** 9

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

print(ans)

Solution (Python):

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) // (use * 100)))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count)
    else:
        
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + 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)

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

def dfs(i,g):
    if i ==0:
        return 1e9
    m =min(g//(i*100),PC[i][0])
    s=100*i*m
    if m ==PC[i][0]:
        s+=PC[i][1]
    if s<g:
        m+=dfs(i-1,g-s)
    return min(m, dfs(i-1,g))
print(dfs(D,G))

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

def dfs(i, g):
  if i == 0:
    return 1e9
  m = min(g // (i * 100), PC[i][0])
  
  s = 100 * i * m
  
  if m == PC[i][0]:
    s += PC[i][1]
  if s < g:
    m += dfs(i - 1, g - s)
  return min(m, dfs(i - 1, g))
print(dfs(D, G))

Solution (Python):
D, G = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(D)]
plst = [0] * D
ans = 0
for i in range(D):
    ans += p[i][0]

def dfs(n):
    global ans
    if n == D:
        cnt = 0
        total = 0
        for i in range(D):
            if plst[i] == 0:
                continue
            elif plst[i] == 1:
                cnt += p[i][0]
                total += (100 * (i + 1) * p[i][0]) + p[i][1]
        if total < G:
            for j in range(D - 1, -1, -1):
                if plst[j] == 0:
                    for k in range(p[j][0] - 1):
                        total += (100 * (j + 1))
                        cnt += 1
                        if total >= G:
                            break
                    break
            if total >= G:
                ans = min(ans, cnt)
        else:
            ans = min(ans, cnt)
        return

    for i in range(2):
        plst[n] = i
        dfs(n + 1)
    return

dfs(0)
print(ans)

Solution (Python):
D, G = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(D)]
plst = [0] * D
ans = 0
for i in range(D):
    ans += p[i][0]

def dfs(n):
    global ans
    if n == D:
        cnt = 0
        total = 0
        for i in range(D):
            if plst[i] == 0:
                continue
            elif plst[i] == 1:
                cnt += p[i][0]
                total += (100 * (i + 1) * p[i][0]) + p[i][1]
        for j in range(D):
            if plst[j] == 2:
                for k in range(p[j][0] - 1):
                    total += (100 * (j + 1))
                    cnt += 1
                    if total >= G:
                        break
        if total >= G:
            ans = min(ans, cnt)
        return

    for i in range(3):
        plst[n] = i
        dfs(n + 1)
    return

dfs(0)
print(ans)

Solution (Python):
D, G = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(D)]
plst = [0] * D
ans = 0
for i in range(D):
    ans += p[i][0]

def dfs(n):
    global ans
    if n == D:
        cnt = 0
        total = 0
        for i in range(D):
            if plst[i] == 0:
                continue
            elif plst[i] == 1:
                cnt += p[i][0]
                total += (100 * (i + 1) * p[i][0]) + p[i][1]
        for j in range(D):
            if plst[j] == 2:
                for k in range(p[j][0] - 1):
                    total += (100 * (j + 1))
                    cnt += 1
                    if total >= G:
                        ans = min(ans, cnt)
        if total >= G:
            ans = min(ans, cnt)
        return

    for i in range(3):
        plst[n] = i
        dfs(n + 1)
    return

dfs(0)
print(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(float, input().split())
    
ans = 0

    
for i in range(2**d):
    score = 0
    count = 0
    for j in range(d):
        if (i >> j) & 1:
            score += p[j]*100*(j+1) + c[j]
            count += p[j]
            
    if g > score:
        for k in range(d-1,-1,-1):
            if (i >> k) & 1 == 0 :
                if (g - score) <= p[k]*100*(k+1):
                    count += (g - score -1)//((k+1)*100) +1
                    break
                else:
                    count = 1145141919
                    break
                    
    if ans == 0 or count<ans:
        ans = count

print(int(ans))

Solution (Python):
D,G = map(int,input().split())
pc = []
for i in range(D):
    p,c = map(int,input().split())
    pc.append([i+1,p,c])
pc.sort(reverse = True)
ansc = []
for i in range(2**D):
    count = 0
    sumb = 0
    pc2 = []
    for j in range(D):
        if (i >> j) & 1 == 1:
            sumb += 100*pc[j][0]*pc[j][1] + pc[j][2]
            count += pc[j][1]
        else:
            pc2.append(pc[j])
    pc2 = sorted(pc2,reverse = True)
    c2 = 0
    if sumb < G:
        c2 = (G - sumb)//(100*pc2[0][0])
        if (G - sumb)%(100*pc2[0][0]) != 0:
            c2 += 1
        if c2 >= pc2[0][1]:
            count = 10**9
        else:
            count += c2
    ansc.append(count)
print(min(ansc))

Solution (Python):
D,G = map(int,input().split())
pc = []
for i in range(D):
    p,c = map(int,input().split())
    pc.append([i+1,p,c])
pc.sort(reverse = True)
ansc = []
for i in range(2**D):
    count = 0
    sumb = 0
    pc2 = []
    for j in range(D):
        if (i >> j) & 1 == 1:
            sumb += 100*pc[j][0]*pc[j][1] + pc[j][2]
            count += pc[j][1]
        else:
            pc2.append(pc[j])
    pc2 = sorted(pc2,reverse = True)
    c2 = 0
    while sumb < G:
        sumb += 100*pc2[0][0]
        count += 1
        c2 += 1
        if c2 == pc2[0][1]:
            count = 10**9
            break
    ansc.append(count)
print(min(ansc))

Solution (Python):
import math
d, g = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(d)]
for i in range(d):
    lst[i].append((i+1) * 100)
    lst[i].append((i+1) * 100 * lst[i][0] + lst[i][1])

def make_bit(n, d):
    bit = [0] * d
    for i in range(d):
        bit[i] += n % 2
        n //= 2
    return bit

min_count = 10 ** 9 + 7
for n in range(2 ** d):
    bit = make_bit(n, d)
    
    now = 0
    count = 0
    for i in range(d):
        if bit[i] == 1:
            now += lst[i][3]
            count += lst[i][0]
    if now >= g:
        min_count = min(min_count, count)
    else:
        for i in range(d-1, -1, -1):
            if bit[i] == 0:
                c = math.ceil((g - now) / lst[i][2])
                if c < lst[i][0]:
                    count += c
                    min_count = min(min_count, count)
                break
print(min_count)

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

ans = 0

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

    for j in range(D):
        if(i>>j)&1: 
            point += X[j][0]*(j+1)*100 + X[j][1]
            count += X[j][0]
    
    if G > point:
        for k in range(D-1,-1,-1):
            if(i>>k)&1 == 0:
                if (G - point) <= X[k][0]*(k+1)*100:
                    count += (G - point - 1) // ((k+1)*100)  + 1
                    break
                else:
                    count = 10**5 
                    break
    
    if ans == 0 or count < ans:
        ans = count

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
d, g = map(int, input().split())
pc = []
for i in range(d):
    p, c = map(int, input().split())
    pc.append([p, c // 100])
g = g // 100
ans = 1000
for i in range(2 ** d):
    rem = g
    cost = 0
    for j in reversed(range(d)):
        if ((i >> j) & 1):
            p, c = pc[j]
            rem -= c + p * (j + 1)
            cost += p
    for j in reversed(range(d)):
        if  not ((i >> j) & 1):
            p, c = pc[j]
            p -= 1
            if rem >= p * (j + 1):
                rem -= p * (j + 1)
                cost += p
            else:
                while rem > 0:
                    rem -= j +1
                    cost += 1
                break
    if rem <= 0:
        ans = min(cost, ans)
print(ans)

Solution (Python):



def solve(*args: str) -> str:
    d, g = map(int, args[0].split())
    pc = [tuple(map(int, a.split())) for a in args[1:]]
    inf = 10**5

    count = inf
    for b in range(2**d):
        score, cnt = 0, 0

        for i in range(d):
            p, c = pc[i]
            if b >> i & 1:
                score += p*100*(i+1)+c
                cnt += p

        if score < g:
            for i in reversed(range(d)):
                if b >> i & 1:
                    continue
                else:
                    p, c = pc[i]
                    j = 0
                    while score < g and j < p:
                        score += 100*(i+1)
                        cnt += 1
                        j += 1

                    if j == p:
                        score += c

        count = min(count, cnt)

    return str(count)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

D, G = MAP()
G //= 100
DC = []
MAX = 0
for i in range(D):
    d, c = MAP()
    c //= 100
    MAX += d
    DC.append((d, c))


dp = list2d(D+1, MAX+1, 0)
for i in range(D):
    d, c = DC[i]
    for j in range(MAX+1):
        for k in range(d+1):
            if j+k > MAX:
                break
            if k == d:
                
                dp[i+1][j+k] = max(dp[i+1][j+k], dp[i][j] + (i+1) * k + c)
            else:
                
                dp[i+1][j+k] = max(dp[i+1][j+k], dp[i][j] + (i+1) * k)


for j in range(MAX+1):
    if dp[D][j] >= G:
        print(j)
        break

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

D, G = MAP()
G //= 100
DC = []
MAX = 0
for i in range(D):
    d, c = MAP()
    c //= 100
    MAX += d
    DC.append((d, c))


dp = list2d(D+1, MAX+1, 0)
for i in range(D):
    d, c = DC[i]
    for j in range(MAX+1):
        for k in range(d+1):
            if j+k > MAX:
                break
            if k == d:
                
                dp[i+1][j+k] = max(dp[i+1][j+k], dp[i][j] + (i+1) * k + c)
            else:
                
                dp[i+1][j+k] = max(dp[i+1][j+k], dp[i][j] + (i+1) * k)


for j in range(MAX+1):
    if dp[D][j] >= G:
        print(j)
        break

Solution (Python):
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)

Solution (Python):
D,G = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(D)]
ans = 0
 
for i in range(2**D):
	point = 0
	count = 0
	for j in range(D):
		if (i>>j)&1:
			point += 100*(j+1)*X[j][0]+X[j][1]
			count += X[j][0]
	if 	G > point:
		for k in range(D)[::-1]:
			if (i>>k)&1==0:
				if (G-point) <= 100*(k+1)*(X[k][0]):
					count += (G-point-1) // (100*(k+1)) +1
					break
				else:
					count = 10**5
					break
	if ans == 0 or count < ans:
		ans = count
 
print(ans)

Solution (Python):
d, g = map(int, input().split())

problems = []
for i in range(1, d + 1):
    num, bonus = map(int, input().split())
    point = i * 100
    problems.append([point, num, bonus])

ans = []
for mask in range(2 ** d):
    score = 0
    count = 0
    target = 0
    for bit in range(d):
        if (mask >> bit) & 1:
            point, num, bonus = problems[bit]
            score += (point * num) + bonus
            count += num
        else:
            target = bit
            
    if score >= g:
        ans.append(count)
    else:
        point, num, bonus = problems[target]
        delta = g - score
        add = delta // point + bool(delta % point)
        if add < num:
            ans.append(count + add)
        else:
            continue

print(min(ans))

Solution (Python):
D,G = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(D)]
ans = 0

for i in range(2**D):
	point = 0
	count = 0
	for j in range(D):
		if (i>>j)&1:
			point += 100*(j+1)*X[j][0]+X[j][1]
			count += X[j][0]
	if 	G > point:
		for k in range(D)[::-1]:
			if (i>>k)&1==0:
				if (G-point) <= 100*(k+1)*(X[k][0]-1):
					count += -((-(G-point)) // (100*(k+1)))
					break
				else:
					count = 10**5
					break
	if ans == 0 or count < ans:
		ans = count

print(ans)

Solution (Python):
d, goal = map(int, input().split())

problems = []
for i in range(1, d+1):
    num, bonus = map(int, input().split())
    point = i * 100
    problems.append([point, num, bonus])


ans = []
for mask in range(2**d):
    score = 0
    count = 0
    target = 0
    for bit in range(d):
        if (mask >> bit) & 1:  
            point, num, bonus = problems[bit]
            score += (point*num) + bonus
            count += num
        else:
            target = bit

    if score >= goal:
        ans.append(count)
    else:
        point, num, bonus = problems[target]
        delta = goal - score
        add = delta//point + bool(delta%point)
        if add < num:
            ans.append(count+add)
        else:
            continue

print(min(ans))

Solution (Python):
d,g= map(int, input().split())
x = [list(map(int, input().split())) for i in range(d)]
ans2=float('inf')

for i in range(2**d):
    v=[0]*d
    ans=0
    ans1=0
    for j in range(d):
        if (i>>j)&1==1:
            ans+=(x[j][0]*100*(j+1))+x[j][1]
            ans1+=x[j][0]
            v[j]=1


    if ans<g:
        for k in range(d):
            if v[d-k-1]==0:
                if g-ans<=(x[d-k-1][0]-1)*100*(d-k):
                    w=-(-(g-ans)//(100*(d-k)))

                    ans2=min(ans2,ans1+w)
                else:
                    break
    else:
        ans2=min(ans2,ans1)
print(ans2)

Solution (Python):
D, G = map(int, input().split())
p = [0] * 11
c = [0] * 11

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


ans = 1e9
for mask in range(1<<D):
    s = 0
    num = 0
    rest_mask = -1
    for i in range(D):
        if mask >> i & 1:
            s += 100 * (i+1) * p[i] + c[i]
            num += p[i]
        else:
            rest_mask = i
    if s < G:
        s1 = 100 * (rest_mask + 1)
        need = (G - s + s1 -1) // s1
        if need >= p[rest_mask]:
            continue
        num += need
    ans = min(ans, num)

print(ans)

Solution (Python):
import math

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 = 1e9
for mask in range(1 << D):
  s, num, rest_max = 0, 0, -1
  for i in range(D):
    if mask >> i & 1:
      s += 100 * (i+1) * p[i] + c[i]
      num += p[i] 
    else:
      rest_max = i 

  if s < G: 
    s1 = 100 * (rest_max + 1)
    need = math.ceil((G - s) / s1)     
    if need >= p[rest_max]:
      continue 
    num += need
  
  ans = min(ans, num)
    
print(ans)