Gives TLE in two test cases

This is my code https://ide.codingblocks.com/s/226825 . It get AC
In this i used 2 heap.
You also used two heap but you are taking more time. Please optimize your code. If not, this is a standard question search on google and learn the algo and do it. Otherwise i also tell you the algo if you want

please tell me algorithm

In this we will maintain two heaps, min-heap and a max heap. When a number comes we will first compare it with the current median and put it to the appropriate heap.

If the new integer value is less than the current median, we put it in to the max-heap else we put it to the min-heap. Then we will make sure min and max heap properties are preserved. (general heap properties + min/max at the top of each heap)

Next is to check whether the size difference between two heaps are more than one. If it is, we will take the top one out of the large heap and put it to the other. (to make the size difference between two heaps 0 or 1) Then again we have to make sure the two heaps are preserving their heap properties. (general heap properties + min/max at the top of each heap)

At the end we will calculate the median, if the two heaps are in same size the median should be the (top value of minHeap + top value of maxHeap)/2. If the two heaps are unbalanced, the median should be the top value of the large heap.

Than we will move on to the next number in the stream.

Then after this now able to understand the logic then search this question on you tube and you will find the logic