qyliang/CodeNanoFix huggingface dataset:
Buggy code:
A = sorted(list(map(int,input().split())))
N = int(input())
A[-1] = A[-1]**N
print(sum(A))

Fixed code:
A = sorted(list(map(int,input().split())))
N = int(input())
A[-1] = A[-1]*2**N
print(sum(A))
Buggy code:
a,b,c = map(int, input().split())
print(a + b + c + max(a, b, c) * (2 ^ (int(input())-1)))

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

Fixed code:
x=list(map(int,input().split()))
k=int(input())
print(max(x)*(2**k)+sum(x)-max(x))
Buggy code:
a = list(map(int, input().split()))
a.sort()
K = int(input())

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

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

Fixed code:
x=list(map(int,input().split()))
k=int(input())
x.sort()
print(x[0]+x[1]+x[2]*2**k)
Buggy code:
A, B, C=map(int, input().split())
K = int(input())
M = max(A, B, C)
G=A+B+C-M
print(G+M**K)

Fixed code:
A, B, C = map(int, input().split())
K = int(input())
M = max(A, B, C)
G = A+B+C-M
print(G+M*(2**K))
Buggy code:
a = map(int, input().split())
k = int(input())

a.sort()
a[-1] *= 2 ** k

print(sum(a))

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

a.sort()
a[-1] *= 2 ** k

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


Fixed code:
nums = list(map(int, input().split()))
K = int(input())
print(sum(nums) + max(nums)*(2**K-1))
Buggy code:
nums = list(map(int, input().split()))
K = int(input())
print(sum(nums) + max(nums)*(2**K))


Fixed code:
nums = list(map(int, input().split()))
K = int(input())
print(sum(nums) + max(nums)*(2**K) - max(nums))
Buggy code:
a = [int(i) for i in input().split()]
k = int(input())
a.sort()
print(a[len(a)-1]**8+sum(a)-a[len(a)-1])

Fixed code:
a = [int(i) for i in input().split()]
k = int(input())
a.sort()
print(a[len(a)-1]*2**k+sum(a)-a[len(a)-1])
Buggy code:
a,b,c = map(int(), input().split())
k = int(input())

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

Fixed code:
a,b,c = map(int, input().split())
k = int(input())
kk=2**k
m = max(a,b,c)
al = a+b+c-m+m*kk
print(al)
Buggy code:
A,B,C = map(int,input().split())
K = int(input())

print(max(A*2+B+C,A+B*2+C,A+B+C*2))

Fixed code:
A, B, C = map(int, input().split())
K = int(input())
print(A + B + C + (max(A, B, C)) * 2 ** K - max(A, B, C))
Buggy code:
A, B, C = [int(x) for x in input().split()]
print(max(A, B, C)　*　(２ **int(input())) + sum(A, B, C) - max(A, B, C))

Fixed code:
A, B, C = [int(x) for x in input().split()]
print(max(A, B, C) * (2 ** int(input())) + sum([A, B, C]) - max(A, B, C))
Buggy code:
a,b,c = map(int,input().split())
k =int(input())

M = max([a,b,c])
print(M)

M2 = M * pow(2,k)

print(a+b+c+M2-M)

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

M = max([a,b,c])
# print(M)

M2 = M * pow(2,k)

print(a+b+c+M2-M)
Buggy code:
a, b, c = (int(i) for i in input().split())
k = int(input())

l = max(a,b,c)
ans = l**k + a+b+c - l
print(ans)


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

l = max(a,b,c)
ans = l*(2**k)+a+b+c-l
print(ans)
Buggy code:
l = list(map(int, input().split()))
k = int(input())
print(sum(l) + max(l)*(2-k))

Fixed code:
l = list(map(int, input().split()))
k = int(input())
ans = sum(l) - max(l) + max(l)*2**k
print(ans)
Buggy code:
a=list(map(int,input().split()))
K=int(input)
maxa=a.pop(a.index(max(a)))
print((maxa*(2**K))+sum(a))

Fixed code:
a=list(map(int,input().split()))
K=int(input())
maxa=a.pop(a.index(max(a)))
print((maxa*(2**K))+sum(a))
Buggy code:
a,b,c = map(int,input(),split())
k = int(input())
m = max(a,b,c)
ans = a+b+c-m
abs += m * (2**k)
print(ans)

