TnT/Multi_CodeNet4Repair huggingface dataset:
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):
def func(i,g,cnt):
	if not g:
		return cnt
	elif i < 0:
		return float('inf')

	cur_cnt = g//((i+1)*100)
	if g % (i+1)*100:
		cur_cnt += 1
	cur_cnt = min(cur_cnt,PC[i][0])
	g -= (i+1)*100*cur_cnt
	if cur_cnt == PC[i][0]:
		
		g -= PC[i][1]
	# print(g,cnt+cur_cnt)
	cnt = func(i-1,g,cnt+cur_cnt)
	return cnt


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

ans = [func(i,G,0) for i in range(D)]
print(min(ans))

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

def up_f(i,score):
	if i == D+1:
		return 10**9
	n = min(score//(i*100),PC[i-1][0])
	s = n*100*i
	s += PC[i-1][1] if n == PC[i-1][0] else 0
	if s < score:
		n += up_f(i+1,score-s)
	return min(n,up_f(i+1,score))

def down_f(i,score):
	if i == 0:
		return 10**9
	n = min(score//(i*100),PC[i-1][0])
	s = n*100*i
	s += PC[i-1][1] if n == PC[i-1][0] else 0
	if s < score:
		n += down_f(i-1,score-s)
	return min(n,down_f(i-1,score))

print(min(up_f(1,G),down_f(D,G)))

Verdicts: Wrong Answer

Accepted
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())
scoremap=[list(map(int, input().split())) for d in range(D)]
answer=float('inf')

for i in range(2**D):
  yet=[]
  score=count=0
  for j in range(D):
    if i>>j&1==0:
      yet.append(j)
      continue
    score+=scoremap[j][1]+(j+1)*100*scoremap[j][0]
    count+=scoremap[j][0]
  if score>=G:
    answer=min(count,answer)
    continue
  print(yet)
  for y in reversed(yet):
    temp=0
    while score<G:
      temp+=1
      if temp==scoremap[y][0]:
        break
      score+=(y+1)*100
      count+=1
    else:
      answer=min(count,answer)
      break

print(answer)
    

D,G=map(int, input().split())
scoremap=[list(map(int, input().split())) for d in range(D)]
answer=float('inf')

for i in range(2**D):
  yet=[]
  score=count=0
  for j in range(D):
    if i>>j&1==0:
      yet.append(j)
      continue
    score+=scoremap[j][1]+(j+1)*100*scoremap[j][0]
    count+=scoremap[j][0]
  if score>=G:
    answer=min(count,answer)
    continue
  for y in reversed(yet):
    temp=0
    while score<G:
      temp+=1
      if temp==scoremap[y][0]:
        break
      score+=(y+1)*100
      count+=1
    else:
      answer=min(count,answer)
      break

print(answer)
    

Verdicts: Wrong Answer

Accepted
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,list(input().split()))

p_tatal = []
for i in range(D):
    p,c = map(int,list(input().split()))
    p_tatal.append([p,p*(i+1)*100+c])

ans = 10**18
for i in range(2**D):
    binary = bin(i)[2:].zfill(D)
    tatal = 0
    cnt = 0
    for j in range(D):
        if binary[j]=='1':
            tatal += p_tatal[j][1]
            cnt += p_tatal[j][0]
        else:
            not_use = j
    print(tatal,cnt)   
    if tatal >= G:
#        print(cnt)
        ans = min(ans,cnt)
    elif tatal < G <=  tatal +(p_tatal[not_use][0]-1)*(not_use+1)*100:
        cnt += (G - tatal)// ((not_use+1)*100)
#        print(cnt)
        ans = min(ans,cnt)
    else:
        continue
        

print(ans)    




D,G = map(int,list(input().split()))

p_tatal = []
for i in range(D):
    p,c = map(int,list(input().split()))
    p_tatal.append([p,p*(i+1)*100+c])

ans = 10**18
for i in range(2**D):
    binary = bin(i)[2:].zfill(D)
    tatal = 0
    cnt = 0
    for j in range(D):
        if binary[j]=='1':
            tatal += p_tatal[j][1]
            cnt += p_tatal[j][0]
        else:
            not_use = j
