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):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

D, G = LI()
PC = []
for i in range(D):
    PC.append([(i+1)*100] + LI())

PC = [tuple(i) for i in PC]

results = []

result = 0
count = 0
for i in range(PC[-1][1]):
    result += PC[-1][0]
    count += 1
    if result >= G:
        results.append(count)

for i in range(1, D+1):
    
    combis = list(itertools.combinations(PC, i))
    
    for combi in combis:
        
        result = 0
        result += sum([c[0] * c[1] + c[2] for c in combi])
        count = sum([c[1] for c in combi])
        if result >= G:
            results.append(count)
            continue
        rest = [_ for _ in PC if _ not in combi]
        for r in rest[::-1]:
            for ridx in range(r[1]):
                result += r[0]
                count += 1
                if result >= G:
                    results.append(count)
print(min(results))

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


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

D, G = LI()
PC = []
for i in range(D):
    PC.append([(i+1)*100] + LI())

PC = [tuple(i) for i in PC]




"""
1種類の場合
2種類の場合
3種類の場合
...
10種類の場合
Gを超えだしたらその種類数の中で決める。

10Cr
という形になる。
最大でも組み合わせの数は260通りほどなのでいけそうだ。
"""
results = []
def dfs(ls, limit, combis, count):
    is_end = True
    for i in range(len(ls)):
        
        new_list = [_ for _ in ls]
        if new_list[i] < combis[i][1]:
            
            new_list[i] += 1
            is_end = False

            p = 0
            for idx, j in enumerate(ls):
                
                
                
                
                p += combis[idx][0] * j
                if j == combis[idx][1]:
                    p += combis[idx][2]

            if p >= G:
                results.append(count)
                return

            dfs(new_list, limit, combis, count+1)


result = 0
count = 0
for i in range(PC[-1][1]):
    result += PC[-1][0]
    count += 1
    if result >= G:
        results.append(count)
for i in range(1, D+1):
    
    combis = list(itertools.combinations(PC, i))
    
    for combi in combis:
        limit = sum([j[1] for j in PC])
        
        result = 0
        result += sum([c[0] * c[1] + c[2] for c in combi])
        count = sum([c[1] for c in combi])
        if result >= G:
            results.append(count)
            continue
        rest = [_ for _ in PC if _ not in combi]
        for r in rest[::-1]:
            for ridx in range(r[1]):
                result += r[0]
                count += 1
                if result >= G:
                    results.append(count)

                

print(min(results))

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

dp = [[0 for _ in range(2000)]for i in range(11)]

for i in range(D):
    for j in range(1001):
        
        for k in range(PC[i][0]):
            
            dp[i+1][j+k] = max(dp[i+1][j+k], dp[i][j]+k*(i+1)*100)
        
        dp[i + 1][j + PC[i][0]] = max(dp[i + 1][j + PC[i][0]],
                                      dp[i][j] + PC[i][0] * (i + 1) * 100 + PC[i][1])


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

Solution (Python):
D,G = map(int,input().split())
b = []
c = []
for i in range(D):
    x,y = map(int,input().split())
    b.append(x)
    c.append(y)
res = 1e9
for i in range(1<<D):
    s = format(i,"0"+str(D)+"b")
    score = 0
    num = 0 
    for j in range(D):
        if s[j]=='1':
            num+=b[j]
            score += b[j]*(j+1)*100 + c[j]
    if score >= G:
        res = min(num,res)
    else:
        for j in range(D)[::-1]:
            if s[j] == '0':
                if score + (b[j]-1)*100*(j+1)>=G:
                    if (G-score)%(100*(j+1))==0:
                        num+= (G-score)//(100*(j+1))
                        score = G
                    else:
                        num+= (G-score)//(100*(j+1)) + 1
                        score = G
                    break
                else:
                    num+= b[j]-1
                    score += (b[j]-1)*100*(j+1)
        if score>=G:
            res = min(num,res)
print(res)

