Not getting correct output

Hey @Bhavya_Goel , I have now corrected your code .
You were not putting the first number in the priority queue before checking the conditions in the loop .
I suggest you to always dry run your code thoroughly with 2 3 examples you will be able to see what logical error are you making in the program .
Here is the updated code :

Hope it helps :blush: .
If your doubt is now resolved please mark it as resolved and rate me accordingly .
Else you can further questions here .
Thankyou

one test case is showing TLE there is code: https://ide.codingblocks.com/s/346099

also I have changed float med to int med forgot to update in this code : https://ide.codingblocks.com/s/346099

@Bhavya_Goelm what is the error you are getting on submission ?

hey, was able to figure out the problem

@Bhavya_Goel if you feel that your query is cleared please mark this doubt as resolved.
Happy Learning !!

Great I hope you get it now

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.