Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define second sc;
#define first fst;
int main()	{
  int n;
  cin>>n;
  vector<int>p(n);
  vector<string>s(n);
  rep(i,n) {
    cin>>s[i]>>p[i];
    p[i]--;
  }
  vector<pair<string,int>>mp;
  rep(i,n){
    mp.push_back(make_pair(s[i],p[i]));
  }
  sort(all(mp));
  rep(i,n-1){
    if(mp[i].fst==mp[i+1].fst && mp[i].sc<mp[i+1].sc){
      int tmp=mp[i].sc;
      mp[i].sc=mp[i+1].sc;
      mp[i+1].sc=tmp;
    }
  rep(i,n){
    cout<<mp[i].sc+1<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'fst'; did you mean 'first'?
   32 |     if(mp[i].fst==mp[i+1].fst && mp[i].sc<mp[i+1].sc){
      |              ^~~
      |              first
a.cc:32:27: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'fst'; did you mean 'first'?
   32 |     if(mp[i].fst==mp[i+1].fst && mp[i].sc<mp[i+1].sc){
      |                           ^~~
      |                           first
a.cc:32:40: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'sc'
   32 |     if(mp[i].fst==mp[i+1].fst && mp[i].sc<mp[i+1].sc){
      |                                        ^~
a.cc:32:51: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'sc'
   32 |     if(mp[i].fst==mp[i+1].fst && mp[i].sc<mp[i+1].sc){
      |                                                   ^~
a.cc:33:21: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'sc'
   33 |       int tmp=mp[i].sc;
      |                     ^~
a.cc:34:13: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'sc'
   34 |       mp[i].sc=mp[i+1].sc;
      |             ^~
a.cc:34:24: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'sc'
   34 |       mp[i].sc=mp[i+1].sc;
      |                        ^~
a.cc:35:15: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'sc'
   35 |       mp[i+1].sc=tmp;
      |               ^~
a.cc:38:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'sc'
   38 |     cout<<mp[i].sc+1<<endl;
      |                 ^~
a.cc:40:2: error: expected '}' at end of input
   40 | }
      |  ^
a.cc:17:17: note: to match this '{'
   17 | int main()      {
      |                 ^