Median in a stream of running integers

All the test case except Test Case 2 are passes. Test Case 2 shows TLE.
Please help me why the second test case couldn’t pass?
LINK : https://ide.codingblocks.com/s/327386

use long long int instead of int

modified Code