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 itertools
D,G = map(int,input().split())
S = []
for _ in range(D):
    S.append(list(map(int,input().split())))
cmin = 10**4
for x in itertools.product((0,1),repeat=D):
    cnt = 0
    s = 0
    for i in range(D):
        if x[i]==1:
            p,c = S[i][0],S[i][1]
            s += 100*(i+1)*p+c

    if s>=G:
        ind = x.index(1)
        s1 = 0
        for i in range(ind+1,D):
            if x[i]==1:
                s1 += 100*(i+1)*S[i][0]+S[i][1]
                cnt += S[i][0]
        if s1>=G:
            continue
        t = 0
        while t<S[ind][0]:
            s1 += 100*(ind+1)
            cnt += 1
            if s1>=G:
                break
            t += 1
        cmin = min(cmin,cnt)

print(cmin)

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

Solution (Python):
D,G = map(int, input().split())
L = []
for i in range(D):
    L.append([int(x) for x in input().split()])
    
for i in range(D):
    L[i].append(L[i][0]*(i+1)*100+L[i][1])
    
ans_list = []
for i in range(2**D):
    temp = bin(i)
    score = 0
    cnt = 0
    used = []
    for j in range(len(temp)-2):
        if temp[-1-j] == "1":
            score += L[j][2]
            used.append(j)
            cnt += L[j][0]
    num = D-1
    while num in used:
        num -= 1
    for j in range(L[num][0]-1):
        if score < G:
            score += (num+1)*100
            cnt += 1
    if score >= G:
        ans_list.append(cnt)
    
print(min(ans_list))

Solution (Python):
d,g = list(map(int,input().split()))
a = [list(map(int,input().split())) for _ in range(d)]
s = set(range(d))
ans = float("Inf")
x = []
for i in zip(*a):
    x.append(list(i))
c = []
for i in range(2**d):
    b = []
    for j in range(d):
        if i>>j & 1:
            b.append(j)
    c.append(b)
for i in c:
    d = 0
    count = 0
    for j in i:
        d += (100*(j+1)) * a[j][0] + a[j][1]
        count += a[j][0]
    if d < g:
        for x in sorted(s - set(i),reverse=True):
            for y in range(a[x][0]):
                if d >= g:
                    break
                d += 100*(x+1)
                count += 1
    if d < g:continue
    ans = min(ans,count)
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

def ceil(a, b):
    if a%b == 0:
        return a//b
    else:
        return a//b + 1

def main():
    D, G = map(int, input().split())
    G //= 100
    pc = [list(map(int, input().split())) for i in range(D)]

    ans = int(1e9)
    for i in range(2**D):
        tmp = 0
        rest = []
        count = 0
        for j in range(D):
            if i&1:
                tmp += (j+1) * pc[j][0] + pc[j][1]//100
                count += pc[j][0]
            else:
                rest.append((j+1, pc[j][0]))
            i >>= 1
        rest = sorted(rest, reverse=True)
        rest_point = G - tmp
        if rest_point <= 0:
            ans = min(ans, count)
        elif len(rest) > 0:
            plus = ceil(rest_point, rest[0][0])
            if plus < rest[0][1]:
                ans = min(ans, count + plus)
        else:
            pass
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
import copy
d,g=map(int,input().split())
pc=[]
for _ in range(d):
	x,y=map(int,input().split())
	pc.append([x,y])
pcc=copy.deepcopy(pc)
def two(x):
	p=bin(x)
	return "0"*10+p[2:]
q=[]
for i in range(2**d):
	pcc=copy.deepcopy(pc)
	ans=0
	cnt=0
	k=[]
	for j in range(d):
		if two(i)[-j-1]=="1":
			ans+=100*pc[j][0]*(j+1)+pc[j][1]
			cnt+=pc[j][0]
		else:
			k.append(j)
	p=1
	if ans<g:
		while ans<g:
			if p>len(k):
				cnt+=10**15
				break
			if pcc[k[-p]][0]<=1:
				p+=1
			if p>len(k):
				cnt+=10**15
				break
			ans+=(k[-p]+1)*100
			pcc[k[-p]][0]-=1
			cnt+=1
	q.append(cnt)
