qyliang/CodeNanoFix huggingface dataset:
Buggy code:
a=input()
if a == "A" or "B" or "C" or "D" or "E" or "F" or "G" or "H" or "I" or "J" or "K" or "L" or "M" or "N" or "O" or "P" or "Q" or "R" or "S" or "T" or "U" or "V" or "W" or "X" or "Y" or "Z":
  print("A")
else:
  print("a")

Fixed code:
a=input()
if a == "A":
  print("A")
elif a =="B":
  print("A")
elif a =="C":
  print("A")
elif a =="D":
  print("A")
elif a =="E":
  print("A")
elif a =="E":
  print("A")
elif a =="F":
  print("A")
elif a =="G":
  print("A")
elif a =="H":
  print("A")
elif a =="I":
  print("A")
elif a =="J":
  print("A")
elif a =="K":
  print("A")
elif a =="L":
  print("A")
elif a =="M":
  print("A")
elif a =="N":
  print("A")
elif a =="O":
  print("A")
elif a =="P":
  print("A")
elif a =="Q":
  print("A")
elif a =="R":
  print("A")
elif a =="S":
  print("A")
elif a =="T":
  print("A")
elif a =="U":
  print("A")
elif a =="V":
  print("A")
elif a =="W":
  print("A")
elif a =="X":
  print("A")
elif a =="Y":
  print("A")
elif a =="Z":
  print("A")
else:
  print("a")
Buggy code:
a=input()
if a.isupper()==True:print('A')
else:print('B')

Fixed code:
a=input()
if a.isupper()==True:print('A')
else:print('a')
Buggy code:
str=str(input())
if str.isupper():
	print("A")
else
	print("a")

Fixed code:
a = str(input())
if a.isupper() == True:
  print("A")
else:
  print("a")
Buggy code:
alp = input()
if str.isupper(alp) == True:
  print("A")
else:
  pritn("a")

Fixed code:
alp = input()
if str.isupper(alp) == True:
  print('A')
else:
  print('a')
Buggy code:
X=int(input())

if X==X.lower():
    print("a")
else:
    print("A")




Fixed code:
X=input()
if X==X.lower():
    print("a")
else:
    print("A")
Buggy code:
a = input()

if (isupper(a)):
  print("A")
else:
  print("a")

Fixed code:
a = input()

if (a.isupper()):
  print("A")
else:
  print("a")
Buggy code:
alpha = input()
if alpha.isupper():
  output = A
else:
  output = a

print(output)


Fixed code:
alpha = input()
if alpha.isupper():
  output = 'A'
else:
  output = 'a'

print(output)
Buggy code:
c = input()
print('A' if ord('A') <= ord(A) <= ord('Z') else 'a')

Fixed code:
print('A' if ord('A') <= ord(input()) <= ord('Z') else 'a')
Buggy code:
c=input()
if(c.isupper):
	print('A')
else:
	print('a')

Fixed code:
a = input()

if a.isupper():
    print("A")
else:
    print("a")
Buggy code:
a=input()
print("A" if a.isupper else "a")

Fixed code:
A=input()

if A.isupper():
	print("A")
else:
	print("a")
Buggy code:
a = input()
if a.isupper():
  print("A")
else:
  peint("a")


Fixed code:
a = input()
if a.isupper():
  print("A")
else:
  print("a")
Buggy code:
a = str(input())
if a.isupper():
  print("A")
else:
  peint("a")


Fixed code:
a = input()

if str.isupper(a):
    print('A')
else:
    print('a')
Buggy code:
x=input()
if 'x'.isupper()==True:
  print('A')
else:
  print('a')


Fixed code:
a = input().isupper()

if a == True:
    print("A")
else:
    print("a")
Buggy code:
a = input()

if True = a.isupper():
  Print("A")
else :
  print("a")
  


Fixed code:
a = input()
 
if True == a.isupper():
  print("A")
else :
  print("a")
Buggy code:
x=input()
if x.isupper() is True:
    print(A)
else:
    print(a)


Fixed code:
x=input()

if x.isupper() is True:
    print("A")
