TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:    * The initial character of S is an uppercase `A`.   * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).   * All letters except the `A` and `C` mentioned above are lowercase.

Submission attempts (in order):
S = input()
CS = S[2:-1]
print(CS)
if S[0] == 'A':
  S = S.lstrip('A')
  if CS.count('C') == 1:
    S = S.replace('C', '')
    if S.islower() == True:
      print('AC')
    else:
      print('WA')
  else:
    print('WA')
else:
  print('WA')

S = input()
CS = S[2:-1]
if S[0] == 'A':
  S = S.lstrip('A')
  if CS.count('C') == 1:
    S = S.replace('C', '')
    if S.islower() == True:
      print('AC')
    else:
      print('WA')
  else:
    print('WA')
else:
  print('WA')

Verdicts: Wrong Answer

Accepted
Problem: You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:    * The initial character of S is an uppercase `A`.   * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (inclusive).   * All letters except the `A` and `C` mentioned above are lowercase.

Submission attempts (in order):
import sys

s = input()
if s[0] == "A" and s.count("C") == 1 and "C" in s[2:-1]:
    ss = set(s)
    ss.remove("A")
    ss.remove("C")
    SS = [i.upper() for i in ss]
    if len(ss & SS) == 0:
        print("AC")
        sys.exit()

print("WA")

s = input()

print("AC" if s[0] == "A" and "C" in s[2:-1] and s[1:].replace("C","",1).islower() else "WA")


Verdicts: Runtime Error

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

Submission attempts (in order):
from itertools import combinations

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

A = []
B = {i for i in range(D)}
for i in range(D+1):
    A += list(combinations(B, i))

print(A)

ans = []
for ai in A:
    p = 0  
    c = 0  
    for aii in ai:
        p += PC[aii][2]
        c += PC[aii][0]
    if p < G:
        x = B.difference(ai)
        max_x = max(x)
        cnt = 0
        while p < G and cnt < PC[max_x][0]:
            p += (max_x + 1) * 100
            cnt += 1
            c += 1
        if p >= G:
            # ans.append([p, c])
            ans.append(c)
    else:
        # ans.append([p, c])
        ans.append(c)

print(min(ans))

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

P = []
for i in range(2 ** D):
    b = format(i, 'b').zfill(D)
    P.append(b)

def get_high_score_q(p):
    if p.count('0') == 0:
        return None
    else:
        pos = []
        for i, pi in enumerate(p):
            if pi == '0':
                pos.append(i)
        return pos[-1]

ans = 10 ** 10
# P: ['00', '01', '10', '11']
for pi in P:
    # print('pi', pi)
    scores = 0
    probs = 0
    for i, b in enumerate(pi):
        if b == '0':
            pass
        elif b == '1':
            pc = PC[i]
            scores += pc[0] * pc[2] + pc[1]
            probs += pc[0]
        else:
            raise Exception()

    
    if scores < G:
        q = get_high_score_q(pi)
        pc = PC[q]
        for i in range(pc[0]):
            scores += pc[2]
            probs += 1
            if scores >= G:
                break
    
    if scores >= G:
        ans = min(ans, probs)

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=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
def dfs(x,num,cost):
  if x==len(l):
    return 10**18
  num1+=l[x][0]*100*(x+1)+l[x][1]
  cost1+=l[x][0]
  cost3=dfs(x+1,num1,cost1)
  num2=num
  cost2=cost
  cost4=dfs(x+1,num2,cost2)
  for i in range(len(n),0,-1):
    if (g-num1+i*100-1)//(i*100)<=l[x][0]:
      cost1+=(g-num1+i*100-1)//(i*100)
      break
  for i in range(len(n),0,-1):
    if (g-num2+i*100-1)//(i*100)<=l[x][0]:
      cost2+=(g-num+i*100-1)//(i*100)
      break
  cost=min(cost1,cost2,cost3,cost4)
  return cost
