func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long int mod = 1e9 + 7;   const long long int lim = 1e17;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int T = clock();     long long int n, k;     cin >> n >> k;     map<long long int, long long int> mpp;     vector<long long int> a(n);     for (long long int i = 0; i < n; i++) cin >> a[i];     long long int tot = 0;     mpp[0] = 1;     long long int ans = 0;     for (long long int i = 0; i < n; i++) {       tot += a[i];       long long int r = 1;       if (k == -1) {         ans += mpp[tot - 1];         ans += mpp[tot + 1];       } else if (k == 1)         ans += mpp[tot - 1];       else {         while (r < lim) {           if (mpp.find(tot - r) != mpp.end()) ans += mpp[tot - r];           r *= k;         }       }       mpp[tot]++;     }     cout << ans;     cerr <<   n nTIME:   << (double)(clock() - T) / CLOCKS_PER_SEC <<   sec n ;     T = clock();     return 0;   }   