else:
    print("a")
Buggy code:
str = input()

if str.isupper:
  print('A')
else:
  print('a')

Fixed code:
t = input()

if str.isupper(t):
    print("A")
else:
    print("a")
Buggy code:
x = str(input())

if x.isupper() = True:
  print("A")
else:
  print("a")

Fixed code:
x=input()

if str.isupper(x)==True:
    print('A')
else:
    print('a')
Buggy code:
s = input()

if s.lower == s:
  print('A')
else:
  print('a')

Fixed code:
s = input()
 
if s.lower() == s:
  print('a')
else:
  print('A')
Buggy code:
n,k = map(int,input().split())
p = [int(x) for x in input().split()]
s = 0
for i in range(k):
    s+=p[i]
print(s)


    

Fixed code:
n,k = map(int,input().split())
p = [int(x) for x in input().split()]
p.sort()
s = 0
for i in range(k):
    s+=p[i]
print(s)
Buggy code:
# -*- coding: utf-8 -*-
# input
a, b = map(int, input().split())
x = list(map(int, input()))
x.sorted()
o = 0
for i in range(b):
    o = O+x[i]
print(o)


Fixed code:
# -*- coding: utf-8 -*-
# input
a, b = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
o = 0
for i in range(b):
    o = o+x[i]
print(o)
Buggy code:
n, k = [int(i) in input().split()]
p = [int(i) in input().split()]
p.sort()
print(sum(p[:k])

Fixed code:
n, k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
p.sort()
print(sum(p[:k]))
Buggy code:
N,K=map(int,input.split())
p=list(int,input().split())
B=0
p.sort()
K=K-1
for i in range(0,K):
    B=B+p[i]
    i=i+1
    
print(B)

Fixed code:
N,K=map(int,input().split())
p=list(map(int,input().split()))
B=0
C=0
p.sort()
N=N-5
for i in range(0,K):
    B=B+p[i]
    i=i+1
    
print(B)
Buggy code:
n.k=map(int,input().split())
lis=list(map(int,input().split()))

ans=0
for i in range(k):
  mi=min(lis)
  ans+=mi
  lis.remove(mi)
  
print(ans)

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

ans=0
for i in range(k):
  mi=min(lis)
  ans+=mi
  lis.remove(mi)
  
print(ans)
Buggy code:
nk=input().split()
n=int(nk[0])
k=int(nk[1])
data=list(map(int,input().split()))
data2=data.sort()
s=0
for i in range(k):
    s += data2[i]
print(s)

Fixed code:
nk=input().split()
n=int(nk[0])
k=int(nk[1])
data=list(map(int,input().split()))
data.sort()
s=0
for i in range(k):
    s += data[i]
print(s)
Buggy code:
a,b = input()
listA = list(map(int,input().split()))
listA.sort()
all = 0

for i in range(b):
  all = all + list[i]

print(all)

Fixed code:
a,b = map(int,input().split())
listA = list(map(int,input().split()))
listA.sort()
all = 0

for i in range(b):
  all = all + listA[i]

print(all)
Buggy code:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()
print(b)
d = b[0:a[1]]
print(sum(d))



Fixed code:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()
d = b[0:a[1]]
print(sum(d))
Buggy code:
n,k = map(int , input().split())
p = list(map(int , input()).split())
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

Fixed code:
n,k = map(int , input().split( ))
p = list(map(int , input().split( )))
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)
Buggy code:
n, k = map(int, input().split())
print(sum(sorted(list(map(int, ipupt().split())))[:k]))


Fixed code:
n, k = map(int, input().split())
print(sum(sorted(list(map(int, input().split())))[:k]))
Buggy code:
n, k = map(int, input().split())
p = sorted(list(map(int, ipupt().split())))
print(sum(p[:k]))


Fixed code:
n,k = map(int,input().split())
p = list(map(int,input().split()))
P = sorted(p)
print(sum(P[:k]))
Buggy code:
N, K = map(int, input().split())

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

p = sorted(p)

print(p)

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

print(ans)

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

