Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n,m;
  cin>>n>>m;
  vector<int>h(n);
   vector<int>ans(n);
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  vector<vector<int>> b(m, vector<int>(2));
  for(int i=0;i<m;i++){
    cin>>b.at(i).at(0)>>b.at(i).at(1); 
  }
  for(int i=0;i<m;i++){
    if(h.at(b.at(i).at(0)) > h.at(b.at(i).at(1))){
     ans.erase(b.begin()+h.at(b.at(i).at(1)));
   }
  else{
     ans.erase(b.begin()+h.at(b.at(i).at(0)));
   }
  }
  cout<<ans.size()<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: no matching function for call to 'std::vector<int>::erase(__gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int> > >)'
   18 |      ans.erase(b.begin()+h.at(b.at(i).at(1)));
      |      ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from '__normal_iterator<std::vector<int>*,vector<std::vector<int>>>' to '__normal_iterator<const int*,vector<int>>'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided
a.cc:21:15: error: no matching function for call to 'std::vector<int>::erase(__gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int> > >)'
   21 |      ans.erase(b.begin()+h.at(b.at(i).at(0)));
      |      ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from '__normal_iterator<std::vector<int>*,vector<std::vector<int>>>' to '__normal_iterator<const int*,vector<int>>'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided