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 functools
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

@functools.lru_cache(maxsize=None)
def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[1] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += j * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        np = f(i - 1, rn - n)
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)

Solution (Python):
d,g=map(int,input().split())
l=[list(map(int,input().split())) for i in range(d)]
ans=float('inf')
for i in range(2**d):
  a=[]
  b=[]
  s=0
  sg=g
  for j in range(d):
    if (i>>j)&1:
      a.append(j)
    else:
      b.append(j)
  if a:
    for k in a:
      sg-=100*(k+1)*l[k][0]+l[k][1]
      s+=l[k][0]
  if sg>0:
    if b:
      for m in range(1,l[b[-1]][0]):
        sg-=100*(b[-1]+1)
        s+=1
        if sg<=0:
          ans=min(ans,s)
          break
  else:
    ans=min(ans,s)
print(ans)

Solution (Python):
import math
length, goal = map(int, input().split(" "))
nums = []
sumall = []
for i in range(length):
    a, b = map(int, input().split(" "))
    nums.append(a)
    sumall.append(a * (i + 1) * 100 + b)
answer = float("inf")
for bit in range(2 ** length):
    temp = []
    for i in range(length - 1, -1, -1):
        if bit & (1 << i):
            temp.append(i)
    temp_length = len(temp)
    for tempbit in range(2 ** temp_length):
        temp_sum = 0
        choosed = 0
        for i in range(temp_length):
            if tempbit & (1 << i):
                temp_sum += sumall[temp[i]]
                choosed += nums[temp[i]]
                if temp_sum >= goal:
                    answer = min(answer, choosed)
                    break
            else:
                if temp_sum + (nums[temp[i]] - 1) * (temp[i] + 1) * 100 >= goal:
                    answer = min(answer, choosed + int(math.ceil((goal - temp_sum) / (100 * (temp[i] + 1)))) )
                    break
                temp_sum += (nums[temp[i]] - 1) * (temp[i] + 1) * 100
                choosed += nums[temp[i]] - 1
        
    
print(answer)

Solution (Python):
D, G = map(int, input().split())
PC = []
for i in range(D):
    p, c = list(map(int, input().split()))
    s = (i+1) * 100
    PC.append([p, c, s])

P = []
for i in range(2 ** D):
    b = format(i, 'b').zfill(D)
    P.append(b)

def get_high_score_q(p):
    if p.count('0') == 0:
        return None
    else:
        pos = []
        for i, pi in enumerate(p):
            if pi == '0':
                pos.append(i)
        return pos[-1]

ans = 10 ** 10

for pi in P:
    
    scores = 0
    probs = 0
    for i, b in enumerate(pi):
        if b == '0':
            pass
        elif b == '1':
            pc = PC[i]
            scores += pc[0] * pc[2] + pc[1]
            probs += pc[0]
        else:
            raise Exception()

    
    if scores < G:
        q = get_high_score_q(pi)
        pc = PC[q]
        for i in range(pc[0]):
            scores += pc[2]
            probs += 1
            if scores >= G:
                break
    
    if scores >= G:
        ans = min(ans, probs)

print(ans)

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

ans = g // 100

for i in range(2 ** d):
    total = 0
    correct = 0
    for j in range(d):
        if (i >> j) & 1:
            correct += S[j][0] 
            total += S[j][0] * (j+1) * 100 + S[j][1]
        else:
            biggest = j

    if total >= g:
        ans = min(correct,ans)
    elif total + (S[biggest][0] - 1) * (biggest+1) * 100 < g:
        continue
    else:
        while total < g:
            total += (biggest+1) * 100
            correct += 1
        ans = min(correct,ans)

print(ans)

Solution (Python):

import numpy as np
import sys
sys.setrecursionlimit(100000)



def acinput():
    return list(map(int, input().split(" ")))





D,G=acinput()


s=[]
for i in range(D):
    s.append(acinput())



res=10**9
for i in range(2**D):
    d = list(map(int,list(bin(i)[2:].zfill(D))))
    
    resid=False
    nquestions=0
    sm=0
    for k in range(D):                
        if d[k]==1:
            sm+=s[k][0]*(100*(k+1))+s[k][1]
            nquestions+=s[k][0]
        else:
            resid=k+1

    needs=0
    if G>sm:
        needs=np.ceil((G-sm)/(100*resid))
        if needs>=s[resid-1][0]:
            continue

    res=min(res,nquestions+needs)
    



