func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, m;   long long a[100];   long long ans = 1e18;   long long po[100];   map<long long, long long> ma;   long long fun(long long left1) {     long long ans1 = 1e18;     if (left1 <= 0) {       return 0;     }     for (long long i = 0; i < n; i++) {       long long left = left1;       long long temp = 0;       if (po[i] >= left)         left = 0, temp = a[i];       else if (left % po[i] == 0) {         temp = left / po[i];         temp *= a[i];         left = 0;       } else {         temp = left / po[i];         temp *= a[i];         left = left % po[i];       }       if (ma[left] != 0)         ans1 = min(ans1, temp + ma[left]);       else {         ma[left] = fun(left);         ans1 = min(ans1, temp + ma[left]);       }     }     return ans1;   }   int main() {     cin >> n >> m;     for (long long i = 0; i < n; i++) cin >> a[i];     po[0] = 1;     for (long long i = 1; i <= 30; i++) {       po[i] = po[i - 1] * 2;     }     for (long long i = 0; i < n; i++) {       long long left = m;       long long temp;       if (po[i] >= left)         left = 0, temp = a[i];       else if (left % po[i] == 0) {         temp = left / po[i];         temp *= a[i];         left = 0;       } else {         temp = left / po[i];         temp *= a[i];         left = left % po[i];       }       ans = min(ans, temp + fun(left));     }     cout << ans;     return 0;   }   