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 numpy as np
d, g = map(int, input().split())
p = []
c = []
for _ in range(d):
    _p, _c = map(int, input().split())
    p.append(_p)
    c.append(_c)

s = np.arange(1, d + 1) * 100
p = np.array(p)

ans_list = []

bool_list = [False] * d

state_list = []

def dfs(i, n, bool_list):
    bool_list = bool_list.copy()
    if i == n:
        state_list.append(bool_list)
    else:
        dfs(i + 1, n, bool_list)
        bool_list[i] = True
        dfs(i + 1, n, bool_list)

dfs(0, d, bool_list)

for state in state_list:
    if np.dot(s * p, state) + np.dot(c, state) >= g:
        ans_list.append(np.dot(p, state))
    else:
        score = max(s * np.array([not i for i in state]))
        for j in range(1, p[score//100 - 1] + 1):
            if np.dot(s * p, state) + np.dot(c, state) + score * j >= g:
                ans_list.append(np.dot(p, state) + j)

print(min(ans_list))

Solution (Python):

import math
def dfs(i,s,c,r):
    global ans
    if i == d:
        if s < g:
            use = max(r)
            n = min(pc[use -1][0], math.ceil((g-s)/(use*100)))
            c += n
            s += n*use*100
        if s >= g:
            ans = min(ans,c)
    
    else:
        dfs(i+1, s, c, r)
        dfs(i+1, s+ pc[i][0]*(i+1)*100+pc[i][1],c+pc[i][0],r-{i+1})
        
d,g = list(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):
import math
D,G=[int(s) for s in input().split()]
ls=[[int(s) for s in input().split()] for i in range(D)]
maxD=2**D-1
def need(num):
  val=num
  score=0
  prob=0
  for i in range(D):
    if val%2==1:
      score+=ls[i][0]*(i+1)*100+ls[i][1]
      prob+=ls[i][0]
    val//=2
  if score>=G:
    return prob
  else:
 
    k=int(math.log2(num^maxD))
    x=(score-G)//((k+1)*100)
    if -x<=ls[k][0]:
      return -x+prob
    else:
      return 10000
print(min([need(i) for i in range(2**D)]))

Solution (Python):
d,g = map(int,input().split())
pc = []
m = 0
for i in range(d):
  pc.append(list(map(int,input().split())))
  m += pc[-1][0]
for i in range(2**d-1):
  cur = bin(i)[2:]
  cur = '0'*(d-len(cur)) + cur
  csum = 0
  cc = 0
  for j in range(d):
    if cur[j] == '0':
      ci = j
    else:
      csum += (j+1)*100*pc[j][0] + pc[j][1]
      cc += pc[j][0]
  if csum >= g:
    m = min(m,cc)
  elif csum + (ci+1) * 100 * pc[ci][0] >= g:
      m = min(m,cc+(g-csum-1)//(100*(ci+1))+1)
print(m)

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

ans = []
for i in range(2**d):
    score = target
    ans_temp = 0
    for j in range(d-1,-1,-1):
        if score <= 0:
            break
        if (i >> j) & 1:
            for k in range(problem[j][0]):
                score -= 100*(j+1)
                ans_temp += 1
                if score <= 0:
                    break
            score -= problem[j][1]
    if score <= 0:
        ans.append(ans_temp)
print(min(ans))

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

for i in range(2**D):
    score = 0
    tmp_ans = 0
    used = [0]*D
    for j in range(D):
        if (i>>j) & 1:
            score += pc[j][0]*(100*(j+1)) + pc[j][1]
            tmp_ans += pc[j][0]
            used[j] = 1
    
    if score >= G:
        ans = min(ans, tmp_ans)
    else:
        for j in range(D-1, -1, -1):
            if (used[j] == 0 and 0 <= (G-score-1)//(100*(j+1))+1 <= pc[j][0]):
                tmp_ans += (G-score-1)//(100*(j+1))+1
                score += ((G-score-1)//(100*(j+1))+1)*(100*(j+1))
            if score >= G:
                ans = min(ans, tmp_ans)
                break

print(ans)

Solution (Python):
(d,g),*l=[list(map(int,i.split()))for i in open(0)]
def f(i,g):
	if i==0:return 1e9
	n,m=l[i-1];c=min(g//(100*i),n);s=100*i*c+m*(c==n);c+=f(i-1,g-s)*(s<g);return min(c,f(i-1,g))
print(int(f(d,g)))

Solution (Python):
from itertools import*
from math import*
d,g=map(int,input().split())
g//=100
xxx=[tuple([i])+tuple(map(int,input().split()))for i in range(1,d+1)]   

yyy=[(score,score*num+bonus//100,num)for score,num,bonus in xxx]
ans=[]
l=[]
for i in range(d+1):
    for j in combinations(yyy,i):
        tmp1=0
        tmp2=0
        tmpl=set()
        for x,y,z in j:
            tmp1+=y
            tmp2+=z
            tmpl.add(x)
        if tmp1>=g:
            ans.append(tmp2)
        else:
            l.append((tmpl,g-tmp1,tmp2))  


for s,t,r in l:  
    for x,y,_ in xxx[::-1]:  
        if x not in s:
            if x*y<=t:
                break
            else:

                ans.append(r+ceil(t/x))

print(min(ans))

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

for i in range(1<<D):
    point = 0
    count = 0
    for j in range(D, 0, -1):
        if i>>j-1&1:
            point += j * 100 * P[j] + C[j]
            count += P[j]
    for k in range(D, 0, -1):
        if not i>>k-1&1 and P[k] > 1:
            for _ in range(P[k]-1):
                if point < G:
                    point += k * 100
                    count += 1
                else:
                    break
            if point >= G:
                ans = min(ans, count)
            break
print(ans)

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

def calc(k):
    s = G
    a = 0
    for i in range(D):
        if k & (1<<i):
            a += X[i][0]
            s -= X[i][0] * (i+1) * 100 + X[i][1]
    if s <= 0:
        return a
    for i in range(D)[::-1]:
        if k & (1<<i) == 0:
            if s > X[i][0] * (i+1) * 100:
                return 1<<100
            else:
                a += -(-s//((i+1) * 100))
                break
    return a

mi = 1 << 100
for j in range(1<<D):
    mi = min(mi, calc(j))
print(mi)

Solution (Python):
d,g= map(int,input().split())
p_c = [input() for i in range(d)]
pc =[]
for j in range(d):
  p,c = map(int,p_c[j].split())
  pc.append([p,c])
ans = []
for x in range(2**d):
  count = 0
  total = 0
  tokanai = []
  for y in range(d):
    if (x >> y) & 1 == 1:
      count += pc[y][0]
      total += pc[y][0] * (y+1)*100 + pc[y][1]
    else:
      tokanai.append([pc[y][0],(y+1)*100])
  if total < g and g-total <= (max(tokanai)[0]-1)*max(tokanai)[1]:
    di = g-total
    for k in range(max(tokanai)[0]):
      if di - ((k+1) * max(tokanai)[1]) <= 0:
        count += k+1
        ans.append(count)
  elif total >= g:
    ans.append(count)
print(min(ans))

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

for i in range(2 ** D):
    score = 0
    count = 0
    for j in range(D):
        if (i >> j) & 1:
            score += c[j] + p[j] * 100 * (j + 1)
            count += p[j]
    for k in range(D - 1, -1, -1):
        if (i >> k) & 1:
            continue
        if score >= G:
            break
        for l in range(p[k] + 1):
            score += 100 * (k + 1)
            count += 1
            if score >= G:
                break
    ans = min(ans, count)

print(ans)

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

Solution (Python):
import sys
import itertools


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    d, g = list(map(int, input().rstrip('\n').split()))
    pc = [[(i + 1) * 100, pc[0], pc[1]]for i, pc in enumerate(list(map(int, input().rstrip('\n').split())) for _ in range(d))]
    pc.sort(reverse=True)
    min_cnt = 10 ** 10
    for v in itertools.product([True, False], repeat=d):
        cnt = 0
        t = 0
        max_p = -1
        limit_c = -1
        for i, vv in enumerate(v):
            if vv:
                cnt += pc[i][1]
                t += pc[i][0] * pc[i][1] + pc[i][2]
            else:
                if max_p < pc[i][0]:
                    max_p = pc[i][0]
                    limit_c = pc[i][1]
        if t >= g:
            min_cnt = min(min_cnt, cnt)
        else:
            if 1 <= (g - t + max_p - 1) // max_p <= limit_c:
                min_cnt = min(min_cnt, cnt + (g - t + max_p - 1) // max_p)
    print(min_cnt)


if __name__ == '__main__':
    solve()

Solution (Python):



import math

d,g = map(int,input().split())
pl = []
cl = []

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

ans = float('inf')
for i in range(2 ** d):
    op = [0] * d
    for j in range(d):
        if ((i >> j) & 1):
            op[j] = 1  

    tmp_ans = 0
    tmp_point = 0
    
    for idx, (o,p,c) in enumerate(zip(op, pl, cl)):
        tmp_ans += o*p
        tmp_point += o*c + (idx+1) * 100 * p*o
        
    
    for k in range(d-1, -1, -1):
        if (i >> k) & 1: 
            continue
        if tmp_point >= g:
            break
        for l in range(pl[k] + 1):
            tmp_point += 100 * (k + 1)
            tmp_ans += 1
            if tmp_point >= g:
                break
    if ans > tmp_ans:
        ans = tmp_ans
print(ans)

Solution (Python):

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

ans = 10 ** 9
for i in range(2 ** d):
    score = 0
    count = 0
    for j in range(d):
        if (i >> j) & 1: 
            score += p_c[j][1] + p_c[j][0] * 100 * (j + 1)
            count += p_c[j][0]
    for k in range(d - 1, -1, -1):
        if (i >> k) & 1: 
            continue
        if score >= g:
            break
        for l in range(p_c[k][0] + 1):
            score += 100 * (k + 1)
            count += 1
            if score >= g:
                break
    if ans > count:
        ans = count
print(ans)

Solution (Python):
import copy
from collections import deque
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = inf

D, G = LI()

P = [0]*D
c = [0]*D
p = [0]*D

for i in range(D):
    P[i], c[i] = LI()

full = [0]*D
for i in range(D):
    full[i] = 100*(i+1)*P[i] + c[i]

for i in range(2**D):
    ansC = int(0)
    p = copy.deepcopy(P)
    candi = [i for i in range(D)]
    cur = int(0)
    for j in range(D):
        if ((i >> j) & 1):
            cur += full[D-j-1]
            ansC += p[D-j-1]
            candi.remove(D-j-1)

    remain = G - cur

    while(candi and remain>0):
        remain -= (candi[-1]+1)*100
        p[candi[-1]] -=1

        ansC +=1
        if p[candi[-1]]==0:
            candi.remove(candi[-1])

    ans = min(ansC,ans)

print(ans)

Solution (Python):
from sys import stdin
D, G = [int(x) for x in stdin.readline().rstrip().split()]
P = []
C = []
for _ in range(D):
    p, c = [int(x) for x in stdin.readline().rstrip().split()]
    P.append(p)
    C.append(c)
ans = 10**9

for i in range(1 << D):
    score = 0
    cnt = 0

    
    for j in range(D):
        if i >> j & 1:
            score += C[j]
            score += P[j]*(j+1)*100
            cnt += P[j]

    
    for k in range(D-1, -1, -1):
        if i >> k & 1:
            continue
        if score >= G:
            break
        S = (k+1)*100
        for l in range(P[k]+1):
            score += S
            cnt += 1
            if score >= G:
                break
    ans = min(ans, cnt)
print(ans)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop, heappush
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

d,g = inpl()
p = [0] * d
c = [0] * d
for i in range(d):
    p[i], c[i] = inpl()
res = float('inf')

for flag in itertools.product((0,1),repeat=d):
    sco = 0
    cnt = 0
    for i,j in enumerate(flag):
        if j:
            sco += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    
    if sco >= g:
        res = min(res, cnt)
    else:
        rem = g - sco 
        for i,j in enumerate(flag):
            if not j:
                tmp = -(-rem//((i+1)*100))
                
                if tmp < p[i]:
                    res = min(res, cnt+tmp)
print(res)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop, heappush
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

d,g = inpl()
p = [0] * d
c = [0] * d
for i in range(d):
    p[i], c[i] = inpl()
res = float('inf')

for flag in itertools.product((0,1),repeat=d):
    sco = 0
    cnt = 0
    for i,j in enumerate(flag):
        if j:
            sco += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    
    if sco >= g:
        res = min(res, cnt)
    else:
        rem = g - sco 
        for i,j in enumerate(flag):
            if not j:
                tmp = rem/((i+1)*100)
                
                if tmp < p[i]:
                    res = max(min(res, cnt+tmp),1)
print(int(res))

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

ans = []

for i in range(2**D):
  x = bin(i).replace("0b","")
  x = x.zfill(D)
  
  point,cnt = 0,0
  
  for l,st in enumerate(x):
    if st == "1":
      cnt += int(pc[l][0])
      point += int(pc[l][1]) + (((l + 1)*100) * int(pc[l][0]))
      
  if point >= G:
    ans.append(cnt)
  else:
    for n,st2 in enumerate(x[::-1]):
      if st2 == "0":
        for z in range(int(pc[D-(n+1)][0])):
          point += ((D-n)*100)
          cnt += 1
          if point >= G:
            ans.append(cnt)

print(min(ans))

Solution (Python):
import itertools
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))

D, G = inpl()
G //= 100
pc = [inpl() for _ in range(D)]
p = [x[0] for x in pc]
c = [x[1]//100 for x in pc]
total = [(i+1)*p[i]+c[i] for i in range(D)]

ans = sum(p)
for complete in itertools.product(range(2),repeat=D):
    n = 0
    g = G
    for i in range(D):
        if complete[i]:
            g -= total[i]
            n += p[i]
    for i in range(D-1,-1,-1):
        if complete[i]:
            continue
        else:
            if g <= 0:
                break
            elif g > (p[i]-1)*(i+1):
                g -= (p[i]-1)*(i+1)
                n += p[i]-1
            else:
                n += g//(i+1) + int(bool(g%(i+1)))
                g = 0
                break
    if g <= 0 and n < ans:
        ans = n
print(ans)

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

scr_comp=[0]*d
scr_no_comp=[0]*d
for i in range(d):
    scr_comp[i]=p[i]*(i+1)*100+c[i]
    scr_no_comp[i]=(p[i]-1)*(i+1)*100

ans=sum(p)
for i in range(2**d):
    scr_tmp=0
    num_tmp=0
    for j in range(d):
        if i&(2**j):
            scr_tmp+=scr_comp[j]
            num_tmp+=p[j]
    if scr_tmp >= g:
        ans=min(ans, num_tmp)
        continue
    for j in range(d-1, -1, -1):
        if i&(2**j):
            continue
        if scr_tmp + scr_no_comp[j] >= g:
            num_tmp+=(g-scr_tmp)//((j+1)*100)
            num_tmp+=1 if ((g-scr_tmp)%((j+1)*100)!=0) else 0
            ans=min(ans, num_tmp)
        else:
            scr_tmp+=scr_no_comp[j]
            num_tmp+=p[j]-1
print(ans)

Solution (Python):
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(d)]
dp=[[-1]*(1001) for i in range(d)]
for i in range(d):
    dp[i][0]=0
lst=[]
for i in range(d):
    p,c=pc[i]
    h=[0]
    for j in range(1,p):
        h.append(100*(i+1)*j)
    h.append(100*(i+1)*p+c)
    lst.append(h)
for i in range(d):
    p,c=pc[i]
    h=lst[i]
    if i==0:
        for j in range(1,p+1):
            dp[0][j]=h[j]
    else:
        for j in range(1,p+1):
            for k in range(j,1001):
                if dp[i-1][k-j]!=-1:
                    dp[i][k]=max(dp[i-1][k-j]+h[j],dp[i-1][k])
                else:
                    break
for i in range(1,1001):
    if dp[d-1][i]>=g:
        print(i)
        break

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

INF = 1001001001
ans = INF
for bit in range(2**d):
    total_comp = 0
    q_total = 0
    for i in range(d):
        if (1 << i) & bit:
            total_comp += pt_ls[i][0] * 100 * (i+1) + pt_ls[i][1]
            q_total += pt_ls[i][0]

    if total_comp >= g:
        ans = min(ans, q_total)
    else:
        for i in reversed(range(d)):
            if not (1<<i) & bit:
                a = g - total_comp
                b = 100 * (i+1)
                need_q = (a + b - 1) // b
                if need_q < pt_ls[i][0]:
                    q_total += need_q
                    ans = min(ans, q_total)
                    break

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
    L=[]
 
    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
        else:
            L.append(i+1)
            
    if sum < g:
        n = min(pc[max(L)-1][0], -(-(g - sum) // (max(L) * 100)))
        count += n
        sum += n * max(L) * 100
 
    if sum >= g:
        ans = min(ans, count)
print(ans)

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

def function(G, i):
    if i == 0:
        return 10**9
    n = min(G // (i *100), pc[i][0])
    s = n * i * 100
    if n == pc[i][0]:
        s += pc[i][1]
    if s < G:
        n += function(G-s, i - 1)
    return min(n, function(G, i-1))

print(function(G, D))

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

ans = float("inf")
for bit in range(2 ** D):
    tmp_ans = 0
    tmp_sum = 0
    for j in range(D):
        if bit >> j & 1:
            tmp_sum += questions[j][0] * 100 * (j + 1) + questions[j][1]
            tmp_ans += questions[j][0]
    if tmp_sum < G:
        for j in range(D - 1 , -1 , -1):
            if bit >> j & 1:
                continue
            else:
                for k in range(questions[j][0]):
                    tmp_ans += 1
                    tmp_sum += 100 * (j + 1)
                    if tmp_sum >= G:
                        break
                if tmp_sum >= G:
                    break
    if tmp_ans < ans and tmp_sum >= G:
        ans = tmp_ans
print(ans)

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

ans = 10 ** 4

for bits in range(2 ** D + 1):
    num, score = 0, 0
    
    for i in range(D):
        if (0x01 << i) & bits:
            score += PC[i][0] * (i + 1) * 100 + PC[i][1]
            num += PC[i][0]

    i = D - 1
    pnum = 0
    
    
    
    
    
    
    
    
    
    
    
    
    while score < G and i >= 0:
        
        if not (0x01 << i) & bits:
            for t in range(PC[i][0]):
                
                if score < G:
                    score += (i + 1) * 100
                    num += 1
            break
        else:
            i -= 1


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

print(ans)

Solution (Python):
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce




def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList




basecost = 100


def dfs(i, total, cnt, nokori):
    global ans
    if i == d:
        if total < g:
            use = max(nokori)
            n = min(data[use - 1][0], -(-(g - total) // (use * basecost)))
            cnt += n
            total += n * use * basecost + data[use - 1][1]
        if total >= g:
            ans = min(ans, cnt)
    else:
        dfs(i + 1, total, cnt, nokori)
        dfs(i + 1, total + (i + 1) * data[i][0] * basecost + data[i][1], cnt + data[i][0], nokori - {i+1})


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

ans = sys.maxsize

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

Solution (Python):
from itertools import product
from math import ceil
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]

a = [True, False]
ss = product(a, repeat=D)

li = []
for i in ss:
  lii = []
  for itr, val in enumerate(i):
    if val:
      lii.append(itr)
  li.append(lii)

oneD = set([i for i in range(D)])
    


ans = 10**9
for i in li:
  psum = 0
  cnt = 0
  for j in i:
    psum += (j + 1) * pc[j][0] * 100 + pc[j][1]
    cnt += pc[j][0]
  if psum >= G:
    ans = min(ans, cnt)
  else:
    hoge = max(oneD - set(i))
    if pc[hoge][0] >= ceil((G - psum)/((hoge+1)*100)):
      cnt += ceil((G - psum)/((hoge+1)*100))
      ans = min(ans, cnt)
    
print(ans)

Solution (Python):
d,g = map(int,input().split())
p = [list(map(int,input().split())) for i in range(d)]
ans = float('inf')
for i in range(2**d):
  solved = 0
  point = 0
  luck = -1
  for j in range(d):
    if i >> j & 1:
      
      point += 100 * (j+1) * p[j][0] + p[j][1]
      solved += p[j][0]
    
    else:
      luck = j
  
  k = 0
  
  while k < p[luck][0] and point < g:
    point += 100 * (luck + 1)
    k += 1
    solved += 1
  if point >= g and solved < ans:
    ans = solved
print(ans)

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

ans = 10 ** 4

for bits in range(2 ** D + 1):
    num, score = 0, 0
    for i in range(D):
        if (0x01 << i) & bits:
            score += PC[i][0] * (i + 1) * 100 + PC[i][1]
            num += PC[i][0]
    
    i = D - 1
    pnum = 0
    while score < G and i >= 0:
        if not (0x01 << i) & bits:
            score += (i + 1) * 100
            num += 1
            pnum += 1
            if pnum >= PC[i][0]:
                pnum = 0
                i -= 1
        else:
            i -= 1
    
    if score >= G:
        ans = min(ans, num)

print(ans)

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 = map(int, input().split())

question_list = []

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

ans = 10 ** 5

for i in range(2 ** D):
    bit = format(i, "0" + str(D) + "b") 

    total = 0
    num_q = 0
    for j in range(D):
        if bit[j] == "1":
            total += question_list[j][0] * 100 * (j + 1) + question_list[j][1]
            num_q += question_list[j][0]
    
    res = max(0, G - total)

    if res > 0:
        ind = bit.rfind("0") 
        res_q = res // (100 * (ind + 1)) + (1 if (res % (100 * (ind + 1)) != 0) else 0)
        if res_q > question_list[ind][0]:
            continue
        num_q += res_q
    
    ans = min(ans, num_q)

print(ans)

Solution (Python):
dg = input().split(' ');
d = int(dg[0]);
g = int(dg[1]);
p = [0]*d;
c = [0]*d;
for i in range(d) :
    s = input().split(' ');
    p[i] = int(s[0]);
    c[i] = int(s[1]);

ans = sum(p);
for i in range(2**d) :
    sumpoint = 0;
    luck = -1;
    point = 0;
    for j in range(d-1,-1,-1) :
        if((i & 2**j)>>j) :
            sumpoint += (j+1)*100*p[j] + c[j];
            point += p[j];
        elif(luck<0) :
            luck = j
    k = 0;
    while k < p[luck] and sumpoint < g :
        sumpoint += (luck+1)*100;
        point += 1;
        k+= 1;
    if sumpoint >= g and point < ans :
        ans = point;

print(ans);

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

question_list = []

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


ans = 10 ** 5

for i in range(2 ** D):
    bit = format(i, "0" + str(D) + "b") 

    total = 0
    num_q = 0
    for j in range(len(bit)):
        if bit[j] == "1":
            total += question_list[j][0] * 100 * (j + 1) + question_list[j][1]
            num_q += question_list[j][0]
    
    res = max(0, G - total)

    if res > 0:
        ind = bit.rfind("0")
        res_q = res // (100 * (ind + 1)) + (1 if (res % (100 * (ind + 1)) != 0) else 0)
        if res_q > question_list[ind][0]:
            continue
        num_q += res_q
    
    ans = min(ans, num_q)

print(ans)

Solution (Python):
D, G = map(int,input().split())
PC = [list(map(int, input().split())) for _ in range(D)]
comp_ans_ll = [0 for _ in range(D) ]
n_ans=float("inf")

def main():
  global n_ans
  for i in range(1<<D):
    comp_ans_l = [0 for _ in range(D) ]
    score = 0
    tmp_n_ans = 0
    for j in range(D):
      if (i>>j)&1:
        score += (j+1)*100*PC[j][0] + PC[j][1]
        tmp_n_ans+=PC[j][0]
        comp_ans_l[j] = 1
    if G <= score:
      n_ans = min(n_ans, tmp_n_ans)
    else:
      for k in range(D-1,-1,-1):
        if comp_ans_l[k]==0:
          for l in range(1,PC[k][0]):
            score += 100*(k+1)
            tmp_n_ans+=1
            if G <= score:
              n_ans = min(n_ans, tmp_n_ans)
              break
        if score>=G:
          break
  print(n_ans)

if __name__=="__main__":
  main()

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

ans = 10**12

for i in range(2**D):
    ten = 0
    mon = 0
    keta = format(i, "0"+str(D)+"b")
    for j in range(D):
        if keta[j] == "1":
            ten += pc[j][0]*(j+1)*100 + pc[j][1]
            mon += pc[j][0]
    if ten < G:
        for j in range(D-1, -1, -1):
            if keta[j] == "0":
                for k in range(pc[j][0]):
                    ten += (j+1) * 100
                    mon += 1
                    if ten >= G:
                        break
                if ten >= G:
                    break
    if ten >= G:
        ans = min(ans, mon)

print(ans)

Solution (Python):
from itertools import combinations

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

A = []
B = {i for i in range(D)}
for i in range(D+1):
    A += list(combinations(B, i))



ans = []
for ai in A:
    p = 0  
    c = 0  
    for aii in ai:
        p += PC[aii][2]
        c += PC[aii][0]
    if p < G:
        x = B.difference(ai)
        max_x = max(x)
        cnt = 0
        while p < G and cnt < PC[max_x][0] - 1:
            p += (max_x + 1) * 100
            cnt += 1
            c += 1
        if p >= G:
            
            ans.append(c)
    else:
        
        ans.append(c)

print(min(ans))