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):
D,G=[ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(D) ]

import itertools as ite
cmin = 100000000000000000
for cli in ite.product( *([[0,1]]*D) ):
  
  s = 0
  c = 0
  for i in range(D):
    if cli[i]==1:
      s +=  li[i][1] + (i+1)*100*li[i][0]
      c +=  li[i][0]
  
  ds = G-s
  
  for i in range(D-1,-1,-1):
    if (ds<=0):
      break
    if cli[i]==0:
      toku = (ds-1)//((i+1)*100)+1
      toku = min(toku,li[i][0])
      c += toku
      ds -= toku*(i+1)*100
    if (ds<=0):
      break
  if (ds<=0):
    cmin = min(cmin,c)
  else:
print (cmin)

D,G=[ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(D) ]

import itertools as ite
cmin = 100000000000000000
for cli in ite.product( *([[0,1]]*D) ):
  
  s = 0
  c = 0
  for i in range(D):
    if cli[i]==1:
      s +=  li[i][1] + (i+1)*100*li[i][0]
      c +=  li[i][0]
  
  
  ds = G-s
  
  for i in range(D-1,-1,-1):
    if (ds<=0):
      break
    if cli[i]==0:
      toku = (ds-1)//((i+1)*100)+1
      toku = min(toku,li[i][0])
      c += toku
      ds -= toku*(i+1)*100
    if (ds<=0):
      cmin = min(cmin,c)
print (cmin)

D,G=[ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(D) ]

import itertools as ite
cmin = 100000000000000000
for cli in ite.product( *([[0,1]]*D) ):
  
  s = 0
  c = 0
  for i in range(D):
    if cli[i]==1:
      s +=  li[i][1] + (i+1)*100*li[i][0]
      c +=  li[i][0]
  
  ds = G-s
  
  for i in range(D-1,-1,-1):
    if (ds<=0):
      break
    if cli[i]==0:
      toku = (ds-1)//((i+1)*100)+1
      toku = min(toku,li[i][0])
      c += toku
      ds -= toku*(i+1)*100
    if (ds<=0):
      break
  if (ds<=0):
    cmin = min(cmin,c)
  else:
    pass
print (cmin)

Verdicts: Runtime Error

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

# print('input >>')
D, G = map(int, (input().split()))
pc = []
for _ in range(D):
    p, c = map(int, (input().split()))
    pc.append((p, c))

point = 0
ans = []

def dfs(i, count, point):
    
    if point >= G:
        ans.append(count)
        return
    
    if point + (i + 1) * 100 * (pc[i][0] - 1) >= G:
        count += math.ceil((G - point) / ((i + 1) * 100))
        point += math.ceil((G - point) / ((i + 1) * 100)) * (i + 1) * 100
        ans.append(count)
    if i == 0:
        return
    
    dfs(i-1, count+pc[i][0], point + (i+1)*100 * pc[i][0] + pc[i][1])
    
    dfs(i-1, count, point)

dfs(D-1,0,0)

# print('----------output----------')
print(min(ans))

import math

# print('input >>')
D, G = map(int, (input().split()))
pc = []
for _ in range(D):
    p, c = map(int, (input().split()))
    pc.append((p, c))

point = 0
ans = []

def dfs(i, count, point):
    
    c_ = count
    if point >= G:
        ans.append(count)
        return
    
    if point + (i + 1) * 100 * (pc[i][0] - 1) >= G:
        count += math.ceil((G - point) / ((i + 1) * 100))
        ans.append(count)
    
    elif point + (i + 1) * 100 * pc[i][0] + pc[i][1] >= G:
        count += pc[i][0]
        ans.append(count)
    if i == 0:
        return
    
    dfs(i-1, c_+pc[i][0], point + (i+1)*100 * pc[i][0] + pc[i][1])
    
    dfs(i-1, c_, point)

dfs(D-1,0,0)

