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(_) for _ in input().split()]
l=[0]+[list(map(int,input().split())) for _ in  range(d)]
print(l)
def f(i,g):
	if i==0:return 10**9
	c=min(g//(100*i),l[i][0])
	s=100*i*c
	if c==l[i][0]:s+=l[i][1]
	if s<g:
		c+=f(i-1,g-s)
	return min(c,f(i-1,g))
print(f(d,g))

import sys
sys.setrecursionlimit(10 ** 6)

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

def solve(bit):
  if bit >= (1<<D):
    return 1000
  p_sum=0
  num=0
  for i in range(D):
    if bit & (1<<i):
      p_sum += c[i] + p[i] * 100*(i+1)
      num += p[i]
  if p_sum >= G:
    return min(num,solve(bit+1))
  else:
    for i in reversed(range(D)):
      if bit & 1<<i:
        continue
      for j in range(p[i]):
        if p_sum >= G:
          break
        p_sum += 100*(i+1)
        num += 1
      else:
        return solve(bit+1)
    return min(num,solve(bit+1))

print(solve(0))

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


l = l[::-1]

ans = float("inf")
for i in range(2**D):
    total = 0
    cnt = 0
    for j in range(D):
      
    if (i>>j)&1:
            total += 100*(D-j)*l[j][0] + l[j][1]
            cnt += l[j][0]
    if total >= G:
        ans = min(ans,cnt)
        continue
    for j in range(D):
        if (i>>j)&1 == False:
            for k in range(l[j][0]):
                total += 100*(D-j)
                cnt+=1
                if total >= G:
                    ans = min(ans,cnt)
                    break
            break

print(ans)

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


l = l[::-1]

ans = float("inf")
for i in range(2**D):
    total = 0
    cnt = 0
    for j in range(D):
        if (i>>j)&1:
            total += 100*(D-j)*l[j][0] + l[j][1]
            cnt += l[j][0]
    if total >= G:
        ans = min(ans,cnt)
        continue
    for j in range(D):
        if (i>>j)&1 == False:
            for k in range(l[j][0]):
                total += 100*(D-j)
                cnt+=1
                if total >= G:
                    ans = min(ans,cnt)
                    break
            #break

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 main():
	D,G = map(int,input().split())
	ListPC = [list(map(int,input().split())) for d in range(D)]
	ans = sum([i[0] for i in ListPC])

	for i in range(2**D):
		TempPoint,num,restmax = 0,0,-1  
		for j in range(D):  
			if i>>j & 1:
				TempPoint += 100*(j+1)*ListPC[j][0]+ListPC[j][1]
				num += ListPC[j][0]
			else:
				restmax = max(j,restmax)
		if TempPoint >= G: 
			ans = min(num,ans)
		elif G - TempPoint // ((restmax + 1) * 100) <= ListPC[restmax][0]: 
			ans = min(num + (G - TempPoint - 1) // ((restmax + 1) * 100) + 1, ans)
		print(ans)

if __name__ == '__main__':
	main()

def main():
	D,G = map(int,input().split())
	ListPC = [list(map(int,input().split())) for d in range(D)]
	ans = sum([i[0] for i in ListPC])

	for i in range(2**D):
		
		TempPoint,num,restmax = 0,0,-1
		
		for j in range(D):
			if i>>j & 1:
				TempPoint += 100*(j+1)*ListPC[j][0]+ListPC[j][1]
				num += ListPC[j][0]
			else:
				restmax = max(j,restmax)
		
		if TempPoint >= G:
			ans = min(num,ans)
		
		elif (G - TempPoint) // ((restmax + 1) * 100) <= ListPC[restmax][0]:
			ans = min(num + (G - TempPoint - 1) // ((restmax + 1) * 100) + 1, ans)
	print(ans)

if __name__ == '__main__':
	main()

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):
difficulties, goal = map(int, input().split())

pcs = [list(map(int, input().split())) for _ in range(difficulties)]

total_problem = 0
new_dp = [0] * 1001

for d, pc in enumerate(pcs, 1):
    dp = new_dp

    problem, complete = pc
    total_problem += problem

    score = {x: x*100*d for x in range(problem)}
    score[problem] = problem * 100 * d +complete

    for i in range(1, total_problem + 1):
        for j in range(0, i + 1):
            if i - j > problem:
                continue
            else:
                new_dp[i] = max(new_dp[i], dp[d-1][j] + score[i-j])

for i, a in enumerate(new_dp):
    if a >= goal:
        print(i)
        exit()


difficulties, goal = map(int, input().split())

pcs = [list(map(int, input().split())) for _ in range(difficulties)]

total_problem = 0
new_dp = [0] * 1001

for d, pc in enumerate(pcs, 1):
    dp = new_dp[:]

    problem, complete = pc
    total_problem += problem

    score = {x: x*100*d for x in range(problem)}
    score[problem] = problem * 100 * d +complete

    for i in range(1, total_problem + 1):
        for j in range(0, i + 1):
            if i - j > problem:
                continue
            else:
                new_dp[i] = max(new_dp[i], dp[j] + score[i-j])

for i, a in enumerate(new_dp):
    if a >= goal:
        print(i)
        exit()


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 itertools
D, G = [int(_) for _ in input().split()]
SPC = [[100 * (i + 1)] + [int(_) for _ in input().split()] for i in range(D)]
ans = 10000
for flags in itertools.product([0, 1], repeat = D):
    print(flags)
    score = G
    count = 0
    for i in range(D):
        if flags[i]:
            score -= SPC[i][0] * SPC[i][1] + SPC[i][2]
            count += SPC[i][1]
    if score > 0:
        for i in range(D):
            count_res = 100
            if not flags[i] or SPC[i][0] * (SPC[i][1] - 1) < score:
                count_res = min(count_res, score // SPC[i][0] + 1)
        if count_res == 100:
            continue
        else:
            count += count_res
    ans = min(ans, count)
print(ans)

import itertools
D, G = [int(_) for _ in input().split()]
SPC = [[100 * (i + 1)] + [int(_) for _ in input().split()]
       for i in range(D)][::-1]
ans = 10**10
for i in range(D + 1):
    completes = set(itertools.combinations(range(D), i))
    for complete in completes:
        incomplete = sorted(set(range(D)) - set(complete))
        score = 0
        cnt = 0
        f = 0
        for j in complete:
            s, p, c = SPC[j]
            score += s * p + c
            cnt += p
        for j in incomplete:
            if score >= G:
                break
            s, p, c = SPC[j]
            d = min(p - 1, 1 + (G - score - 1) // s)
            score += s * d
            cnt += d
        if score >= G:
            ans = min(ans, cnt)
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()))

L=[0]+[list(map(int, input().split())) for i in range(D)]

def f(G, i):
    l=[]
    a=1000
    if i==0:
        return 1000
    else:
        j=min(G//(i*100), L[i][0])
        g=G-j*i*100            
        if j==L[i][0] and g-L[i][1]>0:
            a=min(a,f(g-L[i][1],i-1)+j)
        elif j==L[i][0] and g-L[i][1]<=0:
            a=min(a,L[i][0])
        elif g>0:
            a=min(f(g,i-1)+j,a)
        elif g<=0:
            a=min(a,j)
        return a
print(f(G,D))

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

L=[0]+[list(map(int, input().split())) for i in range(D)]
 

def f(G, i):
    if i==0:
	    return 10000
    
    n=min(G//(i*100), L[i][0])
    
    s=n*i*100
    
    if n==L[i][0]:
        s+=L[i][1]
	
    if s<G:
        n+=f(G-s, i-1)
    
    return min(n, f(G,i-1))
print(f(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,g=map(int,input().split())
g//=100
l=[]
ans=1000
for i in range(d):
  p,c=map(int,input().split())
  l+=[[p,c,i*p,i*p+c]]
#dp[c][i]
dp=[[0for i in range(d)]for i in range(2**d-1)]
for i in range(2**d-1):
  a=0
  b,c=i,0
  d=0
  while b:
    if b%2>0:
      dp[i]+=l[c][3]
      d+=l[i][0]
    else:
      a=c
    b//=2
    c+=1
  if dp[i]+l[a][2]>=g:
    ans=min(ans,d+(g-dp[i])//a+((g-dp[i])%a))
print(ans)
      


d,g=map(int,input().split())
g//=100
l=[]
ans=1000
for i in range(1,d+1):
  p,c=map(int,input().split())
  c//=100
  l+=[[p,c,i*p,i*p+c]]
for i in range(2**d):
  score=0
  a=0
  b=1
  c=0
  if not i:
    b=d
  while i:
    if i%2>0:
      score+=l[a][3]
      c+=l[a][0]
    else:
      b=a+1
    a+=1
    i//=2
  if score>=g:
    ans=min(ans,c)
  elif score+l[b-1][2]>=g:
    ans=min(ans,c+(g-score)//b+((g-score)%b>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):
rom math import ceil

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):
    cnt = 0
    sum = 0
    remain = set(range(1,D+1))

    for i in range(D):
        if bit & (1 << i):
            cnt += pc[i][0]
            sum += pc[i][0]*(i+1)*100 + pc[i][1]
            remain.discard(i+1)

    if sum < G:
        use = max(remain)
        n = min(pc[use-1][0], ceil((G-sum)/(use*100)))
        """
        if use == 0:
            n = 0
        elif (G - sum)%(use%100) == 0:
            n = min(pc[use-1][0], (G - sum)//(use*100))
        else:
            n = min(pc[use-1][0], (G - sum)//(use*100)+1)
        """
        cnt += n
        sum += n*use*100

    if sum >= G:
        ans = min(ans,cnt)

print(ans)

from math import ceil

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):
    sum = 0
    cnt = 0
    
    nokori = set(range(1, d + 1))
    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0]*100*(i+1) + pc[i][1]
            cnt += pc[i][0]
            nokori.discard(i+1)
    
    if sum < g:
        use = max(nokori)
        husoku = min(ceil((g-sum)/(use*100)),pc[use-1][0])
        cnt += husoku
        sum += husoku*use*100
    
    if sum >= g:
        ans = min(cnt,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):
d, g = map(int, input().split())

pc = []
for i in range(d):
    p, c = map(int, input().split())
    pc.append([(i+1)*100, p, c])
    
pc.reverse()
ans = 0
for i in range(d):
    #print(g, pc[i])
    s = pc[i][0] * pc[i][1] + pc[i][2]
    if g > s:
        ans += pc[i][1]
        g -= s
    else:
        if g > s - pc[i][2]:
            ans += pc[i][1]
            break
        else:
            if g % pc[i][0] == 0:
                ans += g // pc[i][0]
            else:
                ans += g // pc[i][0] + 1

            break

print(ans)




d, g = map(int, input().split())

p = [0] * 10
c = [0] * 10

for i in range(d):
    p[i], c[i] = map(int, input().split())

ans = float("inf")
for mask in range(1<<d):
    s = 0; num = 0; rest_max = -1
    for i in range(d):
        if mask >> i & 1:
            s += 100 * (i+1) * p[i] + c[i]
            num += p[i]
        else:
            rest_max = i

    if s < g:
        s1 = 100 * (rest_max + 1)
        need = (g - s +s1 - 1) // s1
        if need >= p[rest_max]:
            continue

        num += need

    ans = min(ans, num)
     
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):
from itertools import product
D, G = map(int, input().split())
P, C = zip(*[map(int, input().split()) for _ in range(D)])
INF = 10**18
ans = INF
for bit in product((0, 1), repeat=D):
    p = list(P)
    cnt = 0
    score = 0
    for i in range(D):
        if bit[i]:
            score += C[i]
            score += P[i]*100*(i+1)
            cnt += P[i]
            p[i] = 0


        if score+sum(p[i]*100*(i+1) for i in range(D)) < G:
        continue
 
    idx = D-1
    while score < G:
        while not p[idx]:
            idx -= 1
        score += 100*(idx+1)
        p[idx] -= 1
        cnt += 1
    if cnt < ans:
        ans = cnt
print(ans)

from itertools import product
D, G = map(int, input().split())
P, C = zip(*[map(int, input().split()) for _ in range(D)])
INF = 10**18
ans = INF
for bit in product((0, 1), repeat=D):
    p = list(P)
    cnt = 0
    score = 0
    for i in range(D):
        if bit[i]:
            score += C[i]
            score += P[i]*100*(i+1)
            cnt += P[i]
            p[i] = 0
 
    if score+sum(p[i]*100*(i+1) for i in range(D)) < G:
        continue
 
    idx = D-1
    while score < G:
        while not p[idx]:
            idx -= 1
        score += 100*(idx+1)
        p[idx] -= 1
        cnt += 1
    if cnt < ans:
        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):
import sys
import numpy as np

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    d, g = MI()
    data = np.array(sys.stdin.buffer.read().split(), np.int64)
    data = data.reshape(-1, 2)
    p = data[:, 0]
    c = data[:, 1]

    problems = np.zeros(2 ** d, np.int64)
    points = np.zeros(2 ** d, np.int64)
    for i in range(d):
        problems[1 << i : 1 << (i + 1)] = problems[: 1 << i] + p[i]
        points[1 << i : 1 << (i + 1)] = points[: 1 << i] + c[i] + 100 * (i + 1) * p[i]

    for i in range(2 ** d):
        while points[i] < g:
            for j in reversed(range(d)):
                if (i >> j) & 1:
                    continue
                for _ in range(p[j]):
                    if points[i] >= g:
                        break
                    points[i] += 100 * (j + 1)
                    problems[i] += 1

    print(problems.min())


if __name__ == "__main__":
    main()


import sys
import math

input = sys.stdin.readline


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


inf = float("inf")


def main():
    d, g = MI()
    pc = [LI() for _ in range(d)]

    ans = inf
    for bit in range(1 << d):
        c = 0
        score = 0
        for i in range(d):
            if bit & (1 << i):
                c += pc[i][0]
                score += pc[i][0] * 100 * (i + 1) + pc[i][1]

        if score >= g:
            ans = min(ans, c)
        else:
            for i in reversed(range(d)):
                if bit & (1 << i):
                    continue
                res = math.ceil((g - score) / (100 * (i + 1)))
                if res < pc[i][0]:
                    ans = min(ans, c + res)
                break

    print(ans)


if __name__ == "__main__":
    main()


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())

ans = float("inf")
for bit in range(1 << D) :
    A = []
    score = 0
    solved = 0
    for k in range(D) :
        if bit & (1 << k) :
            A.append(k)
            score += 100*(k+1)*P[k] + C[k]
            solved += P[k]
    if score < G :
        for k in range(D-1,-1,-1) :
            if k in A :
                continue
            if G-score > 100*(k+1)*P[k] :
                score += 100*(k+1)*P[k] + C[k]
                solved += P[k]
            else :
                solved += (G-score)//(100*(k+1)*P[k]) + ((G-score)%(100*(k+1)*P[k]) != 0)
                break
    print(solved,A)
    ans = min(ans, solved)
print(ans)

from itertools import *

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

P = [None]*D
C = [None]*D

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

products = product(range(2), repeat=D)

ans = float("inf")

for prod in products :
    prod = list(prod)
    
    A = []
    
    cost = 0
    score = 0
    
    for i in range(len(prod)) :
        if prod[i] == 1 :
            A.append(i)
            cost += P[i]
            score += (i+1)*100*P[i]+C[i]
    
    if score < G :
        for i in range(len(prod)-1,-1,-1) :
            if prod[i] == 1 :
                continue
            
            if score + (i+1)*100*P[i] >= G :
                if G-score < 0 :
                    continue
                cost += (G-score)//((i+1)*100) + ((G-score) % ((i+1)*100) != 0)
                break
            
            else :
                cost += P[i]
                score += (i+1)*100*P[i]+C[i]
    
    ans = min(ans, cost)

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())

for i in range(d):
  pc.append(list(map(int,input().split())))

ans = float("inf")



for i in range(2**d):
    count = 0 
    sum = 0
    nokori = set(range(1, d + 1)) 

    for j in range(d):
        if (i>>j)&1:
            sum += pc[j][0] * (j + 1) * 100 + pc[j][1] 
            count += pc[j][0]
            nokori.discard(j + 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)


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

 
for i in range(2**d):
    count = 0 
    sum = 0
    nokori = set(range(1, d + 1)) 
 
    for j in range(d):
        if (i>>j)&1:
            sum += pc[j][0] * (j + 1) * 100 + pc[j][1] 
            count += pc[j][0]
            nokori.discard(j + 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):
D,G = list(map(int,input().split()))
L=[]
for i in range(D):
    L.append(list(map(int,input().split())))
for i in range(D):
    L[i].append(L[i][0]*(i+1)*100)
    L[i].append(L[i][2]+L[i][1])
print(L)
answer = 10**4
for bits in range(1<<D):
    point_sum = 0
    n = 0
    j = -1
    for i in range(D):
        if bits & 1<<i:
            point_sum += L[i][3]
            n += L[i][0]
        else:
            j = max(j, i)
    if point_sum >= G:
        answer = min(answer, n)
    elif j >=0 and (point_sum+L[j][2])-(j+1)*100 >= G:
        a = G - point_sum
        b = (j+1)*100
        answer = min(answer, n+int((a+b-1)/b))
    else:
        pass
print(answer)


D,G = list(map(int,input().split()))
L=[]
for i in range(D):
    L.append(list(map(int,input().split())))
for i in range(D):
    L[i].append(L[i][0]*(i+1)*100)
    L[i].append(L[i][2]+L[i][1])
answer = 10**4
for bits in range(1<<D):
    point_sum = 0
    n = 0
    j = -1
    for i in range(D):
        if bits & 1<<i:
            point_sum += L[i][3]
            n += L[i][0]
        else:
            j = max(j, i)
    if point_sum >= G:
        answer = min(answer, n)
    elif j >=0 and (point_sum+L[j][2])-(j+1)*100 >= G:
        a = G - point_sum
        b = (j+1)*100
        answer = min(answer, n+int((a+b-1)/b))
    else:
        pass
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):
def rec(i, g, count, rem):
    global ans
    if i == 0:
        print(g, count, rem)
        
        if g < G:
            
            use = max(rem)
            c = min(pc[use-1][0], -(-(G-g) // (use*100)))
            count += c
            g += use*100 * c
            
            
        if g >= G:
            ans = min(ans, count)
            
    else:
        
        rec(i-1, g, count, rem)
        
        rem[i] = 0
        rec(i-1, g+i*100*pc[i-1][0]+pc[i-1][1], count+pc[i-1][0], rem)
        rem[i] = i


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

rem = [i for i in range(D+1)]
ans = float("inf")

rec(D, 0, 0, rem)

print(ans)

def rec(i, g, count, rem):
    global ans
    if i == 0:
        
        if g < G:
            
            use = max(rem)
            c = min(pc[use-1][0], -(-(G-g) // (use*100)))
            count += c
            g += use*100 * c
            
            
        if g >= G:
            ans = min(ans, count)
            
    else:
        
        rec(i-1, g, count, rem)
        
        rem[i] = 0
        rec(i-1, g+i*100*pc[i-1][0]+pc[i-1][1], count+pc[i-1][0], rem)
        rem[i] = i


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

rem = [i for i in range(D+1)]
ans = float("inf")

rec(D, 0, 0, rem)

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):
# -*- coding: utf-8 -*-

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())

ans = 100000

sum = 0
k = 0

for i in range(2 ** d):
    cnt = 0
    sum = 0


    for j in range(d):

        if (i >> j) & 1:
            sum += 100 * p[j] * (j + 1) + c[j]
            cnt += p[j]
    print(i, bin(i), j, cnt, sum)

    if sum >= g and ans > cnt:
        ans = cnt
        continue

    if g > sum:
        # print(ans, cnt, sum)
        ans = cnt
        for j in reversed(range(d)):
            if not (i >> j) & 1:
                k = j
                # print(sum, i, k)
                break

        if g - sum > (100 * (k + 1)) * p[k]:
            continue

        if g - sum <= (100 * (k + 1)) * p[k]:

            ans += (g - sum - 1) // (100 * (k + 1)) + 1

print(ans)



# -*- coding: utf-8 -*-

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())

ans = 100000

sum = 0
k = 0

for i in range(2 ** d):
    cnt = 0
    sum = 0
    k = - 1

    for j in range(d):

        if (i >> j) & 1:
            sum += 100 * p[j] * (j + 1) + c[j]
            cnt += p[j]

        else:
            k = j

    if sum < g:
        s1 = 100 * (k + 1)
        need = (g - sum + s1 - 1) // s1

        if need >= p[k]:
            continue

        cnt += need

    ans = min(ans, cnt)

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

D, G = [int(n) for n in input().split()]

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

score_table = sorted(score_table, key=lambda x:x[0], reverse=True)

score = 0
count = 0
for s, p, c in score_table:
    for i in range(1, p+1):
        score += s
        count += 1
        if i == p:
            score += c
        if score >= G:
            print(count)
            sys.exit(0)

import sys

D, G = [int(n) for n in input().split()]

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

score_table = sorted(score_table, key=lambda x:x[0], reverse=True)

score = 0
count = 0
for s, p, c in score_table:
    for i in range(1, p+1):
        score += s
        count += 1
        if i == p:
            score += c
        if score >= G:
            print(count)
            sys.exit(0)

D, G = [int(n) for n in input().split()]

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

min_count = sum([l[1] for l in score_table])
#print(min_count)

for bit in range(1<<D):
    score = 0
    count = 0

    for i in range(D):
        if bit & (1<<i):
            score += score_table[i][0] * score_table[i][1] + score_table[i][2]
            count += score_table[i][1]
    
    if score >= G:
        min_count = min(min_count, count)
    else:
        additional = []
        for j in range(D):
            if not bit & (1<<j):
                additional.append(score_table[j])
        
        additional_ = sorted(additional, key=lambda x:x[0], reverse=True)
        #print(additional_)
        
        
        #     if i[1] > 1:
        #         add_score = i
        #         break

        #add_score = additional_[0]

        for k in range(additional_[0][1]-1):
            score += additional_[0][0]
            count += 1
            if score >= G:
                min_count = min(min_count, count)

print(min_count)

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):
D, G = map(int, input().split())

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

