criyle/codenet-compile-errors huggingface dataset:
Language: C++

using namespace std;
int main() {
  int Q;
  cin >> Q;
  multiset<long long> X;
  long long Y = 0;
  for(auto i=0; i<Q; ++i) {
    int q;
    cin >> q;
    if(q==1) {
      long long a, b;
      cin >> a >> b;
      X.emplace(a);
      Y += b;
    } else {
      auto median = *begin(X);
      auto i = 1;
      for(auto x: X) if(++i == X.size()) {median = x; break;}
      auto y = Y;
      for(auto x: X) y += abs(x - median);
      cout << median << " " << y << endl;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin >> Q;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:5:3: error: 'multiset' was not declared in this scope
    5 |   multiset<long long> X;
      |   ^~~~~~~~
a.cc:1:1: note: 'std::multiset' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
  +++ |+#include <set>
    1 | using namespace std;
a.cc:5:12: error: expected primary-expression before 'long'
    5 |   multiset<long long> X;
      |            ^~~~
a.cc:13:7: error: 'X' was not declared in this scope
   13 |       X.emplace(a);
      |       ^
a.cc:16:28: error: 'X' was not declared in this scope
   16 |       auto median = *begin(X);
      |                            ^
a.cc:16:22: error: 'begin' was not declared in this scope
   16 |       auto median = *begin(X);
      |                      ^~~~~
a.cc:1:1: note: 'std::begin' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>'
  +++ |+#include <iterator>
    1 | using namespace std;
a.cc:20:27: error: 'abs' was not declared in this scope
   20 |       for(auto x: X) y += abs(x - median);
      |                           ^~~
a.cc:21:7: error: 'cout' was not declared in this scope
   21 |       cout << median << " " << y << endl;
      |       ^~~~
a.cc:21:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:37: error: 'endl' was not declared in this scope
   21 |       cout << median << " " << y << endl;
      |                                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#define MAX_N (1<<18) //260000
template<typename T>
struct segtree{
    int n;
    T dat[2*MAX_N-1];
    T cnt[2*MAX_N-1];

    void init(int n_){
        n = 1;
        while(n < n_) n *= 2;
        for(int i = 0; i < 2*n-1; i++) dat[i] = INF;
        for(int i = 0; i < 2*n-1; i++) cnt[i] = 0;
    }

    void update(int k, T a){
        k += n-1;
        dat[k] = a;
        cnt[k]++;
        while(k > 0){
            k = (k-1)/2;
            dat[k] = min(dat[k*2+1], dat[k*2+2]);
            cnt[k] = cnt[k*2+1] + cnt[k*2+2];
        }
    }

    //(a,b,0,0,seg.n)で呼ぶ
    T query(int a, int b, int k, int l, int r){
        if(r <= a || b <= l) return INF;
        if(a <= l && r <= b) return dat[k];
        else{
            T vl = query(a,b,k*2+1,l,(l+r)/2);
            T vr = query(a,b,k*2+2,(l+r)/2,r);
            return min(vl, vr);
        }
    }

    int bin(int k, int mid){
        if (k >= n-1) {
            return k-(n-1);
        }
        if (cnt[k*2+1] >= mid) bin(k*2+1, mid);
        else bin(k*2+2, mid - cnt[k*2+1]);
    }
};


Compiler output:
a.cc: In member function 'void segtree<T>::init(int)':
a.cc:11:49: error: 'INF' was not declared in this scope
   11 |         for(int i = 0; i < 2*n-1; i++) dat[i] = INF;
      |                                                 ^~~
a.cc: In member function 'T segtree<T>::query(int, int, int, int, int)':
a.cc:28:37: error: 'INF' was not declared in this scope
   28 |         if(r <= a || b <= l) return INF;
      |                                     ^~~
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;



template <class T> struct Fenwick {
	int n;
	V<T> seg;
	Fenwick(int _n = 0) : n(_n), seg(n + 1) {}
	/// i番目の要素にxを追加する
	void add(int i, T x) {
		i++;
		while (i <= n) {
			seg[i] += x;
			i += i & -i;
		}
	}
	/// [0, i)のsum
	T sum(int i) {
		T s = 0;
		while (i > 0) {
			s += seg[i];
			i -= i & -i;
		}
		return s;
	}
	/// [a, b)のsum
	T sum(int a, int b) { return sum(b) - sum(a); }

	// sum[0, idx) >= xなる最小のidx(sum[0, n) < x なら n+1)
	int sum_lower_bound(T x) {
		if (x <= 0) return 0;
		int res = 0, len = 1;
		while (2 * len <= n) len *= 2;
		for (; len >= 1; len /= 2) {
			if (res + len <= n && seg[res + len] < x) {
				res += len;
				x -= seg[res];
			}
		}
		return res + 1;
	}
};


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<pair<int, int> > res;
	Fenwick<int> ft1(N + 10);
	Fenwick<int> ft2(N + 10);
	int sum = 0;
	vector<int> T(N);
	vector<int> A(N);
	vector<int> B(N);
	vector<pair<int, int> > X;
	for (int i = 0; i < N; i++) {
		cin >> T[i];
		if (T[i] == 1) {
			cin >> A[i] >> B[i];
			X.emplace_back(A[i], i);
		}
	}

	int t = 0;
	map<pair<int, int>, int>mp;
	vector<int> rev;
	sort(X.begin(), X.end());
	for (int i = 0; i < X.size(); i++) {
		rev.push_back(X[i].first);
		mp[X[i]] = t;
		t++;

	}
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		if (T[i] == 1) {
			sum += B[i];
			int z = mp[make_pair(A[i], i)];
			ft1.add(z, 1);
			ft2.add(z, A[i]);
			cnt++;
		}
		else {
			int L = (cnt + 1) / 2;
			int idx = ft1.sum_lower_bound(L) - 1;

			int val = rev[idx] * L - ft2.sum(idx + 1);
			val += ft2.sum(idx + 1, N + 2) - rev[idx] * (cnt - L);
			res.emplace_back(rev[idx], val + sum);
		}
	}
	for (int i = 0; i < res.size(); i++) {
		cout << res[i].first << " " << res[i].second << endl;
	}
}

Compiler output:
a.cc:14:7: error: conflicting declaration 'using uint = long long unsigned int'
   14 | using uint = unsigned int;
      |       ^~~~
In file included from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/sys/types.h:150:22: note: previous declaration as 'typedef unsigned int uint'
  150 | typedef unsigned int uint;
      |                      ^~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;
int a_list[200000]
int main(){
  int n, q, a0, b;
  cin >> n;
  cin >> q >> a >> b;
  a_list[0] = a
  min_x = a;
  max_x = a;
  min = b;
  
  for( int i=1; i< n; i++){
    cin >> q;
    if (q == 1){
      cin >> _a >> _b;
      a_list[i] = _a;
      b += _b;
      min;
	  int min_a_sub = abs(min_x - _a);
      int max_a_sub = abs(max_x - _a);
      int a_cand, min_cand1;
      int min_cand2 = b;
           
	  if( min_a_sub < max_a_sub ){
      	min_cand_1 = min + _b + min_a_sub;
        a_cand = min_x;
      }
      else{
        min_cand_1 = min + _b + max_a_sub;
        a_cand = max_x;
      }

      for (int j=0; j < i; j++){
	      min_cand_2 += abs(a_list[j] - a_list[i]);
      }
      
      if (min_cand_1 < min_cand_2){
          min = min_cand_1;
          min_x = a_cand;
          max_x = a_cand;
      }
      
      else if (min_cand_1 == min_cand_2){
      	  min = min_cand_1;
      	  if (_a < a_cand){
            min_x = _a;
            max_x = a_cand;
          }
          else if (_a > a_cand) {
          	min_x = a_cand;
            max_x = _a;
          }
          else {
			min_x = _a;
            max_x = _a;
          }
      }
      
      else ( min_cand_2 < min_cand_1){
          min = min_cand_2;
          min_x = _a;
          max_x = _a;
     }
     
     else{
	     if (min_x == max_x){
    	 	cout << min << endl;
	     }
         else{
         	cout << min_x << endl;
         }
     }
   }  
}



Compiler output:
a.cc:5:1: error: expected initializer before 'int'
    5 | int main(){
      | ^~~
Language: C++

#include <iostream>
#include <stdio.h>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#define lld long long

using namespace std;

const int N = 2e5 + 5;
int q, c;
lld A, B;
lld res = LONG_MAX, x_m = LONG_MAX;
priority_queue <lld, vector <lld>, greater <lld> > heap_min;
priority_queue <lld, vector <lld>, less <lld> >    heap_max;

void Insert(lld x, lld y)
{
    A += x, B += y, c++;
    int d_min = heap_min.size();
    int d_max = heap_max.size();
    if (d_max == 0)      heap_max.push(x);
    else if (d_min == 0) heap_min.push(x);
    else
    {
        lld L_max = heap_max.top();
        lld R_min = heap_min.top();
        if (x < R_min)      heap_max.push(x);
        else if (x > L_max) heap_min.push(x);
    }
}

void Equal_lize()
{
    int d_min = heap_min.size();
    int d_max = heap_max.size();
    if (d_min != 0 && d_max != 0)
    {
        while (heap_max.size() != 0 && heap_max.top() > heap_min.top())
        {
            lld temp = heap_max.top();
            heap_max.pop();
            heap_min.push(temp);
        }
        while (heap_min.size() > heap_max.size())
        {
            lld temp = heap_min.top();
            heap_min.pop();
            heap_max.push(temp);
        }
    }
}

void Calculate(int i)
{
    lld temp = heap_max.top();
    res = abs(i * temp - A) + B;
    x_m = temp;
}

void solve()
{
    for (int i = 1; i <= q; i++)
    {
        int type;
        scanf("%d", &type);
        if (type == 1)
        {
            lld a, b;
            scanf("%lld%lld", &a, &b);
            Insert(a, b);
            Equal_lize();
            Calculate(c);
        }
        else
        {
            printf("%lld %lld\n", x_m, res);
        }
    }
}

int main()
{
    //freopen("a.inp", "r", stdin);
        scanf("%d", &q);
        solve();
    return 0;
}


Compiler output:
a.cc:14:11: error: 'LONG_MAX' was not declared in this scope
   14 | lld res = LONG_MAX, x_m = LONG_MAX;
      |           ^~~~~~~~
a.cc:7:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <algorithm>
  +++ |+#include <climits>
    7 | #define lld long long
a.cc: In function 'void Calculate(int)':
a.cc:59:5: error: 'x_m' was not declared in this scope
   59 |     x_m = temp;
      |     ^~~
a.cc: In function 'void solve()':
a.cc:78:35: error: 'x_m' was not declared in this scope
   78 |             printf("%lld %lld\n", x_m, res);
      |                                   ^~~
Language: Java

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc =  new Scanner(System.in);
		int query = sc.nextInt();
		int[] a = new int[query];
		int acount = 1;
		long bSum = 0;
		StringBuilder sb = new StringBuilder();
		sc.next();
		a[0] = sc.nextInt();
		bSum += sc.nextInt();
		for(int i=1;i<query;i++) {
			int order = sc.nextInt();
			if(order == 1) {
				int addA = sc.nextInt();
				bSum += sc.nextInt();
				int j;
				for(j=acount;j>0;j--) {
					if(addA < a[j-1])
						a[j] = a[j-1];
					else {
						a[j] = addA;
						break;
					}
				}
				if(j==0)
					a[0] = addA;
				acount++;
			}else {
				long atotal = 0;
				for(int j=0;j<(acount-1)/2;j++)
					atotal -= a[j];
				for(int j=(acount-1)/2+1;j<acount;j++)
					atotal += a[j];
				atotal -= acount%2 == 0? a[(acount-1)/2]:0;
				sb.append(a[(acount-1)/2]).append(' ').append(atotal+bSum).append('\n');
			}
		}
		sc.close();
		System.out.println(sb.toString());
	}

Compiler output:
Main.java:43: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

#include <stdio.h>
#include <set>
using namespace std;

int main() {
  int qq;
  scanf("%d", &qq);
  qq--;
  int tf, xf, sampahf;
  scanf("%d %d %d", &tf, &xf, &sampahf);
  multiset<int> left, right;
  long long val = 0, left_sum = xf, right_sum = 0, b = sampahf;
  left.insert(xf);
  while (qq--) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int x, sampah;
      scanf("%d %d", &x, &sampah);
      b += sampah;
      if (right.empty()) {
        left.insert(x);
        left_sum += x;
        int era = *left.rbegin();
        left.erase(left.find(era));
        right.insert(era);
        left_sum -= era;
        right_sum += era;
        long long med med = *left.rbegin();
        val = (med * left.size() - left_sum) + (right_sum - med * right.size());
        continue;
      }
      if (x <= *left.begin()) {
        left.insert(x);
        left_sum += x;
        if (left.size() == right.size() + 2) {
          int era = *left.rbegin();
          left.erase(left.find(era));
          right.insert(era);
          left_sum -= era;
          right_sum -= era;
        }
      } else {
        right.insert(x);
        right_sum += x;
        if (right.size() > left.size()) {
          int era = *right.begin();
          right.erase(right.find(era));
          left.insert(era);
          right_sum -= x;
          left_sum += x;
        }
      }
      long long med = *left.rbegin();
      val = (med * left.size() - left_sum) + (right_sum - med * right.size());
    }
    if (t == 2) {
      printf("%d %lld\n", *left.rbegin(), val + b);
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:23: error: expected initializer before 'med'
   29 |         long long med med = *left.rbegin();
      |                       ^~~
a.cc:30:16: error: 'med' was not declared in this scope
   30 |         val = (med * left.size() - left_sum) + (right_sum - med * right.size());
      |                ^~~
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int Q = sc.nextInt();
        Queue<Integer> A = new PriorityQueue<Integer>(Q, Collections.reverseOrder());

        long b = 0;
        for (int i = 0; i < Q; i++) {
            int q = sc.nextInt();
            if (q == 1) {
                A.offer(sc.nextInt());
                b += sc.nextInt();
            } else if (q == 2) {
                // A.sort(Comparator.naturalOrder());
                int x = A.get((A.size() - 1) / 2);
                long aSum = 0;
                for (int j : A) {
                    aSum += Math.abs(x - j);
                }
                System.out.println(x + " " + (aSum + b));
            }
        }

        sc.close();
    }
}


Compiler output:
Main.java:17: error: cannot find symbol
                int x = A.get((A.size() - 1) / 2);
                         ^
  symbol:   method get(int)
  location: variable A of type Queue<Integer>
1 error
Language: Java

import java.util.*;

class Main {
	public static void main(String[] args) {
		Comparator<Integer> comparator = new Comparator<Integer>() {
	        @Override
	        public int compare(Integer o1, Integer o2) {
	            return Integer.valueOf(o2).compareTo(Integer.valueOf(o1));
	        }
    	};
		Scanner sc = new Scanner(System.in);
		int Q = sc.nextInt();
		long b = 0;
		long ans=0;
		Queue<Integer> pq1 = new PriorityQueue<Integer>(comparator);
		Queue<Integer> pq2 = new PriorityQueue<Integer>();

		for (int i=0;i<Q;i++) {
			int x=sc.nextInt();
			if (x==1) {
				int a=sc.nextInt();
				int b=sc.nextInt();
				if (cnt!=0) {
					if (a<pq1.peek() || pq2.peek()<a)
					ans+=Math.min(Math.abs(pq1.peek()-a),Math.abs((pq2.peek()-a)));
				}
				pq1.add(a);
				pq2.add(a);
				ans+=b;
				if (pq1.peek()>pq2.peek()) {
					int tmp_1=pq1.peek();
					int tmp_2=pq2.peek();
					pq1.remove();
					pq2.remove();
					pq1.add(tmp_2);
					pq2.add(tmp_1);
				}
			} else if (x==2) {
				System.out.print(pq1.peek()+" ");
				System.out.println(ans);
			}
		}
	}
}

Compiler output:
Main.java:22: error: variable b is already defined in method main(String[])
				int b=sc.nextInt();
				    ^
Main.java:23: error: cannot find symbol
				if (cnt!=0) {
				    ^
  symbol:   variable cnt
  location: class Main
2 errors
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

using namespace std;

int main()
{
    IOS;
    int q;
    cin>>q;
    ll a,b,t,sl=0,sr=0,c=0,m,sr1=0,sl1=0,m1;
    multiset<ll> s;
    multiset<ll>::iterator it;
    while(q--)
    {
        cin>>t;
        if(t==1)
        {
            cin>>a>>b;
            c+=b;
            if(s.empty())
            {
                sl+=a;
                m=a;
                s.insert(a);
            }
            else{
                if(s.size()%2)
                {
                    if(m>=a)
                    {
                        sl+=a;
                        s.insert(a);
                        sl-=m;
                        sr+=m;
                        it=s.lower_bound(m);
                        if(m!=a) --it;
                        m=*it;
                    }
                    else{
                        sr+=a;
                        s.insert(a);
                    }
                  	sr1=sr;
                  	sl1=sl;
                }
                else{
                    if(a>m)
                    {
                        sr+=a;
                      	sr1=sr;
                        s.insert(a);
                        it=s.upper_bound(m);
                        sr-=*it;
                        sl+=*it;
                        m=*it;
                      	--it;
                      	m1=*it;
                    }
                    else{
                        s.insert(a);
                        sl+=a;
                      	sl1=sl;
                      	sr1=sr;
                    }
                }
            }
        }
        else{
            ll nr=s.size()/2;
            ll nl=s.size()-nr;
            //cout<<nl<<" "<<nr<<endl;
          	ll ans1=(nl-nr)*m-sl+sr+c;
          	ll ans2=(nl-nr)*m1-sl1+sr1+c;
          	if(ans1<ans2) cout<<m<<" "<<ans1<<endl;
          	else cout<<m1<<" "<<ans2<<endl
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:82:47: error: expected ';' before '}' token
   82 |                 else cout<<m1<<" "<<ans2<<endl
      |                                               ^
      |                                               ;
   83 |         }
      |         ~
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

using namespace std;

int main()
{
    IOS;
    int q;
    cin>>q;
    ll a,b,t,sl=0,sr=0,c=0,m;
    multiset<ll> s;
    multiset<ll> s::iterator it;
    while(q--)
    {
        cin>>t;
        if(t==1)
        {
            cin>>a>>b;
            c+=b;
            if(s.empty())
            {
                sl+=a;
                m=a;
                s.insert(a);
            }
            else{
                if(s.size()%2)
                {
                    if(m>=a)
                    {
                        sl+=a;
                        s.insert(a);
                        sl-=m;
                        sr+=m;
                        it=s.lower_bound(m);
                        if(m!=a) --it;
                        m=*it;
                    }
                    else{
                        sr+=a;
                        s.insert(a);
                    }
                }
                else{
                    if(a>m)
                    {
                        sr+=a;
                        s.insert(a);
                        it=s.upper_bound(m);
                        sr-=*it;
                        sl+=*it;
                        m=*it;
                    }
                    else{
                        s.insert(a);
                        sl+=a;
                    }
                }
            }
        }
        else{
            int nr=s.size()/2;
            int nl=s.size()-nr;
            //cout<<nl<<" "<<nr<<endl;
            cout<<m<<" "<<(nl-nr)*m-sl+sr+c<<endl;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: 's' is not a class, namespace, or enumeration
   19 |     multiset<ll> s::iterator it;
      |                  ^
a.cc:19:30: error: qualified-id in declaration before 'it'
   19 |     multiset<ll> s::iterator it;
      |                              ^~
a.cc:42:25: error: 'it' was not declared in this scope; did you mean 't'?
   42 |                         it=s.lower_bound(m);
      |                         ^~
      |                         t
a.cc:56:25: error: 'it' was not declared in this scope; did you mean 't'?
   56 |                         it=s.upper_bound(m);
      |                         ^~
      |                         t
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

using namespace std;

int main()
{
    IOS;
    int q;
    cin>>q;
    ll a,b,t,sl=0,sr=0,c=0,m;
    multiset<ll> s;
    while(q--)
    {
        cin>>t;
        if(t==1)
        {
            cin>>a>>b;
            c+=b;
            if(s.empty())
            {
                sl+=a;
                m=a;
                s.insert(a);
            }
            else{
                if(s.size()%2)
                {
                    if(m>=a)
                    {
                        sl+=a;
                        s.insert(a);
                        sl-=m;
                        sr+=m;
                        it=s.lower_bound(m);
                        if(m!=a) --it;
                        m=*it;
                    }
                    else{
                        sr+=a;
                        s.insert(a);
                    }
                }
                else{
                    if(a>m)
                    {
                        sr+=a;
                        s.insert(a);
                        it=s.upper_bound(m);
                        sr-=*it;
                        sl+=*it;
                        m=*it;
                    }
                    else{
                        s.insert(a);
                        sl+=a;
                    }
                }
            }
        }
        else{
            int nr=s.size()/2;
            int nl=s.size()-nr;
            //cout<<nl<<" "<<nr<<endl;
            cout<<m<<" "<<(nl-nr)*m-sl+sr+c<<endl;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:25: error: 'it' was not declared in this scope; did you mean 't'?
   41 |                         it=s.lower_bound(m);
      |                         ^~
      |                         t
a.cc:55:25: error: 'it' was not declared in this scope; did you mean 't'?
   55 |                         it=s.upper_bound(m);
      |                         ^~
      |                         t
Language: C++

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.PriorityQueue;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int q = Integer.parseInt(br.readLine());
		PriorityQueue<Int2> pq1 = new PriorityQueue<Int2>();
		PriorityQueue<Integer> pq2 = new PriorityQueue<Integer>();
		int x = 0;
		long v = 0;
		for (int i = 0; i < q; i++) {
			String[] sa = br.readLine().split(" ");
			int y = Integer.parseInt(sa[0]);
			if (y == 1) {
				int a = Integer.parseInt(sa[1]);
				int b = Integer.parseInt(sa[2]);
				Int2 o = new Int2();
				o.i = a;
				pq1.add(o);
				pq2.add(a);
				if (pq1.peek().i != pq2.peek()) {
					Int2 r = pq1.poll();
					int s = pq2.poll();
					v += Math.abs(r.i - s);
					int t = s;
					s = r.i;
					r.i = t;
					pq1.add(r);
					pq2.add(a);
				}
				x = pq1.peek().i;
				v += b;
			} else {
				System.out.println(x + " " + v);
			}
		}
	}

	static class Int2 implements Comparable<Int2> {
		int i;

		@Override
		public int compareTo(Int2 o) {
			return o.i - i;
		}
	}
}



Compiler output:
a.cc:44:17: error: stray '@' in program
   44 |                 @Override
      |                 ^
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.BufferedReader;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.PriorityQueue;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
    5 | public class Main {
      | ^~~~~~
Language: Java

/*
* @Author Silviase(@silviasetitech)
* For ProCon
*/

import java.util.*;
import java.lang.*;
import java.math.*;
import java.awt.*;

public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        PriorityQueue<Long> pribig = new PriorityQueue<>(Comparator.naturalOrder());
        PriorityQueue<Long> prismall = new PriorityQueue<>(Comparator.reverseOrder());
        long big = 0;
        long small = 0;
        long b = 0;
        long ans;
        for (int i = 0; i < n; i++) {
            int tmp = sc.nextInt();
            if (tmp == 1) {
                // koushin
                long a = sc.nextLong();
                long bb = sc.nextLong();
                b += bb;
                if (!prismall.isEnpty() || prismall.peek() >= a) {
                    // prismall.peek -> pribig, a -> prismall
                    prismall.add(a);
                    small+=a;
                    if (!prismall.isEmpty() && prismall.size() > pribig.size() + 1 ) {
                        long change = prismall.poll;
                        pribig.add(change);
                        small -= change;
                        big += change;
                    }
                }
            }else if(tmp == 2){
                // hanbetsu
                // small = big or small = big + 1
                if (prismall.size() == pribig.size()){
                    ans = prismall.peek();
                    System.out.println(ans + " " + (big-small+b));
                }else{
                    ans = prismall.peek();
                    System.out.println(ans + " " + (big-small+b-prismall.peek()));
                }
            }
            
        }

        sc.close();
    }
}




Compiler output:
Main.java:30: error: cannot find symbol
                if (!prismall.isEnpty() || prismall.peek() >= a) {
                             ^
  symbol:   method isEnpty()
  location: variable prismall of type PriorityQueue<Long>
Main.java:35: error: cannot find symbol
                        long change = prismall.poll;
                                              ^
  symbol:   variable poll
  location: variable prismall of type PriorityQueue<Long>
2 errors
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define lld long double
#define MOD 1000000007
#define CAP 100000001
#define inf 1000000000000000LL
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(v) v.size()
#define all(v)    v.begin(),v.end()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int ll
using namespace std;
ll power(ll x,ll y, ll md=MOD){ll res = 1;x%=md;while(y>0){if(y&1)res = (res*x)%md;x = (x*x)%md;y = y>>1;}return res%md;}
 

signed main() {
	fast;
	ll n;
	cin>>n;
	ll s=0;
	ll lef=0,rig=0;
	multiset<ll> s1,s2;
	for(int i=0;i<n;i++){
		ll q;
		cin>>q;
		if(q==1){
			ll a,b;
			cin>>a>>b;
			s+=b;
			s1.insert(a);
			lef+=a;
			while(s1.size()>s2.size()+1) {
				multiset<ll>::iterator it=std::prev(s1.end());
				ll temp= *it;
				rig+=temp;
				lef-=temp;
				s2.insert(temp);
				s1.erase(it);
			}
		}
		else {
			multiset<ll>::iterator it=std::prev(s1.end());
			ll med=*it;
			ll ans=s;
          	ans+=med*((ll)(s1.size())-(ll)(s2.size()));
          ans-=lef
            ans+=rig;
			cout<<med<<" "<<ans<<endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:19: error: expected ';' before 'ans'
   51 |           ans-=lef
      |                   ^
      |                   ;
   52 |             ans+=rig;
      |             ~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int n;cin >> n;
    priority_queue<LL> pa;
    priority_queue<LL,vector<LL>,greater<LL>> pb;
    LL la=0,ra=0;
    LL sum = 0;
    for(int i=0;i<n;i++){
        int x;cin >> x;
        if(x==1){
            LL l,r;cin >> l >> r;
            sum+=r;
            if(pa.empty()){
                pa.push(l);
                la+=l;
            }
            else if(pa.size()==pb.size()){
                else if(pb.top()<=l){
                    LL t = pb.top();pb.pop();
                    ra+=l;
                    ra-=t;
                    la+=t;
                    pa.push(t);
                    pb.push(l);
                }
                else{
                    pa.push(l);
                    la+=l;
                }
            }
            else{
                if(pa.top()>=l){
                    LL t = pa.top();pa.pop();
                    la+=l;
                    la-=t;
                    ra+=t;
                    pa.push(l);
                    pb.push(t);
                }
                else{
                    ra+=l;
                    pb.push(l);
                }
            }
        }
        else if(x==2){
            LL s=pa.top();
            cout <<s<<" " <<sum+(LL)pa.size()*s-la+ra-(LL)pb.size()*s << endl;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: expected '}' before 'else'
   35 |                 else if(pb.top()<=l){
      |                 ^~~~
a.cc:34:42: note: to match this '{'
   34 |             else if(pa.size()==pb.size()){
      |                                          ^
a.cc:49:30: error: 'l' was not declared in this scope
   49 |                 if(pa.top()>=l){
      |                              ^
a.cc:63:9: error: 'else' without a previous 'if'
   63 |         else if(x==2){
      |         ^~~~
a.cc:63:17: error: 'x' was not declared in this scope
   63 |         else if(x==2){
      |                 ^
a.cc: At global scope:
a.cc:68:5: error: expected unqualified-id before 'return'
   68 |     return 0;
      |     ^~~~~~
a.cc:69:1: error: expected declaration before '}' token
   69 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll a[210000];
ll q, b = 0, time = 1;
ll mins = 1000000000, maxs = -1000000000;
ll t, t1;
ll calc(ll m)
{
	ll at = b;
	for (int i = 1; i < time; i++)
	{
		at += abs(m - a[i]);
	}
	return at;
}
ll solve(ll L, ll R)
{
	ll M, RM;
	while (L + 1 < R)
	{
		M = (L + R) / 2;
		RM = (M + R) / 2;
		if (calc(M) < calc(RM))
			R = RM;
		else
			L = M;
	}
	return L;
}


int main()
{
	cin >> q;
	for (ll i = 1; i <= q; i++)
	{
		scanf("%lld", &t);
		if (t == 1)
		{
			scanf("%lld %lld", &a[time], &t1);
			b += t1;
			mins = min(mins, a[time]);
			maxs = max(maxs, a[time]);
			time++;
		}
		else
		{
			ll t2 = solve(mins, maxs);
			printf("%lld %lld\n", t2, calc(t2));
		}
	}
}


Compiler output:
a.cc:6:14: error: 'll time' redeclared as different kind of entity
    6 | ll q, b = 0, time = 1;
      |              ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'll calc(ll)':
a.cc:12:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |         for (int i = 1; i < time; i++)
      |                         ~~^~~~~~
a.cc: In function 'int main()':
a.cc:42:46: error: invalid types 'll [210000] {aka long long int [210000]}[time_t(time_t*) noexcept {aka long int(long int*) noexcept}]' for array subscript
   42 |                         scanf("%lld %lld", &a[time], &t1);
      |                                              ^
a.cc:44:43: error: invalid types 'll [210000] {aka long long int [210000]}[time_t(time_t*) noexcept {aka long int(long int*) noexcept}]' for array subscript
   44 |                         mins = min(mins, a[time]);
      |                                           ^
a.cc:45:43: error: invalid types 'll [210000] {aka long long int [210000]}[time_t(time_t*) noexcept {aka long int(long int*) noexcept}]' for array subscript
   45 |                         maxs = max(maxs, a[time]);
      |                                           ^
a.cc:46:25: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   46 |                         time++;
      |                         ^~~~
a.cc:46:29: error: lvalue required as increment operand
   46 |                         time++;
      |                             ^~
Language: C++

std::ostream&
operator<<( std::ostream& dest, __int128_t value )
{
    std::ostream::sentry s( dest );
    if ( s ) {
        __uint128_t tmp = value < 0 ? -value : value;
        char buffer[ 128 ];
        char* d = std::end( buffer );
        do
        {
            -- d;
            *d = "0123456789"[ tmp % 10 ];
            tmp /= 10;
        } while ( tmp != 0 );
        if ( value < 0 ) {
            -- d;
            *d = '-';
        }
        int len = std::end( buffer ) - d;
        if ( dest.rdbuf()->sputn( d, len ) != len ) {
            dest.setstate( std::ios_base::badbit );
        }
    }
    return dest;
}

Compiler output:
a.cc:1:6: error: 'ostream' in namespace 'std' does not name a type
    1 | std::ostream&
      |      ^~~~~~~
a.cc:1:1: note: 'std::ostream' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | std::ostream&
Language: C++

#include <iostream>
#include <algorithm>
#include <queue>
#include <numeric>
#include <iterator>
using namespace std;

typedef long long int LL;

int main() {
	int Q;
	LL B = 0;
	LL SA = 0;
	vector<LL> A;
	cin >> Q;
	vector<pair<LL,LL>> X;
	for (int i = 0; i < Q; ++i) {
		int t;
		cin >> t;
		if (t == 1) {
			LL a, b;
			cin >> a >> b;
			B += b;
			SA += a;
			A.push_back(a);
		}
		else {
			X.push_back({SA, A.size()});
		}
	}
	for (auto x : X) {
		auto sa = x.first;
		auto as = x.second;
		LL x = sa / as;
		LL fx = 0;
		for (int i = 0; i < as; ++i) {
			fx += abs(A[i] - x);
		}
		while (1) {
			LL tmp = 0;
			for (auto a : A) {
				tmp += abs(a - x);
			}
			if (fx < tmp) {
				x += 1;
				break;
			}
			x -= 1;
		}
		cout << x << " " << fx + B << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:20: error: redeclaration of 'LL x'
   34 |                 LL x = sa / as;
      |                    ^
a.cc:31:19: note: 'std::pair<long long int, long long int> x' previously declared here
   31 |         for (auto x : X) {
      |                   ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;

typedef long long ll;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef pair <ll,ll> p_ll;

ll Q,n,a,b,m_x,m_y;
v_ll A;
ll MOD;
int main(){
  m_x=0;m_y=0;
  cin >> Q;
  for (ll i=1;i<=Q;i++){
    cin >> n;

    if (n==2){
      m_x=A[(A.size()-1)/1];
      cout << m_x<<" "<<m_y <<"\n";
    }else{
       cin >> a >> b;
       m_y+=b;
       ll cen,ub,lb;
       if (a.size()>1){
         cen = A[(A.size()-1)/2];
         lb = lower_bound(A.begin(),A.end(),cen)-A.begin();
         ub = upper_bound(A.begin(),A.end(),cen)-A.begin();

         A.push_back(a);
         sort(A.begin(),A.end());
         ll cen2 = A[(A.size()-1)/2];
         if (cen>cen2){
           m_y+=(cen2-cen)*(lb-(A.size()-lb));
         }
         if (cen2>cen){
           m_y+=(cen2-cen)*(ub-(A.size()-ub));
         }
      }else{
        A.push_back(a);
        m_y+=b;
      }

    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: request for member 'size' in 'a', which is of non-class type 'll' {aka 'long long int'}
   29 |        if (a.size()>1){
      |              ^~~~
Language: Java

import java.lang.Math;
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int F = sc.nextInt();

        List<Integer> as = new ArrayList<>();
        long bs = 0;


        for (int i = 0; i < F; i++) {
            int type = sc.nextInt();
            if (type == 1) {
                int a = sc.nextInt();
                int b = sc.nextInt();
                as.add(a);
                bs += b;
            }
            else {
                Collections.sort(as);
                System.out.println(as);
                int x = (as.size % 2 == 0) ? as.size() / 2 - 1: as.size();
                int minX = as.get(x);
                long sum = bs;
                for (int a : as) {
                    sum += Math.abs(minX - a);
                }

                System.out.print(minX);
                System.out.print(" ");
                System.out.println(sum);
            }
        }
    }
}


Compiler output:
Main.java:29: error: cannot find symbol
                int x = (as.size % 2 == 0) ? as.size() / 2 - 1: as.size();
                           ^
  symbol:   variable size
  location: variable as of type List<Integer>
1 error
Language: C++

#include<iostream>
#include<queue>

typedef long long ll;
using namespace std;

queue<ll> L;
queue<ll> R;
ll L_size,R_size;
ll min_value,min_x;
ll L_max,R_min;
int Q;

void f1(ll a,ll b){
  min_value += b;
  ll x;
  if(a < L_max){
    L.push(-a);
    L_size++;
    if(L_size == R_size){
      min_value += min_x - a;
      min_x = L_max;
      return;
    }
    if(L_size == R_size+1){
      min_x = L_max;
      min_value += min_x - a;
      return;
    }
    L_size -= 1;
    R_size++;
    x = -L.front();
    L.pop();
    R.push(x);
    L_max = -L.front();
    R_min = x;
    min_value += x-a;
    min_x = L_max;
    return;
  }
  if(a > R_min){
    R.push(a);
    R_size++;
    if(L_size == R_size){
      min_value += a-min_x;
      return;
    }
    if(R_size == L_size + 1){
      min_x = R_min;
      min_value += a-min_x;
      return;
    }
    R_size -= 1;
    L_size++;
    x = R.front();
    R.pop();
    L.push(-x);
    R_min = R.front();
    L_max = x;
    min_x = x;
    min_value += a-x;
    return;
  }
  // 真ん中に足す場合
  if(L_size > R_size){
    R.push(a);
    R_size++;
    R_min = a;
    min_value += a-L_max;
    min_x = L_max;
    return;
  }
  if(R_size > L_size){
    L.push(-a);
    L_size++;
    L_max = a;
    min_x = a;
    min_value += R_min - a;
    return;
  }
  L.push(-a);
  L_size++;
  L_max = a;
  min_x = a;
  return;
}

void f2(){
  if(L_size >= R_size){
    min_x = -L.front()
  } else {
    min_x = R.front()
  }
  
  cout << min_x << " " << min_value << endl;
  return;
}

int main(){
  L_max = -1e18;
  R_min = -L_max;
  cin >> Q;
  for(int i=0;i<Q;i++){
    ll mode,a,b;
    cin >> mode;
    if(mode == 1){
      cin >> a >> b;
      f1(a,b);
    } else {
      f2();
    }
  }
}

Compiler output:
a.cc: In function 'void f2()':
a.cc:90:23: error: expected ';' before '}' token
   90 |     min_x = -L.front()
      |                       ^
      |                       ;
   91 |   } else {
      |   ~                    
a.cc:92:22: error: expected ';' before '}' token
   92 |     min_x = R.front()
      |                      ^
      |                      ;
   93 |   }
      |   ~
Language: C

#include <stdio.h>
#include <stdlib.h>

struct abtyp {long a,b;};

int asbc(const void *x, const void *y) {
  return (*(struct abtyp *)x).a - (*(struct bctyp *)y).a;
}

int main(){
   int i,q,j,n;
   long a[100000],s;
   struct abtyp ab[100000];
    
   scanf("%d",&q);
   for (n=i=0;i<q;i++) {
      scanf("%d",&j);
      if (j==1) {
         scanf("%ld %ld",&(ab[n].a),&(ab[n].b));
         n++;
      } else {
         qsort(ab,m,sizeof(struct abtyp),asbc);
         j=n/2;
         s=0;
         for (i=0;i<n;i++) {
            if (i<j) s+=ab[i].a-ab[j].a;
            else     s+=ab[j].a-ab[i].a;
            s+=ab[i].b;
         printf("%d %ld\n",j,s);
      }
   return 0;
}


Compiler output:
main.c: In function 'asbc':
main.c:7:55: error: invalid use of undefined type 'struct bctyp'
    7 |   return (*(struct abtyp *)x).a - (*(struct bctyp *)y).a;
      |                                                       ^
main.c: In function 'main':
main.c:22:19: error: 'm' undeclared (first use in this function)
   22 |          qsort(ab,m,sizeof(struct abtyp),asbc);
      |                   ^
main.c:22:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:32:1: error: expected declaration or statement at end of input
   32 | }
      | ^
main.c:32:1: error: expected declaration or statement at end of input
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define INF (1<<28)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long
signed main(){
  int q;
  cin>>q;
  vector<int> v;
  priority_queue<int,vector<int>> qhigh;
  priority_queue<int,vector<int>,greater<int>> qlow;
  int sum=0;
  int dec=0;
  int t;
  int beft=-1;
  lp(i,q){
    int a;
    cin>>a;
    if(a==1){
      int b,c;
      cin>>b>>c;
      if(qlow.empty()){
        qlow.push(b);
        t=b;
      sum+=c;
        continue;
      }
      if(qhigh.empty()){
        if(qlow.top()<b){
          qhigh.push(b);
        }
        else{
          qhigh.push(qlow.top());
          qlow.pop();
          qlow.push(b);
        }
        dec+=qhigh.top()-qlow.top();
        t=qlow.top();
      sum+=c;
        continue;
      }
      if(qlow.size()<qhigh.size()){
        qlow.push(qhigh.top());
        qhigh.pop();
      }
      if(qlow.size()-2==qhigh.size()){
        qhigh.push(qlow.size());
        qlow.pop();
      }
      t=qlow.top();
      dec+=abs(t-b);
      sum+=c;
      if((qhigh.size()+qlow.size())%2==0&&beft!=t) dec+=abs(beft-t);

        e=beft;
    }
    else{
      cout<<t<<" "<<dec+sum<<endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:9: error: 'e' was not declared in this scope
   56 |         e=beft;
      |         ^
Language: C++

#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

int main()
{
    int Q;
    cin >> Q;
    vector<pair<int, ll> > ans(q);
    vector<int> a;
    int cnt=0;
    ll fx=0;
    ll sum=0;
    for(int q=0; q<Q; q++){
        int tmp;
        cin >> tmp;
        if(tmp==1){
            int t1, t2;
            cin >> t1 >> t2;
            a.push_back(t1);
            sum+=t1;
            fx+=t2;
        }else{
            if(a.size()==0){
                ans[cnt]=make_pair(0, fx);
            }else if(a.size()==1){
                ans[cnt]=make_pair(a[0], 0);
            }
            else{
                double avg=sum/a.size();
                int mean=int(avg);
                if(avg-int(avg)>0.5) mean+=1;
                ll all=0;
                for(int i=0; i<a.size(); i++){
                    all+=abs(a[i]-mean);
                }
                ans[cnt]=make_pair(mean, all+fx);
            }
            cnt++;
        }
    }
    for(int q=0; q<cnt; q++){
        cout << ans[q].first << ' ' << ans[q].second << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:32: error: 'q' was not declared in this scope
   21 |     vector<pair<int, ll> > ans(q);
      |                                ^
Language: C++

// template version 1.11
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings {{{
#define infile "../test/sample-1.in"
#define int long long
const int INF=1e18;
const int MOD=1e9+7;
// }}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;
#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#endif
//}}}



int solve(){
  int Q;cin>>Q;
  int B = 0;
  int cou = 0;
  set<int> A;
  rep(q, Q){
    int t;cin>>t;
    if (t==1){  //update
      int a,b;cin>>a>>b;
      A.insert(a);
      B += b;
      cou++;
    }
    if (t==2){ // query
      dump(A);
      dump(B);
      // return median of A
      int left = 0;
      int right = 1000000001;
      int m=(sz(A)+1)/2;
      auto isright = [&](int x) {
        int i = *A.lower_bound(x);
        if (i+1>=m) return true;
        else return false;
      };
      while (right-left>1){
        int mid = (right+left)/2;
        if (isright(mid)) { right = mid;}
        else{ left = mid; }
      }
      cout << right+1 << endl;
    }
  }
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Compiler output:
a.cc: In function 'long long int solve()':
a.cc:62:7: error: 'dump' was not declared in this scope; did you mean 'dup'?
   62 |       dump(A);
      |       ^~~~
      |       dup