#include #include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); static char S[2000001]; cin >> S; int32_t i, l = 0; int64_t ans = 0; for (i = 0; ; ++i) switch (S[i]) { case '0': ans += (i - l) >> 1; l += 1 + ((i - l) & 1); break; case '\0': cout << ans << '\n'; return 0; } cerr << "Buffer overflow...\n"; return -1; }