ZhenlongDai/ACPR huggingface dataset:
Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C = map(int,input().split())
K = int(input())
D = max([A,B,C]) * 2 * K
ans = A + B + C + D - max([A,B,C])
print(ans)

Failing test case input:
0 0 1
0

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
A,B,C = map(int,input().split())
K = int(input())
D = max([A,B,C]) * 2 ** K
ans = A + B + C + D - max([A,B,C])
print(ans)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = [int(i) for i in input().split()]
k = int(input())
print(max(a)*2*k+sum(a)-max(a))


Failing test case input:
15 1 1
3

Expected output:
122


Actual output:
92


Fixed submission (verdict: Accepted):
a = [int(i) for i in input().split()]
k = int(input())
print(max(a)*(2**k)+sum(a)-max(a))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
abc = list(map(int, input().split()))
abc.sort
k = int(input())
print(abc[-1] * 2 ** k + abc[0] + abc[1]) 


Failing test case input:
23 1 -1
1

Expected output:
46


Actual output:
22


Fixed submission (verdict: Accepted):
abc = list(map(int, input().split()))
abc.sort()
k = int(input())
print(abc[-1] * 2 ** k + abc[0] + abc[1])

Problem: p03360
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
l = list(map(int, input().split()))
k = int(input())
ans = sum(l) + max(l)*2**(k-1)
print(ans)

Failing test case input:
7 3 3
4

Expected output:
118


Actual output:
69


Fixed submission (verdict: Accepted):
l = list(map(int, input().split()))
k = int(input())
ans = sum(l) - max(l) + max(l)*2**k
print(ans)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l = list(map(int,input().split()))
k = int(input())
L = sorted(l,reverse = True)
print(L[0]*(k**2)+L[1]+L[2])

Failing test case input:
-1 4 1
7

Expected output:
512


Actual output:
196


Fixed submission (verdict: Accepted):
l = list(map(int,input().split()))
k = int(input())
L = sorted(l,reverse = True)
print(L[0]*(2**k)+L[1]+L[2])

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c=map(int,input().split())
k=int(input())
s=0
if a<=b:
    if b<=c:
        s=c*2*k+a+b
    else:
        s=b*2*k+a+c

if b<=a:
    if a<=c:
        s=c*2*k+a+b
    else:
        s=a*2*k+b+c

if c<=a:
    if a<=b:
        s=b*2*k+a+c
    else:
        s=a*2*k+b+c
print(s)

Failing test case input:
7 6 11
0

Expected output:
24


Actual output:
13


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
k=int(input())
s=0
if a<=b:
    if b<=c:
        s=c*2**k+a+b
    else:
        s=b*2**k+a+c

if b<=a:
    if a<=c:
        s=c*2**k+a+b
    else:
        s=a*2**k+b+c

if c<=a:
    if a<=b:
        s=b*2**k+a+c
    else:
        s=a*2**k+b+c
print(s)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = [int(i) for i in input().split()]
K = int(input())

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



Failing test case input:
15 1 1
3

Expected output:
122


Actual output:
92


Fixed submission (verdict: Accepted):
a = [int(i) for i in input().split()]
K = int(input())

a.sort()
print(a[2] * (2 ** K) + a[0] + a[1])
Problem: p03360
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = list(map(int, input().split()))
k = int(input())

lst = sorted(n, reverse=True)
lst2 = lst[0]*2*k+sum(lst[1::])
print(lst2)

Failing test case input:
7 3 3
4

Expected output:
118


Actual output:
62


Fixed submission (verdict: Accepted):
n = list(map(int, input().split()))
k = int(input())
lst = sorted(n, reverse=True)
ans = lst[0]*2**k+sum(lst[1::])
print(ans)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = sorted(list(map(int, input().split())))
k = int(input())
a[-1] = 2*k*a[-1]
print(sum(a))


Failing test case input:
7 5 11
0

Expected output:
23


Actual output:
12


Fixed submission (verdict: Accepted):
a = sorted(list(map(int, input().split())))
k = int(input())
a[-1] = 2**k*a[-1]
print(sum(a))

Problem: p03360
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a = [int(i) for i in input().split()]
k = int(input())
mx = max(a)
sm = (sum(a)-mx) + mx*(2*k)
print(sm)

Failing test case input:
15 0 1
3

Expected output:
121


Actual output:
91


Fixed submission (verdict: Accepted):
a = [int(i) for i in input().split()]
k = int(input())
mx = max(a)
sm = (sum(a)-mx) + mx*(2**k)
print(sm)

Problem: p03360
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a = list(map(int,input().split()))
K = int(input())
m = max(a)
a.remove(max(a))
print(sum(a)+m*2*K)


Failing test case input:
42 4 8
4

Expected output:
684


Actual output:
348


Fixed submission (verdict: Accepted):
a = list(map(int,input().split()))
K = int(input())
m = max(a)
a.remove(max(a))
print(sum(a)+m*2**K)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
3 4 8
0

Expected output:
15


Actual output:
7


Fixed submission (verdict: Accepted):
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)

Problem: p03360
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=list(map(int,input().split()))
b=int(input())
a.sort()
print(a[0]+a[1]+(a[2]*2)*b)

Failing test case input:
4 3 1
0

Expected output:
8


Actual output:
4


Fixed submission (verdict: Accepted):
a=list(map(int,input().split()))
b=int(input())
a.sort()
print(a[0]+a[1]+(a[2]*(2**b)))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
l = list(map(int, input().split()))
K = int(input())
print(sum(l)+(max(l))*2**(K-1))


Failing test case input:
5 8 2
5

Expected output:
263


Actual output:
143


Fixed submission (verdict: Accepted):


import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
l = list(map(int, input().split()))
K = int(input())
ans = sum(l)-max(l)
ans += max(l)*(2**K)
print(ans)
Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
li = list(map(int, input().split()))
K = int(input())

