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

Fixed submission:
N = int(input())
nums = list(map(int, input().split()))
nodes = []
currentLeaf = 1
fail = False
#check from top
for i in range(N + 1):
	nodes.append(currentLeaf)
	currentLeaf = (currentLeaf-nums[i])*2
	if (currentLeaf < 0):
		fail = True
		break 
if (fail):
	print(-1)
else:
  #check from bottom
  currentLeaf = 0
  totalNode = 0
  for i in reversed(range(N+1)):
      currentLeaf += nums[i]
      currentLeaf = min(currentLeaf, nodes[i])
      totalNode += currentLeaf

  if (fail):
      print(-1) 
  else:
      print(totalNode)

Buggy submission (verdict: Runtime Error):
N = int(input())
nums = list(map(int, input().split()))
nodes = []
currentLeaf = 1
fail = False
#check from top
for i in range(N + 1):
	nodes.append(currentLeaf)
	currentLeaf = (currentLeaf-nums[i])*2
	if (currentLeaf < 0):
		fail = True
		break 
if (fail):
	print(-1)
#check from bottom
currentLeaf = 0
totalNode = 0
for i in reversed(range(N+1)):
	currentLeaf += nums[i]
	currentLeaf = min(currentLeaf, nodes[i])
	totalNode += currentLeaf

if (fail):
	print(-1) 
else:
	print(totalNode)
Problem p02677 (python)

Fixed submission:
import math 
A, B, H, M = map(int,input().split())

timeHr = H + (M / 60)
angVelA = (1/6) * 180
angVelB = (2) * 180

degA = (angVelA * timeHr)
degB = (angVelB * timeHr) 

degDiff = math.radians(abs(degB - degA))

disX_2 = math.pow(B, 2) + math.pow(A, 2) - (2 * A * B * math.cos(degDiff))
disX = math.sqrt(disX_2)

print(disX)

Buggy submission (verdict: Runtime Error):
import math 
A, B, H, M = map(int,input().split())

timeHr = H + (M / 60)
angVelA = (1/6) * 180
angVelB = (2) * 180

degA = (angVelA * timeHr)
degB = (angVelB * timeHr) 

defDiff = math.radians(abs(degB - degA))

disX_2 = math.pow(B, 2) + math.pow(A, 2) - (2 * A * B * math.cos(degDiff))
disX = math.sqrt(disX_2)

print(disX)
Problem p02713 (python)

Fixed submission:
import math
K = int(input())
sum = 0
for i in range(1, K+1):
  for j in range(i, K+1):
    #2i or 3i
    if (i == j):
      for k in range(i, K+1):
        #print("i"+str(i)+"j"+str(j)+"k"+str(k))
        if ((i == j) and (i == k)):
          sum += math.gcd(i, math.gcd(j, k))
        else:
          sum += (3*math.gcd(i, math.gcd(j, k)))
    #1i
    else:
      for k in range(i+1, K+1):
        #print("i"+str(i)+"j"+str(j)+"k"+str(k))
        sum += (3*math.gcd(i, math.gcd(j, k)))
      
print(sum)

Buggy submission (verdict: Runtime Error):
a = input()
a = int(a)
sum = 0
for i in range(1,a+1):
  for j in range(1,a+1):
    for k in range(1,a+1):
      for b in [a:0:-1]:
        if i%b==0 and j%b==0 and k%b==0:
          sum += b
print(b)
Problem p02718 (python)

Fixed submission:
N, M = input().split()
N= int(N)
M = int(M)
itemList = list(map(int, input().split()))
itemList.sort()
index = -1
answer = True
for i in range(M):
  if itemList[index] < (sum(itemList)*(1/(4*M))):
    answer = False
    break
  index -= 1
  
if answer:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N, M = input().split()
N= int(N)
M = int(M)
itemList = input().split()
itemList.sort()
index = -1
answer = true
for i in range(M):
  if itemList[index] < (N*(1/(4*M))):
    answer = false
    break
  index -= 1
  
if answer:
  print("Yes")
else:
  print("No")
Problem p02719 (python)

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

middle = N % K
answer = middle
while True:
  if abs(answer-K) > N:
    answer = N
    break
  if abs(answer - K) < answer:
    answer = abs(answer-K)
  else:
    break
    
