func_code_string: #include <bits/stdc++.h>   using namespace std;   FILE* in = stdin;   FILE* out = stdout;   const int MAX = 100001;   int n, k;   int a[MAX];   int color[256];   void solve() {     memset(color, -1, sizeof(color));     color[0] = 0;     for (int i = 0; i < n; i++) {       if (color[a[i]] != -1) continue;       int left = -1;       for (int c = 0;; c++) {         if (color[a[i] - c] != -1) {           left = a[i] - c;           break;         }       }       if (color[left] + k - 1 >= a[i]) {         for (int c = left + 1; c <= a[i]; c++) color[c] = color[left];         continue;       }       int at = a[i];       if (at - k + 1 > left) {         for (int c = at - k + 1; c <= at; c++) color[c] = at - k + 1;         continue;       }       for (int c = left + 1; c <= a[i]; c++) color[c] = left + 1;     }     for (int i = 0; i < n; i++)       fprintf(out,  %d%c , color[a[i]], i + 1 == n ?   n  :    );   }   int main(void) {     fscanf(in,  %d %d , &n, &k);     for (int i = 0; i < n; i++) fscanf(in,  %d , &a[i]);     solve();     return 0;   }   