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. 



Sample input:
2 700
3 500
5 800


Sample output:
3

Submission status: Runtime Error

Solution code:
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 = 10**6

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

Submission status: Runtime Error

Solution code:
import math
from collections import defaultdict as dd

D, G = map(int, input().split())
sumd = []
p = []
c = []
d = []
for i in range(D):
    a, b = map(int, input().split())
    p.append(a)
    c.append(b)

for i in range(D):
    sumd.append((i+1) * 100 * p[i] + c[i])
    d.append(((i+1) * 100 * p[i] + c[i])/p[i])

temp = 0
temp_i = 0
lis = list(range(D))
rest_sum = G
count = 0
while(rest_sum > 0):
    for i in lis:
        if d[i] >= temp:
            temp = d[i]
            temp_i = i
    lis.remove(temp_i)
    if sumd[temp_i] < rest_sum:
        rest_sum -= sumd[temp_i]
        temp = 0
        count += p[temp_i]
    else:
        while(rest_sum > 0):
            max_i = max(lis)
            if rest_sum >= p[max_i] * 100 * (max_i+1) and rest_sum <= sumd[max_i]:
                count += p[max_i]
                rest_sum -= sumd[max_i]
            elif rest_sum < p[max_i] * 100 * (max_i+1):
                count += math.ceil(rest_sum/((max_i+1) * 100))
                rest_sum -= p[max_i] * 100 * (max_i+1)
            else:
                rest_sum -= p[max_i] * 100 * (i+1)
                lis.remove(max_i)
                count += p[max_i]

print(count)

Submission status: Runtime Error

Solution code:
D, G = map(int, input())

Submission status: Runtime Error

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
    ckm = max(ck)
    for k in range(PC[ckm][0]):
      t += (ckm+1)*100
      c += 1
      if t >= G:
        l.append(c)
        break
      
print(min(l))

Submission status: Runtime Error

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
      for k in range(PC[j][0]):
        t += (max(ck)+1)*100
        c += 1
        if t >= G:
          l.append(c)
      
print(min(l))

Submission status: Runtime Error

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
    for k in range(PC[j][0]):
      t += (max(ck)+1)*100
      c += 1
      if t >= G:
        l.append(c)
      
print(min(l))

Submission status: Runtime Error

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
    while t < G:
      t += (max(ck)+1)*100
      c += 1
    l.append(c)
      
print(min(l))

Submission status: Runtime Error

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
    while t < G:
      t += (max(ck)+1)*100
      c += 1
    l.append(c)
      
print(c)

Submission status: Runtime Error

Solution code:
import numpy as np

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

PC = []
ans = 10 ** 9

for _ in range(D):
    PC.append(list(map(int, input().split())))

PC = np.array(PC)

for i in range(2 ** D):
    score = 0
    count = 0

    for j in range(D):
        if (i >> j) & 1:

          	score += (j+1) * 100 * PC[j,0] + PC[j,1]
            count += PC[j,0]

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

    if score < G:
      for k in range(D):
            sub_score = 0
            sub_count = 0

            if ~(i >> k) & 1:
                for _ in range(PC[k,0] - 1):
                    sub_score += (k+1) * 100
                    sub_count += 1
                    if sub_score >= (G - score):
                        ans = min(ans, count+sub_count)
                        break


print(ans)

Submission status: Runtime Error

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append([c,i,t-G])
    
b = min(l)
p = 0
for j in range(D):
  if ((b[1] >> j) & 1):
    if b[2] < PC[j][1]+(j+1)*100:
      b[2] -= PC[j][1]+(j+1)*100
      ct = 1
      while b[2] > [j +1]:
        b[2] -= (j+1)*100
        ct += 1
    
print(b[0]-ct)

Submission status: Runtime Error

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)

print(min(c))

Submission status: Runtime Error

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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]
  
PC1.sort(reverse=True)
accum = 0
ans = 0
for i in range(D):
  dm = PC1.index(max(PC1[min(i+1,D):],key=(lambda x: x[2])))
  if G - accum < (PC1[dm][1]-1) * PC1[dm][2]:
    for j in range(PC1[dm][1]):
      accum += PC1[dm][2]
      ans += 1
      if accum >= G:
        print(ans)
        exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)

Submission status: Runtime Error

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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]
  
