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

Fixed submission:
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N, M = map(int, readline().split())
lines = readlines()
edge = np.array([line.split() for line in lines], dtype = np.int64)
edge = sorted(edge,key=lambda x:(x[0],x[1],x[2]))

for i in range(1,M):
  if edge[i][0] == edge[i-1][0] and edge[i][1] == edge[i-1][1]:
    edge[i][2] = 0
#print(edge)
x = np.arange(N,1,-1)
y = np.arange(N-1,0,-1)
z = np.zeros(N-1,int)
X = np.vstack([x,y,z]).T
edge = np.concatenate([X,edge]).T
graph = csr_matrix((edge[2], (edge[:2] - 1)), (N, N))
distance_mat = dijkstra(graph, directed = True, indices = 0)
#print(distance_mat)
print(-1 if distance_mat[-1] == float("inf") else int(distance_mat[-1]))

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

N, M = map(int, input().split())
edge = np.array([input().split() for _ in range(M)], dtype = np.int64)
edge = sorted(edge,key=lambda x:(x[0],x[1],x[2]))

edge2 = np.array(edge[0])
for i in range(1,M):
  if edge[i][0] == edge[i-1][0] and edge[i][1] == edge[i-1][1]:
    continue
  edge2 = np.vstack([edge2,edge[i]])

x = np.arange(N,1,-1)
y = np.arange(N-1,0,-1)
z = np.zeros(N-1,int)
X = np.vstack([x,y,z]).T
edge2 = np.concatenate([X,edge2]).T
graph = csr_matrix((edge2[2], (edge2[:2] - 1)), (N, N))
distance_mat = dijkstra(graph, directed = True, indices = 0)
#print(distance_mat)
print(-1 if distance_mat[-1] == float("inf") else int(distance_mat[-1]))
Problem p02883 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N,K = map(int,readline().split())
A = np.array(readline().split(),np.int64)
F = np.array(readline().split(),np.int64)

A.sort(); F.sort(); F=F[::-1]

