Problem:


Score: 200 points

Problem Statement

There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times:

Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n.

What is the largest possible sum of the integers written on the blackboard after K operations?

Constraints

A, B and C are integers between 1 and 50 (inclusive).

K is an integer between 1 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

A B C
K

Output

Print the largest possible sum of the integers written on the blackboard after K operations by E869220.

Sample Input 1

5 3 11
1

Sample Output 1

30

In this sample, 5, 3, 11 are initially written on the blackboard, and E869120 can perform the operation once.

There are three choices:  

Double 5: The integers written on the board after the operation are 10, 3, 11.

Double 3: The integers written on the board after the operation are 5, 6, 11.

Double 11: The integers written on the board after the operation are 5, 3, 22.

If he chooses 3., the sum of the integers written on the board afterwards is 5 + 3 + 22 = 30, which is the largest among 1. through 3.  

Sample Input 2

3 3 4
2

Sample Output 2

22

E869120 can perform the operation twice. The sum of the integers eventually written on the blackboard is maximized as follows:  

First, double 4. The integers written on the board are now 3, 3, 8.  

Next, double 8. The integers written on the board are now 3, 3, 16.  

Then, the sum of the integers eventually written on the blackboard is 3 + 3 + 16 = 22.



Sample input:
5 3 11
1


Sample output:
30

Submission status: Accepted

Solution code:
p=input
*x,=map(int, p().split())
print(sum(x)+max(x)*(2**int(input())-1))

Submission status: Accepted

Solution code:
x=list(map(int, input().split()))
print(sum(x)+max(x)*(2**int(input())-1))

Submission status: Accepted

Solution code:
ABC = list(map(int, input().split()))
ABC.sort()
K = int(input())
M = ABC[-1]
print(M*2**K+ABC[0]+ABC[1])

Submission status: Accepted

Solution code:
P  = list(map(int,input().split()))
P.sort()
p = max(P)
k = int(input())
p = p * 2 ** (k)
print(P[0] + P[1] + p)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    numbers = sorted(list(map(int, input().split())))
    k = int(input())
    twice = numbers[2] * 2 ** k
    print(sum(numbers[:2]) + twice)

Submission status: Accepted

Solution code:
import sys
a, b, c = map(int, sys.stdin.readline().split(' '))
k = int(sys.stdin.readline())
x = max(a, b, c)
print(x * (2 ** k) + a + b + c - x)

Submission status: Accepted

Solution code:
num = list(map(int,input().split(' ')))
k = int(input())
num.sort(reverse = True)
print(num[0] * (2 ** k) + num[1] + num[2])

Submission status: Accepted

Solution code:
def solve(a, b, c, k):
    val = a
    for x in [b, c]:
        if val < x:
            val = x
    remain = a + b + c - val
    for i in range(k):
        val *= 2
    return val + remain

def readQuestion():
    import sys
    line = sys.stdin.readline()
    sline = line.rstrip()
    str_a, str_b, str_c = sline.split(' ')
    a = int(str_a)
    b = int(str_b)
    c = int(str_c)
    line = sys.stdin.readline()
    str_k = line.rstrip()
    k = int(str_k)
    return a, b, c, k

def main():
    a, b, c, k = readQuestion()
    ans = solve(a, b, c, k)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a, b, c = sorted(map(int, raw_input().split()))
k = input()
print a + b + c*(2**k)

Submission status: Accepted

Solution code:
#abc096b

a,b,c=map(int,raw_input().split())
k=int(raw_input())
mx=max(a,b,c)
if mx==a:
 print a*2**k+b+c
elif mx==b:
 print b*2**k+a+c
else:
 print c*2**k+a+b

Submission status: Accepted

Solution code:
def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

a = int(arr_data[0][0])
b = int(arr_data[0][1])
c = int(arr_data[0][2])
k = int(arr_data[1][0])
arr = sorted([a, b, c])

maxdata = arr[-1:][0]

for i in range(1, k + 1):

    maxdata *= 2
    
sumdata = sum(arr[0:len(arr)-1]) + maxdata

print(sumdata)

Submission status: Accepted