PC1.sort()
accum = 0
ans = 0
for i in range(D):
  dm = PC1.index(max(PC1[min(i+1,D):],key=(lambda x: x[2])))
  if G - accum < (PC1[dm][1]-1) * PC1[dm][2]:
    for j in range(PC1[dm][1]):
      accum += PC1[dm][2]
      ans += 1
      if accum >= G:
        print(ans)
        exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)

Submission status: Runtime Error

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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]
  
PC1.sort()
accum = 0
ans = 0
for i in range(D):
  dm = PC1.index(max(PC1[min(i+1,D):],key=(lambda x: x[2])))
  if G - accum < PC1[dm][1] * PC1[dm][0]:
    for j in range(PC1[dm][1]):
      accum += PC1[dm][2]
      ans += 1
      if accum >= G:
        print(ans)
        exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)

Submission status: Runtime Error

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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]

count = 0
for j in range(D):
  count += PC[j][0]
  
PC1.sort()
accum = 0
ans = 0
for i in range(count):
  if G - accum < D * (PC[D-1][0]-1):
    for j in range(PC[D-1][0]-1):
      accum += D*100
      ans += 1
      if accum >= F:
        print(ans)
        exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)

Submission status: Runtime Error

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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]

count = 0
for j in range(D):
  count += PC[j][0]
  
PC1.sort()
accum = 0
ans = 0
for i in range(count):
  if G - accum < D * (PC[D-1][0]-1)
    for j in range(PC[D-1][0]-1):
      accum += D*100
      ans += 1
      if accum >= F:
        print(ans)
        exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)

Submission status: Runtime Error

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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]

count = 0
for j in range(D):
  count += PC[j][0]
  
PC1.sort()
accum = 0
ans = 0
for i in range(count):
  if G - accum < D * (PC[D-1][0]-1)
    for j in range(PC[D-1][0]-1)
    accum += D*100
    ans += 1
    if accum >= F:
      print(ans)
      exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)

Submission status: Runtime Error

Solution code:
d, g = [int(i) for i in input().split()]
p = []
c = []
for i in range(d):
    x, y = [int(_) for _ in input().split()]
    p.append(x)
    c.append(y)

ans = 1
key = d-1
score_max = 0
cnt = 1
pat = [0 for i in range(d)]
while True:
    while pat[key] >= p[key]:
        key -= 1    
    score_max += (key+1) * 100
    pat[key] += 1

    if cnt in p:
        i = p.index(cnt)
        score = 100*(i+1)*p[i]+c[i]
        if score > score_max:
            score_max = score
            pat = [0 for i in range(d)]
            pat[i] = p[i]
            key = d -1
    if score_max >= g:
        break
    cnt += 1
print(cnt)

