Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
N = int(input())
K = int(input())
p = list(map(int, input().split()))
lists = []
  
for x,y,z in p:
  n = x + y + z
  return lists.append(n)

print(min(lists))
  
  

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))


import itertools
 
N = int(input())
K = int(input())
p = list(map(int, input().strip().split()))
lists = []
for l in itertools.combinations(p, K):
  sums = sum(list(l))
  lists.append(sums)
 
print(min(lists))


N = int(input())
K = int(input())
p = list(map(int, input().split()))
lists = []
for l in itertools.combinations(p, 3):
  sums = sum(list(l))
  return lists.append(sums)

print(min(lists))
  
  


import itertools
 
S = list(map(int, input().strip().split()))
N = S[0]
K = S[1]
p = list(map(int, input().strip().split()))
lists = [1000000000000]
x = list(itertools.combinations(p, K))
counts = len(list(x))
for l in range(1,x+1):
    sums = sum(list(x[counts - 1]))
    if int(sums) <= int(lists[l-1]):
        lists.append(sums)
    else:
        continue

print(min(lists))

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.remove(min(p))
  
print(sum(lists))


import itertools

N = int(input())
K = int(input())
p = list(map(int,input().split()))
lists = []
for l in itertools.combinations(p, K):
  sums = sum(list(l))
  lists.append(sums)

print(min(lists))
  
  


import itertools
 
N = int(input().split())
K = int(input().split())
p = list(map(int, input().strip().split()))
lists = []
for l in itertools.combinations(p, K):
  sums = sum(list(l))
  lists.append(sums)
 
print(min(lists))


import itertools
 
S = list(map(int, input().strip().split()))
N = S[0]
K = S[1]
p = list(map(int, input().strip().split()))
lists = [1000000000000]
x = list(itertools.combinations(p, K))
counts = len(list(x))
  for l in range(1,x+1):
    sums = sum(list(x[counts - 1]))
  	if sums <= lists[l-1]:
    	lists.append(sums)
    else:
        continue

print(min(lists))


import itertools

N = int(input())
K = int(input())
p = list(map(int, input().split()))
lists = []
for l in itertools.combinations(p, K):
  sums = sum(list(l))
  lists.append(sums)

print(min(lists))
  
  


import itertools
 
S = list(map(int, input().strip().split()))
N = S[0]
K = s[1]
p = list(map(int, input().strip().split()))
lists = []
for l in itertools.combinations(p, K):
  sums = sum(list(l))
  lists.append(sums)
 
print(min(lists))


import itertools
 
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(l))
  lists.drop(min(l))
  
print(sum(lists))


import itertools
 
S = list(map(int, input().strip().split()))
N = S[0]
K = S[1]
p = list(map(int, input().strip().split()))
lists = [1000000000000]
x = itertools.combinations(p, K)
counts = len(list(x)
  for l in range(1,x+1):
    sums = sum(list(l))
  	if sums <= lists[l-1]:
    	lists.append(sums)
    else:
        continue

print(min(lists))


N = int(input())
K = int(input())
p = list(map(int, input().split()))
lists = []
for l in itertools.combinations(p, K):
  sums = sum(list(l))
  return lists.append(sums)

print(min(lists))
  
  


import itertools
 
N = int(input())
K = int(input())
p = list(map(int,input().split(" ")))
lists = []
for l in itertools.combinations(p, K):
  sums = sum(list(l))
  lists.append(sums)
 
print(min(lists))

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))


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted