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):
INF = float('inf')
d, g = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(d)]
def f(data, score, targets):
  from builtins import min
  from math import ceil
  if score <= 0:
    return 0
  result = INF
  for i in targets:
    t = ceil(score / ((i + 1) * 100))
    if t < data[i][0]:
      result = min(result, t)
  for i in range(len(targets)):
    j = targets[i]
    p, c = data[j]
    t = p + f(data, score - (j + 1) * 100 * p + c, targets[0:i] + targets[i + 1:])
    result = min(result, t)
  return result
print(f(data, g, list(range(len(data)))))


INF = float('inf')
d, g = map(int, input().split())
data = []
calced = set()
for i in range(d):
  p, c = map(int, input().split())
  data.append([p, c, (i + 1) * 100, (i + 1) * 100 * p + c])
def f(data, total, targets):
  if total <= 0:
    return 0
  result = INF
  for i in range(len(targets)):
    p, c, score, subtotal = data[targets[i]]
    t = (total + score - 1) // score
    if t < p and t < result:
      result = t
    nt = tuple(targets[0:i] + targets[i + 1:])
    if nt not in calced:
      calced.add(nt)
      t = p + f(data, total - subtotal, nt)
      if t < result:
        result = t
  calced.add(targets)
  return result
print(f(data, g, tuple(range(len(data)))))


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):
S = list(input())
l = len(S)
if S[0]=="A" and "C" in S[2:l-1]:
  S.remove("A")
  S.remove("C")
  S = "".join(S)
  if S.islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")
  
  

D,G = map(int,input().split())
p,c = [],[]
for i in range(D):
  tmp0 ,tmp1 = map(int,input().split())
  p.append(tmp0)
  c.append(tmp1)
  
min_ans = float('inf')

for bit in range(1<<D):
  dont_solved = [i for i in range(D)]
  ans = 0
  sum_point = 0
  for i in range(D):
    if bit & 1<<i:
      ans += p[i]
      sum_point += (i+1)*100*p[i]+c[i]
      dont_solved.remove(i)
  if sum_point < G:
    for i in  dont_solved[::-1]:
      for j in range(p[i]):
        ans += 1
        sum_point += (i+1)*100
        if sum_point >= G:
          break
      else:
        continue
      break
  
  if ans <= min_ans:
    min_ans = ans
print(min_ans)
  




Verdicts: Wrong Answer

Accepted
Problem: A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode.  A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements:    * Base score: the sum of the scores of all problems solved by the user.   * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).  Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective?

Submission attempts (in order):
import numpy as np

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

PC = []
ans = 10 ** 9

for _ in range(D):
    PC.append(list(map(int, input().split())))

PC = np.array(PC)

for i in range(2 ** D):
    score = 0
    count = 0

    for j in range(D):
        if (i >> j) & 1:

          	score += (j+1) * 100 * PC[j,0] + PC[j,1]
            count += PC[j,0]

    if score >= G:
        ans = min(ans, count)

    if score < G:
      for k in range(D):
            sub_score = 0
            sub_count = 0

            if ~(i >> k) & 1:
                for _ in range(PC[k,0] - 1):
                    sub_score += (k+1) * 100
                    sub_count += 1
                    if sub_score >= (G - score):
                        ans = min(ans, count+sub_count)
                        break


print(ans)

import numpy as np

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

PC = []
ans = 10 ** 9

for _ in range(D):
    PC.append(list(map(int, input().split())))

PC = np.array(PC)

for i in range(2 ** D):
    score = 0
    count = 0

    for j in range(D):
        if (i >> j) & 1:
            score += (j+1) * 100 * PC[j,0] + PC[j,1]
            count += PC[j,0]

    if score >= G:
        ans = min(ans, count)

    if score < G:
      for k in range(D):
            sub_score = 0
            sub_count = 0

            if ~(i >> k) & 1:
                for _ in range(PC[k,0] - 1):
                    sub_score += (k+1) * 100
                    sub_count += 1
                    if sub_score >= (G - score):
                        ans = min(ans, count+sub_count)
                        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):
D, G = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(D)]

for i in range(len(pc)):
    pc[i].append((100 * (i+1) * pc[i][0] + pc[i][1]) / pc[i][0])
    pc[i].append(i+1)

pc = sorted(pc, key=lambda x: x[2], reverse=True)

