func_code_string: #include <bits/stdc++.h>   using namespace std;   const int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};   const int N = 1e6 + 10;   const int mod = 1e9 + 7;   const double pi = acos(-1);   const double eps = 1e-8;   const long long INF = 2e10;   template <class T>   void _print(T arg) {     cout << arg <<    ;   }   template <class... Args>   void log(Args... args) {     int arr[] = {(_print(args), 0)...};     cout << endl;   }   long long a[N], b[N];   int n, m, k;   int main() {     ios::sync_with_stdio(0);     cin >> n >> k;     for (int i = 0; i <= n; ++i) {       cin >> a[i];       b[i] = a[i];     }     for (int i = 0; i < n; ++i) {       a[i + 1] += a[i] / 2;       a[i] %= 2;     }     int pos;     for (int i = 0; i <= n; ++i) {       if (a[i]) {         pos = i;         break;       }     }     int res = 0;     long long tmp = 0;     for (int i = n; i >= 0; --i) {       tmp = tmp * 2 + a[i];       if (abs(tmp) > INF) break;       if (i <= pos) {         long long x = abs(tmp - b[i]);         if (i == n & x == 0) continue;         res += (x <= k);       }     }     cout << res << endl;     return 0;   }   