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

Fixed submission:
N, K = map(int, input().split())
prices = [int(i) for i in input().split()]
prices.sort()
print(sum(prices[:K]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
prices = [int(i) for i in input().split()]
print(sum(prices.sort()[:K]))
Problem p02639 (python)

Fixed submission:
X = [int(i) for i in input().split()]
for c, x in enumerate(X):
  if x == 0:
  	print(c+1)

Buggy submission (verdict: Runtime Error):
X = [for int(i) in input().split()]
for c, x in enumerate(X):
  if x == 0:
  	print(c)

Buggy submission (verdict: Runtime Error):
X = [for int(i) in input().split()]
for c, x in X:
  if x == 0:
  	print(c)
Problem p02675 (python)

Fixed submission:
N = input()
hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]
n = int(N[-1])
if n in hon:
  print('hon')
elif n in pon:
  print('pon')
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
N = int(input().split())
hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]
if N[-1] in hon:
  print('hon')
elif N[-1] in pon:
  print('pon')
else:
  print('bon')
Problem p02642 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split(" ")))
a_max = max(A)
cnts = [0] * (a_max + 1)
for a in A:
    v = a
    while v <= a_max:
        cnts[v] += 1
        v += a
cnt = 0
for a in A:
    if cnts[a] == 1:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split(" "))
n = [0] * (2 * 10 ** 5 + 1)
for v in A:
    n[v] += 1
    if 2 * v > (2 * 10 ** 5 // v + 1) * v:
        continue
    for i in range(2 * v, (2 * 10 ** 5 // v + 1) * v, v):
        n[i] += 10
cnt = 0
n.pop(0)
for v in n:
    if v == 1:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split(" "))))
idx = 0
while True:
    removes = []
    v = a[idx]
    for target in a[idx:]:
        if target % v == 0:
            removes.append(target)
    removes.remove(v)
    if removes:
        if removes[0] == v:
            removes.append(v)
        for target in removes:
            a.remove(target)
    if len(a) == 0 or a[-1] == v:
        break
    idx += 1
print(len(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split(" "))))
idx = 0
while True:
    removes = []
    v = a[idx]
    for target in a:
        if target % v == 0:
            removes.append(target)
    removes.remove(v)
    if removes:
        if removes[0] == v:
            removes.append(v)
        for target in removes:
            a.remove(target)
    if len(a) == 0 or a[-1] == v:
        break
    idx += 1
print(len(a))
Problem p02909 (python)

Fixed submission:
s = input()
d = {"Sunny": "Cloudy", "Cloudy": "Rainy", "Rainy": "Sunny"}
print(d[s])

Buggy submission (verdict: Runtime Error):
d = {"Sunny": "Cloudy", "Cloudy": "Rainy", "Rainy": "Sunny"}
print(d[s])
Problem p02613 (python)

Fixed submission:
AC = 0
WA = 0
TLE = 0
RE = 0
 
N = int(input())
for i in range(N):
  l = input()
  if l == "AC":
    AC += 1
  elif l == "WA":
    WA += 1
  elif l == "TLE":
    TLE += 1
  else:
    RE += 1
print("AC x " + str(AC)) 
print("WA x " + str(WA))
print("TLE x " + str(TLE)) 
print("RE x " + str(RE))

Buggy submission (verdict: Runtime Error):
AC = 0
WA = 0
TLE = 0
RE = 0

N = int(input())
for i in N:
  l = input()
  if l == "AC":
    AC += 1
  elif l == "WA":
    WA += 1
  elif l == "TLE":
    TLE += 1
  else:
    RE += 1
print("AC x " + str(AC)) 
print("WA x " + str(WA))
print("TLE x " + str(TLE)) 
print("RE x " + str(RE))
Problem p02630 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
summary = sum(A)
d = {}
for a in A:
  if a in d:
    d[a] += 1
  else:
    d[a] = 1
    
Q = int(input())
for _ in range(Q):
  B, C = list(map(int,input().split()))
  if B not in d:
    b = 0
  else:
    b = d[B]
    d[B] = 0
  if C in d:
    d[C] += b
  else:
    d[C] = b
  summary = summary + b * (C - B)
  print(summary)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
summary = sum(A)
d = {}
for a in A:
  if a in d:
    d[a] += 1
  else:
    d[a] = 1
    
