Harryxun/stf_run huggingface dataset:
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
while M>0:
    d = max(A[0]//A[1], 1)
    A[0] = A[0]//2**d
    M -= d
    A = sorted(A, reverse=True)
    # print(A, M)

print(sum(A))

### FIXED CODE ###

import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [-a for a in A]
A = sorted(A)
heapq.heapify(A)
for _ in range(M):
    ma = heapq.heappop(A)
    ma = -((-ma)//2)
    heapq.heappush(A, ma)
    # print(A, ma)
print(-sum(A))
A = input()

S = 0
for i in range(0,10):
  S += A[i]
  
if A % S == 0:
  print("Yes")
else:
  print("No")  


### FIXED CODE ###

A = input()

S = 0
for i in A:
  S = S + int(i)
  
if (int(A) % S) == 0:
  print("Yes")
else:
  print("No")
def solve(string):
    s, k = string.split()
    g = []
    for i in range(len(s)):
        for j in range(i + 1, len(s) + 1):
            g.append(s[i:j])
    g = sorted(set(g))
    return g[int(k)-1]


if __name__ == '__main__':
    print(solve(input()))


### FIXED CODE ###

from collections import Counter


def solve(string):
    s, k = string.split()
    """
    g = []
    for i in range(len(s)):
        for j in range(i + 1, len(s) + 1):
            g.append(s[i:j])
    g = sorted(set(g))
    return g[int(k)-1]
    """
    k = int(k)
    count = Counter(s)
    chars = sorted(set(s))
    for t in range(min(3, len(chars))):
        tmp = []
        i = s.index(chars[t])
        tmp.append(s[i:i + 5])
        if count[chars[t]] > 1:
            for _ in range(count[chars[t]] - 1):
                i = s.index(chars[t], i + 1)
                tmp.append(s[i:i + 5])
        g = []
        for p in tmp:
            for j in range(1, len(p) + 1):
                g.append(p[:j])
        g = sorted(set(g))
        if len(g) < k:
            k -= len(g)
            continue
        return g[k - 1]


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))
import sys

mod = 10**9 + 7

N, K = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().strip().split()))

# 0も入れておく
pos_list = []
neg_list = []
for a_i in A:
    if a_i >= 0:
        pos_list.append(a_i)
    else:
        neg_list.append(a_i)

# 降順
pos_list.sort(reverse = True)
neg_list.sort()


