Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

def gcdf(a,n,a0):
    a.sort()
#    print("a1:",a)
    a0=a[0]
    a=[int(x%a0) for x in a if x%a0 != 0]
#    print("a2:",a)
    if len(a)==0:
        return a0
    else:
        a.append(a0)
        a0=min(a)
#        print("a0",a0)
        return gcdf(a,n,a0) 

#n=2
#a=[1000000000, 1000000000]
#n=5
#a=[15, 18, 24, 36, 81]
#n=3
#a=[7, 6, 8]
n=int(input())
a=[]
for i in map(int,input().split()):
    a.append(i)
#n=8
#a=[746130, 1385670, 4849845, 881790, 3233230, 1939938, 570570, 510510]
#ans=[19]

#print(a)
if n==2:
    print(max(a))
else:
    gcdv=0
    for i in range(n):
#        print("--------")
        acpy=list(a)
        del acpy[i]
        a0=acpy[0]
        gcdx=gcdf(acpy,n-1,a0)
        if gcdx>gcdv:
            gcdv=gcdx
    print(gcdv)

### FIXED CODE ###

def gcdf(a):
    a.sort()
#    print("a2:",a)
    a0=a[0]
    a=[int(x%a0) for x in a if x%a0 != 0]
#    print("a2:",a)
    if len(a)==0:
        return a0
    else:
        a.append(a0)
        a0=min(a)
        return gcdf(a) 

#n=8
#a=[746130, 1385670, 4849845, 881790, 3233230, 1939938, 570570, 510510]
#ans=[19]
#n=2
#a=[1000000000, 1000000000]
#n=5
#a=[15, 18, 24, 36, 81]
#n=3
#a=[7, 6, 8]
n=int(input())
a=[]
for i in map(int,input().split()):
    a.append(i)
if n==2:
    print(max(a))
elif n<2**10:
    gcdv=0
    for i in range(n):
        acpy=list(a)
        del acpy[i]
        gcdx=gcdf(acpy)
        if gcdx>gcdv:
            gcdv=gcdx
    print(gcdv)
else:
    m=int(n**(1/2))
    ns=int(n/m)
    rgcd=[]
    for mi in range(m):
        ms=ns*mi
        if mi==m-1:
            am=a[ms:n]
        else:
            am=a[ms:ms+ns]
        gcdm=gcdf(am)
        rgcd.append(gcdm)
    gcdv=0

    for mi in range(m):
        rgcd1=list(rgcd)
        del rgcd1[mi]
        gcdrg1=gcdf(rgcd1)
        ms=ns*mi
        if mi==m-1:
            am=a[ms:n]
        else:
            am=a[ms:ms+ns]
#        print(mi,gcdf(am),len(am),gcdf(rgcd1))
        for i in range(len(am)):
            acpy=list(am)
#            del acpy[i]
#            acpy.append(gcdrg1)
            acpy[i]=gcdrg1
            gcdx=gcdf(acpy)
            if gcdx>gcdv:
                gcdv=gcdx
    print(gcdv)
### BUGGY CODE ###

N = int(input())
L = list(map(int, input().split()))
count = 0
L.sort()
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            if L[k] < L[i] + L[j]:
                if L[j] < L[i] + L[k]:
                    count += 1
            else:
                break

print(count)


### FIXED CODE ###

from bisect import bisect_right
N = int(input())
L = list(map(int, input().split()))
count = 0
L.sort()
for i in range(N):
    for j in range(i):
        m = L[i] - L[j]
        k = bisect_right(L, m)
        n = max(0, j - k)
        count += n
print(count)
### BUGGY CODE ###

n = int(input())

a = list(str(n))

ans = 0

for i in range(len(a)-3):
    for j in range(len(a)-3-i):
        k = a[i:i+4+j]
        if len(k)==4 and int(k[0])%2 !=0:
            continue
        elif len(k)==4 and k[0]=="2" and k[1]!= "0":
            continue
        elif len(k)==5 and int(k[1])%2 != 0:
            continue
        elif len(k)==6 and int(k[2])%2 == 0:
            continue
        elif int("".join(map(str, k)))%2019 == 0:
            ans = ans + 1