Q = int(input())
for _ in range(Q):
  B, C = list(map(int,input().split()))
  if B not in d:
    b = 0
  else:
    b = d[B]
  	d[B] = 0
  if C in d:
    d[C] += b
  else:
    d[C] = b
  summary = summary + b * (C - B)
  print(summary)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
summary = sum(A)
d = {}
for a in A:
  if a in d:
    d[a] += 1
  else:
    d[a] = 1
    
Q = int(input())
for _ in range(Q):
  B, C = list(map(int,input().split()))
  if b in d:
    b = 0
  else:
    b = d[B]
  	d[B] = 0
  if C in d:
    d[C] += b
  else:
    d[C] = b
  summary = summary + b * (C - B)
  print(summary)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
summary = sum(A)
d = {}
for a in A:
  if a in d:
    d[a] += 1
  else:
    d[a] = 1
    
Q = int(input())
for _ in range(Q):
  B, C = list(map(int,input().split()))
  b = d[B]
  d[B] = 0
  if C in d:
    d[C] += b
  else:
    d[C] = b
  summary = summary + b * (C - B)
  print(summary)
Problem p02658 (python)

Fixed submission:
INF = 1000000000000000000
N = int(input())
flag = 1
l = list(map(int,input().split()))
if 0 in l:
  print(0)
  import sys
  sys.exit()
sum = 1
for i in l:
  sum = sum*i
  if sum > INF:
    print(-1)
    flag = 0
    break
  else:
    pass
    
if flag:
  print(sum)

Buggy submission (verdict: Runtime Error):
INF = 10**18
N = int(input())
sum = 1
for _ in range(N):
  sum = sum*int(input())
  if sum > INF:
    print(-1)
    import sys
    sys.exit()

print(sum)
Problem p02664 (python)

Fixed submission:
T = list(input())
 
for i in range(len(T)):
  if T[i] == "?":
    if 1 <= i and T[i-1] == "P":
      T[i] = "D"
    elif i < len(T)-1 and T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif i < len(T)-1 and T[i+1] == "D":
      T[i] = "P"
    else:
      T[i] = "D"
      
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = list(input())
 
for i in range(len(T)):
  if T[i] == "?":
    if 1 <= i：
      if T[i-1] == "P":
      	T[i] = "D"
    elif T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif T[i+1] == "D":
      T[i] = "P"
    else:
      T[i] = "D"
      
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = list(input())
 
for i in range(len(T)):
  if T[i] == "?":
    if 1 <= i：
      if T[i-1] == "P":
      	T[i] = "D"
    elif i < len(T) - 1 and T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif i < len(T) - 1 and T[i+1] == "D":
      T[i] = "P"
    else:
      T[i] = "D"
      
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = list(input())
 
for i in range(len(T)):
  if T[i] == "?":
    if 1 <= i:
      if T[i-1] == "P":
        T[i] = "D"
    elif T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif T[i+1] == "D":
      T[i] = "P"
    else:
      T[i] = "D"
      
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = list(input())
 
for i in range(len(T)):
  if T[i] == "?":
    if T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif T[i+1] == "D":
      T[i] = "P"
    else:
      T[i] = "D"
      
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = list(input())
 
for i in range(len(T)):
  if T[i] == "?":
    if 1 <= i and T[i-1] == "P":
      T[i] = "D"
    elif T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif T[i+1] == "D":
      T[i] = "P"
    else:
      T[i] = "D"
      
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = list(input())

for i in range(len(T)):
  if T[i] == "?":
    if 1 <= i and T[i-1] == "P":
      T[i] = "D"
    elif T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif T[i+1] == "D":
      T[i] = "P"
      
print("".join(T))
Problem p02683 (python)

Fixed submission:
from itertools import combinations
 
N, M, X = list(map(int,input().split()))
A = []
for i in range(N):
  A.append(list(map(int,input().split())))
sum = []
subsets=[]
for i in range(len(A) + 1):
    for c in combinations(A, i):
        subsets.append(list(c))
 
for i in subsets:
  tmp = [0]*(M+1)
  if len(i) == 1:
    sum.append(i[0])
  elif len(i) == 0:
    sum.append([0]*(M+1))
  else:
    for j in i:
      tmp = list(map(lambda a,b: a + b, tmp,j))
    sum.append(tmp)
    
min_price = 10000000000
 
for i in sum:
  t = 0
  for j in range(len(i)):
    if j==0:
      pass
    elif X > i[j]:
      t = 1
      break
  if t == 0:
    min_price = min(min_price, i[0])
 
if min_price == 10000000000:
  print(-1)
