func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long x, d;     while (~scanf( %lld%lld , &x, &d)) {       vector<pair<long long, int> > counts;       long long sum = 0;       long long num = 1;       while (x > 0) {         long long two = 1;         int count = 0;         while (two - 1 <= x) two *= 2, count++;         two /= 2, count--;         sum += count;         counts.emplace_back(num, count);         x -= two - 1;         num += d;       }       printf( %lld n , sum);       for (int i = 0; i < counts.size(); i++)         for (int j = 0; j < counts[i].second; j++)           printf( %lld  , counts[i].first);       printf(  n );     }     return 0;   }   