print(str(answer))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
N = N%K
min_num = 0
while True:
  if (N==0):
    min_num = N
    break
  elif N in history:
    min_num = min(history)
    break 
  history.append(N)
  N = abs(N-K)

print(min_num)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
N = N%K
min_num = 0
while True:
  if (N==0):
    min_num = N
    break
  elif N in history:
    min_num = min(history)
    break 
  history.append(N)
  N = abs(N-K)

print(min_num)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
N = N%K
while True:
  if (N==0):
    min_num = N
    break
  elif N in history:
    min_num = min(history)
    break 
  history.append(N)
  N = abs(N-K)

print(min_num)

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

middle = N % K
answer = middle
while True:
  if abs(answer-k) > N:
    answer = N
    break
  if abs(answer - K) < answer:
    answer = abs(answer-K)
  else:
    break
    
print(str(answer))
Problem p02730 (python)

Fixed submission:
wholeString = input()
firstSub = wholeString[0:int((len(wholeString)-1)/2)]
secondSub = wholeString[int(((len(wholeString)+3)/2)-1):]

if len(wholeString) % 2 == 0 or len(wholeString) < 3 or len(wholeString) > 99:
  print("No")
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1] and wholeString == wholeString[::-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
wholeString = input()
firstSub = wholeString[0:int((len(wholeString)-1)/2)]
secondSub = wholeString[int(((len(wholeString)+3)/2)-1):]

if len(wholeString) % 2 == 0 or len(wholeString) < 3 or len(wholeString) > 99:
  print("No")
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1] and wholString == wholeString[::-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
wholeString = input()
firstSub = wholeString[0:(len(wholeString)-1)/2]
secondSub = wholeString[((len(wholeString)+3)/2)-1:]
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1]:
  print("Yes")
else:
  print("No")
Problem p02741 (python)

Fixed submission:
li = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(li[int(input())-1])

Buggy submission (verdict: Runtime Error):
li = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(li[input()-1])
Problem p02743 (python)

Fixed submission:
from decimal import *
num1, num2, num3 = map(int, input().split())
num1 = Decimal(num1)
num2 = Decimal(num2)
num3 = Decimal(num3)
if (num1.sqrt() + num2.sqrt() < num3.sqrt()):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
from decimal import *
num1, num2, num3 = map(int, input().split())
num1 = Decimal(num1)
num2 = Decimal(num2)
num3 = Decimal(num3)
if (num.sqrt() + num2.sqrt() < num3.sqrt()):
  print("Yes")
else:
  print("No")
Problem p02756 (python)

Fixed submission:
from collections import deque

S = deque(input())
queryNum = input()
flip = False
for i in range(int(queryNum)):
	order = input()
	if order == '1':
		if flip:
			flip = False
		else:
			flip = True
	else:
		if order[2] == '1':
			if not flip:
				S.appendleft(order[4])
			elif flip:
				S.append(order[4])
		else:
			if not flip:
				S.append(order[4])
			elif flip:
				S.appendleft(order[4])
S = ''.join(S)
if flip:
	print(S[::-1])
else: 
	print(S)

Buggy submission (verdict: Runtime Error):
from collections import deque

S = deque(input())
queryNum = input()
flip = False
for i in range(int(queryNum)):
	order = input()
	if order == '1':
		if flip:
			flip = False
		else:
			flip = True
	else:
		if order[2] == '1':
			if not flip:
				S.appendleft(order[4])
			elif flip:
				S.appendright(order[4])
		else:
			if not flip:
				S.appendright(order[4])
			elif flip:
				S.appendleft(order[4])
S = ''.join(S)
if flip:
	print(S[::-1])
else: 
	print(S)

Buggy submission (verdict: Runtime Error):
from collections import deque

S = deque(input())
queryNum = input()
flip = False
for i in range(int(queryNum)):
	order = input()
	if order == '1':
		if flip:
			flip = False
		else:
			flip = True
	else:
		if order[2] == '1':
			if not flip:
				S.appendleft(order[4])
			elif flip:
				S.appendright(order[4])
		else:
			if not flip:
				S.appendright(order[4])
			elif flip:
				S.appendleft(order[4])
