fn fuel_for_modules1(input: &str) -> i64 { let mut fuel: i64 = 0; for module in input.split_whitespace() { let module: i64 = module.parse().unwrap(); fuel += (module / 3) - 2; } fuel } fn fuel_for_mass2(mass: u64) -> u64 { if mass <= 8 { return 0; } /* wish really hard */ let fuel = mass / 3 - 2; fuel + fuel_for_mass2(fuel) } fn fuel_for_modules2(input: &str) -> u64 { let mut fuel: u64 = 0; for module in input.split_whitespace() { let module: u64 = module.parse().unwrap(); fuel += fuel_for_mass2(module); } fuel } fn main() { let input = include_str!("input.txt"); println!("Fuel 1: {}", fuel_for_modules1(input)); println!("Fuel 2: {}", fuel_for_modules2(input)); }