Median in running stream

Can someone pls tell the error in this