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):
def dfs(i, sum, count, rest):
    global ans
    if i == d:
        if sum < g:
            rest_max = max(rest)
            n = min(l[rest_max-1][0], -(-(g-sum)//(rest_max*100)))
            count += n
            sum += n * rest_max * 100
        if sum >= g:
            ans = min(ans, count)
    else :
        dfs(i+1, sum, count, rest) 
        dfs(i+1, sum + l[i][0]*(i+1)*100+l[i][1], count + l[i][0], rest - {i+1}) 

d, g = map(int, input().split())
l = [list((map(int, input().split()))) for _ in range(d)]
ans = float("inf")
dfs(0, 0, 0, set(range(1, d+1)))
print(ans)

Solution (Python):
n,k = map(int,input().split())
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append([(i+1)*100,a,b])

ans = 10**10
if k < L[-1][0]*L[-1][1]:
    if k%L[-1][0] != 0:
        ans = (k//L[-1][0]+1)
    else:
        ans = (k//L[-1][0])

for i in range(1<<n):
    li = []
    score,score_zan,cnt = 0,0,0
    for j in range(n):
        if i>>j&1:
            score +=(L[j][0]*L[j][1] + L[j][2])
            cnt +=L[j][1]
            score_zan = k-score
        else:
            li.append(L[j])
    if score > 0 and score_zan <= 0:
        ans = min(ans,cnt)
    li.sort(reverse = True)
    
    if li and score_zan > 0:
        if score_zan < li[0][0]*li[0][1]:
            ans = min(ans,cnt + score_zan//li[0][0])
print(ans)

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

ans = sum(p)
for i in range(2 ** D):
    complete_indexes = [j for j in range(D) if (i >> j) & 1]

    cur_ans = 0
    cur_point = 0
    for j in complete_indexes:
        cur_ans += p[j]
        cur_point += p[j] * 100 * (j + 1) + c[j]

    if cur_point < G:
        incomplete_indexes = [j for j in range(D) if j not in complete_indexes]
        if incomplete_indexes:
            used_index = incomplete_indexes[-1]
            required = (G - cur_point + 100 * (used_index + 1) - 1) // (100 * (used_index + 1))
            cur_ans += min(required, p[used_index])
            cur_point += min(required, p[used_index]) * 100 * (used_index + 1)

    if G <= cur_point and cur_ans < ans:
        ans = cur_ans

print(ans)

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

ans = sum(p)
for i in range(2 ** D):
    complete_indexes = [j for j in range(D) if (i >> j) & 1]

    question = 0
    point = 0
    for j in complete_indexes:
        question += p[j]
        point += p[j] * 100 * (j + 1) + c[j]

    if point < G:
        incomplete_indexes = [j for j in range(D) if j not in complete_indexes]
        if incomplete_indexes:
            index = incomplete_indexes[-1]
            required_question = (G - point + 100 * (index + 1) - 1) // (100 * (index + 1))
            question += min(required_question, p[index])
            point += min(required_question, p[index]) * 100 * (index + 1)

    if G <= point and question < ans:
        ans = question

print(ans)

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

    c = min(g//(100*d), PC[d][0])
    s = 100*d*c
    if c == PC[d][0]:
        s += PC[d][1]
    if s<g:
        c += dfs(d-1, g-s)
    return min(c, dfs(d-1,g))

print(dfs(D, G))

Solution (Python):










d, goal = list(map(int, input().split()))
problems = [list(map(int, input().split())) for _ in range(d)]

ans = 10 ** 6 * 10 * 2
for completed in range(2 ** d):
    
    point_all = 0
    num_problem = 0

    
    for point in range(d):
        if (completed & 2 ** point) > 0:
            point_all += 100 * (point+1) * problems[point][0]
            point_all += problems[point][1]
            num_problem += problems[point][0]
    
    if point_all < goal:
        for point in reversed(range(d)):
            if (completed & 2 ** point) == 0:
                p = (100 * (point+1))
                n = (goal - point_all + p - 1) // p
                n = min(problems[point][0], n)

                point_all += n * p  
                num_problem += n

                if point_all >= goal:
                    break

    
    if point_all >= goal and num_problem < ans:
        ans = num_problem

print(ans)

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

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

def calc(P):
  count = 0
  g = G
  for i in range(D):
    p,c = pc[-1-i]
    if P[-1-i]==1:
      count += p
      g -= (D-i)*100*p+c
    if g<=0:
      return count
  for i in range(D):
    p,c = pc[-1-i]
    if P[-1-i]==0:
      tmp = min(p-1,ceil(g/((D-i)*100)))
      count += tmp
      g -= (D-i)*100*tmp
    if g<=0:
      return count
  return -1

MIN=10**9
for P in product(range(2),repeat=D):
  tmp = calc(P)
  if tmp != -1 and tmp < MIN: MIN=tmp
    
print(MIN)

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())
qu = [0] * D
bonus = [0] * D
for i in range(D):
  a, b = map(int, input().split()) 
  qu[i] = a
  bonus[i] = b
  
ans = 10 ** 5  
for i in range(2 ** D):
  score = 0
  nn = 0
  yet = [0] * D
  for j in range(D):
    if (i >> j) & 1:
      score += 100 * (j + 1) * qu[j] + bonus[j]
      nn += qu[j]
      yet[j] = 1
  if score >= G:
    ans = min(ans, nn)
  else:
    
    con = 0
    for k in range(1, D + 1):
      if con == 0:
        if yet[D - k] == 0:
          now = 100 * (D - k + 1) * (qu[D - k] - 1)
          if now + score >= G:
            subt = G - score
            nn += int((subt - 1) / (100 * (D - k + 1))) + 1
            ans = min(ans, nn) 
            con = 1
          else:
            score += now
            nn += qu[D - k] - 1
  
print(ans)

Solution (Python):
import math 
D, G = map(int, input().split())
K = [list(map(int, input().split())) for _ in range(D)]
G //= 100
def settify(i):
  s = []
  t = []
  for j in range(D):
    if i % 2 == 0:
      t.append(j)
    else:
      s.append(j)
    i = i>>1
    
  return s,t

ans = 10**20  
for i in range(2**D):
  s, t = settify(i)
  pt = sum([K[j][0]*(j+1)+K[j][1]//100 for j in s])
  tmp = sum([K[j][0] for j in s])
  
  
  while pt < G and t:
    
    tmp += min(K[t[-1]][0]-1,math.ceil((G-pt)/(t[-1]+1)))
    pt += min(K[t[-1]][0]-1,math.ceil((G-pt)/(t[-1]+1)))*(t[-1]+1)
    t.pop()
  
  if pt < G:
    continue
  ans = min(ans, tmp)
    
print(ans)

Solution (Python):
n , g = map(int , input().split())
pt = []
for i in range(0 , n):
	pt.append(list(map(int , input().split())))



ans = 10**9+89
for i in range(0 , (1<<n)):
	tot , cnt = 0 , 0 
	partial=-1
	for j in range(0 , n):
		if (i & (1<<j)):
			cnt = cnt+pt[j][0]
			tot = tot + (100)*(j+1)*pt[j][0]+pt[j][1]
		else:
			partial =j
	if tot<g:
		a = 100*(partial+1)
		rem = (g-tot+a-1)//a
		if rem>=pt[partial][0]:
			continue
		cnt =cnt+rem
	ans = min(ans, cnt)
print(ans)

Solution (Python):
import itertools
import math
d,g=map(int,input().split())
x=[list(map(int,input().split())) for i in range(d)]
y=[]
z=[x[i][0]-1 for i in range(d)]
zz=[]
ans=10**10

pin=0
for i in range(d):
  pin+=100
  y.append(x[i][0]*pin+x[i][1])
  zz+=[pin]

for lst in itertools.product(range(2),repeat=d):
  sum=0
  cnt=0
  for i in range(d):
    if lst[i]==1:
      cnt+=x[i][0]
      sum+=y[i]
  if sum>=g:
      ans=min(ans,cnt)
  else:
    lack=g-sum
    for j in range(d-1,-1,-1):
      if lst[j]==0:  
        if z[j]*zz[j]>=lack:
            cnt+=math.ceil(lack/zz[j])
            ans=min(ans,cnt)         
            break
        else:
            cnt+=z[j]
            lack-=z[j]*zz[j]
    

print(ans)

Solution (Python):
import itertools
import math
d,g=map(int,input().split())
x=[list(map(int,input().split())) for i in range(d)]
y=[]
z=[x[i][0]-1 for i in range(d)]
zz=[]
ans=10**10

pin=0
for i in range(d):
  pin+=100
  y.append(x[i][0]*pin+x[i][1])
  zz+=[pin]

for lst in itertools.product(range(2),repeat=d):
  sum=0
  cnt=0
  for i in range(d):
    if lst[i]==1:
      cnt+=x[i][0]
      sum+=y[i]
  if sum>=g:
      ans=min(ans,cnt)
  else:
    lack=g-sum
    for j in range(d-1,-1,-1):
      if lst[j]==0:  
        if z[j]*zz[j]>=lack:
            cnt+=math.ceil(lack/zz[j])
            ans=min(ans,cnt)         
            break
        else:
            cnt+=z[j]
            lack-=z[j]*zz[j]
    

print(ans)

Solution (Python):
import itertools
import math
d,g=map(int,input().split())
x=[list(map(int,input().split())) for i in range(d)]
y=[]
z=[x[i][0]-1 for i in range(d)]
zz=[]
ans=10**10

pin=0
for i in range(d):
  pin+=100
  y.append(x[i][0]*pin+x[i][1])
  zz+=[pin]

for lst in itertools.product(range(2),repeat=d):
  sum=0
  cnt=0
  for i in range(d):
    if lst[i]==1:
      cnt+=x[i][0]
      sum+=y[i]
  if sum>=g:
      ans=min(ans,cnt)
  else:
    lack=g-sum
    for j in range(d-1,-1,-1):
      if lst[j]==0:  
        if z[j]*zz[j]>=lack:
            cnt+=math.ceil(lack/zz[j])
            lack=0
            break
        else:
            cnt+=z[j]
            lack-=z[j]*zz[j]
    if lack<=0:
      ans=min(ans,cnt)

print(ans)

Solution (Python):


import math

import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd


d,g=map(int,input().split())
g=g//100
pc=[list(map(int,input().split())) for _ in range(d) ]
s=[0]*d
for i in range(d):
    p,c=pc[i]
    s[i]=(i+1)*p+c//100
n=2**d
ans=10**4
for i in range(0,n):
    res=0
    q=0
    for j in range(d):
        if i & (1<<j):
            res+=s[j]
            q+=pc[j][0]
    if g>res:
        q_b=q
        for j in range(d):
            if i & (1<<j):
                continue
            else:
                if (g-res)//(j+1)<pc[j][0]:
                    q_b=q+math.ceil((g-res)/(j+1))
                    ans=min(ans,q_b)
    else:
        ans=min(ans,q)
print(ans)

Solution (Python):
d, g = map(int, input().split())
p, c = [], []
for _ in range(d):
    tmp_p, tmp_c = map(int, input().split())
    p.append(tmp_p)
    c.append(tmp_c)

res = float('inf')
for i in range(2**d):
    num = 0
    score = 0
    flag = [False] * d
    for j in range(d):
        if (i >> j) & 1:
            num += p[j]
            score += 100 * (j + 1) * p[j] + c[j]
            flag[j] = True
    
    if score >= g:
        res = min(res, num)
        continue
    
    for j in range(d-1, -1, -1):
        if flag[j]:
            continue

        if score + 100 * (j + 1) * p[j] < g:
            num += p[j]
            score += 100 * (j + 1) * p[j]
            continue
        else:
            n = ((g - score) + (100 * (j + 1)) - 1) // (100 * (j + 1))
            num += n
            break
    
    res = min(res, num)

print(res)

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

for i in range(1<<D):
  s=0
  n=0
  for j in range(D):
    if i>>j&1==1:
      s+=100*(j+1)*P[j][0]+P[j][1]
      n+=P[j][0]
  for j in range(D-1,-1,-1):
    if i>>j&1==0:
      r = ((G-s)//100+j)//(j+1)
      if r>P[j][0]:
        n = 1000
      else:
        n+=max(r,0)
      break
  ans=min(ans,n)

print(ans)

Solution (Python):
d , g = map(int,input().split())
poi = [tuple(map(int,input().split())) for i in range(d)]
ans = 10**5
for i in range(2**d):
    cou = 0
    ten = 0
    for j in range(d):
        if i >> j & 1 == 1:
            cou += poi[j][0]
            ten += poi[j][1] + (j+1)*100*poi[j][0]
    for j in reversed(range(d)):
        if ten >= g:
            break
        if i >> j & 1 != 1:
            if g - ten > (j+1)*100*(poi[j][0]-1):
                cou += poi[j][0] - 1
                ten += (j+1)*100*(poi[j][0]-1)
            elif g - ten <= (j+1)*100*(poi[j][0]-1):
                cou -= (ten-g)//((j+1)*100)
                ten = g
                break
    if ten >= g:
        ans = min(ans,cou)
print(ans)

Solution (Python):










d, goal = list(map(int, input().split()))
problems = [list(map(int, input().split())) for _ in range(d)]

ans = 10 ** 6 * 10 * 2
for completed in range(2 ** d):
    
    point_all = 0
    num_problem = 0

    
    for point in range(d):
        if (completed & 2 ** point) > 0:
            point_all += 100 * (point+1) * problems[point][0]
            point_all += problems[point][1]
            num_problem += problems[point][0]
    
    if point_all < goal:
        for point in reversed(range(d)):
            if (completed & 2 ** point) == 0:
                p = (100 * (point+1))
                n = (goal - point_all + p - 1) // p
                n = min(problems[point][0], n)

                point_all += n * p  
                num_problem += n

                if point_all >= goal:
                    break

    
    if point_all >= goal and num_problem < ans:
        ans = num_problem

print(ans)

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


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

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

    else:
        dfs(i+1, sum, count, nokori)
        dfs(i+1, sum + pc[i][0] * (i+1) * 100 + pc[i][1], count + pc[i][0], nokori - {i+1})

ans = float("inf")
dfs(0, 0, 0, set(range(1, d+1)))
print(ans)

Solution (Python):
import sys
import itertools

import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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 = INF
for i in range(1 << D):
    points = 0
    solved = 0
    for j in range(D):
        if i & 1 << j > 0:
            points += C[j]
            points += P[j] * (j + 1) * 100
            solved += P[j]

    left = G - points
    for j in range(D - 1, -1, -1):
        if left <= 0:
            break
        if i & 1 << j > 0:
            continue
        val = min(100 * (j + 1) * (P[j] - 1), left)
        left -= val
        if val % (100 * (j + 1)) != 0:
            solved += val // (100 * (j + 1)) + 1
        else:
            solved += val // (100 * (j + 1))

    if left > 0:
        continue
    ans = min(ans, solved)
print(ans)

Solution (Python):
D, G = map(int, input().split())
T = []
acc = 0
for i in range(D):
    p, c = map(int, input().split())
    acc += p
    T.append([p, c])
dp = [[0]*(acc+1) for _ in range(D+1)]
l = 0
for i in range(1, D + 1):
    for j in range(1, acc + 1):
        l += T[i-1][0]
        for k in range(T[i-1][0] + 1):
            if j <= l and j - k >= 0:
                if k == T[i-1][0]:
                    dp[i][j] = max([dp[i - 1][j - k] + 100 * i * k + T[i - 1][1], dp[i - 1][j]])
                else:
                    dp[i][j] = max([dp[i - 1][j - k] + 100 * i * k, dp[i - 1][j]])

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

Solution (Python):
import itertools
D, G = [int(_) for _ in input().split()]
SPC = [[100 * (i + 1)] + [int(_) for _ in input().split()]
       for i in range(D)][::-1]
ans = 10**10
for i in range(D + 1):
    completes = set(itertools.combinations(range(D), i))
    for complete in completes:
        incomplete = sorted(set(range(D)) - set(complete))
        score = 0
        cnt = 0
        f = 0
        for j in complete:
            s, p, c = SPC[j]
            score += s * p + c
            cnt += p
        for j in incomplete:
            if score >= G:
                break
            s, p, c = SPC[j]
            d = min(p - 1, 1 + (G - score - 1) // s)
            score += s * d
            cnt += d
        if score >= G:
            ans = min(ans, cnt)
print(ans)

Solution (Python):
d, g = map(int, input().split())
pc = [tuple(map(int, input().split())) for _ in range(d)]
ans = 1001001001
for s in range(1 << d):
    now = 0
    rest = g
    for i in range(d):
        if s >> i & 1:
            p, c = pc[i]
            rest -= p * (i+1) * 100 + c
            now += p
    if rest > 0:
        free = d-1
        while d >= 0 and s >> free & 1:
            free -= 1
        if free < 0:
            continue
        t = (rest + (free+1) * 100 - 1) // ((free+1) * 100)
        
        if t >= pc[free][0]:
            continue
        now += t
    ans = min(ans, now)
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):
    _sum = 0
    _ans = 0
    rest = [i for i in range(D)]
    for i in range(D):
        if bit & (1<<i):
            _sum += pc[i][0]*(i+1)*100 + pc[i][1]
            _ans += pc[i][0]
            rest.remove(i)
    if _sum < G and len(rest) != 0:
        i = max(rest)
        for j in range(pc[i][0]-1):
            _sum += (i+1)*100
            _ans += 1
            if _sum >= G:
                break
    if _sum >= G:
        ans = min(ans,_ans)
print(ans)

Solution (Python):
d,g=map(int,input().split())
v=[list(map(int,input().split())) for i in range(d)]
ans=1000
for i in range(1<<d):
  s=0
  n=0
  for j in range(d):
    if i>>j&1 == 1:
      s += v[j][0] * (j+1) * 100 + v[j][1]
      n += v[j][0]
  for j in range(d-1,-1,-1):
    if i>>j&1 == 0:
      r = ((g-s)//100 + j) // (j+1)
      if r>v[j][0]:
        n = 1000
      else:
        n += max(r,0)
      break
  ans=min(ans,n)
print(ans)

Solution (Python):
import numpy as np

D, G, *pc = map(int, open(0).read().split())
pc = list(zip(*[iter(pc)]*2))
p, c = np.array([]), np.array([])
for (x,y) in pc:
    p = np.append(p, x)
    c = np.append(c, y)
    
import numpy as np
import math

base_points = np.array([i*100 for i in range(1, D+1)])

ans = []

for i in range(2**D):
    bit_flag = np.array(list(map(int, format(i, '0%db' %D))))
    points = sum(bit_flag * (c + p*base_points))
    solved_num = sum(bit_flag * p)
    
    if points >= G:
        ans.append(solved_num)

    else:
        remained = G - points
        remained_problems = sorted((bit_flag==False) * np.array(range(1, D+1)), reverse=True)
        i = 0

        while True:
            if remained <= 0:
                break
                
            highest_p = remained_problems[i]

            if math.ceil(remained / (highest_p * 100)) <= p[highest_p - 1]:
                solved_num += math.ceil(remained / (highest_p * 100))
                remained -= (math.ceil(remained / (highest_p * 100)) * highest_p * 100)
            else:
                solved_num += p[highest_p - 1]
                remained -= (highest_p * 100 * p[highest_p - 1] + c[highest_p - 1])
                i += 1

        ans.append(solved_num)
        
print(int(min(ans)))

Solution (Python):
import sys
import numpy as np
import math
import collections
import copy
from collections import deque 
from functools import reduce
from itertools import product



D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
ans = 10**8
for p in product((0, 1), repeat=D):
    nmax = -1
    num = 0
    total = 0
    need = 0
    for i, pi in enumerate(p):
        if pi == 1:
            num += pc[i][0]
            total += pc[i][0]*(i+1)*100 + pc[i][1]
        else:
            nmax = i


    if total < G:
        if nmax < 0:
            continue
        if total + nmax * 100 * pc[nmax][0] + pc[nmax][1] < G:
            continue
        need = math.ceil((G-total) / ((nmax+1)*100))
    ans = min(ans, num+need)


print(ans)

Solution (Python):
import sys
import numpy as np
import math
import collections
import copy
from collections import deque 
from functools import reduce
from itertools import product



D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
ans = 10**8
for p in product((0, 1), repeat=D):
    nmax = -1
    num = 0
    total = 0
    need = 0
    for i, pi in enumerate(p):
        if pi == 1:
            num += pc[i][0]
            total += pc[i][0]*(i+1)*100 + pc[i][1]
        else:
            nmax = i


    if total < G:
        if nmax < 0:
            continue
        if total + nmax * 100 * pc[nmax][0] + pc[nmax][1] < G:
            continue
        need = (G - total + ((nmax+1)*100-1)) // ((nmax+1)*100)
    ans = min(ans, num+need)


print(ans)

Solution (Python):
from itertools import groupby, accumulate, product, permutations, combinations
def solve():
  ans = 2000
  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())
  for p in product([0,1],repeat=D):
    if sum(p)<D:
      for i in range(D-1,-1,-1):
        if p[i]==0:
          maxi = i
          break
    cnt = 0
    score = 0
    for i in range(D):
      if p[i]==1:
        score += (i+1)*100*P[i]+C[i]
        cnt += P[i]  
    if -(-(G-score)//(100*(maxi+1)))>=P[maxi]:
      continue
    if G>score:
      cnt += -(-(G-score)//(100*(maxi+1)))
    ans = min(ans,cnt)
  return ans
print(solve())

Solution (Python):
import math

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

ans = float("inf")
for i in range(1 << d):
    score = 0
    took = 0
    not_took = []
    for j in range(d):
        p, c = pc[j]
        if i & 1 << j:
            score += (j + 1) * 100 * p + c
            took += p
        else:
            not_took.append(j)
    if score >= g:
        ans = min(ans, took)
    elif len(not_took) != 0:
        last = not_took[-1]
        need = math.ceil((g - score) / ((last + 1) * 100))
        if need <= pc[last][0]:
            ans = min(ans, took+need)
print(ans)

Solution (Python):
import collections

d,g =  map(int, raw_input().split())
cc = {0:0}
picis = [map(int,raw_input().split()) for _ in range(d)]

pisum = sum([pi for pi,ci in picis] or [0])
for i in range(len(picis)):
	pi,ci = picis[i]
	for p in range(1, pisum + 1)[::-1]:
		for q in range(1, pi + 1):
			if p - q >= 0 and (p - q) in cc:
				cc[p] = max(cc[p] if p in cc else -float('inf'),  cc[p - q] + (100 * q * (i + 1)) + (ci if pi == q else 0))

for k in range(pisum+1):
	if cc[k] >= g:
		print k
		break

Solution (Python):
d,g = map(int,input().split())
pc = [0]*d
for i in range(d):
    pc[i] = list(map(int,input().split()))
ans_new = float("inf")
for i in range(1<<d):
    num = 0
    ans = 0
    for j in range(d):
        if (i >> j)%2 == 1:
           num += pc[j][0]*(j+1)*100 + pc[j][1]
           ans += pc[j][0]
    if num < g:
        dum = 0
        for k in range(d):
            if (i >> k)%2 == 0:
               dum = k
        for l in range(pc[dum][0]):
            num += (dum+1)*100
            ans += 1
            if num >= g:
                break
        else:
            continue
    ans_new = min(ans,ans_new)
print(ans_new)

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

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

    ans = 1000
    for i in range(2 ** D):
        comp = [0 for _ in range(D)]
        num = 0
        score = 0
        for j in range(D):
            if i >> j & 1:
                comp[j] = 1
                
                score += 100 * (j + 1) * p[j] + c[j]

        for j in range(D):
            if comp[j] == 1:
                num += p[j]
        if score < G:
            index = 0
            for j in range(D - 1, 0, -1):
                if comp[j] == 0:
                    index = j
                    break
            for _ in range(p[index]):
                score += 100 * (index + 1)
                num += 1
                if score >= G:
                    break
            if score < G:
                continue
        
        
        
        ans = min(ans, num)
    print(ans)


if __name__ == "__main__":
    solve()

Solution (Python):
D, G = map(int, input().split())
p = []
c = []
for _ in range(D):
    p_i, c_i = map(int, input().split())
    p.append(p_i)
    c.append(c_i)
answer = 10 ** 10

for bit in range(2 ** D):
    score, solution_count, rest_max = 0, 0, 0
    for i in range(D):
        if bit & (1 << i):
            score += 100 * (i + 1) * p[i] + c[i]
            solution_count += p[i]
        else:
            rest_max = i + 1

    if score < G and rest_max:
        if (G - score) % (100 * rest_max) == 0:
            need_count = (G - score) // (100 * rest_max)
        else:
            need_count = (G - score) // (100 * rest_max) + 1
        if need_count > p[rest_max - 1]:
            continue
        else:
            score += 100 * rest_max * need_count
            solution_count += need_count

    if score >= G:
        answer = min(answer, solution_count)
print(answer)

Solution (Python):
from copy import deepcopy
from math import ceil
d,g=map(int,input().split())
lst=[]
for i in range(1,d+1):
    p,c=map(int,input().split())
    lst.append([i*100,p,c])
ans=1145141919
for p in range(d):
    tmp=deepcopy(lst)
    tmp=tmp[:p]+tmp[p+1:]
    for i in range(2**(d-1)):
        point=0
        problem=0
        for j in range(d-1):
            if (i>>j)&1:
                point+=tmp[j][0]*tmp[j][1]+tmp[j][2]
                problem+=tmp[j][1]
        if point<g:
            extra=g-point
            if extra>lst[p][0]*lst[p][1]+lst[p][2]:
                continue
            if extra>lst[p][0]*lst[p][1]:
                ans=min(ans,problem+lst[p][1])
                continue
            problem+=ceil(extra/lst[p][0])
        ans=min(ans,problem)

print(ans)

Solution (Python):
D, G = map(int, input().split())
probs = [tuple(map(int, input().split())) for _ in range(D)]
res = 10 ** 4
for i in range(1 << D):
    comps = []
    idx = -1
    for j in range(D):
        if (i >> j) & 1:
            comps.append(j)
        else:
            idx = j
    g = G
    tmp = 0
    for c in comps:
        g -= 100 * (c + 1) * probs[c][0] + probs[c][1]
        tmp += probs[c][0]
    if g <= 0:
        res = min(res, tmp)
        continue
    else:
        t = (g + 100 * (idx + 1) - 1) // (100 * (idx + 1))
        if t <= probs[idx][0]:
            tmp += t
            res = min(res, tmp)
print(res)

Solution (Python):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

d,g=MI()
lis=[LI() for i in range(d)]
pr=[]
for x in product([0,1],repeat=d):
    
    score=0
    pro=0
    for i in range(d):
        if x[i]==1:
            score+=100*(i+1)*lis[i][0]+lis[i][1]
            pro+=lis[i][0]
    if score>=g:
        pr.append(pro)
    else:
        rest=g-score
        
        for i in range(d):
            j=d-i-1
            if x[j]==0:
                pro+=min(ceil(rest/(100*(j+1))),lis[j][0]-1)
                rest-=100*(j+1)*min(ceil(rest/(100*(j+1))),lis[j][0]-1)
            if rest<=0:
                pr.append(pro)
                break
        else:
            continue
        
print(min(pr))