Solution code:
abc = list(map(int, input().split()))
k = int(input())

abc.sort(reverse=True)
abc[0] *= 2 ** k  
print(sum(abc))

Submission status: Accepted

Solution code:
N = list(map(int,input().split()))
K = int(input())
N.sort()

print(N[0]+N[1]+N[2]*2**K)

Submission status: Accepted

Solution code:
l = sorted(map(int, input().split()))
k = int(input())
l[2] = l[2] * (2 ** k)
print(sum(l))

Submission status: Accepted

Solution code:
A=map(int,raw_input().split());m=max(A);print sum(A)+m*2**input()-m

Submission status: Accepted

Solution code:
s=sorted(list(map(int,input().split())))
print(s[0]+s[1]+s[2]*(2**(int(input()))))

Submission status: Accepted

Solution code:
A=sorted(map(int,raw_input().split()));A[2]=A[2]*pow(2,input());print sum(A)

Submission status: Accepted

Solution code:
x=list(map(int,input().split()));x.sort();print(x[0]+x[1]+x[2]*2**int(input()))

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
k = int(input())
print(sum(a) + max(a)*(2**k - 1))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - Maximum Sum
https://abc096.contest.atcoder.jp/tasks/abc096_b

"""
import sys
from sys import stdin
input = stdin.readline


def calc_sum(a, b, c, k):
    m = max(a, b, c)
    ans = sum([a, b, c])
    ans -= m
    for _ in range(k):
        m *= 2
    ans += m
    return ans


def main(args):
    a, b, c = map(int, input().split())
    k = int(input())
    ans = calc_sum(a, b, c, k)
    print(ans)


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

Submission status: Accepted

Solution code:
from sys import stdin
a = map(int,stdin.readline().split())
k = int(stdin.readline())
b = max(a)
print b* 2**k + sum(a) - b

Submission status: Accepted

Solution code:
from collections import deque

A, B, C = map(int, input().split())
K = int(input())

T = [A, B, C]
T.sort(reverse=True)

for _ in range(K):
    T = [T[0] * 2, T[1], T[2]]

print(sum(T))

Submission status: Accepted

Solution code:
numbers = list(map(int,input().split()))
K = int(input())

D = max(numbers)
for i in range(0,K):
    D = D * 2
    
print(sum(numbers) - max(numbers) + D)

Submission status: Accepted

Solution code:
s = list(map(int, input().split()))
K = int(input())
s.sort()
for i in range(K):
    s[2] *= 2
print(sum(s))

Submission status: Accepted

Solution code:
# Max sum
A, B, C = list(map(int,input().strip().split(' ')))
K = int(input().strip())
v = [A,B,C]
import itertools
nums = [0,1,2]
o = 0
for i in itertools.combinations_with_replacement(nums,K):
    tmp = [v[0],v[1],v[2]]
    for j in i:
        tmp[j] = tmp[j]*2
    o = max(o,sum(tmp))
print(o)

Submission status: Accepted

Solution code:
a,b,c=map(int,raw_input().split())   
k=int(raw_input())
ma=max(a,b,c)
print a+b+c+ma*((2**k)-1)

Submission status: Accepted

Solution code:
prob = list(map(int, (input().split(" "))))
k = int(input())

prob.sort()

for i in range(k):
    prob[-1] *= 2

print(prob[0] + prob[1] + prob[2])

Submission status: Accepted

Solution code:
x= list(map(int,input().split()))
k = int(input())
x.sort()
a = x[2]
for i in range(k):
    a = a *2
max = x[0] + x[1] + a
 
print(max)

Submission status: Accepted

Solution code:
p=input;a=[int(i)for i in p().split()];m=max(a);print(sum(a)-m+m*2**int(p()))

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
K = int(input())
L = [A,B,C]
L.sort()
D = L.pop()
D = D*(2**K)
L.append(D)
print(sum(L))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

tmp=list(map(int,input().split()))
tmp.sort()
K=int(input())
ans=tmp[0]+tmp[1]+(tmp[2]*(2**K))
print(ans)

Submission status: Accepted

Solution code:
arr = list(map(int, input().split()))
k = int(input())

arr_sorted = sorted(arr)
for i in range(k):
    arr_sorted[-1] *= 2
ans = sum(arr_sorted)
print(ans)

Submission status: Accepted

Solution code:
import math
import itertools
from heapq import heapify, heappop, heappush
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))





##### Library ####
#指定値未満の素数
def primes(max_number):
    """
    指定値未満の素数を取得するジェネレータ
    https://qiita.com/Mokkeee/items/93b6b7d59fa256aa1677
    """
    if max_number <= 2:
        raise StopIteration
    yield 2
    is_prime = [1] * max_number
    square_root_of_max = max_number ** 0.5
    for number in range(3, max_number, 2):
        if is_prime[number] is 0:
            continue
        yield number
        if number <= square_root_of_max:
            for multiple in range(number * 2, max_number, number):
                is_prime[multiple] = 0
##### main #####
def main():
	l = LI()
	K = I()
	max_l = max(l)
 
	add_max = max_l * (2 ** K)
	print(sum(l) - max_l + add_max)


if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
s = list(map(int, input().split()))
K = int(input())
s = sorted(s, reverse=True)
for i in range(K):
    s[0] *= 2
print(sum(s))

Submission status: Accepted

Solution code:
s = list(map(int, input().split()))
K = int(input())
s = sorted(s)
for i in range(K):
    s[2] *= 2
print(sum(s))

Submission status: Accepted

Solution code:
a,b,c = (int(i) for i in input().split())
k = int(input())
x,ans = max(a,b,c),a+b+c-max(a,b,c)
for i in range(k): x *= 2
print(ans+x)

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
k = int(input())
mx = max(a)
print(sum(a) - mx + mx*(2**k))

Submission status: Accepted

Solution code:
numbers = [int(i) for i in input().split()] 
K = list(map(int, input().split()))[0]
max_index = numbers.index(max(numbers))
result = [numbers[i] * 2 ** K if i == max_index else numbers[i] for i in range(len(numbers))]
print(sum(result))

Submission status: Accepted

Solution code:

A, B, C = map(int, input().split())
K = int(input())

num = [A, B, C]
max_idx = num.index(max(num))

for _ in range(K):
    num[max_idx] *= 2
    
print(sum(num))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat May  5 22:10:57 2018

@author: sakas
"""

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

