SOLVE

LATER

Xenny and Questions

Problem

Editorial

Analytics

Today Xenny has an exam and he is reading the question paper. He has worked very hard for this and he absolutely knows everything. But there is one thing that he didn't practice and that is - **writing speed**.
Xenny is aware of this and is asking for your help. Xenny knows that he will definitely need 1 unit time for solving each question. Obviously, having studied so hard, he wants to maximize his marks. Your job is to tell him what are the maximum marks can he get if he chooses the right set of questions.
Formally, there are **N** questions in the paper. **i ^{th}** question carries

**Hint**: Use fast I/O methods.

**Input:**

The first line of input will contain an integer - **T**, i.e. number of testcases.

**T** lines follow.

The format for each test case will be as follows:

First line will contain 2 space-separated integers - **N**, denoting the no. of questions and **K**, denoting the amount of time remaining in seconds.
Each of the next **N** lines contains an integer, where integer on **i ^{th}** line denotes marks for

**Output:**

For each testcase, print the maximum marks Xenny can get if he chooses the questions optimally.

(Assume Xenny solves every question he chooses correctly :P )

**Constraints:**

**N** >= 0

**a _{i}** >= 0 for 0 <=

*SMALL:*

1 <= **T** <=1000, **N** <= 100, **a _{i}** <= 100

*MEDIUM:*

1 <= **T** <= 100, **N** <= 1000, **a _{i}** <=100000

*LARGE:*

1 <= **T** <= 100, **N** <= 100000, **a _{i}** <=100000

Time Limit:
1.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala 2.11.8,
Swift,
Visual Basic

Initializing Code Editor...

OTHER PROBLEMS OF THIS CHALLENGE

{"3567e8a": "/pagelets/suggested-problems/algorithm/xenny-and-questions/", "3567eb6": "/pagelets/problems-hint/algorithm/xenny-and-questions/", "3567e6a": "/pagelets/show-submission/algorithm/xenny-and-questions/", "3567eca": "/pagelets/recommended-problems/algorithm/xenny-and-questions/", "3567ea1": "/pagelets/problem-author-tester/algorithm/xenny-and-questions/"}

{}

realtime.hackerearth.com

80

d65535a57c5c9d026ebfd850bb0c3b259966a619

58a29e5cae2309f04b28

/realtime/pusher/auth/