else:
  print(min_price)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
 
N, M, X = list(map(int,input().split()))
A = []
for i in range(N):
  A.append(list(map(int,input().split())))
sum = []
subsets=[]
for i in range(len(A) + 1):
    for c in combinations(A, i):
        subsets.append(list(c))
 
for i in subsets:
  tmp = [0]*(M+1)
  if len(i) == 1:
    sum.append(i[0])
  elif len(i) == 0:
    sum.append([0]*(M+1))
  else:
    for j in i:
      tmp = list(map(lambda a,b: a + b, tmp,j))
    sum.append(tmp)
    
min_price = 999999999999999
 
for i in sum:
  t = 0
  for j in range(len(i)):
    if j==0:
      pass
    elif X > i[j]:
      t = 1
      break
  if t == 0
    min_price = min(min_price, i[0])
 
if min_price == 999999999999999:
  print(-1)
else:
  print(min_price)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
 
N, M, X = list(map(int,input().split()))
A = []
for i in range(N):
  A.append(list(map(int,input().split())))
sum = []
subsets=[]
for i in range(len(A) + 1):
    for c in combinations(A, i):
        subsets.append(list(c))
 
for i in subsets:
  tmp = [0]*(M+1)
  if len(i) == 1:
    sum.append(i[0])
  elif len(i) == 0:
    sum.append([0]*(M+1))
  else:
    for j in i:
      tmp = list(map(lambda a,b: a + b, tmp,j))
    sum.append(tmp)
    
min_price = 101010101010101010101010
 
for i in sum:
  t = 0
  for j in range(len(i)):
    if j==0:
      pass
    elif X > i[j]:
      t = 1
      break
  if t == 0
    min_price = min(min_price, i[0])
 
if min_price == 101010101010101010101010:
  print(-1)
else:
  print(min_price)
Problem p02684 (python)

Fixed submission:
N, K = list(map(int,input().split()))
move_list = list(map(int,input().split()))
 
  
test = 1
find_f = {}
for i in range(N):
  find_f[i+1]=[]
 
find_f[1].append(0)
for i in range(K):
  test = move_list[test-1]
  find_f[test].append(i+1)
  if len(find_f[test]) == 2 and find_f[test][1]-find_f[test][0]<=1000000:
    state ,f = test, find_f[test]
    break
try:
  K = K-f[0]
  f = f[1]-f[0]
  remain = K%f
  for i in range(remain):
    state = move_list[state-1]
 
  print(state)
except:
  print(test)
#state = 1

Buggy submission (verdict: Runtime Error):
N, K = list(map(int,input().split()))
move_list = list(map(int,input().split()))
 
  
test = 1
find_f = {}
for i in range(N):
  find_f[i+1]=[]
 
find_f[1].append(0)
for i in range(K):
  test = move_list[test-1]
  find_f[test].append(i+1)
  if len(find_f[test]) == 2 and find_f[test][1]-find_f[test][0]<=1000:
    state ,f = test, find_f[test]
    break
  
K = K-f[0]
f = f[1]-f[0]
remain = K%f
 
for i in range(remain):
  state = move_list[state-1]
  
print(state)
#state = 1

Buggy submission (verdict: Runtime Error):
N, K = list(map(int,input().split()))
move_list = list(map(int,input().split()))
 
  
test = 1
find_f = {}
for i in range(N):
  find_f[i+1]=[]
 
find_f[1].append(0)
for i in range(K):
  test = move_list[test-1]
  find_f[test].append(i+1)
  if len(find_f[test]) == 2 and find_f[test][1]-find_f[test][0]<=100:
    state ,f = test, find_f[test]
    break
  
K = K-f[0]
f = f[1]-f[0]
remain = K%f
 
for i in range(remain):
  state = move_list[state-1]
  
print(state)
#state = 1

Buggy submission (verdict: Runtime Error):
N, K = list(map(int,input().split()))
move_list = list(map(int,input().split()))
 
  
test = 1
find_f = {}
for i in range(N):
  find_f[i+1]=[]
 
find_f[1].append(0)
for i in range(K):
  test = move_list[test-1]
  find_f[test].append(i+1)
  if len(find_f[test]) == 2 and find_f[test][1]-find_f[test][0]<=100000:
    state ,f = test, find_f[test]
    break
  
K = K-f[0]
f = f[1]-f[0]
remain = K%f
 
for i in range(remain):
  state = move_list[state-1]
  