if a>b and a>c:
    for i in range(K):
        a *= 2
    print(a+b+c)
elif b > a and b > c:
    for i in range(K):
        b *= 2
    print(a+b+c)
else:
    for i in range(K):
        c *= 2
    print(a+b+c)

Submission status: Accepted

Solution code:

li= sorted(list(map(int, input().split(' '))),reverse=True)
  
k = int(input())

mx = li[0] * (2**k)

for i in range(1, len(li)):
                mx += li[i]
print(mx)

Submission status: Accepted

Solution code:
A, B ,C = map(int, input().split())
K = int(input())

for i in range(K):
    if A == max(A,B,C):
        A *= 2
    if B == max(A,B,C):
        B *= 2
    if C == max(A,B,C):
        C *= 2
    

print(A+B+C)

Submission status: Accepted

Solution code:
x = list(map(int,input().split()))
x = sorted(x)
k = int(input())
for i in range(k):
    x[2] *= 2
print(sum(x))

Submission status: Accepted

Solution code:
A = sorted(list(map(int, input().split())))
K = int(input())

A[-1] = A[-1]*2**K
print(sum(A))

Submission status: Accepted

Solution code:
lis = list(map(int,input().split()))
n = lis.pop(lis.index(max(lis)))
for i in range(int(input())):
    n *= 2
print(sum(lis)+n)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
K = int(input())

A = 0
if A < a:
    A = a
if A < b:
    A = b
if A < c:
    A = c
  
ans = a + b + c - A + A * 2**K
print(ans)

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split())
k = int(input())

mx = max(a,b,c)
other = a + b + c - mx
print (other + mx * 2 ** k)

Submission status: Accepted

Solution code:
import numpy as np

nums = np.array(list(map(int, input().split())))
K = int(input())

nums = np.sort(nums)

