Problem:
 Score : 300 points    Problem Statement A programming competition site AtCode provides algorithmic problems.
Each problem is allocated a score based on its difficulty.
Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.
These p_1 + … + p_D problems are all of the problems available on AtCode.  A user of AtCode has a value called total score .
The total score of a user is the sum of the following two elements:   Base score: the sum of the scores of all problems solved by the user.  Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D) .   Takahashi, who is the new user of AtCode, has not solved any problem.
His objective is to have a total score of G or more points.
At least how many problems does he need to solve for this objective?      Constraints  1 ≤ D ≤ 10  1 ≤ p_i ≤ 100  100 ≤ c_i ≤ 10^6  100 ≤ G  All values in input are integers.  c_i and G are all multiples of 100 .  It is possible to have a total score of G or more points.         Input Input is given from Standard Input in the following format:  D  G  p_1  c_1  :  p_D  c_D       Output Print the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).        Sample Input 1 2 700
3 500
5 800      Sample Output 1 3  In this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100 -point problems is 500 points, and the perfect bonus for solving all the 200 -point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.  One way to achieve this objective is to solve four 200 -point problems and earn a base score of 800 points. However, if we solve three 100 -point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.       Sample Input 2 2 2000
3 500
5 800      Sample Output 2 7  This case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200 -point problems, and by solving two 100 -point problems additionally we have the total score of 2000 points.       Sample Input 3 2 400
3 500
5 800      Sample Output 3 2  This case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200 -point problems to achieve the objective.       Sample Input 4 5 25000
20 1000
40 1000
50 1000
30 1000
1 1000      Sample Output 4 66  There is only one 500 -point problem, but the perfect bonus can be earned even in such a case.

Solution (Python):
D, G = map(int, input().split())
questions = []
for a in range(D):
    question = []
    p, c = input().split()
    question.append(int(p))
    question.append(int(c))
    questions.append(question)
numbers = []
S=[i for i in range(D)]
T=tuple(S)
for i in range(2 ** D):
    number = []
    for j in range(D):
        if ((i >> j) & 1):
            number.append(j)
    numbers.append(number)
del numbers[0]
answers=[]
for a in range(1, questions[D - 1][0]):
    b = D * 100 * a
    if G <= b:
        answers.append(a)
for a in numbers:
    goukei = 0
    suuji=0
    for b in a:
        goukei+=questions[b][0]*(b+1)*100+questions[b][1]
        suuji+=questions[b][0]
    if goukei>=G:
        answers.append(suuji)
    else:
        U = list(T)
        for c in range(len(a)):
            if a[c] in U:
                U.remove(a[c])
        saidai = max(U)
        rest=G-goukei
        kaisuu=rest//((saidai+1)*100)
        if kaisuu<questions[saidai][0]:
            answers.append(suuji+kaisuu)
print(min(answers))

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

p = []
c = []
for i in range(D):
    a,b = list(map(int,input().split()))
    p.append(a)
    c.append(b)