ans = 0
cnt = 0
flag = False
for i in range(D):
  for j in range(lst[-i-1][0]):
    ans += (D - i) * 100
    if (j == lst[-i-1][0] - 1):
      ans += lst[-i-1][1]
    print(ans)
    cnt += 1
    if (ans >= G):
      flag = True
      break
  if flag:
    break
print(cnt)

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

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

ans = 0
cnt = 0
flag = False
for i in range(D):
  for j in range(lst[-i-1][0]):
    ans += (D - i) * 100
    if (j == lst[-i-1][0] - 1):
      ans += lst[-i-1][1]
    cnt += 1
    if (ans >= G):
      flag = True
      break
  if flag:
    break
print(cnt)

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

lst = [list(map(int, input().split())) for i in range(D)]
ans = []
ref = []
for i,v in enumerate(lst):
	ref.append(v[0]*(i+1)*100 + v[1])
  
for i in range(2 ** D):
	score = 0
	cnt = 0
	for j in range(D):  
		if ((i >> j) & 1):  
			score += ref[j]
			cnt += lst[j][0]
	if (score >= G):
		ans.append(cnt)
	else:
		for l in range(D)[::-1]:
			if ((i >> l) & 1):
				continue
			for _ in range(1,lst[l][0]):
				score += (l+1) * 100
				cnt += 1
                
				if score >= G:
					ans.append(cnt)  
					break