nums[-1] *= 2 ** K
print(np.sum(nums))

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
k = int(input())

m = a
count = 0
if b>m:
    m=b
    count=1
if c>m:
    m=c
    count=2

if count==0:
    print(a*2**k+b+c)
if count==1:
    print(a+b*2**k+c)
if count==2:
    print(a+b+c*2**k)

Submission status: Accepted

Solution code:
a = [int(i) for i in input().split()]
k = int(input())
print(max(a)*(2**k)+sum(a)-max(a))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# 入力を各変数に格納
num_list = [int(i) for i in input().split()]
times = int(input())

# 3つの数値を昇順ソート
num_list.sort()
# リスト内最大値を一時変数へ
num_tmp = num_list[2]
# 操作回数分の*2をする
for i in range(times):
	num_tmp = num_tmp * 2
num_list[2] = num_tmp

# リスト内の数値を合計して出力
print(sum(num_list))

Submission status: Accepted

Solution code:
l=list(map(int,input().strip().split()))
k=int(input())
l=sorted(l)[::-1]
while k>0:
    l[0]=l[0]*2
    k-=1
print(sum(l))

Submission status: Accepted

Solution code:
num = input()
num = num.rstrip().split(" ")
if int(num[0])>=10:
    num[0]=num[0]
else:
    num[0]="0"+str(num[0])
if int(num[1])>=10:
    num[1]=num[1]
else:
    num[1]="0"+str(num[1])
if int(num[2])>=10:
    num[2]=num[2]
else:
    num[2]="0"+str(num[2])


list1 = [int(num[0]),int(num[1]),int(num[2])]
list1 = sorted(list1)
#print(list1)
count= input()

print(int(list1[2]*(2**int(count))+list1[1]+list1[0]))

Submission status: Accepted

Solution code:
l = input().split()
k = int(input())
a,b,c = int(l[0]),int(l[1]),int(l[2])
maxabc = max(a,b,c)
print(maxabc*(2**k)+a+b+c-maxabc)

Submission status: Accepted

Solution code:
A, B, C = [int(a) for a in input().split()]
K = int(input())

x = max([A,B,C])
print(str(A + B + C + x * (2 ** K - 1)))

Submission status: Accepted

Solution code:
#question B
a,b,c=map(int, input().split())
k=int(input())
if a>=b:
    if a>=c:
        a=a*(2**k)
    else:
        c=c*(2**k)
elif b>=c:
    b=b*(2**k)
else:
    c=c*(2**k)
print(a+b+c)

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
k = int(input())
for i in range(k):
    a[a.index(max(a))] *= 2
print(sum(a))

Submission status: Accepted

Solution code:
a = map(int, raw_input().split())

N = input()

b = sorted(a)
b.reverse()

k = b[0]

for i in range(N):
    k = k * 2


for i in range(len(a)-1):
    k = k + b[i+1]

ans = k

print(ans)

Submission status: Accepted

Solution code:
a = list(map(int, input().split(' ')))
K = int(input())

a.sort()
print('{}'.format(a[0] + a[1] + a[2] * (2 ** K)))

Submission status: Accepted

Solution code:
a=map(int,raw_input().split())
k=int(raw_input())
n=max(a)
a.remove(n)
print("%d"%(n*2**k+sum(a)))

Submission status: Accepted

Solution code:
number = [ int(i) for i in input().split()]
k = int(input())

max_num = max(number)
number.remove(max_num)

max_num = max_num * (2 ** k)

print(sum(number)+max_num)

Submission status: Accepted

Solution code:
A=list(map(int,input().split()))
K=int(input())

res=max(A)*2**K+sum(A)-max(A)
print(res)

Submission status: Accepted

Solution code:
L = list(map(int,input().split()))
K=int(input())

M=max(L)
L.remove(M)



for i in range(K):
    M=M*2
    
ans=0

ans=M+sum(L)

print(ans)

Submission status: Accepted

Solution code:
a=list(map(int,input().split()))
a.sort()
k=int(input())
print(a[0]+a[1]+(a[2]*(2**k)))

Submission status: Accepted

