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

#include <bits/stdc++.h>

using namespace std;

#ifndef ONLINE_JUDGE
	#define W(x, y) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << y;
#else
	#define W(x, y)
#endif

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<pii>;
using vl = vector<ll>;
using vll = vector<pll>;
using ld = long double;
#define ff first
#define ss second
const ld pi = acosl(-1);
const ll prime = 1000000000 + 7;
const ll INF = 1000000000;



int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    ll q;
    cin >> q;
    vector<pair<ll, pll>> vet1(q);
    multiset<ll, greater<ll>> conj1;
    multiset<ll, less<ll>> conj2;
    ll val1, val2, qtd = 0;
    for(int i = 0; i < q; ++i){
        cin >> vet1[i].ff;
        if(vet1[i].ff == 1){
            cin >> vet1[i].ss.ff >> vet1[i].ss.ss;
        }
    }
    ll flag = 0;
    ll aam = 0;
    ll aaM = 0;
    ll bb = 0;
    ll val1 = 0, val2 = 0, aux = 0;
    for(int i = 0; i < q; ++i){
        ll t = vet1[i].ff;
        if(t == 1){
            ll a = vet1[i].ss.ff;
            ll b = vet1[i].ss.ss;
            qtd++;
            // if(qtd == 1){
            //     val1 = a;
            // } else if(qtd == 2){
            //     val2 = a;
            //     if(val1 > val2){
            //         swap(val1, val2);
            //     }
            // } else 
            if(qtd%2 == 1){
                val2 += a;
                conj2.insert(a);
                aux = *conj2.begin();
                val1 += aux;
                val2 -= aux;
                conj1.insert(*conj2.begin());
                conj2.erase(conj2.begin());
            } else{
                val1 += a;
                conj1.insert(a);
                aux = *conj1.begin();
                val2 += aux;
                val1 -= aux;
                conj2.insert(*conj1.begin());
                conj1.erase(conj1.begin());
            }
            if(flag == 0){
                aam = a;
                aaM = a;
                flag = 1;
            } else{
                aam = min(aam, a);
                aaM = max(aaM, a);
            }
            bb += b;
        } else{
            aux = *conj1.begin();
            cout << aux << " " << aux - val1 + val2 - aux << "\n";
        }
    }
    return 0;
}

/*
10
10 9 7 8 6 5 3 4 2 1
*/
// 0 1 2 3 4 5 6 7 8 9 10
// 0 2 0 0 0 4 0 0 0 2 0 

Compiler output:
a.cc: In function 'int main()':
a.cc:47:8: error: redeclaration of 'll val1'
   47 |     ll val1 = 0, val2 = 0, aux = 0;
      |        ^~~~
a.cc:36:8: note: 'll val1' previously declared here
   36 |     ll val1, val2, qtd = 0;
      |        ^~~~
a.cc:47:18: error: redeclaration of 'll val2'
   47 |     ll val1 = 0, val2 = 0, aux = 0;
      |                  ^~~~
a.cc:36:14: note: 'll val2' previously declared here
   36 |     ll val1, val2, qtd = 0;
      |              ^~~~
Language: C++

#include <iostream>
#include <set>

struct medianset {
	std::multiset<long long> left;
	std::multiset<long long> right;
	long long left_sum;
	long long right_sum;

	medianset() {left_sum = right_sum = 0;}

	void balance() {
		if (left.size() == right.size() + 2) {
			right.insert(*left.rbegin());
			left.erase(--left.end());
			right_sum += *right.begin();
			left_sum -= *right.begin();
		}
		if (left.size() + 1 == right.size()) {
			left.insert(*right.begin());
			right.erase(right.begin());
			left_sum += *left.rbegin();
			right_sum -= *left.rbegin();;
		}
	}

	void insert(long long x) {
		if (left.empty()) {
			left.insert(x);
			left_sum += x;
			return;
		}
		if (x <= *left.rbegin()) {
			left.insert(x);
			left_sum += x;
		} else {
			right.insert(x);
			right_sum += x;
		}
		balance();
	}

	// return false : erasure failed
	bool erase(long long x) {
		auto itr1 = left.end();
		auto itr2 = right.end();
		if (x <= *left.rbegin()) itr1 = left.find(x);
		if (*right.begin() <= x) itr2 = right.find(x);
		if (itr2 != right.end()) {
			right.erase(itr2);
			right_sum -= x;
		} else if (itr1 != left.end()) {
			left.erase(itr1);
			left_sum -= x;
		}
		else return false;
		balance();
		return true;
	}

	std::pair<long long, long long> get_median() {
		assert(left.size());
		if (left.size() == right.size()) return {*left.rbegin(), *right.begin()};
		else return {*left.rbegin(), *left.rbegin()};
	}
};

int main() {
	long long q;
	std::cin >> q;
	medianset st;
	long long sum = 0;
	while (q--) {
		long long x;
		std::cin >> x;
		if (x == 1) {
			long long a, b;
			std::cin >> a >> b;
			st.insert(a);
			sum += b;
		} else {
			x = st.get_median().first;
			std::cout << x << ' ';
			std::cout << x * (long long)st.left.size() - st.left_sum + st.right_sum - x * (long long)st.right.size() + sum << '\n';
		}
	}
}