p = list(map(int, input().split()))
ans = 0
p.sort()
for i in range(K):
        ans += p[i]
print(ans)
Buggy code:
n,k = input().split()
num_list = list(map(int,input().split()))

num_list.sort()
ans = 0

for i in range(k):
  ans += num_list[i]
else:
  print(ans)

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

num_list.sort()
ans = 0

for i in range(k):
  ans += num_list[i]
else:
  print(ans)
Buggy code:
n,k = map(int,input().split())
p = list[]
ans = 0

for i in range (n):
  p[i] = int(input())

p.sort()

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

print(ans)

Fixed code:
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0


p.sort()

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

print(ans)
Buggy code:
n, k = map(int, input().split())
li = list(input().split())

li.sort(key = int)

print(li)

j = 0
i = 0

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

print(j)

Fixed code:
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)
Buggy code:
n, k = map(int, input().split())
p = sorted(map(int, input().split()))
print(sum([:k]))

Fixed code:
n, k = map(int, input().split())
*p, = map(int, input().split())
p = sorted(p)
print(sum(p[:k]))
Buggy code:
n,k=map(int,input().split())
a=list(map(int,input().split())
a.sort()
print(sum(a[:k]))


Fixed code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
print(sum(a[:k]))
Buggy code:
N,K=(int(x) for x in input().split())
p=list(map(int, input().split()))
ld = sorted(p, reverse=True)
l=(ld[:K])
print(sum(l))

Fixed code:
N,K=(int(x) for x in input().split())
p=list(map(int, input().split()))
ld = sorted(p)
l=(ld[:K])
print(sum(l))
Buggy code:
N, K=map(int,input().split())

fruit = list(input().split())
price = list(map(int, input().split()))

price2 = sorted(price)
i = 0
sum = 0
while (i < K):
  sum += price2[i]
  i += 1

print(sum)

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

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

price2 = sorted(price)
i = 0
sum = 0
while (i < K):
  sum += price2[i]
  i += 1

print(sum)
Buggy code:
k_n = list(map(int, input().split()))
p = list(map(int, input().split()))
p = sorted(p, reverse=False)
sum = 0
for i in range(k_n[0]):
    sum += p[i]
print(sum)

Fixed code:
k_n = list(map(int, input().split()))
p = list(map(int, input().split()))
p = sorted(p, reverse=False)
sum = 0
for i in range(k_n[1]):
    sum += p[i]
print(sum)
Buggy code:
n,k=map(int,input().split())
p=list(map(int,input().split()))
print(sum(sorted(p)[:K])

Fixed code:
n, k = map(int, input().split())
p = list(map(int, input().split()))
print(sum(sorted(p)[0:k]))
Buggy code:
n, k = map(int, input().split())
pr = list(map(int, input().split()))

pr.sort()

print(sum(pr[0:k])

Fixed code:
n, k = map(int, input().split())
pr = list(map(int, input().split()))
 
pr.sort()
 
print(sum(pr[0:k]))
Buggy code:
n,k=[int(i) for i in input().strip().split(" ")]
arr=[int(i) for i in input().strip().split(" ")]
arr=sorted(arr)
ans=0
for i in range(k):
    ans+=arr[k]
print(ans)

Fixed code:
n,k=[int(i) for i in input().strip().split(" ")]
arr=[int(i) for i in input().strip().split(" ")] 
ans=0
arr=sorted(arr)
for i in range(k):
    ans+=arr[i]
print(ans)
Buggy code:
n=list(map(int,input().split()))
p=list(map(int,input().split()))
p.sort()
sum(p[:n[1]])

Fixed code:
n=list(map(int,input().split()))
p=list(map(int,input().split()))
p.sort()
print(sum(p[:n[1]]))
Buggy code:
N, K = map(int, input().split())

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

print(sum(P[:K]))

Fixed code:
N, K = map(int, input().split())
 
P = list(map(int, input().split()))
P.sort()
 
print(sum(P[:K]))
Buggy code:
n, k = list(map(int, input().split()))
price_arr = list(map(int, input.split()))
price_arr.sort()
sum = 0
for i in range(0,k):
  sum += price_arr[i]
print(sum)


Fixed code:
n, k = list(map(int, input().split()))
price_arr = list(map(int, input().split()))
price_arr.sort()
sum = 0
for i in range(0,k):
  sum += price_arr[i]
print(sum)
Buggy code:
n,k=int(input())
list=list(map(int,input().split()))
list.sort()
ans=0
for i in range(k):
  ans+=list[i]
print(ans)

Fixed code:
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
p.sort()

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

print(ans)
Buggy code:
N,K = map(int,input().split())
p = list(map(int,input().split()))

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

Fixed code:
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
print(sum(p[:K]))
Buggy code:
if __name__ == "__main__":
    N,k = [int(item) for item in input().split()]
    price_arr = [int(p) for p in input().split()]
    print(sum(sorted(price_arr,reverse=True)[:k]))

Fixed code:
if __name__ == "__main__":
    N,k = [int(item) for item in input().split()]
    price_arr = [int(p) for p in input().split()]
    print(sum(sorted(price_arr)[:k]))
Buggy code:
n,k=map(int,input().split())

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

total=0

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

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

p=list(map(int,input().split()))
p.sort()
total=0

for i in range(k):
  total += p[i]
print(total)
Buggy code:
a=input()
l=a.split(" ")
n=int(l[0])
k=int(l[1])
f=input()
fruits=int(f.split(" "))
for d in range(0, len(fruits)):
    fruits[d]=int(fruits[d])
ans=0
b=0
while(b<k):
    g=max(fruits)
    ans+=g
    fruits.remove(g)
    b+=1
print(ans)

Fixed code:
a=input()
l=a.split(" ")
n=int(l[0])
k=int(l[1])
f=input()
fruits=f.split(" ")
for d in range(0, len(fruits)):
    fruits[d]=int(fruits[d])
ans=0
b=0
while(b<k):
    g=min(fruits)
    ans+=g
    fruits.remove(g)
    b+=1
print(ans)
Buggy code:
N,K=map(int,input().split())
p = list(map(int,input().split()))
ans = 0

p.sort()
for i in range(1,K+1):
  ans += p[i]
print(ans)

Fixed code:
N,K=map(int,input().split())
p = list(map(int,input().split()))
ans = 0

p.sort()
for i in range(K):
  ans += p[i]
print(ans)
Buggy code:
x = input()
arr = [int(j) for j in x.split()]
y = input()
main = [int(i) for i in y.split()]
main = sorted(main)
sum = 0
r = 0
while r < arr[1]:
  sum+=main[r]
  r+=1
print(main)


Fixed code:
x = input()
arr = [int(j) for j in x.split()]
y = input()
main = [int(i) for i in y.split()]
main = sorted(main)
sum = 0
r = 0
while r < arr[1]:
  sum+=main[r]
  r+=1
print(sum)
Buggy code:
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)

Fixed code:
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)
Buggy code:
n, k = map(int, input().split())
p - list(map(int, input().split()))

p = sorted(p, key = int)
print(sum(p[:2]))

Fixed code:
n, k = map(int, input().split())
p = list(map(int,input().split()))
p = sorted(p, key = int)
print(sum(p[:k]))
Buggy code:
N,K=map(int,input().split())
p = list(map(int,input().split()))
p=p.sort()
price=0
for idx in range(K):
  price=price+p[idx]
print(price)

Fixed code:
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)
Buggy code:
from sys import stdin

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