li.sort
print (li[0] + li[1] + li[2] * (2 ** K))


Failing test case input:
42 4 6
5

Expected output:
1354


Actual output:
238


Fixed submission (verdict: Accepted):
li = list(map(int, input().split()))
K = int(input())

print (li[0] + li[1] + li[2] + max(li) * (2 ** K - 1))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def resolve():
    a = list(map(int, input().split()))
    K = int(input())
    print(sum(a)-max(a)+max(a)*2*K)
resolve()

Failing test case input:
42 4 8
4

Expected output:
684


Actual output:
348


Fixed submission (verdict: Accepted):
def resolve():
    a = list(map(int, input().split()))
    K = int(input())
    print(sum(a)-max(a)+max(a)*(2**K))
resolve()

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

mx = max(a,b,c)
lis = [a,b,c]
lis.remove(mx)


print(mx*2*k+sum(lis))



Failing test case input:
10 5 11
0

Expected output:
26


Actual output:
15


Fixed submission (verdict: Accepted):


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

mx = max(a,b,c)
lis = [a,b,c]
lis.remove(mx)


print(mx*2**k+sum(lis))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C = map(int, input().split())
K = int(input())
max_v = max(A, B, C)
print(A+B+C - max_v + max_v * 2 * K)

Failing test case input:
3 4 8
0

Expected output:
15


Actual output:
7


Fixed submission (verdict: Accepted):
A, B, C = map(int, input().split())
K = int(input())
max_v = max(A, B, C)
print(A+B+C - max_v + max_v * 2 ** K)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=list(map(int,input().split()))
k=int(input())
ans=0

ans=sum(a)-max(a)
print(max(a)*2*k+ans)

Failing test case input:
5 2 -1
4

Expected output:
81


Actual output:
41


Fixed submission (verdict: Accepted):
num=list(map(int,input().split()))
k=int(input())
ans1=sum(num)-max(num)
print(2**k*max(num)+ans1)

Problem: p03360
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A, B, C = sorted(map(int, input().split()))
K = int(input())

print(A + B + C*2*K)

Failing test case input:
3 3 4
4

Expected output:
70


Actual output:
38


Fixed submission (verdict: Accepted):
A, B, C = sorted(map(int, input().split()))
K = int(input())

print(A + B + C*2**K)

Problem: p03360
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=list(map(int,input().split()))
k=int(input())
s.sort()
m=1
m *= s[2]*(k+1)
print(m+s[0]+s[1])

Failing test case input:
5 4 2
5

Expected output:
166


Actual output:
36


Fixed submission (verdict: Accepted):
s=list(map(int,input().split()))
k=int(input())
s.sort()
m=1
m *= (s[2]*(2**k))
print(m+s[0]+s[1])
Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=list(map(int,input().split()))
k=int(input())
b=[0,0,0]
n=1

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


print(sum(a))

Failing test case input:
3 3 4
2

Expected output:
22

Actual output:
10


Fixed submission (verdict: Accepted):
a=list(map(int,input().split()))
k=int(input())
b=[0,0,0]
n=1

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


print(sum(a))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c = map(int, input().split())
k = int(input())
d = max([a, b, c])
print(a+b+c-d+d*2*k)

Failing test case input:
5 4 2
5

Expected output:
166


Actual output:
56


Fixed submission (verdict: Accepted):
a, b, c = map(int, input().split())
k = int(input())
d = max([a, b, c])
print(a+b+c-d+d*2**k)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
77 1 -3
2

Expected output:
306


Actual output:
229


Fixed submission (verdict: Accepted):
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)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C = map(int,input().split())
K = int(input())
L = max(A,B,C)
if L == A:
  print((A*(2**K))+B+C)
if L == B:
  print(A+(B*(2**K))+C)
else:
  print(A+B+(C*(2**K)))

Failing test case input:
42 4 21
2

Expected output:
193


Actual output:
193
130


Fixed submission (verdict: Accepted):
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)))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c = [int(i) for i in input().split()]
k = int(input())

l = sorted([a, b, c])
print(l[-1] * k * 2 + l[0] + l[1])

Failing test case input:
7 3 3
4

Expected output:
118


Actual output:
62


Fixed submission (verdict: Accepted):
a, b, c = [int(i) for i in input().split()]
k = int(input())

l = sorted([a, b, c])
print(l[-1] * (2 ** k) + l[0] + l[1])

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l=list(map(int,input().split()))
k=int(input())
print(max(l)*2*k+sum(l)-max(l))


Failing test case input:
5 4 11
4

Expected output:
185


Actual output:
97


Fixed submission (verdict: Accepted):
l=list(map(int,input().split()))
k=int(input())
print(max(l)*2**k+sum(l)-max(l))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C = map(int, input().split())
K = int(input())
max_ = max(A, B, C)

print(max_*2*K + A + B + C - max_)

Failing test case input:
6 5 56
0

Expected output:
67


Actual output:
11


Fixed submission (verdict: Accepted):
A, B, C = map(int, input().split())
K = int(input())
max_ = max(A, B, C)

print(max_*2**K + A + B + C - max_)
Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
list = list(map(int, input().split()))
k = int(input())

print(max(list)*(2*k)+sum(list)-max(list))

Failing test case input:
6 5 56
0

Expected output:
67


Actual output:
11


Fixed submission (verdict: Accepted):
list = list(map(int, input().split()))
k = int(input())

print(max(list)*(2**k)+sum(list)-max(list))

Problem: p03360
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
num = list(map(int, input().split()))
k = int(input())
num = sorted(num)
print(num[0] + num[1] + num[2] * 2 * k)

Failing test case input:
7 3 2
4

Expected output:
117


Actual output:
61


Fixed submission (verdict: Accepted):
num = list(map(int, input().split()))
k = int(input())
num = sorted(num)
print(num[0] + num[1] + num[2] * (2 ** k))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c=map(int,input().split())
k=int(input())