print(min(q))

Solution (Python):
d,g=[int(_) for _ in input().split()]
l=[0]+[list(map(int,input().split())) for _ in  range(d)]
def f(i,g):
	if i==0:return 10**9
	c=min(g//(100*i),l[i][0])
	s=100*i*c
	if c==l[i][0]:s+=l[i][1]
	if s<g:
		c+=f(i-1,g-s)
	return min(c,f(i-1,g))
print(f(d,g))

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

for _ in range(d):
    P,C = map(int, input().split( ))
    p.append(P)
    c.append(C)
ans = sum(p)

for i in range(2**d):
    comp = []
    non_comp = []
    cnt = [0]*(d+1)
    sm = 0

    for j in range(1,d+1):
        if i>>(j-1) & 1 == 0:
            comp.append(j)
        else:
            non_comp.append(j)
        non_comp.reverse()
    for j in comp:
        sm += p[j]*j*100 + c[j]
        cnt[j] = p[j]
    for j in non_comp:
        if sm >= g:
            break
        cnt[j] = min(p[j]-1, (g - sm)//(j*100) + 1)
        sm += cnt[j]*j*100
        if sm - j*100>=g:
            cnt[j] -= 1
    tot = sum(cnt)
    if sm >=g:
        ans = min(ans, tot)
        

print(ans)

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

ans = 10**9
for i in range(2**D):
    s, num, rest = 0, 0, -1
    for j in range(D):
        if i >> j & 1:
            s += 100 * (j+1) * p[j] + c[j]
            num += p[j]
        else:
            rest = j
    if s < G:
        s1 = 100 * (rest + 1)
        need = ceil((G - s) / s1)
        if need >= p[rest]:
            continue
        num += need
    ans = min(ans, num)

print(ans)

Solution (Python):

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

d, g = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(d)]
toku = [False]*d



def dfs(i, su, cnt):
    
    if (i >= d):
        if (su >= g):  
            return cnt
        
        for j in range(d - 1, -1, -1):
            if (toku[j]):
                continue
            tokuzo = min(p[j][0], math.ceil((g - su) / (100 * (j + 1))))
            if (su + 100 * (j + 1) * tokuzo >= g):
                return cnt + tokuzo
            return 99999

    
    toku[i] = True
    suru = dfs(i + 1, su + (i + 1) * p[i][0]
               * 100 + p[i][1], cnt + p[i][0])
    toku[i] = False
    sinai = dfs(i + 1, su, cnt)
    
    return min(suru, sinai)


print(dfs(0, 0, 0))

Solution (Python):
import math
def solve():
  d,g = (int(i) for i in input().split())
  query = []
  ans = 10**15
  for i in range(d):
    p,c = (int(i) for i in input().split())
    query.append((p,c,(i+1)*100))
  for i in range(2**d):
    ct = 0
    point = 0
    use = [False]*d
    for j in range(d):
      if (i>>j)&1 == 1:
        use[j] = True

    for m in range(d):
      if use[m]:
        tp,tc,ti = query[m]
        ct += tp
        point += ti*tp+tc
        
    if point >= g:
      ans = min(ans,ct)
    else:
        for l in range(d):
          if use[d-l-1]:
            continue
          else:
            tp,tc,ti = query[d-l-1]
            twant = math.ceil((g-point)/ti)
            if tp >= twant:
              point += twant*ti
              ct += twant

            if point >= g:
              ans = min(ans,ct)
              break


            

  print(ans)
    
    
solve()

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

E=[]
for i in range(2**D):
  tmp=0
  cnt=0
  for j in range(D):
    if (i>>(D-j-1))&1:
      tmp+=(j+1)*100*PC[j][0]+PC[j][1]
      cnt+=PC[j][0]
  E.append([cnt,tmp])


for i in range(2**D):
  if E[i][1]<G:
    tmp=0
    cnt=0
    for j in range(D-1,-1,-1):
      if (i>>(D-j-1))&1==0:
        for k in range(PC[j][0]):
          tmp+=100*(j+1)
          cnt+=1
          if E[i][1]+tmp>=G:
            break
      else:
        continue
      break
    E[i][0]+=cnt
    E[i][1]+=tmp


E.sort()


for i in E:
  if i[1]>=G:
    print(i[0])
    break

Solution (Python):
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]
m = 10000
for i in range(2**d):
    cur = bin(i)[2:].zfill(d)
    s = 0
    c = 0
    nu = []
    for i in range(d):
        if cur[i] == '0':
            nu.append(i)
        else:
            s += (i+1) * 100 * pc[i][0] + pc[i][1]
            c += pc[i][0]
    if g > s:
        if g - s <= (nu[-1]+1) * 100 * pc[nu[-1]][0]:
            c += (g-s-1)//((nu[-1]+1)*100)+1
            m = min(c, m)
    else:
        m = min(c, m)