prices = sorted(prices)

sum = 0
for i in range(0, K):
    print(prices[i])
    sum += prices[i]
print(sum)

Fixed code:
from sys import stdin

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

prices = sorted(prices)

sum = 0
for i in range(0, K):
    sum += prices[i]
print(sum)
Buggy code:
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
P = sorted(P)
print(P)
P = P[0:K]
print(sum(P))




Fixed code:
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
P = sorted(P)
P = P[0:K]
print(sum(P))
Buggy code:
n, m =map(int,input().split())
s = list(map(int,input().split()))
ans = 0
s = s.sort()
for _ in range(m):
  ans += s[_]
print(ans)

Fixed code:
n, m =map(int,input().split())
s = list(map(int,input().split()))
ans = 0
s.sort()
for _ in range(m):
  ans += s[_]
print(ans)
Buggy code:
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)

Fixed code:
n,k = map(int,input().split())
l= list(map(int,input().split()))
l.sort()
ans = 0
for i in range(k):
    ans += l[i]
print(ans)
Buggy code:
N, K = list(map(int, input().split()))

price_list = input().split()

price_list.sort()

answer = 0

for i in range(K):
    answer += price_list[i]

print(answer)

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

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

price_list.sort()

answer = 0

for i in range(K):
    answer += price_list[i]