# print('----------output----------')
print(min(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):
import unionfind

D, G = map(int, input().split())
PC = [list(map(int, input().split())) for i in range(D)]
PC_new = sorted([(PC[i][0]*100*(i+1) + PC[i][1], PC[i][0]) for i in range(D)],
                key=lambda x: x[1], reverse=True)

ans = 99999999
for i in range(1<<D):
    ct = 0
    score = 0
    for j in range(D):
        if i>>j&1:
            score += PC[j][1]
            score += PC[j][0] * (j+1) * 100
            ct += PC[j][0]
    for j in range(D-1, -1, -1):
        if i>>j&1: continue
        if score >= G: break
        g = (j+1)*100
        got = (G-score+g-1)//g
        score += min(got, PC[j][0]) * g
        ct += min(got, PC[j][0])
    ans = min(ans, ct)
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())
li = []
for i in range(D):
  li.append(list(map(int, input().split())))

min_n=10**9
n = 0
s=0
for ind in range(2**D):
  n=0
  s=0
  if ind==0:
    continue
  for j in range(D):
    if ind>>j & 1:
      s += (j+1)*100*li[j][0]+li[j][1]
      n+=li[j][0]
  print(s)
  if s < G:
    for j in range(D-1,-1,-1):
      if ind>>j & 1 == 0:
        tmp = (G-s) / ((j+1)*100)
        if (G-s) % ((j+1)*100) != 0:
          tmp += 1
        if tmp > 0:
          if tmp==li[j][1]:
            tmp -=1
          s += (j+1)*100*tmp
          n+= tmp
      if s >= G:
        break
  if s >= G:
    if n<min_n:
      # print(ind)
      min_n=n

print(int(min_n))
      

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

min_n=0
n = 10**9
s=0
for ind in range(2**D):
  n=0
  if ind==0:
    continue
  for j in range(D):
    if ind>>j & 1:
      s += (j+1)*100*li[j][0]+li[j][1]
      n+=li[j][0]
  if s < G:
    for j in range(D-1,-1,-1):
      if ind>>j & 0:
        tmp = s % ((j+1)*100)
        if tmp > 0:
          if tmp==li[j][1]:
            tmp -=1
          s += (j+1)*100*tmp
          n+= tmp
  if s >= G:
    if n<min_n:
      min_n=n

print(min_n)
      

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

min_n=10**9
n = 0
s=0
for ind in range(2**D):
  n=0
  s=0
  for j in range(D):
    if ind>>j & 1:
      s += (j+1)*100*li[j][0]+li[j][1]
      n+=li[j][0]
  # print(s)
  if s < G:
    for j in range(D-1,-1,-1):
      if ind>>j & 1 == 0:
        tmp = (G-s) / ((j+1)*100)
        if (G-s) % ((j+1)*100) != 0:
          tmp += 1
        if tmp > 0:
          if tmp>=li[j][0]:
            tmp=li[j][0]-1
          s += (j+1)*100*tmp
          n+= tmp
      if s >= G:
        # print(tmp)
        break
  if s >= G:
    if n<min_n:
      # print(ind)
      min_n=n

print(int(min_n))
      

Verdicts: Wrong Answer

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 copy

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


score=[None]*D
for i in range(D):
    score[i]=list(map(int,input().split()))

comp=[None]*D

for i in range(D):
    comp[i]=score[i][0]*(i+1)*100+score[i][1]


number=0
for i in range(D):
    number+=score[i][0]

dplist=[None]*(number+1)
for i in range(number+1):
    dplist[i]=[(0,[0 for i in range(D)])]


def scoresolve(X):
    ANS=0
    for i in range(len(X)):
            ANS+=X[i]*(i+1)*100
            if X[i]==score[i][0]:
                ANS+=score[i][1]

    return ANS

dplist[number]=(sum(comp),[score[i][0] for i in range(D)])
dplist[0]=(0,[0 for i in range(D)])

def DP(x):
    ANS=0
    for i in range(D):
        xx=copy.deepcopy(dplist[x+1][1])
        if xx[i]==0:
            continue
        else:
            xx[i]-=1
        if scoresolve(xx)>ANS:
            retlist=copy.deepcopy(xx)
            retnum=scoresolve(xx)
            ANS=retnum

    return (retnum,retlist)

for i in range(number-1,0,-1):
    #print(dplist)
    dplist[i]=DP(i)

for i in range(number+1):
    if dplist[i][0]>=G:
        print(i)
        break


        
        


import math

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


score=[None]*D
for i in range(D):
    score[i]=list(map(int,input().split()))