print(state)
#state = 1

Buggy submission (verdict: Runtime Error):
N, K = list(map(int,input().split()))
move_list = list(map(int,input().split()))

  
test = 1
find_f = {}
for i in range(N):
  find_f[i+1]=[]

find_f[1].append(0)
for i in range(K):
  test = move_list[test-1]
  find_f[test].append(i+1)
  if len(find_f[test]) == 2:
    state ,f = test, find_f[test]
    break
  
K = K-f[0]
f = f[1]-f[0]
remain = K%f

for i in range(remain):
  state = move_list[state-1]
  
print(state)
#state = 1

#for i in range(K):
#  state = move_list[state][1]
Problem p02778 (python)

Fixed submission:
num = input()
ad = ""
for i in num:
  ad+="x"
print(ad)

Buggy submission (verdict: Runtime Error):
num = input()
ad = ""
for i in num:
  ad.append("x")
print(ad)
Problem p02783 (python)

Fixed submission:
a = input()
a = a.split(" ")
i = 0
while 1:
  if int(a[0]) <= 0:
    break
  else:
    i = i+1
    a[0]=int(a[0])-int(a[1])
    
print(i)

Buggy submission (verdict: Runtime Error):
a = input()
a = a.split(" ")
i = 0
while 1:
  if int(a[0])=<0:
    break
  else:
    i = i+1
    a[0]=int(a[0])-int(a[1])
    
print(i)

Buggy submission (verdict: Runtime Error):
a = input()
a = a.split(" ")
i = 0
while 1:
  if a[0]<0:
    break
  else:
    i = i+1
    a[0]=int(a[0])-int(a[1])
    
print(i)

Buggy submission (verdict: Runtime Error):
a = input()
a = a.split(" ")
i = 0
while 1:
  if a[0]<0:
    break
  else:
    i = i+1
 	a[0]=a[0]-a[1]
    
print(i)

Buggy submission (verdict: Runtime Error):
a = input()
a = a.split(" ")
i = 0
while 1:
  if a[0]<0:
    break
  else:
    i = i+1
 	b=a[0]-a[1]*i
    
print(i)
Problem p03071 (python)

Fixed submission:
import numpy as np
 
a,b=(int(x) for x in input().split())
sum=0

 
if a>=b:
  sum+=a
  if a-1>=b:
  	sum+=a-1
  else:
    sum+=b
else:
  sum+=b
  if b-1>=a:
  	sum+=b-1
  else:
    sum+=a
    
print(sum)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
sum=0
a=int(a)
b=int(b)
 
if a>=b:
  sum+=a
  if a-1>=b:
  	sum+=a-1
  else:
    sum+=b
else:
  sum+=b
  if b-1>=a:
  	sum+=b-1
  else:
    sum+=a
    
print(sum)

Buggy submission (verdict: Runtime Error):
import numpy as np

a=input()
b=input()
sum=0

if a>=b:
  sum+=a
  if a-1>=b:
  	sum+=a-1
  else:
    sum+=b
else:
  sum+=b:
  if b-1>=a:
  	sum+=b-1
  else:
    sum+=a
    
print(sum)
Problem p02613 (python)

Fixed submission:
n = int(input())
ac = wa = tle = re = 0
for i in range(n):
  m = input()
  if m == 'AC': ac += 1
  elif m == 'WA': wa += 1
  elif m == 'TLE': tle += 1
  else: re += 1
print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re)

Buggy submission (verdict: Runtime Error):
n = int(input())
ac = wa = tle = re = 0
for i in range(n):
  m = int(input())
  if m == 'AC':
    ac += 1
  elif m == 'WA':
    wa += 1
  elif m == 'TLE':
    tle += 1
  else:
    re += 1
print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re)

Buggy submission (verdict: Runtime Error):
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
  m = int(input())
  if m == 'AC':
    ac += 1
  elif m == 'WA':
    wa += 1
  elif m == 'TLE':
    tle += 1
  elif m == 'RE':
    re += 1
print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re)
Problem p04043 (python)

Fixed submission:
A,B,C = map(int,input().split())
b_5 = 0
b_7 = 0
if A == 5:
  b_5 += 1
elif A == 7:
  b_7 += 1
if B == 5:
  b_5 +=1
elif B==7:
  b_7 += 1
if C==5:
  b_5 +=1
elif C==7:
  b_7 += 1

if b_5 == 2 and b_7 == 1:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
B = int(input())
b_5 = 0
b_7 = 0
if A == 5:
  b_5 += 1