Solution (Python):
d, g=map(int, input().split())
p_list=[]
c_list=[]
all_list=[]
for i in range(d):
    p, c=map(int, input().split())
    p_list.append(p)
    c_list.append(c)
    all_list.append(100*(i+1)*p+c)



answer=[]

for i in range(2**d):
    number=0
    sum_score=0
    flag=0
    used_number=[]
    for j in range(d):
        if (i>>j)&1:
            sum_score=sum_score+all_list[j]
            number=number+p_list[j]
            used_number.append(j)
    if sum_score>=g:
        answer.append(number)
    else:
        for k in range(d-1, -1, -1):
            if not k in used_number:
                for l in range(p_list[k]):
                    if sum_score+100*(k+1)*l>=g:
                        answer.append(number+l)
                        flag=1
                        break
            if flag:
                break

print(min(answer))

Solution (Python):
import math

d, g = [int(i) for i in input().split(" ")]
p = [0] * (d + 1)
c = [0] * (d + 1)

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

p_min = 10000

def cp(a):
    global p_min
    r = g - sum([(p[i] * 100 * i + c[i]) * a[i] for i in range(1, d + 1)])
    ps = sum([p[i] * a[i] for i in range(1, d + 1)])
    if r <= 0:
        if ps < p_min:
            p_min = ps
        return
    
    for i in reversed(range(1, d + 1)):
        if a[i] == 0:
            s = (p[i] - 1) * 100 * i
            if r - s <= 0:
                ps += math.ceil(r / (100 * i))
                if ps < p_min:
                    p_min = ps
                break
            else:
                ps += p[i] - 1
                r -= s

def trav(a):
    global d
    if len(a) == d + 1:
        cp(a)
    else:
        trav(a + [0])
        trav(a + [1])

trav([0])

print(p_min)

Solution (Python):





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

