Harryxun/stf_run huggingface dataset:
x, n = list(map(int, input().split(" ")))
if n != 0:

    p = list(map(int, input().split(" ")))

    p_ = [abs(x - n) for n in p]

    m_p_ = p_.index(min(p_))

    start = p[m_p_]

    for v in range(100):
        a = start - v - 1
        if a not in p:
            ans = a
        b = start + v + 1
        if b not in p:
            if ans > b:
                ans = b
            break
            
else:
    ans = x
    
print(ans)

### FIXED CODE ###

x, n = list(map(int, input().split(" ")))
if n != 0:

    p = list(map(int, input().split(" ")))

    p_ = [abs(x - n) for n in p]

    m_p_ = p_.index(min(p_))

    start = p[m_p_]

    for v in range(100):
        a = start - v - 1
        b = start + v + 1
        if (a not in p) and (b in p):
            ans = a
            break

        elif (a in p) and (b not in p):
            ans = b
            break
            
        elif (a not in p) and (b not in p):
            if a > b:
                ans = b
                break
            else:
                ans = a
                break
                
else:
    ans = x
    
print(ans)
N, M = map(int, input().split())
S = [0] * M
C = [0] * M
for i in range(M):
    S[i], C[i]= map(int, input().split())

if M==0:
  A = 10**(N-1)
else:
  A = 0

X = []
for j in range(M):
  if S[j] in X:
    X.append(S[j])
  else:
    A +=(10**((N-S[j])))*C[j]
    X.append(S[j])

str_B = list(str(A))

for k in range(M):
  if str_B[S[k]-1] != str(C[k]):
    A = -1

if A < 10**(N-1):
  A = -1

print(A)

### FIXED CODE ###

