Median ina astream of running integer

#include <bits/stdc++.h>

using namespace std;

int main() {

/* code here */
priority_queue<int>leftheap;
priority_queue<int,vector<int>,greater<int> >rightheap;
int t;
cin>>t;
while(t--)
{
    int n,d;
    cin>>n;
    float m;
    cin>>d;
    m=d;
    cout<<m<<" ";
    leftheap.push(d);
    n--;
    while(n--)
    {
        cin>>d;
        if(leftheap.size()>rightheap.size())
        {
            if(d<m){
            rightheap.push(leftheap.top());
            leftheap.pop();
            leftheap.push(d);
            }
            else
            {
                rightheap.push(d);
            }
            m=(leftheap.top()+rightheap.top())/2.0;
        }
        else if(leftheap.size()==rightheap.size())
        {
            if(d<m)
            {
                leftheap.push(d);
                m=leftheap.top();
            }
            else{
                rightheap.push(d);
                m=rightheap.top();
            }
        }
        else{
            if(d>m){
            leftheap.push(rightheap.top());
            rightheap.pop();
            rightheap.push(d);
            }
            else
            {
                leftheap.push(d);
            }
            m=(leftheap.top()+rightheap.top())/2.0;
        }
        cout<<m<<" ";
    }
    cout<<endl;
}
return 0;

}
it give wrong ans

instead of float use int
in question it is not mention to print ans in float

still this code is not correct

these 2 priority queues should declare inside while loop

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.