ans = 0
del_list = []
for i, info in enumerate(pc):
    if (100 * info[3] * info[0] + info[1]) <= G:
        G -= (100 * info[3] * info[0] + info[1])
        ans += info[0]
        del_list.append(i)
    else:
        break

pc = [info for i, info in enumerate(pc) if i not in del_list]

pc = sorted(pc, key=lambda x: x[3], reverse=True)

while G > 0:
    G -= 100 * pc[0][3]
    pc[0][0] -= 1
    ans += 1
    if pc[0][0] == 0:
        G -= pc[0][1]
        pc.pop(0)

print(ans)

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

ans = sum([i[0] for i in pc])

for i in range(2**D):
    search_index = format(i, '0' + str(D) + 'b')
    complete_answered = [i for i, c in enumerate(search_index[::-1]) if c == '1']
    incomplete_answered = list(set(range(D)) - set(complete_answered))
    answered_number = 0
    remaining_score = G
    for j in complete_answered:
        answered_number += pc[j][0]
        remaining_score -= (100 * (j + 1) * pc[j][0] + pc[j][1])
    incomplete_answered = sorted(incomplete_answered, reverse=True)
    for j in incomplete_answered:
        question_number = pc[j][0]
        while remaining_score > 0:
            answered_number += 1
            remaining_score -= 100 * (j + 1)
            question_number -= 1
            if question_number <= 0:
                remaining_score -= pc[j][1]
                break
    if answered_number < ans:
       ans = answered_number
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode.  A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements:    * Base score: the sum of the scores of all problems solved by the user.   * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).  Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective?

Submission attempts (in order):
def main():
    D, G = map(int, input().split())
    pc = []
    for i in range(D):
        p, c = map(int, input().split())
        w = 100 * (i + 1)
        y = w * p + c
        z = y / p
        pc.append((p, w, y, z))
    pc = sorted(pc, key=lambda x: x[3], reverse=True)
    ans = 0
    for p, w, y, z in pc:
        if G >= y:
            G -= y
            ans += p
        else:
            for _ in range(p):
                if G == 0:
                    print(ans)
                    exit()
                G -= w
                ans += 1


main()


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


def f(d, g):
    if 0 > d:
        return 100 ** 10
    n = min(g // (100 * (d + 1)), PC[d][0])
    s = n * 100 * (d + 1)
    if n == PC[d][0]:
        s += PC[d][1]
    if g > s:
        n += f(d - 1, g - s)
    return min(n, f(d - 1, g))


def main():
    print(f(D - 1, G))


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):
import itertools
from collections import Counter
D, G = map(int, input().split())
P = [list(map(int, input().split())) for i in range(D)]
min_num = 10**8

judge_list = list(itertools.product([0, 1, 2], repeat=D)) 


for judge in judge_list:
    score = 0
    num = 0
    d = Counter() 
    d.update(judge)
    print(d)
    if (d[0] <= 1):
        for i in range(1, len(judge) + 1):
            if score >= G:
                break

            if judge[-i] == 1:
                pass

            if judge[-i] == 2:
                score += P[-i][0] * (D - i + 1) * 100 + P[-i][1]
                num += P[-i][0]

            if (judge[-i] == 0):
                for j in range(P[-i][0]):
                    if score >= G:
                        break
                    score += 100 * (D - i + 1)
                    num += 1

        if score >= G:
            min_num = min(num, min_num)

print(min_num)

d,g=map(int,input().split())
PC=[list(map(int,input().split())) for i in range(d)]
P=list(map(lambda x:x[0],PC))
C=list(map(lambda x:x[1],PC))
ans=10**9
def dfs(cur,target):
  if cur==0:
    return 10**9
  cnt=min(target//(cur*100),P[cur-1]) 
  tmp=(100*cur)*cnt
  if cnt==P[cur-1]:
    tmp+=C[cur-1]
  if tmp<target:
    cnt+=dfs(cur-1,target-tmp)       
  return min(cnt,dfs(cur-1,target))
print(dfs(d,g))

Verdicts: Wrong Answer

Accepted
Problem: A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode.  A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements:    * Base score: the sum of the scores of all problems solved by the user.   * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).  Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective?

Submission attempts (in order):
d, g = map(int, input().split())
o, c = zip(*[map(int, input().split()) for _ in range(d)])

