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())
    pc = [list(map(int, input().split())) for _ in range(d)]
     
    ans = 1000
    for i in range(1 << d):
    	score = 0
    	num = 0
    	rest = 0
    	for j in range(d):
    		if ((i >> j) & 1) == 1:
    			score += pc[j][0]*100*(j+1) + pc[j][1]
    			num += pc[j][0]
    		else:
    			rest = j
    	if score < g:
    		need = (g-score-1)//(100*(rest+1)) + 1
    		if need > pc[rest][0]-1:
    			continue
    		else:
    			num += need
    	ans = min(ans, num)
     
    print(ans)

    d, g = map(int, input().split())
    pc = [list(map(int, input().split())) for _ in range(d)]
     
    ans = 1000
    for i in range(1 << d):
    	score = 0
    	num = 0
    	rest = 0
    	for j in range(d):
    		if ((i >> j) & 1) == 1:
    			score += pc[j][0]*100*(j+1) + pc[j][1]
    			num += pc[j][0]
    		else:
    			rest = j
    	if score < g:
    		need = (g-score-1)//(100*(rest+1)) + 1
    		if need > pc[rest][0]-1:
    			continue
    		else:
    			num += need
    	ans = min(ans, num)
     
    print(ans)

d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(n)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
        else:
            rest = j
    if score < g:
        need = (g - score - 1) // (100*(rest+1))
        if need > p[rest][0] - 1: 
            continue
        else:
            num += need
    ans = min(ans, num)
print(ans)

d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(n)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
        else:
            rest = j
    if score < g:
        need = (g - score) // (100*(rest+1))
        if need > p[rest][0] - 1: 
            continue
        else:
            num += need
    ans = min(ans, num)
print(ans)

    d, g = map(int, input().split())
    pc = [list(map(int, input().split())) for _ in range(d)]
     
    ans = 1000
    for i in range(1 << d):
    	score = 0
    	num = 0
    	rest = 0
    	for j in range(d):
    		if ((i >> j) & 1) == 1:
    			score += pc[j][0]*100*(j+1) + pc[j][1]
    			num += pc[j][0]
    		else:
    			rest = j
    	if score < g:
    		need = (g-score-1)//(100*(rest+1)) + 1
    		if need > pc[rest][0]-1:
    			continue
    		else:
    			num += need
    	ans = min(ans, num)
     
    print(ans)

d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(n)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
            print("num:",num)
        else:
            rest = j
            print("rest:",rest)
    if score < g:
        need = (g - score) // (100*(rest+1))
        if need > p[rest][0] - 1: 
            print("need:", need)
            continue
        else:
            num += need
            print("num2:",num)
    ans = min(ans, num)
    print("ans:", ans)
print(ans)

d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(n)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
        else:
            rest = j
    if score < g:
        need = (g - score) // (100*(rest+1))
        if need > p[rest][0] - 1: 
            continue
        else:
            num += need
    ans = min(ans, num)
print(ans)

d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(d)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
        else:
            rest = j
    if score < g:
        need = (g - score - 1) // (100*(rest+1)) + 1
        if need > p[rest][0] - 1: 
            continue
        else:
            num += need
    ans = min(ans, num)
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted