Median of running stream of integers - getting wrong answer and tle in test cases

Can anyone tell me the issue with this code why its not able to pass the test cases?

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main() {
    long long int t;
    cin>>t;
    while (t--) {
        long long int n;
        cin>>n;
        // create a maxHeap and a minHeap
        float median=0;
        priority_queue <long long int, vector<long long int>, greater<long long int>> minHeap;
        priority_queue <long long int> maxHeap;
        long long int firstElement;
        cin>>firstElement;
        maxHeap.push(firstElement);
        median=(float)firstElement;
        cout<<median<<" ";
        for (long long int i=1;i<n;i++) {
            long long int el;
            cin>>el;
            if (el >= median) {
                // push in minHeap
                // first check if size difference is not n-1 already
                if ( minHeap.size() > maxHeap.size() and (minHeap.size()-maxHeap.size())==1) {
                    long long int top= minHeap.top();
                    minHeap.pop();
                    maxHeap.push(top);
                    minHeap.push(el);
                }
                else if (maxHeap.size()<=minHeap.size()) {
                    // push anyways
                    minHeap.push(el);
                } else {
                    minHeap.push(el);
                }
            } else if (el < median) {
                // push in maxHeap
                // first check for difference not n-1
                if ( maxHeap.size() > minHeap.size() and (maxHeap.size()-minHeap.size())==1) {
                    long long int top= maxHeap.top();
                    maxHeap.pop();
                    minHeap.push(top);
                    maxHeap.push(el);
                }
                else if (minHeap.size()<=maxHeap.size()) {
                    // push anyways
                    maxHeap.push(el);
                }
            }
            // get the new median
            long long int minHeapTop = minHeap.top();
            long long int maxHeapTop = maxHeap.top();
            if (minHeap.size()==maxHeap.size()) {
                median=(float)(minHeapTop+maxHeapTop)/2;
            } else if(minHeap.size() > maxHeap.size()) {
                median = (float)minHeapTop;
            } else {
                median=(float)maxHeapTop;
            }
            cout<<median<<" ";
        }
        cout<<endl;
    }
    return 0;
}

Getting right answers for some of the test cases I could think of but the platform’s test cases seem to all fail