print(ans)

### FIXED CODE ###

s = input()[::-1]
#sは文字列 逆向きにしている
sum_of_digits = 0

cnts = [0] * 2019

cnts[0] = 1

d = 1

for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10         #dを１０倍
    d %= 2019       #dを2019で割る（2019は10と素なので意味はないかも）
    cnts[sum_of_digits] += 1
    #cntは2019個ある　modの値が同じごとに個数を計算して足したもの

ans = 0
    
for cnt in cnts:
    ans += cnt * (cnt - 1) // 2  
                    #cnt conbination 2
                    #mod ごとに m(m − 1)/2
        
#(i, j)が条件をみたすのはTi−1 == Tj (mod2019)のとき
#Ti−1 - Tj == 0 (mod2019) と等価 Ti−1 == Tj (mod2019)

print(ans)
### BUGGY CODE ###


from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
S = [input() for _ in range(H)]


move = ((1, 0), (-1, 0), (0, 1), (0, -1))
visited = [[10**8] * W for _ in range(H)]


def bfs(i, j, d):
    visited[i][j] = d
    que = deque([(i, j, d)])

    while que:
        ci, cj, d = que.popleft()

        for di, dj in move:
            ni, nj = ci + di, cj + dj
            if not (0 <= ni < H and 0 <= nj < W) or visited[ni][nj] <= d:
                continue
            if S[ni][nj] == '.':
                visited[ni][nj] = d
                que.append((ni, nj, d))

        for di in range(-2, 3):
            for dj in range(-2, 3):
                ni, nj = ci+di, cj+dj
                if not (0 <= ni < H and 0 <= nj < W) or visited[ni][nj] <= d+1:
                    continue
                if S[ni][nj] == '.':
                    visited[ni][nj] = d+1
                    que.append((ni, nj, d+1))


bfs(Ch-1, Cw-1, 0)
# print(visited)
if visited[Dh-1][Dw-1] == 10**8:
    print(-1)
else:
    print(visited[Dh-1][Dw-1])


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
S = [list(input()) for _ in range(H)]

visited = [[-1] * W for _ in range(H)]

que = deque([(Ch-1, Cw-1, 0)])
move = ((1, 0), (-1, 0), (0, 1), (0, -1))
while que:
    ci, cj, d = que.popleft()

    if visited[ci][cj] != -1:
        continue
    visited[ci][cj] = d

    for di, dj in move:
        ni, nj = ci + di, cj + dj
        if not (0 <= ni < H and 0 <= nj < W) or visited[ni][nj] != -1:
            continue
        if S[ni][nj] == '.':
            que.appendleft((ni, nj, d))

    for di in range(-2, 3):
        for dj in range(-2, 3):
            ni, nj = ci+di, cj+dj
            if not (0 <= ni < H and 0 <= nj < W)  \
                    or visited[ni][nj] != -1:
                continue
            if S[ni][nj] == '.':
                que.append((ni, nj, d+1))
    # print(visited)
    # exit()

if visited[Dh-1][Dw-1] == -1:
    print(-1)
else:
    print(visited[Dh-1][Dw-1])
### BUGGY CODE ###

n = int(input())
s = input()

mem_left_len = [-1 for i in range(n)]
mem_right_len = [-1 for i in range(n)]

def len_left(leader):
  length = mem_left_len[leader]
  if length > 0:
    return length
  else:
    length = len([x for x in s[:leader] if x == 'W'])
    mem_left_len[leader] = length
    return length

def len_right(leader):
  length = mem_right_len[leader]
  if length > 0:
    return length
  else:
    length = len([x for x in s[leader+1:] if x == 'E'])
    mem_right_len[leader] = length
    return length
  
  
