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

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

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
p_list = []
S = []
for _ in range(M):
    n, s = input().split()
    p_list.append(int(n))
    S.append(s)

wa = 0
ac = 0
ac_list = []
for i, p in enumerate(p_list):
    if p not in ac_list:
        if S[i] == "WA":
                wa += 1
        else:
                ac += 1
                ac_list.append(p)

print(ac, wa)
Problem p02817 (python)

Fixed submission:
s, t = input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
for i in range(k):
  if a > 0:
    a -= 1 
  elif b > 0:
    b -= 1
  else:
    break
print(str(a) + " " + str(b))
Problem p02818 (python)

Fixed submission:
a, b, k = map(int,input().split())

if a > 0:
    if a > k:
        a -= k
        k = 0
    else:
        k -= a
        a = 0

if b > 0:
    if b > k:
        b -= k
    else:
        b = 0

print(str(a) + " " + str(b))

Buggy submission (verdict: Runtime Error):
def main()
  a, b, k = map(int, input().split())
  for i in range(k):
    if a > 0:
      a -= 1 
    elif b > 0:
      b -= 1
    else:
      break
  print(str(a) + " " + str(b))
  
if __name__ == "__main__"
  main()

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
for i in range(k)
  if a > 0:
    a -= 1 
  elif b > 0:
    b -= 1
  else:
    break
print(str(a) + " " + str(b)))

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
for i in range(k)
	if a > 0:
  		a -= 1 
	elif b > 0:
 		b -= 1
	else:
		break
print(str(a) + " " + str(b)))
Problem p03106 (python)

Fixed submission:
a, b, k = map(int, input().split())

ans =[]
for i in range(1000, 0, -1):
    if a % i == 0 and b % i == 0:
        ans.append(i)
print(ans[k-1])

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans =[]
for i in range(60, 0, -1):
    if a % i == 0 and b % i == 0:
        ans.append(i)
print(ans[k-1])
Problem p03160 (python)

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

dp = [float("inf")] * (n + 1)
dp[0] = 0
dp[1] = abs(h[0]-h[1])

for i in range(2, n):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
h = list(map(int, input().split()))

dp = [math.inf] * (n + 1)
dp[0] = 0
dp[1] = abs(h[0]-h[1])

for i in range(2, n):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])
Problem p03673 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = []

if n % 2 == 0:
    for i in range(n - 1, 0, -2):
        b.append(a[i])
    for i in range(0, n, 2):
        b.append(a[i])
else:
    for i in range(n - 1, -1, -2):
        b.append(a[i])
    for i in range(1, n, 2):
        b.append(a[i])

for i in range(len(b)):
    print(b[i], end=" ")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b=[]

a = a[::-1]
for i in range(n):
    b.append(a.pop(-1))
    b = b[::-1]
    print(b)

for i in range(len(b)):
    print(b[i], end=" ")
Problem p03760 (python)

Fixed submission:
o = input()
e = input()

a = len(o)-len(e)
s = ""

if a == 0:
    for i in range(len(o)):
         s += o[i] + e[i]
else:
    for i in range(len(o)-1):
        s += o[i] + e[i]
    s += o[len(o)-1]
print(s)

Buggy submission (verdict: Runtime Error):
o = input()
e = input()

s = ""
for i in range(len(o)):
    s += o[i] + e[i]
print(s)
Problem p02934 (python)

Fixed submission:
n = int(input())
print(1 / sum(1 / e for e in map(int, input().split())))

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [*map(int, input().split())]
print(1 / sum(1 / e for e in l))
Problem p02988 (python)

Fixed submission:
n = int(input())
res = 0
p = list(map(int, input().split()))
res = sum(1 for i in range(1, n - 1) if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1])
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
res = 0
p = [*map(int, input().split())]
res = sum(1 for i in range(1, n - 1) if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1])
print(res)
Problem p03200 (python)

Fixed submission:
s = input()
l = []
i = 0
n = len(s)
while i < n:
    j = 0
    while i < n and s[i] == 'B':
        j += 1
        i += 1
    l.append(j)

    j = 0
    while i < n and s[i] == 'W':
        j += 1
        i += 1
    l.append(j)
# print(l)
res = 0
for i in range(0, len(l), 2):
    if l[i] > 0:
        res += l[i] * l[i + 1]
    if i + 2 < len(l):
        l[i + 2] += l[i]
print(res)