print(0,0,0)

import sys
d,g=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
def dfs(x,num,cost,flag):
  if x==len(l):
    return 10**18
  num1=num+l[x][0]*100*(x+1)+l[x][1]
  cost1=cost+l[x][0]
  flag1=flag|(2**x)
  cost3=dfs(x+1,num1,cost1,flag1)
  num2=num
  cost2=cost
  flag2=flag
  cost4=dfs(x+1,num2,cost2,flag2)
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag1>0:
      continue
    if num1>=g:
      break
    if (g-num1+i*100-1)//(i*100)<l[i-1][0]:
      cost1+=(g-num1+i*100-1)//(i*100)
      num1+=((g-num1+i*100-1)//(i*100))*100*i
      break
    else:
      num1+=l[i-1][0]*100*i+l[i-1][1]
      cost1+=l[i-1][0]
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag2>0:
      continue
    if num2>=g:
      break
    if (g-num2+(i*100)-1)//(i*100)<l[i-1][0]:
      cost2+=(g-num2+(i*100)-1)//(i*100)
      num2+=((g-num2+(i*100)-1)//(i*100))*100*i
      break
    else:
      num2+=l[i-1][0]*100*i+l[i-1][1]
      cost2+=l[i-1][0]
  if num1<g:
    cost1=10**18
  if num2<g:
    cost2=10**18
  cost=min(cost1,cost2,cost3,cost4)
  return cost
print(dfs(0,0,0,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):
import itertools
import math

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

ls = []
for i in itertools.product([0, 1], repeat=D):
    sum = 0
    ans = 0
    for j, x in enumerate(i):
        if x == 1:
            sum += c[j] + (100*(j+1))*p[j]
            ans += p[j]
    if sum >= G:
        ls.append(ans)
    else:
        for j, x in enumerate(i[::-1]):
            if x != 1:
                if math.ceil((G-sum)/(100*(D-j))) <= p[D-1-j] - 1:
                    ans += math.ceil((G-sum)/(100*(D-j)))
                    ls.append(ans)
                    break
                else:
                    sum += (100*(D-j))*(p[D-1-j] - 1)
                    ans += p[D-1-j] - 1
print(ls)


import itertools
import math

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

ls = []
for i in itertools.product([0, 1], repeat=D):
    sum = 0
    ans = 0
    for j, x in enumerate(i):
        if x == 1:
            sum += c[j] + (100*(j+1))*p[j]
            ans += p[j]
    if sum >= G:
        ls.append(ans)
    else:
        for j, x in enumerate(i[::-1]):
            if x != 1:
                if math.ceil((G-sum)/(100*(D-j))) <= p[D-1-j] - 1:
                    ans += math.ceil((G-sum)/(100*(D-j)))
                    ls.append(ans)
                    break
                else:
                    sum += (100*(D-j))*(p[D-1-j] - 1)
                    ans += p[D-1-j] - 1
print(min(ls))


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):
_lst = input().split()
d = int(_lst[0])
g = int(_lst[1])

pc = list()

for i in range(d):
    _lst = input().split()
    pc.append((int(_lst[0]), int(_lst[1])))

score = 0
result_count = 0
tmp = 0


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

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

    
    if score > g:
        if result_count >= count or result_count == 0:
            result_count = count
        continue

    not_reach = True
    for j in range(d-1, -1, -1):
        if not (i >> j & 1):  
            if (g - score) // ((j + 1) * 100) < pc[j][0]:  
                count -= (score - g) // ((j + 1) * 100)  
                not_reach = False

    
    if not_reach or count == 0:
        continue

    if result_count >= count or result_count == 0:
        result_count = count

print(result_count)


_lst = input().split()
d = int(_lst[0])
g = int(_lst[1])

pc = list()

for i in range(d):
    _lst = input().split()
    pc.append((int(_lst[0]), int(_lst[1])))

score = 0
result_count = -1


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

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

    
    if score >= g:
        if result_count >= count or result_count == -1:
            result_count = count
        continue

    not_reach = True
    for j in range(d-1, -1, -1):
        if not (i >> j & 1):  
            if -((score - g) // ((j + 1) * 100)) < pc[j][0]:  
                count -= (score - g) // ((j + 1) * 100)  
                not_reach = False
                break

    
    if not_reach:
        continue

    if result_count >= count or result_count == -1:
        result_count = count

print(result_count)


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())
ary = [list(map(int,input().split())) for _ in range(d)]
s = set(i for i in range(d))
ans = float("Inf")
for i in range(2**d):
    a = []
    total,count = 0,0
    for j in range(d):
        if i >> j & 1:
            a.append(j)
    for x in a:
        total += 100*(x+1)*ary[x][0]+ary[x][1]
        count += ary[x][0]
    for y in sorted(s - set(a),reverse=True):
        if total + 100*(y+1)*(ary[y][0]-1) >= g:
            count += -(-(g-total) // (100*(y+1)))
            ans = min(ans,count)
            break
        total += 100*(y+1)*(ary[y][0]-1)
        count += ary[y][0]-1
    if total >= g:
        ans = min(ans,count)
print(ans)

d,g = map(int,input().split())
ary = [list(map(int,input().split())) for _ in range(d)]
s = set(i for i in range(d))
ans = float("Inf")
for i in range(2**d):
    a = []
    total,count = 0,0
    for j in range(d):
        if i >> j & 1:
            a.append(j)
    for x in a:
        total += 100*(x+1)*ary[x][0]+ary[x][1]
        count += ary[x][0]
    if total >= g:
        ans = min(ans,count)
        continue
    for y in sorted(s - set(a),reverse=True):
        if total + 100*(y+1)*(ary[y][0]-1) >= g:
            count += -(-(g-total) // (100*(y+1)))
            ans = min(ans,count)
            break
        total += 100*(y+1)*(ary[y][0]-1)
        count += ary[y][0]-1
    if total >= g:
        ans = min(ans,count)
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 = [list(map(int, input().split())) for _ in range(d)]

    n = len(pc)
    ans = float("inf")

    for i in range(2**n):
        point, cnt = 0, 0
        for j in range(n):
            if (i>>j) & 1:
                point += (j+1)*100*pc[j][0] + pc[j][1]
                cnt += pc[j][0]
        if point >= g:
            ans = min(ans, cnt)
        # print(cnt, point)
        else:
            for j in range(n+1, -1, -1):
                if (i >> j) & 1:
                    continue
                else:
                    for k in range(pc[j][0]):
                        if point >= g:
                            ans = min(ans, cnt)
                            break
                        point += (j+1)*100
                        cnt += 1
    print(ans)


if __name__ == "__main__":
    main()


def main():
    d, g = map(int, input().split())
    pc = [list(map(int, input().split())) for _ in range(d)]

    n = len(pc)
    ans = float("inf")

    for i in range(2**n):
        point, cnt = 0, 0
        for j in range(n):
            if (i>>j) & 1:
                point += (j+1)*100*pc[j][0] + pc[j][1]
                cnt += pc[j][0]
        if point >= g:
            ans = min(ans, cnt)
        # print(cnt, point)
        else:
            for j in range(n-1, -1, -1):
                if (i >> j) & 1:
                    continue
                else:
                    for k in range(pc[j][0]):
                        if point >= g:
                            ans = min(ans, cnt)
                            break
                        point += (j+1)*100
                        cnt += 1
    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())
X = [list(map(int, input().split())) for _ in range(D)]

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

# Solve backward
print(func(D, G))

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

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

# Solve backward
print(func(D, G))


Verdicts: 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), *s = [list(map(int, i.split())) for i in open(0)]
s = [[i[0] * -~n * 100 + i[1], i[0]] for n, i in enumerate(s)]
a = 10**9
for b in range(1 << d):
    su = sum(s[i] * (b >> i & 1) for i in range(d))
    n = sum(s[i][1] * (b >> i & 1) for i in range(d))
    if su <= g:
        m = d-bin(b)[2:].zfill(d).find("0")
        e =-~(g-su)//(m*100)
        if e < s[m-1][1]:
            a = min(a,n + e)
    if su > g:
        a = min(a,n)
print(a)

(d, g), *s = [list(map(int, i.split())) for i in open(0)]
s = [[i[0] * -~n * 100 + i[1], i[0]] for n, i in enumerate(s)]
a = 10**3
for b in range(1 << d):
    su = sum(s[i][0] * (b >> i & 1) for i in range(d))
    n = sum(s[i][1] * (b >> i & 1) for i in range(d))
    if su < g:
        m = d-bin(b)[2:].zfill(d).find("0")
        e = (su-g)//(m*100)
        if -e < s[m-1][1]:
            a = min(a,n - e)
    if su >= g:
        a = min(a,n)
print(a)

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)]
def dfs(i,s,count,r):
    global ans
    if i==d:
        if s<g:
            e=max(r)
            n=min(pc[e-1][0],-(-(g-s)//(n*100)))
            count+=n
            s+=n*e*100
        if s>=g:
            ans=min(ans,count)
    else:
        dfs(i+1,s,r)
        dfs(i+1,s+(i+1)*100*pc[i][0]+pc[i][1],pc[i][0],r-{i+1})
ans=float('inf')
dfs(0,0,0,set(range(1,d+1)))
print(ans)

d,g=map(int,input().split())
pc=[list(map(int,input().split()) for i in range(d)]
def dfs(i,s,count,r):
    global ans
    if i==d:
        if s<g:
            e=max(r)
            n=min(pc[e-1][0],-(-(g-s)//(n*100)))
            count+=n
            s+=n*e*100
        if s>=g:
            ans=min(ans,count)
    else:
        dfs(i+1,s,r)
        dfs(i+1,s+(i+1)*100*pc[i][0]+pc[i][1],pc[i][0],r-{i+1})
ans=float('inf')
dfs(0,0,0,set(range(1,d+1)))
print(ans)

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

def f(i,s,count,nokori):
    global ans
    if s<g:
        b=max(nokori)
        n=min(pc[use-1],-(-(g-s)//(b*100)))
        count+=n
        s+=n*b*100
    if s>=g:
        ans=min(ans,count)
    else:
        f(i+1,s,count,nokori)
        f(i+1,s+a[i][0]*100*(i+1)+a[i][0],count+a[i][0],nokori-{i+1})
        
ans=float('inf')
f(0,0,0,set(range(1,d+1)))
print(ans)

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

        if sum >= g:
            ans = min(ans, count)
    else:
        
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})


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

ans = float("inf")

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        
        if sum < g:
            use = max(nokori)
            
            n = min(-(-(g - sum) // (use * 100)))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count) 
    else:
        
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100\
        + pc[i][1], count + pc[i][0], nokori - {i + 1})


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

ans = float("inf")

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


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 = count
    else:
        
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100\
         + pc[i][1], count + pc[i][0], nokori - {i + 1})


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

ans = 0

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


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

        if sum >= g:
            ans = min(ans, count)
    else:
        
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})


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

ans = float("inf")

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

Verdicts: Runtime Error

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_and_c = [list(map(int, input().split())) for _ in range(d)]
min_number = 1000
for i in range(2**d):
    score = 0
    number = 0
    p_and_c_copy = p_and_c.copy()
    rest_num = set(range(1, d+1))
    for j in range(d):
        if i & (1 << j):
            number += p_and_c_copy[j-d][0]
            score += p_and_c_copy[j-d][1] + 100 * (j+1) * p_and_c_copy.pop(j-d)[0]
            rest_num.discard(j+1)
    print(score)
    if p_and_c_copy:
        for k in range(p_and_c_copy[-1][0]):
            if score >= g:
                break
            score += 100 * max(rest_num)
            number += 1
        else:
            continue
    min_number = min(min_number, number)
print(min_number)

d, g = map(int, input().split())
p_and_c = [list(map(int, input().split())) for _ in range(d)]
min_number = 1000
for i in range(2**d):
    score = 0
    number = 0
    p_and_c_copy = p_and_c.copy()
    rest_num = set(range(1, d+1))
    for j in range(d):
        if i & (1 << j):
            number += p_and_c_copy[j-d][0]
            score += p_and_c_copy[j-d][1] + 100 * (j+1) * p_and_c_copy.pop(j-d)[0]
            rest_num.discard(j+1)
    if p_and_c_copy:
        for k in range(p_and_c_copy[-1][0]):
            if score >= g:
                break
            score += 100 * max(rest_num)
            number += 1
        else:
            continue
    min_number = min(min_number, number)
print(min_number)

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):
ans = float("inf")
for i in range(1<<d):
    count = 0
    sum = 0
    nokori = set(range(1, d+1))
    
    
    for j in range(d):
        if j & 1<<i:
            sum += pc[i][0]*(i+1)*100+pc[i][1]
            count += pc[i][0]
            nokori.discard(i+1)
            
    
    if sum < g:
        use = max(nokori)
        n = min(pc[use-1][0], (g-sum)//(use*100))
        count += n
        sum += n*use*100
        
    
    if sum >= g:
        ans = min(ans, count)
print(ans)

d,g = map(int,input().split())
pc = list(list(map(int, input().split())) for _ in range(d))
ans = float("inf")

for i in range(1<<d):
    score = 0
    cnt = 0
    nokori = set(range(1, d+1))
    
    for j in range(d):
        if i>>j &1:
            score += (j+1)*pc[j][0]*100+pc[j][1]
            cnt += pc[j][0]
            nokori.discard(j+1)
            
    if score < g:
        use = max(nokori)
        n = min(pc[use-1][0], -(-(g-score)//(use*100))) 
        cnt += n
        score += n*use*100
    if score >= g:
        ans = min(ans, cnt)
print(ans)

Verdicts: Runtime Error

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

Submission attempts (in order):
import sys
D,G=map(int,input().split())
Dat=[]
for i in range(1,D+1):
  pi,ci=map(int,input().split())
  Dat.append([i,pi,ci])
GT = 0
Cnt = 0
for i in range(D,0,-1):
  for j in range(1,Dat[i-1][1]):
    Cnt += 1
    GT += 100*i
#    print(Cnt,GT)
    if GT>= G:
      print(Cnt)
      sys.exit()
  Cnt += 1
  GT += 100*i +Dat[i-1][2]
  if GT>= G:
    print(Cnt)
    sys.exit()


#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    D, G = map(int, input().split())
    P = [0] * D
    C = [0] * D
    for i in range(D):
        p, c = map(int,input().split())
        P[i] = p
        C[i] = p * 100 * (i+1) + c

    ret = 1000
    for i in range(2 ** D):
        pt = 0
        ct = 0
        for j in range(D):
            if i >> j & 1:
                pt += C[j]
                ct += P[j]
            else:
                mxi = j
        for j in range(P[mxi]):
            if pt>=G:
                break
            else:
                pt += 100*(mxi+1)
                ct += 1
        if pt>=G:
            ret = min(ret, ct)
    print(ret)

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

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

ans = 1e9
for i in range(2**D - 1):
    inSolve = -1
    score_tmp = 0
    solved = 0
    for j in range(D):
        if (i>>j)%2 == 1:
            score_tmp += (j+1)*100*PC[j][0]+PC[j][1]
            solved += PC[j][0]
        else:
            inSolve = max(j,inSolve)
    if score_tmp < G and inSolve != -1:
        if math.ceil((G-score_tmp)/((inSolve+1)*100)) <= PC[inSolve][0]:
            ans = min(ans,solved + math.ceil((G-score_tmp)/((inSolve+1)*100)))
    elif score_tmp >= G:
        ans = min(ans,solved)
print(ans)

import math

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

ans = sum(P)
for i in range(2**D - 1):
    inSolve = -1
    score_tmp = 0
    solved = 0
    for j in range(D):
        if (i>>j)%2 == 1:
            score_tmp += (j+1)*100*P[j]+C[j]
            solved += P[j]
        else:
            inSolve = max(j,inSolve)
    if score_tmp < G and inSolve != -1:
        if math.ceil((G-score_tmp)/((inSolve+1)*100)) <= P[inSolve]:
            ans = min(ans,solved + math.ceil((G-score_tmp)/((inSolve+1)*100)))
    elif score_tmp >= G:
        ans = min(ans,solved)
print(ans)

Verdicts: Runtime Error

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

Submission attempts (in order):
import math

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

A = []
for i in range(D):
    A.append(100*(i+1)*d[i][0] + d[i][1])

ans = 0
for i in range(D):
    ans += d[i][0]

for i in range(2**D):
    a = 0
    g = 0
    B = []
    for j in range(D):
        if (i >> j) & 1:
            a += A[j]
            g += d[j][0]
        else:
            B.append(j)
    b = 0
    for j in B:
        b = max(b,A[j])

    if G-b < a <= G:
        c = max(B)
        e = math.ceil((G-a)/(100*(c+1)))
        if e > d[c][0]:
            continue
        else:
            ans = min(ans,g+e)

print(ans)

import math

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

A = []
for i in range(D):
    A.append(100*(i+1)*d[i][0] + d[i][1])

ans = 0
for i in range(D):
    ans += d[i][0]

for i in range(2**D):
    a = 0
    g = 0
    B = []
    for j in range(D):
        if (i >> j) & 1:
            a += A[j]
            g += d[j][0]
        else:
            B.append(j)
    b = 0
    for j in B:
        b = max(b,A[j])

    if G-b < a < G+b:
        c = max(B)
        e = math.ceil((G-a)/(100*(c+1)))
        if e <= 0:
            ans = min(ans,g)
        elif e > d[c][0]:
            continue
        else:
            ans = min(ans,g+e)

print(ans)

Verdicts: Wrong Answer

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

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

ans = float("inf")

for bit in range(1 << D):
    count = 0
    sum = 0
    rest = list(range(1, D+1))

    for i in range(D):
        if bit & (1 << i):
            sum += 100 * i * pc[i][0] + pc[i][1]
            count += pc[i][0]
            rest.remove(i+1)
    if sum < G:
        max_num = max(rest)
        n = min(pc[max_num - 1][0], (G - sum) // (max_num * 100))
        count += n
        sum += n*max_num * 100
    if sum >= G:
        ans = min(ans, count)

print(ans)


import math

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

ans = float("inf")

for bit in range(1 << D):
    count = 0
    sum = 0
    rest = list(range(1, D+1))

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

    if sum < G:
        max_num = max(rest)
        n = min(pc[max_num - 1][0], math.ceil((G - sum) / (max_num * 100)))
        count += n
        sum += n * max_num * 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 = map(int, input().split())

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

ans=float('inf')
for bit in range(2**d):
    b = 0
    score = 0
    num = 0
    
    
    for i in range(d):
        if (bit >> i) & 1:
            
            score += pc[0][i] * (i+1) * 100 + pc[1][i]
            
            num += pc[0][i]
        else:
            
            
            b = i

    
    for j in range(pc[b][0]):
        if score>=g and num<ans:
            ans=num
        score+=(b+1)*100
        num+=1

print(ans)

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

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

ans=float('inf')
for bit in range(2**d):
    b = 0
    score = 0
    num = 0
    
    
    for i in range(d):
        if (bit >> i) & 1:
            
            score += pc[i][0] * (i+1) * 100 + pc[i][1]
            
            num += pc[i][0]
        else:
            
            
            b = i

    
    for j in range(pc[b][0]):
        if score>=g and num<ans:
            ans=num
        score+=(b+1)*100
        num+=1

print(ans)

Verdicts: Runtime Error

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

Submission attempts (in order):
import math

n,g=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(n)]
comp=[(100*(i+1)*arr[i][0]+arr[i][1]) for i in range(n)]
ans=10**10
for i in range(2**n):
  flag=format(i,'b')
  if len(flag)<n:
    flag='0'*(n-len(flag))+flag
  tsum=0
  tans=0
  for i in range(n):
    if flag[i]=='1':
      tsum+=comp[i]
      tans+=arr[i][0]
  if tsum>=g:
    ans=min(ans,tans)
  else:
    pos=flag[::-1].index('0')
    tq=math.ceil(g-tsum)/(100*(n-pos)))
    if tq<=arr[n-pos-1][0]:
      ans=min(ans,tans+tq)
print(ans)

import math

n,g=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(n)]
comp=[(100*(i+1)*arr[i][0]+arr[i][1]) for i in range(n)]
ans=10**10
for i in range(2**n):
  flag=format(i,'b')
  if len(flag)<n:
    flag='0'*(n-len(flag))+flag
  tsum=0
  tans=0
  for i in range(n):
    if flag[i]=='1':
      tsum+=comp[i]
      tans+=arr[i][0]
  if tsum>=g:
    ans=min(ans,tans)
  else:
    pos=flag[::-1].index('0')
    tq=math.ceil((g-tsum)/(100*(n-pos)))
    if tq<=arr[n-pos-1][0]:
      ans=min(ans,tans+tq)
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):
#2-1-1 #ABC104C
d,g = map(int,input().split())
q={}
comp={}
p={}
minsolve=0
for i in range(d):
    a,b=map(int,input().split())
    q[i]=a
    p[i]=100*(i+1)
    comp[i]=100*(i+1)*a+b
    minsolve+=a
    
solve=[0 for _ in range(d)]
def roop(s,check,point,solved,minsolve):
    solve=s.copy()
    solve2=s.copy()
    if check==d:
        if 0 in solve:
            solverev=solve.copy()
            solverev.reverse()
            idx=d-solverev.index(0)-1
            shold=min(0,1+(g-point-1)//p[idx])
            if q[idx]>shold and shold>=0:
                solved+=shold
                minsolve=min(minsolve,solved)
        return minsolve

    minsolve=roop(solve,check+1,point,solved,minsolve)
    solve2[check]+=1
    minsolve=roop(solve2,check+1,point+comp[check],solved+q[check],minsolve)
    return minsolve

print(roop(solve,0,0,0,minsolve))

#2-1-1 #ABC104C
d,g = map(int,input().split())
q={}
comp={}
p={}
minsolve=0
for i in range(d):
    a,b=map(int,input().split())
    q[i]=a
    p[i]=100*(i+1)
    comp[i]=100*(i+1)*a+b
    minsolve+=a
    
solve=[0 for _ in range(d)]
def roop(s,check,point,solved,minsolve):
    solve=s.copy()
    solve2=s.copy()
    if check==d:
        if 0 in solve:
            solverev=solve.copy()
            solverev.reverse()
            idx=d-solverev.index(0)-1
            shold=max(0,1+(g-point-1)//p[idx])
            if q[idx]>shold and shold>=0:
                solved+=shold
                minsolve=min(minsolve,solved)
        return minsolve

    minsolve=roop(solve,check+1,point,solved,minsolve)
    solve2[check]+=1
    minsolve=roop(solve2,check+1,point+comp[check],solved+q[check],minsolve)
    return minsolve

print(roop(solve,0,0,0,minsolve))

Verdicts: Wrong Answer

Accepted