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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A = sum(ans)
print(A)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def ii():
    return int(input())


def il():
    return list(map(int, input().split()))


N, K = il()
L = il()
print(sum(sorted(L)[-K::]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#Begginer 067

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

L = sorted(L,reverse=True)

Sum_l = sum(L[0:K])
print(Sum_l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

lines = sys.stdin.readlines()

for n, line in enumerate(lines):
  if n == 0:
    n, k = [int(_) for _ in line.strip().split(' ')]
  elif n == 1:
    bars = [int(_) for _ in line.strip().split(' ')]
  else:
    raise

bars = sorted(bars, reverse=True)
print(sum(bars[:k]))

Submission status: Accepted

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

l1 = input().split()
l = []
for j in l1:
    l.append(int(j))

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

print(ans)

Submission status: Accepted

Solution code:
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest067-B
#  TODO https://atcoder.jp/contests/abc067/tasks/abc067_b
import time
from contextlib import contextmanager
# from time import sleep
@contextmanager
def timer(title):
	t0 = time.time()
	yield
	print("{} - done in {:.0f}s".format(title,time.time()-t0) )

def  calcLongSnakeToy(needBarNumber,barLengthList):
	longSortedToyList = sorted(barLengthList,reverse=True)
	getBarCountRange = range(0,needBarNumber,+1)
	longLength = 0
	for i in getBarCountRange:
		longLength = longLength + longSortedToyList[i]
	answer = longLength
	return answer


if __name__ == '__main__':
	_,K = map(int,input().strip().split(' '))
	lengthList = list(map(int,input().strip().split(' ')))
	solution=calcLongSnakeToy(K,lengthList)
	print("{}".format(solution))

Submission status: Accepted

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

l.sort(reverse=True)

ans = sum(l[:K])
print(ans)

Submission status: Accepted

Solution code:
def abc067_b():
    _, k = map(int, input().split())
    ls = sorted(list(map(int, input().split())), reverse=True)
    print(sum(ls[:k]))


abc067_b()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(l[:K]))

Submission status: Accepted

Solution code:
#B Snake Toy
import numpy as np
a , b = map(int,input().split())
c = list(map(int,input().split()))
c.sort()
c = c[::-1]
d = np.array(c)
print(d[0:b].sum())

Submission status: Accepted

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

Submission status: Accepted

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


def main():
    """Function."""
    n, k = map(int, input().split())
    line = list(map(int, input().split()))
    line.sort()

    print(sum(line[-k:]))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    _, k = map(int, input().split())
    ls = sorted(map(int, input().split()), reverse=True)
    print(sum(ls[:k]))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

xs = sorted(L)
result = sum(xs[-K:])

print(result)

Submission status: Accepted

Solution code:
N, K = map(int, input().split(' '))
bars = [int(length) for length in input().split(' ')]
bars.sort(reverse=True)

sum_len = 0

for i in range(K):
    sum_len += bars[i]

print(sum_len)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K = [int(i) for i in input().split()]
sticks = [int(i) for i in input().split()]
sticks.sort(reverse=True)
sum = 0
for i in range(K) :
    sum += sticks[i]

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

l = sorted(L, reverse=True)
a = 0
for i in range(K):
    a += l[i]
print(a)

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

l.sort(reverse=True)
ans = 0
for i in range(K):
    ans += l[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a=input().strip().split(" ")

a=[int(i) for i in a]

a.sort()
a.reverse()

Sum=0

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

print(Sum)

Submission status: Accepted

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

result = 0
l.sort(reverse=True)
for i in range(k):
    result += l[i]

print(result)

Submission status: Accepted

Solution code:
# coding: utf-8
N, K = map(int, input().split())
print(sum(i for i in sorted(map(int, input().split()), reverse=True)[0:K]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = [int(_) for _ in input().split()]
print(sum(sorted([int(_) for _ in input().split()], reverse=True)[0:K]))

Submission status: Accepted

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

print(sum(l[:k]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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: Accepted

Solution code:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = sorted(b)
d = c[:(a[0]-a[1])]

print(sum(c)-sum(d))

Submission status: Accepted

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

# 例えば'1 2 3 4 5'などを配列に数値として格納したい場合，こう書けばいける
A = list(map(int, input().split()))

# リスト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: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
br = sorted(ar,reverse=True)
count = 0
for i in range(b):
	count += br[i]
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

tl.sort(reverse=True)
print(sum(tl[:K]))

Submission status: Accepted

Solution code:
N, K = list(map(int, input().strip().split(' ')))
array = list(map(int, input().strip().split(' ')))
num = sorted(array, reverse=True)
num1 = num[:K]
ans = sum(num1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_,n=map(int,input().split());print(sum(sorted(map(int,input().split()))[-n:]))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n,k = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
print(sum(l[:k]))

Submission status: Accepted

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

l.sort(reverse=True)

print(sum(l[:k]))

Submission status: Accepted

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

l = [int(x) for x in input().split()]

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=list(map(int,input().split()))
s.sort()
del s[:a-b]
print(sum(s))

Submission status: Accepted

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-i]
print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin


def main() -> int:
    n, k = map(int, input().split())
    l = [next_int() for _ in range(n)]
    l.sort()
    l.reverse()

    ans = sum(l[:k])
    print(ans)
    return 0


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
A=list(map(int,input().strip().split(" ")))
A.sort(reverse=True)
ans=0
for i in range(0,b):
    ans+=A[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K = map(int, input().split())
l = [int(_) for _ in input().split()]
l.sort()
l.reverse()
print(sum(l[:K]))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(sorted(l, reverse=True)[:k]))

Submission status: Accepted

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

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

index=0
sum=0
while index<k:
    sum+=listL[index]
    index+=1
print(sum)

Submission status: Accepted

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

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

l.sort(reverse = True)

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(L[-1:-(K+1):-1]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

l = sorted(l,reverse = True)
ans = 0
for i in range(K):
    ans += l[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N, K = map(int, input().split())
    L = list(sorted(list(map(int, input().split()))))
    print(sum(L[-K:]))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

L.sort(reverse=True)

print(sum(L[:K]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


# --------------------------------------------

dp = None


def main():
    N, K = li_input()
    L = li_input()

    L.sort(reverse=True)

    print(sum(L[:K]))


main()

Submission status: Accepted

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

res = 0
for i in range(K):
	temp = max(l)
	l.remove(temp)
	res += temp
    
print(res)

Submission status: Accepted

Solution code:
num,length = map(int,input().split())
lis = [int(m) for m in input().split()]
total = 0
for i in range(length):
    total += max(lis)
    lis.remove(max(lis))
print(total)

Submission status: Accepted

Solution code:
#67b
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
a=a[-k:]
print(sum(a))

Submission status: Accepted

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

l = sorted(l, reverse=True)
print(sum(l[0:K]))

Submission status: Accepted

Solution code:
def solve():
    n, k = map(int, input().split())
    lists = list(map(int, input().split()))
    lists = sorted(lists, reverse=True)
    result = 0
    for i in range(k):
        result += lists[i]
    print(result)


solve()

Submission status: Accepted

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

print(sum(sorted(l, reverse=True)[:K]))

Submission status: Accepted

Solution code:
# vim: set fileencoding=utf-8 :
n, k = map(int, raw_input().split())
l = sorted(map(int, raw_input().split()), reverse=True)

print(sum(l[0:k]))

Submission status: Accepted

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

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

Submission status: Accepted

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

def main():
    n, k = map(int, input().split())
    l_list = list(map(int, input().split()))
    l_list.sort(reverse=True)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(map(int, input().split()))

N,K = inpl()
ll = inpl()
ll.sort(reverse=True)
print(sum(ll[:K]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(b[:K]))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力

# s = input()
# t = input()
# # s = "ratcode"
# # t = "atlas"

# # a = int(input())
# # スペース区切りの整数の入力
n,k = map(int, input().split())
l = map(int, input().split())
l = list(l)
l.sort()
l.reverse()
# # 文字列の入力
# s = input()
# s = list(s)
# t = list(t)
# s.sort()
# t.sort()
# t.reverse()

# t2 = ''.join(t)
# s2 = ''.join(s)
c=0
ans=0
for i in l:
  c+=1
  ans+=i
  if c >= k:
    break

print( ans)

# f =False
# for sc,tc in zip(s,t):
#   # print(sc+" "+tc)
#   if tc > sc:
#     f=True
#     break;
#   if tc < sc:
#     f=False
#     break;

# if f:
#   print("Yes")
# else:
#   print("No")

# 出力
# print("{} {}".format(a+b+c, s))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = (int(x) for x in raw_input().split())
print sum(sorted([int(x) for x in raw_input().split()])[-k:])

Submission status: Accepted

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

Submission status: Accepted

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

L = sorted(L)[::-1]

res = 0
for i in range(K):
    res += L[i]

print(res)

Submission status: Accepted

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

print(s)

Submission status: Accepted

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

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

a.sort()
a.reverse()

print(sum(a[0:m]))

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(length_list[:k]))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
"""
https://abc067.contest.atcoder.jp/tasks/abc067_b
"""
[n,k]=[int(i) for i in input().split()]
l=[int(i) for i in input().split()]
l.sort()
a=0
for i in range(k):
    a=a+l[n-i-1]
print(a)

Submission status: Accepted

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

L_li.sort(reverse = True)

cnt = 0
ans = 0
for i in L_li:
        ans += i
        cnt += 1
        if cnt == K:
            break
            
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

# 逆順ソート
num_list.sort(reverse=True)
# K番目まで足し合わせる
ans = 0
for i in range(K):
    ans += num_list[i]
print(ans)

Submission status: Accepted

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

L = sorted(L, reverse = True)

ans = 0

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

print(ans)