Buggy submission (verdict: Runtime Error):
from collections import Counter as C
n = int(input())
l = sorted(map(int, input().split()), reverse = True)
c = C(l)
res = 0
for e in l:
    for p in range(32, 0, -1):
        e_ = (1 << p) - e
        if c.get(e_, 0) > 0:
            # print(e, e_, c)
            c[e_] -= 1
            c[e] -= 1
            res += 1
            break
print(res)
Problem p03238 (python)

Fixed submission:
if input() == '1':
    print('Hello World')
else:
    print(int(input()) + int(input()))

Buggy submission (verdict: Runtime Error):
if input() == 1:
    print('Hello World')
else:
    print(int(input()) + int(input()))

Buggy submission (verdict: Runtime Error):
if input() == 1:
    print('Hello World')
else:
    print(input() + input())
Problem p03246 (python)

Fixed submission:
from collections import Counter
n = int(input())
l = list(map(int, input().split()))

l1 = [l[i] for i in range(0, n, 2)]
l2 = [l[i] for i in range(1, n, 2)]
c1 = sorted(Counter(l1).items(), key = lambda x: x[1], reverse = True) + [(0, 0)]
c2 = sorted(Counter(l2).items(), key = lambda x: x[1], reverse = True) + [(0, 0)]

res = c1[0][1] + c2[0][1]
if c1[0][0] == c2[0][0]:
    res = max((c1[1][1] + c2[0][1]), (c1[0][1] + c2[1][1]))

# print(c1, c2)
print(n - res)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
l = [*map(int, input().split())]

l1 = [l[i] for i in range(0, n, 2)]
l2 = [l[i] for i in range(1, n, 2)]
c1 = sorted(Counter(l1).items(), key = lambda x: x[1], reverse = True) + [(0, 0)]
c2 = sorted(Counter(l2).items(), key = lambda x: x[1], reverse = True) + [(0, 0)]

res = c1[0][1] + c2[0][1]
if c1[0][0] == c2[0][0]:
    res = max((c1[1][1] + c2[0][1]), (c1[0][1] + c2[1][1]))

# print(c1, c2)
print(n - res)
Problem p03276 (python)

Fixed submission:
n, k = map(int, input().split())
l = list(map(int, input().split()))
res = float('inf')
for i in range(n - k + 1):
    a = max(0, - l[i])
    b = max(0, l[i + k - 1])
    res = min(res, a + b + min(a, b))
print(res)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = [*map(int, input().split())]
res = float('inf')
for i in range(n - k + 1):
    a = max(0, - l[i])
    b = max(0, l[i + k - 1])
    res = min(res, a + b + min(a, b))
print(res)
Problem p03280 (python)

Fixed submission:
a, b = [int(x) for x in input().split()]
print(a * b - a - b + 1)

Buggy submission (verdict: Runtime Error):
 a, b = [int(x) for x in input().split()]
print(a * b - a - b + 1)
Problem p03614 (python)

Fixed submission:
n = int(input())
l = [int(i + 1 == e) for i, e in enumerate(map(int, input().split()))]
res = 0
for i in range(n):
    if l[i]:
        if i + 1 < n and l[i + 1]: l[i + 1] = 0
        res += 1
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [int(i + 1 == e) for i, e in enumerate(map(int, input().split()))]
res = 0
for i in range(n):
    if l[i]:
        if l[i + 1]: l[i + 1] = 0
        res += 1
print(res)
Problem p02789 (python)

Fixed submission:
N, M = map(int, input().split())

if N == M:
    print("Yes")
else:
    print("No")

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

N = int(input())
res = 0
p = list(map(int, input().split()))
p_a = np.array(p, dtype = np.int64)
for i in range(N):
    mini = np.min(p_a[:(i+1)])
    if mini >= p[i]:
        res += 1    
print(res)
Problem p02791 (python)

Fixed submission:
N = int(input())
res = 0
p = list(map(int, input().split()))
mini = p[0]
for i in range(N):
    mini = min(mini, p[i])
    if mini >= p[i]:
        res += 1    
print(res)

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

N = int(input())
res = 0
p = list(map(int, input().split()))
p_a = np.array(p, dtype = np.int64)
for i in range(N):
    mini = np.min(p_a[:(i+1)])
    if mini >= p[i]:
        res += 1    
print(res)
Problem p02817 (python)

Fixed submission:
# -*- coding: utf-8 -*-
s, t = input().split()
res = t + s
print(res)

Buggy submission (verdict: Runtime Error):
import numpy as np
X =int(input())
 
if X == 2:
    print(X)
 
else:
    s = np.array([2])
    
    for i in range(2, 10**5 + 3):
        res = True
        for j in s:
            if (i % j) == 0:
                res = False
                break
        
        if res == True:
            s = np.append(s, i)
            if i >= X:
                print(i)
                break
Problem p02690 (python)

Fixed submission:
x = int(input())

for i in range(200):
    for j in range(-200, 200):
        if i ** 5 - j ** 5 == x:
            a=i
            b=j

print(a, b)

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

for i in range(-100, 100):
    for j in range(-100, 100):
        if i ** 5 - j ** 5 == x:
            a=i
            b=j

print(a, b)

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

for i in range(200):
    for j in range(-200, 0):
        if i ** 5 - j ** 5 == x:
            a=i
            b=j

print(a, b)
Problem p02687 (python)

Fixed submission:
s = input()

if s == "ABC":
  print("ARC")
else:
  print("ABC")

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

if s == "ABC":
  print("ARC")
else print("ABC")
Problem p02705 (python)

Fixed submission:
import math
 
r = int(input())
l = 2*math.pi*r
print(l)

Buggy submission (verdict: Runtime Error):
import math

r = int(input())
l = 2*math.py*r
print(l)
Problem p03210 (python)

Fixed submission:
age = int(input())

if age == 7 or age == 5 or age == 3:
  print("YES")
else:
  print("NO")

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

if age == 7|5|3:
  print("YES")
else:
  print("NO)
Problem p02761 (python)

Fixed submission:
import sys

n, m = map(int, input().split())
l = [list(map(int, input().split())) for i in range(m)]
ans = [0] * n
check = [10] * n
for i in l:
    if check[i[0] - 1] == 10:
        ans[i[0] - 1] = i[1]
        check[i[0] - 1] = i[1]
    elif check[i[0] - 1] != i[1]:
        print(-1)
        sys.exit()
    if i[0] == 1 and i[1] == 0 and n != 1:
        print(-1)
        sys.exit()

if n > 1 and check[0] == 10:
    ans[0] = 1

for i in ans:
    print(i, end="")

Buggy submission (verdict: Runtime Error):
import sys

n, m = map(int, input().split())
l = [list(map(int, input().split())) for i in range(m)]
ans = [0] * m
check = [10] * m
for i in l:
    if check[i[0] - 1] == 10:
        ans[i[0] - 1] = i[1]
        check[i[0] - 1] = i[1]
    elif check[i[0] - 1] != i[1]:
        print(-1)
        sys.exit()

    if i[0] == 1 and i[1] == 0 and n != 1:
        print(-1)
        sys.exit()

for i in ans:
    print(i, end="")
Problem p02811 (python)

Fixed submission:
k,x=map(int,input().split())

if k*500>=x:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
k,x=mpa(int,input().split())
if 500*k >= x:
  print("Yes")
else:
  print("No")
Problem p02813 (python)

Fixed submission:
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
import itertools
J=(list(itertools.permutations(range(1,n+1))))
#print(J)
for i, j in enumerate(J):
    #print(j,p,q)
    if j == p:
        a=i
    if j==q:
        b=i
print(abs(a-b))

Buggy submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
import itertools
J=(list(itertools.permutations(range(n))))

for i, j in enumerate(J):
    if j == p:
        a=i
    if j==q:
        b=i
print(abs(a-b))
Problem p02818 (python)

Fixed submission:
a,b,k=map(int,input().split())

if k <= a:
    a2=a-k
    b2=b
elif k <= a+b:
    a2=0
    b2=b-(k-a)
else:
    a2=0
    b2=0
print(a2,b2)

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())

a2=a-min(a,k)
if k > a:
    b2=b-min(b,k-a)
print(a2,b2)
Problem p02844 (python)

Fixed submission:
n=int(input())
s=input()
ans=0

for ii in range(1000):
    v = str(ii).zfill(3)
    start=0
    f=0
    
    for j in range(3):
        idx=s.find(v[j],start)
        if idx > -1:
            start = idx + 1
            f+=1
        else:
            break

    if f == 3:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import re
n0=input()
s=input()
ans=0

for i in range(1000):
    n = str(i).zfill(3)
#    print(n[0])
    p = f".*{n[0]}.*{n[1]}.*{n[2]}.*"
    if re.search(p,s):
        ans += 1
print(ans)
Problem p02923 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
i=-1
c=maxc=0

while i < n:
    if c > maxc:
        maxc=c
        ans=i
    i=i+c+1
    c=0
    for j in range(i+1,n):
        if l[j-1]>=l[j]:
            c+=1
        else:
        	break

print(maxc)

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

c=0
maxc=0

