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 = [int(i) for i in input().split()]
p = [0] + [[int(i) for i in input().split()] for _ in range(d)]

def recursive(d, g):
    if d == 0:
        return 10 ** 9
    n = min(g // (100 * d), p[d][0])
    t = 100 * d * n
    
    if n == p[d][0]:
        t += p[d][1]
    
    if t < g:
        n += recursive(d-1, g-t)
    return min(n, recursive(d-1, g))

def bit(d, g):
    ans = 10 ** 9
    for i in range(2 ** d):
        b = '-' + format(i, '0{}b'.format(d))
        last_zero_index = 0
        tmp_ans = 0
        total_score = 0
        for j in range(1, d+1):
            if b[j] == '1':
                total_score += p[j][0] * (100 * (j))
                total_score += p[j][1]
                tmp_ans += p[j][0]
            else:
                last_zero_index = j
        if total_score < g:
            diff = g - total_score
            q = diff // (100 * last_zero_index)
            r = diff % (100 * last_zero_index)
            if r != 0:
                q += 1
            if q > p[last_zero_index][0]:
                continue
            else:
                tmp_ans += q
        ans = min(ans, tmp_ans)
    return ans

solve = recursive

print(solve(d, g))

Solution (Python):
d, g = [int(i) for i in input().split()]
p = [0] + [[int(i) for i in input().split()] for _ in range(d)]

def recursive(d, g):
    if d == 0:
        return 10 ** 9
    n = min(g // (100 * d), p[d][0])
    t = 100 * d * n
    
    if n == p[d][0]:
        t += p[d][1]
    
    if t < g:
        n += recursive(d-1, g-t)
    return min(n, recursive(d-1, g))

def bit(d, g):
    ans = 10 ** 9
    for i in range(2 ** d):
        b = '-' + format(i, '0{}b'.format(d))
        last_zero_index = 0
        tmp_ans = 0
        total_score = 0
        for j in range(1, d+1):
            if b[j] == '1':
                total_score += p[j][0] * (100 * (j))
                total_score += p[j][1]
                tmp_ans += p[j][0]
            else:
                last_zero_index = j
        if total_score < g:
            diff = g - total_score
            q = diff // (100 * last_zero_index)
            r = diff % (100 * last_zero_index)
            if r != 0:
                q += 1
            if q > p[last_zero_index][0]:
                continue
            else:
                tmp_ans += q
        ans = min(ans, tmp_ans)
    return ans


solve = bit
print(solve(d, g))

Solution (Python):
d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for i in range(d)]
ans = float("INF")

for i in range(2**d):
  num = 0
  score = 0
  for j in range(d):
    if i&(1<<j):
      num += pc[j][0]
      score += (j+1)*100*pc[j][0] + pc[j][1]
  j = d-1
  while score<g and j>=0:
    if i&(1<<j) == 0:
      rem = g-score
      tmax = (j+1)*100*pc[j][0]
      if rem>=tmax:
        num += pc[j][0]
        score += tmax
      else:
        for k in range(1, pc[j][0]):
          num += 1
          score += (j+1)*100
          if score>=g:
            break
    j -= 1
  if score>=g:
    ans = min(ans, num)
print(ans)

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

def solve(goal, d):
  if d == 0:
    return 10**9
  n = min(goal//(100*d), pc[d][0])
  t = n * d * 100
  if n == pc[d][0]:
    t += pc[d][1]
  if t < goal:
    n += solve(goal-t, d-1)
  return min(n, solve(goal,d-1))

print(solve(goal,d))

Solution (Python):
D,G = map(int,input().split())
p,c = [],[]
for i in range(D):
  tmp0 ,tmp1 = map(int,input().split())
  p.append(tmp0)
  c.append(tmp1)
  
min_ans = float('inf')

for bit in range(1<<D):
  dont_solved = [i for i in range(D)]
  ans = 0
  sum_point = 0
  for i in range(D):
    if bit & 1<<i:
      ans += p[i]
      sum_point += (i+1)*100*p[i]+c[i]
      dont_solved.remove(i)
  if sum_point < G:
    for i in  dont_solved[::-1]:
      for j in range(p[i]):
        ans += 1
        sum_point += (i+1)*100
        if sum_point >= G:
          break
      else:
        continue
      break
  
  if ans <= min_ans:
    min_ans = ans
print(min_ans)

Solution (Python):
import copy
n, m = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
b = [((i+1)*100*name[0] + name[1]) for i, name in enumerate(a)]

ans = []
pat = []
for i in range(2**n):
    pat_c = []
    sum1 = 0
    count1 = 0
    for j in range(n):
        t = (i // 2 ** j) % 2
        pat_c.append(t)
        if  t == 1:
            sum1 += b[j]
            count1 += a[j][0]

    if sum1 < m and 0 in pat_c:
        tyuu1_index = len(pat_c) - pat_c[::-1].index(0) - 1
        tyuu1 = a[tyuu1_index]
        if (tyuu1_index + 1)*100*tyuu1[0] < (m - sum1):
            continue
        else:
            count1 += (m-sum1) // ((tyuu1_index + 1)*100)
            if (m-sum1) % ((tyuu1_index + 1)*100) != 0:
                count1 += 1
        ans.append(count1)
        pat.append(pat_c)
    else:
        ans.append(count1)
        pat.append(pat_c)

print(min(ans))

Solution (Python):
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    D,G = map(int, input().split())
    qs = [list(map(int, input().split())) for _ in range(D)]
    q_totals = [100*(i+1)*q[0]+q[1] for i,q in enumerate(qs)]

    ans = float('inf')
    for bit in range(1<<D):
        total = 0
        target_qs = []
        another_q_idx = 0
        for i in range(D):
            if bit & 1<<i:
                total += q_totals[i]
                target_qs.append(qs[i])
            else:
                another_q_idx = i
        tmp_ans = sum([q[0] for q in target_qs])

        if total < G and G <= total + 100*(another_q_idx+1)*(qs[another_q_idx][0]-1):
            tmp_ans += ceil((G-total)/(100*(another_q_idx+1)))
        elif total + 100*(another_q_idx+1)*(qs[another_q_idx][0]-1) < G:
            tmp_ans = float('inf')

        ans = min(ans, tmp_ans)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def resolve():
    d, g = map(int, input().split())
    lp, lc = [], []
    while True:
        try:
            p, c = map(int, input().split())
            lp.append(p)
            lc.append(c)
        except EOFError:
            break

    num = sum(lp)
    for i in range(2**d):
        cnt = 0
        scr = 0
        lcn = [0]*d
        for j in range(d):
            if (i // 2**j)%2 == 1:
                cnt += lp[j]
                scr += 100*(j+1)*lp[j]+lc[j]
                lcn[j] += 1
        for j in range(d-1, -1, -1):
            if cnt < num and scr >= g:
                num = cnt
                break
            if lcn[j] == 0:
                for k in range(lp[j]):
                    cnt += 1
                    scr += 100*(j+1)
                    if cnt < num and scr >= g:
                        num = cnt
                        break
                break
    print(num)
resolve()

Solution (Python):
from itertools import product
 
D, G = map(int, input().split())
score = []
for i in range(D):
    p, c = map(int, input().split())
    s = (i + 1) * 100
    score.append([s, p, c, s * p + c])
 
ans = float('inf')
for ptn in product([0, 1], repeat=D):
    total = 0
    cnt = 0
    for i in range(D):
        total += score[i][3] * ptn[i]
        cnt += score[i][1] * ptn[i]
 
    if 0 in ptn[::-1]:
        i = D - 1 - ptn[::-1].index(0)
        x = score[i]
    else:
        x = score[-1]
 
    for i in range(x[1]):
        if total >= G:
            break
        total += x[0]
        cnt += 1
 
    if total < G:
        cnt = float('inf')
    ans = min(ans, cnt)
print(ans)

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

ans = (float('inf'))

for bit in range(2**D):
	wa = 0
	cnt = 0
	for i in range(D):
		if (bit & (1<<i)):
			wa += (i+1)*100*P[i]+C[i]
			cnt += P[i]
		
	for i in range(D-1,-1,-1):
		if wa >= G:
			break
		if bit & (1<<i):
			continue
		s = (i+1)*100
		need = (G-wa+s-1)//s
		wa += min(need,P[i])*s
		cnt += min(need,P[i])

	if wa >= G:
		ans  = min(ans,cnt)

print(ans)

Solution (Python):
def main():
    D, G = [int(i) for i in input().split()]
    p = []
    c = []
    for i in range(D):
        pp, cc = [int(i) for i in input().split()]
        p.append(pp); c.append(cc)
    ans = 1e9
    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) * p[i] + c[i]
                num += p[i]
            else:
                
                
                
                
                rest_max = i
        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)


if __name__ == '__main__':
    main()

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

ans = float("inf")
bi = [0,1]
import itertools

for i in list(itertools.product(bi, repeat=D)):
    tmp = 0
    p = 0
    for j in range(D):
        if i[j] == 1:
            p += PC[j][1]
            p += PC[j][0]*100*(j+1)
            tmp += PC[j][0]
    for j in range(D):
        k = D-1-j
        if p >= G:
            break
        if i[k] == 0:
            tmp += min(PC[k][0]-1,-(-(G-p)//(100*(k+1))))
            p += min(PC[k][0]-1,-(-(G-p)//(100*(k+1)))) * (100*(k+1))
            
    if ans > tmp and p>=G:
        ans = tmp


print(ans)

Solution (Python):
from math import ceil
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for _ in [0]*d]
m=1000

for i in range(2**d):
    cnt=0
    s=g
    for j in range(d):
        k=(i&(2**j))>>j
        if k==1:
            s-=pc[j][0]*(j+1)*100+pc[j][1]
            cnt+=pc[j][0]
    if s<=0:
        m=min(m,cnt)
    else:
        for j in range(d-1,-1,-1):
            k=(i&(2**j))>>j
            if k==0:
                if pc[j][0]*(j+1)*100 >= s:
                    cnt+=ceil(s/((j+1)*100))
                    break
                else:
                    s-=pc[j][0]*100*(j+1)
                    cnt+=pc[j][1]
        m=min(m,cnt)
print(m)

Solution (Python):


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

min_ans = 9999999999
ans = 0
sum_point = 0
dont_solved = [i for i in range(D)]

for bit in range(1<<D):
    dont_solved = [i for i in range(D)]
    ans = 0
    sum_point = 0
    for i in range(D):
        if bit & (1<<i):
            ans += p[i]
            sum_point += (100 * (i+1)) * (p[i]) + c[i]
            dont_solved.remove(i)
    if sum_point < G:
        for i in dont_solved[::-1]:
            for j in range(p[i]):
                sum_point += 100 * (i+1)
                ans += 1
                if sum_point >= G:
                    break
            else:
                continue
            break
    if ans <= min_ans:
        min_ans = ans
print(min_ans)

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

def solve(g, d):
  if d == 0:
    return 10**9
  n = min(g//(100*d), pc[d][0])
  t = n * d * 100
  if n == pc[d][0]:
    t += pc[d][1]
  if t < g:
    n += solve(g-t, d-1)
  return min(n, solve(g,d-1))

print(solve(g,d))

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

min_solved = 1000
for i in range(2 ** d):
    i_str = "{:010b}".format(i)[::-1]
    score = 0
    solved = 0
    for j in range(d):
        if i_str[j] == "1":
            score += 100 * (j + 1) * pc[j][0] + pc[j][1]
            solved += pc[j][0]
    if score < g:
        add_i = i_str[:d].rfind("0")
        for k in range(pc[add_i][0]):
            score += 100 * (add_i + 1)
            solved += 1
            if score >= g:
                break
        else:
            continue

    if solved < min_solved:
        min_solved = solved

print(min_solved)

Solution (Python):

import sys


def solve(D: int, G: int, p: "List[int]", c: "List[int]"):
    cm = sum(p)
    for i in range(1<<D):
        s = 0
        ct = 0
        for j in range(D):
            if((i>>j)&1):
                s += (j+1)*100*p[j]+c[j]
                
                ct += p[j]
    
        for j in range(D, 0, -1):
            if(s >= G): break
            if((i>>(j-1))&1): continue
            u = 100*j
            n = (G-s+u-1)//u
            s += p[j-1]*u
            ct += min(n, p[j-1])

        cm = min(cm, ct)

    print(cm)
    
    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())
pc = [list(map(int, input().split())) for _ in range(d)]

min_solved = 1000
for i in range(2 ** d):
    i_str = "{:010b}".format(i)[::-1]
    score = 0
    solved = 0
    for j in range(d):
        if i_str[j] == "1":
            score += 100 * (j + 1) * pc[j][0] + pc[j][1]
            solved += pc[j][0]
    if score < g:
        add_i = i_str[:d].rfind("0")
        for k in range(pc[add_i][0]):
            score += 100 * (add_i + 1)
            solved += 1
            if score >= g:
                break
        else:
            continue

    if solved < min_solved:
        min_solved = solved

print(min_solved)

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

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

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

ans = float("inf")

for i in range(2**D):
	flg = list(map(int, Base_10_to_n(i,2).rjust(D,"0")))
	tmp_score = sum([t[j] for j in range(D) if flg[j] == 1])
	cnt = sum([p[j] for j in range(D) if flg[j] == 1])

	if tmp_score < G:

		rst_max_q = max([j for j in range(D) if flg[j] == 0])

		rst_q_num = 0
		while rst_q_num < p[rst_max_q]:
			tmp_score += 100*(rst_max_q+1)
			rst_q_num += 1
			cnt += 1
			if tmp_score >= G:
				break

		if tmp_score < G:
			continue

	ans = min(ans, cnt)


print(ans)

Solution (Python):
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]
ans = 1001
for i in range(1<<d):
    count, score, left = 0, 0, 0
    for j in range(d):
        if (i >> j) & 1:
            score += (j+1)*100*pc[j][0] + pc[j][1]
            count += pc[j][0]
        else: left = j
    add = min(-(-max(g-score, 0)//((left+1)*100)),pc[left][0])
    count += add
    score += (left+1)*100*add
    if score >= g: ans = min(ans, count)
print(ans)

Solution (Python):
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]
ans = 1001
for i in range(1<<d):
    count, score, left = 0, 0, 0
    for j in range(d):
        if (i >> j) & 1:
            score += (j+1)*100*pc[j][0] + pc[j][1]
            count += pc[j][0]
        else: left = j
    for j in range(pc[left][0]):
        if score >= g: break
        score += (left+1)*100
        count += 1
    if score >= g: ans = min(ans, count)
print(ans)

Solution (Python):

import sys


def solve(D: int, G: int, p: "List[int]", c: "List[int]"):

    
    mc = sum(p)
    for i in range(1 << D):
        s = 0
        cc = 0
        for j in range(D):
            if((i >> j) & 1):
                s += (j+1)*p[j]*100+c[j]
                cc += p[j]
        
        
        
        for j in range(D-1, -1, -1):
            
            if((i>>j)&1):
                continue
            
            if(s >= G):
                break
            
            g = (j+1)*100
            
            
            got = (G-s+g-1)//g
            s += min(got, p[j])*g
            cc += min(got, p[j])
        mc = min(cc, mc)

    print(mc)

    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):
import sys
import math
from fractions import gcd





def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

D, G =  map(int, sys.stdin.readline().split())
L =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(D)][::-1]

ans = 10 ** 10

for bit in range(2 ** D):
    cnt = 0
    point = 0
    for i, l in enumerate(L):
        
        if bit & (1 << i):
            q_num = l[0]
            bonus = l[1]
            point += q_num * (D - i) * 100 + bonus
            cnt += q_num

    if point >= G:
        ans = min(ans, cnt)
        continue

    for i, l in enumerate(L):
        if not bit & (1 << i):
            for _ in range(l[0]):
                point += (D - i) * 100
                cnt += 1
                if point >= G:
                    break
            else:
                continue
            break

    ans = min(ans, cnt)

print(ans)

Solution (Python):
D,G=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(D)]
r=1000
from itertools import product
for X in product(range(2),repeat=D):
    g,a=0,0
    for i,x in enumerate(X):
        if x:
            g+=pc[i][1]+pc[i][0]*(i+1)*100
            a+=pc[i][0]
    for i in range(D-1,-1,-1):
        if X[i]==1:
            continue
        if g>=G:
            break
        n=min(pc[i][0]-1,-((g-G)//((i+1)*100)))
        a+=n
        g+=n*(i+1)*100
    if g>=G:
        r=min(r,a)
print(r)

Solution (Python):
INF = float('inf')
d, g = map(int, input().split())
data = []
calced = set()
for i in range(d):
  p, c = map(int, input().split())
  data.append([p, c, (i + 1) * 100, (i + 1) * 100 * p + c])
def f(data, total, targets):
  if total <= 0:
    return 0
  result = INF
  for i in range(len(targets)):
    p, c, score, subtotal = data[targets[i]]
    t = (total + score - 1) // score
    if t < p and t < result:
      result = t
    nt = tuple(targets[0:i] + targets[i + 1:])
    if nt not in calced:
      calced.add(nt)
      t = p + f(data, total - subtotal, nt)
      if t < result:
        result = t
  calced.add(targets)
  return result
print(f(data, g, tuple(range(len(data)))))

Solution (Python):
INF = float('inf')
d, g = map(int, input().split())
data = []
for i in range(d):
  p, c = map(int, input().split())
  data.append([p, c, (i + 1) * 100, (i + 1) * 100 * p + c])
def f(data, total, targets):
  if total <= 0:
    return 0
  result = INF
  for i in targets:
    score = data[i][2]
    t = (total + score - 1) // score
    if t < data[i][0] and t < result:
      result = t
  for i in range(len(targets)):
    j = targets[i]
    p, c, score, subtotal = data[j]
    t = p + f(data, total - subtotal, targets[0:i] + targets[i + 1:])
    if t < result:
      result = t
  return result
print(f(data, g, list(range(len(data)))))

Solution (Python):
import math
d,g=map(int,input().split())
pc=[[int(i)for i in input().split()]for _ in range(d)]
a=1000
for i in range(2**d):
    c=0
    s=0
    m=0
    for j in range(d):
        if (i>>j)&1:
            s+=(j+1)*100*pc[j][0]+pc[j][1]
            c+=pc[j][0]
        else:
            m=j
    if s>=g:
        a=min(a,c)
    elif (m+1)*100*(pc[m][0]-1)+s>=g:
        a=min(a,c+math.ceil((g-s)/((m+1)*100)))
print(a)

Solution (Python):


INF = float('inf')
D, G = map(int, input().split())
problems = [] * D
bonus = [] * D
ans = 0
for _ in range(D):
    p, c = map(int, input().split())
    problems.append(p)
    bonus.append(c)

ans = INF
for bit in range(1 << D):
    total_problem = 0
    total_score = 0
    
    
    
    for i in range(D):
        if bit & (1 << i):
            s = (i + 1) * 100
            total_score += s * problems[i] + bonus[i]
            total_problem += problems[i]

    for i in range(D - 1, -1, -1):
        if G <= total_score:
            break
        if bit & (1 << i):
            continue

        s = (i + 1) * 100
        required_score = G - total_score
        required_problem = (required_score + s - 1) // s
        total_score += min(required_problem, problems[i]) * s
        total_problem += min(required_problem, problems[i])

    if G <= total_score:
        ans = min(ans, total_problem)

print(ans)

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

ans = 10 ** 9
for i in range(1 << D):
    score = 0
    solved = 0
    for j in range(D):
        p, c = scores[j]
        if i & (1 << j):
            solved += p
            score += p * 100 * (j + 1) + c
        else:
            k = j

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

    p, c = scores[k]
    for j in range(p):
        solved += 1
        score += 100 * (k + 1)
        if score >= G:
            ans = min(ans, solved)
            break

print(ans)

Solution (Python):


import itertools

D, G = list(map(int, input().split()))
pc_list = []
for _ in range(D):
    p, c = list(map(int, input().split()))
    pc_list.append((p, c))



p_gen = itertools.product([0, 1], repeat=D)

cost_list = []
for pattern in p_gen:
    cost = 0
    point = 0
    for i, solve_flag in enumerate(pattern):
        point += ((i+1) * 100 * pc_list[i][0] + pc_list[i][1]) * solve_flag
        cost += pc_list[i][0] * solve_flag

    if point >= G:
        
        cost_list.append(cost)
    else:
        
        
        kouho_list = [i for i, solve_flag in enumerate(pattern) if solve_flag == 0]
        kouho_list = sorted(kouho_list, reverse=True)
        is_over = False
        for i in kouho_list:
            for _ in range(1, pc_list[i][0]):
                point += (i+1) * 100
                cost += 1
                if point >= G:
                    is_over = True
                    break
            if is_over:
                break
        if is_over:
            cost_list.append(cost)

ans = min(cost_list)
print(ans)

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

D, G = na()
p = []
c = []

for i in range(D):
    x, y = na()
    p.append(x)
    c.append(y)

ans = 9999999999999
for i in range(1<<D):
    score = 0
    ct = 0
    for j in range(D):
        if i >> j & 1:
            score += (p[j] * (j+1) * 100 + c[j])
            ct += p[j]
    for j in range(D-1, -1, -1):
        if i >> j & 1: continue
        if score >= G: break
        g = (j + 1) * 100
        got = (G - score) // g
        score += min(got, p[j]) * g
        ct += min(got, p[j])
    ans = min(ans, ct)
print(ans)

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

D, G = na()
p = []
c = []

for i in range(D):
    x, y = na()
    p.append(x)
    c.append(y)

ans = 9999999999999
for i in range(1<<D):
    score = 0
    ct = 0
    for j in range(D):
        if i >> j & 1:
            score += (p[j] * (j+1) * 100 + c[j])
            ct += p[j]
    for j in range(D-1, -1, -1):
        if i >> j & 1: continue
        if score >= G: break
        g = (j + 1) * 100
        got = (G - score + g - 1) // g
        score += min(got, p[j]) * g
        ct += min(got, p[j])
    ans = min(ans, ct)
print(ans)

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


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

ans = float('inf')
for i in range(1<<D):
    total = 0
    num = 0
    for j in range(D):
        if ((i >> j) & 1):
            total += C[j] + 100*P[j]*(j+1)
            num += P[j]

    if total >= G:
        ans = min(ans, num)
    else:
        for j in range(D-1, -1, -1):
            if ((i >> j) & 1):
                continue

            for k in range(P[j]-1):
                if total >= G:
                    break
                total += 100*(j+1)
                num += 1

        if total >= G:
            ans = min(ans, num)

print(ans)

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


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

ans = float('inf')
for i in range(1<<D):
    total = 0
    num = 0
    for j in range(D):
        if ((i >> j) & 1):
            total += C[j] + 100*P[j]*(j+1)
            num += P[j]


    if total >= G:
        ans = min(ans, num)
    else:
        for j in range(D-1, -1, -1):
            if ((i >> j) & 1):
                continue




            for k in range(P[j]-1):
                if total >= G:
                    break


                total += 100*(j+1)
                num += 1




        if total >= G:

            ans = min(ans, num)

print(ans)

Solution (Python):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


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

ans = float('inf')
for i in range(1<<D):
    total = 0
    num = 0
    for j in range(D):
        if ((i >> j) & 1):
            total += C[j] + 100*P[j]*(j+1)
            num += P[j]

    if total >= G:
        ans = min(ans, num)
    else:
        for j in range(D-1, -1, -1):
            if ((i >> j) & 1):
                continue

            for k in range(P[j]):
                if total >= G:
                    break

                total += 100*(j+1)
                num += 1


        ans = min(ans, num)

print(ans)

Solution (Python):
import itertools
from operator import itemgetter

D,G = map(int,input().split())
pc = []

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

A = [0,1]
mintimes = 10000

for i in itertools.product(A,repeat=D):
    score = 0
    times = 0
    lest = []
    
    for j,v in enumerate(i):
        if v != 0:
            score += pc[j][2]
            times += pc[j][0]
        else:
            lest.append(j)
    
    if score >= G:
        
        mintimes = min(times,mintimes)
    else:
        objective = G - score

        part = []
        for k in lest: 
            part.append([pc[k][0],100*(k+1)])
        
        part2 = sorted(part,key=itemgetter(1),reverse = True)

        for m in part2:
            if objective > (m[0]-1) * m[1]:
                objective -= (m[0]-1) * m[1]
                times += (m[0]-1)
            else:
                tmp3 = objective // m[1]
                if objective % m[1] != 0:
                    tmp3 += 1
                times += tmp3
                mintimes = min(mintimes,times)
                break

print(mintimes)