Median in a running stream of numbers

Why I am getting TLE ?

why you use this condition
cin >> d;

while(d != -1)
{

in question you have given n no of element
only that much element you have to take

Modified the code. Please check, its still giving error https://ide.codingblocks.com/s/265002

Modified Code

mistakes

  1. use int instead of float in question it is not mention to print nos in float
    also divide by 2 not 2.0

  2. print endl after each testcase