Buggy python submission (verdict: Time Limit Exceeded):
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
cache = [{} for _ in range(D + 1)]
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[1] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += j * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        nn = rn - n
        cch = cache[i - 1]
        np = cch.get(nn)
        if not np:
            np = f(i - 1, nn)
            cch[nn] = np
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)


Fixed submission:
import functools
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

@functools.lru_cache(maxsize=None)
def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[1] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += j * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        np = f(i - 1, rn - n)
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)

Buggy python submission (verdict: Time Limit Exceeded):
D, G = map(int, input().split())
ncs = [list(map(int, input().split())) for _ in range(D)]
ns = [x[0] for x in ncs]
cs = [x[1] for x in ncs]

def f(i, rn, rp):
    if i == 0:
        if ns[0] < rn:
            return False
        rp -= 100 * rn
        if ns[0] == rn:
            rp -= cs[0]
        return rp <= 0
    if rn < min(ns[:i+1]):
        for j in range(i, -1, -1):
            n = min((ns[j], rn))
            rp -= (j + 1) * 100 * n
            rn -= n
            if rn == 0:
                break
        return rp <= 0
    for n in range(min((ns[i], rn)) + 1):
        p = (i + 1) * 100 * n
        if n == ns[i]:
            p += cs[i]
        if n == rn:
            return p >= rp
        if p >= rp:
            return True
        if f(i - 1, rn - n, rp - p):
            return True
    return False

mn = 1
mx = sum(ns)
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if f(D - 1, x, G):
        mx = x
    else:
        mn = x + 1
print(mn)


Fixed submission:
import functools
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

@functools.lru_cache(maxsize=None)
def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[1] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += j * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        np = f(i - 1, rn - n)
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)

Buggy python submission (verdict: Time Limit Exceeded):
D, G = map(int, input().split())
ncs = [list(map(int, input().split())) for _ in range(D)]
ns = [x[0] for x in ncs]
cs = [x[1] for x in ncs]

def f(i, rn, rp):
    if i == 0:
        if ns[0] < rn:
            return False
        rp -= 100 * rn
        if ns[0] == rn:
            rp -= cs[0]
        return rp <= 0
    if rn < min(ns[:i+1]):
        for j in range(i, -1, -1):
            n = min((ns[j], rn))
            rp -= (j + 1) * 100 * n
            rn -= n
            if rn == 0:
                break
        return rp <= 0
    for n in range(min((ns[i], rn)) + 1):
        p = (i + 1) * 100 * n
        if n == ns[i]:
            p += cs[i]
        if n == rn:
            return p >= rp
        if p >= rp:
            return True
        if f(i - 1, rn - n, rp - p):
            return True
    return False

mn = 1
mx = sum(ns)
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if f(D - 1, x, G):
        mx = x
    else:
        mn = x + 1
print(mn)


Fixed submission:
import functools
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

@functools.lru_cache(maxsize=None)
def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[1] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += j * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        np = f(i - 1, rn - n)
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
D, G = map(int, input().split())       
npcs = []
for i in range(D):
    n, c = map(int, input().split())   
    p = (i + 1) * 100
    npcs.append((n, p, c))
npcs.sort(key=lambda x: x[0])
lmaxn, lp, lc = npcs[-1]
lmaxp = lmaxn * lp + lc
lmaxp2 = (lmaxn - 1) * lp
result = sum(map(lambda x: x[0], npcs))

nps = [
[(x, p * x + (c if x == n else 0)) for x in range(n + 1)]
for n, p, c in npcs[:-1]
]
for np in product(*nps):
    sumn = sum(map(lambda x: x[0], np))
    if sumn >= result:
        continue
    sump = sum(map(lambda x: x[1], np))
    if sump >= G:
        result = sumn
    else:
        ps = G - sump
        if ps <= lmaxp:
            if ps > lmaxp2:
                sumn += lmaxn
            else:
                sumn += ps // lp
                if ps % lp != 0:
                    sumn += 1
            if sumn < result:
                result = sumn
print(result)

Fixed submission:
import functools
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

@functools.lru_cache(maxsize=None)
def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[1] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += j * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        np = f(i - 1, rn - n)
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
D, G = map(int, input().split())
npcs = []
for i in range(D):
    n, c = map(int, input().split())
    p = (i + 1) * 100
    npcs.append((n, p, c))
