func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e6;   int pref[MAXN + 1];   string S;   int n, k;   void fast_io() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);   }   pair<int, int> query(int s) {     int lo = s, hi = n;     int res = -1;     while (lo <= hi) {       int mid = (lo + hi) >> 1;       if (pref[mid] - pref[s - 1] >= k)         res = mid, hi = mid - 1;       else         lo = mid + 1;     }     if (res == -1 or (pref[res] - pref[s - 1]) != k) return make_pair(-1, -1);     pair<int, int> p = make_pair(res, -1);     lo = res, hi = n;     res = -1;     while (lo <= hi) {       int mid = (lo + hi) >> 1;       if (pref[mid] - pref[s - 1] <= k)         res = mid, lo = mid + 1;       else         hi = mid - 1;     }     p.second = res;     return p;   }   int main() {     fast_io();     cin >> k >> S;     n = S.length();     S =  $  + S;     for (int i = 1; i <= n; i++) {       pref[i] = (S[i] -  0 ) + pref[i - 1];     }     long long ans = 0;     for (int i = 1; i <= n; i++) {       pair<int, int> p = query(i);       if (p.first == -1) continue;       ans += (p.second - p.first + 1);     }     cout << ans <<   n ;     return 0;   }   