func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 4e5 + 10, INF = 1e9;   int l[N], r[N], ps[N];   map<int, int> mp;   int cnt, seg[4 * N], lazy[4 * N];   inline void shift(int id) {     seg[2 * id] += lazy[id];     lazy[2 * id] += lazy[id];     seg[2 * id + 1] += lazy[id];     lazy[2 * id + 1] += lazy[id];     lazy[id] = 0;     return;   }   void add(int id, int L, int R, int s = 0, int e = cnt) {     if (L <= s && e <= R) {       seg[id]++;       lazy[id]++;       return;     }     if (L >= e || s >= R) return;     int mid = (s + e) / 2;     shift(id);     add(2 * id, L, R, s, mid);     add(2 * id + 1, L, R, mid, e);     seg[id] = min(seg[2 * id], seg[2 * id + 1]);     return;   }   int get(int id, int L, int R, int s = 0, int e = cnt) {     if (L <= s && e <= R) return seg[id];     if (L >= e || s >= R) return INF;     int mid = (s + e) / 2;     shift(id);     return min(get(2 * id, L, R, s, mid), get(2 * id + 1, L, R, mid, e));   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> l[i] >> r[i];       r[i]++;       mp[l[i]] = mp[r[i]] = 0;     }     for (auto X : mp) mp[X.first] = cnt++;     for (int i = 0; i < n; i++) {       l[i] = mp[l[i]];       r[i] = mp[r[i]];     }     for (int i = 0; i < n; i++) add(1, l[i], r[i]);     for (int i = 0; i < n; i++) {       int mn = get(1, l[i], r[i]);       if (mn > 1) return cout << i + 1 << endl, 0;     }     return cout << -1 << endl, 0;   }   