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,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,fi1,se1,th1,fo1,fi2,se2;
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"),s;
bool fl;
struct edge{int to,cost;};
ll dat[ohara];
ll dat_cou;
ll ad;
ll before;
ll youso;
ll sp[ohara];
ll sp_cou;
pair<ll,pair<ll,ll>> p[ohara];
map<ll,ll> mp;
ll nannko[ohara];
map<ll,ll> rmp;

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

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<=n){
    bit[i]+=x;
    i+=i&-i;
  }
}
ll tyuu1,tyuu2;

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

    cin>>n;
    //中央値保持　さっきの中央値は変わらん
    rep(i,n){
        cin>>a;
        if(a==1)cin>>b>>c;
        else {b=0;c=0;}
        p[i]=m_p(a,m_p(b,c));
        if(a==1){
            sp[sp_cou++]=b;
        }
    }
    sort(sp,sp+sp_cou);
    tmp=1;
    rep(i,sp_cou){
        mp[sp[i]]=tmp;
        rmp[tmp]=sp[i];
        if(sp[i]!=sp[i+1])tmp++;
    }
    rep(i,n){
        if(p[i].fi==1){
            youso++;
            add(mp[p[i].se.fi],1LL);
            ad+=p[i].se.se;
            if(youso%2==0){
                ans+=abs(tyuu1-p[i].se.fi);
            }
            else{
                
            }
             ll le=1,ri=2*100000,mid;
            ll nn;
            if(youso%2==0)nn=youso/2;
            else nn=youso/2+1;
            while(ri-le>1){
                mid=(le+ri)/2;
                if(sum(mid)>=nn)ri=mid;
                else le=mid;
            }
            rrep(j,max(1,le-2),min(2*100001,ri+2)){
                if(sum(i)==nn){
                    tyuu1=j;
                }
            }
            if(youso%2==0)tyuu2=j+1;
            tyuu1=rmp[tyuu1];
            tyuu2=rmp[tyuu2];
            
        }
        else{
        }
    }
    return 0;
}


Compiler output:
a.cc:45:12: error: 'll sum(ll)' redeclared as different kind of entity
   45 | ll sum(ll i){
      |            ^
a.cc:22:41: note: previous declaration 'll sum'
   22 | ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,fi1,se1,th1,fo1,fi2,se2;
      |                                         ^~~
a.cc: In function 'll sum(ll)':
a.cc:48:8: error: 'bit' was not declared in this scope
   48 |     s+=bit[i];
      |        ^~~
a.cc: In function 'void add(ll, ll)':
a.cc:56:5: error: 'bit' was not declared in this scope
   56 |     bit[i]+=x;
      |     ^~~
a.cc: In function 'int main()':
a.cc:102:23: error: 'sum' cannot be used as a function
  102 |                 if(sum(mid)>=nn)ri=mid;
      |                    ~~~^~~~~
a.cc:105:23: error: no matching function for call to 'max(int, ll)'
  105 |             rrep(j,max(1,le-2),min(2*100001,ri+2)){
      |                    ~~~^~~~~~~~
a.cc:9:32: note: in definition of macro 'rrep'
    9 | #define rrep(i,a,b) for(int i=(a);i<(b);i++)
      |                                ^
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:105:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  105 |             rrep(j,max(1,le-2),min(2*100001,ri+2)){
      |                    ~~~^~~~~~~~
a.cc:9:32: note: in definition of macro 'rrep'
    9 | #define rrep(i,a,b) for(int i=(a);i<(b);i++)
      |                                ^
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:105:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  105 |             rrep(j,max(1,le-2),min(2*100001,ri+2)){
      |                    ~~~^~~~~~~~
a.cc:9:32: note: in definition of macro 'rrep'
    9 | #define rrep(i,a,b) for(int i=(a);i<(b);i++)
      |                                ^
a.cc:105:35: error: no matching function for call to 'min(int, ll)'
  105 |             rrep(j,max(1,le-2),min(2*100001,ri+2)){
      |                                ~~~^~~~~~~~~~~~~~~
a.cc:9:38: note: in definition of macro 'rrep'
    9 | #define rrep(i,a,b) for(int i=(a);i<(b);i++)
      |                                      ^
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:105:35: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  105 |             rrep(j,max(1,le-2),min(2*100001,ri+2)){
      |                                ~~~^~~~~~~~~~~~~~~
a.cc:9:38: note: in definition of macro 'rrep'
    9 | #define rrep(i,a,b) for(int i=(a);i<(b);i++)
      |                                      ^
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:105:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  105 |             rrep(j,max(1,le-2),min(2*100001,ri+2)){
      |                                ~~~^~~~~~~~~~~~~~~
a.cc:9:38: note: in definition of macro 'rrep'
    9 | #define rrep(i,a,b) for(int i=(a);i<(b);i++)
      |                                      ^
a.cc:106:23: error: 'sum' cannot be used as a function
  106 |                 if(sum(i)==nn){
      |                    ~~~^~~
a.cc:110:33: error: 'j' was not declared in this scope
  110 |             if(youso%2==0)tyuu2=j+1;
      |                                 ^