func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( O3 )   #pragma comment(linker,  /stack:200000000 )   #pragma GCC optimize( Ofast )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long int n, p;     cin >> n >> p;     if (p == 0) {       cout << __builtin_popcount(n);       return 0;     }     if (p > 0) {       long long int a = n;       long long int cnt = 0;       while (a > 0) {         long long int temp = __builtin_popcount(a);         long long int c = 0, k = 0;         while (a) {           if (a & 1) {             k += (c + 1);           }           a = a / 2;           c++;         }         if (temp <= cnt) {           if (k >= cnt) {             cout << cnt;             return 0;           }         }         cnt++;         a = n - cnt * p;       }     } else {       long long int a = n;       long long int cnt = 0;       while (cnt < 1000) {         long long int temp = __builtin_popcount(a);         long long int c = 0, k = 0;         while (a) {           if (a & 1) {             k += (c + 1);           }           a = a / 2;           c++;         }         if (temp <= cnt) {           if (k >= cnt) {             cout << cnt;             return 0;           }         }         cnt++;         a = n - cnt * p;       }     }     cout << -1;     return 0;   }   