def test(x):
    return np.maximum(0,A-x//F).sum() <= K

left = -1
right = 10**13
while left+1 < right:
    mid = (left+right)//2
    if test(mid):
        right = mid
    else:
        left = mid
answer = right
print(answer)

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
A = list(map(int,input().split()))
F = list(map(int,input().split()))
X = []
A = sorted(A)
F = sorted(F)[::-1]
for i in range(N):
  X.append([A[i] * F[i],A[i],F[i]])

import heapq
from heapq import heapify

heapq._heapify_max(X)

def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    lastelt = heap.pop()
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt
  
for i in range(K):
    x = _heappop_max(X)
    if x[0] < 1:
        _heappush_max(X,x)
        break
    else:       
        x[1] -= 1
        x[0] = x[1] * x[2]
        _heappush_max(X,x)
from operator import itemgetter
X.sort(key=itemgetter(0))
print(X[-1][0])

Buggy submission (verdict: Runtime Error):
import copy
N, K = map(int,input().split())
A = list(map(int,input().split()))
F = list(map(int,input().split()))
X = []
A = sorted(A)
F = sorted(F)[::-1]
for i in range(N):
  X.append(A[i] * F[i])
XX = copy.deepcopy(X)

import heapq
from heapq import heapify

heapq._heapify_max(X)

def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    lastelt = heap.pop()
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

for i in range(K):
    x = _heappop_max(X)
    id = XX.index(x)
    if x < 1:
        _heappush_max(X,x)
        break
    else:
        A[id] -= 1
        x = A[id] * F[id]
        XX[id] = x
        _heappush_max(X,x)

print(max(X))
Problem p02924 (python)

Fixed submission:
n = int(input())
print(n*(n-1)//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
dp = [0] * (n+1) 
for i in range(2,n+1):
  dp[i] = dp[i-1]+(i-1)
print(dp[-1])
Problem p02945 (python)

Fixed submission:
A,B = map(int,input().split())
print(max(A + B, A - B,A * B))

Buggy submission (verdict: Runtime Error):
print(max(A + B,A - B,A * B))
Problem p02946 (python)

Fixed submission:
K,X = map(int,input().split())
for i in range(X-(K-1),X+K):
  print(str(i) + " ")

Buggy submission (verdict: Runtime Error):
K,X = map(int,input().split())
for i in range(X-(K-1),X+K):
  print(i + " ")

Buggy submission (verdict: Runtime Error):
K,X = map(int,input().split())
for i in range(X-(K-1),X+(K-1)):
  print(i + " ")

Buggy submission (verdict: Runtime Error):
K,X = map(int,input().split())
for i in range(X-(K-1),X+(K+1)):
  print(i + " ")

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

for i in range(X-(K-1),X+(K+1)):
  print(i + " ")
Problem p02975 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
flag = False
x = len(set(A))
if x == 1 and A[0] == 0:
  flag = True
elif x == 2 and A.count(0) == N // 3:
  flag = True
elif x == 3:
  X = A[0]
  Y = -1
  Z = -1
  i = 1
  while i < N:
    if A[i] != X:
      Y = A[i]
      break
    i += 1
  while i < N:
    if A[i] != X and A[i] != Y:
      Z = A[i]
    i += 1
  if X ^ Y ^ Z == 0 and A.count(X)  == N // 3 and A.count(Y)  == N // 3:
    flag = True
print("Yes" if flag else "No")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input()
A = int(eval(A.replace(" ","^")))
print(A)
print("Yes" if A == 0 else "No")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input()
A = eval(A.replace(" ","^"))
print(A)
print("Yes" if A == 0 else "No")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input()
A = eval(A.replace(" ","^"))
#print(A)
print("Yes" if not A else "No")
Problem p03060 (python)

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

total_v = 0

for i in range(n):
  if v[i] - c[i] > 0:
    total_v += (v[i] - c[i])

print(total_v)

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

total_v = 0

for i in range(n-1)
	if v[i] - c[i] > 0:
    	total_v += v[i] - c[i]
print(total_v)

Buggy submission (verdict: Runtime Error):
n = int(input())
v = list(map(int,input()))
c = list(map(int,input()))

total_v = 0

for i in range(n-1)
	if v[i] - c[i] > 0:
    	total_v += v[i] - c[i]
print(total_v)
Problem p03101 (python)

Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split())
print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split)
h,w = map(int,input().split)
print((H*W)-(h*w))
Problem p03126 (python)

Fixed submission:
n,m = map(int,input().split())
food = [0]*(m+1)
for i in range(n):
  k,*a = map(int,input().split())
  for j in range(k):
    food[a[j]]+=1
print(food.count(n))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
food = [0]*m
for i in range(n):
  k,*a = map(int,input().split())
  for j in range(k):
    food[a[j]]+=1
print(food.count(n))
Problem p03136 (python)

Fixed submission:
n = int(input())
L = list(map(int,input().split()))
print("Yes" if max(L)<sum(L)-max(L) else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
L = map(int,input().split())
print("Yes" if max(L)<sum(L)-max(L) else "No")
Problem p03239 (python)

Fixed submission:
n,tl = map(int,input().split())
cost = []
time = []
cost2 = []
for i in range(n):
  c,t = map(int,input().split())
  cost.append(c)
  time.append(t)
for y,z in zip(cost,time):
  if z<=tl:
    cost2.append(y)    
print("TLE" if min(time)>tl else min(cost2))

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split())
cost = 1001
for i in range(N):
  c,t = map(int,input().split())
  if t<=T:cost=min(m,c)
print("TLE" if cost==1001 else m)

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split())
cost = 1001
for i in range(n):
  c,t = map(int,input().split())
  if t<=T:cost=min(m,c)
print("TLE" if cost==1001 else m)
Problem p03243 (python)

Fixed submission:
n = int(input())
for i in range(n,1000):
  I = str(i)
  if I[0]==I[1]==I[2]:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(n,1000):
  if i[0]==i[1]==i[2]:
    return i