print(m)

Solution (Python):
d,g = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(d)]
m = 10000
for i in range(2**d):
  cur = bin(i)[2:]
  cur = '0' * (d-len(cur)) + cur
  s = 0
  c = 0
  nu = [] 
  for i in range(d):
    if cur[i] == '0':
      nu.append(i)
    else:
      s += (i+1) * 100 * pc[i][0] + pc[i][1]
      c += pc[i][0]
  if s < g:
    if g - s <= (nu[-1]+1) * 100 * pc[nu[-1]][0]:
      c += (g-s-1)//((nu[-1]+1)*100) + 1
      m = min(c,m)
  else:
    m = min(c,m)
print(int(m))

Solution (Python):






d, g = map(int, input().split())
pcs = [list(map(int, input().split()))for _ in range(d)]
"""
2 700
3 500
5 800

2 2000
3 500
5 800
"""





"""
完全に解くか、全くとかないかを総当たり
完全に解く問題の総score

総scoreが目標scoreを上回っている
 -> 手数を保存
scoreを下回っている
 -> 全く解いていない問題の中から 一つ選び、中途半端に解く
    scoreを上回る場合
     -> 手数に数える
    scoreを下回る場合
     -> continue
"""





import math





temp_str = ''
min_nb = float('inf')

for i in range(2**d):
    
    score = 0
    solved_nb = 0
    
    for j in range(d):
        if (i>>j) & 1:
            score += (j+1) * 100 * pcs[j][0] + pcs[j][1]
            
            solved_nb += pcs[j][0]
    
    
    if score >= g:
        min_nb = min(min_nb, solved_nb)
        
        continue
    
    
    
    
    
    
    for j in range(d):
        
        if bin(i>>j)[-1] == '0':
            
            j_nb = math.ceil((g-score)/((j+1)*100))
            
            
            if j_nb <= pcs[j][0]-1:
                min_nb = min(min_nb, solved_nb+j_nb)
                
                
    
print(min_nb)

Solution (Python):






d, g = map(int, input().split())
pcs = [list(map(int, input().split()))for _ in range(d)]
"""
2 700
3 500
5 800

2 2000
3 500
5 800
"""





"""
完全に解くか、全くとかないかを総当たり
完全に解く問題の総score

総scoreが目標scoreを上回っている
 -> 手数を保存
scoreを下回っている
 -> 全く解いていない問題の中から 一つ選び、中途半端に解く
    scoreを上回る場合
     -> 手数に数える
    scoreを下回る場合
     -> continue
"""





import math





temp_str = ''
min_nb = float('inf')