comp = [(i+1)*o[i]+c[i]//100 for i in range(d)]
print(o, c)
print(comp)

G = g//100


ans = sum(o)

for j in range(2**d):
    tmp = bin(j)
    ope = tmp[2:len(tmp)].zfill(d)

    now = 0  
    f = 1
    num = 0  
    re = [[0, 0]]  

    for i in range(d):
        if ope[i] == '1':
            now += comp[i]
            num += o[i]
        else:
            re.append([(i+1)*(o[i]-1), i+1])

        re.sort()
        re.reverse()

    if now < G:
        if now+re[0][0] < G:
            
            now = sum(p)
            f = -1
        else:
            
            K = (G - now)//re[0][1]

            
            if (G % re[0][1] > 0):
                K = K+1
            num += K
    if num < ans and f > 0:
        ans = num
print(ans)


d, g = map(int, input().split())
o, c = zip(*[map(int, input().split()) for _ in range(d)])

comp = [(i+1)*o[i]+c[i]//100 for i in range(d)]

G = g//100


ans = sum(o)

for j in range(2**d):
    tmp = bin(j)
    ope = tmp[2:len(tmp)].zfill(d)

    now = 0  
    f = 1
    num = 0  
    re = [[0, 0]]  

    for i in range(d):
        if ope[i] == '1':
            now += comp[i]
            num += o[i]
        else:
            re.append([(i+1)*(o[i]-1), i+1])

        re.sort()
        re.reverse()

    if now < G:
        if now+re[0][0] < G:
            
            now = sum(o)
            f = -1
        else:
            
            K = (G - now)//re[0][1]

            
            if ((G-now) % re[0][1] > 0):
                K = K+1
            num += K
    if num < ans and f > 0:
        ans = num
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()))
t = [[0,0]]
for i in range(D):
    t.append(list(map(int,input().split())))
def down(i,j,ans,wa):
    if wa >= G:
        return ans
        exit()
    else:
        if i == 0:
            for k in range(1,D+1):
                down(k,1,ans+1,wa+100*i)
        elif j < t[i][0]-1:
            down(i,j+1,ans+1,wa+100*i)
        elif j == t[i][0]-1:
            down(i,t[i][0],ans+1,wa+100*i+t[i][1])
        elif j == t[i]:
            if 1 < i :
                down(i-1,1,ans+1,wa+100*(i-1))
def up(i,j,ans,wa):
    if wa >= G:
        return ans
        exit()
    else:
        if i == 0:
            for k in range(1,D+1):
                up(k,1,ans+1,wa+100*i)
        elif j < t[i][0]-1:
            up(i,j+1,ans+1,wa+100*i)
        elif j == t[i][0]-1:
            up(i,t[i][0],ans+1,wa+100*i+t[i][1])
        elif j == t[i]:
            if i < D :
                up(i+1,1,ans+1,wa+100*(i+1))

print(up(0,0,0,0))

#ABC104C - All Green
import math
def dfs(i,s,c,r):
    global ans
    if i == d:
        if s < g:
            use = max(r)
            n = min(pc[use -1][0], math.ceil((g-s)/(use*100)))
            c += n
            s += n*use*100
        if s >= g:
            ans = min(ans,c)
            print(c)
    
    else:
        dfs(i+1, s, c, r)
        dfs(i+1, s+ pc[i][0]*(i+1)*100+pc[i][1],c+pc[i][0],r-{i+1})
        
d,g = list(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)

#ABC104C - All Green
import math
def dfs(i,s,c,r):
    global ans
    if i == d:
        if s < g:
            use = max(r)
            n = min(pc[use -1][0], math.ceil((g-s)/(use*100)))
            c += n
            s += n*use*100
        if s >= g:
            ans = min(ans,c)
    
    else:
        dfs(i+1, s, c, r)
        dfs(i+1, s+ pc[i][0]*(i+1)*100+pc[i][1],c+pc[i][0],r-{i+1})
        
