func_code_string: #include <bits/stdc++.h>   using namespace std;   long long a[101000];   long long pre[101000];   map<long long, long long> Hash;   int main() {     int n, k;     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]);     for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] + a[i];     Hash[0] = 1;     long long count = 0;     for (int i = 1; i <= n; i++) {       if (abs(k) > 1) {         for (long long p = 1; (p > 0 ? p : -p) <= 1e15; p *= k) {           if (Hash[pre[i] - p]) count += Hash[pre[i] - p];         }       } else {         if (k == 1 || k == -1) {           if (Hash[pre[i] - 1]) count += Hash[pre[i] - 1];           if (k == -1) {             if (Hash[pre[i] + 1]) count += Hash[pre[i] + 1];           }         } else {           if (Hash[pre[i]]) count += Hash[pre[i]];         }       }       Hash[pre[i]] += 1;     }     cout << count << endl;     return 0;   }   