CodeEff/ECCO huggingface dataset:
# Original solution
d,g=list(map(int,input().split()))
spc=[]
c=[]
for i in range(d):
    pi,ci=list(map(int,input().split()))
    si=pi*100*(i+1)+ci
    av=si//pi
    spc.append([av,si,pi,ci,100*(i+1)])

#print(spc)

spc.sort(reverse=True)
#print(spc)

#r=g
#icnt=0
#for i in range(d):
#   r=r-spc[i][1]
#   icnt=icnt+spc[i][2]
#   if r<=0:
#       break
#print(r,icnt)


dmin=10000
for i in range(d):
    for j in range(2**d):
#        print("d=",d,"i=",i,"j=",j,j//2,j%2)
        icnt=0
        sisum=0
        j2=j
        for i2 in range(d):
            if i2!=i:
                if j2%2==1:
                    sisum=sisum+spc[i2][1]
                    icnt=icnt+spc[i2][2]
#            if sisum>g:
#               break
#                print("j=",j,icnt,sisum)
            j2=j2//2
        
        for k in range(spc[i][2]):
            sisum=sisum+spc[i][4]
            icnt=icnt+1
#            print("k",k,icnt,sisum)
            if sisum>=g:
                break
        if k==spc[i][2]-1 :
            sisum=sisum+spc[i][3]
#        if sisum>=g :
#            print("kend",icnt,sisum)
        if sisum>=g and icnt<dmin :
            dmin=icnt
#            print("dmin=",dmin,sisum)
    
print(dmin)     
         

# Optimized solution

import itertools

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

icntmin=10*100+1
for j in itertools.product([0,1], repeat=d):
    icnt=0
    gcnt=0
    for i in range(d):
        if j[i]==1:
            icnt+=pc[i][0]
            gcnt+=pc[i][0]*100*(i+1)+pc[i][1]
        else:
            ii=i
            
#    print("1",icnt,gcnt,j)
    if gcnt>=g:
        icntmin=min(icnt,icntmin)
        continue
    else:
        gr=g-gcnt
        k=(gr-1)//(100*(ii+1))+1
        if k<pc[ii][0]:
            icnt+=k
            gcnt+=k*100*(ii+1)
            icntmin=min(icnt,icntmin)
#    print("2",icnt,gcnt,ii,gr,k,j)
        
print(icntmin)
# Original solution
# coding: utf-8
# Your code here!

ans = 10**9


def calc(point,num, i):
    global ans
    global G, D
    if num > ans:
        return
    if point >= G:
        if num < ans:
            ans = num
        return
    if i >= D:
        return
    for j in range(problem[i][0]):
        tmp = point
        for k in range(i, D):
            tmp += (k+1)*100*problem[k][0]+problem[k][1]
        if tmp < G:
            return
        calc(point + (i+1) * 100 * j,num+j, i+1)
    calc(point + (i+1) * 100 * problem[i][0] + problem[i][1],num+problem[i][0], i+1)

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

calc(0,0,0)

print(ans)



# Optimized solution
# coding: utf-8
# Your code here!
from itertools import product

ans = 10**9

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

for p in product([True, False], repeat=D):
    
    point = 0
    num = 0
    
    for i in range(D):
        if p[i]:
            point += (i+1) * 100 * problem[i][0] + problem[i][1]
            num += problem[i][0]
            
    if point >= G:
        ans = min(ans, num)
    
    for i in reversed(list(range(D))):
        if p[i] == False:
            if point >= G:
                ans = min(ans, num)
                break
            for j in range(problem[i][0]):
                point += (i+1) * 100
                num += 1
                if point >= G:
                    break
    if point >= G:
        ans = min(ans, num)
print(ans)
# Original solution
# -*- coding: utf-8 -*-
from itertools import product

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

