Language: C++

#include<bits/stdc++.h>
#include<queue>
#include<utility>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  vector<pair<int, int>>H(N);
  vector<queue<int>>roa(N);
  vector<int>H_(N);
  vector<int>si(N, 0);
  vector<int>good(N, -1);
  int ans = 0;
  for (int i = 0; i < N; i ++) {
    cin >> H_[i];
    H[i] = make_pair(H_[i], i);
  }
  for (int i = 0; i < M; i ++) {
    int a, b;
    cin >> a >> b;
    a --;
    b --;
    roa[a].push(b);
    roa[b].push(a);
    si[a] ++;
    si[b] ++;
  }
  sort(H.begin(), H.end());
  reverse(H,begin(), H.end());
  for (int i = 0; i < N; i ++) {
    int i_ = H[i].second;
    if (good[i_] != -1) continue;
    for (int j = 0; j < si[i]; j ++) {
      int u = roa[i_].front();
      roa[i_].pop();
      roa[i_].push(u);
      if (H_[i_] < H_[u]) good[i_] = 0;
      if (H_[i_] > H_[u]) good[u] = 0;
      if (H_[i_] == H_[u]) good[i_] = good[u] = 0;
    }
    if (good[i_] == -1) good[i_] = 1;
  }
  for (int i = 0; i < N; i ++) ans += good[i];
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:18: error: no matching function for call to 'begin()'
   29 |   reverse(H,begin(), H.end());
      |             ~~~~~^~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
                 from /usr/include/c++/14/bits/stl_algo.h:59,
                 from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/initializer_list:88:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)'
   88 |     begin(initializer_list<_Tp> __ils) noexcept
      |     ^~~~~
/usr/include/c++/14/initializer_list:88:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/range_access.h:52:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)'
   52 |     begin(_Container& __cont) -> decltype(__cont.begin())
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:52:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:63:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)'
   63 |     begin(const _Container& __cont) -> decltype(__cont.begin())
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:63:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:95:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])'
   95 |     begin(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:95:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1227:5: note: candidate: 'template<class _Tp> _Tp* std::begin(valarray<_Tp>&)'
 1227 |     begin(valarray<_Tp>& __va) noexcept
      |     ^~~~~
/usr/include/c++/14/valarray:1227:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/valarray:1238:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const valarray<_Tp>&)'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
/usr/include/c++/14/valarray:1238:5: note:   candidate expects 1 argument, 0 provided