Compiler output:
a.cc: In member function 'std::pair<long long int, long long int> medianset::get_median()':
a.cc:62:17: error: 'assert' was not declared in this scope
   62 |                 assert(left.size());
      |                 ^~~~~~
a.cc:3:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    2 | #include <set>
  +++ |+#include <cassert>
    3 |
Language: C++

#include <bits/stdc++.h>
typedef long long LL;
const int maxn =  2e5+5;
using namespace std;
LL q,mid,psz,sum;
LL sumofs,sumofb;
int arr[maxn];
priority_queue<int>q1;
priority_queue<int>q2;

int main() {
	scanf("%lld",&q);
	while (q--) {
		int op,a,b;
		scanf("%d",&op);
		if (op == 1) {
			scanf("%d%d",&a,&b);
			psz++; sum+=b;
			//if (psz == 1) mid = a;
			else{
				if (a > mid) {
					q2.push(-a);
					sumofb += a;
				} else {
					q1.push(a);
					sumofs += a;
				}
				while (1) {
					if (q1.size() > q2.size()) {
						sumofs -= q1.top();
						sumofb += mid;
						q2.push(-mid);
            			mid=q1.top();
            			q1.pop();
					}else if (q1.size()+1 < q2.size()) {
						sumofb -= q2.top();
						sumofs += mid;
						q1.push(mid);
            			mid=-q2.top();
            			q2.pop();
					}else{
						break;
					}
				}
			}
			arr[psz] = a;
		}else{
			LL sofa = (LL)mid*q1.size()-sumofs+sumofb-(LL)mid*q2.size();
			sofa+=sum;
			printf("%lld %lld\n",mid,sofa);
		}
	}
}

