Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
data = []
for i in range(n-1):
    station_data = [int(x) for x in input().split()]
    data.append(station_data)

time_list = []

for i in range(n-1):
    total_time = data[i][1] + data[i][0]

    for j in range(i+1, n-1):
        if total_time <= data[j][1]:
            total_time = data[j][1] + data[j][0]

        elif total_time % data[j][2] == 0:
            total_time += data[j][0]

        else:
            total_time += total_time % data[j][2] + data[j][0]

    time_list.append(total_time)

time_list.append(0)

answer = map(str, time_list)
print("\n".join(answer)

Fixed submission:
n = int(input())
data = []
for i in range(n-1):
    station_data = [int(x) for x in input().split()]
    data.append(station_data)

time_list = []

for i in range(n):
    total_time = 0

    for j in range(i, n-1):
        if total_time <= data[j][1]:
            total_time = data[j][1] + data[j][0]

        elif total_time % data[j][2] == 0:
            total_time += data[j][0]

        else:
            total_time += data[j][2] - total_time % data[j][2] + data[j][0]

    time_list.append(total_time)

answer = map(str, time_list)
print("\n".join(answer))

Buggy python submission (verdict: Runtime Error):
n = int(input())
data = []
for i in range(n-1):
    station_data = [int(x) for x in input().split()]
    data.append(station_data)

time_list = []

for i in range(n-1):
    total_time = data[i][1] + data[i][0]

    for j in range(i+1, n-1):
        if total_time <= data[j][1]:
            total_time = data[j][1] + data[j][0]

        elif total_time % data[j][2] == 0:
            total_time += data[j][0]

        else:
            total_time += total_time % data[j][2] + data[j][0]

    time_list.append(total_time)

time_list.append(0)

answer = map(str, time_list)
for i in range(n):
    print(answer[i])

Fixed submission:
n = int(input())
data = []
for i in range(n-1):
    station_data = [int(x) for x in input().split()]
    data.append(station_data)

time_list = []

for i in range(n):
    total_time = 0

    for j in range(i, n-1):
        if total_time <= data[j][1]:
            total_time = data[j][1] + data[j][0]

        elif total_time % data[j][2] == 0:
            total_time += data[j][0]

        else:
            total_time += data[j][2] - total_time % data[j][2] + data[j][0]

    time_list.append(total_time)

answer = map(str, time_list)
print("\n".join(answer))
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

parameter = list(map(int, input().split()))
n, k = parameter[0], parameter[1]

balls = list(map(int, input().split()))

numbers = defaultdict(lambda: 0)
for b in balls:
    numbers[b] += 1

if len(numbers) == k:
    print(0)

else:
    sort_number = sorted(numbers.items(), key=lambda x:x[1], reverse=True)
    answer = n - sum([sort_number[i][1] for i in range(k)])
    print(answer)

Fixed submission:
from collections import defaultdict

parameter = list(map(int, input().split()))
n, k = parameter[0], parameter[1]

balls = list(map(int, input().split()))

numbers = defaultdict(lambda: 0)
for b in balls:
    numbers[b] += 1

k = min(k, len(numbers))

sort_number = sorted(numbers.items(), key=lambda x:x[1], reverse=True)
answer = n - sum([sort_number[i][1] for i in range(k)])
print(answer)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

parameter = list(map(int, input().split()))
n, k = parameter[0], parameter[1]

balls = list(map(int, input().split()))

numbers = defaultdict(lambda: 0)
for b in balls:
    numbers[b] += 1

sort_number = sorted(numbers.items(), key=lambda x:x[1], reverse=True)
answer = n - sum([sort_number[i][1] for i in range(k)])
print(answer)

Fixed submission:
from collections import defaultdict

parameter = list(map(int, input().split()))
n, k = parameter[0], parameter[1]

balls = list(map(int, input().split()))

numbers = defaultdict(lambda: 0)
for b in balls:
    numbers[b] += 1

k = min(k, len(numbers))

sort_number = sorted(numbers.items(), key=lambda x:x[1], reverse=True)
answer = n - sum([sort_number[i][1] for i in range(k)])
print(answer)
Buggy python submission (verdict: Runtime Error):
def calcurate_digit_sum(num):
    num_str = str(num)
    digit_sum = 0
    for i, digit in enumerate(num_str):
        digit_sum += int(digit)

    return digit_sum

def check_harshad(num):
    digit_sum = calcurate_digit_sum(num)
    if num % digit_sum == 0:
        return("yes")
    return("no")

if __name__ == "__main__":
    N = int(input())
    print(check_harshad(N))

Fixed submission:
def plan_one(time, price_base):
    price = time * price_base
    return price

if __name__ == "__main__":
    input_list = input().split(" ")
    N, A, B = int(input_list[0]), int(input_list[1]), int(input_list[2])
    price = min(plan_one(N, A), B)
    print(price)

Buggy python submission (verdict: Runtime Error):
def calcurate_digit_sum(num):
    num_str = str(num)
    digit_sum = 0
    for i in num_str:
        digit_sum += int(i)

    return digit_sum

def check_harshad(num):
    digit_sum = calcurate_digit_sum(num)
    if num % digit_sum == 0:
        return("yes")
    return("no")

if __name__ == "__main__":
    N = int(input())
    print(check_harshad(N))

Fixed submission:
def plan_one(time, price_base):
    price = time * price_base
    return price

if __name__ == "__main__":
    input_list = input().split(" ")
    N, A, B = int(input_list[0]), int(input_list[1]), int(input_list[2])
    price = min(plan_one(N, A), B)
    print(price)
Buggy python submission (verdict: Runtime Error):
N, C = map(int, input().split())

f = [[0] * 100000 for _ in range(C)]

for i in range(N):
    s, t, c = map(int, input().split())
    f[c-1][s-1] = 1
    f[c-1][t] = -1

for c in range(C):
    for i in range(100000):
        if i > 0:
            f[c][i] += f[c][i-1]

print(max(map(sum, zip(*f))))

Fixed submission:
N, C = map(int, input().split())
 
f = [[0] * 100000 for _ in range(C)]
 
for i in range(N):
    s, t, c = map(int, input().split())
    f[c-1][s-1:t] = [1] * (t-s+1)
 
print(max(map(sum, zip(*f))))
Buggy python submission (verdict: Time Limit Exceeded):
number_list = []
N = int(input())

for i in range(N):
    new_num = input()
    if new_num in number_list:
        number_list.remove(new_num)
    else:
        number_list.append(new_num)

print(len(number_list))

Fixed submission:
number_set = set()
N = int(input())

for i in range(N):
    new_num = input()
    if new_num in number_set:
        number_set.remove(new_num)
    else:
        number_set.add(new_num)

print(len(number_set))
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
n = int(input())
r = 1
for x in range(n):
    q = input().split()
    if q[0] == '1':
        r = -r
    elif q[1] == '1':
        z = q[2][0]
        if r == 1:
            s.insert(0, z)
        else:
            s.append(z)
    else:
        z = q[2][0]
        if r == -1:
            s.insert(0, z)
        else:
            s.append(z)
if r == -1:
    s.reverse()
print("".join(s))


Fixed submission:
s = input()
n = int(input())
x = []
y = []
r = 1
for i in range(n):
    q = input().split()
    if q[0] == '1':
        r = -r
    elif q[1] == '1':
        z = q[2][0]
        if r == 1:
            x.append(z)
        else:
            y.append(z)
    else:
        z = q[2][0]
        if r == -1:
            x.append(z)
        else:
            y.append(z)
if r == 1:
    x.reverse()
    print("".join(x) + s + "".join(y))
else:
    y.reverse()
    print("".join(y) + s[::-1] + "".join(x))
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)
for i in range(k):
  h.pop(0)


