diff --git a/src/plasl/2025/day10/input b/src/plasl/2025/day10/input new file mode 100644 index 0000000..f5fcc99 --- /dev/null +++ b/src/plasl/2025/day10/input @@ -0,0 +1,200 @@ +[..#.##.##] (0,1,2,3,4,5,8) (2,3,5,7) (2,5,6,7) (0,3,4,5,6,7,8) (0,2,4,6,7,8) (0,1,2,4,5,8) (0,2,4,5,6) (0,1,3,4,7,8) (0,1) (2,3,6) {55,25,58,54,55,53,44,43,42} +[##..#..] (0,3) (0,1,2,5,6) (0,1,2,4,5) (1,3,4,6) (1,2,3,4,5) (1,6) (1,2,4,5) (0,5) (3,4,5,6) {151,96,61,49,74,197,61} +[.##..#.] (4,5) (0,1,3,6) (0,1,2,3,5,6) (1,2,5) (0,1,4,6) (0,1,2,5,6) {31,42,19,20,8,21,31} +[#...###] (1,4,6) (0,2,4,5,6) (0,1,2,3,5,6) (2,3,5) (1,4,5) {11,18,26,16,27,27,27} +[##...###] (0,1,3,4,5,6,7) (1,2,3,5,6,7) (0,5) (0,2,3,5,7) (2,3,4,5,7) (1,3,4,5,6) (0,1,3,4,6) (1,5,6) (3,5) {158,192,24,194,174,81,192,35} +[.#.##...#] (1,2) (1,3,7,8) (1,2,5,7) (4,7) (1,2,4,5,6,7) (0,1,2,3,5,6,8) (0,3,4,5,6,7,8) {22,156,139,39,6,134,25,132,39} +[.#..] (0,1,2) (0,3) (1,2) (3) (0,2) {47,24,44,16} +[#...#] (1,2,3,4) (0,2) (0,1,2,3) {4,2,6,2,2} +[..#.] (1,3) (0,3) (0,2,3) {33,7,14,40} +[.#.#..##.#] (0,4,5,6) (2,7) (4,5) (0,1,2,3,4,5,6,7) (0,1,2,3,5,6,7,8) (1,3,8) (1,3,5,9) (0) (0,2,3,4,6,8) (0,8) (4,5,6,8) (0,1,4,5,6,7,8,9) (0,2,3,4,5,6,7,9) {82,38,35,35,52,58,60,39,51,9} +[##.##] (0,2,3) (1,2) (1,2,3) (0,1,4) {22,22,36,36,4} +[#####....] (0,1,2,4,5,7) (6) (4,5) (0,1,2,5,6,7,8) (0,3,5,6,7,8) (0,1) (0,2,5,8) (0,1,2,3,4,6,8) (8) (1,3,4,6) (1,4,8) {163,146,35,26,33,46,40,33,39} +[..#.##...] (1,2,6,7,8) (1,2,5,6,7,8) (0,1) (0,1,3,4,5,8) (1,3,4,5,7) (2,3,4,6,7,8) (3,4,5) (0,3,6,8) {17,36,16,23,21,34,18,21,22} +[..#.] (0,2) (1,2) (0,2,3) (0,3) (0,1) (0) {26,9,14,12} +[.#.#] (1,3) (0,2,3) {13,16,13,29} +[#....#.##.] (3,8) (2) (1,2,5,6,8) (0,1,3,4,5,6,8) (1,2) (0,3) (0,5,9) (7,8) (1,4,9) (0,1,3,4,5,7,8,9) (4,6,7,8) (1,5) {26,36,20,20,29,32,28,23,34,18} +[#.####] (0,1,2,4) (1,2,3) (0,1,3) (1,3) (0,4) (5) (3,4,5) (1,5) {32,58,12,42,25,24} +[..#.##..##] (0,3,4,7,8) (0,1,3,4,5,6,8,9) (2,3,4) (6,9) (0,1,2,4,5,6,9) (0,5,7,8,9) (4,5,8) (4) {39,29,29,34,84,46,31,10,39,31} +[.#..#..] (1,4,5) (3,5,6) (2,5) (0,2,3,4,6) (1,3,4,5,6) (0,4) (0,1,4,5,6) {22,40,8,28,45,64,45} +[#...] (0) (0,1) (0,2) (0,3) (2) {39,14,23,5} +[.##..#] (0,1,4) (0,1,4,5) (1,2,5) (0,2,5) (1,2,4,5) (0,1,2,3,5) (2,3) {53,63,51,31,34,49} +[.#...] (1,2,3,4) (3) (0,3,4) (1) (0,2) (1,3) (3,4) {23,149,16,50,18} +[.#..#] (0,1,2) (0,2,3,4) (1,3) (2,3) (1,4) {10,31,17,15,22} +[##########] (0,2,5,6,7) (2,5,6,7,9) (0,3,4,5,6,8) (1,4) (1,6,8) (2,3,4,5,6,7) (0,1,2,3,4,6) (0,1,3,4,8) (1,4,5,6,7,8,9) (2,4,5,6,8) {42,49,54,54,87,55,77,27,57,11} +[.#.#.#.] (2,4) (0,5) (1,2,5,6) (0,1,3) (0,1,4,5,6) {22,25,13,3,23,25,22} +[.####..#] (3,5,6) (1,5,7) (0,3,4,7) (0,1,3,6) (0,2,4,6,7) (0,4) (0,1,3,5) {57,33,15,43,35,35,31,38} +[.##.#] (1,2,4) (0,1,3) (1,2) {7,35,28,7,9} +[####.] (0,1,2,3) (0,3,4) (0,2,3) (0,1,2) (2,3,4) {126,20,132,133,8} +[###..#...#] (3,6,7) (1,2,6) (0,2,3,4,5,6,9) (1) (0,1,2,5,6,7) (0,1,2,3,6,7,8,9) (0,1,2,3,5,6,8,9) (1,2,3,4,5,6,8,9) (0,5,6,8,9) (1,2,4,7,9) (0,3,8,9) (0,2,4,5,6,7,8) (2,3,5,6,8,9) {56,74,68,51,33,39,58,48,52,69} +[.#..##.##.] (1,3,5,7,8,9) (1,3,4,5,6,7,8,9) (3,8) (0,1,4,5,7) (1,3,6,8,9) (0,2,3,4,6,7,8,9) (4,7,8) (1,5) (0,1,2,3,4,5,6,8) (4,6,7,8) {27,60,19,56,49,44,47,39,74,29} +[......##] (0,1,2,7) (0,1,2,3,4,5,7) (0,1,3,4,6,7) (1,2,3,5,6) (0,2,3,6) (1,4,6,7) {47,50,46,60,35,26,56,36} +[..##.#..] (0,1,2) (0,4) (2,3,5,7) (0,2,3,4,5,6) (0,1,3,4,6,7) (0,1,3,6,7) (5,6,7) (0,4,5,6,7) (0,2,3) {253,33,46,51,226,48,55,50} +[.#.#] (0,1,2) (1,3) {0,7,0,7} +[#...#...#] (6) (5,7) (0,1,3,4,6,7,8) (0,2,3,6,7,8) (0,1,5,8) (2,7) (0,1,4,8) (4,5,6) (0,4,5,6,7,8) {44,16,26,15,27,45,48,59,44} +[#..##..] (0,1,2,4,5,6) (3,4,5) (0,1,3,4,5,6) (1,4,5) (2) (0,1,3,4,5) (1) (2,3,5) (0,1,4,5,6) {44,54,30,20,55,57,40} +[..###...##] (0,2,5,6,8) (0,1,2,3,4,5,8,9) (2,3,4,5,7) (0,3,4,5,6,8,9) (2,7,9) (0,1,2,3,4,5,7,8,9) (1,7) (1,2,3,4,5,6,7,8,9) {30,37,48,54,54,59,39,57,44,48} +[..##.###] (0,1,2,3,4,5) (1,2,3,4,5) (0,4,5,7) (0,1,4,5,6,7) (0,2,4,5,7) (0,1,5,6) (1,4) (2,3,4,5,7) (0,3,5) {58,53,56,58,72,83,10,29} +[..###...] (1,2) (0,1,3,4,5,7) (3,4,5) (1,3,4) (0,6) (0,1,2,3,6) {10,39,20,29,23,4,10,0} +[.#....##] (2,3,5) (1,2,3,4,6) (1,3,7) (1,2,3,4,6,7) (4,5) (0,4,6,7) {15,29,25,36,47,21,33,26} +[...#..] (0,1,2,4) (1,5) (0,2,5) (1,3) (0) (2,4,5) (0,2) (0,1,4,5) {168,183,164,18,158,39} +[...#.....] (0,2,4,5,6,7,8) (1,5,7,8) (0,1,6) (1,2,3,7,8) (0,4,5,6,7,8) (0,3,5,6,7,8) (1,2,6,7,8) (0,1,3,6,7,8) (1,2,3,4,5,6,7) (2,4) (0,1,2,7) {81,77,60,51,37,50,76,94,74} +[###..#..#.] (2,9) (0,2,4,6,7,9) (3,4,5,6,7,9) (0,2,3,6,7,8,9) (0,1,3,5,6,8,9) (0,1,4,5,6,7,8) (0,4,6) (3,8) (0,3,4,5,6,8,9) (0,1,2,5,6,8,9) (3,7) (0,1,2,5,6,9) {125,72,82,167,78,94,144,79,176,120} +[#.#####.] (0,1,3,5,7) (1,5,7) (2,4,6) (0,1,3,4,7) (1,3,5) (0,4,5) (0,1,2,4,6) (1,2,4,5,7) (1,2,3) (3,5,6) {48,69,36,41,57,59,20,47} +[#.#.#] (0,2,4) (1,2,4) (0,1,2) (1,3) {169,37,181,18,174} +[..##..##] (1,2) (1,3) (0,4,5,6) (5,6) (1,3,6,7) (1,2,3,4,6,7) (1,2,3,7) (1,4,5,6) (0,2,3,5) {27,67,44,56,34,45,54,33} +[###.....] (0,1,5,7) (0,2) (0,2,4,5,6,7) (3,4,6,7) (0,1,2,4,5,6,7) (1,7) {48,27,36,0,21,33,21,39} +[#....##] (1,2,4,5,6) (1,2,6) (0,2,3,5) (2,3,4,5,6) (0,2,4,5,6) (0,2,6) (0,1,3,5) (4,5) {35,43,65,13,36,46,63} +[.########] (3,4,5,6,7,8) (0,1,2,3,4,5,6) (0,2,5,6,8) (1,2,3,4,5,6,8) (1,3,4,5,6,7,8) (0,3,5,6,7,8) (0,2,3,4,6,8) (0,1,2,4,5,6,7) (2,3,5,6) (0,1,7) {38,39,37,69,69,58,75,49,56} +[##..#.] (2,3,4,5) (0,1,3,5) (1,5) (0,3,4) (2,4) {13,18,27,26,30,31} +[#...##.] (2,3) (1,4,6) (0,1,2,3,4,5,6) (1,5) (3,6) (3,5) {4,25,9,28,16,20,28} +[#####] (2,4) (0,3,4) (0,4) (2,3) (1,2,3) {16,0,24,29,24} +[.#.#.#] (1,2,5) (0,2,4,5) (0,1,2,3,4) (1,3,4) (0,4) {19,39,25,27,38,17} +[#......] (0,3,4,5,6) (1,5) (0,1,3) (0,2,3,6) (0,1,2,4,6) (1,2,3,4,5) {39,36,47,36,38,21,37} +[.##.####] (0,6) (0,5) (3,7) (0,1,3,4,6,7) (2,4,6) (1,2,3,5,7) (4,6,7) (1,4,5,6) {28,36,9,21,53,23,60,37} +[.###...] (3,4,5,6) (0,2,3,4,6) (0,2,3,6) (1,2,3,5) (2,4,6) (3,5,6) (0,4,5,6) (1,5) (1) {41,52,59,71,61,84,93} +[#..#..#.#.] (0,1,3,4,5,6,8,9) (0,3,6,8) (0,1,2,5) (4,5) (0,5) (1,2,3,6,7,9) (0,1,3,8) (1,3,9) {62,40,16,46,21,47,40,10,36,28} +[.#.###] (0,1,2,3) (1,3,5) (1,2,3,5) (2,5) (4) (0,1,2,3,5) (0,2,4,5) {28,26,48,26,19,48} +[#.##] (0,1,2) (0,2,3) (1) (2,3) {10,8,23,20} +[###..#.] (0,2,5) (0,1,2,6) (0,2,4,5,6) (0,3) (2,3,4,5,6) (1) (2,4) (2,4,6) {65,27,76,18,43,37,48} +[###..##] (0,1,2,6) (2,6) (1,3,6) (2,3,6) (2,3) (4,5) (0,1,4,6) {34,44,50,28,38,18,76} +[.##.#] (1,4) (1,2,4) (0,3,4) {2,14,4,2,16} +[###.] (0,1,2) (0,1,3) {115,115,12,103} +[..#.] (0,3) (2) (1,3) {17,16,9,33} +[....#.#] (0,3,5) (6) (1,2,4) (4,5,6) (1,2,4,5,6) (3,4,6) (0,2,3,4) (1,2,3,5,6) (4) {24,14,30,204,228,39,221} +[#..##] (2,4) (0,2) (0,1,2) (0,1,3,4) (2,3) (1,3) {30,27,176,172,18} +[#..#.#.] (0,1,2,4,5) (1,2,3,4) (0,1,3,5,6) (1,2,4,5,6) (3) {39,68,49,49,49,50,30} +[#.###.] (3,4,5) (2,4,5) (2,4) (0,2) (1,2) (0,3,4) (0,1) (0,3) {147,40,55,135,51,23} +[..##] (0,1) (0,2) (1,2,3) (1,3) (0,1,2) {206,195,38,6} +[#.#.##...#] (1,3,8,9) (3,5,6,7,8) (1,3,5,8,9) (0,2,8,9) (0,3,5,6,8) (1,3,4,5,7,8,9) (0,1,2,6,7,9) (0,2,3,4,5,6,7,9) (1,2,5,9) (0,1,4,5,6,7,8,9) (0,4,5,9) (2,6,7,8,9) {74,58,74,56,30,87,80,64,80,110} +[..#.] (1,2,3) (2,3) (2) (1) (0,2) {15,7,37,4} +[##..##] (1,2,3,4) (2,3,4) (0,2,5) (1,3) (2,3) {12,23,215,210,189,12} +[.####..#.#] (1,2,3,6) (0,2,3,4,5,6,8,9) (5,7,9) (1,2,3,5,6,7,8) (3,4,7) (0,1,2,3,4,5,7,8,9) (1,9) (1,3,6,8) (1,2,3,4,5,6,8,9) (0,6,7,8,9) (1,3,4,5,6,7) {23,69,48,69,45,68,64,52,57,56} +[..##] (2,3) (1) (0,2) (1,3) (1,2) {16,25,38,16} +[#.#....] (0,1,3,4,5) (1,2,3,5) (3,4,6) (1,2,4,5) (3,5,6) (0,3,5,6) (1,2,4,5,6) (0,1,2,5) {14,60,52,61,52,80,44} +[#..#..##.] (0,1,2,3,4,7) (1,2,3,4,5,6,7,8) (1,4) (2,4,5,6,7) (0,1,2,3,4,5,7,8) (0,2,3,5,6,7) (0,3) (2,3) (0,4,5,7) (3,5,6) {57,52,69,89,72,64,35,67,27} +[#.#.##] (3) (4,5) (1,2) (0,3) (4) (0,1,3,5) {15,12,10,176,20,8} +[....##] (3,4) (0,1,2,5) (0,3,4) (0,2) (0,1,2,3) (4,5) (1,2,5) {27,32,40,23,16,25} +[..#.###.##] (2,4,5,7,8) (0,6,9) (0,1,3,5,6,8,9) (0,2,4,5,6,7,8,9) (2,3,6,7,8) (0,1,2,3,4,5,6,7,8) (0,4,5,6,7,9) (2,3,4,5,7,8,9) (0,1,8,9) {78,34,37,32,54,67,69,57,62,76} +[#..##] (2,3) (1,4) (0,3,4) {5,13,16,21,18} +[####] (0,1,2,3) (0,2,3) {29,15,29,29} +[...#....##] (2,3,4,9) (3,5,9) (0,1,2,3,4) (2,3,5,6,7,8,9) (7,8) (3,4,9) (0,1,3,5,6) (0,1,2,6,9) (4,8) (8) (0,1,4,6) (1,2,3,4,8) (0,1,2,4,5,6,7) {74,74,68,60,69,42,68,31,27,51} +[##.###..##] (2,4,8) (5,6,7,8) (2,6,8) (0,4,6,7,8,9) (3,5,7) (0,2,3,4,5,6,8) (1,6) (1,2,3,4) (2,3,4) {9,20,52,44,39,24,38,15,32,0} +[.##...] (0,3,5) (1,2) (0,2) (0,4,5) (0,4) (0) (5) (1,2,3,5) {37,28,28,18,18,33} +[..#...#] (0,1,3,5) (0,2,5,6) (0,1,3) (4,5,6) (0,1,3,4,5,6) (2,6) (0,1,2,4,5) (0,4,5) {81,50,37,30,60,81,39} +[...######.] (0,3,4,5,6,7,8) (1,4,5,6) (1,2,3,6,7,8,9) (0,1,5,7,9) (9) (2,6) (4,5,8,9) (1,2,3,5,6,7,8,9) (0,1,2,4,5,6,7) (0,3,5,7) (0,2,3,5,6,8,9) (0,1,4) {69,48,28,33,49,67,44,46,31,55} +[###...##..] (2,6) (0,2,3,4,5,6,7,8,9) (0,1,2,5,6) (0,1,2,3,4,7,8,9) (0,1,4,5,6,9) (3,5) (0,2,9) (0,1,2,4,6,7) (6,9) (0,1,8,9) (0,1,2,3,4,5,8) {287,74,298,75,76,77,83,57,55,243} +[#....##.#] (1,3,5,8) (0,5,7) (0,2,7,8) (0,1,2,3,4,5,6,7) (5,7) (5,6,8) (1,7,8) (0,2,3,4,5,7,8) (0,3,4,5) (0,2,5,6) (0,6,7,8) {97,42,58,58,42,113,72,92,88} +[.#.##.#.#.] (2,6) (0,2,3,4,5,8,9) (0,1,3,5,6,7,8,9) (0,1,2,3,4,5,7,9) (2,9) (0,3,6,7,8) (1,2,3,5,7,8,9) (1,4) (0,1,3,4,5,6,7,8) (5,7,9) {61,61,46,71,58,59,52,61,62,42} +[###.###.] (0,3,5,6) (0,3,5,7) (1) (1,3,4,6) (0,1,4) (0,2,3,5,6,7) (3,4,7) (2,3,4,5,6) {177,24,153,190,33,178,180,152} +[#######.] (1,2,4,7) (1,2,3,5,6,7) (0,1,2,5,7) (2,3,6) (0,1,2,3,4,5,6) (0,1,2,5,6) {36,54,65,40,13,53,44,38} +[.#.#] (0,1,2) (1,3) {102,122,102,20} +[.####.] (3,4) (1,2) (0,3,4) (1,4,5) {2,33,13,109,129,20} +[...##..##] (0,1,2,3,5,6,7) (0,1,4,6) (0,1,5,8) (3,7,8) (1,2,3,4,5,6,7) (0,3,7,8) (0,1,2,4,6,7,8) (1,2,4,5,6,7,8) {52,189,182,51,167,168,187,198,165} +[.##..#..] (0,1) (1,2,3,6) (2,3,4,6,7) (1,2,6,7) (0,1,2,4,5,7) (0,4,7) (2,5,6,7) (2,3) {21,39,56,45,19,7,30,23} +[#.###] (1,2) (0,2,3,4) (0,1,2,3) (0,2,3) {166,30,177,166,141} +[#.##] (2,3) (0,1) (1,2,3) (0,2) {18,34,19,18} +[#.###.##.] (0,2,3,4,5,8) (1,2) (4,6) (0,3,4,6,7,8) (2,4,8) (0,3,5,7,8) (0,3,4,5,6,7,8) (0,6,7) (1,5,8) (0,1,2,4,5,8) (5,6) {45,16,203,26,216,51,33,29,229} +[.##.....##] (0,2,3,4,5,6,8,9) (0,1,2,5,6,7,8) (0,1,7) (6,7) (0,1,2,3,4,5,7,8,9) (3,4,8,9) (8,9) (0,1,2,3,4,5,7,8) (0,1,2,3,5,6,7) (2,4,9) (5,6,9) (0,1,2,5,6,7,9) {64,45,69,71,65,67,54,46,72,81} +[.#..] (0,2) (1,3) (0,1) (1) (0) (1,2) {26,182,5,14} +[#.##] (0,1) (0,1,2) (3) (0,2,3) (1,3) {36,44,22,52} +[##....] (1,4,5) (0,1,3,5) (1,2,4) (0,2,4) {16,33,9,15,19,25} +[#.##.##.#] (0,6) (3,8) (2,6,7) (0,1,2,4,6,7) (0,1,4,5,6,8) (0,1,2,3,4,7,8) (0,3,5,6,7) (0,3,6,8) (0,1,2,4,5,6,7) (0,6,7) (0,1,4,6,7) {68,52,47,45,52,18,67,61,50} +[##...] (0,3,4) (0,1) (2,3) (0,1,2,4) (0) {30,10,27,23,14} +[##.....#] (0,2,3,4,5) (1,2,6) (3,4,6,7) (0,1,7) (3,6,7) (0,1,2,3,4,5,7) (1,2,3,5) {132,43,133,170,134,132,39,64} +[##.#] (0,1,3) (0,1,2) {160,160,12,148} +[.#######] (0,1,3,6) (1,2,3,4,5,6,7) (0,1,3,5) (2,4,5) (0,1,2,4,6,7) (0,2,3,5,6,7) (0,1,2,3,4,6,7) (0,6,7) (1,6) (0,1,4,6) {92,83,64,61,62,37,111,75} +[#...] (0,1,3) (3) (1) (0,1,2) (0) (2) {22,21,5,25} +[.##.##] (2,3) (0,2,3,4) (0,1,3,5) (0,1,2,4) {28,8,34,40,21,7} +[##.#.#.#] (2,3,4,5,6,7) (0) (0,1,2,3,7) (0,1,4,7) (3,4,6,7) (1,4) (2,4,5,6,7) (2,6,7) {28,31,58,41,84,36,75,91} +[.#....] (2,4,5) (0,3) (0,1,2,4) (0,1) (0,2) (0,1,2,3,4) {239,31,31,216,23,6} +[#...###] (3,4,6) (1,2,4) (4,5,6) (0,2,3,5) (0,2,3,5,6) (0,4,5) (1,2,3,4,5) (1,2,3,4,6) {26,16,39,44,47,50,35} +[....##..] (0,3,4,5) (0,1,4,7) (2,6) (0,2,3,4,5,6,7) (1,2,3,4,7) (0,3,4,5,6,7) {22,21,37,31,37,16,22,27} +[##.##] (3,4) (2,3,4) (0,1,2,3) (0,1,3,4) (0,3) (0,2,4) (0,2) {65,17,46,56,52} +[.....#..#.] (0,1,2,4,6,7,8) (1,3,4,7) (2,4,9) (0,2,4,5,8,9) (0,4,5,7) (0,3,7,8,9) (0,1,2,3,6,8,9) (1,4,5,7,8) (1) (0,1,2,3,4,6,7,9) (6) {44,58,40,46,72,29,16,65,54,54} +[#.#.] (1,2) (0,3) (0,2) (0) (0,1,2) (2) {40,24,43,4} +[###...#..#] (2,5) (1,5,6,7) (1,2,4,6,8) (2,7,8) (1,6) (0,2,3,4,5,6,8,9) (1,7,8) (4,6,7,9) (1,3,4,7,8,9) (0,1,2,3,6,7,9) (0,6) (0,3,4,6,7,9) (1,3,5,6,7,8,9) {51,78,53,62,53,28,91,71,49,62} +[.#...#.] (0,1,4,5) (5) (0,1,2,3,6) (1,2,3,4,6) (0,6) (0,1,4) {177,180,29,29,168,17,43} +[...###.] (0,1) (3,4,5,6) (0,1,3,4,5,6) (1) (5,6) (2,4) (0,2,4) (0,1,3,4,5) (2,3,5) {40,38,33,68,71,76,47} +[#.###] (0,3) (0,2,3,4) (0,1,2,3,4) {35,9,20,35,20} +[#.#.#...#] (0,1,2,4,5,6,7) (5,6) (1,3,4,6) (0,1,2,5,6) (2,3,6,7,8) (0,1,2,3,4,5) (0,1,6,8) (0,2,4,6,7,8) (0,2,7) {68,57,78,37,47,42,91,59,34} +[###...#.##] (0,1,2,3,6,7,8,9) (4,6) (2,4,5,6,7,8,9) (0,1,4,5,6,7,8,9) (0,1,2,8,9) (0,2,4,5,6,7,8,9) (3,8) (1,5) (0,1,2,3,5,7,8,9) (1,7) (1,2,3,4,6,7,9) {203,209,52,45,202,212,222,222,238,220} +[..##...##.] (1,2,3,4,5,6,8,9) (2,3,7,8) (2,5,7) (1,2,3,4,5,6,7,9) (0,1,8,9) (0,1,2,4,8,9) (1,4,8) (0,2,6,8,9) (1,5,9) {26,59,48,21,40,40,20,30,29,57} +[.#.#..#...] (1,2,3,4,6,7,8,9) (0,2,4,6,9) (4,6,9) (0,1,2,5,6,7,8,9) (0,2,3,6,8) (0,7) (2,5,6,7) (0,1,5,6,7,8,9) (2,3,5,7,9) (1,2,6) (0,1,2,4,5,6,7,8) (4,6) {78,39,88,28,43,53,107,63,56,56} +[..#.#.] (2,4) (2,3,5) (1,4,5) (0,3,4,5) (0,1,3,5) (0,1,2,4) {35,33,41,34,55,47} +[...#...###] (1,3,6,8) (0,2,3,5,7,9) (0,1,6,7,8,9) (1,2,3,6,8,9) (0,1,3,7,9) (3,7,8,9) (0,2,3,4,7,8,9) (1,4,6,8) (1,6,9) {43,71,34,75,24,16,66,59,80,79} +[##.##] (0,1,2) (0,1,3,4) (1,4) {22,38,14,8,24} +[..#..#.] (0,1,2,3,4) (0,1,3,4,5) (1,4,5,6) (1,4) (0,1,2,5,6) {30,44,11,29,43,32,13} +[.#.#] (0,1,2,3) (1,3) (2,3) {17,28,21,32} +[#.#.] (0,2) (1,2,3) {4,10,14,10} +[..##.#] (0,3) (0,1,2,4) (2,3,5) (1,2,4,5) {12,4,14,22,4,14} +[##...#....] (1,3,4,6,7,8) (6,9) (0,1,2,3,4,6,9) (2,4) (0,1,2,3,6,7,8) (0,1,2,3,4,5,6,8) (0,3,4,6,8,9) (0,1,2,3,4,5,7) (5,6,7) (1,3,4,5,6,8,9) (0,3,6) {54,37,35,58,41,25,73,35,36,34} +[.#######] (1,3,6,7) (1,4,5) (0,3,4,6,7) (0,6,7) (1,3) (2,3,5,7) (2,4) {30,39,16,51,42,13,41,44} +[##....##.#] (6,8) (1,3,4,5,6,7) (1,2,3,4,5,6,7,8) (1,2,4,5,7,9) (0,1,2,5,6,7,9) (0,2,3,4,5,6,8,9) (0,1,5,6,7,8) (1,2,3,4) (2,9) (0,1,3,4,5,6) (0,2,5,6,7) (0,1,4,6,7,8,9) (1,2,3,8,9) {86,110,111,69,82,117,119,93,75,74} +[.#......#.] (1,7,8) (1,2,3,4,6,8) (1,2,3,4,5,7,8) (1,5,9) (2,3,4,5,6,7,8,9) (1,8,9) (0,1,2,3,4,5,6,9) (3,5,6,7) (0,3,5,6,9) (1,2,3,6,9) {31,61,64,81,53,60,74,25,42,66} +[#..#...] (1,3,4,5,6) (0,3,4,6) (2,6) (2,4) (1,4,6) (1,2) (2,3,4,5) {14,21,37,38,57,24,50} +[#####..] (0,1,2,3,4) (3,5) (4,6) (0,6) (2) (0,1,4,5) {26,23,38,20,144,7,124} +[#.#...##] (1,2,4,6) (0,1,2,4,5,6,7) (0,2,3,6) (1,4,6,7) (0,3,4,6,7) (1,5) (3,6) {41,58,39,46,59,31,87,43} +[##.#...#.] (0,6) (0,1,3,7) (1,5) (1,2,3,5) (0,1,2,5,6,8) (0,1,2,3,5,7) (0,1,2,4,6) {220,226,27,210,5,25,17,203,8} +[.#.##] (1,3,4) (0,3) (0,2) (0) (1,3) (0,1) (0,1,3) {49,32,20,37,10} +[#####...] (0,1,2,3,4,6,7) (0,1,2,7) (2,3,4) (4,5,7) (0,1,2,3,5,6) (0,1,4,5,7) {46,46,56,50,43,29,30,29} +[.###...#] (1,2,4,7) (0,2,4,6,7) (2,3,6) (5,6) (1,2,3,4,5,6) (3,6) (4,7) {10,17,41,33,34,16,55,30} +[.#.###...] (5,6,7) (1,4,7) (1,3,7,8) (0,2,5,6) (4,5) (0,1,2,4,7,8) (0,1,2,3,4,5,7) (1,2,4,5,7) {39,72,49,33,65,48,12,83,31} +[..#.#] (0,2,3) (0,1,2) (1,2) (0,3,4) {40,28,45,21,4} +[.#.#...] (1,2,3,5,6) (0,1,2,6) (0,2,3,5) (2,3) (0,1,2,3,5) (2,3,4,6) (0,1,2,4,5) (0,1,3,4,5,6) (1,3,4,6) {193,220,227,96,192,196,81} +[.#...] (0,1,2,3) (2,4) (1,2,4) {3,18,23,3,20} +[#.#...###] (0,6) (1,4,8) (0,4,5,6) (1,2,4,6,7) (5,6) (0,1,5,6,7,8) (2,3,4,5,6,7,8) (0,2,7,8) (0) (3) (1,5) {61,60,35,30,48,71,80,53,57} +[#.##.##.] (7) (0,3,4,5,6,7) (0,3,4) (2,5) (1,3) (0,3,6,7) (0,1,4,5,6) (1,2,3,6,7) (2,3) {44,30,32,61,34,31,52,41} +[####..####] (2,4,5,7,8) (0,4,5,6,8) (1,4,5,6,7,8,9) (0,1,4,5,6,7,8,9) (1,3,4,5,7,9) (0,1,2,3,4,5,9) (3,7) (0,1,2,3,6,9) {37,48,37,39,55,55,42,58,45,48} +[..#.##...] (4,5) (0,2,7) (0,2,3,5,6,7,8) (0,1,4,7) (2,3,7,8) (0,1,2,3,4,6) (0,1,2,3,5,6,7,8) (1,3,6,7) (3,5) {41,34,53,59,17,38,40,75,38} +[..##..] (1,5) (0,5) (2,4,5) (0,2,4,5) (1,2,3) (0) {27,19,166,1,165,184} +[##..] (0,3) (0,2,3) (0,1,2) (1,3) {24,32,23,26} +[##.##] (3,4) (0,4) (0,2,3) (1,3) {29,1,15,24,22} +[#....#.##] (0,1,3,6,8) (0,6,8) (1,5,7) (0,1,2,3,4,5,6,8) (1,2,3,4) (5,7) (0,2,3,4,5,6) (1,3,5,6) {46,42,27,36,27,53,51,26,44} +[##...#.#] (1,2,6,7) (0,1,3,4,5,7) (0,2,3,4,6,7) (1,2,3) (1,5,6,7) (3,7) (1,2,3,4) (0,1,4,5,6,7) {37,53,47,55,54,25,51,66} +[....#.#.#] (2,3,5,8) (0,1,2,5,7) (0,5,7,8) (1,7) (0,2,3,5,6) (0,3,6,7) (0,1,4,6,7) (1,2,3,4,6,7,8) {24,31,32,32,11,36,18,46,38} +[.####.] (2,4,5) (0,1,2,4) (1,3,5) (0,4) (1) (1,4,5) (1,2) (2,3,5) {7,142,137,25,30,48} +[#.#####] (3,6) (0,2,3) (0,1,3,4,5,6) (0,1,2,3,4,6) (0,4) {227,17,191,220,36,17,29} +[###..#] (1,4) (0,3) (0,1,4) (1,2,3,5) (1) (3,4,5) (0,1,4,5) (1,2,4,5) {38,79,31,53,72,56} +[#.#.#] (0,1,3,4) (0,1,2) (0,4) (3,4) (0,2,3,4) (0,3,4) (0,2,4) {49,22,18,18,42} +[...#..] (3) (0,4) (5) (0,1,4) (2,5) (1,4,5) (0,2,4) (3,4,5) {29,29,106,31,59,153} +[#.#.###.] (0,2,6) (0,1,5,7) (3,6,7) (6,7) (0,1,2,4,5,6) (0,1,3,6,7) (5) (5,6,7) (3,4) {38,29,12,49,20,25,62,63} +[.##.#.] (0,1,3,5) (0,1,3,4,5) (0,1,2,4,5) (0,1,2,3) (3,4) (4) (1,5) (0,3,4) {183,185,150,191,49,41} +[#...###.] (0,1,2,3,4) (0,1,2,3,4,6) (0) (2,5) (3,4,5,6,7) (0,1) (0,1,3,4,5,6,7) (0,1,4,5,6,7) (1,4,6) (1,2,3,4,6,7) {46,55,22,31,55,44,51,31} +[.###..#.#] (0,2,3,4,7,8) (2,3,6) (0,2,5,6,7,8) (1,2,4,7,8) (1,5) (0,3,5) (1,8) {24,33,36,31,17,23,19,23,40} +[..#.##..] (0,1,3,5,6) (4,6) (0,2,6) (2,5,7) (1,2,4,7) (1,2,3,4,5,7) {23,216,215,209,203,217,26,208} +[.#.#..] (2,3,4) (3,4) (0,5) (1,3) (0,2) {10,0,18,24,24,4} +[###.#.####] (0,5,8,9) (1,5,6,7,8) (1,6) (5,7) (1,2,4,6,8) (0,2,3,4,7) (2,3,4,5,7) (0,2,3,4,7,8,9) (0,1,2,3,4,6,7,8) {28,23,20,13,20,46,23,42,45,25} +[..##..] (0,5) (1,2,3,4,5) (3,4,5) (1,2,4,5) (1,3,4,5) (0,1,4,5) (0,1,2,3,4) {35,46,35,29,52,61} +[.....##] (0,1,4,5,6) (0,1,2,5,6) (5,6) (0,1,3,4,5) (0,1,2,3,6) (0,1,5) (1,2,3,5,6) (4,6) (2,3) {73,93,76,58,36,83,98} +[..#####..] (0,1,2,5,7,8) (0,4,6,7,8) (1,3,4,5,6) (2,5,7) (0,3,5,6,7) (1,5,8) (1,3) {37,220,10,226,217,220,229,42,26} +[####.#] (0,1,2,4,5) (2,3) (0,1,5) (0,4) {198,198,195,9,186,198} +[..#..#.] (3,4) (0,2) (0,3,5,6) (0,2,3) (0,1,2,3,4,6) (1,2,4,6) (0,2,5) {44,17,47,39,35,4,18} +[.###..##.] (0,1,2,3,5) (0,7) (0,1,2,3,5,6,8) (0,1,4,6) (1,5,8) (3,4,6,8) (1,2,3,5,6,7,8) (1,2,5) (0,2,3,5,6,8) (5,7) (0,1,2,3,4,6,8) {90,92,78,180,125,103,177,50,178} +[.#.##.] (2,3,4) (0,3,4) (0,1,2,3) (0,1,2,4,5) (2,3) {24,13,36,46,25,1} +[####...#.#] (0,1,7,8) (5,9) (2,7,8) (4,6,7,8) (0,1,4,6,9) (0,1,2,3,5,6,7,9) (3,6) (5,8) (0,1,2,3,6,8,9) (0,1,2) (0,1,2,3,5,7,8,9) {33,33,45,32,5,30,27,37,48,38} +[#....] (0,1,2) (1,2,3) (0,1,4) (0,2,4) {28,39,37,16,12} +[##..#] (1,3,4) (0,1) (1) (0,4) (1,2) (3,4) {17,29,9,25,41} +[.##.##.##] (1,3,6) (0,1,2,3,4,5,6) (1,3,4,8) (1,6) (0,1,2,5,7) (0,1,2,7,8) (0,1,2,5,6,7,8) (0,4,8) (1,8) {45,59,25,25,45,22,29,20,57} +[.###..] (0,1,2,3) (0,4) (1,2) (0,5) (0) (1,2,3,4) (1,2,3,5) (1,2,3) {48,42,42,27,36,18} +[......##] (0,1,2,3,4,6,7) (2,7) (0,4,5,6,7) (2,3,4,5,6,7) (1,2,3,6,7) (3,4,5,7) (1,5,7) (1,3,4,5,6,7) {19,28,32,45,42,36,42,65} +[...#.##..#] (2,4,5,7,9) (0,2,3,5,6,8) (7,9) (2,6,8,9) (0,1,3,5,6,7,9) (0,2,7,8) (0,1,3) (4,6) (3,6,7) (0,2,3,5,6,7,9) (1,2,6,8,9) {84,36,69,71,167,45,230,67,48,53} +[##.###.##] (0,3,4,5,7,8) (0,3,4,5) (3,7) (1,3,5) (0,2,5,6,8) (1,4,7,8) (0,1,4,7,8) (2,6,7,8) {52,31,24,37,41,48,24,36,47} +[##.#] (1,2) (0,1,3) (0,2,3) {205,19,186,205} +[#....] (0,3) (0,1,4) (0,3,4) (1,2) (0,2,3) (4) (1,3) {27,21,13,39,13} +[##..#.#..] (4,5,6) (0,3,4,5,6,7,8) (1,3,4,5,6,7,8) (0,1,2,3,5,6,7) (1,2,6,8) (0,3,4,5,6,8) (2,4,5,6,7) (0,1,2,4,5,7) (1,2,3,4,6,7) (1,6,8) {184,214,195,205,69,219,244,211,62} +[.###....] (2,3,4,5,6) (1,3,4) (0,1,6) (0,5,7) (1,2,4,5,6,7) (1,2,4,5,6) (3,4,5,6) {27,50,34,25,51,54,63,18} +[..##..] (1) (0,2,3,4) (0,1,2,3,4) (1,2) (2,3,5) (0,3,4,5) {45,29,52,60,45,25} +[.#...] (0,1,3) (0,1,4) (1,2) (2,4) (3,4) (0,1,3,4) {141,155,15,14,148} +[##..] (3) (0,1) (0,2) (0,1,3) (1,3) (0,3) {58,32,17,46} +[##.###.] (0,4,5) (0,1,4,5,6) (0,2,5,6) (0,1,2,3) (1,2,3,4,6) (0,2,3) {45,29,39,25,16,25,28} +[#####] (1,2,4) (0,1,3) (0,1) (0,4) (1,2,3) (4) {41,62,31,36,27} +[#.##] (1,2,3) (0,1,2) (1,3) (0,3) (2) {22,22,27,34} +[..#.#] (1,3,4) (0,2,3,4) (0,2) (0,1,4) (2,4) {30,21,25,32,39} +[#..#.] (1,4) (0,3) (1,2,4) {6,25,19,6,25} +[.#..] (0,2,3) (2,3) (1,2) (0,3) {11,6,12,11} +[##..#...] (0,1,4) (3,6) (0,1,2,5) (0,2,4,6,7) (1,2,3,4,5,7) (3,6,7) (2,3,5,6,7) (2,5,7) (4) (1,3,4,7) {31,32,156,40,37,138,39,160} +[##...] (1,2,3) (0) (3) (2) (2,4) (0,3) (0,1,3) {14,22,42,38,11} +[#.#....] (0,2) (0,1,6) (2,3,4,5,6) (0,2,4,6) (4) (0,2,3,6) (0,1,2,4,6) (1,4,5,6) (1,2) {56,44,58,12,55,17,60} +[###.##.] (0,1,3,5,6) (0,2,4,5,6) (0,1,2,4,5,6) (1,3) (2,4) (0,1,2,3,4,6) (0,1,2,4,5) {33,24,43,17,43,26,26} +[..#..#..#] (1,2,3,4,5,8) (0,2,3,5,6,7) (0,1,3,4,5,6,7,8) (0,1,5,6,8) (2,4,6,7) (1,2,3,8) (0,1,3,5,6,7) (0,2,4,5,6,7) (5,6,8) (1,2,5) {54,61,54,49,14,72,60,40,38} diff --git a/src/plasl/2025/day10/input.t b/src/plasl/2025/day10/input.t new file mode 100644 index 0000000..dd91d7b --- /dev/null +++ b/src/plasl/2025/day10/input.t @@ -0,0 +1,3 @@ +[.##.] (3) (1,3) (2) (2,3) (0,2) (0,1) {3,5,4,7} +[...#.] (0,2,3,4) (2,3) (0,4) (0,1,2) (1,2,3,4) {7,5,12,7,2} +[.###.#] (0,1,2,3,4) (0,3,4) (0,1,2,4,5) (1,2) {10,11,11,5,10,5} diff --git a/src/plasl/2025/day10/part1.psl b/src/plasl/2025/day10/part1.psl new file mode 100644 index 0000000..b3a33c4 --- /dev/null +++ b/src/plasl/2025/day10/part1.psl @@ -0,0 +1,304 @@ + +i64 write(i32, ptr i8, u64) { + `scsbsa` + syscall3(i64(1), `la` as i64, `lb` as i64, `lc` as i64) +} + +i64 read(i32, ptr i8, u64) { + `scsbsa` + syscall3(i64(0), `la` as i64, `lb` as i64, `lc` as i64) +} + +i32 open(ptr i8, i32, i32) { + `scsbsa` + syscall3(i64(2), `la` as i64, `lb` as i64, `lc` as i64) + as i32 +} + +ptr i8 mmap(ptr i8, u64, i32, i32, i32, i64) { + `sfsesdscsbsa` + syscall6(i64(9), `la` as i64, `lb` as i64, `lc` as i64, `ld` as i64, `le` as i64, `lf`) + as ptr i8 +} + +void exit(i32) { + as i64 i64(231) rev + syscall1 trash +} + +void putc(i8) { + array i8[1] `dstr` store + write(1, `lt`, u64(1)) trash +} + +u64 strlen(ptr i8) { + dup while(dup load i8(0) !=) { 1+ } `r-` +} + +void print(ptr i8) { + 1 rev dup strlen write trash +} + +void println(ptr i8) { + print i8(10) putc +} + +void printnum(i32) { + + if (dup 0 ==) { + putc('0') + } else if (dup 0 <) { + `0r-` '-' putc + } + + array i8[11] 10+ dup i8(0) store -1+ `sb` + + while (dup 0 !=) { + 10 divmod 48+ as i8 + `lb` rev store + `lb` -1+ `sb` + } trash + print(`lb`1+) + +} + +void printnum64(u64) { + + if (dup u64(0) ==) { + putc('0') + } + + array i8[22] 21+ dup i8(0) store -1+ `sb` + + while (dup u64(0) !=) { + u64(10) divmod u64(48)+ as i8 + `lb` rev store + `lb` -1+ `sb` + } trash + + print(`lb`1+) + +} + +i32 atoi(ptr i8) { + set string + 0 + while (get string load '0' >= get string load '9' <= &) { + 10* get string load '0'- as i32 + + get string 1+ set string + } +} + +u64 atol(ptr i8) { + set string + u64(0) + while (get string load '0' >= get string load '9' <= &) { + u64(10)* get string load '0'- as u64 + + get string 1+ set string + } +} + +void printbin(i32) { + if (dup 0 ==) { trash '0' putc } else { + array i8[33] 32+ dup i8(0) store -1+ `sb` + + while (dup 0 !=) { + dup 1 & 48+ as i8 `lbr` store + 1 shr + `lb`-1+`sb` + } trash + + print(`lb1+`) + + } +} + + +i32 abs(i32) { + if (dup 0 <) {`0r-`} +} + +ptr i8 memset(ptr i8, i32, u64) { + `sn` as i8 `sc` + + u64(0) `si` + while (`liln` < ) { + `1+dlc` store + inc(i) + } +} + + +i32 bfs_brute(i32, ptr i32, i32) { + set nbuttons set buttons set lights + + # should be fine + array i32[1024] set queue 1 set nqueue 0 set squeue + array i32[1024] set steps + queue[0] get lights store + steps[0] 0 store + + `0so` + + u1(1) set cont + while (get cont) { + queue[get squeue 1023&] load set lights + steps[get squeue 1023&] load set s + + #printnum(get nqueue) '+' putc printnum(get squeue) ':' putc printnum(`ls`) ',' putc + #printbin(get lights) ':' putc + + `0si` + while (`li` get nbuttons < get cont &) { + buttons[`li`] load get lights ^ set push + + + if (get push 0 ==) { + println("done") + u1(0) set cont + `ls1+so` + } else { + # push new lights onto queue + queue[get nqueue get squeue+ 1023&] get push store + steps[get nqueue get squeue+ 1023&] `ls1+` store + + #printbin(get push) ',' putc + + inc(nqueue) + } + + inc(i) + } + + #i8(10) putc + # next + inc(squeue) + dec(nqueue) + } + + get o +} + + +i32 bin_brute(i32, ptr i32, i32) { + set nbuttons set buttons set lights + + `1si` + `10000sm` + while (`li` 1 get nbuttons shl <) { + + #`li` printnum i8(10) putc + + `lisj` + `0sO` + `0so` + + get lights + while (`lj` 0 != ) { + if (`lj` 1 & as u1) { + buttons[`lO`] load ^ + inc(o) + } + inc(O) + `lj2/sj` + } + + if (0 ==) { + + if (`lm` `lo` > ) { + `losm` + } + + } + + inc(i) + } + + `lm` + +} + +void _start() { + + open("input", 0, 0) set file + array i8[65535] set buffer + get buffer i8(48) store + read(get file, get buffer, u64(65535)) as i32 set size + + `0so` + `0si` + + array i32[16] set buttons + + # read + while (`li` get size < ) { + + inc(i) # past [ + + + `0ss` + + 0 + while (buffer[`li`] load ']' !=) { + 2* + if (buffer[`li`] load '#' ==) { + 1+ + } + inc(i) + inc(s) + } set lights + + inc(i) # past ']' + inc(i) # past space + + `0sj` + while (buffer[`li`] load '{' !=) { + + inc(i) # past '(' + + buttons[`lj`] 0 + while(buffer[`li1-`] load ')' !=) { + # should be fine + 1 `ls` buffer[`li`] load '0' - as i32 - 1- shl | + inc(i) + inc(i) + #1 atoi(buffer[`li`]) shl | # shift left button and or into + #while (buffer[`li`] load dup '9' < rev '0' > &) {inc(i)} # go past + #inc(i) # past ',' or ')' + } store + + inc(j) # next button + inc(i) # past ' ' + } `lj` set nbutton + + + println("row") + printbin(get lights) i8(10) putc + + `0sj` + while (`lj` get nbutton <) { + printbin(buttons[`lj`] load) ',' putc + inc(j) + } i8(10) putc + + printnum( + bin_brute(get lights, get buttons, get nbutton) + `dlo+so`) i8(10) putc + + + + # next line + while (buffer[`li`] load i8(10) !=) { inc(i) } + inc(i) + + } + + println("answer:") + printnum(`lo`) + + exit(0) +} + +void main() { + _start +} diff --git a/src/plasl/2025/day10/part2.psl b/src/plasl/2025/day10/part2.psl new file mode 100644 index 0000000..8b49de7 --- /dev/null +++ b/src/plasl/2025/day10/part2.psl @@ -0,0 +1,362 @@ + +i64 write(i32, ptr i8, u64) { + `scsbsa` + syscall3(i64(1), `la` as i64, `lb` as i64, `lc` as i64) +} + +i64 read(i32, ptr i8, u64) { + `scsbsa` + syscall3(i64(0), `la` as i64, `lb` as i64, `lc` as i64) +} + +i32 open(ptr i8, i32, i32) { + `scsbsa` + syscall3(i64(2), `la` as i64, `lb` as i64, `lc` as i64) + as i32 +} + +ptr i8 mmap(ptr i8, u64, i32, i32, i32, i64) { + `sfsesdscsbsa` + syscall6(i64(9), `la` as i64, `lb` as i64, `lc` as i64, `ld` as i64, `le` as i64, `lf`) + as ptr i8 +} + +void exit(i32) { + as i64 i64(231) rev + syscall1 trash +} + +void putc(i8) { + array i8[1] `dstr` store + write(1, `lt`, u64(1)) trash +} + +u64 strlen(ptr i8) { + dup while(dup load i8(0) !=) { 1+ } `r-` +} + +void print(ptr i8) { + 1 rev dup strlen write trash +} + +void println(ptr i8) { + print i8(10) putc +} + +void printnum(i32) { + + if (dup 0 ==) { + putc('0') + } else if (dup 0 <) { + `0r-` '-' putc + } + + array i8[11] 10+ dup i8(0) store -1+ `sb` + + while (dup 0 !=) { + 10 divmod 48+ as i8 + `lb` rev store + `lb` -1+ `sb` + } trash + print(`lb`1+) + +} + +void printnum64(u64) { + + if (dup u64(0) ==) { + putc('0') + } + + array i8[22] 21+ dup i8(0) store -1+ `sb` + + while (dup u64(0) !=) { + u64(10) divmod u64(48)+ as i8 + `lb` rev store + `lb` -1+ `sb` + } trash + + print(`lb`1+) + +} + +i32 atoi(ptr i8) { + set string + 0 + while (get string load '0' >= get string load '9' <= &) { + 10* get string load '0'- as i32 + + get string 1+ set string + } +} + +u64 atol(ptr i8) { + set string + u64(0) + while (get string load '0' >= get string load '9' <= &) { + u64(10)* get string load '0'- as u64 + + get string 1+ set string + } +} + +void printbin(i32) { + if (dup 0 ==) { trash '0' putc } else { + array i8[33] 32+ dup i8(0) store -1+ `sb` + + while (dup 0 !=) { + dup 1 & 48+ as i8 `lbr` store + 1 shr + `lb`-1+`sb` + } trash + + print(`lb1+`) + + } +} + + +i32 abs(i32) { + if (dup 0 <) {`0r-`} +} + +ptr i8 memset(ptr i8, i32, u64) { + `sn` as i8 `sc` + + u64(0) `si` + while (`liln` < ) { + `1+dlc` store + inc(i) + } +} + +ptr i8 memcpy(ptr i8, ptr i8, u64) { + `snsssd` + + u64(0) `si` + while (`liln` <) { d[`li`] s[`li`] load store inc(i)} + `ld` + +} + +i32 dfs_brute(ptr i32, i32, ptr i32, i32) { + set njolt set jolt set nbutt set butt + + `0si` + u1(1) set valid + u1(1) set good + while (`li` get njolt < get valid &) { + if (jolt[`li`] load 0 !=) { + u1(0) set good + } + + if (jolt[`li`] load 0 <){ + u1(0) set valid + } + inc(i) + } + + if (get good) { 0 } else if (get valid u1(0) ==) { 10000 } else { + + + `1000000 sm` + + array i32[16] set buff + + `0si` + while (`li` get nbutt <) { + `0so` + butt[`li`] load set j + + #memcpy(get buff as ptr i8, get jolt as ptr i8, 4 16* as u64) trash + + while (`lo` get njolt <) { + buff[`lo`] jolt[`lo`] load + if (`lj` 1 & as u1) { 1- } + store + + inc(o) + `lj2/sj` + } + + dfs_brute(get butt, get nbutt, get buff, get njolt) `1+st` + + if (`lmlt` >) { + `ltsm` + } + + inc(i) + } + + `lm` + } +} + + +void push(ptr i32, ptr i32, i32, i32) { + set butt set njolt set source set dest + + `0so` + while (`lo` get njolt <) { + dest[`lo`] source[`lo`] load + if (get butt 1 & as u1) { 1- } + store + + inc(o) + get butt 1 shr set butt + + } +} + +u1 allzero(ptr i32, i32) { + `snsp0si` + u1(1) + while (`liln` < dup &) { + p[`li`] load 0 == & + inc(i) + } +} + +u1 allpositive(ptr i32, i32) { + `snsp0si` + u1(1) + while (`liln` < dup &) { + p[`li`] load 0 >= & + inc(i) + } +} + + +i32 bfs_brute(ptr i32, i32, ptr i32, i32) { + set njolt set jolt set nbutt set butt + + array i32[65536] set queue + 1 set nqueue 0 set squeue + + array i32[4096] set steps + + steps[0] 0 store + memcpy(queue[0] as ptr i8, get jolt as ptr i8, 4 16* as u64) trash + + `100000so` + u1(1) set cont + while (get cont) { + printnum(get nqueue) '+' putc printnum(get squeue) ':' putc printnum(steps[get squeue] load) i8(10) putc + + queue[get squeue 65535&] set jolt + `0si` + while (`li` get nbutt < get cont &) { + + queue[get nqueue get squeue + 16* 65535&] set next + push(get next, get jolt, get njolt, butt[`li`] load) + + + if (allzero(get next, get njolt)) { + u1(0) set cont + steps[get squeue 4095&] load 1+ `so` + } + + if (allpositive(get jolt, get njolt)) { + + steps[get nqueue get squeue + 4095 &] steps[get squeue 4095 &] load 1+ store + + inc(i) + inc(nqueue) + } + } + + inc(squeue) + + } + `lo` +} + + + + + + + +void _start() { + + open("input.t", 0, 0) set file + array i8[65535] set buffer + get buffer i8(48) store + read(get file, get buffer, u64(65535)) as i32 set size + + array i32[16] set jolt + + `0so` + `0si` + + array i32[16] set buttons + + # read + while (`li` get size < ) { + + while (buffer[`li`] load ']' !=) {inc(i)} + + inc(i) # past ']' + inc(i) # past space + + `0sj` + while (buffer[`li`] load '{' !=) { + + inc(i) # past '(' + + buttons[`lj`] 0 + while(buffer[`li1-`] load ')' !=) { + # should be fine + 1 buffer[`li`] load '0' - as i32 shl | + inc(i) + inc(i) + #1 atoi(buffer[`li`]) shl | # shift left button and or into + #while (buffer[`li`] load dup '9' < rev '0' > &) {inc(i)} # go past + #inc(i) # past ',' or ')' + } store + + inc(j) # next button + inc(i) # past ' ' + } `lj` set nbutton + + `0ss` + while (buffer[`li`] load '}' !=) { + inc(i) + jolt[`ls`] atoi(buffer[`li`]) store + inc(s) + + while (buffer[`li`] load ',' != buffer[`li`] load '}' != &) {inc(i)} + } + + inc(i) + + + println("row") + + `0sj` + while (`lj` get nbutton <) { + printbin(buttons[`lj`] load) ',' putc + inc(j) + } i8(10) putc + + `0sj` + while (`lj` get s <) { + printnum(jolt[`lj`] load) ',' putc + inc(j) + } i8(10) putc + + printnum( + bfs_brute(get buttons, get nbutton, get jolt, get s) + `dlo+so`) i8(10) putc + + + inc(i) + } + + println("answer:") + printnum(`lo`) + + exit(0) +} + +void main() { + _start +}