Fixed code:
a,b,c = map(int,input().split())
k = int(input())
m = max(a,b,c)
ans = a+b+c-m
ans += m * (2**k)
print(ans)
Buggy code:
a,b,c=map(int, input().split())
ans = a+b+c
m = max(a, max(b,c))
ans += (pow(2,K)-1) * m
print(ans)


Fixed code:
a,b,c=map(int, input().split())
K=int(input())
ans = a+b+c
m = max(a, max(b,c))
ans += (pow(2,K)-1) * m
print(ans)
Buggy code:
A,B,C=map(int,input().split())
K=int(input())

print(A+B+C+max(A,B,C)*(2**K-1)

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

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

Fixed code:
A = list(map(int,input().split()))
K = int(input())
A.sort()
ans = A[0]+A[1]+A[2]*(2**K)
print(ans)
Buggy 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)

Fixed 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)
Buggy code:
a, b, c = [int(i) for i in input().split()]
k = int(input())
m = max(a, b, c)
print(a + b + c + m**k - m)


Fixed code:
a, b, c = [int(i) for i in input().split()]
k = int(input())
m = max(a, b, c)
print(a + b + c + m*(2 ** k) - m)
Buggy code:
a,b,c = map(int,input().split())
k = int(input())
if max(a,b,c) == a:
  print(a**k+b+c)
elif max(a,b,c) == b:
  print(b**k+a+c)
else:
  print(a+b+c**k)

Fixed code:
a,b,c = map(int,input().split())
k = int(input())
if max(a,b,c) == a:
  print(a*(2**k)+b+c)
elif max(a,b,c) == b:
  print(b*(2**k)+a+c)
else:
  print(a+b+c*(2**k))
Buggy code:
l = list(map(int,input().split()))
k = int(input())
L =l.sorted()
print(l[0]+l[1]+l[2]*k)

Fixed code:
l = list(map(int,input().split()))
k = int(input())
L =l.sort()
print(int(l[0])+int(l[1])+int(l[2])*(2**k))
Buggy code:
a, b, c = map(int, input().split())
k = int(input())

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

print(ans)


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

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

print(ans)
Buggy code:
l = list(map(int, input().split()))
k = int(input())
MAX = max(l)
print(sum(l) + MAX * 2 ** (k - 1))

Fixed code:
l = list(map(int, input().split()))
k = int(input())
MAX = max(l)
print(sum(l) + MAX * 2 ** k - MAX)
Buggy code:
ABC = sorted(list(map(int,input().split())))
K = int(input())

print(sum(ABC[:2]) + ABC[-1] ** K)

Fixed code:
ABC = sorted(list(map(int,input().split())))
K = int(input())

print(sum(ABC[:2]) + (ABC[-1]) * (2 ** K))
Buggy code:
a = [int(x) for x in input().split()]
k = int(input())
print(sum(a) + max(a) * (2 ** (K - 1)))

Fixed code:
a = [int(x) for x in input().split()]
k = int(input())
print(sum(a) - max(a) + max(a) * (2 ** k))
Buggy code:
a,b,c = map(int,input().split())
k = int(input())
print(sum(a,b,c)+(max(a,b,c)*(2**k-1)))

Fixed code:
a,b,c = map(int,input().split())
k = int(input())
print(sum([a,b,c])+(max(a,b,c)*(2**k-1)))
Buggy code:
# coding: utf-8
N = sorted(list(map(int, input().split())))
K = int(input())
print(N[0] + N[1] + N[2] ** K)

Fixed code:
# coding: utf-8
N = sorted(list(map(int, input().split())))
K = int(input())
print(N[0] + N[1] + N[2] * (2 ** K))
Buggy code:
e = [int(i) for i in input().split()]
k = int(input())

print(max(e) * 2 ** (k-1) + sum(e))


Fixed code:
e = [int(i) for i in input().split()]
k = int(input())