bit_table = list(product([0, 1], repeat=D))
cnts = []
for bits in bit_table:
    g = sum([
        pc_table[i][1] + 100 * (i + 1) * pc_table[i][0]
        for i, bit in enumerate(bits) if bit
    ])
    cnt = sum([pc_table[i][0] for i, bit in enumerate(bits) if bit])

    if g >= G:
        cnts.append(cnt)

    else:
        max_p = max([i for i, bit in enumerate(bits) if not bit])
        for _ in range(pc_table[max_p][0]):
            g += 100 * (max_p + 1)
            cnt += 1
            if g >= G:
                cnts.append(cnt)
                break

print((min(cnts)))


# Optimized solution
# -*- coding: utf-8 -*-
from itertools import product

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

bit_table = list(product([0, 1], repeat=D))
cnts = []
for bits in bit_table:
    g = sum([
        pc_table[i][1] + 100 * (i + 1) * pc_table[i][0]
        for i, bit in enumerate(bits) if bit
    ])
    cnt = sum([pc_table[i][0] for i, bit in enumerate(bits) if bit])

    max_p = 0 if sum(bits) == D else max(
        [i for i, bit in enumerate(bits) if not bit])
    for _ in range(pc_table[max_p][0]):

        if g >= G:
            cnts.append(cnt)
            break
        else:
            g += 100 * (max_p + 1)
            cnt += 1

print((min(cnts)))
# Original solution
def calcScore(d, g, scoreMap, index, score, solved):
    minSolved = 0
    for i in range(scoreMap[index][0] + 1):
        scoreNow = score + 100 * (index + 1) * i
        if i == scoreMap[index][0]:
            scoreNow += scoreMap[index][1]
        solvedNow = solved + i
        if scoreNow >= g:
            if minSolved == 0 or minSolved > solvedNow:
                return solvedNow
            else:
                return minSolved
        tmpSolved = 0
        if index < d - 1:
            tmpSolved = calcScore(d, g, scoreMap, index + 1, scoreNow, solvedNow)
            if minSolved == 0 or (minSolved > tmpSolved and tmpSolved != 0):
                minSolved = tmpSolved
    return minSolved


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

solved = calcScore(d, g, scoreMap, 0, 0, 0)

print(solved)

# Optimized solution
d, g = list(map(int, input().split()))
scoreMap = [list(map(int, input().split())) for i in range(d)]

minimum = 0

for i in range(2**d):
    score = 0
    solved = 0
    for j in range(d):
        if (i >> j) & 1 == 1:
            score += scoreMap[j][0] * 100 * (j + 1) + scoreMap[j][1]
            solved += scoreMap[j][0]
    if score < g:
        for k in range(d)[::-1]:
            if (i >> k) & 1 == 0:
                if (g - score > scoreMap[k][0] * 100 * (k + 1)):
                    score += scoreMap[k][0] * 100 * (k + 1) + scoreMap[k][1]
                    solved += scoreMap[k][0]
                    if score > g:
                        break
                else:
                    solved += (g - score) // (100 * (k + 1))
                    if (g - score) % (100 * (k + 1)) != 0:
                        solved += 1
                    score = g
                    break
    if minimum == 0 or solved < minimum:
        minimum = solved

print(minimum)
# Original solution
dp = [[0 for n in range(1001)] for m in range(11)]
length, goal = list(map(int, input().split(" ")))
problems = []
for l in range(length):
    a, b = list(map(int, input().split(" ")))
    problems.append([a, b])

for i in range(length):
    max_problems = problems[i][0]
            
    for k in range(1000):
        if dp[i][k]:
            for l in range(max_problems):
                dp[i + 1][k + 1 + l] = max(dp[i + 1][k + 1 + l], dp[i][k] + (i + 1) * 100 * (l + 1) + (problems[i][1] * int(l + 1 == max_problems)) )
                dp[i + 1][k] = max(dp[i + 1][k], dp[i][k])
    for l in range(max_problems):
        dp[i + 1][1 + l] = max(dp[i + 1][1 + l], (i + 1) * 100 * (l + 1) + (problems[i][1] * int(l + 1 == max_problems)) )
        # print(dp[i + 1][1])