kazu=[a,b,c]
kazu.sort()

print(a+b+kazu[2]*2**k)

Failing test case input:
42 1 -1
1

Expected output:
84


Actual output:
127


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
k=int(input())

kazu=[a,b,c]
kazu.sort()

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

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
li = list(map(int,input().split()))
n=int(input())
print(max(li)*(2*n-1)+sum(li))

Failing test case input:
10 5 21
0

Expected output:
36


Actual output:
15


Fixed submission (verdict: Accepted):
li = list(map(int,input().split()))
n=int(input())
print(max(li)*(2**n-1)+sum(li))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=list(map(int,input().split()))
a.sort()
k=int(input())
print(a[0]+a[1]+a[2]*k)

Failing test case input:
7 1 3
1

Expected output:
18


Actual output:
11


Fixed submission (verdict: Accepted):
a=list(map(int,input().split()))
a.sort()
k=int(input())
print(a[0]+a[1]+a[2]*(2**k))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

D = [a,b,c]
D.sort()
ans = D[0] + D[1] + D[2] * 2 * k
print(ans)


Failing test case input:
4 3 1
0

Expected output:
8


Actual output:
4


Fixed submission (verdict: Accepted):

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



D = [a,b,c]
D.sort()
ans = D[0] + D[1] + D[2] * 2 ** k
print(ans)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main(a, b, c, k):
  abc = [a, b, c]
  abc.sort
  abc[-1] *= 2**k
  print(sum(abc))









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


Failing test case input:
23 4 21
1

Expected output:
71


Actual output:
69


Fixed submission (verdict: Accepted):
def main(a, b, c, k):
  abc = sorted([a, b, c])
  abc[-1] *= 2**k
  print(sum(abc))









a, b, c = [int(i) for i in input().split()]
k = int(input())
main(a, b, c, k)
Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C = map(int, input().split())
K = int(input())

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


Failing test case input:
5 8 2
5

Expected output:
263


Actual output:
87


Fixed submission (verdict: Accepted):
A, B, C = map(int, input().split())
K = int(input())

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

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
abc = list(map(int, input().split()))
k = int(input())

x = max(abc)
total = sum(abc) - x + (x * (2 * k))

print(total)


Failing test case input:
0 0 1
0

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
abc = list(map(int, input().split()))
k = int(input())

x = max(abc)
total = sum(abc) - x + (x * (2 ** k))

print(total)

Problem: p03360
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A = list(map(int,input().split()))
K = int(input())
N = sorted(A)[-1]
print(sorted(A)[0] + sorted(A)[1] +N*2*K)

Failing test case input:
3 1 1
0

Expected output:
5


Actual output:
2


Fixed submission (verdict: Accepted):
A = list(map(int,input().split()))
K = int(input())
N = sorted(A)[-1]
print(sorted(A)[0] + sorted(A)[1] +N*2**K)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l = list(map(int, input().split()))
k = int(input())
MAX = max(l)
print(sum(l) + MAX * k)
        

Failing test case input:
3 8 3
4

Expected output:
134


Actual output:
46


Fixed submission (verdict: Accepted):
l = list(map(int, input().split()))
k = int(input())
MAX = max(l)
print(sum(l) + MAX * 2 ** k - MAX)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
L=list(map(int,input().split()))
K=int(input())
N=sorted(L)
print(N[0]+N[1]+N[2]*2*K)

Failing test case input:
5 -3 1
0

Expected output:
3


Actual output:
-2


Fixed submission (verdict: Accepted):
L=list(map(int,input().split()))
K=int(input())
N=sorted(L)
print(N[0]+N[1]+N[2]*(2**K))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l=sorted(list(map(int, input().split())))
k=int(input())
print(l[0]+l[1]+l[2]*2*k)

Failing test case input:
3 8 3
4

Expected output:
134


Actual output:
70


Fixed submission (verdict: Accepted):
l=sorted(list(map(int, input().split())))
k=int(input())
print(l[0]+l[1]+l[2]*2**k)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c=map(int,input().split())
print(max(a,b,c)*(2**int(input())+a+b+c-max(a,b,c)))

Failing test case input:
5 3 2
4

Expected output:
85


Actual output:
105


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
print(max(a,b,c)*(2**int(input()))+a+b+c-max(a,b,c))

Problem: p03360
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c=map(int,input().split())
k=int(input())
d=max(a,b,c)
print(a+b+c-d+2*k*d)

Failing test case input:
5 3 4
4

Expected output:
87


Actual output:
47


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
k=int(input())
d=max(a,b,c)
print(a+b+c-d+d*2**k)
Problem: p03360
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = [int(x) for x in input().split()]
k = int(input())
print(sum(a) + max(a) * (2 ** (k - 1)))

Failing test case input:
42 4 21
2

Expected output:
193


Actual output:
151


Fixed submission (verdict: Accepted):
a = [int(x) for x in input().split()]
k = int(input())
print(sum(a) - max(a) + max(a) * (2 ** k))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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))

Failing test case input:
5 4 2
5

Expected output:
166


Actual output:
56


Fixed submission (verdict: Accepted):
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))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


def main():
    blackboard_list = list(map(int, input().split()))
    K = int(input())

    blackboard_list[blackboard_list.index(max(blackboard_list))] = max(blackboard_list) * 2 * K
    print(sum(blackboard_list))

if __name__ == '__main__':
    main()

Failing test case input:
5 3 2
4

Expected output:
85


Actual output:
45


Fixed submission (verdict: Accepted):


def main():
    blackboard_list = list(map(int, input().split()))
    K = int(input())

    blackboard_list[blackboard_list.index(max(blackboard_list))] = max(blackboard_list) * 2 ** K
    print(sum(blackboard_list))

if __name__ == '__main__':
    main()

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,k=map(int,open(0).read().split())
max_val=max([a,b,c])
print(sum([a,b,c])-max_val+max_val*(2*k))

