Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N , M = map(int,input().split())
list = []
for i in range (M):
    x ,y = map(int , input().split())
    if x == 1 or y == N:
        list.append([x,y])

ans = "IMPOSSIBLE"
for i in range(len(list)):
    if list[i][0] == 1:
        for j in range(len(list)):
            if list[i][1] == list[j][0]:
                if list[j][1] == N:
                    ans = "POSSIBLE"
print(ans)

Fixed submission:
# coding: utf-8
from sys import stdin
input = stdin.readline

N , M = map(int,input().split())
start_input = set()
goal_input = set()

for _ in range(M):
    x , y = map(int,input().split())
    if x == 1:
        start_input.add(y)
    elif y == N:
        goal_input.add(x)
    
if start_input & goal_input:
    print("POSSIBLE")
else :
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

N , M = map(int,input().split())
list = [ list(map(int,input().split())) for i in range(M) ]
ans = "IMPOSSIBLE"
for i in range(M):
    if list[i][0] == 1:
        for j in range(M):
            if list[j][1] == N:
                if list[i][1] == list[j][0]:
                    if list[j][1] == N:
                        ans = "POSSIBLE"
print(ans)

Fixed submission:
# coding: utf-8
from sys import stdin
input = stdin.readline

N , M = map(int,input().split())
start_input = set()
goal_input = set()

for _ in range(M):
    x , y = map(int,input().split())
    if x == 1:
        start_input.add(y)
    elif y == N:
        goal_input.add(x)
    
if start_input & goal_input:
    print("POSSIBLE")
else :
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

N , M = map(int,input().split())
list = [ list(map(int,input().split())) for i in range(M) ]
ans = "IMPOSSIBLE"
for i in range(M):
    if list[i][0] == 1:
        for j in range(M):
            if list[i][1] == list[j][0]:
                if list[j][1] == N:
                    ans = "POSSIBLE"
print(ans)

Fixed submission:
# coding: utf-8
from sys import stdin
input = stdin.readline

N , M = map(int,input().split())
start_input = set()
goal_input = set()

for _ in range(M):
    x , y = map(int,input().split())
    if x == 1:
        start_input.add(y)
    elif y == N:
        goal_input.add(x)
    
if start_input & goal_input:
    print("POSSIBLE")
else :
    print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(str,input().split()))
ans = []

if N %2 == 0:
    for i in range(N):
        if N%2 == 1:
            ans.append(a[i])
        else:
            ans.insert(0,a[i])
        ans.reverse()
    ans.reverse()
else:
    for i in range(N):
        if N%2 == 1:
            ans.append(a[i])
        else:
            ans.insert(0,a[i])
        ans.reverse()


print(" ".join(ans))

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

for i in range(0,n,2):
    odd.append(a[i])
for i in range(1,n,2):
    even.append(a[i])

if n%2 == 0:
    even.reverse()
    ans = even + odd
else:
    odd.reverse()
    ans = odd + even
print(" ".join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(str,input().split()))
ans = []

for i in range(N):
    ans.append(a[i])
    ans.reverse()
print(" ".join(ans))

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

for i in range(0,n,2):
    odd.append(a[i])
for i in range(1,n,2):
    even.append(a[i])

if n%2 == 0:
    even.reverse()
    ans = even + odd
else:
    odd.reverse()
    ans = odd + even
print(" ".join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N , K = map(int,input().split())
list = []

for i in range(N):
    a ,b = map(int,input().split())
    for i in range(b):
        list.append(a)

list.sort()
print(list[K-1])

Fixed submission:
N , K = map(int,input().split())
cnt =0
get_val = [[0,0]]*N
for i in range(N):
    get_val[i] = list(map(int,input().split()))
get_val.sort()

for i in range(N):
    cnt = cnt + get_val[i][1]
    if cnt >= K:
        print(get_val[i][0])
        break
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = list(map(int,input().split( )))
c=a-b
e = 10000000000
if a==b:
  e=s[b]-s[0]+min(abs(s[b]),abs(s[0]))
else:
  for j in range(0,c+1):
    if e>s[j+b-1]-s[j]+min(abs(s[j+b-1]),abs(s[j])):
      e=s[j+b-1]-s[j]+min(abs(s[j+b-1]),abs(s[j]))
print(e)

Fixed submission:
a, b = map(int, input().split())
s = list(map(int,input().split( )))
c=a-b
e = 10000000000
if a==b:
  e=s[b-1]-s[0]+min(abs(s[b-1]),abs(s[0]))
else:
  for j in range(0,c+1):
    if e>s[j+b-1]-s[j]+min(abs(s[j+b-1]),abs(s[j])):
      e=s[j+b-1]-s[j]+min(abs(s[j+b-1]),abs(s[j]))
print(e)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
out = [len(set(s[:i])&set(s[i:])) for i in range(n)]
print(max(out))

Fixed submission:
a, b = map(int, input().split())
print(max(a+b, a-b, a*b))
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, raw_input().split())