Solution code:
a, b, c = (int(i) for i in input().split())
k = int(input())

list = [a, b, c]
max = max(list)
index_max = list.index(max)

result = max * 2 ** k
for i in range(3):
	if i != index_max:
		result += list[i]

print(result)

Submission status: Accepted

Solution code:
A,B,C=map(int, input().split())
K=int(input())
if A<=B and B<=C:
    print(A+B+C*(2**K))
elif C<=A and A<=B:
    print(A+C+B*(2**K))
elif B<=C and C<=A:
    print(B+C+A*(2**K))
elif A<=C and C<=B:
    print(A+C+B*(2**K))
elif B<=A and A<=C:
    print(B+A+C*(2**K))
elif C<=B and B<=A:
    print(C+B+A*(2**K))

Submission status: Accepted

Solution code:
# coding: utf-8
a, b, c = map(int, input().split())
k = int(input())
if(a > b and a > c):
    for aa in range(k):
        a = a * 2
elif(b > a and b > c):
    for bb in range(k):
        b = b * 2
else:
    for cc in range(k):
        c = c * 2
print(a+b+c)

Submission status: Accepted

Solution code:
a = input().split(" ")
K = int(input())
max = 0
k = 0
for i in range(3):
    if int(a[i]) >= max:
        max = int(a[i])
        k = i
a[k] = int(a[k]) * (2 **K)
print(int(a[0])+int(a[1])+int(a[2]))

Submission status: Accepted

Solution code:
a=[int(x) for x in input().split(' ')]
k = int(input())
a,b,c = a

s = sum([a, b, c])
s -= max([a, b, c])
s += 2 ** k * max([a, b, c])

print(s)

Submission status: Accepted

Solution code:
blackboard = map(long, raw_input().split())
K = long(raw_input())
blackboard.sort()
blackboard.reverse()
ans = blackboard[0]*(2**K)+blackboard[1]+blackboard[2]
print ans

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
K = int(input())


for i in range(K):
    if A >= B and A >= C:
        A = A*2

    if B > A and B >= C:
        B = B*2

    if C > B and C > A:
        C = C*2


sum = A + B + C

print(sum)

Submission status: Accepted

Solution code:
A = map(int, raw_input().split())
k = int(raw_input())

m = max(A)
idx = A.index(m)

for i in range(k):
    m *= 2

result = 0
for i in range(3):
    if i == idx:
        result += m
    else:
        result += A[i]
print(result)

Submission status: Accepted

Solution code:
d = list(map(int, input().split(' ')))
k = int(input())
m = max(d)
d.remove(m)
for iter_count in range(k):
    m *= 2
print(sum(d) + m)

Submission status: Accepted

Solution code:
n = input().split()

k=int(input())
n = [int(n[0]), int(n[1]),int( n[2])]
n.sort()

a = n[0]
b = n[1]
c = n[2]


print(a+b+c*pow(2,k))

Submission status: Accepted

Solution code:
n = list(map(int, input().split(' ')))
k = int(input())

for _ in range(k):
    n_max = max(n)
    n_max = n_max * 2
    n[n.index(max(n))] = n_max

print(sum(n))

Submission status: Accepted

Solution code:
import math

s = input().rstrip().split()

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

k = int(input())

m = max(a,b,c)

n = math.pow(2,k)

ans = a + b + c + m*(n-1)

print("{}".format(int(ans)))

Submission status: Accepted

Solution code:
List = [int(i) for i in input().split()]

K = int(input())

maxNumber = max(List)
List.remove(maxNumber)
print(maxNumber* pow(2, K) + List[0] + List[1])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a, b ,c = map(int, raw_input().split())
k=2 ** int(raw_input())
if(a<b):
	if (b<c):
		x=a+b+c*k
	else:
		x=a+c+b*k
else:
	if(a<c):
		x=a+b+c*k
	else:
		x=b+c+a*k
print(x)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
k= int(input())
m = max(a,b,c)
r = a+b+c-m
print (r+m*2**k)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

# coding: utf-8
# Your code here!
a,b,c = list(map(int,input().split()))
K=int(input())

