#include <bits/stdc++.h>   #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math )   #pragma GCC target(         sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native )   using namespace std;   namespace _c {   const double pi = acos(-1.0);   namespace min {   const int i8 = -128;   const int i16 = -32768;   const int i = -2147483647 - 1;   const long long l = -9223372036854775807LL - 1;   }  // namespace min   namespace max {   const int i8 = 127;   const int i16 = 32767;   const int i = 2147483647;   const long long l = 9223372036854775807LL;   }  // namespace max   }  // namespace _c   namespace _f {   template <typename T>   inline const T gcd(T m, T n) {     while (n != 0) {       T t = m % n;       m = n;       n = t;     }     return m;   }   template <typename T>   inline const T max(const T &a, const T &b) {     return a > b ? a : b;   }   template <typename T>   inline const T min(const T &a, const T &b) {     return a < b ? a : b;   }   template <typename T>   inline const T abs(const T &a) {     return a > 0 ? a : -a;   }   template <typename T>   inline T pow(T a, T b) {     T res = 1;     while (b > 0) {       if (b & 1) {         res = res * a;       }       a = a * a;       b >>= 1;     }     return res;   }   template <typename T>   inline T pow(T a, T b, const T &m) {     a %= m;     T res = 1;     while (b > 0) {       if (b & 1) {         res = res * a % m;       }       a = a * a % m;       b >>= 1;     }     return res % m;   }   }  // namespace _f   namespace io {   template <typename T>   inline void read(T &t) {     register T res = 0, neg = 1;     char g = getchar();     for (; !isdigit(g); g = getchar()) {       if (g ==  - ) {         neg = -1;       }     }     for (; isdigit(g); g = getchar()) {       res = res * 10 + g -  0 ;     }     t = res * neg;   }   inline int in() {     register int T;     read(T);     return T;   }   inline long long in_ll() {     register long long T;     read(T);     return T;   }   }  // namespace io   int Ans, T(2), x[11000], y[11000], z[11000], r[11000], f[11000], F[11000],       s[1100000], b[11000], n, m, t[11000], c[11000], K, q[11000], Q[11000];   void In(int a, int b, int c, int d) {     x[T] = f[a];     y[T] = b;     z[T] = c;     r[T] = d;     f[a] = T++;     x[T] = f[b];     y[T] = a;     z[T] = 0;     r[T] = -d;     f[b] = T++;   }   int main() {     int i, j, k;     scanf( %d%d , &n, &K);     for (i = 0; i < n; i++) {       scanf( %d%d%d , s + i, t + i, c + i);       t[i] += s[i];       q[m++] = s[i];       q[m++] = t[i];     }     q[m++] = -1;     std::sort(q, q + m);     for (i = j = 1; i < m; i++)       if (q[i] != q[j - 1]) q[j++] = q[i];     m = j;     for (i = 0; i + 1 < m; i++) In(i, i + 1, K, 0);     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++)         if (q[j] == s[i]) break;       s[i] = j;       for (j = 0; j < m; j++)         if (q[j] == t[i]) break;       t[i] = j;       Q[i] = T;       In(s[i], t[i], 1, -c[i]);     }     s[0] = 0;     for (;;) {       memset(b, 127, sizeof(b));       b[0] = 0;       for (i = 0, j = 1; i < j; i++)         for (k = f[s[i]]; k; k = x[k])           if (z[k] && b[s[i]] + r[k] < b[y[k]]) {             b[y[k]] = b[s[i]] + r[k];             F[y[k]] = k;             s[j++] = y[k];           }       if (b[m - 1] == 2139062143) break;       j = 2139062143;       for (i = m - 1; i; i = y[F[i] ^ 1])         if (j > z[F[i]]) j = z[F[i]];       for (i = m - 1; i; i = y[F[i] ^ 1]) {         Ans += j * r[F[i]];         z[F[i]] -= j;         z[F[i] ^ 1] += j;       }     }     for (i = 0; i < n; i++)       if (z[Q[i]])         printf( 0  );       else         printf( 1  );     printf(  n );     return 0;   }