Failing test case input:
12 10 25
0

Expected output:
47


Actual output:
22


Fixed submission (verdict: Accepted):
a,b,c,k=map(int,open(0).read().split())

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

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
xs = [int(i) for i in input().split()]
k = int(input())

x = max(xs)
ans = x * (2*k) + sum(xs) - x

print(ans)


Failing test case input:
7 7 23
0

Expected output:
37


Actual output:
14


Fixed submission (verdict: Accepted):
xs = [int(i) for i in input().split()]
k = int(input())

x = max(xs)
ans = x * (2**k) + sum(xs) - x

print(ans)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = list(map(int, input().split()))
K = int(input())
print(sum(X) + max(X)*2**(K-1))

Failing test case input:
5 3 11
4

Expected output:
184


Actual output:
107


Fixed submission (verdict: Accepted):
X = list(map(int, input().split()))
K = int(input())
print(sum(X) + max(X)*(2**K-1))
Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

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

Failing test case input:
10 5 25
0

Expected output:
40


Actual output:
15


Fixed submission (verdict: Accepted):
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

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

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
A,B,C=[int(x) for x in stdin.readline().rstrip().split()]
K=int(stdin.readline().rstrip())
data=[A,B,C]
data=sorted(data)
data[-1]=data[-1]*2*K
print(sum(data))

Failing test case input:
6 3 41
0

Expected output:
50


Actual output:
9


Fixed submission (verdict: Accepted):
from sys import stdin
A,B,C=[int(x) for x in stdin.readline().rstrip().split()]
K=int(stdin.readline().rstrip())
data=[A,B,C]
data=sorted(data)
data[-1]=data[-1]*(2**K)
print(sum(data))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

li = na()
k = ni()
print(sum(li) - max(li) + max(li) * 2 * k)



Failing test case input:
3 4 8
0

Expected output:
15


Actual output:
7


Fixed submission (verdict: Accepted):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

li = na()
k = ni()
print(sum(li) - max(li) + max(li) * (2 ** k))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l = list(map(int,input().split()))
k = int(input())
L = sorted(l,reverse = True)
print(L[0]*k*2+L[1]+L[2])

Failing test case input:
7 7 11
0

Expected output:
25


Actual output:
14


Fixed submission (verdict: Accepted):
l = list(map(int,input().split()))
k = int(input())
L = sorted(l,reverse = True)
print(L[0]*(2**k)+L[1]+L[2])

Problem: p03360
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
ABC = sorted(map(int, input().split()))
K = int(input())

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


Failing test case input:
4 1 1
0

Expected output:
6


Actual output:
2


Fixed submission (verdict: Accepted):
ABC = sorted(map(int, input().split()))
K = int(input())

print(ABC[0] + ABC[1] + ABC[2] * 2**K)
Problem: p03360
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
ABC = sorted(map(int, input().split()))
K = int(input())

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


Failing test case input:
-2 4 1
7

Expected output:
511


Actual output:
55


Fixed submission (verdict: Accepted):
ABC = sorted(map(int, input().split()))
K = int(input())

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

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C = map(int, input().split())
K = int(input())
print(max(A, B, C)*(2**K)+B+C)

Failing test case input:
3 5 5
0

Expected output:
13


Actual output:
15


Fixed submission (verdict: Accepted):
A, B, C = map(int, input().split())
K = int(input())
print(max(A, B, C)*(2**K)+A+B+C-max(A, B, C))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c=map(int,input().split()) 
k=int(input()) 
print((max([a,b,c]))*(2*k-1)+sum([a,b,c])) 

Failing test case input:
3 3 4
0

Expected output:
10


Actual output:
6


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
k=int(input())
print((max([a,b,c]))*(2**k-1)+sum([a,b,c]))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C = map(int, input().rstrip().split())
K = int(input())
print(2*(K-1)*max(A,B,C)+A+B+C)

Failing test case input:
-2 4 1
7

Expected output:
511


Actual output:
51


Fixed submission (verdict: Accepted):
A, B, C = map(int, input().rstrip().split())
K = int(input())
print(2**K*max(A,B,C)+A+B+C-max(A,B,C))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c=map(int,input().split())
k=int(input())

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

Failing test case input:
7 3 11
1

Expected output:
32


Actual output:
21


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
k=int(input())
m=max(a,b,c)

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

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A=sorted(list(map(int,input().split())))
print(A[-1]*2*int(input())+A[0]+A[1])

Failing test case input:
5 2 0
4

Expected output:
82


Actual output:
42


Fixed submission (verdict: Accepted):
A=sorted(list(map(int,input().split())))
print(A[-1]*2**int(input())+A[0]+A[1])

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

a.sort(reverse=True)
a[0] = a[0]*2*k

print(sum(a))

Failing test case input:
5 2 -1
4

Expected output:
81


Actual output:
41


Fixed submission (verdict: Accepted):

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

a.sort(reverse=True)
a[0] = a[0]*2**k

print(sum(a))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a= list(map(int, input().split()))
K = int(input())
a.sort()
print(a[2] * 2 * K + a[1] + a[0])

Failing test case input:
42 4 6
5

Expected output:
1354


Actual output:
430


Fixed submission (verdict: Accepted):
a= list(map(int, input().split()))
K = int(input())
a.sort()
print(a[2] * (2 ** K ) + a[1] + a[0])
Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C = map(int, input().split())
K = int(input())

M = max(A, B, C)

SUM = M*(2**K)

if M == A:
	SUM+=(B+C)

if M == B:
	SUM+=(A+C)

if M == C:
	SUM+=(A+B)

print(SUM)


Failing test case input:
4 3 4
0

Expected output:
11


Actual output:
18


Fixed submission (verdict: Accepted):
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)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=list(map(int,input().split()))
K=int(input())
NN = sorted(N, reverse=True)
M = NN[0]
print(M * 2 * K + sum(NN[1:])) 


