Median in a stream of running integers

only 4 test cases are passing rest 6 are falling

Kindly help in finding out mistake