N = int(input())
print(int(N/2) if N%2 == 0 else N//2+1)
import collections
import sys
input=sys.stdin.readline

def divisors(n):
  ret=[]
  for i in range(2,int(n**0.5)+1):
    if n%i==0:
      ret.append(i)
      while n%i==0:
        n//=i
  return ret

def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

n=int(input())
arr=list(map(int,input().split()))
cnt=[False]*(max(arr)+1)
is_pairwise=True
tmp=arr[0]
for val in arr:
  tmp=gcd(tmp,val)
  if is_pairwise==False:
    continue
  divisor=divisors(val)
  for val2 in divisor:
    if cnt[val2]==True
      is_pairwise=False
      break
    cnt[val2]=True
if tmp==1:
  is_setwise=True
else:
  is_setwise=False
if is_pairwise==True:
  print('pairwise coprime')
elif is_setwise==True:
  print('setwise coprime')
else:
  print('not coprime')

### FIXED CODE ###

#!/usr/bin/env python3

import collections
import sys
input=sys.stdin.readline

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

def judge(n,arr):
    MAX=10**6
    table=[i for i in range(MAX+1)]
    for i in range(2,MAX+1):
        if table[i]<i:
            continue
        for j in range(i,MAX+1,i):
            table[j]=i
    cnt=collections.defaultdict(int)
    for val in arr:
        s=set()
        while val!=1:
            prime=table[val]
            s.add(prime)
            val//=prime
        for tmp in s:
            cnt[tmp]+=1
    for val in cnt.values():
        if val>=2:
            return False
    return True
    
n=int(input())
arr=list(map(int,input().split()))
tmp=arr[0]
for val in arr:
    tmp=gcd(tmp,val)
if tmp==1:
    is_setwise=True
else:
    is_setwise=False
is_pairwise=judge(n,arr)
if is_pairwise==True:
    print('pairwise coprime')
elif is_setwise==True:
    print('setwise coprime')
else:
    print('not coprime')
N=int(input())
for a in range(N//4+1):
    for b in range(N//7+1):
        if 4*a+7*b==N:
            print(Yes)
        exit()
        else:
            print(No)


### FIXED CODE ###

N=int(input())
for a in range(N//4+1):
    for b in range(N//7+1):
        if 4*a+7*b==N:
            print('Yes')
            exit()
  
print('No')
n,m=map(int,input().split())
student=[list(map(int,input().split())) for i in range(n)]
point=[list(map(int,input().split())) for i in range(n)]
for a,b in student:
  length=10**10
  pn=0
  for j in range(m):
    c,d=point[j]
    if abs(a-c)+abs(b-d)<length:
      length=abs(a-c)+abs(b-d)
      pn=1+j
  print(pn)

### FIXED CODE ###

n,m=map(int,input().split())
student=[list(map(int,input().split())) for i in range(n)]
point=[list(map(int,input().split())) for i in range(m)]

for a,b in student:
  length=10**10
  pn=0
  for j in range(m):
    c,d=point[j]
    if abs(a-c)+abs(b-d)<length:
      length=abs(a-c)+abs(b-d)
      pn=1+j
  print(pn)
n = int(input())
w = list(map(int,input().split())
ans = 10000000
sumpoint = 0
for i in range (n):
    sumpoint = sumpoint + w[i];
    ans = min(ans, abs(sum(w)-sumpoint))
print(ans)

### FIXED CODE ###

n = int(input())
w = list(map(int,input().split()))
ans = 10000000
sumpoint = 0
for i in range (n):
    sumpoint += w[i]
    ans = min(ans, abs(sum(w)-(2*sumpoint)))
print(ans)
# -*- coding: utf-8 -*-
# 整数の入力
import math

a = int(input())
 
gusu = a // 2
ngusu = math.floor(gusu)
 
if gusu > ngusu:
  kisu = ngusu + 1
else:
  kisu = ngusu

kakuritu　= kisu // a 
print(kakuritu)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
import math
 
a = float(input())
 
gusu = a / 2
ngusu = math.floor(gusu)
 
if gusu > ngusu:
  kisu = ngusu + 1
else:
  kisu = ngusu
kaku = kisu / a 

print(kaku)
import copy
x,y = list(map(int, input().split()))
Z = [list(map(int, input().split())) for _ in range(x)]

def gonext(a,b):
    if a < y-1:
        a += 1
    else:
        b += 1
        a = 0
    return(a,b)

a, b = 0, 0
ans = []
count = 0
while a < y and b < x:
    now = Z[a][b]
    a_copy= copy.deepcopy(a)
    b_copy = copy.deepcopy(b)
    a, b = gonext(a, b)
    if now % 2 == 1:
        Z[a][b] += 1
        ans.append([a_copy, b_copy, a, b])
        count += 1

print(count)
for i in ans:
    k = [j+1 for j in i]
    print(" ".join(list(map(str, k))))

### FIXED CODE ###


import copy
y,x = list(map(int, input().split()))
Z = [list(map(int, input().split())) for _ in range(y)]

way = 1
a, b = 0, 0
ans = []
count = 0
while a < y and b < x:
    now = Z[a][b]
    a_copy= copy.deepcopy(a)
    b_copy = copy.deepcopy(b)

    if (way == 1 and a < y-1) or (way == -1 and a > 0):
        a += way
    else:
        b += 1
        way = way*(-1)
    if not (a < y and b < x):
        break
    if now % 2 == 1:
        Z[a][b] += 1
        ans.append([a_copy, b_copy, a, b])
        count += 1

print(count)
for i in ans:
    k = [j+1 for j in i]
    print(" ".join(list(map(str, k))))
import itertools
N = int(input())

XY = [[int(x) for x in input().split()] for _ in range(N)]

vectors = []

for xy1,xy2 in itertools.combinations(XY,2):
  p = xy2[0] - xy1[0]
  q = xy2[1] - xy1[1]
  vectors.append((p,q))
  vectors.append((-p,-q))

from collections import Counter
c = Counter(vectors)

x = max(c.values())

answer = N - x
print(answer)

### FIXED CODE ###

import itertools
N = int(input())

XY = [[int(x) for x in input().split()] for _ in range(N)]

vectors = []

for xy1,xy2 in itertools.combinations(XY,2):
  p = xy2[0] - xy1[0]
  q = xy2[1] - xy1[1]
  vectors.append((p,q))
  vectors.append((-p,-q))

from collections import Counter
c = Counter(vectors)

if N >= 2:
  x = max(c.values())
  answer = N - x
else:
  answer = 1
print(answer)
N, X = map(int, input().split())
L = list(map(int, input().split()))

x = 0
i = 0

while x <= X :
    x += L[i]
    i += 1
    
print(i)

### FIXED CODE ###

N, X = map(int, input().split())
L = list(map(int, input().split()))

x = 0
i = 0

while x <= X :
    if i == N:
        i += 1
        break
    x += L[i]
    i += 1

print(i)
import functools as fun

@fun.lru_cache
def rec(n):
	if n == 0:
		return 0
	elif n == 1:
		return abs(h[n] - h[n-1])
	else:
		return min(rec(n-1) + abs(h[n] - h[n-1]), rec(n-2) + abs(h[n] - h[n-2]))

### main
N = int(input())
h = list(map(int, input().split()))

print(rec(N-1))



### FIXED CODE ###

def main():
	N = int(input())
	h = list( map(int, input().split()) )
	
	dp = [0 for _ in range(N)]
	dp[1] = abs(h[0] - h[1])
	for i in range(2, N):
		dp[i] = min( dp[i-1] + abs(h[i] - h[i-1]),
		             dp[i-2] + abs(h[i] - h[i-2]) )
	print(dp[N-1])

	return

main()
a, b, c = map(int,input().split())
if (c − a − b > 0) and (4 * a * b < (c − a − b)**2):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a, b, c = map(int,input().split())
if (c - a - b > 0) and (4 * a * b < (c - a - b)**2):
  print('Yes')
else:
  print('No')
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

if a + b + c + d  == 7:
  print(str(a)+"+"+str(b)+"+"str(c)+"+"str(d)+"=7")
elif a + b + c - d == 7:
  print(str(a)+"+"+str(b)+"+"str(c)+"-"str(d)+"=7")
elif a + b - c + d == 7:
  print(str(a)+"+"+str(b)+"-"str(c)+"+"str(d)+"=7")
elif a - b + c + d == 7:
  print(str(a)+"-"+str(b)+"+"str(c)+"+"str(d)+"=7")
elif a + b - c - d == 7:
  print(str(a)+"+"+str(b)+"-"str(c)+"-"str(d)+"=7")
elif a - b + c - d == 7:
  print(str(a)+"-"+str(b)+"+"str(c)+"-"str(d)+"=7")
elif a - b - c - d == 7:
  print(str(a)+"+"+str(b)+"+"str(c)+"+"str(d)+"=7")

### FIXED CODE ###

s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

if a + b + c + d  == 7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a + b + c - d == 7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a + b - c + d == 7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a - b + c + d == 7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a + b - c - d == 7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a - b + c - d == 7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a - b - c + d == 7:
  print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a - b - c - d == 7:
  print(str(a)+"-"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
N = int(input())
n = []
for i in range(N):
  n.append(int(input()))

a = 1
c = -1

for i in range(N):
  a = n[a-1]
  if c != -1:
    if a == 2:
      c = (i+1)
  else:

print(c)

### FIXED CODE ###

N = int(input())
n = []
for i in range(N):
  n.append(int(input()))

a = 1
c = -1

for i in range(N):
  a = n[a-1]
  if a == 2:
    if c < 0:
      c = (i+1)

print(c)
while True:
   x,y = map(int, raw_input().split())
   if x == '0' and y == '0':
      break
   else:
      if x >= y:
         print 'y x'
      else:
         print 'x y'
   

### FIXED CODE ###

while True:
   x,y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   if x >= y:
      print '%s %s' % (y, x)
   else:
      print '%s %s' % (x, y)
s1 = input()
s2 = input()
s3 = input()
print(s1[0][0],s2[0][1],s3[0][2], sep="")s1 = input()
s2 = input()
s3 = input()
print(s1[0],s2[1],s3[2], sep="")

### FIXED CODE ###

s1 = input()
s2 = input()
s3 = input()
print(s1[0],s2[1],s3[2], sep="")
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import deque
n=int(input())
a=[]
for i in range(0,n):
  a.append(int(input()))
a.sort()

d = [a[0]]
a=a[1:]
b = deque(d)

f=True
while len(a)>0:
  la=len(a)-1
  lb=len(b)-1
  ln = abs(b[0]-a[0])
  lx = abs(b[0]-a[la])
  rn = abs(b[lb]-a[0])
  rx = abs(b[lb]-a[la])

  x = max(ln, max(lx, max(rn, rx)))
  
  if x == ln:
    b.insert(0,a[0])
    a=a[1:]
  elif x == lx:
    b.insert(0,a.pop())
  elif x == rn:
    b.append(a[0])
    a=a[1:]
  else:
    b.append(a.pop())
#print(b)

res=0
for i in range(0,len(b)-1):
  res=res+abs(b[i]-b[i+1])
print(res)


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s=input()
if len(s)==2:
  print(s)
else:
  print(s[2]+s[1]+s[0])
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    A, B = map(int, readline().split())
    def gcd(x, y):
        if not x%y:
            return y
        return gcd(y, x%y)
    
    def factorize(x):
        res = []
        for i in range(2, int(n**0.5)+1):
            if x%i != 0:
                continue
            cnt = 0
            while x%i == 0:
                x //= i
                cnt += 1 
            res.append((i, cnt))
        if x != 1:
            res.append((x, 1))
        return res

    print(len(factorize(gcd(A, B)))+1) 
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import math 
def main():
    A, B = map(int, readline().split())
    def gcd(x, y):
        if not x%y:
            return y
        return gcd(y, x%y)
    
    def factorize(x):
        res = []
        for i in range(2, int(math.sqrt(x))+1):
            if x%i != 0:
                continue
            cnt = 0
            while x%i == 0:
                x //= i
                cnt += 1 
            res.append((i, cnt))
        if x != 1:
            res.append((x, 1))
        return res

    g = gcd(A, B)
    print(len(factorize(gcd(A, B)))+1) 
if __name__ == '__main__':
    main()
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input9())
r = []
for _ in range(3):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] == b:
                a[i][j] = 0
ans = 'No'
for i in range(3):
    if a[i][0] + a[i][1] + a[i][2] == 0: ans = 'Yes'
    if a[0][i] + a[1][i] + a[2][i] == 0: ans = 'Yes'
if a[0][0] + a[1][1] + a[2][2] == 0: ans = 'Yes'
if a[0][2] + a[1][1] + a[2][0] == 0: ans = 'Yes'
print(ans)

### FIXED CODE ###

a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
for _ in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] == b:
                a[i][j] = 0
ans = 'No'
for i in range(3):
    if a[i][0] + a[i][1] + a[i][2] == 0: ans = 'Yes'
    if a[0][i] + a[1][i] + a[2][i] == 0: ans = 'Yes'
if a[0][0] + a[1][1] + a[2][2] == 0: ans = 'Yes'
if a[0][2] + a[1][1] + a[2][0] == 0: ans = 'Yes'
print(ans)
N = int(input())
A = list(map(int,input().split()))
from fractions import gcd
mod = 10**9+7
g = A[0]
for a in A[1::]:
  g = g*a//gcd(g,a)

ans = 0
b = g%mod
for a in A:
  ans += b*pow(a,mod-2,mod)
  ans %= mod
  
print(ans%mod)

### FIXED CODE ###

N = int(input())
ans = 0
l=[[0]*10 for _ in range(10)]
for i in range(1,N+1):
  s = str(i)
  l[int(s[0])][int(s[-1])]+=1
  
for i in range(10):
  for j in range(10):
    ans+=l[i][j]*l[j][i]
    
print(ans)
n, k = [int(i) for i in input().split(" ")]
dm = [[0 for j in range(0, 2 * k)] for i in range(0, 2 * k)]
s = [[0 for j in range(0, 2 * k + 1)] for  i in range(0, 2 * k + 1)]

for i in range(0, n):
    x, y, c = input().split(" ")
    x = int(x) % (2 * k)
    if c == "W":
        y = int(y) % (2 * k)
    else:
        y = int(y + k) % (2 * k)
    dm[x][y] += 1

for i in range(1, 2 * k + 1):
    for j in range(1, 2 * k + 1):
        s[i][j] = s[i][j - 1] + s[i - 1][j] - s[i - 1][j - 1] + dm[i - 1][j - 1]

def srect(i, j, r, l):
    global s
    return s[r][l] - s[r][j] - s[i][l] + s[i][j]

m = 0
for i in range(0, k):
    for j in range(0, k):
        aw = srect(i, j, i + k, j + k) + srect(i + k, j + k, 2 * k, 2 * k)
        raw = s[2 * k][2 * k] - aw
        if m < max(aw, raw):
            m = max(aw, raw)
print(m)

#for i in s:
#    print(i)

### FIXED CODE ###

n, k = [int(i) for i in input().split(" ")]
dm = [[0 for j in range(0, 2 * k)] for i in range(0, 2 * k)]
s = [[0 for j in range(0, 2 * k + 1)] for  i in range(0, 2 * k + 1)]

for i in range(0, n):
    x, y, c = input().split(" ")
    x = int(x) % (2 * k)
    if c == "W":
        y = int(y) % (2 * k)
    else:
        y = (int(y) + k) % (2 * k)
    dm[x][y] += 1

for i in range(1, 2 * k + 1):
    for j in range(1, 2 * k + 1):
        s[i][j] = s[i][j - 1] + s[i - 1][j] - s[i - 1][j - 1] + dm[i - 1][j - 1]

def srect(i, j, r, l):
    global s
    return s[r][l] - s[r][j] - s[i][l] + s[i][j]

m = 0
for i in range(0, k):
    for j in range(0, k):
        aw = srect(0, j, i, j + k) + srect(i, 0, i + k, j) + srect(i, j + k, i + k, 2 * k) + srect(i + k, j, 2 * k, j + k)
        raw = n - aw
        if m < max(aw, raw):
            m = max(aw, raw)
print(m)
import numpy as np

while 1:
    N = int(input())
    if N == 0:
        break
    xs = np.array(list(map(int, input().split())))
    print(xs)
    print(np.sqrt(np.var(xs)))


### FIXED CODE ###

import math
while 1:
    N = int(input())
    if N == 0:
        break
    xs = list(map(int, input().split()))
    avg = 0
    for x in xs:
        avg += x
    avg /= len(xs)
    var = 0
    for x in xs:
        var += (x - avg) ** 2
    var /= len(xs)
    print(math.sqrt(var))
import numpy as np
def main():
    N,M = map(int,input().split())
    A = [int(x) for x in input().split()]
    for _ in range(M):
        b,c = map(int, input().split())
        for i in range(b):
            A.append(c)
    np.array(A).sort()
    print(sum(A[-N:]))
main()

### FIXED CODE ###

from operator import itemgetter

def main():
    N,M = map(int, input().split())
    A = [[1,int(x)] for x in input().split()]
    for _ in range(M):
        b,c = map(int, input().split())
        A.append([b,c])
    A.sort(key=itemgetter(1))
    A.reverse()
    n=0
    s=0
    for a in A:
        n+=a[0]
        if n<=N:
            s+=a[1]*a[0]
        elif n>N:
            d=a[0]
            e=a[1]
            break
    s+=(N-n+d)*e
    print(s)
    
main()
N = int(input())
abc = [list(map(int, input().split())) for i in range(N)]
abc.append([0, 0, 0])

dp = [[-1] * 4 for i in range(N + 1)]
print(dp)


def happy(n, p):
    if n < 0:
        return 0
    if dp[n][p] >= 0:
        return dp[n][p]

    a = 0 if p == 0 else happy(n - 1, 0) + abc[n][0]
    b = 0 if p == 1 else happy(n - 1, 1) + abc[n][1]
    c = 0 if p == 2 else happy(n - 1, 2) + abc[n][2]
    dp[n][p] = max([a, b, c])

    return dp[n][p]


print(happy(N - 1, 3))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)

N = int(input())
abc = [list(map(int, input().split())) for i in range(N)]
abc.append([0, 0, 0])

dp = [[-1] * 4 for i in range(N + 1)]


def happy(n, p):
    if n < 0:
        return 0
    if dp[n][p] >= 0:
        return dp[n][p]

    a = 0 if p == 0 else happy(n - 1, 0) + abc[n][0]
    b = 0 if p == 1 else happy(n - 1, 1) + abc[n][1]
    c = 0 if p == 2 else happy(n - 1, 2) + abc[n][2]
    dp[n][p] = max([a, b, c])

    return dp[n][p]


print(happy(N - 1, 3))
N, K = map(int, input().split())
S = str(input())

print(S.lower(K-1))

### FIXED CODE ###

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

S = list(input())

S[K-1] = S[K-1].lower()

s_new = ""
for i in range(N):
  s_new += S[i]
    
print(s_new)
N, Ma, Mb = (list)(map(int, input().split()))
N_max = 40
abmax = 10
l = []
inf = 10**6
dp = [[[inf]*401 for _ in range(401)] for _ in range(40)]


for _ in range(N):
    l.append((list)(map(int, input().split())))

dp[0][0][0] = 0

for i in range(N):
    for ca in range(401):
        for cb in range(401):
            if dp[i][ca][cb] != inf:
                dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb])
                t_a = l[i][0]
                t_b = l[i][1]
                dp[i+1][ca+t_a][cb+t_b] =\
                    min(dp[i+1][ca+t_a][cb+t_b], dp[i][ca][cb]+l[i][2])

ans = inf
for i in range(401):
    for j in range(401):
        if i*Mb == j*Ma:
            ans = min(ans, dp[N][i][j])

if ans == inf:
    ans = -1
print(ans)


### FIXED CODE ###

N, Ma, Mb = (list)(map(int, input().split()))
l = []
inf = 10**6
dp = [[[inf]*401 for _ in range(401)] for _ in range(41)]


for _ in range(N):
    l.append((list)(map(int, input().split())))

dp[0][0][0] = 0

for i in range(N):
    for ca in range(401):
        for cb in range(401):
            if dp[i][ca][cb] != inf:
                dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb])
                t_a = l[i][0]
                t_b = l[i][1]
                dp[i+1][ca+t_a][cb+t_b] =\
                    min(dp[i+1][ca+t_a][cb+t_b], dp[i][ca][cb]+l[i][2])

