getting WA in ( please help me!

my code :

what i did was : i created a multiset and push all the elements in the set initially. Now, i check that whether we can make k elements out starting from the first element (as it is the smallest one and if it is not possible then we can guarantee that starting from any other element is also not possible) .I do this as far as possible and increases the count every time .

I am getting WA in all the test cases …if possible then please tell me where my logic is lacking !

Theres no code at that link. Please re-check :slight_smile:

sorry but it’s working fine …

IDK why, its working fine now :confused:

thanks for looking into my code…i know debugging other’s code is very boring but i am trying this for last 3 days but yet didnt able to get it accepted …(: so, i have no option…

I will look into your code, and rest assured, debug it, but just sometime later. Something is keeping me occupied atm.

There, try your code for this input-

6 2 2
1 3 3 6 6 9 
Expected Output
Your Output

I think I dont need to explain the expected output. Comment if its unclear :slight_smile: