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())
Pb=[]
for _ in range(D):
    p,c=map(int,input().split())
    Pb.append((p,c))

Ans=10**4+1

for i in range(2**D):
    score=0
    cnt=0
    max_flg=-1
    for j in range(D):
        p,c=Pb[j]
        if (i>>j)&1:
            score+=p*(j+1)*100+c
            cnt+=p
        else:
            max_flg=j
    
    if score<G:
        if max_flg==-1:
            continue
        if -(-(G-score)//((max_flg+1)*100))>=Pb[max_flg][0]:
             continue
        else:
            cnt+=-(-(G-score)//((max_flg+1)*100))
    
    Ans=min(Ans,cnt)
    

print(Ans)

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

import math
INF = 1<<30
ans = INF
A = [i for i in range(D)]

permu = permutations(A)

for pp in permu:
    points = 0
    count = 0
    for i in pp:
        if points>=G:
            break
        if points+(i+1)*100*pc[i][0]>=G:
            count += math.ceil((G-points)/(100*(i+1)))
            break
        else:
            count += pc[i][0]
            points += (i+1)*100*pc[i][0]+pc[i][1]
        
    ans = min(ans,count)

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

min_count = 10 ** 10
for use in product(range(2), repeat=d):
    count = 0
    total = 0
    for i in range(d):
        if use[i]:
            total += (i + 1) * 100 * PC[i][0] + PC[i][1]
            count += PC[i][0]
    if total >= g:
        if count < min_count:
            min_count = count
    else:
        for i in range(d):
            if use[i]:
                continue
            if total + (i + 1) * 100 * (PC[i][0] - 1) >= g:
                tmp_count = count + ceil((g - total) // 100 / (i + 1))
                if tmp_count < min_count:
                    min_count = tmp_count

print(min_count)

Solution (Python):
d, g = map(int, input().split())

p, c = [], []
for _ in range(d):
     tp, tc = map(int, input().split())
     p.append(tp)
     c.append(tc)

ans = float("inf")
for bit in range(2 ** d):
    s_temp = 0
    p_temp = 0
    m_temp = -1
    for dd in range(d):
        if (bit >> dd) & 1:
            s_temp += p[dd] * (dd+1) * 100 + c[dd]
            p_temp += p[dd]
        else:
            m_temp = dd
            
    diff = g - s_temp
    
    if diff <= 0:
        ans = min(ans, p_temp)
    elif m_temp != -1:
        from math import ceil
        tt = ceil(diff / (m_temp+1) / 100)
        if tt <= p[m_temp]:
            ans = min(ans, p_temp + tt)

print(ans)

Solution (Python):
D, G = map(int, input().split())
p_list = []
c_list = []
for i in range(D):
    list_for = list(map(int, input().split()))
    p_list.append(list_for[:][0])
    c_list.append(list_for[:][1])

memo = 0
count_list=[]
for i in range(1<<D):
    sum = 0
    count = 0
    lcount = 1
    del memo
    for j in range(D):
        if (i>>j)&1:
            sum += 100*(j+1)*p_list[j]+c_list[j]
            count += p_list[j]
        else:
            memo = j


    while G-sum > 0 and lcount<p_list[memo]:
        sum += 100*(memo+1)
        lcount += 1
        count += 1
    if sum >= G:
        count_list.append(count)

print(min(count_list))

Solution (Python):
import sys
input = sys.stdin.readline
f = lambda:map(int,input().split())
d,g = f()
g//=100
ll = []
for i in range(d):
  p,c = f()
  ll.append([i+1,p,c//100])
ll = ll[::-1]
import itertools as it
ans = 10**9
for t in it.product(range(2),repeat=d):
  cnt = 0
  tot = 0
  flg = 1
  lg = [1,0]
  for i,b in enumerate(t):
    u,p,c = ll[i]
    if b:
      cnt += p
      tot += u*p+c
    elif flg:
      lg = [u,p]
      flg = 0
  if g <= tot+lg[0]*lg[1]:
    ans=min(ans,cnt+max(g-tot,0)//lg[0])
print(max(ans,1))

Solution (Python):
import sys
input = sys.stdin.readline
f = lambda:map(int,input().split())
d,g = f()
g//=100
ll = []
for i in range(d):
  p,c = f()
  ll.append([i+1,p,c//100])
ll = ll[::-1]
import itertools as it
ans = 10**9
for t in it.product(range(2),repeat=d):
  cnt = 0
  tot = 0
  flg = 1
  lg = [1,0]
  for i,b in enumerate(t):
    u,p,c = ll[i]
    if b:
      cnt += p
      tot += u*p+c
    elif flg:
      lg = [u,p]
      flg = 0
  if g <= tot+lg[0]*lg[1]:
    ans=min(ans,cnt+max(g-tot,0)//lg[0])
print(max(1,ans))

Solution (Python):
[d,g]=list(map(int,input().split()))
pc=[]
for i in range(d):
    kari=list(map(int,input().split()))
    pc.append(kari)
gokei=[]
for i in range(d):
    gokei.append(100*(i+1)*pc[i][0]+pc[i][1])

kosumin=10000
for i in range(1<<d):
    score=0
    kosu=0
    jmax=0
    siyouzumi=[]
    for j in range(d):
        if ((i>>j)&1)==1:
            score+=gokei[j]
            kosu+=pc[j][0]
            siyouzumi.append(j)

    if score>=g:
        if kosumin>kosu:
            kosumin=kosu
    if score<g:
        a=d-1
        while True:
            if a==-1:
                break
            if not a in siyouzumi:
                saidai=a
                break
            a-=1
        if a==-1:
            continue

        for k in range(pc[saidai][0]):
            score+=(saidai+1)*100
            kosu+=1
            if k==pc[saidai][0]-1:
                score+=pc[saidai][1]
            if score>=g:
                break
        if score>=g and kosumin>kosu:
            kosumin=kosu
print(kosumin)

Solution (Python):
D,G=map(int, input().split())
G //= 100
dp = [ [ 0 for i in range(1105) ] for i in range(12) ]
for i in range(1,D+1):
  p, c = map(int, input().split())
  c //= 100
  for j in range(1005):
    for k in range(p):
      dp[i][j+k] = max( dp[i][j+k], dp[i-1][j] + k*i)
    dp[i][j+p] = max( dp[i][j+p], dp[i-1][j] + p*i + c)

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

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

for i in range(2 ** d):
    cnt = 0
    point = 0
    for j in range(d):
        if (i >> j) & 1:
            point += 100 * (j + 1) * scores[j][0]
            point += scores[j][1]
            cnt += scores[j][0]
    if point >= g:
        pod.append(cnt)
        continue
    else:
        for p in range(d - 1, -1, -1):
            if not (i >> p) & 1:
                for q in range(scores[p][0]):
                    if point < g:
                        point += (p + 1) * 100
                        cnt += 1
                    else:
                        continue
    pod.append(cnt)

print(min(pod))

Solution (Python):
n, g = map(int, input().split())

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

p = [pc[i][0] for i in range(n)]
c = [pc[i][0]*(i+1)*100+pc[i][1] for i in range(n)]


ans = 1e18
for i in range(1<<n):
    sm = cnt = idx = 0
    for j in range(n):
        if (i>>j)&1:
            sm += c[j]
            cnt += p[j]
        else:
            idx = j+1
    if g-sm>0:
        tmp = (g-sm+idx*100-1)//(idx*100)
        if 0<=tmp<=p[idx-1]: ans = min(ans, cnt+tmp)
    else: ans = min(ans, cnt)
print(ans)

Solution (Python):
'''
最小となる問題数のケースは2通り。
1. 得点の大きい問題から順に解いていく
2. コンプリートボーナスの大きい問題から解いていく
どちらのケースでも解いた問題の組み合わせは以下となる
(a)コンプリートボーナスを獲得した問題 * n + (b)一部だけ解いている問題
'''

D, G = map(int, input().split())


PC = [0] * D
for i in range(D):
    P, C = map(int, input().split())
    PC[i] = [P, 100 * (i + 1) * P + C, 100 * (i + 1)]




ans = 10 * 100
for i in range(2 ** D):
    bit = format(i, '0' + str(D) + 'b') 
    score = 0 
    solve = 0

    

    
    for j in range(D):
        if bit[j] == "1":
            score += PC[j][1]
            solve += PC[j][0]
            

    
    if score < G:
        for k in range(D):
            
            if bit[-(k+1)] == "0":
                sol = min((G - score) // PC[-(k+1)][2], PC[-(k+1)][0] - 1) 
                if sol == 0:
                    sol = 1
                score += PC[-(k+1)][2] * sol
                solve += sol
                
                break

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

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)
cnt = 10 ** 5
for i in range(2**d):
    tmp = 0
    ans = 0
    for j in range(d):
        if i >> j & 1:
            tmp += p[j]
            ans += c[j] + p[j] * 100 * (j + 1)
    for j in range(d-1, -1, -1):
        if ans >= g:
            break
        if i >> j & 1:
            continue
        for k in range(p[j] - 1):
            ans += 100 * (j + 1)
            tmp += 1
            if ans >= g:
                break
    if ans >= g:
        cnt = min (tmp, cnt)
print(cnt)

Solution (Python):
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for _ in range(d)]
ans=0
for i in range(1<<d):
  p=0
  cnt=0
  for j in range(d):
    if (i>>j)&1:
      p+=100*(j+1)*pc[j][0]+pc[j][1]
      cnt+=pc[j][0]
  if g>p:
    for k in range(d)[::-1]:
      if (i>>k)&1==0:
        if g-p<=100*(k+1)*(pc[k][0]-1):
          cnt+=-(-(g-p)//(100*(k+1)))
          break
        else:
          cnt=10**5
          break
  if ans==0 or ans>cnt:
    ans=cnt
print(ans)

Solution (Python):

D, G = [int(i) for i in input().split()]
p = []
c = []
num_solves = []
for i in range(D):
    p_i, c_i = [int(i) for i in input().split()]
    p.append(p_i)
    c.append(c_i)


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


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

print(min(num_solves))

Solution (Python):
D, G = [int(x) for x in input().split()]
lst = [[int(x) for x in input().split()] for i in range(D)]
bit = 0
min_n = float('inf')
while bit < (1 << D):
    
    
    
    score = 0
    n = 0
    for i in range(D):
        if bit & (1 << i):
            score += 100 * (i + 1) * lst[i][0] + lst[i][1]
            n += lst[i][0]
    
    if score < G:
        
        max_i = -1
        for i in reversed(range(D)):
            if not bit & (1 << i):
                max_i = i
                break
        
        if max_i >= 0:
            for j in range(lst[max_i][0]):
                score += 100 * (max_i + 1)
                if score >= G:
                    n += j + 1
                    break
            if score < G:
                bit += 1
                continue
    if min_n > n:
        min_n = n
    bit += 1
print(min_n)

Solution (Python):
import numpy as np

d,g=[int(c) for c in input().split(" ")]

p=[0]*(d+1)
c=[0]*(d+1)

for i in range(1,d+1):
    pp,cc=[int(c) for c in input().split(" ")]
    p[i]=pp
    c[i]=cc

def rec(i,g,flag):
    if i==d+1:
        cnt=0
        if g<=0:
            return 0

        for j in range(d,0,-1):
            bit=flag%2
            flag//=2

            if bit==0:
                ptsperprob=j*100
                psolved=min(p[j]-1,int(np.ceil(g/ptsperprob)))

                g-=psolved*ptsperprob
                cnt+=psolved

                if g<=0:
                    return cnt
        
        return 10000

    return min(p[i]+rec(i+1,g-c[i]-p[i]*100*i,2*flag+1),rec(i+1,g,2*flag))

print(rec(1,g,0))

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


l = l[::-1]

ans = float("inf")
for i in range(2**D):
    total = 0
    cnt = 0
    for j in range(D):
        if (i>>j)&1:
            total += 100*(D-j)*l[j][0] + l[j][1]
            cnt += l[j][0]
    if total >= G:
        ans = min(ans,cnt)
        continue
    for j in range(D):
        if (i>>j)&1 == False:
            for k in range(l[j][0]):
                total += 100*(D-j)
                cnt+=1
                if total >= G:
                    ans = min(ans,cnt)
                    break
            break

print(ans)

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


l = l[::-1]

ans = float("inf")
for i in range(2**D):
    total = 0
    cnt = 0
    for j in range(D):
        if (i>>j)&1:
            total += 100*(D-j)*l[j][0] + l[j][1]
            cnt += l[j][0]
    if total >= G:
        ans = min(ans,cnt)
        continue
    for j in range(D):
        if (i>>j)&1 == False:
            for k in range(l[j][0]):
                total += 100*(D-j)
                cnt+=1
                if total >= G:
                    ans = min(ans,cnt)
                    break
            else:
                continue
            break

print(ans)

Solution (Python):
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue


Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)


class Dijkstra:
 
    def __init__(self, rote_map, start_point, goal_point=None):
        self.rote_map = rote_map
        self.start_point = start_point
        self.goal_point = goal_point
 
    def execute(self):
        num_of_city = len(self.rote_map)
        dist = [float("inf") for _ in range(num_of_city)]
        prev = [float("inf") for _ in range(num_of_city)]
 
        dist[self.start_point] = 0
        heap_q = []
        heapq.heappush(heap_q, (0, self.start_point))
        route_count = [0 for _ in range(num_of_city)]
        route_count[self.start_point] = 1
        while len(heap_q) != 0:
            prev_cost, src = heapq.heappop(heap_q)
 
            if dist[src] < prev_cost:
                continue
 
            for dest, cost in self.rote_map[src].items():
                if cost != float("inf") and dist[dest] > dist[src] + cost:
                    dist[dest] = dist[src] + cost
                    heapq.heappush(heap_q, (dist[dest], dest))
                    prev[dest] = src
                if dist[dest] == dist[src] + cost:
                    route_count[dest] += route_count[src]
 
        if self.goal_point is not None:
            return self._get_path(self.goal_point, prev)
        else:
            return dist, route_count
 
    def _get_path(self, goal, prev):
        path = [goal]
        dest = goal
 
        while prev[dest] != float("inf"):
            path.append(prev[dest])
            dest = prev[dest]
 
        return list(reversed(path))

        
def main(): 
    d,g = map(int,input().split())
    pc = [list(map(int,input().split())) for i in range(d)]
    p = [pc[i][0] for i in range(d)]
    c = [pc[i][1] for i in range(d)]
    def dfs(cur,tar):
        if cur == 0:
            return 10**9
        cnt = min(tar//(cur*100),p[cur-1])
        tmp = 100*cur*cnt
        if cnt == p[cur-1]:
            tmp += c[cur-1]
        if tmp < tar:
            cnt += dfs(cur-1,tar-tmp)
        return min(cnt,dfs(cur-1,tar))

    print(dfs(d,g))
if __name__ == "__main__":
    main()

Solution (Python):
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue


Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)


class Dijkstra:
 
    def __init__(self, rote_map, start_point, goal_point=None):
        self.rote_map = rote_map
        self.start_point = start_point
        self.goal_point = goal_point
 
    def execute(self):
        num_of_city = len(self.rote_map)
        dist = [float("inf") for _ in range(num_of_city)]
        prev = [float("inf") for _ in range(num_of_city)]
 
        dist[self.start_point] = 0
        heap_q = []
        heapq.heappush(heap_q, (0, self.start_point))
        route_count = [0 for _ in range(num_of_city)]
        route_count[self.start_point] = 1
        while len(heap_q) != 0:
            prev_cost, src = heapq.heappop(heap_q)
 
            if dist[src] < prev_cost:
                continue
 
            for dest, cost in self.rote_map[src].items():
                if cost != float("inf") and dist[dest] > dist[src] + cost:
                    dist[dest] = dist[src] + cost
                    heapq.heappush(heap_q, (dist[dest], dest))
                    prev[dest] = src
                if dist[dest] == dist[src] + cost:
                    route_count[dest] += route_count[src]
 
        if self.goal_point is not None:
            return self._get_path(self.goal_point, prev)
        else:
            return dist, route_count
 
    def _get_path(self, goal, prev):
        path = [goal]
        dest = goal
 
        while prev[dest] != float("inf"):
            path.append(prev[dest])
            dest = prev[dest]
 
        return list(reversed(path))

        
def main(): 
    d,g = map(int,input().split())
    pc = [list(map(int,input().split())) for i in range(d)]
    p = [pc[i][0] for i in range(d)]
    c = [pc[i][1] for i in range(d)]
    ans = 10**9
    def dfs(cur,tar):
        if cur == 0:
            return 10**9
        cnt = min(tar//(cur*100),p[cur-1])
        tmp = 100*cur*cnt
        if cnt == p[cur-1]:
            tmp += c[cur-1]
        if tmp < tar:
            cnt += dfs(cur-1,tar-tmp)
        return min(cnt,dfs(cur-1,tar))
    print(dfs(d,g))
if __name__ == "__main__":
    main()

Solution (Python):

D,G=map(int,input().split(" "))
Comp={}
for i in range(D):
  p,c=map(int,input().split(" "))
  Comp[i]=[p,c]
Min=1000000000
for i in range(2**(D)):
  answer=0
  score=0
  Clear=[]
  for j in range(D):
    if ((i>>j)&1):
      score+=(j+1)*100*Comp[j][0]
      score+=Comp[j][1]
      answer+=Comp[j][0]
      Clear.append(j+1)
  No=D
  Count=0
  while score<G and No>=1:
    if No in Clear or Count==Comp[No-1][0]:
      Count=0
      No-=1
    score+=100*No
    Count+=1
    answer+=1
  Min=min(Min,answer)
print(Min)

Solution (Python):

D,G=map(int,input().split(" "))
Comp={}
for i in range(D):
  p,c=map(int,input().split(" "))
  Comp[i]=[p,c]
Min=1000000000
for i in range(2**(D)):
  answer=0
  score=0
  Clear=[]
  for j in range(D):
    if ((i>>j)&1):
      score+=(j+1)*100*Comp[j][0]
      score+=Comp[j][1]
      answer+=Comp[j][0]
      Clear.append(j+1)
  No=D
  Count=0
  while score<G and No>=1:
    if No in Clear or Count==Comp[No-1][0]:
      Count=0
      No-=1
    score+=100*No
    Count+=1
    answer+=1
  if score>=G:
    Min=min(Min,answer)
print(Min)

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

ret = 1000
for i in range(2 ** D):
  s=S[:]
  tot=0
  top=0
  m=0
  am=0
  for j in range(D):
    if (i >> j) & 1:
      s.remove(j)
      tot += iPC[j][0]
      top += iPC[j][1]
  if top<G and len(s)>0:
    m=max(s)
    am=(G-top+((m+1)*100-1))//((m+1)*100)
    if am<iPC[m][0]:
      tot+=am
    else:
      tot=1000

  ret=min(ret,tot)
print(ret)

Solution (Python):
d,g = map(int,input().split())
p = []
c = []
for i in range(d):
    x,y = map(int,input().split())
    p.append(x)
    c.append(y)
ans = 10000
for i in range(1<<d):
    s = cnt = 0
    rest_max = -1
    for j in range(d):
        if (i>>j)&1:
            s += c[j] + 100*(j+1)*p[j]
            cnt += p[j]
        else:
            rest_max = j
    if s < g:
        if g-s > (p[rest_max]-1)*(rest_max+1)*100:
            continue
        else:
            cnt += (g-s-1)//((rest_max+1)*100)+1
    ans = min(ans, cnt)
print(ans)

Solution (Python):
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue


Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): 
    d,g = map(int,input().split())
    pc = [list(map(int,input().split())) for i in range(d)]
    p = [pc[i][0] for i in range(d)]
    c = [pc[i][1] for i in range(d)]
    ans = 10 ** 9
    def dfs(i,pro):
        if i == 0:
            return 10**9
        cnt = min(pro//(i*100),p[i-1])
        tmp = 100*i*cnt
        if cnt == p[i-1]:
            tmp += c[i-1]
        if tmp < pro:
            cnt += dfs(i-1,pro-tmp)
        return min(cnt,dfs(i-1,pro))
    print(dfs(d,g))
if __name__ == "__main__":
    main()

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


l = l[::-1]

ans = float("inf")
for i in range(2**D):
    total = 0
    cnt = 0
    for j in range(D):
        if (i>>j)&1:
            total += 100*(D-j)*l[j][0] + l[j][1]
            cnt += l[j][0]
    if total >= G:
        ans = min(ans,cnt)
        continue
    for j in range(D):
        if (i>>j)&1 == False:
            for k in range(l[j][0]):
                total += 100*(D-j)
                cnt+=1
                if total >= G:
                    ans = min(ans,cnt)
                    break
            else:
                continue
            break
print(ans)

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
D,G=map(int, input().split())
G//=100
p=[list(map(int, input().split())) for i in range(D)]
m=[None]*D
for i in range(D):
    m[i]=p[i][0]*(i+1)+p[i][1]//100
l=[None]*2**D
for i in range(2**D):
    l[i]="{:0>{}b}".format(i,D)
a=1000
for i in l:
    c=0
    t=0
    for j in range(D):
        if i[j]=="1":
            t+=m[j]
            c+=p[j][0]
    if t>G:
        if a>c:
            a=c
        continue
    s=i.rfind("0")
    if t+(s+1)*p[s][0]>G:
        c+=(G-t-1)//(s+1)+1
        if a>c:
            a=c
print(a)

Solution (Python):
from math import ceil

D, G = map(int, input().split())
Pd, Cd = [0] * D, [0] * D

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


ans = float("inf")
for i in range(1 << D):
    score, solved, unsolved = 0, 0, 0
    for j in range(D):
        if i & (1 << j):
            score += 100 * (j+1) * Pd[j] + Cd[j]
            solved += Pd[j]
        else:
            unsolved = j

    rest = G - score
    if rest > 0:
        k = 100 * (unsolved+1)
        if k * Pd[unsolved] < rest:
            continue
        solved += ceil(rest/k)

    ans = min(ans, solved)

print(ans)

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

ans=1000

for b in range(1<<d):
  s=0
  cnt=0
  for i in range(d):
    if b&(1<<i):
      s+=l[i][0]*(i+1)*100+l[i][1]
      cnt+=l[i][0]
  for i in range(d-1,-1,-1):
    if not b&(1<<i):
      for j in range(1,l[i][0]):
        if s<g:
          s+=(i+1)*100
          cnt+=1
  if s>=g:
    ans=min(ans,cnt)
print(ans)

Solution (Python):
from itertools import product

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

for _ in range(D):
  pi,ci=map(int,input().split())
  p.append(pi)
  c.append(ci)
  
ans=10**4
  
for cpls in product(range(2),repeat=D):
  num=0
  tensu=0
  for i,v in enumerate(cpls,start=1):
    if v==1:
      tensu+=i*100*p[i-1]+c[i-1]
      num+=p[i-1]
  if tensu>=G:
    ans=min(ans,num)
    continue
  for i,v in reversed(list(enumerate(cpls,start=1))):
    if v==0:
      for _ in range(p[i-1]-1):
        tensu+=100*i
        num+=1
        if tensu>=G:
          ans=min(ans,num)
          break
print(ans)

Solution (Python):
import math

D,G = list(map(int,input().split()))
lst = [list(map(int,input().split())) for i in range(D)]
for i in range(10-D):
    lst.append([0,0]) 
lst.insert(0,[])

ans = 1000
for i in range(1024):
    bin_i = format(i,'b').zfill(11)
    tmp = G
    solved = 0
    for j in range(1,11):
        if bin_i[j] == "1":
            tmp -= lst[j][0]*j*100 + lst[j][1]
            solved += lst[j][0]
    if 0 < tmp:
        for j in range(10,0,-1):
            if bin_i[j] == "0" and lst[j][0] != 0:
                if tmp <= (lst[j][0]-1)*j*100:
                    solved += math.ceil(tmp/(j*100))
                    break
        else:
            
            continue
        ans = min(ans,solved)
    else:
        ans = min(ans,solved)
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=10e+9

for i in range(2**D):
    sum=0
    q=0
    for j in range(D):
        if(i>>j & 1):
            sum+=(j+1)*100*p[j]+c[j]
            q+=p[j]
        else:
            rest_max=j
    if(sum<G):
        r1=100*(rest_max+1)
        need=-(-(G-sum)//r1)
        if(need>p[rest_max]-1):
            continue
        q+=need
        sum+=need*r1
    
    if(sum>=G):
        ans=min(ans,q)

print(ans)