Language: C++

#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
using Data = pair<ll, vector<int>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge { ll from; ll to; ll cost; };
typedef tuple<ll, ll, ll>T;
typedef pair<ll,ll>pll;

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

	map<string, vector<int>>mp;
	map<pair<string,int>, int>mp1;
	rep(i, 0, n) {
		string temp;
		cin >> temp;
		int t;
		cin >> t;
		mp[temp].pb(t);
		mp1[{temp,t}] = i;
	}

	fore(x, mp) {
		vector<int>temp = x.second;
		sort(all(temp));
		reverse(all(temp));
		rep(i, 0, temp.size()) {
			cout << mp1[{x.first, temp[i]}] + 1 << endl;
		}
	}


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'cin' was not declared in this scope
   26 |         cin >> n;
      |         ^~~
a.cc:8:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    7 | #include <utility>
  +++ |+#include <iostream>
    8 | #define all(x) (x).begin(),(x).end()
a.cc:28:9: error: 'map' was not declared in this scope
   28 |         map<string, vector<int>>mp;
      |         ^~~
a.cc:8:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    7 | #include <utility>
  +++ |+#include <map>
    8 | #define all(x) (x).begin(),(x).end()
a.cc:28:13: error: 'string' was not declared in this scope
   28 |         map<string, vector<int>>mp;
      |             ^~~~~~
a.cc:8:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    7 | #include <utility>
  +++ |+#include <string>
    8 | #define all(x) (x).begin(),(x).end()
a.cc:28:31: error: expected primary-expression before '>' token
   28 |         map<string, vector<int>>mp;
      |                               ^~
a.cc:28:33: error: 'mp' was not declared in this scope
   28 |         map<string, vector<int>>mp;
      |                                 ^~
a.cc:29:31: error: expected primary-expression before 'int'
   29 |         map<pair<string,int>, int>mp1;
      |                               ^~~
a.cc:31:23: error: expected ';' before 'temp'
   31 |                 string temp;
      |                       ^~~~~
      |                       ;
a.cc:32:24: error: 'temp' was not declared in this scope
   32 |                 cin >> temp;
      |                        ^~~~
a.cc:36:17: error: 'mp1' was not declared in this scope
   36 |                 mp1[{temp,t}] = i;
      |                 ^~~
a.cc:41:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   41 |                 sort(all(temp));
      |                 ^~~~
      |                 short
a.cc:42:17: error: 'reverse' was not declared in this scope
   42 |                 reverse(all(temp));
      |                 ^~~~~~~
a.cc:44:25: error: 'cout' was not declared in this scope
   44 |                         cout << mp1[{x.first, temp[i]}] + 1 << endl;
      |                         ^~~~
a.cc:44:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:44:33: error: 'mp1' was not declared in this scope
   44 |                         cout << mp1[{x.first, temp[i]}] + 1 << endl;
      |                                 ^~~
a.cc:44:64: error: 'endl' was not declared in this scope
   44 |                         cout << mp1[{x.first, temp[i]}] + 1 << endl;
      |                                                                ^~~~
a.cc:8:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    7 | #include <utility>
  +++ |+#include <ostream>
    8 | #define all(x) (x).begin(),(x).end()