Failing test case input:
42 6 6
5

Expected output:
1356


Actual output:
432


Fixed submission (verdict: Accepted):
N=list(map(int,input().split()))
K=int(input())
NN = sorted(N, reverse=True)

print(NN[0] * 2 ** K + sum(NN[1:]))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C = map(int, input().rstrip().split())
K = int(input())
print(2*K*max(A,B,C)+A+B+C-max(A,B,C))

Failing test case input:
4 1 1
0

Expected output:
6


Actual output:
2


Fixed submission (verdict: Accepted):
A, B, C = map(int, input().rstrip().split())
K = int(input())
print(2**K*max(A,B,C)+A+B+C-max(A,B,C))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A = [int(i) for i in input().split()]
n = int(input())
print(max(A)*2**n)

Failing test case input:
7 5 11
1

Expected output:
34


Actual output:
22


Fixed submission (verdict: Accepted):
A = sorted([int(i) for i in input().split()])

n = int(input())

m = A.pop()
print(sum([m*2**n]+A))

Problem: p03360
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
MM = input().split()
A = int(MM[0])
B = int(MM[1])
C = int(MM[2])
K = int(input())
S = [A,B,C]
S.sort()
S[-1] = S[-1] * 2 *K
total =0
for i in S:
  total += i
print(total)
  

Failing test case input:
7 7 23
0

Expected output:
37


Actual output:
14


Fixed submission (verdict: Accepted):
MM = input().split()
A = int(MM[0])
B = int(MM[1])
C = int(MM[2])
K = int(input())
S = [A,B,C]
S.sort()

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

total =0
for i in S:
  total += i
print(total)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=list(sorted(map(int,input().split())))
k=int(input())
print(sum(a)+a[-1]**2*(k-1)-a[-1])

Failing test case input:
7 1 3
4

Expected output:
116


Actual output:
151


Fixed submission (verdict: Accepted):
a=list(sorted(map(int,input().split())))
k=int(input())
print(sum(a)+a[-1]*2**k-a[-1])

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
L = list(map(int, input().split()))
K = int(input())

L.sort()

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

Failing test case input:
42 4 6
4

Expected output:
682


Actual output:
220


Fixed submission (verdict: Accepted):
L = list(map(int, input().split()))
K = int(input())

L.sort()

print(sum(L) + L[len(L) - 1] * (2 ** K - 1))
Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main() -> None:
    A, B, C = map(int, input().split())
    K = int(input())
    m = [A, B, C]
    m.sort(reverse=True)
    ans = sum(m[:1] * 2) * K + sum(m[1:])
    print(ans)


if __name__ == '__main__':
    main()


Failing test case input:
12 10 25
0

Expected output:
47


Actual output:
22


Fixed submission (verdict: Accepted):
def main() -> None:
    A, B, C = map(int, input().split())
    K = int(input())
    m = [A, B, C]
    m.sort(reverse=True)
    ans = m[0] * (2 ** K)
    ans += sum(m[1:])
    print(ans)


if __name__ == '__main__':
    main()

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=list(map(int,input().split()))
n=int(input())
x=max(a)*2**n
print(x+sum(a)-max(a)*2)

Failing test case input:
8 0 1
1

Expected output:
17


Actual output:
9


Fixed submission (verdict: Accepted):
a=list(map(int,input().split()))
n=int(input())
x=max(a)*(2**n)
print(x+sum(a)-max(a))

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

input = sys.stdin.readline


def main():
    v = sorted(map(int, input().split()))
    k = int(input())
    print(sum(v[:-1]) + v[-1] * 2 * k)


if __name__ == "__main__":
    main()


Failing test case input:
4 6 17
0

Expected output:
27


Actual output:
10


Fixed submission (verdict: Accepted):
import sys

input = sys.stdin.readline


def main():
    v = sorted(map(int, input().split()))
    k = int(input())
    print(sum(v[:-1]) + v[-1] * 2 ** k)


if __name__ == "__main__":
    main()

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c=map(int,input().split())
k=int(input())
t=max(a,b,c)
print(a+b+c+(t*2*k)-t)

Failing test case input:
-2 4 1
7

Expected output:
511


Actual output:
55


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
k=int(input())
t=max(a,b,c)
print(a+b+c+(t*2**k)-t)

Problem: p03360
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c=map(int,input().split())
k = int(input())
max_num = max(max(a,b),c)
print(a+b+c+max_num*2*k-max_num)

Failing test case input:
-1 0 0
-1

Expected output:
-1.0


Actual output:
-1


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
k = int(input())
max_num = max(max(a,b),c)
print(a+b+c+max_num*2**k-max_num)
Problem: p00107
Buggy submission (Python3, verdict: Wrong Answer):
import math
while True:
	d,w,h = map(int,input().split())
	if d == 0:
		break
	n = int(input())
	dist = [d**2+w**2, d**2+h**2, w**2+h**2]
	leng = min(dist)
	for i in range(n):
		if int(input())-leng > 0:
			print('OK')
		else:
			print('NA')

Failing test case input:
14 6 5
5
4
0
-2
8
11
0 0 0

Expected output:
OK
NA
NA
OK
OK


Actual output:
NA
NA
NA
NA
NA


Fixed submission (verdict: Accepted):
import math
while True:
	d,w,h = map(int,input().split())
	if d == 0:
		break
	n = int(input())
	dist = [math.sqrt(d**2+w**2), math.sqrt(d**2+h**2), math.sqrt(w**2+h**2)]
	leng = min(dist)
	for i in range(n):
		if 2*int(input())-leng > 0:
			print('OK')
		else:
			print('NA')

Problem: p00107
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    d, w, h = [int(x) for x in input().split()]
    minrad = min(d*d+w*w,w*w+h*h,h*h+d*d)
    if minrad == 0:
        break
    n = int(input())
    for i in range(n):
        r = int(input())
        if 2*r*r > minrad:
            print('OK')
        else:
            print('NA')