Submission status: Runtime Error

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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = list(((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1])

count = 0
for j in range(D):
  count += PC[j][0]
  
PC1.sort()
accum = 0
ans = 0
for i in range(count):
  for j in range(PC1[i][1]):
    accum += PC1[i][2]
    ans += 1
    if j = PC1[i][1]-1:
      accum += PC1[i][3]
    if accum >= G:
      print(ans)
      exit()
print(ans)

Submission status: Runtime Error

Solution code:
# ABC104-C

D,G=map(int,input().split()) 
box=[] 
for i in range(D): 
    box.append(list(map(int,input().split()))) 
box.insert(0,[0,0]) #数を１番目に合わせるため 
info=[[0,0] for i in range(2**D)] #各全完の組での点数、解いた問題数の記憶

for i in range(2*D): #全完したものをinfoに追加
    for j in range(1,D+1): #100j点の問題は全完するか 
        if (i>>(j-1))&1: 
            info[i][0]+=box[j][1]+j*100*box[j][0] 
            info[i][1]+=box[j][0] 
            info2[i][j]=box[j][0] #ｊ番目を全問解いている。

for i in range(2**D):
    score=G-info[i][0]
    if score<=0:
        continue
    else:
        n=D
        while score>0:
            #print(str(i)+":"+str(score))
            if (i>>(n-1))&1:
                continue
            else:
                for j in range(1,box[n][0]+1):
                    score -= 100*n
                    info[i][1]+=1 #解いた数を増やす
                    if j==box[n][0]: #ボーナス点追加
                        score-=box[n][1]
                    if  score<=0:
                        break
            n-=1
            
l=len(info)
for i in range(l-1):
    min=info[i][1]
    m=info[i]
    t=i
    for j in range(i+1,l):
        if min>info[j][1]:
            min=info[j][1]
            t=j
    info[i]=info[t]
    info[t]=m
print(info[0][1])

Submission status: Runtime Error

Solution code:
D,G = map(int,input().split())
G = G//100
pc = []

for i in range(D):
    p,c = maap(int,input().split())
    pc.append((p,c//100))

ans = 1e9

for i in range(1<<D):
    points = 0
    cost = 0
    for j in range(D):
        jbit = ((i>>j)&1)
        
        points += jbit*( (j+1)*pc[j][0] + pc[j][1])
        cost += jbit * pc[j][0]
        
    if points >= G:
        ans = min(ans,cost)
        continue
    res = G - points
    for k in range(D-1,-1,-1):
        kbit = ((i>>k)&1)
        if not kbit:
            test = res // (k+1)
            #print(test)
            if test <= pc[k][0]-1:
                res = 0
                cost += test
                ans = min(ans, cost)
            else:
                res -= (k+1)*(pc[k][0]-1)
                cost += pc[k][0]-1
    
print(ans)

Submission status: Runtime Error

Solution code:
D, G = map(int, input().split())
PC = [tuple(map(int, input().split())) for _ in range(D)]
minNum = 10**3

for i in range(2**D):
    point = 0
    num = 0
    leftOvers = []
    for j in range(D):
        if ((i>>j) & 1):
            num += PC[j][0]
            point += PC[j][1] + 100 * (j+1) * PC[j][0]
        else:
            leftOvers.extend([100*(j+1)]*PC[j][0])

    while point < G:
        point += leftOvers.pop()
        num += 1
    minNum = min(num, minNum)
print(minNum)

Submission status: Runtime Error

Solution code:
difficulties, goal = map(int, input().split())

pcs = [list(map(int, input().split())) for _ in range(difficulties)]

total_problem = 0
new_dp = [0] * 1001

for d, pc in enumerate(pcs, 1):
    dp = new_dp

    problem, complete = pc
    total_problem += problem

    score = {x: x*100*d for x in range(problem)}
    score[problem] = problem * 100 * d +complete

    for i in range(1, total_problem + 1):
        for j in range(0, i + 1):
            if i - j > problem:
                continue
            else:
                new_dp[i] = max(new_dp[i], dp[d-1][j] + score[i-j])

for i, a in enumerate(new_dp):
    if a >= goal:
        print(i)
        exit()

Submission status: Runtime Error

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

def func(i, t):
    if i == 0 or i > D:
        return 10 ** 9
    
    # Solve all problems, or part of them
    k = min(t // (100 * i), X[i][0])
    s = 100 * i * k
    
    # If all problems are solved, add bonus
    if k == X[i][0]:
        s += X[i][1]
        
    # If score < objective, go next step
    if s < t:
        k += func(i - 1, t - s)
        
    # Select minimum number of solved problems
    # k: solve i-th line
    # func(i-1,t): pass i-th line
    return min(k, func(i - 1, t))

# Solve backward
print(func(D, G))

Submission status: Runtime Error

Solution code:
D,G=[ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(D) ]

import itertools as ite
cmin = 100000000000000000
for cli in ite.product( *([[0,1]]*D) ):
  
  s = 0
  c = 0
  for i in range(D):
    if cli[i]==1:
      s +=  li[i][1] + (i+1)*100*li[i][0]
      c +=  li[i][0]
  
  ds = G-s
  
  for i in range(D-1,-1,-1):
    if (ds<=0):
      break
    if cli[i]==0:
      toku = (ds-1)//((i+1)*100)+1
      toku = min(toku,li[i][0])
      c += toku
      ds -= toku*(i+1)*100
    if (ds<=0):
      break
  if (ds<=0):
    cmin = min(cmin,c)
  else:
print (cmin)

Submission status: Runtime Error

Solution code:
import math

n,g=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(n)]
comp=[(100*(i+1)*arr[i][0]+arr[i][1]) for i in range(n)]
ans=10**10
for i in range(2**n):
  flag=format(i,'b')
  if len(flag)<n:
    flag='0'*(n-len(flag))+flag
  tsum=0
  tans=0
  for i in range(n):
    if flag[i]=='1':
      tsum+=comp[i]
      tans+=arr[i][0]
  if tsum>=g:
    ans=min(ans,tans)
  else:
    pos=flag[::-1].index('0')
    tq=math.ceil(g-tsum)/(100*(n-pos)))
    if tq<=arr[n-pos-1][0]:
      ans=min(ans,tans+tq)
print(ans)

Submission status: Runtime Error

Solution code:
from math import ceil
d, g = map(int, input().split())
data = [tuple(map(int, input().split())) for _ in range(d)]
ans = 0

for i in range(d):
    p, c = data[-i-1][0], data[-i-1][1]
    if g <= data[-i-2][0]*(d-i-1)*100+data[-i-2][1]:
        ans += min(ceil(g/p), data[-i-2][0])
        print(ans)
        exit()
    for j in range(p):
        g -= (d-i)*100
        ans += 1
        if j == p-1:
            g -= c
        if g <= 0:
            print(ans)
            exit()

Submission status: Runtime Error

Solution code:

import math

def main():
    num, goal = map(int, input().split())
    data = [0] + [list(map(int, input().split())) for i in range(num)]

    ans_num = 1000

    for i in range(num ** 2):
        bin_str = bin(i)
        bin_list = list(bin_str[2:])
        bin_list = ['0' for i in range(num - len(bin_list))] + bin_list
        bin_list.reverse()

        sum_value = 0
        now_num = 0

        for j in range(len(bin_list)):
            if bin_list[j] == '1':
                sum_value += data[j+1][0] * (j + 1) * 100 + data[j+1][1]
                now_num += data[j+1][0]

        if sum_value < goal:
            for j in range(len(bin_list))[::-1]:
                if bin_list[j] == '1':
                    continue
                honsuu = math.ceil((goal - sum_value) / ((j + 1) * 100))
                sum_value += min(honsuu, data[j+1][0] - 1) * (j + 1) * 100
                now_num += min(honsuu, data[j+1][0] - 1)
                break

        if sum_value >= goal:
            if now_num < ans_num:
                ans_num = now_num

    print(ans_num)





if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#3
d,g = map(int,input().split())
lista = []
for i in range(d):
    lista.append([])
    p,c = map(int,input().split())
    lista[i] = [p,c]
    
def search(allcomp,notouch,touch,rem,toachiev,ps):
    #allcomp 全部解く
    #notouch 触らない
    #touch 触る
    #残りの選択肢
    #達成までに必要な得点
    #ここまで解いてる問題数
    if touch != []:
        #print(allcomp,notouch,touch,rem,toachiev,ps)
        point = (touch[0] + 1)*100
        problems = lista[touch[0]][0]
        vnus =  lista[touch[0]][1]
        #print(point,problems,vnus)
        if toachiev == 0:
            return ps
        else:
            needproblems = toachiev//point
            if toachiev%point != 0:
                needproblems += 1
                
            if needproblems<=problems:
                return ps+needproblems
            else:
                if point*problems + vnus >= toachiev:
                    return ps+problems
                else:
                    return 10**9
                
    else:
        if len(rem)==1:
            if toachiev == 0:
                return ps
            else
                rempoint = (rem[0] + 1)*100
                notouchpoint_max = 0
                if notouch != []:
                    notouchpoint_max = (max(notouch) + 1)*100

                if notouchpoint_max <= rempoint:
                    return search(allcomp,notouch,rem,[],toachiev,ps)
                else:
                    return 10**9
        else:
            if toachiev == 0:
                return ps
            else:
                minp = 10**9
                for i in range(len(rem)):
                    allcomp_t,notouch_t,rem_t,toachiev_t,ps_t = list(allcomp),list(notouch),list(rem),toachiev,ps
                    allcomp_t.append(rem[i])
                    rem_t = rem[:i]+rem[i+1:]
                    toachiev_t = toachiev_t - (rem[i] + 1)*100*lista[rem[i]][0] - lista[rem[i]][1]
                    if toachiev_t <0:
                        toachiev_t = 0
                    ps_t = ps_t + lista[rem[i]][0]
                    case1 = search(allcomp_t,notouch_t,[],rem_t,toachiev_t,ps_t)

                    allcomp_t,notouch_t,rem_t,toachiev_t,ps_t = list(allcomp),list(notouch),list(rem),toachiev,ps
                    notouch_t.append(rem[i])
                    rem_t = rem[:i]+rem[i+1:]
                    case2 = search(allcomp_t,notouch_t,[],rem_t,toachiev_t,ps_t)
                    #print(case1,case2)
                    if minp > min(case1,case2):
                        minp = min(case1,case2)
                    
            return minp
                
        
        
        
        
makerem = []
for i in range(d):
    makerem.append(i)
    
print(search([],[],[],makerem,g,0))

Submission status: Runtime Error

Solution code:
def add(pc, p, G, tmp):
    for i in range(len(pc)-1, -1, -1):
        for k in range(pc[i][0]):
            p += (i+1) * 100
            tmp += 1
            if p >= G:
                return tmp


D, G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]
cnt = 10 ** 9
tmp = 0

for i in range(D):
    p = (i+1) * 100 * pc[i][0]
    p += pc[i][1]
    tmp = pc[i][0]
    if p < G:
        tmp += add(pc, p, G, tmp)
    cnt = min(cnt, tmp)
print(cnt)

Submission status: Runtime Error

Solution code:
def add(pc, p, G, tmp):
    b = False
    for i in range(len(pc)-1, -1, -1):
        for k in range(pc[i][0]):
            p += (i+1) * 100
            tmp += 1
            if p >= G:
                return tmp


D, G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]
cnt = 0
tmp = 0