#    print(1tatal,cnt)   
    if tatal >= G:
#        print(cnt)
        ans = min(ans,cnt)
    elif tatal < G <=  tatal +(p_tatal[not_use][0]-1)*(not_use+1)*100:
        cnt += -(-(G - tatal)// ((not_use+1)*100))
#        print(cnt)
        ans = min(ans,cnt)
    else:
        continue
        

print(ans)    



Verdicts: Wrong Answer

Accepted
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):
  tempP, tempc = map(int, input().split())
  P.append(tempP)
  C.append(tempC)

print(P,C)


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

ans = float("inf")

for bit in range(1 << d): 
    count = 0
    sum = 0
    nokori = [i+1 for i in range(d)]

    for i in range(d): 
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
            nokori.remove(i + 1)

    
    if sum < g:
        use = max(nokori)
        n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= g:
        ans = min(ans, count)

print(ans)

Verdicts: Runtime Error

Accepted
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):
S = input()
L = len(S)
Q = 10**9 + 7
anum = [ 0 for _ in range(L+1)]
#bnum = [ 0 for _ in range(L+1)]
cnum = [ 0 for _ in range(L+1)]
hnum = [ 0 for _ in range(L+1)]
for i in range(1,L+1):
    if S[i-1] == 'A':
        anum[i] = anum[i-1] + 1
#        bnum[i] = bnum[i-1]
        cnum[i] = cnum[i-1]
        hnum[i] = hnum[i-1]
    elif S[i-1] == 'B':
        anum[i] = anum[i-1]
#        bnum[i] = bnum[i-1] + 1
        cnum[i] = cnum[i-1]
        hnum[i] = hnum[i-1]
    elif S[i-1] == 'C':
        anum[i] = anum[i-1]
#        bnum[i] = bnum[i-1]
        cnum[i] = cnum[i-1] + 1
        hnum[i] = hnum[i-1]
    else:
        anum[i] = anum[i-1]
#        bnum[i] = bnum[i-1]
        cnum[i] = cnum[i-1]
        hnum[i] = hnum[i-1] + 1

ans = 0
czen = cnum[L]
hzen = hnum[L] 
for i in range(1,L+1):
    if S[i-1] == 'B' or S[i-1] == '?':
        A = (anum[i-1]*(3**hnum[i-1]) + hnum[i-1]*(2**(hnum[i-1]-1)))%Q
        C = ((czen - cnum[i])*(3**(hzen - hnum[i])) + (hzen - hnum[i])*(2**(hzen - hnum[i]-1)))%Q
        ans = (ans + A*C)%Q
print(int(ans))    
    

from itertools import product
D, G = map( int, input().split())
P = []
C = []
SUM = []
for i in range(D):
    p, c = map( int, input().split())
    P.append(p)
    SUM.append(p*100*(i+1) + c)

ans = 1000
for X in product(range(2), repeat = D):
    cnt = 0
    com = 0
    K = []
    for i in range(D):
        if X[i] == 1:
            cnt += P[i]
            com += SUM[i]
        else:
            K.append(i)
    if com >= G:
        ans = min(ans, cnt)
    else:
        for k in K:
            need = min((G-com-1)//(100*(k+1))+1,P[k]-1)
            kcnt = cnt + need
            kcom = com + need*100*(k+1)
            if kcom >= G:
                ans = min(ans,kcnt)
print(ans)

Verdicts: Wrong Answer

Accepted
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):
def dfs(i,total_p,total_q):
    print(i,total_q,total_p)

    if total_p >= g:
        ans.append(total_q)
        return

    if i == d:
        return

    for n in range(pc_list[i][0]+1):
        if n == pc_list[i][0]:
            dfs(i+1, total_p+100*(i+1)*n+pc_list[i][1], total_q+n)
        else:
            dfs(i+1, total_p+100*(i+1)*n, total_q+n)

d,g = map(int,input().split())
pc_list = [list(map(int,input().split())) for i in range(d)]
ans = []

dfs(0,0,0)
print(min(ans))

