Initial commit

This commit is contained in:
Dimitri Lozeve 2024-11-12 21:43:32 +01:00
commit f242d2b0df
420 changed files with 62521 additions and 0 deletions

21
2023/day21/day21.bqn Normal file
View file

@ -0,0 +1,21 @@
mninput>•FLines"input"
sm(÷˜|)/input='S'
grid1˙(s)input='.'
dirs-2
•Show {(grid¨)/𝕩+dirs}64s
ps{(mn|grid˙)¨/𝕩+dirs}((m÷2)+m×3)s
# Lagrange polynomial interpolation, arbitrary nodes and values
Lagrange{x𝕊y:
dx
w÷×˝1˙¨((˜¨d))-˜x
{+´y×w××´¨𝕩-¨/x¨¬(d1)¨1+d}
}
f(ps) Lagrange ¨ps
•Show F (26501365-65)÷m
# Lagrange polynomial interpolation with nodes at 0‿1‿2 and values at 𝕩
LagrangeCoeffs{+˝[[1,-3,2],[1,-2,0],[1,-1,0]]×[0.5,¯1,0.5]×𝕩}
•Show (LagrangeCoeffs ¨ps)(+´×(3))(26501365-65)÷m

131
2023/day21/input Normal file
View file

@ -0,0 +1,131 @@
...................................................................................................................................
...............#.....#...#......#...............#.....#...#...........#..#....##.#..#.........#..............#...........#..#......
........#.#..........#.##..#.......#.#.#.......#..#........................#............#...#....#.............#....#.........#....
.....#......#...................#...#......#.............#..............#.#....#.......#...#...#......##.#.#...........#..###......
.........#............#...##.........#.#....#........#..........................#....#.#......#......#....#....#............#.#....
...#.....#................#.#..........#..........#.#.#...........#.......#..............#......#.......##.....#.........##.#......
..........#....................#............#........#............#............#....#..........#.........................#.........
...#.#...................#.#......##..#........#.##.....................................#........##............#.##....#...........
.........................................#...#.......................#...........................#..#........#....##.#...##........
...#.......#...#.......#..#.#.......#.......#........................#........#....#....#...#.#.....#...#...........#........##.#..
..#....#.............#........................#..##.............................#..#.................#....##.......#.......#....#..
.........................#.......#...#...........#..................#..............#.#....#.....#...#........#...........#......#..
............#..................#...#.......#...#.#.........#.......................#............#.......#....#.....#..........#....
..........#........#......##.#.....#...#................#....##...........#................#.......#........#......#...#....#..#...
.................#.......................##...............#.....#.....#............#.................#..........#......#.....#.....
.....#.###................#..........#...................#.##........#...............#....#...............#..#................#.#..
.#..#..........#..................#...................................#......#.................#.#..................#..............
..........#..#...#.#...........#.#..#....................#....................#..........#.#.#.....#....#...........#........#.....
.#.............#.......##.##.........#.#..............#.......#.............#.........................................#....#.#.....
.............#.....#.#........#..........#..............#.....................#..................#..#........#.#.....#...#.........
....#.......#..............#.....#.......#...........#.............#.##..................#.................#..#......#.#...#....#..
..#....#.....#......................#.....................#..........#..##........#.........#.............#......#.................
...##.......#.......#...#..##..................#.........##....................#.#...................................#..#..........
........#.........#..##........................#......#........#...#...#........#......................................#.......#...
....#..#....#.#.#.................#.............#.........#.............#....#................#..#.....#...##.....#.........##.....
...................#................#...............................#.................#...........#.....##.#.......................
.....#........#........#........................#..............#.............................................#........#...#........
.......#............#.................................#.......#........#...#..............................#.....#.#.#......#.#.#...
.....................###....#.#................#.#....#........##.#..#.......#...#............................#..........###....#..
.#.....##.#......#.#........#.#..............#...............#.........#.........#.....#...........#.............................#.
...#.....#...........#.#......#................#..#....#...#..#......#................#....#.............#.#....#..................
..#....##......#.............#...............#.................................#.......#................#...........#.#............
..........#....#....##.......................#.#.#..................#.....#..............#................#..................#.....
.....#......................................#....#......................#..........#........#........................#.............
..#.#..#........#...#..#...................#............#..#...#......#.#...#............#.....#...............#..............#....
..#....#..##..........#...........#......................##................#...#...............................#..#....#........#..
......#........#...................#.#.......#..#.#....#..##...#.........##......#....#..........#....................#....#.......
.#.##.....#.....#..................#.....#..#..#....#....#......#...........#......#....#.........#........##..#.#..##.............
........#..#.....#.....#.......#.#......................#..................#.#.......##...................................#..#.....
..#........#.........................#.......#..............................#.....##.........#..#.##...............................
..............................#....................#......................#.....#..#.............................#..........#......
........#.#.....................#......#.....#.............##...............#....#.#...#..........................#...#....#.......
........#...................#.#.##.##........................#.#........................#...............................#..#...#.#.
.............##.................#......#.#.##.......#.........................#.......................#.................#..........
..##.....#..........................##..........#....#.............................##.....###......#...........................#...
...#.......#...#..............#................#.#.....#..#..................#..#...##....#....#.......#...........#.........#.....
.....#.......#.........#..#.......##.............#.##...#.......#................#..........#............#.................#.......
..............#..........##....................#......#...##..................................#.#.......#.#..............#.........
..#.....#..#.#.............#................#......................#.#.................##.......###.#....#..............##.........
....................#.........#...#............#.#......#..........#........#..........................#..#.#............##........
.......#...#..........#.........#........#....#......###.......#..#.........##....#..............#.......#..#..........#...........
.....##.#.................................#.....#.............#.#.......#..##.............#........................................
.......#..................##.##..#............#......#...#....##........##.#................#....#..#..##..........................
..##.#..............###..#........#...#...#.........#.....................#....#.......##............#...#..................#......
....#..............#...........#.....##................##...##.......#...#....#...#............#..#..............................#.
.........................#.........#..................##................#....#...#...........#......#..#....####.............#.....
.....................#...#....#........#...........#..........#....................#..#..#..........#..............................
.#..................#..................#........#............#.#..............#....#...............#........#....##............##..
...............#....#.#.........#...#.......#...#.......#.......#................#.##................#.................#...........
..............#.#.......#...#....#......#.............#...................##...#.......##......##..................................
..........##.#..#.......##........#.##......#............#.#..##...............#...#.....#...#............#......#.................
........#.#.#........................................##....#..#...............#.......##......#......#...........#..##.............
......................................#........................#.........#.....#...................#...............................
.........................#....#.......#...................#..#..#.#.....#..................#......##.......................#.......
......#....#.......#.............#.........................#........#.#...#.....#..#....#......#....#.#.......#...........#........
.................................................................S.................................................................
...........#...#.....#......................#.......#.............#.#............#.##.#...#........#.......#........#.......##.....
................#..#........#...#.....................#...............#...........................##.....#.........#...............
.............##.##.#...#........#..#...#....................#...#.......................#............#.............................
................#....#.#.#...#...............#...........#..............................##........................#................
.......................................#.....#...........#.........#...................#..#..#.................#.........#.......#.
..#...............#....#.#.#............................#.#..#............#.........#......#........#....#......................#..
...#......................#....#.#....................##..........#......#...#........#....#.....................#.#...........#.#.
...............#...#.................................##...#.#.......#...#...........#...................#...........#..............
................#......#.............#.#...##...##......#......#..#..........#..#......#...........................................
..................#.#.....#.##.....#....#..........................##.#.#....#.........#...#.....#........#...##.#...............#.
........................#...#..............#....#.......#......#......#......#..#...............##.............##..................
..#...##.............#..................#....#.......................#..........#...##......................#..#..#..........#...#.
....##.#..........#...#..........#.......#...#............#.#.........#..#...#.#.......##......#..###..#.........#.................
.........#.............#...#..........#........#..##..................#..#.........................#.....#...#..............#......
.......#...#.............#.#....###................#...#.................#.#.............#..................##...............#.....
....#....##..............#......#.....#.....#...#..#............#...##.......#.#....#...#........##.#..#...............#...#.......
.#..#....#............#.........#...........#......#...#............#...........#......##....#........#..........................#.
....###...#.................#.......#............#.#.........#...................#.##............#....................#............
........#...............................#..........#................#......#....#.............#..........##..........#.....#..##...
....#.....###...................##..##.##...#..##...##...#....#.......#..................#........#..#...................#.........
..#.#............#................#...#.#.......#.........#.....#.#.....#.............#.....#..#.....................#..##.........
............#.#..#....................#.....#..........#.#...................#....................#..#.......................#..#..
....#....#.....#..................##................#..#...#.......##...............#.....##..#................#..##..##...#.......
..................#..............................##................#....#....#........................................#...#...##...
.............##........................#....#........##......#.............#.#...#................#..........#..#.#.....#.......#..
....#.#..#...#..#..................#..#..#..#.#......#..#..#.#.....####......#...........##.#....#..#..............#............#..
.#...#.................................#............##...#....................#.#..#....#.......#................#..#..........#...
..#.................#.................#...................#.#.......#....#...............#......#.#...............#................
......###.....#.........#.................#.#.............#..#..#.......#.....#.............................#....##..##..#.........
..........###....#.#.#....#........#............###..#.........#....#...........#.......#......#........#......#....#............#.
.....##...#.#.##....................##...#.#..#......#.......#......#...#........#.....................#.......#......#.....##.....
.#.....#..#...............................#....#.................................##...................#.......#...............#....
.....................##.....#...................#......................#.#..#................................##....................
....#....#..........#........#.........#...##..........#.....#..#..#.............#..##....................................#........
..........#.#.............#.................#............#.....#......#...............................#.................#....#.#...
......#...#.#.....#.#.##..#.#............###....#.....#................##......#.......#..#....................#.....#.............
.....#....#....................#.....................#..........#.....#.............#..#.......................#.#.................
......#....#...............................#...#........#.......................#....................##...#..#......#...##....#....
....#..............#...........#................#.#......#........##...#..#....###..................#.........#.............#......
......#....#....#.....#..##.#.#.............##.......#.......#....#...##..........................#....###...#...#.............#...
.#....##......#........#.#..........#..........................................#................#..................#...............
..#......#...#....#.......##.....#.....................#.....#.#..#...#...#......#.......................................#..#......
......#..............#.......#.#..........................#.............#.......#.#.............#......#....................#..#...
..#...#.........................#.#....#............................#.....................#.....#.................#................
...................##......#.....#.............................#......##....#............#...#......................#..............
......#...#..#.##.............#........#..#.........##...#....#......#..#......#..........#...........#..........#.#..#.#..........
.#..#..#.........#.......#.......#.........#..........##...##...#.#...#........................................#....#..............
.#..#.#.#....#......#................#........................#.#.....#........................#...#......................#......#.
...............##...............##....................#..#.#.........................#.......#.......#...........#............#....
..........#.........#.#.............#....#..#.#.............##....#......#.#.........................#..#.....#.......#........#...
....##......#...#.............................#...............#......#................#.....................................#......
....###.#..#.......#...................#....#..........................#..#..................#.....#....#.....#................#.#.
............#.#..#.#.###........##..#.##...........................#.................#.#.............#.............#.....##........
..#......#................................#.#.....................#......................#........#.....#.....#.#...#.....#........
.............#..........#.#.##......#..#....................##................................#..............#......#...........##.
.....#...#..............#..#....#..#..............................#..........................#.###..............#...##.....##......
.#...#..#.......#.#...............#....#.....#..#....#..............#...................................................#.#.#......
.......##.........#.#....#...........#.....#....#...............#....................#..................##......#........#.........
...#.#.....#....#.................#..#................#........#..................#......#............#....#...........#..#........
.....#...#..................#.......#.........#...#....#...................#...##..#.#....#....#.##..#..##.##..................#...
.....................#..#...#.....#............#..........................#.##.....................#..#...#......##.....#.....#....
..#........#.......##.#..............#..##................................#..#.#....#.....#...............#.................#.#....
...#.................................#.........#...........................#....##.#...................#......##.................#.
.........#..........#.#......#....##....#.#...#.........#................................#....#..#..............#....##...#........
...................................................................................................................................

11
2023/day21/test Normal file
View file

@ -0,0 +1,11 @@
...........
.....###.#.
.###.##..#.
..#.#...#..
....#.#....
.##..S####.
.##..#...#.
.......##..
.##.#.####.
.##..##.##.
...........