Language: C++

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

// えびちゃんの make_vector (ここから)
template <typename Tp, size_t N>
std::vector<Tp> make_vector_detail(std::vector<size_t>& sizes, typename std::enable_if<(N == 1), const Tp&>::type x) {
  return std::vector<Tp>(sizes[0], x);
}
template <typename Tp, size_t N>
auto make_vector_detail(std::vector<size_t>& sizes, typename std::enable_if<(N > 1), const Tp&>::type x) {
  size_t size = sizes[N-1];
  sizes.pop_back();
  return std::vector<decltype(make_vector_detail<Tp, N-1>(sizes, x))>(size, make_vector_detail<Tp, N-1>(sizes, x));
}

template <typename Tp, size_t N>
auto make_vector(const size_t(&sizes)[N], const Tp& x) {
  std::vector<size_t> s(N);
  for (size_t i = 0; i < N; ++i) s[i] = sizes[N-i-1];
  return make_vector_detail<Tp, N>(s, x);
}
// えびちゃんの make_vector (ここまで)

signed main(){
    
    int q; cin >> q;
    multimap<int, int> s;
    int op, aa, bb; cin >> op >> aa >> bb;
    int sumb = bb;
    int sum = aa;
    s[aa] = 1;
    int mid = aa;
    int cnt = 1;
    auto itr = s.begin();
    
    s[INF] = 1;
    s[-INF] = 1;
    for(int i = 1; i < q; i++){
        int op; cin >> op;
        if(op == 2){
            //cerr << sum << " " << mid << " " << sumb << endl;
            cout << mid << " " << sum - s[mid] * mid - (cnt - s[mid]) + sumb << endl;
        }else{
            int a, b; cin >> a >> b;
            sumb += b;
            sum += a;

            if(cnt % 2 == 1){
                s[a] = s[a] + 1;
                if(mid > a){
                    itr--;
                    mid = itr->first;
                }
           }else{
                s[a] = s[a] + 1;
                if(mid < a){
                    itr++;
                    mid = itr->first;
                }
            }
            
        cnt++;
        }

        //cerr << mid << endl;

    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:6: error: no match for 'operator[]' (operand types are 'std::multimap<long long int, long long int>' and 'long long int')
   61 |     s[aa] = 1;
      |      ^
a.cc:66:6: error: no match for 'operator[]' (operand types are 'std::multimap<long long int, long long int>' and 'const long long int')
   66 |     s[INF] = 1;
      |      ^
a.cc:67:6: error: no match for 'operator[]' (operand types are 'std::multimap<long long int, long long int>' and 'long long int')
   67 |     s[-INF] = 1;
      |      ^
a.cc:72:42: error: no match for 'operator[]' (operand types are 'std::multimap<long long int, long long int>' and 'long long int')
   72 |             cout << mid << " " << sum - s[mid] * mid - (cnt - s[mid]) + sumb << endl;
      |                                          ^
a.cc:72:64: error: no match for 'operator[]' (operand types are 'std::multimap<long long int, long long int>' and 'long long int')
   72 |             cout << mid << " " << sum - s[mid] * mid - (cnt - s[mid]) + sumb << endl;
      |                                                                ^
a.cc:79:18: error: no match for 'operator[]' (operand types are 'std::multimap<long long int, long long int>' and 'long long int')
   79 |                 s[a] = s[a] + 1;
      |                  ^
a.cc:79:25: error: no match for 'operator[]' (operand types are 'std::multimap<long long int, long long int>' and 'long long int')
   79 |                 s[a] = s[a] + 1;
      |                         ^
a.cc:85:18: error: no match for 'operator[]' (operand types are 'std::multimap<long long int, long long int>' and 'long long int')
   85 |                 s[a] = s[a] + 1;
      |                  ^
a.cc:85:25: error: no match for 'operator[]' (operand types are 'std::multimap<long long int, long long int>' and 'long long int')
   85 |                 s[a] = s[a] + 1;
      |                         ^