Problem:


Score : 200 points

Problem Statement

Snuke has N sticks.
The length of the i-th stick is l_i.

Snuke is making a snake toy by joining K of the sticks together.

The length of the toy is represented by the sum of the individual sticks that compose it.
Find the maximum possible length of the toy.

Constraints

1 \leq K \leq N \leq 50

1 \leq l_i \leq 50

l_i is an integer.

Input

Input is given from Standard Input in the following format:

N K
l_1 l_2 l_3 ... l_{N}

Output

Print the answer.

Sample Input 1

5 3
1 2 3 4 5

Sample Output 1

12

You can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5, which is the maximum possible length.

Sample Input 2

15 14
50 26 27 21 41 7 42 35 7 5 5 36 39 1 45

Sample Output 2

386



Sample input:
5 3
1 2 3 4 5


Sample output:
12

Submission status: Runtime Error

Solution code:
n,k=int(input().split())
l=list(map(int,input().split()))
l1 = sorted(l, reverse=True)
s=0
for i in range(k):
    s+=l1[i]
print(s)

Submission status: Runtime Error

Solution code:
n,k=int(input().split())
l=list(map(int,input()))
l1 = sorted(l, reverse=True)
s=0
for i in range(k):
    s+=l1[i]
print(s)

Submission status: Runtime Error

Solution code:
n,k=int(input())
l=list(map(int,input()))
l.sort()
s=0
for i in range(k):
    s+=l[i]
print(s)

Submission status: Runtime Error

Solution code:
n,k=int(input())
l=list(map(int,input().split()))
l.sort()
s=0
for i in range(k):
    s+=l[i]
print(s)

Submission status: Runtime Error

Solution code:
#ABC067.B
N,K = map(int,input().split())
l = [map(int,input().split())]
l.sort()
L = l[(N-K):]
ans = sum(L)
print(ans)

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
l = [int(input())for i in range(N)]
l.sort()
L = l[(N-K):]
ans = sum(L)
print(ans)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
ans=int(0)
for i in ramge(n-k,n):
	ans+=A[i]
print(ans)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
ans=int(0)
for i in ramge(n-k,n):
    ans+=A[i]
print(ans)

Submission status: Runtime Error

Solution code:
n,m = map(int, input().split())
a = sorted(list(map(int,input().split())))
print(a[-1]+a[-2]+a[-3])

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
l = sorted(map(int, input().split()), reverse=True)
ans = 0
ans += l[i] for i in range(K)
print(ans)

Submission status: Runtime Error

Solution code:
N ,K = map(int, input().split())
L = list(map(int, input().split()))
snake = 0
for i in range(K+1):
  snake += L[i]
print(snake)

Submission status: Runtime Error

Solution code:
N, K = list(map(int, input().split()))
L = llst(map(int, input().split()))
sort.L(reverse = True)
print(sum(l in L for k in range(K+1)))

Submission status: Runtime Error

Solution code:
k = int(input().split('')[1])
sticks = sorted(list(map(int,input().split())),reverse=True)

total = 0

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

print(total)

Submission status: Runtime Error

Solution code:
k = input().split('')[1]
sticks = sorted(list(map(int,input().split(''))),reverse=True)

total = 0

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

print(total)

Submission status: Runtime Error

Solution code:
n = input().split('')[0]
k = input().split('')[1]

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

total = 0

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

