Quest 1: Scales, Bags and a Bit of a Mess
- 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



Futhark + sed
Futhark can read only number and array types from stdin, the input data is often a non-starter. Therefore, I often massage it into the right format using
sed.Sed Script
This formats everything nicely, e.g. the example for part 1:
2456:rrrrrr ggGgGG bbbbBB 7689:rrRrrr ggGggg bbbBBB 3145:rrRrRr gggGgg bbbbBB 6710:rrrRRr ggGGGg bbBBbBis transformed into this:
[ [2456,0b000000,0b001011,0b000011] , [7689,0b001000,0b001000,0b000111] , [3145,0b001010,0b000100,0b000011] , [6710,0b000110,0b001110,0b001101] ]Futhark Solution
I had hoped that the input might get big enough for optimization purposes, but the calculations are likely too simple.