func_code_string: #include <bits/stdc++.h>   using namespace std;   const double PI = atan(1.0) * 4.0;   int in_c() {     int c;     while ((c = getchar()) <=    ) {       if (!~c) throw ~0;     }     return c;   }   int in() {     int x = 0, c;     while ((unsigned int)((c = getchar()) -  0 ) >= 10) {       if (c ==  - ) return -in();       if (!~c) return ~0;     }     do {       x = 10 * x + (c -  0 );     } while ((unsigned int)((c = getchar()) -  0 ) < 10);     return x;   }   template <class T>   struct fenwick_tree {     vector<T> x;     fenwick_tree(int n) : x(n, 0) {}     T sum(int i, int j) const {       if (i == 0) {         T S = 0;         for (; j >= 0; j = (j & (j + 1)) - 1) S += x[j];         return S;       } else         return sum(0, j) - sum(0, i - 1);     }     void add(int k, T a) {       for (; k < (int)x.size(); k |= k + 1) x[k] += a;     }     void set(int k, T a) {       T now = at(k);       add(k, a - now);     }     T at(int i) const { return sum(i, i); }   };   int main() {     int N, K;     while (N = in(), N != EOF) {       K = in();       int center = K / 2;       const int INF = 1 << 28;       vector<fenwick_tree<int> > bit(K, fenwick_tree<int>(K));       for (int i = (0), ___e = (N); i < ___e; ++i) {         int M = in();         int ax = -1, l;         int min_score = INF;         for (int r = (0), ___e = (K); r < ___e; ++r)           for (int c = (0), ___e = (K - M + 1); c < ___e; ++c) {             if (bit[r].sum(c, c + M - 1) == 0) {               int s = 0;               for (int j = c; j < c + M; ++j) {                 s += abs(r - center) + abs(j - center);               }               if (s < min_score) {                 min_score = s;                 ax = r, l = c;               } else if (s == min_score) {                 if (ax > r || ax == r && l > c) {                   min_score = s;                   ax = r, l = c;                 }               }             }           }         if (ax == -1) {           cout << -1 << endl;         } else {           for (int j = l; j < l + M; ++j) bit[ax].add(j, 1);           cout << ax + 1 <<     << l + 1 <<     << l + M << endl;         }       }     }     return 0;   }   