CodeEff/ECCO huggingface dataset:
# Original solution
d, g = list(map(int, input().split()))
q_list = [list(map(int, input().split())) for x in range(d)]
count_list = []

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

    if total >= g:
        count_list.append(count)
        continue

    else:
        for t in range(d):
            digit = str(d)
            if str(format(j, '0'+digit+'b'))[t] == '0':
                for x in range(q_list[d-t-1][0]-1):
                    count += 1
                    total += 100 * (d-t)

                    if total >= g:
                        count_list.append(count)
                        break
                break

print((min(count_list)))

# Optimized solution
d, g = list(map(int, input().split()))
dic = {}
ans = 9999999
for i in range(1, d+1):
    dic[i] = list(map(int, input().split()))

for i in range(2**d):
    total = 0
    count = 0
    select_list = list(range(1, d+1))
    for j in range(d):
        if (i >> j) & 1:
            num = dic[j+1][0]
            total += 100*(j+1)*num + dic[j+1][1]
            count += dic[j+1][0]
            select_list.remove(j+1)

    if total >= g:
        if count < ans:
            ans = count
            continue
        else:
            continue

    else:
        select = max(select_list)
        select_num = dic[select][0]
        for _ in range(select_num):
            total += 100*select
            count += 1

            if total >= g:
                if count < ans:
                    ans = count
                    break
                else:
                    break

print(ans)
# Original solution
d, g = list(map(int, input().split()))
dic = {}
ans = 9999999
for i in range(1, d+1):
    dic[i] = list(map(int, input().split()))

for i in range(2**d):
    total = 0
    count = 0
    select_list = list(range(1, d+1))
    for j in range(d):
        if (i >> j) & 1:
            num = dic[j+1][0]
            total += 100*(j+1)*num + dic[j+1][1]
            count += dic[j+1][0]
            select_list.remove(j+1)

    if total >= g:
        if count < ans:
            ans = count
            continue
        else:
            continue

    else:
        select = max(select_list)
        select_num = dic[select][0]
        for _ in range(select_num):
            total += 100*select
            count += 1

            if total >= g:
                if count < ans:
                    ans = count
                    break
                else:
                    break

print(ans)


# Optimized solution
d, goal = list(map(int, input().split()))

problems = []
for i in range(1, d+1):
    num, bonus = list(map(int, input().split()))
    point = i * 100
    problems.append([point, num, bonus])


ans = []
for mask in range(2**d):
    score = 0
    count = 0
    target = 0
    for bit in range(d):
        if (mask >> bit) & 1:  #全て解く
            point, num, bonus = problems[bit]
            score += (point*num) + bonus
            count += num
        else:
            target = bit

    if score >= goal:
        ans.append(count)
    else:
        point, num, bonus = problems[target]
        delta = goal - score
        add = delta//point + bool(delta%point)
        if add < num:
            ans.append(count+add)
        else:
            continue

print((min(ans)))
# Original solution
#!/usr/bin/env python3
import sys