print(answer)
Buggy code:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

ans = 0

B=sorted(A)

for a in B[::-K]:
  ans += a
  if ans > 10**18:
    print('-1')
    break
else:
  print(ans)

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

ans = 0

B=sorted(A)

for a in B[:K]:
  ans += a
  if ans > 10**18:
    print('-1')
    break
else:
  print(ans)
Buggy code:
N,K = map(int,input().split())
P = list(map(int,input().split()))
sum = 0
for i in range(N):
  sum += sorted(P)[i]
print(sum)

Fixed code:
N,K = map(int,input().split())
P = list(map(int,input().split()))
sum,cnt = 0,0
for i in range(K):
  sum += sorted(P)[i]
print(sum)
Buggy code:
n,k=map(int,input().split())
p=list(map(intinput().split()))
p.sort()
q=p[:k]
print(sum(q))
       

Fixed code:
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
q=p[:k]
print(sum(q))
Buggy code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
print(sum[:k])

Fixed code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
print(sum(a[:k]))
Buggy code:
a,b = map(int,input().split())
lol = [int(n) for n in input().split()]
lol.sort()
print(sum(lol[:k]))

Fixed code:
a,b = map(int,input().split())
lol = [int(n) for n in input().split()]
lol.sort()
print(sum(lol[:b]))
Buggy code:
import sys
input = sys.stdin.readline

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

p = sorted(p)
print(sum(p:[K]))


Fixed code:
import sys
input = sys.stdin.readline

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

p = sorted(p)
print(sum(p[:K]))
Buggy code:
n,k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
print(p)
print(sum(p[0:k]))

Fixed code:
n,k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
print(sum(p[0:k]))
Buggy code:
S = list(map(int, input().strip().split()))
N = S[0]
K = S[1]
p = list(map(int, input().strip().split()))
lists = []
for l in range(K):
  lists.append(min(p))
  lists.drop(min(p))
  
print(sum(lists))


Fixed code:
S = list(map(int, input().strip().split()))
N = S[0]
K = S[1]
p = list(map(int, input().strip().split()))
lists = []
for l in range(K):
  lists.append(min(p))
  p.remove(min(p))
  
print(sum(lists))
Buggy code:
N, K = map(int, input().split())
P = list(map(int, input().split()))

P = sorted(P)
print(P)

print(sum(P[:K]))


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

P = sorted(P)

print(sum(P[:K]))
Buggy code:
a = list(map(int,input().split()))
p = list(map(int, input().split()))

N = a[0]
K = a[1]

p = p.sort

g = 0
for i in range(K):
    g = K+p(i)

print(g)

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

N = a[0]
K = a[1]

p.sort()

g = 0
for k in range(K):
	g = g + p[k]
print(g)
Buggy code:
m, k = map(int, input(.split()))
array = list(map(int, input().split()))

array.sort()
print(sum(array[:k]))


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

array.sort()
print(sum(array[:k]))
Buggy code:
import numpy as np
n, k = list(map(int, input().rstrip().split()))
p = list(map(int, input().rstrip().splist()))
p = np.sort(np.array(p))

print(np.sum(p[:k]))

Fixed code:
import numpy as np
n, k = list(map(int, input().rstrip().split()))
p = list(map(int, input().rstrip().split()))
p = np.sort(np.array(p))
 
print(np.sum(p[:k]))
Buggy code:
N,K=map(int,input().split())
ans=0
p=list(map(int,input().split()))