S = ''.join(S)
if flip:
	print(S[::-1])
else: 
	print(S)

Buggy submission (verdict: Runtime Error):
S = input()
queryNum = input()
for i in queryNum:
	order = input()
	if order == 1:
		S = S[::-1]
	else:
		if order[0] == 1:
			S = order[2] + S
		else:
			S = S + order[2]
print(S)
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
num = ['']*N
valid = True
#create number from input
for i in range(M):
  s, c = map(int, input().split())
  if (num[s-1] == ''):
    num[s-1] = c
  elif (num[s-1] != c):
    valid = False
    break
#check whether 0 is at front
if (N > 1):
  if (num[0]==0):
    valid = False
  
if valid:
  #fill the blank parts
  for i in range(N):
    if (num[i] == ''):
      if (i == 0):
        if (N == 1):
          num[i] = 0
        else:
          num[i] = 1
      else:
      	num[i] = 0
  #convert list to number
  answer = 0
  for i in range(N):
    answer *= 10
    answer += num[i]
  print(answer)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
num = ['']*N
valid = True
#create number from input
for i in range(M):
  s, c = map(int, input().split())
  if (num[s-1] == ''):
    num[s-1] = c
  elif (num[s-1] != c):
    valid = False
    break
#check whether 0 is at front
if (N > 1):
  if (num[0]==0):
    valid = False
  
if valid:
  #fill the blank parts
  for i in range(N):
    if (num[i] == ''):
      if (i == 0):
        num[i] == 1
      else:
      	num[i] = 0
  #convert list to number
  answer = 0
  for i in range(N):
    answer *= 10
    answer += num[i]
  print(answer)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
num = ['']*N
valid = True
#create number from input
for i in range(M):
  s, c = map(int, input().split())
  if (num[s-1] == ''):
    num[s-1] = c
  elif (num[s-1] != c):
    valid = False
    break
#check whether 0 is at front
if (N > 1):
  if (num[0]==0):
    valid = False
  
if valid:
  #fill the blank parts
  for i in range(0,N):
    if (num[i] == ''):
      if (i == 0):
        num[i] == 1
      else:
      	num[i] = 0
  #convert list to number
  answer = 0
  for i in range(N):
    answer *= 10
    answer += num[i]
  print(answer)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
num = ['']*N
valid = True
#create number from input
for i in range(M):
  s, c = map(int, input().split())
  if (num[s-1] == ''):
    num[s-1] = c
  elif (num[s-1] != c):
    valid = False
    break
#check whether 0 is at front
if (N > 1):
  if (num[0]==0):
    valid = False
  
if valid:
  first = True
  #fill the blank parts
  if (num[0]==''):
    num[0]==1
  for i in range(1,N):
    num[i] = 0
  #convert list to number
  answer = 0
  for i in range(N):
    answer *= 10
    answer += num[i]
  print(answer)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
num = ['']*N
valid = True
#create number from input
for i in range(M):
  s, c = map(int, input().split())
  if (num[s-1] == ''):
    num[s-1] = c
  elif (num[s-1] != c):
    valid = False
    break
#check whether 0 is at front
if (N > 1):
  if (num[0]==0):
    valid = False
  
if valid:
  first = True
  #fill the blank parts
  if (num[0]==''):
    num[0]==1
  for i in range(1,N):
    num[i] = 1
  #convert list to number
  answer = 0
  for i in range(N):
    answer *= 10
    answer += num[i]
  print(answer)
else:
  print(-1)
Problem p02678 (python)

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(10000000)
N, M = map(int, input().split())
class tree():
    def __init__(self):
        self.num = 0
        self.flag = 0
        self.step = -1
        self.leaf = []

li = [tree() for i in range(N)]
def saiki(que, step):
    pop = que.popleft()
    li[pop].flag = 2


    for i in range(len(li[pop].leaf)):
        if li[li[pop].leaf[i]].flag == 0:
            que.append(li[pop].leaf[i])
            li[li[pop].leaf[i]].flag = 1
            if li[li[pop].leaf[i]].step != -1:
                if li[li[pop].leaf[i]].step > li[pop].step + 1:
                    li[li[pop].leaf[i]].step = li[pop].step + 1
                    li[li[pop].leaf[i]].num = pop
            else:
                li[li[pop].leaf[i]].step = li[pop].step + 1
                li[li[pop].leaf[i]].num = pop


    #print(que)
    if len(que) != 0:
        saiki(que, li[pop].step)
