func_code_string: #include <bits/stdc++.h>   using namespace std;   struct event {     int x[3], id;     event() { x[0] = x[1] = x[2] = id = 0; }     event(int xx, int yy, int zz, int idd) {       x[0] = xx;       x[1] = yy;       x[2] = zz;       id = idd;     }   };   int vc = 0;   bool operator<(const event &a, const event &b) {     if (a.x[vc] == b.x[vc]) return a.id < b.id;     return a.x[vc] < b.x[vc];   }   int ans[100005], ans_id[100005];   event G[3][200005];   void cdq(int L, int R, int now) {     if (L >= R) return;     vc = now;     if (now == 2) {       int last = -1, last_id = -1;       for (int i = L; i <= R; ++i) {         if (G[now][i].id > 0) {           if (last_id != -1) {             int &tmp = ans[G[now][i].id];             if (tmp == -1 || tmp < last) {               tmp = last;               ans_id[G[now][i].id] = last_id;             }           }         } else {           last = G[now][i].x[2];           last_id = -G[now][i].id;         }       }       return;     }     int mid = (L + R) / 2, cnt = 0;     cdq(L, mid, now);     for (int i = L; i <= mid; ++i)       if (G[now][i].id < 0) G[now + 1][++cnt] = G[now][i];     for (int i = mid + 1; i <= R; ++i)       if (G[now][i].id > 0) G[now + 1][++cnt] = G[now][i];     vc = now + 1;     sort(G[now + 1] + 1, G[now + 1] + cnt + 1);     cdq(1, cnt, now + 1);     cdq(mid + 1, R, now);   }   int main() {     int n, m, i, j, k, l, cnt = 0;     scanf( %d%d , &n, &m);     for (i = 1; i <= n; ++i) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       G[0][++cnt] = event(x, -y, -z, -i);     }     for (i = 1; i <= m; ++i) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       G[0][++cnt] = event(x, -y, -z, i);     }     memset(ans, -1, sizeof(ans));     memset(ans_id, -1, sizeof(ans));     vc = 0;     sort(G[0] + 1, G[0] + 1 + cnt);     cdq(1, cnt, 0);     for (i = 1; i <= m; ++i) printf( %d%c , ans_id[i],    n [i == m]);   }   