Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03254 (python)

Fixed submission:
n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort(key=int)
ans=0
for i in range(n):
  x=x-a[i]
  if x<0:
    x=x+a[i]
  else:
    ans+=1
if ans==n:
    if x>0:
        print(ans-1)
    else:
        print(ans)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input().split()))
ar=a.sort(reverse=True,key=int)
ans=0
for i in range(n):
  x-=ar[i]
  if x<0:
    x+=ar[i]
  else:
    ans+=1
print(ans)
Problem p03434 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
aa=sorted(a,key=int,reverse=True)
Ali=0
Bob=0
for i in range(n):
	if i%2==0:
	    Ali+=aa[i]
	else:
	    Bob+=aa[i]
print(Ali-Bob)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.reverse(key=int)
Ali=0
Bob=0
for i in range(n):
	if i%2==0:
       Ali+=a[i]
	else:
       Bob+=a[i]
ans(Ali-Bob)
Problem p03456 (python)

Fixed submission:
a,b=input().split()
ab=int(a+b)
ans=0
for i in range(350):
	if ab**(1/2)==i:
	    print("Yes")
	    ans+=1
	    quit()
if ans==0:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b=input()
ab=int("a"+"b")
ans=0
for i in range(350):
	if int(ab**(1/2))==i:
      print("Yes")
      ans+=1
      quit()
if ans==0:
  print("No")
Problem p03598 (python)

Fixed submission:
n=int(input())
k=int(input())
x=list(map(int,input().split()))
ans=0
for i in range (n):
    if abs(x[i])>abs(x[i]-k):
	    ans+=abs(x[i]-k)*2
    else:
        ans+=x[i]*2
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
k=int(input())
x=list(map(int,input().split())
ans=0
for i in range (n):
	if abs(x[i])>abs(x[i]-k):
		ans+=abs(x[i]-k)*2
    else:
       ans+=x[i]*2
print(ans)
Problem p02618 (python)

Fixed submission:
d = int(input())
c = list(map(int, input().split()))
for i in range(d):
    s = list(map(int, input().split()))
    num = max(s)
    print(s.index(num)+1)

Buggy submission (verdict: Runtime Error):
d = int(input())
c = list(map(int, input().split()))
for i in range(d):
    s = list(map(int, input().split()))
    num = max(s)
    print(l.index(num)+1)
Problem p02642 (python)

Fixed submission:
from collections import Counter 
n = int(input())
a = list(map(int, input().split()))
s = set(a)
c = Counter(a)
t = [0] * (10**6 + 1)
for i in s:
    for j in range(i, 10**6+1, i):
        t[j] += 1

ans = len([1 for i in s if t[i] == 1 and c[i] == 1])
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter 
n = int(input())
a = sorted(list(map(int, input().split())))
s = sorted(set(a))
c = Counter(a)
t = [0] * (10**6 + 1)
for i in a:
    for j in range(i, 10**6+1, i):
        t[j] += 1
print(len(i for i in a if t[i] == 1 and c[i] == 1))
Problem p02658 (python)

Fixed submission:
n = input()
a = list(map(int, input().split()))
if 0 in a:
  print(0)
  exit()
ans = 1
for x in a:
  ans *= x
  if ans > 10**18:
    print(-1)
    exit()
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int, input().split()))
ans = np.prod(a)
if ans > 10**18:
    print(-1)
else :
    print(ans)
Problem p02660 (python)

Fixed submission:
n=int(input())
cnt=0
for i in range(2,int(n**0.5)+2):
    if n%i==0:
        expo=0
        while n%i==0:
            n//=i
            expo+=1
        j=1
        while expo-j>=0:
            cnt+=1
            expo-=j
            j+=1
if n>1:
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
cnt=0
for i in range(2,int(n**0.5)+2):
    if n%i==0:
        expo=0
    while n%i==0:
        n//=i
        expo+=1
    j=1
    while expo-j>=0:
        cnt+=1
        expo-=j
        j+=1
if n>1:
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
cnt=0
for i in range(2,int(n**0.5)+2):
    if n%i==0:
        expo=0
    while n%i==0:
        n//=i
        expo+=1
        j=1
    while expo-j>=0:
        cnt+=1
        expo-=j
        j+=1