print(i)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
key = []
if S.count("1") == len(S):
  print(1)
else:
  for i in range(len(S)):
    if S[i] != "1":
      key.append([i,S[i]])
      break
  if K - 1 < key[0][0]:
    print(1)
  else:
    print(key[0][1])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
key = []
for i in range(len(S)):
  if S[i] != "1":
    key.append([i,S[i]])
    break
if K < key[0][0]:
  print(1)
else:
  print(key[0][1])
Problem p03425 (python)

Fixed submission:
N = int(input())
M = 0
A = 0
R = 0
C = 0
H = 0

for _ in range(N):
  tmp = input()[0]
  if tmp == "M":
    M += 1
  elif tmp == "A":
    A += 1
  elif tmp == "R":
    R += 1
  elif tmp == "C":
    C += 1
  elif tmp == "H":
    H += 1

ans = 0
ans += M * A * C
ans += M * A * R
ans += M * A * H
ans += M * R * C
ans += M * R * H
ans += M * C * H
ans += A * R * C
ans += A * R * H
ans += A * C * H
ans += R * C * H

print(ans)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

N = int(input())
M = []
A = []
R = []
C = []
H = []
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

for _ in range(N):
  tmp = input()[0]
  if tmp == "M":
    M.append(tmp)
  elif tmp == "A":
    A.append(tmp)
  elif tmp == "R":
    R.append(tmp)
  elif tmp == "C":
    C.append(tmp)
  elif tmp == "H":
    H.append(tmp)
X = [len(M),len(A),len(R),len(C),len(H)]
Y = sum(X)
if Y == 0:
  print(0)
  exit()
Sum = cmb(X[0]+X[1]+X[2]+X[3]+X[4],3)

count_A = 0
for x in X:
  if x >= 3:
    count += 1

count_B = 0
for i in X:
  if i >= 2:
    count_B += cmb(i,2) * (Y - i)

print(Sum - count_A - count_B)
Problem p03469 (python)

Fixed submission:
s = input()
print("2018"+s[4:])

Buggy submission (verdict: Runtime Error):
s = input()
s[3] = "8"
print(s)
Problem p03477 (python)

Fixed submission:
A,B,C,D = map(int,input().split())
print("Left" if A + B > C + D else "Balanced" if A + B == C + D else "Right")

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split)
print("Left" if A + B > C + D else "Balanced" if A + B == C + D else "Right")
Problem p03502 (python)

Fixed submission:
n = input()
print("Yes" if int(n)%sum(map(int,n))==0 else "No")