for i in range(D):
    p = (i+1) * 100 * pc[i][0]
    p += pc[i][1]
    tmp = pc[i][0]
    while p < G:
        tmp += add(pc, p, G, tmp)
    cnt = min(cnt, tmp)
print(cnt)

Submission status: Runtime Error

Solution code:
#人のプログラムの全コピ　TKR18さん

#入力
a,b=map(int,input().split())
c=[0]+[list(map(int,input().split()))for i in range(a)]

#print(c)

def f(t,s): #t:t*100点までリストが存在する s: 目標値
    if t==0: #が0の時、とりあえず大きな数を返す
        return 10**9
    l=min(s//(t*100),c[t][0]) #s//(t*100): 目標を最高基本点で割った時の商、c[t][0]:最高基本点の使える数　これらの小さい方を返す
    k=100*t*l #最高基本点を使って得点できる最高点
    if l==c[t][0]: #最高基本点を使った数が、使える数と同じならボーナス点を加える。
        k+=c[t][1] 
    if k<s:　#最高基本点を全て使って得点できる点が、目標点以下なら...
        l+=f(t-1,s-k) #最高気本点を除いたもので、残りの点数を計算する。
    return min(l,f(t-1,s)) #最高気本点を使うもの(l)と最高基本点を使わないもの(f(t-1,s)のうち最小のものを見つける
print(f(a,b))

Submission status: Runtime Error

Solution code:
d,g=map(int,input().split())
g//=100
l=[]
ans=1000
for i in range(d):
  p,c=map(int,input().split())
  l+=[[p,c,i*p,i*p+c]]
#dp[c][i]
dp=[0for i in range(2**d-1)]
for i in range(2**d-1):
  a=1
  b,c=i,0
  d=0
  while b:
    if b%2>0:
      dp[i]+=l[c][3]
      d+=l[c][0]
    else:
      a=c+1
    b//=2
    c+=1
  if dp[i]>=g:
    ans=min(ans,d)
  elif dp[i]+l[a][2]>=g:
    ans=min(ans,d+(g-dp[i])//a+((g-dp[i])%a))
print(ans)

Submission status: Runtime Error

Solution code:
d,g=map(int,input().split())
g//=100
l=[]
ans=1000
for i in range(d):
  p,c=map(int,input().split())
  l+=[[p,c,i*p,i*p+c]]
#dp[c][i]
dp=[[0for i in range(d)]for i in range(2**d-1)]
for i in range(2**d-1):
  a=0
  b,c=i,0
  d=0
  while b:
    if b%2>0:
      dp[i]+=l[c][3]
      d+=l[i][0]
    else:
      a=c
    b//=2
    c+=1
  if dp[i]+l[a][2]>=g:
    ans=min(ans,d+(g-dp[i])//a+((g-dp[i])%a))
print(ans)

Submission status: Runtime Error

Solution code:
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 = 10*100
for i in range(2**D):
  rest = G
  cnt = 0
  maxdgt = -1
  for j in range(D):
    if bin(i)>>j & 1:
      rest -= P[i]*(i+1)*100+C[i]
      cnt += P[i]
    else:
      maxdgt = j
  if rest <= 0:
    ans = min(ans, cnt)
  else if rest > (P[maxdgt]-1)*(maxdgt+1)*100:
    continue
  else:
    ans = min(ans, cnt+(rest/100-1)//P[maxdgt]+1)
print(ans)

Submission status: Runtime Error

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

P = []
C = []
C2 = []
for i in range(D):
    p, c = map(int, input().split())
    P.append(p)
    c += p * (i+1) * 100
    C.append(c)
    C2.append(c/(p+1))

sort_C2 = sorted(C2, reverse=1)

num = 0
point = 0
question = [i for i in range(D-1, -1, -1)]


for i in range(D):
    x = C2.index(sort_C2[i])
    if C[x] <= G - point:
        num += P[x]
        point += C[x]
        question.remove(x)
    else:
        y = question[0]

        if C[x] < (y+1) * 100:
            continue

        n = -(-(G - point)) // ((y+1) * 100)
        if P[y] < n:
            num += P[y]
        else:
            num += n
        break

print(num)

Submission status: Runtime Error

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

P = []
C = []
C2 = []
for i in range(D):
    p, c = map(int, input().split())
    P.append(p)
    c += p * (i+1) * 100
    C.append(c)
    C2.append(c/(p+1))

sort_C2 = sorted(C2, reverse=1)

num = 0
point = 0
question = [i for i in range(D-1, -1, -1)]


for i in range(D):
    x = C2.index(sort_C2[i])
    if C[x] <= G - point:
        num += P[x]
        point += C[x]
        question.remove(x)
    else:
        y = question[0]

        if C2[x] < (y+1) * 100:
            continue

        n = -(-(G - point)) // ((y+1) * 100)
        if P[y] < n:
            num += P[y]
        else:
            num += n
        break

print(num)

Submission status: Runtime Error

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

P = []
C = []
C2 = []
for i in range(D):
    p, c = map(int, input().split())
    P.append(p)
    c += p * (i+1) * 100
    C.append(c)
    C2.append(c/(p+1))

sort_C2 = sorted(C2, reverse=1)

num = 0
point = 0
question = [i for i in range(D-1, -1, -1)]


for i in sort_C2:
    x = C2.index(i)
    if C[x] <= G - point:
        num += P[x]
        point += C[x]
        question.remove(x)
    else:
        y = question[0]
        n = -(-(G - point)) // ((y+1) * 100)
        if P[y] < n:
            num += P[y]
        else:
            num += n
        break

print(num)

Submission status: Runtime Error

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

P = []
C = []
C2 = []
for i in range(D):
    p, c = map(int, input().split())
    P.append(p)
    c += p * (i+1) * 100
    C.append(c)
    C2.append(c/(p+1))

sort_C2 = sorted(C2, reverse=1)

num = 0
point = 0
question = [i for i in range(D-1, -1, -1)]

for i in sort_C2:
    x = C2.index(i)
    if C[x] <= G - point:
        num += P[x]
        point += C[x]
        question.remove(x)
    else:
        y = question[0]
        num += -(-(G - point)) // ((y+1) * 100)
        break

print(num)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!

D,G = map(int,input().split()) # D問題数,G目標点
lst = [list(map(int,input().split()))for i in range(D)]
ans = float('inf')
for i in range(1 << D): # 全探索
    tmp = 0
    count = 0
    bit = ""
    for j in range(len(lst)):
        bit+=str((i >> j)&1)
        if ((i >> j) & 1) == 1:
            tmp = tmp + lst[j][1] + ((j + 1) * 100 * lst[j][0])
            count+=lst[j][0]
    #print("tmp",tmp)
    if tmp < G or tmp >= G:
        #print(bit)
        for n,k in enumerate(list(bit)):
            if k == "0":
                for p in range(lst[len(bit) - n - 1][0]):
                    t = p * 100 * (n+1)
                    #print("p",p,t,tmp,G,count)
                    if t + tmp >= G:
                        ans = min(ans,p+count)
    
    #if tmp >= G :
    else:
        ans = min(ans,count)
    #print(ans,tmp,count)

print(int(ans))