peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n, y = map(int, input().split(' '))
a = False
for i in range(0, n+1):
    for i2 in range(0, n-i):
        c = n - i2 - i
        if i*10000 + i2 * 5000 + c * 1000 == y:
            print (i, i2, c)
            a = True
if a == False:
    print ("-1 -1 -1")
# Judge status: Accepted
n, k = map(int, input().split())
xxx = list(map(int, input().split()))
print(min(min(abs(l), abs(r)) + r - l for l, r in zip(xxx, xxx[k - 1:])))
# Judge status: Accepted
X, Y = map(int, input().split())
mod = 10**9 + 7

def comb(n, r, mod):
    X = 1
    Y = 1
    for i in range(1,r+1):
        X = (X*(n-i+1))%mod
        Y = (Y*i)%mod
    return (X*pow(Y, mod-2, mod))%mod

if (X+Y)%3 != 0 :
    print(0)
elif X < (X+Y)//3 or Y < (X+Y)//3 :
    print(0)
else :
    i = X - (X+Y)//3
    print(comb((X+Y)//3, i, mod))
# Judge status: Wrong Answer
N = input()
array = list(map(int, N))
S = sum(array)

if S%9 == 0:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
from itertools import combinations
def gcd(a,b):
    if(b==0):
        return a;
    return gcd(b,a%b);
mx =0;

n  =int(input())
a = list(map(int,input().split()))

x = combinations(a,2)
for a,b in x:
    if mx<gcd(a,b):
        mx = gcd(a,b)
print(mx)
# Judge status: Wrong Answer
i = list(map(int, input().split())) #i_1 i_2を取得し、iに値を入れる
i=(sorted(i,reverse=True))
print(i[0]+i[1])
# Judge status: Wrong Answer
n=int(input())
a=[]
for i in range(n):
    a.append(input())
sort_a=sorted(a,reverse=True)
if sort_a[0]==sort_a[1]:
    for _ in range(n):
        print(sort_a[0]) 
else:
    for i in range(n):
        if a[i]==sort_a[0]:
            print(sort_a[1])
        else:
            print(sort_a[0])
# Judge status: Accepted
A = set(input().split())
print(len(A))
# Judge status: Accepted
def main(N,K,p):
    sumi = 0
    ruiseki = [0] * (N+1)
    for i in range(N):
        ruiseki[i+1] = ruiseki[i] + p[i]
    for j in range(N-K+1):
        sumi = max(sumi, (ruiseki[j+K]-ruiseki[j]))
    return (sumi + K) / 2
N,K = map(int,input().split())
p = list(map(int,input().split()))
print(main(N,K,p))
# Judge status: Accepted
N,K,S=map(int, input().split())
ans=[0]*N
if K==0:
    if S==10**9:
        for i in range(N):
            ans[i]=S-1
    else:
        for i in range(N):
            ans[i]=S+1
else:
    for i in range(K):
        ans[i]=S
    if S==10**9:
        for i in range(K,N):
            ans[i]=S-1
    else:
        for i in range(K,N):
            ans[i]=S+1
print(*ans)
# Judge status: Accepted
N=int(input())
ans = 1
while ans*2 <= N:
  ans*=2
print(ans)
# Judge status: Wrong Answer
A = list(map(int, input().split()))
print(A[0]+A[1])
# Judge status: Accepted
from math import ceil

N, K = map(int, input().split())
A = list(map(int, input().split()))
print(ceil((N-1)/(K-1)))
# Judge status: Accepted
print("NYoe s"[input()in["hi"*x for x in range(6)]::2])
# Judge status: Wrong Answer
N, T = map(int,input().split())
cnt = T+1
for _ in range(N):
    c, t = map(int,input().split())
    if t <= T: 
        cnt = min(cnt,c)
if cnt == T+1:
    print("TLE")
else:
    print(cnt)
# Judge status: Accepted
def main():
    N=int(input())
    A=list(map(int,input().split()))
    ans=1000
    stocks=0
    for i in range(N-1):
        if A[i]>A[i+1]:
            ans+=stocks*A[i]
            stocks=0
        else:
            stocks+=(ans//A[i])
            ans-=(ans//A[i])*A[i]
    print(ans+stocks*A[-1])
if __name__=='__main__':
    main()
# Judge status: Accepted
S,T = input().split()

print(T+S)
# Judge status: Accepted
n = int(input())
A = []
for i in range(2):
    A.append(list(map(int, input().split())))

start = sum(A[0]) + A[1][-1]
B = [start]
for i in range(n - 1):
    start = start - A[0][-1 - i] + A[1][-2 - i]
    B.append(start)
print(max(B))
# Judge status: Accepted
A, B, C, K = map(int, input().split(" "))
if A + B >= K:
	if K <= A:
		print(K)
	else:
		print(A)
else:
	print(A-(K-A-B))
# Judge status: Accepted
T = list(input())
for i in range(len(T)):
  if T[i] == '?':
    T[i] = 'D'
print(''.join(T))
# Judge status: Accepted
a,b,c,d,e = map(int,input().split())

if a*1 == 0:
    print(1)
elif b*1 == 0:
    print(2)
elif c*1 == 0:
    print(3)
elif d*1 == 0:
    print(4)
elif e*1 == 0:
    print(5)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=10**10
for i in range(201):
  cnt=0
  for j in range(n):
    cnt+=(a[j]-(i-100))**2
  ans=min(ans,cnt)
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
print('Yes' if n == m else 'No')
# Judge status: Accepted
a = int(input())
b = [int(i) for i in input().split(" ")]
Max = max(b)
c = -Max
for i in range(a):
    c+=b[i]
 
if Max<c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A, B = map(int, input().split())
ans = -1

for price in range(1, 1251):
    if int(price * 0.08) == A and int(price * 0.1) == B:
        ans = price
        break

print(ans)
# Judge status: Wrong Answer
X,Y,Z = map(int,input().split())

X = X-Z
i = 0
while X > 0:
    if X >= Y:
        X = X-Y
        i += 1
    X = X-Z
    
print(i)
# Judge status: Accepted
n,m = map(int, input().split())
r = [0]*(n+1)
r[1] = 1
b0 = [1]*(n+1)
for i in range(m):
    x,y = map(int, input().split())
    b0[x] -= 1
    b0[y] += 1
    if r[x]:
        r[y] = 1
    if b0[x]==0:
        r[x]=0
ans = 0
for j in range(n+1):
    if r[j]:
        ans += 1
print(ans)
# Judge status: Wrong Answer
S = input()
s = [int(c) for c in S]
def to_s(a):
  if a>=0:
    return "+"+str(a)
  return str(a)

for b in [-s[1],s[1]]:
  for c in [-s[2],s[2]]:
    for d in [-s[3],s[3]]:
      if s[0]+b+c+d == 7:
        print(S[0]+to_s(s[1])+to_s(s[2])+to_s(s[3])+"=7")
        exit()
# Judge status: Accepted
n, m = map(int, input().split())
x = min(n, m//2)
y = (m-x*2)//4
print(x+y)
# Judge status: Wrong Answer
def ac_or_wa(n, m):
    if n == m:
        return "AC"
    else:
        return "WA"


n, m = map(int, input().split())
print(ac_or_wa(n, m))
# Judge status: Accepted
n,m=map(int,input().split())
if n==m:
  print("Yes")
else :
  print("No")
# Judge status: Accepted
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, Vs):
    Vs.sort()
    ans = Vs[0]
    for i in range(1, N):
        ans = (ans + Vs[i]) / 2
    print(ans)


if __name__ == '__main__':
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    Vs = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N, Vs)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if a<c and b>c-a:
    print('YES')
else :
    print('NO')
# Judge status: Accepted
a=list(input())
count=0

       
for i in range(4):
  if i==3:
    break
  if a[i]==a[i+1] :
    count+=1
if count>=1:
  print('Bad')
else:
  print('Good')
# Judge status: Wrong Answer
N = int(input())
s = input()
t = input()

if s[N-1] == t[0]:
  print(len(s[:N-1] + t))
elif s == t:
  print(len(s))
else:
  print(len(s + t))
# Judge status: Accepted
n = int(input())
b = list(map(int,input().split()))
ans = b[0] + b[-1]
for i in range(n-2):
    ans += min(b[i],b[i+1])
print(ans)
# Judge status: Accepted
k, a, b = map(int, input().split())
c = 1
if a + 2 >= b: print(c+k)
else:
    k = k - (a+1)
    c = b
    c += (k//2)*(b-a) + k%2
    print(c)
# Judge status: Accepted
if input().islower():
  print("a")
else:
  print("A")
# Judge status: Wrong Answer
import  math

R=int(input())

print(2*math.pi)
# Judge status: Accepted
W, H, x, y = map(float, input().split())
ans = W * H / 2
count = 0
if W / 2 == x and H / 2 == y:
  count = 1
print(ans, count)
# Judge status: Wrong Answer
def solve(X:int) -> int:
    if(X < 100):return 0
    first = int(str(X)[0])
    seccond = int(str(X)[1])
    ans = 0
    if(first >= 6):
        ans += first + 200
    else:
        ans += first + 100
    ans += (seccond * 2) * 105
    return 1 if(X - ans > 0) else 0


def main():
    X = int(input())
    print(solve(X))

if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
cake = N // 4
donuts = N // 7
calcs = False
for i in range(cake + 1):
  for j in range(donuts + 1):
    s = i * 4 + j * 7
    if s == N:
      calcs = True
      break
print('Yes' if calcs is True else 'No')
# Judge status: Accepted
n = int(input())
candy_map = []
candy_map.append(list(map(int, input().split())))
candy_map.append(list(map(int, input().split())))
ans = 0
for i in range(n):
    upper = sum(candy_map[0][:i])
    lower = sum(candy_map[1][i+1:])
    Sum = upper + lower + candy_map[0][i] + candy_map[1][i]
    ans = max(ans, Sum)
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
freq = dict()
for i in range(n):
  a, b = map(int, input().split())
  if freq.get(a): freq[a] += b
  else: freq[a] = b
f_asc = sorted(freq.items(), key=lambda x: x[0])
idx = 0
for kv in f_asc:
  idx += kv[1]
  if idx >= k:
    print(kv[0])
    break
# Judge status: Accepted
N, K = map(int, input().split())

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

for i in range(N - K):
    if A[i] < A[i + K]:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
A,B,C,D = map(int,input().split())
x = ((A+D)-1)/D
y = ((B+C)-1)/B
if(x>=y):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

d = dict()
for v in a:
    if v not in d:
        d[v] = 1
    else:
        d[v] += 1

l = []
for v in d.values():
    l.append(v)
l.sort()

print(sum(l[:len(l)-k]))
# Judge status: Accepted
n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
d = [0]
for i in range(len(l)):
    d.append(d[i] + l[i])
print(len(list(filter(lambda d_i: d_i <= x, d))))
# Judge status: Accepted
a,v = map(int, input().split())
b,w = map(int, input().split())
t=int(input())

rev = v-w
if rev*t >= abs(b-a):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import sys
input = sys.stdin.readline
import numpy as np
from decimal import *

n = int(input())

Li = [[int(e) for e in input().split()] for _ in range(n)]

Li = np.array(Li)
LA = Li[:,0]
LB = Li[:,1]

LA.sort()
LB.sort()


if n %2 == 0: # n = 2m
    idx =n //2 -1
    min = (LA[idx] + LA[idx+1])
    max = (LB[idx] + LB[idx+1])

else: # n = 2m - 1
    idx =(n+1) //2 -1
    min = LA[idx]
    max = LB[idx]

print(max - min +1 )
# Judge status: Accepted
#B
n = int(input())

sp = [list(input().split()) for i in range(n)]
for i in range(n):
    sp[i].append(i + 1)
# print(sp)
sspp = sorted(sp, key=lambda x: int(x[1]), reverse=True)
sspp.sort(key=lambda x: x[0])
for i in range(n):
    print(sspp[i][2])
# Judge status: Accepted
A = input()

# 文字列において、全ての文字が大文字かどうか判定するには str.isupper() 
# 文字列において、全ての文字が小文字かどうか判定するには str.islower()

ans = ''
if A.isupper(): ans = 'A'
else: ans = 'a'

print(ans)
# Judge status: Accepted
n = int(input())
a = 2
b = 1
for i in range(n-1):
    tmp = b
    b += a
    a = tmp

print(b)
# Judge status: Wrong Answer
import heapq
n = int(raw_input())
heap = [map(int, raw_input().split(' '))[::-1] for _ in range(n)]
heapq.heapify(heap)

def f(heap):
	t = 0
	while(heap):
		nd,ct = heapq.heappop(heap)
		gap = nd - t
		while(heap and heap[0][0] == nd):
			u,v = heapq.heappop(heap) 
			t += v
			gap -= v
		if gap < 0: return False
		while(heap and heap[0][1] <= gap):
			_,v = heapq.heappop(heap)
			gap -= v
			t += v
	return True
print 'Yes' if f(heap) else 'No'
# Judge status: Accepted
a, b, n = map(int, input().split())

ans = 0

if n < b:
    ans = int(a*n/b)
    print(ans)

else:
    ans = int(a * (b - 1) / b)
    print(ans)
# Judge status: Accepted
from sys import stdin, setrecursionlimit
from bisect import bisect_right

setrecursionlimit(10 ** 9)
INF = 1 << 60


def input():
    return stdin.readline().strip()


def main():
    N = int(input())
    A = tuple(int(input()) for _ in range(N))
    B = [-A[0]]

    for a in A[1:]:
        if a <= -B[-1]:
            B.append(-a)
        else:
            B[bisect_right(B, -a)] = -a

    print(len(B))


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys

S = str(input())

Sum = 0

for i in range(len(S)):
    Sum += int(S[i])

if Sum % 9 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S = str(input())

if S == 'SUN':
    print('7')
elif S == 'MON':
    print('6')
elif S == 'TUE':
    print('5')
elif S == 'WED':
    print('4')
elif S == 'THU':
    print('3')
elif S == 'FRI':
    print('2')
elif S == 'SAT':
    print('1')
# Judge status: Wrong Answer
a,b,c=map(int,input().split());print(a*b/2)
# Judge status: Accepted
s = input()

xx = s[0] + s[1]
yy = s[2] + s[3]
xx = int(xx)
yy = int(yy)

if 1 <= xx <= 12:
    if yy >= 13 or yy == 0:
        print("MMYY")
    else:
        print("AMBIGUOUS")

if xx == 0 or 13 <= xx <= 99:
    if 1 <= yy <= 12:
        print("YYMM")
    else:
        print("NA")
# Judge status: Accepted
S = input()

s = list(S)
ss = list(reversed(S))

ans = 0
for i in range(len(S)//2):
    if s[i] != ss[i]:
        ans += 1

print(ans)
# Judge status: Accepted
N = int(input())
a=2
while a <= N:
	a*=2
print(int(a/2))
# Judge status: Wrong Answer
x, a, b = map(int, input().split())
A = abs(a - x)
B = abs(b - x)
if A > B:
  print('A')
else:
  print('B')
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    work_list = [tuple(map(int, input().split())) for i in range(n)]

    total = 0
    target = {0, 1, 2}
    pre = {-1}
    for work in work_list:
        max_val = 0
        for i in target - pre:
            if max_val < work[i]:
                max_val = work[i]
                pre = {i}
        total += max_val

    print(total)


if __name__ == '__main__':
    main()
# Judge status: Accepted
def main():
    n = int(input())
    d = sorted(list(map(int,input().split())))
    print(d[n//2]-d[n//2-1])

if __name__ == "__main__":
    main()
# Judge status: Accepted
N=int(input())
*A,=map(int,input().split())
A.sort()
M=A[-1]
A=[-10**9]+A+[10**11]
from bisect import*
P=bisect_right(A,M/2)
if abs(A[P-1]-M/2)>abs(A[P]-M/2):
    m=A[P]
else:
    m=A[P-1]
print(M,m)
# Judge status: Wrong Answer
a,b=map(int,input().split())
cnt=0
while True:
    a+=a-1
    cnt +=1
    if a>b:
        break
print(cnt)
# Judge status: Wrong Answer
a = int(input())
if a < 1000:
  print('ABC' + str(a))
else:
  a = a - 999
  print('ABD' + str(a))
# Judge status: Wrong Answer
s = input()
print(s.replace("2018","2017"))
# Judge status: Accepted
n=int(input())
b=list(map(int,input().split()))
a=list(map(int,input().split()))
ans=0
for i in range(n):
  m=min(b[i],a[i])
  ans+=m
  a[i]-=m
  b[i]-=m
  m=min(b[i+1],a[i])
  ans+=m
  a[i]-=m
  b[i+1]-=m
print(ans)
# Judge status: Wrong Answer
N,X,T =map(int, input().split()) 
print(T*(N//X+1))
# Judge status: Wrong Answer
a,b=5,10
for i in range(5):
    i=int(input())
    a+=(i-1)//10
    if 0<i%10<b:
        b=i%10
print(a*10-(10-b))
# Judge status: Wrong Answer
from math import ceil
def myAnswer(N:int,K:int,A:list) -> int:
   if(N == K): return 1
   total = K *ceil(N/K) - (ceil(N/K) - 1)
   ans = ceil(N/K)
   # print(total,ans)
   if(total < N):
      ans += 1
   return ans

def modelAnswer():
   return
def main():
   N,K = map(int,input().split())
   A = list(map(int,input().split()))
   print(myAnswer(N,K,A[:]))
if __name__ == '__main__':
   main()
# Judge status: Accepted
s = str(input())

if len(s) == 1:
    print('YES')
    exit()

d = {}
for i in range(len(s)):
    if s[i] not in d:
        d[s[i]] = 1
    else:
        d[s[i]] += 1
#print(d)

if len(s) == 2 and len(d) == 2:
    print('YES')
    exit()

if len(d) > 2:
    if max(d.values())-min(d.values()) <= 1:
        print('YES')
    else:
        print('NO')
else:
    print('NO')
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))

if 1 not in A:
    print(-1)
    exit()
bef=1
ans=0
for i in A:
    if i==bef:
        bef+=1
    else:
        ans+=1
print(ans)
# Judge status: Wrong Answer
import sys, math

def input():
    return sys.stdin.readline()[:-1]

def main():
    A = list(map(int,input().split()))
    if A.count(5) == 2 and A.count(7) == 1:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()
# Judge status: Accepted
from math import *
from collections import *
n=int(input())
a=list(map(int,input().split()))
f=Counter(a)
q=int(input())
r=sum(a)
for i in range(q):
    b,c=map(int,input().split())
    re=f[b]
    del f[b]
    if(c in f):
        f[c]+=re
    else:
        f[c]=re
    r+=(c-b)*re
    print(r)
# Judge status: Accepted
import math

H = int(input())
W = int(input())
N = int(input())

print(math.ceil (N / max(H, W)))
# Judge status: Accepted
v = sorted([int(i) for i in input().split()])
print(v[2]*10+v[1]+v[0])
# Judge status: Accepted
import copy
N = int(input())
list_x = list(map(int,input().split()))
sorted_x = copy.copy(list_x)
sorted_x.sort()

L = sorted_x[(N-1)//2]
M = sorted_x[(N+1)//2]
base = (L+M)/2


for i in  list_x:
    if i >= base:
        print(L)
    else:
        print(M)
# Judge status: Accepted
from fractions import gcd
from functools import reduce
 
def lcm(a,b):
    return (a*b)//gcd(a,b)
 
def lcm_list(l):
    return reduce(lcm, l)
 
 
def solve():
    N = int(input())
    T = [int(input()) for _ in range(N)]
    print(lcm_list(T))
    
solve()
# Judge status: Accepted
a,b,c,d = map(int,input().split())
e = b - a + 1
ans_ca = a//c
ans_cb = b//c
ans_c = ans_cb - ans_ca
if a%c== 0:
  ans_c += 1
  
ans_da = a//d
ans_db = b//d
ans_d = ans_db - ans_da
if a%d == 0:
  ans_d += 1

x = c
y = d
for i in range(b):
  n = y%x
  if n == 0:
    break
  y = x
  x = n
z = int(c*d/x)
ans_cda = a//z
ans_cdb = b//z
ans_cd = ans_cdb - ans_cda
if a%z== 0:
  ans_cd += 1
  
print(e-(ans_c+ans_d-ans_cd))
# Judge status: Accepted
n,m=map(int,input().split())
L=list(map(int,input().split()))
total = sum(L)
ans = n-total
if ans <0:
	print(-1)
else:
	print(ans)
# Judge status: Wrong Answer
N, A, B = map(int, input().split())
print(A * N // (A + B) + min(A, N % (A + B)))
# Judge status: Accepted
a, b = map(int, input().split())

if a <= 0 <= b:
    print("Zero")
elif 0 < a <= b:
    print("Positive")
elif a < 0 and 0 < b:
    if a % 2 == 0:
        print("Positive")
    else:
        print("Negative")
else:
    if (b - a) % 2 == 0:
        print("Negative")
    else:
        print("Positive")
# Judge status: Accepted
s = str(input())
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
flag = True

for i in range(len(s)):

    if i%2==1:
        if s[i] not in even:
            flag = False
            break

    elif i%2==0:
        if s[i] not in odd:
            flag = False
            break

if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
# coding: utf-8
# Your code here!
N=int(input())

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

me=A[0]
you=sum(A)-A[0]
ans=abs(me-you)
for i in range(1,N-1):
    me+=A[i]
    you-=A[i]
    ans=min(ans,abs(me-you))

print(ans)
# Judge status: Accepted
import numpy as np
n = int(input())
mod = 10**9+7
a = np.array(list(map(int,input().split())))
ans = 0
for i in range(60):
    #aをiビット右にずらす、iは60桁目まで、&1で対象のビットが1のもの以外を0にその数をカウントする。
    b = np.count_nonzero(a >>i&1)
    ans += ((2**i)*(n-b)*b)%mod
print(ans%mod)
# Judge status: Wrong Answer
A, B, K = map(int, input().split())

for i in range(A , A + K):
    print(i)

for j in range(B - K + 1, B + 1):
    print(j)
# Judge status: Accepted
def main():
  import math
  n,p=map(int,input().split())
  a=list(map(int,input().split()))
  x=[i for i in a if i%2==0]
  y=[i for i in a if i%2==1]
  
  def comb(n,r):
    return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
  
  xl,yl=len(x),len(y)
  ans=0
  
  for i in range(xl+1):
    for j in range(yl+1):
      if j%2==p:
        ans+=comb(yl,j)*comb(xl,i)
        
  print(ans)
if __name__=='__main__':
  main()
# Judge status: Accepted
n,m,x = map(int,input().split())
c = [[int(i) for i in input().split()] for _ in range(n)]
inf = float("inf")
ans = inf
for i in range(1<<n):
    cnt = [0]*m
    cost = 0
    for j in range(n):
        if i >> j & 1:
            cost += c[j][0]
            for k in range(1,m+1):
                cnt[k-1] += c[j][k]
    for j in range(m):
        if cnt[j] < x: break
    else:
        ans = min(cost,ans)
print(ans if ans != inf else -1)
# Judge status: Wrong Answer
n = int(input())
x = sorted(list(map(int, input().split())))

def median(l):
    i = ((len(l)+1)//2) - 1
    return l[i]

for i in range(len(x)):
    print(median(x[:i] + x[i+1:]))
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]

dic = {}

for i in range(N):
  if A[i] in dic.keys():
    dic[A[i]] += 1
  else:
    dic[A[i]] = 1
    
cnt = 0

for j in dic.keys():
  if dic[j] % 2 == 1:
    cnt += 1
    
print(cnt)
# Judge status: Wrong Answer
import itertools
s,k = map(int,input().split())
permutations_lis = list(itertools.product(range(k),repeat=3))
cnt = 0
for i in permutations_lis:
  if i[0] + i[1] + i[2] == s:
    cnt += 1
print(cnt)
# Judge status: Accepted
from itertools import groupby

N,K = map(int,input().split())
S = input()
gnum = len(list(groupby(S)))
if gnum<=2*K-1:
  print(N-1)
else:
  print(min(N-(gnum-2*K),N-1))
# Judge status: Wrong Answer
N = int(input())

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

i = 1
cnt = 0

while i < N-1:
    if A[i-1] <= A[i] <= A[i+1] or A[i-1] >= A[i] >= A[i+1]:
        i += 1
        continue
    else:
        cnt += 1
        i += 2
print(cnt+1)
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")


def main():
    n = int(input())
    x = n * 800
    y = (n // 15) * 200
    print(x - y)


if __name__ == '__main__':
    main()
# Judge status: Accepted
NK = list(map(int, input().split(' ')))
N = NK[0]
K = NK[1]
A = list(map(int, input().split(' ')))

for i in range(K, N):
    if (A[i-K] < A[i]):
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
import collections
s = collections.deque(list(input()))
q = int(input())
cnt = 0
for i in range(q):
    fc = input().split()
    if fc[0] == '1':
        cnt += 1
    else:
        if cnt == 1:
            fc[1] = '1' if fc[1] == '2' else '2'
        if fc[1] == '1':
            s.appendleft(fc[2])
        else:
            s.append(fc[2])
    cnt %= 2
s = list(s)
if cnt == 1:
    s.reverse()
print(*s, sep='')
# Judge status: Wrong Answer
N=int(input())
D=list(map(int,input().split()))

if D[0]!=0:
    print(0)
    exit()


B=[0]*N
for d in D:
    B[d]+=1
if B[0]!=1:
    print(0)
    exit()

ans=1
for i in range(1,N):
    if B[i]==0:break
    ans*=B[i-1]**B[i]

print(ans)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
K = int(input())
print(A + B + C - max(A, B, C) + max(A, B, C) ** K)
# Judge status: Accepted
n=int(input())
a=2
b=1
if n==1:
  print(1)
else:
  for i in range(n-1):
    if i%2==0:
      a=a+b
    else:
      b=a+b
  print(max(a,b))
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

R = int(input())

print(R * 3.141592)
# Judge status: Wrong Answer
n = int(input())
d = [tuple(map(int, input().split())) for _ in range(n)]

ans=0
for k in d:
    if k[0] == k[1]:
        ans+=1
print("YNeos"[ans<3::2])
# Judge status: Accepted
from itertools import combinations

# input
K = int(input())

# check
cnt = len(
    [
        1
        for c in list(combinations(list(range(1, K + 1)), 2))
        if (c[0] + c[1]) % 2 == 1
    ]
)

print(cnt)
# Judge status: Accepted
k = int(input())
a = (k // 2) * ((k + 1) // 2)
print(a)
# Judge status: Wrong Answer
K,N=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
d1=l[len(l)-1]-l[0]
for j in range(len(l)):
	if l[j]>K/2:
		l[j]-=K
l.sort()
d2=l[len(l)-1]-l[0]
print(min(d1,d2))
# Judge status: Accepted
n=int(input())
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))

S=[0]*n

for i in range(n):
  S[i]=sum(a1[0:i+1])+sum(a2[i:n])
print(max(S))
# Judge status: Accepted
def main():
    n, m = map(int, input().split())
    p = (m+1)//2
    q = m//2
    l = 0
    r = 2*p-1
    for i in range(p):
        print(l+1, r+1)
        l += 1
        r -= 1
    l = 2*p
    r = l+2*q
    for i in range(q):
        print(l+1, r+1)
        l += 1
        r -= 1


main()