Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

struct guide{
    string city;
    int point;
    
    guide(string s, int p){
        city = s;
        point = p;
    }
    bool operator<(const guide &another) const
    {
        return city==another.city ? point<another.point : city>another.city;
    };
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<pair<string,int>> v;
    REP(i,n){
        string s;
        int p;
        cin>>s>>p;
        v.push_back({s,p});
    }
    vector<int> idx(v.size());
    iota(idx.begin(),idx.end(),0);
    sort(idx.begin(),idx.end(),
         [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
         );

    for(auto i:idx){
        cout<<i+1<<endl;
    }
}


Compiler output:
a.cc: In lambda function:
a.cc:56:34: error: 'v' is not captured
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |                                  ^
a.cc:56:11: note: the lambda has no capture-default
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |           ^
a.cc:46:30: note: 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> > v' declared here
   46 |     vector<pair<string,int>> v;
      |                              ^
a.cc:56:48: error: 'v' is not captured
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |                                                ^
a.cc:56:11: note: the lambda has no capture-default
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |           ^
a.cc:46:30: note: 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> > v' declared here
   46 |     vector<pair<string,int>> v;
      |                              ^
a.cc:56:61: error: 'v' is not captured
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |                                                             ^
a.cc:56:11: note: the lambda has no capture-default
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |           ^
a.cc:46:30: note: 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> > v' declared here
   46 |     vector<pair<string,int>> v;
      |                              ^
a.cc:56:75: error: 'v' is not captured
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |                                                                           ^
a.cc:56:11: note: the lambda has no capture-default
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |           ^
a.cc:46:30: note: 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> > v' declared here
   46 |     vector<pair<string,int>> v;
      |                              ^
a.cc:56:89: error: 'v' is not captured
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |                                                                                         ^
a.cc:56:11: note: the lambda has no capture-default
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |           ^
a.cc:46:30: note: 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> > v' declared here
   46 |     vector<pair<string,int>> v;
      |                              ^
a.cc:56:102: error: 'v' is not captured
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |                                                                                                      ^
a.cc:56:11: note: the lambda has no capture-default
   56 |          [](int x, int y){return v[x].first == v[y].first ? v[x].second > v[y].second : v[x].first < v[y].first ;}
      |           ^
a.cc:46:30: note: 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> > v' declared here
   46 |     vector<pair<string,int>> v;
      |                              ^