if abs(a-c)<=d:
    print("yes")
else:
    if (abs(a-b)<=d) and (abs(b-c)<=d):
        print("yes")
    else:
        print("no")


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

if abs(a-c)<=d:
    print("Yes")
else:
    if abs(a-b)<=d and abs(b-c)<=d:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
l = map(int, raw_input().split())
if abs(l[1]-l[3])<=l[4]:
    print("yes")
else:
    if abs(l[1]-l[2])<=l[4] and abs(l[2]-l[3])<=l[4]:
        print("yes")
    else:
        print("no")


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

if abs(a-c)<=d:
    print("Yes")
else:
    if abs(a-b)<=d and abs(b-c)<=d:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, raw_input().split())
if abs(a-c)<=d:
    print("yes")
else:
    if abs(a-b)<=d and abs(b-c)<=d:
        print("yes")
    else:
        print("no")


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

if abs(a-c)<=d:
    print("Yes")
else:
    if abs(a-b)<=d and abs(b-c)<=d:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
N,i=input().split()
N=int(N)
i=int(i)
print (N-i+1)
Buggy python submission (verdict: Runtime Error):
a


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

Fixed submission:
a=input()
b=input()
h=input()
a=int(a)
b=int(b)
h=int(h)
print (int((a+b)*h/2))
Buggy python submission (verdict: Runtime Error):
N=int(input())
i=int(input())
j = N - i +1
print(j)

Fixed submission:
s=input().split()
N=int(s[0])
i=int(s[1])
j = N - i +1
print(j)

Buggy python submission (verdict: Runtime Error):
N= int(input())
i=int(input())
print (i if i==N else N-i+1)

Fixed submission:
N,i= map(int,input().split())
print (N-i+1)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split)

print(x*y - x - y +1)

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

print(x*y - x - y +1)
Buggy python submission (verdict: Runtime Error):
n,k = [int(x) for x in input().split()]
if n % k == 0:
  prtint(0)
else :
  print(1)

Fixed submission:
n,k = [int(x) for x in input().split()]
if n % k == 0:
  print(0)
else :
  print(1)
Buggy python submission (verdict: Runtime Error):
import re

string  = input()

m = re.match('A[a-z]+C[a-z]+',string)
if m.group() == string:
  
  print('AC')
else:
  print('WA')

Fixed submission:
import re

string  = input()

m = re.match('A[a-z]+C[a-z]+',string)

if m != None:
  if m.group() == string:
    print('AC')
    exit()
print('WA')
Buggy python submission (verdict: Runtime Error):
l = [int(x) for x in input().split()]
sort(l)
print(l[2]-l[1]+l[1]-l[0])

Fixed submission:
l = [int(x) for x in input().split()]
l.sort()
print(l[2]-l[1]+l[1]-l[0])
Buggy python submission (verdict: Runtime Error):
input()
num_list = [int(x) for x in input().split()]

print(num_list.max - num_list.min )

Fixed submission:
input()
num_list = [int(x) for x in input().split()]

print(max(num_list)- min(num_list))
Buggy python submission (verdict: Runtime Error):
input_list = input().split()

print(input_list.count("+")-input_list.cout("-"))

Fixed submission:
input_list = list(input())

print(input_list.count("+")-input_list.count("-"))
Buggy python submission (verdict: Runtime Error):
#coding:utf-8
import sys

input_nums = [int(x) for x in split(readline())]

if len(input_num) > 2 :
	sys.exit("illegal input")
    
if (sum(input_nums)) > 16:
  sys.exit("illegal input")
  
if (min(input_nums)) < 1:
  sys.exit("illegal input")
  
