Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0 ;i<n ;n++)

int main() {
	int N;
	cin >> N;

	vector<pair<string, int>> data(N);

	rep(i, N) {
		string s;
		int p;
		cin >> s >> p;
		data.at(i) = make_pair(s, p);
	}

	sort(data.begin(), data.end());
  
  vector<int> count(N);
  
  rep(i,N){
    if(data.at(i).first == data.at(i+1).first){
      count[i] = 1;
    }
  }
  
  for(int i=0; i<N; i++){
    if(count[i] == 1){
      for(int j=i+1; j<N; j++){
        if(count[j] == 0){
          reverse(data.begin(i), data.end(j));
        }
         break;
      }
    }
    i = j;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:29: error: no matching function for call to 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::begin(int&)'
   32 |           reverse(data.begin(i), data.end(j));
      |                   ~~~~~~~~~~^~~
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:873:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = std::pair<std::__cxx11::basic_string<char>, int>; _Alloc = std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >; iterator = std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::iterator]'
  873 |       begin() _GLIBCXX_NOEXCEPT
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:873:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:883:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::begin() const [with _Tp = std::pair<std::__cxx11::basic_string<char>, int>; _Alloc = std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >; const_iterator = std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::const_iterator]'
  883 |       begin() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:883:7: note:   candidate expects 0 arguments, 1 provided
a.cc:32:42: error: no matching function for call to 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::end(int&)'
   32 |           reverse(data.begin(i), data.end(j));
      |                                  ~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:893:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::end() [with _Tp = std::pair<std::__cxx11::basic_string<char>, int>; _Alloc = std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >; iterator = std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::iterator]'
  893 |       end() _GLIBCXX_NOEXCEPT
      |       ^~~
/usr/include/c++/14/bits/stl_vector.h:893:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:903:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::end() const [with _Tp = std::pair<std::__cxx11::basic_string<char>, int>; _Alloc = std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >; const_iterator = std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::const_iterator]'
  903 |       end() const _GLIBCXX_NOEXCEPT
      |       ^~~
/usr/include/c++/14/bits/stl_vector.h:903:7: note:   candidate expects 0 arguments, 1 provided
a.cc:37:9: error: 'j' was not declared in this scope
   37 |     i = j;
      |         ^