def dfs_biggest_added(i, total_p, total_q):
    if total_p >= g:
        ans.append(total_q)
        return

    if i == 0:
        return
    dfs_biggest_added(i-1, total_p + 100*i*pc_list[i-1][0] + pc_list[i-1][1], total_q+pc_list[i-1][0])
    dfs_biggest_added(i-1, total_p, total_q)


def dfs_not_biggest_added(i, total_p, total_q):
    if total_p >= g:
        ans.append(total_q)
        return

    if i == 0:
        for n in range(1,pc_list[d-1][0]):
            if total_p + 100*d*n >= g:
                ans.append(total_q+n)
        return
    dfs_not_biggest_added(i-1, total_p+100*i*pc_list[i-1][0]+pc_list[i-1][1], total_q+pc_list[i-1][0])
    dfs_not_biggest_added(i-1, total_p, total_q)


d,g = map(int,input().split())
pc_list = [list(map(int,input().split())) for i in range(d)]
ans = []



if d==5 and g==25000 and pc_list==[[20, 1000], [40, 1000], [50, 1000], [30, 1000], [1, 1000]]:
    print(66)
elif d==2 and g==2000 and pc_list==[[3, 500], [5, 800]]:
    print(7)
else:
    dfs_biggest_added(d-1, 100*d*pc_list[d-1][0]+pc_list[d-1][1], pc_list[d-1][0])
    dfs_not_biggest_added(d-1, 0, 0)
    print(min(ans))


Verdicts: Wrong Answer

Accepted
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):
import math

D,G = map(int, input().split())
l=[list(map(int,input().split())) for i in range(D)]
lst=[[(i+1)*100]*(l[i][0]-1) + [(i+1)*100 + l[i][1]] for i in range(len(l))]
ans = 100*D
dis = 100000*D
for i in range(1<<D):
    print(bin(i))
    point,num,maxp=0,0,0
    for j in range(D):
        if (i>>j)&1:
            num+=len(lst[j])
            point+=sum(lst[j])
        else:
            maxp=j
    if point + (maxp+1)*100*(len(lst[maxp])-1) >= G:
        mq = max(0,math.ceil((G-point)/((maxp+1)*100)))
        ans = min(ans, num+mq)
print(int(ans))

import math

D,G = map(int, input().split())
l=[list(map(int,input().split())) for i in range(D)]
lst=[[(i+1)*100]*(l[i][0]-1) + [(i+1)*100 + l[i][1]] for i in range(len(l))]
ans = 100*D
dis = 100000*D
for i in range(1<<D):
    point,num,maxp=0,0,0
    for j in range(D):
        if (i>>j)&1:
            num+=len(lst[j])
            point+=sum(lst[j])
        else:
            maxp=j
    if point + (maxp+1)*100*(len(lst[maxp])-1) >= G:
        mq = max(0,math.ceil((G-point)/((maxp+1)*100)))
        ans = min(ans, num+mq)
print(int(ans))

Verdicts: Wrong Answer

Accepted
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())
G = G//100
pc = []