answer = float("inf")
for i in range(11):
    for j in range(1001):
        if dp[i][j] >= goal:
            answer = min(answer, j)
print(answer)

# Optimized solution
import math
length, goal = list(map(int, input().split(" ")))
nums = []
sumall = []
for i in range(length):
    a, b = list(map(int, input().split(" ")))
    nums.append(a)
    sumall.append(a * (i + 1) * 100 + b)
answer = float("inf")
for bit in range(2 ** length):
    temp = []
    for i in range(length - 1, -1, -1):
        if bit & (1 << i):
            temp.append(i)
    temp_length = len(temp)
    for tempbit in range(2 ** temp_length):
        temp_sum = 0
        choosed = 0
        for i in range(temp_length):
            if tempbit & (1 << i):
                temp_sum += sumall[temp[i]]
                choosed += nums[temp[i]]
                if temp_sum >= goal:
                    answer = min(answer, choosed)
                    break
            else:
                if temp_sum + (nums[temp[i]] - 1) * (temp[i] + 1) * 100 >= goal:
                    answer = min(answer, choosed + int(math.ceil((goal - temp_sum) / (100 * (temp[i] + 1)))) )
                    break
                temp_sum += (nums[temp[i]] - 1) * (temp[i] + 1) * 100
                choosed += nums[temp[i]] - 1
        # print(bin(bit), bin(tempbit), temp_sum, choosed, answer)
    # print(answer, bin(bit))
print(answer)
# Original solution
d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for i in range(d)]

def dfs(s=[], score=0):
    ans = float('inf')
    if len(s)==d:
        if score >= g:
            return sum(s)
        else:
            return float('inf')
    else:
        p, c = pc[len(s)]
        for i in range(p+1):
            a = 100*(len(s)+1)*i
            if i==p:
                a+=c
            ans = min(ans, dfs(s+[i], score+a))
    return ans

print((dfs([])))


# Optimized solution
from itertools import product
from math import ceil
d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for i in range(d)]

ans = 10**9
for bit in product([0, 1], repeat=d):
    score = 0
    probs = 0
    for i, b in enumerate(bit):
        p, c = pc[i]
        if b==1:
            probs+=p
            score+=100*(i+1)*p
            score+=c
    if score >= g:
        ans = min(ans, probs)
    else:
        # greedyに足す
        for i, b in list(enumerate(bit))[::-1]:
            p, c = pc[i]
            if b==1:
                continue
            if score+100*(i+1)*p >= g:
                a = ceil((g-score)/(100*(i+1)))
                probs += a
                score += (100*(i+1))*a
                if a == p: score += c
                break
            else:
                probs += p
                score += (100*(i+1))*p+c
                if score >= g: break
        if score >= g:
            ans = min(ans, probs)
print(ans)
# Original solution
import math
from itertools import permutations

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

min_answer = 1000

for question_ids in permutations(list(range(D))):
    score = G
    answer = 0
    for question_id in question_ids:
        n, bonus = questions[question_id]
        point = 100 * (question_id + 1)
        n_ans = min(n, math.ceil(score / point))
        answer += n_ans
        score -= n_ans * point
        if n_ans == n:
            score -= bonus
        if score <= 0:
            min_answer = min(min_answer, answer)
            break

print(min_answer)


# Optimized solution
from itertools import product

D, G = list(map(int, input().split(' ')))
questions = [tuple(map(int, input().split(' '))) for _ in range(D)]
questions = [(100 * index, n, bonus) for index, (n, bonus) in enumerate(questions, start=1)]

min_answer = 1000

for bits in product((True, False), repeat=D):
    not_complete = []
    score = G
    answered = 0
    for index, bit in enumerate(bits):
        if not bit:
            not_complete.append(index)
            continue

        point, n, bonus = questions[index]
        score -= point * n + bonus
        answered += n

    if not_complete:
        index = max(not_complete)
        point, n, _ = questions[index]
        while score > 0 and n > 1:
            score -= point
            n -= 1
            answered += 1

    if score <= 0:
        min_answer = min(min_answer, answered)