Failing test case input:
13 6 8
5
3
0
0
3
7
0 0 0

Expected output:
NA
NA
NA
NA
OK


Actual output:
NA
NA
NA
NA
NA


Fixed submission (verdict: Accepted):
while True:
    d, w, h = [int(x) for x in input().split()]
    minrad = min(d*d+w*w,w*w+h*h,h*h+d*d)
    if minrad == 0:
        break
    n = int(input())
    for i in range(n):
        r = int(input())
        if 4*r*r > minrad:
            print('OK')
        else:
            print('NA')

Problem: p00107
Buggy submission (Python3, verdict: Wrong Answer):
import math
while True:
	d,w,h = map(int,input().split())
	if d == 0:
		break
	n = int(input())
	dist = [d**2+w**2, d**2+h**2, w**2+h**2]
	leng = min(dist)
	for i in range(n):
		if leng-int(input()) > 0:
			print('OK')
		else:
			print('NA')

Failing test case input:
10 6 8
5
4
0
0
3
5
0 0 0

Expected output:
NA
NA
NA
NA
NA


Actual output:
OK
OK
OK
OK
OK


Fixed submission (verdict: Accepted):
import math
while True:
	d,w,h = map(int,input().split())
	if d == 0:
		break
	n = int(input())
	dist = [math.sqrt(d**2+w**2), math.sqrt(d**2+h**2), math.sqrt(w**2+h**2)]
	leng = min(dist)
	for i in range(n):
		if 2*int(input())-leng > 0:
			print('OK')
		else:
			print('NA')

Problem: p00107
Buggy submission (Python3, verdict: Wrong Answer):
import math
while True:
	d,w,h = map(int,input().split())
	if d == 0:
		break
	n = int(input())
	dist = [math.sqrt(d**2+w**2), math.sqrt(d**2+h**2), math.sqrt(w**2+h**2)]
	leng = min(dist)
	for i in range(n):
		if int(input())-leng > 0:
			print('OK')
		else:
			print('NA')

Failing test case input:
7 6 0
5
4
0
0
2
5
0 0 0

Expected output:
OK
NA
NA
NA
OK


Actual output:
NA
NA
NA
NA
NA


Fixed submission (verdict: Accepted):
import math
while True:
	d,w,h = map(int,input().split())
	if d == 0:
		break
	n = int(input())
	dist = [math.sqrt(d**2+w**2), math.sqrt(d**2+h**2), math.sqrt(w**2+h**2)]
	leng = min(dist)
	for i in range(n):
		if 2*int(input())-leng > 0:
			print('OK')
		else:
			print('NA')
Problem: p00107
Buggy submission (Python3, verdict: Wrong Answer):


import sys


def solve(d, w, h, holes):
    result = []
    
    for r in holes:
        side_max = max(w, h)
        if r*2**0.5 >= side_max:
            result.append('OK')
        else:
            result.append('NA')
    return result


def main(args):
    while True:
        
        
        d, w, h = [int(x) for x in input().split(' ')]
        if d == 0 and w == 0 and h == 0:
            break
        num = int(input())
        holes = [int(input()) for _ in range(num)]
        result = solve(d, w, h, holes)
        for r in result:
            print(r)


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

Failing test case input:
10 6 0
5
4
0
-2
8
11
0 0 0

Expected output:
OK
NA
NA
OK
OK


Actual output:
NA
NA
NA
OK
OK


Fixed submission (verdict: Accepted):


import sys


def solve(d, w, h, holes):
    result = []
    diagonal_len = (w**2 + h**2)**0.5
    for r in holes:
        if r*2 > diagonal_len:
            result.append('OK')
        else:
            result.append('NA')
    
    
    
    
    
    
    
    return result


def main(args):
    while True:
        
        
        d, w, h = [int(x) for x in input().strip().split(' ')]
        if d == 0 and w == 0 and h == 0:
            break
        num = int(input())
        holes = [int(input().strip()) for _ in range(num)]
        result = solve(d, w, h, holes)
        for r in result:
            print(r)


if __name__ == '__main__':
    main(sys.argv[1:])
Problem: p03178
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
k = int(input())
d = int(input())

li = list(map(int,(list(str(k)))))
leng = len(li)
mod = 10**9+7

dp1 = [0 for _ in range(d)]
dp2 = [0 for _ in range(d)]

mm1 = li[0]
for i in range(mm1):
    dp2[i%d] = 1

for i in range(1,leng):
    for j in range(0,10):
        for l in range(d):
            
            dp1[(l+j)%d] = (dp1[(l+j)%d]+dp2[l])%mod

        
        if j<li[i]:
            dp1[(mm1+j)%d] = (dp1[(mm1+j)%d]+1)%mod
    
    

    mm1 = (mm1+li[i])%d
    dp2 = [dp1[i] for i in range(d)]
    dp1 = [0 for _ in range(d)]


print((dp2[0]-1)%mod)   








Failing test case input:
30
1

Expected output:
30


Actual output:
9


Fixed submission (verdict: Accepted):
k = int(input())
d = int(input())

li = list(map(int,(list(str(k)))))
leng = len(li)
mod = 10**9+7

dp1 = [0 for _ in range(d)]
dp2 = [0 for _ in range(d)]

mm1 = li[0]
for i in range(mm1):
    dp2[i%d] += 1

for i in range(1,leng):
    for j in range(0,10):
        for l in range(d):
            
            dp1[(l+j)%d] += dp2[l]
            dp1[(l+j)%d] %= mod

        
        if j<li[i]:
            dp1[(mm1+j)%d] += 1
            dp1[(mm1+j)%d] %= mod
    
    mm1 = (mm1+li[i])%d
    dp2 = [dp1[i] for i in range(d)]
    dp1 = [0 for _ in range(d)]
