Harryxun/stf_run huggingface dataset:
n = int(input())
m = 1
ans = 0
"""
for m in range(1, int(n**0.5)+1):
    if n%m == 0 and m < n//m:
        ans += n//m -1
"""
while m <= int(sqrt(n)):
    if n % m == 0 and m < n // m:
        ans += n // m - 1
    m += 1
print(ans)


### FIXED CODE ###

n = int(input())
ans = 0
for m in range(1, int(n**0.5)+1):
    if n%m == 0 and m < n//m-1:
        ans += n//m -1
print(ans)
"""
while m <= int(n**0.5):
    if n % m == 0 and m < n // m:
        ans += n // m - 1
    m += 1
print(ans)
"""
x = [input() for i in range(2)]
S = list(x[0])
T = list(x[1])

n = int(len(S)) - int(len(T)) + 1
min = int(len(T))
 
for a in range(n):
  count = 0 
	for b in range(int(len(T))):
      if S[a+b] != T[b]:
        count += 1
  if count < min:
    min = count
print(min)

### FIXED CODE ###

x = [input() for i in range(2)]
S = x[0]
T = x[1]
moji = len(T)

for a in range(len(S) - len(T) + 1):
  count = 0
  for b in range(len(T)):
    
    if S[a+b] != T[b]:
      count += 1
  if count < moji:
    moji = count

print(moji)
S = input()
A = [0]*(len(S)+1)
for i in range(len(S)+1):
    L = S[:i]
    R = S[i:]
    print('L=', L)
    print('R=', R)
    l = 0
    r = 0
    if L != '':
        T = len(L)
        for k in range(T):
            if L[T-k-1] != '<':
                l = k
                break
        else:
            l = T
    if R != '':
        U = len(R)
        for j in range(U):
            if R[j] != '>':
                r = j
                break
        else:
            r = len(R)
    A[i] = max(l, r)
# print(A)
print(sum(A))

### FIXED CODE ###

S=input()
N=len(S)+1
L=[0]*N
R=[0]*N
ans=[0]*N
for i in range(1,N):
    if S[i-1]=='<':
        L[i]=L[i-1]+1
    if S[N-i-1]=='>':
        R[N-i-1]=R[N-i]+1
for i in range(N):
    ans[i]=max(L[i], R[i])
print(sum(ans))
###ncrのmodあまりの話
mod=10**9+7
N=100005
kaidan=[1 for i in range(N)]
gyaku=[1 for i in range(N)]
for i in range(1,N):
    kaidan[i] = (i * kaidan[i-1])%mod
    gyaku[i]=pow(bikkuri[i], mod-2, mod)
def comb(a,b):
    return kaidan[a]*gyaku[b]*gyaku[a-b]
n,m=map(int,input().split())
if abs(n-m)>=2:
    print(0)
else:
    if n==m:
        print(kaidan[n]*kaidan[n]*2%mod)
    else:
        a=max(n,m)
        b=min(n,m)
        print(kaidan[a]*kaidan[b]%mod)

### FIXED CODE ###

###ncrのmodあまりの話
mod=10**9+7
N=100005
kaidan=[1 for i in range(N)]
gyaku=[1 for i in range(N)]
for i in range(1,N):
    kaidan[i] = (i * kaidan[i-1])%mod
    gyaku[i]=pow(kaidan[i], mod-2, mod)
def comb(a,b):
    return kaidan[a]*gyaku[b]*gyaku[a-b]
n,m=map(int,input().split())
if abs(n-m)>=2:
    print(0)
else:
    if n==m:
        print(kaidan[n]*kaidan[n]*2%mod)
    else:
        a=max(n,m)
        b=min(n,m)
        print(kaidan[a]*kaidan[b]%mod)
a,b = map(double,input().split())
print(int(a*b))

### FIXED CODE ###

a,b=input().split()
a = int(a)
b = int(b.replace('.',""))

