peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
x = int(input())
c = (x + 10) // 11 * 2
if 11 * (c // 2) - 5 >= x:
    c -= 1
print(c)
# Judge status: Accepted
N,K = map(int, input().split())

a = N%K
b = abs(a - K)

lst = []
lst.append(a)
lst.append(b)
print(min(lst))
# Judge status: Accepted
def resolve():
	x = int(input())
	r = 0
	if x % 11 > 6:
		r = 2
	elif x % 11:
		r = 1

	print((x // 11 * 2) + r)
resolve()
# Judge status: Accepted
n=int(input())
li=[i for i in range(1,n+1) if i%2==1]
s=len(li)
print(s/n)
# Judge status: Wrong Answer
x = int(input())
print((x//500*1000) + (x%1000//5*5))
# Judge status: Accepted
a = list(map(int,input().split()))
a = sorted(a)
i = (a[1] - a[0])//2
a[0] += i*2
i += a[2] - a[1]
if a[0] != a[1]:
  i += 2

print(i)
# Judge status: Accepted
n,d = map(int,input().split())
l = []
for i in range(n):
    x,y = map(int,input().split())
    g = ((x**2)+(y**2))**0.5
    l.append(g)

l.sort()
cnt = 0
for i in l:
    if i > d:
        break

    cnt = cnt+1

print(cnt)
# Judge status: Accepted
n,*a=map(int,open(0).read().split())
ans=0
if n==1:
  print(a[0]//2)
  exit()
for i in range(n-1):
  if (a[i]+a[i+1])%2==0:
    ans+=(a[i]+a[i+1])//2
    a[i+1]=0
  else:
    ans+=(a[i]+a[i+1])//2
    a[i+1]=(0 if a[i+1]==0 else 1)
print(ans)
# Judge status: Accepted
from numpy import*
input();a=array(list(map(int,input().split())))
print(int(min(abs(cumsum(a)-(sum(a)/2)))*2))
# Judge status: Accepted
N=int(input())
A_lis=list(map(int,input().split()))
p={i:0 for i in range(1,N+1)} 
for j in A_lis:
    p[j]+=1
 
for i in range(1,N+1):
    print(p[i])
# Judge status: Wrong Answer
import numpy as np
N,K = (int(x) for x in input().split())
p1 = np.array(list(map(int, input().split())))
p2 = (p1+1) / 2
p3 = np.array([np.sum(p2[i:i+K],dtype=np.float32) for i in range(N-K+1)])
print(np.amax(p3))
# Judge status: Wrong Answer
def main():
    import sys
    input = sys.stdin.readline
    from fractions import gcd

    N, M = map(int, input().split())
    A = list(map(lambda x: int(x)//2, input().split()))

    l = 1
    for a in A:
        l = l*a // gcd(l, a)

    # l の奇数倍がM*max(A)以下にいくつあるか

    if l < max(A):
        ref = 1
    else:
        ref = 0
    print((M//l + 1)//2-ref)
    # print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n,k = map(int,input().split())
l = list(map(int, input().split()))
def counter(l):
    count = {}
    for i in l:
        count[i] = l.count(i)
    return sorted(count.values())

freq = counter(l)
print(len(freq) - k if len(freq)> k else 0)
# Judge status: Accepted
n=int(input())
import math
ans=0
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      ans+=math.gcd(math.gcd(i,k),j)
print(ans)
# Judge status: Accepted
N = int(input())
N_str=str(N)
K=(len(str(N)))
S=0
for i in range(K):
  S += int(N_str[i])

if S%9==0:
    print('Yes')
else:
   print("No")
# Judge status: Accepted
l = [int(input()) for i in range(6)]
print(['Yay!',':('][l[4]-l[0]>l[5]])
# Judge status: Accepted
def resolve():
  T = input()
  print(T.replace('?', 'D'))

if __name__ == "__main__":
  resolve()
# Judge status: Accepted
K=int(input())
A,B=map(int,input().split())
flag=0
for i in range(A,B+1):
  if i%K==0:
    flag=1
    
    
if flag==1:
    print('OK')
    
else:
    print('NG')
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

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

q, mod = divmod(N, A + B)

print((A * q) + max((mod - B), mod))
# Judge status: Accepted
s=input()[::-1]
ans=0
u=0
d=1
l=[0]*2019
l[0]=1
for i in map(int,s):
  u=(u+i*d)%2019
  l[u]+=1
  d=d*10%2019
for i in l:
  ans+=i*(i-1)//2
print(ans)
# Judge status: Accepted
K, A, B = map(int, input().split())
K += 1

if B-A <= 2:
    print(K)
else:
    num = max(0, (K-A)//2)
    print(num*B+K-(A+2)*num)
# Judge status: Accepted
import math
a,b = input().split()
number = int(a+b)
root = math.sqrt(number)//1
if root**2 == number:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
x = list(map(int, input().split()))

for i in x:
    if i == 0:
        print(i+1)
        break
# Judge status: Wrong Answer
a, b, x = map(int, input().split())

ans = (b // x) - (a // x)

if a == 0:
    ans += 1

print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a >= b:
    print(b)
else:
    print(a)
# Judge status: Accepted
from collections import Counter

def main():
    s = input()
    src = ""
    for dst in s:
        if dst == src:
            print("Bad")
            break
        src = dst
    else:
        print("Good")

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import math
N = int(input())
if N <= 1:
    print(0)
    exit()

L = math.ceil(math.sqrt(N)) + 1
isPrime = [True] * L
isPrime[0] = isPrime[1] = False
primes = []
for n in range(2, L):
    if isPrime[n]:
        primes.append(n)
        isPrime[2*n::n] = [False] * ((L-n-1) // n)

ans = 0
for p in primes:
    d = p
    while N % d == 0:
        ans += 1
        N //= d
        d *= p

print(max(1, ans))
# Judge status: Accepted
S = input()
Mozi = ["resare","esare","remaerd","maerd"]

S = S[::-1]
for i in Mozi:
    S = S.replace(i,"")
if not S:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
now = 100
ans = 0
while now < n:
  now = int(now * 1.01)
  ans += 1
print(ans)
# Judge status: Wrong Answer
S = input()

n = len(S)
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        if int(S[i:j]) % 2019 == 0:
            ans += 1

print(ans)
# Judge status: Accepted
N = int(input())
A = [int(v) for v in input().split()]
MOD = int(1e9 + 7)

S = sum(A)
SQ = S * S
IS = sum(a*a for a in A)

print(((SQ - IS) // 2) % MOD)
# Judge status: Accepted
s = input()
s = s.replace('2017','2018')
print(s)
# Judge status: Wrong Answer
import math

n = int(input())
for i in range(1, math.ceil(n**0.5)):
    if n % i == 0:
        ans = n//i + i - 2

print(ans)
# Judge status: Accepted
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
        
def lcm(a,b):
    return a*b//gcd(a,b)
    
N = int(input())
A = list(map(int, input().split()))

lcm_A = 1
for i in range(N):
    lcm_A = lcm(lcm_A, A[i])
    
ans = 0
for i in range(N):
    ans += lcm_A // A[i]

mod = 10**9+7
print(ans % mod)
# Judge status: Accepted
n,m,k=map(int,input().split())
if(k>=m-n):
    for i in range(n,m+1):
        print(i)
else:
    l=list(range(n,n+k))
    d=list(range(m-k+1,m+1))
    s=l+d
    s=list(set(s))
    s.sort()
    for i in s:
        print(i)
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
cnt = [0]*n
for a in A:
    cnt[a-1] += 1
ans = 0
for i in range(n):
    ans += cnt[i] * (cnt[i]-1) // 2
for a in A:
    print(ans-cnt[a-1]+1)
# Judge status: Accepted
import collections

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

check=collections.Counter(A).most_common()
ans=0
for i in range(K,len(check)):
  ans+=check[i][1]
print(ans)
# Judge status: Wrong Answer
a = int(input())
b = a%7
b = a%4

c = a%4
c = c%7
if b == 0:
  print('Yes')
elif c ==0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = {} #10000以上key以下の回文数の個数
cnt = 0
for i in range(10000, 100000):
    L = list(str(i))
    if L == list(reversed(L)):
        cnt += 1
    N[i] = cnt
A, B = map(int, input().split())
print(N[B]-N[A-1] if A > 10000 else N[B])
# Judge status: Accepted
import sys
n,k,q = map(int,input().split())
if k > q:
    for _ in range(n):
        print("Yes")
    sys.exit()
p = [0 for i in range(n)]

for __ in range(q):
    number = int(input())
    p[number - 1] += 1

for x in range(n):
    if k - q + p[x] >= 1:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
n = int(input())
li = [int(x) for x in input().split()]
ans = 1
m = li[0]
for i in range(1,n):
    if m>li[i]:
        m = li[i]
    if m==li[i]:
        ans += 1
print(ans)
# Judge status: Accepted
n, k, s = map(int, input().split())
print(*[s] * k + [s % 10**9 + 1] * (n - k))
# Judge status: Accepted
d = int(input())
c = list(map(int, input().split()))
prev = [0] * 26
# 毎日コストの最小化を試みてみる
for i in range(d):
  s = list(map(int, input().split()))
  cost = 10 ** 10
  ans = -1
  for j in range(26):
    tmp = 0
    for k in range(26):
      if j == k:
        continue
      tmp += c[k] * (i - prev[k])
    if tmp < cost:
      cost = tmp
      ans = j
  prev[ans] = i
  print(ans+1)
# Judge status: Wrong Answer
K,A,B = map(int,input().split())

if K < (A+B+2) or B <= A+2:
  print(K+1)
  exit(0)
  
K -= A - 1
p,q = divmod(K,2)
ans = B * p + q
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
if min(a,b)>=3:
    print( (a-2)*(b-2))
    exit()
if a>b: a,b=b,a
if a==1 and b>=3:
    print(b-2)
if a==2 and b>=3:
    print(0)


if [a,b]==[1,1]:
    print(1)
if [a,b]==[1,2]:
    print(0)
if [a,b]==[2,2]:
    print(0)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
for i in range(n):
    ans += a[i//2]

ans -= a[0]
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
s = input()
y = s.split("-")

if len(y[0]) == a and len(y[1]) == b and s[a] == "-":
	print("Yes")
else:
	print("No")
# Judge status: Accepted
a,b = map(int, input().split())
print((a+b)//2 + (a+b)%2)
# Judge status: Wrong Answer
billNum, Declation = map(int, input().split())
bill10000 = -1
bill5000  = -1
bill1000  = -1

for x in range(billNum + 1):
    for y in range(billNum + 1):
        z = billNum - x - y
        sumOfMoney = x * 10000 + y * 5000 + z * 1000
        if Declation == sumOfMoney:
            bill10000 = x
            bill5000  = y
            bill1000  = z
            break

print(bill10000, bill5000, bill1000)
# Judge status: Wrong Answer
sx, sy, tx, ty = map(int, input().split())
route = ""
dx, dy = tx - sx, ty - sy
path1 = "R" * dx + "U" * dy
path2 = "L" * dx + "D" * dy
dx, dy = dx + 1, dy + 1
path3 = "D" + "R" * dx + "U" * dy + "L"
path4 = "U" + "L" * dx + "D" * dy + "R"
ans =path1 + path2 + path3 + path4
if ans.count("R")+ans.count("U") == ans.count("L") + ans.count("D"):
    print("Yes,", ans)
else:
    print("No,", ans)
# Judge status: Accepted
n = int(input())
cnt = 0

for i in range(1, 10):
    if len(str(n//i)) == 1 and n%i == 0:
        cnt +=1

if cnt >= 1:
    print('Yes')
else :
    print('No')
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n - k > 0:
    print(x * k + y * (n - k))
else:
    print(x * n)
# Judge status: Wrong Answer
n,m = map(int,input().split())
if n == 1 and m == 1:
    print (1)
elif n == 1 and m != 1:
    print (m-2)
else:
    print ((n-2)*(m-2))
# Judge status: Accepted
N=int(input())
a=[int(input()) for i in range(N)]
count=0
tmp=1
while count<=N:
  if a[tmp-1] ==2:
    print(count+1)
    break
  else:
    count+=1
    tmp = a[tmp-1]
if count > N:
  print(-1)
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))
dp = [float("Inf")] * (n + 1)

dp[0] = 0
for i in range(1, n):
  dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i - 1]))
  if i > 1:
    dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i - 2]))

print(dp[n - 1])
# Judge status: Accepted
N = int(input())
A = []
B = []

for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

A.sort()
B.sort()

if N % 2 == 1:
    print(B[N//2] - A[N//2] + 1)
else:
    a0 = A[N//2 - 1]
    b0 = B[N//2 - 1]
    a1 = A[N//2]
    b1 = B[N//2]

    print((b1 + b0) - (a1 + a0) + 1)
# Judge status: Wrong Answer
xs = map(int, input().split())

for x, i in enumerate(xs):
  if x == 0:
    ans = i + 1

print(ans)
# Judge status: Wrong Answer
import copy 

N=int(input())
A=list(map(int,(input().split())))
new_A=list(set(A))
new_A.sort()
tmp_A = copy.copy(new_A)
count=0
try:
  for i in new_A[:]:
    tmp_A.remove(i)
    for j in tmp_A[:]:

      if(i%j==0):
        new_A.remove(i)
    tmp_A=copy.copy(new_A)

  if(len(new_A)==1):
    print(0)
  else:
    print(len(new_A))
except:
  print(len(new_A))
# Judge status: Accepted
n,m,x = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
ans = 10**9
for i in range(2 ** n):
  skill = [0] * m
  overTen = False
  money = 0
  for j in range(n):
    if ((int(bin(i)[2:]) >> j) & 1):
      money += a[j][0]
      for h in range(m):
        skill[h] += a[j][h+1]
  for k in skill:
    if k >= x:
      overTen = True
    else:
      overTen = False
      break
  if overTen == True:
    if money < ans:
      ans = money

if ans == 10**9:
  print(-1)
else:
  print(ans)
# Judge status: Accepted
import math

N = int(input())

n = N / (1.08)

n0 = math.floor(n) - 1
n1 = math.floor(n)
n2 = math.ceil(n)

if int(n0 * 1.08) == N:
    print(n0)
elif int(n1 * 1.08) == N:
    print(n1)
elif int(n2 * 1.08) == N:
    print(n2)
else:
    print(":(")
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a == 1:
    a = 14
elif b == 1:
    b = 14
if a > b:
    print('Alice')
elif b > a:
    print('Bob')
else:
    print('Draw')
# Judge status: Wrong Answer
n,m,k = map(int, input().split())
for i in range(n):
	for j in range(m):
		if i*(m-j)+j*(n-i)==k:
			print('Yes')
			exit()
print('No')
# Judge status: Wrong Answer
n = int(input())
if n%1000 <= 500:
    print(n%1000)
else:
    print(1000-n%1000)
# Judge status: Accepted
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

N = int(input())
l = list(map(int, input().split()))
ans = l[0]
for i in range(1, N):
    ans = gcd(ans, l[i])
print(ans)
# Judge status: Accepted
from itertools import permutations

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


def dist(i, j):
    return ((towns[i][0] - towns[j][0])**2 +
            (towns[i][1] - towns[j][1])**2)**0.5


ans = cnt = 0
for perm in permutations(range(n)):
    cand = 0
    for i in range(n - 1):
        cand += dist(perm[i], perm[i + 1])
    ans += cand
    cnt += 1

ans /= cnt
print(ans)
# Judge status: Accepted
a=list(map(int,input().split()))
a.sort()
print(a[2]*10+a[1]+a[0])
# Judge status: Accepted
s=input().strip()
s=s.replace("eraser","A")
s=s.replace("erase","A")
s=s.replace("dreamer","A")
s=s.replace("dream","A")
print("YES" if not s.replace("A","") else "NO")
# Judge status: Accepted
def resolve():
	n = int(input())
	a = list(map(int, input().split()))
	t = [0]*(10**5+2)
	for i in a:
		t[i] += 1
		t[i+1] += 1
		if i-1 >= 0:
			t[i-1] += 1
	print(max(t))
resolve()
# Judge status: Accepted
A, B, C = map(int, input().split())
if A+B-C >= 0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
r, g, b = map(int, input().split())

answer = r * 100 + g * 10 + b

if answer % 4 == 0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
def main():

    num = int(input())
    boss = input().split()

    ans_list = [0] * num
    
    for i_boss in boss:
        #print(f'start for {i_boss}')
        ans_list[int(i_boss)-1] += 1
    a = list(map(lambda  x: str(x), ans_list))
    print('\n'.join(a))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
# input
X = int(input())

# check
if X in [7, 5, 3]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys

a = input()
b = input()

for i in range(2):
    if a[i] != b[2 - i]:
        print("NO")
        sys.exit()
print("YES")
# Judge status: Wrong Answer
s = sorted(input())
t = sorted(input())
print("Yes" if s<t else "No")
# Judge status: Accepted
import sys

A, B, C, K = map(int, input().split())
if A >= K:
    print(K)
elif A + B >= K:
    print(A)
else:
    print(A + (A+B-K))
# Judge status: Accepted
K=int(input())
queue=[1,2,3,4,5,6,7,8,9]
i=0
flag=1
while(flag==1):
  if K<=len(queue):
    flag=0
    break
  else:

    x=queue[i]
    if x % 10!=0:
      queue.append(x*10+(x%10)-1)
    queue.append(10*x+(x%10))

    if x%10!=9:
      queue.append(10*x+(x%10)+1)
    
  
  i+=1



print(queue[K-1])
# Judge status: Accepted
n,k=map(int,input().split())
A=list(map(int,input().split()))
for i in range(n-k):
    print('Yes' if A[i]<A[i+k] else 'No')
# Judge status: Accepted
s=input()
print('TBD' if s>'2019/04/30' else 'Heisei')
# Judge status: Accepted
n = int(input())
f = True

if n%7 == 0:
    print("Yes")
    f = False

while(n > 0)and(f):
    if(n%4 == 0):
        print("Yes")
        f = False
    n -= 7
if(f):
    print("No")
# Judge status: Wrong Answer
K = int(input())
S = input()
print(len(S))
if len(S) <= K:
    print(S)
else:
    print(f"{S[:K]}...")
# Judge status: Accepted
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

h = ni()



def atk(n):
  if n==0:
    return 1

  n //=2
  return atk(n)*2

print(atk(h)-1)
# Judge status: Accepted
N = int(input())
W = list(map(int, input().split()))
R = [0]*N
R[0] = W[0]

for i in range(1, N):
  R[i] = R[i-1] + W[i]

#print(R)
m = sum(W) / 2
#print(m)
e = 10000

for i in range(N):
  e_new = abs(R[i] - m)
  if e >= e_new:
    e = e_new
    #print(e)
  else:
    ans_index = i - 1
    #print(ans_index, e)
    break

print(int(2 * abs(R[ans_index] - m)))
# Judge status: Accepted
import numpy as np
n,p = map(int,input().split())
A = np.array(list(map(int,input().split())))
flg = np.all(A%2==0)
print( 2**n if flg and p==0 else 0 if flg else 2**(n-1))
# Judge status: Accepted
n = int(input())
s = input()

tmp = 0
a = 0
for i in s:
    if i == "(":
        tmp -= 1
    else:
        tmp += 1
    a = max(a, tmp)
ans = a * "(" + s
print(ans + ")" * (ans.count("(") - ans.count(")")))
# Judge status: Accepted
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''


n=int(input())
a=list(map(int,input().split()))
a.sort()
#print(a)
ans=0
from math import floor
for i in range(1,n):
    ans+=a[n-1-floor(i/2)]
    #print(ans)
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
for i in range(m//2):
    print(1+i,m//1-i)
for i in range((m+1)//2):
    print(m//1+1+i,m*2+1-i)
# Judge status: Accepted
N = input()
del N
I1 = input().split(); i = 0
for a in range(len(I1)):
    if (int(I1[a]) * (a+1))%2 == 1:
        i += 1
print(i)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

def uclid(x, y):
    if(y == 0):
        return x
    tmp = y
    y =  x % y
    x = tmp
    return uclid(x, y)

ans = A[0] 
for i in range(1, N):
    ans = uclid(ans, A[i])
print(ans)
# Judge status: Accepted
import sys

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

if len(A) == 1:
    print(1)
    sys.exit(0)

box = [False] * (A[-1] + 1)
for a in A:
    box[a] = True

for idx, a in enumerate(A):
    if A[idx] == A[idx - 1]:
        box[a] = False
    for j in range(2, A[-1]//a + 1):
        box[a * j] = False

count = 0
for d in box:
    if d:
        count += 1
print(count)
# Judge status: Accepted
n = int(input())
data = input().split()
 
ans = "APPROVED"
 
for i in range(n):
  num = int(data[i])
  if num % 2 == 0:
    if num % 3 != 0 and num % 5 != 0:
      ans = "DENIED"
      break  
 
print(ans)
# Judge status: Accepted
N=int(input())
m = {}
for i in range(N):
  s = input()
  if s in m:
    m[s] += 1
  else:
    m[s] = 1
M=int(input())
for i in range(M):
  t = input()
  if t in m:
    m[t] -= 1
  else:
    m[t] = -1
ans = 0
for k,v in m.items():
  ans = max( ans, v )
print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())
S = input()
X = S.count("RL")
Y = 0
if S[0] == "L":
    Y += 1
if S[-1] == "R":
    Y += 1

ans = 0
for a, b in zip(S, S[1:]):
    if a == b:
        ans += 1
ans += 2*min(K, X)
if K > X:
    ans += min(Y, K-X)
print(ans)
# Judge status: Accepted
n,t = map(int, input().split())
ans = 1001
for _ in range(n):
    a,b = map(int, input().split())
    if (b <= t): ans = min(ans,a)
print(ans if ans <= 1000 else "TLE")
# Judge status: Accepted
import heapq

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]
AB.sort()

ans = 0
candidates = []
now = 0
for i in range(M+1):
  for j in range(now, N):
    if AB[j][0] <= i:
      heapq.heappush(candidates, -AB[j][1])
      now = j + 1
      
    else:
      now = j
      break
  
  if candidates:
    ans -= heapq.heappop(candidates)

print(ans)
# Judge status: Wrong Answer
n = input()
maximum = 0
for c in n:
    maximum = max(maximum, int(c))

ans = [str(maximum)] * 3
print(''.join(ans))
# Judge status: Accepted
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

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

if (n%k==0):
    print(0)
else:
    print(1)
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))
p0, p1 = 0, abs(h[1] - h[0])
for i in range(2, n):
    p2 = min(p1 + abs(h[i] - h[i - 1]), p0 + abs(h[i] - h[i - 2]))
    p0, p1 = p1, p2
print(p1)
# Judge status: Accepted
N = int(input())
a = N*[0]

for i in range(1,N):
  C,S,F = map(int,input().split())
  for j in range(i):
    a[j] = max(S,((F+a[j]-1)//F)*F)+C

print(*a,sep="\n")
# Judge status: Wrong Answer
l,r,n = map(int, input().split())
L = l//n
R = r//n
print(R-L)
# Judge status: Accepted
a, b, c = map(int, input().split())
if a + c == 2 * b:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N = int(input())
a = sorted([int(c) for c in input().split()])
#2回の変わり目を記憶
c1,c2,c3 = [0,0,0]
ma = 1
for i in range(N):
    if i > 0:
        if a[i]==a[i-1]+1:
            c1 = c2 
            c2 = c3
            c3 = i
        elif a[i]!=a[i-1]:
            c1,c2,c3=[i,i,i]
    if ma < i - c1+1:
        ma = i - c1+1

print(ma)
# Judge status: Accepted
n,m = map(int,input().split())
a = [list(input()) for i in range(n)]
b = [list(input()) for i in range(m)]
ans = 'No'
for i in range(n-m+1):
    for j in range(n-m+1):
        ok = True
        for k in range(m):
            for l in range(m):
                if a[i+k][j+l]!=b[k][l]:
                    ok = False
        if ok: ans = 'Yes'
print(ans)
# Judge status: Accepted
N,L=map(int,input().split())
S=[]
for i in range(N):
  S.append(input())

S=sorted(S)
for i in range(N):
  print(S[i],end="")
# Judge status: Accepted
S = input()
alphabet = set([chr(i) for i in range(97, 97+26)])
ans = alphabet - set(list(S))
print(sorted(ans)[0]) if len(ans) > 0 else print('None')
# Judge status: Accepted
n,m=map(int,input().split())
if n==1 and m==1:
    print(1)
elif n==1 or m==1:
    print(max(0,max(n,m)-2))
else:
    print((n-2)*(m-2))
# Judge status: Accepted
from sys  import stdin,stdout

st=lambda:list(stdin.readline().strip())
li=lambda:list(map(int,stdin.readline().split()))
mp=lambda:map(int,stdin.readline().split())
inp=lambda:int(stdin.readline())
pr=lambda n: stdout.write(str(n)+"\n")

mod=1000000007
INF=float('inf')

n,k=mp()
l=li()
dp=[INF for i in range(n)]
dp[0]=0

for i in range(n):

    for j in range(i+1,min(i+k+1,n)):

        dp[j]=min(abs(l[i]-l[j])+dp[i],dp[j])

print(dp[-1])
# Judge status: Accepted
import fractions
a = list(map(int,input().split()))
N = a[0]
b = []
x = list(map(int,input().split()))
x.append(a[1])
x.sort()
flag = 0
for i in range(N):
    c = x[i+1] - x[i]
    if flag == 1:
        ans = fractions.gcd(c, ans) # 最大公約数を求める
    else:
        ans = c # 数列が一つの場合は差が答え
    b.append(c)
    flag = 1
print(ans)
# Judge status: Accepted
def gcd(x, y):
    if x == 0:
        return y
    else:
        return gcd(y % x, x)


def lcm(x, y):
    return x * y // gcd(x, y)


a, b = map(int, input().split())

print(lcm(a, b))
# Judge status: Wrong Answer
n = int(input())
s = str(input())

count = 0
for i in range(0,n-3):
    for j in (i+1,n-2):
        for k in (j+1,n-1):
            if s[i]!=s[j] and s[j]!=s[k] and s[j]!=s[k] and j-i != k-j:
                count += 1

print(count)
# Judge status: Accepted
N = int(input())
a_list = [int(e) for e in input().split()]
a_list.sort(reverse=True)
a_list = [0] + a_list 
ans_list= list()

for i in range(1,len(a_list)):
    if i%2 == 0:
        ans_list.append(a_list[i])
        if len(ans_list) == N:
            print(sum(ans_list))
            break
# Judge status: Accepted
n = int(input())
X = list(map(int,input().split()))
Xs = sorted(X)
bottom = Xs[n//2-1]
top = Xs[n//2]
for i in X:
  if i <= bottom:
    print(top)
  else:
    print(bottom)