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(_) for _ in input().split()]
PC = [tuple(int(_) for _ in input().split()) for i in range(D)]

from itertools import product

def calc(D, G, PC, es):
    r = 0
    k = None
    result = 0
    for i, e, pc in zip(range(D), es, PC):
        if e:
            r += (i+1) * 100 * pc[0] + pc[1]
            result += pc[0]
        else:
            k = i
    if r >= G:
        return result, r
    if not k is None:
        d = (k+1)*100
        p = PC[k][0]
        if r + d * (p - 1) >= G:
            n = (G - r + d - 1) // d
            result += n
            r += n * d
            return result, r
    return None, None

result = 10**20

for es in product((0, 1), repeat=D):
    r, score = calc(D, G, PC, es)
    
    if not r is None:
        result = min(result, r)

print(result)

Solution (Python):
def main():
    """
    1 <=  D <= 100
    1 <= pi <= 100
    1 <=  i <= D
    100 <= G
    100 <= ci <= 10^6

    all: sum(p)
        max: 100 * 10 = 1000
    """
    D, G = map(int, input().split())
    P, C = zip(*(
        map(int, input().split())
        for _ in range(D)
    ))

    
    ans = editorial(D, G, P, C)
    print(ans)


def editorial(D, G, P, C):
    ans = float("inf")
    for i in range(2 ** D):
        c = 0
        score = 0
        clear = [False] * D
        for j in range(D):
            if i & (1 << j):
                c += P[j]
                score += 100 * (j + 1) * P[j] + C[j]
                clear[j] = True

        
        for j in range(D)[::-1]:
            if score >= G:
                break
            if clear[j]:
                continue

            rest = G - score
            base_score = 100 * (j + 1)
            add_c = (rest + base_score - 1) // base_score
            add_c = min(add_c, P[j] - 1)
            c += add_c
            score += base_score * add_c

            

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

    return ans


def f(D, G, P, C):
    """
    i, P から問題をすべて分割
    すべての解き方を列挙する
    sum_p ! = 1000 ! => TLE

    点数の高いものから解けばいいとは限らない

    dpっぽく前の解き方を利用してみる
    ans[0] = 0
    ans[1] = max_i * 100 or ボーナスあり
        ボーナスがあるので、前の答え＋点の良い問題とは限らない
        前の解き方のうち、１つ変えるとどうなるか？
            ボーナスがなくなってしまうかもしれない
            代わりにボーナスになる可能性もある
            前の解き方からｘ問変えるとどうなるか？
                同様
    ボーナスもらえるテーブルを作る？
        それとボーナス加味しないDPテーブルとの比較
        b_dp[5] = p1 全完了
        dp[2] = p2
            fix[]
    """
    from itertools import permutations
    from collections import defaultdict

    sum_p = sum(P)
    dp = [float("inf") for _ in range(sum_p + 1)]
    dp[0] = 0
    max_state = {}

    
    total = [(i + 1) * 100 * P[i] + C[i] for i in range(D)]
    ratio = [total[i] / P[i] for i in range(D)]
    bonus = [False for _ in range(D)]
    for i in range(1, sum_p + 1):
        score = 0
        rest = i
        for j in range(D):
            if bonus[j]:
                rest -= P[j]
                score += total[j]
            elif P[j] <= rest:
                bonus[j] = True
                rest -= P[j]
                score += total[j]

        if dp[i] >= G:
            return i


if __name__ == '__main__':
    main()

Solution (Python):
D, G = map(int, input().split())
problem = []
bonus = []
for i in range(D):
    pi, ci = map(int, input().split())
    problem.append(pi)
    bonus.append(ci)
ans = float('inf')
for S in range(1 << D):  
    score = sum([(problem[j] * 100 * (j + 1) + bonus[j]) * ((S >> j) & 1) for j in range(D)])
    count = sum([problem[j] * ((S >> j) & 1) for j in range(D)])
    if score >= G:
        ans = min(ans,count)
    else:
        for i in range(D):
            if (S >> i) & 1 == 0 and score + problem[i] * 100 * (i + 1) >= G: 
                count_2 = count + (G - score + (100 * (i + 1)) - 1) // (100 * (i + 1))
                ans = min(ans, count_2)
print(ans)

Solution (Python):
import math


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

ans = float('inf')

