func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, tmp, ans, curr;   string s;   deque<pair<long long, long long> > v;   void add(long long val, long long pos) {     while (v.front().first <= val) {       curr -= v.front().first * (v[1].second - v.front().second);       v.pop_front();     }     v.push_front({val, pos});     curr += v.front().first * (v[1].second - v.front().second);   }   int main() {     cin >> n >> s;     curr = ans = tmp = 0;     v.push_front({1000000, n});     for (int i = s.size() - 1; i >= 0; i--) {       if (s[i] ==  0 ) {         while (tmp >= 0) {           add(tmp, i + tmp);           tmp--;         }         tmp = 0;       } else {         tmp++;         ans += (tmp * (tmp + 1)) / 2ll;         add(tmp, i + tmp);       }       ans += curr;     }     cout << ans <<   n ;     return 0;   }   