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):
from math import ceil

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

ans = float("inf")
for bit in range(1<<d):
    sum = 0
    cnt = 0
    
    nokori = set(range(1, d + 1))
    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0]*100*(i+1) + pc[i][1]
            cnt += pc[i][0]
            nokori.discard(i+1)
    
    if sum < g:
        use = max(nokori)
        husoku = min(ceil((g-sum)/(use*100)),pc[use-1][0])
        cnt += husoku
        sum += husoku*use*100
    
    if sum >= g:
        ans = min(cnt,ans)

print(ans)

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

ans=10000
for i in range(2**D):
    score=0
    cnt=0
    rest=[]
    for j in range(D):
        if (i>>j)&1:
            score+=100*(j+1)*s[j][0]+s[j][1]
            cnt+=s[j][0]
        else:
            rest.append(j)

    if score<G:
        r=rest[-1]
        for _ in range(s[r][0]-1):
            score+=100*(r+1)
            cnt+=1
            if score>=G: break

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

print(ans)

Solution (Python):
D, G = map(int,input().split())
table = []
ans = 0

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


for i in range(2**D):
    score = 0
    n = 0
    solved = [0] * D
    for j in range(D):
        if i>>j & 1:
            p,c = table[j]
            solved[j] = 1
            score += 100*(j+1)*p+c
            n += p
    if score<G:
        for k in range(D-1,-1,-1):
            if solved[k] == 0:
                p = table[k][0]
                for l in range(1,p):
                    score += 100*(k+1)
                    n += 1
                    if score>=G:
                        break
                break

    if score>=G:
        ans = min(n,ans)
print(ans)

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

Solution (Python):

import sys
from itertools import combinations_with_replacement,product
def input(): return sys.stdin.readline().rstrip()


def main():
    D,G=map(int, input().split())
    problem=[]
    for i in range(1,D+1):
        p,c=map(int, input().split())
        problem.append([i,p,c])
    ans=10000000
    for bit in list(product([0,1],repeat=D)):
        pnum=0
        nokori=G
        notcomp=[]
        for i in range(D):
            if bit[i]==1:
                pnum+=problem[i][1]
                nokori-=problem[i][2]+problem[i][1]*problem[i][0]*100
            else:
                notcomp.append(problem[i])
        while nokori>0 and notcomp:
            score,p,c=notcomp.pop()
            if score*(p-1)*100<=nokori:
                nokori-=score*(p-1)*100
                pnum+=p-1
            else:
                tmp=score*100
                pnum+=(nokori+tmp-1)//tmp
                nokori=0
        if nokori<=0:
            ans=min(ans,pnum)
    print(ans)
    


if __name__ == '__main__':
    main()

Solution (Python):
def main():
  ans = 1000
  d,g  = map(int,input().split())
  pc = [list(map(int,input().split())) for i in range(d)]
  pc.reverse()
  
  for i in range( 2 ** d):
    score = 0
    count = 0
    for j in range(d):
      if i & (1<<j):
        score += pc[j][0] * (d-j) * 100 + pc[j][1]
        count += pc[j][0]
    if score >= g:
      if ans > count:
        ans = count
      
      continue
    for j in range(d):
      if not(i &(1<<j)):
        
        c = 0
        for k in range(1,pc[j][0]):
          score += (d-j) * 100
          count += 1
          c += 1
          if score >= g:
            if ans > count:
              ans = count
            
            break
        break
  print(ans)

if __name__ == '__main__':
  ans = 0
  main()

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



        
        if sum >= g:
            ans = min(ans,count)
    else:
        
        dsf(i+1,sum,count,nokori)
        
        dsf(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')


dsf(0,0,0,set(range(1,d + 1)))
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):

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

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):
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):
from math import ceil

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):
    cnt = 0
    sum = 0
    remain = set(range(1,D+1))

    for i in range(D):
        if bit & (1 << i):
            cnt += pc[i][0]
            sum += pc[i][0]*(i+1)*100 + pc[i][1]
            remain.discard(i+1)

    if sum < G:
        use = max(remain)
        n = min(pc[use-1][0], ceil((G-sum)/(use*100)))
        cnt += n
        sum += n*use*100

    if sum >= G:
        ans = min(ans,cnt)

print(ans)

Solution (Python):
from itertools import permutations

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

ans = sum(p for p, _ in PC)
for ids in permutations(range(D)):
    score = 0
    num = 0
    for i in ids:
        p, c = PC[i]
        if score + (i + 1) * 100 * p + c < G:
            score += (i + 1) * 100 * p + c
            num += p
        else:
            for j in range(p):
                score += (i + 1) * 100
                num += 1
                if G <= score:
                    ans = min(ans, num)
                    break
            else:
                score += c
                if G <= score:
                    ans = min(ans, num)
        if G <= score:
            break
