func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 5e5 + 10;   const int base = 31337;   const int mod = 1e9 + 7;   const int inf = 0x3f3f3f3f;   const int logo = 20;   const int off = 1 << logo;   const int treesiz = off << 1;   int n;   char niz[maxn];   int his[maxn];   int main() {     scanf( %d%s , &n, niz);     long long sol = 0;     long long tren = 0;     memset(his, -1, sizeof his);     for (int i = 0; i < n; i++) {       if (niz[i] ==  0 )         sol += tren;       else {         int ptr = i;         while (ptr + 1 < n && niz[ptr + 1] ==  1 ) ptr++;         int cnt = 1;         for (int j = i; j <= ptr; j++) {           tren += j - his[cnt];           his[cnt] = ptr - cnt + 1;           sol += tren;           cnt++;         }         i = ptr;       }     }     printf( %lld n , sol);     return 0;   }   