dp2[sum(li)%d]+=1
print((dp2[0]-1)%mod)

Problem: p03178
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
k=input()
n=len(k)
d=int(input())
mod=10**9+7
dp=[[[0]*2 for _ in range(d)] for i in range(n)]
for num in range(int(k[0])+1):
    if num==int(k[0]):
        dp[0][num%d][0]=1
    else:
        dp[0][num%d][1]=1
for i in range(1,n):
    num=int(k[i])
    for l in range(10):
        for j in range(d):
            if l<num:
                dp[i][(j+l)%d][1]+=dp[i-1][j][0]
            elif l==num:
                dp[i][(j+l)%d][0]+=dp[i-1][j][0]
            dp[i][(j+l)%d][1]+=dp[i-1][j][1]
            dp[i][(j+l)%d][1]%=mod
            dp[i][(j+l)%d][0]%=mod
print(sum(dp[n-1][0])-1)

Failing test case input:
98765432109876543210
6

Expected output:
419788043


Actual output:
419768115


Fixed submission (verdict: Accepted):
k=input()
n=len(k)
d=int(input())
mod=10**9+7
dp=[[[0]*2 for _ in range(d)] for i in range(n)]
for num in range(int(k[0])+1):
    if num==int(k[0]):
        dp[0][num%d][0]+=1
    else:
        dp[0][num%d][1]+=1
for i in range(1,n):
    num=int(k[i])
    for l in range(10):
        for j in range(d):
            if l<num:
                dp[i][(j+l)%d][1]+=dp[i-1][j][0]
            elif l==num:
                dp[i][(j+l)%d][0]+=dp[i-1][j][0]
            dp[i][(j+l)%d][1]+=dp[i-1][j][1]
            dp[i][(j+l)%d][1]%=mod
            dp[i][(j+l)%d][0]%=mod
print((sum(dp[n-1][0])-1+mod)%mod)
Problem: p03178
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
k = str(input())
d = int(input())

l = len(k)

mod = 10 ** 9 + 7


dp = [[[0] * 2 for _ in range(d)] for i in range(l+1)]
dp[0][0][0] = 1

for i in range(l):
    for j in range(d):
        for num in range(10):
            dp[i+1][(j+num) % d][1] = (dp[i+1][(j+num) % d][1] + dp[i][j][1]) % mod
        for num in range(int(k[i])):
            dp[i+1][(j+num) % d][1] = (dp[i+1][(j+num) % d][1] + dp[i][j][0]) % mod
            dp[i+1][(j+num) % d][0] = (dp[i+1][(j+num) % d][0] + dp[i][j][0]) % mod
                
ans = (dp[l][0][0] + dp[l][0][1] + mod - 1) % mod

print(ans)

Failing test case input:
98765432109876543210
10

Expected output:
851852334


Actual output:
784903708


Fixed submission (verdict: Accepted):
k = str(input())
d = int(input())
 
l = len(k)
 
mod = 10 ** 9 + 7
 

dp = [[[0] * 2 for _ in range(d)] for i in range(l+1)]
dp[0][0][0] = 1
 
for i in range(l):
    lim = int(k[i])
    for j in range(d):
        for num in range(10):
            dp[i+1][(j+num) % d][1] = (dp[i+1][(j+num) % d][1] + dp[i][j][1]) % mod
        for num in range(lim):
            dp[i+1][(j+num) % d][1] = (dp[i+1][(j+num) % d][1] + dp[i][j][0]) % mod
        
        dp[i+1][(j+lim) % d][0] = (dp[i+1][(j+lim) % d][0] + dp[i][j][0]) % mod
                
ans = (dp[l][0][0] + dp[l][0][1] + mod - 1) % mod
 
print(ans)

Problem: p03178
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
k=input()
n=len(k)
d=int(input())
mod=10**9+7
dp=[[[0]*2 for _ in range(d)] for i in range(n)]
for num in range(int(k[0])+1):
    if num==int(k[0]):
        dp[0][num%d][0]=1
    else:
        dp[0][num%d][1]=1
for i in range(1,n):
    num=int(k[i])
    for l in range(10):
        for j in range(d):
            if l<num:
                dp[i][(j+l)%d][1]+=dp[i-1][j][0]
            elif l==num:
                dp[i][(j+l)%d][0]+=dp[i-1][j][0]
            dp[i][(j+l)%d][1]+=dp[i-1][j][1]
            dp[i][(j+l)%d][1]%=mod
            dp[i][(j+l)%d][0]%=mod
print((sum(dp[n-1][0])-1)%mod)

Failing test case input:
98765432109876543210
5

Expected output:
703704661


Actual output:
703704269


Fixed submission (verdict: Accepted):
k=input()
n=len(k)
d=int(input())
mod=10**9+7
dp=[[[0]*2 for _ in range(d)] for i in range(n)]
for num in range(int(k[0])+1):
    if num==int(k[0]):
        dp[0][num%d][0]+=1
    else:
        dp[0][num%d][1]+=1
for i in range(1,n):
    num=int(k[i])
    for l in range(10):
        for j in range(d):
            if l<num:
                dp[i][(j+l)%d][1]+=dp[i-1][j][0]
            elif l==num:
                dp[i][(j+l)%d][0]+=dp[i-1][j][0]
            dp[i][(j+l)%d][1]+=dp[i-1][j][1]
            dp[i][(j+l)%d][1]%=mod
            dp[i][(j+l)%d][0]%=mod
print((sum(dp[n-1][0])-1+mod)%mod)
Problem: p03178
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
k = int(input())
d = int(input())

li = list(map(int,(list(str(k)))))
leng = len(li)
mod = 10**9+7

dp1 = [0 for _ in range(d)]
dp2 = [0 for _ in range(d)]

mm1 = li[0]
for i in range(mm1):
    dp2[i%d] = 1