print(min_answer)
# Original solution
import sys
input = sys.stdin.readline

d, g = [int(x) for x in input().split()]
pc = [[int(x) for x in input().split()] for _ in range(d)]

ans = float("inf")

for i in range(2 ** d):
    i_bin = bin(i)[2:].zfill(d)
    s = set() # コンプリートボーナスをもらう
    for j in range(len(i_bin)):
        if i_bin[j] == "1":
            s.add(j)
    cnt = 0
    total = 0
    for k in s:
        cnt += pc[k][0]
        total += (k + 1)*pc[k][0]*100 + pc[k][1]
    if total >= g:
        ans = min(ans, cnt)
        continue
    for l in range(d - 1, -1, -1):
        flag = 0
        if l in s:
            continue
        for m in range(1, pc[l][0]):
            total += (l + 1) * 100
            cnt += 1
            if total >= g:
                flag = 1
                break
        if flag:
            break
    if total >= g:
        ans = min(ans, cnt)

print(ans)
            

# Optimized solution
import sys
input = sys.stdin.readline

d, g = [int(x) for x in input().split()]
pc = [[int(x) for x in input().split()] for _ in range(d)]

ans = float("inf")

for i in range(2 ** d):
    s = set() # コンプリートボーナスをもらう
    for j in range(d):
        if (i >> j) & 1:
            s.add(j)
    cnt = 0
    total = 0
    for k in s:
        cnt += pc[k][0]
        total += (k + 1)*pc[k][0]*100 + pc[k][1]
    if total >= g:
        ans = min(ans, cnt)
        continue
    for l in range(d - 1, -1, -1):
        flag = 0
        if l in s:
            continue
        for m in range(1, pc[l][0]):
            total += (l + 1) * 100
            cnt += 1
            if total >= g:
                flag = 1
                break
        if flag:
            break
    if total >= g:
        ans = min(ans, cnt)

print(ans)
# Original solution
D,G = list(map(int,input().split()))
P = []
num_p = 0
for i in range(1,D+1):
    p,c = list(map(int,input().split()))
    num_p += p
    for j in range(1,p+1):
        P += [(j,i*100*j+c*(j==p))]
dp = [0]*(num_p+1)
for k,pt in P:
    if k==1:
        t_dp = dp[:]
    for cur in range(1,num_p+1):
        if cur>=k:
            dp[cur] = max(dp[cur], t_dp[cur-k]+pt)
for i in range(num_p+1):
    if dp[i]>=G:
        print(i)
        break

# Optimized solution
d,g = list(map(int,input().split()))
pc = [list(map(int,input().split()))for _ in[0]*d]
ans = []
for mask in range(1 << d):
    s = 0
    num = 0
    rest_max = -1
    for i in range(d):
        p,c = pc[i]
        if mask >> i & 1:
            s += p * 100 * (i + 1) + c
            num += p
        else:
            rest_max = i
    if s < g:
        s1 = 100 * (rest_max + 1)
        need = (g - s + s1 - 1) // s1
        if need >= pc[rest_max][0]:
            continue
        num += need
    ans.append(num)
print((min(ans)))
# Original solution
D, G = [int(i) for i in input().split()]
PC = [(int(i), int(j)) for (i, j) in [input().split() for _ in range(D)]]

# 十分大きい数を用意する
ans = float("inf")

