fn calc_idx(v: impl Iterator<Item = i32>) -> usize