ans = inf
for i in range(1, 401):
    for j in range(1, 401):
        if i*Mb == j*Ma:
            ans = min(ans, dp[N][i][j])

if ans == inf:
    ans = -1
print(ans)
import sys
try:
    while True:
        n = input()
        a=input()
		b=input()
		nn=int(n)
		aa=int(a)
		bb=int(b)
        if n == '':
            break
        if a == '':
            break
        if b == '':
            break
except EOFError:
    pass

train=nn*aa
taxi=bb
if train>=taxi:
  print(train)
else:
  print(taxi)


### FIXED CODE ###

import sys

n,a,b=(int(x) for x in input().split())

train=n*a
taxi=b
if train>=taxi:
  print(taxi)
else:
  print(train)
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)

thold = sum(a) / (4 * m)

if a[m] < thold:
    print('No')
else:
    print('Yes')


### FIXED CODE ###

from math import ceil

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

a.sort(reverse=True)

thold = ceil(sum(a) / (4 * m))

if a[m-1] < thold:
    print('No')
else:
    print('Yes')
if int(raw_iniput()) >= 1000:
  print 'ABD'
else:
  print 'ABC'


### FIXED CODE ###

if int(raw_input()) >= 1000:
  print 'ABD'
else:
  print 'ABC'
def unplanned_queries():
	n, m = map(int, raw_input().split(" "))
	a = []
	for i in range(m):
		a.append(map(int, raw_input().split(" ")))
	dic = defaultdict(int)
	for i in range(m):
		dic[a[i][0]] += 1
		dic[a[i][1]] += 1
	for key,value in dic.iteritems():
		if value%2!=0:
			print "NO"
			return
	print "YES"