print(int(a*b)//100)
D = int(input().split())
print("Christmas" + "Eve" * (25 - D)

### FIXED CODE ###

D = int(input())
print("Christmas" + " Eve" * (25 - D))
vdef judge(A, B, C, M):
	result = C
	for i in range(M):
		result += A[i] * B[i]

	return result > 0

def main():
	N, M, C = map(int, input().split())
	B = map(int, input().split())
	count = 0

	for i in N:
		A = map(int, input().split())

		if judge(A, B, C, M):
			count += 1

	print(count)



if __name__ == '__main__':
	main()

### FIXED CODE ###

def judge(A, B, C, M):
	result = C
	for i in range(M):
		result += A[i] * B[i]

	return result > 0

def main():
	N, M, C = map(int, input().split())
	B = [int(x) for x in input().split()]
	count = 0

	for i in range(N):
		A = [int(x) for x in input().split()]

		if judge(A, B, C, M):
			count += 1

	print(count)



if __name__ == '__main__':
	main()
a = [int(input()) for i in range(5)]
b = [10 - i % 10 for i in a if i % 10 != 0]
print(sum(a) + sum(b) - max(b))

### FIXED CODE ###

a = [int(input()) for i in range(5)]
b = [9 - (i - 1) % 10 for i in a]
print(sum(a) + sum(b) - max(b))
n,r = map(int,input().split())

if n > =10:
  print(r)

else:
  print(r-100*(10-n))

### FIXED CODE ###

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

if n >= 10:
  print(r)

else:
  print(r+100*(10-n))
import sys, math
from collections import defaultdict
from copy import deepcopy
import itertools
input = sys.stdin.readline
# 文字列の場合は普通のinput()を使うか下を使う
# input = sys.stdin.readline().rstrip()


A, B = map(int, input().split())
gcd = math.gcd(A, B)
ans = A * B // gcd
print(ans)

### FIXED CODE ###

import sys, fractions
from collections import defaultdict
from copy import deepcopy
import itertools
input = sys.stdin.readline
# 文字列の場合は普通のinput()を使うか下を使う
# input = sys.stdin.readline().rstrip()


A, B = map(int, input().split())
gcd = fractions.gcd(A, B)
ans = A * B // gcd
print(ans)
t = list(input())


for i in range(len(t)-1, -1, -1):
    if t[i] == '?':
        t[i] = 'D'
print(''.join(list(map(str, t))))

### FIXED CODE ###

t = list(input())
for i in range(len(t)-1, -1, -1):
    if t[i] == '?':
        t[i] = 'D'
print(''.join(list(map(str, t))))
N, M = map(int, input().split())
Print(abs((N-M))-N)

### FIXED CODE ###

n, k = map(int, input().split())
if n==0 or k==1:
    print(0)
    exit()
elif n<k:
    print(min(n, abs(n-k)))
    exit()
elif n % k == 0:
    print(0)
    exit()
else:
    mx = n%k
print(min(abs(mx-k), mx))
N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p-1] = 1
  elif(AC[p-1] == 0):
    WA[p-1] += 1
for i in range(M):
  if(AC[i] == 0):
    WA[i] = 0
print(sum(AC), sum(WA))

### FIXED CODE ###

N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p-1] = 1
  elif(AC[p-1] == 0):
    WA[p-1] += 1
for i in range(N):
  if(AC[i] == 0):
    WA[i] = 0
print(sum(AC), sum(WA))
N = int(input())
divide = []
for i in range(2,int( (10**6) ) + 1):
    while( N % i == 0):
        divide.append(i)
        N = int( N/i )
    if N ==1:
        break

i = 0
check = []
while(i < len(divide)-1):
    x = 1
    a = divide[:i+1]
    for j in a:
        x= x * j
    b = divide[i+1:]
    y = 1
    for j in b:
        y = y * j
    check.append(x + y)
    i += 1
    
ans = min(check) - 2
print(ans)

