Median in a stream of running integers

https://ide.codingblocks.com/s/439682 ,
sample output is same , but test cases are not passing?

hello @CODER_JATIN

check now->

u need to take care of corner cases ,
like n==1 or ur no==0 in while loop for such cases u dont have to read new input

bhaiya , now also test case 3 is not workinh

and bhaiya agar no=0 ya 1 bhi hua to , while loop apne aap smbhal lega us case ko bhi, then why are we giving corner cases?

add these lines just in the start of main function.
ios_base::sync_with_stdio(false);
cin.tie(NULL);

dry run karo no=2 tum total 3 input loge jabki 2 hi input lene hai tumko

okay and bhaiya what is the meaning of this line (ios_base::sync_with_stdio(false); cin.tie(NULL);

read about fast io from internet.

ye line tumhare program ke printing ko thoda fast bana deta hai

bhaiya , yeh corner case wali baat smjh ni aayi, agr no=2 lete hai tb bhi sahi chl rha hai bina corner cases ke bhi?

pehle tum no read karoge uske baad
while loop se pehel tum do bar n read karoge right?
aur phir while loop ke end me ek baar phir n read karoge.
to total 3 baar read kar liya na n . but input to 2 hi lena tha

okay okay , thik hai bhaiya ,thank you :slight_smile:

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.