if __name__ == "__main__":
	unplanned_queries()

### FIXED CODE ###

from collections import defaultdict

def unplanned_queries():
	n, m = map(int, raw_input().split(" "))
	a = []
	for i in range(m):
		a.append(map(int, raw_input().split(" ")))
	dic = defaultdict(int)
	for i in range(m):
		dic[a[i][0]] += 1
		dic[a[i][1]] += 1
	for key,value in dic.iteritems():
		if value%2!=0:
			print "NO"
			return
	print "YES"


if __name__ == "__main__":
	unplanned_queries()
def transnum(int: n):
    if n % 3 != 0:
        return n + 3 - n % 3
    else:
        return n
 
while True:
    x,n = tuple(int(i) for i in input().split())
    r = 0
    if x == n == 0:
        break
    amin = n // 3 + 1
    amax = 2 * transnum(n) // 3
    if amax > x:
        amax = x
 
    A = [j for j in range(amin, amax+1)]
 
    #print(A)
 
    for a in A:
        bmin = (n-a) // 3 + 1
        bmax = 2 * transnum(n-a) // 3
        if bmax > a:
            bmax = a
 
        B = [j for j in range(bmin, bmax) if j+j != n-a]
        #print(B)
        for b in B:
            cmin = (n-a-b) // 3 + 1
            cmax = 2 * transnum(n-a-b) // 3
            if cmax > b:
                cmax = b
            C = [k for k in range(cmin, cmax) if k == n-a-b]
            #print(C)
            r += len(C)
            C.clear()
        B.clear()
     
    print(r)