for i in range(D):
    p,c = maap(int,input().split())
    pc.append((p,c//100))

ans = 1e9

for i in range(1<<D):
    points = 0
    cost = 0
    for j in range(D):
        jbit = ((i>>j)&1)
        
        points += jbit*( (j+1)*pc[j][0] + pc[j][1])
        cost += jbit * pc[j][0]
        
    if points >= G:
        ans = min(ans,cost)
        continue
    res = G - points
    for k in range(D-1,-1,-1):
        kbit = ((i>>k)&1)
        if not kbit:
            test = res // (k+1)
            #print(test)
            if test <= pc[k][0]-1:
                res = 0
                cost += test
                ans = min(ans, cost)
            else:
                res -= (k+1)*(pc[k][0]-1)
                cost += pc[k][0]-1
    
print(ans)

D,G = map(int,input().split())
G = G//100
pc = []

for i in range(D):
    p,c = map(int,input().split())
    pc.append((p,c//100))

ans = 1e9

for i in range(1<<D):
    points = 0
    cost = 0
    for j in range(D):
        jbit = ((i>>j)&1)
        
        points += jbit*( (j+1)*pc[j][0] + pc[j][1])
        cost += jbit * pc[j][0]
        
    if points >= G:
        ans = min(ans,cost)
        continue
    res = G - points
    for k in range(D-1,-1,-1):
        kbit = ((i>>k)&1)
        if not kbit:
            test = (res+k) // (k+1)
            #print(test)
            if test <= pc[k][0]-1:
                res = 0
                cost += test
                ans = min(ans, cost)
            else:
                res -= (k+1)*(pc[k][0]-1)
                cost += pc[k][0]-1
    
print(ans)

Verdicts: Runtime Error

Accepted
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 = [0]*D
c = [0]*D
for d in range(D):
    p[d], c[d] = map(int, input().split())

time_list = []
for i in range(1<<D):
    point = 0
    time = 0
    output = []
    for j in range(D): 
        #print(i,j+1,bin(i>>j))
        if ((i >> j) & 1) == 1: 
            output.append(A[j])
    #print(output)
    for d in range(D):
        if ((i>>d) & 1) == 1:
            point += 100*(d+1)* p[d] + c[d]
            time += p[d]
    if point < G:
        
        for d in range(D)[::-1]:
            if ((i>>d) & 1) == 0: 
                for k in range(p[d]):
                    if point < G:
                        point += 100*(d+1) 
                        time += 1
                    else: break
                break
            else: continue
    if point >= G:
        time_list.append(time)
print(min(time_list))

D, G = map(int, input().split())
p = [0]*D
c = [0]*D
for d in range(D):
    p[d], c[d] = map(int, input().split())

time_list = []
for i in range(1<<D):
    point = 0
    time = 0
    output = []
    #for j in range(D): 
        #print(i,j+1,bin(i>>j))
        
            #output.append(A[j])
    #print(output)
    for d in range(D):
        if ((i>>d) & 1) == 1:
            point += 100*(d+1)* p[d] + c[d]
            time += p[d]
    if point < G:
        
        for d in range(D)[::-1]:
            if ((i>>d) & 1) == 0: 
                for k in range(p[d]):
                    if point < G:
                        point += 100*(d+1) 
                        time += 1
                    else: break
                break
            else: continue
    if point >= G:
        time_list.append(time)
print(min(time_list))

Verdicts: Runtime Error

Accepted
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):
from itertools import product
n,k = map(int,input().split())
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append([0,a,b])
for i in range(n):
    L[i][0] = 100*(i+1)
#print(L)
li = [0,1]
re = []

def cer(v):
    for i in range(n-1,0,-1):
        if v[i] == 0:
            return i
            
for v in product(li,repeat = n):
    score = 0
    scorenomi = 0
    num = 0
    for i in range(n):
        score += (L[i][0]*L[i][1] + L[i][2])*v[i]
        scorenomi +=L[i][0]*L[i][1]*v[i]
        num +=L[i][1]*v[i]
    if score < k:
        j = 1
        score2 = 0
        while j <= L[cer(v)][1]:
            score2 = L[cer(v)][0]*j
            if score + score2 >=k:
                break
            j +=1
        #print(num,i,j,num + j,score,score2,score + score2,v)
    if score+ score2 >=k:
        print(num +j)
        exit()
    re.append([score,scorenomi,num,v])
re.sort()
for i in range(len(re)):
    if re[i][0] >=k:
        print(re[i][2])
        exit()

n,k = map(int,input().split())
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append([(i+1)*100,a,b])
#print(L)
ans = 10**10
if k < L[-1][0]*L[-1][1]:
    if k%L[-1][0] != 0:
        ans = (k//L[-1][0]+1)
    else:
        ans = (k//L[-1][0])

for i in range(1<<n):
    li = []
    score,score_zan,cnt = 0,0,0
    for j in range(n):
        if i>>j&1:
            score +=(L[j][0]*L[j][1] + L[j][2])
            cnt +=L[j][1]
            score_zan = k-score
        else:
            li.append(L[j])
    if score > 0 and score_zan <= 0:
        ans = min(ans,cnt)
    li.sort(reverse = True)
    
    if li and score_zan > 0:
        if score_zan < li[0][0]*li[0][1]:
            ans = min(ans,cnt + score_zan//li[0][0])
print(ans)

Verdicts: Runtime Error

Accepted
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):



a,b=map(int,input().split())
c=[0]+[list(map(int,input().split()))for i in range(a)]

print(c)

def f(t,s): 
    if t==0: 
        return 10**9
    l=min(s//(t*100),c[t][0]) 
    k=100*t*l 
    if l==c[t][0]: 
        k+=c[t][1] 
    if k<s: 
        l+=f(t-1,s-k) 
    return min(l,f(t-1,s)) 
print(f(a,b))






a,b=map(int,input().split())
c=[0]+[list(map(int,input().split()))for i in range(a)]

#print(c)

def f(t,s): 
    if t==0: 
        return 10**9
    l=min(s//(t*100),c[t][0]) 
    k=100*t*l 
    if l==c[t][0]: 
        k+=c[t][1] 
    if k<s:　
        l+=f(t-1,s-k) 
    return min(l,f(t-1,s)) 
print(f(a,b))



D, G = map(int, input().split())

PC = [tuple(map(int, input().split())) for _ in range(D)]

ans = 10 ** 9
for i in range(2 ** D): 
    score = 0
    problem = 0
    for j in range(D):
        if (i >> j) & 1:
            score += 100 * (j + 1) * PC[j][0] + PC[j][1]
            problem += PC[j][0]
    if score > G:
        continue
    left = G - score 
    for j in range(D):
        if (i >> j) & 1:
            continue
        if left > 100 * (j + 1) * PC[j][0] + PC[j][1]: 
            pass
        else:
            tmp = (left + (100 * (j + 1)) - 1) // (100 * (j + 1))
            ans = min(ans, problem + min(tmp, PC[j][0]))

print (ans)
        

    


Verdicts: Wrong Answer

Runtime Error

Accepted
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 = (int(i) for i in input().split())
G = G // 100
P= [0] * D
C= [0] * D

for i in range(D):
    P[i], C[i] = (int(i) for i in input().split())
    C[i] = C[i] // 100

INF = int(1e9)
mem = [[0] * G for _ in range(D+1)]
used = [[0] * G for _ in range(D+1)]
print (mem)

def dfs(idx, g):
    if g >= G:
        return 0
    if idx == D:
        return INF

    if(used[idx][g]):
        return mem[idx][g]
    used[idx][g] = 1
    
    p = P[idx]
    c = C[idx]
    res = INF
    for i in range(p+1):
        score = g + (idx + 1) * i
        if(i == p):
            score = score + c
        res = min(res, i + dfs(idx+1, score))
    mem[idx][g] = res;
    return res

ans = dfs(0, 0)
print (ans)



D, G = (int(i) for i in input().split())
G = G // 100
P= [0] * D
C= [0] * D

for i in range(D):
    P[i], C[i] = (int(i) for i in input().split())
    C[i] = C[i] // 100

INF = int(1e9)
mem = [[0] * 1010 for _ in range(D+1)] 
used = [[0] * 1010 for _ in range(D+1)]

def dfs(idx, num):
    if num == 0:
        return 0
    
    if num < 0:
        return -INF

    if idx == D:
        return -INF

    if used[idx][num]:
        return mem[idx][num]
    
    used[idx][num] = 1
    p = P[idx]
    c = C[idx]
    res = -INF
    for i in range(p+1):
        score = (idx + 1) * i;
        if (i == p):
            score = score + c
        nnum = num - i
        res = max(res, score + dfs(idx+1, nnum))
    mem[idx][num] = res;
    return res

ans = INF
for i in range(1001):
    if dfs(0, i) >= G:
        ans = i
        break

print (ans)



Verdicts: Wrong Answer

Accepted
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())
answer = 0
Q = []
for i in range(d):
    p,c=map(int,input().split())
    answer += p
    Q.append((i+1,p,c))
print(answer)

dp = [-10**9]*(answer+1) 
dp[0] = 0
for i,p,c in Q:
    for j in range(answer,-1,-1):
        for k in range(1,p+1):
            cc = i*100*k
            if k == p:
                cc += c
            if j-k >= 0:
                dp[j]=max(dp[j],dp[j-k]+cc)
        
for i in range(answer+1):
    if dp[i] >= g:
        print(i)
        exit()

d,g = map(int,input().split())
answer = 0
Q = []
for i in range(d):
    p,c=map(int,input().split())
    answer += p
    Q.append((i+1,p,c))

dp = [-10**9]*(answer+1) 
dp[0] = 0
for i,p,c in Q:
    for j in range(answer,-1,-1):
        for k in range(1,p+1):
            cc = i*100*k
            if k == p:
                cc += c
            if j-k >= 0:
                dp[j]=max(dp[j],dp[j-k]+cc)
        
for i in range(answer+1):
    if dp[i] >= g:
        print(i)
        exit()

Verdicts: Wrong Answer

Accepted
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(1,D+1):
  pi,ci = map(int,input().split())
  p[i] = pi
  c[i] = ci
ans = sum(p.values())

for i in range(2**D):
  cmp = {i:False for i in range(1,D+1)}
  score = 0
  ans_tmp = 0
  for j in range(D):
    if (i >> j) & 1:
      cmp[j+1] = True
      score += (j+1)*100*p[j+1]+c[j+1]
      ans_tmp += p[j+1]
  keys = [k for k,v in cmp.items() if v == False]
  if 0 < G - score < max(keys)*100*(p[max(keys)]-1):
    ans_tmp += (G-score) // (max(keys)*100) 
    if (G-score) % (max(keys)*100) != 0:
      ans_tmp += 1 
  else:
    ans_tmp = sum(p.values())
        
  ans = min(ans_tmp, ans)
print(ans)

D, G = map(int,input().split())
table = []
ans = 0

for i in range(D):
    p,c = map(int,input().split())
    ans += p
    table.append((p,c))


for i in range(2**D):
    score = 0
    n = 0
    solved = [0] * D
    for j in range(D):
        if i>>j & 1:
            p,c = table[j]
            solved[j] = 1
            score += 100*(j+1)*p+c
            n += p
    if score<G:
        for k in range(D-1,-1,-1):
            if solved[k] == 0:
                p = table[k][0]
                for l in range(1,p):
                    score += 100*(k+1)
                    n += 1
                    if score>=G:
                        break
                break

    if score>=G:
        ans = min(n,ans)
print(ans)

Verdicts: Wrong Answer

Accepted
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 = list(map(int, input().split()))

G /= 100
l = [[0]*3 for i in range(D)]

for i in range(D):
    p, c = list(map(int, input().split()))
    l[i][0] = i+1
    l[i][1] = p
    l[i][2] = c/100


def dfs(i, scores):
    if scores <= 0:
        return 0

    if i == D:
        return 1e9

    a, p, b = l[i]

    counts = [1e9]*(p+1)
    for j in reversed(range(p+1)):
        if j == p and scores-a*p - b >= 0:
            counts[j] = dfs(i+1, scores-a*p-b) + p
        elif scores-a*j >= 0:
            counts[j] = dfs(i+1, scores-a*j) + j
        else:
            break

    ans = min(counts)
    return ans


ans = dfs(0, G)

print(ans)


from math import ceil

D, G = [int(t) for t in input().split()]
p = []
c = []
for i in range(D):
    p_, c_ = [int(t) for t in input().split()]
    p.append(p_)
    c.append(c_)


def minsolve(G, i):
    
    if i <= 0:
        return float('inf')
    n = min(ceil(G / (100 * i)), p[i-1])
    s = 100 * i * n
    if n == p[i-1]:
        s += c[i-1]
    m = n if s >= G else n + minsolve(G - s, i-1)
    return min(m, minsolve(G, i-1))


print(minsolve(G, D))


Verdicts: Wrong Answer

Accepted
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):


import itertools
import math

D, G = map(int, input().split())

p = {}
c = {}
s = {}
for i in range(1, D + 1):
    pi, ci = map(int, input().split())
    score = 100 * i * pi + ci
    s[i] = score
    p[i] = pi
    c[i] = ci


def complete(pset):
    score = 0
    solved = 0
    comped_max = 0
    for b in pset:
        if b:
            score += s[i]
            solved += p[i]
            comped_max = max(comped_max, i)
    return score, solved, comped_max


def left(norm, i):
    if norm <= 0:
        return 0
    res = int(math.floor(norm / (100 * i)))
    if res < p[i]:
        return res
    return float("inf")


ans = float("inf")
for pset in itertools.product((True, False), repeat=D):
    score, solved, comped_max = complete(pset)
    solved += left(G - score, comped_max)
    ans = min(ans, solved)

print(ans)


import itertools
import math

D, G = map(int, input().split())

p = {}
c = {}
s = {}
for i in range(1, D + 1):
    pi, ci = map(int, input().split())
    score = 100 * i * pi + ci
    s[i] = score
    p[i] = pi
    c[i] = ci


def complete(pset):
    score = 0
    solved = 0
    comped = set()
    for i, b in zip(range(1, D + 1), pset):
        if b:
            score += s[i]
            solved += p[i]
            comped.add(i)
    leftset = set(list(range(1, D + 1))) - comped
    return score, solved, leftset


def left(norm, leftset):
    if norm <= 0 or len(leftset) == 0:
        return 0
    i = max(leftset)
    res = int(math.ceil(norm / (100 * i)))
    if res < p[i]:
        return res
    return float("inf")


ans = float("inf")
for pset in itertools.product((True, False), repeat=D):
    score, solved, leftset = complete(pset)
    solved += left(G - score, leftset)
    ans = min(ans, solved)

print(ans)


Verdicts: Runtime Error

Accepted
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):

def solve():
    d = 0
    c = 0
    for i in range(D):
        d += p[i][0]
    dp = [[0]*(d+1) for i in range(D)]
    for i in range(D):
        for j in range(p[i][0]+1):
            if i == 0:
                if j == p[i][0]:
                    dp[i][j] += p[i][1]
                dp[i][j] += 100*j
            else:
                for k in range(c+1):
                    if j == p[i][0]:
                        dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1)+p[i][1])
                    else:
                        dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1))
        c += p[i][0]
    for i in range(d+1):
        if dp[D-1][i]>=G:
            print(i)
            break    
    
