func_code_string: #include <bits/stdc++.h>   using namespace std;   pair<int, int> a[1000001];   int b[1000001], ans[1000001];   int main() {     int n, h;     cin >> n >> h;     for (int i = 0; i < n; i++) {       int c;       cin >> c;       a[i] = make_pair(c, i + 1);     }     sort(a, a + n);     for (int i = 0; i < n; i++) b[i] = a[i].first;     int diff = b[n - 1] + b[n - 2] - b[0] - b[1];     int km = 0;     for (int k = 1; k < n; k++) {       int other;       int small = int(1e9);       if (k >= 2) {         other = b[1] + b[2];         if (other < small) small = other;       }       other = b[0] + b[1] + h;       if (other < small) small = other;       if (k < n - 1) {         other = b[0] + b[k + 1];         if (other < small) small = other;       }       int big = b[n - 1] + h;       if (k == n - 1)         big += b[0];       else         big += b[k];       other = b[n - 1] + b[n - 2];       if (other > big) big = other;       if (big - small < diff) {         diff = big - small;         km = k;       }     }     cout << diff << endl;     for (int i = 1; i <= n; i++) ans[i] = 1;     for (int i = 1; i <= km; i++) ans[a[i].second] = 2;     for (int i = 1; i <= n; i++) cout << ans[i] <<    ;     cout << endl;     return 0;   }   