q_min = 1000000
for i in range(2**D):
    Gtmp = G
    ps = [p for p in ps_ini]
    s = "{:010b}".format(i)[::-1]
    q_all = 0
    for j,(p,c) in enumerate(zip(ps,cs)):
        
        Gtmp -= (p*(j+1)*100+c)*int(s[j]) 
        q_all += p*int(s[j])
        ps[j] -= p*int(s[j])
    
    if Gtmp <= 0:
        q_min = min(q_min, q_all)
    else:
        
        ind = 0
        for i,p in enumerate(ps):
            if p != 0:
                ind = i
        
        
        if Gtmp//((ind+1)*100) > ps[ind]:
            continue
        if Gtmp%((ind+1)*100) == 0:           
            q_all += (Gtmp//((ind+1)*100))
        else:                           
            q_all += (Gtmp//((ind+1)*100) + 1) 
        q_min = min(q_min, q_all)
print(q_min)

Solution (Python):
d, g = map(int, input().split())
a = []
c = []
for i in range(d):
    a.append(list(map(int, input().split())))
for i in range(2 ** d):
    summ = 0
    count = 0
    j = list(bin(i)[2:].zfill(len(bin(2 ** d - 1)[2:])))
    for k in range(len(j)):
        summ += int(j[k]) * a[k][0] * (k+1) * 100
        if j[k] == '1':
            count += a[k][0]
            summ += a[k][1]
    if summ >= g:
        c.append(count)
        continue
    elif summ < g:
        idx = 0
        for l in range(len(j) - 1, 0, -1):
            if j[l] == '0':
                idx = l
                break
        for m in range(1, a[idx][0]):
            summ += (idx+1) * 100
            count += 1
            if summ >= g:
                c.append(count)
                break

print(min(c))

Solution (Python):
import math

INF = 1000000007

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

p = []
c = []

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


def main():
    ans = INF

    
    for b in range(2 ** D):
        num = 0
        pnt = 0

        
        x = None

        
        for i in range(D - 1, -1, -1):
            
            if b >> i & 1:
                num += p[i]
                
                pnt += c[i] + 100 * (i + 1) * p[i]

            elif x is None:
                x = i

        
        
        if x is None or G <= pnt:
            ans = min(ans, num)

        
        elif math.ceil((G - pnt) / (100 * (x + 1))) < p[x]:
            ans = min(ans, num + math.ceil((G - pnt) / (100 * (x + 1))))

    print(ans)
    return


main()

Solution (Python):
from itertools import permutations
from math import ceil
D, G = map(int, input().split())
prob = [tuple(map(int, input().split())) for _ in range(D)]
perms = [i for i in range(D)]
ans = 10 ** 100
for p in permutations(perms):
    point = 0
    manip = 0
    for i in range(D):
        if point + (p[i] + 1) * 100 * (prob[p[i]][0] - 1) >= G:
            manip += ceil((G - point) / ((p[i] + 1) * 100))
            ans = min(ans, manip)
            break
        else:
            point += (p[i] + 1) * 100 * prob[p[i]][0] + prob[p[i]][1]
            manip += prob[p[i]][0]
            if point >= G:
                ans = min(ans, manip)
                break
print(ans)

Solution (Python):
INF = 1000000007

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

p = []
c = []

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


def main():
    ans = INF

    
    for b in range(2 ** D):
        num = 0
        pnt = 0

        
        x = None

        
        for i in range(D - 1, -1, -1):
            if b >> i & 1:
                num += p[i]
                
                pnt += c[i] + 100 * (i + 1) * p[i]

            elif x is None:
                x = i

        
        if x is None:
            ans = min(ans, num)
            continue

        flg = True

        for i in range(p[x]):
            if G <= pnt:
                break

            pnt += 100 * (x + 1)
            num += 1

            
            
            if i == p[x] - 1:
                flg = False

        if not flg:
            continue

        ans = min(ans, num)

    print(ans)
    return


main()

Solution (Python):
INF = 1000000007

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

p = []
c = []

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


def main():
    ans = INF

    
    for b in range(2 ** D):
        num = 0
        pnt = 0

        
        x = None

        
        for i in range(D - 1, -1, -1):
            if b >> i & 1:
                num += p[i]
                
                pnt += c[i] + 100 * (i + 1) * p[i]

            elif not x:
                x = i

        
        if x is None:
            ans = min(ans, num)
            continue

        flg = True

        for i in range(p[x]):
            if G <= pnt:
                break

            pnt += 100 * (x + 1)
            num += 1

            
            
            if i == p[x] - 1:
                flg = False

        if not flg:
            continue

        ans = min(ans, num)

    print(ans)
    return


main()

Solution (Python):
D,G = map(int,input().split())
b = []
c = []
for i in range(D):
    x,y = map(int,input().split())
    b.append(x)
    c.append(y)
res = 10**18
for i in range(1<<D):
    s = format(i,"0"+str(D)+"b")
    score = 0
    num = 0 
    for j in range(D):
        if s[j]=='1':
            num+=b[j]
            score += b[j]*(j+1)*100 + c[j]
    if score >= G:
        res = min(num,res)
    else:
        for j in range(D)[::-1]:
            if s[j] == '0':
                if score + (b[j]-1)*100*(j+1)>=G:
                    if (G-score)%(100*(j+1))==0:
                        num+= (G-score)//(100*(j+1))
                        score = G
                    else:
                        num+= (G-score)//(100*(j+1)) + 1
                        score = G
                    break
                else:
                    num+= b[j]-1
                    score += (b[j]-1)*100*(j+1)
        if score>=G:
            res = min(num,res)
print(res)

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

def dfs(d, g):
  if(d == 0):
    return 1e9

  x = min(g//(100*d), PC[d][0])
  point = x*100*d

  if(x == PC[d][0]):
    point += PC[d][1]
  
  if(point < g):
    x += dfs(d-1, g-point)
  
  return min(x, dfs(d-1, g))
print(dfs(D, G))

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

ans = 1e9
for i in range(1 << D):
  point = 0
  cnt = 0
  for j in range(D):
    if(((i >> j) & 1) == 1):
      point += PC[j][0]*(j+1)*100 + PC[j][1]
      cnt += PC[j][0]
    else:
      tmp = j
  if(point < G):
    x = G - point
    if((PC[tmp][0]-1)*(tmp+1)*100 < x):
      continue
    cnt += -(-x//(100*(tmp+1)))
  ans = min(ans, cnt)
print(ans)

Solution (Python):
from math import ceil


def all_green(D: int, G: int, PC: int)->int:
    min_coin_num = float('inf')
    for n in range(1 << D):
        
        not_used = []
        
        used_coin_num, total_point = 0, 0
        for i, (p, c) in enumerate(PC):
            
            
            
            
            
            
            
            if n & 1 == 1:
                
                total_point += (100*(i+1)) * p + c
                used_coin_num += p
            else:
                
                not_used.append((i, p))
            n = n >> 1

        if total_point >= G:
            
            min_coin_num = min(min_coin_num, used_coin_num)
        else:
            
            
            for i, p in not_used:
                
                coin_num = ceil((G-total_point)/(100*(i+1)))
                if coin_num < p:
                    
                    min_coin_num = min(min_coin_num, used_coin_num+coin_num)

    return min_coin_num


if __name__ == "__main__":
    D = 0
    D, G = map(int, input().split())
    PC = [tuple(int(s) for s in input().split()) for _ in range(D)]
    ans = all_green(D, G, PC)
    print(ans)

Solution (Python):
from itertools import product
from math import ceil


def solve(string):
    d, g, *pc = map(int, string.split())
    g //= 100
    p = [_p for _p in pc[::2]]
    c = [_c // 100 for _c in pc[1::2]]
    ans = 1000
    for f in product([True, False], repeat=d):
        sums = sum([(i + 1) * _p + _c for i, (_f, _p, _c) in enumerate(zip(f, p, c)) if _f])
        counts = sum([_p for _f, _p in zip(f, p) if _f])
        if g <= sums:
            ans = min(ans, counts)
            continue

        indices = [i + 1 for i, _f in enumerate(f) if not _f]
        tmp = ceil((g - sums) / indices[-1])
        if tmp < p[indices[-1] - 1]:
            ans = min(ans, counts + tmp)
    return str(ans)


if __name__ == '__main__':
    n, g = map(int, input().split())
    print(solve('{} {}\n'.format(n, g) + '\n'.join([input() for _ in range(n)])))

Solution (Python):
from itertools import product
from math import ceil


def solve(string):
    d, g, *pc = map(int, string.split())
    g //= 100
    p = [_p for _p in pc[::2]]
    c = [_c // 100 for _c in pc[1::2]]
    ans = 1000
    for f in product([True, False], repeat=d):
        sums = sum([(i + 1) * _p + _c for i, (_f, _p, _c) in enumerate(zip(f, p, c)) if _f])
        counts = sum([_p for _f, _p in zip(f, p) if _f])
        if g <= sums:
            ans = min(ans, counts)
            continue

        indices = [i + 1 for i, _f in enumerate(f) if not _f]
        tmp = ceil((g - sums) / indices[-1])
        if tmp < p[indices[-1] - 1]:
            ans = min(ans, counts + tmp)
    return str(ans)


if __name__ == '__main__':
    n, g = map(int, input().split())
    print(solve('{} {}\n'.format(n, g) + '\n'.join([input() for _ in range(n)])))

Solution (Python):
from itertools import product


def solve(string):
    d, g, *pc = map(int, string.split())
    g //= 100
    p = [_p for _p in pc[::2]]
    c = [_c // 100 for _c in pc[1::2]]
    ans = 1000
    for f in product([True, False], repeat=d):
        sums = sum([(i + 1) * _p + _c for i, (_f, _p, _c) in enumerate(zip(f, p, c)) if _f])
        counts = sum([_p for _f, _p in zip(f, p) if _f])
        if g <= sums:
            ans = min(ans, counts)
            continue
        indices = [i + 1 for i, _f in enumerate(f) if not _f]
        for i in range(1, p[indices[-1]-1]):
            if sums + indices[-1] * i >= g:
                ans = min(ans, counts + i)
                break
    return str(ans)


if __name__ == '__main__':
    n, g = map(int, input().split())
    print(solve('{} {}\n'.format(n, g) + '\n'.join([input() for _ in range(n)])))

Solution (Python):
from itertools import product


def solve(string):
    d, g, *pc = map(int, string.split())
    g //= 100
    p = [_p for _p in pc[::2]]
    c = [_c // 100 for _c in pc[1::2]]
    ans = 1000
    for f in product([True, False], repeat=d):
        sums = sum([(i + 1) * _p + _c for i, (_f, _p, _c) in enumerate(zip(f, p, c)) if _f])
        counts = sum([_p for _f, _p in zip(f, p) if _f])
        if g <= sums:
            ans = min(ans, counts)
            continue
        indices = [i + 1 for i, _f in enumerate(f) if not _f]
        for i in range(1, p[indices[-1]-1]):
            if sums + indices[-1] * i >= g:
                ans = min(ans, counts + i)
                break
    return str(ans)


if __name__ == '__main__':
    n, g = map(int, input().split())
    print(solve('{} {}\n'.format(n, g) + '\n'.join([input() for _ in range(n)])))

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

def dfs(s):
    if len(s) == D:
        ans = 1000
        score = 0
        times = 0
        for i in range(D):
            if s[i] == "1":
                score += 100 * (i+1) * p[i] + c[i]
                times += p[i]
        if score >= G:
            ans = min(ans, times)
        else:
            idx = s.rfind("0")
            for i in range(1, p[idx]):
                if score + 100 * (idx+1) * i >= G:
                    ans = min(ans, times+i)
                    break
        return ans
    return min(dfs(s + "0"), dfs(s+ "1"))


print(dfs(""))

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

ans = float('inf')
for i in range(2**D):
    pnt = 0
    cnt = 0
    for j in range(D):
        if ((i >> j) % 2 == 1):
            pnt += p[j]*100*(j+1)+c[j]
            cnt += p[j]
        else:
            unsolved = j
    if pnt >= G:
        ans = min(ans,cnt)
    elif pnt + (p[unsolved]-1)*100*(unsolved+1) >= G:
        if G-pnt < 100*(unsolved+1):
            tmp = 1
        else:
            tmp = (G-pnt)//(100*(unsolved+1))
        ans = min(ans,cnt+tmp)
print(ans)

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

ans = 1e9
for i in range(1 << D):
  cnt = 0
  point = 0
  for j in range(D):
    if(((i >> j) & 1) == 1):
      point += pc[j][0]*100*(j+1) + pc[j][1]
      cnt += pc[j][0]
    else:
      tmp = j
  if(point < G):
    x = G - point
    if((pc[tmp][0]-1)*(tmp+1)*100 < x):
      continue
    cnt += -(-x//(100*(tmp+1)))
  ans = min(ans, cnt)
print(ans)

Solution (Python):
def solve():
    inf = 1 << 60
    D, G = map(int, input().split())
    p = []
    c = []
    for i in range(D):
        pi, ci = map(int, input().split())
        p.append(pi)
        c.append(ci)

    bitD = 1 << D
    min_cnt = inf
    for b in range(bitD):
        sc = 0
        cnt = 0
        for i in range(D):
            if (b & (1 << i)) != 0:
                sc += (i + 1) * 100 * p[i] + c[i]
                cnt += p[i]
        if sc < G:
            for i in range(D-1,-1,-1):
                if (b & (1 << i)) == 0:
                    unit = (i + 1) * 100
                    cnt2 = min((G - sc + (unit - 1)) // unit, p[i] - 1)
                    sc += cnt2 * unit
                    cnt += cnt2
                    break
        if sc >= G:
            min_cnt = min(min_cnt, cnt)

    return min_cnt

print(solve())

Solution (Python):
import numpy as np
D,G=list(map(int,input().split()))
p=np.zeros(D)
c=np.zeros(D)
for i in range(D):
    a,b=list(map(int,input().split()))
    p[i]=a
    c[i]=b
    
def solve(x):  
    score=0
    cost=0
    no_use=0
    
    b=str(format(x,'010b'))
    for i in range(1,D+1):
        if b[-i]=="1": 
            score+=100*i*p[i-1]+c[i-1]
            cost+=p[i-1]
        else:
            no_use=i-1

    if score<G: 
        no_solve=p[no_use]-1
        while(no_solve!=0):
            score+=100*(no_use+1)
            cost+=1
            if score>=G:
                return cost
            no_solve-=1
                
    if score<G:
        return 10**9+7
    return cost

min_cost=10**9+7
for x in range(2**D):
    cost=solve(x)
    if cost<min_cost:
        min_cost=cost
print(int(min_cost))

Solution (Python):
import numpy as np
D,G=list(map(int,input().split()))
p=np.zeros(D)
c=np.zeros(D)
for i in range(D):
    a,b=list(map(int,input().split()))
    p[i]=a
    c[i]=b
    
def calc(i,j):
    if i//j==0:
        return 1
    else:
        return i//j
      
min_cost=10**9+7
for x in range(2**D):
    score=0
    cost=0
    max_no_use=0
    
    b=str(format(x,'010b'))
    for i in range(1,D+1):
        if b[-i]=="1":
            score+=100*i*p[i-1]+c[i-1]
            cost+=p[i-1]
        else:
            max_no_use=abs(i)-1
    shortage=G-score
    if shortage>0:
        add=calc(shortage,100*(max_no_use+1))
        if add<=p[max_no_use]-1:
            cost+=add
            if min_cost>cost:
                min_cost=cost
    else:
        if min_cost>cost:
            min_cost=cost
print(int(min_cost))

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

for x in range(0,D):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)

answer = sum(P)

for x in range(1<<D):
    score = 0
    number = 0
    for i in range(1,D+1):
        if x & (1<<(i-1)) > 0:
            score += P[i]*i*100 + C[i]
            number += P[i]
    
    if score >= G:
        answer = min(answer,number)
        continue

    for i in range(D,0,-1):
        if x & (1<<(i-1)) == 0:
            n = (G-score)//(100*i)
            if n <= P[i]:
                score += 100*i*n
                number += n
            else:
                score += 100*i*P[i]
                number += P[i]
        if score >= G:
            answer = min(answer,number)
            break

print(answer)

Solution (Python):
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

D, G = map(int, input().split())
p = [0]*(D+1)
c = [0]*(D+1)
for i in range(1, D+1):
    p[i], c[i] = map(int, input().split())



ans = int(1e18)
for pat in range(1<<D):
    score = G
    res = 0
    for i in range(1, D+1):
        if pat & (1<<(i-1)) > 0:
            res += p[i]
            score -= i * p[i] * 100 + c[i]
    
    for i in reversed(range(1, D+1)):
        if score <= 0:
            ans = min(ans, res)
            break
        if pat & (1<<(i-1)) == 0:
            now = (score + (i * 100) - 1) // (i * 100)
            if now <= p[i]:
                res += now
                ans = min(ans, res)
                break
            else:
                res += p[i]
                score -= i*100 * p[i]
print(ans)

Solution (Python):
def solve():
    inf = 1 << 60
    D, G = map(int, input().split())
    p = [0]
    c = [0]
    for i in range(D):
        pi, ci = map(int, input().split())
        p.append(pi)
        c.append(ci)
    sump = sum(p)
    
    dp = [[-inf for j in range(sump+1)] for i in range(D+1)]
    dp[0][0] = 0
    for d in range(1,D+1):
        for i in range(sump+1):
            for j in range(p[d]+1):
                if i - j >= 0:
                    dp[d][i] = max(dp[d][i], dp[d-1][i])
                    if dp[d-1][i-j] >= 0:
                        if j != p[d]:
                            dp[d][i] = max(dp[d][i], dp[d-1][i-j] + 100*d*j)
                        else:
                            dp[d][i] = max(dp[d][i], dp[d-1][i-j] + 100*d*j+c[d])
        
    for i in range(sump+1):
        if dp[D][i] >= G:
            return i

print(solve())

Solution (Python):
from copy import copy
D,G=map(int,input().split())
p=[]
c=[]
for i in range(D):
    a,b=map(int,input().split())
    p.append(a)
    c.append(b)
lst1=[]
lst2=[]
lst3=[]
def func1(l1,l2,l3,p,c,G):
    S=0
    n=0
    ind=0
    for i in range(len(l1)):
        S+=c[i]*l1[i]
        n+=p[i]*l1[i]
        S+=p[i]*100*(i+1)*l1[i]
    for i in range(len(l2)):
        if S>=G:
            break
        kazu=len(l2)-i
        a=l2[kazu-1]
        for j in range(1,a+1):
            if j==a:
                break
            S+=100*kazu
            n+=1
            if S>=G:
                break
    if S>=G:
        l3.append(n)
        l3.append(S)
    return 0
def func(l1,l2,l3,num,p,c,G):
    if num==0:
        func1(l1,l2,l3,p,c,G)
        return 0
    y1=copy(l2)
    y2=copy(l2)
    y2[len(l1)]=0
    x1=copy(l1)
    x1.append(0)
    x2=copy(l1)
    x2.append(1)
    num-=1
    return func(x1,y1,l3,num,p,c,G),func(x2,y2,l3,num,p,c,G)
func(lst1,p,lst3,D,p,c,G)
print(min(lst3))

Solution (Python):
import math

D, G = map(int, input().split())
prob = [list(map(int, input().split())) for i in range(D)]
tmp = 100*10

for i in range(1<<D):
    grade = 0
    cnt = 0
    judge = list(range(1, D+1))

    for j in range(D):
        if (i>>j & 1):
            grade += (100*(j+1)*prob[j][0] + prob[j][1])
            cnt += prob[j][0]
            judge[j] = 0

    if grade >= G and tmp > cnt:
        tmp = cnt
        
    num = prob[(max(judge))-1][0]

    if G > grade and num > math.ceil((G - grade)/(max(judge)*100)):
        cnt += math.ceil((G - grade)/(max(judge)*100)) 
        if tmp > cnt:
            tmp = cnt

print(tmp)

Solution (Python):


import sys


D,G = list(map(int, input().split()))
PC = [0]+[list(map(int, input().split())) for _ in range(D)]
 
def function(G, i):
	if i == 0:
		return 1e9
	n = min(G//(i*100), PC[i][0])
	s = n*i*100
	if n == PC[i][0]:
		s += PC[i][1]
	if s < G:
		n += function(G-s, i-1)
	return min(n, function(G,i-1))

print(function(G, D))

Solution (Python):
d,g=map(int,input().split())
PC=[list(map(int,input().split())) for i in range(d)]
P=list(map(lambda x:x[0],PC))
C=list(map(lambda x:x[1],PC))
ans=10**9
def dfs(cur,target):
  if cur==0:
    return 10**9
  cnt=min(target//(cur*100),P[cur-1]) 
  tmp=(100*cur)*cnt
  if cnt==P[cur-1]:
    tmp+=C[cur-1]
  if tmp<target:
    cnt+=dfs(cur-1,target-tmp)       
  return min(cnt,dfs(cur-1,target))
print(dfs(d,g))

Solution (Python):
import sys
input=sys.stdin.readline
d,g=map(int,input().split())
ls=[list(map(int,input().split())) for i in range(d)]
P=list(map(lambda x:x[0],ls))
C=list(map(lambda x:x[1],ls))

tmp=10**9
for i in range(1<<d):
  total=0
  num=0
  for j in range(d):
    if (i>>j)&1:
      total+=C[j]+P[j]*100*(j+1)
      num+=P[j]
  if total>=g:
    tmp=min(num,tmp)
  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
    tmp=min(tmp,num)
print(tmp)