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

b = 1 << D
ans = float("inf")
for i in range(b):
    score = 0
    cnt = 0
    for j in range(D):
        b2 = 1<<j
        if i & b2:
            score += C[j] + P[j] * (j+1) * 100
            cnt += P[j]
    if score >= G:
        ans = min(ans, cnt)
        continue
    for j in range(D-1, -1, -1):
        b2 = 1<<j
        if i & b2 == 0:
            for k in range(P[j]-1):
                score += (j+1)*100
                cnt += 1
                if score >= G:
                    break
            if score >= G:
                break
    if score >= G:
        ans = min(ans, cnt)
print(ans)

Solution (Python):
from itertools import product

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

ans = float('inf')
for ptn in product([0, 1], repeat=D):
    total = 0
    cnt = 0
    for i in range(D):
        total += score[i][3] * ptn[i]
        cnt += score[i][1] * ptn[i]

    if 0 in ptn[::-1]:
        i = D - 1 - ptn[::-1].index(0)
        x = score[i]
    else:
        x = score[-1]

    for i in range(x[1]):
        if total >= G:
            break
        total += x[0]
        cnt += 1

    if total < G:
        cnt = float('inf')
    ans = min(ans, cnt)
print(ans)

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

for i in range(1<<D):
    t=G
    s=0
    for j in range(D):
        if i & (1<<j):
            s+=table[j][0]
            t=t-table[j][1]-table[j][0]*(j+1)*100
    if t<=0:
        ans=min(ans,s)
        
    else:
        j=D-1
        flag=True
        while flag and (j>=0):
            
            if not (i & (1<<j)):
                for u in range(table[j][0]-1):
                    if t<=0:
                        flag =False
                        break
                    else:
                        s+=1
                        t-=100*(j+1)
            j-=1
        if t<=0:
            ans=min(ans,s)
print(ans)

Solution (Python):
d,g=map(int,input().split())
data=[]
cp=[]
for  i in range(1,d+1):
    p,c=map(int,input().split())
    data.append(p)
    cp.append(c)
a=99999999
for i in range(1024):
    ct=0
    ans=0
    tmp=data[:]
    for j in range(d):
        if i&(1<<j):
            ct+=100*(j+1)*data[j]+cp[j]
            ans+=data[j]
            tmp[j]=0
            
    p=len(tmp)-1
    while ct<g :
        if tmp[p]>1:
            ct+=100*(p+1)
            tmp[p]-=1
            ans+=1
        else:
            p-=1
        if p<0:
            ans=99999999
            break
    a=min(a,ans)
print(a)

Solution (Python):

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

D, G = inpl()
P = []
C = []
for _ in range(D):
    p, c = inpl()
    P.append(p)
    C.append(c)

ans = 10000

for c in range(2**D):
    score = 0
    solved = 0
    remain = []
    for i, b in enumerate(format(c, "b").zfill(D)):
        if b == "1":
            score += P[i]*100*(i+1) + C[i]
            solved += P[i]
        else:
            remain.append(i)
    if score < G:
        R = G - score
        j = remain[-1]
        if (P[j] - 1)*(j+1)*100 < R:
            continue
        solved += -(-R//(100*(j+1)))
    ans = min(solved, ans)
print(ans)

Solution (Python):
from itertools import permutations

d, g = map(int, input().split())
g = g // 100
p = []
c = []

for _ in range(d):
	pp, cc = map(int, input().split())
	p.append(pp)
	c.append(cc // 100)

ans = float("inf")
for array in permutations(range(d)):
	gap = g
	num = 0
	for a in array:
		if p[a] * (a + 1) >= gap:
			num += (gap - 1) // (a + 1) + 1
			break
		elif p[a] * (a + 1) + c[a] >= gap:
			num += p[a]
			break
		else:
			num += p[a]
			gap -= p[a] * (a + 1) + c[a]

	if num < ans:
		ans = num

print(ans)

Solution (Python):
D, G = map(int, input().split())
s = 0
Q = []
for i in range(D):
    p, c = map(int, input().split())
    s += p
    Q.append((i+1, p, c))
dp = [-10**18]*(s+1)

dp[0] = 0
for i, p, c in Q:
    for j in range(s, -1, -1):
        for k in range(1, p+1):
            if k == p:
                cc = 100*i*k + c
            else:
                cc = 100*i*k
            if j - k >= 0:
                dp[j] = max(dp[j], dp[j - k] + cc)
for i in range(1+s):
    if dp[i] >= G:
        print(i)
        break

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

D, G = na()
p = []
c = []
for i in range(D):
    x, y = na()
    p.append(x)
    c.append(y)

ans = 99999999
for i in range(1<<D):
    ct = 0
    score = 0
    for j in range(D):
        if i>>j&1:
            score += c[j]
            score += p[j] * (j+1) * 100
            ct += p[j]
    for j in range(D-1, -1, -1):
        if i>>j&1: continue
        if score >= G: break
        g = (j+1)*100
        got = (G-score+g-1)//g
        score += min(got, p[j]) * g
        ct += min(got, p[j])
    ans = min(ans, ct)
print(ans)

Solution (Python):
D,G = map(int, raw_input().split())
p = [0]*D
c = [0]*D
for i in range(D):
  p[i],c[i] = map(int, raw_input().split())

ans = sum(p)
for b in range(1<<D):
  s = 0
  a = 0
  for i in range(D):
    if b>>i&1:
      s += p[i]*(i+1)*100 + c[i]
      a += p[i]
  for i in range(D)[::-1]:
    if not b>>i&1:
      if s>=G:
        break
      t = min(p[i], (G-s+(i+1)*100-1)/((i+1)*100))
      s += t*(i+1)*100
      a += t
  ans = min(ans, a)
print ans

Solution (Python):
def main():
    d, g = map(int, input().split())
    probs = []
    ans = 0
    for i in range(d):
        p, c = map(int, input().split())
        probs.append(((i + 1) * 100, p, c))
        ans += p

    for mask in range(1 << d):
        solved = 0
        my_score = 0
        for i in range(d):
            score, occ, bonus = probs[i]
            if (mask & (1 << i)) > 0:
                solved += occ
                my_score += score * occ + bonus

        for x in range(d - 1, -1, -1):
            if my_score >= g:
                break
            if (mask & (1 << x)) > 0:
                continue
            score, occ, bonus = probs[x]
            for _ in range(occ):
                solved += 1
                my_score += score
                if my_score >= g:
                    break
        if my_score >= g:
            ans = min(ans, solved)

    print(ans)

main()