├── go
├── 2015
│ ├── days
│ │ ├── day02
│ │ │ ├── small.txt
│ │ │ └── exemple.txt
│ │ ├── day04
│ │ │ ├── input.txt
│ │ │ └── day04_test.go
│ │ ├── day12
│ │ │ ├── exemple7.txt
│ │ │ ├── exemple8.txt
│ │ │ ├── exemple1.txt
│ │ │ ├── exemple3.txt
│ │ │ ├── exemple11.txt
│ │ │ ├── exemple5.txt
│ │ │ ├── exemple6.txt
│ │ │ ├── exemple2.txt
│ │ │ ├── exemple4.txt
│ │ │ ├── exemple9.txt
│ │ │ └── exemple10.txt
│ │ ├── day05
│ │ │ ├── part2test2.txt
│ │ │ ├── small.txt
│ │ │ ├── part2test1.txt
│ │ │ ├── part2test3.txt
│ │ │ └── part2test4.txt
│ │ ├── day07
│ │ │ ├── small1.txt
│ │ │ ├── small.txt
│ │ │ ├── exemple.txt
│ │ │ └── day07_test.go
│ │ ├── day10
│ │ │ ├── input.txt
│ │ │ └── day10_test.go
│ │ ├── day11
│ │ │ ├── input.txt
│ │ │ ├── exemple1.txt
│ │ │ └── exemple2.txt
│ │ ├── day20
│ │ │ ├── input.txt
│ │ │ └── day20_test.go
│ │ ├── day17
│ │ │ ├── exemple.txt
│ │ │ ├── input.txt
│ │ │ └── day17_test.go
│ │ ├── day22
│ │ │ ├── small.txt
│ │ │ ├── exemple1.txt
│ │ │ ├── exemple2.txt
│ │ │ ├── exemple3.txt
│ │ │ ├── input.txt
│ │ │ ├── input2.txt
│ │ │ └── input3.txt
│ │ ├── day08
│ │ │ └── exemple.txt
│ │ ├── day16
│ │ │ ├── exemple.txt
│ │ │ └── MFCSAM.txt
│ │ ├── day21
│ │ │ ├── input.txt
│ │ │ ├── input2.txt
│ │ │ ├── shop.txt
│ │ │ └── day21_test.go
│ │ ├── day23
│ │ │ ├── exemple.txt
│ │ │ ├── input.txt
│ │ │ ├── input2.txt
│ │ │ └── day23_test.go
│ │ ├── day19
│ │ │ ├── exemple.txt
│ │ │ ├── exemple3.txt
│ │ │ ├── exemple2.txt
│ │ │ ├── day19_test.go
│ │ │ └── input.txt
│ │ ├── day18
│ │ │ └── exemple.txt
│ │ ├── day24
│ │ │ ├── exemple.txt
│ │ │ └── input.txt
│ │ ├── day09
│ │ │ ├── exemple.txt
│ │ │ └── input.txt
│ │ ├── day25
│ │ │ ├── input.txt
│ │ │ └── day25_test.go
│ │ ├── day15
│ │ │ ├── exemple.txt
│ │ │ └── input.txt
│ │ ├── day14
│ │ │ ├── exemple.txt
│ │ │ └── input.txt
│ │ ├── day01
│ │ │ ├── day01_test.go
│ │ │ └── day01.go
│ │ ├── MAKEDAY
│ │ ├── day13
│ │ │ └── exemple.txt
│ │ ├── CLEANALL
│ │ └── day06
│ │ │ └── day06_test.go
│ └── TEMPLATES
│ │ ├── minmax.go
│ │ ├── permutations.go
│ │ ├── TEST.go
│ │ └── INIT.go
├── 2016
│ └── days
│ │ ├── d13
│ │ ├── example.txt
│ │ ├── input.txt
│ │ └── altsol.py
│ │ ├── d25
│ │ └── example.txt
│ │ ├── d01
│ │ ├── e1.txt
│ │ ├── e2.txt
│ │ ├── e3.txt
│ │ ├── e4.txt
│ │ └── input.txt
│ │ ├── d05
│ │ ├── example.txt
│ │ └── input.txt
│ │ ├── d14
│ │ ├── example.txt
│ │ └── input.txt
│ │ ├── d17
│ │ ├── ex1.txt
│ │ ├── ex2.txt
│ │ ├── ex3.txt
│ │ ├── example.txt
│ │ └── input.txt
│ │ ├── d19
│ │ ├── example.txt
│ │ ├── input.txt
│ │ └── heuristics.sh
│ │ ├── d07
│ │ ├── ex1.txt
│ │ ├── ex2.txt
│ │ ├── ex3.txt
│ │ ├── ex5.txt
│ │ ├── ex6.txt
│ │ ├── ex7.txt
│ │ ├── ex8.txt
│ │ ├── example.txt
│ │ └── ex4.txt
│ │ ├── d18
│ │ ├── ex1.txt
│ │ ├── example.txt
│ │ └── input.txt
│ │ ├── d09
│ │ └── example.txt
│ │ ├── d16
│ │ ├── example.txt
│ │ └── input.txt
│ │ ├── d20
│ │ └── example.txt
│ │ ├── d04
│ │ ├── ex2.txt
│ │ └── example.txt
│ │ ├── d02
│ │ └── example.txt
│ │ ├── d12
│ │ ├── example.txt
│ │ └── input.txt
│ │ ├── d23
│ │ └── example.txt
│ │ ├── d24
│ │ ├── example.txt
│ │ └── permutations.go
│ │ ├── d08
│ │ └── example.txt
│ │ ├── d03
│ │ └── example.txt
│ │ ├── d22
│ │ ├── example3.txt
│ │ ├── example2.txt
│ │ ├── example4.txt
│ │ └── example.txt
│ │ ├── d15
│ │ ├── example.txt
│ │ └── input.txt
│ │ ├── d06
│ │ └── example.txt
│ │ ├── d10
│ │ └── example.txt
│ │ ├── d11
│ │ ├── example.txt
│ │ └── input.txt
│ │ ├── d21
│ │ └── example.txt
│ │ └── MAKEDAY
├── 2017
│ └── days
│ │ ├── d23
│ │ └── example.txt
│ │ ├── d01
│ │ ├── example1.txt
│ │ ├── example2.txt
│ │ ├── example3.txt
│ │ ├── example21.txt
│ │ ├── example22.txt
│ │ ├── example23.txt
│ │ ├── example24.txt
│ │ ├── example25.txt
│ │ ├── example4.txt
│ │ └── README.md
│ │ ├── d03
│ │ ├── example1.txt
│ │ ├── example2.txt
│ │ ├── example3.txt
│ │ └── example4.txt
│ │ ├── d09
│ │ ├── example1.txt
│ │ ├── example2.txt
│ │ ├── example3.txt
│ │ ├── example4.txt
│ │ ├── example5.txt
│ │ ├── example6.txt
│ │ ├── example8.txt
│ │ ├── example7.txt
│ │ └── README.md
│ │ ├── d17
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d06
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d11
│ │ ├── example.txt
│ │ ├── example2.txt
│ │ ├── example1.txt
│ │ └── example3.txt
│ │ ├── d14
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d10
│ │ ├── example-p2-1.txt
│ │ ├── example-p2-3.txt
│ │ ├── example-p2-4.txt
│ │ ├── example-p2-2.txt
│ │ ├── example.txt
│ │ ├── README.md
│ │ └── axialcoords.png
│ │ ├── d16
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d22
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d02
│ │ ├── example.txt
│ │ ├── example2.txt
│ │ └── README.md
│ │ ├── d05
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d13
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d04
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d07
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d08
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d12
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d15
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d19
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d20
│ │ ├── README.md
│ │ ├── example.txt
│ │ └── example2.txt
│ │ ├── d24
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d25
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d21
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d18
│ │ ├── example2.txt
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── go.mod
│ │ ├── go.sum
│ │ └── MAKEDAY
├── 2018
│ └── days
│ │ ├── d09
│ │ ├── example.txt
│ │ ├── example1.txt
│ │ ├── example2.txt
│ │ ├── example3.txt
│ │ ├── example4.txt
│ │ ├── example5.txt
│ │ └── README.md
│ │ ├── d11
│ │ ├── example.txt
│ │ ├── example2.txt
│ │ └── README.md
│ │ ├── d14
│ │ ├── example.txt
│ │ ├── example1.txt
│ │ ├── example2.txt
│ │ ├── example3.txt
│ │ ├── example21.txt
│ │ └── README.md
│ │ ├── d01
│ │ ├── example3.txt
│ │ ├── example.txt
│ │ ├── example1.txt
│ │ ├── example2.txt
│ │ └── README.md
│ │ ├── d05
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d08
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d13
│ │ ├── example1.txt
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d02
│ │ ├── README.md
│ │ ├── example2.txt
│ │ └── example.txt
│ │ ├── d03
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d04
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d06
│ │ ├── README.md
│ │ ├── example.txt
│ │ └── d06_test.go
│ │ ├── d07
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d10
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d12
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── go.mod
│ │ ├── go.sum
│ │ └── MAKEDAY
├── 2022
│ └── days
│ │ ├── d06
│ │ ├── example.txt
│ │ ├── ex1.txt
│ │ ├── ex2.txt
│ │ ├── ex3.txt
│ │ ├── ex4.txt
│ │ └── ex5.txt
│ │ ├── d08
│ │ ├── example.txt
│ │ └── ex.txt
│ │ ├── d09
│ │ ├── example.txt
│ │ └── ex.txt
│ │ ├── d13
│ │ ├── ex1.txt
│ │ ├── ex2.txt
│ │ └── example.txt
│ │ ├── d18
│ │ ├── ex1.txt
│ │ └── example.txt
│ │ ├── d12
│ │ ├── ex1.txt
│ │ └── example.txt
│ │ ├── d02
│ │ └── example.txt
│ │ ├── d10
│ │ └── ex1.txt
│ │ ├── d22
│ │ ├── ex1.txt
│ │ └── example.txt
│ │ ├── d17
│ │ └── example.txt
│ │ ├── d20
│ │ └── example.txt
│ │ ├── d23
│ │ ├── ex.txt
│ │ └── example.txt
│ │ ├── d14
│ │ └── example.txt
│ │ ├── d04
│ │ └── example.txt
│ │ ├── d24
│ │ ├── ex.txt
│ │ ├── example.txt
│ │ └── d24
│ │ ├── d16
│ │ ├── ex1.txt
│ │ ├── ex2.txt
│ │ └── example.txt
│ │ ├── d01
│ │ └── example.txt
│ │ ├── d25
│ │ └── example.txt
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── d03
│ │ └── example.txt
│ │ ├── d05
│ │ └── example.txt
│ │ ├── d21
│ │ └── example.txt
│ │ ├── d07
│ │ └── example.txt
│ │ ├── d19
│ │ └── example.txt
│ │ ├── d11
│ │ └── example.txt
│ │ ├── MAKEDAY
│ │ ├── d15
│ │ └── example.txt
│ │ └── CLEANALL
├── 2023
│ └── days
│ │ ├── d15
│ │ ├── example-hash.txt
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d06
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d10
│ │ ├── example1f.txt
│ │ ├── example1s.txt
│ │ ├── example2f.txt
│ │ ├── example2s.txt
│ │ ├── example-p2e2.txt
│ │ ├── example-p2e1.txt
│ │ ├── example-p2e3.txt
│ │ ├── example-p2e4.txt
│ │ └── README.md
│ │ ├── d13
│ │ ├── README.md
│ │ ├── exemple1.txt
│ │ ├── sample2.txt
│ │ ├── sample3.txt
│ │ ├── sample1.txt
│ │ └── example.txt
│ │ ├── d16
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d20
│ │ ├── README.md
│ │ ├── example1.txt
│ │ └── example2.txt
│ │ ├── d01
│ │ ├── example.txt
│ │ ├── example2.txt
│ │ └── README.md
│ │ ├── d09
│ │ ├── example.txt
│ │ ├── INPUT.txt
│ │ ├── README.md
│ │ └── sol1.py
│ │ ├── d07
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d18
│ │ ├── example0.txt
│ │ ├── example1.txt
│ │ └── example.txt
│ │ ├── d08
│ │ ├── example2.txt
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d22
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d12
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d03
│ │ └── example.txt
│ │ ├── d11
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d14
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d24
│ │ └── example.txt
│ │ ├── d21
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d17
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d25
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── go.mod
│ │ ├── d04
│ │ └── example.txt
│ │ ├── d02
│ │ └── example.txt
│ │ ├── d23
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d19
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d05
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── go.sum
│ │ └── MAKEDAY
├── 2024
│ └── days
│ │ ├── d12
│ │ ├── example0.txt
│ │ ├── example1.txt
│ │ ├── README.md
│ │ ├── example2.txt
│ │ ├── example4.txt
│ │ ├── example5.txt
│ │ └── example3.txt
│ │ ├── d21
│ │ ├── example1.txt
│ │ ├── example2.txt
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d22
│ │ ├── example1.txt
│ │ ├── example3.txt
│ │ ├── example6.txt
│ │ ├── example.txt
│ │ ├── example2.txt
│ │ ├── example4.txt
│ │ ├── example5.txt
│ │ └── README.md
│ │ ├── d11
│ │ ├── example2.txt
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d09
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d10
│ │ ├── example3.txt
│ │ ├── example1.txt
│ │ ├── README.md
│ │ └── example2.txt
│ │ ├── d15
│ │ ├── example2.txt
│ │ ├── example3.txt
│ │ ├── README.md
│ │ ├── example4.txt
│ │ ├── example1.txt
│ │ └── example.txt
│ │ ├── d14
│ │ ├── example1.txt
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d01
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d02
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d03
│ │ ├── README.md
│ │ ├── example.txt
│ │ └── example2.txt
│ │ ├── d04
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d05
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d06
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d07
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d08
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d13
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d16
│ │ ├── README.md
│ │ ├── example.txt
│ │ └── example2.txt
│ │ ├── d18
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d19
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d20
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d23
│ │ ├── README.md
│ │ ├── example1.txt
│ │ ├── example.txt
│ │ └── d23_test.go
│ │ ├── d24
│ │ ├── README.md
│ │ ├── full-adder-circuit.png
│ │ ├── example1.txt
│ │ ├── example3.txt
│ │ ├── example2.txt
│ │ └── example.txt
│ │ ├── d25
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d17
│ │ ├── example.txt
│ │ └── example2.txt
│ │ ├── go.mod
│ │ ├── go.sum
│ │ └── MAKEDAY
├── 2025
│ └── days
│ │ ├── d09
│ │ └── example.txt
│ │ ├── d03
│ │ ├── example.txt
│ │ ├── README.md
│ │ └── d03_test.go
│ │ ├── d06
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d01
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d05
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d02
│ │ ├── README.md
│ │ ├── example.txt
│ │ └── d02_test.go
│ │ ├── d04
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d08
│ │ ├── README.md
│ │ └── example.txt
│ │ ├── d11
│ │ ├── example.txt
│ │ ├── example2.txt
│ │ └── README.md
│ │ ├── d10
│ │ └── example.txt
│ │ ├── go.mod
│ │ ├── d12
│ │ ├── example.txt
│ │ └── README.md
│ │ ├── d07
│ │ ├── example.txt
│ │ └── README.md
│ │ └── go.sum
├── TEMPLATES
│ ├── README-DD.md
│ ├── minmax.go
│ ├── parsing.go
│ ├── TEST.go
│ └── README.md
├── MAKEYEAR
└── README.md
├── bash
├── 2021
│ └── days
│ │ ├── d18.example1
│ │ ├── d16.example01
│ │ ├── d16.example21
│ │ ├── d16.example26
│ │ ├── d25.small1
│ │ ├── d06.example
│ │ ├── d16.example02
│ │ ├── d16.example03
│ │ ├── d16.example22
│ │ ├── d16.example23
│ │ ├── d16.example24
│ │ ├── d16.example25
│ │ ├── d16.example27
│ │ ├── d18.example2
│ │ ├── d18.small1
│ │ ├── d07.example
│ │ ├── d16.example1
│ │ ├── d18.explode1
│ │ ├── d18.explode2
│ │ ├── d18.explode3
│ │ ├── d09.small
│ │ ├── d15.small
│ │ ├── d16.example2
│ │ ├── d16.example28
│ │ ├── d16.example3
│ │ ├── d17.example
│ │ ├── d18.small2
│ │ ├── d18.small3
│ │ ├── d18.small4
│ │ ├── d18.small5
│ │ ├── d18.split1
│ │ ├── d16.example4
│ │ ├── d17.input
│ │ ├── d18.split2
│ │ ├── d24.small
│ │ ├── d18.explode4
│ │ ├── d18.small6
│ │ ├── d25.small2
│ │ ├── d21.input
│ │ ├── d12.example1
│ │ ├── d21.example
│ │ ├── d02.example
│ │ ├── d09.example
│ │ ├── EXECALL
│ │ ├── d23.input
│ │ ├── d25.small3
│ │ ├── d01.example
│ │ ├── d08.example-1
│ │ ├── d23.example
│ │ ├── d23.goal
│ │ ├── d12.example2
│ │ ├── d22.small
│ │ ├── d03.example
│ │ ├── d24.example
│ │ ├── d25.example
│ │ ├── d05.example
│ │ ├── d11.example
│ │ ├── d11.input
│ │ ├── d15.example
│ │ ├── d13.small
│ │ ├── d12.example3
│ │ ├── d13.example
│ │ ├── d14.example
│ │ ├── d12.input
│ │ ├── CHECKALL
│ │ ├── d10.example
│ │ ├── d04.example
│ │ ├── d25-2.sh
│ │ ├── d18.example3
│ │ ├── d01-1.sh
│ │ ├── d24-2.sh
│ │ ├── d19.small
│ │ ├── d02-1.sh
│ │ ├── d06-2.sh
│ │ ├── d20.example2
│ │ ├── d06.input
│ │ ├── d01-2.sh
│ │ ├── d20.example
│ │ ├── d08-1.sh
│ │ ├── d02-2.sh
│ │ ├── d22.example
│ │ ├── d08.example
│ │ ├── MAKEDAY
│ │ ├── d17-1.sh
│ │ ├── d06-other1.sh
│ │ ├── d07-1.sh
│ │ ├── d21-1.sh
│ │ └── d16.input
└── README.md
├── README.md
└── LICENSE
/go/2016/days/d13/example.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/go/2016/days/d25/example.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/go/2017/days/d23/example.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/go/2022/days/d06/example.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/go/2022/days/d08/example.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/go/2022/days/d09/example.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.example1:
--------------------------------------------------------------------------------
1 | [9,1]
2 |
--------------------------------------------------------------------------------
/go/2015/days/day02/small.txt:
--------------------------------------------------------------------------------
1 | 2x3x4
2 |
--------------------------------------------------------------------------------
/go/2015/days/day04/input.txt:
--------------------------------------------------------------------------------
1 | ckczppom
--------------------------------------------------------------------------------
/go/2015/days/day12/exemple7.txt:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/go/2015/days/day12/exemple8.txt:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/go/2016/days/d01/e1.txt:
--------------------------------------------------------------------------------
1 | R2, L3
2 |
--------------------------------------------------------------------------------
/go/2016/days/d01/e2.txt:
--------------------------------------------------------------------------------
1 | R2, R2, R2
2 |
--------------------------------------------------------------------------------
/go/2016/days/d05/example.txt:
--------------------------------------------------------------------------------
1 | abc
2 |
--------------------------------------------------------------------------------
/go/2016/days/d13/input.txt:
--------------------------------------------------------------------------------
1 | 1362
2 |
--------------------------------------------------------------------------------
/go/2016/days/d14/example.txt:
--------------------------------------------------------------------------------
1 | abc
2 |
--------------------------------------------------------------------------------
/go/2016/days/d17/ex1.txt:
--------------------------------------------------------------------------------
1 | ihgpwlah
2 |
--------------------------------------------------------------------------------
/go/2016/days/d17/ex2.txt:
--------------------------------------------------------------------------------
1 | kglvqrro
2 |
--------------------------------------------------------------------------------
/go/2016/days/d17/ex3.txt:
--------------------------------------------------------------------------------
1 | ulqzkmiv
2 |
--------------------------------------------------------------------------------
/go/2016/days/d17/example.txt:
--------------------------------------------------------------------------------
1 | hijkl
2 |
--------------------------------------------------------------------------------
/go/2016/days/d19/example.txt:
--------------------------------------------------------------------------------
1 | 5
2 |
--------------------------------------------------------------------------------
/go/2016/days/d19/input.txt:
--------------------------------------------------------------------------------
1 | 3004953
2 |
--------------------------------------------------------------------------------
/go/2017/days/d01/example1.txt:
--------------------------------------------------------------------------------
1 | 1122
2 |
--------------------------------------------------------------------------------
/go/2017/days/d01/example2.txt:
--------------------------------------------------------------------------------
1 | 1111
2 |
--------------------------------------------------------------------------------
/go/2017/days/d01/example3.txt:
--------------------------------------------------------------------------------
1 | 1234
2 |
--------------------------------------------------------------------------------
/go/2017/days/d03/example1.txt:
--------------------------------------------------------------------------------
1 | 1
2 |
--------------------------------------------------------------------------------
/go/2017/days/d03/example2.txt:
--------------------------------------------------------------------------------
1 | 12
2 |
--------------------------------------------------------------------------------
/go/2017/days/d03/example3.txt:
--------------------------------------------------------------------------------
1 | 23
2 |
--------------------------------------------------------------------------------
/go/2017/days/d03/example4.txt:
--------------------------------------------------------------------------------
1 | 1024
2 |
--------------------------------------------------------------------------------
/go/2017/days/d09/example1.txt:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/go/2017/days/d17/example.txt:
--------------------------------------------------------------------------------
1 | 3
2 |
--------------------------------------------------------------------------------
/go/2018/days/d09/example.txt:
--------------------------------------------------------------------------------
1 | 9 25
2 |
--------------------------------------------------------------------------------
/go/2018/days/d11/example.txt:
--------------------------------------------------------------------------------
1 | 18
2 |
--------------------------------------------------------------------------------
/go/2018/days/d11/example2.txt:
--------------------------------------------------------------------------------
1 | 42
2 |
--------------------------------------------------------------------------------
/go/2018/days/d14/example.txt:
--------------------------------------------------------------------------------
1 | 9
2 |
--------------------------------------------------------------------------------
/go/2018/days/d14/example1.txt:
--------------------------------------------------------------------------------
1 | 5
2 |
--------------------------------------------------------------------------------
/go/2018/days/d14/example2.txt:
--------------------------------------------------------------------------------
1 | 18
2 |
--------------------------------------------------------------------------------
/go/2018/days/d14/example3.txt:
--------------------------------------------------------------------------------
1 | 2018
2 |
--------------------------------------------------------------------------------
/go/2024/days/d12/example0.txt:
--------------------------------------------------------------------------------
1 | A
2 |
--------------------------------------------------------------------------------
/go/2024/days/d21/example1.txt:
--------------------------------------------------------------------------------
1 | 029A
2 |
--------------------------------------------------------------------------------
/go/2024/days/d21/example2.txt:
--------------------------------------------------------------------------------
1 | 379A
2 |
--------------------------------------------------------------------------------
/go/2024/days/d22/example1.txt:
--------------------------------------------------------------------------------
1 | 123
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example01:
--------------------------------------------------------------------------------
1 | D2FE28
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example21:
--------------------------------------------------------------------------------
1 | C200B40A82
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example26:
--------------------------------------------------------------------------------
1 | F600BC2D8F
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d25.small1:
--------------------------------------------------------------------------------
1 | ...>>>>>...
2 |
--------------------------------------------------------------------------------
/go/2015/days/day05/part2test2.txt:
--------------------------------------------------------------------------------
1 | xxyxx
2 |
--------------------------------------------------------------------------------
/go/2015/days/day05/small.txt:
--------------------------------------------------------------------------------
1 | aabcdefgaa
2 |
--------------------------------------------------------------------------------
/go/2015/days/day07/small1.txt:
--------------------------------------------------------------------------------
1 | 3 -> a
2 |
--------------------------------------------------------------------------------
/go/2015/days/day10/input.txt:
--------------------------------------------------------------------------------
1 | 1321131112
2 |
--------------------------------------------------------------------------------
/go/2015/days/day11/input.txt:
--------------------------------------------------------------------------------
1 | hepxcrrq
2 |
--------------------------------------------------------------------------------
/go/2015/days/day12/exemple1.txt:
--------------------------------------------------------------------------------
1 | [1,2,3]
2 |
--------------------------------------------------------------------------------
/go/2015/days/day12/exemple3.txt:
--------------------------------------------------------------------------------
1 | [[[3]]]
2 |
--------------------------------------------------------------------------------
/go/2015/days/day20/input.txt:
--------------------------------------------------------------------------------
1 | 36000000
2 |
--------------------------------------------------------------------------------
/go/2016/days/d01/e3.txt:
--------------------------------------------------------------------------------
1 | R5, L5, R5, R3
2 |
--------------------------------------------------------------------------------
/go/2016/days/d01/e4.txt:
--------------------------------------------------------------------------------
1 | R8, R4, R4, R8
2 |
--------------------------------------------------------------------------------
/go/2016/days/d05/input.txt:
--------------------------------------------------------------------------------
1 | ugkcyxxp
2 |
--------------------------------------------------------------------------------
/go/2016/days/d07/ex1.txt:
--------------------------------------------------------------------------------
1 | abba[mnop]qrst
2 |
--------------------------------------------------------------------------------
/go/2016/days/d07/ex2.txt:
--------------------------------------------------------------------------------
1 | abcd[bddb]xyyx
2 |
--------------------------------------------------------------------------------
/go/2016/days/d07/ex3.txt:
--------------------------------------------------------------------------------
1 | aaaa[qwer]tyui
2 |
--------------------------------------------------------------------------------
/go/2016/days/d07/ex5.txt:
--------------------------------------------------------------------------------
1 | aba[bab]xyz
2 |
--------------------------------------------------------------------------------
/go/2016/days/d07/ex6.txt:
--------------------------------------------------------------------------------
1 | xyx[xyx]xyx
2 |
--------------------------------------------------------------------------------
/go/2016/days/d07/ex7.txt:
--------------------------------------------------------------------------------
1 | aaa[kek]eke
2 |
--------------------------------------------------------------------------------
/go/2016/days/d07/ex8.txt:
--------------------------------------------------------------------------------
1 | zazbz[bzb]cdb
2 |
--------------------------------------------------------------------------------
/go/2016/days/d14/input.txt:
--------------------------------------------------------------------------------
1 | zpqevtbw
2 |
--------------------------------------------------------------------------------
/go/2016/days/d17/input.txt:
--------------------------------------------------------------------------------
1 | qzthpkfp
2 |
--------------------------------------------------------------------------------
/go/2016/days/d18/ex1.txt:
--------------------------------------------------------------------------------
1 | 3
2 | ..^^.
3 |
--------------------------------------------------------------------------------
/go/2017/days/d01/example21.txt:
--------------------------------------------------------------------------------
1 | 1212
2 |
--------------------------------------------------------------------------------
/go/2017/days/d01/example22.txt:
--------------------------------------------------------------------------------
1 | 1221
2 |
--------------------------------------------------------------------------------
/go/2017/days/d01/example23.txt:
--------------------------------------------------------------------------------
1 | 123425
2 |
--------------------------------------------------------------------------------
/go/2017/days/d01/example24.txt:
--------------------------------------------------------------------------------
1 | 123123
2 |
--------------------------------------------------------------------------------
/go/2017/days/d01/example25.txt:
--------------------------------------------------------------------------------
1 | 12131415
2 |
--------------------------------------------------------------------------------
/go/2017/days/d01/example4.txt:
--------------------------------------------------------------------------------
1 | 91212129
2 |
--------------------------------------------------------------------------------
/go/2017/days/d06/example.txt:
--------------------------------------------------------------------------------
1 | 0 2 7 0
2 |
--------------------------------------------------------------------------------
/go/2017/days/d09/example2.txt:
--------------------------------------------------------------------------------
1 | {{{}}}
2 |
--------------------------------------------------------------------------------
/go/2017/days/d09/example3.txt:
--------------------------------------------------------------------------------
1 | {{},{}}
2 |
--------------------------------------------------------------------------------
/go/2017/days/d11/example.txt:
--------------------------------------------------------------------------------
1 | ne,ne,ne
2 |
--------------------------------------------------------------------------------
/go/2017/days/d11/example2.txt:
--------------------------------------------------------------------------------
1 | ne,ne,s,s
2 |
--------------------------------------------------------------------------------
/go/2017/days/d14/example.txt:
--------------------------------------------------------------------------------
1 | flqrgnkx
2 |
--------------------------------------------------------------------------------
/go/2018/days/d01/example3.txt:
--------------------------------------------------------------------------------
1 | -1, -2, 3
2 |
--------------------------------------------------------------------------------
/go/2018/days/d09/example1.txt:
--------------------------------------------------------------------------------
1 | 10 1618
2 |
--------------------------------------------------------------------------------
/go/2018/days/d09/example2.txt:
--------------------------------------------------------------------------------
1 | 13 7999
2 |
--------------------------------------------------------------------------------
/go/2018/days/d09/example3.txt:
--------------------------------------------------------------------------------
1 | 17 1104
2 |
--------------------------------------------------------------------------------
/go/2018/days/d09/example4.txt:
--------------------------------------------------------------------------------
1 | 21 6111
2 |
--------------------------------------------------------------------------------
/go/2018/days/d09/example5.txt:
--------------------------------------------------------------------------------
1 | 30 5807
2 |
--------------------------------------------------------------------------------
/go/2018/days/d14/example21.txt:
--------------------------------------------------------------------------------
1 | 51589
2 |
--------------------------------------------------------------------------------
/go/2022/days/d13/ex1.txt:
--------------------------------------------------------------------------------
1 | [7]
2 | [5]
3 |
--------------------------------------------------------------------------------
/go/2022/days/d13/ex2.txt:
--------------------------------------------------------------------------------
1 | [5]
2 | [6]
3 |
--------------------------------------------------------------------------------
/go/2023/days/d15/example-hash.txt:
--------------------------------------------------------------------------------
1 | HASH
2 |
--------------------------------------------------------------------------------
/go/2024/days/d11/example2.txt:
--------------------------------------------------------------------------------
1 | 125 17
2 |
--------------------------------------------------------------------------------
/go/2024/days/d22/example3.txt:
--------------------------------------------------------------------------------
1 | 3363619
2 |
--------------------------------------------------------------------------------
/go/2024/days/d22/example6.txt:
--------------------------------------------------------------------------------
1 | 19751
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d06.example:
--------------------------------------------------------------------------------
1 | 3,4,3,1,2
2 |
3 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example02:
--------------------------------------------------------------------------------
1 | 38006F45291200
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example03:
--------------------------------------------------------------------------------
1 | EE00D40C823060
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example22:
--------------------------------------------------------------------------------
1 | 04005AC33890
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example23:
--------------------------------------------------------------------------------
1 | 880086C3E88112
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example24:
--------------------------------------------------------------------------------
1 | CE00C43D881120
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example25:
--------------------------------------------------------------------------------
1 | D8005AC2A8F0
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example27:
--------------------------------------------------------------------------------
1 | 9C005AC2F8F0
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.example2:
--------------------------------------------------------------------------------
1 | [[9,1],[1,9]]
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.small1:
--------------------------------------------------------------------------------
1 | [[1,2],[[3,4],5]]
2 |
--------------------------------------------------------------------------------
/go/2015/days/day11/exemple1.txt:
--------------------------------------------------------------------------------
1 | abcdefgh
2 |
--------------------------------------------------------------------------------
/go/2015/days/day11/exemple2.txt:
--------------------------------------------------------------------------------
1 | ghijklmn
2 |
--------------------------------------------------------------------------------
/go/2015/days/day12/exemple11.txt:
--------------------------------------------------------------------------------
1 | [1,"red",5]
2 |
--------------------------------------------------------------------------------
/go/2015/days/day12/exemple5.txt:
--------------------------------------------------------------------------------
1 | {"a":[-1,1]}
2 |
--------------------------------------------------------------------------------
/go/2015/days/day12/exemple6.txt:
--------------------------------------------------------------------------------
1 | [-1,{"a":1}]
2 |
--------------------------------------------------------------------------------
/go/2016/days/d07/example.txt:
--------------------------------------------------------------------------------
1 | abba[mnop]qrst
2 |
--------------------------------------------------------------------------------
/go/2016/days/d09/example.txt:
--------------------------------------------------------------------------------
1 | X(8x2)(3x3)ABCY
2 |
--------------------------------------------------------------------------------
/go/2016/days/d16/example.txt:
--------------------------------------------------------------------------------
1 | 20
2 | 10000
3 |
--------------------------------------------------------------------------------
/go/2017/days/d09/example4.txt:
--------------------------------------------------------------------------------
1 | {{{},{},{{}}}}
2 |
--------------------------------------------------------------------------------
/go/2017/days/d10/example-p2-1.txt:
--------------------------------------------------------------------------------
1 |
2 | 256
3 |
--------------------------------------------------------------------------------
/go/2017/days/d11/example1.txt:
--------------------------------------------------------------------------------
1 | ne,ne,sw,sw
2 |
--------------------------------------------------------------------------------
/go/2017/days/d11/example3.txt:
--------------------------------------------------------------------------------
1 | se,sw,se,sw,sw
2 |
--------------------------------------------------------------------------------
/go/2018/days/d01/example.txt:
--------------------------------------------------------------------------------
1 | +1, -2, +3, +1
2 |
--------------------------------------------------------------------------------
/go/2018/days/d01/example1.txt:
--------------------------------------------------------------------------------
1 | +1, +1, +1
2 |
--------------------------------------------------------------------------------
/go/2018/days/d01/example2.txt:
--------------------------------------------------------------------------------
1 | +1, +1, -2
2 |
--------------------------------------------------------------------------------
/go/2022/days/d18/ex1.txt:
--------------------------------------------------------------------------------
1 | 1,1,1
2 | 2,1,1
3 |
--------------------------------------------------------------------------------
/go/2024/days/d11/example.txt:
--------------------------------------------------------------------------------
1 | 0 1 10 99 999
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d07.example:
--------------------------------------------------------------------------------
1 | 16,1,2,0,4,2,7,1,2,14
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example1:
--------------------------------------------------------------------------------
1 | 8A004A801A8002F478
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.explode1:
--------------------------------------------------------------------------------
1 | [[[[[9,8],1],2],3],4]
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.explode2:
--------------------------------------------------------------------------------
1 | [7,[6,[5,[4,[3,2]]]]]
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.explode3:
--------------------------------------------------------------------------------
1 | [[6,[5,[4,[3,2]]]],1]
2 |
--------------------------------------------------------------------------------
/go/2015/days/day02/exemple.txt:
--------------------------------------------------------------------------------
1 | 2x3x4
2 | 1x1x10
3 |
--------------------------------------------------------------------------------
/go/2015/days/day12/exemple2.txt:
--------------------------------------------------------------------------------
1 | {"a":2,"b":4}
2 |
--------------------------------------------------------------------------------
/go/2016/days/d07/ex4.txt:
--------------------------------------------------------------------------------
1 | ioxxoj[asdfgh]zxcvbn
2 |
--------------------------------------------------------------------------------
/go/2016/days/d18/example.txt:
--------------------------------------------------------------------------------
1 | 10
2 | .^^.^.^^^^
3 |
--------------------------------------------------------------------------------
/go/2016/days/d20/example.txt:
--------------------------------------------------------------------------------
1 | 5-8
2 | 0-2
3 | 4-7
4 |
--------------------------------------------------------------------------------
/go/2017/days/d09/example5.txt:
--------------------------------------------------------------------------------
1 | {,,,}
2 |
--------------------------------------------------------------------------------
/go/2017/days/d10/example-p2-3.txt:
--------------------------------------------------------------------------------
1 | 1,2,3
2 | 256
3 |
--------------------------------------------------------------------------------
/go/2017/days/d10/example-p2-4.txt:
--------------------------------------------------------------------------------
1 | 1,2,4
2 | 256
3 |
--------------------------------------------------------------------------------
/go/2017/days/d16/example.txt:
--------------------------------------------------------------------------------
1 | s1,x3/4,pe/b
2 | 5
3 |
--------------------------------------------------------------------------------
/go/2017/days/d22/example.txt:
--------------------------------------------------------------------------------
1 | ..#
2 | #..
3 | ...
4 |
--------------------------------------------------------------------------------
/go/2018/days/d05/example.txt:
--------------------------------------------------------------------------------
1 | dabAcCaCBAcCcaDA
2 |
--------------------------------------------------------------------------------
/go/2022/days/d12/ex1.txt:
--------------------------------------------------------------------------------
1 | babc
2 | dSEe
3 | fghj
4 |
--------------------------------------------------------------------------------
/go/2024/days/d09/example.txt:
--------------------------------------------------------------------------------
1 | 2333133121414131402
2 |
--------------------------------------------------------------------------------
/go/2024/days/d10/example3.txt:
--------------------------------------------------------------------------------
1 | 201
2 | 312
3 | 543
4 |
--------------------------------------------------------------------------------
/go/2024/days/d15/example2.txt:
--------------------------------------------------------------------------------
1 | @OO.#
2 |
3 | >
4 |
--------------------------------------------------------------------------------
/go/2024/days/d15/example3.txt:
--------------------------------------------------------------------------------
1 | @OO.#
2 |
3 | >>>>
4 |
--------------------------------------------------------------------------------
/bash/2021/days/d09.small:
--------------------------------------------------------------------------------
1 | 01234
2 | 12949
3 | 29999
4 |
--------------------------------------------------------------------------------
/bash/2021/days/d15.small:
--------------------------------------------------------------------------------
1 | 19999
2 | 19111
3 | 11191
4 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example2:
--------------------------------------------------------------------------------
1 | 620080001611562C8802118E34
2 |
--------------------------------------------------------------------------------
/go/2015/days/day05/part2test1.txt:
--------------------------------------------------------------------------------
1 | qjhvhtzxzqqjkmpb
2 |
--------------------------------------------------------------------------------
/go/2015/days/day05/part2test3.txt:
--------------------------------------------------------------------------------
1 | uurcxstgmygtbstg
2 |
--------------------------------------------------------------------------------
/go/2015/days/day05/part2test4.txt:
--------------------------------------------------------------------------------
1 | ieodomkazucvgmuy
2 |
--------------------------------------------------------------------------------
/go/2015/days/day12/exemple4.txt:
--------------------------------------------------------------------------------
1 | {"a":{"b":4},"c":-1}
2 |
--------------------------------------------------------------------------------
/go/2016/days/d16/input.txt:
--------------------------------------------------------------------------------
1 | 272
2 | 10001001100000001
3 |
--------------------------------------------------------------------------------
/go/2017/days/d10/example-p2-2.txt:
--------------------------------------------------------------------------------
1 | AoC 2017
2 | 256
3 |
--------------------------------------------------------------------------------
/go/2017/days/d10/example.txt:
--------------------------------------------------------------------------------
1 | 3, 4, 1, 5
2 | 5
3 |
4 |
--------------------------------------------------------------------------------
/go/2022/days/d02/example.txt:
--------------------------------------------------------------------------------
1 | A Y
2 | B X
3 | C Z
4 |
5 |
--------------------------------------------------------------------------------
/go/2022/days/d06/ex1.txt:
--------------------------------------------------------------------------------
1 | bvwbjplbgvbhsrlpgdmjqwftvncz
2 |
--------------------------------------------------------------------------------
/go/2022/days/d06/ex2.txt:
--------------------------------------------------------------------------------
1 | nppdvjthqldpwncqszvftbrmjlhg
2 |
--------------------------------------------------------------------------------
/go/2022/days/d10/ex1.txt:
--------------------------------------------------------------------------------
1 | noop
2 | addx 3
3 | addx -5
4 |
--------------------------------------------------------------------------------
/go/2024/days/d22/example.txt:
--------------------------------------------------------------------------------
1 | 1
2 | 10
3 | 100
4 | 2024
5 |
--------------------------------------------------------------------------------
/go/2024/days/d22/example2.txt:
--------------------------------------------------------------------------------
1 | 1
2 | 2
3 | 3
4 | 2024
5 |
--------------------------------------------------------------------------------
/go/2024/days/d22/example4.txt:
--------------------------------------------------------------------------------
1 | 2021
2 | 5017
3 | 19751
4 |
--------------------------------------------------------------------------------
/go/2024/days/d22/example5.txt:
--------------------------------------------------------------------------------
1 | 5053
2 | 10083
3 | 11263
4 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example28:
--------------------------------------------------------------------------------
1 | 9C0141080250320F1802104A08
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example3:
--------------------------------------------------------------------------------
1 | C0015000016115A2E0802F182340
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d17.example:
--------------------------------------------------------------------------------
1 | target area: x=20..30, y=-10..-5
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.small2:
--------------------------------------------------------------------------------
1 | [[[[0,7],4],[[7,8],[6,0]]],[8,1]]
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.small3:
--------------------------------------------------------------------------------
1 | [[[[1,1],[2,2]],[3,3]],[4,4]]
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.small4:
--------------------------------------------------------------------------------
1 | [[[[3,0],[5,3]],[4,4]],[5,5]]
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.small5:
--------------------------------------------------------------------------------
1 | [[[[5,0],[7,4]],[5,5]],[6,6]]
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.split1:
--------------------------------------------------------------------------------
1 | [[[[0,7],4],[15,[0,13]]],[1,1]]
2 |
--------------------------------------------------------------------------------
/go/2015/days/day12/exemple9.txt:
--------------------------------------------------------------------------------
1 | [1,{"c":"red","b":2},3]
2 |
--------------------------------------------------------------------------------
/go/2015/days/day17/exemple.txt:
--------------------------------------------------------------------------------
1 | 20
2 | 15
3 | 10
4 | 5
5 | 5
6 |
--------------------------------------------------------------------------------
/go/2015/days/day22/small.txt:
--------------------------------------------------------------------------------
1 | Hit Points: 1
2 | Damage: 1
3 |
--------------------------------------------------------------------------------
/go/2016/days/d04/ex2.txt:
--------------------------------------------------------------------------------
1 | qzmt-zixmtkozy-ivhz-343[zimth]
2 |
--------------------------------------------------------------------------------
/go/2017/days/d02/example.txt:
--------------------------------------------------------------------------------
1 | 5 1 9 5
2 | 7 5 3
3 | 2 4 6 8
4 |
--------------------------------------------------------------------------------
/go/2017/days/d05/example.txt:
--------------------------------------------------------------------------------
1 | 0
2 | 3
3 | 0
4 | 1
5 | -3
6 |
--------------------------------------------------------------------------------
/go/2017/days/d09/example6.txt:
--------------------------------------------------------------------------------
1 | {{},{},{},{}}
2 |
--------------------------------------------------------------------------------
/go/2017/days/d09/example8.txt:
--------------------------------------------------------------------------------
1 | {{},{},{},{}}
2 |
--------------------------------------------------------------------------------
/go/2022/days/d06/ex3.txt:
--------------------------------------------------------------------------------
1 | nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg
2 |
--------------------------------------------------------------------------------
/go/2022/days/d06/ex4.txt:
--------------------------------------------------------------------------------
1 | zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw
2 |
--------------------------------------------------------------------------------
/go/2022/days/d06/ex5.txt:
--------------------------------------------------------------------------------
1 | mjqjpqmgbljsphdztnvjfqwrcgsmlb
2 |
--------------------------------------------------------------------------------
/go/2024/days/d14/example1.txt:
--------------------------------------------------------------------------------
1 | w=11, h=7
2 | p=2,4 v=2,-3
3 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.example4:
--------------------------------------------------------------------------------
1 | A0016C880162017C3686B18A3D4780
2 |
3 |
--------------------------------------------------------------------------------
/bash/2021/days/d17.input:
--------------------------------------------------------------------------------
1 | target area: x=195..238, y=-93..-67
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.split2:
--------------------------------------------------------------------------------
1 | [[[[0,7],4],[[7,8],[0,13]]],[1,1]]
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d24.small:
--------------------------------------------------------------------------------
1 | inp z
2 | inp x
3 | mul z 3
4 | eql z x
5 |
--------------------------------------------------------------------------------
/go/2015/days/day07/small.txt:
--------------------------------------------------------------------------------
1 | 3 -> x
2 | 6 -> y
3 | x AND y -> a
4 |
--------------------------------------------------------------------------------
/go/2015/days/day12/exemple10.txt:
--------------------------------------------------------------------------------
1 | {"d":"red","e":[1,2,3,4],"f":5}
2 |
--------------------------------------------------------------------------------
/go/2015/days/day22/exemple1.txt:
--------------------------------------------------------------------------------
1 | Hit Points: 13
2 | Damage: 8
3 |
--------------------------------------------------------------------------------
/go/2015/days/day22/exemple2.txt:
--------------------------------------------------------------------------------
1 | Hit Points: 14
2 | Damage: 8
3 |
--------------------------------------------------------------------------------
/go/2016/days/d02/example.txt:
--------------------------------------------------------------------------------
1 | ULL
2 | RRDDD
3 | LURDL
4 | UUUUD
5 |
--------------------------------------------------------------------------------
/go/2017/days/d02/example2.txt:
--------------------------------------------------------------------------------
1 | 5 9 2 8
2 | 9 4 7 3
3 | 3 8 6 5
4 |
--------------------------------------------------------------------------------
/go/2017/days/d09/example7.txt:
--------------------------------------------------------------------------------
1 | {{},{},{},{}}
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d13/example.txt:
--------------------------------------------------------------------------------
1 | 0: 3
2 | 1: 2
3 | 4: 4
4 | 6: 4
5 |
--------------------------------------------------------------------------------
/go/2018/days/d08/example.txt:
--------------------------------------------------------------------------------
1 | 2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2
2 |
--------------------------------------------------------------------------------
/go/2022/days/d22/ex1.txt:
--------------------------------------------------------------------------------
1 | .#
2 | #.
3 | #..
4 |
5 | 1R2L3R4L
6 |
--------------------------------------------------------------------------------
/go/2024/days/d10/example1.txt:
--------------------------------------------------------------------------------
1 | 0123
2 | 1234
3 | 8765
4 | 9876
5 |
--------------------------------------------------------------------------------
/go/2024/days/d12/example1.txt:
--------------------------------------------------------------------------------
1 | AAAA
2 | BBCD
3 | BBCC
4 | EEEC
5 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.explode4:
--------------------------------------------------------------------------------
1 | [[3,[2,[1,[7,3]]]],[6,[5,[4,[3,2]]]]]
2 |
--------------------------------------------------------------------------------
/go/2015/days/day08/exemple.txt:
--------------------------------------------------------------------------------
1 | ""
2 | "abc"
3 | "aaa\"aaa"
4 | "\x27"
5 |
--------------------------------------------------------------------------------
/go/2018/days/d13/example1.txt:
--------------------------------------------------------------------------------
1 | |
2 | v
3 | |
4 | |
5 | |
6 | ^
7 | |
8 |
--------------------------------------------------------------------------------
/go/2022/days/d08/ex.txt:
--------------------------------------------------------------------------------
1 | 30373
2 | 25512
3 | 65332
4 | 33549
5 | 35390
6 |
--------------------------------------------------------------------------------
/go/2022/days/d17/example.txt:
--------------------------------------------------------------------------------
1 | >>><<><>><<<>><>>><<<>>><<<><<<>><>><<>>
2 |
--------------------------------------------------------------------------------
/go/2022/days/d20/example.txt:
--------------------------------------------------------------------------------
1 | 1
2 | 2
3 | -3
4 | 3
5 | -2
6 | 0
7 | 4
8 |
--------------------------------------------------------------------------------
/go/2024/days/d21/example.txt:
--------------------------------------------------------------------------------
1 | 029A
2 | 980A
3 | 179A
4 | 456A
5 | 379A
6 |
--------------------------------------------------------------------------------
/go/2015/days/day16/exemple.txt:
--------------------------------------------------------------------------------
1 | Sue 76: samoyeds: 9, perfumes: 1, trees: 6
2 |
--------------------------------------------------------------------------------
/go/2015/days/day21/input.txt:
--------------------------------------------------------------------------------
1 | Hit Points: 109
2 | Damage: 8
3 | Armor: 2
4 |
--------------------------------------------------------------------------------
/go/2015/days/day21/input2.txt:
--------------------------------------------------------------------------------
1 | Hit Points: 109
2 | Damage: 8
3 | Armor: 2
4 |
--------------------------------------------------------------------------------
/go/2015/days/day23/exemple.txt:
--------------------------------------------------------------------------------
1 | inc b
2 | jio b, +2
3 | tpl b
4 | inc b
5 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.small6:
--------------------------------------------------------------------------------
1 | [[[[8,7],[7,7]],[[8,6],[7,7]]],[[[0,7],[6,6]],[8,7]]]
2 |
--------------------------------------------------------------------------------
/go/2015/days/day19/exemple.txt:
--------------------------------------------------------------------------------
1 | H => HO
2 | H => OH
3 | O => HH
4 |
5 | HOH
6 |
--------------------------------------------------------------------------------
/go/2015/days/day22/exemple3.txt:
--------------------------------------------------------------------------------
1 | Hit Points: 24
2 | Damage: 9
3 | # mana -1: 318
4 |
--------------------------------------------------------------------------------
/go/2017/days/d01/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d01
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d02/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d02
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d04/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d04
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d05/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d05
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d06/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d06
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d07/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d07
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d08/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d08
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d09/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d09
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d10/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d10
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d12/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d12
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d13/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d13
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d14/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d14
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d15/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d15
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d16/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d16
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d19/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d19
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d20/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d20
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d22/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d22
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d24/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d24
2 |
3 |
--------------------------------------------------------------------------------
/go/2017/days/d25/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d25
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d01/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d01
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d02/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d02
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d03/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d03
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d03/example.txt:
--------------------------------------------------------------------------------
1 | #1 @ 1,3: 4x4
2 | #2 @ 3,1: 4x4
3 | #3 @ 5,5: 2x2
4 |
--------------------------------------------------------------------------------
/go/2018/days/d04/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d04
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d05/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d05
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d06/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d06
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d06/example.txt:
--------------------------------------------------------------------------------
1 | 1, 1
2 | 1, 6
3 | 8, 3
4 | 3, 4
5 | 5, 5
6 | 8, 9
7 |
--------------------------------------------------------------------------------
/go/2018/days/d07/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d07
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d08/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d08
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d09/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d09
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d10/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d10
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d11/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d11
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d12/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d12
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d13/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d13
2 |
3 |
--------------------------------------------------------------------------------
/go/2018/days/d14/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2018, in GO, day d14
2 |
3 |
--------------------------------------------------------------------------------
/go/2022/days/d23/ex.txt:
--------------------------------------------------------------------------------
1 | .....
2 | ..##.
3 | ..#..
4 | .....
5 | ..##.
6 | .....
7 |
--------------------------------------------------------------------------------
/go/2023/days/d06/example.txt:
--------------------------------------------------------------------------------
1 | Time: 7 15 30
2 | Distance: 9 40 200
3 |
--------------------------------------------------------------------------------
/go/2023/days/d10/example1f.txt:
--------------------------------------------------------------------------------
1 | -L|F7
2 | 7S-7|
3 | L|7||
4 | -L-J|
5 | L|-JF
6 |
--------------------------------------------------------------------------------
/go/2023/days/d10/example1s.txt:
--------------------------------------------------------------------------------
1 | .....
2 | .S-7.
3 | .|.|.
4 | .L-J.
5 | .....
6 |
--------------------------------------------------------------------------------
/go/2023/days/d10/example2f.txt:
--------------------------------------------------------------------------------
1 | ..F7.
2 | .FJ|.
3 | SJ.L7
4 | |F--J
5 | LJ...
6 |
--------------------------------------------------------------------------------
/go/2023/days/d10/example2s.txt:
--------------------------------------------------------------------------------
1 | ..F7.
2 | .FJ|.
3 | SJ.L7
4 | |F--J
5 | LJ...
6 |
--------------------------------------------------------------------------------
/go/2023/days/d13/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d13
2 |
3 |
--------------------------------------------------------------------------------
/go/2023/days/d16/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d16
2 |
3 |
--------------------------------------------------------------------------------
/go/2023/days/d20/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d20
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d01/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d01
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d02/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d02
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d03/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d03
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d04/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d04
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d05/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d05
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d06/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d06
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d07/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d07
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d08/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d08
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d09/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d09
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d10/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d10
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d11/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d11
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d12/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d12
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d12/example2.txt:
--------------------------------------------------------------------------------
1 | OOOOO
2 | OXOXO
3 | OOOOO
4 | OXOXO
5 | OOOOO
6 |
--------------------------------------------------------------------------------
/go/2024/days/d12/example4.txt:
--------------------------------------------------------------------------------
1 | EEEEE
2 | EXXXX
3 | EEEEE
4 | EXXXX
5 | EEEEE
6 |
--------------------------------------------------------------------------------
/go/2024/days/d13/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d13
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d14/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d14
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d15/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d15
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d16/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d16
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d18/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d18
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d19/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d19
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d20/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d20
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d21/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d21
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d22/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d22
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d23/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d23
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d24/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d24
2 |
3 |
--------------------------------------------------------------------------------
/go/2024/days/d25/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2024, in GO, day d25
2 |
3 |
--------------------------------------------------------------------------------
/bash/2021/days/d25.small2:
--------------------------------------------------------------------------------
1 | ..........
2 | .>v....v..
3 | .......>..
4 | ..........
5 |
--------------------------------------------------------------------------------
/go/2017/days/d04/example.txt:
--------------------------------------------------------------------------------
1 | aa bb cc dd ee
2 | aa bb cc dd aa
3 | aa bb cc dd aaa
4 |
--------------------------------------------------------------------------------
/go/2022/days/d09/ex.txt:
--------------------------------------------------------------------------------
1 | R 4
2 | U 4
3 | L 3
4 | D 1
5 | R 4
6 | D 1
7 | L 5
8 | R 2
9 |
--------------------------------------------------------------------------------
/go/2023/days/d01/example.txt:
--------------------------------------------------------------------------------
1 | 1abc2
2 | pqr3stu8vwx
3 | a1b2c3d4e5f
4 | treb7uchet
5 |
--------------------------------------------------------------------------------
/go/2023/days/d09/example.txt:
--------------------------------------------------------------------------------
1 | 0 3 6 9 12 15
2 | 1 3 6 10 15 21
3 | 10 13 16 21 30 45
4 |
--------------------------------------------------------------------------------
/go/2023/days/d15/example.txt:
--------------------------------------------------------------------------------
1 | rn=1,cm-,qp=3,cm=2,qp-,pc=4,ot=9,ab=5,pc-,pc=6,ot=7
2 |
--------------------------------------------------------------------------------
/go/2024/days/d01/example.txt:
--------------------------------------------------------------------------------
1 | 3 4
2 | 4 3
3 | 2 5
4 | 1 3
5 | 3 9
6 | 3 3
7 |
--------------------------------------------------------------------------------
/bash/2021/days/d21.input:
--------------------------------------------------------------------------------
1 | Player 1 starting position: 7
2 | Player 2 starting position: 3
3 |
--------------------------------------------------------------------------------
/go/2016/days/d12/example.txt:
--------------------------------------------------------------------------------
1 | cpy 41 a
2 | inc a
3 | inc a
4 | dec a
5 | jnz a 2
6 | dec a
7 |
--------------------------------------------------------------------------------
/go/2017/days/d15/example.txt:
--------------------------------------------------------------------------------
1 | Generator A starts with 65
2 | Generator B starts with 8921
3 |
--------------------------------------------------------------------------------
/go/2017/days/d21/example.txt:
--------------------------------------------------------------------------------
1 | ../.# => ##./#../...
2 | .#./..#/### => #..#/..../..../#..#
3 |
--------------------------------------------------------------------------------
/go/2022/days/d12/example.txt:
--------------------------------------------------------------------------------
1 | Sabqponm
2 | abcryxxl
3 | accszExk
4 | acctuvwj
5 | abdefghi
6 |
--------------------------------------------------------------------------------
/go/2022/days/d14/example.txt:
--------------------------------------------------------------------------------
1 | 498,4 -> 498,6 -> 496,6
2 | 503,4 -> 502,4 -> 502,9 -> 494,9
3 |
--------------------------------------------------------------------------------
/bash/2021/days/d12.example1:
--------------------------------------------------------------------------------
1 | start-A
2 | start-b
3 | A-c
4 | A-b
5 | b-d
6 | A-end
7 | b-end
8 |
--------------------------------------------------------------------------------
/bash/2021/days/d21.example:
--------------------------------------------------------------------------------
1 | Player 1 starting position: 4
2 | Player 2 starting position: 8
3 |
--------------------------------------------------------------------------------
/go/2015/days/day18/exemple.txt:
--------------------------------------------------------------------------------
1 | .#.#.#
2 | ...##.
3 | #....#
4 | ..#...
5 | #.#..#
6 | ####..
7 |
--------------------------------------------------------------------------------
/go/2017/days/d24/example.txt:
--------------------------------------------------------------------------------
1 | 0/2
2 | 2/2
3 | 2/3
4 | 3/4
5 | 3/5
6 | 0/1
7 | 10/1
8 | 9/10
9 |
--------------------------------------------------------------------------------
/go/2023/days/d07/example.txt:
--------------------------------------------------------------------------------
1 | 32T3K 765
2 | T55J5 684
3 | KK677 28
4 | KTJJT 220
5 | QQQJA 483
6 |
--------------------------------------------------------------------------------
/go/2024/days/d12/example5.txt:
--------------------------------------------------------------------------------
1 | AAAAAA
2 | AAABBA
3 | AAABBA
4 | ABBAAA
5 | ABBAAA
6 | AAAAAA
7 |
--------------------------------------------------------------------------------
/go/2025/days/d09/example.txt:
--------------------------------------------------------------------------------
1 | 7,1
2 | 11,1
3 | 11,7
4 | 9,7
5 | 9,5
6 | 2,5
7 | 2,3
8 | 7,3
9 |
--------------------------------------------------------------------------------
/bash/2021/days/d02.example:
--------------------------------------------------------------------------------
1 | forward 5
2 | down 5
3 | forward 8
4 | up 3
5 | down 8
6 | forward 2
7 |
--------------------------------------------------------------------------------
/bash/2021/days/d09.example:
--------------------------------------------------------------------------------
1 | 2199943210
2 | 3987894921
3 | 9856789892
4 | 8767896789
5 | 9899965678
6 |
--------------------------------------------------------------------------------
/go/2015/days/day19/exemple3.txt:
--------------------------------------------------------------------------------
1 | e => H
2 | e => O
3 | H => HO
4 | H => OH
5 | O => HH
6 |
7 | HOH
8 |
--------------------------------------------------------------------------------
/go/2015/days/day22/input.txt:
--------------------------------------------------------------------------------
1 | Hit Points: 71
2 | Damage: 10
3 | # mana -1: 1824
4 | # mana: 1937
5 |
--------------------------------------------------------------------------------
/go/2015/days/day24/exemple.txt:
--------------------------------------------------------------------------------
1 | 1
2 | 2
3 | 3
4 | 4
5 | 5
6 | 7
7 | 8
8 | 9
9 | 10
10 | 11
11 |
--------------------------------------------------------------------------------
/go/2016/days/d23/example.txt:
--------------------------------------------------------------------------------
1 | cpy 2 a
2 | tgl a
3 | tgl a
4 | tgl a
5 | cpy 1 a
6 | dec a
7 | dec a
8 |
--------------------------------------------------------------------------------
/go/2017/days/d18/example2.txt:
--------------------------------------------------------------------------------
1 | snd 1
2 | snd 2
3 | snd p
4 | rcv a
5 | rcv b
6 | rcv c
7 | rcv d
8 |
--------------------------------------------------------------------------------
/go/2018/days/d02/example2.txt:
--------------------------------------------------------------------------------
1 | abcde
2 | fghij
3 | klmno
4 | pqrst
5 | fguij
6 | axcye
7 | wvxyz
8 |
--------------------------------------------------------------------------------
/go/2022/days/d04/example.txt:
--------------------------------------------------------------------------------
1 | 2-4,6-8
2 | 2-3,4-5
3 | 5-7,7-9
4 | 2-8,3-7
5 | 6-6,4-6
6 | 2-6,4-8
7 |
--------------------------------------------------------------------------------
/go/2023/days/d18/example0.txt:
--------------------------------------------------------------------------------
1 | R 2 (#000020)
2 | D 2 (#000021)
3 | L 2 (#000022)
4 | U 2 (#000023)
5 |
--------------------------------------------------------------------------------
/go/2024/days/d23/example1.txt:
--------------------------------------------------------------------------------
1 | aa-ab
2 | aa-ae
3 | ab-ae
4 | ab-ac
5 | ac-ad
6 | ad-ae
7 | ad-af
8 |
--------------------------------------------------------------------------------
/bash/2021/days/EXECALL:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | for i in d*.sh; do
3 | echo "# $i:"
4 | ./"$i"
5 | done
6 |
--------------------------------------------------------------------------------
/go/2015/days/day19/exemple2.txt:
--------------------------------------------------------------------------------
1 | e => H
2 | e => O
3 | H => HO
4 | H => OH
5 | O => HH
6 |
7 | HOHOHO
8 |
--------------------------------------------------------------------------------
/go/2016/days/d24/example.txt:
--------------------------------------------------------------------------------
1 | ###########
2 | #0.1.....2#
3 | #.#######.#
4 | #4.......3#
5 | ###########
6 |
--------------------------------------------------------------------------------
/go/2017/days/d20/example.txt:
--------------------------------------------------------------------------------
1 | p=< 3,0,0>, v=< 2,0,0>, a=<-1,0,0>
2 | p=< 4,0,0>, v=< 0,0,0>, a=<-2,0,0>
3 |
--------------------------------------------------------------------------------
/go/2018/days/d02/example.txt:
--------------------------------------------------------------------------------
1 | abcdef
2 | bababc
3 | abbcde
4 | abcccd
5 | aabcdd
6 | abcdee
7 | ababab
8 |
--------------------------------------------------------------------------------
/go/2022/days/d24/ex.txt:
--------------------------------------------------------------------------------
1 | #.#####
2 | #.....#
3 | #>....#
4 | #.....#
5 | #...v.#
6 | #.....#
7 | #####.#
8 |
--------------------------------------------------------------------------------
/go/2022/days/d24/example.txt:
--------------------------------------------------------------------------------
1 | #.######
2 | #>>.<^<#
3 | #.<..<<#
4 | #>v.><>#
5 | #<^v^^>#
6 | ######.#
7 |
--------------------------------------------------------------------------------
/go/2023/days/d08/example2.txt:
--------------------------------------------------------------------------------
1 | LLR
2 |
3 | AAA = (BBB, BBB)
4 | BBB = (AAA, ZZZ)
5 | ZZZ = (ZZZ, ZZZ)
6 |
--------------------------------------------------------------------------------
/go/2023/days/d18/example1.txt:
--------------------------------------------------------------------------------
1 | R 100 (#001000)
2 | D 2 (#000021)
3 | L 100 (#001002)
4 | U 2 (#000023)
5 |
--------------------------------------------------------------------------------
/go/2023/days/d20/example1.txt:
--------------------------------------------------------------------------------
1 | broadcaster -> a, b, c
2 | %a -> b
3 | %b -> c
4 | %c -> inv
5 | &inv -> a
6 |
--------------------------------------------------------------------------------
/go/2024/days/d03/example.txt:
--------------------------------------------------------------------------------
1 | xmul(2,4)%&mul[3,7]!@^do_not_mul(5,5)+mul(32,64]then(mul(11,8)mul(8,5))
2 |
--------------------------------------------------------------------------------
/go/2024/days/d03/example2.txt:
--------------------------------------------------------------------------------
1 | xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5))
2 |
--------------------------------------------------------------------------------
/go/2025/days/d03/example.txt:
--------------------------------------------------------------------------------
1 | 987654321111111
2 | 811111111111119
3 | 234234234234278
4 | 818181911112111
5 |
--------------------------------------------------------------------------------
/go/2025/days/d06/example.txt:
--------------------------------------------------------------------------------
1 | 123 328 51 64
2 | 45 64 387 23
3 | 6 98 215 314
4 | * + * +
5 |
--------------------------------------------------------------------------------
/bash/2021/days/d23.input:
--------------------------------------------------------------------------------
1 | #############
2 | #...........#
3 | ###B#B#C#D###
4 | #D#C#A#A#
5 | #########
6 |
--------------------------------------------------------------------------------
/bash/2021/days/d25.small3:
--------------------------------------------------------------------------------
1 | ...>...
2 | .......
3 | ......>
4 | v.....>
5 | ......>
6 | .......
7 | ..vvv..
8 |
--------------------------------------------------------------------------------
/go/2015/days/day09/exemple.txt:
--------------------------------------------------------------------------------
1 | London to Dublin = 464
2 | London to Belfast = 518
3 | Dublin to Belfast = 141
4 |
--------------------------------------------------------------------------------
/go/2022/days/d23/example.txt:
--------------------------------------------------------------------------------
1 | ....#..
2 | ..###.#
3 | #...#.#
4 | .#...##
5 | #.###..
6 | ##.#.##
7 | .#..#..
8 |
--------------------------------------------------------------------------------
/go/2024/days/d02/example.txt:
--------------------------------------------------------------------------------
1 | 7 6 4 2 1
2 | 1 2 7 8 9
3 | 9 7 6 2 1
4 | 1 3 2 4 5
5 | 8 6 4 4 1
6 | 1 3 6 7 9
7 |
--------------------------------------------------------------------------------
/bash/2021/days/d01.example:
--------------------------------------------------------------------------------
1 | 199
2 | 200
3 | 208
4 | 210
5 | 200
6 | 207
7 | 240
8 | 269
9 | 260
10 | 263
11 |
--------------------------------------------------------------------------------
/bash/2021/days/d08.example-1:
--------------------------------------------------------------------------------
1 | acedgfb cdfbe gcdfa fbcad dab cefabd cdfgeb eafb cagedb ab | cdfeb fcadb cdfeb cdbaf
2 |
--------------------------------------------------------------------------------
/bash/2021/days/d23.example:
--------------------------------------------------------------------------------
1 | #############
2 | #...........#
3 | ###B#C#B#D###
4 | #A#D#C#A#
5 | #########
6 |
7 |
--------------------------------------------------------------------------------
/bash/2021/days/d23.goal:
--------------------------------------------------------------------------------
1 | #############
2 | #...........#
3 | ###A#B#C#D###
4 | #A#B#C#D#
5 | #########
6 |
7 |
--------------------------------------------------------------------------------
/go/2015/days/day22/input2.txt:
--------------------------------------------------------------------------------
1 | Hit Points: 58
2 | Damage: 9
3 | # source: devjobe
4 | # mana -1: 1269
5 | # mana: 1309
--------------------------------------------------------------------------------
/go/2022/days/d24/d24:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ColasNahaboo/advent-of-code-my-solutions/HEAD/go/2022/days/d24/d24
--------------------------------------------------------------------------------
/go/2023/days/d20/example2.txt:
--------------------------------------------------------------------------------
1 | broadcaster -> a
2 | %a -> inv, con
3 | &inv -> b
4 | %b -> con
5 | &con -> output
6 |
--------------------------------------------------------------------------------
/go/2024/days/d17/example.txt:
--------------------------------------------------------------------------------
1 | Register A: 729
2 | Register B: 0
3 | Register C: 0
4 |
5 | Program: 0,1,5,4,3,0
6 |
--------------------------------------------------------------------------------
/go/2024/days/d17/example2.txt:
--------------------------------------------------------------------------------
1 | Register A: 2024
2 | Register B: 0
3 | Register C: 0
4 |
5 | Program: 0,3,5,4,3,0
6 |
--------------------------------------------------------------------------------
/go/2025/days/d01/example.txt:
--------------------------------------------------------------------------------
1 | L68
2 | L30
3 | R48
4 | L5
5 | R60
6 | L55
7 | L1
8 | L99
9 | R14
10 | L82
11 |
--------------------------------------------------------------------------------
/go/2015/days/day22/input3.txt:
--------------------------------------------------------------------------------
1 | Hit Points: 55
2 | Damage: 8
3 | # source: schwern
4 | # mana -1: 953
5 | # mana: 1289
6 |
--------------------------------------------------------------------------------
/go/2016/days/d08/example.txt:
--------------------------------------------------------------------------------
1 | rect 3x2
2 | rotate column x=1 by 1
3 | rotate row y=0 by 4
4 | rotate column x=1 by 1
5 |
--------------------------------------------------------------------------------
/go/2017/days/d08/example.txt:
--------------------------------------------------------------------------------
1 | b inc 5 if a > 1
2 | a inc 1 if b < 5
3 | c dec -10 if a >= 1
4 | c inc -20 if c == 10
5 |
--------------------------------------------------------------------------------
/go/2025/days/d05/example.txt:
--------------------------------------------------------------------------------
1 | 3-5
2 | 10-14
3 | 16-20
4 | 12-18
5 |
6 | 1
7 | 5
8 | 8
9 | 11
10 | 17
11 | 32
12 |
--------------------------------------------------------------------------------
/go/2016/days/d03/example.txt:
--------------------------------------------------------------------------------
1 | 101 301 501
2 | 102 302 502
3 | 103 303 503
4 | 201 401 601
5 | 202 402 602
6 | 203 403 603
7 |
--------------------------------------------------------------------------------
/go/2023/days/d13/exemple1.txt:
--------------------------------------------------------------------------------
1 | #.##..##.
2 | ..#.##.#.
3 | ##......#
4 | ##......#
5 | ..#.##.#.
6 | ..##..##.
7 | #.#.##.#.
8 |
--------------------------------------------------------------------------------
/go/2015/days/day25/input.txt:
--------------------------------------------------------------------------------
1 | To continue, please consult the code grid in the manual. Enter the code at row 2978, column 3083.
2 |
--------------------------------------------------------------------------------
/go/2016/days/d22/example3.txt:
--------------------------------------------------------------------------------
1 | #MAP#
2 | .........X
3 | ..........
4 | ....######
5 | ..........
6 | ......@...
7 | ..........
8 |
--------------------------------------------------------------------------------
/go/2017/days/d12/example.txt:
--------------------------------------------------------------------------------
1 | 0 <-> 2
2 | 1 <-> 1
3 | 2 <-> 0, 3, 4
4 | 3 <-> 2, 4
5 | 4 <-> 2, 3, 6
6 | 5 <-> 6
7 | 6 <-> 4, 5
8 |
--------------------------------------------------------------------------------
/go/2018/days/d13/example.txt:
--------------------------------------------------------------------------------
1 | /->-\
2 | | | /----\
3 | | /-+--+-\ |
4 | | | | | v |
5 | \-+-/ \-+--/
6 | \------/
7 |
--------------------------------------------------------------------------------
/go/2022/days/d16/ex1.txt:
--------------------------------------------------------------------------------
1 | Valve AA has flow rate=0; tunnel lead to valve BB
2 | Valve BB has flow rate=1; tunnel leads to valve AA
3 |
--------------------------------------------------------------------------------
/go/2023/days/d13/sample2.txt:
--------------------------------------------------------------------------------
1 | #...#..##
2 | #.#.#..##
3 | ###..##..
4 | #..##.###
5 | ..#.#.#..
6 | #####..##
7 | .#....#..
8 |
9 |
--------------------------------------------------------------------------------
/go/2023/days/d13/sample3.txt:
--------------------------------------------------------------------------------
1 | #..#..##.
2 | #..#..##.
3 | .####.#.#
4 | ..#..#...
5 | #.###.#..
6 | #.###.##.
7 | ..#..#...
8 |
9 |
--------------------------------------------------------------------------------
/go/2024/days/d10/example2.txt:
--------------------------------------------------------------------------------
1 | 89010123
2 | 78121874
3 | 87430965
4 | 96549874
5 | 45678903
6 | 32019012
7 | 01329801
8 | 10456732
9 |
--------------------------------------------------------------------------------
/go/2016/days/d18/input.txt:
--------------------------------------------------------------------------------
1 | 40
2 | .^.^..^......^^^^^...^^^...^...^....^^.^...^.^^^^....^...^^.^^^...^^^^.^^.^.^^..^.^^^..^^^^^^.^^^..^
3 |
--------------------------------------------------------------------------------
/go/2023/days/d13/sample1.txt:
--------------------------------------------------------------------------------
1 | #.##.
2 | #.#.#
3 | #.###
4 | #...#
5 | #.#..
6 | ##...
7 | ##...
8 | #.#..
9 | #...#
10 |
11 |
--------------------------------------------------------------------------------
/go/2017/days/d10/axialcoords.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ColasNahaboo/advent-of-code-my-solutions/HEAD/go/2017/days/d10/axialcoords.png
--------------------------------------------------------------------------------
/go/2023/days/d22/example.txt:
--------------------------------------------------------------------------------
1 | 1,0,1~1,2,1
2 | 0,0,2~2,0,2
3 | 0,2,3~2,2,3
4 | 0,0,4~0,2,4
5 | 2,0,5~2,2,5
6 | 0,1,6~2,1,6
7 | 1,1,8~1,1,9
8 |
--------------------------------------------------------------------------------
/go/2023/days/d09/INPUT.txt:
--------------------------------------------------------------------------------
1 | 8 27 69 157 321 595 1027 1725 2968 5429 10599 21587 44639 92035 187591 376965 746552 1457231 2802953 5309577 9897013
2 |
--------------------------------------------------------------------------------
/go/2024/days/d15/example4.txt:
--------------------------------------------------------------------------------
1 | #######
2 | #...#.#
3 | #.....#
4 | #..OO@#
5 | #..O..#
6 | #.....#
7 | #######
8 |
9 | x
2 | 456 -> y
3 | x AND y -> d
4 | x OR y -> e
5 | x LSHIFT 2 -> f
6 | y RSHIFT 2 -> g
7 | NOT x -> h
8 | NOT y -> i
9 |
--------------------------------------------------------------------------------
/bash/2021/days/d24.example:
--------------------------------------------------------------------------------
1 | inp w
2 | add z w
3 | mod z 2
4 | div w 2
5 | add y w
6 | mod y 2
7 | div w 2
8 | add x w
9 | mod x 2
10 | div w 2
11 | mod w 2
12 |
--------------------------------------------------------------------------------
/go/2016/days/d22/example4.txt:
--------------------------------------------------------------------------------
1 | #MAP#
2 | .......X
3 | ........
4 | ....####
5 | ........
6 | ......@.
7 | ........
8 | ........
9 | ........
10 | ........
11 |
--------------------------------------------------------------------------------
/bash/2021/days/d25.example:
--------------------------------------------------------------------------------
1 | v...>>.vv>
2 | .vv>>.vv..
3 | >>.>v>...v
4 | >>v>>.>.v.
5 | v>v.vv.v..
6 | >.>>..v...
7 | .vv..>.>v.
8 | v.v..>>v.v
9 | ....v..v.>
10 |
--------------------------------------------------------------------------------
/go/2022/days/d18/example.txt:
--------------------------------------------------------------------------------
1 | 2,2,2
2 | 1,2,2
3 | 3,2,2
4 | 2,1,2
5 | 2,3,2
6 | 2,2,1
7 | 2,2,3
8 | 2,2,4
9 | 2,2,6
10 | 1,2,5
11 | 3,2,5
12 | 2,1,5
13 | 2,3,5
14 |
--------------------------------------------------------------------------------
/go/2024/days/d15/example1.txt:
--------------------------------------------------------------------------------
1 | ########
2 | #..O.O.#
3 | ##@.O..#
4 | #...O..#
5 | #.#.O..#
6 | #...O..#
7 | #......#
8 | ########
9 |
10 | <^^>>>vv>v<<
11 |
--------------------------------------------------------------------------------
/go/2022/days/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/ColasNahaboo/advent-of-code-my-solutions/go/2022/src
2 |
3 | go 1.19
4 |
5 | require github.com/gammazero/deque v0.2.1 // indirect
6 |
--------------------------------------------------------------------------------
/go/2023/days/d10/example-p2e2.txt:
--------------------------------------------------------------------------------
1 | ..........
2 | .S------7.
3 | .|F----7|.
4 | .||....||.
5 | .||....||.
6 | .|L-7F-J|.
7 | .|II||II|.
8 | .L--JL--J.
9 | ..........
10 |
--------------------------------------------------------------------------------
/go/2023/days/d12/example.txt:
--------------------------------------------------------------------------------
1 | ???.### 1,1,3
2 | .??..??...?##. 1,1,3
3 | ?#?#?#?#?#?#?#? 1,3,1,6
4 | ????.#...#... 4,1,1
5 | ????.######..#####. 1,6,5
6 | ?###???????? 3,2,1
7 |
--------------------------------------------------------------------------------
/go/2015/days/day15/exemple.txt:
--------------------------------------------------------------------------------
1 | Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8
2 | Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3
3 |
--------------------------------------------------------------------------------
/go/2024/days/d24/example1.txt:
--------------------------------------------------------------------------------
1 | x00: 1
2 | x01: 1
3 | x02: 1
4 | y00: 0
5 | y01: 1
6 | y02: 0
7 |
8 | x00 AND y00 -> z00
9 | x01 XOR y01 -> z01
10 | x02 OR y02 -> z02
11 |
--------------------------------------------------------------------------------
/bash/2021/days/d05.example:
--------------------------------------------------------------------------------
1 | 0,9 -> 5,9
2 | 8,0 -> 0,8
3 | 9,4 -> 3,4
4 | 2,2 -> 2,1
5 | 7,0 -> 7,4
6 | 6,4 -> 2,0
7 | 0,9 -> 2,9
8 | 3,4 -> 1,4
9 | 0,0 -> 8,8
10 | 5,5 -> 8,2
11 |
--------------------------------------------------------------------------------
/bash/2021/days/d11.example:
--------------------------------------------------------------------------------
1 | 5483143223
2 | 2745854711
3 | 5264556173
4 | 6141336146
5 | 6357385478
6 | 4167524645
7 | 2176841721
8 | 6882881134
9 | 4846848554
10 | 5283751526
11 |
--------------------------------------------------------------------------------
/bash/2021/days/d11.input:
--------------------------------------------------------------------------------
1 | 5665114554
2 | 4882665427
3 | 6185582113
4 | 7762852744
5 | 7255621841
6 | 8842753123
7 | 8225372176
8 | 7212865827
9 | 7758751157
10 | 1828544563
11 |
--------------------------------------------------------------------------------
/bash/2021/days/d15.example:
--------------------------------------------------------------------------------
1 | 1163751742
2 | 1381373672
3 | 2136511328
4 | 3694931569
5 | 7463417111
6 | 1319128137
7 | 1359912421
8 | 3125421639
9 | 1293138521
10 | 2311944581
11 |
--------------------------------------------------------------------------------
/go/2015/days/day14/exemple.txt:
--------------------------------------------------------------------------------
1 | Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds.
2 | Dancer can fly 16 km/s for 11 seconds, but then must rest for 162 seconds.
3 |
--------------------------------------------------------------------------------
/go/2015/days/day17/input.txt:
--------------------------------------------------------------------------------
1 | 50
2 | 44
3 | 11
4 | 49
5 | 42
6 | 46
7 | 18
8 | 32
9 | 26
10 | 40
11 | 21
12 | 7
13 | 18
14 | 43
15 | 10
16 | 47
17 | 36
18 | 24
19 | 22
20 | 40
21 |
--------------------------------------------------------------------------------
/go/2022/days/d16/ex2.txt:
--------------------------------------------------------------------------------
1 | Valve AA has flow rate=0; tunnel lead to valve BB
2 | Valve BB has flow rate=1; tunnel leads to valve CC
3 | Valve CC has flow rate=2; tunnel leads to valve AA
4 |
--------------------------------------------------------------------------------
/go/2023/days/d10/example-p2e1.txt:
--------------------------------------------------------------------------------
1 | ...........
2 | .S-------7.
3 | .|F-----7|.
4 | .||.....||.
5 | .||.....||.
6 | .|L-7.F-J|.
7 | .|..|.|..|.
8 | .L--J.L--J.
9 | ...........
10 |
--------------------------------------------------------------------------------
/go/2015/days/day16/MFCSAM.txt:
--------------------------------------------------------------------------------
1 | children: 3
2 | cats: 7
3 | samoyeds: 2
4 | pomeranians: 3
5 | akitas: 0
6 | vizslas: 0
7 | goldfish: 5
8 | trees: 3
9 | cars: 2
10 | perfumes: 1
11 |
--------------------------------------------------------------------------------
/go/2017/days/d20/example2.txt:
--------------------------------------------------------------------------------
1 | p=<-6,0,0>, v=< 3,0,0>, a=< 0,0,0>
2 | p=<-4,0,0>, v=< 2,0,0>, a=< 0,0,0>
3 | p=<-2,0,0>, v=< 1,0,0>, a=< 0,0,0>
4 | p=< 3,0,0>, v=<-1,0,0>, a=< 0,0,0>
5 |
--------------------------------------------------------------------------------
/go/2023/days/d03/example.txt:
--------------------------------------------------------------------------------
1 | 467..114..
2 | ...*......
3 | ..35..633.
4 | ......#...
5 | 617*......
6 | .....+.58.
7 | ..592.....
8 | ......755.
9 | ...$.*....
10 | .664.598..
11 |
--------------------------------------------------------------------------------
/go/2023/days/d11/example.txt:
--------------------------------------------------------------------------------
1 | ...#......
2 | .......#..
3 | #.........
4 | ..........
5 | ......#...
6 | .#........
7 | .........#
8 | ..........
9 | .......#..
10 | #...#.....
11 |
--------------------------------------------------------------------------------
/go/2023/days/d14/example.txt:
--------------------------------------------------------------------------------
1 | O....#....
2 | O.OO#....#
3 | .....##...
4 | OO.#O....O
5 | .O.....O#.
6 | O.#..O.#.#
7 | ..O..#O..O
8 | .......O..
9 | #....###..
10 | #OO..#....
11 |
--------------------------------------------------------------------------------
/go/2023/days/d16/example.txt:
--------------------------------------------------------------------------------
1 | .|...\....
2 | |.-.\.....
3 | .....|-...
4 | ........|.
5 | ..........
6 | .........\
7 | ..../.\\..
8 | .-.-/..|..
9 | .|....-|.\
10 | ..//.|....
11 |
--------------------------------------------------------------------------------
/go/2023/days/d24/example.txt:
--------------------------------------------------------------------------------
1 | TESTAREA-XY: 7 27
2 | 19, 13, 30 @ -2, 1, -2
3 | 18, 19, 22 @ -1, -1, -2
4 | 20, 25, 34 @ -2, -2, -4
5 | 12, 31, 28 @ -1, -2, -1
6 | 20, 19, 15 @ 1, -5, -3
7 |
--------------------------------------------------------------------------------
/go/2024/days/d04/example.txt:
--------------------------------------------------------------------------------
1 | MMMSXXMASM
2 | MSAMXMSMSA
3 | AMXSXMAAMM
4 | MSAMASMSMX
5 | XMASAMXAMM
6 | XXAMMXXAMA
7 | SMSMSASXSS
8 | SAXAMASAAA
9 | MAMMMXMMMM
10 | MXMXAXMASX
11 |
--------------------------------------------------------------------------------
/go/2024/days/d06/example.txt:
--------------------------------------------------------------------------------
1 | ....#.....
2 | .........#
3 | ..........
4 | ..#.......
5 | .......#..
6 | ..........
7 | .#..^.....
8 | ........#.
9 | #.........
10 | ......#...
11 |
--------------------------------------------------------------------------------
/go/2024/days/d12/example3.txt:
--------------------------------------------------------------------------------
1 | RRRRIICCFF
2 | RRRRIICCCF
3 | VVRRRCCFFF
4 | VVRCCCJFFF
5 | VVVVCJJCFE
6 | VVIVCCJJEE
7 | VVIIICJJEE
8 | MIIIIIJJEE
9 | MIIISIJEEE
10 | MMMISSJEEE
11 |
--------------------------------------------------------------------------------
/go/2025/days/d04/example.txt:
--------------------------------------------------------------------------------
1 | ..@@.@@@@.
2 | @@@.@.@.@@
3 | @@@@@.@.@@
4 | @.@@@@..@.
5 | @@.@@@@.@@
6 | .@@@@@@@.@
7 | .@.@.@.@@@
8 | @.@@@.@@@@
9 | .@@@@@@@@.
10 | @.@.@@@.@.
11 |
--------------------------------------------------------------------------------
/go/2022/days/go.sum:
--------------------------------------------------------------------------------
1 | github.com/gammazero/deque v0.2.1 h1:qSdsbG6pgp6nL7A0+K/B7s12mcCY/5l5SIUpMOl+dC0=
2 | github.com/gammazero/deque v0.2.1/go.mod h1:LFroj8x4cMYCukHJDbxFCkT+r9AndaJnFMuZDV34tuU=
3 |
--------------------------------------------------------------------------------
/go/2023/days/d08/example.txt:
--------------------------------------------------------------------------------
1 | RL
2 |
3 | AAA = (BBB, CCC)
4 | BBB = (DDD, EEE)
5 | CCC = (ZZZ, GGG)
6 | DDD = (DDD, DDD)
7 | EEE = (EEE, EEE)
8 | GGG = (GGG, GGG)
9 | ZZZ = (ZZZ, ZZZ)
10 |
--------------------------------------------------------------------------------
/go/2024/days/d07/example.txt:
--------------------------------------------------------------------------------
1 | 190: 10 19
2 | 3267: 81 40 27
3 | 83: 17 5
4 | 156: 15 6
5 | 7290: 6 8 6 15
6 | 161011: 16 10 13
7 | 192: 17 8 14
8 | 21037: 9 7 18 13
9 | 292: 11 6 16 20
10 |
--------------------------------------------------------------------------------
/go/2025/days/d11/example.txt:
--------------------------------------------------------------------------------
1 | aaa: you hhh
2 | you: bbb ccc
3 | bbb: ddd eee
4 | ccc: ddd eee fff
5 | ddd: ggg
6 | eee: out
7 | fff: out
8 | ggg: out
9 | hhh: ccc fff iii
10 | iii: out
11 |
--------------------------------------------------------------------------------
/go/2022/days/d03/example.txt:
--------------------------------------------------------------------------------
1 | vJrwpWtwJgWrhcsFMMfFFhFp
2 | jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
3 | PmmdzqPrVvPwwTWBwg
4 | wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
5 | ttgJtRGJQctTZtZT
6 | CrZsJsPPZsGzwwsLwLmpwMDw
7 |
--------------------------------------------------------------------------------
/go/2022/days/d05/example.txt:
--------------------------------------------------------------------------------
1 | [D]
2 | [N] [C]
3 | [Z] [M] [P]
4 | 1 2 3
5 |
6 | move 1 from 2 to 1
7 | move 3 from 1 to 3
8 | move 2 from 2 to 1
9 | move 1 from 1 to 2
10 |
--------------------------------------------------------------------------------
/go/2025/days/d02/example.txt:
--------------------------------------------------------------------------------
1 | 11-22,95-115,998-1012,1188511880-1188511890,222220-222224,
2 | 1698522-1698528,446443-446449,38593856-38593862,565653-565659,
3 | 824824821-824824827,2121212118-2121212124
4 |
--------------------------------------------------------------------------------
/go/2023/days/d21/example.txt:
--------------------------------------------------------------------------------
1 | ...........
2 | .....###.#.
3 | .###.##..#.
4 | ..#.#...#..
5 | ....#.#....
6 | .##..S####.
7 | .##..#...#.
8 | .......##..
9 | .##.#.####.
10 | .##..##.##.
11 | ...........
12 |
--------------------------------------------------------------------------------
/go/2025/days/d10/example.txt:
--------------------------------------------------------------------------------
1 | [.##.] (3) (1,3) (2) (2,3) (0,2) (0,1) {3,5,4,7}
2 | [...#.] (0,2,3,4) (2,3) (0,4) (0,1,2) (1,2,3,4) {7,5,12,7,2}
3 | [.###.#] (0,1,2,3,4) (0,3,4) (0,1,2,4,5) (1,2) {10,11,11,5,10,5}
4 |
--------------------------------------------------------------------------------
/go/2025/days/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/ColasNahaboo/advent-of-code-my-solutions/go/2025/src
2 |
3 | go 1.24
4 |
5 | require (
6 | github.com/aclements/go-z3 v0.0.0-20220809013456-4675d5f90ca5 // indirect
7 | )
8 |
--------------------------------------------------------------------------------
/go/2016/days/d06/example.txt:
--------------------------------------------------------------------------------
1 | eedadn
2 | drvtee
3 | eandsr
4 | raavrd
5 | atevrs
6 | tsrnev
7 | sdttsa
8 | rasrtv
9 | nssdts
10 | ntnada
11 | svetve
12 | tesnvt
13 | vntsnd
14 | vrdear
15 | dvrsen
16 | enarar
17 |
--------------------------------------------------------------------------------
/bash/2021/days/d13.small:
--------------------------------------------------------------------------------
1 | 6,10
2 | 0,14
3 | 9,10
4 | 0,3
5 | 10,4
6 | 4,11
7 | 6,0
8 | 6,12
9 | 4,1
10 | 0,13
11 | 10,12
12 | 3,4
13 | 3,0
14 | 8,4
15 | 1,10
16 | 2,14
17 | 8,10
18 | 9,0
19 |
20 | fold along y=7
21 |
--------------------------------------------------------------------------------
/go/2025/days/d11/example2.txt:
--------------------------------------------------------------------------------
1 | svr: aaa bbb
2 | aaa: fft
3 | fft: ccc
4 | bbb: tty
5 | tty: ccc
6 | ccc: ddd eee
7 | ddd: hub
8 | hub: fff
9 | eee: dac
10 | dac: fff
11 | fff: ggg hhh
12 | ggg: out
13 | hhh: out
14 |
--------------------------------------------------------------------------------
/go/2023/days/d01/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d01
2 |
3 | The trick in part2 was that number names could overlap, e.g. `eighthree` instead of `eightthree`, so a naive tokenisation of the input would fail.
4 |
--------------------------------------------------------------------------------
/bash/2021/days/d12.example3:
--------------------------------------------------------------------------------
1 | fs-end
2 | he-DX
3 | fs-he
4 | start-DX
5 | pj-DX
6 | end-zg
7 | zg-sl
8 | zg-pj
9 | pj-he
10 | RW-he
11 | fs-DX
12 | pj-RW
13 | zg-RW
14 | start-pj
15 | he-WI
16 | zg-he
17 | pj-fs
18 | start-RW
19 |
20 |
--------------------------------------------------------------------------------
/bash/2021/days/d13.example:
--------------------------------------------------------------------------------
1 | 6,10
2 | 0,14
3 | 9,10
4 | 0,3
5 | 10,4
6 | 4,11
7 | 6,0
8 | 6,12
9 | 4,1
10 | 0,13
11 | 10,12
12 | 3,4
13 | 3,0
14 | 8,4
15 | 1,10
16 | 2,14
17 | 8,10
18 | 9,0
19 |
20 | fold along y=7
21 | fold along x=5
22 |
--------------------------------------------------------------------------------
/go/2024/days/d08/example.txt:
--------------------------------------------------------------------------------
1 | ............
2 | ........0...
3 | .....0......
4 | .......0....
5 | ....0.......
6 | ......A.....
7 | ............
8 | ............
9 | ........A...
10 | .........A..
11 | ............
12 | ............
13 |
--------------------------------------------------------------------------------
/bash/2021/days/d14.example:
--------------------------------------------------------------------------------
1 | NNCB
2 |
3 | CH -> B
4 | HH -> N
5 | CB -> H
6 | NH -> C
7 | HB -> C
8 | HC -> B
9 | HN -> C
10 | NN -> C
11 | BH -> H
12 | NC -> B
13 | NB -> B
14 | BN -> B
15 | BB -> N
16 | BC -> B
17 | CC -> N
18 | CN -> C
19 |
--------------------------------------------------------------------------------
/go/2023/days/d13/example.txt:
--------------------------------------------------------------------------------
1 | #.##..##.
2 | ..#.##.#.
3 | ##......#
4 | ##......#
5 | ..#.##.#.
6 | ..##..##.
7 | #.#.##.#.
8 |
9 | #...##..#
10 | #....#..#
11 | ..##..###
12 | #####.##.
13 | #####.##.
14 | ..##..###
15 | #....#..#
16 |
17 |
--------------------------------------------------------------------------------
/go/2015/days/day24/input.txt:
--------------------------------------------------------------------------------
1 | 1
2 | 3
3 | 5
4 | 11
5 | 13
6 | 17
7 | 19
8 | 23
9 | 29
10 | 31
11 | 37
12 | 41
13 | 43
14 | 47
15 | 53
16 | 59
17 | 67
18 | 71
19 | 73
20 | 79
21 | 83
22 | 89
23 | 97
24 | 101
25 | 103
26 | 107
27 | 109
28 | 113
29 |
--------------------------------------------------------------------------------
/go/2016/days/d10/example.txt:
--------------------------------------------------------------------------------
1 | value 5 goes to bot 2
2 | bot 2 gives low to bot 1 and high to bot 0
3 | value 3 goes to bot 1
4 | bot 1 gives low to output 1 and high to bot 0
5 | bot 0 gives low to output 2 and high to output 0
6 | value 2 goes to bot 2
7 |
--------------------------------------------------------------------------------
/go/2024/days/d14/example.txt:
--------------------------------------------------------------------------------
1 | w=11, h=7
2 | p=0,4 v=3,-3
3 | p=6,3 v=-1,-3
4 | p=10,3 v=-1,2
5 | p=2,0 v=2,-1
6 | p=0,0 v=1,3
7 | p=3,0 v=-2,-2
8 | p=7,6 v=-1,-3
9 | p=3,0 v=-1,-2
10 | p=9,3 v=2,3
11 | p=7,3 v=-1,2
12 | p=2,4 v=2,-3
13 | p=9,5 v=-3,-3
14 |
--------------------------------------------------------------------------------
/go/2023/days/d15/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d15
2 |
3 | A resfreshingly very simple and easy problem, the only implementation trick was to use sparse lists for storing lenses in boxes, instead of actually moving them around all the time.
4 |
--------------------------------------------------------------------------------
/go/2016/days/d11/example.txt:
--------------------------------------------------------------------------------
1 | The first floor contains a hydrogen-compatible microchip and a lithium-compatible microchip.
2 | The second floor contains a hydrogen generator.
3 | The third floor contains a lithium generator.
4 | The fourth floor contains nothing relevant.
5 |
--------------------------------------------------------------------------------
/go/2023/days/d17/example.txt:
--------------------------------------------------------------------------------
1 | 2413432311323
2 | 3215453535623
3 | 3255245654254
4 | 3446585845452
5 | 4546657867536
6 | 1438598798454
7 | 4457876987766
8 | 3637877979653
9 | 4654967986887
10 | 4564679986453
11 | 1224686865563
12 | 2546548887735
13 | 4322674655533
14 |
--------------------------------------------------------------------------------
/go/2024/days/d18/example.txt:
--------------------------------------------------------------------------------
1 | size: 6 falls: 12
2 | 5,4
3 | 4,2
4 | 4,5
5 | 3,0
6 | 2,1
7 | 6,3
8 | 2,4
9 | 1,5
10 | 0,6
11 | 3,3
12 | 2,6
13 | 5,1
14 | 1,2
15 | 5,5
16 | 2,5
17 | 6,5
18 | 1,4
19 | 0,4
20 | 6,4
21 | 1,1
22 | 6,1
23 | 1,0
24 | 0,5
25 | 1,6
26 | 2,0
27 |
--------------------------------------------------------------------------------
/go/2024/days/d24/example3.txt:
--------------------------------------------------------------------------------
1 | x00: 0
2 | x01: 1
3 | x02: 0
4 | x03: 1
5 | y00: 0
6 | y01: 0
7 | y02: 1
8 | y03: 1
9 |
10 | x00 AND y00 -> aaa
11 | x01 AND y01 -> bbb
12 | aaa XOR bbb -> z00
13 | ccc OR ddd -> z01
14 | x02 AND y02 -> ccc
15 | x03 AND y03 -> ddd
16 |
--------------------------------------------------------------------------------
/go/2017/days/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/ColasNahaboo/advent-of-code-my-solutions/go/2017/src
2 |
3 | go 1.21
4 |
5 | require (
6 | github.com/fxtlabs/primes v0.0.0-20150821004651-dad82d10a449 // indirect
7 | golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
8 | )
9 |
--------------------------------------------------------------------------------
/go/2023/days/d22/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d22
2 |
3 | This is a very pleasant exercise, a 3D tetris. I chose to implement a "roof levels" cache that listed all the bricks having the same top Z value. It made the solution very fast and efficient.
4 |
--------------------------------------------------------------------------------
/go/2018/days/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/ColasNahaboo/advent-of-code-my-solutions/go/2018/src
2 |
3 | go 1.23
4 |
5 | require (
6 | github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203 // indirect
7 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
8 | )
9 |
--------------------------------------------------------------------------------
/go/2022/days/d22/example.txt:
--------------------------------------------------------------------------------
1 | ...#
2 | .#..
3 | #...
4 | ....
5 | ...#.......#
6 | ........#...
7 | ..#....#....
8 | ..........#.
9 | ...#....
10 | .....#..
11 | .#......
12 | ......#.
13 |
14 | 10R5L5R10L4R5L5
15 |
--------------------------------------------------------------------------------
/bash/2021/days/d12.input:
--------------------------------------------------------------------------------
1 | xz-end
2 | CJ-pt
3 | pt-QW
4 | hn-SP
5 | pw-CJ
6 | SP-end
7 | hn-pt
8 | GK-nj
9 | fe-nj
10 | CJ-nj
11 | hn-ZZ
12 | hn-start
13 | hn-fe
14 | ZZ-fe
15 | SP-nj
16 | SP-xz
17 | ZZ-pt
18 | nj-ZZ
19 | start-ZZ
20 | hn-GK
21 | CJ-end
22 | start-fe
23 | CJ-xz
24 |
--------------------------------------------------------------------------------
/go/2023/days/d25/example.txt:
--------------------------------------------------------------------------------
1 | jqt: rhn xhk nvd
2 | rsh: frs pzl lsr
3 | xhk: hfx
4 | cmg: qnr nvd lhk bvb
5 | rhn: xhk bvb hfx
6 | bvb: xhk hfx
7 | pzl: lsr hfx nvd
8 | qnr: nvd
9 | ntq: jqt hfx bvb xhk
10 | nvd: lhk
11 | lsr: lhk
12 | rzs: qnr cmg lsr rsh
13 | frs: qnr lhk lsr
14 |
--------------------------------------------------------------------------------
/bash/2021/days/CHECKALL:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # check for syntax and style all bash scripts in this directory
3 | # terse output usable under emacs compile mode
4 | while read -r file; do
5 | bash -n "$file" && shellcheck -f gcc "$file"
6 | done < <(grep -rElm1 '^#!/(bin/|usr/bin/env )bash$' .)
7 |
--------------------------------------------------------------------------------
/go/2022/days/d21/example.txt:
--------------------------------------------------------------------------------
1 | root: pppw + sjmn
2 | dbpl: 5
3 | cczh: sllz + lgvd
4 | zczc: 2
5 | ptdq: humn - dvpt
6 | dvpt: 3
7 | lfqf: 4
8 | humn: 5
9 | ljgn: 2
10 | sjmn: drzm * dbpl
11 | sllz: 4
12 | pppw: cczh / lfqf
13 | lgvd: ljgn * ptdq
14 | drzm: hmdt - zczc
15 | hmdt: 32
16 |
--------------------------------------------------------------------------------
/go/2023/days/d10/example-p2e3.txt:
--------------------------------------------------------------------------------
1 | .F----7F7F7F7F-7....
2 | .|F--7||||||||FJ....
3 | .||.FJ||||||||L7....
4 | FJL7L7LJLJ||LJ.L-7..
5 | L--J.L7...LJS7F-7L7.
6 | ....F-J..F7FJ|L7L7L7
7 | ....L7.F7||L7|.L7L7|
8 | .....|FJLJ|FJ|F7|.LJ
9 | ....FJL-7.||.||||...
10 | ....L---J.LJ.LJLJ...
11 |
--------------------------------------------------------------------------------
/go/2023/days/d10/example-p2e4.txt:
--------------------------------------------------------------------------------
1 | FF7FSF7F7F7F7F7F---7
2 | L|LJ||||||||||||F--J
3 | FL-7LJLJ||||||LJL-77
4 | F--JF--7||LJLJ7F7FJ-
5 | L---JF-JLJ.||-FJLJJ7
6 | |F|F-JF---7F7-L7L|7|
7 | |FFJF7L7F-JF7|JL---7
8 | 7-L-JL7||F7|L7F-7F7|
9 | L.L7LFJ|||||FJL7||LJ
10 | L7JLJL-JLJLJL--JLJ.L
11 |
--------------------------------------------------------------------------------
/go/2023/days/d18/example.txt:
--------------------------------------------------------------------------------
1 | R 6 (#70c710)
2 | D 5 (#0dc571)
3 | L 2 (#5713f0)
4 | D 2 (#d2c081)
5 | R 2 (#59c680)
6 | D 2 (#411b91)
7 | L 5 (#8ceee2)
8 | U 2 (#caa173)
9 | L 1 (#1b58a2)
10 | U 2 (#caa171)
11 | R 2 (#7807d2)
12 | U 3 (#a77fa3)
13 | L 2 (#015232)
14 | U 2 (#7a21e3)
15 |
--------------------------------------------------------------------------------
/go/2023/days/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/ColasNahaboo/advent-of-code-my-solutions/go/2023/src
2 |
3 | go 1.21
4 |
5 | require (
6 | github.com/deckarep/golang-set/v2 v2.6.0 // indirect
7 | github.com/emirpasic/gods v1.18.1 // indirect
8 | gonum.org/v1/gonum v0.14.0 // indirect
9 | )
10 |
--------------------------------------------------------------------------------
/go/2017/days/d07/example.txt:
--------------------------------------------------------------------------------
1 | pbga (66)
2 | xhth (57)
3 | ebii (61)
4 | havc (66)
5 | ktlj (57)
6 | fwft (72) -> ktlj, cntj, xhth
7 | qoyq (66)
8 | padx (45) -> pbga, havc, qoyq
9 | tknk (41) -> ugml, padx, fwft
10 | jptl (61)
11 | ugml (68) -> gyxo, ebii, jptl
12 | gyxo (61)
13 | cntj (57)
14 |
--------------------------------------------------------------------------------
/go/2018/days/d12/example.txt:
--------------------------------------------------------------------------------
1 | initial state: #..#.#..##......###...###
2 |
3 | ...## => #
4 | ..#.. => #
5 | .#... => #
6 | .#.#. => #
7 | .#.## => #
8 | .##.. => #
9 | .#### => #
10 | #.#.# => #
11 | #.### => #
12 | ##.#. => #
13 | ##.## => #
14 | ###.. => #
15 | ###.# => #
16 | ####. => #
17 |
--------------------------------------------------------------------------------
/bash/2021/days/d10.example:
--------------------------------------------------------------------------------
1 | [({(<(())[]>[[{[]{<()<>>
2 | [(()[<>])]({[<{<<[]>>(
3 | {([(<{}[<>[]}>{[]{[(<()>
4 | (((({<>}<{<{<>}{[]{[]{}
5 | [[<[([]))<([[{}[[()]]]
6 | [{[{({}]{}}([{[{{{}}([]
7 | {<[[]]>}<{[{[{[]{()[[[]
8 | [<(<(<(<{}))><([]([]()
9 | <{([([[(<>()){}]>(<<{{
10 | <{([{{}}[<[[[<>{}]]]>[]]
11 |
--------------------------------------------------------------------------------
/go/2015/days/day15/input.txt:
--------------------------------------------------------------------------------
1 | Frosting: capacity 4, durability -2, flavor 0, texture 0, calories 5
2 | Candy: capacity 0, durability 5, flavor -1, texture 0, calories 8
3 | Butterscotch: capacity -1, durability 0, flavor 5, texture 0, calories 6
4 | Sugar: capacity 0, durability 0, flavor -2, texture 2, calories 1
5 |
--------------------------------------------------------------------------------
/go/2016/days/d12/input.txt:
--------------------------------------------------------------------------------
1 | cpy 1 a
2 | cpy 1 b
3 | cpy 26 d
4 | jnz c 2
5 | jnz 1 5
6 | cpy 7 c
7 | inc d
8 | dec c
9 | jnz c -2
10 | cpy a c
11 | inc a
12 | dec b
13 | jnz b -2
14 | cpy c b
15 | dec d
16 | jnz d -6
17 | cpy 17 c
18 | cpy 18 d
19 | inc a
20 | dec d
21 | jnz d -2
22 | dec c
23 | jnz c -5
24 |
--------------------------------------------------------------------------------
/go/2023/days/d09/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d09
2 |
3 | This is really a trivial problem.
4 |
5 | I chose to solve it iteratively, as I was afraid that a more natural recursive
6 | solution may not have scaled for the part 2. But it could have been done
7 | recursively also for part2.
8 |
--------------------------------------------------------------------------------
/go/2024/days/d24/example2.txt:
--------------------------------------------------------------------------------
1 | x00: 0
2 | x01: 1
3 | x02: 0
4 | x03: 1
5 | x04: 0
6 | x05: 1
7 | y00: 0
8 | y01: 0
9 | y02: 1
10 | y03: 1
11 | y04: 0
12 | y05: 1
13 |
14 | x00 AND y00 -> z05
15 | x01 AND y01 -> z02
16 | x02 AND y02 -> z01
17 | x03 AND y03 -> z03
18 | x04 AND y04 -> z04
19 | x05 AND y05 -> z00
20 |
--------------------------------------------------------------------------------
/go/2022/days/d13/example.txt:
--------------------------------------------------------------------------------
1 | [1,1,3,1,1]
2 | [1,1,5,1,1]
3 |
4 | [[1],[2,3,4]]
5 | [[1],4]
6 |
7 | [9]
8 | [[8,7,6]]
9 |
10 | [[4,4],4,4]
11 | [[4,4],4,4,4]
12 |
13 | [7,7,7,7]
14 | [7,7,7]
15 |
16 | []
17 | [3]
18 |
19 | [[[]]]
20 | [[]]
21 |
22 | [1,[2,[3,[4,[5,6,7]]]],8,9]
23 | [1,[2,[3,[4,[5,6,0]]]],8,9]
24 |
--------------------------------------------------------------------------------
/go/2016/days/d21/example.txt:
--------------------------------------------------------------------------------
1 | abcde
2 | decab
3 | swap position 4 with position 0
4 | swap letter d with letter b
5 | reverse positions 0 through 4
6 | rotate left 1 step
7 | move position 1 to position 4
8 | move position 3 to position 0
9 | rotate based on position of letter b
10 | rotate based on position of letter d
11 |
--------------------------------------------------------------------------------
/go/2022/days/d07/example.txt:
--------------------------------------------------------------------------------
1 | $ cd /
2 | $ ls
3 | dir a
4 | 14848514 b.txt
5 | 8504156 c.dat
6 | dir d
7 | $ cd a
8 | $ ls
9 | dir e
10 | 29116 f
11 | 2557 g
12 | 62596 h.lst
13 | $ cd e
14 | $ ls
15 | 584 i
16 | $ cd ..
17 | $ cd ..
18 | $ cd d
19 | $ ls
20 | 4060174 j
21 | 8033020 d.log
22 | 5626152 d.ext
23 | 7214296 k
24 |
--------------------------------------------------------------------------------
/go/2025/days/d12/example.txt:
--------------------------------------------------------------------------------
1 | 0:
2 | ###
3 | ##.
4 | ##.
5 |
6 | 1:
7 | ###
8 | ##.
9 | .##
10 |
11 | 2:
12 | .##
13 | ###
14 | ##.
15 |
16 | 3:
17 | ##.
18 | ###
19 | ##.
20 |
21 | 4:
22 | ###
23 | #..
24 | ###
25 |
26 | 5:
27 | ###
28 | .#.
29 | ###
30 |
31 | 4x4: 0 0 0 0 2 0
32 | 12x5: 1 0 1 0 2 2
33 | 12x5: 1 0 1 0 3 2
34 |
--------------------------------------------------------------------------------
/go/2023/days/d04/example.txt:
--------------------------------------------------------------------------------
1 | Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53
2 | Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19
3 | Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1
4 | Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83
5 | Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36
6 | Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11
7 |
--------------------------------------------------------------------------------
/go/2024/days/d16/example.txt:
--------------------------------------------------------------------------------
1 | ###############
2 | #.......#....E#
3 | #.#.###.#.###.#
4 | #.....#.#...#.#
5 | #.###.#####.#.#
6 | #.#.#.......#.#
7 | #.#.#####.###.#
8 | #...........#.#
9 | ###.#.#####.#.#
10 | #...#.....#.#.#
11 | #.#.#.###.#.#.#
12 | #.....#...#.#.#
13 | #.###.#.#.#.#.#
14 | #S..#.....#...#
15 | ###############
16 |
--------------------------------------------------------------------------------
/go/2024/days/d20/example.txt:
--------------------------------------------------------------------------------
1 | ###############
2 | #...#...#.....#
3 | #.#.#.#.#.###.#
4 | #S#...#.#.#...#
5 | #######.#.#.###
6 | #######.#.#...#
7 | #######.#.###.#
8 | ###..E#...#...#
9 | ###.#######.###
10 | #...###...#...#
11 | #.#####.#.###.#
12 | #.#...#.#.#...#
13 | #.#.#.#.#.#.###
14 | #...#...#...###
15 | ###############
16 |
--------------------------------------------------------------------------------
/go/2022/days/d19/example.txt:
--------------------------------------------------------------------------------
1 | Blueprint 1: Each ore robot costs 4 ore. Each clay robot costs 2 ore. Each obsidian robot costs 3 ore and 14 clay. Each geode robot costs 2 ore and 7 obsidian.
2 | Blueprint 2: Each ore robot costs 2 ore. Each clay robot costs 3 ore. Each obsidian robot costs 3 ore and 8 clay. Each geode robot costs 3 ore and 12 obsidian.
3 |
--------------------------------------------------------------------------------
/go/2015/TEMPLATES/minmax.go:
--------------------------------------------------------------------------------
1 |
2 | func min(is ...int) int {
3 | min := is[0]
4 | for _, i := range is[1:] {
5 | if i < min {
6 | min = i
7 | }
8 | }
9 | return min
10 | }
11 |
12 | func max(is ...int) int {
13 | max := is[0]
14 | for _, i := range is[1:] {
15 | if i > max {
16 | max = i
17 | }
18 | }
19 | return max
20 | }
21 |
--------------------------------------------------------------------------------
/go/2024/days/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/ColasNahaboo/advent-of-code-my-solutions/go/2024/src
2 |
3 | go 1.23
4 |
5 | require (
6 | github.com/bits-and-blooms/bitset v1.20.0 // indirect
7 | github.com/mattn/go-runewidth v0.0.9 // indirect
8 | github.com/olekukonko/tablewriter v0.0.5 // indirect
9 | gonum.org/v1/gonum v0.15.1 // indirect
10 | )
11 |
--------------------------------------------------------------------------------
/go/2025/days/d08/example.txt:
--------------------------------------------------------------------------------
1 | 162,817,812
2 | 57,618,57
3 | 906,360,560
4 | 592,479,940
5 | 352,342,300
6 | 466,668,158
7 | 542,29,236
8 | 431,825,988
9 | 739,650,466
10 | 52,470,668
11 | 216,146,977
12 | 819,987,18
13 | 117,168,530
14 | 805,96,715
15 | 346,949,466
16 | 970,615,88
17 | 941,993,340
18 | 862,61,35
19 | 984,92,344
20 | 425,690,689
21 |
--------------------------------------------------------------------------------
/go/2024/days/d13/example.txt:
--------------------------------------------------------------------------------
1 | Button A: X+94, Y+34
2 | Button B: X+22, Y+67
3 | Prize: X=8400, Y=5400
4 |
5 | Button A: X+26, Y+66
6 | Button B: X+67, Y+21
7 | Prize: X=12748, Y=12176
8 |
9 | Button A: X+17, Y+86
10 | Button B: X+84, Y+37
11 | Prize: X=7870, Y=6450
12 |
13 | Button A: X+69, Y+23
14 | Button B: X+27, Y+71
15 | Prize: X=18641, Y=10279
16 |
--------------------------------------------------------------------------------
/go/2025/days/d07/example.txt:
--------------------------------------------------------------------------------
1 | .......S.......
2 | ...............
3 | .......^.......
4 | ...............
5 | ......^.^......
6 | ...............
7 | .....^.^.^.....
8 | ...............
9 | ....^.^...^....
10 | ...............
11 | ...^.^...^.^...
12 | ...............
13 | ..^...^.....^..
14 | ...............
15 | .^.^.^.^.^...^.
16 | ...............
17 |
--------------------------------------------------------------------------------
/go/2023/days/d02/example.txt:
--------------------------------------------------------------------------------
1 | Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
2 | Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
3 | Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
4 | Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
5 | Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green
6 |
--------------------------------------------------------------------------------
/go/2024/days/d05/example.txt:
--------------------------------------------------------------------------------
1 | 47|53
2 | 97|13
3 | 97|61
4 | 97|47
5 | 75|29
6 | 61|13
7 | 75|53
8 | 29|13
9 | 97|29
10 | 53|29
11 | 61|53
12 | 97|53
13 | 61|29
14 | 47|13
15 | 75|47
16 | 97|75
17 | 47|61
18 | 75|61
19 | 47|29
20 | 75|13
21 | 53|13
22 |
23 | 75,47,61,53,29
24 | 97,61,53,29,13
25 | 75,29,13
26 | 75,97,47,61,53
27 | 61,13,29
28 | 97,13,75,29,47
29 |
--------------------------------------------------------------------------------
/go/2025/days/d12/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2025, in GO, day d12
2 |
3 | [Problem statement](https://adventofcode.com/2025/day/12)
4 |
5 | Just checking that the sum of all the shapes areas was less than the area of the rectangle they were to fit in was sufficient.
6 |
7 | The trick that this was not the case in the provided example, only for the real input.
8 |
--------------------------------------------------------------------------------
/go/2023/days/d14/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d14
2 |
3 | In part2, obviously it was supposed we did not perform the billion cycles, but detect when the cycles were looping. I did it by brute force, storing all the board positions and comparing with all of them on each cycle. Go is fast enough to perform this in less than 1/10th of a second anyways.
4 |
--------------------------------------------------------------------------------
/go/2024/days/d23/example.txt:
--------------------------------------------------------------------------------
1 | kh-tc
2 | qp-kh
3 | de-cg
4 | ka-co
5 | yn-aq
6 | qp-ub
7 | cg-tb
8 | vc-aq
9 | tb-ka
10 | wh-tc
11 | yn-cg
12 | kh-ub
13 | ta-co
14 | de-co
15 | tc-td
16 | tb-wq
17 | wh-td
18 | ta-ka
19 | td-qp
20 | aq-cg
21 | wq-ub
22 | ub-vc
23 | de-ta
24 | wq-aq
25 | wq-vc
26 | wh-yn
27 | ka-de
28 | kh-ta
29 | co-tc
30 | wh-qp
31 | tb-vc
32 | td-yn
33 |
--------------------------------------------------------------------------------
/go/2016/days/d19/heuristics.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | i=4
4 | r=1
5 |
6 | while true; do
7 | while ((r*2 < i)); do
8 | ((i++))
9 | ((r++))
10 | echo "$i [$r]"
11 | done
12 | while ((r < i)); do
13 | ((i++))
14 | ((r+=2))
15 | echo "$i [$r]"
16 | done
17 | ((i++))
18 | r=1
19 | echo "$i [$r]"
20 | done
21 |
--------------------------------------------------------------------------------
/go/2016/days/d15/input.txt:
--------------------------------------------------------------------------------
1 | Disc #1 has 13 positions; at time=0, it is at position 11.
2 | Disc #2 has 5 positions; at time=0, it is at position 0.
3 | Disc #3 has 17 positions; at time=0, it is at position 11.
4 | Disc #4 has 3 positions; at time=0, it is at position 0.
5 | Disc #5 has 7 positions; at time=0, it is at position 2.
6 | Disc #6 has 19 positions; at time=0, it is at position 17.
7 |
--------------------------------------------------------------------------------
/go/2018/days/d07/example.txt:
--------------------------------------------------------------------------------
1 | Step C must be finished before step A can begin.
2 | Step C must be finished before step F can begin.
3 | Step A must be finished before step B can begin.
4 | Step A must be finished before step D can begin.
5 | Step B must be finished before step E can begin.
6 | Step D must be finished before step E can begin.
7 | Step F must be finished before step E can begin.
8 |
--------------------------------------------------------------------------------
/go/TEMPLATES/minmax.go:
--------------------------------------------------------------------------------
1 | # OBSOLETE since Go 1.21, do not use anymore!
2 |
3 | func min(is ...int) int {
4 | min := is[0]
5 | for _, i := range is[1:] {
6 | if i < min {
7 | min = i
8 | }
9 | }
10 | return min
11 | }
12 |
13 | func max(is ...int) int {
14 | max := is[0]
15 | for _, i := range is[1:] {
16 | if i > max {
17 | max = i
18 | }
19 | }
20 | return max
21 | }
22 |
--------------------------------------------------------------------------------
/go/2023/days/d23/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d23
2 |
3 | A very straightforward problem. Part2 needed however some optimizations to scale.
4 |
5 | The naive approach of "forking" (cloning) a new state on each exploratory step was too slow, a simple approach working on the same data found the solution in 126s.
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/bash/2021/days/d04.example:
--------------------------------------------------------------------------------
1 | 7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1
2 |
3 | 22 13 17 11 0
4 | 8 2 23 4 24
5 | 21 9 14 16 7
6 | 6 10 3 18 5
7 | 1 12 20 15 19
8 |
9 | 3 15 0 2 22
10 | 9 18 13 17 5
11 | 19 8 7 25 23
12 | 20 11 10 24 4
13 | 14 21 16 12 6
14 |
15 | 14 21 17 24 4
16 | 10 16 15 9 19
17 | 18 8 23 26 20
18 | 22 11 13 6 5
19 | 2 0 12 3 7
20 |
--------------------------------------------------------------------------------
/bash/2021/days/d25-2.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://adventofcode.com/days/day/25 puzzle #2
3 | # See README.md in the parent directory
4 | in="${1:-${0%-[0-9].*}.input}"; [[ -e $in ]] || exit 1
5 | err(){ echo "***ERROR: $*" >&2; exit 1;}
6 | #export tmp=tmp.$$; clean(){ rm -f "$tmp" "$tmp".*;}; trap clean 0
7 |
8 | #TEST: example
9 | #TEST: input
10 |
11 | # This is a placeholder till we finish day 23
12 |
--------------------------------------------------------------------------------
/go/2024/days/d16/example2.txt:
--------------------------------------------------------------------------------
1 | #################
2 | #...#...#...#..E#
3 | #.#.#.#.#.#.#.#.#
4 | #.#.#.#...#...#.#
5 | #.#.#.#.###.#.#.#
6 | #...#.#.#.....#.#
7 | #.#.#.#.#.#####.#
8 | #.#...#.#.#.....#
9 | #.#.#####.#.###.#
10 | #.#.#.......#...#
11 | #.#.###.#####.###
12 | #.#.#...#.....#.#
13 | #.#.#.#####.###.#
14 | #.#.#.........#.#
15 | #.#.#.#########.#
16 | #S#.............#
17 | #################
18 |
--------------------------------------------------------------------------------
/bash/2021/days/d18.example3:
--------------------------------------------------------------------------------
1 | [[[0,[5,8]],[[1,7],[9,6]]],[[4,[1,2]],[[1,4],2]]]
2 | [[[5,[2,8]],4],[5,[[9,9],0]]]
3 | [6,[[[6,2],[5,6]],[[7,6],[4,7]]]]
4 | [[[6,[0,7]],[0,9]],[4,[9,[9,0]]]]
5 | [[[7,[6,4]],[3,[1,3]]],[[[5,5],1],9]]
6 | [[6,[[7,3],[3,2]]],[[[3,8],[5,7]],4]]
7 | [[[[5,4],[7,7]],8],[[8,3],8]]
8 | [[9,3],[[9,9],[6,[4,9]]]]
9 | [[2,[[7,7],7]],[[5,8],[[9,3],[0,2]]]]
10 | [[[[5,2],5],[8,[3,7]]],[[5,[7,5]],[4,4]]]
11 |
--------------------------------------------------------------------------------
/go/2016/days/d11/input.txt:
--------------------------------------------------------------------------------
1 | The first floor contains a promethium generator and a promethium-compatible microchip.
2 | The second floor contains a cobalt generator, a curium generator, a ruthenium generator, and a plutonium generator.
3 | The third floor contains a cobalt-compatible microchip, a curium-compatible microchip, a ruthenium-compatible microchip, and a plutonium-compatible microchip.
4 | The fourth floor contains nothing relevant.
5 |
--------------------------------------------------------------------------------
/go/2024/days/d25/example.txt:
--------------------------------------------------------------------------------
1 | #####
2 | .####
3 | .####
4 | .####
5 | .#.#.
6 | .#...
7 | .....
8 |
9 | #####
10 | ##.##
11 | .#.##
12 | ...##
13 | ...#.
14 | ...#.
15 | .....
16 |
17 | .....
18 | #....
19 | #....
20 | #...#
21 | #.#.#
22 | #.###
23 | #####
24 |
25 | .....
26 | .....
27 | #.#..
28 | ###..
29 | ###.#
30 | ###.#
31 | #####
32 |
33 | .....
34 | .....
35 | .....
36 | #....
37 | #.#..
38 | #.#.#
39 | #####
40 |
41 |
--------------------------------------------------------------------------------
/go/TEMPLATES/parsing.go:
--------------------------------------------------------------------------------
1 | // Simple parsing with Scanf, example:
2 |
3 | for lineno := 0; lineno < len(lines); lineno++ {
4 | line := lines[lineno]
5 | if nf, _ := fmt.Sscanf(line, "cpy %d %1s", &n, ®name); nf == 2 {
6 |
7 | } else if nf, _ := fmt.Sscanf(line, "cpy %1s %1s", ®name2, ®name); nf == 2 {
8 |
9 | } else {
10 | panic(fmt.Sprintf("Syntax error line %d: %s\n", lineno, line))
11 | }
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/go/2023/days/d11/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d11
2 |
3 | The problem needs to be solved by using data structures representing the list of galaxies, but never trying to instance the universe as a grid, as it would be too huge.
4 |
5 | One small detail was when the text says "expand by 10", it means "expand each row/column by adding 9", not 10
6 |
7 | And of course, the distances are computed as Mahattan distances..
8 |
--------------------------------------------------------------------------------
/go/2017/days/go.sum:
--------------------------------------------------------------------------------
1 | github.com/fxtlabs/primes v0.0.0-20150821004651-dad82d10a449 h1:HOYnhuVrhAVGKdg3rZapII640so7QfXQmkLkefUN/uM=
2 | github.com/fxtlabs/primes v0.0.0-20150821004651-dad82d10a449/go.mod h1:i+vbdOOivRRh2j+WwBkjZXloGN/+KAqfKDwNfUJeugc=
3 | golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA=
4 | golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
5 |
--------------------------------------------------------------------------------
/go/2023/days/d19/example.txt:
--------------------------------------------------------------------------------
1 | px{a<2006:qkq,m>2090:A,rfg}
2 | pv{a>1716:R,A}
3 | lnx{m>1548:A,A}
4 | rfg{s<537:gd,x>2440:R,A}
5 | qs{s>3448:A,lnx}
6 | qkq{x<1416:A,crn}
7 | crn{x>2662:A,R}
8 | in{s<1351:px,qqz}
9 | qqz{s>2770:qs,m<1801:hdj,R}
10 | gd{a>3333:R,R}
11 | hdj{m>838:A,pv}
12 |
13 | {x=787,m=2655,a=1222,s=2876}
14 | {x=1679,m=44,a=2067,s=496}
15 | {x=2036,m=264,a=79,s=2244}
16 | {x=2461,m=1339,a=466,s=291}
17 | {x=2127,m=1623,a=2188,s=1013}
18 |
--------------------------------------------------------------------------------
/bash/2021/days/d01-1.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://adventofcode.com/2021/day/1 puzzle #1
3 | # See README.md in the parent directory
4 | in="${1:-${0%-[0-9].*}.input}"; [[ -e $in ]] || exit 1
5 |
6 | #TEST: example 7
7 | #TEST: input 1696
8 |
9 | # brute force
10 | previous=
11 | count=0
12 | while read -r number; do
13 | [[ -n $previous ]] && (( number > previous )) && (( ++count ))
14 | previous="$number"
15 | done <"$in"
16 | echo "$count"
17 |
--------------------------------------------------------------------------------
/go/2018/days/go.sum:
--------------------------------------------------------------------------------
1 | github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203 h1:XBBHcIb256gUJtLmY22n99HaZTz+r2Z51xUPi01m3wg=
2 | github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203/go.mod h1:E1jcSv8FaEny+OP/5k9UxZVw9YFWGj7eI4KR/iOBqCg=
3 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
4 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5 |
--------------------------------------------------------------------------------
/go/2023/days/d05/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d05
2 |
3 | The part1 was quite simple, however the naive approch to examine each seed does not scale for the part2.
4 |
5 | Since for each mapping, the resulting values are always bigger than the one for the start of the range interval, we will thus examine only the start of the range, and discard the rest as it cannot have a lower location. However, as we go through the maps, we must split the range if we fall in a smaller range for the n+1 map.
6 |
--------------------------------------------------------------------------------
/bash/2021/days/d24-2.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://adventofcode.com/days/day/24 puzzle #2
3 | # See README.md in the parent directory
4 | in="${1:-${0%-[0-9].*}.input}"; [[ -e $in ]] || exit 1
5 | err(){ echo "***ERROR: $*" >&2; exit 1;}
6 | export tmp=tmp.$$; clean(){ rm -f "$tmp" "$tmp".*;}; trap clean 0
7 |
8 | #TEST: input 21191861151161
9 |
10 | # run d24-1.sh to generate the C program
11 | d24-1.sh d24.input 21191861151161
12 |
13 | # run it
14 | gcc -O -o d24.bin d24.c; ./d24.bin 2; rm -f d24.bin d24.c
15 |
--------------------------------------------------------------------------------
/bash/2021/days/d19.small:
--------------------------------------------------------------------------------
1 | --- scanner 0 ---
2 | -1,-1,1
3 | -2,-2,2
4 | -3,-3,3
5 | -2,-3,1
6 | 5,6,-4
7 | 8,0,7
8 |
9 | --- scanner 0 ---
10 | 1,-1,1
11 | 2,-2,2
12 | 3,-3,3
13 | 2,-1,3
14 | -5,4,-6
15 | -8,-7,0
16 |
17 | --- scanner 0 ---
18 | -1,-1,-1
19 | -2,-2,-2
20 | -3,-3,-3
21 | -1,-3,-2
22 | 4,6,5
23 | -7,0,8
24 |
25 | --- scanner 0 ---
26 | 1,1,-1
27 | 2,2,-2
28 | 3,3,-3
29 | 1,3,-2
30 | -4,-6,5
31 | 7,0,8
32 |
33 | --- scanner 0 ---
34 | 1,1,1
35 | 2,2,2
36 | 3,3,3
37 | 3,1,2
38 | -6,-4,-5
39 | 0,7,-8
40 |
--------------------------------------------------------------------------------
/go/2023/days/d05/example.txt:
--------------------------------------------------------------------------------
1 | seeds: 79 14 55 13
2 |
3 | seed-to-soil map:
4 | 50 98 2
5 | 52 50 48
6 |
7 | soil-to-fertilizer map:
8 | 0 15 37
9 | 37 52 2
10 | 39 0 15
11 |
12 | fertilizer-to-water map:
13 | 49 53 8
14 | 0 11 42
15 | 42 0 7
16 | 57 7 4
17 |
18 | water-to-light map:
19 | 88 18 7
20 | 18 25 70
21 |
22 | light-to-temperature map:
23 | 45 77 23
24 | 81 45 19
25 | 68 64 13
26 |
27 | temperature-to-humidity map:
28 | 0 69 1
29 | 1 0 69
30 |
31 | humidity-to-location map:
32 | 60 56 37
33 | 56 93 4
34 |
--------------------------------------------------------------------------------
/go/2015/TEMPLATES/permutations.go:
--------------------------------------------------------------------------------
1 |
2 | // Enumerate all the subsets of size k from a set of size n
3 | // Fast algortihm via bitsets, but only for n < 64
4 | // see http://math0.wvstateu.edu/~baker/cs405/code/Subset.html
5 |
6 | func subsetsList(n, k int) []int {
7 | x := intPower(2, k) - 1
8 | max := intPower(2, n) - intPower(2, n-k)
9 | s := make([]int, 1, max-x)
10 | s[0] = x
11 | for x < max {
12 | u := x & (-x)
13 | v := x + u
14 | x = v + (((v ^ x) / u) >> 2)
15 | s = append(s, x)
16 | }
17 | return s
18 | }
19 |
--------------------------------------------------------------------------------
/go/2023/days/go.sum:
--------------------------------------------------------------------------------
1 | github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM=
2 | github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
3 | github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
4 | github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
5 | gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0=
6 | gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU=
7 |
--------------------------------------------------------------------------------
/go/2023/days/d19/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d19
2 |
3 | The part 2 difficulty is scaling up. Trying all the combinations would mean trying 4000^4, more than 10^18.
4 |
5 | At firts I tried the approach I used in the day before, to divide the 4D solution space into 4D tiles, but it was still big (4 billion tiles), running in more than 2 minutes. (I saved this approach as a "part 3"). So I just explored the tree, auto-creating new tiles on the go, splitting at each condition comparison. I Then only had to look at 500 tiles altogether...
6 |
--------------------------------------------------------------------------------
/go/2016/days/d22/example.txt:
--------------------------------------------------------------------------------
1 | root@ebhq-gridcenter# df -h
2 | Filesystem Size Used Avail Use%
3 | /dev/grid/node-x0-y0 10T 8T 2T 80%
4 | /dev/grid/node-x0-y1 11T 6T 5T 54%
5 | /dev/grid/node-x0-y2 32T 28T 4T 87%
6 | /dev/grid/node-x1-y0 9T 7T 2T 77%
7 | /dev/grid/node-x1-y1 8T 0T 8T 0%
8 | /dev/grid/node-x1-y2 11T 7T 4T 63%
9 | /dev/grid/node-x2-y0 10T 6T 4T 60%
10 | /dev/grid/node-x2-y1 9T 8T 1T 88%
11 | /dev/grid/node-x2-y2 9T 6T 3T 66%
12 |
--------------------------------------------------------------------------------
/bash/2021/days/d02-1.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://adventofcode.com/2021/day/2 puzzle #1
3 | # See README.md in the parent directory
4 | in="${1:-${0%-[0-9].*}.input}"; [[ -e $in ]] || exit 1
5 |
6 | #TEST: example 150
7 | #TEST: input 1507611
8 |
9 | # Brute force. Ignore invalid lines.
10 | horiz=0
11 | depth=0
12 | while read -r command value; do
13 | case "$command" in
14 | forward) (( horiz += value ));;
15 | down) (( depth += value ));;
16 | up) (( depth -= value ));;
17 | esac
18 | done <"$in"
19 | echo $(( horiz * depth ))
20 |
--------------------------------------------------------------------------------
/go/2015/days/day04/day04_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func TestPart1(t *testing.T) {
8 | t.Run("Test Part1.1", func(t *testing.T) {
9 | got := Part1([]byte("abcdef"))
10 | expected := 609043
11 | if got != expected {
12 | t.Errorf("expected '%d' but got '%d'", expected, got)
13 | }
14 | })
15 | t.Run("Test Part1.2", func(t *testing.T) {
16 | got := Part1([]byte("pqrstuv"))
17 | expected := 1048970
18 | if got != expected {
19 | t.Errorf("expected '%d' but got '%d'", expected, got)
20 | }
21 | })
22 | }
23 |
--------------------------------------------------------------------------------
/go/2015/days/day23/input.txt:
--------------------------------------------------------------------------------
1 | jio a, +19
2 | inc a
3 | tpl a
4 | inc a
5 | tpl a
6 | inc a
7 | tpl a
8 | tpl a
9 | inc a
10 | inc a
11 | tpl a
12 | tpl a
13 | inc a
14 | inc a
15 | tpl a
16 | inc a
17 | inc a
18 | tpl a
19 | jmp +23
20 | tpl a
21 | tpl a
22 | inc a
23 | inc a
24 | tpl a
25 | inc a
26 | inc a
27 | tpl a
28 | inc a
29 | tpl a
30 | inc a
31 | tpl a
32 | inc a
33 | tpl a
34 | inc a
35 | inc a
36 | tpl a
37 | inc a
38 | inc a
39 | tpl a
40 | tpl a
41 | inc a
42 | jio a, +8
43 | inc b
44 | jie a, +4
45 | tpl a
46 | inc a
47 | jmp +2
48 | hlf a
49 | jmp -7
50 |
--------------------------------------------------------------------------------
/go/2015/days/day23/input2.txt:
--------------------------------------------------------------------------------
1 | jio a, +19
2 | inc a
3 | tpl a
4 | inc a
5 | tpl a
6 | inc a
7 | tpl a
8 | tpl a
9 | inc a
10 | inc a
11 | tpl a
12 | tpl a
13 | inc a
14 | inc a
15 | tpl a
16 | inc a
17 | inc a
18 | tpl a
19 | jmp +23
20 | tpl a
21 | tpl a
22 | inc a
23 | inc a
24 | tpl a
25 | inc a
26 | inc a
27 | tpl a
28 | inc a
29 | tpl a
30 | inc a
31 | tpl a
32 | inc a
33 | tpl a
34 | inc a
35 | inc a
36 | tpl a
37 | inc a
38 | inc a
39 | tpl a
40 | tpl a
41 | inc a
42 | jio a, +8
43 | inc b
44 | jie a, +4
45 | tpl a
46 | inc a
47 | jmp +2
48 | hlf a
49 | jmp -7
50 |
--------------------------------------------------------------------------------
/bash/2021/days/d06-2.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://adventofcode.com/days/day/6 puzzle #2
3 | # See README.md in the parent directory
4 | in="${1:-${0%-[0-9].*}.input}"; [[ -e $in ]] || exit 1
5 | err(){ echo "***ERROR: $*" >&2; exit 1;}
6 | export tmp=tmp.$$; clean(){ rm -f "$tmp" "$tmp".*;}; trap clean 0
7 | #TEST: input 1650309278600
8 | #TEST: example 26984457539
9 |
10 | # The second problem is just the first, with steps 256 instead of 80
11 | steps="${2:-256}" # 2nd argument is the number of steps (def, 80)
12 |
13 | "${0//d06-2/d06-1}" "$in" "$steps"
14 |
--------------------------------------------------------------------------------
/bash/2021/days/d20.example2:
--------------------------------------------------------------------------------
1 | #.#.###........##....#.......#..##.#.##...#..##...#..##.......##..##.#..####.#.#..#..#...#.##...##.####..###.#.###.#####...##.#.###..#..#.##...##..####...#..#.#.###....####.####.##.####.#..##.##...#####.##.#.##.#..##.##.##.###.#..##.#.##...###.###..###....#.########..##..#...#....###.####.#######..#.##.##...####.#.#.###.#..#.......#..##..##.##....####.##.#.#.##.#.#.#.##.#..##..##.#..####.#....##.#...#.##.#....#......#...##.##.#.#...#.#.#.#..#.##.#..##...##.#.#.##..###.##.#.###..#####.#...###..#.....#....#..
2 |
3 | #..#.
4 | #....
5 | ##..#
6 | ..#..
7 | ..###
8 |
--------------------------------------------------------------------------------
/bash/2021/days/d06.input:
--------------------------------------------------------------------------------
1 | 3,4,1,2,1,2,5,1,2,1,5,4,3,2,5,1,5,1,2,2,2,3,4,5,2,5,1,3,3,1,3,4,1,5,3,2,2,1,3,2,5,1,1,4,1,4,5,1,3,1,1,5,3,1,1,4,2,2,5,1,5,5,1,5,4,1,5,3,5,1,1,4,1,2,2,1,1,1,4,2,1,3,1,1,4,5,1,1,1,1,1,5,1,1,4,1,1,1,1,2,1,4,2,1,2,4,1,3,1,2,3,2,4,1,1,5,1,1,1,2,5,5,1,1,4,1,2,2,3,5,1,4,5,4,1,3,1,4,1,4,3,2,4,3,2,4,5,1,4,5,2,1,1,1,1,1,3,1,5,1,3,1,1,2,1,4,1,3,1,5,2,4,2,1,1,1,2,1,1,4,1,1,1,1,1,5,4,1,3,3,5,3,2,5,5,2,1,5,2,4,4,1,5,2,3,1,5,3,4,1,5,1,5,3,1,1,1,4,4,5,1,1,1,3,1,4,5,1,2,3,1,3,2,3,1,3,5,4,3,1,3,4,3,1,2,1,1,3,1,1,3,1,1,4,1,2,1,2,5,1,1,3,5,3,3,3,1,1,1,1,1,5,3,3,1,1,3,4,1,1,4,1,1,2,4,4,1,1,3,1,3,2,2,1,2,5,3,3,1,1
2 |
--------------------------------------------------------------------------------
/go/2017/days/d21/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d21
2 |
3 | For this problem, I tried to keep the data structures as close to the human-readable input as possible, and put the logic in the functions/met6hods handling them instead of optimizing the data structure.
4 |
5 | I just pre-generated all the possible variants of a pattern, so that rule matching would be simple string comparisons. However, I kind of made an ad hoc hashtable in that I grouped the matching patterns (the conditions part of the rule) by string lenghth and number of lit pixels, to limit the number of matches to perform.
6 |
--------------------------------------------------------------------------------
/bash/2021/days/d01-2.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://adventofcode.com/2021/day/1 puzzle #2
3 | # See README.md in the parent directory
4 | in="${1:-${0%-[0-9].*}.input}"; [[ -e $in ]] || exit 1
5 | export tmp=tmp.$$; clean(){ rm -f "$tmp" "$tmp".*;}; trap clean 0
6 |
7 | #TEST: example 5
8 | #TEST: input 1737
9 |
10 | # converts input to sliding sums of n1,n2,n3
11 | # and feed it to 1-1.sh to count the increases
12 | n1=
13 | n2=
14 | n3=
15 | while read -r n3; do
16 | [[ -n $n1 && -n $n2 ]] && echo $(( n1 + n2 + n3 ))
17 | n1="$n2"
18 | n2="$n3"
19 | done <"$in" >"$tmp"
20 |
21 | ./d01-1.sh "$tmp"
22 |
--------------------------------------------------------------------------------
/go/2015/days/day07/day07_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | // reflect.DeepEqual(got, expected)
8 | func Test_Part1(t *testing.T) {
9 | t.Run("1", func(t *testing.T) {
10 | got := int(Part1([]string{"3 -> a"}))
11 | expected := 3
12 | if got != expected {
13 | t.Errorf("expected '%v' but got '%v'", expected, got)
14 | }
15 | })
16 | t.Run("1", func(t *testing.T) {
17 | got := int(Part1([]string{"3 -> x", "6 -> y", "x AND y -> a"}))
18 | expected := 2
19 | if got != expected {
20 | t.Errorf("expected '%v' but got '%v'", expected, got)
21 | }
22 | })
23 | }
24 |
--------------------------------------------------------------------------------
/bash/2021/days/d20.example:
--------------------------------------------------------------------------------
1 | ..#.#..#####.#.#.#.###.##.....###.##.#..###.####..#####..#....#..#..##..##
2 | #..######.###...####..#..#####..##..#.#####...##.#.#..#.##..#.#......#.###
3 | .######.###.####...#.##.##..#..#..#####.....#.#....###..#.##......#.....#.
4 | .#..#..##..#...##.######.####.####.#.#...#.......#..#.#.#...####.##.#.....
5 | .#..#...##.#.##..#...##.#.##..###.#......#.#.......#.#.#.####.###.##...#..
6 | ...####.#..#..#.##.#....##..#.####....##...##..#...#......#.#.......#.....
7 | ..##..####..#...#.#.#...##..#.#..###..#####........#..####......#..#
8 |
9 | #..#.
10 | #....
11 | ##..#
12 | ..#..
13 | ..###
14 |
--------------------------------------------------------------------------------
/go/2015/days/day01/day01_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func TestPart1(t *testing.T) {
8 | t.Run("Test Part1 with valid list", func(t *testing.T) {
9 | got := Part1(")())())")
10 | expected := -3
11 | if got != expected {
12 | t.Errorf("expected '%d' but got '%d'", expected, got)
13 | }
14 | })
15 | }
16 |
17 | func TestPart2(t *testing.T) {
18 | t.Run("Test Part2 with valid list", func(t *testing.T) {
19 | got := Part2(")())())")
20 | expected := 1
21 | if got != expected {
22 | t.Errorf("expected '%d' but got '%d'", expected, got)
23 | }
24 | })
25 | }
26 |
--------------------------------------------------------------------------------
/go/2022/days/d16/example.txt:
--------------------------------------------------------------------------------
1 | Valve AA has flow rate=0; tunnels lead to valves DD, II, BB
2 | Valve BB has flow rate=13; tunnels lead to valves CC, AA
3 | Valve CC has flow rate=2; tunnels lead to valves DD, BB
4 | Valve DD has flow rate=20; tunnels lead to valves CC, AA, EE
5 | Valve EE has flow rate=3; tunnels lead to valves FF, DD
6 | Valve FF has flow rate=0; tunnels lead to valves EE, GG
7 | Valve GG has flow rate=0; tunnels lead to valves FF, HH
8 | Valve HH has flow rate=22; tunnel leads to valve GG
9 | Valve II has flow rate=0; tunnels lead to valves AA, JJ
10 | Valve JJ has flow rate=21; tunnel leads to valve II
11 |
--------------------------------------------------------------------------------
/bash/2021/days/d08-1.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://adventofcode.com/days/day/8 puzzle #1
3 | # See README.md in the parent directory
4 | in="${1:-${0%-[0-9].*}.input}"; [[ -e $in ]] || exit 1
5 |
6 | #TEST: example 26
7 | #TEST: input 504
8 |
9 | # simple brute force: first emit the output values one per line,
10 | # and count the ones with the proper length via a regexp.
11 | # Possible lengths: 2 4 3 7 for the digits 1 4 7 8
12 |
13 | grep -oP '\| +\K.*' <"$in" | # keep only the values after the "|"
14 | tr ' ' '\n' | # emit one value per line
15 | grep -Ec '^(..|....|...|.......)$' # count the ones of the proper lengths
16 |
--------------------------------------------------------------------------------
/go/2016/days/d01/input.txt:
--------------------------------------------------------------------------------
1 | R2, L1, R2, R1, R1, L3, R3, L5, L5, L2, L1, R4, R1, R3, L5, L5, R3, L4, L4, R5, R4, R3, L1, L2, R5, R4, L2, R1, R4, R4, L2, L1, L1, R190, R3, L4, R52, R5, R3, L5, R3, R2, R1, L5, L5, L4, R2, L3, R3, L1, L3, R5, L3, L4, R3, R77, R3, L2, R189, R4, R2, L2, R2, L1, R5, R4, R4, R2, L2, L2, L5, L1, R1, R2, L3, L4, L5, R1, L1, L2, L2, R2, L3, R3, L4, L1, L5, L4, L4, R3, R5, L2, R4, R5, R3, L2, L2, L4, L2, R2, L5, L4, R3, R1, L2, R2, R4, L1, L4, L4, L2, R2, L4, L1, L1, R4, L1, L3, L2, L2, L5, R5, R2, R5, L1, L5, R2, R4, R4, L2, R5, L5, R5, R5, L4, R2, R1, R1, R3, L3, L3, L4, L3, L2, L2, L2, R2, L1, L3, R2, R5, R5, L4, R3, L3, L4, R2, L5, R5
2 |
--------------------------------------------------------------------------------
/go/2025/days/go.sum:
--------------------------------------------------------------------------------
1 | github.com/aclements/go-z3 v0.0.0-20220809013456-4675d5f90ca5 h1:A27FEXOK2zSHuCwXwmPIKfrHcT+caybRGb1kaW4KOBI=
2 | github.com/aclements/go-z3 v0.0.0-20220809013456-4675d5f90ca5/go.mod h1:Dcqk4DTCIWIVv0jiFnYg5nnTIOWZ3JgU/mYjb5puA1s=
3 | github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82 h1:7dONQ3WNZ1zy960TmkxJPuwoolZwL7xKtpcM04MBnt4=
4 | github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82/go.mod h1:nLnM0KdK1CmygvjpDUO6m1TjSsiQtL61juhNsvV/JVI=
5 | github.com/crillab/gophersat v1.4.0 h1:irf9ajKmNnEURjgPU4oz+ouqIXXLQ59ZNd3NC+hULMc=
6 | github.com/crillab/gophersat v1.4.0/go.mod h1:gDzeMEBrqJR20IL9JW25tFHNGLU5+GDeJzr0zpi3mxs=
7 |
--------------------------------------------------------------------------------
/bash/2021/days/d02-2.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://adventofcode.com/2021/day/2 puzzle #2
3 | # See README.md in the parent directory
4 | in="${1:-${0%-[0-9].*}.input}"; [[ -e $in ]] || exit 1
5 |
6 | #TEST: example 900
7 | #TEST: input 1880593125
8 |
9 | # Brute force. Ignore invalid lines.
10 | horiz=0
11 | depth=0
12 | aim=0
13 | while read -r command value; do
14 | case "$command" in
15 | forward)
16 | (( horiz += value ))
17 | (( depth += ( aim * value) ))
18 | ;;
19 | down) (( aim += value ));;
20 | up) (( aim -= value ));;
21 | esac
22 | done <"$in"
23 | echo $(( horiz * depth ))
24 |
--------------------------------------------------------------------------------
/go/2015/TEMPLATES/TEST.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "reflect"
5 | "testing"
6 | )
7 |
8 | // reflect.DeepEqual(got, expected)
9 | func Test_part1(t *testing.T) {
10 | t.Run("1", func(t *testing.T) {
11 | got := part1([]string{("foo")})
12 | expected := 2
13 | if got != expected {
14 | t.Errorf("expected '%v' but got '%v'", expected, got)
15 | }
16 | })
17 | }
18 |
19 | func Test_part2(t *testing.T) {
20 | t.Run("1", func(t *testing.T) {
21 | got := part1([]string{("foo")})
22 | expected := 2
23 | if !reflect.DeepEqual(got, expected) {
24 | t.Errorf("expected '%v' but got '%v'", expected, got)
25 | }
26 | })
27 | }
28 |
--------------------------------------------------------------------------------
/go/2015/days/day19/day19_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "reflect"
5 | "testing"
6 | )
7 |
8 | // reflect.DeepEqual(got, expected)
9 | func Test_part1(t *testing.T) {
10 | t.Run("1", func(t *testing.T) {
11 | got := part1([]string{("foo")})
12 | expected := 2
13 | if got != expected {
14 | t.Errorf("expected '%v' but got '%v'", expected, got)
15 | }
16 | })
17 | }
18 |
19 | func Test_part2(t *testing.T) {
20 | t.Run("1", func(t *testing.T) {
21 | got := part1([]string{("foo")})
22 | expected := 2
23 | if !reflect.DeepEqual(got, expected) {
24 | t.Errorf("expected '%v' but got '%v'", expected, got)
25 | }
26 | })
27 | }
28 |
--------------------------------------------------------------------------------
/go/2015/days/day23/day23_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "reflect"
5 | "testing"
6 | )
7 |
8 | // reflect.DeepEqual(got, expected)
9 | func Test_part1(t *testing.T) {
10 | t.Run("1", func(t *testing.T) {
11 | got := part1([]string{("foo")})
12 | expected := 2
13 | if got != expected {
14 | t.Errorf("expected '%v' but got '%v'", expected, got)
15 | }
16 | })
17 | }
18 |
19 | func Test_part2(t *testing.T) {
20 | t.Run("1", func(t *testing.T) {
21 | got := part1([]string{("foo")})
22 | expected := 2
23 | if !reflect.DeepEqual(got, expected) {
24 | t.Errorf("expected '%v' but got '%v'", expected, got)
25 | }
26 | })
27 | }
28 |
--------------------------------------------------------------------------------
/go/2018/days/d04/example.txt:
--------------------------------------------------------------------------------
1 | [1518-11-01 00:00] Guard #10 begins shift
2 | [1518-11-01 00:05] falls asleep
3 | [1518-11-01 00:25] wakes up
4 | [1518-11-01 00:30] falls asleep
5 | [1518-11-01 00:55] wakes up
6 | [1518-11-01 23:58] Guard #99 begins shift
7 | [1518-11-02 00:40] falls asleep
8 | [1518-11-02 00:50] wakes up
9 | [1518-11-03 00:05] Guard #10 begins shift
10 | [1518-11-03 00:24] falls asleep
11 | [1518-11-03 00:29] wakes up
12 | [1518-11-04 00:02] Guard #99 begins shift
13 | [1518-11-04 00:36] falls asleep
14 | [1518-11-04 00:46] wakes up
15 | [1518-11-05 00:03] Guard #99 begins shift
16 | [1518-11-05 00:45] falls asleep
17 | [1518-11-05 00:55] wakes up
18 |
--------------------------------------------------------------------------------
/go/2017/days/d25/example.txt:
--------------------------------------------------------------------------------
1 | Begin in state A.
2 | Perform a diagnostic checksum after 6 steps.
3 |
4 | In state A:
5 | If the current value is 0:
6 | - Write the value 1.
7 | - Move one slot to the right.
8 | - Continue with state B.
9 | If the current value is 1:
10 | - Write the value 0.
11 | - Move one slot to the left.
12 | - Continue with state B.
13 |
14 | In state B:
15 | If the current value is 0:
16 | - Write the value 1.
17 | - Move one slot to the left.
18 | - Continue with state A.
19 | If the current value is 1:
20 | - Write the value 1.
21 | - Move one slot to the right.
22 | - Continue with state A.
23 |
--------------------------------------------------------------------------------
/go/2023/days/d23/example.txt:
--------------------------------------------------------------------------------
1 | #.#####################
2 | #.......#########...###
3 | #######.#########.#.###
4 | ###.....#.>.>.###.#.###
5 | ###v#####.#v#.###.#.###
6 | ###.>...#.#.#.....#...#
7 | ###v###.#.#.#########.#
8 | ###...#.#.#.......#...#
9 | #####.#.#.#######.#.###
10 | #.....#.#.#.......#...#
11 | #.#####.#.#.#########v#
12 | #.#...#...#...###...>.#
13 | #.#.#v#######v###.###v#
14 | #...#.>.#...>.>.#.###.#
15 | #####v#.#.###v#.#.###.#
16 | #.....#...#...#.#.#...#
17 | #.#########.###.#.#.###
18 | #...###...#...#...#.###
19 | ###.###.#.###v#####v###
20 | #...#...#.#.>.>.#.>.###
21 | #.###.###.#.###.#.#v###
22 | #.....###...###...#...#
23 | #####################.#
24 |
--------------------------------------------------------------------------------
/go/2015/days/day21/shop.txt:
--------------------------------------------------------------------------------
1 | Weapons: Cost Damage Armor
2 | Dagger 8 4 0
3 | Shortsword 10 5 0
4 | Warhammer 25 6 0
5 | Longsword 40 7 0
6 | Greataxe 74 8 0
7 |
8 | Armor: Cost Damage Armor
9 | Leather 13 0 1
10 | Chainmail 31 0 2
11 | Splintmail 53 0 3
12 | Bandedmail 75 0 4
13 | Platemail 102 0 5
14 |
15 | Rings: Cost Damage Armor
16 | Damage +1 25 1 0
17 | Damage +2 50 2 0
18 | Damage +3 100 3 0
19 | Defense +1 20 0 1
20 | Defense +2 40 0 2
21 | Defense +3 80 0 3
22 |
--------------------------------------------------------------------------------
/go/2015/days/day17/day17_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | // reflect.DeepEqual(got, expected)
8 | func Test_part1(t *testing.T) {
9 | t.Run("1", func(t *testing.T) {
10 | cans := readCans(fileToLines("exemple.txt"))
11 | got := part1(cans, 25)
12 | expected := 4
13 | if got != expected {
14 | t.Errorf("expected '%v' but got '%v'", expected, got)
15 | }
16 | })
17 | }
18 |
19 | func Test_part2(t *testing.T) {
20 | t.Run("1", func(t *testing.T) {
21 | cans := readCans(fileToLines("exemple.txt"))
22 | got := part2(cans, 25)
23 | expected := 3
24 | if got != expected {
25 | t.Errorf("expected '%v' but got '%v'", expected, got)
26 | }
27 | })
28 | }
29 |
--------------------------------------------------------------------------------
/go/2015/days/day14/input.txt:
--------------------------------------------------------------------------------
1 | Vixen can fly 19 km/s for 7 seconds, but then must rest for 124 seconds.
2 | Rudolph can fly 3 km/s for 15 seconds, but then must rest for 28 seconds.
3 | Donner can fly 19 km/s for 9 seconds, but then must rest for 164 seconds.
4 | Blitzen can fly 19 km/s for 9 seconds, but then must rest for 158 seconds.
5 | Comet can fly 13 km/s for 7 seconds, but then must rest for 82 seconds.
6 | Cupid can fly 25 km/s for 6 seconds, but then must rest for 145 seconds.
7 | Dasher can fly 14 km/s for 3 seconds, but then must rest for 38 seconds.
8 | Dancer can fly 3 km/s for 16 seconds, but then must rest for 37 seconds.
9 | Prancer can fly 25 km/s for 6 seconds, but then must rest for 143 seconds.
10 |
--------------------------------------------------------------------------------
/go/2018/days/d06/d06_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | //"reflect"
6 | )
7 |
8 | /////////// Setups
9 |
10 | var locs = []Point{Point{1,1}, Point{1,6}, Point{8,3}, Point{3,4}, Point{5,5}, Point{8,9}}
11 |
12 | /////////// Tests to pass
13 |
14 | func Test(t *testing.T) {
15 | // calls to test function(s) args (adapt "args" and "expected")
16 | t_ClosestXY("Closest-1", t, locs, 2, 2, 0)
17 | }
18 |
19 | /////////// Functions to test
20 |
21 | func t_ClosestXY(label string, t *testing.T, locs []Point, x, y int, expected int) {
22 | t.Run(label, func(t *testing.T) {
23 | got := ClosestXY(locs, x, y)
24 | if got != expected {
25 | t.Errorf("exp '%v'\ngot '%v'", expected, got)
26 | }})}
27 |
--------------------------------------------------------------------------------
/go/2024/days/go.sum:
--------------------------------------------------------------------------------
1 | github.com/bits-and-blooms/bitset v1.20.0 h1:2F+rfL86jE2d/bmw7OhqUg2Sj/1rURkBn3MdfoPyRVU=
2 | github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
3 | github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
4 | github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
5 | github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
6 | github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
7 | gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0=
8 | gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o=
9 |
--------------------------------------------------------------------------------
/go/2023/days/d21/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d21
2 |
3 | Part1 was trivial, but Part 2 was quite hard, and not very interesting as a programming exercice. It consited in understanding howthe input was hyper-specific and design and ad hoc solution that worked only in this specific case.
4 | - the set of reachable plots spread out in a diamond pattern undisturbed, ad there are no rocks on lines going straight out the starting place, either horizonatlly, vertically, or in diagonals
5 | - once filled, the "tiles" ocillate between two patterns
6 | - the number of steps is very specific, a multiple of the input "tile" side (131) plus half (65)
7 | - the the number is expressed in a quadratic functions, that we have to solve.
8 |
--------------------------------------------------------------------------------
/go/2025/days/d11/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2025, in GO, day d11
2 |
3 | [Problem statement](https://adventofcode.com/2025/day/11)
4 |
5 | The input dscribe a graph of less than 640 nodes with max 25 directed edges connected to each of them, with no loops.
6 |
7 | For part 2, to find all paths going through `A -> B -> C -> D` we find all paths:
8 | - going from A to B without going through C or D,
9 | - then going from B to C without going through D. No need to check for A since we do not have loops
10 | - then going from C to D, without checking for A or B
11 | And we add the number of paths found by the same process for `A -> C -> B -> D`
12 |
13 | We cache the results of the pathfinding functions to avoid a combinatorial explosion.
14 |
--------------------------------------------------------------------------------
/go/2022/days/d11/example.txt:
--------------------------------------------------------------------------------
1 | Monkey 0:
2 | Starting items: 79, 98
3 | Operation: new = old * 19
4 | Test: divisible by 23
5 | If true: throw to monkey 2
6 | If false: throw to monkey 3
7 |
8 | Monkey 1:
9 | Starting items: 54, 65, 75, 74
10 | Operation: new = old + 6
11 | Test: divisible by 19
12 | If true: throw to monkey 2
13 | If false: throw to monkey 0
14 |
15 | Monkey 2:
16 | Starting items: 79, 60, 97
17 | Operation: new = old * old
18 | Test: divisible by 13
19 | If true: throw to monkey 1
20 | If false: throw to monkey 3
21 |
22 | Monkey 3:
23 | Starting items: 74
24 | Operation: new = old + 3
25 | Test: divisible by 17
26 | If true: throw to monkey 0
27 | If false: throw to monkey 1
28 |
--------------------------------------------------------------------------------
/go/2015/days/MAKEDAY:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Usage: MAKEDAY N
3 | # creates the set of files for day N
4 | n="$1"
5 | [[ $n =~ ^[[:digit:]]+$ ]] || { echo "Usage: MAKEDAY N"; exit 1;}
6 | [[ ${#n} == 1 ]] && n="0$n"
7 |
8 | name="day$n"
9 | # The current path must contain the year
10 | [[ $PWD =~ go/([[:digit:]]{4})/ ]] && YYYY=${BASH_REMATCH[1]}
11 |
12 | [[ -e "$name/$name.go" ]] && { echo "ABORT: $name already exists"; exit 1;}
13 |
14 | mkdir -p "$name"
15 | cp ../TEMPLATES/TEST.go "$name/${name}_test.go"
16 | cp ../TEMPLATES/utils.go "$name"
17 | sed -r -e "s/YYYY/$YYYY/g" -e "s/dayNN/$name/g" \
18 | <../TEMPLATES/INIT.go >"$name/$name.go"
19 | touch "$name/input.txt"
20 |
21 | echo "Generated $name/$name.go $name/${name}_test.go $name/input.txt in $name/"
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Colas: advent-of-code-my-solutions
2 |
3 | These are my solutions for the [advent-of-code](https://adventofcode.com/) puzzles.
4 | The code is reasonably commented, and the top README in each directory details the tricks/tweaks/hacks I used.
5 |
6 | Available for now:
7 |
8 | - [go/2025](go/2025) (completed)
9 | - [go/2024](go/2024) (completed)
10 | - [go/2023](go/2023) (completed)
11 | - [go/2022](go/2022) (completed)
12 | - [bash/2021](bash/2021) (completed)
13 | - go/2020 (to do)
14 | - go/2019 (to do)
15 | - [go/2018](go/2018) (in progress)
16 | - [go/2017](go/2017) (completed)
17 | - [go/2016](go/2016) (completed)
18 | - [go/2015](go/2015) (completed)
19 |
20 | Author: (c)2021-2025 Colas Nahaboo, https://colas.nahaboo.net
21 | License: free of use via the MIT License
22 |
--------------------------------------------------------------------------------
/go/2015/days/day13/exemple.txt:
--------------------------------------------------------------------------------
1 | Alice would gain 54 happiness units by sitting next to Bob.
2 | Alice would lose 79 happiness units by sitting next to Carol.
3 | Alice would lose 2 happiness units by sitting next to David.
4 | Bob would gain 83 happiness units by sitting next to Alice.
5 | Bob would lose 7 happiness units by sitting next to Carol.
6 | Bob would lose 63 happiness units by sitting next to David.
7 | Carol would lose 62 happiness units by sitting next to Alice.
8 | Carol would gain 60 happiness units by sitting next to Bob.
9 | Carol would gain 55 happiness units by sitting next to David.
10 | David would gain 46 happiness units by sitting next to Alice.
11 | David would lose 7 happiness units by sitting next to Bob.
12 | David would gain 41 happiness units by sitting next to Carol.
13 |
--------------------------------------------------------------------------------
/go/2023/days/d08/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d08
2 |
3 | The part 2 is one of these problems where the problem text is not solvable in reasonable time, but by examining the input, we can see it has very specific properties that enable to use an ad hoc, very simplified solution.
4 |
5 | Here, in the input, the ghost each go through only one Z-ended node, looping with a fixed loop of period P, that coincidentally also starts at zero. Thus solution is thus trivial: the least common multiplicator (aka "LCM") of all the ghost loop periods.
6 |
7 |
8 | ```mermaid
9 | flowchart LR
10 | XXA --> |P| XXZ
11 | XXZ --> |P| XXZ
12 | ```
13 |
14 | My code checks that the input is in this special case and applies the LCM shortcut, or otherwise fall back to the general solution.
15 |
--------------------------------------------------------------------------------
/go/2022/days/MAKEDAY:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Usage: MAKEDAY N
3 | # creates the set of files for day N
4 | n="$1"
5 | [[ $n =~ ^[[:digit:]]+$ ]] || { echo "Usage: MAKEDAY N"; exit 1;}
6 | [[ ${#n} == 1 ]] && n="0$n"
7 |
8 | name="d$n"
9 | # The current path must contain the year
10 | [[ $PWD =~ go/([[:digit:]]{4})/ ]] && YYYY=${BASH_REMATCH[1]}
11 |
12 | [[ -e "$name/$name.go" ]] && { echo "ABORT: $name already exists"; exit 1;}
13 |
14 | mkdir -p "$name"
15 | cp ../../TEMPLATES/TEST.go "$name/${name}_test.go"
16 | cp ../../TEMPLATES/utils.go "$name"
17 | sed -r -e "s/YYYY/$YYYY/g" -e "s/dNN/$name/g" \
18 | <../../TEMPLATES/INIT.go >"$name/$name.go"
19 | touch "$name/input.txt" "$name/example.txt"
20 |
21 | echo "Generated $name/$name.go $name/${name}_test.go $name/input.txt $name/example.txt in $name/"
22 |
23 |
--------------------------------------------------------------------------------
/go/2022/days/d15/example.txt:
--------------------------------------------------------------------------------
1 | Sensor at x=2, y=18: closest beacon is at x=-2, y=15
2 | Sensor at x=9, y=16: closest beacon is at x=10, y=16
3 | Sensor at x=13, y=2: closest beacon is at x=15, y=3
4 | Sensor at x=12, y=14: closest beacon is at x=10, y=16
5 | Sensor at x=10, y=20: closest beacon is at x=10, y=16
6 | Sensor at x=14, y=17: closest beacon is at x=10, y=16
7 | Sensor at x=8, y=7: closest beacon is at x=2, y=10
8 | Sensor at x=2, y=0: closest beacon is at x=2, y=10
9 | Sensor at x=0, y=11: closest beacon is at x=2, y=10
10 | Sensor at x=20, y=14: closest beacon is at x=25, y=17
11 | Sensor at x=17, y=20: closest beacon is at x=21, y=22
12 | Sensor at x=16, y=7: closest beacon is at x=15, y=3
13 | Sensor at x=14, y=3: closest beacon is at x=15, y=3
14 | Sensor at x=20, y=1: closest beacon is at x=15, y=3
15 |
--------------------------------------------------------------------------------
/bash/2021/days/d22.example:
--------------------------------------------------------------------------------
1 | on x=-20..26,y=-36..17,z=-47..7
2 | on x=-20..33,y=-21..23,z=-26..28
3 | on x=-22..28,y=-29..23,z=-38..16
4 | on x=-46..7,y=-6..46,z=-50..-1
5 | on x=-49..1,y=-3..46,z=-24..28
6 | on x=2..47,y=-22..22,z=-23..27
7 | on x=-27..23,y=-28..26,z=-21..29
8 | on x=-39..5,y=-6..47,z=-3..44
9 | on x=-30..21,y=-8..43,z=-13..34
10 | on x=-22..26,y=-27..20,z=-29..19
11 | off x=-48..-32,y=26..41,z=-47..-37
12 | on x=-12..35,y=6..50,z=-50..-2
13 | off x=-48..-32,y=-32..-16,z=-15..-5
14 | on x=-18..26,y=-33..15,z=-7..46
15 | off x=-40..-22,y=-38..-28,z=23..41
16 | on x=-16..35,y=-41..10,z=-47..6
17 | off x=-32..-23,y=11..30,z=-14..3
18 | on x=-49..-5,y=-3..45,z=-29..18
19 | off x=18..30,y=-20..-8,z=-3..13
20 | on x=-41..9,y=-7..43,z=-33..15
21 | on x=-54112..-39298,y=-85059..-49293,z=-27449..7877
22 | on x=967..23432,y=45373..81175,z=27513..53682
23 |
--------------------------------------------------------------------------------
/go/2015/days/day09/input.txt:
--------------------------------------------------------------------------------
1 | AlphaCentauri to Snowdin = 66
2 | AlphaCentauri to Tambi = 28
3 | AlphaCentauri to Faerun = 60
4 | AlphaCentauri to Norrath = 34
5 | AlphaCentauri to Straylight = 34
6 | AlphaCentauri to Tristram = 3
7 | AlphaCentauri to Arbre = 108
8 | Snowdin to Tambi = 22
9 | Snowdin to Faerun = 12
10 | Snowdin to Norrath = 91
11 | Snowdin to Straylight = 121
12 | Snowdin to Tristram = 111
13 | Snowdin to Arbre = 71
14 | Tambi to Faerun = 39
15 | Tambi to Norrath = 113
16 | Tambi to Straylight = 130
17 | Tambi to Tristram = 35
18 | Tambi to Arbre = 40
19 | Faerun to Norrath = 63
20 | Faerun to Straylight = 21
21 | Faerun to Tristram = 57
22 | Faerun to Arbre = 83
23 | Norrath to Straylight = 9
24 | Norrath to Tristram = 50
25 | Norrath to Arbre = 60
26 | Straylight to Tristram = 27
27 | Straylight to Arbre = 81
28 | Tristram to Arbre = 90
29 |
--------------------------------------------------------------------------------
/go/2016/days/d24/permutations.go:
--------------------------------------------------------------------------------
1 | // Generate all permutations
2 | // Code by Paul Hankin copied from https://stackoverflow.com/a/30230552
3 |
4 | package main
5 |
6 | func nextPerm(p []int) {
7 | for i := len(p) - 1; i >= 0; i-- {
8 | if i == 0 || p[i] < len(p)-i-1 {
9 | p[i]++
10 | return
11 | }
12 | p[i] = 0
13 | }
14 | }
15 |
16 | func getPerm(orig, p []int) []int {
17 | result := make([]int, len(orig), len(orig))
18 | copy(result, orig)
19 | for i, v := range p {
20 | result[i], result[i+v] = result[i+v], result[i]
21 | }
22 | return result
23 | }
24 |
25 |
26 | // example of use:
27 | // func main() {
28 | // orig := []int{11, 22, 33}
29 | // for p := make([]int, len(orig)); p[0] < len(p); nextPerm(p) {
30 | // fmt.Println(getPerm(orig, p))
31 | // }
32 | // }
33 |
--------------------------------------------------------------------------------
/go/MAKEYEAR:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Usage: MAKEYEAR YYYY
3 | # creates the set of dirs+files for year YYYY
4 | year="$1"
5 | [[ $year =~ ^[[:digit:]]{4}$ ]] || { echo "Usage: MAKEDAY YYYY"; exit 1;}
6 |
7 | # Are e in the proper place?
8 | [[ -s TEMPLATES/INIT.go ]] || { echo "ABORT: not in proper dir"; exit 1;}
9 |
10 | [[ -e "$year/days/MAKEDAY" ]] && { echo "ABORT: $year dir already exists"; exit 1;}
11 |
12 | mkdir -p "$year/days"
13 | version=1.19
14 | [[ $(go version) =~ 'go version go'([[:digit:]]+[.][[:digit:]]+) ]] && version="${BASH_REMATCH[1]}"
15 |
16 | echo "module github.com/ColasNahaboo/advent-of-code-my-solutions/go/$year/src
17 |
18 | go $version
19 | " >"$year/days"/go.mod
20 |
21 | cp TEMPLATES/{CLEANALL,MAKEDAY,TESTALL} "$year/days"
22 | sed -e "s/YYYY/$year/g" $year/README.md
23 |
24 | echo "Generated $year/"
25 |
26 |
--------------------------------------------------------------------------------
/go/2025/days/d06/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2025, in GO, day d06
2 |
3 | [Problem statement](https://adventofcode.com/2025/day/6)
4 |
5 | For part 2, we just rotate the input char matrix of the numbers (not the operators row) by a quarter turn to the left, and then parse naturally the numbers.
6 |
7 | E.g, on the example input:
8 |
9 | ```
10 | 123 328 51 64
11 | 45 64 387 23
12 | 6 98 215 314
13 | * + * +
14 | ```
15 |
16 | We rotate it into:
17 |
18 | ```
19 | 4
20 | 431
21 | 623
22 |
23 | 175
24 | 581
25 | 32
26 |
27 | 8
28 | 248
29 | 369
30 |
31 | 356
32 | 24
33 | 1
34 | ```
35 |
36 | We thus get the numbers of each problems, separated by a blank line, and starting by the end problem to the first one.
37 |
38 | Note that the operators (plus or mult) are commutative, so the order of numbers in each problem is not significant.
39 |
--------------------------------------------------------------------------------
/bash/2021/days/d08.example:
--------------------------------------------------------------------------------
1 | be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe
2 | edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc
3 | fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg
4 | fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb
5 | aecbfdg fbg gf bafeg dbefa fcge gcbea fcaegb dgceab fcbdga | gecf egdcabf bgf bfgea
6 | fgeab ca afcebg bdacfeg cfaedg gcfdb baec bfadeg bafgc acf | gebdcfa ecba ca fadegcb
7 | dbcfg fgd bdegcaf fgec aegbdf ecdfab fbedc dacgb gdcebf gf | cefg dcbef fcge gbcadfe
8 | bdfegc cbegaf gecbf dfcage bdacg ed bedf ced adcbefg gebcd | ed bcgafe cdgba cbgef
9 | egadfb cdbfeg cegd fecab cgb gbdefca cg fgcdab egfdb bfceg | gbdfcae bgc cg cgb
10 | gcafb gcf dcaebfg ecagb gf abcdeg gaef cafbge fdbac fegbdc | fgae cfgab fg bagce
11 |
--------------------------------------------------------------------------------
/go/2017/days/d17/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d17
2 |
3 | Part2 can be coded quite efficiently if you note that the first position has always value 0 as it is never inserted, since we always insert after. So, unlike part1, we do not need toa ctually build the circular buffer! We just have to register the value when the position wraps up at 0 (the first position).
4 |
5 | If we call:
6 | - `s` the step, our program input
7 | - `v` the iteration value, which is also the length of the circular buffer as we always insert one new element at each iteration
8 | - `p` the start position
9 |
10 | We get:
11 | ```
12 | p-s->q
13 | 1234567890123
14 | <-----v----->
15 |
16 | p-s->q
17 | 123456789v0123
18 | <-----v+1---->
19 | ```
20 | So we only have to compute the successives values of `p`, registering the value `v` when `q` wraps to 0, never actually building the buffer.
21 |
--------------------------------------------------------------------------------
/bash/2021/days/MAKEDAY:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Usage: MAKEDAY N
3 | # creates the set of files for day N
4 | n="$1"
5 | [[ $n =~ ^[[:digit:]]+$ ]] || { echo "Usage: MAKEDAY N"; exit 1;}
6 | [[ ${#n} == 1 ]] && n="0$n"
7 |
8 | name="d$n"
9 | year="${PWD##*/}" # The current dir name must be the year
10 |
11 | for i in 1 2; do
12 | cat >"$name-$i.sh" <&2; exit 1;}
18 | #export tmp=tmp.\$\$; clean(){ rm -f "\$tmp" "\$tmp".*;}; trap clean 0
19 |
20 | #TEST: example
21 | #TEST: input
22 |
23 | EOF
24 |
25 | chmod a+x "$name-$i.sh"
26 | done
27 | : >"$name.example"
28 | : >"$name.input"
29 |
30 | echo "Generated $name-1.sh $name-2.sh $name.example $name.input"
31 |
--------------------------------------------------------------------------------
/go/2025/days/d02/d02_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | // "reflect"
6 | )
7 |
8 | /////////// Setups
9 |
10 | /////////// Tests to pass
11 |
12 | func Test(t *testing.T) {
13 | // calls to test function(s) args (adapt "args" and "expected")
14 | t_rs("1", t, 1, false)
15 | t_rs("123", t, 123, false)
16 | t_rs("55", t, 55, true)
17 | t_rs("6464", t, 6464, true)
18 | t_rs("123123", t, 123123, true)
19 | t_rs("1111", t, 1111, true)
20 | t_rs("121212", t, 121212, true)
21 | t_rs("121213", t, 121213, false)
22 | t_rs("1188511885", t, 1188511885, true)
23 | }
24 |
25 | /////////// Functions to test
26 |
27 | func t_rs(label string, t *testing.T, args int, expected bool) {
28 | // setup here
29 | t.Run(label, func(t *testing.T) {
30 | got := invalidRepeatedSequence(args)
31 | if got != expected {
32 | t.Errorf("exp '%v'\ngot '%v'", expected, got)
33 | }})}
34 |
--------------------------------------------------------------------------------
/go/2015/days/day21/day21_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "reflect"
5 | "testing"
6 | )
7 |
8 | // reflect.DeepEqual(got, expected)
9 | func Test_day21(t *testing.T) {
10 |
11 | t.Run("read", func(t *testing.T) {
12 | got := readMob(fileToLines("input.txt"))
13 | expected := mob{109, 8, 2}
14 | if !reflect.DeepEqual(got, expected) {
15 | t.Errorf("expected '%v' but got '%v'", expected, got)
16 | }
17 | })
18 |
19 | t.Run("winFight", func(t *testing.T) {
20 | got := winFight(mob{8, 5, 5}, mob{12, 7, 2})
21 | expected := true
22 | if got != expected {
23 | t.Errorf("expected '%v' but got '%v'", expected, got)
24 | }
25 | })
26 |
27 | t.Run("winFight", func(t *testing.T) {
28 | got := winFight(mob{100, 3, 8}, mob{109, 8, 2})
29 | expected := false
30 | if got != expected {
31 | t.Errorf("expected '%v' but got '%v'", expected, got)
32 | }
33 | })
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/go/2024/days/d15/example.txt:
--------------------------------------------------------------------------------
1 | ##########
2 | #..O..O.O#
3 | #......O.#
4 | #.OO..O.O#
5 | #..O@..O.#
6 | #O#..O...#
7 | #O..O..O.#
8 | #.OO.O.OO#
9 | #....O...#
10 | ##########
11 |
12 | ^v>^vv^v>v<>v^v<<><>>v^v^>^<<<><^
13 | vvv<<^>^v^^><<>>><>^<<><^vv^^<>vvv<>><^^v>^>vv<>v<<<^<^^>>>^<>vv>v^v^<>><>>>><^^>vv>v<^^^>>v^v^<^^>v^^>v^<^v>v<>>v^v^v^^<^^vv<
15 | <>^^^^>>>v^<>vvv^>^^^vv^^>v<^^^^v<>^>vvvv><>>v^<<^^^^^
16 | ^><^><>>><>^^<<^^v>>><^^>v>>>^v><>^v><<<>vvvv>^<><<>^><
17 | ^>><>^v<><^vvv<^^<><^v<<<><<<^^<^>>^<<<^>>^v^>>^v>vv>^<<^v<>><<><<>v<^vv<<<>^^v^>^^>>><<^v>>v^v><^^>>^<>vv^
19 | <><^^>^^^<>^vv<<^><<><<><<<^^<<<^<<>><<><^^^>^^<>^>v<>
20 | ^^>vv<^v^v^<>^^^>>>^^vvv^>vvv<>>>^<^>>>>>^<<^v>^vvv<>^<><
21 | v^^>>><<^^<>>^v^v^<<>^<^v^v><^<<<><<^vv>>v>v^<<^
22 |
--------------------------------------------------------------------------------
/go/2015/days/day25/day25_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | // reflect.DeepEqual(got, expected)
8 | func Test_numAt(t *testing.T) {
9 | t.Run("1,1", func(t *testing.T) {
10 | got := numAt(1, 1)
11 | expected := 1
12 | if got != expected {
13 | t.Errorf("expected '%v' but got '%v'", expected, got)
14 | }
15 | })
16 | t.Run("6,1", func(t *testing.T) {
17 | got := numAt(6, 1)
18 | expected := 21
19 | if got != expected {
20 | t.Errorf("expected '%v' but got '%v'", expected, got)
21 | }
22 | })
23 | t.Run("1,6", func(t *testing.T) {
24 | got := numAt(1, 6)
25 | expected := 16
26 | if got != expected {
27 | t.Errorf("expected '%v' but got '%v'", expected, got)
28 | }
29 | })
30 | t.Run("3,3", func(t *testing.T) {
31 | got := numAt(3, 3)
32 | expected := 13
33 | if got != expected {
34 | t.Errorf("expected '%v' but got '%v'", expected, got)
35 | }
36 | })
37 | }
38 |
--------------------------------------------------------------------------------
/go/2024/days/d24/example.txt:
--------------------------------------------------------------------------------
1 | x00: 1
2 | x01: 0
3 | x02: 1
4 | x03: 1
5 | x04: 0
6 | y00: 1
7 | y01: 1
8 | y02: 1
9 | y03: 1
10 | y04: 1
11 |
12 | ntg XOR fgs -> mjb
13 | y02 OR x01 -> tnw
14 | kwq OR kpj -> z05
15 | x00 OR x03 -> fst
16 | tgd XOR rvg -> z01
17 | vdt OR tnw -> bfw
18 | bfw AND frj -> z10
19 | ffh OR nrd -> bqk
20 | y00 AND y03 -> djm
21 | y03 OR y00 -> psh
22 | bqk OR frj -> z08
23 | tnw OR fst -> frj
24 | gnj AND tgd -> z11
25 | bfw XOR mjb -> z00
26 | x03 OR x00 -> vdt
27 | gnj AND wpb -> z02
28 | x04 AND y00 -> kjc
29 | djm OR pbm -> qhw
30 | nrd AND vdt -> hwm
31 | kjc AND fst -> rvg
32 | y04 OR y02 -> fgs
33 | y01 AND x02 -> pbm
34 | ntg OR kjc -> kwq
35 | psh XOR fgs -> tgd
36 | qhw XOR tgd -> z09
37 | pbm OR djm -> kpj
38 | x03 XOR y03 -> ffh
39 | x00 XOR y04 -> ntg
40 | bfw OR bqk -> z06
41 | nrd XOR fgs -> wpb
42 | frj XOR qhw -> z04
43 | bqk OR frj -> z07
44 | y03 OR x01 -> nrd
45 | hwm AND bqk -> z03
46 | tgd XOR rvg -> z12
47 | tnw OR pbm -> gnj
48 |
--------------------------------------------------------------------------------
/go/2016/days/MAKEDAY:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Usage: MAKEDAY N
3 | # creates the set of files for day N
4 |
5 | err() { echo "***ERROR: $*"; exit 1;}
6 |
7 | n="$1"
8 | [[ $n =~ ^[[:digit:]]+$ ]] || err "Usage: MAKEDAY N"
9 | [[ ${#n} == 1 ]] && n="0$n"
10 |
11 | name="d$n"
12 | if [[ $PWD =~ go/([[:digit:]]{4})/ ]]; then
13 | YYYY=${BASH_REMATCH[1]}
14 | else
15 | err "The current path must contain the year: $PWD"
16 | fi
17 | if [[ $PWD =~ ^(.*/days)/d ]]; then
18 | cd "${BASH_REMATCH[1]}" || exit
19 | elif ! [[ $PWD =~ /days ]]; then
20 | err "MAKEDAY must be run from dir days/"
21 | fi
22 |
23 | [[ -e "$name/$name.go" ]] && err "$name already exists"
24 |
25 | mkdir -p "$name"
26 | #cp ../../TEMPLATES/TEST.go "$name/${name}_test.go"
27 | cp ../../TEMPLATES/utils.go "$name"
28 | sed -r -e "s/YYYY/$YYYY/g" -e "s/NN/$n/g" \
29 | <../../TEMPLATES/INIT.go >"$name/$name.go"
30 | touch "$name/input,,.test" "$name/example.txt"
31 |
32 | echo "Generated $name/$name.go $name/input,,.txt $name/example.txt in $name/"
33 |
--------------------------------------------------------------------------------
/bash/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code solutions in bash
2 | Here are my solutions to the "Advent of code" challenges implemented in bash. See https://adventofcode.com/
3 |
4 | I tried to implement "smart" bash solutions, that rely on fast GNU/Linux utilities like grep, sed, sort... (the way I use bash in real life), but most of the time my goal was readability and compliance with shellcheck, not terseness or efficiency. I am an old (retired) proficient bash programmer, so my goal here is not to learn bash, but rather un-learn some bad dirty habits accumulated over the years and force myself to code in a "shellcheck-friendly" modern way.
5 |
6 | Although I invented, designed and implemented a commercial programming language and worked professionnally with "real" languages, I grew in love with bash because the intellectual challenges it poses to write efficient code, making mundane tasks exciting, and that it (nearly) never breaks backwards compatibility, a code that runs now will run in 20 years and more...
7 |
8 | More details in each of the per-year subdirectories.
9 |
--------------------------------------------------------------------------------
/go/2015/days/CLEANALL:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # clean the directories before git-commiting
3 |
4 | # remove non-commitable files
5 | export d
6 | for d in day??; do
7 | ( cd "$d" || exit 1
8 | rm -f -- day[0-9][0-9] __debug_bin *~ \#*
9 | )
10 | done
11 |
12 | # check some problematic files do not remain
13 | nfs=$(find -name .nfs\*)
14 | if [[ n $nfs ]]; then
15 | echo "### Warning: some .nfs files remain!"
16 | echo "$nfs"
17 | fi
18 |
19 | # check that all GO source files have their TEST: lines completed
20 | missing=$(grep '^// TEST: .*[^[:alnum:]]$' day??/*.go)
21 | if [[ -n $missing ]]; then
22 | echo "### Warning: some TEST declarations are missing values!"
23 | echo "$missing"
24 | echo "=== Please fix them"
25 | fi
26 |
27 | # check that we added the notes for the completed day
28 | for day in day??; do
29 | d="${day#day}"
30 | [[ -s $day/input.txt ]] || continue
31 | if ! grep -q "^- [*][*]Day${d}[*][*][[:space:]]*[^[:space:]]" ../README.md; then
32 | echo "### Warning: missing $day note in ../README.md"
33 | fi
34 | done
35 |
36 |
--------------------------------------------------------------------------------
/go/2025/days/d07/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2025, in GO, day d07
2 |
3 | [Problem statement](https://adventofcode.com/2025/day/7)
4 |
5 | For the exemple:
6 | ```
7 | .......S.......
8 | ...............
9 | .......^.......
10 | ...............
11 | ......^.^......
12 | ...............
13 | .....^.^.^.....
14 | ...............
15 | ....^.^...^....
16 | ...............
17 | ```
18 |
19 | In part1, we just trace beams:
20 | ```
21 | .......S.......
22 | .......|.......
23 | ......|^|......
24 | ......|.|......
25 | .....|^|^|.....
26 | .....|.|.|.....
27 | ....|^|^|^|....
28 | ....|.|.|.|....
29 | ...|^|^|||^|...
30 | ...|.|.|||.|...
31 | ```
32 | And the result is the number of splits. .
33 |
34 | But for part 2, we "charge" the beams with the number of timelines it appears in:
35 |
36 | ```
37 | .......S.......
38 | .......1.......
39 | ......1^1......
40 | ......1.1......
41 | .....1^2^1.....
42 | .....1.2.1.....
43 | ....1^3^3^1....
44 | ....1.3.3.1....
45 | ...1^4^634^1...
46 | ...1.4.634.1...
47 | ```
48 | And the result is the sum of all timelines for each beam at the end.
49 |
--------------------------------------------------------------------------------
/go/2023/days/d12/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d12
2 |
3 | Part1 was quite simple. I solved it by just generating all the possible arrangments with all the combinations of value s'.' or '#' for the '?', and then checking all of them to see which ones were valid. But this would not scale for part2.
4 |
5 | I thus tried an iterative approach: moving up the string of the springs records, each time I encountered a '?', explored on the 2 possible branches. Nice, but not enough. I kept the code (functions named `explore`) for this approach as an alternate to part2, callable with the `-a` command line option
6 |
7 | I then took the same approach, but skipping the '.' of the record string, and trying to fit the whole first span of contiguous '#' at the first '#' position. And then recursing not by character, but by spans.
8 |
9 | And finally, I added a cache of calls to the recurive function, to gain a bit more speed.... but it was too slow!
10 |
11 | I ended up copying the logic of a [python solution](https://gist.github.com/sanyi/96ccaf6d3c0a67536b4fe3e99bc53bb3) by "sanyi", that was simple and fast.
12 |
--------------------------------------------------------------------------------
/go/2016/days/d13/altsol.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | def f(x,y): return x*x + 3*x + 2*x*y + y + y*y + 1362
4 | def o(n): return bin(n)[2:].count('1')%2==0 # open
5 |
6 | OPEN,WALL = 0,-1
7 |
8 | def gen(r,c): return [[(WALL,OPEN)[o(f(x,y))] for x in range(c)] for y in range(r)]
9 |
10 | def directions( m, y, x ):
11 | d = []
12 | if y>0 and m[y-1][x]==OPEN: d.append((x,y-1))
13 | if y0 and m[y][x-1]==OPEN: d.append((x-1,y))
15 | if xINPUT.txt; s=$(./sol1.py|tail -1); m=$(./d?? -1 INPUT.txt|tail -1); echo "[$i]: s=$s, m=$m"; ((m == s)) || { echo "**DIFFER!"; cat INPUT.txt; break;}; ((i++)); done
6 |
7 | from itertools import pairwise
8 |
9 |
10 | def next_reading(reading_set):
11 | if len(set(reading_set)) == 1:
12 | return reading_set[0]
13 | return reading_set[-1] + next_reading([x[1] - x[0] for x in pairwise(reading_set)])
14 |
15 |
16 | with open("INPUT.txt", "r") as input:
17 | readings = [[int(val) for val in line.split(" ")] for line in input.readlines()]
18 | p1_results = []
19 | p2_results = []
20 | for reading_set in readings:
21 | p1_results.append(next_reading(reading_set))
22 | p2_results.append(next_reading(reading_set[::-1]))
23 | #print(f"Part One : {sum(p1_results)}")
24 | #print(f"Part Two : {sum(p2_results)}")
25 | print(sum(p1_results))
26 |
--------------------------------------------------------------------------------
/go/2015/days/day19/input.txt:
--------------------------------------------------------------------------------
1 | Al => ThF
2 | Al => ThRnFAr
3 | B => BCa
4 | B => TiB
5 | B => TiRnFAr
6 | Ca => CaCa
7 | Ca => PB
8 | Ca => PRnFAr
9 | Ca => SiRnFYFAr
10 | Ca => SiRnMgAr
11 | Ca => SiTh
12 | F => CaF
13 | F => PMg
14 | F => SiAl
15 | H => CRnAlAr
16 | H => CRnFYFYFAr
17 | H => CRnFYMgAr
18 | H => CRnMgYFAr
19 | H => HCa
20 | H => NRnFYFAr
21 | H => NRnMgAr
22 | H => NTh
23 | H => OB
24 | H => ORnFAr
25 | Mg => BF
26 | Mg => TiMg
27 | N => CRnFAr
28 | N => HSi
29 | O => CRnFYFAr
30 | O => CRnMgAr
31 | O => HP
32 | O => NRnFAr
33 | O => OTi
34 | P => CaP
35 | P => PTi
36 | P => SiRnFAr
37 | Si => CaSi
38 | Th => ThCa
39 | Ti => BP
40 | Ti => TiTi
41 | e => HF
42 | e => NAl
43 | e => OMg
44 |
45 | CRnCaSiRnBSiRnFArTiBPTiTiBFArPBCaSiThSiRnTiBPBPMgArCaSiRnTiMgArCaSiThCaSiRnFArRnSiRnFArTiTiBFArCaCaSiRnSiThCaCaSiRnMgArFYSiRnFYCaFArSiThCaSiThPBPTiMgArCaPRnSiAlArPBCaCaSiRnFYSiThCaRnFArArCaCaSiRnPBSiRnFArMgYCaCaCaCaSiThCaCaSiAlArCaCaSiRnPBSiAlArBCaCaCaCaSiThCaPBSiThPBPBCaSiRnFYFArSiThCaSiRnFArBCaCaSiRnFYFArSiThCaPBSiThCaSiRnPMgArRnFArPTiBCaPRnFArCaCaCaCaSiRnCaCaSiRnFYFArFArBCaSiThFArThSiThSiRnTiRnPMgArFArCaSiThCaPBCaSiRnBFArCaCaPRnCaCaPMgArSiRnFYFArCaSiThRnPBPMgAr
46 |
--------------------------------------------------------------------------------
/go/2017/days/MAKEDAY:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Usage: MAKEDAY N
3 | # creates the set of files for day N
4 |
5 | err() { echo "***ERROR: $*"; exit 1;}
6 |
7 | n="$1"
8 | [[ $n =~ ^[[:digit:]]+$ ]] || err "Usage: MAKEDAY N"
9 | [[ ${#n} == 1 ]] && n="0$n"
10 |
11 | name="d$n"
12 | if [[ $PWD =~ go/([[:digit:]]{4})/ ]]; then
13 | YYYY=${BASH_REMATCH[1]}
14 | else
15 | err "The current path must contain the year: $PWD"
16 | fi
17 | if [[ $PWD =~ ^(.*/days)/d ]]; then
18 | cd "${BASH_REMATCH[1]}" || exit
19 | elif ! [[ $PWD =~ /days ]]; then
20 | err "MAKEDAY must be run from dir days/"
21 | fi
22 |
23 | [[ -e "$name/$name.go" ]] && err "$name already exists"
24 |
25 | mkdir -p "$name"
26 | #cp ../../TEMPLATES/TEST.go "$name/${name}_test.go"
27 | cp ../../TEMPLATES/utils.go "$name"
28 | sed -r -e "s/YYYY/$YYYY/g" -e "s/NN/${name#d}/g" \
29 | <../../TEMPLATES/INIT.go >"$name/$name.go"
30 | sed -r -e "s/YYYY/$YYYY/g" -e "s/NN/${name#d}/g" \
31 | <../../TEMPLATES/README-DD.md >"$name/README.md"
32 | touch "$name/input,,.test" "$name/example.txt"
33 |
34 | echo "Generated $name/$name.go $name/input,,.txt $name/example.txt $name/README.md in $name/"
35 |
--------------------------------------------------------------------------------
/go/2023/days/MAKEDAY:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Usage: MAKEDAY N
3 | # creates the set of files for day N
4 |
5 | err() { echo "***ERROR: $*"; exit 1;}
6 |
7 | n="$1"
8 | [[ $n =~ ^[[:digit:]]+$ ]] || err "Usage: MAKEDAY N"
9 | [[ ${#n} == 1 ]] && n="0$n"
10 |
11 | name="d$n"
12 | if [[ $PWD =~ go/([[:digit:]]{4})/ ]]; then
13 | YYYY=${BASH_REMATCH[1]}
14 | else
15 | err "The current path must contain the year: $PWD"
16 | fi
17 | if [[ $PWD =~ ^(.*/days)/d ]]; then
18 | cd "${BASH_REMATCH[1]}" || exit
19 | elif ! [[ $PWD =~ /days ]]; then
20 | err "MAKEDAY must be run from dir days/"
21 | fi
22 |
23 | [[ -e "$name/$name.go" ]] && err "$name already exists"
24 |
25 | mkdir -p "$name"
26 | #cp ../../TEMPLATES/TEST.go "$name/${name}_test.go"
27 | cp ../../TEMPLATES/utils.go "$name"
28 | sed -r -e "s/YYYY/$YYYY/g" -e "s/NN/${name#d}/g" \
29 | <../../TEMPLATES/INIT.go >"$name/$name.go"
30 | sed -r -e "s/YYYY/$YYYY/g" -e "s/NN/${name#d}/g" \
31 | <../../TEMPLATES/README-DD.md >"$name/README.md"
32 | touch "$name/input,,.test" "$name/example.txt"
33 |
34 | echo "Generated $name/$name.go $name/input,,.txt $name/example.txt $name/README.md in $name/"
35 |
--------------------------------------------------------------------------------
/go/2024/days/MAKEDAY:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Usage: MAKEDAY N
3 | # creates the set of files for day N
4 |
5 | err() { echo "***ERROR: $*"; exit 1;}
6 |
7 | n="$1"
8 | [[ $n =~ ^[[:digit:]]+$ ]] || err "Usage: MAKEDAY N"
9 | [[ ${#n} == 1 ]] && n="0$n"
10 |
11 | name="d$n"
12 | if [[ $PWD =~ go/([[:digit:]]{4})/ ]]; then
13 | YYYY=${BASH_REMATCH[1]}
14 | else
15 | err "The current path must contain the year: $PWD"
16 | fi
17 | if [[ $PWD =~ ^(.*/days)/d ]]; then
18 | cd "${BASH_REMATCH[1]}" || exit
19 | elif ! [[ $PWD =~ /days ]]; then
20 | err "MAKEDAY must be run from dir days/"
21 | fi
22 |
23 | [[ -e "$name/$name.go" ]] && err "$name already exists"
24 |
25 | mkdir -p "$name"
26 | #cp ../../TEMPLATES/TEST.go "$name/${name}_test.go"
27 | cp ../../TEMPLATES/utils.go "$name"
28 | sed -r -e "s/YYYY/$YYYY/g" -e "s/NN/${name#d}/g" \
29 | <../../TEMPLATES/INIT.go >"$name/$name.go"
30 | sed -r -e "s/YYYY/$YYYY/g" -e "s/NN/${name#d}/g" \
31 | <../../TEMPLATES/README-DD.md >"$name/README.md"
32 | touch "$name/input,,.test" "$name/example.txt"
33 |
34 | echo "Generated $name/$name.go $name/input,,.txt $name/example.txt $name/README.md in $name/"
35 |
--------------------------------------------------------------------------------
/go/2023/days/d06/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d06
2 |
3 | Instead of trying all the values, we just solve the problem mathematically.
4 |
5 | For a race of duration $d$, keeping the button pressed for a time $t$ makes the boat goes to length $l$ by the formula:
6 |
7 | $l=speed *(d-t)$
8 |
9 | That is, since $speed$ is given by the time $t$ itself:
10 |
11 | $l=t(d-t) \implies -t^2+dt$
12 |
13 | So, the winning times $w$ are the ones that can generate a distance $r$, equal or greater to the current record + 1.
14 |
15 | $-t^2+dt=r \implies -t^2+dt-r=0$
16 |
17 | This means that the winning times are on a parabola, in the "bump" between the two solutions of this second degree equation, which are:
18 |
19 | $(-d ± \sqrt({d^2-4r})/-2 \implies (d ± \sqrt({d^2-4r})/2$
20 |
21 | For instance, for the first race of the example, with $d=7$ and $r=10$ (9+1), the solutions are $(7 +- \sqrt{49 - 40}) / 2$, that is $(7-3)/2=2$ and $(7+3)/2=5$. So the solutions are the integer between 2 and 5, inclusive.
22 |
23 | For the second race, we get the solutions 3.5948... and 11.4051... we round these values up and down, to 4 and 11, to stay inside the acceptable values range.
24 |
--------------------------------------------------------------------------------
/go/2022/days/CLEANALL:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # clean the directories before git-commiting
3 |
4 | # first, place ourselves in the dir of the script
5 | cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null
6 |
7 | # remove non-commitable files
8 | export d
9 | for d in d??; do
10 | ( cd "$d" || exit 1
11 | rm -f -- d[0-9][0-9] __debug_bin *~ \#*
12 | )
13 | done
14 |
15 | # check some problematic files do not remain
16 | nfs=$(find -name .nfs\*)
17 | if [[ -n $nfs ]]; then
18 | echo "### Warning: some .nfs files remain!"
19 | echo "$nfs"
20 | fi
21 |
22 | # check that all GO source files have their TEST: lines completed
23 | missing=$(grep '^// TEST: .*[^[:alnum:]]$' d??/*.go)
24 | if [[ -n $missing ]]; then
25 | echo "### Warning: some TEST declarations are missing values!"
26 | echo "$missing"
27 | echo "=== Please fix them"
28 | fi
29 |
30 | # check that we added the notes for the completed day
31 | for day in d??; do
32 | day="${d#d}"
33 | [[ -s $day/input.txt ]] || continue
34 | if ! grep -q "^- [*][*]d${d}[*][*][[:space:]]*[^[:space:]]" ../README.md; then
35 | echo "### Warning: missing $day note in ../README.md"
36 | fi
37 | done
38 |
39 |
--------------------------------------------------------------------------------
/go/2015/days/day06/day06_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | // reflect.DeepEqual(got, expected)
8 | func Test_TurnOn(t *testing.T) {
9 | t.Run("Test TurnOn.1", func(t *testing.T) {
10 | var grid Grid
11 | got := grid.TurnOn(0, 0, 0, 2, 2)
12 | expected := 9
13 | if got != expected {
14 | t.Errorf("expected '%v' but got '%v'", expected, got)
15 | }
16 | })
17 | }
18 |
19 | func Test_TurnOn2(t *testing.T) {
20 | t.Run("1", func(t *testing.T) {
21 | var grid Grid
22 | got := grid.TurnOn2(1, 0, 0, 0, 0)
23 | expected := 2
24 | if got != expected {
25 | t.Errorf("expected '%v' but got '%v'", expected, got)
26 | }
27 | })
28 | t.Run("2", func(t *testing.T) {
29 | var grid Grid
30 | got := grid.TurnOn2(4, 0, 0, 999, 999)
31 | expected := 1000004
32 | if got != expected {
33 | t.Errorf("expected '%v' but got '%v'", expected, got)
34 | }
35 | })
36 | }
37 |
38 | func Test_Toggle2(t *testing.T) {
39 | t.Run("1", func(t *testing.T) {
40 | var grid Grid
41 | got := grid.Toggle2(4, 0, 0, 999, 999)
42 | expected := 2000004
43 | if got != expected {
44 | t.Errorf("expected '%v' but got '%v'", expected, got)
45 | }
46 | })
47 | }
48 |
--------------------------------------------------------------------------------
/bash/2021/days/d17-1.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://adventofcode.com/days/day/17 puzzle #1
3 | # See README.md in the parent directory
4 | in="${1:-${0%-[0-9].*}.input}"; [[ -e $in ]] || exit 1
5 | err(){ echo "***ERROR: $*" >&2; exit 1;}
6 | #export tmp=tmp.$$; clean(){ rm -f "$tmp" "$tmp".*;}; trap clean 0
7 |
8 | #TEST: example 45
9 | #TEST: input 4278
10 |
11 | ############ Parse input
12 | # shellcheck disable=SC2034 # unused values for reads
13 | {
14 | read -r input <"$in"
15 | [[ $input =~ 'target area: 'x=([-[:digit:]]+)[.]+([-[:digit:]]+),[[:space:]]*y=([-[:digit:]]+)[.]+([-[:digit:]]+) ]] || err "Input syntax error: $input"
16 | x1="${BASH_REMATCH[1]}"
17 | x2="${BASH_REMATCH[2]}"
18 | y1="${BASH_REMATCH[3]}"
19 | y2="${BASH_REMATCH[4]}"
20 | }
21 |
22 | ############ Main
23 | # We know the initial velocity must be the lower Y of the target area
24 | # absolute value -1, as we cross back altitude 0 at the same vertical velocity
25 | # and the next step will be +1
26 |
27 | ((vy0 = -y1 -1))
28 |
29 | echo "vy0 = $vy0"
30 |
31 | # then, just compute the max height reached, step by step.
32 | y=0
33 | for((vy=vy0; vy>0; vy--)); do
34 | ((y += vy))
35 | done
36 |
37 | echo "$y"
38 |
--------------------------------------------------------------------------------
/go/2018/days/MAKEDAY:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Usage: MAKEDAY N
3 | # creates the set of files for day N
4 |
5 | err() { echo "***ERROR: $*"; exit 1;}
6 |
7 | n="$1"
8 | [[ $n =~ ^[[:digit:]]+$ ]] || err "Usage: MAKEDAY N"
9 | [[ ${#n} == 1 ]] && n="0$n"
10 |
11 | name="d$n"
12 | if [[ $PWD =~ go/([[:digit:]]{4})/ ]]; then
13 | YYYY=${BASH_REMATCH[1]}
14 | else
15 | err "The current path must contain the year: $PWD"
16 | fi
17 | if [[ $PWD =~ ^(.*/days)/d ]]; then
18 | cd "${BASH_REMATCH[1]}" || exit
19 | elif ! [[ $PWD =~ /days ]]; then
20 | err "MAKEDAY must be run from dir days/"
21 | fi
22 |
23 | [[ -e "$name/$name.go" ]] && err "$name already exists"
24 |
25 | mkdir -p "$name"
26 | #cp ../../TEMPLATES/TEST.go "$name/${name}_test.go"
27 | cp ../../TEMPLATES/utils.go "$name"
28 | sed -r -e "s/YYYY/$YYYY/g" -e "s/NN/${name#d}/g" \
29 | <../../TEMPLATES/INIT.go >"$name/$name.go"
30 | sed -r -e "s/YYYY/$YYYY/g" -e "s/NN/${name#d}/g" \
31 | <../../TEMPLATES/README-DD.md >"$name/README.md"
32 | touch "$name/input,,.test" "$name/example.txt"
33 |
34 | echo "Generated $name/$name.go $name/input,,.txt $name/example.txt $name/README.md in $name/"
35 | echo "To enable tests, do: cp ../../TEMPLATES/TEST.go $name/${name}_test.go"
36 |
--------------------------------------------------------------------------------
/go/2015/days/day10/day10_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "strconv"
5 | "testing"
6 | )
7 |
8 | func test_LookAndSay(t *testing.T, in, expected string) {
9 | got := LookAndSay(in)
10 | if got != expected {
11 | t.Errorf("for %v: expected '%v' but got '%v'", in, expected, got)
12 | }
13 | }
14 |
15 | func Test_LookAndSay(t *testing.T) {
16 | t.Run("1", func(t *testing.T) { test_LookAndSay(t, "1", "11") })
17 | t.Run("2", func(t *testing.T) { test_LookAndSay(t, "11", "21") })
18 | t.Run("1", func(t *testing.T) { test_LookAndSay(t, "21", "1211") })
19 | t.Run("1", func(t *testing.T) { test_LookAndSay(t, "1211", "111221") })
20 | t.Run("1", func(t *testing.T) { test_LookAndSay(t, "111221", "312211") })
21 | t.Run("1", func(t *testing.T) { test_LookAndSay(t, "312211", "13112221") })
22 | }
23 |
24 | func test_Game(t *testing.T, in string, n int, expected string) {
25 | gotseq, len := Game(in, n)
26 | got := ""
27 | for i := 0; i < len; i++ {
28 | got += strconv.Itoa(gotseq[i])
29 | }
30 |
31 | if got != expected {
32 | t.Errorf("for %v(%c): expected '%v' but got '%v'", in, n, expected, got)
33 | }
34 | }
35 |
36 | func Test_Game(t *testing.T) {
37 | t.Run("1", func(t *testing.T) { test_Game(t, "1", 5, "312211") })
38 | }
39 |
--------------------------------------------------------------------------------
/go/2018/days/d10/example.txt:
--------------------------------------------------------------------------------
1 | position=< 9, 1> velocity=< 0, 2>
2 | position=< 7, 0> velocity=<-1, 0>
3 | position=< 3, -2> velocity=<-1, 1>
4 | position=< 6, 10> velocity=<-2, -1>
5 | position=< 2, -4> velocity=< 2, 2>
6 | position=<-6, 10> velocity=< 2, -2>
7 | position=< 1, 8> velocity=< 1, -1>
8 | position=< 1, 7> velocity=< 1, 0>
9 | position=<-3, 11> velocity=< 1, -2>
10 | position=< 7, 6> velocity=<-1, -1>
11 | position=<-2, 3> velocity=< 1, 0>
12 | position=<-4, 3> velocity=< 2, 0>
13 | position=<10, -3> velocity=<-1, 1>
14 | position=< 5, 11> velocity=< 1, -2>
15 | position=< 4, 7> velocity=< 0, -1>
16 | position=< 8, -2> velocity=< 0, 1>
17 | position=<15, 0> velocity=<-2, 0>
18 | position=< 1, 6> velocity=< 1, 0>
19 | position=< 8, 9> velocity=< 0, -1>
20 | position=< 3, 3> velocity=<-1, 1>
21 | position=< 0, 5> velocity=< 0, -1>
22 | position=<-2, 2> velocity=< 2, 0>
23 | position=< 5, -2> velocity=< 1, 2>
24 | position=< 1, 4> velocity=< 2, 1>
25 | position=<-2, 7> velocity=< 2, -2>
26 | position=< 3, 6> velocity=<-1, -1>
27 | position=< 5, 0> velocity=< 1, 0>
28 | position=<-6, 0> velocity=< 2, 0>
29 | position=< 5, 9> velocity=< 1, -2>
30 | position=<14, 7> velocity=<-2, 0>
31 | position=<-3, 6> velocity=< 2, -1>
32 |
--------------------------------------------------------------------------------
/go/2025/days/d03/d03_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | //"reflect"
6 | )
7 |
8 | /////////// Setups
9 |
10 | /////////// Tests to pass
11 |
12 | func Test(t *testing.T) {
13 | // calls to test function(s) args (adapt "args" and "expected")
14 | TEST("maxBankJolt, len 2")
15 | T(t, "987654321111111", 2, 98)
16 | T(t, "811111111111119", 2, 89)
17 | T(t, "234234234234278", 2, 78)
18 | T(t, "818181911112111", 2, 92)
19 | TEST("maxBankJolt, len 12")
20 | T(t, "987654321111111", 12, 987654321111)
21 | T(t, "811111111111119", 12, 811111111119)
22 | T(t, "234234234234278", 12, 434234234278)
23 | T(t, "818181911112111", 12, 888911112111)
24 | }
25 |
26 | /////////// Test function(s)
27 |
28 | // adapt to your case the types of args and expected
29 | func T(t *testing.T, banklabel string, banklen int, expected int) {
30 | // setup here
31 | TNUM++
32 | t.Run(TNAME + "#" + itoa(TNUM), func(t *testing.T) {
33 | got := maxBankJolt(bankParse(banklabel), banklen)
34 | if got != expected {
35 | t.Errorf("\nexp= '%v'\ngot= '%v'", expected, got)
36 | }})}
37 |
38 | //////////// Automatic Labels: string-argument-to-TEST + # + test-number
39 |
40 | var TNAME = "T"
41 | var TNUM = 0
42 |
43 | func TEST(s string) {
44 | TNAME = s
45 | TNUM = 0
46 | }
47 |
--------------------------------------------------------------------------------
/bash/2021/days/d06-other1.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://adventofcode.com/days/day/6 puzzle #1
3 | # See README.md in the parent directory
4 | in="${1:-${0%-[0-9].*}.input}"; [[ -e $in ]] || exit 1
5 | err(){ echo "***ERROR: $*" >&2; exit 1;}
6 | export tmp=tmp.$$; clean(){ rm -f "$tmp" "$tmp".*;}; trap clean 0
7 |
8 | # This is the naive version, but it is too slow to tackle the input
9 | # It took more than one hour for the 80 days
10 |
11 | steps="${2:-80}" # 2nd argument is the number of steps (def, 80)
12 |
13 | fishes=$(tr ',' ' ' <"$in")
14 | next=(6 0 1 2 3 4 5 6 7)
15 |
16 | # advance once the existing fishes (olds) create the newborns (news)
17 | # modifies in place the global space-separated list "fishes"
18 | nextgen(){
19 | local olds='' news=''
20 | for f in $fishes; do
21 | olds="$olds ${next[f]}"
22 | [[ $f == 0 ]] && news="$news 8"
23 | done
24 | # add new ones
25 | fishes="$olds$news"
26 | }
27 |
28 | start=$(date +%s)
29 | for ((s=0; s= pos)) && ((move = crab - pos)) || ((move = pos - crab))
28 | ((fuel += move))
29 | done
30 | if ((fuel < optimalfuel)); then
31 | optimalpos="$pos"
32 | optimalfuel="$fuel"
33 | fi
34 | done
35 |
36 | echo "Position: $optimalpos, fuel:
37 | $optimalfuel"
38 |
--------------------------------------------------------------------------------
/go/2015/TEMPLATES/INIT.go:
--------------------------------------------------------------------------------
1 | // Adventofcode YYYY, dayNN, in go. Arguments:
2 | // -1: use solve part 1 of the problem, default is the second one
3 | // the input file name: default: input.txt
4 | // TEST: -1 input
5 | // TEST: input
6 | package main
7 |
8 | import (
9 | "flag"
10 | "fmt"
11 | // "regexp"
12 | )
13 |
14 | var verbose bool
15 |
16 | func main() {
17 | partOne := flag.Bool("1", false, "run exercise part1, (default: part2)")
18 | verboseFlag := flag.Bool("v", false, "verbose: print extra info")
19 | flag.Parse()
20 | verbose = *verboseFlag
21 | infile := "input.txt"
22 | if flag.NArg() > 0 {
23 | infile = flag.Arg(0)
24 | }
25 | lines := fileToLines(infile)
26 |
27 | var result int
28 | if *partOne {
29 | VP("Running Part1")
30 | result = part1(lines)
31 | } else {
32 | VP("Running Part2")
33 | result = part2(lines)
34 | }
35 | fmt.Println(result)
36 | }
37 |
38 | //////////// Part 1
39 |
40 | func part1(lines []string) int {
41 | for _, line := range lines {
42 | fmt.Println(line)
43 | }
44 | return 0
45 | }
46 |
47 | //////////// Part 2
48 | func part2(lines []string) int {
49 | for _, line := range lines {
50 | fmt.Println(line)
51 | }
52 | return 0
53 | }
54 |
55 | //////////// Common Parts code
56 |
57 | //////////// Part1 functions
58 |
59 | //////////// Part2 functions
60 |
--------------------------------------------------------------------------------
/go/2017/days/d18/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2017, in GO, day d18
2 |
3 | The part 1 is simple.
4 |
5 | For the part2, I modelized the tablets as objects, and run them "by hand" one a t a time, the tablets comunicating by FIFO queues. But since I wanted to practice the use of Go goroutines and channels, I also made an implementation via a goroutine for each tablet, communicating by channels, that is called via the command line flag `-3`.
6 |
7 | We use 3 goroutines: the two tablet `T0` and `T1`, and an `observer` of their status whose role is to detect when both tablets are waiting for input on a `rcv` operation.
8 |
9 | The observer maintains an `alive status` (`1` if alive, `0` if waiting) for each tablet. On executing a `rcv` a tablet sends a clear status message to the observer channel, and once a value is read, it sends a set status.
10 |
11 | Thus the observer can thus tell that the two tablets are in deadlock when both status are 0, and can terminate the whole program.
12 |
13 | ```
14 | +----+ +----+
15 | | T0 |-----channel-0-1----->| T1 |
16 | | |<----channel-1-0----- | |
17 | +----+ +----+
18 | | | +----------+
19 | +-------observer-channel---+---> | observer |
20 | +----------+
21 | ```
22 |
--------------------------------------------------------------------------------
/bash/2021/days/d21-1.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://adventofcode.com/days/day/21 puzzle #1
3 | # See README.md in the parent directory
4 | in="${1:-${0%-[0-9].*}.input}"; [[ -e $in ]] || exit 1
5 | err(){ echo "***ERROR: $*" >&2; exit 1;}
6 | #export tmp=tmp.$$; clean(){ rm -f "$tmp" "$tmp".*;}; trap clean 0
7 |
8 | #TEST: example 739785
9 | #TEST: input 551901
10 |
11 | # we number the places 0 to 9 with scores place+1 (1 to 10)
12 | declare -i p1 p2 s1=0 s2=0
13 | # shellcheck disable=SC2034 # s unused
14 | { read -r d d d d p1; read -r d d d d p2;} <"$in"
15 |
16 | ((--p1))
17 | ((--p2))
18 |
19 | declare -i dicerolls=0
20 | declare -i diceval=0
21 | dice_roll(){
22 | local i
23 | dice_roll=0
24 | for((i=0; i<3; i++)); do
25 | ((++diceval > 100)) && ((diceval-=100))
26 | ((dice_roll += diceval))
27 | done
28 | ((dicerolls+=3))
29 | }
30 |
31 | declare -i sloser=0
32 | while true; do # turns
33 | # Player 1
34 | dice_roll
35 | ((p1+=dice_roll))
36 | ((p1 = p1 % 10))
37 | ((s1 += (p1 + 1)))
38 | ((s1 >= 1000)) && { sloser="$s2"; break;}
39 | # Player 2
40 | dice_roll
41 | ((p2+=dice_roll))
42 | ((p2 = p2 % 10))
43 | ((s2 += (p2 + 1)))
44 | ((s2 >= 1000)) && { sloser="$s1"; break;}
45 | done
46 | echo "$sloser * $dicerolls ="
47 | echo $((sloser * dicerolls))
48 |
--------------------------------------------------------------------------------
/go/2023/days/d17/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d17
2 |
3 | A typical problem, where we must find the shortest path in states of "things" on a 2D board. We combine for the solution the use of `scalarray.go` (for the 2D board) and `astar.go` (for the shortest path).
4 |
5 | ## Part 3
6 |
7 | We also provide an alternate implementation of part2, named part3 and callable with the `-3` command line option that use a 3D scalar array instead of a hashtable map to get IDs of states.
8 | A state ID is thus its position (number) in the array of Scalarray3D
9 | We do not have an actual State type, we map the fields virtually on the 3D coords: pos is x, dir is y, steps is z
10 |
11 | Note that we do not need to actually instanciate the scalar array field of id3d, we only use its coordinates/position conversion methods, as we do not have to store additional data to Nodes.
12 |
13 | The Part3 implementation is thus 25% faster than part2, and takes less space as there is no actual data structure to do the mapping state -> ID.
14 |
15 | ## Part 4
16 |
17 | Another alternative implementation of Part2, "Part 4" called with `-4`, also avoids the mapping state -> ID via a Go map, and instead use for Node the State type itself (a struct of 3 ints). The code is then simpler and more readable, with only a speed penaly of less than 4% compared to Part 2.
18 |
--------------------------------------------------------------------------------
/go/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code solutions in GO
2 | Here are my solutions to the "Advent of code" challenges implemented in GO. See https://adventofcode.com/
3 |
4 | I discovered "advent of code" in 2021, and did it in [bash](../) for the challenge. But since I started learning GO, I decided to code the previous AoC years in GO as a mean to practice it. So, although my bash code can be useful to see some tricks of a seasoned bash programmer, these GO solutions must be considered as "student code".
5 |
6 | The code is in GO, with some housekeeping scripts in bash.
7 |
8 | I tried to keep each day directory as standalone as possible. For instance, instead of factorizing code that is often used acrosss days, I store them in the `TEMPLATES/` directory, and I copy them in the day dir if needed, instead of making separate packages. Thus two days can have different versions of `utils.go` for instance. This is because I keep tweaking them to experiment and do not want to manage backwards compatibility, and ensure you can re-compile my exemple by downloading only the directory of single day without strings attached. Of course, I may publish as proper separate packages on GitHub these libraries once I am confident enough their API is stabilized, and they provide something more than what is already alvailable elsewhere.
9 |
10 | More details in each of the per-year subdirectories.
11 |
--------------------------------------------------------------------------------
/go/2023/days/d07/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d07
2 |
3 | To simplify things, we will map hands to numbers so that we can easily sort them:
4 | - each card is a 2-digit number: 2=02 ... 9=09, T=10, J=11, Q=12K=13, A=14
5 | - we collate the five 2-digit strings to obtain a 10-digit number. E.g for hand `32T3K` we get `0302100313`
6 | - we prepend the type of the hand:
7 | - Five of a kind = 7
8 | - Four of a kind = 6
9 | - Full house = 5
10 | - Three of a kind = 4
11 | - Two pair = 3
12 | - One pair = 2
13 | - High card = 1
14 |
15 | So, for the hand `32T3K` we get `20302100313`
16 | - this is a bijective mapping, so we will just store internally the hands by their number, their "score".
17 |
18 | To determine the type of the hand, we count the occurences of each card value and sort these in decreasing order, then collate them into digits of a number T, so we can easily detemine the type. For instance T=32 means a full house, T=221 means two pairs, T=5 five of a kind...
19 |
20 | For Part2, we look at all the cards present in the hand along the joker(s), and test the score with the jocker imitating each of these cards, using the mocked value for computing the type, but the low value (1) of the joker for computing the strength. Be careful to take into account the special cases of hands with no or only jokers.
21 |
--------------------------------------------------------------------------------
/go/2015/days/day01/day01.go:
--------------------------------------------------------------------------------
1 | // Adventofcode 2015, day01, in go. Arguments:
2 | // -1: use solve part 1 of the problem, default is the second one
3 | // the input file name: default: input.txt
4 | // TEST: input 1795
5 | package main
6 |
7 | import (
8 | "flag"
9 | "fmt"
10 | "io/ioutil"
11 | "os"
12 | )
13 |
14 | func main() {
15 | partOne := flag.Bool("1", false, "run part one code, instead of part 2 (default)")
16 | flag.Parse()
17 | infile := "input.txt"
18 | if flag.NArg() > 0 {
19 | infile = flag.Arg(0)
20 | }
21 | i, err := ioutil.ReadFile(infile)
22 | if err != nil {
23 | os.Exit(1)
24 | }
25 | var result int
26 | if *partOne {
27 | fmt.Println("Running Part1")
28 | result = Part1(string(i))
29 | } else {
30 | fmt.Println("Running Part2")
31 | result = Part2(string(i))
32 | }
33 | fmt.Println(result)
34 | }
35 |
36 | func Part1(input string) int {
37 | floor := 0
38 | for _, c := range input {
39 | switch {
40 | case c == '(':
41 | floor++
42 | case c == ')':
43 | floor--
44 | }
45 | }
46 | return floor
47 | }
48 |
49 | func Part2(input string) int {
50 | floor := 0
51 | position := 0
52 | for p, c := range input {
53 | switch {
54 | case c == '(':
55 | floor++
56 | case c == ')':
57 | floor--
58 | }
59 | if floor == -1 {
60 | position = p + 1
61 | break
62 | }
63 | }
64 | return position
65 | }
66 |
--------------------------------------------------------------------------------
/bash/2021/days/d16.input:
--------------------------------------------------------------------------------
1 | A20D6CE8F00033925A95338B6549C0149E3398DE75817200992531E25F005A18C8C8C0001849FDD43629C293004B001059363936796973BF3699CFF4C6C0068C9D72A1231C339802519F001029C2B9C29700B2573962930298B6B524893ABCCEC2BCD681CC010D005E104EFC7246F5EE7328C22C8400424C2538039239F720E3339940263A98029600A80021B1FE34C69100760B41C86D290A8E180256009C9639896A66533E459148200D5AC0149D4E9AACEF0F66B42696194031F000BCE7002D80A8D60277DC00B20227C807E8001CE0C00A7002DC00F300208044E000E69C00B000974C00C1003DC0089B90C1006F5E009CFC87E7E43F3FBADE77BE14C8032C9350D005662754F9BDFA32D881004B12B1964D7000B689B03254564414C016B004A6D3A6BD0DC61E2C95C6E798EA8A4600B5006EC0008542D8690B80010D89F1461B4F535296B6B305A7A4264029580021D1122146900043A0EC7884200085C598CF064C0129CFD8868024592FEE9D7692FEE9D735009E6BBECE0826842730CD250EEA49AA00C4F4B9C9D36D925195A52C4C362EB8043359AE221733DB4B14D9DCE6636ECE48132E040182D802F30AF22F131087EDD9A20804D27BEFF3FD16C8F53A5B599F4866A78D7898C0139418D00424EBB459915200C0BC01098B527C99F4EB54CF0450014A95863BDD3508038600F44C8B90A0801098F91463D1803D07634433200AB68015299EBF4CF5F27F05C600DCEBCCE3A48BC1008B1801AA0803F0CA1AC6200043A2C4558A710E364CC2D14920041E7C9A7040402E987492DE5327CF66A6A93F8CFB4BE60096006E20008543A8330780010E8931C20DCF4BFF13000A424711C4FB32999EE33351500A66E8492F185AB32091F1841C91BE2FDC53C4E80120C8C67EA7734D2448891804B2819245334372CBB0F080480E00D4C0010E82F102360803B1FA2146D963C300BA696A694A501E589A6C80
2 |
--------------------------------------------------------------------------------
/go/2015/days/day20/day20_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | // reflect.DeepEqual(got, expected)
8 | func Test_part1(t *testing.T) {
9 | t.Run("1", func(t *testing.T) {
10 | got := part1(150)
11 | expected := 8
12 | if got != expected {
13 | t.Errorf("expected '%v' but got '%v'", expected, got)
14 | }
15 | })
16 | t.Run("2", func(t *testing.T) {
17 | got := part1(29000000)
18 | expected := 665280
19 | if got != expected {
20 | t.Errorf("expected '%v' but got '%v'", expected, got)
21 | }
22 | })
23 | t.Run("3", func(t *testing.T) {
24 | got := part1(36000000)
25 | expected := 831600
26 | if got != expected {
27 | t.Errorf("expected '%v' but got '%v'", expected, got)
28 | }
29 | })
30 | }
31 |
32 | func Test_part2(t *testing.T) {
33 | t.Run("1", func(t *testing.T) {
34 | got := part2(150)
35 | expected := 8
36 | if got != expected {
37 | t.Errorf("expected '%v' but got '%v'", expected, got)
38 | }
39 | })
40 | t.Run("2", func(t *testing.T) {
41 | got := part2(29000000)
42 | expected := 705600
43 | if got != expected {
44 | t.Errorf("expected '%v' but got '%v'", expected, got)
45 | }
46 | })
47 | t.Run("3", func(t *testing.T) {
48 | got := part2(36000000)
49 | expected := 884520
50 | if got != expected {
51 | t.Errorf("expected '%v' but got '%v'", expected, got)
52 | }
53 | })
54 | }
55 |
--------------------------------------------------------------------------------
/go/2023/days/d25/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2023, in GO, day d25
2 |
3 | The problem is cutting a graph into two sub-graphs.
4 |
5 | A a brute-force approch (in the function `BruteForceCut` works for the example since all combinations of 3 links (or graph edges) out of its 33 is only 32736.
6 | But it cannot work for the 3450 edges of my input that would require looking at more than 40 billions of combinations.
7 |
8 | We then must find an algorithm do do this, and I used the Kargen-Stein one, detailed in
9 | https://stanford-cs161.github.io/winter2021/assets/files/lecture16-slides.pdf
10 |
11 | The slide 95 giving a pseudo-code summary of the algorithm itself:
12 |
13 | KargerStein of a graph with initial number of nodes $n$:
14 | - if $n$ < 4:
15 | - find a min-cut by brute force
16 | - Run Karger’s algorithm on G with independent repetitions until $n/\sqrt(2)$ nodes remain
17 | - Make 2 copies copies of what’s left of G: G1 and G2
18 | - Recurse on them, cutting a different edge at random on each one
19 | - S1 = KargerStein(G1)
20 | - S2 = KargerStein(G2)
21 | - return whichever of S1 or S2 is the smaller cut.
22 |
23 | Karger is the simpler version:
24 | - if $n$ < 4:
25 | - find a min-cut by brute force
26 | - Run Karger’s algorithm on G with independent repetitions
27 | I coded it in the KargerMinCut function, the input is not big enough to warrant a Karger-Stein algorithm
28 |
--------------------------------------------------------------------------------
/go/2025/days/d01/README.md:
--------------------------------------------------------------------------------
1 | # Advent of code challenge 2025, in GO, day d01
2 |
3 | [Problem statement](https://adventofcode.com/2025/day/1)
4 |
5 | Basically, the position of the dial is the one we get modulo 100 after performing the move.
6 | So, a simple formula would be:
7 |
8 | `new-pos = (old-pos + move) % 100`
9 |
10 | E.g, for R42 while the dial is at 76
11 |
12 | `18 = (76 + 42) % 100`
13 |
14 | The difficulty is for negative moves, e.g the first example move of `L68`. Trying to find the correct arithmetic formula from scratch is error prone, as modulo keeps the sign:
15 |
16 | `-42 % 100` yields `-42` where we would have liked to get `58`.
17 |
18 | The sanest solution is thus not to use the classic modulo operator (`%`), but a **Positive Modulo** function (also called true modulo or Euclidian modulo), that we call `pmod`.
19 |
20 | Thus `new-pos = pmod(old-pos + move, 100)` works in all cases.
21 |
22 |
23 | ## Part2
24 |
25 | Positive rotations, are simple, for negative (counterclockwise), we flip the picture horizontally:
26 |
27 | ```
28 | --- h flip -->
29 |
30 | 0 0
31 | 7 1 1 7
32 | 6 2 2 6
33 | 5 3 3 5
34 | 4 * * 4
35 | ```
36 |
37 | Thus a L42 becomes a R42 on the mirrored dial, where numbers on the dial are `pmod(100 - n)`, and we can use the simple computations for positive rots.
38 |
39 |
--------------------------------------------------------------------------------
/go/TEMPLATES/README.md:
--------------------------------------------------------------------------------
1 | # Colas Adventofcode templates
2 |
3 | These are files to be copied in the day directories as needed, to provide some functionalities. So they are in the `main` package namespace. You can also fing files used to populate new day directories via the bash script `MAKEDAY`.
4 |
5 | I did not make proper packages because:
6 | - I was learning Go, and it gave me the occasion to reinvent the wheel to do things by myself and better understand them
7 | - There already exist better (but maybe more complex to use) packages on github, no need to publish them as standalone packages
8 | - I may evolve them, and maybe later publish them as proper standalone packages (not really likely, though), so I can tweak them and change their API without fear of breaking past exercices relying on them, as they work with their own copy.
9 | - Some are just bits copied from other authors (with attribution)
10 |
11 | ## Used external packages
12 | On a related note, I also used the external packages not in the Go standard library:
13 |
14 | - `github.com/gammazero/deque` fast FIFO & LIFO
15 | - `github.com/fzipp/astar` simple and flexible Astar shortest path finder. I finally made my own version `astar.go`, even easier to use, using generics
16 | - `github.com/emirpasic/gods/` plenty of useful data structures and algorithms in Go
17 | - `github.com/deckarep/golang-set` a production-quality implementation of Sets
18 |
--------------------------------------------------------------------------------
/go/2024/days/d23/d23_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | "reflect"
6 | )
7 |
8 | // https://en.wikipedia.org/wiki/Bron%E2%80%93Kerbosch_algorithm#Example
9 |
10 | func EdgesInit() BKSet {
11 | bks := BKNew()
12 | bks[0] = uint64(63)
13 | bkedges = [][]int{[]int{1,4}, []int{0,2,4}, []int{1,3}, []int{2,4,5}, []int{0,1,3}, []int{3}}
14 | return bks
15 | }
16 |
17 | // set of unit tests
18 | func Test(t *testing.T) {
19 | // setup code
20 | s := EdgesInit()
21 | e := BKNew()
22 |
23 | e[0] = uint64(63)
24 | t_add("AddNode 1", t, s, 1, e)
25 | e = BKNew()
26 | e[0] = uint64(63 + 1<<32)
27 | t_add("AddNode 32", t, s, 32, e)
28 | e = BKNew()
29 | e[0] = uint64(63)
30 | e[1] = uint64(1 << (80-64))
31 | t_add("AddNode 80", t, s, 80, e)
32 |
33 | t_res("Restrict 1", t, s, BKMake(0, 3, 5), BKMake(1, 2, 4))
34 | }
35 |
36 | // test function
37 | func t_add(label string, t *testing.T, s BKSet, i int, expected BKSet) {
38 | t.Run(label, func(t *testing.T) {
39 | got := s.AddNode(i)
40 | if !reflect.DeepEqual(got, expected) {
41 | t.Errorf("expected '%v' but got '%v'", expected, got)
42 | }})}
43 |
44 | // test function
45 | func t_res(label string, t *testing.T, s, ss BKSet, expected BKSet) {
46 | t.Run(label, func(t *testing.T) {
47 | got := s.Restrict(ss)
48 | if !reflect.DeepEqual(got, expected) {
49 | t.Errorf("expected '%v' but got '%v'", expected, got)
50 | }})}
51 |
--------------------------------------------------------------------------------