pub fn part1(input: &[usize]) -> u32
Map each index to a score using a small precomputed lookup table.