print(sum(h))

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)
del h[0:k]


print(sum(h))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,inpt().split())
if n==m:
  print('Yes')
else:
  print('No')

Fixed submission:
n,m=map(int,input().split())
if n==m:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int,input().split()))
l = [2*10**5]
cnt=0
if n == 1:
  print(1)
else:
  for i in range(n-1):
    l.append(p[i])
    m = min(l)
    if m > p[i+1]:
      #print(p[i+1])
      cnt+=1
  print(cnt+1)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
m = 2*10**5
cnt=0
if n == 1:
  print(1)
else:
  for i in range(n-1):
    if m > p[i]:
      m = p[i]
    if m > p[i+1]:
      #print(p[i+1])
      cnt+=1
  print(cnt+1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int,input().split()))
l = [2*10**5]
cnt=0

for i in range(n):
  for j in range(i):
    l.append(p[j])
  m = min(l)
  if m>= p[i]:
    cnt+=1 
print(cnt)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
m = 2*10**5
cnt=0
if n == 1:
  print(1)
else:
  for i in range(n-1):
    if m > p[i]:
      m = p[i]
    if m > p[i+1]:
      #print(p[i+1])
      cnt+=1
  print(cnt+1)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
cnt=0
for i in range(k):
  if a>=1:
    a-=1
  elif b>=1:
    b-=1
  else:
    break
