func_code_string: #include <bits/stdc++.h>   using namespace std;   int k, b, n;   map<int, int>::iterator it;   int main() {     map<int, int> mp;     while (scanf( %d%d%d , &k, &b, &n) != EOF) {       mp.clear();       if (b == 0) {         int a, sum = 0;         long long res = 0;         mp[0] = 1;         for (int i = 1; i <= n; i++) {           scanf( %d , &a);           if (a) sum++;           if (mp.find(sum) == mp.end())             mp[sum] = 1;           else             mp[sum]++;         }         for (it = mp.begin(); it != mp.end(); it++) {           long long tmp = it->second;           res += tmp * (tmp - 1) / 2;         }         cout << res << endl;       } else {         int a, ss = 0;         long long res = 0, pre = 0;         mp[0] = 1;         for (int i = 1; i <= n; i++) {           scanf( %d , &a);           if (a) {             ss += a;             ss %= (k - 1);             int ff = (ss - b + k - 1) % (k - 1);             int st = mp.find(ff) == mp.end() ? 0 : mp[ff];             pre = st;             res += st;             if (mp.find(ss) == mp.end())               mp[ss] = 1;             else               mp[ss]++;           } else {             res += pre;             mp[ss]++;           }         }         cout << res << endl;       }     }   }   