### FIXED CODE ###

N = int ( input() )
check_list = []
for i in range( 1, int( N**( 1/2 )+1 ) ):
    check = 0
    if N % i == 0:
        check = i + int( N / i ) - 2
        check_list.append(check)

print( min(check_list) )
#!/usr/bin/env python3
import sys
from operator import itemgetter
import bisect


def solve(N: int, M: int, A: "List[int]", BC):
    A.sort()
    BC.sort(key=itemgetter(1), reverse=True)
    idx = 0
    i = 0
    while i < M:
        B, C = BC[i]
        nidx = idx+B if idx+B < len(A) else len(A) - 1
        if A[nidx] < C:
            for j in range(idx+B):
                A[j] = C
            idx += B
            i += 1
        else:
            for j in range(nidx):
                if A[j] < C:
                    A[j] = C
            break

    ans = 0
    for a in A:
        ans += a
    print(ans)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    BC = []
    for _ in range(M):
        BC.append(list(map(int, input().split())))
    solve(N, M, A, BC)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from operator import itemgetter
import bisect


def solve(N: int, M: int, A: "List[int]", BC):
    A.sort()
    BC.sort(key=itemgetter(1), reverse=True)
    idx = 0
    i = 0
    for i in range(M):
        B, C = BC[i]
        nidx = idx+B if idx+B < len(A) else len(A)
        if A[nidx-1] < C:
            for j in range(idx, nidx):
                A[j] = C
            idx += B
        else:
            for j in range(idx, nidx):
                if A[j] < C:
                    A[j] = C
            break

    ans = 0
    for a in A:
        ans += a
    print(ans)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    BC = []
    for _ in range(M):
        BC.append(list(map(int, input().split())))
    solve(N, M, A, BC)

if __name__ == '__main__':
    main()
c0 = map(int, raw_input().split())
c1 = map(int, raw_input().split())
c2 = map(int, raw_input().split())

d0 = c0 - c2
d1 = c1 - c2
d2 = c2 - c1

b0 = ((d0[0] == d0[1]) and (d0[1] == d0[2]))
b1 = ((d1[0] == d1[1]) and (d1[1] == d1[2]))
b2 = ((d2[0] == d2[1]) and (d2[1] == d2[2]))

if (b0 and b1 and b2):
  print 'Yes'
else:
  print 'No'

### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
# 整数の入力
c1 = np.zeros((3,3),dtype=np.int64)
c2 = np.zeros((3,3),dtype=np.int64)
# スペース区切りの整数の入力
c1[0] = np.array(map(int, raw_input().split()))
c1[1] = np.array(map(int, raw_input().split()))
c1[2] = np.array(map(int, raw_input().split()))

c2[0] = c1[0] - c1[2]
c2[1] = c1[1] - c1[2]
c2[2] = c1[2] - c1[1]

b0 = ((c2[0,0] == c2[0,1]) and (c2[0,1] == c2[0,2]))
b1 = ((c2[1,0] == c2[1,1]) and (c2[1,1] == c2[1,2]))
b2 = ((c2[2,0] == c2[2,1]) and (c2[2,1] == c2[2,2]))

if (b0 and b1 and b2):
  print 'Yes'
else:
  print 'No'
N, M = map(int, input().split())
E = [[] for i in range(N + 1)]
for _ in range(M):
    l, r, d = map(int, input().split())
    E[l].append((r, d))
    E[r].append((l, -d))
INF = 10**10
dp = [INF for i in range(N + 1)]


def dfs(i):
    for r, d in E[i]:
        if dp[r] == INF:
            dp[r] = dp[i] + d
            if not dfs(r):
                return False
        elif dp[r] != dp[i] + d:
            return False
    return True


for i in range(1, N + 1):
    if dp[i] == INF:
        dp[i] = 0
        if not dfs(i):
            print('No')
            break
else:
    print('Yes')


### FIXED CODE ###