print("{} {}".format(a,b))

Fixed submission:
a,b,k=map(int,input().split())
cnt=0
if k>=(a+b):
  print("{} {}".format(0,0))
elif k>=a and k-a<=b:
  print("{} {}".format(0,b-k+a))
elif k<a:
  print("{} {}".format(a-k,b))
Buggy python submission (verdict: Runtime Error):
n,a,b= map(int,input().split())
if a<b:
  tmp=a
  a=b
  b=a
if abs(a-b)%2==0:
  c=abs(a-b)//2
else:
  if abs(a-b)>=3:
    c = c-abs(a-b)//2
  elif abs(a-b)<3:
	c=min(abs(1-a),abs(n-b))

print(c)

Fixed submission:
n,a,b= map(int,input().split())
if a<b:
  tmp=a
  a=b
  b=tmp
if abs(a-b)%2==0:
  c=abs(a-b)//2

else:

  if abs(a-b)>=3:
    c=min(abs(1-a),abs(n-b))
    c = c-(abs(a-b)//2)
  else:
    c=min(abs(1-a),abs(n-b))


print(c)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b=[]
b=list(map(int,input().split()))
sum1=0
num = []
for i in range(a-1):
  for j in range(i+1,a):
    num.append(b[i]^b[j])
sum1=sum(num)
 
if sum1>=1000000007:
  sum1=sum1%1000000007
print(sum1)

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

if a+b+c>=22:
  print('bust')
else:
  print('win')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans=[]
for j in range(n):
  for idx,num in enumerate(a):
    if num==j+1:
      ans.append(idx+1)

print(*ans)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans=[0]*n
for i in range(n):
    ans[a[i]-1] = i+1 

print(*ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
H = list(map(int, input().split()))

if K >= N:
    print(0)
else:
    H.sort(reverse=True)
    for i in range(0, K):
        H.pop(i)

    print(sum(H))

Fixed submission:
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
H = list(map(int, input().split()))

if K >= N:
    print(0)
else:
    H.sort(reverse=True)
    print(sum(H[K:]))

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

if K >= N:
    print(0)
else:
    H.sort(reverse=True)
    for i in range(0, K):
        H.pop(i)

    print(sum(H))

Fixed submission:
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
H = list(map(int, input().split()))

if K >= N:
    print(0)
else:
    H.sort(reverse=True)
    print(sum(H[K:]))

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

if K >= N:
    print(0)
else:
    H.sort(reverse=True)
    for i in range(0, K):
        H.pop(i)
    
    print(sum(H))

Fixed submission:
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
H = list(map(int, input().split()))

if K >= N:
    print(0)
else:
    H.sort(reverse=True)
    print(sum(H[K:]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

ans = 0
for i in range(0, N):
    if P[i] <= min(P[0:i+1]):
        ans += 1

print(ans)

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

ans = 0
m = P[0]
for i in range(0, N):
    if m > P[i]:
        m = P[i]
    if P[i] <= m:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

ans = 0
for i in range(0, N):
    if P[i] <= min(P[0:i+1]):
        ans += 1

print(ans)

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

ans = 0
m = P[0]
for i in range(0, N):
    if m > P[i]:
        m = P[i]
    if P[i] <= m:
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

order = [0] * N
flag = 0
for i in range(0, N):
    flag = A.index(min(A))
    order[i] = flag + 1
    A[flag] = N + 1

print(" ".join(map(str, order)))


Fixed submission:
N = int(input()) 
A = list(map(int,input().split()))
 
lis = []
for i in range(N):
    lis.append ([A[i],i+1])
 
lis.sort()
ans = []
for i in range(N):
    ans.append(lis[i][1])
 
print(" ".join(map(str,ans)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

order = [0] * N
flag = 0
for i in range(0, N):
    flag = A.index(min(A))
    order[i] = flag + 1
    A[flag] = N + 1

for s in order:
    print(s, end =" ")


Fixed submission:
N = int(input()) 
A = list(map(int,input().split()))
 
lis = []
for i in range(N):
    lis.append ([A[i],i+1])
 
lis.sort()
ans = []
for i in range(N):
    ans.append(lis[i][1])
 
print(" ".join(map(str,ans)))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
p = list(map(int, input().split()))
Max = 0
for i in range(N):
    Sum=0
    if i+K<=N:
        for j in range(K):
            Sum += p[i + j]
        if Sum > Max:
            Max = Sum
            index = i
    else:
        break
Sum=0
for i in range(K):
    kitai=1/2*p[index+i]*(p[index+i]+1)
    kitai = kitai / p[index+i]
    Sum+=kitai
print(Sum)

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

s=[0]*(N+1)
for i in range(N):
    s[i + 1] = s[i] + p[i]

Max = 0
for i in range(N):
    Sum=0
    if i+K<=N:
        Sum = s[K+i] - s[i]
        if Sum > Max:
            Max = Sum
            index = i
    else:
        break
Sum=0
for i in range(K):
    kitai=1/2*p[index+i]*(p[index+i]+1)
    kitai = kitai / p[index+i]
    Sum+=kitai
print(Sum)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
p = list(map(int, input().split()))
big = []
Max = 0
for i in range(N):
    Sum=0
    if i+K<=N:
        for j in range(K):
            Sum += p[i + j]
        if Sum > Max:
            Max = Sum
            index = i
    else:
        break
for i in range(K):
    big.append(p[index+i])
ans = []
for i in big:
    kitai=0
    for j in range(1,i+1):
        kitai += j
    kitai = kitai / i
    ans.append(kitai)
print(sum(ans))

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

s=[0]*(N+1)
for i in range(N):
    s[i + 1] = s[i] + p[i]

Max = 0
for i in range(N):
    Sum=0
    if i+K<=N:
        Sum = s[K+i] - s[i]
        if Sum > Max:
            Max = Sum
            index = i
    else:
        break
Sum=0
for i in range(K):
    kitai=1/2*p[index+i]*(p[index+i]+1)
    kitai = kitai / p[index+i]
    Sum+=kitai
print(Sum)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
p = list(map(int, input().split()))
big = []
Max = 0
for i in range(N):
    Sum=0
    if i+K<=N:
        for j in range(K):
            Sum += p[i + j]
        if Sum > Max:
            Max = Sum
            index=i
for i in range(K):
    big.append(p[index+i])
ans = []
for i in big:
    kitai=0
    for j in range(1,i+1):
        kitai += j
    kitai = kitai / i
    ans.append(kitai)
print(sum(ans))

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

s=[0]*(N+1)
for i in range(N):
    s[i + 1] = s[i] + p[i]

Max = 0
for i in range(N):
    Sum=0
    if i+K<=N:
        Sum = s[K+i] - s[i]
        if Sum > Max:
            Max = Sum
            index = i
    else:
        break
Sum=0
for i in range(K):
    kitai=1/2*p[index+i]*(p[index+i]+1)
    kitai = kitai / p[index+i]
    Sum+=kitai
print(Sum)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
X = int(input())
price=[100,101,102,103,104,105]
num = int(X / 100)
state=False
for i in range(1,num+1):
    for j in itertools.combinations_with_replacement(price, i):
        if sum(j) == X:
            print(1)
            state=True
            exit()
if state != True:
    print(0)

Fixed submission:
import itertools
X = int(input())
price=[100,101,102,103,104,105]
num = int(X / 100)
state=False
for i in range(num,0,-1):
    for j in itertools.combinations_with_replacement(price, i):
        if sum(j) == X:
            print(1)
            state=True
            exit()
if state != True:
    print(0)
Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
  if i%2!=0:
    odd+=1
 
print(odd/n)

Fixed submission:
n=int(input())
odd=0
for i in range(1, n+1):
  if i%2!=0:
    odd+=1
 
print(odd/n)
Buggy python submission (verdict: Runtime Error):
n, k=map(int,input())
h=list(map(int,input()))
cnt=0
for i in h:
  if i>=k:
    cnt+=1
print(cnt)

Fixed submission:
n, k=map(int,input().split())
h=list(map(int,input().split()))
cnt=0
for i in h:
  if i>=k:
    cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
point = [K] * N
for i in A:
    point[i-1] = point[i-1] + 1
    point=list(map(lambda x:x-1, point))
    
for i in range(N):
    if point[i] <= 0:
        print('No')
    else:
        print('Yes')

Fixed submission:
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
point = [K-Q] * N
for i in A:
    point[i-1] = point[i-1] + 1
 
for i in range(N):
    if point[i] <= 0:
        print('No')
    else:
        print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
point = [K] * N
for i in A:
    for j in range(N):
        point[j]=point[j] - 1
    point[i-1] = point[i-1] + 1

for i in range(N):
    if point[i] <= 0:
        print('No')
    else:
        print('Yes')

Fixed submission:
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
point = [K-Q] * N
for i in A:
    point[i-1] = point[i-1] + 1
 
for i in range(N):
    if point[i] <= 0:
        print('No')
    else:
        print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
from collections import Counter
N = int(input())
s = [input() for _ in range(N)]
comb = list(itertools.combinations(range(N), 2))

count=0
for i in range(len(comb)):
    if Counter(s[comb[i][0]].upper()) == Counter(s[comb[i][1]].upper()):
        count+=1
print(count)

Fixed submission:
N = int(input())
s = [''.join(sorted(input())) for _ in range(N)]
dic = {}
count=0
for i in range(N):
    if s[i] in dic:
        dic[s[i]] = dic[s[i]] + 1
    else:
        dic.setdefault(s[i], 1)
for i in dic.values():
    if i > 1:
        count += i* (i - 1) // 2
print(count)
Buggy python submission (verdict: Runtime Error):
from collections import deque
N, M = map(int, input().split())
X = list(map(int, input().split()))
sortX = sorted(X)
dist = []
if M == 1:
    print(0)
else:
    for i in range(M-1):
        dist.append(sortX[i + 1] - sortX[i])
    for i in range(N - 1):
        dist.pop(dist.index(max(dist)))
    print(sum(dist))

Fixed submission:
from collections import deque
N, M = map(int, input().split())
X = list(map(int, input().split()))
sortX = sorted(X)
dist = []
if N-M>=0:
    print(0)
else:
    for i in range(M-1):
        dist.append(sortX[i + 1] - sortX[i])
    dist.sort()
    print(sum(dist[:M-N]))
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
x = list(map(int, input().split()))
d = []
min=abs(x[0]-X)
for i in range(N):
    d.append(abs(x[i] - X))

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

g = gcd(d[0], d[1])
for i in range(2,N):
    g=gcd(g,d[i])
print(g)

Fixed submission:
N, X = map(int, input().split())
x = list(map(int, input().split()))
d = []
min=abs(x[0]-X)
for i in range(N):
    d.append(abs(x[i] - X))

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

if len(d) == 1:
    print(d[0])
else:    
    g = gcd(d[0], d[1])
    for i in range(2,N):
        g=gcd(g,d[i])
    print(g)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

def minus(N, K,count):
    if N>K:
        N=N - (K - 1)
        count += 1
        return minus(N, K, count)
        
    elif N <= K:
        count += 1
        return count

print(minus(N,K,0))

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

if N == K:
    print(1)
else:
    N = N - K
    count = 1
    while N>0:
        N -= K - 1
        count += 1
    print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
X = list(map(int, input().split()))
for i in range(N):
    med = copy.deepcopy(X)
    med.pop(i)
    med.sort()
    print(med[int(N/2)-1])

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Xsort = sorted(X)
med = (Xsort[N // 2] + Xsort[N // 2 - 1]) / 2
for i in range(N):
    if X[i] < med:
        print(Xsort[N // 2])
    else:
        print(Xsort[N // 2-1])

Buggy python submission (verdict: Time Limit Exceeded):
import copy
import statistics
N = int(input())
X = list(map(int, input().split()))
for i in range(N):
    med = copy.deepcopy(X)
    med.pop(i)
    print(statistics.median(med))

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Xsort = sorted(X)
med = (Xsort[N // 2] + Xsort[N // 2 - 1]) / 2
for i in range(N):
    if X[i] < med:
        print(Xsort[N // 2])
    else:
        print(Xsort[N // 2-1])
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
if N == 1 and M == 1:
    print(1)
elif N == 1 and M != 1:
    print(M - 2)
elif M == 1 and N != !:
    print(M - 2)
else:
    print((N-2)*(M-2))

Fixed submission:
N, M = map(int, input().split())
if N == 1 and M == 1:
    print(1)
elif N == 1 and M != 1:
    print(M - 2)
elif M == 1 and N != 1:
    print(N - 2)
else:
    print((N-2)*(M-2))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
size=len(Counter(A).most_common())
if K >= size:
    print(0)
else:
    values, counts = zip(*Counter(A).most_common()[::-1])
    ans=0
    for i in range(size-K):
        ans += counts[i]
print(ans)

Fixed submission:
from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
size=len(Counter(A).most_common())
if K >= size:
    print(0)
else:
    values, counts = zip(*Counter(A).most_common()[::-1])
    ans=0
    for i in range(size-K):
        ans += counts[i]
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
count=0
for i in range(N):
    a=int(input())
    if a not in A:
        A.append(a)
        count += 1
    else:
        A.remove(a)
        count-=1
print(count)
    

Fixed submission:
N = int(input())
A={}
for _ in range(N):
    a = int(input())
    if a in A:
        A.pop(a)
    else:
        A[a]=1
print(len(A))