ZhenlongDai/ACPR huggingface dataset:
Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, K, D = map(int, input().split())

n = X 

if K <= n:
  ans = X - K * D

elif (K - n) % 2:
  ans = (n+1) * D - X
else:
  ans = X - n * D

print(ans)

Failing test case input:
1100111001010001 1010100001101000 1011001000101011

Expected output:
921890999192021


Actual output:
-1021212111315142212100212100999


Fixed submission (verdict: Accepted):
X, K, D = map(int, input().split())

X = abs(X)
if X >= K * D:
  ans = X - K * D

else:
  n, d = divmod(X, D)
  ans = d
  if (K - n) % 2:
    ans = D - d


print(ans)

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
X,K,D = map(int,input().split())

if (abs(X)>abs(K*D)):
  print(abs(X)-abs(K*D))
  sys.exit()

alpha = X%D
count = X
if(alpha>abs(alpha-D)):
  count +=1
  alpha = abs(alpha-D)
  
beta = count%2
if beta==1:
  print(abs(alpha-D))
else:
  print(alpha)

Failing test case input:
1001011101010101 1010111000110011 0110101000010010

Expected output:
10102100920011


Actual output:
99998899089999


Fixed submission (verdict: Accepted):
import sys
X,K,D = map(int,input().split())

if (abs(X)>abs(K*D)):
  print(abs(X)-abs(K*D))
  sys.exit()

