func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m;   int an[333333];   int bit[333333];   void upd(int x, int v) {     for (int i = x; i <= n; i += (i & -i)) {       bit[i] += v;     }   }   int get(int x) {     int an = 0;     for (int i = x; i > 0; i -= (i & -i)) an += bit[i];     return an;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; ++i) upd(i, 1);     while (m--) {       int from, to, win;       scanf( %d%d%d , &from, &to, &win);       int add = get(to);       int dec = get(from - 1);       while (add > dec) {         int ll = from, rr = to;         while (ll <= rr) {           int mid = (ll + rr) / 2;           if (get(mid) == dec)             ll = mid + 1;           else             rr = mid - 1;         }         an[ll] = win;         upd(ll, -1);         --add;       }       an[win] = 0;       upd(win, 1);     }     for (int i = 1; i <= n; ++i) printf( %d  , an[i]);     return 0;   }   