import sys
sys.setrecursionlimit(2*10**5)
N, M = map(int, input().split())
E = [[] for i in range(N + 1)]
for _ in range(M):
    l, r, d = map(int, input().split())
    E[l].append((r, d))
    E[r].append((l, -d))
INF = 10**10
dp = [INF for i in range(N + 1)]


def dfs(i):
    for r, d in E[i]:
        if dp[r] == INF:
            dp[r] = dp[i] + d
            if not dfs(r):
                return False
        elif dp[r] != dp[i] + d:
            return False
    return True


for i in range(1, N + 1):
    if dp[i] == INF:
        dp[i] = 0
        if not dfs(i):
            print('No')
            break
else:
    print('Yes')
INF = float("inf")
n = int(input())
A = [0]
for i, a in enumerate(sys.stdin)):
    a = list(map, a.split())
    if i == 0:
        A.extend(a)
    else:
        A.append(a[1])
C = [[INF] * (n + 1) for _ in range(n + 1)]
for i in range(n + 1):
    C[i][i] = 0
for j in range(1, n):
    for i in range(1, n - j + 1):
        for k in range(i + 1, i + j + 1):
            cost = C[i][k - 1] + C[k][i + j] + A[i] * A[k] * A[i + j + 1]
            if cost < C[i][i + j]:
                C[i][i + j] = cost
print(C[1][n])



### FIXED CODE ###

import sys
INF = float("inf")
n = int(input())
m = [[0] * (n + 1) for _ in range(n + 1)]
li = [list(map(int, a.split())) for a in sys.stdin]
z = (li[0][0], ) + list(zip(*li))[1]
for l in range(1, n):
    for i in range(1, n - l + 1):
        j = i + l
        m[i][j] = INF
        for k in range(i, j):
            m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + z[i - 1] * z[k] * z[j])
print(m[1][n])
a , b = input().split()
if a == b:
  print("H"):
else:
  print("D")

### FIXED CODE ###

a , b = input().split()
if a == b:
  print("H")
else:
  print("D")
n = input(); l=sorted([int(input()) for _ in range(n)])
print(int(sum(l)-l[-1]/2))

### FIXED CODE ###

n = int(input()); l=sorted([int(input()) for _ in range(n)])
print(int(sum(l)-l[-1]/2))
n = int(input())
a = list(map(int, input().split))

def 割れる回数(a):
    回数 = 0
    while a % 2 == 0:
        回数 += 1
        a = a // 2
    return 回数

割れる回数のリスト = [割れる回数(a_i) for a_i in a]
答え = min(割れる回数のリスト)
print(答え)

### FIXED CODE ###

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

def 割れる回数(a):
    回数 = 0
    while a % 2 == 0:
        回数 += 1
        a = a // 2
    return 回数

割れる回数のリスト = [割れる回数(a_i) for a_i in a]
答え = min(割れる回数のリスト)
print(答え)
N = int(input())
A = list(map(int,input().split()))
saidaiA =[]
oya = 1/2
flag = True
for i in range(len(A)):
    ko = oya *2
    oya = ko - A[i]
    saidaiA.append(ko)
    # print("i=",i)
    # print("ko =",ko)
    # print("oya =",oya)
    if oya < 0:
        flag = False
        break
ans = 0
print(saidaiA)
motikosi = 0
for i in range(len(A)):
    if A[-i] + motikosi >= saidaiA[-i]:
        ans += saidaiA[-i]
        motikosi = saidaiA[-i]
    else:
        ans += A[-i] + motikosi
        motikosi = A[-i] + motikosi
if flag == True:
    print(int(ans))
else:
    print(-1)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
if N == 0:
    if A[0] == 1:
        print(1)
    else:
        print(-1)