d,g = list(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: 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 itertools

def solve(D, G, problems):
    bit_list = list(itertools.product([0, 1], repeat=D))
    
    result_count = 10 ** 8
    for pattern in bit_list:
        scores = 0 
        count = 0  
        for i in range(D):
            if pattern[i] == 1: 
                scores += problems[i][0] * (i+1) * 100 + problems[i][1]  
                count += problems[i][0]
            
            else:
                max_score_problem = i + 1
    
        
        if G > scores:
            count += (G - scores) // (max_score_problem * 100)
            if  (G - scores) % (max_score_problem * 100) != 0:
                count += 1
                
        result_count = min(result_count, count)
            
        print(result_count)
    

if __name__ == '__main__':
    D, G = map(int, input().split())
    problems = [list(map(int, input().split())) for _ in range(D)]
    solve(D, G, problems)

import itertools

def solve(D, G, problems):
    bit_list = list(itertools.product([0, 1], repeat=D))
    
    result_count = 10 ** 8
    for pattern in bit_list:
        score = 0 
        count = 0  
        for i in range(D):
            if pattern[i] == 1: 
                score += problems[i][0] * (i+1) * 100 + problems[i][1]  
                count += problems[i][0]
            
            else:
                max_score_problem = i
    
        
        if score < G:
            for i in range(problems[max_score_problem][0]):
                count += 1
                score += (max_score_problem + 1) * 100
                if score >= G:
                    break
        
        if score >= G:
            result_count = min(result_count, count)
            
    print(result_count)
    

if __name__ == '__main__':
    D, G = map(int, input().split())
    problems = [list(map(int, input().split())) for _ in range(D)]
    solve(D, G, problems)

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 resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = 100**6
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d-1, -1, -1):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g and ans > solved:
				ans = solved
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g and ans > solved:
			ans = solved
			break
		for j in range(1 << d):
			done = False
			t_solved = solved
			t_total = total
			for k in range(d-1, -1, -1):
				if (j >> k) & 1:
					if i == k:
						continue
					if done:
						break
					for _ in range(ps[k]):
						if done:
							break
						if t_total >= g and ans > t_solved:
							ans = t_solved
							done = True
							continue
						t_total += 100 * (k+1)
						t_solved += 1
					t_total += cs[k]
resolve()

def resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = 100**6
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d-1, -1, -1):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g and ans > solved:
				ans = solved
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g and ans > solved:
			ans = solved
			break
		for j in range(1 << d):
			done = False
			t_solved = solved
			t_total = total
			for k in range(d-1, -1, -1):
				if (j >> k) & 1:
					if i == k:
						continue
					if done:
						break
					for _ in range(ps[k]):
						if done:
							break
						if t_total >= g and ans > t_solved:
							ans = t_solved
							done = True
							continue
						t_total += 100 * (k+1)
						t_solved += 1
					t_total += cs[k]
					if t_total >= g and ans > t_solved:
						ans = t_solved
	print(ans)
resolve()

Verdicts: Wrong Answer

Accepted
Problem: A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode.  A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements:    * Base score: the sum of the scores of all problems solved by the user.   * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).  Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective?

Submission attempts (in order):
D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)

ans = 1e9
for mask in range(2**D - 1):
  score = 0
  num = 0
  rest_max = -1

  for i in range(D):
    if (mask >> i) & 1:
      score += 100 * (i+1) * P[i] + C[i]
      num += P[i]
    else:
      rest_max = i

  #print('mask {}, score {}, num {}, rest_max {}'.format(format(mask, '010b'), score, num, rest_max))

  if score < G:
    scr1 = 100 * (rest_max + 1)
    need = (G - score + scr1 - 1) // scr1
    if need >= P[rest_max]:
      #print('fault')
      continue
    num += need
    
  else:
    

  ans = min(ans, num)

print(ans)

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

ans = 1e9
for mask in range(2**D):
  score = 0
  num = 0
  rest_max = -1

  for i in range(D):
    if (mask >> i) & 1:
      score += 100 * (i+1) * P[i] + C[i]
      num += P[i]
    else:
      rest_max = i

  if score < G:
    scr1 = 100 * (rest_max + 1)
    need = (G - score + scr1 - 1) // scr1
    if need >= P[rest_max]:
      continue
    num += need

  ans = min(ans, num)

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_list = []
c_list = []
for i in range(D):
    p, c = map(int, input().split())
    p_list.append(p)
    c_list.append(c)

fi = 0
co = 0
result1=0
for i in range(D-1, -1, -1):
    if fi >= G:
        break
    p = p_list[i]
    while p > 0:
        p -= 1
        fi += 100 * (i+1)
        result1 +=1
        if p==0:
            fi += c_list[i]
        if fi >= G:
            break
print(result1)

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

