Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
"""
C - Pyramid
https://atcoder.jp/contests/abc112/tasks/abc112_c

"""
import sys


def solve(N, positions):
    if N == 1:
        return positions[0]
    for cy in range(101):
        for cx in range(101):
            is_valid = True
            x, y, h = positions[0]
            ph = h + abs(cy-y) + abs(cx-x)
            for x, y, h in positions[1:]:
                hh = h + abs(cy-y) + abs(cx-x)
                if hh != ph:
                    is_valid = False
                    break
            if is_valid:
                return (cx, cy, ph)

def main(args):
    N = int(input())
    positions = [[int(i) for i in input().split()] for _ in range(N)]
    ans = solve(N, positions)
    print(*ans)


if __name__ == '__main__':
    main(sys.argv[1:])


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
C - Pyramid
https://atcoder.jp/contests/abc112/tasks/abc112_c

"""
import sys


def solve(N, positions):
    if N == 1:
        return positions[0]
    for cy in range(101):
        for cx in range(101):
            is_valid = True
            x, y, h = positions[0]
            ph = h + abs(cy-y) + abs(cx-x)
            for x, y, h in positions[1:]:
                hh = max(ph - abs(cy-y) - abs(cx-x), 0)
                if hh != h:
                    is_valid = False
                    break
            if is_valid:
                return (cx, cy, ph)
    for cy in range(101):
        for cx in range(101):
            is_valid = True
            x, y, h = positions[-1]
            ph = h + abs(cy-y) + abs(cx-x)
            for x, y, h in positions[:-1]:
                hh = max(ph - abs(cy-y) - abs(cx-x), 0)
                if hh != h:
                    is_valid = False
                    break
            if is_valid:
                return (cx, cy, ph)


def main(args):
    N = int(input())
    positions = [[int(i) for i in input().split()] for _ in range(N)]
    ans = solve(N, positions)
    print(*ans)


if __name__ == '__main__':
    main(sys.argv[1:])
x = input()
if x == ABC:
    print('ARC')
else:
    print('ABC')

### FIXED CODE ###

x = input()
if x == 'ABC':
    print('ARC')
else:
    print('ABC')
n,x=map(int,input().split())
*l, =  map(int, input().split())

point = 0
count = 0
while point <= x:
    point = point + l[count]
    count += 1

print(count)

### FIXED CODE ###

n,x=map(int,input().split())
*l, =  map(int, input().split())

d = [0]
count = 0
for i in range(n):
    d.append(d[i]+l[i])
for i in range(n+1):
    if d[i] <= x:
        count += 1
        
print(count)
S = input()

num = len(S)

bra = ""
ket = ""
if (num % 2 == 0):
    bra = S[0:int(num/2)]
    ket = S[num:int(num/2) - 1:-1]
else:
    bra = S[0:int(num/2)]
    ket = S[num:int(num/2) - 2:-1]

count = 0
for i in range(int(num/2)):
    if (bra[i] != ket[i]):
        count += 1

print(count)

### FIXED CODE ###

S = input()

num = len(S)

bra = ""
ket = ""
if (num == 1):
    print(0)
elif (num < 4):
    if (S[0] != S[int(num / 2) + (num % 2)]):
        print(1)
    else:
        print(0)
else:
    if (num % 2 == 0):
        bra = S[0:int(num/2)]
        ket = S[num:int(num/2) - 1:-1]
    else:
        bra = S[0:int(num/2)]
        ket = S[num:int(num/2) - 2:-1]

    count = 0
    for i in range(int(num/2)):
        if (bra[i] != ket[i]):
            count += 1

    print(count)
def main():
    H, W = map(int, input())
    h, w = map(int, input())

    print(H*W - h*w)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    H, W = map(int, input().split())
    h, w = map(int, input().split())

    print(H*W - (h*W + (H-h)*w))


if __name__ == "__main__":
    main()
s = str(input())
n = len(s)
a = []
for i in range(n):
    if s[i] != 'B':
        a.append(s[i])
    else:
        if len(s) != 0:
            a.pop(-1)
t =''
m = len(a)
for j in range(m):
    t += a[j]
print(t)

### FIXED CODE ###

s = str(input())
n = len(s)
a = []
for i in range(n):
    if s[i] != 'B':
        a.append(s[i])
    else:
        if len(a) != 0:
            a.pop(-1)
t =''
m = len(a)
for j in range(m):
    t += a[j]
print(t)
n, k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0

for l in range(k + 1):
	for r in range(k - l + 1):
		hand = []
		#handに左からl個
		hand = v[: l]
        #右からr個の要素を追加
		hand.extend(v[n - r:])
        #現時点でのhandの和をhand_sum
		hand_sum = sum(hand)  
		hand.sort()
        #hand_sum中の負の要素を詰めていく
		for i in range(min(k-l-r,l + r)):
			if hand[i] < 0:
			  hand_sum -= hand[i]
		ans = max(ans, hand_sum)

print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0

for l in range(k + 1):
	for r in range(k - l + 1):
		hand = []
		if l + r > n:
			break
        #handに左からl個
		hand = v[: l]
        #右からr個の要素を追加
		hand.extend(v[n - r:])
        #現時点でのhandの和をhand_sum
		hand_sum = sum(hand)  
		hand.sort()
        #hand_sum中の負の要素を詰めていく
		for i in range(min(k - l - r, l + r)):
			if hand[i] < 0:
			  hand_sum -= hand[i]
		ans = max(ans, hand_sum)

print(ans)
import sys
def input(): return sys.stdin.readline().strip()
from functools import lru_cache
mod = 998244353

def main():
    N, S = map(int, input().split())
    A = list(map(int, input().split()))

    @lru_cache(maxsize=None)
    def g(n, S):
        if S == 0: return pow(2, n + 1, mod) - 1
        if n == 0 and S == A[0]: return 1
        if n == 0: return 0
        val = (g(n - 1, S) * 2 + g(n - 1, S - A[n])) % mod
        if A[n] == S: val += 1
        #print("g({},{})={}".format(n, S, val))
        return val % mod
    
    print(g(N - 1, S))

    

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
from functools import lru_cache
sys.setrecursionlimit(10**9)
mod = 998244353

def main():
    N, S = map(int, input().split())
    A = list(map(int, input().split()))

    """
    再帰の計算式自体は合っていた！
    メモ化再帰とdpで計算量は変わらないはずだが、取りあえずdpで書き直してみる。
    """

    dp = [[0] * (S + 1) for _ in range(N)] # dp[n][s] = (N=n, S=sに対する問題の解)
    dp[0][0] = 1
    for n in range(1, N): dp[n][0] = (dp[n - 1][0] * 2 + 1) % mod
    for s in range(1, S + 1): dp[0][s] = 1 if s == A[0] else 0
    for n in range(1, N):
        for s in range(1, S + 1):
            dp[n][s] = (dp[n - 1][s] * 2 + dp[n - 1][s - A[n]]) if s >= A[n] else dp[n - 1][s] * 2
            if A[n] == s: dp[n][s] += 1
            dp[n][s] %= mod
    print(dp[N - 1][S])

    

if __name__ == "__main__":
    main()
a = int(input())
b = a // 10
c = a % 10

if b == 9 or c == 9
 print("yes")
 else
  print("no")

### FIXED CODE ###

a = int(input())
b = a // 10
c = a % 10

if b == 9 or c == 9 :
	print("Yes")
else :
	print("No")
import sys
#入力
N, M = map(int, input().split())

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

lst.sort()

sa = []

for i in range(M-1):
    sa += [abs(lst[i] - lst[i+1])]

sa.sort(reverse = True)

ans = -(lst[0] - lst[M-1])
#print (ans)
if not sa ==[]:
    for j in range(N-1):
        ans -= sa[j]
print (ans)

### FIXED CODE ###

import sys
#入力
N, M = map(int, input().split())

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

lst.sort()
#print (lst)

sa = []

for i in range(M-1):
    sa += [abs(lst[i] - lst[i+1])]

sa.sort(reverse = True)
#print(sa)

ans = -(lst[0] - lst[M-1])
#print (ans)
if not sa ==[]:
    if N <= M:
        for j in range(N-1):
            ans -= sa[j]
    else:
        ans = 0
print (ans)
import sys
sys.setrecursionlimit(10**9)
n , k = [int(i) for i in input().strip().split()]
arr = [int(i) for i in input().strip().split()]
dp = [-1]*(10**5+3)
def cal(i):
    if i>=n-1:
        return 0
 
    elif dp[i]==-1:
        m=10**9
        for j in range(i+1,min(n,i+k+1)):
            m=min(m,cal(j)+abs(arr[j]-arr[i]))
        dp[i]=m
    return dp[i]

### FIXED CODE ###


from functools import lru_cache
import sys
sys.setrecursionlimit(10**9)
n = int(input())
arr = [int(i) for i in input().strip().split()]

@lru_cache(None)
def cal(i):
    if i>=n-1:
        return 0
    else:
        if i==n-2:
            return cal(i+1)+abs(arr[i]-arr[i+1])

        return min(cal(i+1)+abs(arr[i]-arr[i+1]),cal(i+2)+abs(arr[i]-arr[i+2]))

print(cal(0))
from fractions import gcd

K = int(input())

ans = 0

for a in range(1,K+1) :
    for b in range(1,K+1) :
        for c in range(1,K+1) :
           X = fractions.gcd(a, b)
           Y = fractions.gcd(X, c)
           ans += Y

print(ans)

### FIXED CODE ###

from math import gcd

K = int(input())

ans = 0

for a in range(1,K+1) :
    for b in range(1,K+1) :
        X = gcd(a, b)
        for c in range(1,K+1) :
           Y = gcd(X, c)
           ans += Y

print(ans)
n=int(input())-1
a=list(map(int,input().split()))
r=[]
for i in range(n):
  	r.append(0)
    r[a[i]-1]+=1
for i in range (n):
    print (r[i])
print (0)

### FIXED CODE ###

n=int(input())-1
a=list(map(int,input().split()))
r=[]
for i in range(n):
    r.append(0)
    r[a[i]-1]+=1
for i in range (n):
    print (r[i])
print (0)
# -*- coding: utf-8 -*-
import numpy as np

def mk_prime_list(num):
    num_list = np.array(range(2, num + 1))
    prime_list = np.array([])

    i = num_list[0]
    while i <= np.sqrt(num):
        prime_list = np.append(prime_list, i)
        num_list = num_list[~(num_list % i == 0)]
        i = num_list[0]

    return prime_list


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

if a > b:
    max_num = np.sqrt(a)
else:
    max_num = np.sqrt(b)

num_list = np.array(range(2, max_num + 1))
#prime_list = np.array([])

ans = 1
i = num_list[0]
while i <= max_num:
    if a % i == 0 and b % i == 0:
        ans += 1
    num_list = num_list[~(num_list % i == 0)]
    i = num_list[0]

#prime_list = mk_prime_list(max_num)
#print(prime_list)

#ans = 1

#for i in prime_list:
#    if a % i == 0 and b % i == 0:
#        ans += 1

print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np

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

soin_a = np.array([], dtype='int')
for i in range(2, int(np.sqrt(a)) + 1):
    if a % i == 0:
        soin_a = np.append(soin_a, i)
        while a % i == 0:
            a //= i
if a != 1:
    soin_a = np.append(soin_a, a)

soin_b = np.array([], dtype='int')
for i in range(2, int(np.sqrt(b)) + 1):
    if b % i == 0:
        soin_b = np.append(soin_b, i)
        while b % i == 0:
            b //= i
if b != 1:
    soin_b = np.append(soin_b, b)

ans = 1
for j in soin_a:
    if soin_b[soin_b == j].size != 0:
        ans += 1

print(ans)
W, H, x, y = list(map(int,input().split()))

y_min = min(W*y, W*(H-y))
x_min = min(H*x, H*(W-x))

if y_min == x_min:
    ans = 1
else:
    ans = 0
print(f'{max(x_min, y_min):.08f}', ans)

### FIXED CODE ###

w, h, x, y = list(map(int,input().split()))
area = (w * h) / 2
if x == (w / 2) and y == (h / 2):
    print(area, 1)
else:
    print(area, 0)
import math

R = input()

try:
    R = int(R)
except:
    pass

if R =< 100 and R >= 1:
    print(R*2*pi)

### FIXED CODE ###

import math

R = input()

print(2 * float(R) * math.pi)
n=int(input())
s=input()

d={}
t={}
for i in range(ord(a),ord(z)+1):
  d[chr(i)]=0
  t[chr(i)]=0
  
for i in s:
  d[i]+=1
for i in range(n-1):
  s=input()
  for j in s: t[j]+=1
  for j in t: d[i]=min(d[i],t[i])
  for j in s: t[i]=0
ans=[]
for i in d:
  for j in range(d[i]):
    ans.append(i)
ans.sort()
x="".join(ans)
print(x)


### FIXED CODE ###

n=int(input())
s=input()

d={}
t={}
for i in range(ord("a"),ord("z")+1):
  d[chr(i)]=0
  t[chr(i)]=0
  
for i in s:
  d[i]+=1
for i in range(n-1):
  s=input()
  for j in s: t[j]+=1
  for j in t: d[j]=min(d[j],t[j])
  for j in s: t[j]=0
ans=[]
for i in d:
  for j in range(d[i]):
    ans.append(i)
ans.sort()
x="".join(ans)
print(x)
a = int(input())
b = input()
count =int(a/2)
bf = b[:count]
bb = b[count:]
if a %2==0 && bf == bb:
    print('yes')
else:
    print('no')

### FIXED CODE ###

a = int(input())
b = a**2
print(b)
N,K = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)

P = []
M = []
Ans = []
p = 0
m = 0

for i in range(N):
    if 0 <= A[i]:
        P.append(A[i])
    else:
        M.append(A[i])

M.sort()

if K % 2 == 1 and len(P) != 0:
    Ans.append(P[p])
    p += 1
elif K % 2 == 1 and len(P) == 0:
    M.sort(reverse=True)

while len(Ans) < K:

    #Mのストックがもうない時
    if m >= len(M):
        Ans.append(P[p])
        if len(Ans) == K:
            break
        Ans.append(P[p + 1])
        p += 2
    elif p >= len(P):
        Ans.append(M[m])
        if len(Ans) == K:
            break
        Ans.append(M[m + 1])
        m += 2
    else:
        if P[p]*P[p+1] < M[m]*M[m+1]:
            Ans.append(M[m])
            Ans.append(M[m+1])
            m += 2
        else:
            Ans.append(P[p])
            Ans.append(P[p + 1])
            p += 2

answer = 1
for i in range(K):
    answer = (answer * Ans[i]) % 1000000007

print(answer)


### FIXED CODE ###

import sys

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

A.sort(reverse=True)

P = []
M = []
Ans = []
p = 0
m = 0

for i in range(N):
    if 0 <= A[i]:
        P.append(A[i])
    else:
        M.append(A[i])

M.sort()

if K % 2 == 1 and len(P) != 0:
    Ans.append(P[p])
    p += 1
elif K % 2 == 1 and len(P) == 0:
    M.sort(reverse=True)
elif len(M) == 0:
    answer = 1
    for i in range(K):
        answer = (answer * P[i]) % 1000000007

    print(answer)
    sys.exit()

while len(Ans) < K:

    #Mのストックがもうない時
    if m+1 >= len(M) and p < len(P):
        Ans.append(P[p])
        if len(Ans) == K:
            break
        if p + 1 < len(P):
            Ans.append(P[p + 1])
            p += 2
        else:
            p += 1
        
    elif p+1 >= len(P) and m < len(M):
        Ans.append(M[m])
        if len(Ans) == K:
            break
        Ans.append(M[m + 1])
        m += 2
    elif m >= len(M) and p < len(P):
        Ans.append(P[p])
        p += 1
    elif p >= len(P) and m < len(M):
        Ans.append(M[m])
        m += 1
    else:
        if P[p]*P[p+1] < M[m]*M[m+1]:
            Ans.append(M[m])
            Ans.append(M[m+1])
            m += 2
        else:
            Ans.append(P[p])
            Ans.append(P[p + 1])
            p += 2

answer = 1
for i in range(K):
    answer = (answer * Ans[i]) % 1000000007

print(answer)
import heapq
n, m = map( int, input().split() )
adj_list = [ [] for i in range( n+1 ) ]
for _ in range( m ):
    a, b, c = map( int, input().split() )
    adj_list[ a ].append( ( b, c ) )
    adj_list[ b ].append( ( a, c ) )

# dijkstra
def dijkstra( start ):
    prev_node = [ -1 ] * ( n + 1 )
    INF = 10 ** 10
    VISITED = 1
    NOT_VISITED = 0
    cost = [ INF ] * ( n + 1 )
    cost[ start ] = 0
    visit = [ NOT_VISITED ] * ( n + 1 )
    queue = [ ( cost[ start ], start ) ]
    while len( queue ) > 0:
        c, v = heapq.heappop( queue )
        visit[ v ] = VISITED
        for u, cost_vu in adj_list[v]:
            if visit[ u ] == VISITED:
                continue
            if cost[u] > cost[v] + cost_vu:
                cost[u] = cost[v] + cost_vu
                heapq.heappush( queue, ( cost[u], u ) )
                prev_node[ u ] = v
    return prev_node

used_edge = [ [ False ] * ( m+1 ) for i in range( m+1 ) ]

used_count = 0
for s in range( 1, n+1 ):
    prev_node = dijkstra( s )
    for i in range( 1, n+1 ):
        j = prev_node[ i ]
        if j == -1:
            continue
        if used_edge[ i ][ j ] == False:
            used_count += 1
            used_edge[ i ][ j ] = True
            used_edge[ j ][ i ] = True

print( m - used_count )

### FIXED CODE ###

import heapq
n, m = map( int, input().split() )
adj_list = [ [] for i in range( n+1 ) ]
for _ in range( m ):
    a, b, c = map( int, input().split() )
    adj_list[ a ].append( ( b, c ) )
    adj_list[ b ].append( ( a, c ) )

# dijkstra
def dijkstra( start ):
    prev_node = [ -1 ] * ( n + 1 )
    INF = 10 ** 10
    VISITED = 1
    NOT_VISITED = 0
    cost = [ INF ] * ( n + 1 )
    cost[ start ] = 0
    visit = [ NOT_VISITED ] * ( n + 1 )
    queue = [ ( cost[ start ], start ) ]
    while len( queue ) > 0:
        c, v = heapq.heappop( queue )
        visit[ v ] = VISITED
        for u, cost_vu in adj_list[v]:
            if visit[ u ] == VISITED:
                continue
            if cost[u] > cost[v] + cost_vu:
                cost[u] = cost[v] + cost_vu
                heapq.heappush( queue, ( cost[u], u ) )
                prev_node[ u ] = v
    return prev_node

used_edge = [ [ False ] * ( n+1 ) for i in range( n+1 ) ]

used_count = 0
for s in range( 1, n+1 ):
    prev_node = dijkstra( s )
    for i in range( 1, n+1 ):
        j = prev_node[ i ]
        if j == -1:
            continue
        if used_edge[ i ][ j ] == False:
            used_count += 1
            used_edge[ i ][ j ] = True
            used_edge[ j ][ i ] = True

print( m - used_count )
import sys, os 
sys.setrecursionlimit(10**8)
#resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1))
from numba import jit

read = lambda : sys.stdin.readline().rstrip('\n')
tint = lambda x: [int(x) for x in x.split()]
inf = float('inf')

@jit
def main():
    n, k = tint(read())
    stones = tint(read())
    dp = [inf]*n
    dp[0] = 0
    for i in range(n):
        for t in range(1, k+1):
            if i+t < n:
                dp[i+t] = min(dp[i+t], dp[i]+abs(stones[i]-stones[i+t]))
    print(dp[-1])

if __name__ == '__main__':    
    main()


### FIXED CODE ###

def main():
    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))
    INF = 10 ** 9
    dp = [INF] * n
    dp[0] = 0
    for i in range(n):
        for j in range(1, k + 1):
            i_j = i + j
            if i_j < n:
                x = dp[i] + abs(h[i] - h[i_j])
                if dp[i_j] > x:
                    dp[i_j] = x
    print(dp[-1])


if __name__ == "__main__":
    main()
import sys
a,b,c=map(int, input().split())

if 1 <= a < 100:
    if a < 10:
        print(a)
    else:
        print(9)
elif 100 <= a < 10000:
    if a < 1000:
        print(a - 90)
    else:
        print(900 + 9)
elif 10000 <= a < 100000:
    print(a - 9999)

### FIXED CODE ###

N=int(input())
ans=0
for i in range(1,N+1):
  dig = len(str(i))
  if dig%2 != 0:
    ans +=1
   
print(ans)
s=input()
ans=[]
for c in s:
    if c=="0" or c=="1":
        ans.append(c)
    else:
        ans.pop(-1)
print("".join(ans))

### FIXED CODE ###

s=""
for c in input():
    s=s[:-1] if c=="B" else s+c
print(s)
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    print(x)
    exit()

cnt = [0] *101
ans1 = 0
ans2 = 0

for _p in p:
    cnt[_p] += 1

for i in range(x, 1000):
    if cnt[i] == 0:
        ans1 = i
        break

for i in range(x-1, -1000, -1):
    if cnt[i] == 0:
        ans2 = i
        break

if abs(ans1 - x) < abs(ans2 - x):
    print(ans1)
elif abs(ans1 - x) >= abs(ans2 - x):
    print(ans2)

### FIXED CODE ###

x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    print(x)
    exit()

cnt = [0] *10001
ans1 = 0
ans2 = 0

for _p in p:
    cnt[_p] += 1

for i in range(x, 1000):
    if not i in p:
        ans1 = i
        break

for i in range(x-1, -1000, -1):
    if not i in p:
        ans2 = i
        break

if abs(ans1 - x) < abs(ans2 - x):
    print(ans1)
elif abs(ans1 - x) >= abs(ans2 - x):
    print(ans2)
N,M,s=map(int,input().split())
S=sum(s)
m=sorted(s)[-M]
if m<S/(4*M):
    print('No')
else:
    print('Yes')


### FIXED CODE ###

x,y = map(int,input().split())
A=list(map(int,input().split()))
T=sum(A)
a=0
for i in range(x):
  if A[i]>=T/(4*y):
    a+=1
if a>=y:
    print('Yes')
else:
    print('No')
import math
import numpy as np

s = int(input())

all_list = []

for _ in range(2):
    all_list.append(list(map(float, input().split())))

p1 = sum([math.fabs(x - y) for x, y in zip(all_list[0], all_list[1])])
p2 = math.sqrt(sum([(math.fabs(x - y))**2 for x, y in zip(all_list[0], all_list[1])]))
p3 = np.cbrt(sum([(math.fabs(x - y))**3 for x, y in zip(all_list[0], all_list[1])]))
pi = max([math.fabs(x - y) for x, y in zip(all_list[0], all_list[1])])

print("{:.6f}".format(p1))
print("{:.6f}".format(p2))
print("{:.6f}".format(p3))
print("{:.6f}".format(pi))



### FIXED CODE ###

n = int(input())
x, y = [list(map(int, input().split())) for _ in range(2)]
print(sum([abs(x[i] - y[i]) for i in range(n)]))
print(pow(sum([(x[i] - y[i]) ** 2 for i in range(n)]), 1/2))
print(pow(sum([abs(x[i] - y[i]) ** 3 for i in range(n)]), 1/3))
print(max([abs(x[i] - y[i]) for i in range(n)]))
n, m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
from collections import deque
import bisect
d = deque(A)
index = bisect.bisect_left(d, 2)
for _ in range(m):
    max_ = d.pop()
    tmp = max_ // 2
    index = bisect.bisect_left(d, tmp)
    d.insert(index, tmp)
print(sum(d))

### FIXED CODE ###

n, m = map(int,input().split())
A = list(map(int,input().split()))
A = [x * -1 for x in A]
A.sort()
import heapq
import bisect
heapq.heapify(A)
for _ in range(m):
    min_ = heapq.heappop(A)
    tmp = min_ * -1 // 2 * -1
    index = bisect.bisect_left(A, tmp)
    heapq.heappush(A,tmp)
print(sum(A) * -1)
from collections import Counter
H, W, M = map(int, input().split())
h = [0] * M
w = [0] * M
bom = [[0] * (H+1) for _ in range(W+1)]
for i in range(M):
    h[i], w[i] = map(int, input().split())
    bom[h[i]][w[i]] = 1
hl = Counter(h)
hl = list(reversed(sorted(hl.items(), key=lambda x: x[1])))
wl = Counter(w)
wl = list(reversed(sorted(wl.items(), key=lambda x: x[1])))
ans = 0
#print(hl)
#print(wl)
max_hl = hl[0][1]
max_wl = wl[0][1]
ans = max_hl + max_wl
end_flag = 0
max_flag = 1
for i in range(len(hl)):
    for j in range(len(wl)):
        if hl[i][1] < max_hl:
            end_flag = 1
            break
        if wl[j][1] < max_wl:
            break
        if bom[hl[i][0]][wl[j][0]] == 1:
            continue
        else:
            end_flag = 1
            max_flag = 0
            break
    else:
        continue
    if end_flag == 1:
        break
print(ans - max_flag)


### FIXED CODE ###

from collections import Counter
H, W, M = map(int, input().split())
h = [0] * M
w = [0] * M
h_w = {}
for i in range(M):
    h[i], w[i] = map(int, input().split())
    h_w[(h[i], w[i])] = 1
hl = Counter(h)
hl = list(reversed(sorted(hl.items(), key=lambda x:x[1])))
wl = Counter(w)
wl = list(reversed(sorted(wl.items(), key=lambda x:x[1])))
ans = 0
#print(hl)
#print(wl)
max_hl = hl[0][1]
max_wl = wl[0][1]
ans = max_hl + max_wl
end_flag = 0
max_flag = 1
for i in range(len(hl)):
    for j in range(len(wl)):
        if hl[i][1] < max_hl:
            end_flag = 1
            break
        if wl[j][1] < max_wl:
            break
        if (hl[i][0], wl[j][0]) in h_w.keys():
            continue
        else:
            end_flag = 1
            max_flag = 0
            break
    else:
        continue
    if end_flag == 1:
        break
print(ans - max_flag)
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

d,n = map(int,input().split())
a = 100**d
c = []
for i in range(n+1):
    if i%100 == 0:
        continue
    c.append(a*i)
print(c[n-1])

### FIXED CODE ###

import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

d,n = map(int,input().split())
if n != 100:
    print(n*100**d)
else:
    print(101*100**d)
round = 3.1415
 
r = input()
print(r*2*round)

### FIXED CODE ###

round = 6.28318530717958623200

 
r = int(input())
print(r*round)
from collections import deque as dq
s = input()
nq = int(input())

s = dq(s)

jun = True
for i in range(nq):
  query = input().split()
  if query[0] == '1':
    jun = not jun
    continue
  if jun:
    if query[1] == '1':
      s.appendleft(query[2])
    else:
      s.qppend(query[2])
  else:
    if query[1] == '1':
      s.append(query[2])
    else:
      s.appendleft(query[2])
if jun:
  print(''.join(s))
else:
  print(''.join(s[::-1]))
    

### FIXED CODE ###

from collections import deque as dq
s = input()
nq = int(input())

s = dq(s)

jun = True
for i in range(nq):
  query = input().split()
  if query[0] == '1':
    jun = not jun
    continue
  if jun:
    if query[1] == '1':
      s.appendleft(query[2])
    else:
      s.append(query[2])
  else:
    if query[1] == '1':
      s.append(query[2])
    else:
      s.appendleft(query[2])
if jun:
  print(''.join(s))
else:
  print(''.join(list(s)[::-1]))