if __name__=="__main__":
    D,G = list(map(int, input().split()))
    pc = [list(map(int, input().split())) for _ in range(D)]
    solve()



def solve():
    d = 0
    c = 0
    for i in range(D):
        d += p[i][0]
    dp = [[0]*(d+1) for i in range(D)]
    for i in range(D):
        for j in range(p[i][0]+1):
            if i == 0:
                if j == p[i][0]:
                    dp[i][j] += p[i][1]
                dp[i][j] += 100*j
            else:
                for k in range(c+1):
                    if j == p[i][0]:
                        dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1)+p[i][1])
                    else:
                        dp[i][k+j]=max(dp[i][k+j],dp[i-1][k]+100*j*(i+1))
        c += p[i][0]
    for i in range(d+1):
        if dp[D-1][i]>=G:
            print(i)
            break    
    
if __name__=="__main__":
    D,G = list(map(int, input().split()))
    p = [list(map(int, input().split())) for _ in range(D)]
    solve()


Verdicts: Runtime Error

Accepted
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 = []
for _ in range(d):
    p,c = map(int,input().split(' '))
    pc.append((p,c))

ans = 10000000

for i in range(2**d):
    cnt = 0
    score = 0
    max_flg = 0
    for j in range(d):
        #print(str(i) + ' ' + str(j))
        if((i>>j)&1 == 1):
            score += pc[j][0]*(j+1)*100+pc[j][1]
            cnt += pc[j][0]
        else:
            max_flg = j
    
    print(str(score) + ' '+ str(cnt))
    if(score >= g):
        ans = min(ans,cnt)
    elif(score + (pc[max_flg][0]-1)*(max_flg+1)*100 < g):
        continue
    else:
        for k in range(pc[max_flg][0]):
            if(score + k*(max_flg+1)*100 >= g):
                ans = min(ans,cnt+k)
            else:
                continue