if n>1:
	cnt+=1
print(cnt)
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
root = [1]
for i in range(2*n+1000):
    next_num = a[root[-1]]
    root.append(next_num)

if k < n+1:
    print(root[k])

else: 
    loop_end = n 
    loop_start = n-1
    while(root[loop_start]!=root[loop_end]):
        loop_start -= 1
    period = loop_end - loop_start
    k %= period
    while k < n:
        k += period
    print(root[k])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
root = [1]
for i in range(1500):
    next_num = a[root[-1]]
    root.append(next_num)

if k < n+1:
    print(root[k])

else: 
    loop_end = n 
    loop_start = n-1
    while(root[loop_start]!=root[loop_end]):
        loop_start -= 1
    period = loop_end - loop_start
    k %= period
    while k < n:
        k += period
    print(root[k])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
root = [1]
for i in range(n+1000):
    next_num = a[root[-1]]
    root.append(next_num)

if k < n+1:
    print(root[k])

else: 
    loop_end = n 
    loop_start = n-1
    while(root[loop_start]!=root[loop_end]):
        loop_start -= 1
    period = loop_end - loop_start
    k %= period
    while k < n:
        k += period
    print(root[k])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
root = [1]
for i in range(1000):
    next_num = a[root[-1]]
    root.append(next_num)

if k < n+1:
    print(root[k])
    exit()

loop_end = n 
loop_start = n-1
while(root[loop_start]!=root[loop_end]):
    loop_start -= 1
period = loop_end - loop_start
k %= period
while k < n:
    k += period
print(root[k])
Problem p02714 (python)

Fixed submission:
n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r*g*b
for i in range(n-2):
    for j in range(i+1, n-1):
        k = 2*j - i
        if k >= n:
            break 
        if s[i]!=s[j] and s[k]!= s[i] and s[j]!=s[k]:
            ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r*g*b
for i in range(n-2):
    for j in range(i+1, n-1):
        k = 2j - i
        if k >= n:
            break 
        if s[i]!=s[j] and s[k]!= s[i] and s[j]!=s[k]:
            ans -= 1
print(ans)
Problem p02730 (python)

Fixed submission:
s = input()
f = 0
a = 0; b = 0; c = 0
if len(s)==3 and s[0]==s[2]:
    print('Yes')
