func_code_string: #include <bits/stdc++.h>   const int MXN = 100010;   bool alive[MXN * 5];   int L[MXN], R[MXN], T[MXN];   struct heap_t {     int idx;     heap_t(int nidx) : idx(nidx) {}     bool operator<(const heap_t& cmp) const { return T[idx] > T[cmp.idx]; }   };   struct ele_t {     int idx, val;     bool operator<(const ele_t& cmp) const { return val < cmp.val; }   } ele[MXN * 2], ele2[MXN * 5];   int ans[MXN];   int main() {     int n, m;     scanf( %d %d , &m, &n);     for (int i = 1; i <= n; i++) {       scanf( %d %d %d , &L[i], &R[i], &T[i]);       ele[i].idx = i, ele[i].val = L[i];       ele[i + n].idx = i, ele[i + n].val = R[i];     }     int cele2 = m;     for (int i = 1; i <= m; i++) {       ele2[i].idx = i;       scanf( %d , &ele2[i].val);     }     int lstPos = -1;     std::priority_queue<heap_t> heap;     std::sort(ele + 1, ele + n * 2 + 1);     for (int i = 1; i <= n * 2; i++) {       while (!heap.empty() && !alive[heap.top().idx]) heap.pop();       if (!heap.empty()) {         ++cele2;         ele2[cele2].idx = cele2;         ele2[cele2 + 1].idx = cele2;         ele2[cele2].val = T[heap.top().idx] - lstPos;         ele2[cele2 + 1].val = T[heap.top().idx] - ele[i].val;         ++cele2;       }       lstPos = ele[i].val;       alive[ele[i].idx] = !alive[ele[i].idx];       if (alive[ele[i].idx]) heap.push(ele[i].idx);     }     int sum = 0, cnt = 0;     std::sort(ele2 + 1, ele2 + cele2 + 1);     for (int i = 1; i <= cele2; i++) {       sum += cnt * (ele2[i].val - lstPos);       lstPos = ele2[i].val;       if (ele2[i].idx <= m)         ans[ele2[i].idx] = sum;       else {         alive[ele2[i].idx] = !alive[ele2[i].idx];         cnt += (alive[ele2[i].idx]) ? 1 : -1;       }     }     for (int i = 1; i <= m; i++) printf( %d%c , ans[i], i == m ?   n  :    );   }   