p_list = []
c_list = []
for i in range(D):
    p, c = map(int, input().split())
    p_list.append(p)
    c_list.append(c)

fi = 0
co = 0
result1=0
for i in range(D-1, -1, -1):
    if fi >= G:
        break
    p = p_list[i]
    while p > 0:
        p -= 1
        fi += 100 * (i+1)
        result1 +=1
        if p==0:
            fi += c_list[i]
        if fi >= G:
            break

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

p_list = []
c_list = []
for i in range(D):
    p, c = map(int, input().split())
    p_list.append(p)
    c_list.append(c)

fi = 0
co = 0
result1=0
for i in range(D-1, -1, -1):
    if fi >= G:
        break
    p = p_list[i]
    while p > 0:
        p -= 1
        fi += 100 * (i+1)
        print(fi)
        result1 +=1
        if p==0:
            fi += c_list[i]
        if fi >= G:
            break

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

ans = float("inf")
for i in range(2 ** D):
    bit = bin(i)[2:].zfill(D)
    sum_num = 0
    cnt = 0
    used = set()
    for j in range(D):
        b = bit[j]
        if b == "1":
            used.add(j)
            cnt += items[j][0]
            sum_num += 100 * (j + 1) * items[j][0] + items[j][1]
    if sum_num >= G:
        ans = min(ans, cnt)
    else:
        for p, c, j in reversed(items):
            if j in used:
                continue
            for a in range(p - 1):
                sum_num += 100 * (j + 1)
                cnt += 1
                if sum_num >= G:
                    break
            if sum_num >= G:
                ans = min(ans, cnt)
                break
print(ans)


Verdicts: Wrong Answer

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

d, g = map(int, input().split())
memo = {}
points, bonus = [], []
for _ in range(d):
    p, c = map(int, input().split())
    points.append(p)
    bonus.append(c)


def f(c, p):
    if (c, p) in memo:
        return memo[(c, p)]
    if p >= g:
        return c
    ret = 10 ** 10
    for i in range(d):
        if points[i] == 1:
            points[i] = 0
            ret = min(ret, f(c + 1, p + (i + 1) * 100 + bonus[i]))
            points[i] = 1
        elif points[i] > 1:
            points[i] -= 1
            ret = min(ret, f(c + 1, p + (i + 1) * 100))
            points[i] += 1
        else:
            continue
    memo[(c, p)] = ret
    return ret


print(f(0, 0))




d, g = map(int, input().split())
points = []
for _ in range(d):
    p, c = map(int, input().split())
    points.append((p, c))
ans = 10**12
for bit in range(2**d):
    arr = [False] * d
    for i in range(d):
        if bit >> i & 1 == 1:
            arr[i] = True
    tmp_sum = 0
    count = 0
    for i in range(d):
        if arr[i]:
            # kompuli-to
            tmp_sum += points[i][1]
            tmp_sum += (i + 1) * 100 * points[i][0]
            count += points[i][0]
    if tmp_sum < g:
        
        for i in range(d - 1, -1, -1):
            if arr[i]:
                
                continue
            used = 0
            for j in range(points[i][0]):
                if tmp_sum < g:
                    tmp_sum += (i + 1) * 100
                    count += 1
                    used += 1
            if used == points[i][0]:
                tmp_sum += points[i][1]
            if tmp_sum >= g:
                break
    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):
abcd=list(input())
for i in range(2**3):
    if i//4==0:
        op1="+"
    else:
        op1="-"
    i=i%4
    if i//2==0:
        op2="+"
    else:
        op2="-"
    i=i%2
    if i==0:
        op3="+"
    else:
        op3="-"
    siki=abcd[0]+op1+abcd[1]+op2+abcd[2]+op3+abcd[3]
    if eval(siki)==7:
        siki+="=7"
        break
print(siki)


[d,g]=list(map(int,input().split()))
pc=[]
for i in range(d):
    kari=list(map(int,input().split()))
    pc.append(kari)
gokei=[]
for i in range(d):
    gokei.append(100*(i+1)*pc[i][0]+pc[i][1])

