Language: C++

#include<cstdio>
#include<vector>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=1e6+6;
const int MOD=998244353;
const double EPS=1e-12;
template <class T>
bool sf(T &ret){ //Faster Input
    char c; int sgn; T bit=0.1;
    if(c=getchar(),c==EOF) return 0;
    while(c!='-'&&c!='.'&&(c<'0'||c>'9')) c=getchar();
    sgn=(c=='-')?-1:1;
    ret=(c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
    if(c==' '||c=='\n'){ ret*=sgn; return 1; }
    while(c=getchar(),c>='0'&&c<='9') ret+=(c-'0')*bit,bit/=10;
    ret*=sgn;
    return 1;
}
struct node{
    int l,r;
};
set<int> vec[600];
int main(void){

    int n,m,q;
//    sf(n);sf(m);sf(q);
    cin >>n>>m>>q;
    for(int i=1;i<=m;i++){
        int l,r;
//        sf(l);sf(r);
        cin >>l>>r;
        vec[l].insert(r);
    }
//    for(int i=1;i<=n;i++){
//        if(!(int)vec[i].size()) continue;
//        sort(vec[i].begin(),vec[i].end());
//    }
    while(q--){
        int l,r;
        sf(l);sf(r);
        int ans=0;
        for(int i=l;i<=r;i++){
            ans=vec[i].upper_bound(vec[i].begin(),vec[i].end(),r)-vec[i].lower_bound(vec[i].begin(),vec[i].end(),l);
        }
//        printf("%d\n",ans);
        cout << ans << endl;
    }


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:35: error: no matching function for call to 'std::set<int>::upper_bound(std::set<int>::iterator, std::set<int>::iterator, int&)'
   58 |             ans=vec[i].upper_bound(vec[i].begin(),vec[i].end(),r)-vec[i].lower_bound(vec[i].begin(),vec[i].end(),l);
      |                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/set:63,
                 from a.cc:9:
/usr/include/c++/14/bits/stl_set.h:871:9: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_upper_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::upper_bound(const _Kt&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  871 |         upper_bound(const _Kt& __x)
      |         ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:871:9: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/stl_set.h:877:9: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_upper_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::upper_bound(const _Kt&) const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  877 |         upper_bound(const _Kt& __x) const
      |         ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:877:9: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/stl_set.h:861:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::upper_bound(const key_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; key_type = int]'
  861 |       upper_bound(const key_type& __x)
      |       ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:861:7: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/stl_set.h:865:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::upper_bound(const key_type&) const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; key_type = int]'
  865 |       upper_bound(const key_type& __x) const
      |       ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:865:7: note:   candidate expects 1 argument, 3 provided
a.cc:58:85: error: no matching function for call to 'std::set<int>::lower_bound(std::set<int>::iterator, std::set<int>::iterator, int&)'
   58 |             ans=vec[i].upper_bound(vec[i].begin(),vec[i].end(),r)-vec[i].lower_bound(vec[i].begin(),vec[i].end(),l);
      |                                                                   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:841:9: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_lower_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::lower_bound(const _Kt&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  841 |         lower_bound(const _Kt& __x)
      |         ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:841:9: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/stl_set.h:847:9: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::const_iterator)(((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_lower_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::lower_bound(const _Kt&) const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  847 |         lower_bound(const _Kt& __x) const
      |         ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:847:9: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/stl_set.h:831:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::lower_bound(const key_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; key_type = int]'
  831 |       lower_bound(const key_type& __x)
      |       ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:831:7: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/stl_set.h:835:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::lower_bound(const key_type&) const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; key_type = int]'
  835 |       lower_bound(const key_type& __x) const
      |       ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:835:7: note:   candidate expects 1 argument, 3 provided