func_code_string: #include <bits/stdc++.h>   using namespace std;   int32_t main() {     long long int t = 1;     while (t--) {       long long int k, b, n;       cin >> k >> b >> n;       long long int s = 0;       long long int a[n];       map<long long int, vector<long long int> > mp;       mp[0].push_back(-1);       for (long long int i = 0; i < n; i++) {         cin >> a[i];         s = s + a[i];         s = s % (k - 1);         mp[s].push_back(i);       }       long long int an = 0;       if (b == k - 1 || b == 0) {         map<long long int, long long int> mp;         mp[0]++;         long long int an = 0, z = 0, ts = 0;         for (long long int i = 0; i < n; i++) {           ts = (ts + a[i]) % (k - 1);           if (a[i] == 0)             z++;           else             z = 0;           long long int tmp = (ts + (k - 1) - b) % (k - 1);           if (b == 0)             an += z;           else             an = an + mp[tmp] - z;           mp[ts]++;         }         cout << an;       } else {         for (auto x : mp) {           long long int y = x.first;           y = (y + b) % (k - 1);           for (long long int i = 0; i < x.second.size(); i++) {             long long int l =                 lower_bound(mp[y].begin(), mp[y].end(), x.second[i]) -                 mp[y].begin();             an = an + max(0ll, (long long int)(mp[y].size() - l));           }         }         cout << an;       }     }     return 0;   }   