print(int(res))

Solution (Python):
d,g = map(int, input().split())
g //= 100
p = [0]*d
c = [0]*d
for i in range(d):
  x,y = map(int, input().split())
  p[i] = x
  c[i] = y//100

ans = sum(p)
for bit in range(1<<d):
  t = -1
  cur = 0
  ret = 0
  for i in range(d):
    if bit & (1<<i):
      cur += p[i]*(i+1) + c[i]
      ret += p[i]
    else:
      t = i
  if cur >= g:
    if ans > ret:
      ans = ret
  else:
    h = (g-cur-1)//(t+1) + 1
    if h <= p[t]:
      ret += h
      if ret < ans:
        ans = ret
print(ans)

Solution (Python):

import sys
import math
import os
import itertools

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]

class Util():
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Util.round_up(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x

D,G = cin.mapInt()
P = cin.intListList(D)

ans = int(1e09)
for i in range(1 << D):
    point = 0
    cnt = 0
    for j in range(D):
        if i >> j & 1:
            cnt += P[j][0]
            point += P[j][0] * (j + 1) * 100 + P[j][1]
    if point >= G:
        ans = min(ans,cnt)
        continue
    for j in reversed(range(D)):
        if not i >> j & 1:
            p = (j + 1) * 100
            c = min(P[j][0],Util.roundUp(G - point,p))
            cnt += c
            point += c * p
            if point >= G:
               break
    ans = min(ans,cnt)

print(ans)

Solution (Python):
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True  and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

d,g = inm()
p = []
c = []
for i in range(d):
    pp,cc = inm()
    c.append(cc)
    p.append(pp)

mn = BIG
for i in range(2**d):
    s = [0]*d
    for j in range(d):
        s[j] = (i>>j)%2  
    ddprint("i {} s {}".format(i,s))
    np = 0
    sc = 0
    for j in range(d):
        if s[j]==1:
            sc += 100*(j+1)*p[j] + c[j]
            np += p[j]
    ddprint("full sc {} np {}".format(sc,np))
    if sc<g:
      for j in range(d-1,-1,-1): 
        if s[j]==1:
            continue
        for k in range(p[j]-1):
            np += 1
            sc += 100*(j+1)
            if sc >= g:
                break
        break
    ddprint("all sc {} np {}".format(sc,np))
    if sc>=g and np<mn:
        mn = np
print(mn)

Solution (Python):


D, G = map(int, input().split())
from itertools import chain

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

L = []
for i in range(2**D):
  T = []
  for j in range(D):
    if (i>>j) & 1:
      T.append(j)
  L.append(T)

X = []
for l in L:
  score, count = 0, 0
  for m in l:
    p, c = S[m]
    score += c + (m+1) * 100 * p
    count += p
  else:
    X.append((score,count,l))

ans = float("inf")
for l in X:
  score, count, indexes = l

  if score >= G:
    ans = min(ans, count)
    continue
  
  end = False
  for i in list(range(D))[::-1]:
    if i in indexes:
      continue

    if end:
      break
    
    p, c = S[i]
    for _ in range(p):
      count += 1
      score += (i+1) * 100
      if score >= G:
        ans = min(ans, count)
        end = True
        break

print(ans)

Solution (Python):
D, G = [int(x) for x in input().split(" ")]

p = [0]
c = [0]

for i in range(D):
    pi, ci = [int(x) for x in input().split(" ")]
    p.append(pi)
    c.append(ci)

a = list()
for i in range(2**D):
    m = 0
    s = 0
    solves = 0
    for j in range(D):
        if i & (1<<j):
            s += 100 * (j+1) * p[j+1] + c[j+1]
            solves += p[j+1]
        else:
            if m < j+1:
                m = j+1

    if s < G:
        for j in range(1, p[m]):
            s += 100 * m
            solves += 1
            if s >= G:
                break

    if s >= G:
        a.append(solves)

print(min(a))

Solution (Python):
dp = [[0 for n in range(1001)] for m in range(11)]
length, goal = map(int, input().split(" "))
problems = []
for l in range(length):
    a, b = map(int, input().split(" "))
    problems.append([a, b])

for i in range(length):
    max_problems = problems[i][0]
            
    for k in range(1000):
        if dp[i][k]:
            for l in range(max_problems):
                dp[i + 1][k + 1 + l] = max(dp[i + 1][k + 1 + l], dp[i][k] + (i + 1) * 100 * (l + 1) + (problems[i][1] * int(l + 1 == max_problems)) )
                dp[i + 1][k] = max(dp[i + 1][k], dp[i][k])
    for l in range(max_problems):
        dp[i + 1][1 + l] = max(dp[i + 1][1 + l], (i + 1) * 100 * (l + 1) + (problems[i][1] * int(l + 1 == max_problems)) )
        
answer = float("inf")
for i in range(11):
    for j in range(1001):
        if dp[i][j] >= goal:
            answer = min(answer, j)
print(answer)

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 itertools

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

P_list = list(range(D))
cnt = float('inf')

for i in range(D):
	for bonus in itertools.combinations(P_list, i):

		tmp_cnt = 0
		score = 0

		for j in bonus:
			score += PC[j][0] * 100 * (j+1) + PC[j][1]
			tmp_cnt += PC[j][0]

		res_max_p = max([k for k in range(D) if k not in bonus])
		res_score = G - score
		if res_score > 0:
			t = (-res_score//((res_max_p+1)*100)) * (-1) 
			if t < PC[res_max_p][0]:
				tmp_cnt += t
			else:
				continue

		cnt = min(cnt, tmp_cnt)

if cnt == float('inf'):
	cnt = sum([PC[j][0] for j in range(D)])

print(cnt)

Solution (Python):

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


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

ans = float("inf")

dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)

Solution (Python):
D, G = [int(i) for i in input().split()]
G //= 100
p = []
c = []
ans = float("inf")
for _ in range(D):
    a, b = [int(i) for i in input().split()]
    p.append(a)
    c.append(b//100)
for i in range(2**D):
    g = G
    count = 0
    B = bin(i)[2:].zfill(D)
    for j, b in enumerate(B):
        if b == "1":
            g -= c[j]+p[j]*(j+1)
            count += p[j]
    i0 = B.rfind("0")
    if i0 >= 0:
        for _ in range(p[i0]):
            if g <= 0:
                break
            g -= i0+1
            count += 1
    if g <= 0:
        ans = min(count, ans)
print(ans)

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

N = 1<<D
cnts = []
for one in range(N):
    s = 0
    flag=False
    cnt = 0
    for i in range(D):
        if (one>>i &1)==1:
            s+=p_c[i][0]*(i+1)*100+p_c[i][1]
            cnt+=p_c[i][0]
    if G<=s:
        flag=True
    else:
        for i in range(D-1, -1, -1):
            if (one>>i&1)==0:
                if G-s<=p_c[i][0]*100*(i+1):
                    cnt+=(G-s)//(100*(i+1))
                    if (G-s)%(100*(i+1))!=0:
                        cnt+=1
                    flag=True
                    break
    if flag:
        cnts.append(cnt)
print(min(cnts))

Solution (Python):
d,g=map(int,input().split())
P=[]
C=[]
for i in range(d):
    x,y=map(int,input().split())
    P.append(x)
    C.append(y)
v=sum(P)
for i in range(1<<d):
	t=0
	c=0
	L=[i for i in range(d)]
	for j in range(d):
		if i&(2**j):
			L.remove(j)
			t+=(j+1)*100*P[j]+C[j]
			c+=P[j]
	if t>=g:
		v=min(v,c)
	else:
		if L:
			s=max(L)
			for k in range(P[s]-1):
				t+=100*(s+1)
				c+=1
				if g<=t:
					v=min(v,c)
					break
print(v)

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

min_cost = 10**9
for i in range(2**d):
    count = 0
    score = 0
    use_list = []
    for bit in range(d):
        if i & 2 ** bit > 0:
            use_list.append(bit + 1)
            count += p[bit]
            score += (bit + 1) * 100 * p[bit] + c[bit]
    if score < g:
        p_i = max(set(range(1, d+1)) - set(use_list))
        p_count = math.ceil((g - score) / (p_i * 100))
        if p_count <= p[p_i - 1]:
            count += p_count
            score += p_count * (p_i * 100)
    if score >= g:
        min_cost = min(min_cost, count)
print(min_cost)

Solution (Python):
import itertools,math

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

ans = 1000  
for t in itertools.product([0, 1], repeat=D):
    score = sum(t[i] * (Q[i][0] * 100 * (i + 1) + Q[i][1]) for i in range(D))
    ans_tmp = sum(t[i] * Q[i][0] for i in range(D))
    if score < G:
        p = D - 1
        while t[p]:
            p -= 1
        addition_q = math.ceil((G - score) / (100 * (p + 1)))
        if addition_q >= Q[p][0]:
            continue
        ans_tmp += addition_q
    ans = min(ans, ans_tmp)
print(ans)

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

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

ans = 10 ** 10
for e in product((0, 1), repeat=d):
    total_cnt = 0
    score = 0
    odd_idx = 0
    for j in range(d):
        if e[j] == 1:
            cnt = pc[j][0]
            bonus = pc[j][1]
            score += cnt * ((j + 1) * 100) + bonus
            total_cnt += cnt
        else:
            odd_idx = j

    if g <= score:
        ans = min(ans, total_cnt)
    else:
        odd_point = (odd_idx + 1) * 100
        odd_cnt = pc[odd_idx][0] - 1
        if g <= score + (odd_cnt * odd_point):
            total_cnt += ceil((g - score) / odd_point)
            ans = min(ans, total_cnt)
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):
def dfs(problems: "scores", now_depth: int, g: int) -> int:
  if now_depth == 0:
    return 10 ** 9 
  
  
  
  
  solve_count = min(g // (100 * now_depth), problems[now_depth][0]) 
  score = 100 * now_depth * solve_count

  
  if solve_count == problems[now_depth][0]:
    score += problems[now_depth][1]
  
  if score < g:
    solve_count += dfs(problems, now_depth - 1, g - score)
  
  return min(solve_count, dfs(problems, now_depth - 1, g))

depth, g = [ int(x) for x in input().split() ]

problems = [0] + [ [ int (x) for x in input().split() ] for _ in range(depth) ]
print(dfs(problems, depth, g))

Solution (Python):
D,G = map(int,input().split()) 
L = []
minimum = 0 
candidate = 0 
score = 0
for _ in range(D):
    p,c = map(int,input().split())
    L.append([p,c]) 





for i in range(2**D):
    for j in range(len(L)): 
        if ((i>>j)& 1): 
            score += L[j][0] * (j+1) * 100 + L[j][1] 
            candidate += L[j][0]
    if score >= G:
        if minimum == 0:
            minimum = candidate 
            candidate = 0 
            score = 0
        elif candidate != 0 and candidate < minimum:
            minimum = candidate 
            candidate = 0 
            score = 0
    else: 
        for j in range(len(L)-1,-1,-1):
            if ((i>>j) & 1):
                continue 
            for k in range(L[j][0]):
                score += 100*(j+1) 
                candidate += 1
                if score >= G:
                    if minimum == 0:
                        minimum = candidate 
                        candidate = 0 
                        score = 0
                    elif candidate != 0 and candidate < minimum:
                        minimum = candidate 
                        candidate = 0 
                        score = 0
    candidate = 0 
    score = 0
print(minimum)

Solution (Python):
from collections import defaultdict

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

scores = []

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


result = 10 ** 9

n = 2 ** d
for i in range(n):
    
    cnt = 0
    point = 0
    memo = -1
    for j in range(d):  
        if ((i >> j) & 1):  
            point += scores[j][0] * scores[j][1] + scores[j][2]
            cnt += scores[j][1]
        else:
            memo = j

    
    if point >= g:
        result = min(result, cnt)
    else:
        if memo > -1:
            for k in range(scores[memo][1] - 1):
                cnt += 1
                point += scores[memo][0]
                if point >= g:
                    result = min(result, cnt)
                    break

print(result)

Solution (Python):
D, G = map(int, input().split())
P, C = [], []
for _ in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)
  
ans = 1<<60
for bit in range(1<<D):
  s = 0
  num = 0
  rest_max = -1
  for i in range(D):
    if bit & (1<<i):
      s += 100*(i+1)*P[i]+C[i]
      num += P[i]
    else:
      rest_max = i
  if s < G:
    rest_max_point = 100*(rest_max+1)
    need = -(-(G-s)//rest_max_point)
    if need < P[rest_max]:
      num += need
    else:
      continue
  ans = min(ans, num)
  
print(ans)

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

minnum = 1e9
for i in range(0, 2**D):
    total = 0
    num = 0
    serach0 = [0] * D
    for j in range(D):
        if (i >> j) & 1:
            total += P[j]*(j+1) + C[j]
            num += P[j]
            serach0[j] = 1

    if total >= G:
        minnum = min(minnum, num)
        continue
    
    while 0 in serach0:
        idx = serach0.index(0)
        total_ = total
        num_ = num
        for _ in range(P[idx]):
            total_ += idx+1
            num_ += 1
            if total_ >= G:
                minnum = min(minnum, num_)
                break
        serach0[idx] = 1
print(minnum)

Solution (Python):
import itertools

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

ans = 10**5

for v in itertools.product([0,1],repeat=D):
    p = 0
    t = 0
    for i in range(D):
        if v[i] == 1:
            p += (i+1)*100*pc[i][0] + pc[i][1]
            t += pc[i][0]
    w = G-p
    if w > 0:
        for i in range(D):
            if v[i] == 0 and w <= (i+1)*100*(pc[i][0]-1):
                a = (i+1)*100
                tt = t+(w+a-1)//a
                ans = min(ans,tt)
    else:
        ans = min(ans,t)
print(ans)

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

P, C = [], []
for p, c in PC:
  P.append(p)
  C.append(c)
  
answer = []
for i in range(2 ** D):
  tmp = 0
  cnt = 0
  for j in range(D):
    if (i >> j) & 1:
      tmp += P[j] * (j + 1) * 100 + C[j]
      cnt += P[j]
  if tmp >= G:
    answer.append(cnt)
  else:
    for j in range(D - 1, -1, -1):
      if (i >> j) & 1 == 0:
        if -(-(G - tmp) // ((j + 1) * 100)) <= P[j] - 1:
          cnt += -(-(G - tmp) // ((j + 1) * 100))
          answer.append(cnt)
        else:
          tmp += (P[j] - 1) * (j + 1) * 100
          cnt += (P[j] - 1)
          
print(min(answer))

Solution (Python):
d,g=map(int,input().split())
P=[]
C=[]
for i in range(d):
	p,c=map(int,input().split())
	P.append(p)
	C.append(c)
v=sum(P)

for i in range(1<<d):
	t=0
	c=0
	L=[i for i in range(d)]
	for j in range(d):
		if i&(2**j):
			L.remove(j)
			t+=(j+1)*100*P[j]+C[j]
			c+=P[j]
	if t>=g:
		v=min(v,c)
	else:
		if L:
			s=max(L)
			for k in range(P[s]-1):
				t+=100*(s+1)
				c+=1
				if g<=t:
					v=min(v,c)
					break
print(v)

Solution (Python):
d, g = map(int, input().split())
g //= 100
PC = [ list(map(int, input().split())) for _ in range(d) ]
P, C = zip(*PC)
C = [i//100 for i in C]
ans = float("inf")
for i in range(2**d):
  count = 0
  end = 0
  l = []
  for j in range(d):
    if i>>j & 1:
      count += P[j]
      end += (j+1)*P[j] + C[j]
    else:
      l += [j+1]*(P[j]-1)
  l.sort()
  while end < g and l:
    end += l.pop()
    count += 1
  if end < g:
    continue
  ans = min(ans, count)
print(ans)

Solution (Python):
import itertools

d,g = map(int,input().split())
    
arr = []
    
for i in range(d):
    arr.append(list(map(int,input().split())))
    
ans = 10**10

for i in itertools.product((0,1),repeat=d):
    score=0
    num=0
    index=0
    
    for j in range(d):
        if i[j]==1:
            score += (j+1)*100*arr[j][0] + arr[j][1]
            num +=arr[j][0]
        else:
            index = max(j,index)
    
    if g - score <=0:
        ans = min(ans,num)
    
    elif g - score <= (index+1) *100*(arr[index][0]-1):
        num+= -(-(g-score)//(100*(index+1)))
        ans =min(ans,num)

print(ans)

Solution (Python):
"""
bit全探索
"""

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

for i in range(2 ** D):
    a = 0
    b = 0
    for j in range(D):
        if i >> j & 1:
            a += 100 * P[j] * (j + 1) + C[j]
            b += P[j]
    for k in range(D-1, -1, -1):
        if i >> k & 1:
            continue
        if a >= G:
            break
        for l in range(P[k] - 1):
            a += 100 * (k + 1)
            b += 1
            if a >= G:
                break
    if a >= G:
        ans = min(ans, b)
print(ans)

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

for i in range(2 ** D):
    a = 0
    b = 0
    for j in range(D):
        if i >> j & 1:
            a += 100 * P[j] * (j + 1) + C[j]
            b += P[j]
    for k in range(D-1, -1, -1):
        if i >> k & 1:
            continue
        if a >= G:
            break
        for l in range(P[k]):
            a += 100 * (k + 1)
            b += 1
            if a >= G:
                break
    ans = min(ans, b)
print(ans)

Solution (Python):
d,g = map(int,input().split())
    
arr = []
    
for i in range(d):
    arr.append(list(map(int,input().split())))
    
from itertools import product
from math import ceil
    
ans = 1e09

for c in product([0,1],repeat=d):
    
    
    score = 0
    
    num = 0
    
    ind = 0
    
    for i in range(d):
        
        if c[i] == 1:
            score += arr[i][0]*100*(i+1) + arr[i][1]
            num += arr[i][0]
        
        else:
            ind = max(i,ind)
    
    if g - score <= 0:
        ans = min(ans,num)
        
    
    elif g - score <= (arr[ind][0]-1)*100*(ind+1):
        num += ceil((g-score)/(100*(ind+1)))
        ans = min(ans,num)
        
    else:
        pass

print(ans)

Solution (Python):
D, G = map(int, input().split())
P = [0]*D
C = [0]*D
for d in range(D):
    P[d], C[d] = map(int, input().split())

ans = 10000
for f in range(2**D):
    score_tot = 0
    q = 0
    for d in range(D):
        if f>>d&1:
            score_tot += C[d]+P[d]*(d+1)*100
            q += P[d]

    for d in range(D-1, -1, -1):
        if G <= score_tot: break
        if f>>d&1: continue
        score_d = (d+1)*100
        k = (G-score_tot-1)//score_d+1
        score_tot += min(k, P[d]) * score_d
        q += min(k, P[d])

    ans = min(ans, q)

print(ans)

Solution (Python):

from itertools import combinations
inf = 10**9
d,g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]

def score(comp):
    res = 0
    s = 0
    for i in comp:
        s += pc[i][1]
        s += pc[i][0]*100*(i+1)
        res += pc[i][0]

    if s>=g:
        return res

    for i in range(d-1,-1,-1):
        if i in comp:
            continue

        c = 0
        while c<pc[i][0]-1 and s<g:
            c += 1
            s += 100*(i+1)
        res += c

        if s>=g:
            return res
    return inf

res = inf
for r in range(d+1):
    for c in combinations(range(d),r):
        s = score(c)
        res = min(res, s)

print(res)

Solution (Python):
D, G = map(int, input().split())
Q = list()
s = 0
for d in range(D):
    Q.append([d+1]+[int(x) for x in input().split()])
    s += Q[-1][1]
dp = [-float("inf")]*(s+1)
dp[0] = 0
for i, p, c in Q:
    for j in range(s, -1, -1):
        for k in range(1, p+1):
            if k == p:
                cc = 100*i*k+c
            else:
                cc = 100*i*k
            if k <= j:
                dp[j] = max(dp[j], dp[j-k]+cc)
for i in range(s+1):
    if dp[i] >= G:
        print(i)
        exit()

Solution (Python):

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

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

ans = float("inf")

for i in range(2 ** D):
  score = 0
  index = []
  attempt = 0

  for j in range(D):
    if ((i >> j) & 1):
      p, c = map(int, P[j])
      score += (c + p * (100 * (j+1) ))
      attempt += p
      index.append(j)

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

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

    if i in index: 
      continue

    p, c = map(int, P[i])
    for j in range(p):
      score += 100 * (i+1)
      attempt += 1
      if score >= G: 
        ans = min(ans, attempt)
        break
    else:
      index.append(i)

print(ans)

Solution (Python):
from itertools import product
D, G = map(int, input().split())
P, C = map(list, zip(*[tuple(map(int, input().split())) for _ in range(D)]))
CP = [100*i*p+c for i, (p, c) in enumerate(zip(P, C), 1)]
ans = 10**9
for prod in product((True, False), repeat=D):
    I = [i for i, p in enumerate(prod) if p]
    A = sum(CP[i] for i in I)
    r = sum(P[i] for i in I)
    if A >= G:
        ans = min(ans, r)
    else:
        j = max(i for i, p in enumerate(prod) if not p)
        if G > A + 100*(j+1)*(P[j]-1):
            continue
        ans = min(ans, r + (G-A-1)//((j+1)*100)+1)
print(ans)