Problem:


Score : 300 points

Problem Statement

When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l.

You are given N numbers X_1, X_2, ..., X_N, where N is an even number.
For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i.

Find B_i for each i = 1, 2, ..., N.

Constraints

2 \leq N \leq 200000

N is even.

1 \leq X_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
X_1 X_2 ... X_N

Output

Print N lines.
The i-th line should contain B_i.

Sample Input 1

4
2 4 4 3

Sample Output 1

4
3
3
4

Since the median of X_2, X_3, X_4 is 4, B_1 = 4.

Since the median of X_1, X_3, X_4 is 3, B_2 = 3.

Since the median of X_1, X_2, X_4 is 3, B_3 = 3.

Since the median of X_1, X_2, X_3 is 4, B_4 = 4.

Sample Input 2

2
1 2

Sample Output 2

2
1

Sample Input 3

6
5 5 4 4 3 3

Sample Output 3

4
4
4
4
4
4



Sample input:
4
2 4 4 3


Sample output:
4
3
3
4

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int, input().split()))
y = list(x)
y.sort()
if n % 2 != 0:
    a,b,c = y[n//2-1],y[n//2],y[n//2+1]
    m = b
else:
    a,b = y[n//2-1],y[n//2]    
    m = (a+b)/2
for i in range(n):
    if x[i] < m :
        if n%2==0:
            tm = b
        else:
            tm = (b+c)/2
    if i == n//2:
        if n%2==0:
            tm = a
        else:
            tm = (a+c)/2
    if x[i] > m:
        if n%2==0:
            tm = a
        else:
            tm = (a+b)/2
    print(tm)

Submission status: Runtime Error

Solution code:
n = int(input())
x=y = list(map(int, input().split()))
y.sort()
if n % 2 != 0:
    a,b,c = y[n//2-1],y[n//2],y[n//2+1]
    m = b
else:
    a,b = y[n//2-1],y[n//2]    
    m = (a+b)/2
for i in range(n):
    if x[i] < m :
        if n%2==0:
            tm = b
        else:
            tm = (b+c)/2
    if i == n//2+1:
        if n%2==0:
            tm = a
        else:
            tm = (a+c)/2
    if x[i] > m:
        if n%2==0:
            tm = a
        else:
            tm = (a+b)/2
    print(tm)

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
for i in x:
  if i > y[n/2-1]:
    print(y[n/2-1])
  else:
    print(y[n/2])

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int,input().split()))
for i in range(n):
  a = x[:i] + x[i+1:]
  a.sort()
  print(a[n//2])

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int,input().split()))
for i in range(n):
  a = x[:i] + x[i+1:]
  print(a[n//2])

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int,input().split()))

x_sorted = sorted(x)

for i in range(n):
    l = x_sorted.copy()
    l.remove(x[i])
    print(l[int(n/2)-1])

Submission status: Runtime Error

Solution code:
import bisect

N = int(input())
X = [int(_) for _ in input().split()]

X2 = sorted(X)
r = X2[N // 2 ]
l = X2[N // 2 -1]

for i in range(N):
    ind = bitsect.bitsect_left(X2, X[i])
    if idx < N // 2:
        print(r)
    else:
        print(l)

Submission status: Runtime Error

Solution code:
import copy
n = int(input())
x = [int(y) for y in input().split()]
z = copy.deepcopy(x)
for i in range(n):
  x.pop(i)
  x.sort()
  print(x[(n - 2) / 2])
  x = z

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
for i in range(n):
    c=b.remove(a[i])
    print(c[n//2-1])

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    b=sorted(del a[i])
    print(b[n//2-1])

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    b=sorted(del a[i])
    print(b[n//2])

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
a = y[n//2-1]
b = y[n//2+1]
for i in range(n):
  if x[i] <= a:
    print(b)
  else:
    print(a)

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int, input().split()))
a = x[n//2-1]
b = x[n//2+1]
for i in range(n):
  if x[i] <= a:
    print(b)
  else:
    print(a)

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(map(int,input().split()))
X_sort = sorted(X)
N_half = int(N/2)
median_large = X_sort[N_half+1]
median_small = X_sort[N_half]
if median_large == median_small:
    for _ in range(N):
        print(median_large)
else:
    for i in range(N):
        if X[i] <= median_small:
            print(median_large)
        elif X[i] >= median_large:
            print(median_small)

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(map(int, input().split()))
ans = ''

def median(_list):
	_list.sort()
	return _list[N//2]

for i in range(N):
	if i != N-1:
		ans += '{0}\n'.format(median(X[:i]+X[i+1:]))
	else:
		ans += '{0}'.format(median(X[:-1]))
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
x=list(map(int, input().split()))
x_=sorted(x)
for i in range(n):
    for j in range(n):
        if x[i]==x_[j]:
            del x_[i]
            print(x_[int(n/2)-1])
            break()


#    x_=x[0:len(x)]
#    del x_[i]
#    x_=sorted(x_)
#    print(x_[int(n/2)-1])

Submission status: Runtime Error

Solution code:
n=int(input())
x=list(map(int, input().split()))

for i in range(n):
    x_=[]
    x_=x
    del x_[i]
    x_1=[]
    x_1=x_.sorted()
    b=[]
    b[i]=x_1[(i+1)/2]
    print(b[i])

Submission status: Runtime Error

Solution code:
n=int(input())
x=list(map(int, input().split()))

for i in range(n):
    x_=[]
    x_=x
    del x_[i]
    x_1=[]
    x_1=x_.sorted()
    b=[]
    b[i]=x_1[(i+1)/2]

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(map(int, input().split()))
 
s_X = sorted(X)
miX = s_X[N//2]
mi1X = s_X[N//2 + 1]
 
for a in X:
  if(s_X.index(a)<=N//2):
    print(mi1X)
  else:
    print(miX)

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(map(int, input().split()))
 
s_X = sorted(X)
miX = s_X[N//2]
mi1X = s_X[N//2 + 1]
 
for a in X:
  if(a.find(s_X)<=N//2):
    print(mi1X)
  else:
    print(miX)

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(map(int, input().split()))

s_X = soreted(X)
miX = s_X[N//2]
mi1X = s_X[N//2 + 1]

for a in X:
  if(a.find(s_X)<=N//2):
    print(mi1X)
  else:
    print(miX)

Submission status: Runtime Error

Solution code:
from numpy import median

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

for i in range(len(X)):
    del X[i]
    print(median(X))

Submission status: Runtime Error

Solution code:
def main():
  N = int(input())
  t = input().split(" ")
  a = [int(i) for i in t]
  a.sort()
  
  for i in range(N):
    if i <= N//2:
      print(a[N//2+1])
    else:
      print(a[N//2])
main()

Submission status: Runtime Error

Solution code:
def main():
  N = int(input())
  t = input().split(" ")
  a = [int(i) for i in t]
  a.sort()
  
  for i in range(N):
    if i <= N/2:
      print(a[N/2+1])
    else:
      print(a[N/2])
main()

Submission status: Runtime Error

Solution code:
def main():
  N = int(input())
  t = input().split(" ")
  a = [int(i) for i in t]
  a.sort()
  
  for i in range(N):
  	if i <= N/2:
      print(a[N/2+1])
    else:
      print(a[N/2])
main()

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(map(int, input().split()))

sorted_X = sorted(X)
m1, m2 = sorted[N//2-1: N//2]

if m1 == m2:
  for i in range(N):
    print(m1)
else:
  for i in range(N):
    if X[i] <= m1:
      print(m2)
    else:
      print(m1)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))

AB = sorted(A)
C = int(N/2)
for i in range(N):
    if AB[i] <= AB[C+1]:
        print(AB[C+1])
    else:
        print(AB[C])

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))

AB = sorted(A)
C = int(N/2)
for i in range(N):
    if AB[i] <= AB[C]:
        print(AB[C+1])
    else:
        print(AB[C])

Submission status: Runtime Error

Solution code:
N = int,input().split()
A = list(map(int,input().split()))

AB = sorted(A)
C = int(N/2)
for i in range(N):
    if AB[i] <= AB[C-1]:
        print(AB[C])
    else:
        print(AB[C-1])

Submission status: Runtime Error

Solution code:
N = int,input().split()
A = list(map(int,input().split()))

A1 = sorted(A)
a = int(N/2)
for i in range(N):
    if A1[i] <= A1[a-1]:
        print(A1[a])
    else:
        print(A1[a-1])

Submission status: Runtime Error

Solution code:
N = int,input().split()
A = list(map(int,input().split()))

A1 = sorted(A)
a = int(n/2)
for i in range(N):
    if A1[i] <= A1[a-1]:
        print(A1[a])
    else:
        print(A1[a-1])

Submission status: Runtime Error

Solution code:
n = int(input())
x = tuple(map(int, input().split(" ")))

for x_i in range(len(x)):
	x_dummy = :
	print(sorted(x_dummy.remove(x_i))[len(x)//2])

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int, input().split()))

sx = sorted(x)
xm = sx[n//2]
xp = sx[n//2+1]

for i in range(n):
  if x[i] <= xm:
    b = xp
  else:
    b = xm
  print(b)

Submission status: Runtime Error

Solution code:
n = int(input())
nums= list(map(int, input().split()))

for i in range(0,n):
    current = nums.copy
    current.pop(i)
    current.sort(key=int , reverse = True)
    print(current[ int(n / 2  - 1)])

Submission status: Runtime Error

Solution code:
mport numpy as np

N = int(input())
X = [int(i) for i in input().split()]

arrayX = np.array(X)
num = arrayX.size

for i in range(num):
    arrayX = np.delete(arrayX,i)
    print(int(np.median(arrayX)))
    arrayX = np.array(X)

Submission status: Runtime Error

Solution code:
N = int(input())
arr = input().split()
arr = arr.sort()

for i in range(N):
    if i < N/2:
        print(arr[int(N/2)])
    else:
        print(arr[int(N/2)-1])

Submission status: Runtime Error

Solution code:
from statistics import median
N = int(input())
X = list(map(int, input.split()))

Y = X + [0]
Z = X + [10*9+1]

ymed = median(ymed)
zmed = median(zmed)

if ymed == zmed:
  for _ in range(N):
    print(ymed)
else:
  for i in X:
    if i <= ymed:
      print(zmed)
    else:
      print(ymed)

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(map(int, input().split()))

x_sort = sorted(X)
m = N/2 - 1
for i in range(N):
    if X[i] <= x_sort[m]:
        print(x_sort[m + 1])
    else:
        print(x_sort[m])

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int,input().split()))
s = sum(x)

for i,j in zip(x,range(n)):
    x.remove(i)
    t = sorted(x)
    print(t)
    print(t[int(n/2-1)])
    x.insert(j,i)
    print(x)

Submission status: Runtime Error

Solution code:
N = int(input())
import numpy as np
l = np.array(map(int,input().split()))
for i in range(N):
    print(np.delete(l,i).median())

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(map(int, input().split()))
x = sorted(X)
m1 = x[N//2]
m2 = x[N//2-1]
for i in X:
    print(m1 if i < m else m2)

Submission status: Runtime Error

Solution code:
N = int(input())
X = [int(i) for i in input().split()]
for i in range(N): print((lambda j: sorted([x for k, x in enumerate(X) if not k == j]))(i)[N/2-1])

Submission status: Runtime Error

Solution code:
n=int(input());print(''.join([sorted(list(map(int,input().split())))[n//2-i//(n//2)]for i in range(n)]))

Submission status: Runtime Error

Solution code:
import copy
N = int(input())
numList = list(map(int, input().split()))
medIndex = int(N/2)

for i in range(0,N):
	numListCopy = copy.deepcopy(numList)
	numListCopy.pop(i)
	numListCopy.sort()
	print(numListCopy[medIndex])

Submission status: Runtime Error

Solution code:
N = input()
X = sorted(list(map(int, input().split())))
for i in range (N):
    if i > (N+1)/2:
        print(X[N/2])
    else:
        print(X[N/2-1])

Submission status: Runtime Error

Solution code:
N = map(int,input().split())
a = list(map(int,input().split()))
b = a
for i in range(N):
    del b[i]
    b.sort()
    print(b[N/2])
    b = a

Submission status: Runtime Error

Solution code:
a = input()
l = map(int, raw_input().split())
t=[]
for i in range(a):
    m = del l[i]
    m.sort()
    answer = m[a/2]
    print(answer)
    print("\n")

Submission status: Runtime Error

Solution code:
from statistics import median

N = int(input())
X = list(map(int, input().split(' ')))

def get_median(l):
    return median(l)

for i in range(N):
    target_l = X[:i] + X[i+1:]
    target_l = sorted(target_l)
    print(target_l[(N+1)/2])

Submission status: Runtime Error

Solution code:
n=int(input())
y=sorted(list(map(int,input().split())))
x1, x2 = y[n//2-1], y[n//2]
for i in range(n):
    if x[i]<=x1:
        print(x2)
    else:
        print(x1)

Submission status: Runtime Error

Solution code:
n=int(input())
x=map(int,input().split())
y = sorted(x)
x1, x2 = y[n//2-1], y[n//2]
for i in range(n):
    if x[i]<=x1:
        print(x2)
    else:
        print(x1)

Submission status: Runtime Error

Solution code:
n = int(input())
x = sorted(map(int, input().split()))
x1 = x[n/2-1]
x2 = x[n/2]
for i, xx in enumerate(x):
    if xx <= x1:
        print(x2)
    else:
        print(x1)

Submission status: Runtime Error

Solution code:
n = int(input())
x = sorted(map(int, input().split()))
x1, x2 = x[n//2-1], x[n//2]
for i, xx in enumerate(x):
　if xx <= x1:
　　print(x2)
　else:
　　print(x1)

Submission status: Runtime Error

Solution code:
n = int(input())
x = [int(i) for i in input().split()]

for i in range(n):
    a = x[:]
    del a[i]
    a.sort()
    print(a[(n-1)/2-1])

Submission status: Runtime Error

Solution code:
n = input()
x_str = input_row().split()
xs = [int(c) for c in x_str]

xs_len = len(xs)
center = (xs_len - 1)//2

c_xs = xs[:]
c_xs.sort()

for x in xs:
    print c_xs[center+1] if x <= c_xs[center] else c_xs[center]

Submission status: Runtime Error

Solution code:
from statistics import median
from collections import deque

n = int(input())
x = deque(map(int, input().split()))

for i in range(0, len(x)):
    x_copy = x.copy()
    del x_copy[i]
    print(median(x_copy))

Submission status: Runtime Error

Solution code:


def main():
    N = int(input())
    X = list(map(int, input().split(" ")))

    nums = list(set(X))
    lis = [-1]*200001

    for x in X:
        lis[x] += 1

    for x in X:
        if lis[x] < 1:
            ind = nums.index(x)
            edited = nums[:ind] + nums[ind+1:]
            
            print(edited[len(edited)//2])
        else:
            print(nums[len(nums)//2])



if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n, map(int, input())
ls = set(map(int, input().split()))
sorted_ls.sort()
f = sorted_ls[int(n/2)]
b = sorted_ls[int(n/2)-1]

for i in range(n):
    if i > n/2:
        print(f)
    else:
        print(b)

Submission status: Runtime Error

Solution code:
n = map(int, input().split())
ls = list(map(int, input().split()))

for i in range(len(ls)):
    ls2 = ls.copy()
    ls2.remove(ls[i])
    print(sorted(ls2)[1])

Submission status: Runtime Error

Solution code:
n = map(int, input().split())
ls = list(map(int, input().split))
for i in ls:
    ls2 = ls.copy()
    ls2.remove(i)
    print(sorted(ls2)[1])

Submission status: Runtime Error

Solution code:
n=int(input())
x=list(map(lambda x:int(x), input().split()))
mi = n/2
sx=sorted(x)
for item in x:
    if item > sx[mi]:
	print(sx[mi])
    else:
	print(sx[mi+1])

Submission status: Runtime Error

Solution code:
n = (input())
a = list(map(int, input().split(' ')))
i = 0
for i in range(n):
    ai = a[0:i] + a[i+1:n]
    aisrt = sorted(ai)
    l = int(len(aisrt)/2)
    print(aisrt[l])

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(map(int, input().split()))

Y=sorted(X)
mid = N//2
lm=Y[mid-1]
rm=Y[mid+1]

for x in X:
    if x<=lm:
        print(rm)
    else:
        print(lm)

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(map(int, input().split()))
Y = [[X[k],k] for k in range(N)]
Y.sort()
A = [0 for k in range(N)]

for k in range(N):
    if k >= N//2:
        A[Y[k][1]] = Y[N//2-1][0]
    else:
        A[Y[k][1]] = Y[N//2][0]

for x in A:
    print(A)

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(str, input().split()))
sx = sorted(x)

max_mid = sx[int(n/2)+1]
min_mid = sx[int(n/2)]

for i in x:
    if i <= min_mid:    # 左半分から取られてる時
        print(max_mid)
    else:               # 右半分から取られてる時
        print(min_mid)

Submission status: Runtime Error

Solution code:
N=int(input())
X=[int(i) for i in input().split()]
for i in range(N):
  x=X.copy()
  del x[i]
  x.sort()
  print(x[N//2-1])

Submission status: Runtime Error

Solution code:
import copy
X_sort=copy.deepcopy(X)
X_sort.sort()
X_sort
median_control=(X_sort[N//2-1]+X_sort[N//2])/2
for i in range (N):
    if X[i]>median_control:
        print (X_sort[N//2-1])
    if X[i]<=median_control:
        print (X_sort[N//2])

Submission status: Runtime Error

Solution code:

N = int(input())

X = input().split()
X = [ int(x) for x in X]
"""
N = 4
X = [2,4,4,3]
"""

#F = copy.deepcopy(X)
F = X[:]
F.sort()

median1 = int(N/2 - 1)
median2 = int(N/2) 

for i in range(N):
    #print(F, median1, median2)
    
    if X[i] < median(F):
        ans = F[median2]
    else:
        ans = F[median1]
    print(int(ans))

Submission status: Runtime Error

Solution code:
N = int(input())
X = tuple(map(int,input().split()))
test = N/2
for i in range(len(test)):
    temp = list(X)
    temp.pop(i)
    temp = sorted(temp)
    print(temp[test-1])

Submission status: Runtime Error

Solution code:
n=int(input())
a1=input().split()
tag_list=()
dic={}
for i in a1:
    tag_list.append(int(i))
 
for j in range(0,n):
    numnum=tag_list[j]
    if numnum in dic:
        print(dic[numnum])
    else:
        A=list(tag_list)
        A.pop(j)
        A.sort()
        num=int(n/2-1)
        print(A[num])
        dic[numnum]=A[num]

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

def merge(ll, lr):
  if ll == []: return lr
  if lr == []: return ll

  l = ll.pop(0)
  r = lr.pop(0)

  if l <= r: return ([l] + merge(ll, [r]+lr))
  else:      return ([r] + merge([l]+ll, lr))

def halve(l):
  return (l[:len(l)//2], l[len(l)//2:])

def msort(l):
  if l == [] or len(l) == 1:
    return l

  ll,lr = halve(l)
  return merge(msort(ll), msort(lr))

N = int(input())
target = N//2-1
X = [0] + list(map(int, input().split()))

for i in range(1, N+1):
  l = X[1:i] + X[i+1:N+1]
  print(msort(l)[target])

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import copy

N = input()
X = map(int, raw_input().split())
AN = N / 2 - 1
RA = copy.deepcopy(X)
X.sort()
AA = X[N/2]
for i in range(N):
    if AA > RA[i]:
        print X[N/2+1]
    if AA <= RA[i]:
        print X[N/2-1]

Submission status: Runtime Error

Solution code:
# mondai C

N =int(input())
X = list(map(int, raw_input().split(" ")))

for i in range(N):
    li1 = X[:i+1]
    li2 = X[i+1:]
    li1.pop()
    li = li1 + li2
    li = sorted(li)
    print(li[int(N/2-1)])

Submission status: Runtime Error

Solution code:
N=int(input())
X=list(map(int, input().split()))
x=[]
for i in range (N):
    x.append(X[:i] +X[i+1:])
for i in range (N):
    x[i].sort()
    print(x[i][median])

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import copy

N = input()
X = map(int, raw_input().split())
AN = N / 2

for i in range(N):
    RA = copy.deepcopy(X)
    del RA[i]
    RA.sort()
    print RA[AN]

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
x = list(map(int, input().split(' ')))

res = [0] * n
for i in range(n):
    if res[x[i]] == 0:
        res[x[i]] = int(np.median(x[:i] + x[(i+1):]))
    print(res[x[i]])

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C


# See:
# https://qiita.com/suecharo/items/30f5d817da4c948c3be6
def count_sort(arr):
    max_num = max(arr)
    min_num = min(arr)
    count = [0] * (max_num - min_num + 1)
    for ele in arr:
        count[ele - min_num] += 1

    return [ele for ele, cnt in enumerate(count, start=min_num) for __ in range(cnt)]


if __name__ == '__main__':
    n = int(input())
    x = list(map(int, input().split()))
    order = list(x)

    for i in range(n):
        tmp = order[i]
        x.remove(tmp)
        x = count_sort(x)
        print(x[(n // 2) - 1])
        x += [tmp]

Submission status: Runtime Error

Solution code:
n=int(input())
x=list(map(int,input().split()))
N=int(n/2)
y=sorted(x)
a=y[N-1]
b=y[N]
for j in range(n):
    if x[j]<a:
        print(b)
    elif x[j]==a:
        print(y[N+1])
    else:
        print(a)

Submission status: Runtime Error

Solution code:
n=int(input())
a1=input().split()
tag_list=[]
for i in a1:
    tag_list.append(int(i))
 
for j in range(0,n):
    numnum=tag_list[j]
    if numnum in dic:
        print(dic[numnum])
    else:
        A=tag_list[0:j]
        test=tag_list[j+1:n]
        A.extend(test)
        A.sort()
        num=int(n/2-1)
        print(A[num])
        dic[numnum]=A[num]

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int, input().split()))

for i in range(n):
    m = x[:]
    m.pop(i)
    l = sorted(m)[::-1]
    print(l[1])

Submission status: Runtime Error

Solution code:
for i in range(0, 200000):
    
    N = int(input())
    X = list(int(i) for i in input().split())
    
    if i < N:
        del X[i]
        X.sort(reverse=True)
        ans = X[int((N/2-1))]
        print(ans)
        X.clear()

Submission status: Runtime Error

Solution code:
import copy

N = int(input())
X = list(map(int, input().split()))
X_a = []
X.sort()
for i in range(N):
	X_a = copy.deepcopy(X)
	X_a.pop(i)
	print(X_a[N//2])

Submission status: Runtime Error

Solution code:
for i in range(0, 200000):
    
    N = int(input())
    X = list(int(i) for i in input().split())
    
    del X[i]
    X.sort(reverse=True)
    ans = X[int((N/2-1))]
    print(ans)
    X.clear()

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = sorted(a)
for i in range(n):
    if b[int(n/2)+1] <= a[i]:
        print(b[int(n/2)-1])
    else:
        print(b[int(n/2)])

Submission status: Runtime Error

Solution code:
N = int(input())
X = list(int(i) for i in input().split())

for i in range(0, N):
    
    N = int(input())
    X = list(int(i) for i in input().split())
    
    del X[i]
    X.sort(reverse=True)
    ans = X[int((N/2-1))]
    print(ans)
    X.clear()

Submission status: Runtime Error

Solution code:
N = int(input())
X = [int(i) for i in input().split()]

for i in range(N):
    tmp = []
    once = True
    delnum = X[i]
    for j in range(len(X)):
        if X[j] == delnum and once:
            continue  
        else:
            tmp.append(X[j])
            once = False
    tmp = sorted(tmp)
    print(tmp[int((len(tmp)+1)/2)])

Submission status: Runtime Error

Solution code:
import copy
n = int(input())
x = list(map(int, input().split()))
y = sorted(x)

for i in range(n):
    Y  = copy.deepcopy(y)
    Y.remove(x[i])
    print(x_in[int(n/2 -1)])

Submission status: Runtime Error

Solution code:
n = input()
x = list(map(int, input().split()))
out = [sorted(x[:i] + x[i+1:])[(len(val)-1)//2] for i, xx in enumerate(x)]
for o in out:
    print(o)

Submission status: Runtime Error

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
for i in range(N):
    sorted_list = a[:i] + a[i+1:]
     sorted_list.sort()
    print(sorted_list[int((N-1)/2)])

Submission status: Runtime Error

Solution code:
n=int(input())
tag_list=[]
for i in range(n):
    tag_list.append(input(i))


#i=int(4)
#tag_list=[5,3,3,4]

for j in range(0,i):
    A=tag_list[0:j]
    test=tag_list[j+1:i]
    A.extend(test)
    A.sort()
    num=int(i/2-1)
    print(A[num])

Submission status: Runtime Error

Solution code:
N=int(input())
X=list(map(int, input().split()))

median=(N//2)-1
for i in range (N):
    X_instant=copy.deepcopy(X)
    X_instant.pop(i)
    X_instant.sort()
    output=X_instant[median]
    print(output)

Submission status: Runtime Error

Solution code:
from statistics import mean, median,variance,stdev
import sys
N = int(raw_input())
nums = map(int, raw_input().split())
for i in range(N):
    nums_tmp = nums[0:i] + nums[i+1:N]
    print(median(nums_tmp))
sys.exit()
num_t = []
index_t = []
for i,num in enumerate(nums):
    num_t.append([num, i])
num_t = sorted(num_t, key=lambda x: x[0])
for a in num_t:
    index_t.append(a[1])
for i in range(N):
    num_tmp = num_t
    idx = index_t.index(i)
    num_tmp = num_tmp[0:idx] + num_tmp[idx+1:N]
    print(num_tmp[(N/2) - 1][0])

Submission status: Runtime Error

Solution code:
import math
n int(input())
a = list(map(int, input().split(' ')))

n = 5
a = [6, 9, 4, 2, 11]

n = max(a)
a.remove(n)
res = 0
for k in a:
    buf = (math.factorial(n) / (math.factorial(k) * math.factorial(n-k)))
    if buf < res:
        res = buf

print(n, res)

Submission status: Runtime Error

Solution code:
n = long(input())
x = [long(i) for i in input().split()]
sortx = sorted(x)

mid_left = sortx[(n//2)-1]
mid_right = sortx[(n//2)]

for i in range(n):
    if sortx[i] <= mid_left:
        print(mid_right)
    else:
        print(mid_left)

Submission status: Runtime Error

Solution code:
N=int(input())
s=list(map(int,input().split()))
t=sorted(s)
p=t[N//2]
q=t[N//2+1]
for i in range(N):
    if s[i]<=p:
        print(q)
    else:
        print(p)