import itertools
bitlist=list(itertools.product((0,1),repeat=D))

def xx(a):
    XX=[0 for i in range(D)]
    for i in range(len(a)):
        if a[i]==1:
            XX[i]=score[i][0]
    return XX


def scoresolve(X):
    ANS=0
    for i in range(len(X)):
            ANS+=X[i]*(i+1)*100
            if X[i]==score[i][0]:
                ANS+=score[i][1]

    return ANS





ANS=100000
for bit in bitlist:
    ii=xx(bit)
    if scoresolve(ii)>=G:
        ANS=min(ANS,sum(ii))
    else:
        j=D-ii[::-1].index(0)-1
        if G-scoresolve(ii)<=(j+1)*100*score[j][0]:
            ANS=min(ANS,sum(ii)+math.ceil((G-scoresolve(ii))/(j+1)/100))

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(' '))
l = [list(map(int,input().split())) for i in range(D)]
     
ans = 10**8
for i in range(2**D):
    score = 0
    tmp = 0
    n_list = []
    for j in range(D):
        if (i >> j & 1):
            k = l[j]
            score += (j+1)*100*k[0]+k[1]
            tmp += k[0]
        else:
            n_list.append([j+1]+l[j])
    e_flag = False
    for ii in n_list[::-1]:#[1or2or..,times,bonus]
        for jj in range(ii[1]-1):
            if score<G:
                score += ii[0]*100
                tmp += 1
            else:
                e_flag = True
                break
        if e_flag:
            break
    if score<G:
        continue
    ans = min(ans,tmp)
    print(ans)

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