elif A == 7:
  b_7 += 1
if B == 5:
  b_5 +=1
elif B==7:
  b_7 += 1
if C==5:
  b_5 +=1
elif C==7:
  b_7 += 1

if b_5 == 2 and b_7 == 1:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
B = input()
b_5 =0
b_7=0
if A == 5:
  b_5 += 1
elif A == 7:
  b_7 += 1
if B == 5:
  b_5 +=1
elif B==7:
  b_7 += 1
if C==5:
  b_5 +=1
elif C==7:
  b_7 += 1

if b_5 == 2 and b_7 == 1:
  print("YES")
else:
  print("NO")
Problem p02613 (python)

Fixed submission:
d={'AC':0,'WA':0,'TLE':0,'RE':0}
for _ in range(int(input())):
	d[input()]+=1
print('AC x',d['AC'])
print('WA x',d['WA'])
print('TLE x',d['TLE'])
print('RE x',d['RE'])

Buggy submission (verdict: Runtime Error):
d={'AC':0,'WA':0,'TLE':0,'RE':0}
for _ in range(int(input()):
	d[input()]+=1
print('AC X',d['AC'])
print('WA X',d['WA'])
print('TLE X',d['TLE'])
print('RE X',d['RE'])
Problem p02613 (python)

Fixed submission:
N = int(input())

result = {}
for _ in range(N):
  s = input()
  result[s] = result.get(s, 0) + 1

print(f"AC x {result.get('AC', 0)}")
print(f"WA x {result.get('WA', 0)}")
print(f"TLE x {result.get('TLE', 0)}")
print(f"RE x {result.get('RE', 0)}")

Buggy submission (verdict: Runtime Error):
N = int(input())

result = {}
for _ in range(N):
  s = input()
  result[s] = result.get(s, 0) + 1

print(f"AC x {result['AC']}")
print(f"WA x {result['WA']}")
print(f"TLE x {result['TLE']}")
print(f"RE x {result['RE']}")
Problem p03079 (python)

Fixed submission:
A, B, C = map(int, input().split())
print('Yes' if A == B == C else 'No')

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input())
print('Yes' if A == B == C else 'No')
Problem p03136 (python)

Fixed submission:
_ = input()
edges = list(map(int, input().split()))
max_edge = max(edges)
print('Yes' if max_edge < sum(edges) - max_edge else 'No')

Buggy submission (verdict: Runtime Error):
_ = input()
edges = list(int, input().split())
max_edge = max(edges)
print('Yes' if max_edge < sum(edges) - max_edge else 'No')
Problem p03680 (python)

Fixed submission:
N = int(input())
a = {}
for i in range(N):
    a[i + 1] = int(input())

i = 1
cnt = 0
while True:
    next_i = a[i]
    cnt += 1
    if next_i < 1:
        print(-1)
        break
    elif next_i == 2:
        print(cnt)
        break

    a[i] = 0
    i = next_i

Buggy submission (verdict: Runtime Error):
N = int(input())
a = {}
for i in range(N):
    a[i + 1] = int(input())

for i in range(N):
    if a[i] == 2:
        print(i + 1)
        exit(0)
print(-1)
Problem p04043 (python)

Fixed submission:
clause_list = list(map(int, input().split()))

for index, clause in enumerate(clause_list):
  if clause == 5:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause == 7:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause == 5:
    clause_list.pop(index)
    break

print('YES' if len(clause_list) == 0 else 'NO')

Buggy submission (verdict: Runtime Error):
clause_list = list(map(int, input().split()))

for index, clause in enumerate(clause_list):
  if clause = 5:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause = 7:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause = 5:
    clause_list.pop(index)
    break

print('YES' if len(clause_list) == 0 else 'NO')

Buggy submission (verdict: Runtime Error):
clause_list = list(map(int, input()))

for index, clause in enumerate(clause_list):
  if clause = 5:
    clause_list.pop(index)
    break
    
for index, clause in enumerate(clause_list):
  if clause = 7:
    clause_list.pop(index)
    break
    
for index, clause in enumerate(clause_list):
  if clause = 5:
    clause_list.pop(index)
    break
    
print('YES' if len(clause_list) == 0 else 'NO')
Problem p02628 (python)

Fixed submission:
n,k=map(int,input().split())
p=[]
a,*b=map(int,input().split())
p.append(a)
for i in range(len(b)):
    p.append(b[i])