kosumin=10000
for i in range(1<<d):
    score=0
    kosu=0
    jmax=0
    siyouzumi=[]
    for j in range(d):
        if ((i>>j)&1)==1:
            score+=gokei[j]
            kosu+=pc[j][0]
            siyouzumi.append(j)

    if score>=g:
        if kosumin>kosu:
            kosumin=kosu
    if score<g:
        a=d-1
        while True:
            if a==-1:
                break
            if not a in siyouzumi:
                saidai=a
                break
            a-=1
        if a==-1:
            continue

        for k in range(pc[saidai][0]):
            score+=(saidai+1)*100
            kosu+=1
            if k==pc[saidai][0]-1:
                score+=pc[saidai][1]
            if score>=g:
                break
        if score>=g and kosumin>kosu:
            kosumin=kosu
print(kosumin)
                




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


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


ans = float('inf')

dfs(0, 0, 0, set(range(1, D+1)))
print(ans)


import itertools
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
bit = itertools.product([0, 1], repeat=D)
ans = 1000
for bi in bit:
    cnt = 0
    score = 0
    nokori = []
    for i in range(D):
        if bi[i] == 0:
            nokori.append([pc[i][0], (i+1)*100])
            continue
        score += pc[i][1] + 100*(i+1)*(pc[i][0])
        cnt += pc[i][0]
    if score >= G:
        ans = min(ans, cnt)
    else:
        for num, point in reversed(nokori):
            for j in range(1, num):
                cnt += 1
                score += point
                if score >= G:
                    ans = min(ans, cnt)
                    break
            else:
                continue
            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):
D,G=map(int,input().split())
p=[]
c=[]
avg=[]
for i in range(D):
  p1,c1=map(int,input().split())
  p.append(p1)
  c.append(c1)
  avg.append((p1*(i+1)*100+c1)/p1)
ans=sum(p)
for i in range(2**D):
  num=0
  point=0
  sit=[0]*D
  for j in range(D):
    if(i>>j&1):
      num+=p[j]
      sit[j]+=p[j]
      point+=(j+1)*100*p[j]+c[j]
  if(point<G):
    sitt=sit[::-1]
    loc=D-1-sitt.index(0)
    k=0
    while(point<G):
      num+=1
      k+=1
      point+=(loc+1)*100
    if(k<p[loc]):
      ans=min(ans,num)
  #print(loc)
print(ans)

D,G=map(int,input().split())
p=[]
c=[]
for i in range(D):
  p1,c1=map(int,input().split())
  p.append(p1)
  c.append(c1)
ans=sum(p)
for i in range(2**D):
  num=0
  point=0
  flag=[0]*D
  for j in range(D):
    if(i>>j&1):
      num+=p[j]
      flag[j]=1
      point+=(j+1)*100*p[j]+c[j]
  if(point<G):
    sitt=flag[::-1]
    loc=D-1-sitt.index(0)
    k=0
    while(point<G):
      num+=1
      k+=1
      point+=(loc+1)*100
    if(k<p[loc]):
      ans=min(ans,num)
  else:
    ans=min(ans,num)
  #print(loc)
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
input = sys.stdin.readline

def ceil(a, b):
    if a%b == 0:
        return a//b
    else:
        return a//b + 1

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

    ans = int(1e9)
    for i in range(2**D):
        tmp = 0
        rest = []
        count = 0
        for j in range(D):
            if i&1:
                tmp += (j+1)*100 * pc[j][0] + pc[j][1]
                count += pc[j][0]
            else:
                rest.append(((j+1)*100, pc[j][0]))
            i >>= 1
        rest = sorted(rest, reverse=True)
        rest_point = G - tmp
        if rest_point < 0:
            continue
        tmp = ceil(rest_point, rest[0][0])
        if tmp <= rest[0][1]:
            ans = min(ans, count + tmp)
            # print(rest_point, count, tmp)
    print(ans)

if __name__ == "__main__":
    main()


import sys
input = sys.stdin.readline

def ceil(a, b):
    if a%b == 0:
        return a//b
    else:
        return (a//b) + 1

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

    ans = int(1e9)
    for i in range(2**D):
        score = 0
        count = 0
        check = [False] * D
        for j in range(D):
            p, c = pc[j]
            if i&1:
                score += 100 * (j+1) * p + c
                count += p
                check[j] = True
            i >>= 1
        if score < G:
            for j in range(D):
                if not check[D-1-j]:
                    check[D-1-j] = True
                    p, c = pc[D-1-j]
                    tmp = ceil(G - score, (D-j) * 100)
                    if tmp < p:
                        count += tmp
                        score += tmp * (D-j) * 100
                    break
        if score >= G:
            
            ans = min(ans, count)
    
    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())