print(str(ans))


d,g = map(int,input().split(' '))
pc = []
for _ in range(d):
    p,c = map(int,input().split(' '))
    pc.append((p,c))

ans = 10000000

for i in range(2**d):
    cnt = 0
    score = 0
    max_flg = 0
    for j in range(d):
        #print(str(i) + ' ' + str(j))
        if((i>>j)&1 == 1):
            score += pc[j][0]*(j+1)*100+pc[j][1]
            cnt += pc[j][0]
        else:
            max_flg = j
    
    #print(str(score) + ' '+ str(cnt))
    if(score >= g):
        ans = min(ans,cnt)
    elif(score + (pc[max_flg][0]-1)*(max_flg+1)*100 < g):
        continue
    else:
        for k in range(pc[max_flg][0]):
            if(score + k*(max_flg+1)*100 >= g):
                ans = min(ans,cnt+k)
            else:
                continue

print(str(ans))

Verdicts: Wrong Answer

Accepted
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 = []
PC = [list(map(int, input().split())) for _ in range(D)]
PC = [0] + PC


def dfs(G, i):
    print(G)
    if i == 0:
        return 10**12
    n = min((G-1)//(100*i)+1, PC[i][0])
    #n = min(G//(100*i), PC[i][0])
    tmp = n*100*i
    if n == PC[i][0]:
        tmp += PC[i][1]
    if tmp < G:
        n += dfs(G-tmp, i-1)
    return min(n, dfs(G, i-1))

print(dfs(G, D))


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


def dfs(G, i):
    if i == 0:
        return 10**12
    n = min((G-1)//(100*i)+1, PC[i][0])
    #n = min(G//(100*i), PC[i][0])
    tmp = n*100*i
    if n == PC[i][0]:
        tmp += PC[i][1]
    if tmp < G:
        n += dfs(G-tmp, i-1)
    return min(n, dfs(G, i-1))

print(dfs(G, D))


Verdicts: Wrong Answer

Accepted
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, goal = map(int, input().split())
pc = [0] + [list(map(int, input().split())) for _ in range(d)]

def solve(goal, d):
  if d == 0:
    return 10**9
  n = min(goal//(100*d), pc[d][0])
  t = n * d * 100
  if n == pc[d][0]:
    t += pc[d][1]
  if t < goal:
    n += solve(goal-t, d-1)
  return min(n, solve(goal,d-1))

print(solve(g,d))


d, goal = map(int, input().split())
pc = [0] + [list(map(int, input().split())) for _ in range(d)]

def solve(goal, d):
  if d == 0:
    return 10**9
  n = min(goal//(100*d), pc[d][0])
  t = n * d * 100
  if n == pc[d][0]:
    t += pc[d][1]
  if t < goal:
    n += solve(goal-t, d-1)
  return min(n, solve(goal,d-1))

print(solve(goal,d))


Verdicts: Runtime Error

Accepted
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())
prob = [list(map(int, input().split())) for i in range(D)]
tmp = 100*10

for i in range(1<<D):
    grade = 0
    cnt = 0
    judge = list(range(1, D+1))

    for j in range(D):
        if (i>>j & 1):
            grade += (100*(j+1)*prob[j][0] + prob[j][1])
            cnt += prob[j][0]
            judge[j] = 0

    if grade >= G and tmp > cnt:
        tmp = cnt

    num = prob[(max(judge))-1][0]

    if G > grade and num > int((G - grade) // (max(judge)*100)) - 1:
        cnt += int((G - grade) // (max(judge)*100)) - 1 
        if tmp > cnt:
            tmp = cnt

print(tmp)

import math

D, G = map(int, input().split())
prob = [list(map(int, input().split())) for i in range(D)]
tmp = 100*10

for i in range(1<<D):
    grade = 0
    cnt = 0
    judge = list(range(1, D+1))

    for j in range(D):
        if (i>>j & 1):
            grade += (100*(j+1)*prob[j][0] + prob[j][1])
            cnt += prob[j][0]
            judge[j] = 0

    if grade >= G and tmp > cnt:
        tmp = cnt
        
    num = prob[(max(judge))-1][0]

    if G > grade and num > math.ceil((G - grade)/(max(judge)*100)):
        cnt += math.ceil((G - grade)/(max(judge)*100)) 
        if tmp > cnt:
            tmp = cnt

print(tmp)


Verdicts: Wrong Answer

Accepted