else :
    
    for i in range(len(s)//2):
        if s[i]==s[-1-i]:
            a += 1
        if a == len(s)//2:
            f += 1
    for i in range(len(s)//4):
        if s[i]==s[(len(s)-1)//2-1-i]:
            b += 1
        if b == len(s)//4:
            f += 1
        if s[(len(s)+3)//2-1+i]==s[len(s)-1-i]:
            c += 1
        if c == len(s)//4:
            f += 1
    print('Yes' if f == 3 else 'No')

Buggy submission (verdict: Runtime Error):
s = input()
f = 0
a = 0; b = 0; c = 0
if len(s)==3 and s[0]==s[2]:
    print('Yes')
else :
    
    for i in range(len(s)//2):
        if s[i]==s[-1-i]:
            a += 1
        if a == len(s)//2:
            f += 1
    for i in range(len(s)//4):
        if s[i]==s[(len(s)-1)//2-1-i]:
            b += 1
        if b == len(s)//4:
            f += 1
        if s[(len(s)+3)//2-1+i]==s[len(s)-1+i]:
            c += 1
        if c == len(s)//4:
            f += 1
    print('Yes' if f == 3 else 'No')

Buggy submission (verdict: Runtime Error):
s = input()
f = 0
a = 0; b = 0; c = 0
if len(s)==3 and s[0]==s[2]:
    print('Yes')
else :
    
    for i in range(len(s)//2):
        if s[i]==s[-1-i]:
            a += 1
        if a == len(s)//2:
            f += 1
    for i in range(len(s)//4):
        if s[i]==s[(len(s)-1)//2-1-i]:
            b += 1
        if b == len(s)//4:
            f += 1
        if s[(len(s)+3)//2-1+i]==s[len(s)-1+i]:
            c += 1
        if c == len(s)//4:
            f += 1
    print('Yes' if f == 3 else 'No')

Buggy submission (verdict: Runtime Error):
s = input()
f = 0
a = 0; b = 0; c = 0
if len(s)==3 and len(set(s))==1:
    print('Yes')
else :
    
    for i in range(len(s)//2):
        if s[i]==s[-1-i]:
            a += 1
            if a == len(s)//2:
                f += 1
    for i in range(len(s)//4):
        if s[i]==s[(len(s)-1)//2-1-i]:
            b += 1
        if b == len(s)//4:
            f += 1
        if s[(len(s)+3)//2-1+i]==s[len(s)-1+i]:
            c += 1
        if c == len(s)//4:
            f += 1
    print('Yes' if f == 3 else 'No')

Buggy submission (verdict: Runtime Error):
s = input()
f = 0
a = 0; b = 0; c = 0
for i in range(len(s)//2):
    if s[i]==s[-1-i]:
        a += 1
    if a == len(s)//2:
        f += 1
for i in range(len(s)//4):
    if s[i]==s[(len(s)-1)//2-1-i]:
        b += 1
    if b == len(s)//4:
        f += 1
    if s[(len(s)+3)//2-1+i]==s[len(s)-1+i]:
        c += 1
    if c == len(s)//4:
        f += 1
print('Yes' if f == 3 else 'No')
Problem p02747 (python)

Fixed submission:
s = input()
if len(s)%2 == 0 and s == 'hi' * (len(s)//2):
    print('Yes')
else :
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
ans = 'Yes'
for i in range(0, n, 2):
    if s[i] != 'h':
        ans = 'No'
for j in range(1, n+1, 2):
    if s[j] != 'i':
        ans = 'No'
print(ans)
Problem p02760 (python)

Fixed submission:
A=[]
flag=0
for i in range(3):
  A.append(list(map(int,input().split())))
n=int(input())
for i in range(n):
  s=int(input())
  for k in range(3):
    if s in A[k]:
      A[k][A[k].index(s)]=0

if A[0]==[0,0,0] or A[1]==[0,0,0] or A[2]==[0,0,0]:
  print("Yes")
  flag=1
elif A[1][1]==0 and A[2][2]==0 and A[0][0]==0:
  print("Yes")
  flag=1
elif A[0][2]==0 and A[1][1]==0 and A[2][0]==0:
  print("Yes")
  flag=1
else:
  for i in range(3):
    if A[0][i]==0 and A[1][i]==0 and A[2][i]==0:
      print("Yes")
      flag=1
      break
if flag == 0:
  print("No")

Buggy submission (verdict: Runtime Error):
a11, a12, a13 = map(int, input().split())
a21, a22, a23 = map(int, input().split())
a31, a32, a33 = map(int, input().split())
n = int(input())
l = [int(input()) for i in range(n)]
if (a11 and a12 and a13 in l) or (a21 and a22 and a23 in l) or (a31 and a32 and a33 in l) or (a11 and a21 and a31 in l) or (a22 and a12 and a32 in l) or (a13 and a23 and a33 in l) or (a11 and a22 and a33 in l) or (elif a13 and a22 and a31 in l):
    print('Yes')
else :
    print('No')
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
exp_list = []
for i in p:
    expect = (i+1)/2
    exp_list.append(expect)
s = sum(exp_list[0:k])
ans = s
for j in range(n-k):
    s -= exp_list[j]
    s += exp_list[j+k]
    if s > ans :
        ans = s
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
exp_list = []
for i in p:
    expect = (i+1)/2
    exp_list.append(expect)
s = sum(exp_list[0:k])
ans = s
for j in range(n-k):
    s -= s[j]
    s += s[j+k]
    if s > ans :
        ans = s
print(ans)
Problem p02783 (python)

Fixed submission:
h, a = map(int, input().split())
print(h//a+1 if h%a!=0 else h//a)

Buggy submission (verdict: Runtime Error):
from collections import deque 
import math
n, d, a = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
l.sort(key = lambda x:x[0])
cnt = 0
queue = deque()
sum_bomb = 0
for i in range(n):
    while len(queue) != 0 and queue[0][0]<l[i][0]:
        sum_bomb -= queue[0][1] * a
        queue.popleft()
    l[i][1] -= sum_bomb
    if l[i][1] <= 0 :
        continue
    num = math.ceil(l[i][1]/a)
    right = l[i][0] + 2 * d
    queue.append([right, num])
    cnt += num
    sum_bomb += num * a
print(cnt)
Problem p02789 (python)

Fixed submission:
n, m = map(int, input().split())
print('Yes' if n==m else 'No')

Buggy submission (verdict: Runtime Error):
n, m = map(int, input(),split())
print('Yes' if n==m else 'No')
Problem p02801 (python)

Fixed submission:
s = input()
t = chr(ord(s)+1)
print(t)

Buggy submission (verdict: Runtime Error):
C = input()
alpha = iter("abcdefghijklmnopqrstuvwxyz")
if C in alpha :
    A = alpha.next()
print(A)
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
print(s.count('ABC'))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
cnt=0
for i in range(n):
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
        cnt+=1
print(cnt)
Problem p02817 (python)

Fixed submission:
S, T = input().split()

print(T + S)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(500*500)
S = input()
T =input()
s = S.lower()
t = T.lower()
if len(s) or len(t) > 100 : 
    print("error")
print(T + S)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(500*500)
S = input()
T =input()
S.lower()
T.lower()
print(T + S)

Buggy submission (verdict: Runtime Error):
S = input()
T =input()
S.lower()
T.lower()
print(T + S)
Problem p02818 (python)

Fixed submission:
A, B, K = map(int, input().split())

a = max(A-K, 0)
K -= A - a
b = max(B-K, 0)

print(a, b)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(500*500)

A = int(input())
B = int(input())
K = int(input())


for i in range(1, K+1) :
    if A >0:
        A -= 1
    elif B > 0 :
        B -= 1
        
print(A, B)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
K = int(input())


for i in range(1, K+1) :
    if A >0:
        A -= 1
    elif B > 0 :
        B -= 1
        
print(A, B)
Problem p02837 (python)

Fixed submission:
n = int(input())
evidences = [[] for _ in range(n)]
for i in range(n):
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        evidences[i].append((x-1, y))
result = 0
for i in range(1, 2**n):
    consistent = True 
    for j in range(n):
        if (i>>j) & 1 == 0:
            continue 
        for x, y in evidences[j]:
            if (i>>x)&1 != y:
                consistent = False 
                break
        if not consistent:
            break
    if consistent:
        result = max(result, bin(i)[2:].count('1'))
print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
XY = [[] for _ in range(n)]
for i in range(n):
    for j in range(int(input())):
        x, y = map(int, input().split())
        XY[i].append([x-1, y])
honest = 0
for bit in range(1<<n):
    flag = True 
    for i in range(n):
        if bit & (1<<i) :
            for a, b in XY[i]:
                if bit & (1<<a) != b:
                    flag = False 
                    break
    if flag:
        honest = max(honest, bin(i)[2:].count('1'))
print(ans)

Buggy submission (verdict: Runtime Error):
#abc147c　HonestOrUnkind
from itertools import product 
n = int(input())
XY = [[] for _ in range(n)]
for i in range(n):
    for j in range(int(input())):
        x, y = map(int, input().split())
        XY[i].append([x-1, y])
honest = 0
for bit in range(1<<n):
    flag = True 
    for i in range(n):
        if bit & (1<<i) :
            for a, b in XY[i]:
                if bit & (1<<a) != b:
                    flag = False 
                    break
    if flag:
        hoenst = max(honest, bin(i)[2:].count('1'))
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import product 
n = int(input())
XY = [[] for _ in range(n)]
for i in range(n):
    for j in range(int(input())):
        x, y = map(int, input().split())
        XY[i].append([x-1, y])
honest = 0
for bit in range(1<<n):
    flag = True 
    for i in range(n):
        if bit & (1<<i) :
            for a, b in XY[i]:
                if bit & (1<<a) != b:
                    flag = False 
                    break
    if flag:
        hoenst = max(honest, bin(i)[2:].count('1'))
        print(ans)
print(ans)
Problem p02911 (python)

Fixed submission:
n,k,q = map(int,input().split())
s = [k]*n
for i in range(q):
    a = int(input())
    s[a-1] += 1
for key in s:
    if key-(q) > 0:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
n, k, q = map(int, input().split())
l = [int(input()) for i in range(q)]
ls = np.array([k]*n)
for i in l:
    ls[:i-1] -= 1
    ls[i:] -= 1
for i in range(n):
    if ls[i]>0:
        print('Yes')
    else :
        print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
n, k, q = map(int, input().split())
l = [int(input()) for i in range(q)]
ls = np.array([k]*n)
for i in l:
    ls[:i-1] -= 1
    ls[i:] -= 1
for i in range(n):
    if ls[i]>0:
        print('Yes')
    else :
        print('No')
Problem p03030 (python)

Fixed submission:
n = int(input())
l = []
for i in range(n):
    s, p = input().split()
    l.append([s, int(p), i+1])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for j in range(n):
    print(l_sorted[j][2])

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in  range():
    s, p = input().split()
    l.append([s, int(p), i+1])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for j in range(n):
    print(l_sorted[j][2])

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in  range():
    s, p = input().split()
    l.append([s, int(p), i])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for j in range(n):
    print(l_sorted[j][2]+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in  range():
    s, p = input().split()
    l.append([s, int(p), i])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for j in l_sorted:
    print(j[2]+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in  range():
    s, p = input().split()
    l.append([s, int(p), i])
l_sorted = sorted(l, key = lambda x: (x[0], -x[1]))
for out in l_sorted:
    print(out[2]+1)
Problem p03106 (python)

Fixed submission:
import fractions
a, b, k = map(int, input().split())
l = []
gcd = fractions.gcd(a, b)
for i in range(1, int(gcd**0.5)+1):
    if gcd%i==0:
        l.append(i)
        if i != gcd//i:
            l.append(gcd//i)
l.sort(reverse = True)
print(l[k-1])

Buggy submission (verdict: Runtime Error):
import math
a, b, k = map(int, input().split())
l = []
gcd = math.gcd(a, b)
for i in range(1, int(gcd**0.5)+1):
    if gcd%i==0:
        l.append(i)
        if i != gcd//i:
            l.append(gcd//i)
l.sort(reverse = True)
print(l[k-1])
Problem p03126 (python)

Fixed submission:
from collections import deque
n, m = map(int, input().split())
a = [0]*m
for _ in range(n):
    A = deque(map(int, input().split()))
    k = A.popleft()
    if _ == 0:
        S = set(A)
    else:
        S = S & set(A)
print(len(S))

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
a = [0]*m
for _ in range(n):
    A = deque(map(int, input().split()))
    k = A.popleft()
    if i == 0:
        S = set(A)
    else:
        S = S & set(A)
print(len(S))

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
a = [0]*m
for _ in range(n):
    A = deque(map(int, input().split()))
    k = A.popleft()
    if i == 0:
        S = set(A)
    else:
        S = S & set(A)
 
print(len(S))
Problem p03243 (python)

Fixed submission:
n = int(input())
l = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in l:
    if n<=i:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
n = input()
l = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in l:
    if n<=i:
        print(i)
        break
Problem p03251 (python)

Fixed submission:
n, m, x, y = map(int, input().split())
if x>y :
    print('War')
else  :
    X = sorted(list(map(int, input().split())))
    Y = sorted(list(map(int, input().split())))
    a = 0
    for i in range(x+1, y+1):
        if X[-1]<i and i <= Y[0] and x < i and i <= y:
            print('No War')
            break
        else :
            a += 1
    if a == y-x:
        print('War')

Buggy submission (verdict: Runtime Error):
n, m, x, y = map(int, input().split())
if x>y :
    print('War')
a = 0
else:
    X = sorted(list(map(int, input().split())))
    Y = sorted(list(map(int, input().split())))
    for i in range(x+1, y+1):
        if X[-1]<i and i <= Y[0] and x < i and i <= y:
            print('No War')
            break
        else :
            a += 1
    if a == y-x:
        print('War')

Buggy submission (verdict: Runtime Error):
n, m, x, y = map(int, input().split())
if x>y :
    print('War')
else:
    X = sorted(list(map(int, input().split())))
    Y = sorted(list(map(int, input().split())))
    for i in range(x+1, y+1):
        if X[-1]<i and i <= Y[0] and x < i and i <= y:
            print('No War')
            break
        else :
            a += 1
    if a == y-x:
        print('War')
Problem p03290 (python)

Fixed submission:
#abc104c all green 
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]
all_sum = []
for bit in range(1<<d):
    s = 0
    a = 0
    rest = []
    for i in range(d):
        if bit & (1<<i):
            s += pc[i][0]*100*(i+1) + pc[i][1]
            a += pc[i][0]
        else :
            rest.append(i)
    
    if s >= g :
        all_sum.append(a)
    else :
        k = max(rest)
        diff = g - s
        for j in range(pc[k][0]):
            if j*(k+1)*100 >= diff:
                all_sum.append(a+j)
print(min(all_sum))

Buggy submission (verdict: Runtime Error):
#abc104c All Green
#全てとかない問いは一種類以下になるので、各問いに対し解く/解かないを決める

def dfs(i, sum, count, rest):
    global ans
    if i == d:
        if sum < g:
            rest_max = max(rest)
            n = min(l[rest_max-1][0], -(-(g-sum)//(rest_max*100)))
            count += n
            sum += n * rest_max * 100
        if sum >= g:
            ans = min(ans, count)
    else :
        dfs(i+1, sum, count, rest) #二分岐のうち解かない選択
        dfs(i+1, sum + l[i][0]*(i+1)*100, count + l[i][0], rest - {i+1}) #解く選択

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

Fixed submission:
a, b, k = [int(x) for x in input().split()]
if a + k - 1 < b - k + 1:
    l = list(range(a, a + k)) + list(range(b - k + 1, b + 1))
else:
    l = list(range(a, b + 1))
for ans in l:
    print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = [int(x) for x in input().split()]
if a + k - 1 < b - k + 1:
    l = list(range(a, a + k)) + list(range(b - k + 1, b + 1))
else:
    lcnt = list(range(a, b + 1))
for ans in l:
    print(ans)
Problem p03545 (python)

Fixed submission:
#abc079 train ticket
s = input()
for bit in range(1<<3):
    a = int(s[0])
    func = s[0]
    for i in range(3):
        if bit & (1<<i):
            func += '+'
            a += int(s[i+1])
        else : #もし1というフラグが立っていなければ、引くというプログラム
            func += '-'
            a -= int(s[i+1])
        func += s[i+1]
    
    if a == 7:
        print(func + '=7')
        exit()
print('No')

Buggy submission (verdict: Runtime Error):
def dfs(i, f, sum):
    if i == 3 and sum == 7:
        print(f+"=7")
        exit()
    else :
        dfs(i+1, f + '-' + s[i+1], sum - int(s[i+1]))
        dfs(i+1, f + '+' + s[i+1], sum + int(s[i+1]))
        
s = input()
dfs(0, s[0], int(s[0]))
Problem p03612 (python)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
q = [i for i in range(1, n+1)]
cnt = 0
for j in range(n):
    if p[j] == q[j]:
        if j != n-1:
            p[j], p[j+1] = p[j+1], p[j]
            cnt += 1
        else :
            p[j], p[j-1] = p[j-1], p[j]
            cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
q = [i for i in range(1, n+1)]
cnt = 0
for j in range(n):
    if p[j] == q[j]:
        p[j], p[j+1] = p[j+1], p[j]
        cnt += 1
print(cnt)
Problem p03852 (python)

Fixed submission:
c = input()
print("vowel" if c == "a" or c == "i" or c == "u" or c == "e" or c == "o" else "consonant")

Buggy submission (verdict: Runtime Error):
c = input()
print("vowel" if c = "a" or c = "i" or c = "u" or c = "e" or c = "o" else "consonant")