peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
if n % 2 == 0:
  print(n // 2)
else:
  print(n // 2 + 1)
# Judge status: Accepted
N, M = map(int, input().split())
edges = [[] for i in range(N)]

for i in range(M):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  edges[a].append(b)

for i in edges[0]:
  if N-1 in edges[i]:
    print("POSSIBLE")
    exit()
print("IMPOSSIBLE")
# Judge status: Accepted
a=int(input())
b=input()
if a%2 == 0:
  if b[:a//2]==b[a//2:]:
    print("Yes")
  else:
    print("No")
else:
  print("No")
# Judge status: Accepted
n = int(input())
a = int(input())
if n % 500 <= a:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print("red")
# Judge status: Wrong Answer
N,M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(M):
    A[-1] //= 2
    A.sort()
print(sum(A))
# Judge status: Wrong Answer
a,b,c = map(int, input().split())

if a <= c <= b:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
s=list(input())
if s[0]=='9' or s[1]=='9':
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from collections import Counter
def solve():
    ans = 0
    N = int(input())
    A = list(map(int, input().split()))
    c = Counter(A)
    for i in range(1,10**5-1):
        cnt = 0
        if i-1 in c:
            cnt += c[i-1]
        if i in c:
            cnt += c[i]
        if i+1 in c:
            cnt += c[i+1]
        ans = max(ans,cnt)   
    return ans
print(solve())
# Judge status: Accepted
abc = list(map(int, input().split()))
abc = sorted(abc, reverse=True)
print(abc[0]*10 + abc[1] + abc[2])
# Judge status: Wrong Answer
n = int(input())
A = list(map(int,input().split()))
from  fractions import gcd

first = A[0]
second = A[0]

for a in A:
  second = max(gcd(second, a) ,first)
  first = gcd(first,a)
print(max(first,second))
# Judge status: Accepted
M = 10 ** 6 + 1
N = int(input())
A = list(map(int, input().split()))
 
A.sort()
not_divisible = [True] * (M)
# print(A)

result = 0
for i in range(N):
    target = A[i]
    if not_divisible[target]:
        if i+1 <= N-1 and A[i+1] == A[i]:
            pass
        else:
            result += 1
        for j in range(target, M, target):
            not_divisible[j] = False
print(result)
# Judge status: Wrong Answer
N = int(input())
S = input()

# RGBそれぞれの字数カウント
R = S.count('R')
G = S.count('G')
B = S.count('B')

# 条件２の対象数カウント
ad = R * G * B
ed = 0

for i in range(0, N):
  for j in range(1, N):
    if (i + j) >= N or (i + j * 2) >= N:
      break
    # 判定
    if S[i] != S[i+j] and S[j] != S[i+j*2] and S[i+j*2] != S[i+j]:
      ed += 1

print(ad-ed)
# Judge status: Accepted
O = input()
E = input()

password = []
for i in range(len(O)):
    password += [O[i]]
    if i == len(O) - 1:
        if i != len(E):
            password += [E[i]]
    else:
        password += [E[i]]
print(''.join(password))
# Judge status: Wrong Answer
x=input().split()
print(x[0]+x[1]+x[2])
# Judge status: Wrong Answer
import math
n,k = map(int,input().split())

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

aleft = alist[:alist.index(1)]
aright = alist[alist.index(1)+1:]

ans = math.ceil(len(aleft)/(k-1)) + math.ceil(len(aright)/(k-1))
print(ans)
# Judge status: Accepted
n,m,x,y=map(int,input().split())
xx=list(map(int,input().split()))
yy=list(map(int,input().split()))
a = True
for i in range(-100,100):
    if x < i <= y and max(xx) < i <= min(yy):
        a = False
        break
print('War' if a else 'No War')
# Judge status: Accepted
N = int(input())

s = input()
t = input()

i = 0

while i < N:
    if s[i:] == t[:N-i]:
        break
    else:
        i+=1

print(N+i)
# Judge status: Accepted
n, m = map(int, input().split())

a = (n * (n - 1)) // 2 + (m * (m - 1)) // 2

print(a)
# Judge status: Accepted
a=int(input())

a = a % 10

if a == 2 or a == 4 or a == 5 or a == 7 or a == 9:
    print("hon")
elif a == 0 or a == 1 or a == 6 or a == 8:
    print("pon")
else:
    print("bon")
# Judge status: Wrong Answer
n = int(input())
cnt = 0
for i in range(1, n):
    if len(str(i)) % 2 == 1:
        cnt += 1
    else:
        continue
print(cnt)
# Judge status: Accepted
n, m = map(int, input().split())

if n == 1 and m == 1:
    print(1)
elif n == 1 or m == 1:
    print(n*m - 2)
else:
    print(n*m - (n*2+m*2-4))
# Judge status: Accepted
N = int(input())
#払ったお金
x = N * 800
#15食ワンセットなら何セット？？
y = 200 * (N//15)

print(x-y)
# Judge status: Accepted
N, M = map(int, input().split())
A = sum(list(map(int, input().split())))

print(max(-1, N-A))
# Judge status: Wrong Answer
s = int(input())

x3 = s % (10**9)
y3 = - (s // (10**9))
print("0 0 " + str(10**9) + " 1 " + str(x3) + " " + str(y3))
# Judge status: Accepted
N = int(input())

answer = 0
for n in range(1, int(N**0.5)+1):
  m = N//n if N%n != 0 else N//n-1
  if m >= n:
    answer += (m-n+1)*2-1
print(answer)
# Judge status: Wrong Answer
N=int(input())
B=list(map(int,input().split()))
A=[]
B.insert(0,1000000)
B.append(1000000)
for i in range(1,N+1):
  a=min(B[i],B[i-1])
  A.append(a)
print(A)  
print(sum(A))
# Judge status: Wrong Answer
n,k=map(int,input().split())
s=0
while 1:
  a,b=map(int,input().split())
  if k<=s+b:
    print(a)
    break
  s+=b
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
s=[0]*n
diff=[0]*(n)
Sum=0
for i in range(n):
  Sum+=a[i]
  s[i]=Sum

SUM=sum(a)
for i in range(n):
  diff[i]=s[i]-(SUM-s[i])
ans=[diff[i] for i in range(n) if diff[i]>=0]
#print(diff)
print(min(ans))
# Judge status: Wrong Answer
N=int(input())
S=input()
ans=1
for i in range(N):
  ans=max(ans,len(list(set(list(set(list(S[:i+1])) & set(list(S[i+1:])))))))
print(ans)
# Judge status: Wrong Answer
i1 = input()
i2 = input()

# i1 = "4 1"
# i2 = "5 4 2 1"
list1 = [int(s) for s in i1.split()]
list2 = [int(s) for s in i2.split()]

n = list1[0]
m = list1[1]


total = sum(list2)

# 選べる
count = 0

for a in range(m):
    if (list2[a]/total > 1/(4*m)):
        count += 1 

if count == m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
k,x = map(int,input().split())
for i in range(x-(k-1),x+k):
    print(i,end=" ")
# Judge status: Accepted
n = int(input())
A = sorted(list(map(int, input().split())))[::-1]
print(sum(A[1:2*n:2]))
# Judge status: Accepted
y,m,d = map(int,input().split('/'))
if m <= 4:
    ans = 'Heisei'
elif m > 4:
    ans = 'TBD'
print(ans)
# Judge status: Wrong Answer
n=int(input())
a = int(input())
if a >= n//500:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m = na()

if n%2 == 0:
    a,b = n//2,n//2+1
    for i in range(m):
        print(a,b)
        a,b = a-1,b+1
else:
    a,b = n//2,n//2+1
    for i in range(m):
        print(a,b)
        a,b = a-1,b+1
# Judge status: Accepted
K = int(input())
S = input()

Sl = list(S)

if len(Sl) <= K:
    print(S)
else:
    Po = "".join(Sl[0:K])
    print(Po+'...')
# Judge status: Accepted
from functools import cmp_to_key

N = int(input())
SN = []
for i in range(N):
    SN.append(input().split())
    SN[i].append(i + 1)


def cmp(a, b):
    if a[0] == b[0]:
        if int(a[1]) == int(b[1]): return 0
        return 1 if int(a[1]) <= int(b[1]) else -1
    return -1 if a[0] <= b[0] else 1

def cmpstr(a, b):
    return cmp(a, b)

sorted_SN = sorted(SN, key=cmp_to_key(cmpstr))

answer = "\n".join([str(sorted_SNi[2]) for sorted_SNi in sorted_SN])

print(answer)
# Judge status: Accepted
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
S = str(input())

minN = sys.maxsize
for i in range(len(S)-2) :
  minN = min(minN, abs(int(S[i:i+3]) - 753))

print (minN)
# Judge status: Accepted
x = int(input())
if x == 0:
  print(1)
else:
  print(0)
# Judge status: Accepted
N, M = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(M)]

ans = ["0"] * N
if N > 1: ans[0] = "1"
rep = {}

ok = True
for s, c in sc:
  ans[s-1] = str(c)
  if s in rep and rep[s] != str(c):
    ok = False
  else:
    rep[s] = str(c)

if ok:
  if ans[0] == "0" and N > 1:
    ok = False

print("".join(ans) if ok else -1)
# Judge status: Wrong Answer
a=1
kazu=[]
while 1:
  if a*a>1000:
    break
  kazu.append(a*a)
  a+=1
x=int(input())
for i in range(len(kazu)):
  if kazu[len(kazu)-1-i]<=x:
    print(kazu[len(kazu)-1-i])
    exit()
# Judge status: Accepted
import bisect

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

A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
    a = bisect.bisect_left(A, b)
    c = len(C) - bisect.bisect_right(C, b)
    ans += a * c

print(ans)
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

a, b = readline().rstrip().decode('utf-8').split()
N = int(a + b)

LIM = 10 ** 7
for i in range(1, LIM):
    tmp = i * i
    if tmp == N:
        print('Yes')
        exit()
    if tmp > N:
        print('No')
        exit()
# Judge status: Accepted
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]

num_l=[1 for i in range(n)]
bit_l=[1]+[0 for i in range(n-1)]

for x,y in l:
  x-=1
  y-=1

  if bit_l[x]==1:
    bit_l[y]=1
    if num_l[x]==1:
      bit_l[x]=0
  num_l[x]-=1
  num_l[y]+=1

print(bit_l.count(1))
# Judge status: Wrong Answer
S = input()

year = int(S[0:3])
month = int(S[5:6])
day = int(S[8:9])

if (S > "2019/05/01"):
	print("TBD")
else:
	print("Heisei")
# Judge status: Accepted
# cook your dish here
a,b,c = map(int, input().split())
k = int(input())
c1, c2 = 0, 0
while b<=a:
    b=b*2
    c1 = c1 + 1
while c <= b:
    c=c*2
    c2 = c2 +1
if c1 + c2 <= k:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S = input()
if 'A' in S and 'B' in S: print('Yes')
else: print('No')
# Judge status: Accepted
import sys
from collections import deque
import copy
sys.setrecursionlimit(2147483647)
input = sys.stdin.readline

if __name__ == '__main__':
  n,m,k=map(int,input().strip("\n").split())
  A=list(map(int,input().strip("\n").split()))
  B=list(map(int,input().strip("\n").split()))
  t=sum(B)
  j=m
  ans=0
  for i in range(n+1):
    while j>0 and t>k:
      j-=1
      t-=B[j]
    if t>k:
      break
    ans=max(ans,i+j)
    if i==n:
      break
    t+=A[i]
  print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
arr = []
ans = [0 for i in range(m+1)]
for i in range(n):
    arr.append(list(map(int,input().split())))
for i in arr:
    for j in i[1:]:
        ans[j-1] +=1
val = 0
for i in ans:
    if i == n:
        val +=1
print(val)
# Judge status: Accepted
k,s = map(int, input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0<=z and z<=k : 
            cnt += 1
print(cnt)
# Judge status: Accepted
N = int(input())
d = list(map(int,input().split()))
d = sorted(d)

if len(d) % 2 == 1:
  print(0)
  exit(0)
  
pick = len(d)//2
ans = d[pick] - d[pick-1]
print(ans)
# Judge status: Accepted
N, K = [int(i) for i in input().split()]
A = []
for i in range(K):
    input()
    A += [int(i) for i in input().split()]
print(N - len(set(A)))
# Judge status: Accepted
a, b, c, d = map(int, input().split())
from fractions import gcd
xc = (a-1)//c
yc = b//c
xd = (a-1)//d
yd = b//d    
xcd = (a - 1) // ((c * d) // gcd(c, d))
ycd = b // ((c * d) // gcd(c, d))

print(b - a + 1 -((yc - xc) + (yd - xd) - (ycd - xcd)))
# Judge status: Accepted
s1=input()
s2=input()

if s1 == s2[:-1]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
a1=1
a2=2
for i in range(n-1):
	a=a1+a2
	a2=a1
	a1=a
if n==1:
	a=1
	
print(a)
# Judge status: Accepted
a, b, c = map(int, input().split())

Li = [a, b, c]
Li.sort()

print(Li[0] + Li[1])
# Judge status: Accepted
d = int(input())
if d == 25:
  print("Christmas")
elif d == 24:
  print("Christmas Eve")
elif d == 23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")
# Judge status: Accepted
S = input()
mm = ["0"+str(x) for x in range(1,10)]+["10","11","12"]
mmyy = (S[:2] in mm)
yymm = (S[2:] in mm)
a = "NA"

if yymm and mmyy:
  a = "AMBIGUOUS"
elif yymm:
  a = "YYMM"
elif mmyy:
  a = "MMYY"
  
print(a)
# Judge status: Accepted
N = int(input())

if N == 3 or  N == 5 or  N == 7:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

a,b,c = na()
d = max(a,b,c)*3-(a+b+c)
e = d//2 if d%2==0 else (d+3)//2

print(e)
# Judge status: Accepted
from itertools import accumulate
n, k = map(int, input().split())
a = list(map(int, input().split()))

for _ in range(k):
    newa = [0 for _ in range(n)]
    for i in range(n):
        l = max(0, i - a[i])
        r = min(n - 1, i + a[i])
        newa[l] += 1
        if r + 1 < n:
            newa[r + 1] -= 1
    a = list(accumulate(newa))
    if all(i == n for i in a):
        break
print(*a)
# Judge status: Accepted
N=int(input())
p=[int(i) for i in input().split()]
q=sorted(p)
count=0
for t in range(N):
    if p[t]!=q[t]:
        count+=1
if count==0 or count==2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
x, y = map(int, input().split())
ans = 1

while x <= y//2:
    x *= 2
    ans += 1

if x > y:
    ans -= 1

print(ans)
# Judge status: Accepted
N = int(input())
l_cnt = [1, 2, 4, 8, 16, 32, 64]
l_ans = [x for x in l_cnt if x <= N]

print((l_ans[-1]))
# Judge status: Wrong Answer
s = list(input())
n = len(s)
cnt = 0

for i in range(n-1):
    if s[i] == '0' and s[i+1]:
        cnt += 2
        
print(cnt)
# Judge status: Wrong Answer
n=int(input())
h=list(map(int,input().split()))

ans,tmp=0,0
for i in range(n-1):
    if h[i]>=h[i+1]:
        tmp+=1
        ans=max(ans,tmp)
    else:
        tep=0
print(ans)
# Judge status: Accepted
k = int(input())

lunlun = [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
for i in range(11):
    last = lunlun[-1]
    add = []
    for x in last:
        c = x % 10
        add.append(x*10+c)
        if c != 0:
            add.append(x*10+c-1)
        if c != 9:
            add.append(x*10+c+1)
    lunlun.append(add)

all = []
for i in range(11):
    for x in lunlun[i]:
        all.append(x)
all.sort()
print(all[k-1])
# Judge status: Accepted
import bisect
import sys
input = sys.stdin.readline

n = int(input())
colors_maxs = []

colors_maxs.append(int(input()) *(-1) )
for _ in range(n-1):
    a = int(input()) * (-1)
    if colors_maxs[-1] <= a:
        colors_maxs.append(a)
    else:
        ind = bisect.bisect_right(colors_maxs, a) # -> 4
        colors_maxs[ind] = a

print(len(colors_maxs))
# Judge status: Accepted
H, N = map(int, input().split())
A = sum(list(map(int, input().split())))

if H <= A:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
x = 0

for r in a:
	x ^= r
print(' '.join([str(x^r) for r in a]))
# Judge status: Accepted
import math
ab = int(input().replace(' ', ''))
print ('Yes' if math.sqrt(ab).is_integer() else 'No')
# Judge status: Accepted
num = (1,0,0)
for _ in range(int(input()) - 2):
    num = (num[1],num[2],num[0]+num[2])
    
print(num[2]%(10**9+7))
# Judge status: Accepted

N = int(input())

ans = 0
for i in range(1, N + 1):
    cnt = 0
    for j in range(1, i + 1):
        if i % j == 0:
            cnt += 1
    if cnt == 8 and i % 2 != 0:
        ans += 1
print(ans)
# Judge status: Accepted
import math
x,y = map(int, input().split())
xy = x*y//(math.gcd(x,y))
if xy > x: print(x)
else: print(-1)
# Judge status: Accepted
n = int(input())
a = int(input())
c = n % 500
if c <= a:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
for i in range(1,n+1):
    print(c[i])
# Judge status: Accepted
X, A, B = map(int,input().split())
if B <= A:
    print("delicious")
elif B <= A+X:
    print("safe")
else:
    print("dangerous")
# Judge status: Wrong Answer
t = set([])

for i in range(1,32):
    for s in range(2,32):
        if i**s<1001:
            t.add(i**s)
            
t = list(t)

t.sort(reverse = True)

x = int(input())

for i in range(len(t)-1):
    if t[i]>x>=t[i+1]:
        print(t[i+1])
        break
# Judge status: Accepted
N, M = map(int, input().split())
H = list(map(int, input().split()))
Root = []
for i in range(M):
  temp = list(map(int, input().split()))
  Root.append(temp)

ans = [1]*N

for i in range(M):
  r_start = Root[i][0] - 1 
  r_stop = Root[i][1] - 1
  if H[r_start] < H[r_stop]:
    ans[r_start] = 0
  elif H[r_start] == H[r_stop]:
    ans[r_start] = 0
    ans[r_stop] = 0
  else:
    ans[r_stop] = 0

print(sum(ans))
# Judge status: Accepted
a=list(map(int, input().split(" ")))
print(a.index(0)+1)
# Judge status: Wrong Answer
N = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N):
    for j in range(i+1):
        if P[i] > P[j]:
            break
        count += 1
print(count)
# Judge status: Accepted
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
L = lr()
L.sort()
answer = 0
for i in range(N-1, -1, -1):
    # iが一番大きい辺
    x = L[i]
    left = 0
    right = i - 1
    while left < right:
        if L[left] + L[right] <= x:
            left += 1
            continue
        answer += (right - left)
        right -= 1

print(answer)
# Judge status: Wrong Answer
k,x=map(int,input().split())
ans=[]
for i in range(-k+1,k):
  print(i,end=' ')
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
if (A*B*C)%2==0:
  ans = 0
else:
  ans = int(A*B*C/max(A,B,C))
print(ans)
# Judge status: Accepted
S = input()
s_num = len(S)

i=0
max_count = 0
count = 0

while i < s_num:
    if S[i] != "R":
        if max_count < count:
            max_count = count
            count = 0
    elif S[i] == "R":
        count += 1

    i+=1

if max_count < count:
    max_count = count

print(max_count)
# Judge status: Accepted
a = int(input())
b = list(map(int,input().split()[:a]))
c = sum(b)
for i in range(len(b)):
    c = min(c, abs(sum(b[:i]) - sum(b[i:])))
print(c)
# Judge status: Accepted
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

s=s0()

n=len(s)
print("Yes" if s==s[::-1] and s[:n//2]==s[n//2-1::-1] and s[n//2+1:]==s[:n//2:-1] else "No")
# Judge status: Accepted
X = int(input())
if X%100 <= (X//100 * 5):
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
# coding:utf-8

H, N = map(int, input().split(' '))
ab_list = []
for _ in range(N):
    a, b = map(int, input().split(' '))
    ab_list.append([a, b])
dp = [0] * (H + 1)

for i in range(1, H + 1):
    for j in range(N):
        if ab_list[j][0] <= H:
            dp[i] = dp[H - ab_list[j][0]] + ab_list[j][1]
        else:
            dp[i] = ab_list[j][1]

print(dp[H])
# Judge status: Wrong Answer
n = int(input())
s = input()
t = input()
ans = n
for i in range(n):
    f = True
    for j in range(n - i):
        f &= s[j + i] == t[j]
    if f:
        ans = i

print(n+ans)
# Judge status: Wrong Answer
n = int(input())
block = list(map(int,input().split()))

count = 0
num = 1
for i in range(0,n):
  if block[i] == num:
    num += 1
  else:
    count += 1
if count == 0 and num != 2:
  print(-1)
else:
  print(count)
# Judge status: Accepted
def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    l=Y[N // 2-1]
    r=Y[N//2]


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






resolve()
# Judge status: Wrong Answer
print("YNeos"[int(input())%9==0::2])
# Judge status: Accepted
a,b,c,k = map(int,input().split())
if k < a:
  print(k)
elif a <= k and k < a+b:
  print(a)
else:
  print(a-(k-a-b))
# Judge status: Wrong Answer
N,K=map(int,input().split())
p=list(map(int, input().split()))
p.sort()
print(p)
price=0
for idx in range(K):
    price=price+p[idx]
print(price)
# Judge status: Wrong Answer
A,B,Z=map(int,input().split())

import math

theta = math.atan2(2*(B-Z/(A**2)),A)
print(math.degrees(theta))
# Judge status: Accepted
n = int(input())

O = list(range(1, n + 1))
P = list(map(int, input().split()))

count = 0
for i in range(n):
    if O[i] != P[i]:
        count += 1

print("YES" if count <= 2 else "NO")
# Judge status: Wrong Answer
N, W = map(int, input().split())
dp = [[0]*(W+1) for _ in range(N+1)]

for i in range(N):
    w, v = map(int, input().split())
    
    for j in range(W):
        if w > j:
            dp[i+1][j+1] = dp[i][j+1]
        else:
            #print(j+1,w)
            dp[i+1][j+1] = max(dp[i][j+1], dp[i][j+2-w]+v)
    
print(dp[-1][-1])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

if a[0]:
   if n == 0 and a[0] == 1:
      print(1)
   else:
      print(-1)
   exit()

b = [0 for _ in range(n)]
b.append(a[-1])
for i in range(n)[::-1]:
   b[i] = b[i+1] + a[i]

node = 1
ans = 1
for i in range(1, n+1):
   t = min(node*2, b[i])
   ans += t
   node = t - a[i]
   if node < 0:
      print(-1)
      exit()

print(ans)
# Judge status: Accepted
def main():
    n, c, k = map(int, input().split())
    t = [None]*n
    for i in range(n):
        t[i] = int(input())
    t.sort()
    ans = 0
    l = 0
    x = t[0]+k
    for r in range(1, n):
        if x < t[r] or c < r-l+1:
            ans += 1
            l = r
            x = t[r] + k
        if r == n-1:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
A = sorted(list(map(int, input().split())))
s = 0
for a in A[:-1]:
	s += A[-1] - a
print(s//2 + 2 if s % 2 else s//2)
# Judge status: Accepted
N = int(input())
A = int(input())
n5 = int(N/500)
a = N - n5 * 500
if a <= A:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
R = int(input())
print(3.1415926*R*2)
# Judge status: Accepted
n,k = map(int, input().split())

print(min(n%k, abs(n%k-k)))
# Judge status: Accepted
s = input()
firstHalf = s[:2]
secondHalf = s[2:]
val1 = 0
val2 = 0
if firstHalf[0] == '0':
    val1 = int(firstHalf[1])
else:
    val1 = int(firstHalf)
if secondHalf[0] == '0':
    val2 = int(secondHalf[1])
else:
    val2 = int(secondHalf)
first = False
second = False
if val1 <= 12 and val1 > 0:
    first = True
if val2 <= 12 and val2 > 0:
    second = True
if first and second:
    print("AMBIGUOUS")
elif first:
    print("MMYY")
elif second:
    print("YYMM")
else:
    print("NA")
# Judge status: Wrong Answer
def resolve():
    X, Y = [int(i) for i in input().split()]
    if Y % X == 0:
        print(-1)
    else:
        print(X)

resolve()
# Judge status: Wrong Answer
N=int(input())
a_list=list(map(int,input().split()))
a_list.sort(reverse=True)
c_list=[None]*N

c_list[0]=2**(len(bin(a_list[0])[2:]))-1
b=a_list[0]

for i,a in enumerate(a_list[1:]):
    print(bin(c_list[i]),bin(a))
    c_list[1+i]=b^a^c_list[i]
    b=a

ans=" ".join(list(map(str,c_list)))
print(ans)
# Judge status: Wrong Answer
a, b, c = sorted(map(int, input().split()))
 
print("YES" if a+b == c else "No")
# Judge status: Accepted
s = list(input())
t = list(input())

for _ in range(2):

    n = len(s)
    l = [set() for _ in range(26)]

    def f(c):
        return ord(c) - ord('a')

    for i, j in enumerate(s):
        l[f(j)].add(t[i])

    for i in l:
        if len(list(i)) > 1:
            print('No')
            exit(0)
        
    s,t = t,s

print('Yes')
# Judge status: Accepted
N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]

S = [[x - l, x + l] for x, l in X]
S.sort(key=lambda x: x[1])

ans = 0
tmp = -10 ** 12
for x, y in S:
    if tmp <= x:
        ans += 1
        tmp = y
        
print(ans)