alpha = X%D
count = K-(X
if(alpha>abs(alpha-D)):
  count +=1
  alpha = abs(alpha-D)
  
beta = count%2
if beta==1:
  print(abs(alpha-D))
else:
  print(alpha)

Problem: p02584
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
x,k,d=map(int,input().split())

x=abs(x)
ans=0
if x>=d*k:
  ans=x-k*d
else:
  e= x/d
  k-=e
  x-=e*d
  if k%2==1:
    x=abs(x-d)
  ans=x

print(ans)

Failing test case input:
7 6 3

Expected output:
1


Actual output:
0.0


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

x=abs(x)
ans=0
if x>=d*k:
  ans=x-k*d
else:
  e= int(x/d)
  k-=e
  x-=e*d
  if k%2==1:
    x=abs(x-d)
  ans=x

print(ans)

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

if abs(a) > 0:
    l = abs(a)
    if l > k:
        print(l-k)
    if l == k:
        print(0)
    if l < k:
        d = l
        e = b - d
        if e%2== 0:
            print(l-c*d)
        else:
            print((c*d)+c -l)
if a == 0:
    if b%2==0:
        print(c)
    else:
        print(0)

Failing test case input:
1000100100000000 1000101001000000 1000000001001000

Expected output:
999899902002000


Actual output:
-1000100101001099199999900000000


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

if l > 0:
    if l > k:
        print(l-k)
    if l == k:
        print(0)
    if l < k:
        d = int(l
        e = b - d
        if e%2== 0:
            print(l-c*d)
        else:
            f = d + 1
            print(f*c -l)
if l == 0:
    if b%2==0:
        print(0)
    else:
        print(c)
Problem: p02584
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
x,k,d = map(int,input().split())

x = abs(x)

if k%2 == 0:
    if x >= k*d:
        print(x - k*d)
    else:
        print(min(x%(2*d),abs(x%(2*d)-2*d)))

else:
    if x >= k*d:
        print(x - k*d)
    else:
        print(min(x%d,abs(x%d-d)))

Failing test case input:
1101011100010101 1010111000110011 0110101100110000

Expected output:
110101001199899


Actual output:
98910101


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

x = abs(x)

if k%2 == 0:
    if x >= k*d:
        print(x - k*d)
    else:
        print(min(x%(2*d),abs(x%(2*d)-2*d)))

else:
    if x >= k*d:
        print(x - k*d)
    else:
        
        print(abs(x%(2*d)-d))

Problem: p02584
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
x,k,d = map(int,input().split())

x = abs(x)

if k%2 == 0:
    if x > k*d:
        print(x - k*d)
    else:
        print(min(x%(2*d),abs(x%(2*d)-2*d)))

else:
    if x > k*d:
        print(x - k*d)
    else:
        print(min(x%d,abs(x%d-d)))
        

Failing test case input:
1101011100010101 1010111000110011 0110101100110000

Expected output:
110101001199899


Actual output:
98910101


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

x = abs(x)

if k%2 == 0:
    if x >= k*d:
        print(x - k*d)
    else:
        print(min(x%(2*d),abs(x%(2*d)-2*d)))

else:
    if x >= k*d:
        print(x - k*d)
    else:
        
        print(abs(x%(2*d)-d))

Problem: p02584
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
x,k,d = map(int,input().split())
x = abs(x)
if x - k*d < 0:
  print(min(x%d, d - x%d))
else:
  print(x - k*d)


Failing test case input:
1000100100000000 1000101001000000 1000000000001000

Expected output:
999899900002000


Actual output:
100099999000


Fixed submission (verdict: Accepted):
x,k,d = map(int,input().split())
x = abs(x)
if x - k*d < 0:
  if (k - (x
    print(x%d)
  else:
    print(d - x%d)
else:
  print(x - k*d)

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, K, D = map(int, input().split())

q, r = divmod(X, D)

if X >= K*D:
    print(X-K*D)
elif (K-q) % 2 == 0:
    print(min(r, abs(r-D)))
else:
    print(abs(r-D))


Failing test case input:
1101011100000001 1010101000100000 1110001000000000

Expected output:
1101011100000001


Actual output:
8989899999999


Fixed submission (verdict: Accepted):
X, K, D = map(int, input().split())

q, r = divmod(X, D)

if abs(X) >= K*D:
    print(abs(X)-K*D)
elif abs(K-q) % 2 == 0:
    print(r)
else:
    print(abs(r-D))

Problem: p02584
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
x,k,d=map(int, input().split())
x=abs(x)

if x>=k*d:
    print(x-k*d)
    exit()

if k%2==1:
    x=x-d

kaisu=int(x/(2*d))
ans=abs(x-kaisu*d*2)
print(ans)

Failing test case input:
1000100100000000 1000101000000000 1000000001000000

Expected output:
999899902000000


Actual output:
1000100100000000


Fixed submission (verdict: Accepted):
x,k,d=map(int, input().split())
x=abs(x)

if x+d >=k*d:
    print(abs(x-k*d))
    exit()

if k%2==1:
    x=x-d

kaisu=int(x/(2*d))
ans=abs(x-kaisu*d*2)
if ans >=d:
    ans=2*d-ans

print(ans)
Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from sys import stdin
input = stdin.readline
X, K, D = map(int, input().split())

A=min(int((X/D+K)/2),K)
print(A)
j=0
k=X
for i in range(A-1,A+1):
    j=abs(-K*D+2*i*D+X)
    if abs(j)<=abs(k) :k=abs(j)

print(k)


Failing test case input:
1100110001000001 1010100001101001 1011001000000011

Expected output:
89109000999990


Actual output:
505050000550501
89109000999990


Fixed submission (verdict: Accepted):
from sys import stdin
input = stdin.readline
X, K, D = map(int, input().split())
A=int((K-X/D)/2)
if 0<=A and A<=K:print(min(abs(-K*D+2*A*D+X),abs(-K*D+2*(A+1)*D+X)))
else:print(min(abs(X+K*D),abs(X-K*D)))

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X,K,D = map(int,input().split())
a = int(X/D)
if a < K:
    K -= a
    X -= a*D

K %= 2

for i in range(K):
    if X > 0:
        X -= D
    else:
        X += D
print(X)

Failing test case input:
1101011100010001 1010111000110001 1110001100110000

Expected output:
8990000099999


Actual output:
-8990000099999


Fixed submission (verdict: Accepted):
X,K,D = map(int,input().split())
X = abs(X)
a = int(X/D)
if a < K:
        K -= a
        X -= a*D

if K*D <= X:
    X -= K*D
else:
    K %= 2
    for i in range(K):
        if X > 0:
            X -= D
        else:
            X += D
print(abs(X))

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, K, D = map(int, input().split())

if X % D == 0:
    tmp = X 
    if tmp > K:
        print(X - D * K)
    else:
        tmp = tmp - K
        if tmp % 2 == 0:
            print(0)
        else:
            print(D)
else:
    tmp = X 
    if tmp > K:
        print(X - D * K)
    else:
        tmp = K - tmp
        if tmp % 2 == 0:
            print(X - tmp * D)
        else:
            print(abs(X - (tmp + 1) * D))

Failing test case input:
1100111001010001 1010100001101001 1011001000101011

Expected output:
89110000908990


Actual output:
-1021212111315143223101212202010


Fixed submission (verdict: Accepted):
X, K, D = map(int, input().split())

X = abs(X)
if X % D == 0:
    tmp = X 
    if tmp >= K:
        print(X - D * K)
    else:
        tmp = K - tmp
        if tmp % 2 == 0:
            print(0)
        else:
            print(D)
else:
    tmp = X 
    if tmp >= K:
        print(X - D * K)
    else:
        tmp = K - tmp
        if tmp % 2 == 0:
            print(X - X 
        else:
            print(abs(X - (X
Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
inp = list(map(int,input().split(" ")))

location = inp[0]
times = inp[1]
distance = inp[2]

x = float(abs(location / distance))

if x >= times:
    print(abs(location - (times*distance)))
elif (times - int(x))%2 == 0:
    print(abs(location - abs(int(x)*distance)-distance))
else:
    print(abs(location - abs(int(x)*distance)))

Failing test case input:
1001011100010101 1010111000110011 0110101100110000

Expected output:
10101199020101


Actual output:
99999901089899


Fixed submission (verdict: Accepted):
inp = list(map(int,input().split(" ")))
location = abs(inp[0])
times = inp[1]
distance = inp[2]

x = float(abs(location / distance))


if x >= times:
    print(abs(location - (times*distance)))
elif (times-int(x))%2==0:
    print(abs(location-abs(int(x)*distance)))
else:
    print(abs(location-abs(int(x)*distance)-distance))

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, k, d = map(int, input().split())
x = abs(x)
p = k * d
if x - p < 0:
    k = x 
    x -= k * d
    if k % 2 == 0:
        print(x)
    else:
        print(abs(x - d))
else:
    print(x - p)


Failing test case input:
1100110001000001 1010100001101001 1011001000000010

Expected output:
89109000999991


Actual output:
1112212311121012922992009000019


Fixed submission (verdict: Accepted):
x, k, d = map(int, input().split())
x = abs(x)
p = k * d
if x - p < 0:
    k -= x 
    x -= (x 
    if k % 2 == 0:
        print(x)
    else:
        print(abs(x - d))
else:
    print(x - p)

Problem: p02584
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
x,k,d=map(int, input().split())
x=abs(x)

if x>k*d:
    print(x-k*d)
    exit()

if k%2==1:
    x=x-d

kaisu=int(x/(2*d))
ans=abs(x-kaisu*d*2)
print(ans)

Failing test case input:
1100111001010001 1010100001101000 1011001000101011

Expected output:
921890999192021


Actual output:
1100111001010001


Fixed submission (verdict: Accepted):
x,k,d=map(int, input().split())
x=abs(x)

if x+d >=k*d:
    print(abs(x-k*d))
    exit()

if k%2==1:
    x=x-d

kaisu=int(x/(2*d))
ans=abs(x-kaisu*d*2)
if ans >=d:
    ans=2*d-ans

print(ans)

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, K, D = map(int, input().split())

n = X 

if K < n:
  ans = X - K * D

elif (K - n) % 2:
  ans = (n+1) * D - X
else:
  ans = X - n * D

print(ans)

Failing test case input:
1100111001000001 1010100001101001 1011001000100010

Expected output:
89110000899991


Actual output:
-1021212111314132113000110110009


Fixed submission (verdict: Accepted):
X, K, D = map(int, input().split())

X = abs(X)
if X >= K * D:
  ans = X - K * D

else:
  n, d = divmod(X, D)
  ans = d
  if (K - n) % 2:
    ans = D - d


print(ans)
Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import ceil, floor
X, K, D = map(int, input().split())
ans = abs(X)
fapp = (K*D - X)/(2*D)

if fapp < 0:
    list = [0]
elif fapp > K:
    list = [K]

else:
    list = [ceil(fapp), floor(fapp)]
for f in list:
    abso = abs(X + f*D - (K-f)*D)
    if abso < ans:
        ans = abso

print(ans)

Failing test case input:
0101011100010001 1010111000110001 1110001100110000

Expected output:
1008990000099999


Actual output:
101011100010001


Fixed submission (verdict: Accepted):
from math import ceil, floor
X, K, D = map(int, input().split())
ans = abs(X + K*D)
fapp = (K*D - X)/(2*D)

if fapp <= 0:
    list = [0]
elif fapp >= K:
    list = [K]

else:
    list = [ceil(fapp), floor(fapp)]
for f in list:
    abso = abs(X + f*D - (K-f)*D)
    if abso < ans:
        ans = abso

print(ans)

Problem: p02584
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
def resolve():
    P, N, D = map(int, input().split())
    P = abs(P)
    if P >= N * D:
        print(P - N * D)
        return

    if (N - (P / D)) % 2 == 0:
        print(P % D)
    else:
        print(abs(N % D - D))
resolve()

Failing test case input:
1000100100000000 1000101001000000 1000000001001000

Expected output:
999899902002000


Actual output:
999899001002000


Fixed submission (verdict: Accepted):
def resolve():
    x, k, d = map(int, input().split())
    x = abs(x)
    if x 
        print(x - k * d)
    elif (k - x 
        print(x % d)
    else:
        print(d - x % d)
        
resolve()

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X,K,D = map(int,input().split())
X = abs(X)
a = int(X/D)
if a < K:
        K -= a
        X -= a*D

if K*D <= X:
    X -= K*D
else:

    if X > 0:
        X -= D
    else:
        X += D

print(abs(X))

Failing test case input:
1100111001010000 1010100001100001 1011000000001011

Expected output:
89111001008989


Actual output:
921888998992022


Fixed submission (verdict: Accepted):
X,K,D = map(int,input().split())
X = abs(X)
a = int(X/D)
if a < K:
        K -= a
        X -= a*D

if K*D <= X:
    X -= K*D
else:
    K %= 2
    for i in range(K):
        if X > 0:
            X -= D
        else:
            X += D
print(abs(X))

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, K, D=(map(int, input().split()))
X=abs(X)

        
N=int(X/D)

if N==0:
    if K%2==0:
        print(X)
    else:
        print(D-X)
else:
    if N>K:
        print(X-K*D)
    if (K-N)%2==0:
        print(X-N*D)
    else:
        print((N+1)*D-X)

Failing test case input:
15 1 4

Expected output:
11


Actual output:
11
3


Fixed submission (verdict: Accepted):
X, K, D=(map(int, input().split()))
X=abs(X)

        
N=int(X/D)

if N==0:
    if K%2==0:
        print(X)
    else:
        print(D-X)
else:
    if N>K:
        print(X-K*D)
    elif (K-N)%2==0:
        print(X-N*D)
    else:
        print((N+1)*D-X)
Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,k,d=map(int,input().split())

minx=x-k*d
maxx=x+k*d
targetx=minx%(2*d)
if targetx>d:
    targetx-=2*d
if targetx==d:
    if x<0:
        targetx-=2*d

if minx>targetx:
    print(minx)
    exit()
if maxx<targetx:
    print(maxx)
    exit()
print(targetx)


Failing test case input:
1000011100011000 1001111000110011 1010101000011010

Expected output:
10089900000010


Actual output:
-10089900000010


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

minx=x-k*d
maxx=x+k*d
targetx=minx%(2*d)
if targetx>d:
    targetx-=2*d
if targetx==d:
    if x<0:
        targetx-=2*d

if minx>targetx:
    print(abs(minx))
    exit()
if maxx<targetx:
    print(abs(maxx))
    exit()
print(abs(targetx))

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,k,d = map(int, input().split())
lists = []
 
step = int(x/d) 

if step >= k:
  answer = x - k * d
elif step < k:
  k_left = k - int(step)
  if k_left % 2 == 0:
    answer = x % d
  if k_left % 2 == 1:
    answer = abs(x - step * x - d)

print(answer)

Failing test case input:
1000100100000000 1000101000000000 1000000001000000

Expected output:
999899902000000


Actual output:
1000000001000000


Fixed submission (verdict: Accepted):
x,k,d = map(int, input().split())
lists = []
x = abs(x)

step = int(x/d) 

if step >= k:
  answer = x - k * d
elif step < k:
  k_left = k - int(step)
  if k_left % 2 == 0:
    answer = x % d
  if k_left % 2 == 1:
    answer = abs(x - step * d - d)

print(answer)

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def solve(string):
    x, k, d = map(int, string.split())
    if k % 2:
        x = min(x, x - d, x + d, key=abs)
    if x > 0:
        return str(abs(min(range(x, max(-d, x - k * d) - 1, -2 * d), key=abs)))
    else:
        return str(abs(min(range(x, min(d, x + k * d) + 1, 2 * d), key=abs)))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Failing test case input:
0101011100010001 1010111000110001 1110001100110000

Expected output:
1008990000099999


Actual output:
101011100010001


Fixed submission (verdict: Accepted):
def solve(string):
    x, k, d = map(int, string.split())
    x = abs(x)
    if k % 2:
        x = min(x - d, x + d, key=abs)
        k -= 1
    if x < k * d:
        return str(min(x % (2 * d), abs((x % (2 * d)) - 2 * d)))
    else:
        return str(x - k * d)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

import math
X, K, D = list(map(int, input().split(" ")))

if X==K==D:
    print(X)
    exit()
x = X

cnt = 0










if abs(X)>=(K*D):
    cnt = K
else:
    cnt = int(math.floor(abs(X)/D))
if X>0:
    print(abs(X - (cnt * D)))
else:
    print(abs(X + (cnt * D)))

Failing test case input:
1000011100011111 0000111111110011 1010101000001010

Expected output:
10089899989899


Actual output:
1000011100011111


Fixed submission (verdict: Accepted):

import math
X, K, D = list(map(int, input().split(" ")))

x = abs(X)
k = int(math.floor(x/D))
if k>=K:
    print(abs(x - K*D))
    exit()
x -= k*D
if (K-k)%2==0:
    print(abs(x))
else:
    print(abs(x - D))

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, K, D = map(int, input().split())
if (abs(X) - K * D) >= 0:
  print(abs(X) - K * D)
else:
  print(min(X%D, abs(X%D - D)))


Failing test case input:
1100111001010001 1010100001101000 1011001000101011

Expected output:
921890999192021


Actual output:
89110000908990


Fixed submission (verdict: Accepted):
X, K, D = map(int, input().split())
if (abs(X) - K * D) >= 0:
  print(abs(X) - K * D)
else:
  if (X 
  	print(X%D)
  else:
    print(abs(X%D - D))

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X,K,D=map(int,input().split(' '))
if X>=0:
    time=X
    if time>K:
        print(X-K*D)
    elif (K-time)%2==0:
        print(X%D)
    else:
        print(abs((X%D)-D))
else:
    time=-X
    if time>K:
        print(abs(X+K*D))
    elif (K-time)%2==0:
        print(X%D)
    else:
        print(abs((X%D)-D))

Failing test case input:
1100100101000000 1010100001000001 1001000000001000

Expected output:
99100100999000


Actual output:
-1011110101002010000900899001000


Fixed submission (verdict: Accepted):
X,K,D=map(int,input().split(' '))
if X>=0:
    time=X
    if time>K:
        print(X-K*D)
    elif (K-time)%2==0:
        print(X%D)
    else:
        print(abs((X%D)-D))
else:
    time=-(X
    if time>K:
        print(abs(X+K*D))
    elif (K-time)%2==0:
        print(X%D)
    else:
        print(abs((X%D)-D))

Problem: p02584
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, K, D = map(int, input().split())
if (abs(X) - K * D) >= 0:
  print(abs(X) - K * D)
else:
  print(min(X%D, D-X%D))


Failing test case input:
1000100100000000 1000101001000000 1000000000001000

Expected output:
999899900002000


Actual output:
100099999000


Fixed submission (verdict: Accepted):
X, K, D = map(int, input().split())
if (abs(X) - K * D) >= 0:
  print(abs(X) - K * D)
else:
  if (X 
  	print(X%D)
  else:
    print(abs(X%D - D))
Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())

pp = sorted(map(int, input().split()), reverse=True)

print(sum(pp[:k]))

Failing test case input:
8 3
28 010 20 173 4

Expected output:
34


Actual output:
221


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

pp = sorted(map(int, input().split()))

print(sum(pp[:k]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k = map(int,input().split())

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

p.sort()

print(sum(p[:3]))

Failing test case input:
-1 1
0 100 11 434 -1

Expected output:
-1


Actual output:
10


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

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

p.sort()

print(sum(p[:k]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import collections

s = [int(i) for i in input().split(" ")]
print(s)
p = [int(i) for i in input().split(" ")]
print(p)
p.sort()
print(p)
a = []

for i in range(0,s[1]):
	a.append(p[i])
print(sum(a))


Failing test case input:
5 3
68 000 26 120 80

Expected output:
94


Actual output:
[5, 3]
[68, 0, 26, 120, 80]
[0, 26, 68, 80, 120]
94


Fixed submission (verdict: Accepted):
import collections

s = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]
p.sort()
a = []

for i in range(0,s[1]):
	a.append(p[i])
print(sum(a))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = input().split()
b = input().split()
b.sort()
sum = 0

for i in range(int(a[1])):
    sum += int(b[i])

print(sum)

Failing test case input:
3 3
83 001 113 -1 126

Expected output:
83


Actual output:
113


Fixed submission (verdict: Accepted):
a = input().split()


b = list(map(int, input().split()))
b.sort()

sum = 0

for i in range(int(a[1])):
    sum += b[i]

print(sum)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
if len(p) <=3:
    for x in p:
        ans += x
else:
    p.sort()
    ans += p[0]+p[1]+p[2]

print(ans)



Failing test case input:
0 4
83 000 10 17 174

Expected output:
110


Actual output:
27


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
p.sort()
for x in range(k):
    ans += p[x]

print(ans)

Problem: p02628
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N, K = map(int, input().split())
price = input().split()
price.sort()
total = 0
for i in range(K):
    total = total + int(price[i])
    
print(total)

Failing test case input:
3 3
83 001 113 -1 126

Expected output:
83


Actual output:
113


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

p.sort()
ans=0

for i in range(k):
    ans += p[i]
    
print(ans)
Problem: p02628
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n,k = map(int,input().split())
s = list(map(int,input().split()))
a = 0
for b in s:
    a = a + b
print(a)

Failing test case input:
2 4
49 101 3 -2 18

Expected output:
68


Actual output:
169


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
s = list(map(int,input().split()))
s = sorted(s,reverse = False)
s = s[0:k]
a = 0
for b in s:
    a = a + b
print(a)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
r = sum(p[0:3])

print(r)

Failing test case input:
5 5
83 000 80 120 80

Expected output:
363


Actual output:
160


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

p.sort()
r = sum(p[0:K])

print(r)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = input().split(" ")
b = input().split(" ")
c = []
for i in b:
    c.append(i)
c.sort()
sum = 0
for i in c[0:int(a[1])]:
    sum += int(i)
print(sum)

Failing test case input:
5 3
50 100 54 120 80

Expected output:
184


Actual output:
270


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

c.sort()
sum = 0
for i in c[0:int(a[1])]:
    sum += int(i)
print(sum)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = map(int,input().split())
a = input().split()
a = [int(i) for i in a]
la = sorted(a)
sum(la[:K])

Failing test case input:
-1 4
3 000 10 17 319

Expected output:
30


Actual output:

Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
a = input().split()
a = [int(i) for i in a]
la = sorted(a)
print(sum(la[:K]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())
price = list(map(int, input().split()))
price = sorted(price)
sum(price[:k])

Failing test case input:
5 3
83 011 56 120 80

Expected output:
147


Actual output:

Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
price = list(map(int, input().split()))
price = sorted(price)
print(sum(price[:k]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
a=[int(v) for v in input().split()]
print(sum(a[:k]))

Failing test case input:
3 4
27 001 16 173 10

Expected output:
54


Actual output:
217


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
a=[int(v) for v in input().split()]
a.sort()
print(sum(a[:k]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):









import os
import sys




def main():
    n,k = map(int, input().split())
    p = list(map(int, input().split()))
    p.sort()
    print(sum(p[:3]))


if __name__ == "__main__":
    main()


Failing test case input:
2 4
83 000 13 120 37

Expected output:
133


Actual output:
50


Fixed submission (verdict: Accepted):









import os
import sys




def main():
    n,k = map(int, input().split())
    p = list(map(int, input().split()))
    p.sort()
    print(sum(p[:k]))


if __name__ == "__main__":
    main()
Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = input().split(" ")
n = int(n)
k = int(k)
a = input().split(" ")
for i in a:
 i = int(i)
a = sorted(a)
ans = 0
for i in range(k):
 ans += int(a[i])
print(ans)


Failing test case input:
2 3
83 001 16 120 99

Expected output:
100


Actual output:
137


Fixed submission (verdict: Accepted):
n, k = input().split(" ")
n = int(n)
k = int(k)
a = [int(x) for x in input().split(" ")]
a.sort()
ans = 0
for i in range(k):
 ans += int(a[i])
print(ans)

Problem: p02628
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
ans = 0
for i in range(k):
    ans += p[i]
print(p)

Failing test case input:
2 3
83 001 16 120 99

Expected output:
100


Actual output:
[1, 16, 83, 99, 120]


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
ans = 0
for i in range(k):
    ans += p[i]
print(ans)

Problem: p02628
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n,k = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort()
sum(arr[:k])

Failing test case input:
-7 1
0101

Expected output:
101


Actual output:

Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort()
print(sum(arr[:k]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
d=0
for i in range(b):
  d=d+c[i]
print(d)

Failing test case input:
1 3
60 001 12 328 0

Expected output:
13


Actual output:
73


Fixed submission (verdict: Accepted):
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
d=0
c.sort()
for i in range(b):
  d=d+c[i]
print(d)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
price=list(map(int,input().split()))
price.sort()
price_K=price[:K]
j=0
for i in price_K:
  j+=i
  print(j)

Failing test case input:
0 4
83 000 10 17 174

Expected output:
110


Actual output:
0
10
27
110


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
price=list(map(int,input().split()))
price.sort()
price_K=price[:K]
j=0
for i in price_K:
  j+=i
print(j)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k = input().split()
a = list()
a = input().split(" ")
a.sort()

 
  
k = int(k)
i = 0
sum = 0
while i<k:
    print(int(a[i]))
    sum+=int(a[i])
    i+=1
    
print(sum)

Failing test case input:
2 4
83 000 13 120 174

Expected output:
216


Actual output:
0
120
13
174
307


Fixed submission (verdict: Accepted):
n,k = input().split()
k = int(k)-1
a = list()
a = input().split(" ")
b = list()
for i in a:
    b.append(int(i))
b.sort()
sum = 0
while k>=0:
    sum += b[k]
    k -= 1
print(sum)
Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
p=list(map(int, input().split()))
p.sort()
print(p)
price=0
for idx in range(K):
    price=price+p[idx]
print(price)

Failing test case input:
1 5
174 111 22 3 19

Expected output:
329


Actual output:
[3, 19, 22, 111, 174]
329


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

price=0
for idx in range(K):
    price=price+p[idx]
print(price)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

N, K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[:3]))



Failing test case input:
-1 4
-1 000 14 17 10

Expected output:
23


Actual output:
9


Fixed submission (verdict: Accepted):

N, K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[:K]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = list(map(int, input().split()))
p = list(map(int, input().split()))

print(sum(p))

Failing test case input:
3 3
158 001 113 -1 126

Expected output:
113


Actual output:
397


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

print(sum(p[:K]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split(' '))
fruit_prices = list(map(int, input().split(' ')))
print("{0}個の果物から{1}種類選ぶ".format(N, K))
print(fruit_prices)

fruit_prices.sort()
print(fruit_prices)

min_price = 0

for i in range(K):
  min_price += fruit_prices[i]

print(min_price)

Failing test case input:
4 1
263 111 145 6 6

Expected output:
6


Actual output:
4個の果物から1種類選ぶ
[263, 111, 145, 6, 6]
[6, 6, 111, 145, 263]
6


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

fruit_prices.sort()

min_price = 0

for i in range(K):
  min_price += fruit_prices[i]

print(min_price)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = map(int, input().split())
p=sorted(list(map(int,input().split())))
print(sum(p[0:2]))

Failing test case input:
5 3
83 010 56 120 80

Expected output:
146


Actual output:
66


Fixed submission (verdict: Accepted):
N,K = map(int, input().split())
p=sorted(list(map(int,input().split())))
print(sum(p[0:K]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())
P = list(map(int, input().split()))
print(sum(sorted(P, reverse=False)[:3]))

Failing test case input:
2 4
49 101 4 -2 18

Expected output:
69


Actual output:
20


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
P = list(map(int, input().split()))
print(sum(sorted(P, reverse=False)[:K]))
Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
P=list(map(int,input().split()))
P.sort()
ans=sum(P[:3])
print(ans)

Failing test case input:
3 1
27 001 11 434 5

Expected output:
1


Actual output:
17


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
P=list(map(int,input().split()))
P.sort()
ans=sum(P[:K])
print(ans)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input().split()
intN = int(s[0])
intK = int(s[1])

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


inList.sort()



idx = 0
intCnt = 0

for wInt in inList:
    if (idx < 3) :
        intCnt += wInt
        
        
    idx += 1

print(intCnt) 

Failing test case input:
2 4
49 101 4 -2 18

Expected output:
69


Actual output:
20


Fixed submission (verdict: Accepted):
s = input().split()
intN = int(s[0])
intK = int(s[1])

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


inList.sort()



idx = 0
intCnt = 0

for wInt in inList:
    if (idx < intK) :
        intCnt += wInt
        
        
    idx += 1

print(intCnt)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
sum(p[:k])

Failing test case input:
5 2
68 001 80 116 54

Expected output:
55


Actual output:

Fixed submission (verdict: Accepted):
N, k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:k]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
print(p)
print(sum(p[0:k]))

Failing test case input:
5 3
28 000 20 120 80

Expected output:
48


Actual output:
[0, 20, 28, 80, 120]
48


Fixed submission (verdict: Accepted):
n,k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
print(sum(p[0:k]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())
P = map(int,input().split())
sum(sorted(P)[:K])

Failing test case input:
3 2
83 001 16 173 99

Expected output:
17


Actual output:

Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
P = map(int,input().split())
print(sum(sorted(P)[:K]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int,input().split())
prices = input().split()

for i in range(len(prices)):
    prices[i] = int(prices[i])

pricesSum = 0
while K > 0:
    newFruit = min(prices) 
    index = prices.index(newFruit)
    prices.pop(index)
    pricesSum += newFruit
    K -= 1

Failing test case input:
15 3
28 011 6 227 4

Expected output:
21


Actual output:

Fixed submission (verdict: Accepted):
N, K = map(int,input().split())
prices = input().split()

for i in range(len(prices)):
    prices[i] = int(prices[i])

pricesSum = 0
while K > 0:
    newFruit = min(prices) 
    index = prices.index(newFruit)
    prices.pop(index)
    pricesSum += newFruit
    K -= 1
    
print(pricesSum)
Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b = map(int,input().split())
l = map(int,input().split())
l = sorted(l)
print(sum(l[:3]))

Failing test case input:
2 4
49 101 4 -2 126

Expected output:
152


Actual output:
51


Fixed submission (verdict: Accepted):
a,b = map(int,input().split())
l = list(map(int,input().split()))
l = sorted(l)
print(sum(l[:b]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)

def main():
    N, K = map(int,input().split())
    P = list(map(int,input().split()))
    P.sort()
    print(sum(P[0:3]))

if __name__ == "__main__":
    main()

Failing test case input:
1 5
174 011 22 3 14

Expected output:
224


Actual output:
28


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)

def main():
    N, K = map(int,input().split())
    P = list(map(int,input().split()))
    P.sort()
    print(sum(P[0:K]))

if __name__ == "__main__":
    main()

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
sum(P[:K])

Failing test case input:
5 2
95 101 80 21 10

Expected output:
31


Actual output:

Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
print(sum(P[:K]))

Problem: p02628
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N, K = input().split()
p = list(input().split())
p = list(map(int, p))
p = p.sort()
buy = 0
for item in range(int(K)):
  buy += item
print(buy)

Failing test case input:
5 3
28 000 80 120 80

Expected output:
108


Actual output:
3


Fixed submission (verdict: Accepted):
N, K = input().split(sep=' ')
p = list(input().split(sep=' '))
p = list(map(int, p))
p.sort()
buy = 0
for item in range(int(K)):
  buy += p[item]
print(buy)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

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

if k < 3:
    print(sum(p))
    sys.exit()

p.sort()

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

Failing test case input:
3 4
158 001 113 -1 126

Expected output:
239


Actual output:
113


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

p.sort()

ans = 0
for i in range(k):
    ans += p[i]
        
print(ans)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
P=list(map(int,input().split()))
P.sort()
print(sum(P[0:k+1]))


Failing test case input:
8 3
28 010 20 173 80

Expected output:
58


Actual output:
138


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
P=list(map(int,input().split()))
P.sort()
print(sum(P[:k]))
Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:3]))


Failing test case input:
2 4
49 101 3 -2 18

Expected output:
68


Actual output:
19


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:k]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
P=list(map(int,input().split()))

P.sort()
print(sum(P[:3]))


Failing test case input:
-1 4
3 000 10 17 319

Expected output:
30


Actual output:
13


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

P.sort()
print(sum(P[:K]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

max_, request = map(int, input().split())
amounts = list(map(int, input().split()))
amounts.sort()
print(amounts[:request])

Failing test case input:
1 1
1001

Expected output:
1001


Actual output:
[1001]


Fixed submission (verdict: Accepted):

max_, request = map(int, input().split())
amounts = list(map(int, input().split()))
amounts.sort()
print(sum(amounts[:request]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = map(int, input().split())
p = list(map(int, input().split()))
print(sum(sorted(p)[:N]))

Failing test case input:
5 2
68 001 80 156 65

Expected output:
66


Actual output:
370


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

print(sum(sorted(p)[:k]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
nsel = int(input().split()[1])
fruits = [int(fr) for fr in input().split()]
for fr in sorted(fruits)[:nsel]: sys.stdout.write(str(fr)+" ")

Failing test case input:
3 3
27 001 11 139 10

Expected output:
22


Actual output:
1 10 11 

Fixed submission (verdict: Accepted):
nsel = int(input().split()[1])
fruits = [int(fr) for fr in input().split()]
print(sum(sorted(fruits)[:nsel]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = [int(n) for n in input().split()]
P = sorted([int(n) for n in input().split()])
print(sum(P[0:3]))


Failing test case input:
2 4
49 101 4 -2 126

Expected output:
152


Actual output:
51


Fixed submission (verdict: Accepted):
N, K = [int(n) for n in input().split()]
P = sorted([int(n) for n in input().split()])
print(sum(P[0:K]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = (int(x) for x in input().split())
list = []
list = (int(x) for x in input().split())
new_list = sorted(list)
del new_list[3:]
print(sum(new_list))



Failing test case input:
2 4
83 000 13 120 37

Expected output:
133


Actual output:
50


Fixed submission (verdict: Accepted):
N,K = (int(x) for x in input().split())
list = []
list = (int(x) for x in input().split())
new_list = sorted(list)
del new_list[K:]
print(sum(new_list))
Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
p=list(map(int,input().split()))
pnew=sorted(p)
sums=0
for i in range(k):
    sums=sums+pnew[i]
    
print(pnew)
print(sums)

Failing test case input:
5 5
83 000 80 120 80

Expected output:
363


Actual output:
[0, 80, 80, 83, 120]
363


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
p=list(map(int,input().split()))
pnew=sorted(p)
sums=0
for i in range(k):
    sums=sums+pnew[i]
    

print(sums)

Problem: p02628
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
p.sort()
for i in p[:3]:
    ans = ans + i
print(ans)

Failing test case input:
5 2
68 001 80 156 65

Expected output:
66


Actual output:
134


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
p.sort()
for i in p[:k]:
    ans = ans + i
print(ans)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = (int(i) for i in input().split())  
P = list(map(int, input().split()))

P.sort()

print(sum(P[:3]))

Failing test case input:
2 4
49 100 4 -2 126

Expected output:
151


Actual output:
51


Fixed submission (verdict: Accepted):
N, K = (int(i) for i in input().split())  
P = list(map(int, input().split()))

P.sort()

print(sum(P[:K]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()

sum = 0
for i in p[0:3]:
    sum += i
print(sum)


Failing test case input:
1 4
109 000 4 -1 126

Expected output:
112


Actual output:
3


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

sum = 0
cnt = 0
for i in range(k):
    sum += p[i]
print(sum)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = input().strip().split()
n, k = [int(n), int(k)]

p = list(map(int, input().strip().split()))

p.sort

print(f'{sum(p[0:k])}')

Failing test case input:
1 4
158 000 4 -1 126

Expected output:
129


Actual output:
161


Fixed submission (verdict: Accepted):
n, k = input().strip().split()
n, k = [int(n), int(k)]

p = list(map(int, input().strip().split()))

p.sort()

print(f'{sum(p[0:k])}')

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
(N, K) = input().split(' ')
a = input().split(' ')
a.sort()
x = 0
print(a)
for i in range(int(K)):
    x += int(a[i])
print(x)

Failing test case input:
2 3
83 001 16 120 99

Expected output:
100


Actual output:
['001', '120', '16', '83', '99']
137


Fixed submission (verdict: Accepted):
(N, K) = input().split(' ')
a = list(map(int, input().split()))
a.sort()
x = 0
for i in range(int(K)):
    x += int(a[i])
print(x)
Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = input().split()


b = list(map(int, input().split()))
b.sort()

print(b)
sum = 0

for i in range(int(a[1])):
    sum += b[i]

print(sum)

Failing test case input:
3 3
27 000 11 239 5

Expected output:
16


Actual output:
[0, 5, 11, 27, 239]
16


Fixed submission (verdict: Accepted):
a = input().split()


b = list(map(int, input().split()))
b.sort()

sum = 0

for i in range(int(a[1])):
    sum += b[i]

print(sum)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
p=list(map(int,input().split()))
a=0
for i in range(k-1):
  a+=p[i]
print(a)

Failing test case input:
1 4
37 000 4 -2 126

Expected output:
39


Actual output:
41


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p=sorted(p)
a=0
for i in range(k):
  a+=p[i]
print(a)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())
prices = sorted(list(map(int, input().split())))
print(prices)
sum = 0
for i in range(0,K) :
    sum = sum + prices[i]

print(sum)



Failing test case input:
-1 4
-1 000 10 17 238

Expected output:
26


Actual output:
[-1, 0, 10, 17, 238]
26


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
prices = sorted(list(map(int, input().split())))
sum = 0
for i in range(0,K) :
    sum = sum + prices[i]

print(sum)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())
p = [int(e) for e in input().split()]

p.sort

ans = 0
for i in range(k):
    ans += p[i]

print(ans)

Failing test case input:
3 3
158 001 113 -1 126

Expected output:
113


Actual output:
272


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
p = [int(e) for e in input().split()]

p.sort()

ans = 0
for i in range(k):
    ans += p[i]

print(ans)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b=map(int,input().split())
c=list(map(int,input().split()))
print(c)
d=sorted(c)
ans=0
for i in range(0,b):
 ans+=d[i]
print(ans)

Failing test case input:
1 3
60 001 12 328 0

Expected output:
13


Actual output:
[60, 1, 12, 328, 0]
13


Fixed submission (verdict: Accepted):
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=sorted(c)
ans=0
for i in range(0,b):
 ans+=d[i]
print(ans)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().strip().split())
p = list(map(int, input().strip().split()))
p.sort()
print(sum(p[:K+1]))

Failing test case input:
1 3
60 011 6 328 1

Expected output:
18


Actual output:
78


Fixed submission (verdict: Accepted):
N, K = map(int, input().strip().split())
p = list(map(int, input().strip().split()))
p = sorted(p)
print(sum(p[:K]))
Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

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


A = list(map(int, input().split()))
A = sorted(A, reverse = False)


ans=0


for i in A:
    ans += A.pop(0)
    
    
    
print(ans)




Failing test case input:
3 2
27 001 16 173 10

Expected output:
11


Actual output:
27


Fixed submission (verdict: Accepted):
import sys

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


A = list(map(int, input().split()))
A = sorted(A, reverse = False)


ans=0


ans = (A[:K])

print(sum(ans))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k,_,*p=sorted(map(int,open(0).read().split()))
print(sum(p[:k]))

Failing test case input:
2 3
83 000 13 120 99

Expected output:
96


Actual output:
0


Fixed submission (verdict: Accepted):
_,k,*p=map(int,open(0).read().split())
print(sum(sorted(p)[:k]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())
li = list(input().split())

new_list = sorted(li)

j = 0
i = 0

while i <= k-1:
  j += int(new_list[i])
  i += 1

print(j)

Failing test case input:
1 3
79 001 139 15 17

Expected output:
33


Actual output:
155


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

li.sort(key = int)

j = 0
i = 0

while i <= k-1:
  
  j += int(li[i])
  i += 1

print(j)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = input().split(" ")
n = int(n)
k = int(k)
a = input().split(" ")
a = sorted(a)
ans = 0
for i in range(k):
 ans += int(a[i])
print(ans)


Failing test case input:
1 3
60 001 6 328 1

Expected output:
8


Actual output:
330


Fixed submission (verdict: Accepted):
n, k = input().split(" ")
n = int(n)
k = int(k)
a = [int(x) for x in input().split(" ")]
a.sort()
ans = 0
for i in range(k):
 ans += int(a[i])
print(ans)

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

n,k = map(int,input().split())
p_L = list(map(int,input().split()))

p_L = list(sorted(p_L))
print(sum(p_L[:3]))

Failing test case input:
5 2
95 101 80 21 10

Expected output:
31


Actual output:
111


Fixed submission (verdict: Accepted):

n,k = map(int,input().split())
p_L = list(map(int,input().split()))

p_L = list(sorted(p_L))
print(sum(p_L[:k]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())
p = list(map(int,input().split()))
p = sorted(list(set(p)))

print(sum(p[0:K]))

Failing test case input:
15 3
28 011 4 227 4

Expected output:
19


Actual output:
43


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

print(sum(p[0:K]))

Problem: p02628
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, k = map(int, input().split())
list_ = list(map(int, input().split()))
sorted(list_)

print(sum(list_[:k]))

Failing test case input:
3 2
83 001 16 173 99

Expected output:
17


Actual output:
84


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

print(sum(list_[:k]))