else:
    saidaiA =[]
    oya = 1
    flag = True
    for i in range(len(A)):
        if oya >= 5*10**13:
            ko = 10**14
        else:
            ko = oya *2
        if i == 0:
            ko = 1
        oya = ko - A[i]
        saidaiA.append(ko)
        if oya < 0:
            flag = False
    ans = 0
    # print(saidaiA)
    motikosi = 0
    for i in range(len(A)):
        if A[-i] + motikosi >= saidaiA[-i]:
            ans += saidaiA[-i]
            motikosi = saidaiA[-i]
        else:
            ans += A[-i] + motikosi
            motikosi = A[-i] + motikosi
    if flag == True:
        print(ans+1)
    else:
        print(-1)
a=str(input())
b=str(input())
c=str(input())
slice=a[:1]
slice=b[1:2]
slice=c[2:3]
s=a[:1]+b[1:2]+c[2:3]
print(“s”)

### FIXED CODE ###

a=list(str(input()))
b=list(str(input()))
c=list(str(input()))
print(str(a[0]+b[1]+c[2]))
import sys

mod=10**9+7
x,y=map(int,input().split())

if (-X + 2*Y) % 3 or (2*X - Y) % 3 or (-X + 2*Y) < 0 or (2*X - Y) < 0:
    print(0)
    sys.exit()

a=(-x+2*y)//3
b=(2*x-y)//3

n=a+b

p1=1
p2=1
p3=1

for i in range(n):
    p1=p1*(i+1)%mod

for i in range(max(a,b)):
    p2=p2*(i+1)%mod

    if i==b-1:
        p3=p2

if a+2*b==x and 2*a+b==y:
    print(p1*pow(p2,mod-2,mod)*pow(p3,mod-2,mod)%mod)
else:
    print(0)


### FIXED CODE ###

import sys
mod=10**9+7
x,y=map(int,input().split())

a=(-x+2*y)//3
b=(2*x-y)//3

if a<0 or b<0:
  print(0)
  sys.exit()
  
f=[1]
for i in range(1,a+b+1):
    f.append(f[-1]*i%mod)

if a+2*b==x and 2*a+b==y:
    print(f[a+b]*pow(f[a]*f[b],mod-2,mod)%mod)
else:
    print(0)
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v=i*i+j*j+k*k+i*j+j*k+k*i;
            if v<10050:
            	ans[v]+=1
for i in range(n):
	print(ans[i+1])

### FIXED CODE ###