for i in range(2**d):
    
    score = 0
    solved_nb = 0
    
    for j in range(d):
        if (i>>j) & 1:
            score += (j+1) * 100 * pcs[j][0] + pcs[j][1]
            temp_str += '{}ten {}mon {}perf : total {}\n'.format((j+1)*100, pcs[j][0], pcs[j][1], score)
            solved_nb += pcs[j][0]
    
    
    if score >= g:
        min_nb = min(min_nb, solved_nb)
        
        continue
    
    
    
    
    
    
    for j in range(d):
        
        if bin(i>>j)[-1] == '0':
            
            j_nb = math.ceil((g-score)/((j+1)*100))
            score_judge = score + pcs[j][1]*j_nb 
            
            if j_nb <= pcs[j][0]-1 and score_judge > score:
                min_nb = min(min_nb, solved_nb+j_nb)
                temp_str += '{}ten {}mon: total {}\n'.format((j+1)*100, j_nb, (j+1)*100*j_nb)
                
    
print(min_nb)

Solution (Python):
import itertools
D, G = map(int,input().split())
PC = [list(map(int,input().split())) for _ in range(D)]
result = 10**18
for s in itertools.product(range(3), repeat = D):
    s = list(s)
    t = sorted(s, reverse=True)
    idx = 0
    SUM = 0
    ans = 0
    while True:
        if G <= SUM:
            break
        if idx == D:
            ans = 10**18
            break
        if t[idx] == 2:
            SUM += PC[s.index(2)][0] * 100 * (s.index(2)+1) + PC[s.index(2)][1]
            ans += PC[s.index(2)][0]
            s[s.index(2)] = 4
        elif t[idx] == 1:
            if G-SUM >= PC[s.index(1)][0] * 100 * (s.index(1)+1):
                SUM += (PC[s.index(1)][0]-1) * 100 * (s.index(1)+1)
                ans += PC[s.index(1)][0]-1
                s[s.index(1)] == 4
            else:
                if (G-SUM) % (100*(s.index(1)+1)) == 0:
                    ans += (G-SUM) // (100 * (s.index(1)+1))
                    break
                else:
                    ans += ((G-SUM) // (100 * (s.index(1)+1))) + 1
                    break
        idx += 1
    result = min(result, ans)
print(result)

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







def f(G,i):
    if i == 0:
        return float("inf")
    n = min(G//(i * 100),po[i])
    s = 100 * i * n 
    if n == po[i]:
        s += co[i]
    if s < G:
        n += f(G-s,i-1)
    return min(n,f(G,i-1))

print(f(g,d))

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


d, g = LI()
g //= 100
p, c = list(zip(*LIR(d)))
c = [c[i] // 100 for i in range(d)]



ans = INF
for i in range(2 ** d):
    cnt = 0
    score = 0
    for j in range(d):
        if 1 << j & i:
            cnt += p[j]
            score += (j + 1) * p[j]
            score += c[j]


    max_score = -INF
    for k in range(d):
        if not (1 << k) & i:
            max_score = max(max_score, k + 1)
    if score < g:
        remain_num = (g - score) // max_score + bool((g - score) % max_score)
        if remain_num >= p[max_score - 1]:
            continue
        cnt += remain_num
    ans = min(ans, cnt)


print(ans)

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


can = []
for k in range(2 ** D):
    x = [0] * (D+1)
    kk = k
    score = [0] * (D+1)
    count = 0
    for j in range(1,D+1):
        x[j] = kk % 2
        kk //= 2
        score[j] = x[j] * (j * p[j] + c[j]//100)
        count += x[j] * p[j]
    s = sum(score)
    deffer = G//100 - s
    num = D
    left = p[:]
    while deffer > 0 and num > 0:
        if x[num] == 1 or left[num] == 1:
            num -= 1
        else:
            deffer -= num
            left[num] -= 1
            count += 1
    if deffer <= 0:
        
        can.append(count)

print(min(can))

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


can = []
for k in range(2 ** D):
    x = [0] * (D+1)
    kk = k
    score = [0] * (D+1)
    count = 0
    for j in range(1,D+1):
        x[j] = kk % 2
        kk //= 2
        score[j] = x[j] * (j * p[j] + c[j]//100)
        count += x[j] * p[j]
    s = sum(score)
    deffer = G//100 - s
    num = D
    left = p[:]
    while deffer > 0 and num > 0:
        if x[num] == 1 or left[num] == 1:
            num -= 1
        else:
            deffer -= num
            left[num] -= 1
            count += 1
    if deffer <= 0:
        
        can.append(count)

print(min(can))

Solution (Python):
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    D, G = map(int, input().split())
    problems = [[None] * 2 for _ in range(D)]
    ans = float('inf')

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

    for bit in range(1 << D):
        score = 0
        solved = 0
        unsolved = set(range(D))
        for j in range(D):
            if bit & (1 << j):
                score += problems[j][0] * (j+1) * 100 + problems[j][1]
                solved += problems[j][0]
                unsolved.discard(j)

        if score < G:
            use = max(unsolved)
            n = min(problems[use][0]-1, -(-(G - score) // ((use + 1) * 100)))
            score += n * (use + 1) * 100
            solved += n

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

    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")

for bit in range(1 << D):
    count = 0
    sum = 0
    nokori = set(range(1,D+1))

    for i in range(D):
        if bit & (1 << i):
            sum=sum+pc[i][0]*(i+1)*100+pc[i][1]
            count=count+pc[i][0]
            nokori.discard(i+1)
    
    
    if sum<G:
        use=max(nokori)
        n=min(pc[use-1][0], -(-(G-sum)//(use*100)))
        count=count+n
        sum=sum+n*(use*100)
    
    if sum>=G:
        ans=min(ans, count)

print(ans)

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

ans = float("inf")

for bit in range(1 << d):
    count = 0
    sum = 0
    nokori = set(range(1, d + 1))

    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
            nokori.discard(i + 1)

    
    if sum < g:
        use = max(nokori)
        n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= g:
        ans = min(ans, count)

print(ans)

Solution (Python):
D, G = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(D)]
visited = [0] * D
def dfs(s, c):
  temp = 10 ** 3
  for i in range(D):
    if visited[i] == 0:
      visited[i] = 1
      if s >= p[i][0] * (i + 1) * 100 + p[i][1]:
        temp = min(temp, dfs(s - p[i][0] * (i + 1) * 100 - p[i][1], c + p[i][0]))
      else:
        temp = min(temp, -(-s // ((i + 1) * 100)) + c, p[i][0] + c)
      visited[i] = 0
  return temp
print(dfs(G, 0))

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

ans = 10000
for i in range(2**D):
    s = 0
    cnt = 0
    b = [0] * D
    
    
    for j in range(D):
        if (i >> j) & 1:
            s += 100 * (j + 1) * pc[j][0] + pc[j][1]
            cnt += pc[j][0]
            b[j] = 1

    
    flag1 = False
    flag2 = True
    if s < G:
        for k in range(D)[::-1]:
            if b[k] == 0:
                for x in range(pc[k][0]):
                    s += 100 * (k + 1)
                    cnt += 1
                    if s >= G:
                        flag1 = True
                        break
                else:
                    flag2 = False
                    break
            if flag1:
                break

    if flag2:
        ans = min(ans, cnt)


print(ans)

Solution (Python):
def solve(D, G):
    p, c = [], []

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

    each_total = []
    ans = float('inf')

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

    for j in range(1 << D):
        total_ope, total_score = 0, 0
        for k in range(D):
            if j >> k & 1:
                total_score += each_total[k]
                total_ope += p[k]
            else:
                solve_half = k

        for _ in range(p[solve_half]-1):
            if total_score >= G:
                break
            else:
                total_score += 100*(solve_half+1)
                total_ope += 1
        if total_score < G:
            continue

        ans = min(ans, total_ope)

    return ans


if __name__ == '__main__':
    D, G = map(int, input().split())
    print(solve(D, G))

Solution (Python):
from itertools import combinations

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


ans=100*10

for i in range(0,D+1):
	for v in combinations(range(D), i):
		t=0
		s=0
		for j in v:
			t+=p[j]
			s+=p[j]*(j+1)*100 + c[j]
		
		if s<G:
			for j in range(D)[::-1]:
				if j in v:
					pass
				else:
					k=(G-s)//((j+1)*100)
					t+=min(p[j]-1,k)
					s+=min(p[j]-1,k)*(j+1)*100
					
					if s>=G:break
		
		if s>=G:
			ans=min(ans,t)
		
print(ans)

Solution (Python):




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


p=[]
c=[]

for i in range(d):
  pk, ck = map(int, input().split())
  p.append(pk)
  c.append(ck)


  
ans = 10000


for i in range(2 ** d):
  
  ten = 0
  mondaisu = 0
  for j in range(d):
    if (i>>j)&1 == 1:
      
      ten += (j+1)*100*p[j] + c[j]
      mondaisu += p[j]
    else:
      
      k = j
  
  if ten > g:
    if ans > mondaisu:
      ans = mondaisu
  else:
    
    if g-ten <= (k+1)*100*p[k] :
      mondaisu += (g-ten-1)//((k+1)*100) +1
      if ans > mondaisu:
        ans = mondaisu
      

print(ans)

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

def f(G, i):
  if i == 0:
    return float('inf')
  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 += f(G-s, i-1)
  return min(n, f(G,i-1))
 
print(f(G, D))

Solution (Python):

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


ans = float('inf')
for i in range(2**d):
    s = 0
    num = 0
    rest_max = -1
    for j in range(d):
        if (i>>j) & 1:
            s += 100*(j+1)*p[j] + c[j]
            num += p[j]
        else:
            rest_max = j 
    if s<g and rest_max >= 0:
        r = 100*(rest_max+1)
        need = ((g-s)+r-1)//r 
        if need >= p[rest_max]:
            continue
        num += need
    ans = min(ans,num)
print(ans)

Solution (Python):
def func():
    D, G = map(int, input().split())
    p = [0] * D 
    bonus = [0] * D
    for i in range(D):
        p[i], bonus[i] = map(int, input().split())
    
    ans = 10000
    for i in range(2 ** D):
        chosen = []
        for j in range(D):
            if ((i >> j) & 1) == 1:
                chosen.append(j)
        
        pointSum = 0
        Nsolved = 0
        for idx in chosen:
            pointSum += (idx + 1) * 100 * p[idx] + bonus[idx]
            Nsolved += p[idx]
        
        if pointSum >= G:
            ans = min(ans, Nsolved)
        else:
            notChosen = list(filter(lambda x: x not in chosen, list(range(D))))
            highestDimIdx = notChosen[-1]
            
            
            
            

            Nsolved += min(p[highestDimIdx] - 1, -(-(G - pointSum) // ((highestDimIdx + 1) * 100)))
            pointSum += min(p[highestDimIdx] - 1, -(-(G - pointSum) // (highestDimIdx + 1 * 100))) * (highestDimIdx + 1) * 100
            
            if pointSum >= G:
                ans = min(ans, Nsolved)
            

    print(ans)
        
if __name__ == '__main__':
    func()

Solution (Python):
d,g = map(int,input().split())
li = []
for i in range(1,d+1):
	p,c = map(int,input().split())
	li.append([p,i*100*p+c])
ans = 10**5
for i in range(2**d):
	s = t = u =0
	for j in range(d):
		if 1&(i>>j):
			s += li[j][1]
			u += li[j][0]
		else:
			t = max(t,j+1)
	if g <= s:
		ans = min(ans,u)
	elif g <= s + t*100*(li[t-1][0]-1):
		u -= (g-s)//-(100*t)
		ans = min(ans,u)
print(ans)

Solution (Python):
import math

d, g = map(int, input().split())
ls = [[100 * (i + 1)] + list(map(int,
                                 input().split())) for i in range(d)][::-1]
l0 = [a * p + c for a, p, c in ls]

res = float('inf')
for index in range(2**d):
    cs = '{:b}'.format(index)
    cs = '0' * (d - len(cs)) + cs
    count = 0
    s = 0
    for i, c in enumerate(cs):
        if c == '1':
            count += ls[i][1]
            s += l0[i]
    if s < g:
        for i, c in enumerate(cs):
            if c == '0' and s + ls[i][0] * ls[i][1] >= g:
                n = math.ceil((g - s) / ls[i][0])
                count += n
                s += ls[i][0] * n
                break
    if s >= g:
        res = min(res, count)
print(res)

Solution (Python):
from itertools import product
import math

d, g = map(int, input().split())
ps = []
cs = []

for i in range(d):
    pi, ci = map(int, input().split())
    ps.append(pi)
    cs.append(ci)

min_count = 10000000
for pro in product([0,1,2], repeat=d):
    if len([_ for _ in pro if _ == 2]) <= 1:
        tmp_count = 0
        tmp_total = 0
        for i in range(len(pro)):
            if pro[i] == 1:
                tmp_count += ps[i]
                tmp_total += ps[i] * (i+1) * 100 + cs[i]
        if tmp_total >= g:
            min_count = min(min_count, tmp_count)
            continue
        elif 2 in pro and ps[pro.index(2)] * (pro.index(2)+1) * 100 >= g-tmp_total:
            tmp_count += -(-(g-tmp_total) // ((pro.index(2)+1) * 100))
            tmp_total += tmp_count * (pro.index(2)+1) * 100
            min_count = min(min_count, tmp_count)
            continue

print(min_count)

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


def function(g, i):
    if i == 0:
        return 1e9
    n = min(g // (i * 100), p_c[i][0])
    s = n * i * 100
    if n == p_c[i][0]:
        s += p_c[i][1]
    if s < g:
        n += function(g-s, i-1)
    return min(n, function(g, i-1))


print(function(g, d))

Solution (Python):
import itertools
import math

d, g = map(int, input().split())
ls = [[100 * (i + 1)] + list(map(int, input().split())) for i in range(d)]
s0 = [a * p for a, p, _ in ls]
s1 = [a * p + c for a, p, c in ls]

res = float('inf')
for indices in itertools.permutations(range(d)):
    count = 0
    s = 0
    for i in indices:
        if s + s0[i] >= g:
            count += math.ceil((g - s) / (100 * (i + 1)))
            break
        else:
            count += ls[i][1]
            if count >= res:
                break
            s += s1[i]
            if s >= g:
                break
    res = min(res, count)
print(res)

Solution (Python):
D, G = map(int, input().split())
score_list = []
for i in range(D):
    p, c = map(int, input().split())
    score_list.append([(i + 1) * 100] * (p - 1) + [c + (i + 1) * 100])
full_score = [sum(i) for i in score_list]
sol = [format(i, 'b').zfill(D) for i in range(2 ** D)]
ans = []

for i in sol:
    problem = 0
    score = 0
    for j in range(D):
        if i[j] == '1':
            score += full_score[j]
            problem += len(score_list[j])
        else:
            continue
    if score >= G:
        ans.append(problem)
    else:
        if score + full_score[i.rfind('0')] < G:
            continue
        else:
            while score < G:
                score += score_list[i.rfind('0')][0]
                problem += 1
            ans.append(problem)

print(min(ans))

Solution (Python):
D,G = map(int,input().split())
P,C = map(list,zip(*[list(map(int,input().split())) for i in range(D)]))
Solved = []
for i in range(2**D):
    bit = bin(i)[2:].zfill(D)
    solved = 0
    score = 0
    for j in range(D):
        if bit[j] == '1':
            score += (j+1)*100*P[j]+C[j]
            solved += P[j]
    if G-score > 0:
        for j in range(D):
            if bit[-j-1] == '0':
                for k in range(P[-j-1]-1):
                    score += (D-j)*100
                    solved += 1
                    if G-score <= 0:
                        break
            if G-score <= 0:
                break
    if G-score <= 0:
        Solved += [solved]
print(min(Solved))