Median of Running Stream doubts

This code is working good and passed all test cases https://ide.codingblocks.com/s/257829

but this one is also built on same logic but little bit changes in loops and not giving correct answer
https://ide.codingblocks.com/s/257829 (Please Tell correction in this code)

You have shared the same code in both cases

@as159925
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
just use this in the code, it will pass all the testcases, the time limit of the question was quiet strict.

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.