for i in range(len(l)):
    if c > maxc:
        maxc=c
        ans=i
    c=0
        
    for j in range(i+1,len(l)):
        if l[j-1]>=l[j]:
            c+=1
        else:
            break
print(ans)
Problem p03000 (python)

Fixed submission:
N,X=map(int,input().split())
L = [int(i) for i in input().split()] 
ans=N+1
a=0
for i in range(N):
    a+=L[i]
    if a > X:
        ans=i+1
        break

print(ans)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L = [int(i) for i in input().split()] 

a=0
for i in range(N):
    a+=L[i]
    if a > X:
        ans=i+1
        break

print(ans)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L = [int(i) for i in input().split()] 

a=0
for i in range(N+1):
    a+=L[i]
    if a > X:
        ans=i+1
        break

print(ans)
Problem p03047 (python)

Fixed submission:
n,k=map(int,input().split())
print(n-k+1)

Buggy submission (verdict: Runtime Error):
n,k=input().split()
ans=n-k+1
Problem p03110 (python)

Fixed submission:
n=int(input())
ans=0
for i in range(n):
    x,u=input().split()
    x=float(x)
    
    if u == 'BTC':
        x=x*380000.
    ans+=x
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(n):
    x,u=map(int,input().split())
    x=float(x)
    if u == 'BTC':
        x=x*380000.
    ans+=x
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(n):
    x,u=map(int,input().split())
    if u == 'BTC':
        x=x*380000.
    ans+=x
print(ans)
Problem p03239 (python)

Fixed submission:
N,T=map(int,input().split())
l=[]
for i in range(N):
    c,t=map(int,input().split())
    if t <= T:
        l.append(c)
if len(l) > 0:
    print(min(l))        
else:
    print("TLE")

Buggy submission (verdict: Runtime Error):
N,T=map(int,input().split())
l=[]
for i in range(N):
    c,t=map(int,input().split())
    if t <= T:
        l.append(c)
if len(c) > 0:
    print(min(c))        
else:
    print("TLE")
Problem p03294 (python)

Fixed submission:

from fractions import gcd
from functools import reduce


def lcm_base(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
a = list(map(int, input().split()))
ll = lcm_list(a) - 1
ans = 0
for i in a:
    ans += (ll % i)
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd
from functools import reduce


def lcm_base(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
a = list(map(int, input().split()))
ll = lcm_list(a) - 1
ans = 0
for i in a:
    ans += (ll % i)
print(ans)
Problem p03448 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == 500*i+100*j+50*k:
                ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,x=map(int,input().split())
ans=0
for i in range(a+1):
    for j i range(b+1):
        for k in range(c+1):
            if x == 500*i+100*j+50*k:
                ans+=1
print(ans)
Problem p03547 (python)

Fixed submission:
x,y=input().split()
if x>y:print(">")
elif x<y:print("<")
else:print("=")

Buggy submission (verdict: Runtime Error):
x,y=input().split()
if x>Y:print(">"):
elif x<Y:print("<")
else:print("=")
Problem p03610 (python)

Fixed submission:
print(input()[::2])

Buggy submission (verdict: Runtime Error):
print(input()[::2])

Buggy submission (verdict: Runtime Error):
s=input()
print(s[::2]
Problem p03624 (python)

Fixed submission:
import sys
s=list(input())
s=list(set(s))
s.sort()
s.append("eof")

for i in range(26):
    if chr(ord("a")+i)!=s[i]:
        print(chr(ord("a")+i))
        sys.exit()
print("None")

Buggy submission (verdict: Runtime Error):
import sys
s=list(input())
s=list(set(s))
s.sort()
#print(s)
for i in range(26):
    if chr(ord("a")+i)!=s[i]:
        print(chr(ord("a")+i))
        sys.exit()
print("None")
Problem p03633 (python)

Fixed submission:
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
n=int(input())
t=[int(input()) for i in range(n)] 
 
print(lcm_list(t))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n=int(input())
t=[int(input()) for i in range(n)] 

print(lcm_list(t))

Buggy submission (verdict: Runtime Error):
import fractions

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))

if n == 1:
    ans=1

if n > 1:
    ans=t[0]
    for j in range(1,n):
        ans=int(ans*t[j]/fractions.gcd(ans,t[j]))
    
print(ans)

Buggy submission (verdict: Runtime Error):
import math

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))

if n == 1:
    ans=1

if n > 1:
    ans=t[0]
    for j in range(1,n):
        ans=int(ans*t[j]/math.gcd(ans,t[j]))

Buggy submission (verdict: Runtime Error):
import math

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))