npcs.sort(key=lambda x: x[0])
lmaxn, lp, lc = npcs[-1]
lmaxp = lmaxn * lp + lc
lmaxp2 = (lmaxn - 1) * lp
result = sum(map(lambda x: x[0], npcs))

nps = [
[(x, p * x + (c if x == n else 0)) for x in range(n + 1)]
for n, p, c in npcs[:-1]
]
for np in product(*nps):
    sumn = sum(map(lambda x: x[0], np))
    if sumn >= result:
        continue
    sump = sum(map(lambda x: x[1], np))
    if sump >= G:
        result = sumn
    else:
        ps = G - sump
        if ps <= lmaxp:
            if ps > lmaxp2:
                sumn += lmaxn
            else:
                sumn += ps // lp
                if ps % lp != 0:
                    sumn += 1
            if sumn < result:
                result = sumn
print(result)

Fixed submission:
import functools
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

@functools.lru_cache(maxsize=None)
def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[1] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += j * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        np = f(i - 1, rn - n)
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
D, G = map(int, input().split())
npcs = []
for i in range(D):
    n, c = map(int, input().split())
    p = (i + 1) * 100
    npcs.append((n, p, c))
npcs.sort(key=lambda x: x[0])
result = sum(map(lambda x: x[0], npcs))
for ns in product(*[range(n + 1) for n, p, c in npcs[:-1]]):
    sump = 0
    sumn = 0
    for i, n in enumerate(ns):
        maxn, p, c = npcs[i]
        sump += n * p
        if n == maxn:
            sump += c
        sumn += n
    if sump >= G:
        if sumn < result:
            result = sumn
    else:
        s = G - sump
        lmaxn, lp, lc = npcs[-1]
        if s <= lmaxn * lp + lc:
            if s > (lmaxn - 1) * lp:
                sumn += lmaxn
            else:
                sumn += s // lp
                if s % lp != 0:
                    sumn += 1
            if sumn < result:
                result = sumn
print(result)

Fixed submission:
import functools
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

@functools.lru_cache(maxsize=None)
def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[1] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += j * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        np = f(i - 1, rn - n)
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
D, G = map(int, input().split())
npcs = []
for i in range(D):
    n, c = map(int, input().split())
    p = (i + 1) * 100
    npcs.append((n, p, c))
npcs.sort(key=lambda x: x[0])
result = sum(map(lambda x: x[0], npcs))
for ns in product(*[range(n + 1) for n, p, c in npcs[:-1]]):
    sump = 0
    sumn = 0
    for i, n in enumerate(ns):
        maxn, p, c = npcs[i]
        sump += n * p
        if n == maxn:
            sump += c
        sumn += n
    if sump >= G:
        if sumn < result:
            result = sumn
    else:
        s = G - sump
        lmaxn, lp, lc = npcs[-1]
        if s <= lmaxn * lp + lc:
            if s > (lmaxn - 1) * lp:
                sumn += lmaxn
            else:
                sumn += s // lp
                if s % lp != 0:
                    sumn += 1
            if sumn < result:
                result = sumn
print(result)

Fixed submission:
import functools
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

@functools.lru_cache(maxsize=None)
def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[1] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += j * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        np = f(i - 1, rn - n)
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
D, G = map(int, input().split())
pc = [tuple(map(int, input().split())) for _ in range(D)]
p = [x[0] for x in pc]
c = [x[1] for x in pc]
result = sum(p)
for nums in product(*map(range, [pp + 1 for pp in p])):
    n = sum(nums)
    if n >= result:
        continue
    point = 0
    for i, num in enumerate(nums):
        point += (i + 1) * 100 * num
        if num == p[i]:
            point += c[i]
    if point >= G:
        result = n
print(result)

Fixed submission:
import functools
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

@functools.lru_cache(maxsize=None)
def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[1] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += j * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        np = f(i - 1, rn - n)
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
D, G = map(int, input().split())
p = []
c = []
for _ in range(D):
    pc = list(map(int, input().split()))
    p.append(pc[0])
    c.append(pc[1])

def acceptable_point(pnums):
    point = 0
    for i, pnum in enumerate(pnums):
        point += (i + 1) * 100 * pnum
        if pnum == p[i]:
            point += c[i]
    return point >= G

result = min(
    map(sum,
        filter(acceptable_point,
            product(*map(range, [pp + 1 for pp in p]))
        )
    )
)
print(result)

Fixed submission:
import functools
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

@functools.lru_cache(maxsize=None)
def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[1] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += j * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        np = f(i - 1, rn - n)
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)