Buggy submission (verdict: Runtime Error):
n = input()
print("Yes" if n%sum(map(int,n))==0 else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
print("Yes" if n%sum(map(int,n))==0 else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
print("Yes" if sum(map(int,n))%n==0 else "No")
Problem p03523 (python)

Fixed submission:
S = list(input())
if S[0] != "A":
  S.insert(0,"A")
if len(S) < 5:
  print("NO")
  exit()
if S[4] != "A":
  S.insert(4,"A")
if len(S) < 7:
  print("NO")
  exit()
if S[6] != "A":
  S.insert(6,"A")
if len(S) < 5:
  print("NO")
  exit()
if len(S) < 8:
  print("NO")
  exit()
if S[-1] != "A":
  S.append("A")
s = ""
for i in S:
  s += i
print("YES" if s == "AKIHABARA" else "NO")

Buggy submission (verdict: Runtime Error):
S = list(input())
if S[0] != "A":
  S.insert(0,"A")
if S[4] != "A":
  S.insert(4,"A")
if S[6] != "A":
  S.insert(6,"A")
if S[-1] != "A":
  S.append("A")
s = ""
for i in S:
  s += i
print("YES" if s == "AKIHABARA" else "NO")
Problem p03543 (python)

Fixed submission:
n = input()
print("Yes" if n[0]==n[1]==n[2]==n[3] or n[0]==n[1]==n[2] or n[1]==n[2]==n[3] else "No")

Buggy submission (verdict: Runtime Error):
n = input()
print("Yes" if n[0]=n[1]=n[2]=n[3] or n[0]=n[1]=n[2] or n[1]=n[2]=n[3] else "No")

Buggy submission (verdict: Runtime Error):
n = input()
print("Yes" if n[0]=n[1]=n[2]=n[3] or n[0]=n[1]=n[2] or n[0]=n[2]=n[3] or n[0]=n[1]=n[3] else "No")
Problem p03597 (python)

Fixed submission:
N = int(input())
A = int(input())
print((N**2)-A)

Buggy submission (verdict: Runtime Error):
N,A = map(int,input().split())
print((N**N)-A)
Problem p03605 (python)

Fixed submission:
N = input()
if "9" in N:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
if 9 in N:
  print("YES")
else:
  print("NO")
Problem p03636 (python)

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

Buggy submission (verdict: Runtime Error):
a,*b,c = input()split()
print(a+str(len(b))+c)
Problem p03651 (python)

Fixed submission:
import fractions
from functools import reduce
N,K = map(int,input().split())
A = list(map(int,input().split()))
if max(A) < K:
  print("IMPOSSIBLE")
elif N == 1:
  if A[0] == K:
    print("POSSIBLE")
  else:
    print("IMPOSSIBLE")
else:
  G = fractions.gcd(A[0],A[1])
  for g in range(2,N):
    G = fractions.gcd(G,A[g])
  if K % G != 0:
    print("IMPOSSIBLE")
  else:
    print("POSSIBLE")

Buggy submission (verdict: Runtime Error):
import fractions
N,K = map(int,input().split())
A = sorted(list(map(int,input().split())))[::-1]
#print(A)
if A[0] < K:
  print("IMPOSSIBLE")
  exit()
else:
  G = fractions.gcd(A[0],A[1])
  for g in range(2,N):
    G = fractions.gcd(G,A[g])
  print(G)
  if K % G != 0:
    print("IMPOSSIBLE")
    exit()
print("POSSIBLE")

Buggy submission (verdict: Runtime Error):
import fractions
N,K = map(int,input().split())
A = sorted(list(map(int,input().split())))[::-1]
#print(A)
if A[0] < K:
  print("IMPOSSIBLE")
  exit()
else:
  G = fractions.gcd(A[0],A[1])
  for g in range(1,N):
    G = fractions.gcd(G,A[g])
  print(G)
  if K % G != 0:
    print("IMPOSSIBLE")
    exit()
print("POSSIBLE")
Problem p03671 (python)

Fixed submission:
a,b,c = sorted(map(int,input().split()))
print(a+b)

Buggy submission (verdict: Runtime Error):
list = list(map(int,input().split()))
print(min(sum(list)-a,sum(list)-b,sum(list)-c))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(min(sum(a+b),sum(b+c),sum(c+a)))
Problem p03693 (python)

Fixed submission:
r,g,b = input().split()
print('YES 'if int(r+g+b)%4==0 else 'NO')

Buggy submission (verdict: Runtime Error):
r,g,b = input().split()
print('YES 'int(r+g+b)%4==0 else 'NO')
Problem p03732 (python)

Fixed submission:
#ABC060D
N, W = map(int,input().split())
WV = [list(map(int,input().split())) for _ in range(N)]
A = WV[0][0]
B = A + 1
C = A + 2
D = A + 3

AA = []
BB = []
CC = []
DD = []

for wv in WV:
  if wv[0] == A:
    AA.append(wv[1])
  elif wv[0] == B:
    BB.append(wv[1])
  elif wv[0] == C:
    CC.append(wv[1])
  else:
    DD.append(wv[1])

AA = sorted(AA)[::-1]
BB = sorted(BB)[::-1]
CC = sorted(CC)[::-1]
DD = sorted(DD)[::-1]

ans = 0
for a in range(N+1):
  for b in range(N+1-a):
    for c in range(N+1-a-b):
      for d in range(N+1-a-b-c):
        if a > len(AA) or b > len(BB) or c > len(CC) or d > len(DD):
          continue
        if A * a + B * b + C * c + D * d > W:
          continue
        tmp = sum(AA[:a])+sum(BB[:b])+sum(CC[:c])+sum(DD[:d])
        ans = max(ans,tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
#ABC060D
N, W = map(int,input().split())
WV = [list(map(int,input().split())) for _ in range(N)]
dp = [[0] * (N+10) for _ in range(W+10)]

#DPループ
for i in range(N):
    for w in range(W+1):
        if w >= WV[i][0]:
            dp[i+1][w] = max(dp[i][w-WV[i][0]] + WV[i][1],dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]
#print(*dp,sep="\n")
print(dp[N][W])
Problem p03737 (python)

Fixed submission:
a,b,c = input().split()
print((a[0]+b[0]+c[0]).upper())

Buggy submission (verdict: Runtime Error):
a,b,c = input().split()
print(upper(a[0]+b[0]+c[0]))
Problem p03738 (python)

Fixed submission:
a = int(input())
b = int(input())
print("GREATER" if a > b else "LESS" if a < b else "EQUAL")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print("GREATER" if a > b else "LESS" a < b else "EQUAL")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print("GREATER" if a > b else "LESS" a < b else "EQUAL")
Problem p03759 (python)

Fixed submission:
a,b,c = map(int,input().split())
print('YES' if b-a==c-b else 'NO')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print('YES' if b-a=c-b else 'NO')
Problem p03777 (python)

Fixed submission:
a,b = input().split()
print("H" if a==b=="H" or a==b=="D" else "D")

Buggy submission (verdict: Runtime Error):
a,b = map(input().split())
print("H" if a==b=="H" or a==b=="D" else "D")
Problem p03816 (python)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
C = Counter(A)
L = len(C)
print(L-1 if L % 2 == 0 else L)

Buggy submission (verdict: Runtime Error):
from collections import Counter
import math
N = int(input())
A = list(map(int,input().split()))
R = []
T = []
C = Counter(A)
cnt = 0
for c in C.items():
  if c[1] > 1:
    cnt += c[1] - 1
    T.append(c[0])
  else:
    R.append(c[0])
Max_R = max(T)
Min_R = min(T)
flg = False
for r in R:
  if Min_R <= r <= Max_R:
    flg = True
    break
if cnt % 2 != 0:
  ans = N - cnt - 1
else:
  if flg:
    ans = N - cnt
  else:
    ans = N - cnt - 2
print(ans)
Problem p04011 (python)

Fixed submission:
n,k,x,y = [int(input()) for _ in range(4)]
print(k*x+(n-k)*y if n>=k else n*x)

Buggy submission (verdict: Runtime Error):
n,k,x,y = [int(split()) for _ in range(4)]
print(k*x+(n-k)*y if n>=k else k*x)

Buggy submission (verdict: Runtime Error):
n,k,x,y = [int().split() for _ in range(4)]
print(k*x+(n-k)*y if n>=k else k*x)
Problem p04044 (python)

Fixed submission:
n,l = map(int,input().split())
s = [input() for _ in range(n)]
s_sorted = sorted(s)
for i in range(n):
  print(s_sorted[i],end="")

Buggy submission (verdict: Runtime Error):
n,l = map(int,input().split())
s = sorted[input() for _ in range(n)]
for i in range(n):
  print(*s,sep="")
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(a*b)2
Problem p02885 (python)

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

if A - (B*2) > 0:
    print(A - (B*2))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import bisect

N = int(input())
L = list(map(int, input().split()))

L.sort()

buff = []
ll = []


for i in range(N):
    l_b = []
    for j in range(i+1, N):
        l_b.append(L[i]+L[j])
        ll.append(L[i]+L[j])
    if i != N-1:
        buff.append(l_b)
# buff.sort()
# print(L)
# print(buff)

ans = 0
_len = len(buff)

for i in range(_len):
    for j in range(len(buff[i])):
        index = bisect.bisect_left(L[i+j+1+1:], buff[i][j])
        # print(L[i+j+1+1:])
        # print(index, buff[i][j])
        ans += index
print(ans)


# for i in range(N):
#     index = bisect.bisect_left(buff, L[i])
#     print(index)
#     ans += index
# print(ans)
Problem p02971 (python)

Fixed submission:
N = int(input())
A = []

for i in range(N):
    A.append(int(input()))

buff = A.copy()
buff.sort()
buff = buff[::-1]

for i in range(N):
    if A[i] == buff[0]:
        print(buff[1])
    else:
        print(buff[0])

Buggy submission (verdict: Runtime Error):
import heapq
from collections import defaultdict
cnt = defaultdict(int)
N = int(input())
A = list(map(int, input().split()))
# A = []
# for i in range(N):
#     A.append(int(input()))
ans = 0
_ans = []
buff = [0 for i in range(N)]
for i in range(N-1, -1, -1):
    if i > N//2:
        buff[i] = A[i]
    else:
        _m = 0
        # for j in range(i, N, max(1, i)):
        #     _m += buff[j]
        # _m = sum(buff[i:N])
        for j in range(i*2, N, max(1, i)):
            _m += buff[j]
        if _m % 2 != A[i]:
            buff[i] = 1
            ans += 1
            _ans.append(i+1)

mm = 0
for i in range(ans):
    if buff[i] == 1:
        mm = i

print(sum(buff))
print(*_ans)

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

for i in range(N):
    A.append(int(input()))

buff = A.copy()
buff.sort()
buff = buff[::-1]

for i in range(N):
    if A[i] == buff[0]:
        print(buff[1])
    else:
        print(buff[0])
Problem p02988 (python)

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

counter = 0
for i in range(1, n-1):
    buff = []
    buff = P[i-1:i+2]
    buff.sort()
    if P[i] == buff[1]:
        counter += 1


print(counter)

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

print(n)
print(P)

counter = 0
for i in range(1, n-1):
    buff = []
    buff = P[i-1:i+2]
    buff.sort()
    if P[i] == buff[1]:
        counter += 1


print(counter)
Problem p03379 (python)

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

# _sum = sum(X)
buff_x = X.copy()


X.sort()
mm = X[N//2-1]
mx = X[N//2]
for i in range(N):
    if buff_x[i] < mx:
        print(mx)
    else:
        print(mm)

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

# _sum = sum(X)
buff_x = X.copy()


X.sort()
mm = X[N//2-1]
mx = X[N//2]
for i in range(N):
    if buff_x[i] < mx:
        print(mx)
    else:
        print(mm)

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

_sum = sum(X)
buff_x = X.copy()


X.sort()
mm = X[N//2-1]
mx = X[N//2]
for i in range(N):
    if buff_x[i] < mx:
        print(mx)
    else:
        print(mm)

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

_sum = sum(X)
buff_x = X.copy()


X.sort()
mm = X[N//2-1]
mx = X[N//2]
for i in range(N):
    if buff_x[i] < mx:
        print(mx)
    else:
        print(mm)
Problem p03485 (python)

Fixed submission:
# coding:utf-8
a, b = list(map(float, input().split()))
c = (a + b)/2
c_int = int(c)
if c > c_int:
    print(c_int+1)
else:
    print(c_int)

Buggy submission (verdict: Runtime Error):
# coding:utf-8
N = int(input())
a = input().split()
a_ = list(map(int, a))

#back_a = list(map(lambda x:x*0, list(range(N))))

back_i = 0
back_i2 = 0
for i in range(N):
    a_count = a[i-back_i]
    if a_count > int(a[i-back_i]):
        del a[i-back_i]
        back_i += 1
        back_i2 += 
    if a_count < int(a[i-back_i]):
        del a[i-back_i]
        back_i += 1

print(back_i)