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: Wrong Answer

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

Submission status: Wrong Answer

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

L.sort()
print(sum(L[-3:]))

Submission status: Wrong Answer

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

l.sort

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

L.sort() 
L_len = len(L) 
print(sum(L)-sum(L[:k-1]))

Submission status: Wrong Answer

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

L.sort() 
L_len = len(L) 
print(sum(L[-L_len:]))

Submission status: Wrong Answer

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n, k = i_map()
    num_list = i_list()

    num_list.sort(reverse=True)

    print(num_list[:2])

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

L.sort()
L.reverse()
ans = 0
for i in range(0,n):
  ans += L[i]
  
print(ans)

Submission status: Wrong Answer

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

print(sum(sorted(l)[-K-1:]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=sorted([int(i) for i in input().split()])
print(sum(a[-m:]),a[-m:])

Submission status: Wrong Answer

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

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

tar = A[-K:]
tar_sum = sum(tar)
print(tar_sum)

Submission status: Wrong Answer

Solution code:

N, K = map(int, input().split())
l = list(map(int, input().split()))[::-1]

print(sum(l[:K]))

Submission status: Wrong Answer

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n,k = map(int,input().split())
l = sorted(list(map(int,input().split())))
l2 = []
c = 0
for i in range(len(l)):
    c += l[i]
    l2.append(c)
ans = 0
for i in range(len(l)-k):
    ans = max(ans,l2[k+i] - l2[i])
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, K = list(map(int,_in[0].split(' ')))
    l_arr = list(map(int,_in[1].split(' ')))
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    l_arr.sort(reverse=True)
    cnt = l_arr[:K]
    ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l.sort(reverse=True)

print(sum(l[0:K+1]))

Submission status: Wrong Answer

Solution code:
import sys

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

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

l.sort()

max_length = 0
for item in l[n-1:n-k-1:-1]:
    max_length += item

print("{}".format(max_length))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = [int(e) for e in input().split()]
sticks_length = list(map(int, input().split()))
sticks_length.sort(reverse=True)
sum(sticks_length[:k:1])

Submission status: Wrong Answer

Solution code:
import sys
 
stdin = sys.stdin

mod = 1000000007
inf = 1 << 60
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n, k = na()
l = na()

l.sort()
ans = sum(l[-1:n - k - 1:-1])

print(ans)

Submission status: Wrong Answer

Solution code:
N, K = map(int,input().split())
l = list(map(int,input().split()))
sum_raw = []
ans_raw = []
sum = 0

for i in range(0, N):
	sum += l[i]
	sum_raw.append(sum)

ans_raw.append(sum_raw[K - 1])

for i in range(0, N - K + 1):
	ans = sum_raw[i + K -1] - sum_raw[i - 1]
	ans_raw.append(ans)

print(ans_raw)


print(sum_raw)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(sum(l[:k]))

Submission status: Wrong Answer

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

for i in range(n-k+1):
    lst.append(sum(l[i:i+k+1]))

print(max(lst))

Submission status: Wrong Answer

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

for i in range(n-k+1):
    lst.append(sum(l[i:i+k]))

print(max(lst))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = map(int,input().split())
l = map(int,input().split())
lista = list(l)
soma = 0
menorN = lista[0]
if 1 <= K <= N <= 50:
    for num in lista:
        if 1 <= num <= 50:
            soma = soma + num  
            if num <= menorN:
                menorN = num          
print(soma - menorN)

Submission status: Wrong Answer

Solution code:
N, K = map(int,input().split())
l = map(int,input().split())
lista = list(l)
soma = 0
menorN = lista[0]
maiorN = lista[0]
if 1 <= K <= N <= 50:
    for num in lista: 
        if num <= menorN:
             menorN = num
        if num >= maiorN:
            maiorN = num
    for num in lista:
        soma = soma + num
            
        
print(soma - menorN)

Submission status: Wrong Answer

Solution code:
N, K = map(int,input().split())
l = map(int,input().split())
lista = list(l)
soma = 0
menorN = lista[0]
for num in lista:
    soma = soma + num  
    if num <= menorN:
        menorN = num          
print(soma - menorN)

Submission status: Wrong Answer

Solution code:
A, B = map(int,input().split())
result = 0
for num in range(A + 1):
    if num >= B:
        result = result + num
print(result)

Submission status: Wrong Answer

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

buf=sorted(l,reverse=True)
print(buf)
result=0

for i in range(K):
    result+=buf[i]

print(result)

Submission status: Wrong Answer

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

answer = 1
for i in range(k):
  answer *= lst[i]
  
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

A.sort(reverse=True)

AMAX = A[0:3]

print(sum(AMAX))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

li=list(map(int,input().split()))
li.sort(reverse=True)

ans=0

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

  print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
print("no" if len(s)-len(set(s)) else "yes")

Submission status: Wrong Answer

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

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

l.sort()

ans=0
for i in range(k):
    ans+=l[k-1-i]
print(ans)

Submission status: Wrong Answer

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+1):
  ans += i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = [int(num) for num in input().split()]
list = [int(num) for num in input().split()]
list.reverse()
print(sum(list[:k]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

array.sort()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# ABC 67, B - snake toy
n, k = [int(el) for el in input().split(' ')]
L = sorted([int(l) for l in input().split(' ')])

print(L[-k:])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    if not (a % 3 and b % 3 and (a + b) % 3):
        print("Possible")
    else:
        print("Impossible")
    return

#B
def B():
    k, n = LI()
    l = LI()
    l.sort()
    print(sum(l[k:k - n - 1:-1]))
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Wrong Answer

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

for i in range(N):
    if K != 0:
        ans += l[i]
        K -= 1
    elif K == 0:
        print(ans)
        break

Submission status: Wrong Answer

Solution code:
N,K =map(int,input().split())
Int = list(map(int,input().split()))
Int.sort(reverse=True)
print(Int)
length = 0

for i in range(int(K)):
	length += int(Int[i])
print(length)

Submission status: Wrong Answer

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

for i in range(int(K)):
	length +=int(Int[i])
print(length)

Submission status: Wrong Answer

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

for i in range(len(Int)-1,len(Int)-(int(K)+1),-1):
	length +=int(Int[i])
print(length)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,K = [int(x) for x in stdin.readline().rstrip().split()]
data = [int(x) for x in stdin.readline().rstrip().split()]
data = sorted(data)
print(sum(data[-N:]))

Submission status: Wrong Answer

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

answer = []
for i in range(len(l)-(k-1)) :
    sum = 0
    for j in range(k) :
        sum += l[i+j]
    answer.append(sum)

print(max(answer))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
nk = input().split(" ");
n = int(nk[0]);
k = int(nk[1]);
l = input().split(" ");
l.sort(reverse=True)
ans = 0;
for i in range(k) :
	ans = ans + int(l[i]);
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

l.sort(reverse=True)

l = l[:3]

print(sum(l))

Submission status: Wrong Answer

Solution code:
n, k = [ int(v) for v in input().split() ]
bar_list = sorted([ int(v) for v in input().split() ], reverse = True)
print(bar_list[:k])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(sum(L[:K]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

L.sort()
print(sum(L[:K+1]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
0

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())
listA = list(map(int, input().split()))
listA.sort()
listB = listA[:k]
sum(listB)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
l = list(map(int,input().split()))
slide = N - K + 1
Max = sum(l[:K])
Sum = 0
count = 0


for i in range(0,slide):
        Sum = sum(l[i:K+i])
        if Max < Sum:
                 Max = Sum
print(Max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 067B
n,k = map(int, input().split())
ll = list(map(int, input().split()))
print( sum(sorted(ll)[-3:]))

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l = list(input().split(" "))

l = sorted(l,reverse=True)

result = 0

for i in range(0,int(k)):
    result += int(l[i])

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N,K = map(int,input().split()) #棒の個数、選ぶ棒の個数の入力
a = [int(i) for i in range(N)] #棒のそれぞれの長さの記入
L = sorted(a) #aを小さい順に並べる
L.reverse() #Lの要素を反転させる
b = [] #リストの作成
for j in range(K):
  b.append(L[j])
print(sum(b))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N,K = map(int,input().split()) #棒の個数、選ぶ棒の個数の入力
a = [int(i) for i in range(N+1)] #棒のそれぞれの長さの記入
L = sorted(a) #aを小さい順に並べる
L.reverse() #Lの要素を反転させる
b = [] #リストの作成
for j in range(K): 
  b.append(L[j])
print(sum(b))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

nums.sort()

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

Submission status: Wrong Answer

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

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

nums.sort

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
lis = input().split(' ')
N= int(lis[0])
L = int(lis[1])

l = input().split(' ')

l.sort()

ans = 0
n = N - 1
for i in range(L):
#    print(l[n])
    ans += int(l[n])
    n -= 1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    sums = 0
    raw_inputer = raw_input()
    raw_inputer_test = raw_inputer.split(" ")

    N = int(raw_inputer_test[0])
    K = int(raw_inputer_test[1])


    lenter = raw_input()
    lenter_test = lenter.split(" ")

    if N!=len(lenter_test):
        sys.exit()

    if N < K:
       sys.exit() 
    elif K < 1:
        sys.exit()
    elif 50 < N:
        sys.exit()
    else:
        pass

    for j in lenter_test:
        if j < 1 and 50 <j:
            sys.exit()
            break

    lenter_test.sort()
    lenter_test.reverse()

    for i in range(K):
        sums += int(lenter_test[i])


    print(sums)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    sums = 0
    raw_inputer = raw_input()
    raw_inputer_test = raw_inputer.split(" ")

    N = int(raw_inputer_test[0])
    K = int(raw_inputer_test[1])


    lenter = raw_input()
    lenter_test = lenter.split(" ")

    if N < K:
       sys.exit() 
    elif K < 1:
        sys.exit()
    elif 50 < N:
        sys.exit()
    else:
        pass

    for j in lenter_test:
        if j < 1 and 50 <j:
            sys.exit()
            break

    lenter_test.sort()
    lenter_test.reverse()


    for i in range(K):
        sums += int(lenter_test[i])


    print(sums)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:

def main():
    sums = 0
    raw_inputer = raw_input()
    raw_inputer_test = raw_inputer.split(" ")

    lenter = raw_input()
    lenter_test = lenter.split(" ")

    lenter_test.sort()
    lenter_test.reverse()

    counter = int(raw_inputer_test[1])

    for i in range(counter):
        sums += int(lenter_test[i])


    print(sums)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

L.sort(reverse=True)
print(sum(L[:3]))

Submission status: Wrong Answer

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])
k = int(arr_data[0][1])

arr01=arr_data[1]

arr02=sorted(list(map(int, arr01)),reverse=True)

print(n,k,arr02)

mysum=0
for v in range(0,len(arr02)):

    if(v!=k):
        mysum+=arr02[v]
   
        
    else:
        break
print(mysum)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
num = [0]*N
tmp = input().split()
for i in range(N):
  num[i] = int(tmp[i])
num.sort()
sum = 0
for j in range(K):
  sum += num[j]
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ToyLen = 0

for i in range(int(K)):
    ToyLen += int(max(l))
    l.remove(max(l))

print(ToyLen)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#coding: utf-8
n, k = [int(i) for i in input().split()]
l  = input().split()

l.sort()
l.reverse()

re = 0
for i in range(k):
   re += int(l[i])

print(re)

Submission status: Wrong Answer

Solution code:
num = input().split()

N = int(num[0])
K = int(num[1])

l = input().split()

i = 0
length = []

while i < N:
    length.append(l[i])
    i += 1

length.sort()

sum = 0
i = 0

while i < K:
    sum += int(length.pop())
    i += 1

print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !
 
x=input()
a=int(x.split(" ")[0])
b=int(x.split(" ")[1])
y=input()
c=y.split(" ")
c=sorted(c,reverse=True)
sum = 0
for i in range(b):
    sum += int(c[i])
print (sum)

Submission status: Wrong Answer

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

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

a = sorted(L)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

nums.sort()
nums.reverse()
ans=0

for v in range(0,k):
    ans=ans+int(nums[v])

print(ans)

Submission status: Wrong Answer

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

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

l = sorted(l)

ans = 0
for k in range(-1, -K-1 -1):
    ans += l[k]

print(ans)

Submission status: Wrong Answer

Solution code:
N, K = list(map(int ,input().split()))
sticks = list(map(int, input().split()))
sticks = sorted(sticks, reverse = True)
ans = 0
for s in sticks:
    ans += s
    if(sticks.index(s) == K-1):
        break
print(ans)