for i in range(M):
    A, B = map(int, input().split())
    li[A-1].leaf.append(B-1)
    li[B-1].leaf.append(A-1)

que = deque()
que.append(0)
li[0].step = 0
saiki(que, 0)
flag = 1

for i in range(len(li)):
    if li[i].flag == 0:
        flag = 0
        break
if flag == 0:
    print("No")
else:
    print("Yes")
for i in range(1, len(li)):
    print(li[i].num+1)

Buggy submission (verdict: Runtime Error):
from collections import deque
N, M = map(int, input().split())
class tree():
    def __init__(self):
        self.num = 0
        self.flag = 0
        self.step = -1
        self.leaf = []

li = [tree() for i in range(N)]
def saiki(que, step):
    pop = que.pop()
    li[pop].flag = 2


    for i in range(len(li[pop].leaf)):
        if li[li[pop].leaf[i]].flag == 0:
            que.append(li[pop].leaf[i])
            li[li[pop].leaf[i]].flag = 1
            if li[li[pop].leaf[i]].step != -1:
                if li[li[pop].leaf[i]].step > li[pop].step + 1:
                    li[li[pop].leaf[i]].step = li[pop].step + 1
                    li[li[pop].leaf[i]].num = pop
            else:
                li[li[pop].leaf[i]].step = li[pop].step + 1
                li[li[pop].leaf[i]].num = pop


    #print(que)
    if len(que) != 0:
        saiki(que, li[pop].step)
for i in range(M):
    A, B = map(int, input().split())
    li[A-1].leaf.append(B-1)
    li[B-1].leaf.append(A-1)

que = deque()
que.append(0)
li[0].step = 0
saiki(que, 0)
flag = 1
for i in range(len(li)):
    if li[i].flag == 0:
        flag = 0
        break
if flag == 0:
    print("No")
else:
    print("Yes")
for i in range(1, len(li)):
    print(li[i].num+1)
Problem p02730 (python)

Fixed submission:
S = input()
def kaibun(st):
    stre = st[::-1]
    if st == stre:
        return 1
    else:
        return 0

if kaibun(S[0:(len(S)-1) // 2]) and kaibun(S) and kaibun(S[(len(S)+3) // 2-1:len(S)]):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
def kaibun(st):
    stre = st[::-1]
    if st == stre:
        return 1
    else:
        return 0

if kaibun(S[0:(len(S)-1) // 2]) and kaibun(S) and kaibun(S[(len(S)+3) // 2]):
    print("Yes")
else:
    print("No")
Problem p02909 (python)

Fixed submission:
S = input()

if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
else:
    print("Sunny")

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

A = list(map(int, input().split()))
def soujyuu(left, right, num):
    if right - left <= 1:
        A.insert(right, num)
    else:
        if num >= A[left + right // 2]:
            left = left + right // 2
        else:
            right = left + right // 2
        soujyuu(left, right, num)


A.sort()
for i in range(M):
    maxA = A.pop(N-1)
    maxA = maxA // 2
    soujyuu(0,N-2, maxA)
    #print(A)

print(sum(A))
Problem p02981 (python)

Fixed submission:
N, A, B = map(int, input().split())
sume = N * A
print(min(B, sume))

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
m = 673
if R // m - (L - 1) // m != 0:
    print(0)
else:
    minnum = 1000
    Lmod = L % m
    Rmod = R % m
    for i in range(Lmod, Rmod+1):
        for j in range(i + 1, Rmod+1):
            #print(i, j, (i * j) % 2019)
            minnum = min(minnum, (i * j) % 2019)
    print(minnum)
Problem p02993 (python)

Fixed submission:
S = int(input())

a = S % 10
b = int((S % 100) / 10)
c = int(S % 1000 / 100)
d = int(S / 1000)

if a == b or b == c or c == d:
    print("Bad")
else:
    print("Good")

Buggy submission (verdict: Runtime Error):
def saidaikouyaku(a, b):
    if b > a:
        a, b = b, a

    while b != 0:
        a, b=b,(a%b)
    return a

A, B, C, D = map(int, input().split())
hani = B - A + 1
Cnum = int(B / C) - int((A - 1) / C)
Dnum = int(B / D) - int((A - 1) / D)
saisyoukoubai = int(C * D / saidaikouyaku(C, D))
koubainum = int(B / saisyoukoubai) - int((A - 1) / saisyoukoubai)
#print(hani)
#print(Cnum, Dnum, koubainum, saisyoukoubai)
print(hani - Cnum - Dnum + koubainum)
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(int, input().split())
a = float(W * H / 2)
flag = 0
if x == 0 or y == 0 or x == W or y == H:
    falg = 0
else:
    if x == W / 2 and y == H / 2:
        flag = 1
    else:
        flag = 0
print(a, flag)

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
a = float(W * H / 2)
if x == 0 or y == 0 or x == W or y == H:
    falg = 0
else:
    if x == W / 2 and y == H / 2:
        flag = 1
    else:
        flag = 0
print(a, flag)
Problem p03005 (python)

Fixed submission:
N, K = map(int, input().split())
if K == 1:
    print(0)
else:
    print(N - K)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
A = []
B = []
YHASHNUM = 1000000000
for i in range(N):
    A.append(list(map(int, input().split())))
#print(N, A)
if N == 1:
    print(1)
else:
    for i in A:
        #print(i[0], i[1])
        for j in A:
            if i == j:
                continue
            B.append(i[0] - j[0] + (i[1] - j[1]) * YHASHNUM)
    #print(B)
    C = collections.Counter(B)
    print(N - C.most_common()[0][1])
Problem p03006 (python)

Fixed submission:
import collections
N = int(input())
A = []
B = []
YHASHNUM = 1000000000
for i in range(N):
    A.append(list(map(int, input().split())))
#print(N, A)
if N == 1:
    print(1)
else:
    for i in A:
        #print(i[0], i[1])
        for j in A:
            if i == j:
                continue
            B.append(i[0] - j[0] + (i[1] - j[1]) * YHASHNUM)
    #print(B)
    C = collections.Counter(B)
    print(N - C.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
A = []
B = []
YHASHNUM = 1000000000
for i in range(N):
    A.append(list(map(int, input().split())))
#print(N, A)
for i in A:
    #print(i[0], i[1])
    for j in A:
        if i == j:
            continue
        B.append(i[0] - j[0] + (i[1] - j[1]) * YHASHNUM)
#print(B)
C = collections.Counter(B)
print(N - C.most_common()[0][1])
Problem p03495 (python)

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

#print(N, K, A)
A2 = [0] * N
for i in range(len(A)):
    A2[A[i]-1] += 1

A2.sort(reverse = True)
#print(A2)
count = 0
for i in range(K):
    count += A2[i]
print(N - count)

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

#print(N, K, A)
A2 = [0] * N
for i in range(len(A)):
    A2[A[i]] += 1

A2.sort(reverse = True)
print(A2)
count = 0
for i in range(K):
    count += A2[i]
print(N - count)
Problem p02642 (python)

Fixed submission:
N = int(input())
array = list(map(int, input().strip().split()))
array.sort()
ans = 0
a = [True] * (10**6 + 1)
i = 0
before = 0
for i in array:
    if a[i] == True:
        j = 2*i
        if i == before:
            a[i] = False
        while j <= array[N-1]:
            a[j] = False
            j += i
        before = i
for i in array:
    if a[i] == True:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
array = list(map(int, input().strip().split()))
array.sort()
ans = 0
a = [True] * array[N-1]
i = 0
before = 0
for i in array:
    j = 2*i
    if i == before:
        array[i] == False
    while j < array[N-1]:
        array[j] == False
        j += i
    before = i
for i in array:
    if array[i] == True:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
array = list(map(int, input().strip().split()))
array.sort()
ans = 0
a = [True] * array{N}
i = 0
before = 0
for i in array:
    j = 2*i
    if i == before:
        array[i] == False
    while j < array[N]:
        array[j] == False
        j += i
    before = i
for i in array:
    if array[i] == True:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
array = list(map(int, input().strip().split()))
array.sort()
ans = N
a = [True] * N
i = 0
for i in range(len(array)):
    j = i + 1
    while j < len(array):
        if (array[j] % array[i] == 0 or array[j] == array[i]):
            array.pop(j)
            ans -= 1
            if j == len(array) -1:
                break
        else:
            j += 1
if (array[len(array)-1] == array[len(array)-2]):
    ans -= 1
if (array[0] == array[1]):
    ans -= 1
print(ans)
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
cnt = 0
for i in range(3):
  if s[i] == t[i]:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()


cnt = 0
for i in range(3):
  if a[i]== b[i]:
    cnt += 1
pint(cnt)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()


cnt = 0
for i in range(3):
  if a[i]== b[i]:
    cnt += 1
pint(cnt)
Problem p02811 (python)

Fixed submission:
K, X = map(int, input().split())
print("Yes" if K * 500 >= X else "No")

Buggy submission (verdict: Runtime Error):
K, X = map(int, intpu().split())
print("Yes" if K * 400 >= X else "No")
Problem p03078 (python)

Fixed submission:
numbers = input().split()
x = input().split()
y = input().split()
z = input().split()

k = int(numbers[3])

answer = []
for i in x:
    for j in y:
        price = int(i)+int(j)
        answer.append(price)
answer.sort(reverse=True)
del answer[k::]
f_ans = []
for m in answer:
    for n in z:
        price = m + int(n)
        f_ans.append(price)

f_ans.sort(reverse=True)
del f_ans[k::]

for l in f_ans:
    print(l)

Buggy submission (verdict: Runtime Error):
import numpy as np
numbers = input().split()
x = input().split()
y = input().split()
z = input().split()

k = int(numbers[3])
x.sort(reverse=True)
y.sort(reverse=True)
z.sort(reverse=True)

answer = []
for i in x:
    for j in y:
        price = int(i)+int(j)
        answer.append(price)
del answer[k::]
for m in range(k):
    answer[m] = answer[m] + z[m]

"""
answer.sort(reverse=True)
del answer[k::]
"""
for l in answer:
    print(l)

Buggy submission (verdict: Runtime Error):
numbers = input().split()
x = input().split()
y = input().split()
z = input().split()

k = int(numbers[3])


def cutting(c, k):
    del c[k::]


x.sort(reverse=True)
cutting(x)
y.sort(reverse=True)
cutting(y)
z.sort(reverse=True)
cutting(z)

answer = []

for i in x:
    for j in y:
        for m in z:
            price = int(i)+int(j)+int(m)
            answer.append(price)

answer.sort(reverse=True)
del answer[k::]

for l in answer:
    print(l)

Buggy submission (verdict: Runtime Error):
numbers = input().split()
x = input().split()
y = input().split()
z = input().split()

k = int(numbers[3])

x.sort(reverse=True)
if len(x) > k:
    del x[k::]
y.sort(reverse=True)
if len(y) > k:
    del y[k::]
z.sort(reverse=True)
if len(z) > k:
    del z[k::]

answer = []

for i in x:
    for j in y:
        price = int(i)+int(j)
        answer.append(price)
answer[k::]

for m, mn in enumerate(z):
    price = answer[m] + mn
    answer.append(price)

answer.sort(reverse=True)
del answer[int(numbers[3])::]

for l in answer:
    print(l)
Problem p02717 (python)

Fixed submission:
s = input().split()
print(s[2],s[0],s[1])

Buggy submission (verdict: Runtime Error):
num = []
vote = []
num = list(map(int,input().split()))
vote = list(map(int,input().split()))
N = num[0]
M = num[1]
j = (sum(vote)/(4*M)
#print(j)

cnt = 0
for i in vote:
    if  i>=j:
        cnt += 1
    else:
        pass
#print(cnt)
if M<=cnt:
    print("Yes")
else:
    print("No")
Problem p02899 (python)

Fixed submission:
import numpy as np
N = int(input())

x = np.array(list(map(int,input().split())),dtype=np.int)

print (*np.argsort(x)+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int,input().split()))


x = np.array(A)

for i in range(len(x)):
    print (np.argsort(x)[i]+1,"",end="")