if n == 1:
    ans=1
else:
    ans=math.gcd(t[0],t[1])

if n > 2:
    for j in range(2,n):
        ans=math.gcd(ans,t[j])

seki=1
for i in t:
    seki=seki*i
    
print(int(seki/ans))

Buggy submission (verdict: Runtime Error):
import math

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))

if n == 1:
    ans=1
else:
    ans=math.gcd(t[0],t[1])

if n > 2:
    for j in range(2,n):
        ans=gcd(ans,t[j])

seki=1
for i in t:
    seki=seki*i
    
print(int(seki/ans))
Problem p03636 (python)

Fixed submission:
s=input()
n=len(s)-2
print(s[:1]+str(n)+s[-1:])

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)-2
print(s[:1]+str(n)+s[-1:])
Problem p03645 (python)

Fixed submission:
import sys
n,m=map(int,input().split())
a = [[int(i) for i in input().split()] for i in range(m)] 
c=[]
s=[]
a = sorted(a,key = lambda x:-x[1])

#print(a[0][0],a[0][1])
for i in range(m):
    if a[i][1] < n:
        break
    else:
        c.append(a[i][0])
c=set(c)
a = sorted(a,key = lambda x:x[0])
for i in range(m):
    if a[i][0] > 1:
        break
    else:
        s.append(a[i][1])

    #if a[i][1] in c:
s=set(s)

for i in s:
    if i in c:
        print("POSSIBLE")
        sys.exit()

print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
a = [[int(i) for i in input().split()] for i in range(m)] 
c=[]

a = sorted(li,key = lambda x:-x[1])


for i in range(m):
    if a[i][1] < n:
        break
    else:
        c.append(a[i][0])

a = sorted(li,key = lambda x:x[0])
for i in range(m):
    if a[i][0] > 1:
        break
    if a[i][1] in c:
            print("POSSIBLE")
            sys.exit()
        
print("IMPOSSIBLE")
Problem p03657 (python)

Fixed submission:
a, b = map(int, input().split())
if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a %3==0 or b%3== or (a+b)%3==0:
  print("Possible")
else:
  print("Impossible")
Problem p03658 (python)

Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
a=0
l.sort(reverse=True)
for i in range(k):
    a+=l[i]
print(a)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))
a=0
l.sort(reverse=True)
for i in range(k):
    a+=l[i]
print(a)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))
a=0
l.sort(reverse=True)
for i in range(k):
    a+=l[i]
print(a)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))
a=0
l.sort()
for i in range(k):
    a+=l[i]
print(l)
Problem p03694 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(a[n-1]-a[0])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(a[n]-a[0])
Problem p03695 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
rank = [0] * 9
for i in a:
    if i < 3200:
        rank[i // 400] += 1
    else:
        rank[8] += 1

s = 0
for i in range(8):
    if rank[i] > 0:
        s += 1
if s > 0:
    s1 = s
else:
    s1 = 1
s2 = s + rank[8]
print(s1, s2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
rank=[0]*9
for i in a:
    rank[i//400]+=1

s=0
for i in range(8):
    if rank[i]>0:
        s+=1
if s>0:
    s1=s
else:
    s1=1
s2=s+rank[8]
print(s1,s2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
rank=[0]*9
for i in a:
    rank[i//400]+=1

s=0
for i in range(8):
    if rank[i]>0:
        s+=1
if s>0:
    s1=s
else:
    s1=1
s2=s+rank[8]
print(s1,s2)
Problem p03998 (python)

Fixed submission:
sa=list(input())
sb=list(input())
sc=list(input())

n=sa.pop(0)
while True:
    if n == 'a':
        if len(sa)==0:
            print('A')
            break
        n=sa.pop(0)
    elif n == 'b':
        if len(sb)==0:
            print('B')
            break
        n=sb.pop(0)
    elif n == 'c':
        if len(sc)==0:
            print('C')
            break
        n=sc.pop(0)

Buggy submission (verdict: Runtime Error):
sa=list(input())
sb=list(input())
sc=list(input())

n=sa.pop(0)
while True:
    if n == 'a':
        if len(sa)==0:
            print('A')
            break
        n=sa.pop(0)
    elif n == 'b':
        if len(sa)==0:
            print('B')
            break
        n=sb.pop(0)
    elif n == 'c':
        if len(sa)==0:
            print('C')
            break
        n=sc.pop(0)
Problem p02687 (python)

Fixed submission:
s = input()
if s == 'ABC':
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'ABC':
    return 'ARC'
else:
    return 'ABC'