pc = [list(map(int,input().split())) for i in range(D)]

ans = float("inf")
for i in range(2**D):
    sum = 0
    count = 0
    rem = set(range(1,D+1))
    for j in range(D):
        if (i >> j) & 1:
            sum += pc[j][0]*100*j+pc[j][1]
            count += pc[j][0]
            rem.discard(j+1)
    if sum < G:
        k = max(rem)-1
        n = min(pc[k][0],-(-(G-sum)//((k+1)*100))
        count += n
        sum += n*100*(k+1)
    if sum >= G:
        ans = min(ans,count)

print(ans)
        


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

print(pc)
ans = float("inf")

for i in range(2**D):
    sum = 0
    count = 0
    rem = set(range(1,D+1))
    for j in range(D):
        if (i >> j) & 1:
            sum += pc[j][0]*100*(j+1)+pc[j][1]
            count += pc[j][0]
            rem.discard(j+1)
    if sum < G:
        k = max(rem)-1
        n = min(pc[k][0],-(-(G-sum)//((k+1)*100)))
        count += n
        sum += n*100*(k+1)
    if sum >= G:
        ans = min(ans,count)

print(ans)


def dfs (i,sum,count,rem):
    global ans
    if i == D:
        if sum < G:
            k = max(rem)
            n = min(pc[k-1][0],-(-(G-sum)//(k*100)))
            count += n
            sum += n*100*k
        if sum >= G:
            ans = min(ans,count)
    else:
        dfs(i+1,sum,count,rem)
        dfs(i+1,sum+pc[i][0]*100*(i+1)+pc[i][1],count+pc[i][0],rem-{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

Wrong Answer

Accepted
Problem: A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode.  A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements:    * Base score: the sum of the scores of all problems solved by the user.   * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).  Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective?

Submission attempts (in order):
D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)
ans = 10*100
for i in range(2**D):
  rest = G
  cnt = 0
  maxdgt = -1
  for j in range(D):
    if bin(i)>>j & 1:
      rest -= P[i]*(i+1)*100+C[i]
      cnt += P[i]
    else:
      maxdgt = j
  if rest <= 0:
    ans = min(ans, cnt)
  else if rest > (P[maxdgt]-1)*(maxdgt+1)*100:
    continue
  else:
    ans = min(ans, cnt+(rest/100-1)//P[maxdgt]+1)
print(ans)

D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)
ans = 10*100
for i in range(2**D):
  rest = G
  cnt = 0
  maxdgt = -1
  for j in range(D):
    if i & 1<<j:
      rest -= P[j]*(j+1)*100+C[j]
      cnt += P[j]
    else:
      maxdgt = j
  if rest <= 0:
    ans = min(ans, cnt)
  elif rest > (P[maxdgt]-1)*(maxdgt+1)*100:
    continue
  else:
    ans = min(ans, cnt+(rest/100-1)//(maxdgt+1)+1)
print(int(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):
n, s = map(int, input().split())
data = []
for i in range(1,n+1):
    k, v = map(int, input().split())
    for j in range(1,k+1):
        if j<k:
            data.append([j,j*i*100])
        else:
            data.append([j,j*i*100+v])
m = len(data)
kekka = {}
for i in range(2 ** m):
    bag = []
    prob = []
   
    for j in range(m):  
        if ((i >> j) & 1):  
            bag.append(data[j][1]) 
            prob.append(data[j][0])
    if sum(bag) >= s:
        kekka[sum(prob)] = sum(bag)
min(kekka.items(), key = lambda x:x[1])[0]               

D,G=map(int,input().split())
 
pc=[list(map(int,input().split())) for i in range(D)]
 
ans=float('inf')
 
for i in range(1<<D):
    s=0
    c=0
    for k in range(D):
        if 1&i>>k:
            s+=(k+1)*100*pc[k][0]+pc[k][1]
            c+=pc[k][0]
 
    if s>=G:
        ans=min(ans,c)
 
    if s<G:
        for k in reversed(range(D)):
            if not(1&i>>k):
                ac=-(-(G-s)//((k+1)*100))
                if  pc[k][0]>ac:
                    ans=min(ans,c+ac)
                    break
print(ans)

Verdicts: Wrong Answer

Accepted