p.sort()

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

    print(ans)


Fixed code:
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)
Buggy code:
n, k = map(int, input().split())
p = list(map(int, input().split())
p.sort()
ans = sum(p[:k])
print(ans)

Fixed code:
n, k = map(int, input().split())
p = list(map(int, input().split()))
         
p.sort()
ans = sum(p[:k])
print(ans)
Buggy code:
N, K = map( int, input() )

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

print( sum( p[ : K ] ) )


Fixed code:
N, K = map( int, input().split() )
 
p = sorted( list( map( int, input().split() ) ) )
 
print( sum( p[ : K ] ) )
Buggy code:
N,K=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
print(l)
print(sum(l[0:K]))


Fixed code:
N,K=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
print(sum(l[0:K]))
Buggy code:
N, K = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse = True)
min = 0

for i in range(K):
  min += A[i]
  
print(min)

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

A.sort()
min = 0

for i in range(K):
  min += A[i]
  
print(min)
Buggy code:
N, K = map(int,input().split())
p = map(int,input().split())
newlist = sorted(p, reverse=False)
ans_list=[]
for i in range(1,K+1):
    ans.append(newlist[i-1])
print(sum(ans_list))


Fixed code:
N, K = map(int,input().split())
p = map(int,input().split())
newlist = sorted(p, reverse=False)
ans_list=[]
for i in range(1,K+1):
    ans_list.append(newlist[i-1])
print(sum(ans_list))
Buggy code:
N,K=map(int,input().split())
p=list(map(int,input().split()))
ppp=sorted(p)
print(ppp)
buy=[]
for i in range(K):
    buy.append(ppp[i])
print(sum(buy))

Fixed code:
N,K=map(int,input().split())
p=list(map(int,input().split()))
ppp=sorted(p)
buy=[]
for i in range(K):
    buy.append(ppp[i])
print(sum(buy))
Buggy code:
n, k = map(int, input().split())
p = list(map(int, input().split()))
p = p.sort()
print(sum(p[:k]))

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

print(sum(p[:k]))
Buggy code:
_,k=map(int,input().split())
print(sum(sorted(list(map(int,input(),split())))[:k]))

Fixed code:
_,k=map(int,input().split())
print(sum(sorted(list(map(int,input().split())))[:k]))
Buggy code:
n,m=map(int, input().split())
l=list(map(int, input().split()))
ans=0
l.sort()
for i in range(k):
    ans=ans+l[k]
print(ans)

Fixed code:
n,m=map(int, input().split())
l=list(map(int, input().split()))
ans=0
l.sort()
for i in range(m):
    ans=ans+l[i]
print(ans)
Buggy code:
N,K=map(int,input().split())
n=list(map(int, input().split()))
m=n.sort()
print(sum(m[0:K]))


Fixed code:
N,K=map(int,input().split())
n=list(map(int, input().split()))
m=sorted(n)
print(sum(m[0:K]))
Buggy code:
import collections

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

for i in range(0,s[1]):
	a = p[i]
b = [int(b) for b in a]
print(sum(b))


Fixed code:
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))
Buggy code:
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)



Fixed code:
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)
Buggy code:
N,K = map(int,input().split())
p = list(map(int,input().split()))

p.sort()
print(p)

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

Fixed code:
N,K=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
sum=0
for i in range(K):
    sum+=p[i]
print(sum)
Buggy code:
n,k = int(input())
p = list(map(int,input().split()))

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

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

li.sort()

ans = 0

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

print(ans)
Buggy code:
N,K=map(int,input().split())
p=list(map(int,input().split()))
l=[]

p.sort()

for i in range(K+1):
  l.append(p[i])
print(sum(l))



Fixed code:
N,K=map(int,input().split())
p=list(map(int,input().split()))
l=[]

p.sort()

for i in range(K):
  l.append(p[i])
print(sum(l))
Buggy code:
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)

Fixed code:
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)
Buggy code:
N, K = map(int, input().split())
p = list(map(int,input().split()))
p = sorted(list(set(p)))

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

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

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