func_code_string: #include <bits/stdc++.h>   using namespace std;   const double eps = 1e-8;   const double pi = acos(-1.0);   const int inf = 2147483647;   int n, w;   int a[1005];   bool first;   int MIN;   void output(int x) {     if (first)       first = false;     else       printf(   );     if (x == MIN)       x = 0;     else if (x == 0)       x = MIN;     printf( %d , x + 1);   }   int main() {     scanf( %d%d , &n, &w);     int total = 0;     MIN = 0;     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);       total += a[i];       if (a[MIN] > a[i]) MIN = i;     }     first = true;     if (w >= a[MIN] && w <= total) {       printf( Yes n );       swap(a[0], a[MIN]);       output(0);       total = total - w;       for (int i = 1; i < n && total; i++) {         while (total && a[i]) {           total--;           a[i]--;           output(i);           output(i);         }       }       output(0);       a[0]--;       for (int i = 0; i < n; i++) {         while (a[i]) {           a[i]--;           output(i);           output(i);         }       }       printf(  n );     } else if (w > total || n == 1) {       printf( No n );     } else if (w <= 1) {       printf( No n );     } else {       printf( Yes n );       swap(a[0], a[MIN]);       output(0);       total = total - w;       for (int i = 1; i < n && total; i++) {         int limit = (i == 1 ? 1 : 0);         while (total && a[i] > limit) {           total--;           a[i]--;           output(i);           output(i);         }       }       output(0);       a[0]--;       output(1);       while (a[0] >= w - 1) {         output(0);         output(0);         a[0]--;       }       output(1);       while (a[0]) {         output(0);         output(0);         a[0]--;       }       printf(  n );     }     return 0;   }   