print(min(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):
D, G = (int(i) for i in input().split())  
PC = [[int(i) for i in input().split()] for i in range(D)] 

max_atmpt = G // (D * 100)
total = 0
ans = 0
count = 0
pc_gain_sorted = []
idx_list = []
for i, (p, c) in enumerate(PC):
  pc_gain_sorted.append((p * (i + 1) * 100 + c, i + 1, p))
pc_gain_sorted.reverse()

for gain, idx, _ in pc_gain_sorted:
  if total + gain <= G:
    total += gain
    idx_list.append(idx) # start from 1
    count += PC[idx - 1][0]
    
for gain, idx, p in pc_gain_sorted:
  if idx not in idx_list:
    break

for i in range(10):
  tmp = []
  for j, (p, c) in enumerate(PC):
    if i + 1 
  	tmp.append((j + 1) * 100 * (i + 1)
  

print(ans + count)

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

s = 0
Q = []
for i, (p, c) in enumerate(PC):
    s += p
    Q.append((i+1, p, c))
    
dp = [-10**18]*(s+1)
dp[0] = 0

for i, p, c in Q:
  for j in range(s, -1, -1): 
    for k in range(1, p+1): 
      if k == p:
        cc = 100*i*k + c
      else:
        cc = 100*i*k
      if j - k >= 0:
        dp[j] = max(dp[j], dp[j - k] + cc)

for i, total in enumerate(dp):
  if total >= G:
    print(i)
    break

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())
oe=[]
for i in range(D):
  p,c=map(int,input().split())
  oe.append([(c+p*100*(i+1))/p,p,c,i+1])
oe.sort(reverse=True)
ans=0
co=0
for i in range(D):
  for j in range(oe[i][1]):
    co+=1
    ans+=100*oe[i][3]
    if j==oe[i][1]-1:
      ans+=oe[i][2]
    if G<=ans:
      print(co)
      exit()

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

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


kosupa={}
for i in range(D):
    kosupa[i]=100*(i+1) + c[i]/p[i]

sorted_kosupa=sorted(kosupa.items(),key=lambda x:x[1])

result=[]
sousa=[]
while(1):
    tmp=sorted_kosupa.pop()
    min_num=p[tmp[0]]
    min_ind=tmp[0]
    for i in range(D):
        if(i in sousa):
            continue
        tmp_num=(G-1)//(100*(i+1))+1
        if(tmp_num <= min_num and tmp_num<=p[i]):
            min_num=tmp_num
            min_ind=i
    result.append([min_ind,min_num])
    G-=100*(min_ind+1)*min_num
    if(min_num==p[min_ind]):
        G-=c[min_ind]
    sousa.append(min_ind)
    if(G<=0):
        break

total=0
for k in result:
    total+=k[1]

print(total)

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


kosupa={}
for i in range(D):
    kosupa[i]=100*(i+1) + c[i]/p[i]

sorted_kosupa=sorted(kosupa.items(),key=lambda x:x[1])

result=[]
sousa=[]
while(1):
    tmp=sorted_kosupa.pop()
    min_num=p[tmp[0]]
    min_ind=tmp[0]
    for i in range(D):
        if(i in sousa):
            continue
        tmp_num=(G-1)//(100*(i+1))+1
        if(tmp_num < min_num and tmp_num<=p[i]):
            min_num=tmp_num
            min_ind=i
    result.append([min_ind,min_num])
    G-=100*(min_ind+1)*min_num
    if(min_num==p[min_ind]):
        G-=c[min_ind]
    sousa.append(min_ind)
    if(G<=0):
        break

total=0
for k in result:
    total+=k[1]

print(total)

from math import ceil
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())
_min=101*D

flag=0
while(flag < 2**D):
    
    _G=G
    tmp=0
    max_ind=0
    for i in range(D):
        if(flag & 1<<i):
            _G-=p[i]*(i+1)*100 + c[i]
            tmp+=p[i]
        else:
            max_ind=i
    k=ceil( max([(_G),0]) / (100*(max_ind+1)) )  
    if(k < p[max_ind] or k==0):
        tmp+=k
        _min=min([tmp,_min])
    flag+=1
print(_min) 

Verdicts: Wrong Answer

Wrong Answer

Accepted