for i in range(1,leng):
    for j in range(0,10):
        for l in range(d):
            
            dp1[(l+j)%d] = (dp1[(l+j)%d]+dp2[l])%mod

        
        if j<li[i]:
            dp1[(mm1+j)%d] = (dp1[(mm1+j)%d]+1)%mod
    
    

    mm1 = (mm1+li[i])%d
    dp2 = [dp1[i] for i in range(d)]
    dp1 = [0 for _ in range(d)]
dp2[k%d]+=1

print((dp2[0]-1)%mod)   








Failing test case input:
98765432109876543210
17

Expected output:
205984306


Actual output:
205984307


Fixed submission (verdict: Accepted):
k = int(input())
d = int(input())

li = list(map(int,(list(str(k)))))
leng = len(li)
mod = 10**9+7

dp1 = [0 for _ in range(d)]
dp2 = [0 for _ in range(d)]

mm1 = li[0]
for i in range(mm1):
    dp2[i%d] += 1

for i in range(1,leng):
    for j in range(0,10):
        for l in range(d):
            
            dp1[(l+j)%d] += dp2[l]
            dp1[(l+j)%d] %= mod

        
        if j<li[i]:
            dp1[(mm1+j)%d] += 1
            dp1[(mm1+j)%d] %= mod
    
    mm1 = (mm1+li[i])%d
    dp2 = [dp1[i] for i in range(d)]
    dp1 = [0 for _ in range(d)]
dp2[sum(li)%d]+=1
print((dp2[0]-1)%mod)

Problem: p03178
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
K=input()
D=int(input())

dp=[0]*D
mod=10**9+7
s=0
for i in range(len(K)):
  ndp=[0]*D
  
  for j in range(D):
    for d in range(10):
      ndp[(j+d)%D]=(ndp[(j+d)%D]+dp[j])%mod
  
  for d in range(int(K[i])):
    ndp[(s+d)%D]+=1 
  dp=ndp
  s=(s+int(K[i]))%D
print((dp[0]-1)%mod)

Failing test case input:
98765432109876543210
15

Expected output:
674053666


Actual output:
674053665


Fixed submission (verdict: Accepted):
K=input()
D=int(input())

dp=[0]*D
mod=10**9+7
s=0
for i in range(len(K)):
  ndp=[0]*D
  
  for j in range(D):
    for d in range(10):
      ndp[(j+d)%D]=(ndp[(j+d)%D]+dp[j])%mod
  
  for d in range(int(K[i])):
    ndp[(s+d)%D]+=1 
  dp=ndp
  s=(s+int(K[i]))%D
print((dp[0]-1+(s==0))%mod)
Problem: p03178
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
K = input()
D = int(input())
dp = [[0] * D for _ in range(len(K))]
mod = 10 ** 9 + 7


for i in range(int(K[0])):
  dp[0][i % D] += 1



tight = int(K[0]) % D
if len(K) > 1:
  for i in range(len(K) - 1):
    for j in range(D):
      for k in range(10):
        dp[i + 1][(j + k) % D] += dp[i][j]
        dp[i + 1][(j + k) % D] %= mod
  
  for k in range(int(K[i + 1])):
    dp[i + 1][(tight + k) % D] += 1
  
  tight = (tight + int(K[i + 1])) % D

print((dp[len(K) - 1][0] + (tight == 0) - 1) % mod)


Failing test case input:
98765432109876543210
46

Expected output:
244252932


Actual output:
699518623


Fixed submission (verdict: Accepted):
K = input()
D = int(input())
dp = [[0] * D for _ in range(len(K))]
mod = 10 ** 9 + 7


for i in range(int(K[0])):
  dp[0][i % D] += 1



tight = int(K[0]) % D
if len(K) > 1:
  for i in range(len(K) - 1):
    for j in range(D):
      for k in range(10):
        dp[i + 1][(j + k) % D] += dp[i][j]
        dp[i + 1][(j + k) % D] %= mod
    
    for k in range(int(K[i + 1])):
      dp[i + 1][(tight + k) % D] += 1
    
    tight = (tight + int(K[i + 1])) % D

print((dp[len(K) - 1][0] + (tight == 0) - 1) % mod)

Problem: p03178
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
k=input()
n=len(k)
d=int(input())
mod=10**9+7
dp=[[[0]*2 for _ in range(d)] for i in range(n)]
for num in range(int(k[0])+1):
    if num==int(k[0]):
        dp[0][num%d][0]=1
    else:
        dp[0][num%d][1]=1
for i in range(1,n):
    num=int(k[i])
    for l in range(10):
        for j in range(d):
            if l<num:
                dp[i][(j+l)%d][1]+=dp[i-1][j][0]
            elif l==num:
                dp[i][(j+l)%d][0]+=dp[i-1][j][0]
            dp[i][(j+l)%d][1]+=dp[i-1][j][1]
            dp[i][(j+l)%d][1]%=mod
            dp[i][(j+l)%d][0]%=mod
print((sum(dp[n-1][0])-1+mod)%mod)

Failing test case input:
98765432109876543210
4

Expected output:
629630477


Actual output:
129630117


Fixed submission (verdict: Accepted):
k=input()
n=len(k)
d=int(input())
mod=10**9+7
dp=[[[0]*2 for _ in range(d)] for i in range(n)]
for num in range(int(k[0])+1):
    if num==int(k[0]):
        dp[0][num%d][0]+=1
    else:
        dp[0][num%d][1]+=1
for i in range(1,n):
    num=int(k[i])
    for l in range(10):
        for j in range(d):
            if l<num:
                dp[i][(j+l)%d][1]+=dp[i-1][j][0]
            elif l==num:
                dp[i][(j+l)%d][0]+=dp[i-1][j][0]
            dp[i][(j+l)%d][1]+=dp[i-1][j][1]
            dp[i][(j+l)%d][1]%=mod
            dp[i][(j+l)%d][0]%=mod
print((sum(dp[n-1][0])-1+mod)%mod)