numpeople = 3 * 10 ** 5 + 1
for leader in range(n):
  left = len_left(leader)
  right = len_right(leader)
  numpeople = min(numpeople, left + right)

print(numpeople)

### FIXED CODE ###

n = int(input())
s = input()

turn_east = [0 for x in range(n)]
turn_west = [0 for x in range(n)]
total = [0 for x in range(n)]

for i in range(n):
  if i > 0:
    if s[i-1] == 'W':
      turn_east[i] = turn_east[i-1]+1
    else:
      turn_east[i] = turn_east[i-1]

    if s[n-i] == 'E':
      turn_west[n-1-i] = turn_west[n-i]+1
    else:
      turn_west[n-1-i] = turn_west[n-i]

for j in range(n):
  total[j] = turn_east[j] + turn_west[j]

print(min(total))
### BUGGY CODE ###

N, M = map(int, input().split())

B = [list(map(int, input().split())) for _ in range(M)]

class Group:
    id = 0
    def __init__(self):
        self.id = Group.id
        Group.id += 1
        self.count = 1
        self.root = None

    def top(self):
        w = self
        while not w.root is None:
            w = w.root
        return w

    def union(self, g):
        ss, gg = self.top(), g.top()
        ss.count += gg.count
        gg.root = ss.top()

pt = []
G = [Group() for x in range(N+1)]
idx = 0
cnt = 0
while len(B):
    x, y = B.pop()
    wx = G[x].top()
    wy = G[y].top()
    if wx is wy:
        pt.append(0)
    else:
        pt.append(wx.count * wy.count)
        wx.union(wy)

    #print(G)

cnt = 0
while len(pt):
    cnt += pt.pop()
    print(cnt)


### FIXED CODE ###

N, M = map(int, input().split())
B = [list(map(int, input().split())) for _ in range(M)]

pt = []
G = [[None, 1] for x in range(N+1)]

def find(x):
    n = G[x]
    c = []
    while not n[0] is None:
        c.append(n)
        n = n[0]
    for ci in c:
        ci[0] = n
    return n

cnt = 0
while len(B):
    x, y = B.pop()
    wx = find(x)
    wy = find(y)
    if wx is wy:
        pt.append(0)
    else:
        pt.append(wx[1] * wy[1])
        wx[1] += wy[1]
        wy[0] = wx

    #print(G)

cnt = 0
for _ in range(M):
    cnt += pt.pop()
    print(cnt)
### BUGGY CODE ###

import math


def nontrivial_divisors(x):
	for i in range(1, math.floor(math.sqrt(x)) + 1):
		d, m = divmod(x, i)
		if m == 0:
			if i != x:
				yield i
			if d != x:
				yield d


def solve(n, qs):
	ps = [0] # sent.
	ps.extend(qs)
	balls = [0] * (n + 1)
	vals = [0] * (n + 1)
	divs = [set(nontrivial_divisors(i)) for i in range(n + 1)]
	first = n // 2 + 1
	last = n
	while True:
		for i in range(first, last + 1):
			if vals[i] % 2 != ps[i]:
				balls[i] += 1
				vals[i] += 1
				for j in divs[i]:
					vals[j] += 1
		if first == 1:
			break
		last = first - 1
		first = last // 2 + 1
	for i in range(1, n + 1):
		if vals[i] % 2 != ps[i]:
			return None
	else:
		bs = [b for b in range(1, n + 1) if balls[b]]
		m = len(bs)
		return m, bs
	

def main():
	n = int(input())
	qs = [int(q) for q in input().split()]
	res = solve(n, qs)
	if res is None:
		print(-1)
	else:
		m, bs = res
		print(m)
		print(*bs)


if __name__ == "__main__":
	main()

### FIXED CODE ###

import math
import sys


def nontrivial_divisors(x):
	for i in range(1, math.floor(math.sqrt(x)) + 1):
		d, m = divmod(x, i)
		if m == 0:
			if i != x:
				yield i
			if d != x:
				yield d


