func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 105;   const int inf = 10000000;   int n, k;   int l[N], r[N];   int main() {     scanf( %d%d , &n, &k);     int midx = (k + 1) / 2, midy = (k + 1) / 2;     for (int i = 0; i < n; i++) {       int m, ans = inf, x, y1, y2;       scanf( %d , &m);       for (int row = 1; row <= k; row++) {         if (l[row] == 0 && r[row] == 0) {           for (int a = 1; a + m - 1 <= k; a++) {             int tot = 0, b = a + m - 1;             for (int col = a; col <= b; col++) {               tot += abs(row - midx) + abs(col - midy);             }             if (tot < ans) ans = tot, x = row, y1 = a, y2 = b;           }         } else {           if (l[row] > m) {             int tot = 0, a = l[row] - m, b = l[row] - 1;             for (int col = a; col <= b; col++) {               tot += abs(row - midx) + abs(col - midy);             }             if (tot < ans) ans = tot, x = row, y1 = a, y2 = b;           }           if (r[row] + m <= k) {             int tot = 0, a = r[row] + 1, b = r[row] + m;             for (int col = a; col <= b; col++)               tot += abs(row - midx) + abs(col - midy);             if (tot < ans) ans = tot, x = row, y1 = a, y2 = b;           }         }       }       if (ans == inf)         puts( -1 );       else {         printf( %d %d %d n , x, y1, y2);         if (r[x] == 0 && l[x] == 0)           l[x] = y1, r[x] = y2;         else           l[x] = min(l[x], y1), r[x] = max(r[x], y2);       }     }     return 0;   }   