Answer is wrong. Dont know why

Hello @mdj please wait i am checking your code:

Hello @mdj you have to apply the concept of binary search in it.
there must be editorial video for this in your portal.
please see that.
if you still have any doubt you can ask here:
we will discuss.
Happy Learning!!

Whats wrong in my approach?

your logic is not fine.
could you explain your logic so that we can discuss and i can explain you the correct logic.
if we will discuss you will be able to understand in the better way.
Happy learning!!

Firstly finding number of students that can get scholorship using M then how many more are getting by taking points from other students

Hello @mdj dry run your code for this test case:
823378841 143542613 5719 199889
the correct answer is this:
800477202
but your ouput is different from the correct.
try to think.
Happy Learning!!

@mdj see this video for understanding the correct logic :

if you still have any doubt you can ask here:
Happy Learning!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.