def solve(n, qs):
	ps = [0] # sent.
	ps.extend(qs)
	balls = [0] * (n + 1)
	vals = [0] * (n + 1)
	divs = [set() for _ in range(n + 1)]
	for i in range(1, n // 2 + 1):
		for j in range(2, n // i + 1):
			divs[i * j].add(i)
	# print(divs, file=sys.stderr)
	first = n // 2 + 1
	last = n
	while True:
		for i in range(first, last + 1):
			if vals[i] % 2 != ps[i]:
				balls[i] += 1
				vals[i] += 1
				for j in divs[i]:
					vals[j] += 1
		if first == 1:
			break
		last = first - 1
		first = last // 2 + 1
	for i in range(1, n + 1):
		if vals[i] % 2 != ps[i]:
			return None
	else:
		bs = [b for b in range(1, n + 1) if balls[b]]
		m = len(bs)
		return m, bs
	

def main():
	n = int(input())
	qs = [int(q) for q in input().split()]
	res = solve(n, qs)
	if res is None:
		print(-1)
	else:
		m, bs = res
		print(m)
		print(*bs)


if __name__ == "__main__":
	main()
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

import copy
import itertools

from functools import lru_cache
#@lru_cache(maxsize = None)

PPP = 1000000007

# 整数の入力
#n = int(input())

# スペース区切りの整数の入力
#a = [int(x) for x in input().split()]
a, b, c, d = map(int, input().split())
#print("sp", n, k, file=sys.stderr)
#p, q, r = map(int, input().split())
#s = [int(x) for x in input().split()]
#t = [int(x) for x in input().split()]

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))
#  a.append([int(x) for x in input().split()])
#p = [int(x) for x in input().split()]
#a.sort()
#print(l, file=sys.stderr)

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

#cache = dict()

import re

def doit():
  res = 0
  for x in range(a, b + 1):
    if x % c == 0:
      continue
    if x % d == 0:
      continue
    res += 1
  return res

#print(doit([0] * 4))
#doit(s)
#print(doit())
try:
  print(doit())
except Exception as e:
  print("e", e, file=sys.stderr)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

import copy
import itertools

from functools import lru_cache
#@lru_cache(maxsize = None)

PPP = 1000000007

# 整数の入力
#n = int(input())

# スペース区切りの整数の入力
#a = [int(x) for x in input().split()]
a, b, c, d = map(int, input().split())
#print("sp", n, k, file=sys.stderr)
#p, q, r = map(int, input().split())
#s = [int(x) for x in input().split()]
#t = [int(x) for x in input().split()]

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))
#  a.append([int(x) for x in input().split()])
#p = [int(x) for x in input().split()]
#a.sort()
#print(l, file=sys.stderr)

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

#cache = dict()

import re
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
def count(c):
  return b // c - (a-1) // c

def doit():
  res = b + 1 - a
  print(res, file=sys.stderr)
  res -= count(c)
  print(res, file=sys.stderr)
  res -= count(d)
  print(res, file=sys.stderr)
  l = lcm(c, d)
  print(l, file=sys.stderr)
  res += count(l)
  print(res, file=sys.stderr)
  return res

#print(doit([0] * 4))
#doit(s)
#print(doit())
try:
  print(doit())
except Exception as e:
  print("e", e, file=sys.stderr)
### BUGGY CODE ###

n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0

for i in range(n):
    for j in range(i+1, n):
        length = l[i] + l[j]

        for k in range(j+1, n):
            if l[k] >= length:
                break
            else:
                ans += 1

print(ans)

### FIXED CODE ###

import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
biSet = set()


for i in range(n):
    for j in range(i+1, n):
        length = l[i] + l[j]

        index = bisect.bisect_left(l[j+1:], length)
        #print(index)
        if index > 0:
            ans += index


print(ans)
### BUGGY CODE ###

# ABC 066 C
N = int(input())
A = input().split()

tmp = []
for i,a in enumerate(A):
    if i %2!=0:
        A =list(a)
        A.extend(tmp)
        tmp=A
    else:
        tmp.append(a)
if N%2!=0:
    tmp=tmp[::-1]
print(' '.join(tmp))

### FIXED CODE ###

# ABC 066 C
N = int(input())
A = input().split()
from collections import deque

tmp = deque([])
for i,a in enumerate(A):
    if i %2!=0:
        tmp.appendleft(a)
    else:
        tmp.append(a)
if N%2!=0:
    tmp.reverse()
print(' '.join(tmp))
### BUGGY CODE ###

def cal_minX(A,N,M):
    """
    hit A内の数全てでXが割り切れ、かつ商が奇数だったらTrue
    """
    modA=list(map(lambda x:x%2,A))
    max_A=max(A)
    #A内に偶奇が混在する場合は解が存在しない
    if len(set(modA))==2:
        no_ans=True
        minX=0
    else:
        fin=False
        no_ans=False
        i=0
        while fin==False:
            coef=2*i+1
            if max_A*coef>M:
                fin=True
                no_ans=True
            else:
                hit=True
                for n in range(N):
                    if max_A*coef%A[n]==0:
                        if (max_A*coef//A[n])%2==1:
                            pass
                        else:
                            hit=False
                            break
                    else:
                        hit=False
                        break

                if hit==False:
                    i+=1
                else:
                    fin=True
        minX=max_A*coef
    return no_ans,minX

def main():
    #input
    N,M=map(int,input().strip().split())
    A=list(map(int,input().strip().split()))
    A=list(map(lambda x:x//2,A))
    
    #題意を満たす最小のXを求める。
    no_ans,minX=cal_minX(A,N,M)
    #1-Mの中にminXの奇数倍数がいくつあるか調べる
    if minX>M or no_ans:
        return 0
    else:
        if M//minX%2==1:
            return M//minX//2+1
        else:
            return M//minX//2
if __name__=="__main__":
    print(main())

### FIXED CODE ###

def divider(A,N):
    """
    リストA内の全要素が全て2**nで割れるときTrueを返す
    """
    cnt_list=[]
    same=True
    for n in range(N):        
        tmp=A[n]
        cnt=0
        while tmp%2==0:
            tmp//=2
            cnt+=1
        cnt_list.append(cnt)
        if n>=1 and cnt!=cnt_list[n-1]:
            same=False
            break
    return same       

def cal_minX(A,N,M):
    """
    hit A内の数全てでXが割り切れ、かつ商が奇数だったらTrue
    """
    max_A=max(A)

    if divider(A,N)==False:
        no_ans=True
        minX=0
    else:
        fin=False
        no_ans=False
        i=0
        while fin==False:
            coef=2*i+1
            if max_A*coef>M:
                fin=True
                no_ans=True
            else:
                hit=True
                for n in range(N):
                    if max_A*coef%A[n]==0:
                        if (max_A*coef//A[n])%2==1:
                            pass
                        else:
                            hit=False
                            break
                    else:
                        hit=False
                        break

                if hit==False:
                    i+=1
                else:
                    fin=True
        minX=max_A*coef
    return no_ans,minX

def main():
    #input
    N,M=map(int,input().strip().split())
    A=list(map(int,input().strip().split()))
    A=list(map(lambda x:x//2,A))
    
    #題意を満たす最小のXを求める。
    no_ans,minX=cal_minX(A,N,M)
    #1-Mの中にminXの奇数倍数がいくつあるか調べる
    if no_ans:
        return 0
    else:
        if M//minX%2==1:
            return M//minX//2+1
        else:
            return M//minX//2
if __name__=="__main__":
    print(main())
### BUGGY CODE ###

from bisect import bisect_right

N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort()

for i in range(M):
    a = A.pop()//2
    idx = bisect_right(A, a)
    A.insert(idx, a)

print(sum(A))

### FIXED CODE ###

import heapq

N, M = map(int, input().split())
A = list(map(lambda a: int(a)*(-1), input().split()))

heapq.heapify(A)

for i in range(M):
    a = -heapq.heappop(A)//2
    heapq.heappush(A, -a)
    
print(-sum(A))
### BUGGY CODE ###

n, w = map(int, input().split())
a = [tuple(map(int, input().split())) for _ in range(n)]

# dp[i][j] := i番目の以前の品物から、重さがj以下になるような最大の価値
dp = [[-1]*(w+1) for _ in range(n+1)]
for i in range(w+1):
    dp[0][i] = 0

for i in range(1, n+1):
    for j in range(w+1):
        # 重さjより上なら、選ばない
        if j < a[i-1][0]:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-a[i-1][0]] + a[i-1][1])
            
print(dp[n][w])

### FIXED CODE ###

n, w = map(int, input().split())
a = [tuple(map(int, input().split())) for _ in range(n)]

# dp[i][j] := i番目の以前の品物から、重さがj以下になるような最大の価値
dp = [[-1]*(w+1) for _ in range(n+1)]
for i in range(w+1):
    dp[0][i] = 0

for i in range(1, n+1):
    for j in range(w+1):
        # 重さjより上なら、選ばない
        if j < a[i-1][0]:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-a[i-1][0]] + a[i-1][1])
            
print(dp[n][w])
### BUGGY CODE ###

def main():
    number = int(input())
    num_list = list(map(int, input().split()))
    total = sum([num_list[i]*num_list[j] % (10**9 + 7) for i in range(number) for j in range(i+1, number)])
    print(total % (10**9 + 7))
if __name__ == '__main__':
    main()

### FIXED CODE ###

from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    num_list_sum = sum(num_list)
    total = 0
    for i in range(number):
        num_list_sum -= num_list[i]
        total += num_list[i] * num_list_sum
    print(total % (10**9+7))
if __name__ == '__main__':
    main()
### BUGGY CODE ###

n=int(input())
l=sorted([(v,i+1) for i,v in enumerate(list(map(int,input().split())))],reverse=1)
dp=[[0]*(n+1) for i in range(n+1)]
for ko in range(1,n+1):
    for x in range(ko+1):
        ret=0
        v,i=l[ko-1]
        y=ko-x
        if y>=1:ret=max(ret,dp[x][y-1]+abs(n-y+1-i)*v)
        if x>=1:ret=max(ret,dp[x-1][y]+abs(x-i)*v)
        dp[x][y]=ret
print(max(dp[a][n-a] for a in range(n+1)))

### FIXED CODE ###

n=int(input())
l=sorted([(v,i+1) for i,v in enumerate(list(map(int,input().split())))],reverse=1)
dp=[[0]*(n+1) for i in range(n+1)]
for ko in range(1,n+1):
    for x in range(ko+1):
        ret=0
        v,i=l[ko-1]
        y=ko-x
        if y>=1:ret=max(ret,dp[x][y-1]+abs(n-y+1-i)*v)
        if x>=1:ret=max(ret,dp[x-1][y]+abs(x-i)*v)
        dp[x][y]=ret
print(max(dp[a][n-a] for a in range(n+1)))
### BUGGY CODE ###

N = int(input())

inf = float('inf')

import heapq
def dijkstra(adj, n, st=1):
    dj = [inf] * (n + 1)
    paths = dict((x, [x]) for x in range(n + 1))
    dj[st] = 0
    q = []
    heapq.heappush(q, (0, st))
    while q:
        fc, fn = heapq.heappop(q)
        if dj[fn] < fc: continue
        for tn, lc in adj[fn]:
            if dj[fn] + lc < dj[tn]:
                dj[tn] = dj[fn] + lc
                paths[tn] = paths[fn] + [tn]
                heapq.heappush(q, (dj[tn], tn))
    return dj, paths

import itertools
def reachable(adj, st):
    reached = set([st])
    cur = set([st])
    while cur:
        nxt = set(itertools.chain(*[[y[0] for y in adj[x]] for x in cur]))
        reached.update(cur)
        cur = nxt - reached
    return reached

adj = dict((x, []) for x in range(N + 1))
for _ in range(N - 1):
    a, b = map(int, input().split())
    adj[a].append((b, 1))
    adj[b].append((a, 1))

costs, paths = dijkstra(adj, N, 1)
main_street = paths[N]
import math
mid = math.ceil(len(main_street) / 2) - 1
mid_v0 = main_street[mid]
mid_v1 = main_street[mid + 1]
adj[mid_v0] = filter(lambda x: x[0] != mid_v1, adj[mid_v0])
adj[mid_v1] = filter(lambda x: x[0] != mid_v0, adj[mid_v1])

fennec = len(reachable(adj, 1))
snuke = N - fennec

print("Fennec" if fennec > snuke else "Snuke")

### FIXED CODE ###

N = int(input())

inf = float('inf')

import heapq
def dijkstra(adj, n, st=1):
    dj = [inf] * (n + 1)
    dj[st] = 0
    q = []
    heapq.heappush(q, (0, st))
    while q:
        fc, fn = heapq.heappop(q)
        if dj[fn] < fc: continue
        for tn, lc in adj[fn]:
            if dj[fn] + lc < dj[tn]:
                dj[tn] = dj[fn] + lc
                heapq.heappush(q, (dj[tn], tn))
    return dj

adj = dict((x, []) for x in range(N + 1))
for _ in range(N - 1):
    a, b = map(int, input().split())
    adj[a].append((b, 1))
    adj[b].append((a, 1))

c_f = dijkstra(adj, N, 1)
c_s = dijkstra(adj, N, N)

score = 0
for i in range(1, N + 1):
    if c_f[i] > c_s[i]:
        score -= 1
    else:
        score += 1

print("Fennec" if score > 0 else "Snuke")
### BUGGY CODE ###

n,k = map(int,input().split())
p = list(map(int,input().split()))

t = [0]*n
n = n-(k-1)
for i in range(n):
    for j in range(i,i+k):
        t[i] += p[j]
T = t.index(max(t))
ans = 0
for i in range(k):
    ans += (p[T+i]+1)/2
print(ans)

### FIXED CODE ###

n,k = map(int,input().split())
p = list(map(int,input().split()))

t = [0]*n
for j in range(k):
    t[0] += p[j]
for i in range(1,n-k+1):
    t[i] = t[i-1]-p[i-1]+p[i+k-1]
T = t.index(max(t))
ans = 0
for i in range(k):
    ans += (p[T+i]+1)/2
print(ans)
### BUGGY CODE ###

def resolve():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    ans = [0] * N
    max_tmp = [0] * K
    start_index = 0
    for i in range(N - K + 1):
        tmp = P[i: i + K]
        ans[i] = (1 + P[i]) / 2
        if sum(max_tmp) < sum(tmp):
            max_tmp = tmp
            start_index = i

    for i in range(N - K, N):
        ans[i] = (1 + P[i]) / 2

    print(sum(ans[start_index: start_index + K]))


resolve()

### FIXED CODE ###

import itertools


def resolve():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    P = [(1 + p) / 2 for p in P]
    accumulate_P = [0] + list(itertools.accumulate(P))

    ans = 0
    for ii in range(N - K + 1):
        range_sum_P = accumulate_P[ii + K] - accumulate_P[ii]
        ans = max(ans, range_sum_P)

    print(ans)

resolve()
### BUGGY CODE ###

import statistics
N = int(input())
L = list(map(int,input().split()))
for i in range(N):
    Li = L[0:i] + L [i+1::]
    k = statistics.median(Li)
    print(k)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = tuple(a)
a.sort()
A1 = a[n//2-1]
A2 = a[n//2]
med = (A1+A2)/2
for i in range(n):
    if b[i] <= med:
        print(A2)
    else:
        print(A1)