print(total)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
li = sorted(list(map(int, input().split())), reverse=True)

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

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=sorted(list(map(int,input().split())),reverse=True)
print(sum(l[:k])

Submission status: Runtime Error

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

l.sort()
print(sum(l[-K:])

Submission status: Runtime Error

Solution code:
l = list(map(int, input().split()))
N, K = map(int, input().split())
i = 0
std = sorted(l, reverse = True)
print(sum(std[0:K]))

Submission status: Runtime Error

Solution code:
N = list(map(int, input().split()))
K = map(int, input().split())
l = 0
i = 0
std = sorted(N, reverse = True)
while i < K:
  l += std[i]
  i += 1

Submission status: Runtime Error

Solution code:
N = list(map(int, input().split()))
K = map(int, input().split())
l = 0
std = sorted(N, reverse = True)
for i = 0 and i <= K and i += 1:
  l += std[i]

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
l = sorted(list(map(int,input().split())),reverse=True)
print(sum[0:3])

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=list(map(int,input().split()))
a=0
l.sort(reverse=True)
for i in range(k):
    a+=l[i]
print(a)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=list(map(int,input().split()))
a=0
l.sort()
for i in range(k):
    a+=l[i]
print(l)

Submission status: Runtime Error

Solution code:
N, K = [int(x) for x in input().split()]
lens = [int(x) for x in input().split()]

lens = sorted(lens).reverse()

if len(lens) >= K:
    print(sum(lens))
else:
    print(sum(lens[:K]))

Submission status: Runtime Error

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

N, K = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
l = sorted(l, reverse=True)
print(sum(l[K]))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
l = [list(map(int,input().split())) for i in range(a)]
l=sorted(l)
l=l[::-1]
sum = 0
for i in range(b-1):
  sum += l[i]
print(sum)

Submission status: Runtime Error

Solution code:
n, k = map(int,input().split())
l = list(input())
a = sorted(l)[::1]
print(sum(a)[::a])

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
ln=[int(_) for _ in input().split()]
ans=0
ln.sorted(reverse=True)
print(sum(ln[0:k+1]))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
mapa = map(int, input().split())
lista = list(mapa)
cont = 0
lixo = n-k
soma = 0

while cont < lixo:
    print(min(lista))
    lista.pop(min(lista))   #ta errado essa linha
    cont = cont + 1

print(sum(lista))

Submission status: Runtime Error

Solution code:
n,k = input().split()
n = int(n)
k = int(k)
l = (int,input().split())
lista = list(l)
soma = 0
menor = 0
for num in lista:
    while k > 0:
        k = k - 1
        menor = menor + min(lista)
        soma = soma + num - menor
        print(soma)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
c = 0
lista = []
listamaior = []
while c < n:
    l = int(input())
    lista.append(l)
    c += 1
lista.sort()
maior = lista[n - k]
for i in lista:
    if maior <= i:
        maior = i
        listamaior.append(maior)
print(sum(listamaior))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
c = 0
c2 = 0
lista = []
listamaior = []
while c < n:
    l = int(input())
    lista.append(l)
    c += 1
lista.sort()
maior = lista[n - k]
for i in lista:
    if maior <= i:
        maior = i
        listamaior.append(maior)
print(sum(listamaior))

Submission status: Runtime Error

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

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

lst.sort()
lst.reverse()
print(lst[0] + lst[1] + lst[2])

Submission status: Runtime Error

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

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

lst.sort()
lst.reverse()
print(lst[0] * lst[1] * lst[2])

Submission status: Runtime Error

Solution code:

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

k = sorted(l)

print(k[-1] + k[-2] + k[-3])

Submission status: Runtime Error

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

print(sum(sorted(list(map(input(split()))), reverse = True)[0:k+1]))

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()[::-1]
res = 0
for i in range(k):
    res+=l[i]
print(res)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
l = list(map(int, input().split())).sort(reverse=True)
print(sum(l[0:k]))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
a.reverse()
print(sum(0,k+1))

Submission status: Runtime Error

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

sorted_Ls = sorted(Ls, reverse=True)
length_sum = 0
for k in K:
    length_sum += sorted_Ls[k]
print(length_sum)

Submission status: Runtime Error

Solution code:
def main():
  N, K = map(lambda i: int(i), input().split(' '))
  l = list(map(lambda i: int(i), input().split(' '))
  l.sort()
  l.reverse()
  m = 0
  for i in range(K):
    m += l[i]
  print(m)

main()

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
li=[map(int,input().split())]
li_sort=sorted(li,reverse=True)
print(sum(li_sort[::K]))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
li=[map(int,input().split())]
li_sort=sorted(li,reverse=True)
print(sum(li_sort[:K]))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
li=[int(input())]
li_sort=sorted(li,reverse=True)
print(sum(li_sort[:K]))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
L = list(map(int, input().split()))
L.sort()
L.reverse()
print(L[0] + L[1] + L[2])

Submission status: Runtime Error

Solution code:
#1行目を読み取る
line1 = input()
#スペースで区切る
splitLine1 = line1.split()

#それぞれをintに変換してn, kに代入する
#n, k = map(int, splitLine1)を分解
n = int(splitLine1[0])
k = int(splitLine1[1])

#2行目を読み取る
line2 = input()
#スペースで区切る
splitLine2 = line2.split()

#それぞれをintに変換してリストとして持つ
lengthList = []
for i in range(n):
  eachLengthNum = int(splitLine2[i])
  lengthList.append(eachLengthNum)

#lengthListを数字の小さい順にソートする
lengthList.sort()
#順番に取り出すために、大きい順に並べ替える
#reverseを使うと、listの順番をひっくり返す
lengthList.reverse()

#頭からkまでの数字を合計していく
resultLengthSum = 0
for i in range(k):
  resultLengthSum += l[i]

#答えを出力
print(resultLengthSum)

Submission status: Runtime Error

Solution code:
N = int(input())
L = list(map(int, input().split()))

L.sort(reverse=True))
print(L[0:K+1])

Submission status: Runtime Error

Solution code:
n, k = map(int, input())
print(sorted(map(int, input().split()), key = lambda x:-x)[0:k])

Submission status: Runtime Error

Solution code:
n,k=map(int,imput().split())
a=list(map(int,input().split()))
a=sorted(a)
sum=0
for i in range(len(a)-1,len(a)-k,-1):
  sum=sum+a[i]
print(sum)

Submission status: Runtime Error

Solution code:
N, K = [int(_) for _ in stdin.readline().rstrip().split()]
L = sorted([int(_) for _ in stdin.readline().rstrip().split()], reverse=True)
print(sum(L[:k]))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=sort(list(map(int,input().split())),reverse=True)
ans=0
for i in range(k): ans+=l[i]
print(ans)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
print(sum(li[:k])

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 0

a.sort(reverse=True)
a_sum = sum(a[0:len(a):2])
b_sum = sum(a[1:len(a):2])

ans = a_sum-b_sum

print(ans)

Submission status: Runtime Error

Solution code:
n, k = map(int,input().split())
print(sum(sorted(list(map(int,input().split())).reverse=True)[0:k]))

Submission status: Runtime Error

Solution code:
import numpy as np

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

ls = input().split()
ls_arr = np.array(N)
for i in range(N):
  ls_arr[i] = int(ls[i])

ls_arr = np.sort(ls_arr)[::-1]

ans = int(ls_arr[:K].sum())

print(ans)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
L = list(map(int, input().split()))
L = L.sorted(reverse=True)
sum = 0

for i in L:
  sum += L[i]

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
L = list(map(int, input().split()))
L = L.sort(reverse=True)
sum = 0

for i in L:
  sum += L[i]

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort(revese = True)
sum_l=0
for i in range(0,k):
    sum_l+=l[i]

print(sum_l)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
l = list(map(int, input().split))
l.sort(revese = True)
sum_l=0
for i in range(0,k):
    sum_l+=l[i]

print(sum_l)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
lst = list(map(int, input().split())
print(sum(sorted(lst)[:k])

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
lst = [int(input()) for i in range(n)]
print(sum(sorted(lst)[:k])

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=list(map(int,inout().split()))
print(sum(sorted(l)[:k][::-1]))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = 0
for i in li[:K]
  total += i
  
print(total)

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = 0
for i in li[:k-1]:
  total += i
  
print(total)

Submission status: Runtime Error

Solution code:
n,k = map(int,input.split())
n_list = list(map(int,input.split()))
n_list.sort()
n_list.reverse()
n_list[:k]
length = 0
for i in n_list[:k] :
  length += i
print(length)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
n_list = list(map(int,input().split()))
n_list = n_list.sort()
n_list = n_list.reverse()
length = 0
for i in range(k + 1):
  length += i
print(length)

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define All(v) (v).begin(),(v).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
int main(){
    int n, k;
    cin >> n >> k;
    int l[100];
    rep(i, n) cin >> l[i];
    sort(l, l + n, greater<int>());
    int res = 0;
    rep(i, k) res += l[i];
    cout << res << endl;
}

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
l = sort(list(map(int, input().split())), reverse=True)
print(sum(l[:k]))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
l = list(map(int,input().split()))
ans = 0
l.sorted()
for i in range(K):
  ans += l[i]
print(ans)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=list(map(int,input().split()))
ans=0
for i iin range(k):
  m=max(l)
  ans +=m
  l.remove(m)
print(ans)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=0
for i in range(m)
ans+=l[i]

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
A = [int(x) for x in input().split()]
A.sort()

answer = sum(A[-K:])
print(answer)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
l = list(map(int,input().split())).sort()
s = 0
for i in range(k):
  s += l[i]
print(s)

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
L = sorted(list[map(int,input().split())], reverse=True)

print(sum(L[:K]))

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
l = [input() for _ in range(n)]

l.sort(reverse=True)
print(sum(l[:k]))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
sum = 0
for i in range(k):
        sum += l[i]
print(sum)
~

Submission status: Runtime Error

Solution code:
N,K = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
l.sort(reversed = True)
print(sum(l[:K]))

Submission status: Runtime Error

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

ans = 0
for i in range(K):
    ans += L.pop(max(L))

print(ans)

Submission status: Runtime Error

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

for i in range(K):
    ans += L.pop(max(L))

print(ans)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
lList = list(map(int, input().split())).sort(reverse = True)
ans = 0
for i in range(K):
    ans += lList[i]
print(ans)

Submission status: Runtime Error

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

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

a.sort(reverse=True)

print(sum(a[:k]))

Submission status: Runtime Error

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

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

a.sort(reverse=True)

print(sum(a[:k])

Submission status: Runtime Error

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

ans = 0
for i in range(K):
	m = max(l)
	ans += m
	l[l.find(str(m))] = 0
print(ans)

Submission status: Runtime Error

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

ans = 0
for i in range(K):
	m = max(l)
	ans += m
	l[l.find(m)] = 0
print(ans)

Submission status: Runtime Error

Solution code:
t,l=open(0);print(sum(sorted(map(int,l.split()))[-int(t[2:])]))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=[(int(i) for i in input().split())]
l.sort(reverse=True)
print(sum(l[:k]))

Submission status: Runtime Error

Solution code:
n,k=map(inr,input().split())
l=[(int(i) for i in input().split())]
l.sort(reverse=True)
print(sum(l[:k]))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=[int(input())for i in range(n)]
l.sort(reverse=1)
print(sum(l[:k]))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split())).sort()
A.revrese
print(sum(A[:K]))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split())).sort().reverse()

print(sum(A[:K]))

Submission status: Runtime Error

Solution code:
N, K = map(int,input().split(" "))
L = list(map(int,input().split(" ")))

L.sort(inverse = True)
length_of_snake = 0
for i in range(K):
  length_of_snake += L[i]

print(length_of_snake)

Submission status: Runtime Error

Solution code:
n,k,s=map(int,input().split()),list(map(int,input().split()));s.sort();print(sum(s[-k:]))

Submission status: Runtime Error

Solution code:
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
a.reversed()
print(sum(a[:m]))

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<algorithm>
using namespace std;

int main(){
	int N,K;
	cin>>N>>K;
	int l[N];
	for(int i=0;i<N;++i){
		cin>>l[i];
	}
	sort(l,l+N,greater<int>());
	int ans=0;
	for(int i=0;i<K;++i){
		ans+=l[i];
	}
	cout<<ans<<endl;
}

Submission status: Runtime Error

Solution code:
K, N = map(int, input().split())
L = list(map(int, input().split())).sort(reverse=True)
print(sum(L[:K]))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
l = sorted(list(map(int, input().split())))
l = list(reversed(l))

print(sum(:l[k-1]))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N, K;
  cin >> N >> K;
  std::vector<int> l(N);
  for (int i = 0; i < N; i++) {
    cin >> l.at(i);
  }
  sort(l.begin(), l.end());
  int ans=0;
  for (int i = N-1; i > N-1-K; i--) {
    ans += l.at(i);
  }
  cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
x , y = map(int,input().split())
if x % 3 == 0 or y % 3 == 0 or (x+y) % 3 ==0:
    print("Possible")
else:
    print("Impossible")
remote@G465:~/abc/067$ vim b.py
remote@G465:~/abc/067$ cat b.py
N ,K = map(int,input().split())
L = list(map(int,input().split()))
L = sorted(L)[::-1]
ans = 0
for i in range(K):
    ans = ans + L[i]
print(ans)

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
A=sorted(list(map(int,input().split()))).reverse()
ans=0
for i in range K:
  ans+=A[i]
  
print(ans)

Submission status: Runtime Error

Solution code:
l1 = input().split()
a, b = list(map(int, l1))

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

l3 = sorted(l2)
sum = l3[-1] + l3[-2] + l3[-3]
print(sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
l = []
for i in range(N):
    l.append(int(input()))

l.sort(reverse=True)

print(sum(l[:K]))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=list(int(input()))
l.sort(reverse=True)
s=0
for i in range(k):
    s+=l[i]
print(l)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
Li = list(map(int, input().split()))
Li.reverse()

length = 0
for l, i in Li:
  length += 0
  if i == k - 1:
    break
    
print(length)

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
l = [map(int,input().split())]
m = sorted(l).reverse()
b = []
for i in range(K):
  b.append(m[i])
print(sum(b))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N,K = map(int,input().split())
a = [int(i) for i in range(N)]
L = sorted(a)
M = a.reverse()
b = []
for j in range(K):
  b.append(L(j))
print(sum(b))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N,K = map(int,input().split())
a = [int(i) for i in range(N)]
L = sorted(a)
L = L[::-1]
for i in range(N):
  b.append(a[i])
print(sum(b))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
ans = 0

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

nums.sort(reverse="True")

for i in range(k):
  ans += nums.pop(0)
  
print(ans)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
ans = 0

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

nums.sort

for i in range(k):
  ans += pop.nums(0)
  
print(ans)

Submission status: Runtime Error

Solution code:
# NとKを数値入力させる
N, K = map(int, input().split())

# 棒を入れるリストを用意する
A = []

# N本の棒の長さを入力させる
for i in range(N):
    # 数字を1つ入力させる
    a = int(input())

    # リストAに追加する
    A.append(a)

# リストAをソートする．このとき引数にreverse = Trueを設定すると降順になる（デフォルトは昇順）
A = sorted(A, reverse = True)

# 現在リストAには大きい順に棒の長さが格納されている．
# 大きい方からK本の長さの総和が最大値なので初期値0にしてK本分足していく
ans = 0
for i in range(K):
    ans += A[i]

print(ans)

Submission status: Runtime Error

Solution code:
n,k = map(int, input().split())
l = int(input())
l = sorted(l, reverse=True)
ans = 0
for i in range(0,k - 1):
  ans += l[i]
print(ans)

Submission status: Runtime Error

Solution code:
n,k = map(int, input().split())
l = int(input())
l = sorted(l, reverse = True)
ans = 0
for i in k:
  ans += l[i]
print(ans)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum[:k])

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
c=0
for i in range(k):
    c += l[-1-k]
print(c)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=list(map(int,input.split()))
l.sort()
c=0
for i in range(k):
    c += l[-1-k]
print(c)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
l = map(int,input().split())
l.sort(reverse=True)
print(sum(l[0:k]))

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
l = map(int,input().split())
l = l.sort(reverse=True)
print(sum(l[0:k]))

Submission status: Runtime Error

Solution code:
n,k=map(int, input().split())
l = list(map(int, input().split()))
l.sort(reversed=True)
print(sum(l[:k]))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
int_list = sorted(list(map(int, input().split())), reverse=True)

print(sum(int_list[:K])

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=reversed(sorted(list(map(int,input().split()))))
sum=0
for i in range(k):
    sum+=l[i]
print(sum)

Submission status: Runtime Error

Solution code:
n, k = list(map(int, input().split()))
l=[int(x) for x in input().split()]
l.sort()
l.reverse()
print(sum(l[0:K]))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
a=sorted(l)
for j in range(k):
  s+=a[-(j+1):]
print(s)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
l = sorted(map(int, input().split()), reversed=True)
print(sum(l[:K]))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
l = soted(map(int, input().split()), reversed=True)
print(sum(l[:K]))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
l = soted(map(int, input().split()))
print(sum(l[:-K]))

Submission status: Runtime Error

Solution code:
n, k = [int(x) for x in input().split()]
l = [int(y) for y in input().split()]

l.sort()

print(l[-1]+l[-2]+l[-3])

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
a=[]
for i in range(n):
 a+=map(input().split())
a.sort()
ans=0
for i in range(k):
 ans+=a[i]
print(ans)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
a=[]
for i in range(n)
 a+=map(input().split())
a.sort()
ans=0
for i in range(k)
 ans+=a[i]
print(ans)

Submission status: Runtime Error

Solution code:
N, K = input().split()
l = input().split()
l = list(map(int, l))
l.sort(reverse=True)

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

Submission status: Runtime Error

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

l = map(int, input().split(" "))
l.sort()

sum = 0
for i in range(n-k-1, n-1):
    sum = sum + l[i]

print(sum)

Submission status: Runtime Error

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

l = map(int, input().split(" "))
l.sort()

sum = 0
for i in range(n-k,n):
    sum = sum + l[i]

print(sum)

Submission status: Runtime Error

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

l = map(int, input().split(" "))
l.sort()

sum = 0
for i in range(n-k,n):
    sum += l[i]

print(sum)

Submission status: Runtime Error

Solution code:
#!/usr/bin
# -*- cording: "utf-8" -*-
 
a, b = map(int, input().split())
c = list(map(int, input().split()))
c.sort(reverse=true)
for i in range(b):
  x = x + c[i]
print(x)

Submission status: Runtime Error

Solution code:
!/usr/bin
# -*- cording: "utf-8" -*-

a, b = map(int, input().split())
c = list(map(int, input().split()))
c.sort(reverse=true)
for i in range(b):
  x = x + c[i]
print(x)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
N=int(b[0])
K=int(b[1])

ans=[]
l=[]
for i in range(N):
    l.append(int(input()))
for w in range(K):
    ans.append(max(l))
print(sum(ans))

Submission status: Runtime Error

Solution code:
Inp = input()
Blist = Inp[1]
Blist.sort()

out = 0
for i in range(Imp[0,1]):
    out += Blist[-(i+1)]
    
print(out)

Submission status: Runtime Error

Solution code:
def solution(n, k, l_list):
    l_list.sort(reverse=True)
    result = sum(l_list[:k])
    return result


N, K = [int(value) for value in input().split(' ')]
l_list = [int(value) for value in input().split(' ')]
print(solution(n, k, l_list))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys

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

l.sort()

X = range(K, -1, -1)

s = 0
for i in range(K, K-N+1, -1):
    s += l[i]

print(l, s, X)

Submission status: Runtime Error

Solution code:
n, k = map(int, raw_input().split())
a = map(int, raw_input().split())
a.sort(reverse = True)
ans = 0:
for i in xrange(k):
    ans += a[i]
print ans

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys

N, K = map(int, input().split())
l = list()
for i in range(N):
    l.append( map( int, input().split() ) )

l.reverse()

for i in range(K)
    sum += a[i]

print(sum)