Language: C++

#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PPQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> &vec){ return (ll)vec.size(); }
template<typename T>
ll sz(priority_queue<T> &pq) {return (ll)pq.size(); }
ll sz(string &s) {return (ll)s.size(); } 
ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b; }
bool checkindex(ll i,ll n){ return (i < n && i >= 0); }

int main(){
    ll n;
    cin >> n;
    ll bsum = 0,rasum = 0,lasum = 0,temp = 0;
    priority_queue<ll,llVEC,greater<ll>> pq_r;
    priority_queue<ll,llVEC> pq_l;

    ll q,a,b;
    rep(i,0,n){
        cin >> q;
        if(q == 2){
            ll minx;
            if(pq_r.empty()){
                cout << pq_l.top() << " " << bsum << endl;
            }
            else if(pq_l.empty()){
                cout << pq_r.top() << " " << bsum << endl;
            }
            else if(sz(pq_r) == sz(pq_l)){
                minx = pq_l.top();
            }
            else if(sz(pq_l) > sz(pq_r)){
                minx = pq_l.top();
            }
            else{
                minx = pq_r.top();
            }

            //cout << bsum  << " " << lasum << " " << rasum << " " << ((ll)(sz(pq_r)) - (ll)(sz(pq_l))) << endl;
            if(!pq_r.empty() && !pq_l.empty()) cout << minx << " " << bsum - lasum + rasum + minx*(sz(pq_l) - sz(pq_r)) << endl;
        }
        else{
            cin >> a >> b;
            bsum += b;
            if(pq_l.empty() && pq_r.empty()){
                pq_r.push(a);
                rasum += a;
            }
            else if(sz(pq_r) == sz(pq_l)){
                if(pq_r.top() <= a){
                    pq_r.push(a);
                    rasum += a;
                }
                else{
                    pq_l.push(a);
                    lasum += a;
                }
            }
            else if(sz(pq_l) > sz(pq_r)){
                if(pq_l.top() > a){
                    rasum += pq_l.top();
                    lasum -= pq_l.top();
                    pq_r.push(pq_l.top());
                    pq_l.pop();
                    pq_l.push(a);
                    lasum += a;
                }
                else{
                    pq_r.push(a);
                    rasum += a;
                }
            }
            else{
                if(pq_r.top() < a){
                    lasum += pq_r.top();
                    rasum -= pq_r.top();
                    pq_l.push(pq_r.top());
                    pq_r.pop();
                    pq_r.push(a); 
                    rasum += a;
                }
                else{
                    pq_l.push(a);
                    lasum += a;
                }
            }
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:23: error: no matching function for call to 'sz(std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >&)'
   49 |             else if(sz(pq_r) == sz(pq_l)){
      |                     ~~^~~~~~
a.cc:26:4: note: candidate: 'll sz(std::string&)'
   26 | ll sz(string &s) {return (ll)s.size(); }
      |    ^~
a.cc:26:15: note:   no known conversion for argument 1 from 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' to 'std::string&' {aka 'std::__cxx11::basic_string<char>&'}
   26 | ll sz(string &s) {return (ll)s.size(); }
      |       ~~~~~~~~^
a.cc:23:4: note: candidate: 'template<class T> ll sz(std::vector<_Tp>&)'
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |    ^~
a.cc:23:4: note:   template argument deduction/substitution failed:
a.cc:49:23: note:   'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' is not derived from 'std::vector<_Tp>'
   49 |             else if(sz(pq_r) == sz(pq_l)){
      |                     ~~^~~~~~
a.cc:25:4: note: candidate: 'template<class T> ll sz(std::priority_queue<T>&)'
   25 | ll sz(priority_queue<T> &pq) {return (ll)pq.size(); }
      |    ^~
a.cc:25:4: note:   template argument deduction/substitution failed:
a.cc:49:23: note:   mismatched types 'std::less<typename std::vector<_Tp>::value_type>' and 'std::greater<long long int>'
   49 |             else if(sz(pq_r) == sz(pq_l)){
      |                     ~~^~~~~~
a.cc:52:34: error: no matching function for call to 'sz(std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >&)'
   52 |             else if(sz(pq_l) > sz(pq_r)){
      |                                ~~^~~~~~
a.cc:26:4: note: candidate: 'll sz(std::string&)'
   26 | ll sz(string &s) {return (ll)s.size(); }
      |    ^~
a.cc:26:15: note:   no known conversion for argument 1 from 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' to 'std::string&' {aka 'std::__cxx11::basic_string<char>&'}
   26 | ll sz(string &s) {return (ll)s.size(); }
      |       ~~~~~~~~^
a.cc:23:4: note: candidate: 'template<class T> ll sz(std::vector<_Tp>&)'
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |    ^~
a.cc:23:4: note:   template argument deduction/substitution failed:
a.cc:52:34: note:   'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' is not derived from 'std::vector<_Tp>'
   52 |             else if(sz(pq_l) > sz(pq_r)){
      |                                ~~^~~~~~
a.cc:25:4: note: candidate: 'template<class T> ll sz(std::priority_queue<T>&)'
   25 | ll sz(priority_queue<T> &pq) {return (ll)pq.size(); }
      |    ^~
a.cc:25:4: note:   template argument deduction/substitution failed:
a.cc:52:34: note:   mismatched types 'std::less<typename std::vector<_Tp>::value_type>' and 'std::greater<long long int>'
   52 |             else if(sz(pq_l) > sz(pq_r)){
      |                                ~~^~~~~~
a.cc:60:113: error: no matching function for call to 'sz(std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >&)'
   60 |             if(!pq_r.empty() && !pq_l.empty()) cout << minx << " " << bsum - lasum + rasum + minx*(sz(pq_l) - sz(pq_r)) << endl;
      |                                                                                                               ~~^~~~~~
a.cc:26:4: note: candidate: 'll sz(std::string&)'
   26 | ll sz(string &s) {return (ll)s.size(); }
      |    ^~
a.cc:26:15: note:   no known conversion for argument 1 from 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' to 'std::string&' {aka 'std::__cxx11::basic_string<char>&'}
   26 | ll sz(string &s) {return (ll)s.size(); }
      |       ~~~~~~~~^
a.cc:23:4: note: candidate: 'template<class T> ll sz(std::vector<_Tp>&)'
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |    ^~
a.cc:23:4: note:   template argument deduction/substitution failed:
a.cc:60:113: note:   'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' is not derived from 'std::vector<_Tp>'
   60 |             if(!pq_r.empty() && !pq_l.empty()) cout << minx << " " << bsum - lasum + rasum + minx*(sz(pq_l) - sz(pq_r)) << endl;
      |                                                                                                               ~~^~~~~~
a.cc:25:4: note: candidate: 'template<class T> ll sz(std::priority_queue<T>&)'
   25 | ll sz(priority_queue<T> &pq) {return (ll)pq.size(); }
      |    ^~
a.cc:25:4: note:   template argument deduction/substitution failed:
a.cc:60:113: note:   mismatched types 'std::less<typename std::vector<_Tp>::value_type>' and 'std::greater<long long int>'
   60 |             if(!pq_r.empty() && !pq_l.empty()) cout << minx << " " << bsum - lasum + rasum + minx*(sz(pq_l) - sz(pq_r)) << endl;
      |                                                                                                               ~~^~~~~~
a.cc:69:23: error: no matching function for call to 'sz(std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >&)'
   69 |             else if(sz(pq_r) == sz(pq_l)){
      |                     ~~^~~~~~
a.cc:26:4: note: candidate: 'll sz(std::string&)'
   26 | ll sz(string &s) {return (ll)s.size(); }
      |    ^~
a.cc:26:15: note:   no known conversion for argument 1 from 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' to 'std::string&' {aka 'std::__cxx11::basic_string<char>&'}
   26 | ll sz(string &s) {return (ll)s.size(); }
      |       ~~~~~~~~^
a.cc:23:4: note: candidate: 'template<class T> ll sz(std::vector<_Tp>&)'
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |    ^~
a.cc:23:4: note:   template argument deduction/substitution failed:
a.cc:69:23: note:   'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' is not derived from 'std::vector<_Tp>'
   69 |             else if(sz(pq_r) == sz(pq_l)){
      |                     ~~^~~~~~
a.cc:25:4: note: candidate: 'template<class T> ll sz(std::priority_queue<T>&)'
   25 | ll sz(priority_queue<T> &pq) {return (ll)pq.size(); }
      |    ^~
a.cc:25:4: note:   template argument deduction/substitution failed:
a.cc:69:23: note:   mismatched types 'std::less<typename std::vector<_Tp>::value_type>' and 'std::greater<long long int>'
   69 |             else if(sz(pq_r) == sz(pq_l)){
      |                     ~~^~~~~~
a.cc:79:34: error: no matching function for call to 'sz(std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >&)'
   79 |             else if(sz(pq_l) > sz(pq_r)){
      |                                ~~^~~~~~
a.cc:26:4: note: candidate: 'll sz(std::string&)'
   26 | ll sz(string &s) {return (ll)s.size(); }
      |    ^~
a.cc:26:15: note:   no known conversion for argument 1 from 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' to 'std::string&' {aka 'std::__cxx11::basic_string<char>&'}
   26 | ll sz(string &s) {return (ll)s.size(); }
      |       ~~~~~~~~^
a.cc:23:4: note: candidate: 'template<class T> ll sz(std::vector<_Tp>&)'
   23 | ll sz(vector<T> &vec){ return (ll)vec.size(); }
      |    ^~
a.cc:23:4: note:   template argument deduction/substitution failed:
a.cc:79:34: note:   'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' is not derived from 'std::vector<_Tp>'
   79 |             else if(sz(pq_l) > sz(pq_r)){
      |                                ~~^~~~~~
a.cc:25:4: note: candidate: 'template<class T> ll sz(std::priority_queue<T>&)'
   25 | ll sz(priority_queue<T> &pq) {return (ll)pq.size(); }
      |    ^~
a.cc:25:4: note:   template argument deduction/substitution failed:
a.cc:79:34: note:   mismatched types 'std::less<typename std::vector<_Tp>::value_type>' and 'std::greater<long long int>'
   79 |             else if(sz(pq_l) > sz(pq_r)){
      |                                ~~^~~~~~