func_code_string: #include <bits/stdc++.h>   using namespace std;   long long m;   int k;   vector<int> a;   long long memo[66][2][66];   long long dp(int id, int tight, int cnt) {     long long &res = memo[id][tight][cnt];     if (res == -1) {       res = 0;       if (id == a.size()) {         if (cnt == k) res = 1;       } else {         for (int i = 0; i < 2; i++) {           if (tight && i > a[id]) continue;           int new_tight = tight ? i == a[id] : false;           int new_cnt = cnt + (i == 1 ? 1 : 0);           res += dp(id + 1, new_tight, new_cnt);         }       }     }     return res;   }   long long solve(long long n) {     a.clear();     while (n) {       a.push_back(n % 2);       n /= 2;     }     a.push_back(0);     reverse(a.begin(), a.end());     memset(memo, -1, sizeof(memo));     return dp(0, 1, 0);   }   long long possible(long long n) { return solve(2 * n) - solve(n); }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cin >> m >> k;     long long lo = 1, hi = (long long)1e18 + 15;     long long ans = -1;     while (lo <= hi) {       long long mid = (lo + hi) / 2;       if (possible(mid) == m) {         ans = mid;         break;       }       if (possible(mid) < m) {         lo = mid + 1;       } else         hi = mid - 1;     }     assert(ans != -1);     cout << ans << endl;     return 0;   }   