l, r, d = map(int, input().split())
print(r//d - (l-1)//d)
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

A = [0]
B = [0]

for i in range(n):
    A.append(A[i]+a[i])

for i in range(m):
    B.append(B[i]+b[i])
    
ans,j = 0,m
for j in range(n+1):
    if A[i] > k:
        break
    while B[j] > k - B[i]:
        j -= 1
    ans = max(ans,i+j)
print(ans)

### FIXED CODE ###

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

A = [0]
B = [0]

for i in range(n):
    A.append(A[i]+a[i])

for i in range(m):
    B.append(B[i]+b[i])
    
ans,j = 0,m
for i in range(n+1):
    if A[i] > k:
        break
    while B[j] > k - A[i]:
        j -= 1
    ans = max(ans,i+j)
print(ans)
x=input()
    xx=[]
    if i in range(len(x)):
      xx.append("x")
    print(x)

### FIXED CODE ###

x=input()
xx=''
for i in range(len(x)):
    xx+='x'
print(xx)
abcde = []
for i in range(5):
    abcde.append(int(input()))
ans = sum([-(-abcde[i] // 10)*10 for i in range(5)]) + min([abcde[i]%10 for i in range(5) if abcde[i]%10 != 0])-10
print(ans)

### FIXED CODE ###

abcde = []
for i in range(5):
    abcde.append(int(input()))
ans = sum([-(-abcde[i] // 10)*10 for i in range(5)])
amari = [abcde[i]%10 for i in range(5) if abcde[i]%10 != 0]
if len(amari) == 0:
    ans = sum([-(-abcde[i] // 10)*10 for i in range(5)])
else:
    ans = sum([-(-abcde[i] // 10)*10 for i in range(5)])-10+min(amari)
    
print(ans)
import math
A,B = input().split()

if (float(B) - (int(float(B)))) * 100 * 100 == 28.99999999999999:
    D = 29 + int(float(B)) * 100
elif (float(B) - (int(float(B)))) * 100 * 100 == 57.99999999999999:
    D = 58 + int(float(B)) * 100
else:
    D = int(float(B) * 100)

C = math.floor(int(A) * int(B) / 100)
print(C)


### FIXED CODE ###

A,B = input().split()
B = B[:-3] + B[-2:]
C = int(A) * int(B) // 100
print(C)
num=1
while True:
    maxw=input()
    if maxw==0:break
    N=input()
    ws,ps=[0]*N,[0]*N
    for i in xrange(N):
        ps[i],ws[i]=map(int,raw_input().strip().split(","))
    dp=[[0]*(maxw+1) for i in range(len(ws)+1)]
    ret=0
    for i in range(len(ws)):
        for j in range(maxw+1):
            if (j+ws[i])<=maxw:
                dp[i+1][j+ws[i]]=max(dp[i+1][j+ws[i]],dp[i][j]+ps[i])
                ret=max(dp[i+1][j+ws[i]],ret)
    print "Case {}:".format(num)
    print ret
    print dp[len(ws)].index(ret)
    num+=1

### FIXED CODE ###

num=1
while True:
    maxw=input()
    if maxw==0:break
    print "Case %d:"%num
    dp,w,v=[0]*1001,[0]*1001,[0]*1001
    n=input()
    for i in xrange(n):
        v[i],w[i]=map(int,raw_input().strip().split(","))
    for i in xrange(n):
        for j in xrange(maxw,-1,-1):
            if j+w[i]<=maxw:
                dp[j+w[i]]=max(dp[j+w[i]],dp[j]+v[i])
    print max(dp)
    print dp.index(max(dp))
    num+=1
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    n, y = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    flag = False
    for i in rage(n):
        for j in range(n - i):
            if y - (i * 10000) + (j * 5000) == 1000 * (n - i - j):
                print(i, j, (n-i-j))
                flag = True
                break
        if flag == True
            break

    if flag == False:
        print("-1 -1 -1")
resolve()

### FIXED CODE ###

def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    n, y = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    flag = False
    for i in range(n+1):
        for j in range(n-i+1):
            if (10000 * i) + (5000 * j) + (1000 * (n-i-j)) == y:
                print(i, j, (n-i-j))
                flag = True
                break
        if flag == True:
            break

    if flag == False:
        print("-1 -1 -1")
resolve()
N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]
X.sort(key=lambda x: (x[0], -x[1]))
for a, b in X:
  print(a, b)

### FIXED CODE ###

N = int(input())
X = [list(input().split()) for _ in range(N)]
for i, t in sorted(enumerate(X), key=lambda x: (x[1][0], -int(x[1][1]))):
  print(i + 1)
import heapq
 
 
class MaxHeap(object):
    def __init__(self, x):
        self.heap = [-e for e in x]
        heapq.heapify(self.heap)
 
    def push(self, value):
        heapq.heappush(self.heap, -value)
 
    def pop(self):
        return -heapq.heappop(self.heap)
 
N, M = list(map(lambda x:int(x), input().split(' ')))
l = list(map(lambda x:int(x), input().split(' ')))

maxheap = MaxHeap(l)
 
WARI = 0.5
for _ in range(0, M):

### FIXED CODE ###


import heapq


class MaxHeap(object):
    def __init__(self, x):
        self.heap = [-e for e in x]
        heapq.heapify(self.heap)

    def push(self, value):
        heapq.heappush(self.heap, -value)

    def pop(self):
        return -heapq.heappop(self.heap)

N, M = list(map(lambda x:int(x), input().split(' ')))
l = list(map(lambda x:int(x), input().split(' ')))

maxheap = MaxHeap(l)

WARI = 0.5
for _ in range(0, M):
    v = int(maxheap.pop() * WARI)
    maxheap.push(v)

SUM = 0
for _ in range(0, N):
    SUM += maxheap.pop()

print(SUM)
import collections
q = collections.deque()
li = ((1,0),(0,1),(-1,0),(0,-1))
LL=[]

for i in range(H):
    for j in range(W):
        visited = [[-1]*W for i in range(H)]
        if L[i][j] ==".":
            visited[i][j] = 0
            q.append((i,j))
            cnt = 0
        
        while q:
            x,y = q.popleft()
            for dx,dy in li:
                nx,ny = x+dx,y+dy
                #print(nx,ny)
                if nx<0 or nx>=H or ny<0 or ny>=W or visited[nx][ny] >0:
                    continue
                if visited[nx][ny] ==-1 and  L[nx][ny] == ".": 
                    visited[nx][ny] = visited[x][y] +1
                    cnt = max(cnt,visited[nx][ny])
                    q.append((nx,ny))
        LL.append(cnt)
print(max(LL))

### FIXED CODE ###

import collections
H,W = map(int,input().split())
if H == W == 1:
    print(0)
    exit()
if (H == 1 and W == 2) or (H == 2 and W == 1):
    print(1)
    exit()
LL=[]
for i in range(H):
    LL.append(input())

L = ((1,0),(0,1),(-1,0),(0,-1))
q = collections.deque()
max_L = []
for i in range(H):
    for j in range(W):
        d = [[0]*W for i in range(H)]
        if LL[i][j] ==".":
            q.append((i,j))
            d[i][j] = 0
            max1 = 0
            while q:
                x,y = q.popleft()
                for dx,dy in L:
                    if 0>x+dx or x+dx>H-1 or 0>y+dy or y+dy>W-1 or d[x+dx][y+dy] !=0:
                        continue
                    if  LL[x+dx][y+dy] == ".":
                        d[x+dx][y+dy] = d[x][y] +1
                        q.append((x+dx,y+dy))
                        max1 = max(max1,d[x+dx][y+dy])
                        max_L.append(max1)
                        #print(q,d ,max1)
print(max(max_L))
H, W = list(map(int, input().split()))

areas = [ceil(H / 2), H // 2]

ret = areas[0] * (ceil(W / 2)) + areas[1] * (W // 2)

print(ret)



### FIXED CODE ###


from math import ceil, sqrt, floor


H, W = list(map(int, input().split()))

if H == 1 or W == 1:
    print(1)
    exit(0)

areas = [ceil(H / 2), H // 2]

ret = areas[0] * (ceil(W / 2)) + areas[1] * (W // 2)

print(ret)
str = input()

L, R = map(int, str.split(" "))

min = 2019

for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        k = i * j % 2019
        if min > k:
            min = k

print(min)

### FIXED CODE ###

str = input()

N, A, B = str.split(" ")

a = int(N) * int(A)
b = int(B)

if a > b:
    print(b)
else:
    print(a)
n=int(input())
w=list(map(int,input().split()))

total=sum[w]
s1=w[0]
ans=total-s1

for i in range(1,n):
    s1+=w[i]
    ans=min(ans,abs(total-s1*2))

print(ans)

### FIXED CODE ###

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

total=sum(w)
s1=w[0]
ans=total-s1

for i in range(1,n):
    s1+=w[i]
    ans=min(ans,abs(total-s1*2))

print(ans)
n=int(input())
d=list(int(input()) for i in range(n))
cnt=0
st=100
l=[]
for i in range(n):
    if d<st:
        cnt += 1
        st = d
    else:
        l.append(cnt)
        st = 100
print(max(l))

### FIXED CODE ###

n=int(input())
k=[]
for i in range(n):
    d = int(input())
    k.append(d)
print(len(set(k)))