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):
# 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): 
    for j in range(1,D+1): 
        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])

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)] 
info2=[[0]*(D+1) for i in range(2**D)] 

for i in range(2**D): 
    for j in range(1,D+1): 
        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:
            num=box[n][0]-info2[i][n] 
            #print(num)
            #print(str(i)+":"+str(score))
            if num!=0:
                for j in range(1,num+1):
                    score -= 100*n
                    info[i][1]+=1 
                    if j==num: 
                        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])

Verdicts: Runtime Error

Accepted