if b <= c:
    b,c=c,b
if a <= b:
    a,b = b,a
print(a*(2**K)+b+c)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a,b,c = map(int, raw_input().split())
d=[a,b,c]
# 整数の入力
k = int(raw_input())

m=max(d)
print (sum(d)-m+m*2**k)

Submission status: Accepted

Solution code:
numbers = input().split()
A = int(numbers[0])
B = int(numbers[1])
C = int(numbers[2])

K = int(input())

for i in range(K):
    M = max(A,B,C)
    if A == M:
        A = 2 * A
    elif B == M:
        B = 2 * B
    else:
        C = 2 * C

print(A + B + C)

Submission status: Accepted

Solution code:
ABC = sorted(map(int,raw_input().split()))
for x in range(input()):
	ABC[2] = ABC[2]*2
print ABC[2]+ABC[0]+ABC[1]

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
k = int(input())
max_num = max(a, b, c)
result = max_num * pow(2,k) + a + b + c - max_num
print(result)

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split(" "))
K = int(input())
print(max([A,B,C])*((1 << (K))-1) + sum([A,B,C]))

Submission status: Accepted

Solution code:
def ii():
    return int(input())

def lii():
    return list(map(int, input().split(' ')))
# a, b = lii()
# if b < a:
#     print(a-1)
# else:
#     print(a)


a, b, c = lii()
k = ii()

for _ in range(k):
    if a == max(a, b, c):
        a *= 2
    elif b == max(a, b, c):
        b *= 2
    elif c == max(a, b, c):
        c *= 2

print(sum([a, b, c]))

Submission status: Accepted

Solution code:

if __name__ == "__main__":
    A, B, C = list(map(int, input().split()))
    K = int(input())
    l = [A, B, C]
    l.sort()
    ans = l[2] * (2**K) + l[0] + l[1]
    print(ans)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
k = int(input())
m = max(max(a, b), c)
sum_ = a + b + c
res = sum_ - m + m*(2**k)
print(res)

Submission status: Accepted

Solution code:
s = list(map(int, input().split()))
k = int(input())
mx = max(s)
ind = s.index(mx)
sm = sum(s[:ind])+sum(s[ind+1:])
sm+=mx*2**k
print(sm)

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
k = int(input())

m = max(a)
s = m

for i in range(k):
	s = s * 2

print(sum(a) - m + s)

Submission status: Accepted

Solution code:
import numpy as np

nums = np.array([int(item) for item in input().split(' ')])
k = int(input().split(' ')[0])

for i in range(1,k+1):
    maxi = nums.argmax()
    nums[maxi] = nums[maxi] * 2

print(sum(nums))

Submission status: Accepted

Solution code:
a = [int(i) for i in input().split()] 
a.sort()
k = int(input())
print (a[2] * (2 ** k) + a[0] + a[1])  #出力結果：[2,4,6]

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
k = int(input())
ma = max(a)
a.remove(ma)
for i in range(0,k):
    ma = ma * 2
res = ma + a[0] + a[1]
print(res)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())  # 入力
k = int(input())  # 入力
num_ary = [a, b, c]
max_n = max(num_ary)

max_index = num_ary.index(max_n)#最大値のindex

max_num = max_n * pow(2, k)

num_ary[max_index] = max_num

print(num_ary[0] + num_ary[1] + num_ary[2])

Submission status: Accepted

Solution code:
a, b, c = map(int, input() .split())
K = input()
k = int(K)
N = max(a, b, c)
print((a + b + c - N) + (2 ** k) * N)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
k=int(input())
num=[a,b,c]
max=(max(num))
a=pow(2,k)*max+a+b+c-max
print(a)

Submission status: Accepted

Solution code:
ABC = [int(i) for i in input().split(" ")]
K = int(input())

maximun = max(ABC)
index = 0
for i in range(3):
    if ABC[i] - maximun == 0:
        index = i

for k in range(K):
    ABC[index] = 2 * ABC[index]

print(sum(ABC))

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
a.sort()
k = int(input())
a[2] = a[2]*2**k
print(sum(a))

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
k = int(input())
max = max(a,b,c)
print(a+b+c+max*(2**k)-max)

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split())
k = int(input())

