1
2
3
4
5
6
7
8
9
10
MappedIndices ← +⊃(\+×≡/×=@.)(⇡⧻): -1

Input ← &fras "../day_11.txt"
⊜∘≠, @\n Input                         # split on newlines
↯¯1_2⊞⊂ ∩(MappedIndices 1000000) ⊃∘⍉ . # mapped indices
▽=@#♭:                                 # galaxy indices
↯¯1_2_2⊠⊟.                             # pairs of galaxies
⊝≡(⊏⍏.)                                # unique pairs
≡(/+⌵-°⊟)                              # distances between pairs
/+                                     # sum