### FIXED CODE ###

while True:
    n,x = tuple(int(i) for i in input().split())
    if n == x == 0:
        break
    r = 0
    a = [j for j in range(1,n+1)]
    #print(a)
    for l in a:
        b = [k for k in range(1,l)]
        if len(b) == 0:
            continue
        #print(b)
        for m in b:
            c = [o for o in range(1,m) if l+m+o == x]
            #print(c)
            r += len(c)
            c.clear()
        b.clear()
    print(r)
A,B,C = map(int, input().split())

def even(a):
	if a % 2 == 0:
		return True
	else:
		return False

if A == B and B == C:
	print("-1")
elif:
	if not (even(A) and even(B) and even(C)):
		print("0")
		
else:
	cnt = 0
	while even(A) and even(B) and even(C):
		tmp1, tmp2, tmp3 = A,B,C
		A = (tmp2+tmp3) // 2
		B = (tmp3+tmp1) // 2
		C = (tmp1+tmp2) // 2
		cnt += 1
	print(cnt)


### FIXED CODE ###

l = list(map(int, input().split()))
ans = 0
while( l[0]%2==0 and l[1]%2==0 and l[2]%2==0):
    if l[0]==l[1]and l[1]==l[2]:
        ans = -1
        break
    else:
        a = l[0]
        b = l[1]
        c = l[2]
        l[0]=(b+c)/2
        l[1]=(a+c)/2
        l[2]=(a+b)/2
        ans+=1
print(ans)
n,m=map(int,input().split())
A=list(map(int,input().split()))

while m>0:
  A.sort(reverse=True)
  A[0]=A[0]//2
  m-=1
  print(A,m)
print(sum(A))

### FIXED CODE ###

import heapq
n,m=map(int,input().split())
A=list(map(int,input().split()))

q=[]
for a in A:
  heapq.heappush(q,-a)
  
for _ in range(m):
  p=-heapq.heappop(q)//2
  heapq.heappush(q,-p)
print(-sum(q))