Day 2: Gift Shop
Megathread guidelines
- Keep top level comments as only solutions, if you want to say something other than a solution put it in a new post. (replies to comments can be whatever)
- You can send code in code blocks by using three backticks, the code, and then three backticks or use something such as https://topaz.github.io/paste/ if you prefer sending it through a URL
FAQ
- What is this?: Here is a post with a large amount of details: https://programming.dev/post/6637268
- Where do I participate?: https://adventofcode.com/
- Is there a leaderboard for the community?: We have a programming.dev leaderboard with the info on how to join in this post: https://programming.dev/post/6631465


Uiua
Considerably easier than Day 1 for me. Uiua does have regex support, but no back references, so this is my poor man’s version.
"11-22,95-115,998-1012,1188511880-1188511890,222220-222224,1698522-1698528,446443-446449,38593856-38593862,565653-565659,824824821-824824827,2121212118-2121212124" ⊜(⊜⋕⊸≠@-)⊸≠@, R ← +⊙⇡⟜-⊙+₁°⊟ Dup ← ¬˜∊0⦷⊸↙⌈÷2⊸⧻°⋕ Dup₂ ← ⨬(/↥≡⌟(¬˜∊0⦷⊸↙)↘1⇡+1⌈÷2⊸⧻|0)<2÷∩⧻⊸⊸◴°⋕ ⊃≡(/+▽⊸≡Dup R)≡(/+▽⊸≡Dup₂ R) ∩/+You can run the code on Uiua Pad, btw.
And here’s a much improved version based on my understanding of another solution on the Discord.