for i in range(1 << D): 
    solved = [a for a in range(D)] 
    count = 0
    point = 0
    for j in range(D): 
        if i & (1 << j): 
            count += Problems[j][0]
            point += Problems[j][0] * (j + 1) * 100 + Problems[j][1]
            solved.remove(j) 
    if point < G and len(solved) > 0:
        k = max(solved)
        if math.ceil((G - point) / ((k + 1) * 100)) > Problems[k][0] - 1:
            continue
        else:
            count += math.ceil((G - point) / ((k + 1) * 100))
            ans = min(ans, count)
    else:
        ans = min(ans, count)

print(ans)

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

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

Solution (Python):
D, G = map(int, input().split())
problem = []
bonus_score = []
for i in range(D):
    pi, ci = map(int, input().split())
    problem.append(pi)
    bonus_score.append(ci)
total_problem = sum(problem)
dp= [[0 for k in range(total_problem + 1)] for i in range(D+1)]

for i in range(D):
    for k in range(total_problem + 1):
        for j in range(min(problem[i], k) + 1):
            dp[i+1][k] = max(dp[i+1][k], dp[i][k - j] + (i + 1) * 100 * j + (j//problem[i]) * bonus_score[i])
ans = 0
while dp[D][ans] < G:
    ans += 1
print(ans)

Solution (Python):
import math
import itertools

(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 = 114514
for order in itertools.permutations(range(d)):
    point = 0
    cnt = 0
    for i in order:
        if g - point <= 100 * (i + 1) * p[i]:
            cnt += math.ceil((g - point) / (100 * (i + 1)))
            break
        elif g - point <= 100 * (i + 1) * p[i] + c[i]:
            cnt += p[i]
            break
        else:
            point += 100 * (i + 1) * p[i] + c[i]
            cnt += p[i]         

    ans = min([ans, cnt])

print(ans)

Solution (Python):
D,G = list(map(int,input().split()))
L=[]
for i in range(D):
    L.append(list(map(int,input().split())))
for i in range(D):
    L[i].append(L[i][0]*(i+1)*100)
    L[i].append(L[i][2]+L[i][1])
answer = 10**4
for bits in range(1<<D):
    point_sum = 0
    n = 0
    j = -1
    for i in range(D):
        if bits & 1<<i:
            point_sum += L[i][3]
            n += L[i][0]
        else:
            j = max(j, i)
    if point_sum >= G:
        answer = min(answer, n)
    elif j >=0 and (point_sum+L[j][2])-(j+1)*100 >= G:
        a = G - point_sum
        b = (j+1)*100
        answer = min(answer, n+int((a+b-1)/b))
    else:
        pass
print(answer)

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

ans = float('inf')

for i in range(1 << D):
    number = 0
    score = 0
    chosen = []
    for j in range(D):
        if (1 & (i >> j)) == 1:
            chosen.append(j)
            score += P[j][0] * 100 * (j+1) + P[j][1]
            number += P[j][0]

    index = D-1
    while score < G:
        if index < 0:
            break
        if index in chosen:
            pass
        else:
            for _ in range(1, P[index][0]+1):
                score += 100 * (index + 1)
                number += 1

                if score >= G:
                    break

        index -= 1
    ans = min(ans, number)
            

print(ans)

Solution (Python):
D, G = map(int, input().split())
set, full = [],[]
for i in range(D):
    set.append(list(map(int, input().split())))
    full.append((i + 1)*100*set[i][0] + set[i][1])

minNum = 1001
for i in range(2 ** D):
    a = list(format(i, "b").zfill(D))
    total, num , largest= 0, 0, 0
    for j in range(D):
        if a[j] == "1":
            total += full[j]
            num += set[j][0]
        else:
            largest = j
    if total >= G:
        minNum = (num if num < minNum else minNum)
    else:
        for j in range(1, set[largest][0]):
            total += (largest + 1) * 100
            num += 1
            if total >= G:
                minNum = (num if num < minNum else minNum)

print(minNum)

Solution (Python):
I=input().split()
D=int(I[0])
G=int(I[1])
P=[]
C=[]
sumS=[]
ans=10**4
for i in range(0,D):
    T=input().split()
    P.append(int(T[0]))
    C.append(int(T[1]))
    sumS.append((i+1)*100*P[i]+C[i])
for i in range(0,2**D):
    t=i
    point=0
    cost=0
    used=[]
    for j in range(0,D):
        if(t%2==1):
            point+=sumS[j]
            cost+=P[j]
            used.append(True)
        else:
            used.append(False)
        t//=2
    if(point<G):
        t=i
        f=False
        for j in range(0,D)[::-1]:
            if(not used[j]):
                f=True
                for k in range(1,P[j]):
                    point+=(j+1)*100
                    cost+=1
                    if (point>=G):
                        break
            if f:
                break
    if(point>=G):
        if(ans>cost):
            ans=cost
print(ans)

Solution (Python):

from itertools import product

D, G = map(int, input().split())
pc_table = [tuple(map(int, input().split())) for _ in range(D)]

bit_table = list(product([0, 1], repeat=D))
cnts = []
for bits in bit_table:
    g = sum([
        pc_table[i][1] + 100 * (i + 1) * pc_table[i][0]
        for i, bit in enumerate(bits) if bit
    ])
    cnt = sum([pc_table[i][0] for i, bit in enumerate(bits) if bit])

    max_p = 0 if sum(bits) == D else max(
        [i for i, bit in enumerate(bits) if not bit])
    for _ in range(pc_table[max_p][0]):

        if g >= G:
            cnts.append(cnt)
            break
        else:
            g += 100 * (max_p + 1)
            cnt += 1

print(min(cnts))

Solution (Python):

from itertools import product

D, G = map(int, input().split())
pc_table = [tuple(map(int, input().split())) for _ in range(D)]

bit_table = list(product([0, 1], repeat=D))
cnts = []
for bits in bit_table:
    g = sum([
        pc_table[i][1] + 100 * (i + 1) * pc_table[i][0]
        for i, bit in enumerate(bits) if bit
    ])
    cnt = sum([pc_table[i][0] for i, bit in enumerate(bits) if bit])

    if g >= G:
        cnts.append(cnt)

    else:
        max_p = max([i for i, bit in enumerate(bits) if not bit])
        for _ in range(pc_table[max_p][0]):
            g += 100 * (max_p + 1)
            cnt += 1
            if g >= G:
                cnts.append(cnt)
                break

print(min(cnts))

Solution (Python):
import math
from itertools import chain, combinations



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

for _ in range(D):
    p_in, c_in = map(int, input().split())
    p.append(p_in)
    c.append(c_in)



def powerset(itr):
    s = list(itr)
    return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))



fullcon = []
for i in range(D):
    score = 100 * (i + 1) * p[i] + c[i]
    fullcon.append(score)


use_flag_itr = range(D)
use_flag_set = powerset(use_flag_itr)

mincount = 100 * 10

for use_flag in use_flag_set:
    fullscore = 0
    fullcount = 0
    for i in use_flag:
        fullcount += p[i]
        fullscore += fullcon[i]

    remain = G - fullscore

    if remain <= 0:
        if mincount > fullcount:
            mincount = fullcount 
        continue



    for i in reversed(range(D)):
        if i in use_flag:
            continue

        score = 100 * (i + 1) 
        if score * p[i] > remain:
            new_count = fullcount +  int(math.ceil(remain / score))
            if mincount > new_count:
                mincount = new_count
        break

print(mincount)

Solution (Python):

"""
Created on Sun Aug  5 19:16:59 2018
ABC104C
@author: maezawa
"""
import math

d, g = list(map(int, input().split()))
p = []
c = []
for i in range(d):
    pi, ci = list(map(int, input().split()))
    p.append(pi)
    c.append(ci)
 
min_cnt = 10**11 
    
for i in range(2**d):
    istr = '0'*d + format(i,'b')
    used = []
    cnt = 0
    maney = 0   
    for j in range(d):
        if istr[-1-j] == '1':
            maney += c[j]+p[j]*(j+1)*100
            cnt += p[j]
            used.append(j)
    if maney >= g:
        if min_cnt > cnt:
            min_cnt = cnt
            
            continue
    else:
        k = d-1
        while k>=0:
            if k not in used:
                break 
            k -= 1
        rem = math.ceil((g-maney)/(100*(k+1)))
        if rem >= p[k]:
            continue
        else:
            cntp = cnt + rem
            if min_cnt > cntp:
                min_cnt = cntp
                
                continue
    
print(min_cnt)

Solution (Python):
from collections import defaultdict

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

bonus=[]

for i in range(D):
  a,b=map(int,input().split())
  bonus.append([a,b])

def solve(bit):
  ans=0
  turn=0
  for j in range(D):
    if (bit >> j ) % 2:
      ans+=(bonus[j][0] * (j+1) * 100 + bonus[j][1])
      turn+=bonus[j][0]
  if ans >= G:
    return turn
  for k in range(D-1,-1,-1):
    if (bit >> k ) % 2 == 0:
      for l in range(bonus[k][0]-1):
        ans += (k+1)*100
        turn += 1
        if ans >= G:
          return turn
  return -1
        

bits = (1 << D)

res=10**10
for i in range(bits):
  c=solve(i)
  if c > 0:
    res=min(res,c)
  
print(res)

Solution (Python):
from math import ceil
D,G = map(int,input().split())
P,C,A = [],[],[]
for i in range(D):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)
    A.append((i+1)*100*p+c)