if (max_num = max(input_nums)) > 16:
  sys.exit("illegal input")
elif max_num > 8:
  print(":(")
else :
  print('Yay!')

Fixed submission:
#coding:utf-8
import sys

input_nums = [int(x) for x in sys.stdin.readline().split()]

if len(input_nums) > 2 :
	sys.exit("illegal input")
    
if (sum(input_nums)) > 16:
  sys.exit("illegal input")
  
if (min(input_nums)) < 1:
  sys.exit("illegal input")

max_num = max(input_nums)
if max_num > 16:
  sys.exit("illegal input")
elif max_num > 8:
  print(":(")
else :
  print('Yay!')
Buggy python submission (verdict: Runtime Error):
There is an N-car train.

You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Fixed submission:
n, i = map(int, input().split())
print(n-i+1)
Buggy python submission (verdict: Runtime Error):
print(input().replace("2017", "2018))

Fixed submission:
s = input()
print("2018" + s[4:])
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
l = a + b
r = c + d
print("Left" if l > r else "Balanced" if l = r else "Right" if l < r else)

Fixed submission:
a, b, c, d = map(int, input().split())
l, r = a + b, c + d
if r < l:
  print("Left")
elif l < r:
  print("Right")
else:
  print("Balanced")

Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
l = a + b
r = c + d
print("Left" if l > r else "Balanced" if l = r else "Right")

Fixed submission:
a, b, c, d = map(int, input().split())
l, r = a + b, c + d
if r < l:
  print("Left")
elif l < r:
  print("Right")
else:
  print("Balanced")

Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
l = a + b
r = c + d
print("Left" if l > r "Balanced" if l = r else "Right")

Fixed submission:
a, b, c, d = map(int, input().split())
l, r = a + b, c + d
if r < l:
  print("Left")
elif l < r:
  print("Right")
else:
  print("Balanced")
Buggy python submission (verdict: Runtime Error):
s = input().split()
a, b, c = s[0], s[1], s[2]
if b.startswith(a[-1:]) and c.stratswith(b[-1:]):
  print("YES")
else:
  print("NO")

Fixed submission:
s = input().split()
a, b, c = s[0], s[1], s[2]
if b.startswith(a[-1:]) and c.startswith(b[-1:]):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
a, b = int(a), int(b)
print("Draw" if a == b elif a < b "Bob" else "Alice")

Fixed submission:
a, b = input().split()
a, b = int(a), int(b)
if a == 1:
  a += 13
if b == 1:
  b += 13
print("Alice" if a > b else "Draw" if a == b else "Bob")
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
ab_list = list()
for _ in range(m):
    a, b = map(int, input().split())
    ab_list.append([a, b])
ab_list = sorted(ab_list, key=lambda x: x[1])
n_list = [1 for i in range(n)]
for a, b in ab_list:
    t_list = n_list[a:b]
    v = t_list.count(0)
    if v == 0:
        n_list[b-1] = 0
print(n_list.count(0))

Fixed submission:
n, m = map(int, input().split())
ab_list = list()
for _ in range(m):
    a, b = map(int, input().split())
    ab_list.append([a, b])
ab_list = sorted(ab_list, key=lambda x: x[1])
x = -1
ans = 0
for a, b in ab_list:
    if a <= x:
        continue
    else:
        x = b-1
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
ab_list = list()
for _ in range(m):
    a, b = map(int, input().split())
    ab_list.append([a, b])
ab_list = sorted(ab_list, key=lambda x: x[1])
n_list = [1 for i in range(n)]
for a, b in ab_list:
    flag = False
    for i in range(a, b):
        if n_list[i] == 0:
            flag = True
            break
    if not flag:
        n_list[b-1] = 0
print(n_list.count(0))

Fixed submission:
n, m = map(int, input().split())
ab_list = list()
for _ in range(m):
    a, b = map(int, input().split())
    ab_list.append([a, b])
ab_list = sorted(ab_list, key=lambda x: x[1])
x = -1
ans = 0
for a, b in ab_list:
    if a <= x:
        continue
    else:
        x = b-1
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
ans = (2*n) // math.gcd(2, n)
print(ans)

Fixed submission:
import math

n = int(input())
if n%2 == 0:
    print(n)
else:
    print(2*n)

Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
ans = (2*n) // math.gcd(2, n)
print(ans)

Fixed submission:
import math

n = int(input())
if n%2 == 0:
    print(n)
else:
    print(2*n)
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <cmath>
using namespace std;


int main()
{
  float a, b;

  cin >> a >> b;
  cout << (int)round((a+b)/2) << endl;
  
  return 0;
}


Fixed submission:
import math


def main():
    a, b = map(int, input().split())
    print(math.ceil((a+b)/2))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <string>
using namespace std;


int main()
{
  string s;
  int c=0;
  
  cin >> s;
  for ( int i=0; i<s.length(); i++ ) {
    if ( s[i] == '1' ) c++;
  }
  cout << c << endl;
  
  return 0;
}


Fixed submission:
def main():
    print(input().count('1'))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    s = input()
    t = input()

    for i in range(len(s)-len(t)+1):
        flag = True
        for j in range(len(t)):
            if s[i+j] != t[j] and s[i+j] != '?':
                flag = False
                break
        if flag:
            s = s[:i] + t + s[i+len(t):]
            #break

    if flag:
        print(s.replace('?', 'a'))
    else:
        print("UNRESTORABLE")
        

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    r = int(input())
    g = int(input())
    print(g*2 - r)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <string>


using namespace std;


bool yaki_check(string s)
{
  if (s.length() < 4){
    return false;
  }
  string t("YAKI");
  for (int i=0; i<4; i++){
    if (s[i] != t[i]){
      return false;
    }
  }
  return true;
}

int main()
{
  string s;

  cin >> s;

  if (yaki_check(s)){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}


Fixed submission:
def main():
    s = input()
    if len(s) < 4 or "YAKI" != s[:4]:
        print("No")
    else:
        print("Yes")


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    l_list = sorted([int(i) for i in input().split()], reverse=True)
    print(sum(l_list[:k]))
    

if __name__ == "__main__":
    main()

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

    if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0: print("Possible")
    else: print("Impossible")


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    l_list = sorted([int(i) for i in input().split()], reverse=True)
    print(sum(l_list[:k]))
    

if __name__ == "__main__":
    main()

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

    if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0: print("Possible")
    else: print("Impossible")


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a_list = [int(i) for i in input().split()]

    b_list = list()
    for i, a in enumerate(a_list):
        c = i+1
        if (c%2 == 0 and n%2 == 0) or (c%2 == 1 and n%2 == 1): b_list.insert(0, a)
        else: b_list.insert(len(b_list), a)

    print(' '.join([str(i) for i in b_list]))


if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    a_list = [int(i) for i in input().split()]

    b_list = [-1 for i in range(512345)]
    left = 212345
    right = left+1
    for i in range(n):
        if (i+1)%2 == n%2:
            b_list[left] = a_list[i]
            left -= 1
        else:
            b_list[right] = a_list[i]
            right += 1

    print(' '.join([str(i) for i in b_list[left+1:right]]))

    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a_list = [int(i) for i in input().split()]

    b_list = list()
    for i in range(n):
        b_list.append(a_list[i])
        b_list.reverse()

    print(' '.join([str(i) for i in b_list]))


if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    a_list = [int(i) for i in input().split()]

    b_list = [-1 for i in range(512345)]
    left = 212345
    right = left+1
    for i in range(n):
        if (i+1)%2 == n%2:
            b_list[left] = a_list[i]
            left -= 1
        else:
            b_list[right] = a_list[i]
            right += 1

    print(' '.join([str(i) for i in b_list[left+1:right]]))

    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict


def solve(pre_is_positive, a_list):
    total = 0
    ans = 0
    for a in a_list:
        total += a
        if pre_is_positive and total >= 0:
            ans += abs(total) + 1
            total = -1
        elif not pre_is_positive and total <= 0:
            ans += abs(total) + 1
            total = 1
        pre_is_positive = total > 0
    return ans


def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    print(min(solve(True, a_list), solve(False, a_list)))


if __name__ == "__main__":
    main()

Fixed submission:
def main():
    print(''.join([s[0].upper() for s in input().split()]))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>


using namespace std;


long long f(long long a, long long b)
{
  string x=to_string(a), y=to_string(b);
  return max(x.length(), y.length());
}


int main()
{
  long long n, i, minv=100000000000;

  cin >> n;
  i = 1;
  while (i <= (long long)sqrt((long long)n)){
    if (n%i == 0 && f(i, n/i) < minv) minv = f(i, n/i);
    i++;
  }
  cout << minv << endl;
  
  return 0;
}


Fixed submission:
import math


def f(a, b):
    return max(len(str(a)), len(str(b)))


def main():
    n = int(input())

    i = 1
    minv = 100000000000
    while i <= int(math.sqrt(n)):
        if n%i == 0 and f(i, n//i) < minv:
            minv = f(i, n//i)
        i += 1
    print(minv)
    

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    s = input()

    x, maxv = 0, 0
    for c in s:
        if c == 'I':
            x += 1
        elif c == 'D':
            x -= 1
        if x > maxv:
            maxv = x
    print(maxv)


if __name__ == "__main__":
    main()

Fixed submission:
def main():
    a, b, c, d = map(int, input().split())
    ans = a*b if a*b >= c*d else c*d
    print(ans)
    

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    k, s = map(int, input().split())
    cnt = 0
    for x in range(k+1):
        for y in range(k+1):
            for z in range(k+1):
                if x+y+z == s: cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

Fixed submission:
def main():
    k, s = map(int, input().split())
    cnt = 0
    for x in range(k+1):
        for y in range(k+1):
            if 0 <= s-x-y and s-x-y <= k: cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n, t = map(int ,raw_input().split())
li = map(int , raw_input().split())

ans = 1
temp = 0
for i in range(len(li)):
	for j in range(i+1,len(li)):
		if(li[j] - li[i] == temp):
			ans += 1
		elif(li[j] - li[i] > temp):
			temp = li[j] - li[i]
			ans = 1

print ans

Fixed submission:
import numpy as np

if __name__ == "__main__":
	n,t = map(int,raw_input().split())
	li = map(int,raw_input().split())

	minv = li[0]
	dm = 0
	ans = 1
	for i in range(1, len(li)):
		minv = min(minv, li[i])
		if(dm == li[i] - minv):
			ans += 1
		elif(dm < li[i]-minv):
			dm = li[i] - minv
			ans = 1

	print ans
Buggy python submission (verdict: Runtime Error):
l = raw_input().split()
N = l[0]
i = l[1]
print(N + 1 - i)


Fixed submission:
l = input().split()
N = int(l[0])
i = int(l[1])
print(N + 1 - i)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split()))
Y = X.copy()
Y.sort()

for i in X:
    if Y.index(i) >= N//2:
        print(Y[N//2-1])
    if Y.index(i) <= N//2 - 1:
        print(Y[N//2])

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

l = Y[N//2-1]
r= Y[N//2]

for i in X:
    if i <= l:
        print(r)
    else:
        print(l)

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N = int(input())
    X = list(map(int, input().split()))
    
    for i in range(N):
        l = X[:i] + X[i+1:]
        l.sort()
        print(l[N//2-1])

if __name__ == '__main__':
    solve()

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

l = Y[N//2-1]
r= Y[N//2]

for i in X:
    if i <= l:
        print(r)
    else:
        print(l)

Buggy python submission (verdict: Time Limit Exceeded):
import statistics

def solve():
    N = int(input())
    X = list(map(int, input().split()))
    
    for i in range(N):
        l = X[:i] + X[i+1:]
        print(statistics.median(l))

if __name__ == '__main__':
    solve()

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

l = Y[N//2-1]
r= Y[N//2]

for i in X:
    if i <= l:
        print(r)
    else:
        print(l)

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

for i in range(N):
    l = X[:i] + X[i+1:]
    print(statistics.median(l))

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

l = Y[N//2-1]
r= Y[N//2]

for i in X:
    if i <= l:
        print(r)
    else:
        print(l)
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    A, B, K = map(int, input().split())
    for i in range(A, B+1):
        if A <= i <= A+K-1 or B-K+1 <= i <= B:
            print(i)
if __name__ == '__main__':
    solve()

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

if K<(B-A)/2+1:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1, B+1):
        print(i)
else:
    for i in range(A, B+1):
        print(i)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
for i in range(A, B+1):
    if A <= i <= A+K-1 or B-K+1 <= i <= B:
        print(i)

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

if K<(B-A)/2+1:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1, B+1):
        print(i)
else:
    for i in range(A, B+1):
        print(i)