print(ans)

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 = 1001
import math
for i in range(2**D):
    pp = 0
    t = 0
    b = format(i, "0" + str(D) + "b")
    
    for j in range(D):
        pp += (100 * (j + 1) * p[j] + c[j]) * int(b[j])
        t += p[j] * int(b[j])
    if pp >= G:
        ans = min(ans, t)
        continue
    for k in range(D-1, -1, -1):
        if b[k] == "0":
            a = math.ceil((G - pp)//100/(k+1))
            if a < p[k]:
                t += a
                ans = min(ans, t)
                break
            else:
                t += p[k]-1
                pp += 100* (k + 1) *(p[k] - 1)

print(ans)

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

d, g = map(int, readline().split())
pc = []
for _ in range(d):
    pc.append(readline().split())

def main(d, g, pc):
    min_cnt = 1000000000
    for i in range(2**d):
        wa = 0
        cnt = 0
        nokori = [i for i in range(d)]
        for j in range(d):
            if i & 2**j:
                wa += int(pc[j][1]) + 100 * int(pc[j][0]) * (j+1)
                cnt += int(pc[j][0])
                nokori.remove(j)
        if wa < g:
            if int(pc[nokori[-1]][0]) * 100 *(nokori[-1]+1) > int(g) - wa:
              if (g-wa) % (100 *(nokori[-1]+1)) != 0:
                  ato = 1 + (g-wa) // (100 *(nokori[-1]+1))
              else:
                  ato = (g-wa) // (100 *(nokori[-1]+1))
              cnt += ato
              wa += ato * 100 * (nokori[-1]+1)
        if g <= wa:
	        min_cnt = min(cnt, min_cnt)
    return min_cnt


print(main(d, g, pc))

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):
    cnt = 0
    sum = 0
    remain = set(range(1,D+1))

    for i in range(D):
        if bit & (1 << i):
            cnt += pc[i][0]
            sum += pc[i][0]*(i+1)*100 + pc[i][1]
            remain.discard(i+1)

    if sum < G:
        use = max(remain)
        n = min(pc[use-1][0],-(-(G - sum)//(use*100)))
        cnt += n
        sum += n*use*100

    if sum >= G:
        ans = min(ans,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):
d, g = map(int, input().split())
pc = [list(map(int,input().split())) for _ in range(d)]
ans = g//100 + 1

for i in range(2**d):
    count = 0
    total = 0
    for j in range(d):
        if (i >> j) & 1 == 1:
            count += pc[j][0]
            total += (j+1)*100*pc[j][0] + pc[j][1]

    if total >= g:
        ans = min(ans, count)
    else:
        for k in reversed(range(d)):
            if ((i >> k) & 1) == 0:
                for _ in range(pc[k][0]-1):
                    count += 1
                    total += (k+1)*100
                    if total >= g:
                        ans = min(ans, count)
                        break

print(ans)

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

for i in range(2**d):
    count = 0
    total = 0
    for j in range(d):
        if (i >> j) & 1 == 1:
            count += pc[j][0]
            total += (j+1)*100*pc[j][0] + pc[j][1]

    if total >= g:
        ans = min(ans, count)
    else:
        for k in reversed(range(d)):
            if ((i >> k) & 1) == 0:
                for _ in range(pc[k][0]):
                    if total >= g:
                        ans = min(ans, count)
                        break
                    count += 1
                    total += (k+1)*100

print(ans)

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

for i in range(2**D):
    score=0
    b=0
    cnt=0
    for j in range(D):
        if ((i>>j)&1):
            score+=100*(j+1)*pc[j][0]+pc[j][1]
            cnt+=pc[j][0]
        else:
            b=j
    for k in range(pc[b][0]):
        if score>=G and cnt<ans:
            ans=cnt
        score+=(b+1)*100
        cnt+=1
print(ans)

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

for i in range(2**D):
    score=0
    b=0
    cnt=0
    for j in range(D):
        if ((i>>j)&1):
            score+=100*(j+1)*pc[j][0]+pc[j][1]
            cnt+=pc[j][0]
        else:
            b=j
    for k in range(pc[b][0]):
        if score>=G and cnt<ans:
            ans=cnt
        score+=(b+1)*100
        cnt+=1
print(ans)

Solution (Python):
d,g = map(int,input().split())
pc = list(list(map(int, input().split())) for _ in range(d))
ans = float("inf")

for i in range(1<<d):
    score = 0
    cnt = 0
    nokori = set(range(1, d+1))
    
    for j in range(d):
        if i>>j &1:
            score += (j+1)*pc[j][0]*100+pc[j][1]
            cnt += pc[j][0]
            nokori.discard(j+1)
            
    if score < g:
        use = max(nokori)
        n = min(pc[use-1][0], -(-(g-score)//(use*100))) 
        cnt += n
        score += n*use*100
    if score >= g:
        ans = min(ans, cnt)
print(ans)

Solution (Python):
d,g = map(int, input().split())
pc = list(list(map(int,input().split())) for _ in range(d))
ans = float("inf")
          
for i in range(1<<d):
    count = 0
    sum = 0
    nokori = set(range(1, d+1))
    
    
    for j in range(d):
        if i & 1<<j:
            sum += pc[j][0]*(j+1)*100+pc[j][1]
            count += pc[j][0]
            nokori.discard(j+1)
            
    
    if sum < g:
        use = max(nokori)
        n = min(pc[use-1][0], -(-(g-sum)//(use*100)))
        count += n
        sum += n*use*100
        
    
    if sum >= g:
        ans = min(ans, count)
print(ans)

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

ans = float("inf")

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

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

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

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

print(ans)

Solution (Python):
d,g=map(int,input().split())
p=[]
c=[]
for i in range(d):
    P,C=map(int,input().split())
    p.append(P)
    c.append(C)
ans=sum(p)
for i in range(2**d):
    z=i
    x=[]
    for j in range(d):
        x.append(z%2)
        z=z//2
    po=0
    m=0
    for j in range(d):
        if x[j]==1:
            po+=100*(j+1)*p[j]+c[j]
            m+=p[j]
    q=[[] for j in range(d)] 
    s=0
    for j in range(d):
        if x[j]==0:
            q[s].append(100*(j+1))
            q[s].append(p[j])
            s+=1
    q=[q[j] for j in range(d) if q[j]!=[]]
    q=sorted(q,reverse=True)
    w=len(q)
    for j in range(w):
        q[j][1]-=1
    if po>=g:
        ans=min(ans,m)
    else:
        for j in range(w):
            if po+q[j][0]*q[j][1]>=g:
                m+=(g-po+q[j][0]-1)//q[j][0]
                ans=min(ans,m)
                break
            else:
                po+=q[j][0]*q[j][1]
                m+=q[j][1]
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=sum(p)
for i in range(2**d):
    z=i
    x=[]
    for j in range(d):
        x.append(z%2)
        z=z//2
    po=0
    m=0
    for j in range(d):
        if x[j]==1:
            po+=100*(j+1)*p[j]+c[j]
            m+=p[j]
    q=[[] for j in range(d)] 
    s=0
    for j in range(d):
        if x[j]==0:
            q[s].append(100*(j+1))
            q[s].append(p[j])
            s+=1
    q=[q[j] for j in range(d) if q[j]!=[]]
    q=sorted(q,reverse=True)
    w=len(q)
    for j in range(w):
        q[j][1]-=1
    if po>=g:
        ans=min(ans,m)
    else:
        for j in range(w):
            if po+q[j][0]*q[j][1]>=g:
                m+=(g-po+q[j][0]-1)//q[j][0]
                ans=min(ans,m)
                break
            else:
                po+=q[j][0]*q[j][1]
                m+=q[j][1]
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=sum(p)
for i in range(2**d):
    z=i
    x=[]
    for j in range(d):
        x.append(z%2)
        z=z//2
    po=0
    m=0
    for j in range(d):
        if x[j]==1:
            po+=100*(j+1)*p[j]+c[j]
            m+=p[j]
    q=[[] for j in range(d)] 
    s=0
    for j in range(d):
        if x[j]==0:
            q[s].append(100*(j+1))
            q[s].append(p[j])
            s+=1
    q=[q[j] for j in range(d) if q[j]!=[]]
    q=sorted(q,reverse=True)
    w=len(q)
    for j in range(w):
        q[j][1]-=1
    if po>=g:
        ans=min(ans,m)
    else:
        for j in range(w):
            if po+q[j][0]*q[j][1]>=g:
                m+=(g-po+q[j][0]-1)//q[j][0]
                ans=min(ans,m)
                break
            else:
                po+=q[j][0]*q[j][1]
                m+=q[j][1]
print(ans)

Solution (Python):
import itertools
from typing import List, Tuple
 
 
def main():
    d, g = map(int, input().split())
    v = []
    for _ in range(d):
        p, c = map(int, input().split())
        v.append((p, c))
 
    print(ag(v, g))
 
 
def ag(v: List[Tuple[int, int]], g: int) -> int:
    ret = 10 ** 10
    for comb in itertools.product((False, True), repeat=len(v)):
        cnt, score = 0, 0
        for i, bit in enumerate(comb):
            if bit:
                score += (i + 1) * 100 * v[i][0] + v[i][1]
                cnt += v[i][0]
        if score < g:
            idx = len(v) - list(reversed(comb)).index(False) - 1
            add = ((g - score) + ((idx + 1) * 100) - 1) // ((idx + 1) * 100)
            if add < v[idx][0]:
                cnt += add
            else:
                cnt = 10 ** 10  
        ret = min(ret, cnt)
    return ret
 
 
if __name__ == '__main__':
    main()

Solution (Python):
import itertools
from typing import List, Tuple


def main():
    d, g = map(int, input().split())
    v = []
    for _ in range(d):
        p, c = map(int, input().split())
        v.append((p, c))

    print(ag(v, g))


def ag(v: List[Tuple[int, int]], g: int) -> int:
    ret = 10 ** 10
    for comb in itertools.product((False, True), repeat=len(v)):
        cnt, score = 0, 0
        for i, bit in enumerate(comb):
            if bit:
                score += (i + 1) * 100 * v[i][0] + v[i][1]
                cnt += v[i][0]
        if score < g:
            idx = len(v) - list(reversed(comb)).index(False) - 1
            add = ((g - score) + ((idx + 1) * 100) - 1) // ((idx + 1) * 100)
            if add < v[idx][0]:
                cnt += add
            else:
                cnt = 10 ** 10  
        ret = min(ret, cnt)
    return ret


if __name__ == '__main__':
    main()

Solution (Python):
import itertools
from typing import List, Tuple


def main():
    d, g = map(int, input().split())
    v = []
    for _ in range(d):
        p, c = map(int, input().split())
        v.append((p, c))

    print(ag(v, g))


def ag(v: List[Tuple[int, int]], g: int) -> int:
    
    v = [(i + 1, v[i][0], v[i][1]) for i in range(len(v))]

    result = 100 ** 10

    for j in range(len(v) + 1):
        for cb in itertools.combinations(v, j):
            sc = 0
            cnt = 0
            
            for (i, p, c) in cb:
                sc += i * 100 * p + c
                cnt += p

            for idx in reversed(range(len(v))):
                if sc >= g:
                    break
                if v[idx] in cb:
                    continue
                i, p, _ = v[idx]
                for _ in range(p - 1):
                    if sc >= g:
                        break
                    sc += i * 100
                    cnt += 1

            if sc >= g:
                result = min(result, cnt)
    return result


if __name__ == '__main__':
    main()

Solution (Python):
import copy

from typing import List, Tuple


def main():
    d, g = map(int, input().split())
    v = []
    for _ in range(d):
        p, c = map(int, input().split())
        v.append((p, c))

    print(ag(v, g))


def ag(v: List[Tuple[int, int]], g: int) -> int:
    
    v = [(i, p, c) for i, (p, c) in enumerate(v, 1)]

    result = 100 ** 10
    for j in range(2 ** len(v)):
        cb = []
        for k in range(len(v)):
            if ((j >> k) & 1):
                cb.append(v[k])

        sc = 0
        cnt = 0
        
        for (i, p, c) in cb:
            sc += i * 100 * p + c
            cnt += p

        for idx in reversed(range(len(v))):
            if sc >= g:
                break
            if v[idx] in cb:
                continue
            i, p, _ = v[idx]
            for _ in range(p - 1):
                if sc >= g:
                    break
                sc += i * 100
                cnt += 1

        if sc >= g:
            result = min(result, cnt)
    return result


if __name__ == '__main__':
    main()

Solution (Python):
import copy
import heapq

from typing import List, Tuple


def main():
    d, g = map(int, input().split())
    v = []
    for _ in range(d):
        p, c = map(int, input().split())
        v.append((p, c))

    print(ag(v, g))


def ag(v: List[Tuple[int, int]], g: int) -> int:
    rs = []
    
    v = [(i, p, c) for i, (p, c) in enumerate(v, 1)]

    for j in range(2 ** len(v)):
        cb = []
        for k in range(len(v)):
            if ((j >> k) & 1):
                cb.append(v[k])

        sc = 0
        cnt = 0
        
        for (i, p, c) in cb:
            sc += i * 100 * p + c
            cnt += p

        vv = [x for x in copy.copy(v) if not x in cb]
        while sc < g:
            if not vv:
                break
            i, p, _ = vv.pop()
            for _ in range(p - 1):
                if sc >= g:
                    break
                sc += i * 100
                cnt += 1

        if sc >= g:
            heapq.heappush(rs, cnt)
    return heapq.heappop(rs)


if __name__ == '__main__':
    main()

Solution (Python):
D,G=map(int,input().split())
import math
ans=10**9
prob=[]
for i in range(D):
  p,c=map(int,input().split())
  prob.append((p,c))
for i in range(2**D):
  i=format(i-1,'b').rjust(D,'0')
  alll=[]
  notall=[]
  for j in range(D):
    if i[j]=='1':
      alll.append(j)
    else:
      notall.append(j)
  if notall!=[]:
    maxnotall=notall[-1]  
  point=0
  tans=0
  for i in alll:
    point+=100*(i+1)*prob[i][0]+prob[i][1]
    tans+=prob[i][0]
  if point>=G:
    ans=min(tans,ans)
  if point<G:
    if 100*(maxnotall+1)*(prob[maxnotall][0]-1)>=G-point:
      tans+=math.ceil((G-point)/(100*(maxnotall+1)))
      ans=min(tans,ans)
    else:
      ans=ans

if ans==10**9:
  ans=0
  for i in range(D):
    ans+=prob[i][0]
print(ans)

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

ans = 100*11
for i in range(2**d):
    sum = 0
    cnt = 0
    a = []
    for j in range(d):
        if (i >> j) & 1 == 1:
            sum += (j+1)*100*pc[j][0] + pc[j][1]
            cnt += pc[j][0]
            a.append(j)
    if sum < g:
        for j in range(d):
            if d-j-1 not in a:
                for k in range(pc[d-j-1][0]):
                    if sum >= g:
                        break
                    sum += (d-j)*100
                    cnt += 1
    ans = min(ans, cnt)
print(ans)

Solution (Python):
import math

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

ans = float("inf")

for bit in range(1 << D):
    cnt = 0
    sum = 0
    pids = set(range(D))

    for i in range(D):
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            cnt += pc[i][0]
            pids.discard(i)

    if sum < G:
        pid = max(pids)
        n = min(pc[pid][0], math.ceil((G - sum) / ((pid + 1) * 100)))
        cnt += n
        sum += n * (pid + 1) * 100
        
    if sum >= G:
        ans = min(ans, cnt)

print(ans)

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

ans = 100000000000000

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):
import itertools
d,g=map(int,input().split())
p=[]
c=[]
for i in range(d):
    p1,c1=map(int,input().split())
    p.append(p1)
    c.append(c1//100)
n=list(itertools.permutations(list(range(1,d+1))))
ans=1024
g//=100
for i in range(len(n)):
    cnt=g
    cnt2=0
    for j in range(d):
        num3=n[i][j]
        num4=num3*p[num3-1]
        if num4>=cnt:
            cnt2+=((cnt-1)//num3)+1
            break
        elif num4+c[num3-1]>=cnt:
            cnt2+=p[num3-1]
            break
        else:
            cnt-=num4+c[num3-1]
            cnt2+=p[num3-1]
    ans=min(ans,cnt2)
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 i in range(2**D):
    tmp = 0
    cnt = 0
    dic = set(range(1, D+1))
    for j in range(D):
        if (i >> j)&1: 
            tmp += PC[j][0] * (j+1) * 100 + PC[j][1]
            cnt += PC[j][0]
            dic.discard(j+1)

    if tmp < G:
        t = max(dic)
        p, c = PC[t-1][0], PC[t-1][1]
        if t*100*p+c+tmp >= G:
            while p:
                tmp += t*100
                cnt += 1
                if tmp >= G:
                    break
            ans = min(ans, cnt)
    else:
        ans = min(ans, 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 i in range(1<<d):
  count = 0
  sum = 0
  nokori = set(range(1, d+1))
  
  for j in range(d):
    if i & (1 << j):
      sum += pc[j][0]*(j+1)*100 + pc[j][1]
      count += pc[j][0]
      nokori.discard(j+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):
import math
d,g=map(int,input().split())
p=[list(map(int,input().split())) for _ in range(d)]
ans=sum([i[0] for i in p])
for i in range(2**d-1):
    bit=bin(i)[2:].zfill(d)
    c,s,a=0,0,0
    for j in range(d):
        if bit[j]=='1':
            c+=p[j][0]
            s+=p[j][1]+100*(j+1)*p[j][0]
        else:
            a=max(a,j)
    short=g-s
    pc=max(math.ceil(short/((a+1)*100)),0)
    if pc<p[a][0]:
        ans=min(c+pc,ans)
print(ans)