ans = 10**9
for i in range(2**D):
    score = 0
    count = 0
    
    
    for j,s in enumerate(list(bin(i+2**D)[3:])):
        if s=="1":
            score+=c[j] + p[j]*100*(j+1)
            count+=p[j]
    rev = list(bin((2**(D+1)-1) ^ i)[3:][::-1])
    
    
    for j in range(D):
        
        if G <= score:
            break
        if rev[j]=="1":
            if (G-score)//((D-j)*100)<p[D-j-1]-1:
                if (G-score)%((D-j)*100)==0:
                    count+=(G-score)//((D-j)*100)
                    score+=((G-score)//((D-j)*100))*((D-j)*100)
                else:
                    count+=(G-score)//((D-j)*100)+1
                    score+=((G-score)//((D-j)*100)+1)*((D-j)*100)
                
                break
            else:
                score+=(p[D-j-1]-1)*(D-j)*100
                count += p[D-j-1]-1

    if G<=score:
        ans = min(count,ans)

print(ans)

Solution (Python):
d,g=map(int,input().split())
num=[0 for _ in range(d)]
com=[0 for _ in range(d)]
hum=[100*(i+1) for i in range(d)]
ans=10**9+7
for i in range(d):
    num[i],com[i]=map(int,input().split())
for i in range(2**d):
    tmp_get=0
    tmp_ans=0
    for j in range(d):
        if((i>>j)&1):
            tmp_get+=num[-j-1]*hum[-j-1]
            tmp_get+=com[-j-1]
            tmp_ans+=num[-j-1]
    for j in range(d):
        if tmp_get>=g:
            break        
        if not((i>>j)&1):
            tmp_cnt=min(-(-(g-tmp_get)//hum[-j-1]),num[-j-1])
            tmp_ans+=tmp_cnt
            tmp_get+=tmp_cnt*hum[-j-1]
            if tmp_cnt==num[-j-1]:
                tmp_get+=com[-j-1]
    ans=min(ans,tmp_ans)
print(ans)

Solution (Python):



def format(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out



def format0(X, n, m):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    if len(out) < m:
        out = "0" * (m - len(out)) + out
    return out

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

for i in range(pow(2,d)):
  pt=0
  ans_=0
  t = format0(i,2,d)
  for j in range(d):
    if t[j]=="1":
      pt += (j+1)*100*pc[j][0]+pc[j][1]
      ans_ += pc[j][0]
  if pt >= g:
    ans = min(ans,ans_)
    continue
  for j in range(d):
    j=d-1-j
    if t[j]=="1":
      continue
    if pt + ((j+1)*100*(pc[j][0]-1))>=g:
      q=(j+1)*100
      k = (g-pt+q-1)//q
      pt += (j+1)*100*k
      ans_ += k
      break
    else:
      pt += (j+1)*100*(pc[j][0]-1)
      ans_ += pc[j][0]-1
  if pt>=g:
    ans = min(ans,ans_)
print(ans)

Solution (Python):

import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  d,g=LI()
  l=[LI() for _ in range(d)]

  ans=inf
  for i in range(2**d):
    sm=0
    cnt=0
    _l=[0]*d
    for j in range(d):
      if i&(1<<j):
        cnt+=l[j][0]
        sm+=l[j][0]*(j+1)*100+l[j][1]
        _l[j]=1

    if sm<g:
      while True:
        for k in range(d)[::-1]:
          if _l[k]==0:
            _l[k]=2 
            if sm+(k+1)*100*(l[k][0]-1)>=g:
              _cnt=(g-sm+(k+1)*100-1)//((k+1)*100)
              cnt+=_cnt
              sm+=_cnt*(k+1)*100
              break
            else:
              cnt+=l[k][0]-1
              sm+=(k+1)*100*(l[k][0]-1)

        break

    if sm>=g:
      ans=min(ans,cnt)

    

  return ans


print(main())

Solution (Python):
def dfs(i, sum, cnt, memo):
    if i == d + 1:
        if sum >= g:
            tmp.append(cnt)
        else:
            cnt += min(p_lst[max(memo) - 1], -(-(g - sum) // (max(memo) * 100)))
            if sum + min(p_lst[max(memo) - 1], -(-(g - sum) // (max(memo) * 100))) * max(memo) * 100 >= g:
                tmp.append(cnt)
        
    else:
        dfs(i + 1, sum + 100 * i * p_lst[i - 1] + c_lst[i - 1], cnt + p_lst[i - 1], memo)
        dfs(i + 1, sum, cnt, memo + [i])

d, g = map(int, input().split())
p_lst = []
c_lst = []
tmp = []
for i in range(d):
    p, c = map(int, input().split())
    p_lst.append(p)
    c_lst.append(c)


dfs(1, 0, 0, [])
print(min(tmp))

Solution (Python):
from itertools import product

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

res = 100*10+1
for solved in product((0, 1),repeat=d):
    cnt = score = max_i = 0
    for i, prob in enumerate(solved):
        if prob:
            cnt += p[i]
            score += p[i] * 100 * (i+1) + c[i]
        else:
            max_i = i

    if score < g:
        for _ in range(p[max_i]):
            cnt += 1
            score += 100 * (max_i+1)
            if score >= g:
                break

    if score >= g and cnt < res:
        res = cnt

print(res)

Solution (Python):
import itertools

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

res = 1000000
for i in itertools.product([0, 1], repeat=D):
    cost = 0
    num = 0
    for j in range(len(i)):
        cost += ((j+1)*100*P[j][0]+P[j][1])*i[j]
        num += P[j][0]*i[j]
    
    if cost >= G:
        res = min(res, num)
    else:
        for k in range(len(i)-1, -1, -1):
            if i[k] == 1:
                continue
            for l in range(P[k][0]):
                cost += 100*(k+1)
                num += 1
                if cost >= G:

                    res = min(res, num)
                    break
        else:
            continue
        break

print(res)

Solution (Python):
import sys
sys.setrecursionlimit(2000)

D, goal = map(int, input().split())
q_num, bonus = [], []
for i in range(1,D+1):
  q, b = map(int, input().split())
  q_num.append(q)
  bonus.append(b)
ans = 100000

def rec2(current_qn, next_n, current_score, tyuuto_done):
  if next_n == D + 1:
    global ans
    if current_score >= goal:
      ans = min(ans, current_qn)
  else:
    rec2(current_qn+q_num[next_n-1], next_n+1, current_score+q_num[next_n-1]*next_n*100+bonus[next_n-1], tyuuto_done)
    rec2(current_qn, next_n+1, current_score, tyuuto_done)
    if not tyuuto_done:
      for i in range(1,q_num[next_n-1]):
        rec2(current_qn+i, next_n+1, current_score+i*next_n*100, 1)

def rec(comb, next_n, current_score):
  if next_n == D + 1:
    global ans
    if current_score >= goal:
      ans = min(ans, sum(comb))
  else:
    for i in range(q_num[next_n-1]):
      rec(comb + [i], next_n+1, current_score + i * next_n * 100)
    rec(comb + [q_num[next_n-1]], next_n+1, current_score + q_num[next_n-1] * next_n * 100 + bonus[next_n-1])


rec2(0, 1, 0, 0)

print(ans)

Solution (Python):

inf=10**10

d,g=map(int,input().split())
g//=100
p=[];c=[]
for i in range(d):
    a,b=map(int,input().split())
    b//=100
    p.append(a)
    c.append(b)
ans=inf

for i in range(1<<d):
    cnt=0
    sum=0
    for j in range(d):
        if(i&(1<<j)):
            cnt+=p[j]
            sum+=(j+1)*p[j]+c[j]
    for j in range(d)[::-1]:
        if(i&(1<<j)):continue
        if(sum>=g):break
        if(sum+(j+1)*(p[j]-1)<=g):
            cnt+=p[j]-1
            sum+=(j+1)*(p[j]-1)
        else:
            cnt+=(g-sum+j)//(j+1)
            sum=inf
            
    if(sum>=g):ans=min(ans,cnt)
    
print(ans)

Solution (Python):

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

D, G = MAP()
pc = [LIST() for i in range(D)]

B = list(product([0, 1], repeat=D))

ans = INF
for b in B:
    point = 0
    count = 0
    for i, vonus in enumerate(b):
        if vonus == 1:
            
            point += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
        
    if point >= G:
        ans = min(count, ans)
        
    else:
        
        need_point = G - point
        added_count = count
        for i in range(len(b)-1, -1, -1):
            if b[i] == 0:
                
                    
                    num = ceil(need_point / (100 * (i + 1)))
                    if num >= pc[i][0]:
                        
                        count = INF
                        break
                    count += ceil(need_point/ ((i+1) * 100))
                    break
                    
                    
                    
                    
                    
                    
        ans = min(ans, count)
print(ans)

Solution (Python):
from itertools import product
import math
D,G = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(D)]
cmin = 10**4
for x in product((0,1),repeat=D):
    scr = 0
    cnt = 0
    j = -1
    for i in range(D):
        if x[i]==1:
            scr += 100*(i+1)*A[i][0]+A[i][1]
            cnt += A[i][0]
        else:
            j = i
    if scr>=G:
        cmin = min(cmin,cnt)
    else:
        k = math.ceil((G-scr)/(100*(j+1)))
        if k<A[j][0]:
            cmin = min(cmin,cnt+k)
print(cmin)

Solution (Python):
D,G = map(int, input().split())
G //= 100
PC = []
for _ in range(D):
    p,c = map(int, input().split())
    PC.append((p,c // 100))

ans = float("inf")
for i in range(2 ** D):
    cnt, scr = 0, 0
    smax = -1 
    for j in range(D):
        if (i >> j) & 1:
            p,c = PC[j]
            cnt += p
            scr += c + p * (j + 1)
        else:
            smax = j + 1

    if scr < G:
        need = (G - scr + smax - 1) // smax
        
        if need >= PC[smax - 1][0]:
            continue
        cnt += need
    
    ans = min(ans, cnt)

print(ans)

Solution (Python):
D, G = map(int, input().split())
P, comp = [], []
r = 0
for i in range(D):
  p, c = map(int, input().split())
  P.append(p), comp.append(100 * (i+1) * p + c)
  r += p
for i in range(1<<D):
  _g, _r = 0, 0
  for j in range(D):
    if i>>j & 1:
      _g += comp[j]
      _r += P[j]
  if _g >= G:
    r = min(r, _r)
    continue
  for j in range(D):
    if i>>j & 1:
      continue
    _diff = G - _g
    _p = 100 * (j+1)
    x = int(_diff // _p)
    if _diff % _p > 0:
      x += 1
    if x <= P[j]:
      _r += x
      r = min(r, _r)
print(r)

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

def flag(point,P,now):
    if point+100*(now+1)*(P-1) >= g: return 1
    elif point+100*(now+1)*P + C[now] >= g: return 2
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    if m <= n: return
    elif now == -1:
        for i in remain:
            score(point, n, i, remain)
    elif point >= g: m = n
    elif flag(point,P[now],now) == 1:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    elif flag(point,P[now],now) == 2:
        n += P[now]
        if m > n: m = n
    else:
        if m <= n+P[now]: return
        else:
            remain = remain[:]
            remain.remove(now)
            nxtp = point + P[now]*100*(now+1) + C[now]
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)

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







def flag(point,P,now):
    if point+100*(now+1)*(P-1) >= g: return 1
    elif point+100*(now+1)*P + C[now] >= g: return 2
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    if m <= n: return
    elif now == -1:
        for i in remain:
            score(point, n, i, remain)
    elif point >= g: m = n
    elif flag(point,P[now],now) == 1:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    elif flag(point,P[now],now) == 2:
        n += P[now]
        if m > n: m = n
    else:
        if m <= n+P[now]: return
        else:
            remain = remain[:]
            remain.remove(now)
            nxtp = point + P[now]*100*(now+1) + C[now]
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)

Solution (Python):
import copy
N,G=map(int,input().split())
pc=[]
for i in range(N):
  pc.append(list(map(int,input().split())))
ans=10**10
for i in range(2**N):
  tmp=0
  tmp2=0
  l=[]
  for j in range(N):
    if i>>j&1:
      w=pc[j]
      p,c=w[0],w[1]
      tmp+=100*(j+1)*p+c
      tmp2+=p
    else:
      l.append(j)
  if tmp>=G:
    ans=min(ans,tmp2)
  else:
    pc_=copy.copy(pc)
    while tmp<G:
      index=l.pop(-1)
      w=pc_.pop(index)
      p,c=w[0],w[1]
      if 100*(index+1)*p+c+tmp<G:
        tmp+=(100*(index+1)*p+c)
        tmp2+=p
      elif 100*(index+1)*p+tmp<G<=100*(index+1)*p+c+tmp:
        tmp=G
        tmp2+=p
      else:
        val=(G-tmp)//(100*(index+1))
        if (G-tmp)%(100*(index+1))==0:
          tmp2+=val
        else:
          tmp2+=(val+1)
        tmp=G
    ans=min(ans,tmp2)
print(ans)

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

P.reverse()
C.reverse()
ans = sum(P)
for i in range(2 ** D):
    cnt = 0
    score = 0
    for j, p in enumerate(P):
        if ((i >> j) & 1):
            score += (D - j) * p + C[j]
            cnt += p
    if score >= G:
        ans = min(ans, cnt)
    else:
        for j, p in enumerate(P):
            if ((i >> j) & 1) == 0:
                for k in range(p - 1):
                    score += (D - j)
                    cnt += 1
                    if score >= G:
                        ans = min(ans, cnt)
                        break

print(ans)

Solution (Python):
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(d)]
ans=10**18
for i in range(2**d):
  cnt=0
  res=[]
  x=0
  for j in range(d):
    if i>>j&1:
      cnt+=pc[j][1]+pc[j][0]*(j+1)*100
      x+=pc[j][0]
    else:
      res.append((100*(j+1),pc[j][0]))
  res.sort(reverse=True)
  if cnt>=g:
    ans=min(ans,x)
  elif len(res)>0:
    y=res[0]
    z=0
    while z<y[1] and cnt<g:
      cnt+=y[0]
      z+=1
    if cnt>=g:
      ans=min(ans,x+z)
print(ans)

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

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

ans = []
for i in range(2**D):
    score = 0
    n = 0
    han = []
    for j in range(D):
        if i >> j & 1:
            score += cs[j]
            n += p[j]
        else:
            han.append(j)
    if score >= G:
        ans.append(n)
    else:
        for np in reversed(han):
            for j in range(p[np]-1):
                score += 100 * (np + 1)
                n += 1
                if score >= G:
                    ans.append(n)
                    break
            if score >= G:
                break

print(min(ans))

Solution (Python):
d,g = map(lambda x: int(x),input().split())
pc_list= []
ans = 0
count = 0
min = 0



for i in range(d):
    p,c = map(lambda x: int(x),input().split())
    pc_list.append([p,c])
    min += p


for j in range(1 << d):
    j_bin = format(j, 'b').zfill(d)
    for k in range(d) :
        ans += int(j_bin[k]) * (100*(1+k)*pc_list[k][0] + pc_list[k][1] )
        if j_bin[k] == '1':
            count += pc_list[k][0]
        else :
            max_re = k
    for l in range(pc_list[max_re][0]):
        if ans >= g :
            break
        ans += 100*(1+max_re)
        count += 1
    if ans >= g and min > count :
        min = count
    ans = 0
    count = 0
print(min)

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

ans = 2<<9

for m in range(1<<d):
    s = 0
    num = 0
    rest_max = -1
    for i in range(d):
        if m>>i & 1:
            s += 100 * (i+1) * p[i] + c[i]
            num += p[i]
        else:
            rest_max = i
    if s < g:
        s1 = 100 * (rest_max + 1)
        need = (g - s + s1 - 1) // s1
        if need >= p[rest_max]:
            continue
        num += need
    ans = min(ans, num)
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())
ans = float('inf')


def dfs(i, g):
    global ans
    if i == 0:
        return ans
    cnt = min(g // (100 * i), p[i])
    score = 100 * i * cnt
    if cnt == p[i]:
        score += c[i]
    if g > score:
        cnt += dfs(i - 1, g - score)
    return min(cnt, dfs(i - 1, g))


print(dfs(D, G))

Solution (Python):
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 = float('inf')
for bit in range(1 << D):
    score = 0
    cnt = 0
    l = [0] * D
    for j in range(D):
        if (bit >> j) & 1 == 1:
            score += p[j] * 100 * (j + 1) + c[j]
            cnt += p[j]
            l[j] = 1
    if score < G:
        idx = -1
        for k, v in enumerate(l):
            if v == 0:
                idx = k
        if idx != -1:
            p_copy = p.copy()
            while score < G and p_copy[idx] > 0:
                score += (idx + 1) * 100
                cnt += 1
                p_copy[idx] -= 1
    if score < G:
        continue
    ans = min(ans, cnt)
print(ans)

Solution (Python):
import sys
input=sys.stdin.readline
INF = 10**9

def main():
    d,g=map(int,input().split())
    P=[list(map(int,input().split())) for _ in range(d)]
    
    ans=INF
    for bit in range(1<<d):
        score=0
        p=0
        cnt=0
        for i in range(d):
            if (bit>>i)&1:
                score += P[i][0]*100*(i+1)+P[i][1]
                cnt += P[i][0]
            else:
                p = i
       
        if score >= g:
            ans=min(ans,cnt)
        
        else:
            for i in range(P[p][0]-1):
                score += 100*(p+1)
                cnt +=1
                if score >= g:
                    ans=min(ans,cnt)
                    break
    print(ans)
  
if __name__=='__main__':
    main()

Solution (Python):
import re

d,g = map(int,input().split() )
l = [list(map(int,input().split() ))+[100*(x+1)] for x in range(d) ] 

mondai_num = []

for k in range(2**d):

  
  bin_str = format(k, "0{}b".format(d) )
  
  zenkan_list = [ x.start() for x in re.finditer("1",bin_str)  ] 
  

  
  d_list = [i for i in range(d)]
  wa = 0
  cnt = 0
  
  for i in zenkan_list:
    wa = wa+(l[i][0])*((i+1)*100)
    wa = wa + l[i][1]  
    cnt = cnt + l[i][0]
  
  if wa>=g:
    mondai_num.append( cnt )

  
  else:
    
    for i in zenkan_list:
      d_list.remove(i)
    
    max_set = l[max(d_list)]

    for i in range( max_set[0]  ):
      wa = wa + max_set[2]
      if wa >= g:
        mondai_num.append(cnt + i+1 )
        break
print(min(mondai_num))

Solution (Python):
def main():
    D,G =map(int,input().split())
    pc = [list(map(int,input().split())) for i in range(D)]
    max_D = int("1"*D,2)
    res = float("inf")
    for i in range(max_D,-1,-1):
        ansed_num = 0
        point = 0
        now = format(i,"0"+str(D)+"b")
        
        for j in range(len(now)):
            if now[j] == "1":
                
                ansed_num += pc[j][0]
                point += (j+1) * 100 * pc[j][0] + pc[j][1]
        for j in range(len(now)-1,-1,-1):
            if now[j] == "0":
                ansed_num_this = 0
                while point < G and ansed_num_this < pc[j][0]:
                    ansed_num += 1
                    point += (j+1) * 100
                    ansed_num_this += 1
            
            if point >= G:
                if ansed_num < res:
                    res = ansed_num
    print(res)


if __name__ == "__main__":
    main()

Solution (Python):
D,G=map(int,input().split())
pl=[0]*D
cl=[0]*D
for i in range(D):
  pl[i],cl[i]=map(int,input().split())
ans=[]
for bit in range(2**D):
  compl=[]
  count=0
  score=0
  for i in range(D):
    if bit&(1<<i):
      score+=pl[i]*100*(i+1)+cl[i]
      count+=pl[i]
      compl.append(i)
  if score>=G:
    ans.append(count)
  else:
    n=max(set(range(D))-set(compl))
    for i in range(pl[n]):
      score+=100*(n+1)
      count+=1
      if score>=G:
        ans.append(count)
        break
print(min(ans))

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

d, g = map(int, input().split())
pc = []
ans = []
bit = list(itertools.product([0, 1], repeat=d))
cnt_v = 0
cnt = 0

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

for i in range(2 ** d):
    for j in range(d):
        if bit[i][j] == 1:
            p = pc[j][0]
            c = pc[j][1]
            p_index = j + 1
            cnt_v += p * 100 * p_index + c
            cnt += p

    if cnt_v >= g:
        ans.append(cnt)

    else:
        for j in range(d):
            cnt_check = cnt_v
            if bit[i][j] == 0:
                p = pc[j][0]
                p_index = j + 1

                for k in range(p):
                    if cnt_check >= g:
                        cnt += k
                        ans.append(cnt)
                        cnt -= k
                        break

                    cnt_check += 100 * p_index
    cnt = 0
    cnt_v = 0

print(min(ans))

Solution (Python):
D,G = list(map(int, input().split()))
P = []
C = []
for i in range(D):
    p,c = list(map(int, input().split()))
    P.append(p)
    C.append(c)
s = {i for i in range(D)}
flag = False
bit = 0
number = []

for bit in range(2**D):
    score = 0
    count = 0
    comp = []
    
    for j in range(D):
        if bit & (1<<j):
            score += P[j] * 100 * (j+1) + C[j]
            count += P[j]
            comp.append(j)
    if score >= G:
        number.append(count)
    else:
        n = max(s-set(comp))
        for k in range(P[n]):
            score += 100 * (n+1)
            count += 1
            if score >= G:
                number.append(count)
                break

print(min(number))

Solution (Python):
d,g = map(int, input().split())
l = []
for i in range(d):
    l.append(list(map(int,input().split())))
from itertools import *
ans=10**9
for tmp in list(product([True,False], repeat=d)):
    nokori=g
    rest=[]

    solved=0
    for comp in range(d):
        if tmp[comp]:
            nokori -= l[comp][1]
            solved += l[comp][0]
            nokori -= l[comp][0]*100*(comp+1)
        else:
            for i in range(l[comp][0]):
                rest.append((comp+1) * 100)
    if nokori > 0:
        rest.sort()
        rest.reverse()

        for i in range(len(rest)):
            nokori-=rest[i]
            solved+=1
            if nokori <=0:
                break
    if ans > solved:
        ans=solved
print(ans)

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

def f(i,s):
    if i == 0: return 10**9
    cnt = min(s//(100 * i), p[i][0])
    score = 100*i*cnt
    if (cnt==p[i][0]):
        score += p[i][1]
    
    if (s > score):
        cnt += f(i-1,s-score)
    
    return min(cnt, f(i-1,s))

def main():
    print(f(d,g))
main()

Solution (Python):

from itertools import combinations

def read_input():
    d, g = map(int, input().split())

    points = []
    for i in range(d):
        points.append(tuple(map(int, input().split())))

    return d, g, points


def extract(x, lst):
    
    bin_x = bin(x)[2:]
    bin_x = '0'* (len(lst) - len(bin_x)) + bin_x

    return [l for l, b in zip(lst, bin_x) if b == '1']


def submit():
    d, g, points = read_input()
    points = [(i*100, p, c) for i, (p, c) in enumerate(points, start=1)]

    min_count = float('inf')
    for fp in points:
        

        rest_points = points.copy()
        rest_points.remove(fp)
        for i in range(2 ** len(rest_points)):
            
            comps = extract(i, rest_points)
            solved = 0
            get_points = 0
            for c in comps:
                solved += c[1]
                get_points += c[0] * c[1] + c[2]

            if g > get_points:
                rest = g - get_points
                if rest > fp[0] * fp[1] + fp[2]:
                    
                    continue
                else:
                    if rest > fp[0] * fp[1]:
                        
                        solved += fp[1]
                    elif rest % fp[0]:
                        solved += rest // fp[0] + 1
                    else:
                        solved += rest // fp[0]
            
            if min_count > solved:
                min_count = solved

    print(min_count)


if __name__ == "__main__":
    submit()

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] +
            pc[i][0], 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 = map(int, input().split())

P = {}
C = {}
for i in range(D):
    P[i], C[i] = map(int, input().split())

ans = float('inf')

for j in range(2**D):
    total_tmp = 0
    count = 0
    not_done = []
    for k in range(D):

        if (j>>k)&1:
            total_tmp += P[k]*100*(k+1)
            total_tmp += C[k]
            count += P[k]

        else:
            not_done.append(k)
    
    if total_tmp >= G:
        ans = min(ans, count)
    
    else:

        for y in sorted(not_done, reverse=True):
            for x in range(P[y]):
                count += 1
                total_tmp += 100*(y+1)

                if total_tmp >= G:

                    ans = min(ans, count)
                    break
        
print(ans)

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

for i in range(d):
  p_i, c_i = input().split()
  p.append(int(p_i))
  c.append(int(c_i))

ans = float("inf")

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


  for i in range(d):
    if ((bit >> i) & 1):
      sum += p[i] * (i + 1) * 100 + c[i]
      count += p[i]
      nokori.discard(i + 1)

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

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

print(ans)