lp = len(pos_list)
ln = len(neg_list)

    
if min(2 * (ln // 2), 2 * (K // 2)) + lp >= K:
    pos_twins = [pos_list[2 * i] * pos_list[2 * i + 1] for i in range(lp // 2)] + [0]
    neg_twins = [neg_list[2 * i] * neg_list[2 * i + 1] for i in range(ln // 2)] + [0]
    pos_twins.sort()
    neg_twins.sort()
 
    ans = 1
    pos_select = 0
    for i in range(K // 2):
        if pos_twins[-1] <= neg_twins[-1]:
            ans *= neg_twins[-1]
            ans %= mod
            neg_twins.pop()
        else:
            ans *= pos_twins[-1]
            ans %= mod
            pos_twins.pop()
            pos_select += 1
 
    if K % 2 == 1:
        if K == 1:
            ans = pos_list[2 * pos_select]
        else:
            ans *= pos_list[2 * pos_select]
    print(ans % mod)    
# マイナスになるため、最小化する
else:
    ans = 1
    neg_list.sort(reverse=True)
    for i in range(K):
        ans *= neg_list[i]
        ans %= mod
    print(ans)

### FIXED CODE ###

import sys

mod = 10**9 + 7

N, K = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().strip().split()))

# 0も入れておく
pos_list = []
neg_list = []
zero_count = 0
for a_i in A:
    if a_i > 0:
        pos_list.append(a_i)
    elif a_i == 0:
        zero_count += 1
    else:
        neg_list.append(a_i)

lp = len(pos_list)
ln = len(neg_list)

if min(2 * (ln // 2), 2 * (K // 2)) + lp >= K:
    # 降順
    pos_list.sort(reverse = True)
    neg_list.sort()

    pos_twins = [pos_list[2 * i] * pos_list[2 * i + 1] for i in range(lp // 2)] + [0]
    neg_twins = [neg_list[2 * i] * neg_list[2 * i + 1] for i in range(ln // 2)] + [0]
    pos_twins.sort()
    neg_twins.sort()
 
    ans = 1
    pos_select = 0
    for i in range(K // 2):
        if pos_twins[-1] <= neg_twins[-1]:
            ans *= neg_twins[-1]
            ans %= mod
            neg_twins.pop()
        else:
            ans *= pos_twins[-1]
            ans %= mod
            pos_twins.pop()
            pos_select += 1
 
    if K % 2 == 1:
        if K == 1:
            ans = pos_list[2 * pos_select]
        else:
            ans *= pos_list[2 * pos_select]
    print(ans % mod)    
elif zero_count > 0:
	print(0)
# マイナスになるため、最小化する
else:
    ans = 1
    abs_list = sorted([abs(a) for a in A])
    for a in abs_list[:K]:
        ans *= a
        ans %= mod
    print((-1) * ans % mod)
N, X = map(int, input().split())
L = list(map(int, input().split()))
S = [0]
c = 0

i = 0
while i <= N-1:
  S.append(S[i]+L[i])
  i += 1
  
i = 0
while S[i] <= X:
  if S[i]<= X:
    c += 1
    i += 1

    
print(c)

### FIXED CODE ###

N, X = map(int, input().split())
L = list(map(int, input().split()))
S = [0]
c = 0

i = 0
while i <= N-1:
  S.append(S[i]+L[i])
  i += 1
  
j = 0
while j <= N:
  if S[j]<= X:
    c += 1
    j += 1
  
  else:
    j += 1

    
print(c)
s = input()
if s = 'SUN':
	print('7')
elif s = 'MON':
	print('6')
elif s = 'TUE':
	print('5')
elif s = 'WED':
	print('4')
elif s = 'TUE':
	print('3')
elif s = 'FRI':
	print('2')
elif s = 'SAT':
	print('1')


### FIXED CODE ###

s = input()
if s == 'SUN':
	print('7')
elif s == 'MON':
	print('6')
elif s == 'TUE':
	print('5')
elif s == 'WED':
	print('4')
elif s == 'THU':
	print('3')
elif s == 'FRI':
	print('2')
elif s == 'SAT':
	print('1')
H, W = map(int, input().split(" "))

# result = True
masu = [['.' for i in range(H+2)] for j in range(W+2)]
for h in range(H):
    s = "."+input()+"."
    masu[h+1] = s

# print(masu)

for h in range(1,H+1):
    for w in range(1,W+1):
        if masu[h][w] == "#":
            if "#" == masu[h+1][w] or "#" == masu[h][w+1] or "#" == masu[h-1][w] or "#" == masu[h][w-1]:
                pass
            else:
                # result = False
                print("No")
                exit()

print("Yes")



### FIXED CODE ###


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

# result = True
masu = [['.' for i in range(W+2)] for j in range(H+2)]
for h in range(H):
    s = "."+input()+"."
    masu[h+1] = s

# print(masu)

for h in range(1,H+1):
    for w in range(1,W+1):
        if masu[h][w] == "#":
            if "#" == masu[h+1][w] or "#" == masu[h][w+1] or "#" == masu[h-1][w] or "#" == masu[h][w-1]:
                pass
            else:
                # result = False
                print("No")
                exit()

print("Yes")
from numba import njit
@njit()
def check(s, a, next):
    if a==next:
        return False
    x = 1
    while a>=x*x:
        if a%x==0:
            if x in s:
                return False
            if a//x in s:
                return False
        x += 1
    return True

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

s = set()
res = 0
for i in range(n):
    a = al[i]
    next = -1
    if i<n-1:
        next = al[i+1]
    if check(s,a,next):
        res += 1
    s.add(a)
print(res)



### FIXED CODE ###

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

cnt = [0]*(10**6+10)
for a in al:
    if cnt[a]>1:
        continue
    for i in range(0,10**6+10,a):
        cnt[i] += 1

res = 0
for a in al:
    if cnt[a]==1:
        res += 1
print(res)
print(input().count(1))

### FIXED CODE ###

print(input().count('1'))
import bisect
A, B, Q = map(int, input().split())
ss = [int(input()) for i in range(A)]
ts = [int(input()) for i in range(B)]
xs = [int(input()) for i in range(Q)]
INF = 10**11
 
-INF, INF = -1, 10**10 + 1
ss = [-INF] + ss + [INF]
ts = [-INF] + ts + [INF]
 
# s_e is index the nearest s on the east side of x
for x in xs:
  s_e_ix = bisect.bisect_left(ss, x)
  s_e = ss[s_e_ix]
  s_w = ss[s_e_ix - 1]
  t_e_ix = bisect.bisect_left(ts, x)
  t_e = ts[t_e_ix]
  t_w_ix = ts[t_e_ix - 1]
  
  d = INF
  for s in [s_w, s_e]:
    for t in [t_w, t_e]:
      d0 = abs(s-x) + abs(t-s)
      d1 = abs(t-x) + abs(s-t)
      d = min(d0, d1, d)
  print(d)

### FIXED CODE ###

import bisect
A, B, Q = map(int, input().split())
ss = [int(input()) for i in range(A)]
ts = [int(input()) for i in range(B)]
xs = [int(input()) for i in range(Q)]
INF = 10**11

ss = [-INF] + ss + [INF]
ts = [-INF] + ts + [INF]
 
# s_e is index the nearest s on the east side of x
for x in xs:
  s_e_ix = bisect.bisect_left(ss, x)
  s_e = ss[s_e_ix]
  s_w = ss[s_e_ix - 1]
  
  t_e_ix = bisect.bisect_left(ts, x)
  t_e = ts[t_e_ix]
  t_w = ts[t_e_ix - 1]
  
  d = INF
  for s in [s_w, s_e]:
    for t in [t_w, t_e]:
      d0 = abs(s-x) + abs(t-s)
      d1 = abs(t-x) + abs(s-t)
      d = min(d0, d1, d)
  print(d)
import sys
from itertools import permutations

a = [int(i) for i in sys.stdin]

b = [(list(map(int, str(k)))[-1], i) for i, k in enumerate(a)]

indexes = [i for i, (x, y)in enumerate(b) if x == 0]
d = 0
for i in sorted(indexes)[::-1]:
  d += a[i]
  b.pop(i)
b.sort()
c = b[::-1]

for i, k in c[:-1]:
  if i >= 5:
    d += round(a[k], -1)
  else:
    d += (round(a[k], -1) + 10)
d += a[c[-1][1]]
print(d)

### FIXED CODE ###

import sys
from itertools import permutations

a = [int(i) for i in sys.stdin]

b = [(list(map(int, str(k)))[-1], i) for i, k in enumerate(a)]

indexes = [i for i, (x, y)in enumerate(b) if x == 0]
d = 0
for i in sorted(indexes)[::-1]:
  d += a[i]
  b.pop(i)
b.sort()
c = b[::-1]

for i, k in c[:-1]:
  if i > 5:
    d += round(a[k], -1)
  else:
    d += (round(a[k], -1) + 10)
if c != []:
  d += a[c[-1][1]]
print(d)
D, N = map(int, input().split())
if N < 100:
  print((100**D)*N)
else:
  print(((100**D)*101)

### FIXED CODE ###

D, N = map(int, input().split())
if N < 100:
  print((100**D)*N)
else:
  print((100**D)*101)
N,M,Q = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(Q)]
def dfs(s):
    if len(s) == N:
        return[s]
    result = []
    if s == '':
        num = 0
    else:
        num = int(s[-1])
    for i in range(num,M+1):
        result.extend(dfs(s+str(i)))
    return result
ans = 0
S = dfs('')
for s in S:
    C = [int(i)+1 for i in s]
    B = 0
    for a,b,c,d in A:
        if C[b-1] - C[a-1] == c:
            B += d
    ans = max(ans,B)
print(ans)

### FIXED CODE ###

N,M,Q = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(Q)]
def dfs(s):
    if len(s) == N:
        return[s]
    result = []
    if s == '':
        num = 0
    else:
        num = int(s[-1])
    for i in range(num,M):
        result.extend(dfs(s+str(i)))
    return result
ans = 0
S = dfs('')
for s in S:
    C = [int(i)+1 for i in s]
    B = 0
    for a,b,c,d in A:
        if C[b-1] - C[a-1] == c:
            B += d
    ans = max(ans,B)
print(ans)
N = int(input())
s = []
cnt = 0

for i in range(N):
    s.append(input())

for i in range(N):
    for j in range(i+1, N):
        for k in range(len(s[i])):
          	tmp = s[i]
            tmp = s[i].replace(s[j][k], "")
        if tmp == "":
            cnt += 1
        else:
            continue
            
print(cnt)



### FIXED CODE ###

N = int(input())
dic = {}
count = 0


for i in range(N):
    s = input()
    s_sorted = "".join(sorted(s))
    count += dic.get(s_sorted, 0)
    dic[s_sorted] = dic.get(s_sorted, 0) + 1

print(count)
N,K=(int(x) for x in input().split())
H=list(map(int, input().split()))

i=0

if K >= N:
    print('0')
else:
    A = sorted(H, reverse=True)
    for i in range(K):
        A.pop(i)
        i=i+1
    B=sum(A)
    print(B)

### FIXED CODE ###

N,K=(int(x) for x in input().split())
H=list(map(int, input().split()))
A = sorted(H)
i=0
a=N-K
if K >= N:
    print('0')

else:
    B=A[:a]
    C=sum(B)
    print(C)
import math

mod = 10 ** 9 + 7


def C(n, r):
    return int(math.factorial(n) / math.factorial(n - r) / math.factorial(r))


def F(s):
    if s < 3:
        return 0
    elif s < 6:
        return 1
    else:
        ans = 1
        for i in range(6, s+1, 3):
            ans += C(s-i+1, s-i)
        return ans


s = int(input())
print(F(s) % mod)

### FIXED CODE ###

S = int(input())
DP = [0] * (S + 1)
Mod = 10 ** 9 + 7

if S >= 3:
    DP[0] = 1
    DP[1] = 0
    DP[2] = 0
    for TS in range(3,S+1):
        DP[TS] = DP[TS-1] + DP[TS-3]
    print(DP[S] % Mod)
else:
    print(0)
n = int(input())
X = input()
pc = X.count('1')
nx = int(X, 2)

dp = [-1] * ((2*10**5)+1)
dp[0] = 0
dp[1] = 1
pcs = [-1] * ((2*10**5)+1)
pcs[0] = 0
for i in range(1, 18):
    pcs[2**i] = 1
    pcs[2**i-1] = i
def f(n):
    if dp[n] >= 0:
        return dp[n]
    if pcs[n] >= 0:
        pc = pcs[n]
    else:
        pc = bin(n).count('1')
        pcs[n] = pc
    nn = n%pc
    d = f(nn)+1
    dp[n] = d
    return d

tmp = pow(2, n)
for i in range(n-1, -1, -1):
    # ibit目を反転させる # つまり2**iを引く
    tmp //= 2
    if (nx>>i)&1:
        r = (nx-tmp)%(pc-1)
    else:
        r = (nx+tmp)%(pc+1)

    if r > 0:
        print(f(r) + 1)
    else:
        print(1)
    

### FIXED CODE ###

n = int(input())
X = input()
pc = X.count('1')
nx = int(X, 2)

def f(n):
    c = 0
    while n > 0:
        n %= bin(n).count('1')
        c += 1
    return c

nxp = nx%(pc+1)
nxm = nx%(pc-1) if pc > 1 else 0
for i in range(n-1, -1, -1):
    if (nx>>i)&1:
        # 2**iを引く
        if pc-1 == 0:
            print(0)
            continue
        p = pow(2, i, pc-1)
        r = (nxm-p)%(pc-1)
    else:
        # 2**iを足す
        r = (nxp+pow(2, i, pc+1))%(pc+1)

    print(f(r) + 1)
N, K = map(int, input().split())
list=[]
for _ in range(K):
    d = int(input())
    S = input().split()
    list.extend(S)
num = collections.Counter(list)
print(N-num)

    

### FIXED CODE ###

from collections import Counter
N, K = map(int, input().split())
list=[]
for _ in range(1,K+1):
    d = int(input())
    S = input().split()
    list.extend(S)
num = Counter(list)
print(N-len(num))
n,l=map(int,input().split())
s=[]
for i in range(n):
  tmp=input()
  s.append(tmp)

s.sort()
for i in range(l):
  print(s[i],end="")

### FIXED CODE ###

n,l=map(int,input().split())
s=[]
for i in range(n):
  s.append(input())
  
  
s.sort()
print("".join(s))
#print(*sorted(map(int, input().split())))

print(*.sorted(map(int, input().split())))


### FIXED CODE ###

#print(*sorted(map(int, input().split())))

print(*sorted(map(int, input().split())))
from collections import deque
s = deque([i for i in input()])
s_origin = s.copy()
t = deque([i for i in input()])
s.rotate(1)
while s!=s_origin:
    if s == t or s_origin == t:
        print("Yes")
        break
    s.rotate(1)
else:
    print("No")

### FIXED CODE ###

from collections import deque
sin = [i for i in input()]
tin = [i for i in input()]
s = deque(sin)
s_origin = deque(sin)
t = deque(tin)
s.rotate(1)
while s!=s_origin:
    if s == t or s_origin == t:
        print("Yes")
        break
    s.rotate(1)
else:
    if s_origin == t:
        print("Yes")
    else:
        print("No")
a , b =map(int(),input().split())
A=str(a)
B=str(b)
for i in a:
    X+="A"
for j in b:
    Y+="B"

if a<b:
    print(X)
if a>b:
    print(Y)


### FIXED CODE ###

a , b =input().split()
print(a*int(b) if a<=b else b*int(a))
def ranking(x):
    if(x>=400):
        if(x<600):
            return 8
        elif(x<800):
            return 7
        elif (x < 1000):
            return 6
        elif (x < 1200):
            return 5
        elif (x < 1400):
            return 4
        elif (x < 1600):
            return 3
        elif (x < 1800):
            return 2
        elif (x < 2000):
            return 1
x=input()
print(ranking(x))

### FIXED CODE ###

def ranking(x):
    if(x>=400):
        if(x<600):
            return 8
        elif(x<800):
            return 7
        elif (x < 1000):
            return 6
        elif (x < 1200):
            return 5
        elif (x < 1400):
            return 4
        elif (x < 1600):
            return 3
        elif (x < 1800):
            return 2
        elif (x < 2000):
            return 1
x=int(input())
print(ranking(x))
n = int(input())
lst = [int(i) for i in input().split()]

flag = 0

if len(lst) == 1:
    flag = 1

for i in range(0,len(lst)-1):
    if lst[i]-1 == lst[i+1]:
        lst[i] = lst[i] - 1



if flag == 0:
    for i in range(0,len(lst)-1):
        if (lst[i] <= lst[i+1])&(flag==0):
            #print(str(lst[i])+'<='+str(lst[i+1]))
            flag = 0
        else:
            flag = 1



if flag == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a, b, c = map(int, input().split())
x = a - b
ans = c - x
if ans <= 0:
    print(0)
else:
    print(ans)
n,m = map(int,input().split())
a = list(range(m+2))
a[0] = -1
a[m+1] = n+1
ans = 1
if m == 0:
    x = a[m+1]-a[i]-1
    ans = ans * int(1/(5**0.5) * (((1+(5**0.5))/2)**x - ((1-(5**0.5))/2)**x)) %1000000007  
for i in range(m):
  a[i+1] = int(input())
for i in range(m+1):
  if a[i]+1 == a[i+1] and i != 0 and i != m:
    ans = 0
    break
  else:
    x = a[i+1]-a[i]-1
    ans = ans * int(1/(5**0.5) * (((1+(5**0.5))/2)**x - ((1-(5**0.5))/2)**x)) %1000000007

print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
b = [] 
for i in range(n+1):
  if i == 0 or i == 1:
    b.append(1)
  else:
    b.append(b[i-2]+b[i-1])

ans = 1
if m != 0:
  a = list(range(m))
  for i in range(m):
    a[i] = int(input())
    if i == 0:
      ans = ans*b[a[i]-1]%1000000007
    else:
      if a[i] == a[i-1]+1:
        ans = 0
      else:
        ans = ans*b[a[i]-a[i-1]-2]%1000000007
  ans = ans*b[n-a[m-1]-1]%1000000007
  print(ans)
else:
  print(b[n]%1000000007)
N=int(input())
A=list(map(int,input().split()))
B=[0]*N

for i in A:
    B[i-1]+=1

for i in B:
    print(i)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[0]*N

for i in A:
    B[i-1]+=1

for i in B:
    print(i)
# -*- coding: utf-8 -*-
h, w = map(int, input().split())
a = []
a = [[True] * (w + 2)]
for i in range(h + 2):
    a.append([True] + [x == '#' for x in input()] + [True])
a.append([True] * (w + 2))
q = []


for i in range(1, w + 1):
    for j in range(1, h + 1):
        if a[i][j]:
            q.append((i, j))

count = 0
while True:
    qq = []
    for i, j in q:
        if not a[i-1][j]:
            a[i-1][j] = True
            qq.append((i - 1, j))
        if not a[i+1][j]:
            a[i+1][j] = True
            qq.append((i + 1, j))
        if not a[i][j-1]:
            a[i][j-1] = True
            qq.append((i, j - 1))
        if not a[i][j+1]:
            a[i][j+1] = True
            qq.append((i, j + 1))
    q = qq
    if len(q) <= 0:
        break
    count += 1

print(count)


### FIXED CODE ###

# -*- coding: utf-8 -*-
h, w = map(int, input().split())
a = []
a = [[True] * (w + 2)]
for i in range(h):
    a.append([True] + [x == '#' for x in input()] + [True])
a.append([True] * (w + 2))
q = []

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if a[i][j]:
            q.append((i, j))

count = 0
while True:
    qq = []
    for i, j in q:
        if not a[i-1][j]:
            a[i-1][j] = True
            qq.append((i - 1, j))
        if not a[i+1][j]:
            a[i+1][j] = True
            qq.append((i + 1, j))
        if not a[i][j-1]:
            a[i][j-1] = True
            qq.append((i, j - 1))
        if not a[i][j+1]:
            a[i][j+1] = True
            qq.append((i, j + 1))
    q = qq
    if len(q) <= 0:
        break
    count += 1

print(count)
n = int(input())
a = list(map(int, input().split()))
b = []
'''
b = [str(a[0])]
if (n == 1):
    print(a[0])
    exit()

a = a[1:]

for i in a:
    b.append(str(i))
    b.reverse()
'''

loop = int(n / 2)
loop_rest = n - loop

for i in range(loop):
    tar_index = (n - 1) - 2 * i
    tar = a[tar_index]

    b.append(str(tar))


if (n % 2 == 0):
    tar_index = 0
else:
    tar_index = 1

for i in range(loop_rest):
    b.append(str(a[tar_index]))
    tar_index += 2

print(' '.join(b))


### FIXED CODE ###

n = int(input())
a = list(map(str, input().split()))
b = []
'''
b = [str(a[0])]
if (n == 1):
    print(a[0])
    exit()

a = a[1:]

for i in a:
    b.append(str(i))
    b.reverse()
'''
'''
loop = int(n / 2)
loop_rest = n - loop

for i in range(loop):
    tar_index = (n - 1) - 2 * i
    tar = a[tar_index]

    b.append(str(tar))


if (n % 2 == 0):
    tar_index = 0
else:
    tar_index = 1

for i in range(loop_rest):
    b.append(str(a[tar_index]))
    tar_index += 2
'''

# 一つおきでListを取る場合。
# a[0::2]
# 1つ目：起点。
# 2つ目：Step

# a[::-1]
# > -1step,つまりReverse

if n % 2 == 1:
    print(" ".join((a[0::2][::-1] + a[1::2])))
else:
    print(" ".join((a[1::2][::-1] + a[0::2])))
from collections import deque
import bisect

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

    plus = []; minus = []
    for a in A:
        if a > 0:
            plus.append(a)
        if a < 0:
            minus.append(a)
    
        
    plus.sort()
    minus.sort()
    plus = deque(plus)
    minus = deque(minus)
    anslist = []
    if len(plus) == 0:
        stmp = minus.popleft()
        ltmp = minus.pop()
        anslist.append((ltmp, stmp))
        plus.append(ltmp-stmp)
        N -= 1
    elif len(minus) == 0:
        stmp = plus.popleft()
        ltmp = plus.pop()
        anslist.append((stmp, ltmp))
        minus.append(stmp-ltmp)
        N -= 1
    else:
        pass

    for _ in range(N):
        if len(minus) > 1:
            ltmp = plus.pop()
            stmp = minus.pop()
            anslist.append((ltmp, stmp))
            plus.append(ltmp - stmp)
        elif len(plus) > 1:
            ltmp = plus.popleft()
            stmp = minus.popleft()
            anslist.append((stmp, ltmp))
            minus.append(stmp - ltmp)
        else:
            ltmp = plus.popleft()
            stmp = minus.popleft()
            anslist.append((ltmp, stmp))
            ans = ltmp - stmp
            break
    print(ans)
    for s in anslist:
        print(*s)

if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque
import bisect

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

    plus = []; minus = []
    for a in A:
        if a >= 0:
            plus.append(a)
        if a < 0:
            minus.append(a)
        
    plus.sort()
    minus.sort()
    plus = deque(plus)
    minus = deque(minus)

    if N == 2:
        if A[0] >= A[1]:
            ans = A[0] - A[1]
            print(ans)
            print(A[0], A[1])
        else:
            ans = A[1] - A[0]
            print(ans)
            print(A[1], A[0])
        return

    anslist = []
    if len(plus) == 0:
        stmp = minus.popleft()
        ltmp = minus.pop()
        anslist.append((ltmp, stmp))
        ans = ltmp - stmp
        plus.append(ans)
        N -= 1
    elif len(minus) == 0:
        stmp = plus.popleft()
        ltmp = plus.pop()
        anslist.append((stmp, ltmp))
        ans = stmp - ltmp
        minus.append(ans)
        N -= 1
    else:
        pass

    for _ in range(N):
        if len(minus) > 1:
            ltmp = plus.pop()
            stmp = minus.pop()
            anslist.append((ltmp, stmp))
            plus.append(ltmp - stmp)
        elif len(plus) > 1:
            ltmp = plus.popleft()
            stmp = minus.popleft()
            anslist.append((stmp, ltmp))
            minus.append(stmp - ltmp)
        else:
            ltmp = plus.popleft()
            stmp = minus.popleft()
            anslist.append((ltmp, stmp))
            ans = ltmp - stmp
            break
    print(ans)
    for s in anslist:
        print(*s)

if __name__ == "__main__":
    main()
a = input()
b = input()
print(a*b)

### FIXED CODE ###

a,b=map(int,input().split())
print(a*b,2*a+2*b)
import sys

#+++++


def main():
	s = input()
	a = ''.join(sorted(s)) == 'abc'
	if a:
		print('Yes')
	else:
		print('No')
	#print(' '.join([str(v) for v in l]))
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		#input = sys.stdin.readline
        pass
			
	ret = main()
	if ret is not None:
		print(ret)

### FIXED CODE ###

import sys

#+++++


def main():
	s = input()
	#a ='Yes' if ''.join(sorted(s)) == 'abc' else 'No'
	for c in 'abc':
		if c not in s:
			print('No')
			return 
	print('Yes')
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)