Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int l[100000+5],r[100000+5],n,m,q,ret[100000+5],size,p,num1[100000+5],num[100000];
int l1[100000+5],r1[100000+5],vec[600000+5],c[100000+5];
void Add( int x)  //树状数组加入
{
    for(;x<=size;x+=(x&-x))
        c[x]++;  //因为这里只需要1，所以我就写出c[x]++了
}
int Sum( int x)  //树状数组求和，同上面的sum(x)
{
     int s=0;  //计数的变量
    for(;x>0;x-=(x&-x))  //累计
        s+=c[x];
    return s;  //返回结果
}
bool cmp1(int a,int b){
	return r1[a]<r1[b];
}
bool cmp(int a,int b){
	return r[a]<r[b];
}
int main()
{
    cin>>n>>m>>q;
    for(int i=1;i<=m;i++){
    	cin>>l[i]>>r[i];
    	vec[p++]=l[i];
    	vec[p++]=r[i];
    	num[i]=i;
	}
	for(int i=1;i<=q;i++){
		cin>>l1[i]>>r1[i];
		vec[p++]=l1[i];
		vec[p++]=r1[i];
		num1[i]=i;
	}
	sort(vec,vec+p);
	size=unique(vec,vec+p)-vec;
	for(int i=1;i<=m;i++){
		l[i]=lower_bound(vec,vec+size,l[i])-vec+1;
		r[i]=lower_bound(vec,vec+size,r[i])-vec+1;
	}
	for(int i=1;i<=q;i++){
		l1[i]=lower_bound(vec,vec+size,l1[i])-vec+1;
		r1[i]=lower_bound(vec,vec+size,r1[i])-vec+1;
	}
	sort(num1+1,num1+q+1,cmp1);
	sort(num+1,num+m+1,cmp);
	
	int j=1;
	for(int k=1;k<=q;k++){
		int i=num1[k];
		while(j<=m&&r[j]<=r1[i]){
		Add(l[num[j++]]);	
			
		} 
		ret[i]=j-Sum(l1[i]-1)-1;
	
	}
	for(int i=1;i<=q;i++){
		cout<<ret[i]<<endl;
	}
}

Compiler output:
a.cc: In function 'void Add(int)':
a.cc:9:13: error: reference to 'size' is ambiguous
    9 |     for(;x<=size;x+=(x&-x))
      |             ^~~~
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:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:49: note:                 'int size'
    5 | int l[100000+5],r[100000+5],n,m,q,ret[100000+5],size,p,num1[100000+5],num[100000];
      |                                                 ^~~~
a.cc: In function 'int main()':
a.cc:41:9: error: reference to 'size' is ambiguous
   41 |         size=unique(vec,vec+p)-vec;
      |         ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:49: note:                 'int size'
    5 | int l[100000+5],r[100000+5],n,m,q,ret[100000+5],size,p,num1[100000+5],num[100000];
      |                                                 ^~~~
a.cc:43:42: error: reference to 'size' is ambiguous
   43 |                 l[i]=lower_bound(vec,vec+size,l[i])-vec+1;
      |                                          ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:49: note:                 'int size'
    5 | int l[100000+5],r[100000+5],n,m,q,ret[100000+5],size,p,num1[100000+5],num[100000];
      |                                                 ^~~~
a.cc:44:42: error: reference to 'size' is ambiguous
   44 |                 r[i]=lower_bound(vec,vec+size,r[i])-vec+1;
      |                                          ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:49: note:                 'int size'
    5 | int l[100000+5],r[100000+5],n,m,q,ret[100000+5],size,p,num1[100000+5],num[100000];
      |                                                 ^~~~
a.cc:47:43: error: reference to 'size' is ambiguous
   47 |                 l1[i]=lower_bound(vec,vec+size,l1[i])-vec+1;
      |                                           ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:49: note:                 'int size'
    5 | int l[100000+5],r[100000+5],n,m,q,ret[100000+5],size,p,num1[100000+5],num[100000];
      |                                                 ^~~~
a.cc:48:43: error: reference to 'size' is ambiguous
   48 |                 r1[i]=lower_bound(vec,vec+size,r1[i])-vec+1;
      |                                           ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:49: note:                 'int size'
    5 | int l[100000+5],r[100000+5],n,m,q,ret[100000+5],size,p,num1[100000+5],num[100000];
      |                                                 ^~~~