After yesterday' fiddle-fest we are back with a straight-forward puzzle. Today we get the return of Manhattan distance, an AoC fav, but this time not spelled out to fool the crafty LLMs.
I made the initial decision not to "move" the galaxies in the initial map, but instead to store an offset that was increased whenever an empty row or column preceding the object was detected. This turned out to make part 2 really easy once I figured out the off-by-one error.
In retrospect that would have been far better for runtime, my dist function ended up being a tad expensive.
I substituted the rows/columns, with multiplication by the expansion rate if they were all numbers.
And then for each galaxy pair do a running sum by going “down” the “right” and adding the distance for each row and column crossed.