m = max(a,b,c)
n = a+b+c-m
print(m*(2**k)+n)

Submission status: Accepted

Solution code:
l = list(map(int,input().split()))
k = int(input())

l.sort()
l[2] = l[2] * (2**k)
print(sum(l))

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
K=int(input())
a=int(max(A,B,C)*(2**K))
print((A+B+C-max(A,B,C)+a))

Submission status: Accepted

Solution code:
abc = tuple(map(lambda x: int(x), input().split()))
k = int(input())

max_abc = max(abc)
sum_abc = sum(abc)

print(sum_abc - max_abc + max_abc*(2**k))

Submission status: Accepted

Solution code:
A,B,C = map(int, raw_input().split())
K = input()
print sum([A,B,C])+max(A,B,C)*(2**K-1)

Submission status: Accepted

Solution code:
import math
import random
import heapq
from collections import Counter, defaultdict
from decimal import Decimal, ROUND_HALF_UP, ROUND_CEILING
from functools import lru_cache, reduce
from itertools import combinations_with_replacement, product, combinations


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def mt(f):
    import time
    import sys

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        print(e - s, 'sec', file=sys.stderr)
        return ret

    return wrap


@mt
def slv(A, B, C, K):

    ans = sum([A, B, C])
    m = max([A, B, C])
    ans -= m
    for i in range(K):
        m *= 2
    return ans + m


def main():
    A, B, C = read_int_n()
    K = read_int()
    print(slv(A, B, C, K))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
K = int(input())

M = max(A, B, C)

SUM = M*(2**K)


if M == A:
	ADD=(B+C)
elif M == B:
	ADD=(A+C)
elif M == C:
	ADD=(A+B)

print(SUM+ADD)

Submission status: Accepted

Solution code:
l = sorted(list(map(int, input().split())))
k = int(input())

print(l[2]*2**k + l[0] + l[1])

Submission status: Accepted

Solution code:
A=[int(x) for x in input().split()]
K=int(input())
m=max(A)
k=2**K
A_m=sum(A)-m
print(A_m+m*k)

Submission status: Accepted

Solution code:
L = list(map(int, input().split()))
K = int(input())

L.sort()

print(sum(L) + L[len(L) - 1] * (2 ** K - 1))

Submission status: Accepted

Solution code:
A = list(map(int,input().split()))
K = int(input())
 
A.sort()
ans =A[0]+A[1]+A[2]*(2**K)
 
print(ans)

Submission status: Accepted

Solution code:
a,k = list(map(int,input().split())),int(input())
print(sum(a)+max(a)*2**k-max(a))

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split())
k = int(input())
sum = a+b+c+max(a,b,c)*(2**k-1)
print(sum)

Submission status: Accepted

Solution code:
a = [int(i) for i in input().split()]
K=int(input())
M = max(a)
y = pow(2,K)
B=M*y
result = sum(a) + B - M
print(result)

Submission status: Accepted

Solution code:
def main(a, b, c, k):
  abc = sorted([a, b, c])
  abc[-1] *= 2**k
  print(sum(abc))

# tests = [
#   [5, 3, 11, 1],  # 30
#   [3, 3, 4, 2],  # 22
# ]

# for test in tests:
#   main(*test)

a, b, c = [int(i) for i in input().split()]
k = int(input())
main(a, b, c, k)

Submission status: Accepted

Solution code:
inp=input().split()
A,B,C=int(inp[0]),int(inp[1]),int(inp[2])
K=int(input())
X=sorted([A,B,C])
print(X[0]+X[1]+(2**(K))*X[2])

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	a,b,c = map(int, input().split())
	k = int(input())

	m = max(a,b,c)
	print(a+b+c+m*(2**k)-m)

Submission status: Accepted

Solution code:
import numpy as np

x, y, z = map(int, input().split(' '))
row = np.array([x, y, z])

for times in range(int(input())):
    row[row.argmax()] = row.max() * 2
    
print(np.sum(row))

Submission status: Accepted