def solve(D: int, G: int, p: "List[int]", c: "List[int]"):

    # bit全探索
    mc = sum(p)
    for i in range(1 << D):
        s = 0
        cc = 0
        for j in range(D):
            if((i >> j) & 1):
                s += (j+1)*p[j]*100+c[j]
                cc += p[j]
        # if(s >= G):
        #     mc = min(mc, cc)
        # 以下はuwiさんの回答を参考
        for j in range(D-1, -1, -1):
            # ここはもう全部解くことが決まっている
            if((i>>j)&1):
                continue
            # 「すべて解く」のみで目的スコアに達する場合はそのまま抜けて良い　＆　前回の足して合計に達するならば出て良い
            if(s >= G):
                break
            # g: 最大のスコアの問題の一問あたりのスコア
            g = (j+1)*100
            # got: どのくらいとくか
            # g-1を足すことで、math.ceilを使わなくて良い(//で表現できる)
            got = (G-s+g-1)//g
            s += min(got, p[j])*g
            cc += min(got, p[j])
        mc = min(cc, mc)

    print(mc)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    D = int(next(tokens))  # type: int
    G = int(next(tokens))  # type: int
    p = [int()] * (D)  # type: "List[int]"
    c = [int()] * (D)  # type: "List[int]"
    for i in range(D):
        p[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(D, G, p, c)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys


def solve(D: int, G: int, p: "List[int]", c: "List[int]"):
    cm = sum(p)
    for i in range(1<<D):
        s = 0
        ct = 0
        for j in range(D):
            if((i>>j)&1):
                s += (j+1)*100*p[j]+c[j]
                # print(s)
                ct += p[j]
    
        for j in range(D, 0, -1):
            if(s >= G): break
            if((i>>(j-1))&1): continue
            u = 100*j
            n = (G-s+u-1)//u
            s += p[j-1]*u
            ct += min(n, p[j-1])

        cm = min(cm, ct)

    print(cm)
    
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    D = int(next(tokens))  # type: int
    G = int(next(tokens))  # type: int
    p = [int()] * (D)  # type: "List[int]"
    c = [int()] * (D)  # type: "List[int]"
    for i in range(D):
        p[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(D, G, p, c)

if __name__ == '__main__':
    main()
# Original solution
D, G = list(map(int, input().split()))
G = G // 100
P = []
C = []
for i in range(1, D+1):
    p, c = list(map(int, input().split()))
    P.append(p)
    C.append(c//100)

minnum = 1e9
for i in range(0, 2**D):
    total = 0
    num = 0
    serach0 = [0] * D
    for j in range(D):
        if (i >> j) & 1:
            total += P[j]*(j+1) + C[j]
            num += P[j]
            serach0[j] = 1

    if total >= G:
        minnum = min(minnum, num)
        continue
    
    while 0 in serach0:
        idx = serach0.index(0)
        total_ = total
        num_ = num
        for _ in range(P[idx]):
            total_ += idx+1
            num_ += 1
            if total_ >= G:
                minnum = min(minnum, num_)
                break
        serach0[idx] = 1
print(minnum)

# Optimized solution
D, G = list(map(int, input().split()))
G //= 100
P = [] 
C = []
for i in range(1, D+1):
    p, c = list(map(int, input().split()))
    P.append(p)
    C.append(c//100)

scores = []
nums = []
for i in range(0, 2**D):
    score = 0
    num = 0
    remain = []
    for j in range(D):
        if (i>>j)&1:
            score += P[j]*(j+1) + C[j]
            num += P[j]
        else:
            remain.append(j)
    if score >= G:
        scores.append(score)
        nums.append(num)
    else:
        remain = sorted(remain, reverse=True)
        nokori = G - score
        for r in remain:
            if P[r] > -(-nokori // (r+1)):
                num += -(-nokori // (r+1))
                nums.append(num)
                break
print((min(nums)))
# Original solution
import itertools as it
D, G = list(map(int, input().split()))
P, C = [], []
for _ in range(D):
    p, c = list(map(int, input().split()))
    P.append(p)
    C.append(c)
A = list(it.permutations([i for i in range(D)]))
ans = 10**9
for a in A:
    S, i, sub_ans = 0, 0, 0
    while 1:
        if S + (a[i] + 1) * 100 * P[a[i]] < G:
            S += (a[i] + 1) * 100 * P[a[i]]
            sub_ans += P[a[i]]
            S += C[a[i]]
        else:
            j = 0
            while S < G and j < P[a[i]]:
                S += (a[i] + 1) * 100
                sub_ans += 1
            if j == P[a[i]]:
                S += C[a[i]]
        if S >= G:
            if sub_ans < ans:
                ans = sub_ans
            break
        i += 1
print(ans)


# Optimized solution
import itertools as it
D, G = list(map(int, input().split()))
P, C = [], []
for _ in range(D):
    p, c = list(map(int, input().split()))
    P.append(p)
    C.append(c)
A = it.permutations([i for i in range(D)])
ans = 10**9
for a in A:
    S, i, sub_ans = 0, 0, 0
    while 1:
        if S + (a[i] + 1) * 100 * P[a[i]] < G:
            S += (a[i] + 1) * 100 * P[a[i]]
            sub_ans += P[a[i]]
        else:
            x = (G - S) // ((a[i] + 1) * 100)
            if S + (a[i] + 1) * 100 * x < G:
                x += 1
            sub_ans += x
            S += (a[i] + 1) * 100 * x
        S += C[a[i]]
        if S >= G:
            if sub_ans < ans:
                ans = sub_ans
            break
        i += 1
print(ans)
# Original solution
import sys
from collections import defaultdict
input = sys.stdin.readline

D, G = [int(x) for x in input().strip().split()]
P = [''] * D
for d in range(D):
    p, c = [int(x) for x in input().strip().split()]
    P[d] = [0] + [(d + 1) * 100 * (i + 1) for i in range(p)]
    P[d][-1] += c

d = defaultdict(int)
def f(P, D, qnum, trial, d, score=[]):
    if (qnum, trial, sum(score)) in d:
        return d[(qnum, trial, sum(score))]
    #print('x={}, a={}, c={}'.format(x, a, c))
    if qnum == D:
        if sum(score) >= G:
            #print('  OK : {}'.format(a))
            return trial
        else:
            #print('  NG')
            return 10 ** 9 + 7
    ret = 10 ** 9 + 7
    for n in range(len(P[qnum])):
        t = score[:]
        t.append(P[qnum][n])
        ret = min(ret, f(P, D, qnum+1, trial+n, d, t))
    d[(qnum, trial, sum(score))] = ret
    return ret

print((f(P, D, 0, 0, d)))

# Optimized solution
import sys
from collections import defaultdict
input = sys.stdin.readline

D, G = [int(x) for x in input().strip().split()]
P = [''] * D
for d in range(D):
    p, c = [int(x) for x in input().strip().split()]
    P[d] = [0] + [(d + 1) * 100 * (i + 1) for i in range(p)]
    P[d][-1] += c

d = defaultdict(int)
def f(P, D, qnum, trial, d, flag=False, score=[]):
    if (qnum, trial, sum(score)) in d:
        return d[(qnum, trial, sum(score))]
    #print('qnum={}, trial={}, score={}'.format(qnum,trial,score))
    if qnum == D:
        if sum(score) >= G:
            #print('  OK : {}'.format(trial))
            return trial
        else:
            #print('  NG')
            return 10 ** 9 + 7
    ret = 10 ** 9 + 7
    if flag:
        N = [0, len(P[qnum])-1]
    else:
        N = list(range(len(P[qnum])))
    for n in N:
        flag2 = flag
        t = score[:]
        t.append(P[qnum][n])
        if not flag and n != len(P[qnum]) - 1 and n != 0:
            flag2 = True
        ret = min(ret, f(P, D, qnum+1, trial+n, d, flag2, t))
    d[(qnum, trial, sum(score))] = ret
    return ret

print((f(P, D, 0, 0, d)))
# Original solution
import itertools
from collections import Counter
D, G = list(map(int, input().split()))
P = [list(map(int, input().split())) for i in range(D)]
min_num = 10**8

judge_list = list(itertools.product([0, 1, 2], repeat=D)) #0:中途半端に解く 1:一問も解かない 2: 全部解く


for judge in judge_list:
    score = 0
    num = 0
    d = Counter() #インスタンスを生成
    d.update(judge)
    if (d[0] <= 1):
        for i in range(1, len(judge) + 1):
            if score >= G:
                break

            if judge[-i] == 1:
                pass

            if judge[-i] == 2:
                score += P[-i][0] * (D - i + 1) * 100 + P[-i][1]
                num += P[-i][0]

            if (judge[-i] == 0):
                for j in range(P[-i][0]):
                    if score >= G:
                        break
                    score += 100 * (D - i + 1)
                    num += 1
                        
        if score >= G:
            min_num = min(num, min_num)

print(min_num)           

# Optimized solution
import itertools

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

num = D #生成するビット数
bit_list = list(itertools.product([0, 1], repeat=num))
tmp = 10 ** 6

for bit in bit_list:
    count = 0
    num = 0
    for i in range(D):
        if bit[i] == 1:
            count += L[i][0] *(i+1) * 100 + L[i][1]
            num += L[i][0]
            
    if count >= G:
        tmp = min(num, tmp)
        
    else:
        for i in range(1, D+1):
            if bit[D-i] == 0:
                for j in range(L[D-i][0]):
                    count += (D-i+1) * 100
                    num += 1
                    if count >= G:
                        break
                break
                
        if count >= G:
            tmp = min(num, tmp)
            
print(tmp)
# Original solution
import itertools

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

num = D #生成するビット数
bit_list = list(itertools.product([0, 1], repeat=num))
tmp = 10 ** 6

for bit in bit_list:
    count = 0
    num = 0
    for i in range(D):
        if bit[i] == 1:
            count += L[i][0] *(i+1) * 100 + L[i][1]
            num += L[i][0]
            
    if count >= G:
        tmp = min(num, tmp)
        
    else:
        for i in range(1, D+1):
            if bit[D-i] == 0:
                for j in range(L[D-i][0]):
                    count += (D-i+1) * 100
                    num += 1
                    if count >= G:
                        break
                break
                
        if count >= G:
            tmp = min(num, tmp)
            
print(tmp)

# Optimized solution
import itertools

def solve(D, G, problems):
    bit_list = list(itertools.product([0, 1], repeat=D))
    
    result_count = 10 ** 8
    for pattern in bit_list:
        score = 0 # スコアの合計
        count = 0  # 解いた問題数
        for i in range(D):
            if pattern[i] == 1: # ビット値が１の難易度の問題は全て解く
                score += problems[i][0] * (i+1) * 100 + problems[i][1]  # 問題のスコア + ボーナス点
                count += problems[i][0]
            
            else:
                max_score_problem = i
    
        # 合計スコアが足りない場合，もっともスコアの高い未着手の問題を必要な分だけ解く
        if score < G:
            for i in range(problems[max_score_problem][0]):
                count += 1
                score += (max_score_problem + 1) * 100
                if score >= G:
                    break
        
        if score >= G:
            result_count = min(result_count, count)
            
    print(result_count)
    

if __name__ == '__main__':
    D, G = list(map(int, input().split()))
    problems = [list(map(int, input().split())) for _ in range(D)]
    solve(D, G, problems)
# Original solution
D, G= list(map(int, input().split()))
P = [[int(x) for x in input().split()] for d in range(D)]
Score = [[] for d in range(D)]
for d in range(D):
  for i in range(P[d][0] + 1):
    Score[d].append(100 * (d + 1) * i)
  Score[d][-1] += P[d][1]
DP = [[] for d in range(D)]
DP[0] = [x for x in Score[0]]
p_all = P[0][0]
for d in range(1, D):
  p_all += P[d][0]
  DP[d] = [0 for i in range(p_all + 1)]
  for p in range(p_all + 1):
    for s in range(min(P[d][0], p) + 1):
      if p - s < p_all - P[d][0] + 1:
        DP[d][p] = max(Score[d][s] + DP[d - 1][p - s], DP[d][p])
for i, s in enumerate(DP[D - 1]):
  if s >= G:
    print(i)
    break

# Optimized solution
D, G = list(map(int, input().split()))
S = [[0] for i in range(D + 1)]
B = [[0] for i in range(D + 1)]
sumP = 0
for i in range(D):
  p, c = list(map(int, input().split()))
  S[i + 1] += [0] * (len(S[i]) + p - 1)
  B[i + 1] += [100 * (i + 1) * (x + 1) for x in range(p)]
  B[i + 1][-1] += c
for i in range(1, D + 1):
  for j in range(1, len(S[i])):
    for k in range(max(j - len(S[i - 1]) + 1, 0), min(len(B[i]), j + 1)):
      S[i][j] = max(B[i][k] + S[i - 1][j - k], S[i][j])
for i, s in enumerate(S[D]):
  if s >= G:
    print(i)
    break
# Original solution
import sys
sys.setrecursionlimit(100000)
inf = float('inf')

def dfs(h, s):
    # 停止条件
    if h == D:
        tmp = 0
        p = 0
        ans = 0
        for i, c in enumerate(s):
            if c == '0':
                tmp = i
            else:
                ans += pc[i][0]
                p += (i+1) * 100 * pc[i][0] + pc[i][1]
        for i in range(pc[tmp][0]-1):
            if p < G:
                p += (tmp + 1) * 100
                ans += 1
        if p < G:
            return inf
        else:
            return ans
    tmp1 = dfs(h+1, s + '0')
    tmp2 = dfs(h+1, s + '1')
    return min(tmp1, tmp2)


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

# Optimized solution
D, G=list(map(int, input().split()))
PC=[0]+[list(map(int, input().split())) for _ in range(D)]

def function(G, i):
	if i==0:
		return 1e9
	n=min(G//(i*100), PC[i][0])
	s=n*i*100
	if n==PC[i][0]:
		s+=PC[i][1]
	if s<G:
		n+=function(G-s, i-1)
	return min(n, function(G,i-1))
print((function(G, D)))
# Original solution
D, G = list(map(int, input().split()))
pc = [[i + 1] + [int(x) for x in input().split()] for i in range(D)]

import math
m = {}
def f(cur, n, left):
    if left <= 0:
        return n
    def g(cur, n, left):
        if cur in m: return m[cur]
        r = m[cur] = f(cur, n, left)
        return r
    ret = 10**9
    for x in pc:
        i, p, c = x
        if (1 << i) & cur: continue
        ip = i*100*p
        if ip > left:
            h = math.ceil(left / (i*100))
            ret = min(ret, n + h)
        else:
            if n + p >= ret: continue
            h = f(cur | (1 << i), n + p, left - ip - c)
            ret = min(ret, h)
    return ret

print((f(0, 0, G)))

# Optimized solution
D, G = list(map(int, input().split()))
pc = [[i + 1] + [int(x) for x in input().split()] for i in range(D)]

import math
m = {}
def f(cur, n, left):
    if left <= 0:
        return n
    def g(cur, n, left):
        if cur in m: return m[cur]
        r = m[cur] = f(cur, n, left)
        return r
    ret = 10**9
    for x in pc:
        i, p, c = x
        if (1 << i) & cur: continue
        ip = i*100*p
        if ip > left:
            h = math.ceil(left / (i*100))
            ret = min(ret, n + h)
        else:
            if n + p >= ret: continue
            h = g(cur | (1 << i), n + p, left - ip - c)
            ret = min(ret, h)
    return ret

print((f(0, 0, G)))
# Original solution
def solve():
    inf = 1 << 60
    D, G = list(map(int, input().split()))
    p = [0]
    c = [0]
    for i in range(D):
        pi, ci = list(map(int, input().split()))
        p.append(pi)
        c.append(ci)
    sump = sum(p)
    # dp[i][j] = 100i点の問題までで、j問解いて得られる最大の点数
    dp = [[-inf for j in range(sump+1)] for i in range(D+1)]
    dp[0][0] = 0
    for d in range(1,D+1):
        for i in range(sump+1):
            for j in range(p[d]+1):
                if i - j >= 0:
                    dp[d][i] = max(dp[d][i], dp[d-1][i])
                    if dp[d-1][i-j] >= 0:
                        if j != p[d]:
                            dp[d][i] = max(dp[d][i], dp[d-1][i-j] + 100*d*j)
                        else:
                            dp[d][i] = max(dp[d][i], dp[d-1][i-j] + 100*d*j+c[d])
        #print(dp)
    for i in range(sump+1):
        if dp[D][i] >= G:
            return i

print((solve()))


# Optimized solution
def solve():
    inf = 1 << 60
    D, G = list(map(int, input().split()))
    p = []
    c = []
    for i in range(D):
        pi, ci = list(map(int, input().split()))
        p.append(pi)
        c.append(ci)

    bitD = 1 << D
    min_cnt = inf
    for b in range(bitD):
        sc = 0
        cnt = 0
        for i in range(D):
            if (b & (1 << i)) != 0:
                sc += (i + 1) * 100 * p[i] + c[i]
                cnt += p[i]
        if sc < G:
            for i in range(D-1,-1,-1):
                if (b & (1 << i)) == 0:
                    unit = (i + 1) * 100
                    cnt2 = min((G - sc + (unit - 1)) // unit, p[i] - 1)
                    sc += cnt2 * unit
                    cnt += cnt2
                    break
        if sc >= G:
            min_cnt = min(min_cnt, cnt)

    return min_cnt

print((solve()))
# Original solution

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

D, G = list(map(int, input().split()))
P = [] * D
C = [] * D
for i in range(D):
    p, c = list(map(int, input().split()))
    P.append(p)
    C.append(c)

ans = float('inf')
for i in range(1<<D):
    total = 0
    num = 0
    for j in range(D):
        if ((i >> j) & 1):
            total += C[j] + 100*P[j]*(j+1)
            num += P[j]

#    print(total, num)
    if total >= G:
        ans = min(ans, num)
    else:
        for j in range(D-1, -1, -1):
            if ((i >> j) & 1):
                continue

#            print('i=', i)
#            print('j=',j)
#            print('-', total, num)
            for k in range(P[j]-1):
                if total >= G:
                    break
#                print('?', total, num)
#                print('k=', k)
                total += 100*(j+1)
                num += 1
#                print('?', total, num)

#        print('Z', total, num, ans)
#        print('----')
        if total >= G:
#            print('x', total, num, ans)
            ans = min(ans, num)

print(ans)

# Optimized solution

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

D, G = list(map(int, input().split()))
P = [] * D
C = [] * D
for i in range(D):
    p, c = list(map(int, input().split()))
    P.append(p)
    C.append(c)

ans = float('inf')
for i in range(1<<D):
    total = 0
    num = 0
    for j in range(D):
        if ((i >> j) & 1):
            total += C[j] + 100*P[j]*(j+1)
            num += P[j]

    if total >= G:
        ans = min(ans, num)
    else:
        for j in range(D-1, -1, -1):
            if ((i >> j) & 1):
                continue

            for k in range(P[j]-1):
                if total >= G:
                    break
                total += 100*(j+1)
                num += 1

        if total >= G:
            ans = min(ans, num)

print(ans)
# Original solution
from itertools import product

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


# Optimized solution
from itertools import product

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

C = [0] * D
for i in range(D):
    p, c = pc[i]
    C[i] = 100 * (i + 1) * p + c

ans = float('inf')
for ptn in product([0, 1], repeat=D):
    point, cnt = 0, 0
    for i in range(D):
        p, c = pc[i]
        cnt += p * ptn[i]
        point += C[i] * ptn[i]

    if 0 in ptn:
        index = D - 1 - ptn[::-1].index(0)
        p, _ = pc[index]
        for i in range(p):
            if point >= G:
                break            
            point += 100 * (index + 1)
            cnt += 1

    if point >= G:
        ans = min(ans, cnt)
print(ans)