Language: C++

#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
using namespace std;
 
int bit[1000000],bit_n;
int sum(int i){
  int s=0;
  while(i){
    s+=bit[i];
    i-=i&-i;
  }
  return s;
}
void add(int i,int x){
  while(i<=bit_n){
    bit[i]+=x;
    i+=i&-i;
  }
}
 
struct data{
  int time,type,l,r;
  bool operator < (const data &p)const{
    return (time==p.time?type<p.type:time<p.time);
  }
};
// 1 | add
// 2 - check
// 3 | delete
 
int n;
vector<data> t;
vector<int> X;
map<int,int> mapx;
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    X.push_back(a);
    X.push_back(c);
    if(a==c){
      t.push_back((data){min(b,d),1,a,a});
      t.push_back((data){max(b,d),3,a,a});
    }else{
      t.push_back((data){b,2,min(a,c),max(a,c)});
    }
  }
  sort(t.begin(),t.end());
  sort(X.begin(),X.end());
  int c=2;
  for(int i=0;i<(int)X.size();i++)
    if(i==0||X[i]!=X[i-1])
      mapx[X[i]]=c++;
   
  bit_n=n*2+1;
  long long ans = 0;
  for(int i=0;i<(int)t.size();i++){
    data d=t[i];
    d.l=mapx[d.l],d.r=mapx[d.r];
    if(d.type==1){
      add(d.l,1);
    }else if(d.type==2){
      long long A=sum(d.r)-sum(d.l-1);
      ans+=A;
    }else if(d.type==3){
      add(d.l,-1);
    }
  }
  printf("%lld\n",ans);
  return 0;
}

Compiler output:
a.cc:35:12: error: template argument 1 is invalid
   35 | vector<data> t;
      |            ^
a.cc:35:12: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:46:9: error: request for member 'push_back' in 't', which is of non-class type 'int'
   46 |       t.push_back((data){min(b,d),1,a,a});
      |         ^~~~~~~~~
a.cc:46:20: error: reference to 'data' is ambiguous
   46 |       t.push_back((data){min(b,d),1,a,a});
      |                    ^~~~
In file included from /usr/include/c++/14/string:53,
                 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/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:24:8: note:                 'struct data'
   24 | struct data{
      |        ^~~~
a.cc:47:9: error: request for member 'push_back' in 't', which is of non-class type 'int'
   47 |       t.push_back((data){max(b,d),3,a,a});
      |         ^~~~~~~~~
a.cc:47:20: error: reference to 'data' is ambiguous
   47 |       t.push_back((data){max(b,d),3,a,a});
      |                    ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:24:8: note:                 'struct data'
   24 | struct data{
      |        ^~~~
a.cc:49:9: error: request for member 'push_back' in 't', which is of non-class type 'int'
   49 |       t.push_back((data){b,2,min(a,c),max(a,c)});
      |         ^~~~~~~~~
a.cc:49:20: error: reference to 'data' is ambiguous
   49 |       t.push_back((data){b,2,min(a,c),max(a,c)});
      |                    ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:24:8: note:                 'struct data'
   24 | struct data{
      |        ^~~~
a.cc:52:10: error: request for member 'begin' in 't', which is of non-class type 'int'
   52 |   sort(t.begin(),t.end());
      |          ^~~~~
a.cc:52:20: error: request for member 'end' in 't', which is of non-class type 'int'
   52 |   sort(t.begin(),t.end());
      |                    ^~~
a.cc:61:24: error: request for member 'size' in 't', which is of non-class type 'int'
   61 |   for(int i=0;i<(int)t.size();i++){
      |                        ^~~~
a.cc:62:5: error: reference to 'data' is ambiguous
   62 |     data d=t[i];
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:24:8: note:                 'struct data'
   24 | struct data{
      |        ^~~~
a.cc:63:5: error: 'd' was not declared in this scope
   63 |     d.l=mapx[d.l],d.r=mapx[d.r];
      |     ^