func_code_string: #include <bits/stdc++.h>   using namespace std;   int weight[11];   int total = 0;   int bd2 = 0;   int mem[11][5001];   int m;   bool wasal = false;   int arr[1001];   int knapsack(int i, int prev, int totalPrev, int me, int all, int counter) {     arr[counter - 1] = prev;     if (i == m) {       wasal = true;       bd2 = all;       return 0;     }     int choice2 = 0;     if (!wasal) {       for (int j = 0; j < total && !wasal; j++) {         if (weight[j] != prev && me + weight[j] > totalPrev && !wasal) {           if (totalPrev == -1) {             totalPrev = 0;           }           choice2 += knapsack(i + 1, weight[j], me + weight[j], totalPrev,                               me + weight[j] + totalPrev, counter + 1) +                      1;         }       }       return choice2;     }     return 0;   }   int main() {     string c;     cin >> c;     for (int i = 0; i < c.size(); i++) {       if (c.at(i) ==  1 ) {         weight[total] = i + 1;         total++;       }     }     memset(arr, false, sizeof(arr));     cin >> m;     int num = knapsack(0, 0, -1, 0, 0, 0);     if (wasal) {       cout <<  YES  << endl;       for (int i = 0; i < m; i++) {         if (i != 0) {           cout <<     << arr[i];         } else {           cout << arr[i];         }       }     } else {       cout <<  NO  << endl;     }     return 0;   }   