print(max(e) * 2 ** k + sum(e) - max(e))
Buggy code:
x=list(map(int,input().split()));x.sort();print(x[0]+x[1]+x[2]*2**int(input())

Fixed code:
x=list(map(int,input().split()));x.sort();print(x[0]+x[1]+x[2]*2**int(input()))
Buggy code:
a=list(map(int,input().split()))
k=int(input())
print(sum(a)-max(a)+max(a)*(2**(k-1)))

Fixed code:
a = list(map(int,input().split()))
k = int(input())
print(max(a)*(2**k) + sum(a) - max(a))
Buggy code:
A, B, C = list(map(int, input().split()))
K = int(input())

ans = max([A, B, C]) * (2 ** K)

print(ans)


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

ans = max([A, B, C]) * (2 ** K) - max([A, B, C])

print(ans + A + B + C)
Buggy code:
if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    n = int(input())
    a.sort()
    a[2] = a[2]*(2**n)
    print(su

Fixed code:
if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    n = int(input())
    a.sort()
    a[2] = a[2]*(2**n)
    print(sum(a))
Buggy code:
a = list(map(int,input().split())).sort()
k = int(input())
print(a[0]+a[1]+a[2]*(2**k))

Fixed code:
a = list(map(int,input().split()))
a.sort()
k = int(input())
print(a[0]+a[1]+a[2]*(2**k))
Buggy code:
A, B, C = map(int, input().split())
K = int(input())
m = max(A,B,C)
print(A+B+C-m+m**K)

Fixed code:
A, B, C = map(int, input().split())
K = int(input())
m = max(A,B,C)
print(A+B+C-m+m*(2**K))
Buggy code:
n=map(ijnt,input().split())
k=int(input())
n.sort(reverse=True)
print(n[0]*k+n[1]+n[2])

Fixed code:
n=list(map(int,input().split()))
k=int(input())
n.sort(reverse=True)
print(n[0]*(2**k)+n[1]+n[2])
Buggy code:
l=list(map(int,input().split()))
k=int(input())

print(sum(l)+max(l)**k-max(l))


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

print(sum(l)+max(l)*(2**k)-max(l))
Buggy code:
A,B,C = map(int, input().strip().split(' '))
K = int(input().strip())

print(sum(A,B,C)+max(A,B,C)*((2**K)-1))


Fixed code:
A,B,C = map(int, input().strip().split(' '))
K = int(input().strip())

print(A+B+C+max(A,B,C)*((2**K)-1))
Buggy code:
ABC = list(map(int, input().split()))

ABC_1 = sorted(ABC)

ABC_1[-1] = ABC_1[-1]*2**K

print(sum(ABC_1))

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

ABC_1 = sorted(ABC)

ABC_1[-1] = ABC_1[-1]*2**K

print(sum(ABC_1))
Buggy code:
l = list(map(int,input().split()))
k = int(input())
L = sorted(l,reverse = True)
print(L[0]*(k**2)+L[1]+L[2])

Fixed code:
l = list(map(int,input().split()))
k = int(input())
L = sorted(l,reverse = True)
print(L[0]*(2**k)+L[1]+L[2])
Buggy code:
a = list(map(int, input().split()))
print((sum(a)-max(a))+max(a)**int(input()))

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

Fixed code:
a,x=list(map(int,input().split())),int(input());print(sum(a)+max(a)*((2**x)-1))
Buggy code:
a,b,c=map(int,input().split())
n=int(input())

a,b,c= sorted([a,b,c])
print(a+b+c*n)

Fixed code:
a,b,c=map(int,input().split())
n=int(input())

a,b,c= sorted([a,b,c])
print(a+b+c*2**n)
Buggy code:
a = list(map(int,input().split()))
k = int(input())
a.sort(reverse = True)
a[0] = a*2**k
print(sum(a))


Fixed code:
a = list(map(int,input().split()))
k = int(input())
a.sort(reverse = True)
a[0] = a[0]*2**k
print(sum(a))
Buggy code:
L = list(map(int, input().split()))
K = int(input())

L.sort()

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

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

L.sort()

print(sum(L) + L[len(L) - 1] * (2 ** K - 1))
Buggy code:
A = list(map(int, input().split())).sort()
K = int(input())

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

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

A[-1] = A[-1]*2**K
print(sum(A))
Buggy code:
num = list(map(int, input().split())
k = int(input())
print(max(num)*(2**k-1)+sum(num))

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

Fixed code:
a,b,c = map(int,input().split())
k = int(input())
print(2**k*max(a,b,c) + (a+b+c-max(a,b,c)))
Buggy code:
num = list(map(int,input().split()))
k = int(input())
num.sort()
print(sum(num[:2])+num[-1]**k)

Fixed code:
num = list(map(int,input().split()))
k = int(input())
num.sort()
print(sum(num[:2])+num[-1] * 2**k)
Buggy code:
A,B,C=map(int,input().split())
K=int(input())

m=max(A,B,C)
print((2**K)*m + (A+B+C-m)

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

m=max(A,B,C)
print((2**K)*m + (A+B+C-m))
Buggy 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**k+b+c)
if count==1:
    print(a+b**k+c)
if count==2:
    print(a+b+c**k)


Fixed 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)
Buggy code:
ls = map(int,input().split())
K = int(input())
ls.sort()
ans = ls[0]+ls[1]+ls[2]*2**K
print(ans)

Fixed code:
ls = list(map(int,input().split()))
K = int(input())
ls.sort()
ans = ls[0]+ls[1]+ls[2]*2**K
print(ans)
Buggy code:
calc_lsit = list(map(int,input().split()))
k = int(input())

calc_list = sorted(calc_list)
Answer = calc_list[0] + calc_list[1] + calc_list[2]**k
print(Answer)

Fixed code:
calc_list = list(map(int,input().split()))
k = int(input())
 
calc_list = sorted(calc_list)
Answer = calc_list[0] + calc_list[1] + calc_list[2]*(2**k)
print(Answer)
Buggy code:
# -*- coding: utf-8 -*-

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

Fixed 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)
Buggy code:
a=list(map(int,input().split()))
n=int(input())
x=max(a)*2**n
print(x+sum(a)-max(a)*2)

Fixed code:
a=list(map(int,input().split()))
n=int(input())
x=max(a)*(2**n)
print(x+sum(a)-max(a))
Buggy code:
a,b,=map(int,input().split()) 
k=int(input()) 
print((max([a,b,c]))*(2**k-1)+sum([a,b,c])) 


Fixed code:
a,b,c=map(int,input().split())
k=int(input())
print((max([a,b,c]))*(2**k-1)+sum([a,b,c]))
Buggy code:
if __name__ == "__main__":
    abc = input().replace("　", " ").split(" ")
    abc = [int(x) for x in abc].sort(reverse=True)
    k = int(input())
    print(abc[0] * (2**k)

Fixed code:
if __name__ == "__main__":
    abc = input().replace("　", " ").split(" ")
    abc = [int(x) for x in abc]
    abc.sort(reverse=True)
    k = int(input())
    print(abc[0] * (2**k) + abc[1] + abc[2])
Buggy code:
a,b,c=map(int,input().split())
k=int(input())
print((max(a,b,c)*(2**k))+(a+b+c)-max(a,b,c)


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

max_value = max([a, b, c])

res = max_value * k + a + b + c

print(res)

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

max_value = max([a, b, c])

res = max_value *(2**k) + a + b + c - max_value

print(res)
Buggy code:
A, B, C = map(int, input().split())
K = int(input())

biggest = max(A, B, C)
print(biggest * 2 ** K + sum(A, B, C) - biggest)

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

biggest = max(A, B, C)
print(biggest * 2 ** K + sum([A, B, C]) - biggest)
Buggy code:
N = [int(a) for a in input().split()]
N.sort()
K = int(input())
print(A[0] + A[1] + A[2] * 2 ** K)

Fixed code:
A = [int(a) for a in input().split()]
A.sort()
K = int(input())
print(A[0] + A[1] + A[2] * 2 ** K)
Buggy code:
a,b,c = map(int,input().split())
k = int(input())
ans = max(a,b,c)*(2**(k+1))-(a+b+c)
print(ans)


Fixed code:
a,b,c = map(int,input().split())
k = int(input())
ans = max(a,b,c)*(2**k-1)+(a+b+c)
print(ans)
Buggy code:
A,B,C = map(int,input().split())
K = int(input())
L = max(A,B,C)
if L ==A:
print((A*(2**K))+B+C
elif L ==B:
print(A+(B*(2**K))+C)
else:
print(A+B+(C*(2**K)))

Fixed code:
A,B,C = map(int,input().split())
K = int(input())
L = max(A,B,C)
if L == A:
  print((A*(2**K))+B+C)
elif L == B:
  print(A+(B*(2**K))+C)
else:
  print(A+B+(C*(2**K)))
Buggy code:
a,b,c = map(int,input().split())
k = int(input())
print(max(a,b,c)**k + min(a,b,c) + (a+b+c-max(a,b,c)-min(a,b,c)))

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

Fixed code:
abc = list(map(int, input().split()))
k = int(input())
print(max(abc) * (2 ** k - 1) + sum(abc))
Buggy code:
ABC = list(map(int, input().split()))
K = int(input())
print(max(ABC) * K + (sum(ABC) - max(ABC)))



Fixed code:
ABC = list(map(int, input().split()))
K = int(input())
print(max(ABC) * 2**K + (sum(ABC) - max(ABC)))
Buggy code:
a,b,c = map(int,input().split())
k = int(input())
x = map(a,b,c)
print(x*(2**k) + a + b + c - x)

Fixed code:
a,b,c = map(int,input().split())
k = int(input())
x = max(a,b,c)
print(x*(2**k) + a + b + c - x)
Buggy code:
x = list(map(int,input().split( )))
y = int(input())
xx = sorted(x)
xx[2] == xx[2]*2**y
ans = sum(xx)
print(ans)

Fixed code:
x = list(map(int,input().split( )))
y = int(input())
xx = sorted(x)
xx[2] *= 2**y
ans = sum(xx)
print(ans)
Buggy code:
A, B, C = map(int, input().split())
K = int(input())
print(max(A, B, C)**(2*K)+B+C)

Fixed code:
A, B, C = map(int, input().split())
K = int(input())
print(max(A, B, C)*(2**K)+A+B+C-max(A, B, C))
Buggy code:
# ABC096B

def f(a, b, c, k):
    abc = sorted([a, b, c])
    if k != 0:
        abc[2] *= 2 * k
    print(sum(abc))

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

Fixed code:
def f(a, b, c, k):
    abc = sorted([a, b, c])
    if k != 0:
        abc[2] *= 2 ** k
    print(sum(abc))

a, b, c = map(int, input().split())
k = int(input())
f(a, b, c, k)
Buggy code:
a, b, c = map(int, input().split(' '))
N = int(input())
max_ = max([a, b, c]
print(a+b+c+max_**N-max_)

Fixed code:
a, b, c = list(map(int, input().split(' ')))
N = int(input())
max_ = max([a, b, c])
print(a+b+c+max_*(2**N)-max_)
Buggy code:
List = sorted([int(i) for i in input().split(" ")],reversed=True)
K = int(input())
List[0] = List[0]*(2**K)
print(sum(List))
 

Fixed code:
List = sorted([int(i) for i in input().split(" ")],reverse=True)
K = int(input())
List[0] = List[0]*(2**K)
print(sum(List))
Buggy code:
a=list(map(int,input().split()))
a.sort()
print(a[0]+a[1]+a[2]*2)

Fixed code:
a=list(map(int,input().split()))
b=int(input())
a.sort()
print(a[0]+a[1]+(a[2]*(2**b)))
Buggy code:
a,b,c=map(int,input().split())
print(max(a,b,c)*(2**int(input())+a+b+c-max(a,b,c)))

Fixed code:
a,b,c=map(int,input().split())
print(max(a,b,c)*(2**int(input()))+a+b+c-max(a,b,c))
Buggy code:
a = list(map(int, input().split()))
k = int(input())
m = max(a)
print(m**k + sum(a) - m)

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

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

m = max(a, b, c)
print(a + b + c - m + m * 2 ** k)
Buggy code:
import sys
input = sys.stdin.readline
li = [int(i) for i in input().split()]
K = int(input())
li.sort()
ans = 0
li[-1] *= K
for i in range(3) :
    ans += li[i]
print(ans)

Fixed code:
import sys
input = sys.stdin.readline
li = [int(i) for i in input().split()]
K = int(input())
li.sort()
ans = 0
li[-1] *= 2 **K
for i in range(3) :
    ans += li[i]
print(ans)
Buggy code:
a = list(map(int, input().split()))
k = int(input())

a.sort()
print(a[2] ** k + a[1] + a[0])


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

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

Fixed code:
a, b, c = map(int, input().split())
k = int(input())
print(a + b + c + max((a, b, c)) * (2 ** k)  - max((a, b, c)))
Buggy code:
L = list(map(int,input().split()))
K = int(input())
m = max(L)
print(L-m + m* (2 ** k))


Fixed code:
L = list(map(int,input().split()))
K = int(input())
m = max(L)
print(sum(L)-m + m* (2 ** K))
Buggy code:
a,b,c=map(int,input().split())

x=max(a,b,c)

print((a+b+c)-x+x*(2**k))

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

x=max(a,b,c)

print((a+b+c)-x+x*(2**k))
Buggy code:
ABC = sorted(map(int, input().split()))
K = int(input())

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


Fixed code:
ABC = sorted(map(int, input().split()))
K = int(input())
print(ABC[0]+ABC[1]+(2**K)*ABC[2])
Buggy code:
a=input().split()
b=input()
c=[int(i) for i in a]
d=0
for j in c:
  d+=j
d=d-max(c)
d=d+(max(c))*(2**b)

Fixed code:
a=input().split()
b=int(input())
c=[int(i) for i in a]
d=0
for j in c:
  d+=j
d=d-max(c)
d=d+(max(c))*(2**b)
print(d)
Buggy code:
n = int(input())
a = list(map(int, input().split()))

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) += 1

count = 0
# count += count_list.get(0, 0) * (count_list.get(0, 0)+1) // 2
for i in count_list.keys():
  count+= count_list[i] * count_list.get(-i, 0)
print((count + count_list.get(0, 0))//2)

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

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) + 1

count = 0
count += count_list.get(0, 0) * (count_list.get(0, 0)+1)
for i in count_list.keys():
  if i!=0:
    #count+= count_list[i] * count_list.get(-i, 0)
    count += count_list[i] * (count_list[i]-1)
print(count//2)
Buggy code:
from collections import Counter
from math import factorial


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

s = [0]
s_elem = 0

for ai in a:
  
  s_elem += ai
  s.append(s_elem)

ans = 0
for c in Counter(s).values():
  if c > 1:
    ans += i*(i-1)//2
    
print(ans)

Fixed code:
from collections import Counter
from math import factorial


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

s = [0]
s_elem = 0

for ai in a:
  
  s_elem += ai
  s.append(s_elem)

ans = 0
for c in Counter(s).values():
  ans += c*(c-1)//2
    
print(ans)
Buggy code:
from math import factorial
import sys
input = sys.stdin.readline
def ncr(n,r):
 if n <= 1:
  return 0
 else:
  return  factorial(n) / factorial(r) / factorial(n - r)

n= int(input())
a = list(int(i) for i in input().split())
s = [0]
for i in range(n):
  s.append(s[i]+a[i])
s = sorted(s,reverse =True)
ans = 0
for i in range(n):
  tmp = 0
  if s[i] == s[i+1]:
    tmp += 1
  else:
   ans += ncr(tmp,2)
ans += ncr(tmp,2)
print(int(ans))


Fixed code:
from math import factorial
import sys
input = sys.stdin.readline
def ncr(n):
 if n <= 1:
  return 0
 elif n == 2:
  return 1
 else:
  return  (factorial(n) // 2) // factorial(n - 2)

n= int(input())
a = list(int(i) for i in input().split())
s = [0]
for i in range(n):
  s.append(s[i]+a[i])
s = sorted(s,reverse =True)
ans = 0
tmp = 1
for i in range(len(s)-1):
  if s[i] == s[i+1]:
   tmp += 1
  else:
   ans += ncr(tmp)
   tmp = 1
ans += ncr(tmp)
print(ans)
Buggy code:
n = int(input())
a = [int(i) for i in input().split()]
s = [0] * (n+1)
ans = 0
for i in range(n):
    s[i+1] = s[i] + a[i]
c = Counter(s)
for i in c:
    ans += int(c[i]*(c[i]-1)//2)
print(ans)


Fixed code:
from collections import Counter

n = int(input())
a = [int(i) for i in input().split()]
s = [0] * (n+1)
ans = 0
for i in range(n):
    s[i+1] = s[i] + a[i]
c = Counter(s)
for i in c:
    ans += int(c[i]*(c[i]-1)//2)
print(ans)
Buggy code:
n = int(input()) 
a = [int(i) for i in input().split()]
d = dict()
d[0] = 1
ans = 0
t = 0
for i in range(n):
    t += a[i]

    s = d.get(t,0)
    ans += s 
    d[t] = s+1

Fixed code:
n = int(input()) 
a = [int(i) for i in input().split()]
d = dict()
d[0] = 1
ans = 0
t = 0
for i in range(n):
    t += a[i]

    s = d.get(t,0)
    ans += s 
    d[t] = s+1
    
print(ans)
Buggy code:
import numpy as np
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    ruiseki = [0,a[0]]
    ans = 0
    for i in range(n-1):
        ruiseki.append(ruiseki[i]+a[i+1])
        if ruiseki[i]+a[i+1] == 0:
            ans += 1
    c = collections.Counter(ruiseki).values()
    for i in c:
        ans += i*(i-1)//2
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Fixed code:
import numpy as np
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    ruiseki = [0]
    ans = 0
    for i in range(n):
        ruiseki.append(ruiseki[i]+a[i])
    c = collections.Counter(ruiseki).values()
    for i in c:
        ans += i*(i-1)//2
    print(ans)
    return 0

if __name__ == "__main__":
    solve()