def func(i, t):
    if i == 0:
        return 10 ** 9
    
    # Solve all problems, or part of them
    k = min(t // (100 * i), X[i][0])
    s = 100 * i * k
    
    # If all problems are solved, add bonus
    if k == X[i][0]:
        s += X[i][1]
        
    
    if s < t:
        k += func(i - 1, t - s)
        
    # Select minimum number of solved problems
    # k: solve i-th line
    
    return min(k, func(i - 1, t))

# Solve backward
print(func(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):
def Search(g,L,i):
    if i<0:return 9999
    pS=pC=S = C = 0
    while g > S:
        if i < 0: return 9999
        pS=S
        pC=C
        S+=L[i][0]*L[i][1]*100
        if g > S:
            S+=L[i][2]
        C+=L[i][1]
        i-=1
    print(C,pC,g-pS,L[:i+1],i)
    pC+=min(C,((g-pS-1)//100//L[i+1][0]+1),Search(g-pS,L[:i+1],i))
    return pC
d,g=map(int,input().split())
L=[]
for i in range(d):
    p,c=map(int,input().split())
    L.append((i+1,p,c))
print(Search(g,L,i))

def Search(g,t):
    if t<= 0: return 100000000000
    n=min(int(g/(100*t)),p[t-1])
    s=100*t*n
    if n==p[t-1]:
        s=sum[t-1]
    if g>s:
        n+=Search(g-s,t-1)
    return min(n,Search(g,t-1))
d,g=map(int,input().split())
p=[]
c=[]
sum=[]
for i in range(d):
    a,b=map(int,input().split())
    p.append(a)
    c.append(b)
for i in range(d):
    sum.append((i+1)*100*p[i]+c[i])
print(Search(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):
def dfs(i, sum, count, unsolve):
 global ans
 if i == D:
  
  if sum < G:
   use = max(unsolve)
  
   N = min(pc[use-1][0], -(-(g-sum)//(100*use)))
   count += N 
   sum += N * 100 * use
  if sum > G:
   ans = min(ans, count)
 else:
 dfs(i + 1, sum, count, unsolve)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], unsolve - {i + 1})

d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = float("inf")
dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)

def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        
        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)
    else:
        
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = float("inf")
dfs(0, 0, 0, set(range(1, d + 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 i in range(D):
    p[i], c[i] = map(int, input().split())

num = []

for i in range(2**D):
    score = 0
    num_tmp = 0  
    not_comp = []  
    for j in range(D):
        if i >> j & 1:
            score += p[j] * 100 * (j + 1) + c[j]
            num_tmp += p[j]
        else:
            not_comp.append(j)
    print("not_comp:", not_comp)

    for j in not_comp[::-1]:
        if score < G:
            num_j = min(p[j] - 1, (G - score - 1) // (100 * (j + 1)) + 1)
            score += num_j * 100 * (j + 1)
            num_tmp += num_j
    print("num_tmp:", num_tmp)

    if score >= G:
        num.append(num_tmp)
    print("num:", num)

ans = min(num)
print(ans)

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

num = []

for i in range(2**D):
    score = 0
    num_tmp = 0  
    not_comp = []  
    for j in range(D):
        if i >> j & 1:
            score += p[j] * 100 * (j + 1) + c[j]
            num_tmp += p[j]
        else:
            not_comp.append(j)
    print("not_comp:", not_comp)

    for j in not_comp[::-1]:
        if score < G:
            num_j = min(p[j] - 1, (G - score) // (100 * (j + 1)))
            score += num_j * 100 * (j + 1)
            num_tmp += num_j
    print("num_tmp:", num_tmp)

    if score >= G:
        num.append(num_tmp)
    print("num:", num)

ans = min(num)
print(ans)

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

num = []

for i in range(2**D):
    score = 0
    num_tmp = 0  
    not_comp = []  
    for j in range(D):
        if i >> j & 1:
            score += p[j] * 100 * (j + 1) + c[j]
            num_tmp += p[j]
        else:
            not_comp.append(j)

    for j in not_comp[::-1]:
        if score < G:
            num_j = min(p[j] - 1, (G - score) // (100 * (j + 1)))
            score += num_j * 100 * (j + 1)
            num_tmp += num_j

    if score >= G:
        num.append(num_tmp)

ans = min(num)
print(ans)

Verdicts: Wrong Answer

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):
ans = 10000
for i in range(2**D):
    s = 0
    cnt = 0
    b = [0] * D
    
    
    for j in range(D):
        if (i >> j) & 1:
            s += 100 * (j + 1) * pc[j][0] + pc[j][1]
            cnt += pc[j][0]
            b[j] = 1

    
    flag1 = False
    flag2 = True
    if s < G:
        for k in range(D)[::-1]:
            if b[k] == 0:
                for x in range(pc[k][0]):
                    s += 100 * (k + 1)
                    cnt += 1
                    if s >= G:
                        flag1 = True
                        break
                else:
                    flag2 = False
                    break
            if flag1:
                break

    if flag2:
        ans = min(ans, cnt)


print(ans)

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

ans = 10000
for i in range(2**D):
    s = 0
    cnt = 0
    b = [0] * D
    
    
    for j in range(D):
        if (i >> j) & 1:
            s += 100 * (j + 1) * pc[j][0] + pc[j][1]
            cnt += pc[j][0]
            b[j] = 1

    
    flag1 = False
    flag2 = True
    if s < G:
        for k in range(D)[::-1]:
            if b[k] == 0:
                for x in range(pc[k][0]):
                    s += 100 * (k + 1)
                    cnt += 1
                    if s >= G:
                        flag1 = True
                        break
                else:
                    flag2 = False
                    break
            if flag1:
                break

    if flag2:
        ans = min(ans, cnt)


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())
po = [0]
co = [0]
for i in range(d):
    p,c = map(int,input().split())
    po.append(p)
    co.append(c)







def f(G,i):
    if i == 0:
        return float("inf")
    n = min(G//(i * 100),p[i])
    s = 100 * i * n 
    if n == p[i]:
        s += c[i]
    if s < G:
        n += f(G-s,i-1)
    return min(n,f(G,i-1))

print(f(g,d))

d,g = map(int,input().split())
po = [0]
co = [0]
for i in range(d):
    p,c = map(int,input().split())
    po.append(p)
    co.append(c)







def f(G,i):
    if i == 0:
        return float("inf")
    n = min(G//(i * 100),po[i])
    s = 100 * i * n 
    if n == po[i]:
        s += c[i]
    if s < G:
        n += f(G-s,i-1)
    return min(n,f(G,i-1))

print(f(g,d))

d,g = map(int,input().split())
po = [0]
co = [0]
for i in range(d):
    p,c = map(int,input().split())
    po.append(p)
    co.append(c)







def f(G,i):
    if i == 0:
        return float("inf")
    n = min(G//(i * 100),po[i])
    s = 100 * i * n 
    if n == po[i]:
        s += co[i]
    if s < G:
        n += f(G-s,i-1)
    return min(n,f(G,i-1))

print(f(g,d))

Verdicts: Runtime Error

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):
import itertools

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

ans = 10**5

for v in itertools.product([0,1],repeat=D):
    p = 0
    t = 0
    for i in range(D):
        if v[i] == 1:
            p += (i+1)*100*pc[i][0] + pc[i][1]
            t += pc[i][0]
    w = G-p
    if w > 0:
        for i in range(D):
            if v[i] == 0 and w <= (i+1)*100*(pc[i][0]-1):
                a = (i+1)*100
                tt = t+(w+a-1)//a
                ans = min(ans,tt)
    else:
        ans = min(ans,t)
print(ans)


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


scr = [((i+1)*100)*pc[i][0]+pc[i][1] for i in range(D)]

ans = 10**10
for i in range(2**D):
    a = 0
    c = 0
    for j in range(D):
        if i>>j&1:
            a += scr[j]
            c += pc[j][0]
    if a < G:
        continue
    ans = min(ans,c)
    for j in range(D):
        if i>>j&1:
            a -= scr[j]
            c -= pc[j][0]
            if a >= G:
                continue
            t = (j+1)*100
            if (G-a+t-1)//t < pc[j][0]:
                ans = min(ans,c+(G-a+t-1)//t)
            a += scr[j]
            c += pc[j][0]

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

ans = 1 << 29
t = []
for bit in range(1<<D):
    score = 0
    f = 0
    
    for i in range(D):
        if bit & (1<<i):
            score += pc[i][0]*100*(i+1) + pc[i][1]
            f += pc[i][0]
            if score >= G: break
    
    nokori = []
    for j in range(D):
        if not (bit & (1<<j)):
            nokori.append(pc[j] + [j+1])
    nokori = list(reversed(nokori))
    for d in nokori:
        for x in range(d[0]):
            if score >= G: break
            score += 100*(d[2])
            f += 1
        if score >= G: break
    print(bin(bit),f)
    ans = min(ans,f)
print(ans)


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

ans = 1 << 29
t = []
for bit in range(1<<D):
    score = 0
    f = 0
    
    for i in range(D):
        if bit & (1<<i):
            score += pc[i][0]*100*(i+1) + pc[i][1]
            f += pc[i][0]
            if score >= G: break
    
    nokori = []
    for j in range(D):
        if not (bit & (1<<j)):
            nokori.append(pc[j] + [j+1])
    nokori = list(reversed(nokori))
    for d in nokori:
        for x in range(d[0]):
            if score >= G: break
            score += 100*(d[2])
            f += 1
        if score >= G: break
    ans = min(ans,f)
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()))
P = []
C = []

for i in range(D):
    p,c = list(map(int,input().split()))
    P.append(p)
    C.append(c)

for c in range(2**D):
    score = 0
    solved = 0
    remain = []
    for i,b in enumerate(format(c,'b').zfill(D)):
        if b == '1':
            score += P[i]*100*(i+1) + C[i]
            solved += P[i]
        else:
            remain.append(i)
    if score < G:
        R = G - score
        j = remain[-1]
        if (P[j]-1)*(j+1)*100 < R:
            continue
        solved += (R//(100*(j+1)))
    ans = min(solved, ans)

print(ans)

D,G = list(map(int,input().split()))
P = []
C = []

for i in range(D):
    p,c = list(map(int,input().split()))
    P.append(p)
    C.append(c)

ans = 10000

for c in range(2**D):
    score = 0
    solved = 0
    remain = []
    for i,b in enumerate(format(c,'b').zfill(D)):
        if b == '1':
            score += P[i]*100*(i+1) + C[i]
            solved += P[i]
        else:
            remain.append(i)
    if score < G:
        R = G - score
        j = remain[-1]
        if (P[j]-1)*(j+1)*100 < R:
            continue
        solved += -(-R//(100*(j+1)))
    ans = min(solved, ans)

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):
import sys 
sys.setrecursionlimit(10**6)

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

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

  else:
    dfs(i+1,sum,count,nokori)
    dfs(i+1,sum+pc[i][0]*100*(i+1)+pc[i][1],count+pc[i][0],nokori-(i+1))

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

dfs(0,0,0,set(range(1,d+1))

print(ans)  

import sys 
sys.setrecursionlimit(10**8)

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

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

  else:
    dfs(i+1,sum,count,nokori)
    dfs(i+1,sum+pc[i][0]*100*(i+1)+pc[i][1],count+pc[i][0],nokori-{i+1})

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

dfs(0,0,0,set(range(1,d+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):
#abc104c All Green


def dfs(i, sum, count, rest):
    global ans
    if i == d:
        if sum < g:
            rest_max = max(rest)
            n = min(l[rest_max-1][0], -(-(g-sum)//(rest_max*100)))
            count += n
            sum += n * rest_max * 100
        if sum >= g:
            ans = min(ans, count)
    else :
        dfs(i+1, sum, count, rest) 
        dfs(i+1, sum + l[i][0]*(i+1)*100, count + l[i][0], rest - {i+1}) 

d, g = map(int, input().split())
l = [list((map(int, input().split()))) for _ in range(d)]
ans = float("inf")
dfs(0, 0, 0, set(range(1, d+1)))
print(ans)



def dfs(i, sum, count, rest):
    global ans
    if i == d:
        if sum < g:
            rest_max = max(rest)
            n = min(l[rest_max-1][0], -(-(g-sum)//(rest_max*100)))
            count += n
            sum += n * rest_max * 100
        if sum >= g:
            ans = min(ans, count)
    else :
        dfs(i+1, sum, count, rest) 
        dfs(i+1, sum + l[i][0]*(i+1)*100+l[i][1], count + l[i][0], rest - {i+1}) 

d, g = map(int, input().split())
l = [list((map(int, input().split()))) for _ in range(d)]
ans = float("inf")
dfs(0, 0, 0, set(range(1, d+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):
import sys
from math import ceil
inputs = sys.stdin.readlines()

d, g = map(int, inputs[0].split())
P = list(map(int, map(lambda x: x.split()[0], inputs[1:])))
C = list(map(int, map(lambda x: x.split()[1], inputs[1:])))

ans = float('inf')
for bit in range(1 << d):
    count, total, rest = 0, 0, set(range(1, d+1))
    for i in range(d):
        if bit & (1 << i):
            total += P[i] * (i + 1) * 100 + C[i]
            count += P[i]
            rest.discard(i + 1)

    if total < g:
        use = max(rest)

#         count += n

        n = ceil((g - total) / (use * 100))
        if P[use-1] > n:
            count += n
            total += n * use * 100
            ans = min(ans, count)
#     if total >= g:
#         ans = min(ans, count)
print(ans) 



d, g = map(int, inputs[0].split())
P = list(map(int, map(lambda x: x.split()[0], inputs[1:])))
C = list(map(int, map(lambda x: x.split()[1], inputs[1:])))

ans = float('inf')
for bit in range(1 << d):
    count, total, rest = 0, 0, set(range(1, d+1))
    for i in range(d):
        if bit & (1 << i):
            total += P[i] * (i + 1) * 100 + C[i]
            count += P[i]
            rest.discard(i + 1)

    if total < g:
        use = max(rest)
        n = ceil((g - total) / (use * 100))
        if P[use-1]-1 < n:
            continue
        count += n
        total += n * use * 100
        
    if total >= g:
        ans = min(ans, count)
print(ans) 


import sys
from math import ceil
inputs = sys.stdin.readlines()

d, g = map(int, inputs[0].split())
P = list(map(int, map(lambda x: x.split()[0], inputs[1:])))
C = list(map(int, map(lambda x: x.split()[1], inputs[1:])))

ans = float('inf')
for bit in range(1 << d):
    count, total, rest = 0, 0, set(range(1, d+1))
    for i in range(d):
        if bit & (1 << i):
            total += P[i] * (i + 1) * 100 + C[i]
            count += P[i]
            rest.discard(i + 1)

    if total < g:
        use = max(rest)
        n = ceil((g - total) / (use * 100))
        if P[use-1]-1 < n:
            continue
        count += n
        total += n * use * 100
        
    if total >= g:
        ans = min(ans, count)
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 = map(int, input().split())
PC = [tuple(map(int, input().split()))]

res = float("inf")
for bit in range(1 << D):
    sum = 0
    num = 0
    for i in range(D):
        if ((bit >> i) & 1):
            sum += (i + 1) * 100 * P[i] + C[i]
            num += P[i]
    if sum >= G:
        res = min(res, num)
    for i in range(D - 1, -1, -1):
        if ((bit >> i) & 1):
            continue
        for j in range(P[i] - 1):
            sum += (i + 1) * 100
            num + +
        if sum >= G:
            res = min(res, num)
            break
    print(res)


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

res = float("inf")
for bit in range(1 << D):
    summ = 0
    num = 0
    for i in range(D):
        if ((bit >> i) & 1):
            summ += (i + 1) * 100 * PC[i][0] + PC[i][1]
            num += PC[i][0]
    if summ >= G:
        res = min(res, num)
    for i in range(D - 1, -1, -1):
        if ((bit >> i) & 1):
            continue
        for _ in range(PC[i][0] - 1):
            summ += (i + 1) * 100
            num += 1
            if summ >= G:
                res = min(res, num)
                break
print(res)


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, C = [], []

for _ in range(D):
    p, c = map(int, input().split())
    P.append(p); C.append(c)

ans = float('inf')

for bit in range(2**D):
    score, solve_num = 0, 0
    for i in range(D):
        if (bit >> i) & 1:
            score += (100 * (i+1) * P[i] + C[i])
            solve_num += P[i]
            is_solve[i] += P[i]

    for i in range(D-1, -1, -1):
        if score >= G:
            break

        if (bit >> i) & 1:
            continue

        for j in range(p[i]):
            score += 100*(i+1)
            solve_num += 1

            if score >= G:
                break

    ans = min(ans, solve_num)

print(ans)


D, G = map(int, input().split())
P, C = [], []

for _ in range(D):
    p, c = map(int, input().split())
    P.append(p); C.append(c)

ans = float('inf')

for bit in range(2**D):
    score, solve_num = 0, 0
    for i in range(D):
        if (bit >> i) & 1:
            score += (100 * (i+1) * P[i] + C[i])
            solve_num += P[i]
            is_solve[i] += P[i]

    for i in range(D-1, -1, -1):
        if score >= G:
            break

        if (bit >> i) & 1:
            continue

        for j in range(P[i]):
            score += 100*(i+1)
            solve_num += 1

            if score >= G:
                break

    ans = min(ans, solve_num)

print(ans)

D, G = map(int, input().split())
P, C = [], []

for _ in range(D):
    p, c = map(int, input().split())
    P.append(p); C.append(c)

ans = float('inf')

for bit in range(2**D):
    score, solve_num = 0, 0

    for i in range(D):
        if (bit >> i) & 1:
            score += (100 * (i+1) * P[i] + C[i])
            solve_num += P[i]

    for i in range(D-1, -1, -1):
        if score >= G:
            break

        if (bit >> i) & 1:
            continue

        for j in range(P[i]):
            score += 100*(i+1)
            solve_num += 1

            if score >= G:
                break

    ans = min(ans, solve_num)

print(ans)


Verdicts: Runtime Error

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 add(pc, p, G, tmp):
    b = False
    for i in range(len(pc)-1, -1, -1):
        for k in range(pc[i][0]):
            p += (i+1) * 100
            tmp += 1
            if p >= G:
                return tmp


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

for i in range(D):
    p = (i+1) * 100 * pc[i][0]
    p += pc[i][1]
    tmp = pc[i][0]
    while p < G:
        tmp += add(pc, p, G, tmp)
    cnt = min(cnt, tmp)
print(cnt)


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

def dfs(question_num, rquired_point):
    if question_num < 0:
        return 10 ** 9

    point = (question_num+1) * 100
    ans_num = min(rquired_point // point, pc[question_num][0])
    score = ans_num * point

    if ans_num == pc[question_num][0]:
        score += pc[question_num][1]

    if rquired_point > score:
        ans_num += dfs(question_num-1, rquired_point-score)
    
    return min(ans_num, dfs(question_num-1, rquired_point))

print(dfs(D-1, G))

Verdicts: Runtime Error

Accepted