use proconio::input; use proconio::marker::Bytes; fn main() { input! { s: Bytes, } let mut next = 0; let mut ans = 0; for (i, &c) in s.iter().enumerate() { if c == b'0' { let j = next + (next + i) % 2; next = j + 1; ans += (i - j) / 2; } } println!("{ans}"); }