Heaps 19 - Implementing Running Median of a Integer Stream

my code is correct but it is showing time limit excceded
here is my code https://ide.codingblocks.com/s/318437