Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
string s;
int k;
int INF=1000000000;
int dh[4]={0,1,0,-1};
int dw[4]={1,0,-1,0};

int main(){
    int n,m;
    cin>>n>>m;
    vector<int,int> p;
    p.resize(m);
    rep(i,0,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        p[i]=make_pair(b,a);
    }
    sort(p.begin(),p.end());
    int ans=0;
    int bri=0;
    rep(i,0,m){
        if(!(bri>p[i].second&&bri<=p[i].first)){
            ans++;
            bri=p[i].first;
        }
    }
    cout<<ans<<endl;
}

Compiler output:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<int, int>':
/usr/include/c++/14/bits/stl_vector.h:428:11:   required from 'class std::vector<int, int>'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:25:21:   required from here
   25 |     vector<int,int> p;
      |                     ^
/usr/include/c++/14/bits/stl_vector.h:87:28: error: 'int' is not a class, struct, or union type
   87 |         rebind<_Tp>::other _Tp_alloc_type;
      |                            ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:89:9: error: 'int' is not a class, struct, or union type
   89 |         pointer;
      |         ^~~~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<int, int>':
a.cc:25:21:   required from here
   25 |     vector<int,int> p;
      |                     ^
/usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<int, int>::_Base'
  518 |       using _Base::_M_allocate;
      |                    ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<int, int>::_Base'
  519 |       using _Base::_M_deallocate;
      |                    ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<int, int>::_Base'
  521 |       using _Base::_M_get_Tp_allocator;
      |                    ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/iostream:38,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = int]':
a.cc:25:21:   required from here
   25 |     vector<int,int> p;
      |                     ^
/usr/include/c++/14/bits/stl_vector.h:136:24: error: 'int' is not a class, struct, or union type
  136 |         _Vector_impl() _GLIBCXX_NOEXCEPT_IF(
      |                        ^~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:31:10: error: no match for 'operator[]' (operand types are 'std::vector<int, int>' and 'int')
   31 |         p[i]=make_pair(b,a);
      |          ^
a.cc:33:12: error: 'class std::vector<int, int>' has no member named 'begin'
   33 |     sort(p.begin(),p.end());
      |            ^~~~~
a.cc:33:22: error: 'class std::vector<int, int>' has no member named 'end'
   33 |     sort(p.begin(),p.end());
      |                      ^~~
a.cc:37:19: error: no match for 'operator[]' (operand types are 'std::vector<int, int>' and 'int')
   37 |         if(!(bri>p[i].second&&bri<=p[i].first)){
      |                   ^
a.cc:37:37: error: no match for 'operator[]' (operand types are 'std::vector<int, int>' and 'int')
   37 |         if(!(bri>p[i].second&&bri<=p[i].first)){
      |                                     ^
a.cc:39:18: error: no match for 'operator[]' (operand types are 'std::vector<int, int>' and 'int')
   39 |             bri=p[i].first;
      |                  ^
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = int]':
/usr/include/c++/14/bits/stl_vector.h:314:7:   required from here
  314 |       _Vector_base() = default;
      |       ^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:141:26: error: 'int' is not a class, struct, or union type
  141 |         : _Tp_alloc_type()
      |                          ^