p.sort()
y=0
for i in range(k):
    y=y+p[i]
print(y)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=[]
for i in range(n):
  x=int(input())
  p.append(x)
p.sort()
y=0
for i in range(k):
  y=y+p[i]
print(y)
Problem p02639 (python)

Fixed submission:
a=list(map(int,input().split()))
for i in range(5):
  if a[i]!=i+1:
    print(i+1)

Buggy submission (verdict: Runtime Error):
a=map(int,input().split())
for i in range(len(a)):
  if a[i]!=i:
    print(a[i])
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
a = [int(x) for x in input().split()]
b = [i for i in range(0,102) if i not in a] 
b_tmp = list(map(lambda s:abs(s-x), b)) #b_tmpはbとxの差分のリストをさくせい
address = b_tmp.index(min(b_tmp))
print(b[address])

Buggy submission (verdict: Runtime Error):
X,N=map(int,input().split())
l=[]
for i in range(100):
  l.append(i+1)
if N>0:
  p=list(map(int,input().split()))
  l1=[x for x in l if x not in p]
  d=abs(X-l1[0])
if N>0:
  for i in range(N):
    d=min(abs(X-l1[i]),d)
  print(l1[i])
else:
  print(X)
Problem p03493 (python)

Fixed submission:
s = list(input())
ball = 0
for i in s:
    ball = ball + int(i)

print(ball)

Buggy submission (verdict: Runtime Error):
s = list(input())

for i in s:
    sum += int(i)

print(sum)

Buggy submission (verdict: Runtime Error):
s = input().split()

for i in range(2):
    sum += int(s[i])

print(sum)

Buggy submission (verdict: Runtime Error):
s = input().split()

for i in s:
    sum += int(i)

print(sum)

Buggy submission (verdict: Runtime Error):
s = input().split()

for i in s:
    sum += int(s[i])

print(sum)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()

n = len(s)
if s+t[n] == t:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
z = 0
b = [1]
c = [0]*n
for i in range(n*3):
  j = [a[b[i]-1]]
  b.extend(j)
  c[a[b[i]-1]-1] = c[a[b[i]-1]-1]+1
  if c[a[b[i]-1]-1] == 2:
    z = z + 1
if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)
Problem p02684 (python)

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
z = 0
b = [1]
c = [0]*n
for i in range(n*3):
  j = [a[b[i]-1]]
  b.extend(j)
  c[a[b[i]-1]-1] = c[a[b[i]-1]-1]+1
  if c[a[b[i]-1]-1] == 2:
    z = z + 1
if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
z = 0
b = [1]
c = [0]*n
for i in range(n*3):
  j = [a[b[i]-1]]
  b.extend(j)
  c[a[b[i]-1]-1] = c[a[b[i]-1]-1]+1
  if c[a[b[i]-1]-1] == 2:
    z = z + 1

if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)

Buggy submission (verdict: Runtime Error):
z = 0

b = [1]
for i in range(1000000):
  j = [a[b[i]-1]]
  b.extend(j)

for i in range(n):
  if b.count(i+1)>=3:
    z = z + 1

if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)
Problem p03220 (python)

Fixed submission:
N = input()
T, A = map(int, input().split())
temperatures = list(map(int, input().split()))
 
r = 50000000000000
results = ''
 
list = [T - t * 0.006 for t in temperatures]
for index, avg_temp in enumerate(list):
    ondo_sa = avg_temp - A
 
    if ondo_sa < 0:
        ondo_sa = - ondo_sa
 
    if r > abs(ondo_sa):
        r = ondo_sa
        results = index + 1
print(results)

Buggy submission (verdict: Runtime Error):
N = input()
T, A = map(int, input().split())
temperatures = list(map(int, input().split()))
 
r = 50000000
results = ''
 
list = [T - t * 0.006 for t in temperatures]
for index, avg_temp in enumerate(list):      

    if r > abs(ondo_sa):
        r = ondo_sa
        results = index + 1
print(results)

Buggy submission (verdict: Runtime Error):
N = input()
T, A = map(int, input().split())
temperatures = list(map(int, input().split()))

r = 50000000
results = ''

list = [T - t * 0.006 for t in temperatures]
for index, avg_temp in enumerate(list):
  	if avg_temp < 0:
      	avg_temp = avg_temp * -1
      
    ondo_sa = A - avg_temp
    if r > ondo_sa:
        r = ondo_sa
        results = index + 1
print(results)