Problem: 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?

Submission attempts (in order):
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)

getPoint = [[] for i in range(max(p))]

#print(c)
for i in range(max(p)):
    for j in range(D):
        if p[j] - 1> i:
            getPoint[i].append((i + 1) * 100 * (j + 1))
        else:
            getPoint[i].append(p[j] * (j + 1) * 100 + c[j])

#print(getPoint)

def sarch(G, keypoint):
    i = 0
    print(G, keypoint, 1111)
    if max(getPoint[-1]) >= G:
        i = 0
        while True:
            if max(getPoint[i]) >= G:
                print(keypoint + i + 1)
                break
            i += 1
    else:
        G -= max(getPoint[-1])
        keypoint += max(p)
        for i in range(len(getPoint[-1])):
            if getPoint[-1][i] == max(getPoint[-1]):
                key = i
        del p[i]
        del getPoint[max(p) + 1:]
        for i in range(len(getPoint)):
            del getPoint[i][key]
        sarch(G, keypoint)

def sarch2(G, keypoint):
    if G < 0:
        return print(keypoint)
    num = sorted(getPoint[0])[-1]
    for i in range(len(getPoint[0])):
        if getPoint[0][i] == max(getPoint[0]):
            num = i
    i = 0
    while True:
        if getPoint[i][num] < max(getPoint[i]):
            G -= getPoint[i][num]
            keypoint = keypoint + i + 1
            for j in range(len(getPoint)):
                if j < i:
                    #print(j, i)
                    getPoint[j][num] = getPoint[j + i + 1][num]
                else:
                    getPoint[j][num] = getPoint[-1][num]
            sarch2(G, keypoint)
            break
        i += 1
        if i >= len(getPoint):
            break
i = 0
#sarch(G, 0)
sarch2(G, 0)

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

ans_cnt = 10 ** 20
for i in range(2 ** (D)):
    def make_p(i):
        p = bin(i)[2::]
        while len(p) != D:
            p = "0" + p
        key = D
        for j in range(D - 1, -1, -1):
            if int(p[j]) == 0:
                key = j
                break
        return p, key
    
    p_and_key = make_p(i)
    p = p_and_key[0]
    key = p_and_key[1]
    cnt = 0
    ansP = 0
    for j in range(len(p)):
        if p[j] == "1":
            ansP += pc[j][0] * 100 * (j + 1) + pc[j][1]
            cnt += pc[j][0]
    j = 0
    if int(key) != int(D):
        key = int(key)
        while ansP < G:
            j = int(j)
            if pc[key][0] <= j:
                break
            ansP += 100 * (key + 1)
            cnt += 1
            j += 1
    if ansP >= G:
        ans_cnt = min(ans_cnt, cnt)

print(ans_cnt)


Verdicts: Runtime Error

Accepted