Solution code:
# n = int(raw_input())
# a = [int(raw_input()) for i in xrange(n)]
a, b, c = map(int, raw_input().split())
k = int(raw_input())
# print "".join(["a","b"])
 
# print "Yes" if 3 > 0 else "No"
 
 
l = sorted([a,b,c])
m=l[2]
 
for i in xrange(k):
    m *= 2

print m + l[0] + l[1]

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
li = list(map(int,raw_input().split()))
time = int(raw_input())
max_num = max(li)
print sum(li) - max_num + max_num*(2** time)

Submission status: Accepted

Solution code:
import sys

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

flag = True

if max([a, b, c]) == a:
    for i in range(k):
        a = a*2

    flag = False
    print(a+b+c)

if max([a, b, c]) == b and flag:
    for i in range(k):
        b = b*2

    flag = False
    print(a+b+c)

if max([a, b, c]) == c and flag:
    for i in range(k):
        c = c*2

    print(a+b+c)

Submission status: Accepted

Solution code:
list = [int(i) for i in input().split()]
k = int(input())

for i in range(k):
    list[list.index(max(list))] *= 2

print(sum(list))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000)

a, b, c = list(map(int, input().split(" ")))
k = int(input())

ans = []

for i in range(0, k+1, 1):
    for j in range(0, k-i+1, 1):
        ans.append(a*(2**i) + b*(2**j) + c*(2**(k-i-j)))

print(max(ans))

Submission status: Accepted

Solution code:
# 整数の入力
blackboard = list(map(int, input().split(" ")))
K = int(input())

for _ in range(K):
    maximum = max(blackboard)
    ind_max = blackboard.index(maximum)
    blackboard[ind_max] = maximum * 2

# 出力
print(sum(blackboard))

Submission status: Accepted

Solution code:
a_list = list(map(int, input().split()))
k = int(input())

for i in range(k):
  a_list = sorted(a_list, reverse=True)
  a_list[0] = max(a_list) * 2
  
print(sum(a_list))

Submission status: Accepted

Solution code:
x = list(map(int,input().split()))
a = x[0]
b = x[1]
c = x[2]
k = int(input())
x_max = max(a,b,c)
answer = x_max * (2 ** k - 1) + a + b + c
print(answer)

Submission status: Accepted

Solution code:
A,B,C = list(map(int,input().split()))
K = int(input())


def dp(a,b,c,k):
    if k == 0:
        return a+b+c
    elif k == 1:
        return max(a,b,c) + a+b+c
    else:
        if max(a,b,c) == a:
            return dp(2*a, b, c, k-1)
        elif max(a, b, c) == b:
            return dp(a, 2*b, c, k - 1)
        else:
            return dp(a, b, 2*c, k - 1)


print(dp(A,B,C,K))

Submission status: Accepted

Solution code:
abc_list = list(map(int, input().split()))
K = int(input())
abc_list.sort()
m_v = abc_list.pop()

for i in range(K):
    m_v *= 2
abc_list.append(m_v)
print(sum(abc_list))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

l = list(map(int, input().split()))
k = int(input())

l.sort(reverse=True)
m = max(l)
for _ in range(k):
    m *= 2

ans = m
for i in range(1, len(l)):
    ans += l[i]
print(ans)

Submission status: Accepted

Solution code:
ABC = list(map(int,input().split()))

K = int(input()) 
temp = max(ABC)
temp_index=ABC.index(temp)
del ABC[temp_index]
ans = temp*2**K
ans += sum(ABC)

print(ans)

Submission status: Accepted

Solution code:
listA=list(map(int,input().split()))
K=int(input())
listA=sorted(listA)
ans=(2**K)*listA[-1]+sum(listA[:-1])
print(ans)

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
k = int(input())
print(max(a)*(2**k-1)+sum(a))

Submission status: Accepted

Solution code:
def main():
    n = list(map(int, input().split()))
    k = int(input())

    n.sort(reverse=True)
    r = n[0] * (2 ** k) + n[1] + n[2]
    print(r)

main()

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
K = int(input())
max_num = max(A, B, C)*2**K
others = A + B + C - max(A, B, C)
print(others + max_num)