Ans = []

for i in range(2**D):
    bits = bin(2**D+i)[3:]
    
    total,ans = 0,0
    for i,b in enumerate(bits):
        if b=="1":
            total += A[i]
            ans += P[i]
    
    if total >= G:
        Ans.append(ans)
    
    else:
        j = 0 
        for i,b in enumerate(bits):
            if b=="0":
                j = i
        
        res =  G - total
        if res/((j+1)*100) <= P[j]:
            ans += ceil(res/((j+1)*100))
            Ans.append(ans)


print(min(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)

num = float("inf")
for i in range(1 << d):
    cnt = 0
    rec = 0
    for j in range(d):
        if i & 1 << j:
            cnt += P[j]
            rec += P[j] * (j + 1) * 100
            rec += C[j]

    k = d - 1
    while k >= 0 and rec < g:
        if i & 1 << k:
            k -= 1
            continue
        else:
            q = 0
            while q < P[k] and rec < g:
                cnt += 1
                rec += (k + 1) * 100
                q += 1
        k -= 1

    if rec >= g:
        num = min(num, cnt)

print(num)

Solution (Python):
from itertools import product
D, G = map(int, input().split())
l = [tuple(map(int, input().split())) for i in range(D)]
s = [0] * D
ans = float('inf')
for b in product([0,1], repeat=D):
    s = sum([(i+1)*100 * l[i][0] + l[i][1] for i,f in enumerate(b) if f])
    tmp = sum([l[i][0] for i,f in enumerate(b) if f])
    if s < G:
        for i, j in enumerate(reversed(b)):
            if j == 0:
                d = D - i
                k = 0
                if s + 100 * d * (l[d-1][0] - 1 - k) < G:
                    tmp = float('inf')
                    break
                while True:
                    k += 1
                    if s + 100 * d * (l[d-1][0] - 1 - k) < G:
                        break
                tmp += l[d-1][0] - k 
                break
    ans = min(ans, tmp)
print(ans)

Solution (Python):
import math
from itertools import combinations
d,g = map(int,input().split())
x = []
for i in range(d):
    x1,y1=[int(i) for i in input().split()]
    x.append([x1,y1])
zy = [i for i in range(1,d+1)]
zyu = []
for i in range(d+1):
  zyu.extend(list(combinations(zy, i)))
ans2 = 100000000000000000000000
gou = g+0
for i in zyu:
  ans = 0
  g = gou +0
  for j in i:
    g -= (x[j-1][0] * j*100 + x[j-1][1])
    ans += x[j-1][0]
  if g >0:
    y = d+0
    while y in i:
      y -= 1
    a = x[y-1][0]
    if g > a*y*100:
      continue
    ans += math.ceil(g/(y*100))
  ans2 = min(ans,ans2)
print(ans2)

Solution (Python):
d,g=map(int,input().split())
p=[]
c=[]
for l in range(d):
    t1,t2=map(int,input().split())
    p.append(t1)
    c.append(t2)
ans=1e9
for i in range(1<<d):
    s=0
    n=0
    r=-1
    for j in range(d):
        if(i>>j & 1):
            s+=100*(j+1)*p[j]+c[j]
            n+=p[j]
        else:
            r=j
    if(s<g):
        s1=100*(r+1)
        ne=(g-s+s1-1)//s1
        if(ne>=p[r]):continue
        n+=ne
    ans=min(ans,n)
print(ans)

Solution (Python):
import bisect
from operator import itemgetter

d, g = map(int, input().split())
g //= 100
problem_quantities = []
complete_scores = []
for i in range(1, d + 1):
    p, c = map(int, input().split())
    c //= 100
    problem_quantities.append(p)
    complete_scores.append(i * p + c)

curr_idx = d
curr_bit = 0
curr_cmp, curr_qtt = 0, 0
complete_combinations = [None] * (1 << d)
complete_combinations[0] = (0, 0, 0)
for use in range(1, 1 << d):
    if use & curr_bit == 0:
        curr_idx -= 1
        curr_bit = use
        curr_cmp = complete_scores[curr_idx]
        curr_qtt = problem_quantities[curr_idx]
    ps, pq, _ = complete_combinations[use ^ curr_bit]
    complete_combinations[use] = (ps + curr_cmp, pq + curr_qtt, use)

complete_combinations.sort()

bi = bisect.bisect(complete_combinations, (g,))

ans = float('inf')
for s, p, use in complete_combinations[:bi]:
    i = d
    while use & 1:
        i -= 1
        use >>= 1
    cmp = complete_scores[i - 1]
    remain = g - s
    if remain >= cmp:
        continue
    q = min(problem_quantities[i - 1], (remain - 1) // i + 1)
    ans = min(ans, p + q)

ans = min(ans, min(map(itemgetter(1), complete_combinations[bi:])))
print(ans)

Solution (Python):

"""
Created on Mon Aug  6 16:07:14 2018

@author: Yuki
"""



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)


MAX_POINT_LIST = []
for i in range(D):
    MAX_POINT_LIST.append(P[i] * 100 * (i + 1) + C[i])


res_list = []
flag = [False for i in range(D)]
for i in range(2**D):
    tmp_point = 0
    tmp_count = 0
    tmp_bin = bin(i)[2:].zfill(D)
    for ii in range(D):
        flag[ii] = False
        if tmp_bin[ii] == '1':
            flag[ii] = True
            tmp_point += MAX_POINT_LIST[ii]
            tmp_count += P[ii]
    if tmp_point >= G:
        res_list.append(tmp_count)
    else:
        for ii in range(D):
            if flag[ii] == False:
                
                if tmp_point + (P[ii] - 1) * 100 *(ii + 1) >= G:
                    comp_cnt = (G - tmp_point - 1) // (100 * (ii + 1)) + 1
                    res_list.append(comp_cnt + tmp_count)
    
    
                
print(min(res_list))

Solution (Python):
import math
d,g = map(int,input().split())
ans = []
data = []

for i in range(0,d):
    P,C = map(int,input().split())
    data.append((P,C,(i+1)*100))

def dfs(i,sum,a,last):
    if i >= d:
        p,c,point = data[last]
        if sum >= g-(c+p*point):
            global ans
            a += max(0,min(math.ceil((g-sum)/point),p))
            ans.append(a)
        return
    dfs(i+1,sum,a,last)
    p,c,point = data[i]
    if i != last:
        dfs(i+1,sum+c+p*point,a+p,last)

for i in range(0,d):
    p,c,point = data[i]
    dfs(0,0,0,i)
print(min(ans))

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

g //= 100

p = [0 for _ in range(d)]
c = [0 for _ in range(d)]
b = [0 for _ in range(d)]
for i in range(d):
    p[i], c[i] = map(int, input().split())
    b[i] = p[i] * (i + 1) + (c[i] // 100)

res = sum(p)
com = [0 for _ in range(d)]
for i in range(2 ** d):
    temp = i
    temp_res = 0
    total = 0
    for j in range(d):
        com[j] = temp % 2
        temp //= 2
        if com[j] == 1:
            total += b[j]
            temp_res += p[j]
    if total >= g:
        res = min(temp_res, res)
        
        continue

    j = d
    while total < g:
        j -= 1
        if j < 0:
            break
        if com[j] == 1:
            continue
        if (p[j] - 1) * (j + 1) + total >= g:
            temp_res += (g - total) // (j + 1)
            if (g - total) % (j + 1) != 0:
                temp_res += 1
            total += (p[j] - 1) * (j + 1)
            break
        else:
            temp_res += p[j] - 1
            total += (p[j] - 1) * (j + 1)
    if total >= g:
        
        res = min(temp_res, res)

print(res)

Solution (Python):
D,G = map(int,input().split())
G = G/100
P = []; C = []
for i in range(D):
  p,c = map(int,input().split())
  P.append(p)
  C.append(c/100)
m = 10**3
for k in range(2**D):
  R = list(range(D))[::-1]
  point = G
  prob = 0
  for d in range(D):
    if k%(2**(d+1)) >= 2**d:
      p = P[d]; c = C[d]
      point -= (d+1)*p + c
      prob += p
      R.remove(d)
  for r in R:
    if point > 0:
      p = P[r]
      if point/(r+1) <= p:
        prob += -(-point//(r+1))
        point = 0
      else:
        point -= (r+1)*p + C[r]
        prob += p
  if m >= prob:
    m = prob
print(int(m))

Solution (Python):
d,g=map(int, input().split())
A=[]
a=0
b=0
for i in range(d):
  a,b=map(int, input().split())
  A.append([a,b])


minp=0
for i in range(d):
  minp+=A[i][0]



for i in range(2**d):
  sco=0 
  pro=0 
  bini=bin(i)[2:].zfill(d)
  
  for j in range(d):
    if bini[j]=="1" : 
      pro+=A[j][0]
      sco+=A[j][0]*100*(j+1)+A[j][1]
  if sco<g : 
    
    totyuu=-1
    j=0
    while totyuu==-1 :
      if bini[d-j-1]=="0" :
        totyuu=d-j-1
      j+=1
    
    
    if g-sco<=(A[totyuu][0]-1)*100*(totyuu+1):
      pro=pro+(g-sco-1)//(100*(totyuu+1))+1
    else:
      pro=minp

  

  if pro<minp :
    minp=pro

print(minp)

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

table=[(0,0)]*D
s=0
for i in range(D):
    p,c=map(int,input().split())
    table[i]=(p,c)
    s+=p
dp=[-1]*(s+1)
dp[0]=0
t=0
for i in range(D):
    for j in range(t,-1,-1):
        for k in range(1,table[i][0]+1):
            if k<table[i][0]:
                dp[j+k]=max(dp[j+k],dp[j]+100*(i+1)*k)
            else:
                dp[j+k]=max(dp[j+k],dp[j]+100*(i+1)*k+table[i][1])
    t+=table[i][0]
    
for i in range(s+1):
    if dp[i]>=G:
        print(i)
        break

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

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

def calc_for(mask) :
    score, cnt = 0, 0
    for i in range(len(mask)) :
        if mask[i] == "1" :
            score += (i + 1) * 100 * scores[i][0] + scores[i][1]
            cnt += scores[i][0]
            
    min_cnt = 10**20
    
    if score >= G :
        return cnt
    else :    
        for i in range(len(mask)) :
            if mask[i] != "1" :
                cnt_tmp = 0 
                score_tmp = score 
                achieve_flg = False


                for j in range(scores[i][0] - 1) :
                    score_tmp += (i + 1) * 100
                    cnt_tmp += 1
                    
                    if score_tmp >= G :
                        achieve_flg = True
                        break

                if achieve_flg == True : 
                    min_cnt = min(min_cnt, cnt + cnt_tmp)

        return min_cnt
            

perms = []

def permsgen(S) :
    global perms
    if len(S) >= D :
        perms.append(S)
    else :
        permsgen(S + "0")
        permsgen(S + "1")

permsgen("")


min_cnt = 10**20
for p in perms :
    min_cnt = min(min_cnt, calc_for(p))
    
print(min_cnt)

Solution (Python):
from itertools import product
import math
D,G=list(map(int, input().strip().split()))
pc=[list(map(int, input().strip().split())) for i in range(D)]

minCount=float("inf")

for idx in product(*([0,1]for i in range(D))):
    ct=0
    score=0
    max_0=-1
    for i,ix in enumerate(idx):
        if ix:
            ct+=pc[i][0]
            score+=pc[i][1]+pc[i][0]*100*(i+1)
        else:
            max_0=i
    if score<G and max_0>=0:
        pt=(max_0+1)*100
        add=int(math.ceil((G-score)/pt))
        if add<pc[max_0][0]:
            ct+=add
            score+=add*pt
    if score>=G and ct<minCount:
        minCount=ct
print(minCount)

Solution (Python):
from sys import stdin

D, G = [int(x) for x in stdin.readline().rstrip().split()]

list = []
for i in range(D):
    tmp = [int(x) for x in stdin.readline().rstrip().split()]
    list.append(tmp)

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) * list[i][0] + list[i][1]
            num += list[i][0]
        else:
            rest_max = i
    if s < G:
        s1 = 100 * (rest_max + 1)
        need = (G - s + s1 - 1) // s1
        if need >= list[rest_max][0]:
            continue
        num += need
    ans = min(ans, num)

print(ans)

Solution (Python):

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


ans = 100000
for i in range(2 ** d):
    sum = 0
    ans_tmp = 0
    s = bin(i)
    
    for j in range(d):
        if bin(2 ** j) == bin(2 ** j & i):
            sum += p[j][0] * (j+1) * 100 + p[j][1]
            ans_tmp += p[j][0]
    if sum < g:
        for j in range(d-1, -1, -1):
            if bin(2 ** j) != bin(2 ** j & i):
                for k in range(p[j][0]-1):
                    sum += (j+1) * 100
                    ans_tmp += 1
                    if g <= sum:
                        break
                if g <= sum:
                    if ans_tmp < ans:
                        ans = ans_tmp
                    break
            else:
                continue
    else:
        if ans_tmp < ans:
            ans = ans_tmp
print(ans)

Solution (Python):
D,G = map(int, input().split())
prob_num = []
bonus = []
comp_pt = []
for i in range(D):
    p,b = map(int, input().split())
    prob_num.append(p)
    bonus.append(b)
    comp_pt.append(100*(i+1)*p+b)

def dfs(hascomp:str, target:int, prob:int, depth:int) -> int:
    if target <= 0:
        
        return prob
    
    elif depth == D:
        for i in range(D-1,-1,-1):
            if hascomp[i] == "n":
                if target <= 100*(i+1)*(prob_num[i]-1):
                    prob += (target//(100*(i+1)))+bool(target%(100*(i+1)))
                    
                    return prob
                
                else:
                    prob += (prob_num[i]-1)
                    target -= 100*(i+1)*(prob_num[i]-1)
                    
        if target > 0:
            
            return 10**5
        
    else:
        new_tar = target-comp_pt[depth]
        new_prob = prob + prob_num[depth]
        return min(dfs(hascomp+"y",new_tar, new_prob, depth+1),
                   dfs(hascomp+"n",target, prob, depth+1))
        

ans = dfs("",G,0,0)
print(ans)

Solution (Python):


from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(10000000)

D, G = map(int, raw_input().split())
lst = []

for loop in range(D):
    p, c = map(int, raw_input().split())
    lst.append((p, c))

ans = 100000

for p in it.product([0, 1], repeat = D):
    S = 0
    cnt = 0
    rem = []
    for i in range(D):
        if p[i] == 1:
            S += 100 * (i + 1) * lst[i][0] + lst[i][1]
            cnt += lst[i][0]
        else:
            rem = [lst[i][0], i + 1]
    if S >= G:
        ans = min(ans, cnt)
        continue
    if S + 100 * rem[0] * rem[1] >= G:
        cnt += (G - S) / (100 * rem[1])
        if (G - S) % (100 * rem[1]) != 0:
            cnt += 1
        ans = min(ans, cnt)

print ans

Solution (Python):
from itertools import product as p

d,g=map(int,input().split())
l=[(0,0) for _ in range(d)]
for i in range(d):
  l[i]=tuple(map(int,input().split()))
f=lambda x:[i for (i,j) in enumerate(x) if j==0]
res={}

for i in p([0,1],repeat=d):
  b=f(i)
  cnt=0
  t_val=0

  for (j,k) in enumerate(i):
      if k:
        t_val+=((j+1)*100*l[j][0]+l[j][1])
        cnt+=(l[j][0])
  
  if b:
    inc=max(b)
    pl=g-t_val
    c_inc=0
    if pl>0:
      if pl%((inc+1)*100):
        c_inc=1+pl//((inc+1)*100)
      else:
        c_inc=pl//((inc+1)*100)
      if c_inc<l[inc][0]:
        t_val+=(c_inc*(inc+1)*100)
        cnt+=(c_inc)
      else:
        t_val+=((l[inc][0]-1)*(inc+1)*100)
        cnt+=(l[inc][0]-1)
  res[i]=(t_val,cnt)

o=sorted([i for i in res.values() if i[0]>=g],key=lambda x:x[1])
print(o[0][1])