/*
	while(q1.size() != q2.size()){
        if(q1.size() > q2.size()){
           	q2.push(-mid);
            mid=q1.top();
            q1.pop();
        }else{
            q1.push(mid);
            mid=-q2.top();
            q2.pop();
        }
    }
    */ 

Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: expected '}' before 'else'
   20 |                         else{
      |                         ^~~~
a.cc:16:30: note: to match this '{'
   16 |                 if (op == 1) {
      |                              ^
a.cc:47:18: error: 'else' without a previous 'if'
   47 |                 }else{
      |                  ^~~~
a.cc: At global scope:
a.cc:53:1: error: expected declaration before '}' token
   53 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
long long a[200000+5],b[200000+5],k,ans;
int main(){
	priority_queue<long long,vector<long long> > q1;
   priority_queue<long long,vector<long long>,greater<long long> > q2;
	long long n,num;
	cin>>n;
	while(n--){
		cin>>num;
		if(num==1){
			cin>>a[k]>>b[k];
			k++;
		if (a[k]>q1.top()) q2.push(a[k]);
			else q1.push(a[k]);
			int sz1=q1.size();
			int sz2=q2.size();
		while (abs(sz1-sz2)>1)
			if (sz1>sz2){q2.push(q1.top());q1.pop();}
				else{q1.push(q2.top());q2.pop();}
	   }
	   if(num==2){
	        long long mid=(sz1>sz2?q1.top():q2.top());
	        ans=0,k=0;
	        for(long long i=0;i<k;i++){
	        	ans=ans+abs(mid-a[i])+b[i];
			}
			  cout<<ans<<endl;
	   }
    }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:32: error: 'sz1' was not declared in this scope
   26 |                 long long mid=(sz1>sz2?q1.top():q2.top());
      |                                ^~~
a.cc:26:36: error: 'sz2' was not declared in this scope
   26 |                 long long mid=(sz1>sz2?q1.top():q2.top());
      |                                    ^~~
Language: C++

#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
long long a[200000+5],b[200000+5],k,ans;
int main(){
	priority_queue<long long,vector<long long> > q1;
   priority_queue<long long,vector<long long>,greater<long long> > q2;
	long long n,num;
	cin>>n;
	while(n--){
		cin>>num;
		if(num==1){
			cin>>a[k]>>b[k];
			k++;
		if (a[k]>q1.top()) q2.push(a[k]);
			else q1.push(a[k]);
		while (abs(q1.size()-q2.size())>1)
			if (q1.size()>q2.size()){q2.push(q1.top());q1.pop();}
				else{q1.push(q2.top());q2.pop();}
	   }
	   if(num==2){
	        long long mid=(q1.size()>q2.size()?q1.top():q2.top());
	        ans=0,k=0;
	        for(long long i=0;i<k;i++){
	        	ans=ans+abs(mid-a[i])+b[i];
			}
			  cout<<ans<<endl;
	   }
    }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:27: error: call of overloaded 'abs(std::priority_queue<long long int, std::vector<long long int> >::size_type)' is ambiguous
   19 |                 while (abs(q1.size()-q2.size())>1)
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~
In file included 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/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
Language: C++

#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
long long a[200000+5],b[200000+5],k,ans;
int main(){
	priority_queue<long long,vector<long long> > q1;
   priority_queue<long long,vector<long long>,greater<long long> > q2;
	long long n,num;
	cin>>n;
	while(n--){
		cin>>num;
		if(num==1){
			cin>>a[k]>>b[k];
			k++;
		if (a[k]>q1.top()) q2.push(a[k]);
			else q1.push(a[k]);
		while (abs(q1.size()-q2.size())>1)
			if (q1.size()>q2.size()){q2.push(q1.top());q1.pop();}
				else{q1.push(q2.top());q2.pop();}
	   }
	   if(num==2){
	        long long mid=(q1.size()>q2.size()?q1.top():q2.top());
	        ans=0,k=0;
	        for(long long i=0;i<k;i++){
	        	ans+=abs(mid-a[i])+b[i];
			}
			  cout<<ans<<endl;
	   }
    }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:27: error: call of overloaded 'abs(std::priority_queue<long long int, std::vector<long long int> >::size_type)' is ambiguous
   19 |                 while (abs(q1.size()-q2.size())>1)
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~
In file included 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/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
Language: C

#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
long long a[200000+5],b[200000+5],k,ans;
int main(){
	priority_queue<long long,vector<long long> > q1;
   priority_queue<long long,vector<long long>,greater<long long> > q2;
	long long n,num;
	cin>>n;
	while(n--){
		cin>>num;
		if(num==1){
			cin>>a[k++]>>b[k];
		if (a[k]>q1.top()) q2.push(a[k]);
			else q1.push(a[k]);
		while (abs(q1.size()-q2.size())>1)
			if (q1.size()>q2.size()){q2.push(q1.top());q1.pop();}
				else{q1.push(q2.top());q2.pop();}
	   }
	   if(num==2){
	        long long mid=(q1.size()>q2.size()?q1.top():q2.top());
	        ans=0,k=0;
	        for(long long i=0;i<k;i++){
	        	ans+=abs(mid-a[i])+b[i];
			}
			  cout<<ans<<endl;
	   }
    }
  
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
long long a[200000+5],b[200000+5],k,ans;
int main(){
	priority_queue<long long,vector<long long> > q1;
   priority_queue<long long,vector<long long>,greater<long long> > q2;
	long long n,num;
	cin>>n;
	while(n--){
		cin>>num;
		if(num==1){
			cin>>a[k++]>>b[k];
		if (a[k]>q1.top()) q2.push(a[k]);
			else q1.push(a[k]);
		while (abs(q1.size()-q2.size())>1)
			if (q1.size()>q2.size()){q2.push(q1.top());q1.pop();}
				else{q1.push(q2.top());q2.pop();}
	   }
	   if(num==2){
	        long long mid=(q1.size()>q2.size()?q1.top():q2.top());
	        ans=0,k=0;
	        for(long long i=0;i<k;i++){
	        	ans+=abs(mid-a[i])+b[i];
			}
			  cout<<ans<<endl;
	   }
    }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:27: error: call of overloaded 'abs(std::priority_queue<long long int, std::vector<long long int> >::size_type)' is ambiguous
   18 |                 while (abs(q1.size()-q2.size())>1)
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~
In file included 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/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
Language: C++

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

int main(){
  long long int sum=0;
  long long int tmp=0;
  long long int mid;
  vector <long long int> v;
  int q;
  cin >> q;
  long long int a,b,c;
  cin >> a >> b >> c;
  sum+=(b+c);
  v.push_back(b);
  tmp+=b;
  mid = b;
  for(int i=0;i<q;i++){
    cin >> a;
    if(a==1){
      cin >> b >> c;
      sum+=(b+c);
      v.insert(upper_bound(v.begin(),v.end(),b),b);
      if(mid>=b){
        if(v.size()%2==0)tmp -= mid;
        tmp += b;
        mid=v[(v.size()-1)/2];
      }
      else{
        if(v.size()%2)tmp += v[(v.size()-1)/2];
        mid=v[(v.size()-1)/2];
      }
    }
    else cout << (-1LL)*(v.size()%2)*v[(v.size()-1)/2]+sum - 2*tmp << endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:34:4: error: expected '}' at end of input
   34 |   }
      |    ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

int main(){
  long long int sum=0;
  long long int tmp=0;
  long long int mid;
  vector <long long int> v;
  int q;
  cin >> q;
  long long int a,b,c;
  cin >> a >> b >> c;
  sum+=(b+c);
  v.push_back(b);
  tmp+=b;
  mid = b;
  for(int i=0;i<q;i++){
    cin >> a;
    if(a==1){
      cin >> b >> c;
      sum+=(b+c);
      v.insert(upper_bound(v.begin(),v.end(),b),b);
      if(mid>=b){
        if(v.size()%2==0)tmp -= mid;
        tmp += b;
        mid=v[(n-1)/2];
      }
      else{
        if(v.size()%2)tmp += v[(n-1)/2];
        mid=v[(n-1)/2];
      }
    }
    else cout << (-1LL)*(v.size()%2)*v[(n-1)/2]+sum - 2*tmp << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: 'n' was not declared in this scope
   26 |         mid=v[(n-1)/2];
      |                ^
a.cc:29:33: error: 'n' was not declared in this scope
   29 |         if(v.size()%2)tmp += v[(n-1)/2];
      |                                 ^
a.cc:30:16: error: 'n' was not declared in this scope
   30 |         mid=v[(n-1)/2];
      |                ^
a.cc:33:41: error: 'n' was not declared in this scope
   33 |     else cout << (-1LL)*(v.size()%2)*v[(n-1)/2]+sum - 2*tmp << endl;
      |                                         ^
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

int q;

multiset<ll> a;
ll b;

int main()
{
    cin >> q;

    bool even = false;

    int num;
    ll tmp;
    cin >> num >> tmp >> b;

    a.insert(tmp);

    auto itr = a.begin();

    tmp = 0;

    for (int i = 0; i < q - 1; i++)
    {
        cin >> num;

        if (num == 1)
        {
            ll aa, bb;
            cin >> aa >> bb;
            b += bb;

            if (even)
            {
                if (aa < *itr)
                {
                    a.insert(aa);
                    tmp += abs(aa - *itr);
                }
                else
                {
                    ll tt = *itr;
                    a.insert(aa);
                    ++itr;
                    tmp += abs(aa - tt) - (*itr - tt);
                }
                even = false;
            }
            else
            {
                if (aa < *itr)
                {
                    ll tt = A[*itr];
                    tmp += abs(*itr - aa);
                    a.insert(aa);
                    --itr;
                }
                else
                {
                    a.insert(aa);
                    tmp += abs(aa - *itr);
                }
                even = true;
            }
        }
        else
        {
            cout << *itr << ' ' << tmp + b << endl;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:29: error: 'A' was not declared in this scope
   61 |                     ll tt = A[*itr];
      |                             ^
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;

#define int long long

#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define rrep(i, n) for (int i=(int)n-1;i>=0;--i)
#define rrep1(i, n) for (int i=n;i>=1;--i)
#define range(i, l, r) for (int i=l;i<(int)r;++i)
#define rrange(i, l, r) for (int i=(int)r-1;i>=(int)l;--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;
using ld=long double;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}

const int mod = TEN(9)+7;
const int inf = TEN(18) * 3 + 10;

int Q;

signed main()
{
	cin >> Q;

	int sum = 0;
	int v = 0;

	priority_queue<int> small;
	priority_queue<int, vi, greater<int>> big;

	small.emplace(-inf);
	big.push(inf);

	int median = -1;
	int sz = 0;

	rep(_, Q) {
		int query; scanf("%lld", &query);

		if (query == 1) {
			sz++;

			int l = small.top(), r = big.top();

			int a,b;scanf("%lld%lld",&a,&b);
			sum += b;

			if (small.top() > a) {
				small.emplace(a);
			} else {
				big.emplace(a);
			}

			if (sz & 1) {
				while (big.size() >= small.size()) {
					int tmp = big.top();
					big.pop();
					small.emplace(tmp);
				}

				while (small.size() >= big.size() + 2) {
					int tmp = small.top();
					small.pop();
					bit.emplace(tmp);
				}
			} else {
				while (big.size() > small.size()) {
					int tmp = big.top();
					big.pop();
					small.emplace(tmp);
				}
				while (big.size() < small.size()) {
					int tmp = small.top();
					small.pop();
					big.emplace(tmp);
				}
			}

			if (l <= a and a <= r) {
			} else {
				if (sz & 1) {
					v += min(abs(small.top() - a), abs(big.top() - a));
				} else {
					v += abs(median - a);
				}
			}
			median = small.top();
		} else {
			printf("%lld %lld\n", median, v + sum);
		}
	}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:91:41: error: 'bit' was not declared in this scope; did you mean 'big'?
   91 |                                         bit.emplace(tmp);
      |                                         ^~~
      |                                         big
Language: C

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
multiset<int>h1,h2;
ll s1,s2;
void push(int x){
	if(!h1.empty()&&x<*h1.rbegin()){   //先插入小堆
		h1.insert(x);
		s1+=x;
	}
	else{
		h2.insert(x);
		s2+=x;
	}
	while(h1.size()>h2.size()){
		const int cur=*h1.rbegin();
		h2.insert(cur);
		auto it=h1.end();
		it--;
		h1.erase(it);
		s1-=cur;
		s2+=cur;
	}
	while(h2.size()>h1.size()){
		const int cur=*h2.begin();
		h1.insert(cur);
		h2.erase(h2.begin());
		s1+=cur;
		s2-=cur;
	 }
 }
 ll num;
 int main(){
	int q;
	cin>>q;
	while(q--){
		int n;
		cin>>n;
		if(n==1){
			int a,b;
			cin>>a>>b;
			num+=b;
			push(a);
		}
		else{
			int x=*h1.rbegin();
	ll ans=1ll*x*(int)(h1.size())-s1+s2-1ll*x*(int)(h2.size())+num;
	    cout<<x<<' '<<ans<<'\n';
		}
	}
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import hiro116s.lib.io.scanner.FastScanner;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeSet;

public class Main {
    InputStream is;

    int __t__ = 1;
    int __f__ = 0;
    int __FILE_DEBUG_FLAG__ = __f__;
    String __DEBUG_FILE_NAME__ = "src/F5";

    FastScanner in;
    PrintWriter out;


    class Pair {
        final int p;
        final int cnt;

        public Pair(int p, int cnt) {
            this.p = p;
            this.cnt = cnt;
        }
    }

    public void solve() {
        int Q = in.nextInt();

        TreeSet<Pair> ts = new TreeSet<>((p1, p2) -> {
            if (p1.p == p2.p) {
                return p1.cnt - p2.cnt;
            } else {
                return p1.p - p2.p;
            }
        });
        Map<Integer, Integer> counts = new HashMap<>();

        Pair curValue = null;
        long res = 0;

        for (int q = 0; q < Q; q++) {
            int t = in.nextInt();
            if (t == 1) {
                int a = in.nextInt();
                int b = in.nextInt();

                int count = counts.getOrDefault(a, 0);
                counts.put(a, count + 1);
                Pair p = new Pair(a, count);
                ts.add(p);

                if (curValue == null) {
                    res += b;
                    curValue = p;
                } else if (ts.size() % 2 == 1 && curValue.p <= a) {
                    curValue = ts.higher(curValue);
                    res += Math.abs(curValue.p - (long) a) + b;
                } else if (ts.size() % 2 == 0 && curValue.p > a) {
                    res += Math.abs(curValue.p - (long) a) + b;
                    curValue = ts.lower(curValue);
                } else {
                    res += Math.abs(curValue.p - (long) a) + b;
                }
            } else {
                out.println(curValue.p + " " + res);
            }
        }
        out.close();
    }

    public void run() {
        if (__FILE_DEBUG_FLAG__ == __t__) {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                // TODO 自動生成された catch ブロック
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } else {
            is = System.in;
        }
        in = new FastScanner(is);
        out = new PrintWriter(System.out);

        solve();
    }

    public static void main(final String[] args) {
        new Main().run();
    }

}


Compiler output:
Main.java:1: error: package hiro116s.lib.io.scanner does not exist
import hiro116s.lib.io.scanner.FastScanner;
                              ^
Main.java:19: error: cannot find symbol
    FastScanner in;
    ^
  symbol:   class FastScanner
  location: class Main
Main.java:90: error: cannot find symbol
        in = new FastScanner(is);
                 ^
  symbol:   class FastScanner
  location: class Main
3 errors
Language: Java

import hiro116s.lib.io.scanner.FastScanner;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeSet;

public class Main {
    InputStream is;

    int __t__ = 1;
    int __f__ = 0;
    int __FILE_DEBUG_FLAG__ = __f__;
    String __DEBUG_FILE_NAME__ = "src/F2";

    FastScanner in;
    PrintWriter out;


    class Pair {
        final int p;
        final int cnt;

        public Pair(int p, int cnt) {
            this.p = p;
            this.cnt = cnt;
        }
    }

    public void solve() {
        int Q = in.nextInt();

        TreeSet<Pair> ts = new TreeSet<>((p1, p2) -> {
            if (p1.p == p2.p) {
                return p1.cnt - p2.cnt;
            } else {
                return p1.p - p2.p;
            }
        });
        Map<Integer, Integer> counts = new HashMap<>();

        Pair curValue = null;
        long res = 0;

        for (int q = 0; q < Q; q++) {
            int t = in.nextInt();
            if (t == 1) {
                int a = in.nextInt();
                int b = in.nextInt();

                int count = counts.getOrDefault(a, 0);
                counts.put(a, count + 1);
                Pair p = new Pair(a, count);
                ts.add(p);

                if (curValue == null) {
                    res += b;
                    curValue = p;
                } else if (ts.size() % 2 == 1 && curValue.p <= a) {
                    curValue = ts.higher(curValue);
                    res += Math.abs(curValue.p - a) + b;
                } else if (ts.size() % 2 == 0 && curValue.p >= a) {
                    res += Math.abs(curValue.p - a) + b;
                    curValue = ts.lower(curValue);
                } else {
                    res += Math.abs(curValue.p - a) + b;
                }
            } else {
                out.println(curValue.p + " " + res);
            }
        }
        out.close();
    }

    public void run() {
        if (__FILE_DEBUG_FLAG__ == __t__) {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                // TODO 自動生成された catch ブロック
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } else {
            is = System.in;
        }
        in = new FastScanner(is);
        out = new PrintWriter(System.out);

        solve();
    }

    public static void main(final String[] args) {
        new Main().run();
    }

}


Compiler output:
Main.java:1: error: package hiro116s.lib.io.scanner does not exist
import hiro116s.lib.io.scanner.FastScanner;
                              ^
Main.java:19: error: cannot find symbol
    FastScanner in;
    ^
  symbol:   class FastScanner
  location: class Main
Main.java:90: error: cannot find symbol
        in = new FastScanner(is);
                 ^
  symbol:   class FastScanner
  location: class Main
3 errors
Language: C++

#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, S, E) for (int(X) = (S); (X) < (E); ++(X))
#define rrep(X, S, E) for (int(X) = (E)-1; (X) >= (S); --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define sortDecending(X) sort(all(X), greater<ll>()) //降順
#define sortAscending(X) sort(all(X))                //昇順
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl
#define printDouble(x) cout << fixed << setprecision(13) << x << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef priority_queue<ll, vl> decendingQueue;              //降順
typedef priority_queue<ll, vl, greater<ll>> ascendingQueue; //昇順
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 9 * 1e18;
const ll MOD = 1e9 + 7;

int main() {
  int Q;
  cin >> Q;

  multiset<ll> less; // 中央値以下の値. less.size() >= more.size()
  multiset<ll> more; // 中央値より大きい値
  less.insert(-INF);
  more.insert(INF);

  ll fx = 0;
  rep(i, 0, Q) {
    int q;
    cin >> q;

    if (q == 1) {
      // 更新
      int a, b;
      cin >> a >> b;

      ll lessv = *--less.end(); // 中央値

      fx += b;
      if (lessv != -INF) {
        fx += abs(lessv - a);
      }

      if (lessv <= a) {
        more.insert(a);
        if (more.size() > less.size()) {
          less.insert(morev);
          more.erase(more.lower_bound(morev));
        }
      } else {
        less.insert(a);
        if (less.size() > more.size() + 1) {
          more.insert(lessv);
          less.erase(less.lower_bound(lessv));
        }
      }

      if (lessv != -INF) {
        ll lessv_new = *--less.end();
        fx += abs(lessv_new - lessv) * (more.size() - less.size());
      }
    } else {
      // 求値
      print(*--less.end() << " " << fx);
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:77:23: error: 'morev' was not declared in this scope; did you mean 'more'?
   77 |           less.insert(morev);
      |                       ^~~~~
      |                       more
Language: C++

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

constexpr int DEBUG = 0;

class OnlineMedian {
 private:
  priority_queue<int64, vector<int64>, less<int64>> pq_less;
  priority_queue<int64, vector<int64>, greater<int64>> pq_greater;
 public:
  void Add(int64 x) {
    if (pq_less.empty() || x <= pq_less.top()) {
      pq_less.push(x); pq_less.push(x);
    } else {
      pq_greater.push(x); pq_greater.push(x);
    }
    if (pq_less.size() > pq_greater.size()) {
      int64 t = pq_less.top(); pq_less.pop(); pq_greater.push(t);
    } else if (pq_greater.size() > pq_less.size()) {
      int64 t = pq_greater.top(); pq_greater.pop(); pq_less.push(t);
    }
  }
  // Returns a median. When there are two, returns a less one.
  int64 LessMedian() { return pq_less.top(); }
  // Returns a median. When there are two, returns a greater one.
  int64 GreaterMedian() { return pq_greater.top(); }
  bool Empty() { return pq_less.empty(); }
};

class OnlineLeastAbsoluteErrors {
 private:
  OnlineMedian online_median;
  int64 sum_of_absolute_errors;
 public:
  void Add(int64 x) {
    if (!online_median.Empty()) {
      if (x > online_median.GreaterMedian()) {
        sum_of_absolute_errors += x - online_median.GreaterMedian();
      } else if (x < online_median.LessMedian()) {
        sum_of_absolute_errors += online_median.LessMedian() - x;
      }
    }
    online_median.Add(x);
  }
  
  int64 SumOfAbsoluteErrors() {
    return sum_of_absolute_errors;
  }

  OnlineMedian OnlineMedian() {
    return online_median;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int num_queries;
  cin >> num_queries;

  OnlineLeastAbsoluteErrors online_lae;
  int64 absolute_sum = 0;
  int64 base = 0;
  for (int i = 0; i < num_queries; i++) {
    int command;
    cin >> command;
    if (command == 1) {
      int64 a, b;
      cin >> a >> b;

      base += b;

      online_lae.Add(a);
    } else {
      // Output
      cout << online_lae.OnlineMedian().LessMedian() << " "
          << absolute_sum + base << endl;
    }
  } 
}


Compiler output:
a.cc:53:16: error: declaration of 'OnlineMedian OnlineLeastAbsoluteErrors::OnlineMedian()' changes meaning of 'OnlineMedian' [-Wchanges-meaning]
   53 |   OnlineMedian OnlineMedian() {
      |                ^~~~~~~~~~~~
a.cc:53:3: note: used here to mean 'class OnlineMedian'
   53 |   OnlineMedian OnlineMedian() {
      |   ^~~~~~~~~~~~
a.cc:9:7: note: declared here
    9 | class OnlineMedian {
      |       ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

constexpr int DEBUG = 0;

class OnlineMedian {
 private:
  priority_queue<int64, vector<int64>, less<int64>> pq_less;
  priority_queue<int64, vector<int64>, greater<int64>> pq_greater;
 public:
  void Add(int64 x) {
    if (pq_less.empty() || x <= pq_less.top()) {
      pq_less.push(x); pq_less.push(x);
    } else {
      pq_greater.push(x); pq_greater.push(x);
    }
    if (pq_less.size() > pq_greater.size()) {
      int64 t = pq_less.top(); pq_less.pop(); pq_greater.push(t);
    } else if (pq_greater.size() > pq_less.size()) {
      int64 t = pq_greater.top(); pq_greater.pop(); pq_less.push(t);
    }
  }
  // Returns a median. When there are two, returns a less one.
  int64 LessMedian() { return pq_less.top(); }
  // Returns a median. When there are two, returns a greater one.
  int64 GreaterMedian() { return pq_greater.top(); }
  bool Empty() { return pq_less.empty(); }
};

class OnlineLeastAbsoluteErrors {
 private:
  OnlineMedian online_median;
  int64 sum_of_absolute_errors;
 public:
  void Add(int64 x) {
    if (!online_median.Empty()) {
      if (x > online_median.GreaterMedian()) {
        sum_of_absolute_errors += x - online_median.GreaterMedian();
      } else if (x < online_median.LessMedian()) {
        sum_of_absolute_errors += online_median.LessMedian() - a;
      }
    }
  }
  
  int64 SumOfAbsoluteErrors() {
    return sum_of_absolute_errors;
  }

  OnlineMedian OnlineMedian() {
    return online_median;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int num_queries;
  cin >> num_queries;

  OnlineLeastAbsoluteErrors online_lae;
  int64 absolute_sum = 0;
  int64 base = 0;
  for (int i = 0; i < num_queries; i++) {
    int command;
    cin >> command;
    if (command == 1) {
      int64 a, b;
      cin >> a >> b;

      base += b;

      online_lae.Add(a);
    } else {
      // Output
      cout << online_lae.OnlineMedian().LessMedian() << " "
          << absolute_sum + base << endl;
    }
  } 
}


Compiler output:
a.cc:52:16: error: declaration of 'OnlineMedian OnlineLeastAbsoluteErrors::OnlineMedian()' changes meaning of 'OnlineMedian' [-Wchanges-meaning]
   52 |   OnlineMedian OnlineMedian() {
      |                ^~~~~~~~~~~~
a.cc:52:3: note: used here to mean 'class OnlineMedian'
   52 |   OnlineMedian OnlineMedian() {
      |   ^~~~~~~~~~~~
a.cc:9:7: note: declared here
    9 | class OnlineMedian {
      |       ^~~~~~~~~~~~
a.cc: In member function 'void OnlineLeastAbsoluteErrors::Add(int64)':
a.cc:43:64: error: 'a' was not declared in this scope
   43 |         sum_of_absolute_errors += online_median.LessMedian() - a;
      |                                                                ^
Language: C++

#include <iostream>
#include <ios>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>
#include <cassert>

using namespace std;

using i64 = long long;
using P = pair<i64, i64>;

const i64 mod = 1e9 + 7;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

i64 a[200010];
i64 b = 0, n = 0;

int main(){
    i64 q, tb, k, l, r, lres, rres, lidx, ridx;
    cin >> q;
    for(int i = 0; i < q; ++i){
        cin >> k;
        if(k == 1){
            cin >> a[n] >> tb;
            ++n;
            b += tb;
        }else{
            l = -1*mod, r = mod;
            while(r - l >= 3){
                lres = b, rres = b;
                lidx = (l * 2 + r) / 3, ridx = (l + r * 2) / 3);
                for(int i = 0; i < n; ++i){
                    lres += abs(lidx - a[i]);
                    rres += abs(ridx - a[i]);
                }
                if(lres > rres){
                    l = lidx;
                }else{
                    r = ridx;
                }
            }
            i64 m = 0, v = 1e18 + 7;
            for(int i = l; i <= r; ++i){
                i64 res = 0;
                for(int j = 0; j < n; ++i) res += abs(i - a[j]);
                if(res < v){
                    v = res;
                    m = i;
                }
            }
            cout << m << " " << v << endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:63: error: expected ';' before ')' token
   43 |                 lidx = (l * 2 + r) / 3, ridx = (l + r * 2) / 3);
      |                                                               ^
      |                                                               ;
Language: C++

//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> vpi;

const long long MOD = 998244353;
const long long mod = 1000000007;
const long long INF = 10000000000000;
 
#define itn int
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
 
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
 
#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
/**************************************************/
int q;
vector<int> lyn;
multiset<int> sl,sr;
ll sum;
/*****************************************************/
void q1(int a,int b){
   lyn.pb(a);
   sum += b;
   if(sl.size() == 0){
      sl.insert(a);
      sr.insert(b);
   }else{
      if(*(--sl.end()) > a){
         sl.insert(a);
         sl.insert(a);
         int x = *(--sl.end());
         sl.erase(x);
         sr.insert(x);
      }else if(*(sr.begin()) < a){
         sr.insert(a);
         sr.insert(a);
         int x = *(sr.begin());
         sr.erase(x);
         sl.insert(x);
      }else{
         sl.insert(a);
         sr.insert(a);
      }
   }
}

void q2(){
   int x = *(--sl.end());
   ll ans = sum;
   rep(i,a.size()){
      ans += abs(a[i] - x);
   }
   printf("%d %lld\n",x,ans);
   //cout << x << " " << ans << endl;
}
void solve(){
   rep(i,q){
      int query;scanf("%d",&query);
      if(query == 1){
         int a,b;scanf("%d%d",&a,&b);
         q1(a,b);
      }else{
         q2();
      }
   }
}

int main(void){
   cin >> q;
   solve();
   return 0;
}

Compiler output:
a.cc: In function 'void q2()':
a.cc:80:10: error: 'a' was not declared in this scope
   80 |    rep(i,a.size()){
      |          ^
a.cc:36:36: note: in definition of macro 'rep'
   36 | #define rep(i,n) for(int i = 0;i < n;i++)
      |                                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 1000000000000000LL
priority_queue<ll>l;
priority_queue<ll,vector<ll>,greater<ll> >r;
 
int main(){
  ll q;
  ll sum=0,lsum=0,rsum=0;
  cin>>q;
  
  for(int i=0;i<q;i++){
    int t;
    cin>>t;
    if(t==1){
      ll a,b;
      cin>>a>>b;
      sum+=b;
 
      ll max_l=INF;
      if(!l.empty())max_l=l.top();
      if(a<=max_l){
	l.push(a);
	lsum+=a;
      }
      else{
	r.push(a);
	rsum+=a;
      }
      
      if(!l.empty()&&(int)l.size()-(int)r.size()>1){
    	ll temp=l.top();l.pop();
    	r.push(temp);
    	lsum-=temp;
    	rsum+=temp;
      }
      else if(!r.empty()&&(int)r.size()-(int)l.size()>0){
	ll temp=r.top();r.pop();
	l.push(temp);
	rsum-=temp;
	lsum+=temp;
      }
    }
    else{
      if((int)l.size()-(int)r.size()==1){
    	ll x=l.top();
    	cout<<x<<' '<<x-lsum+rsum+sum<<endl;
      }
      else{
    	ll x=l.top();
    	cout<<x<<' '<<-lsum+rsum+sum<<endl;
      }
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:55:4: error: expected '}' at end of input
   55 |   }
      |    ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <set>
using namespace std;

multiset<long long> A;
long long bs, as, q, sz;

void lax() {
	while (A.size() > (sz + 1) / 2) {
		multiset<long long>::iterator it = A.end();
		it--;
		as += 2 * (*it);
		A.erase(*it);
	}
}
long long geten() {
	multiset<int>::iterator it = A.end();
	it--;
	return *it;
}

int main() {
	cin >> q;
	for (int i = 0; i < q; i++) {
		int t, a, b;
		cin >> t;
		if (t == 1) {
			cin >> a >> b;
			sz++;
			A.insert(a);
			as -= a;
			bs += b;
			lax();
		}
		else
			cout << geten() << ' ' << + geten() * (sz % 2) + as + bs << '\n';
	}
}

Compiler output:
a.cc: In function 'long long int geten()':
a.cc:17:43: error: conversion from '_Rb_tree_const_iterator<long long int>' to non-scalar type '_Rb_tree_const_iterator<int>' requested
   17 |         multiset<int>::iterator it = A.end();
      |                                      ~~~~~^~
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a[ohara],b[ohara],c[ohara],d,tmp,tmpp,m,h,w,y,pos,k,bit[ohara];
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz");
bool fl;
struct edge{int to,cost;};
ll atu[ohara];
ll atu_cou;
map<ll,ll> mp;
unoreded_map<ll,ll> fuku;
ll tasu;
ll yoso;
ll anss;
ll before;
vector<ll> kouho;
ll zyuu[ohara];

//-------------------------↓↓↓↓↓↓------------------------

ll sum(ll i){
  ll s=0;
  while(i>0){
    s+=bit[i];
    i-=i&-i;
  }
  return s;
}

void add(ll i,ll x){
  while(i<=ohara-10){
    bit[i]+=x;
    i+=i&-i;
  }
}

int main(void){
        cin.tie(0);
        cout.tie(0);
    ios::sync_with_stdio(false);

    //cin>>n;
    scanf("%lld",&n);
    rep(i,n){
        //cin>>a[i];
        scanf("%lld",&a[i]);
        if(a[i]==1){
          //cin>>b[i]>>c[i];
          scanf(" %lld %lld",&b[i],&c[i]);
          atu[atu_cou++]=b[i];
        }
    }
    sort(atu,atu+atu_cou);
    tmp=1;
    rep(i,atu_cou-1){
        mp[atu[i]]=tmp;
        fuku[tmp]=atu[i];
        if(atu[i]!=atu[i+1])tmp++;
    }
    mp[atu[atu_cou-1]]=tmp;
    fuku[tmp]=atu[atu_cou-1];
    rep(i,n){
      if(a[i]==1){
        add(mp[b[i]],1LL);
        zyuu[mp[b[i]]]++;
        tasu+=c[i];
        yoso++;

         ll le=1,ri=tmp,mid;
        while(ri-le>1){
          mid=(le+ri)/2;
          if(sum(mid)-zyuu[mid]+1>(yoso+1)/2)ri=mid;
          else if((yoso+1)/2>sum(mid))le=mid;
          else break;
        }
        int ok=0;
        rrep(j,max(le-3,0LL),min(ri+3,tmp+1)){
          if(sum(j)-zyuu[j]+1<=(yoso+1)/2&&(yoso+1)/2<=sum(j)){
            tmpp=j;
            ok=1;
            break;
          }
        }
        if(!ok)tmpp=tmp;
        /////
        ans+=(yoso%2==0?abs(fuku[before]-b[i]):abs(fuku[tmpp]-b[i]));
        /////
        anss=fuku[tmpp];
        before=tmpp;
      }
      else{
        printf("%lld %lld\n",anss,ans+tasu);
      }
    }
    return 0;
}


Compiler output:
a.cc:34:1: error: 'unoreded_map' does not name a type
   34 | unoreded_map<ll,ll> fuku;
      | ^~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:80:9: error: 'fuku' was not declared in this scope
   80 |         fuku[tmp]=atu[i];
      |         ^~~~
a.cc:84:5: error: 'fuku' was not declared in this scope
   84 |     fuku[tmp]=atu[atu_cou-1];
      |     ^~~~