Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random
import copy
def quickselect(items, item_index):

    def select(lst, l, r, index):

        # base case
        if r == l:
            return lst[l]

        # choose random pivot
        pivot_index = random.randint(l, r)

        # move pivot to beginning of list
        lst[l], lst[pivot_index] = lst[pivot_index], lst[l]

        # partition
        i = l
        for j in range(l+1, r+1):
            if lst[j] < lst[l]:
                i += 1
                lst[i], lst[j] = lst[j], lst[i]

        # move pivot to correct location
        lst[i], lst[l] = lst[l], lst[i]

        # recursively partition one side only
        if index == i:
            return lst[i]
        elif index < i:
            return select(lst, l, i-1, index)
        else:
            return select(lst, i+1, r, index)

    if items is None or len(items) < 1:
        return None

    if item_index < 0 or item_index > len(items) - 1:
        raise IndexError()

    return select(items, 0, len(items) - 1, item_index)

N = int(input())
X = list(map(int, input().split(" ")))
med1 = quickselect(copy.deepcopy(X), N//2-1)
med2 = quickselect(copy.deepcopy(X), N//2)
for i in range(N):
    if X[i] <= med1:
        print(med2)
    else:
        print(med1)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random
import copy

N = int(input())
X = list(map(int, input().split(" ")))
sorted_X = sorted(X)
med1 = sorted_X[N//2-1]
med2 = sorted_X[N//2]
for i in range(N):
    if X[i] <= med1:
        print(med2)
    else:
        print(med1)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random
import copy
def quickselect(items, item_index):

    def select(lst, l, r, index):

        # base case
        if r == l:
            return lst[l]

        # choose random pivot
        pivot_index = random.randint(l, r)

        # move pivot to beginning of list
        lst[l], lst[pivot_index] = lst[pivot_index], lst[l]

        # partition
        i = l
        for j in range(l+1, r+1):
            if lst[j] < lst[l]:
                i += 1
                lst[i], lst[j] = lst[j], lst[i]

        # move pivot to correct location
        lst[i], lst[l] = lst[l], lst[i]

        # recursively partition one side only
        if index == i:
            return lst[i]
        elif index < i:
            return select(lst, l, i-1, index)
        else:
            return select(lst, i+1, r, index)

    if items is None or len(items) < 1:
        return None

    if item_index < 0 or item_index > len(items) - 1:
        raise IndexError()

    return select(items, 0, len(items) - 1, item_index)

N = int(input())
X = list(map(int, input().split(" ")))
med1 = quickselect(copy.deepcopy(X), N//2-1)
med2 = quickselect(copy.deepcopy(X), N//2)
for i in range(N):
    if X[i] <= med1:
        print(med2)
    else:
        print(med1)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random
import copy

N = int(input())
X = list(map(int, input().split(" ")))
sorted_X = sorted(X)
med1 = sorted_X[N//2-1]
med2 = sorted_X[N//2]
for i in range(N):
    if X[i] <= med1:
        print(med2)
    else:
        print(med1)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random
import copy
def quickselect(items, item_index):

    def select(lst, l, r, index):

        # base case
        if r == l:
            return lst[l]

        # choose random pivot
        pivot_index = random.randint(l, r)

        # move pivot to beginning of list
        lst[l], lst[pivot_index] = lst[pivot_index], lst[l]

        # partition
        i = l
        for j in range(l+1, r+1):
            if lst[j] < lst[l]:
                i += 1
                lst[i], lst[j] = lst[j], lst[i]

        # move pivot to correct location
        lst[i], lst[l] = lst[l], lst[i]

        # recursively partition one side only
        if index == i:
            return lst[i]
        elif index < i:
            return select(lst, l, i-1, index)
        else:
            return select(lst, i+1, r, index)

    if items is None or len(items) < 1:
        return None

    if item_index < 0 or item_index > len(items) - 1:
        raise IndexError()

    return select(items, 0, len(items) - 1, item_index)

N = int(input())
X = list(map(int, input().split(" ")))
med1 = quickselect(copy.deepcopy(X), N//2-1)
med2 = quickselect(copy.deepcopy(X), N//2)
for i in range(N):
    if X[i] <= med1:
        print(med2)
    else:
        print(med1)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random
import copy

N = int(input())
X = list(map(int, input().split(" ")))
sorted_X = sorted(X)
med1 = sorted_X[N//2-1]
med2 = sorted_X[N//2]
for i in range(N):
    if X[i] <= med1:
        print(med2)
    else:
        print(med1)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random

def quickselect(items, item_index):

    def select(lst, l, r, index):

        # base case
        if r == l:
            return lst[l]

        # choose random pivot
        pivot_index = random.randint(l, r)

        # move pivot to beginning of list
        lst[l], lst[pivot_index] = lst[pivot_index], lst[l]

        # partition
        i = l
        for j in range(l+1, r+1):
            if lst[j] < lst[l]:
                i += 1
                lst[i], lst[j] = lst[j], lst[i]

        # move pivot to correct location
        lst[i], lst[l] = lst[l], lst[i]

        # recursively partition one side only
        if index == i:
            return lst[i]
        elif index < i:
            return select(lst, l, i-1, index)
        else:
            return select(lst, i+1, r, index)

    if items is None or len(items) < 1:
        return None

    if item_index < 0 or item_index > len(items) - 1:
        raise IndexError()

    return select(items, 0, len(items) - 1, item_index)

import numpy as np
N = int(input())
X = np.array(list(map(int, input().split(" "))))
for i in range(N):
    print(quickselect(np.append(X[:i], X[i+1:]), N//2-1))

Fixed submission:
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random
import copy

N = int(input())
X = list(map(int, input().split(" ")))
sorted_X = sorted(X)
med1 = sorted_X[N//2-1]
med2 = sorted_X[N//2]
for i in range(N):
    if X[i] <= med1:
        print(med2)
    else:
        print(med1)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""

import numpy as np

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

for i in range(N):
    print(int(np.median(np.append(X[:i], X[i+1:]))))

Fixed submission:
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random
import copy

N = int(input())
X = list(map(int, input().split(" ")))
sorted_X = sorted(X)
med1 = sorted_X[N//2-1]
med2 = sorted_X[N//2]
for i in range(N):
    if X[i] <= med1:
        print(med2)
    else:
        print(med1)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""

import numpy as np

N = int(input())
X = np.array(map(int, input().split(" ")))

for i in range(N):
    print(np.append(X[:i], X[i+1:]).median)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random
import copy

N = int(input())
X = list(map(int, input().split(" ")))
sorted_X = sorted(X)
med1 = sorted_X[N//2-1]
med2 = sorted_X[N//2]
for i in range(N):
    if X[i] <= med1:
        print(med2)
    else:
        print(med1)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""

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

sorted_X = sorted(X)
for i in range(N):
    j = sorted_X.index(X[i])
    if j < N//2:
        print(sorted_X[N//2])
    else:
        print(sorted_X[N//2-1])

Fixed submission:
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Regular Contest 095 c問題
Author     : Kitaura Hiromi
LastUpdate : 20180414
Since      : 20180414
"""
import random
import copy

N = int(input())
X = list(map(int, input().split(" ")))
sorted_X = sorted(X)
med1 = sorted_X[N//2-1]
med2 = sorted_X[N//2]
for i in range(N):
    if X[i] <= med1:
        print(med2)
    else:
        print(med1)