fn solve_second_optim(input: &[Option<u64>]) -> u64 {
    let v = input
        .iter()
        .enumerate()
        .filter(|&(_, id)| id.is_some())
        .map(|(i, id)| {
            let id = id.unwrap() as i64;
            (id - (i as i64), id)
        })
        .collect::<Vec<_>>();
    dbg!(&v);
    let t = chinese_remainder(&v);
    t.unwrap_or_default() as u64
}
// this uses the chinese remainder theorem, O(n)
this uses the chinese remainder theorem, O(n)
this uses the chinese remainder theorem O ( n )
fn solve_second_optim(input: &[Option<u64>]) -> u64 {
    let v = input
        .iter()
        .enumerate()
        .filter(|&(_, id)| id.is_some())
        .map(|(i, id)| {
            let id = id.unwrap() as i64;
            (id - (i as i64), id)
        })
        .collect::<Vec<_>>();
    dbg!(&v);
    let t = chinese_remainder(&v);
    t.unwrap_or_default() as u64
}
fn solve_second_optim ( input : & [ Option < u64 > ] ) -> u64 { let v = input . iter ( ) . enumerate ( ) . filter ( | & ( _ , id ) | id . is_some ( ) ) . map ( | ( i , id ) | { let id = id . unwrap ( ) as i64 ; ( id - ( i as i64 ) , id ) } ) . collect :: < Vec < _ > > ( ) ; dbg ! ( v ) ; let t = chinese_remainder ( & v ) ; t . unwrap_or_default ( ) as u64 }
this uses the chinese remainder theorem, O(n)
this uses the chinese remainder theorem O ( n )
input
&[Option<u64>]
input
&[Option<u64>]