# それぞれのランクの問題を「完全に解く」 or not -> 2^D通り
for bit in range(1 << D):
    score = 0
    solve = 0
    rest = set(range(1, D + 1))

    for i in range(D):
        # (i+1)番目の問題を完全に解いた場合
        if (bit>>i) & 1:
            # スコア = 基本スコア + コンプリートボーナス
            score += PC[i][0] * (i + 1) * 100 + PC[i][1]
            solve += PC[i][0]
            # 今回解いたランクの問題を削除
            rest.discard(i + 1)

    # 目標点に満たない場合、restの大きいものから順に解く
    if score < G:
        target = max(rest)
        n = min(PC[target - 1][0], -((score-G) // (target*100)))
        score += n * target * 100
        solve += n

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

print(ans)

# Optimized solution
import itertools


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

ans = float("inf")
for bit in itertools.product((0, 1), repeat=d):
    score = 0
    solve = 0
    rest = set(range(d))

    for i in range(d):
        if bit[i] == 1:
            score += pc[i][0] * (i+1) * 100 + pc[i][1]
            solve += pc[i][0]
            rest.discard(i)

    if score < g:
        problem = max(rest)
        needs = -((-(g - score)) // ((problem+1)*100))
        n = min(pc[problem][0] - 1, needs)
        score += n * (problem+1) * 100
        solve += n
    if score >= g:
        ans = min(ans, solve)
print(ans)
# Original solution
D, G = list(map(int, input().split()))
p, c = [], []
for i in range(D):
    a, b = list(map(int, input().split()))
    p.append(a)
    c.append(b)

from itertools import product
res = 1 << 29
for v in product([0, 1], repeat=D):
    score, num = 0, 0
    for i in range(D):
        if v[i] == 1:
            score += c[i] + p[i] * 100 * (i + 1)
            num += p[i]
    if score >= G:
        res = min(res, num)
    else:
        for j in range(D - 1, -1, -1):
            if v[j] == 1:
                continue
            for k in range(p[j]):
                if score >= G:
                    break
                score += 100 * (j + 1)
                num += 1
        res = min(res, num)
print(res)

# Optimized solution
D, G = list(map(int, input().split()))
p, c = [], []
for i in range(D):
    a, b = list(map(int, input().split()))
    p.append(a)
    c.append(b)

res = 1 << 29
for bit in range(1 << D):
    score, num = 0, 0
    for i in range(D):
        if bit >> i & 1: # bit & (i << i)
            score += c[i] + p[i] * 100 * (i + 1)
            num += p[i]
    if score >= G:
        res = min(res, num)
    else:
        for j in range(D - 1, -1, -1):
            if bit >> j & 1: # bit & (i << i)
                continue
            for k in range(p[j]):
                if score >= G:
                    break
                score += 100 * (j + 1)
                num += 1
        res = min(res, num)
print(res)
# Original solution

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

#prob_num = [3,5]
#comp = [500,800]

prob_num = []
comp = []

for i in range(D):
    p,c = list(map(int, input().split()))
    prob_num.append(p)
    comp.append(c)

comp_point = []
for i in range(D):
    comp_point.append((100*(i+1)*prob_num[i]+comp[i]))



ans = 1000000
for b in range(1<<D):
    hasComp = []
    for j in range(D):
        if b & (1<<j):
            hasComp.append(True)
        else:
            hasComp.append(False)
        
    # compしてるものを決め打ち
    point = 0
    prb = 0
    for i in range(D):
        if hasComp[i]:
            point += comp_point[i]
            prb += prob_num[i]
    
    res = G-point
    
    while res>0:
        flag = 0
        for i in range(D-1,-1,-1):
            if not hasComp[i]:
                if res <= (100*(i+1)*(prob_num[i]-1)):
                    req_prob = (res//(100*(i+1))) + bool(res%(100*(i+1)))
                    prb += req_prob
                    res = 0
                    break
                
                else:
                    prb += (prob_num[i]-1)
                    res -= (100*(i+1))*(prob_num[i]-1)
        
            if i==0:
                flag = 1
                break
        
        if flag:
            break
    if res<=0:
        ans = min(ans,prb)
    
print(ans)
             

# Optimized solution
D,G = list(map(int, input().split()))
prob_num = []
bonus = []
comp_pt = []
for i in range(D):
    p,b = list(map(int, input().split()))
    prob_num.append(p)
    bonus.append(b)
    comp_pt.append(100*(i+1)*p+b)

def dfs(hascomp:str, target:int, prob:int, depth:int) -> int:
    if target <= 0:
        #print(hascomp, depth, prob)
        return prob
    
    elif depth == D:
        for i in range(D-1,-1,-1):
            if hascomp[i] == "n":
                if target <= 100*(i+1)*(prob_num[i]-1):
                    prob += (target//(100*(i+1)))+bool(target%(100*(i+1)))
                    #print(hascomp, depth, prob)
                    return prob
                
                else:
                    prob += (prob_num[i]-1)
                    target -= 100*(i+1)*(prob_num[i]-1)
                    
        if target > 0:
            #print(hascomp, depth, prob)
            return 10**5
        
    else:
        new_tar = target-comp_pt[depth]
        new_prob = prob + prob_num[depth]
        return min(dfs(hascomp+"y",new_tar, new_prob, depth+1),
                   dfs(hascomp+"n",target, prob, depth+1))
        

ans = dfs("",G,0,0)
print(ans)
# Original solution
n,g = list(map(int,input().split()))
lis = []
mon = []
for i in range(n):
  a,b = list(map(int,input().split()))
  lis.append([a,b])
score = {(0,0)}
for i in range(n):
  gone = set()
  for nu,cou in score:
    for j in range(lis[i][0]+1):
      if j != lis[i][0]:
        gone.add((nu+(i+1) * 100 * j,cou + j))
      else:
        gone.add((nu+(i+1) * 100 * j + lis[i][1],cou + j))
  score = gone
ans = 10 ** 12
for nu,num in score:
  if nu >= g:
    ans = min(ans,num)
print(ans)


# Optimized solution
import math
n,g = list(map(int,input().split()))
lis = []
sum = []
for i in range(n):
  a,b = list(map(int,input().split()))
  lis.append([a,b])
  sum.append((i+1)*100*a+b)
def ans(x,y):
  if y <= 0:return 10 ** 12
  nu = min(math.ceil(x/(100 * y)),lis[y-1][0])
  num = 100 * y * nu
  if nu == lis[y-1][0]:num += lis[y-1][1]
  if num >= x:cou = nu
  else:cou = nu +ans(x-num,y-1)
  return min(cou,ans(x,y-1))

print((ans(g,n)))
# Original solution
d,g = list(map(int,input().split()))

p = [] # 問題数の格納
c = [] # ボーナス点の格納
ans = [] #　候補解の格納
ss = 0
cnt = 0

for _ in range(d): #問題数、ボーナス点の入力
    pp,cc = list(map(int,input().split()))
    p.append(pp)
    c.append(cc)

for x in range(2**d): #bit全探索
    ss = 0 # 得点
    cnt = 0 #　問題数
    for i in range(d): #bit探索
        if (x >> i) & 1:
            ss += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    
    if ss >= g: #　既に得点がg以上の時、ansに格納
        ans.append(cnt)
    
    else:
        for l in range(d)[::-1]:
            if ((x>>l)&1):
                continue
            for _ in range(1,p[l]):
                ss += (l+1) * 100
                cnt += 1
                
                if ss >= g:
                    ans.append(cnt)
                    break

print((min(ans)))

# Optimized solution
d,g = list(map(int,input().split()))
P, C = [], []
probs = set([i for i in range(d)])
for _ in range(d):
    p,c = list(map(int,input().split()))
    P.append(p)
    C.append(c)
res = float('inf')
for i in range(2**d):
    tmp = []
    score = 0
    cnt = 0
    for j in range(d):
        if ((i>>j)&1):
            tmp.append(j)
    for k in tmp:
        score += (k+1)*100*P[k] + C[k]
        cnt += P[k]    
    if score >= g:
        res = min(res, cnt)
    else:
        x = list(probs - set(tmp))
        x.sort(reverse=True)
        for x_ in x:
            for _ in range(P[x_]):
                score += (x_+1)*100
                cnt += 1
                if score >= g:
                    res = min(res, cnt)
                    break
print(res)