diff options
123 files changed, 16269 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd7fab4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.clang-format diff --git a/2015/01/.gitignore b/2015/01/.gitignore new file mode 100644 index 0000000..60d075d --- /dev/null +++ b/2015/01/.gitignore @@ -0,0 +1 @@ +puzzle-[12] diff --git a/2015/01/Makefile b/2015/01/Makefile new file mode 100644 index 0000000..c32dafa --- /dev/null +++ b/2015/01/Makefile @@ -0,0 +1,7 @@ +all: + ${CC} ${CFLAGS} -o puzzle-1 puzzles.c + ${CC} ${CFLAGS} -DPART2 -o puzzle-2 puzzles.c + +.PHONY: clean +clean: + rm -f puzzle-[12] diff --git a/2015/01/input b/2015/01/input new file mode 100644 index 0000000..73e014e --- /dev/null +++ b/2015/01/input @@ -0,0 +1 @@ +(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()((()((()((((((((((())(()())))))()))())()()((((()()()()()()((((((())())(((()())()((()()(((()()()))(((((()))(((()(()()()(()(()(((())()))(()(((()((())()(()())())))((()()()(()()(((()))(((()((((()(((((()()(()())((()())())(()((((((()(()()))((((()))))())((())()()((()(()))))((((((((()))(()()(((())())(())()((()()()()((()((()((()()(((())))(()((())()((((((((()((()(()()(((())())())))(())())))()((((()))))))())))()()))()())((()())()((()()()))(()()(((()(())((((())())((((((((()()()()())))()()()((((()()))))))()((((()(((()))(()()())))((()()(((()))()()())())(((())((()()(())()()()(((())))))()())((()))()))((())()()())()())()()(()))())))())()))(())((()(())))(()(())(()))))(()(())())(()(())(()(()))))((()())()))()((((()()))))())))()()())((())()((()()()))()(((()(()))))(())()()))(((()())))))))))(((())))()))())()))))()()(((())))))))()(()()(()))((()))))((())))((()((())))())))()()(()))())()(()((()())(()(()()())())(()()))()))))(()())()()))()()()()))(()(()(()))))))()(()))()))()()(()((())(()(())))()(((())(())())))))()(()(()))))()))(()()()(())()(()(())))()))))()()(((((())))))())()())())())()())()))))()))))))))())()()()()()()())))()))((())()))())))()((())()))))()))())))))))())()()()))()()(()((((()(((((((()(())((()())((()()))()))))(())))()()()(())((())()())))(())))(())))(((()()))()(())(((()(()))((())))())()))((((()))())()))))))))()(())())))(()))()(()()))())()()(())())))())()()(()())))()((()())(()(())(())))))))))))))(()))))()))))))()()())(()(((((()(()())))())()))(()))()))(()()))()())(()))())()(())((()()))))))())))())()(((())))(()(()))()()))()(()))))))((()())(()))))))()())))()()))))))))((((((((()()()(()))))))()())))())))()()((())()))((())(())))())())))()()()((()((()(())))())()(())))))))))()())))()()()()()()))()))((())())(()(()))))))(()()))()))(())))()))))))))))))(()))))))))()))))()))()())()))()()))))))()))))((()))))(()))())()(())))(()())((((()())))()))))(()))()(()()(())))))())))))()))))))())))())))))())))())())))())(()))))(())()(())))())()))((()()))))))())))((())))))))())))(())))))()()())))))())))))()))))))()))()()()(()(((()())())())(()))())))))((()(())(()))))))))(())))()()()())())(()))))()()()))()))())())())()(())))()(((()((((())))))))()))))))))))))))))))))((())()())(()))))()()))))))(()()(())())))())))((())))((())))))))))))))()))))()(()))))))())))))()))(()()())(()())))))))))()))))))(())))))()()))()())(((())))()))(()))))))))(())())))())))())())())()()))((())()(())()())()))()())(())(()))))()())))(()(((()))))))()(()())()()()))()))))))))()()()(())()())()(((((()))()())())(()))))()()()(())))())))()((()())))(()))())()(()())())(()))()()))((()()))((()()()()())))(())()))(()(())))((()()))))))))())))))))())()()))))))))))))))))(())()(())(())()())())()))()(()))))())())))))()())()(()))()()(())))(())())))))(()))))))))))))))())())(())(())))(((()))()))))())((())(()))())))))))())))))())))()))()))))))))))))())()))))()))))((()))(())))()(())))(())()))()))())))())))))))()(()())())))()()())))(())))))(()))))))))))))(()))()))()))())))(((()()()(())((()())))()())(((()))(())()))((()()()())))())(())(()))))()(((((())))(()))())())))))))((((()()()))())())()(()(()())))))))))()())())))(())))()())(((()(())())()()))())())))))))((()())((()()(()))(()(())))()))()))(()))(()))()()(()(((())((((()))()(()))((())()(()(()())()(()))()())))))(()))()))())()())))())))(())))((())(()())))))()))(())(()))()())()(()()((()(()))))))()(())(()())(())()))(((())()))(()()(()()()))))(()(())))()))))())))))())(()()()()()()(((())))(()()))()((())(((((()()())))(()))(()))()()))(((())())()(((()()()()))))(()))(())())))()())(()()())())))))))()))))((())))()())(()))(()(()))())))))())(())))))()()())())()))()()(())))(()))(())((((((())(()))(()))())()))(()()(())))()))(()()))()))()(())))(())))((()(()))(())()()())())))(((()()())(())()))))))()(((()(((((()()(((())(())))())()((()))))((()())()(())(((())))(((()((()(()(()))(()()))())(()))(())(())))()))))))((((()))()((((()(()))()))()()))))()(()(()))()(()((()(((()(()()(((()))))()(((()(()(()(((()(()())())()()(()(()())())(()((((())(()))()))(((((()()())(())()((()()())))()()(((()()))()((((((((()(())))())((()))))(())))(()))))((()((((()()(())(((((()))(((((((((((((()())))((((()(((()((())())()))((()))()(()()((()()()()(()()(()(()(((())()(()((((((()((()()((())()((((()((()()(()()())((()()()((()((())()(()(((()((())((((())(()))((()(()))(()())()((((((((()(((((((((((()))(()(((()(()()()((((())((())()())()))(())((())(()))(((()((()(())))(()))))((()()))))((((()(()(()())(()(())((((((((()((((()((()(((((()))())()(()))(()()((()(())(((((()(())()(((((()()))))))()(((())()(()()((((())()((())((()(((())(((()))((()()((((()(())))))((()((((()((()((()(((())((()))(((((((()(((()((((((((())()))((((())(((((()((((((((()(((()((()(((()()(((()((((((()()(()((((((((()()(()(()(())((((()())()))))(((()))((((())((((()())((()(())()((()((((((()((((((()(())))()())(((())())())()(())()(()())((()()((((())((((((())(()(((((()((((())()((((()(()(())(()())(((())()((())((((()))()((((((())(()(((()(((()((((((()(((()))(()()())())((()((()())()((((())(((()(()(((((((((())(())))()((()()()()(())((()))(((((((()(((((((((()(()))))(()((((((((()((((()((()()((((((()()(((((((()(()(())()(())((()()()((()(((((()())()(((((()())()()((()(()())(()()()(((()()(((((()((((((()()((()(()()()((((((((((((()((((((((()()(((()())))()(((()()(())())((((()((((()((((()()()(())(())((()(()(((((((((((((((()(())(())))))()()))((()(((()(())((()(((()(()()((((()()(((()(((()(((((()()((()(()(((()))((((((()((((((((()((()((())(((((()(((())(())())((()()))((((())()()((()(((()(((((()()(((()))(((()(()(((((((((((((()))((((((((()(((()))))())((((((((((((())((())((()())(((())((())(()((((((((((()(((())((()()(()((())(((((((((((()))((((((((((((()(()())((()((()((()(()(((()((((((((()()(()((()(()(((()))((()))(((((((((((((()(())((((((())(((()(())(()(()(()((()()))((((()((((()((((())))())((((()((((()))((((((()((((((()((()(((())))((())(()))(()((()((((()((()(((()()))((((()()()(((((((())(((())(()))())((((()())(((()(((((((((((()(()(()((()(((((((((((((((()()((((()((((((((()(((()()((()((((()))(((()(())((((((()((((())()((((()((()))(())()(()(((()((())())((((((()(()(())())(((())(()(()())(((((()((()((())()())(())))(((()(())))))))(((()(((()))()((()(((()()((()())()()))())))(((()))(()(((()(((((((((()(()(((((()()(((()())()()))))()(((()))(((()(()(()(()(()))()(())()))(()(((())))(()))))))))))(())((()((())((()(())()(())((()()((((()()((()()))((())(((()((()(())(())))()(()(((((()((()))())()(((((()()(((()(()((((((())(()))(())()))((()(()()))(())())()))(((())))(()((()(((())(())())))((()()((((((((((((((()((()(()()(()(((()))())()()((()()()(())(()))(()())(((())((())()(())()()(()()(())))((()(((()))))(((()()(()()))())((()((())()))((((()()()())((())))(((()(())(((((()(((((()((()(()((((()()(((()()()(((()())(((()()((((())(()))(((()))(())())((()))(((()((()))(((()()((())((()(((((()((((()()())((()))()((((()((()(()()()(
\ No newline at end of file diff --git a/2015/01/puzzles.c b/2015/01/puzzles.c new file mode 100644 index 0000000..6690a64 --- /dev/null +++ b/2015/01/puzzles.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <stdlib.h> + +int +main(void) +{ + int c; + FILE *fp = fopen("input", "r"); + + register int floor = 0; + for (register unsigned int i = 1; (c = fgetc(fp)) != EOF; i++) { + floor += (c == '(') ? 1 : -1; +#ifdef PART2 + if (floor == -1) { + printf("%u\n", i); + return EXIT_SUCCESS; + } +#endif + } + + fclose(fp); + printf("%d\n", floor); + + return EXIT_SUCCESS; +} diff --git a/2015/02/input b/2015/02/input new file mode 100644 index 0000000..5f3335f --- /dev/null +++ b/2015/02/input @@ -0,0 +1,1000 @@ +29x13x26 +11x11x14 +27x2x5 +6x10x13 +15x19x10 +26x29x15 +8x23x6 +17x8x26 +20x28x3 +23x12x24 +11x17x3 +19x23x28 +25x2x25 +1x15x3 +25x14x4 +23x10x23 +29x19x7 +17x10x13 +26x30x4 +16x7x16 +7x5x27 +8x23x6 +2x20x2 +18x4x24 +30x2x26 +6x14x23 +10x23x9 +29x29x22 +1x21x14 +22x10x13 +10x12x10 +20x13x11 +12x2x14 +2x16x29 +27x18x26 +6x12x20 +18x17x8 +14x25x1 +30x15x22 +17x18x7 +28x23x24 +15x12x25 +14x7x20 +29x23x8 +24x5x22 +6x22x8 +1x15x26 +14x5x1 +24x28x28 +17x23x23 +4x15x7 +23x8x11 +6x15x1 +23x18x13 +17x1x26 +23x13x17 +2x18x8 +22x22x1 +10x22x6 +28x29x20 +22x21x25 +14x8x23 +12x30x14 +8x7x5 +3x30x15 +4x3x29 +25x18x3 +16x7x16 +4x3x8 +9x16x30 +20x28x3 +28x24x6 +4x18x2 +23x18x5 +22x4x30 +15x30x9 +7x12x12 +3x22x29 +12x1x9 +9x2x25 +17x11x10 +25x24x7 +7x27x26 +26x4x12 +29x2x26 +19x24x12 +23x23x3 +26x28x16 +18x4x16 +25x30x18 +29x19x19 +16x3x27 +29x25x29 +18x19x5 +14x21x30 +19x13x26 +19x10x15 +9x4x7 +18x6x6 +24x25x29 +9x12x27 +15x3x22 +30x17x21 +18x19x28 +9x11x12 +8x28x22 +11x3x4 +28x17x20 +24x18x15 +11x12x13 +6x19x24 +28x4x5 +28x22x23 +13x29x2 +9x16x15 +29x28x1 +10x18x30 +19x11x12 +26x28x25 +23x17x13 +25x1x21 +17x1x27 +17x27x28 +28x13x15 +14x13x25 +11x29x7 +22x29x5 +13x6x14 +23x18x13 +25x7x17 +18x9x20 +21x11x2 +28x11x13 +13x25x1 +19x29x25 +16x29x4 +10x21x10 +7x25x17 +5x9x3 +1x15x6 +8x27x29 +23x6x30 +22x22x29 +6x20x30 +26x25x29 +10x19x19 +20x30x9 +5x30x24 +17x10x27 +30x14x30 +8x17x4 +7x18x6 +3x5x4 +24x17x15 +14x20x17 +22x27x15 +18x14x15 +23x9x11 +21x16x29 +7x18x21 +9x3x29 +10x13x4 +2x30x4 +23x20x4 +8x22x21 +29x28x4 +13x16x25 +21x9x11 +7x26x26 +13x23x30 +19x7x10 +9x23x21 +21x9x17 +9x21x15 +20x29x22 +23x13x15 +19x25x2 +12x11x30 +20x21x6 +21x6x17 +24x26x9 +29x21x29 +29x26x16 +6x16x1 +2x12x6 +6x7x20 +7x2x22 +6x22x4 +13x11x27 +25x27x14 +11x8x6 +26x11x14 +30x3x29 +27x21x20 +15x16x26 +6x22x10 +11x9x25 +23x13x6 +13x9x3 +30x22x13 +29x23x14 +25x19x6 +7x29x11 +19x18x5 +29x25x13 +25x24x27 +1x9x12 +22x9x17 +14x12x28 +19x21x17 +13x25x17 +14x25x12 +4x14x30 +7x15x28 +3x6x25 +6x2x16 +15x19x11 +17x30x20 +20x23x7 +26x21x6 +26x29x24 +2x4x30 +4x22x18 +13x3x28 +27x6x21 +5x3x27 +12x7x11 +28x11x9 +12x9x2 +1x22x20 +15x13x28 +14x19x16 +28x20x3 +20x4x9 +26x7x26 +18x19x25 +7x1x13 +20x23x29 +27x26x8 +11x15x15 +10x21x23 +29x2x11 +21x28x20 +3x18x23 +26x17x17 +14x26x17 +20x7x17 +18x12x8 +4x8x8 +8x15x23 +24x29x5 +1x25x8 +1x28x17 +16x18x13 +29x24x22 +13x16x10 +14x7x16 +15x11x29 +12x15x19 +17x6x28 +4x3x9 +15x16x8 +29x27x11 +2x24x20 +4x21x3 +29x24x27 +18x22x22 +7x8x18 +20x7x8 +19x9x2 +20x17x2 +2x29x10 +19x25x1 +28x9x3 +29x27x20 +7x21x7 +10x4x22 +26x8x5 +26x14x1 +5x27x9 +2x18x3 +3x27x17 +30x17x23 +30x11x20 +4x6x7 +6x29x27 +30x16x20 +24x30x28 +19x20x26 +18x1x25 +26x12x12 +19x15x29 +16x21x24 +23x13x26 +25x16x10 +8x9x18 +24x14x1 +24x15x21 +19x9x14 +8x23x11 +22x2x16 +29x9x26 +3x16x25 +15x20x30 +3x11x12 +15x2x3 +13x7x4 +2x7x27 +9x26x11 +30x24x19 +28x17x21 +10x8x2 +11x15x26 +10x12x20 +24x24x27 +25x26x16 +13x4x20 +25x13x11 +12x22x3 +20x7x1 +12x18x6 +26x8x20 +14x2x7 +23x12x1 +26x24x24 +27x26x23 +26x17x5 +17x24x2 +26x5x6 +23x5x1 +5x18x30 +24x21x19 +5x28x11 +21x20x14 +25x4x22 +26x24x11 +7x5x8 +13x1x30 +5x1x6 +14x5x2 +8x11x7 +13x20x1 +17x30x14 +29x22x10 +12x26x3 +27x17x3 +26x27x4 +5x26x17 +22x11x19 +8x26x3 +24x19x22 +7x1x4 +6x27x30 +4x28x14 +16x14x18 +4x5x20 +19x25x4 +15x15x1 +10x14x14 +16x18x24 +21x27x15 +5x5x10 +1x7x13 +16x2x8 +13x15x11 +3x25x10 +20x29x8 +12x3x2 +10x13x12 +25x27x1 +11x30x19 +7x19x13 +27x6x18 +16x21x19 +21x29x5 +16x23x12 +29x19x15 +5x5x10 +27x15x1 +13x16x22 +29x19x5 +8x12x9 +3x18x5 +13x25x3 +5x9x21 +10x20x16 +9x9x11 +23x21x1 +22x2x15 +27x8x13 +23x7x3 +26x30x15 +29x15x16 +16x27x13 +2x18x9 +10x27x8 +20x9x25 +10x2x17 +16x13x13 +21x26x1 +27x26x24 +9x30x16 +19x17x28 +25x15x1 +10x26x6 +10x11x11 +5x26x25 +30x4x15 +9x8x23 +14x25x7 +8x28x8 +28x18x24 +4x4x25 +16x25x11 +17x27x8 +15x16x9 +24x13x21 +17x3x27 +27x5x26 +8x27x12 +29x2x8 +24x23x30 +1x30x21 +6x18x20 +13x14x12 +25x30x23 +24x6x24 +12x7x21 +11x6x8 +8x30x30 +26x3x12 +28x6x5 +18x7x1 +7x6x20 +14x16x18 +11x22x15 +4x20x10 +19x24x19 +8x24x11 +4x9x10 +6x6x22 +10x9x29 +1x5x28 +19x25x29 +20x30x3 +15x13x13 +9x9x24 +20x14x29 +26x24x13 +2x25x8 +10x26x2 +12x19x12 +18x6x20 +4x5x14 +26x27x10 +16x26x20 +3x21x15 +2x26x18 +14x11x17 +26x26x25 +10x1x11 +17x19x19 +27x28x26 +9x2x10 +19x30x15 +23x30x14 +15x3x20 +2x14x22 +21x18x8 +22x4x29 +19x6x29 +9x26x29 +16x10x9 +22x12x22 +13x28x14 +25x14x28 +28x3x30 +10x17x1 +10x27x22 +10x23x19 +14x25x9 +11x24x8 +30x25x10 +22x13x28 +2x7x6 +11x20x8 +9x22x14 +19x16x9 +11x24x4 +11x17x2 +6x4x10 +26x10x10 +12x14x5 +27x10x3 +15x3x6 +11x7x19 +22x10x12 +21x26x10 +13x20x3 +27x8x8 +1x24x23 +24x9x22 +23x17x23 +3x28x19 +2x20x28 +23x17x24 +26x1x4 +4x1x12 +5x6x16 +13x22x13 +25x21x21 +20x21x12 +9x24x25 +17x16x12 +12x28x9 +18x16x27 +29x12x2 +30x12x15 +24x11x10 +4x9x22 +4x24x5 +19x11x5 +6x25x6 +1x20x17 +22x8x21 +11x26x4 +16x19x3 +8x12x8 +13x2x18 +10x5x11 +8x12x17 +21x2x5 +26x17x26 +23x18x17 +28x11x14 +1x4x27 +29x5x28 +5x9x10 +5x7x25 +20x15x27 +15x11x17 +12x14x1 +29x14x4 +18x14x18 +14x25x24 +26x14x18 +13x8x11 +30x1x23 +3x4x12 +12x24x9 +8x6x16 +14x15x30 +12x30x8 +22x11x18 +16x30x28 +17x18x4 +13x14x23 +2x28x8 +3x28x30 +29x30x8 +4x6x26 +6x30x17 +11x30x30 +19x4x3 +12x15x20 +22x28x4 +26x30x2 +6x12x7 +1x10x5 +25x29x7 +17x9x18 +16x21x29 +21x14x7 +15x16x11 +26x6x15 +8x24x7 +2x20x4 +2x9x3 +19x8x13 +18x7x22 +27x14x17 +2x13x8 +18x15x26 +15x27x27 +18x11x15 +1x29x20 +21x12x11 +20x2x15 +28x23x9 +1x1x17 +7x23x9 +30x9x27 +9x16x18 +15x24x28 +30x11x18 +29x26x10 +9x5x25 +2x1x19 +14x3x14 +6x3x6 +30x15x20 +20x17x27 +28x10x9 +14x24x28 +17x11x6 +12x3x6 +8x8x15 +23x14x21 +11x21x7 +5x13x30 +4x29x25 +30x28x24 +18x4x9 +3x15x6 +13x9x19 +30x14x7 +7x9x9 +17x11x26 +24x26x13 +16x21x16 +27x17x25 +2x21x11 +9x11x27 +3x3x7 +13x8x14 +20x20x26 +13x29x22 +30x11x1 +7x10x19 +27x5x9 +23x17x15 +21x6x13 +24x15x16 +18x4x14 +18x16x6 +22x11x18 +14x2x5 +15x3x7 +10x20x29 +16x1x10 +30x23x1 +10x15x11 +17x14x5 +22x8x13 +7x11x28 +26x17x3 +2x23x2 +28x13x19 +18x12x28 +22x23x16 +14x12x1 +20x8x19 +17x19x13 +29x2x12 +2x26x27 +29x16x4 +13x8x18 +16x15x30 +23x16x2 +28x8x27 +21x8x23 +13x20x26 +19x6x17 +17x30x15 +7x4x30 +2x13x30 +18x7x19 +4x13x27 +8x6x5 +18x20x25 +2x3x30 +23x27x13 +22x30x4 +23x25x25 +23x16x19 +25x3x1 +5x6x15 +11x29x12 +25x24x7 +16x7x20 +20x3x2 +12x27x15 +16x10x12 +1x3x14 +22x1x26 +2x24x18 +11x29x16 +15x2x9 +10x1x24 +21x8x11 +30x11x23 +6x30x21 +13x27x29 +14x6x5 +18x29x19 +12x4x28 +29x3x14 +10x30x28 +5x7x15 +14x1x10 +9x25x14 +7x24x18 +28x17x21 +18x13x25 +26x15x1 +21x1x19 +12x16x21 +4x6x13 +7x15x26 +17x19x5 +12x28x2 +1x20x19 +27x7x5 +17x26x8 +12x15x19 +5x23x10 +8x2x8 +16x13x12 +14x27x1 +26x29x3 +24x16x14 +14x13x13 +7x22x23 +2x9x30 +4x27x8 +26x27x15 +23x1x6 +25x29x18 +5x18x1 +20x8x20 +5x10x25 +30x25x15 +7x22x25 +28x26x17 +29x4x1 +21x11x27 +20x9x8 +25x22x12 +2x11x11 +23x2x16 +23x27x20 +2x13x28 +27x2x24 +11x1x17 +12x4x27 +16x20x22 +30x12x10 +5x15x4 +5x2x27 +12x4x25 +1x16x4 +27x4x4 +21x16x3 +27x26x3 +24x6x6 +24x12x12 +20x20x25 +8x29x2 +21x4x5 +2x4x8 +4x13x19 +3x20x10 +12x15x16 +6x5x4 +12x16x20 +22x19x17 +8x17x22 +25x16x15 +7x1x19 +10x1x7 +23x23x5 +28x6x12 +2x25x12 +10x27x12 +24x27x19 +14x14x20 +4x1x5 +16x27x29 +20x20x24 +28x24x30 +6x15x15 +9x15x30 +23x26x3 +17x24x21 +22x25x25 +18x29x10 +20x25x1 +24x11x16 +20x7x21 +20x7x9 +7x26x2 +5x18x1 +16x26x28 +4x10x18 +27x30x21 +26x9x9 +8x16x14 +6x27x8 +28x9x20 +13x13x4 +9x18x16 +18x15x18 +22x19x14 +14x10x17 +25x29x11 +1x18x19 +8x11x26 +18x6x14 +30x24x13 +27x1x27 +15x9x3 +2x29x17 +2x26x21 +22x9x9 +20x20x20 +22x28x2 +26x5x16 +11x3x14 +21x16x16 +18x26x7 +18x30x6 +7x11x12 +15x10x2 +27x2x16 +27x30x24 +28x14x24 +7x4x8 +6x28x15 +13x19x1 +22x26x30 +7x30x24 +2x17x21 +19x26x2 +19x24x15 +14x23x2 +21x27x15 +30x15x14 +21x29x5 +23x30x2 +4x1x2 +15x5x13 +21x2x30 +20x7x16 +1x21x25 +2x25x1 +12x29x5 +28x13x16 +26x3x12 +29x20x23 +28x12x20 +4x30x8 +16x15x16 +6x16x29 +2x28x13 +24x25x2 +26x15x22 +17x20x11 +18x12x7 +19x1x18 +8x27x13 +22x16x8 +19x26x17 +13x11x10 +22x12x3 +13x12x14 +29x17x9 +6x14x10 +14x20x10 +8x26x9 +25x13x22 +3x30x25 +14x28x1 +30x29x12 +3x17x15 +3x24x14 +28x24x22 +16x6x1 +20x25x14 +17x17x13 +6x19x27 +10x15x20 +8x23x20 +7x29x21 +18x9x25 +10x5x22 +2x27x27 +16x18x30 +15x5x12 +26x29x29 +28x11x10 +9x29x28 +24x15x23 +26x9x10 +5x1x25 +22x27x16 +7x29x3 +1x3x5 +8x7x29 +19x21x11 +28x13x30 +17x16x20 +5x10x25 +9x14x15 +15x14x23 +16x4x17 +21x8x2 +9x9x8 +22x22x4 +10x2x27 +12x19x10 +15x29x4 +22x14x7 +29x18x5 +1x7x27 +24x1x15 +23x23x26 +12x17x23 +26x10x24 +8x22x2 +8x1x10 +22x19x12 +2x23x13 +11x27x25 +26x15x27 +27x7x21 +18x9x6 +22x21x22 +7x12x26 +23x21x13 +14x3x8 +5x9x28 +29x29x15 +27x25x23 +12x2x24 +8x2x20 +29x19x4 +12x24x29 +2x27x28 +14x20x9 +28x6x25 +18x29x8 +19x11x30 +15x11x23 +18x7x7 +14x20x14 +26x18x22 +27x25x13 +12x10x30 +30x2x7 +28x10x1 +18x10x30 +22x11x5 +22x16x3 +25x15x9 +5x10x24 +4x28x8 +19x24x18 +3x4x25 +14x4x30 +11x26x3 +12x12x12 +26x7x24 +3x2x14 +1x27x7 +2x2x13 +3x26x26 +12x4x11 +12x17x20 +4x19x30 +5x18x10 +17x6x18 +19x30x20 +11x2x17 +30x13x19 +22x23x7 +17x28x2 +5x17x30 +7x11x4 +21x26x18 +15x28x4 +5x6x27 +12x6x16 +9x17x12 +27x20x5 +14x5x20 +27x14x6 +2x14x21 +4x28x30 +24x5x1 +19x29x29 +11x23x1 +8x16x21 +3x17x19 +10x13x5 +20x21x16 +23x3x6 +27x26x11 +3x2x22 +14x3x5 +10x9x8 diff --git a/2015/02/puzzle-1.awk b/2015/02/puzzle-1.awk new file mode 100755 index 0000000..e316ba2 --- /dev/null +++ b/2015/02/puzzle-1.awk @@ -0,0 +1,20 @@ +#!/usr/bin/env -S awk -f + +function min(a, b, c) +{ + if (a <= b && a <= c) + return a + if (b <= a && b <= c) + return b + return c +} + +BEGIN { FS = "x" } +{ + x = $1 * $2 + y = $2 * $3 + z = $1 * $3 + + sum += (2 * x) + (2 * y) + (2 * z) + min(x, y, z) +} +END { print sum } diff --git a/2015/02/puzzle-2.awk b/2015/02/puzzle-2.awk new file mode 100755 index 0000000..e031b94 --- /dev/null +++ b/2015/02/puzzle-2.awk @@ -0,0 +1,20 @@ +#!/usr/bin/env -S awk -f + +function min(a, b, c) +{ + if (a <= b && a <= c) + return a + if (b <= a && b <= c) + return b + return c +} + +BEGIN { FS = "x" } +{ + x = $1 + $1 + $2 + $2 + y = $2 + $2 + $3 + $3 + z = $1 + $1 + $3 + $3 + + sum += $1 * $2 * $3 + min(x, y, z) +} +END { print sum } diff --git a/2015/03/input b/2015/03/input new file mode 100644 index 0000000..6e8d40e --- /dev/null +++ b/2015/03/input @@ -0,0 +1 @@ +^^<<v<<v><v^^<><>^^<v<v^>>^^^><^>v^>v><><><<vv^^<^>^^<v^>v>v^v>>>^<>v<^<v^><^>>>>><<v>>^>>^>v^>><<^>v>v<>^v^v^vvv><>^^>v><v<><>^><^^<vv^v<v>^v>>^v^>v><>v^<vv>^><<v^>vv^<<>v>>><<<>>^<vv<^<>^^vv>>>^><<<<vv^v^>>><><^>v<>^>v<v^v<^vv><^v^><<<<>^<>v>^v>v<v<v<<>v<^<<<v>>>>>^^v>vv^^<>^<>^^^^<^^^v<v^^>v<^^v^^>v>^v^^^^>><<v<>v<>^v^<v<>><>^^><<^^<^^>vv<>v^<^v<vv<<<>^>^^>^<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v<>vv<<^vvvv><<<v>v>v^>v^<>v^>^<v<vvv^>^<>^>^^v<>><<<><v<^^>^v<v>^^v^v<<<^v^<>^<>v>^^>v<v<v>v>^^<<<><<^>v<v<^vv^v><^^<<vv>^<<v><>^>>>>><v^v<<<^>^v^v<<v<>vvv<<>v>v>>^v^v^>><<<<>v^<v<><<>>>^>>^>><<v>
\ No newline at end of file diff --git a/2015/03/puzzle-1.awk b/2015/03/puzzle-1.awk new file mode 100644 index 0000000..13b1209 --- /dev/null +++ b/2015/03/puzzle-1.awk @@ -0,0 +1,6 @@ +BEGIN { x = y = 1; homes[x][y] = 1; acc = 1 } +$0 == "^" { if (!homes[x][++y]++) acc++; next } +$0 == ">" { if (!homes[++x][y]++) acc++; next } +$0 == "v" { if (!homes[x][--y]++) acc++; next } +$0 == "<" { if (!homes[--x][y]++) acc++; next } +END { print acc } diff --git a/2015/03/puzzle-2.awk b/2015/03/puzzle-2.awk new file mode 100644 index 0000000..0857009 --- /dev/null +++ b/2015/03/puzzle-2.awk @@ -0,0 +1,11 @@ +BEGIN { sx = sy = rx = ry = 1; homes[sx][sy] = 1; acc = 1 } + { santa = santa ? 0 : 1 } +santa == 0 && $0 == "^" { if (!homes[rx][++ry]++) acc++; next } +santa == 0 && $0 == ">" { if (!homes[++rx][ry]++) acc++; next } +santa == 0 && $0 == "v" { if (!homes[rx][--ry]++) acc++; next } +santa == 0 && $0 == "<" { if (!homes[--rx][ry]++) acc++; next } +santa == 1 && $0 == "^" { if (!homes[sx][++sy]++) acc++; next } +santa == 1 && $0 == ">" { if (!homes[++sx][sy]++) acc++; next } +santa == 1 && $0 == "v" { if (!homes[sx][--sy]++) acc++; next } +santa == 1 && $0 == "<" { if (!homes[--sx][sy]++) acc++; next } +END { print acc } diff --git a/2015/03/puzzles.sh b/2015/03/puzzles.sh new file mode 100755 index 0000000..6007df1 --- /dev/null +++ b/2015/03/puzzles.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +fold -w1 input | awk -f puzzle-1.awk +fold -w1 input | awk -f puzzle-2.awk diff --git a/2015/04/.gitignore b/2015/04/.gitignore new file mode 100644 index 0000000..60d075d --- /dev/null +++ b/2015/04/.gitignore @@ -0,0 +1 @@ +puzzle-[12] diff --git a/2015/04/Makefile b/2015/04/Makefile new file mode 100644 index 0000000..10ec8f9 --- /dev/null +++ b/2015/04/Makefile @@ -0,0 +1,7 @@ +all: + ${CC} ${CFLAGS} -lmd -DINPUT=\"$$(cat input)\" -o puzzle-1 puzzles.c + ${CC} ${CFLAGS} -lmd -DINPUT=\"$$(cat input)\" -DPART2 -o puzzle-2 puzzles.c + +.PHONY: clean +clean: + rm -f puzzle-[12] diff --git a/2015/04/input b/2015/04/input new file mode 100644 index 0000000..bf3e46f --- /dev/null +++ b/2015/04/input @@ -0,0 +1 @@ +bgvyzdsv diff --git a/2015/04/puzzles.c b/2015/04/puzzles.c new file mode 100644 index 0000000..22833a2 --- /dev/null +++ b/2015/04/puzzles.c @@ -0,0 +1,35 @@ +#include <sys/types.h> + +#include <md5.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define BUFFER 128 +#ifdef PART2 + #define ZEROS "000000" + #define NUM_ZEROS 6 +#else + #define ZEROS "00000" + #define NUM_ZEROS 5 +#endif + +int +main(void) +{ + unsigned int i = 0; + char buffer[MD5_DIGEST_STRING_LENGTH], digest[BUFFER]; + MD5_CTX ctx; + + do { + snprintf(digest, BUFFER, INPUT "%u", i); + + MD5Init(&ctx); + MD5Update(&ctx, (uint8_t *) digest, strlen(digest)); + MD5End(&ctx, buffer); + } while (strncmp(buffer, ZEROS, NUM_ZEROS) && ++i); + + printf("%u\n", i); + return EXIT_SUCCESS; +} diff --git a/2015/05/input b/2015/05/input new file mode 100644 index 0000000..a9b6e77 --- /dev/null +++ b/2015/05/input @@ -0,0 +1,1000 @@ +sszojmmrrkwuftyv +isaljhemltsdzlum +fujcyucsrxgatisb +qiqqlmcgnhzparyg +oijbmduquhfactbc +jqzuvtggpdqcekgk +zwqadogmpjmmxijf +uilzxjythsqhwndh +gtssqejjknzkkpvw +wrggegukhhatygfi +vhtcgqzerxonhsye +tedlwzdjfppbmtdx +iuvrelxiapllaxbg +feybgiimfthtplui +qxmmcnirvkzfrjwd +vfarmltinsriqxpu +oanqfyqirkraesfq +xilodxfuxphuiiii +yukhnchvjkfwcbiq +bdaibcbzeuxqplop +ivegnnpbiyxqsion +ybahkbzpditgwdgt +dmebdomwabxgtctu +ibtvimgfaeonknoh +jsqraroxudetmfyw +dqdbcwtpintfcvuz +tiyphjunlxddenpj +fgqwjgntxagidhah +nwenhxmakxqkeehg +zdoheaxqpcnlhnen +tfetfqojqcdzlpbm +qpnxkuldeiituggg +xwttlbdwxohahwar +hjkwzadmtrkegzye +koksqrqcfwcaxeof +wulwmrptktliyxeq +gyufbedqhhyqgqzj +txpunzodohikzlmj +jloqfuejfkemcrvu +amnflshcheuddqtc +pdvcsduggcogbiia +yrioavgfmeafjpcz +uyhbtmbutozzqfvq +mwhgfwsgyuwcdzik +auqylgxhmullxpaa +lgelzivplaeoivzh +uyvcepielfcmswoa +qhirixgwkkccuzlp +zoonniyosmkeejfg +iayfetpixkedyana +ictqeyzyqswdskiy +ejsgqteafvmorwxe +lhaiqrlqqwfbrqdx +ydjyboqwhfpqfydc +dwhttezyanrnbybv +edgzkqeqkyojowvr +rmjfdwsqamjqehdq +ozminkgnkwqctrxz +bztjhxpjthchhfcd +vrtioawyxkivrpiq +dpbcsznkpkaaclyy +vpoypksymdwttpvz +hhdlruwclartkyap +bqkrcbrksbzcggbo +jerbbbnxlwfvlaiw +dwkasufidwjrjfbf +kkfxtjhbnmqbmfwf +vmnfziwqxmioukmj +rqxvcultipkecdtu +fhmfdibhtjzkiqsd +hdpjbuzzbyafqrpd +emszboysjuvwwvts +msyigmwcuybfiooq +druyksfnbluvnwoh +fvgstvynnfbvxhsx +bmzalvducnqtuune +lzwkzfzttsvpllei +olmplpvjamynfyfd +padcwfkhystsvyfb +wjhbvxkwtbfqdilb +hruaqjwphonnterf +bufjobjtvxtzjpmj +oiedrjvmlbtwyyuy +sgiemafwfztwsyju +nsoqqfudrtwszyqf +vonbxquiiwxnazyl +yvnmjxtptujwqudn +rrnybqhvrcgwvrkq +taktoxzgotzxntfu +quffzywzpxyaepxa +rfvjebfiddcfgmwv +iaeozntougqwnzoh +scdqyrhoqmljhoil +bfmqticltmfhxwld +brbuktbyqlyfpsdl +oidnyhjkeqenjlhd +kujsaiqojopvrygg +vebzobmdbzvjnjtk +uunoygzqjopwgmbg +piljqxgicjzgifso +ikgptwcjzywswqnw +pujqsixoisvhdvwi +trtuxbgigogfsbbk +mplstsqclhhdyaqk +gzcwflvmstogdpvo +tfjywbkmimyyqcjd +gijutvhruqcsiznq +ibxkhjvzzxgavkha +btnxeqvznkxjsgmq +tjgofgauxaelmjoq +sokshvyhlkxerjrv +ltogbivktqmtezta +uduwytzvqvfluyuf +msuckpthtgzhdxan +fqmcglidvhvpirzr +gwztkqpcwnutvfga +bsjfgsrntdhlpqbx +xloczbqybxmiopwt +orvevzyjliomkkgu +mzjbhmfjjvaziget +tlsdxuhwdmghdyjb +atoecyjhwmznaewi +pyxpyvvipbqibiox +ajbfmpqqobfsmesj +siknbzefjblnohgd +eqfhgewbblwdfkmc +opylbscrotckkrbk +lbwxbofgjkzdxkle +ceixfjstaptdomvm +hnkrqxifjmmjktie +aqykzeuzvvetoygd +fouahjimfcisxima +prkzhutbqsyrhjzx +qqwliakathnsbzne +sayhgqtlcqqidqhj +ygduolbysehdudra +zricvxhdzznuxuce +ucvzakslykpgsixd +udirhgcttmyspgsb +yuwzppjzfsjhhdzi +gtqergjiuwookwre +xvxexbjyjkxovvwf +mlpaqhnnkqxrmwmm +ezuqbrjozwuqafhb +mcarusdthcbsonoq +weeguqeheeiigrue +pngtfugozxofaqxv +copphvbjcmfspenv +jiyahihykjjkdaya +gdqnmesvptuyrfwp +vbdscfywqmfxbohh +crtrfuxyjypzubrg +seihvevtxywxhflp +fvvpmgttnapklwou +qmqaqsajmqwhetpk +zetxvrgjmblxvakr +kpvwblrizaabmnhz +mwpvvzaaicntrkcp +clqyjiegtdsswqfm +ymrcnqgcpldgfwtm +nzyqpdenetncgnwq +cmkzevgacnmdkqro +kzfdsnamjqbeirhi +kpxrvgvvxapqlued +rzskbnfobevzrtqu +vjoahbfwtydugzap +ykbbldkoijlvicbl +mfdmroiztsgjlasb +quoigfyxwtwprmdr +ekxjqafwudgwfqjm +obtvyjkiycxfcdpb +lhoihfnbuqelthof +eydwzitgxryktddt +rxsihfybacnpoyny +bsncccxlplqgygtw +rvmlaudsifnzhcqh +huxwsyjyebckcsnn +gtuqzyihwhqvjtes +zreeyomtngvztveq +nwddzjingsarhkxb +nuqxqtctpoldrlsh +wkvnrwqgjooovhpf +kwgueyiyffudtbyg +tpkzapnjxefqnmew +ludwccvkihagvxal +lfdtzhfadvabghna +njqmlsnrkcfhtvbb +cajzbqleghhnlgap +vmitdcozzvqvzatp +eelzefwqwjiywbcz +uyztcuptfqvymjpi +aorhnrpkjqqtgnfo +lfrxfdrduoeqmwwp +vszpjvbctblplinh +zexhadgpqfifcqrz +ueirfnshekpemqua +qfremlntihbwabtb +nwznunammfexltjc +zkyieokaaogjehwt +vlrxgkpclzeslqkq +xrqrwfsuacywczhs +olghlnfjdiwgdbqc +difnlxnedpqcsrdf +dgpuhiisybjpidsj +vlwmwrikmitmoxbt +sazpcmcnviynoktm +pratafauetiknhln +ilgteekhzwlsfwcn +ywvwhrwhkaubvkbl +qlaxivzwxyhvrxcf +hbtlwjdriizqvjfb +nrmsononytuwslsa +mpxqgdthpoipyhjc +mcdiwmiqeidwcglk +vfbaeavmjjemfrmo +qzcbzmisnynzibrc +shzmpgxhehhcejhb +wirtjadsqzydtyxd +qjlrnjfokkqvnpue +dxawdvjntlbxtuqc +wttfmnrievfestog +eamjfvsjhvzzaobg +pbvfcwzjgxahlrag +omvmjkqqnobvnzkn +lcwmeibxhhlxnkzv +uiaeroqfbvlazegs +twniyldyuonfyzqw +wgjkmsbwgfotdabi +hnomamxoxvrzvtew +ycrcfavikkrxxfgw +isieyodknagzhaxy +mgzdqwikzullzyco +mumezgtxjrrejtrs +nwmwjcgrqiwgfqel +wjgxmebfmyjnxyyp +durpspyljdykvzxf +zuslbrpooyetgafh +kuzrhcjwbdouhyme +wyxuvbciodscbvfm +kbnpvuqwmxwfqtqe +zddzercqogdpxmft +sigrdchxtgavzzjh +lznjolnorbuddgcs +ycnqabxlcajagwbt +bnaudeaexahdgxsj +rlnykxvoctfwanms +jngyetkoplrstfzt +tdpxknwacksotdub +yutqgssfoptvizgr +lzmqnxeqjfnsxmsa +iqpgfsfmukovsdgu +qywreehbidowtjyz +iozamtgusdctvnkw +ielmujhtmynlwcfd +hzxnhtbnmmejlkyf +ftbslbzmiqkzebtd +bcwdqgiiizmohack +dqhfkzeddjzbdlxu +mxopokqffisxosci +vciatxhtuechbylk +khtkhcvelidjdena +blatarwzfqcapkdt +elamngegnczctcck +xeicefdbwrxhuxuf +sawvdhjoeahlgcdr +kmdcimzsfkdfpnir +axjayzqlosrduajb +mfhzreuzzumvoggr +iqlbkbhrkptquldb +xcvztvlshiefuhgb +pkvwyqmyoazocrio +ajsxkdnerbmhyxaj +tudibgsbnpnizvsi +cxuiydkgdccrqvkh +cyztpjesdzmbcpot +nnazphxpanegwitx +uphymczbmjalmsct +yyxiwnlrogyzwqmg +gmqwnahjvvdyhnfa +utolskxpuoheugyl +mseszdhyzoyavepd +ycqknvbuvcjfgmlc +sknrxhxbfpvpeorn +zqxqjetooqcodwml +sesylkpvbndrdhsy +fryuxvjnsvnjrxlw +mfxusewqurscujnu +mbitdjjtgzchvkfv +ozwlyxtaalxofovd +wdqcduaykxbunpie +rlnhykxiraileysk +wgoqfrygttlamobg +kflxzgxvcblkpsbz +tmkisflhativzhde +owsdrfgkaamogjzd +gaupjkvkzavhfnes +wknkurddcknbdleg +lltviwincmbtduap +qwzvspgbcksyzzmb +ydzzkumecryfjgnk +jzvmwgjutxoysaam +icrwpyhxllbardkr +jdopyntshmvltrve +afgkigxcuvmdbqou +mfzzudntmvuyhjzt +duxhgtwafcgrpihc +tsnhrkvponudumeb +sqtvnbeiigdzbjgv +eczmkqwvnsrracuo +mhehsgqwiczaiaxv +kaudmfvifovrimpd +lupikgivechdbwfr +mwaaysrndiutuiqx +aacuiiwgaannunmm +tjqjbftaqitukwzp +lrcqyskykbjpaekn +lirrvofbcqpjzxmr +jurorvzpplyelfml +qonbllojmloykjqe +sllkzqujfnbauuqp +auexjwsvphvikali +usuelbssqmbrkxyc +wyuokkfjexikptvv +wmfedauwjgbrgytl +sfwvtlzzebxzmuvw +rdhqxuechjsjcvaf +kpavhqkukugocsxu +ovnjtumxowbxduts +zgerpjufauptxgat +pevvnzjfwhjxdoxq +pmmfwxajgfziszcs +difmeqvaghuitjhs +icpwjbzcmlcterwm +ngqpvhajttxuegyh +mosjlqswdngwqsmi +frlvgpxrjolgodlu +eazwgrpcxjgoszeg +bbtsthgkjrpkiiyk +tjonoglufuvsvabe +xhkbcrofytmbzrtk +kqftfzdmpbxjynps +kmeqpocbnikdtfyv +qjjymgqxhnjwxxhp +dmgicrhgbngdtmjt +zdxrhdhbdutlawnc +afvoekuhdboxghvx +hiipezngkqcnihty +bbmqgheidenweeov +suprgwxgxwfsgjnx +adeagikyamgqphrj +zzifqinoeqaorjxg +adhgppljizpaxzld +lvxyieypvvuqjiyc +nljoakatwwwoovzn +fcrkfxclcacshhmx +ownnxqtdhqbgthch +lmfylrcdmdkgpwnj +hlwjfbvlswbzpbjr +mkofhdtljdetcyvp +synyxhifbetzarpo +agnggugngadrcxoc +uhttadmdmhidpyjw +ohfwjfhunalbubpr +pzkkkkwrlvxiuysn +kmidbxmyzkjrwjhu +egtitdydwjxmajnw +civoeoiuwtwgbqqs +dfptsguzfinqoslk +tdfvkreormspprer +zvnvbrmthatzztwi +ffkyddccrrfikjde +hrrmraevdnztiwff +qaeygykcpbtjwjbr +purwhitkmrtybslh +qzziznlswjaussel +dfcxkvdpqccdqqxj +tuotforulrrytgyn +gmtgfofgucjywkev +wkyoxudvdkbgpwhd +qbvktvfvipftztnn +otckgmojziezmojb +inxhvzbtgkjxflay +qvxapbiatuudseno +krpvqosbesnjntut +oqeukkgjsfuqkjbb +prcjnyymnqwqksiz +vuortvjxgckresko +orqlyobvkuwgathr +qnpyxlnazyfuijox +zwlblfkoklqmqzkw +hmwurwtpwnrcsanl +jzvxohuakopuzgpf +sfcpnxrviphhvxmx +qtwdeadudtqhbely +dbmkmloasqphnlgj +olylnjtkxgrubmtk +nxsdbqjuvwrrdbpq +wbabpirnpcsmpipw +hjnkyiuxpqrlvims +enzpntcjnxdpuqch +vvvqhlstzcizyimn +triozhqndbttglhv +fukvgteitwaagpzx +uhcvukfbmrvskpen +tizcyupztftzxdmt +vtkpnbpdzsaluczz +wodfoyhoekidxttm +otqocljrmwfqbxzu +linfbsnfvixlwykn +vxsluutrwskslnye +zbshygtwugixjvsi +zdcqwxvwytmzhvoo +wrseozkkcyctrmei +fblgtvogvkpqzxiy +opueqnuyngegbtnf +qxbovietpacqqxok +zacrdrrkohfygddn +gbnnvjqmkdupwzpq +qgrgmsxeotozvcak +hnppukzvzfmlokid +dzbheurndscrrtcl +wbgdkadtszebbrcw +fdmzppzphhpzyuiz +bukomunhrjrypohj +ohodhelegxootqbj +rsplgzarlrknqjyh +punjjwpsxnhpzgvu +djdfahypfjvpvibm +mlgrqsmhaozatsvy +xwktrgyuhqiquxgn +wvfaoolwtkbrisvf +plttjdmguxjwmeqr +zlvvbwvlhauyjykw +cigwkbyjhmepikej +masmylenrusgtyxs +hviqzufwyetyznze +nzqfuhrooswxxhus +pdbdetaqcrqzzwxf +oehmvziiqwkzhzib +icgpyrukiokmytoy +ooixfvwtiafnwkce +rvnmgqggpjopkihs +wywualssrmaqigqk +pdbvflnwfswsrirl +jeaezptokkccpbuj +mbdwjntysntsaaby +ldlgcawkzcwuxzpz +lwktbgrzswbsweht +ecspepmzarzmgpjm +qmfyvulkmkxjncai +izftypvwngiukrns +zgmnyjfeqffbooww +nyrkhggnprhedows +yykzzrjmlevgffah +mavaemfxhlfejfki +cmegmfjbkvpncqwf +zxidlodrezztcrij +fseasudpgvgnysjv +fupcimjupywzpqzp +iqhgokavirrcvyys +wjmkcareucnmfhui +nftflsqnkgjaexhq +mgklahzlcbapntgw +kfbmeavfxtppnrxn +nuhyvhknlufdynvn +nviogjxbluwrcoec +tyozixxxaqiuvoys +kgwlvmvgtsvxojpr +moeektyhyonfdhrb +kahvevmmfsmiiqex +xcywnqzcdqtvhiwd +fnievhiyltbvtvem +jlmndqufirwgtdxd +muypbfttoeelsnbs +rypxzbnujitfwkou +ubmmjbznskildeoj +ofnmizdeicrmkjxp +rekvectjbmdnfcib +yohrojuvdexbctdh +gwfnfdeibynzjmhz +jfznhfcqdwlpjull +scrinzycfhwkmmso +mskutzossrwoqqsi +rygoebkzgyzushhr +jpjqiycflqkexemx +arbufysjqmgaapnl +dbjerflevtgweeoj +snybnnjlmwjvhois +fszuzplntraprmbj +mkvaatolvuggikvg +zpuzuqygoxesnuyc +wnpxvmxvllxalulm +eivuuafkvudeouwy +rvzckdyixetfuehr +qgmnicdoqhveahyx +miawwngyymshjmpj +pvckyoncpqeqkbmx +llninfenrfjqxurv +kzbjnlgsqjfuzqtp +rveqcmxomvpjcwte +bzotkawzbopkosnx +ktqvpiribpypaymu +wvlzkivbukhnvram +uohntlcoguvjqqdo +ajlsiksjrcnzepkt +xsqatbldqcykwusd +ihbivgzrwpmowkop +vfayesfojmibkjpb +uaqbnijtrhvqxjtb +hhovshsfmvkvymba +jerwmyxrfeyvxcgg +hncafjwrlvdcupma +qyvigggxfylbbrzt +hiiixcyohmvnkpgk +mmitpwopgxuftdfu +iaxderqpceboixoa +zodfmjhuzhnsqfcb +sthtcbadrclrazsi +bkkkkcwegvypbrio +wmpcofuvzemunlhj +gqwebiifvqoeynro +juupusqdsvxcpsgv +rbhdfhthxelolyse +kjimpwnjfrqlqhhz +rcuigrjzarzpjgfq +htxcejfyzhydinks +sxucpdxhvqjxxjwf +omsznfcimbcwaxal +gufmtdlhgrsvcosb +bssshaqujtmluerz +uukotwjkstgwijtr +kbqkneobbrdogrxk +ljqopjcjmelgrakz +rwtfnvnzryujwkfb +dedjjbrndqnilbeh +nzinsxnpptzagwlb +lwqanydfirhnhkxy +hrjuzfumbvfccxno +okismsadkbseumnp +sfkmiaiwlktxqvwa +hauwpjjwowbunbjj +nowkofejwvutcnui +bqzzppwoslaeixro +urpfgufwbtzenkpj +xgeszvuqwxeykhef +yxoldvkyuikwqyeq +onbbhxrnmohzskgg +qcikuxakrqeugpoa +lnudcqbtyzhlpers +nxduvwfrgzaailgl +xniuwvxufzxjjrwz +ljwithcqmgvntjdj +awkftfagrfzywkhs +uedtpzxyubeveuek +bhcqdwidbjkqqhzl +iyneqjdmlhowwzxx +kvshzltcrrururty +zgfpiwajegwezupo +tkrvyanujjwmyyri +ercsefuihcmoaiep +ienjrxpmetinvbos +jnwfutjbgenlipzq +bgohjmrptfuamzbz +rtsyamajrhxbcncw +tfjdssnmztvbnscs +bgaychdlmchngqlp +kfjljiobynhwfkjo +owtdxzcpqleftbvn +ltjtimxwstvzwzjj +wbrvjjjajuombokf +zblpbpuaqbkvsxye +gwgdtbpnlhyqspdi +abipqjihjqfofmkx +nlqymnuvjpvvgova +avngotmhodpoufzn +qmdyivtzitnrjuae +xfwjmqtqdljuerxi +csuellnlcyqaaamq +slqyrcurcyuoxquo +dcjmxyzbzpohzprl +uqfnmjwniyqgsowb +rbmxpqoblyxdocqc +ebjclrdbqjhladem +ainnfhxnsgwqnmyo +eyytjjwhvodtzquf +iabjgmbbhilrcyyp +pqfnehkivuelyccc +xgjbyhfgmtseiimt +jwxyqhdbjiqqqeyy +gxsbrncqkmvaryln +vhjisxjkinaejytk +seexagcdmaedpcvh +lvudfgrcpjxzdpvd +fxtegyrqjzhmqean +dnoiseraqcoossmc +nwrhmwwbykvwmgep +udmzskejvizmtlce +hbzvqhvudfdlegaa +cghmlfqejbxewskv +bntcmjqfwomtbwsb +qezhowyopjdyhzng +todzsocdkgfxanbz +zgjkssrjlwxuhwbk +eibzljqsieriyrzr +wamxvzqyycrxotjp +epzvfkispwqynadu +dwlpfhtrafrxlyie +qhgzujhgdruowoug +girstvkahaemmxvh +baitcrqmxhazyhbl +xyanqcchbhkajdmc +gfvjmmcgfhvgnfdq +tdfdbslwncbnkzyz +jojuselkpmnnbcbb +hatdslkgxtqpmavj +dvelfeddvgjcyxkj +gnsofhkfepgwltse +mdngnobasfpewlno +qssnbcyjgmkyuoga +glvcmmjytmprqwvn +gwrixumjbcdffsdl +lozravlzvfqtsuiq +sicaflbqdxbmdlch +inwfjkyyqbwpmqlq +cuvszfotxywuzhzi +igfxyoaacoarlvay +ucjfhgdmnjvgvuni +rvvkzjsytqgiposh +jduinhjjntrmqroz +yparkxbgsfnueyll +lyeqqeisxzfsqzuj +woncskbibjnumydm +lltucklragtjmxtl +ubiyvmyhlesfxotj +uecjseeicldqrqww +xxlxkbcthufnjbnm +lhqijovvhlffpxga +fzdgqpzijitlogjz +efzzjqvwphomxdpd +jvgzvuyzobeazssc +hejfycgxywfjgbfw +yhjjmvkqfbnbliks +sffvfyywtlntsdsz +dwmxqudvxqdenrur +asnukgppdemxrzaz +nwqfnumblwvdpphx +kqsmkkspqvxzuket +cpnraovljzqiquaz +qrzgrdlyyzbyykhg +opoahcbiydyhsmqe +hjknnfdauidjeydr +hczdjjlygoezadow +rtflowzqycimllfv +sfsrgrerzlnychhq +bpahuvlblcolpjmj +albgnjkgmcrlaicl +pijyqdhfxpaxzdex +eeymiddvcwkpbpux +rqwkqoabywgggnln +vckbollyhgbgmgwh +ylzlgvnuvpynybkm +hpmbxtpfosbsjixt +ocebeihnhvkhjfqz +tvctyxoujdgwayze +efvhwxtuhapqxjen +rusksgefyidldmpo +nkmtjvddfmhirmzz +whvtsuadwofzmvrt +iiwjqvsdxudhdzzk +gucirgxaxgcassyo +rmhfasfzexeykwmr +hynlxcvsbgosjbis +huregszrcaocueen +pifezpoolrnbdqtv +unatnixzvdbqeyox +xtawlpduxgacchfe +bdvdbflqfphndduf +xtdsnjnmzccfptyt +nkhsdkhqtzqbphhg +aqcubmfkczlaxiyb +moziflxpsfubucmv +srdgnnjtfehiimqx +pwfalehdfyykrohf +sysxssmvewyfjrve +brsemdzosgqvvlxe +bimbjoshuvflkiat +hkgjasmljkpkwwku +sbnmwjvodygobpqc +bbbqycejueruihhd +corawswvlvneipyc +gcyhknmwsczcxedh +kppakbffdhntmcqp +ynulzwkfaemkcefp +pyroowjekeurlbii +iwksighrswdcnmxf +glokrdmugreygnsg +xkmvvumnfzckryop +aesviofpufygschi +csloawlirnegsssq +fkqdqqmlzuxbkzbc +uzlhzcfenxdfjdzp +poaaidrktteusvyf +zrlyfzmjzfvivcfr +qwjulskbniitgqtx +gjeszjksbfsuejki +vczdejdbfixbduaq +knjdrjthitjxluth +jweydeginrnicirl +bottrfgccqhyycsl +eiquffofoadmbuhk +lbqfutmzoksscswf +xfmdvnvfcnzjprba +uvugkjbkhlaoxmyx +wadlgtpczgvcaqqv +inzrszbtossflsxk +dbzbtashaartczrj +qbjiqpccefcfkvod +hluujmokjywotvzy +thwlliksfztcmwzh +arahybspdaqdexrq +nuojrmsgyipdvwyx +hnajdwjwmzattvst +sulcgaxezkprjbgu +rjowuugwdpkjtypw +oeugzwuhnrgiaqga +wvxnyymwftfoswij +pqxklzkjpcqscvde +tuymjzknntekglqj +odteewktugcwlhln +exsptotlfecmgehc +eeswfcijtvzgrqel +vjhrkiwmunuiwqau +zhlixepkeijoemne +pavfsmwesuvebzdd +jzovbklnngfdmyws +nbajyohtzfeoiixz +ciozmhrsjzrwxvhz +gwucrxieqbaqfjuv +uayrxrltnohexawc +flmrbhwsfbcquffm +gjyabmngkitawlxc +rwwtggvaygfbovhg +xquiegaisynictjq +oudzwuhexrwwdbyy +lengxmguyrwhrebb +uklxpglldbgqsjls +dbmvlfeyguydfsxq +zspdwdqcrmtmdtsc +mqfnzwbfqlauvrgc +amcrkzptgacywvhv +ndxmskrwrqysrndf +mwjyhsufeqhwisju +srlrukoaenyevykt +tnpjtpwawrxbikct +geczalxmgxejulcv +tvkcbqdhmuwcxqci +tiovluvwezwwgaox +zrjhtbgajkjqzmfo +vcrywduwsklepirs +lofequdigsszuioy +wxsdzomkjqymlzat +iabaczqtrfbmypuy +ibdlmudbajikcncr +rqcvkzsbwmavdwnv +ypxoyjelhllhbeog +fdnszbkezyjbttbg +uxnhrldastpdjkdz +xfrjbehtxnlyzcka +omjyfhbibqwgcpbv +eguucnoxaoprszmp +xfpypldgcmcllyzz +aypnmgqjxjqceelv +mgzharymejlafvgf +tzowgwsubbaigdok +ilsehjqpcjwmylxc +pfmouwntfhfnmrwk +csgokybgdqwnduwp +eaxwvxvvwbrovypz +nmluqvobbbmdiwwb +lnkminvfjjzqbmio +mjiiqzycqdhfietz +towlrzriicyraevq +obiloewdvbrsfwjo +lmeooaajlthsfltw +ichygipzpykkesrw +gfysloxmqdsfskvt +saqzntehjldvwtsx +pqddoemaufpfcaew +mjrxvbvwcreaybwe +ngfbrwfqnxqosoai +nesyewxreiqvhald +kqhqdlquywotcyfy +liliptyoqujensfi +nsahsaxvaepzneqq +zaickulfjajhctye +gxjzahtgbgbabtht +koxbuopaqhlsyhrp +jhzejdjidqqtjnwe +dekrkdvprfqpcqki +linwlombdqtdeyop +dvckqqbnigdcmwmx +yaxygbjpzkvnnebv +rlzkdkgaagmcpxah +cfzuyxivtknirqvt +obivkajhsjnrxxhn +lmjhayymgpseuynn +bbjyewkwadaipyju +lmzyhwomfypoftuu +gtzhqlgltvatxack +jfflcfaqqkrrltgq +txoummmnzfrlrmcg +ohemsbfuqqpucups +imsfvowcbieotlok +tcnsnccdszxfcyde +qkcdtkwuaquajazz +arcfnhmdjezdbqku +srnocgyqrlcvlhkb +mppbzvfmcdirbyfw +xiuarktilpldwgwd +ypufwmhrvzqmexpc +itpdnsfkwgrdujmj +cmpxnodtsswkyxkr +wayyxtjklfrmvbfp +mfaxphcnjczhbbwy +sjxhgwdnqcofbdra +pnxmujuylqccjvjm +ivamtjbvairwjqwl +deijtmzgpfxrclss +bzkqcaqagsynlaer +tycefobvxcvwaulz +ctbhnywezxkdsswf +urrxxebxrthtjvib +fpfelcigwqwdjucv +ngfcyyqpqulwcphb +rltkzsiipkpzlgpw +qfdsymzwhqqdkykc +balrhhxipoqzmihj +rnwalxgigswxomga +ghqnxeogckshphgr +lyyaentdizaumnla +exriodwfzosbeoib +speswfggibijfejk +yxmxgfhvmshqszrq +hcqhngvahzgawjga +qmhlsrfpesmeksur +eviafjejygakodla +kvcfeiqhynqadbzv +fusvyhowslfzqttg +girqmvwmcvntrwau +yuavizroykfkdekz +jmcwohvmzvowrhxf +kzimlcpavapynfue +wjudcdtrewfabppq +yqpteuxqgbmqfgxh +xdgiszbuhdognniu +jsguxfwhpftlcjoh +whakkvspssgjzxre +ggvnvjurlyhhijgm +krvbhjybnpemeptr +pqedgfojyjybfbzr +jzhcrsgmnkwwtpdo +yyscxoxwofslncmp +gzjhnxytmyntzths +iteigbnqbtpvqumi +zjevfzusnjukqpfw +xippcyhkfuounxqk +mcnhrcfonfdgpkyh +pinkcyuhjkexbmzj +lotxrswlxbxlxufs +fmqajrtoabpckbnu +wfkwsgmcffdgaqxg +qfrsiwnohoyfbidr +czfqbsbmiuyusaqs +ieknnjeecucghpoo +cevdgqnugupvmsge +gjkajcyjnxdrtuvr +udzhrargnujxiclq +zqqrhhmjwermjssg +ggdivtmgoqajydzz +wnpfsgtxowkjiivl +afbhqawjbotxnqpd +xjpkifkhfjeqifdn +oyfggzsstfhvticp +kercaetahymeawxy +khphblhcgmbupmzt +iggoqtqpvaebtiol +ofknifysuasshoya +qxuewroccsbogrbv +apsbnbkiopopytgu +zyahfroovfjlythh +bxhjwfgeuxlviydq +uvbhdtvaypasaswa +qamcjzrmesqgqdiz +hjnjyzrxntiycyel +wkcrwqwniczwdxgq +hibxlvkqakusswkx +mzjyuenepwdgrkty +tvywsoqslfsulses +jqwcwuuisrclircv +xanwaoebfrzhurct +ykriratovsvxxasf +qyebvtqqxbjuuwuo +telrvlwvriylnder +acksrrptgnhkeiaa +yemwfjhiqlzsvdxf +banrornfkcymmkcc +ytbhxvaeiigjpcgm +crepyazgxquposkn +xlqwdrytzwnxzwzv +xtrbfbwopxscftps +kwbytzukgseeyjla +qtfdvavvjogybxjg +ytbmvmrcxwfkgvzw +nbscbdskdeocnfzr +sqquwjbdxsxhcseg +ewqxhigqcgszfsuw +cvkyfcyfmubzwsee +dcoawetekigxgygd +ohgqnqhfimyuqhvi +otisopzzpvnhctte +bauieohjejamzien +ewnnopzkujbvhwce +aeyqlskpaehagdiv +pncudvivwnnqspxy +ytugesilgveokxcg +zoidxeelqdjesxpr +ducjccsuaygfchzj +smhgllqqqcjfubfc +nlbyyywergronmir +prdawpbjhrzsbsvj +nmgzhnjhlpcplmui +eflaogtjghdjmxxz +qolvpngucbkprrdc +ixywxcienveltgho +mwnpqtocagenkxut +iskrfbwxonkguywx +ouhtbvcaczqzmpua +srewprgddfgmdbao +dyufrltacelchlvu +czmzcbrkecixuwzz +dtbeojcztzauofuk +prrgoehpqhngfgmw +baolzvfrrevxsyke +zqadgxshwiarkzwh +vsackherluvurqqj +surbpxdulvcvgjbd +wqxytarcxzgxhvtx +vbcubqvejcfsgrac +zqnjfeapshjowzja +hekvbhtainkvbynx +knnugxoktxpvoxnh +knoaalcefpgtvlwm +qoakaunowmsuvkus +ypkvlzcduzlezqcb +ujhcagawtyepyogh +wsilcrxncnffaxjf +gbbycjuscquaycrk +aduojapeaqwivnly +ceafyxrakviagcjy +nntajnghicgnrlst +vdodpeherjmmvbje +wyyhrnegblwvdobn +xlfurpghkpbzhhif +xyppnjiljvirmqjo +kglzqahipnddanpi +omjateouxikwxowr +ocifnoopfglmndcx +emudcukfbadyijev +ooktviixetfddfmh +wtvrhloyjewdeycg +cgjncqykgutfjhvb +nkwvpswppeffmwad +hqbcmfhzkxmnrivg +mdskbvzguxvieilr +anjcvqpavhdloaqh +erksespdevjylenq +fadxwbmisazyegup +iyuiffjmcaahowhj +ygkdezmynmltodbv +fytneukxqkjattvh +woerxfadbfrvdcnz +iwsljvkyfastccoa +movylhjranlorofe +drdmicdaiwukemep +knfgtsmuhfcvvshg +ibstpbevqmdlhajn +tstwsswswrxlzrqs +estyydmzothggudf +jezogwvymvikszwa +izmqcwdyggibliet +nzpxbegurwnwrnca +kzkojelnvkwfublh +xqcssgozuxfqtiwi +tcdoigumjrgvczfv +ikcjyubjmylkwlwq +kqfivwystpqzvhan +bzukgvyoqewniivj +iduapzclhhyfladn +fbpyzxdfmkrtfaeg +yzsmlbnftftgwadz diff --git a/2015/05/puzzle-1.sed b/2015/05/puzzle-1.sed new file mode 100644 index 0000000..9cba7ad --- /dev/null +++ b/2015/05/puzzle-1.sed @@ -0,0 +1,3 @@ +/ab\|cd\|pq\|xy/d +/\(.\)\1/!d +/\(.*[aeiou].*\)\{3\}/p diff --git a/2015/05/puzzle-2.sed b/2015/05/puzzle-2.sed new file mode 100644 index 0000000..908afdf --- /dev/null +++ b/2015/05/puzzle-2.sed @@ -0,0 +1,2 @@ +/\(.\).\1/!d +/\(..\).*\1/p diff --git a/2015/05/puzzles.sh b/2015/05/puzzles.sh new file mode 100755 index 0000000..57ddb11 --- /dev/null +++ b/2015/05/puzzles.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +# Could do this with just grep(1) and skip using wc(1), but I am lazy + +sed -nf puzzle-1.sed input | wc -l +sed -nf puzzle-2.sed input | wc -l diff --git a/2015/06/input b/2015/06/input new file mode 100644 index 0000000..495311e --- /dev/null +++ b/2015/06/input @@ -0,0 +1,300 @@ +turn off 660,55 through 986,197 +turn off 341,304 through 638,850 +turn off 199,133 through 461,193 +toggle 322,558 through 977,958 +toggle 537,781 through 687,941 +turn on 226,196 through 599,390 +turn on 240,129 through 703,297 +turn on 317,329 through 451,798 +turn on 957,736 through 977,890 +turn on 263,530 through 559,664 +turn on 158,270 through 243,802 +toggle 223,39 through 454,511 +toggle 544,218 through 979,872 +turn on 313,306 through 363,621 +toggle 173,401 through 496,407 +toggle 333,60 through 748,159 +turn off 87,577 through 484,608 +turn on 809,648 through 826,999 +toggle 352,432 through 628,550 +turn off 197,408 through 579,569 +turn off 1,629 through 802,633 +turn off 61,44 through 567,111 +toggle 880,25 through 903,973 +turn on 347,123 through 864,746 +toggle 728,877 through 996,975 +turn on 121,895 through 349,906 +turn on 888,547 through 931,628 +toggle 398,782 through 834,882 +turn on 966,850 through 989,953 +turn off 891,543 through 914,991 +toggle 908,77 through 916,117 +turn on 576,900 through 943,934 +turn off 580,170 through 963,206 +turn on 184,638 through 192,944 +toggle 940,147 through 978,730 +turn off 854,56 through 965,591 +toggle 717,172 through 947,995 +toggle 426,987 through 705,998 +turn on 987,157 through 992,278 +toggle 995,774 through 997,784 +turn off 796,96 through 845,182 +turn off 451,87 through 711,655 +turn off 380,93 through 968,676 +turn on 263,468 through 343,534 +turn on 917,936 through 928,959 +toggle 478,7 through 573,148 +turn off 428,339 through 603,624 +turn off 400,880 through 914,953 +toggle 679,428 through 752,779 +turn off 697,981 through 709,986 +toggle 482,566 through 505,725 +turn off 956,368 through 993,516 +toggle 735,823 through 783,883 +turn off 48,487 through 892,496 +turn off 116,680 through 564,819 +turn on 633,865 through 729,930 +turn off 314,618 through 571,922 +toggle 138,166 through 936,266 +turn on 444,732 through 664,960 +turn off 109,337 through 972,497 +turn off 51,432 through 77,996 +turn off 259,297 through 366,744 +toggle 801,130 through 917,544 +toggle 767,982 through 847,996 +turn on 216,507 through 863,885 +turn off 61,441 through 465,731 +turn on 849,970 through 944,987 +toggle 845,76 through 852,951 +toggle 732,615 through 851,936 +toggle 251,128 through 454,778 +turn on 324,429 through 352,539 +toggle 52,450 through 932,863 +turn off 449,379 through 789,490 +turn on 317,319 through 936,449 +toggle 887,670 through 957,838 +toggle 671,613 through 856,664 +turn off 186,648 through 985,991 +turn off 471,689 through 731,717 +toggle 91,331 through 750,758 +toggle 201,73 through 956,524 +toggle 82,614 through 520,686 +toggle 84,287 through 467,734 +turn off 132,367 through 208,838 +toggle 558,684 through 663,920 +turn on 237,952 through 265,997 +turn on 694,713 through 714,754 +turn on 632,523 through 862,827 +turn on 918,780 through 948,916 +turn on 349,586 through 663,976 +toggle 231,29 through 257,589 +toggle 886,428 through 902,993 +turn on 106,353 through 236,374 +turn on 734,577 through 759,684 +turn off 347,843 through 696,912 +turn on 286,699 through 964,883 +turn on 605,875 through 960,987 +turn off 328,286 through 869,461 +turn off 472,569 through 980,848 +toggle 673,573 through 702,884 +turn off 398,284 through 738,332 +turn on 158,50 through 284,411 +turn off 390,284 through 585,663 +turn on 156,579 through 646,581 +turn on 875,493 through 989,980 +toggle 486,391 through 924,539 +turn on 236,722 through 272,964 +toggle 228,282 through 470,581 +toggle 584,389 through 750,761 +turn off 899,516 through 900,925 +turn on 105,229 through 822,846 +turn off 253,77 through 371,877 +turn on 826,987 through 906,992 +turn off 13,152 through 615,931 +turn on 835,320 through 942,399 +turn on 463,504 through 536,720 +toggle 746,942 through 786,998 +turn off 867,333 through 965,403 +turn on 591,477 through 743,692 +turn off 403,437 through 508,908 +turn on 26,723 through 368,814 +turn on 409,485 through 799,809 +turn on 115,630 through 704,705 +turn off 228,183 through 317,220 +toggle 300,649 through 382,842 +turn off 495,365 through 745,562 +turn on 698,346 through 744,873 +turn on 822,932 through 951,934 +toggle 805,30 through 925,421 +toggle 441,152 through 653,274 +toggle 160,81 through 257,587 +turn off 350,781 through 532,917 +toggle 40,583 through 348,636 +turn on 280,306 through 483,395 +toggle 392,936 through 880,955 +toggle 496,591 through 851,934 +turn off 780,887 through 946,994 +turn off 205,735 through 281,863 +toggle 100,876 through 937,915 +turn on 392,393 through 702,878 +turn on 956,374 through 976,636 +toggle 478,262 through 894,775 +turn off 279,65 through 451,677 +turn on 397,541 through 809,847 +turn on 444,291 through 451,586 +toggle 721,408 through 861,598 +turn on 275,365 through 609,382 +turn on 736,24 through 839,72 +turn off 86,492 through 582,712 +turn on 676,676 through 709,703 +turn off 105,710 through 374,817 +toggle 328,748 through 845,757 +toggle 335,79 through 394,326 +toggle 193,157 through 633,885 +turn on 227,48 through 769,743 +toggle 148,333 through 614,568 +toggle 22,30 through 436,263 +toggle 547,447 through 688,969 +toggle 576,621 through 987,740 +turn on 711,334 through 799,515 +turn on 541,448 through 654,951 +toggle 792,199 through 798,990 +turn on 89,956 through 609,960 +toggle 724,433 through 929,630 +toggle 144,895 through 201,916 +toggle 226,730 through 632,871 +turn off 760,819 through 828,974 +toggle 887,180 through 940,310 +toggle 222,327 through 805,590 +turn off 630,824 through 885,963 +turn on 940,740 through 954,946 +turn on 193,373 through 779,515 +toggle 304,955 through 469,975 +turn off 405,480 through 546,960 +turn on 662,123 through 690,669 +turn off 615,238 through 750,714 +turn on 423,220 through 930,353 +turn on 329,769 through 358,970 +toggle 590,151 through 704,722 +turn off 884,539 through 894,671 +toggle 449,241 through 984,549 +toggle 449,260 through 496,464 +turn off 306,448 through 602,924 +turn on 286,805 through 555,901 +toggle 722,177 through 922,298 +toggle 491,554 through 723,753 +turn on 80,849 through 174,996 +turn off 296,561 through 530,856 +toggle 653,10 through 972,284 +toggle 529,236 through 672,614 +toggle 791,598 through 989,695 +turn on 19,45 through 575,757 +toggle 111,55 through 880,871 +turn off 197,897 through 943,982 +turn on 912,336 through 977,605 +toggle 101,221 through 537,450 +turn on 101,104 through 969,447 +toggle 71,527 through 587,717 +toggle 336,445 through 593,889 +toggle 214,179 through 575,699 +turn on 86,313 through 96,674 +toggle 566,427 through 906,888 +turn off 641,597 through 850,845 +turn on 606,524 through 883,704 +turn on 835,775 through 867,887 +toggle 547,301 through 897,515 +toggle 289,930 through 413,979 +turn on 361,122 through 457,226 +turn on 162,187 through 374,746 +turn on 348,461 through 454,675 +turn off 966,532 through 985,537 +turn on 172,354 through 630,606 +turn off 501,880 through 680,993 +turn off 8,70 through 566,592 +toggle 433,73 through 690,651 +toggle 840,798 through 902,971 +toggle 822,204 through 893,760 +turn off 453,496 through 649,795 +turn off 969,549 through 990,942 +turn off 789,28 through 930,267 +toggle 880,98 through 932,434 +toggle 568,674 through 669,753 +turn on 686,228 through 903,271 +turn on 263,995 through 478,999 +toggle 534,675 through 687,955 +turn off 342,434 through 592,986 +toggle 404,768 through 677,867 +toggle 126,723 through 978,987 +toggle 749,675 through 978,959 +turn off 445,330 through 446,885 +turn off 463,205 through 924,815 +turn off 417,430 through 915,472 +turn on 544,990 through 912,999 +turn off 201,255 through 834,789 +turn off 261,142 through 537,862 +turn off 562,934 through 832,984 +turn off 459,978 through 691,980 +turn off 73,911 through 971,972 +turn on 560,448 through 723,810 +turn on 204,630 through 217,854 +turn off 91,259 through 611,607 +turn on 877,32 through 978,815 +turn off 950,438 through 974,746 +toggle 426,30 through 609,917 +toggle 696,37 through 859,201 +toggle 242,417 through 682,572 +turn off 388,401 through 979,528 +turn off 79,345 through 848,685 +turn off 98,91 through 800,434 +toggle 650,700 through 972,843 +turn off 530,450 through 538,926 +turn on 428,559 through 962,909 +turn on 78,138 through 92,940 +toggle 194,117 through 867,157 +toggle 785,355 through 860,617 +turn off 379,441 through 935,708 +turn off 605,133 through 644,911 +toggle 10,963 through 484,975 +turn off 359,988 through 525,991 +turn off 509,138 through 787,411 +toggle 556,467 through 562,773 +turn on 119,486 through 246,900 +turn on 445,561 through 794,673 +turn off 598,681 through 978,921 +turn off 974,230 through 995,641 +turn off 760,75 through 800,275 +toggle 441,215 through 528,680 +turn off 701,636 through 928,877 +turn on 165,753 through 202,780 +toggle 501,412 through 998,516 +toggle 161,105 through 657,395 +turn on 113,340 through 472,972 +toggle 384,994 through 663,999 +turn on 969,994 through 983,997 +turn on 519,600 through 750,615 +turn off 363,899 through 948,935 +turn on 271,845 through 454,882 +turn off 376,528 through 779,640 +toggle 767,98 through 854,853 +toggle 107,322 through 378,688 +turn off 235,899 through 818,932 +turn on 445,611 through 532,705 +toggle 629,387 through 814,577 +toggle 112,414 through 387,421 +toggle 319,184 through 382,203 +turn on 627,796 through 973,940 +toggle 602,45 through 763,151 +turn off 441,375 through 974,545 +toggle 871,952 through 989,998 +turn on 717,272 through 850,817 +toggle 475,711 through 921,882 +toggle 66,191 through 757,481 +turn off 50,197 through 733,656 +toggle 83,575 through 915,728 +turn on 777,812 through 837,912 +turn on 20,984 through 571,994 +turn off 446,432 through 458,648 +turn on 715,871 through 722,890 +toggle 424,675 through 740,862 +toggle 580,592 through 671,900 +toggle 296,687 through 906,775 diff --git a/2015/06/puzzle-1.awk b/2015/06/puzzle-1.awk new file mode 100755 index 0000000..97165cf --- /dev/null +++ b/2015/06/puzzle-1.awk @@ -0,0 +1,15 @@ +#!/usr/bin/env -S awk -f + +function setlights(val, toggle) +{ + for (i = from[1]; i <= to[1]; i++) { + for (j = from[2]; j <= to[2]; j++) + lights[i][j] = toggle ? (lights[i][j] ? 0 : 1) : val + } +} + +$1 == "toggle" { split($2, from, ","); split($4, to, ","); setlights(0, 1) } +$2 ~ /on|off/ { split($3, from, ","); split($5, to, ",") } +$2 == "on" { setlights(1, 0) } +$2 == "off" { setlights(0, 0) } +END { for (i = 0; i <= 999; i++) for (j = 0; j <= 999; j++) count += lights[i][j]; print count } diff --git a/2015/06/puzzle-2.awk b/2015/06/puzzle-2.awk new file mode 100755 index 0000000..97ae1f8 --- /dev/null +++ b/2015/06/puzzle-2.awk @@ -0,0 +1,17 @@ +#!/usr/bin/env -S awk -f + +function setlights(val) +{ + for (i = from[1]; i <= to[1]; i++) { + for (j = from[2]; j <= to[2]; j++) { + if (!(val == -1 && lights[i][j] == 0)) + lights[i][j] += val + } + } +} + +$1 == "toggle" { split($2, from, ","); split($4, to, ","); setlights(2) } +$2 ~ /on|off/ { split($3, from, ","); split($5, to, ",") } +$2 == "on" { setlights(1) } +$2 == "off" { setlights(-1) } +END { for (i = 0; i <= 999; i++) for (j = 0; j <= 999; j++) count += lights[i][j]; print count } diff --git a/2015/08/input b/2015/08/input new file mode 100644 index 0000000..94538e7 --- /dev/null +++ b/2015/08/input @@ -0,0 +1,300 @@ +"qxfcsmh" +"ffsfyxbyuhqkpwatkjgudo" +"byc\x9dyxuafof\\\xa6uf\\axfozomj\\olh\x6a" +"jtqvz" +"uzezxa\"jgbmojtwyfbfguz" +"vqsremfk\x8fxiknektafj" +"wzntebpxnnt\"vqndz\"i\x47vvjqo\"" +"higvez\"k\"riewqk" +"dlkrbhbrlfrp\\damiauyucwhty" +"d\"" +"qlz" +"ku" +"yy\"\"uoao\"uripabop" +"saduyrntuswlnlkuppdro\\sicxosted" +"tj" +"zzphopswlwdhebwkxeurvizdv" +"xfoheirjoakrpofles\"nfu" +"q\xb7oh\"p\xce\"n" +"qeendp\"ercwgywdjeylxcv" +"dcmem" +"\"i\x13r\"l" +"ikso\xdcbvqnbrjduh\"uqudzki\xderwk" +"wfdsn" +"pwynglklryhtsqbno" +"hcoj\x63iccz\"v\"ttr" +"zf\x23\\hlj\\kkce\\d\\asy\"yyfestwcdxyfj" +"xs" +"m\"tvltapxdvtrxiy" +"bmud" +"k\"a" +"b\"oas" +"\"yexnjjupoqsxyqnquy\"uzfdvetqrc" +"vdw\xe3olxfgujaj" +"qomcxdnd\"\\cfoe\"" +"fpul" +"m\"avamefphkpv" +"vvdnb\\x\\uhnxfw\"dpubfkxfmeuhnxisd" +"hey\\" +"ldaeigghlfey" +"eure\"hoy\xa5iezjp\\tm" +"yygb\"twbj\\r\"\x10gmxuhmp\"" +"weirebp\x39mqonbtmfmd" +"ltuz\\hs\"e" +"ysvmpc" +"g\x8amjtt\"megl\"omsaihifwa" +"yimmm" +"iiyqfalh" +"cwknlaaf" +"q\x37feg\xc6s\"xx" +"uayrgeurgyp\\oi" +"xhug\"pt\"axugllbdiggzhvy" +"kdaarqmsjfx\xc3d" +"\"vkwla" +"d\"" +"tmroz\"bvfinxoe\\mum\"wmm" +"\"n\"bbswxne\\p\\yr\"qhwpdd" +"skzlkietklkqovjhvj\xfe" +"pbg\\pab\"bubqaf\"obzcwxwywbs\\dhtq" +"xxjidvqh\"lx\\wu\"ij" +"daef\x5fe\x5b\\kbeeb\x13qnydtboof" +"ogvazaqy\"j\x73" +"y" +"n\"tibetedldy\\gsamm\"nwu" +"wldkvgdtqulwkad" +"dpmxnj" +"twybw\"cdvf\"mjdajurokbce" +"ru\"\\lasij\"i" +"roc\\vra\\lhrm" +"pbkt\x60booz\"fjlkc" +"j\x4dytvjwrzt" +"\\uiwjkniumxcs" +"cbhm\"nexccior\"v\"j\"nazxilmfp\x47" +"qdxngevzrlgoq" +"\"lrzxftytpobsdfyrtdqpjbpuwmm\x9e" +"mdag\x0asnck\xc2ggj\"slb\"fjy" +"wyqkhjuazdtcgkcxvjkpnjdae" +"aixfk\xc0iom\x21vueob" +"dkiiakyjpkffqlluhaetires" +"ysspv\"lysgkvnmwbbsy" +"gy\"ryexcjjxdm\"xswssgtr" +"s" +"ddxv" +"qwt\"\x27puilb\"pslmbrsxhrz" +"qdg\xc9e\\qwtknlvkol\x54oqvmchn\\" +"lvo" +"b" +"fk\"aa\"\"yenwch\\\\on" +"srig\x63hpwaavs\\\x80qzk\"xa\"\xe6u\\wr" +"yxjxuj\"ghyhhxfj\"\xa6qvatre" +"yoktqxjxkzrklkoeroil" +"\"jfmik\"" +"smgseztzdwldikbqrh\"" +"jftahgctf\"hoqy" +"tcnhicr\"znpgckt\"ble" +"vqktnkodh\"lo\"a\\bkmdjqqnsqr" +"ztnirfzqq" +"s" +"xx" +"iqj\"y\\hqgzflwrdsusasekyrxbp\\ad" +"\\xzjhlaiynkioz\"\"bxepzimvgwt" +"s\x36rbw" +"mniieztwrisvdx" +"atyfxioy\x2b\\" +"irde\x85\x5cvbah\\jekw\"ia" +"bdmftlhkwrprmpat\"prfaocvp" +"w\\k" +"umbpausy" +"zfauhpsangy" +"p\"zqyw" +"wtztypyqvnnxzvlvipnq\"zu" +"deicgwq\\oqvajpbov\\or\"kgplwu" +"mbzlfgpi\\\\zqcidjpzqdzxityxa" +"lfkxvhma" +"\xf2yduqzqr\"\\fak\"p\"n" +"mpajacfuxotonpadvng" +"anb\\telzvcdu\\a\xf2flfq" +"lrs\"ebethwpmuuc\"\x86ygr" +"qmvdbhtumzc\"ci" +"meet" +"yopg\x0fdxdq\"h\\ugsu\xffmolxjv" +"uhy" +"fzgidrtzycsireghazscvmwcfmw\\t" +"cqohkhpgvpru" +"bihyigtnvmevx\"xx" +"xz" +"zofomwotzuxsjk\"q\"mc\"js\"dnmalhxd" +"\\ktnddux\\fqvt\"ibnjntjcbn" +"ia" +"htjadnefwetyp\xd5kbrwfycbyy" +"\"\\hkuxqddnao" +"meqqsz\x83luecpgaem" +"cvks\x87frvxo\"svqivqsdpgwhukmju" +"sgmxiai\\o\"riufxwjfigr\xdf" +"fgywdfecqufccpcdn" +"faghjoq\x28abxnpxj" +"zuppgzcfb\"dctvp\"elup\"zxkopx" +"xqs\x45xxdqcihbwghmzoa" +"anbnlp\\cgcvm\"hc" +"xf\"fgrngwzys" +"nrxsjduedcy\x24" +"\x71sxl\"gj\"sds\"ulcruguz\\t\\ssvjcwhi" +"jhj\"msch" +"qpovolktfwyiuyicbfeeju\x01" +"nkyxmb\"qyqultgt\"nmvzvvnxnb" +"ycsrkbstgzqb\"uv\\cisn" +"s" +"ueptjnn\"\"sh" +"lp\"z\"d\"mxtxiy" +"yzjtvockdnvbubqabjourf\"k\"uoxwle" +"\x82\"wqm\"" +"\xb5cwtuks\x5fpgh" +"wd" +"tbvf" +"ttbmzdgn" +"vfpiyfdejyrlbgcdtwzbnm" +"uc" +"otdcmhpjagqix" +"\\\xb1qso\"s" +"scowax" +"behpstjdh\xccqlgnqjyz\"eesn" +"r\xe1cbnjwzveoomkzlo\\kxlfouhm" +"jgrl" +"kzqs\\r" +"ctscb\x7fthwkdyko\"\x62pkf\"d\xe6knmhurg" +"tc\"kw\x3ftt" +"bxb\x5ccl" +"jyrmfbphsldwpq" +"jylpvysl\"\"juducjg" +"en\\m\"kxpq\"wpb\\\"" +"madouht\"bmdwvnyqvpnawiphgac\"" +"vuxpk\"ltucrw" +"aae\x60arr" +"ttitnne\"kilkrgssnr\xfdurzh" +"oalw" +"pc\"\"gktkdykzbdpkwigucqni\"nxiqx" +"dbrsaj" +"bgzsowyxcbrvhtvekhsh\"qgd" +"kudfemvk\"\"\"hkbrbil\"chkqoa" +"zjzgj\\ekbhyfzufy" +"\\acos\"fqekuxqzxbmkbnn\x1ejzwrm" +"elxahvudn\"txtmomotgw" +"\x2eoxmwdhelpr\"cgi\xf7pzvb" +"eapheklx" +"hfvma\"mietvc\"tszbbm\"czex" +"h\"iiockj\\\xc1et" +"d\"rmjjftm" +"qlvhdcbqtyrhlc\\" +"yy\"rsucjtulm\"coryri\"eqjlbmk" +"tv" +"r\"bfuht\\jjgujp\"" +"kukxvuauamtdosngdjlkauylttaokaj" +"srgost\"\"rbkcqtlccu\x65ohjptstrjkzy" +"yxwxl\\yjilwwxffrjjuazmzjs" +"dxlw\\fkstu\"hjrtiafhyuoh\"sewabne" +"\x88sj\"v" +"rfzprz\xec\"oxqclu\"krzefp\\q" +"cfmhdbjuhrcymgxpylllyvpni" +"ucrmjvmimmcq\x88\xd9\"lz" +"lujtt\"" +"gvbqoixn\"pmledpjmo\"flydnwkfxllf" +"dvxqlbshhmelsk\x8big\"l" +"mx\x54lma\x8bbguxejg" +"\x66jdati\xeceieo" +"\"iyyupixei\x54ff" +"xohzf\"rbxsoksxamiu" +"vlhthspeshzbppa\x4drhqnohjop\"\"mfjd" +"f\"tvxxla\"vurian\"\"idjq\x3aptm\xc3olep" +"gzqz" +"kbq\\wogye\\altvi\\hbvmodny" +"j\xd8" +"ofjozdhkblvndl" +"hbitoupimbawimxlxqze" +"ypeleimnme" +"xfwdrzsc\\oxqamawyizvi\\y" +"enoikppx\xa1ixe\"yo\"gumye" +"fb" +"vzf" +"zxidr" +"cu\x31beirsywtskq" +"lxpjbvqzztafwezd" +"\\jyxeuo\x18bv" +"b\"vawc\"p\\\\giern\"b" +"odizunx\"\"t\\yicdn\"x\"sdiz" +"\"\"tebrtsi" +"ctyzsxv\xa6pegfkwsi\"tgyltaakytccb" +"htxwbofchvmzbppycccliyik\xe5a" +"ggsslefamsklezqkrd" +"rcep\"fnimwvvdx\"l" +"zyrzlqmd\x12egvqs\\llqyie" +"\x07gsqyrr\\rcyhyspsvn" +"butg\"" +"gb" +"gywkoxf\"jsg\\wtopxvumirqxlwz" +"rj\"ir\"wldwveair\x2es\"dhjrdehbqnzl" +"ru\"elktnsbxufk\\ejufjfjlevt\\lrzd" +"\"widsvok" +"oy\"\x81nuesvw" +"ay" +"syticfac\x1cfjsivwlmy\"pumsqlqqzx" +"m" +"rjjkfh\x78cf\x2brgceg\"jmdyas\"\\xlv\xb6p" +"tmuvo\"\x3ffdqdovjmdmkgpstotojkv\"as" +"jd\\ojvynhxllfzzxvbn\"wrpphcvx" +"pz" +"\"twr" +"n\\hdzmxe\"mzjjeadlz" +"fb\"rprxuagvahjnri" +"rfmexmjjgh\\xrnmyvnatrvfruflaqjnd" +"obbbde\"co\"qr\"qpiwjgqahqm\\jjp\"" +"vpbq\"\"y\"czk\\b\x52ed\"lnzepobp" +"syzeajzfarplydipny\"y\"\xe8ad" +"mpyodwb" +"\x47rakphlqqptd" +"wa\"oj\"aiy" +"a" +"ropozx" +"q\x51nbtlwa" +"etukvgx\\jqxlkq" +"\"tp\"rah\"pg\"s\"bpdtes\\tkasdhqd" +"dn\"qqpkikadowssb\xcah\"dzpsf\\ect\"jdh" +"pxunovbbrrn\\vullyn\"bno\"\"\"myfxlp\"" +"qaixyazuryvkmoulhcqaotegfj\\mpzm" +"bvfrbicutzbjwn\\oml\"cf\"d\"ezcpv\"j" +"rmbrdtneudemigdhelmb" +"aq\\aurmbhy" +"wujqvzw" +"gf\"tssmvm\"gm\"hu\x9a\xb7yjawsa" +"hrhqqxow\xe2gsydtdspcfqy\"zw\\ou" +"ianwwf\\yko\\tdujhhqdi" +"xylz\"zpvpab" +"lwuopbeeegp" +"aoop\x49jhhcexdmdtun" +"\\\\mouqqcsgmz" +"tltuvwhveau\x43b\"ymxjlcgiymcynwt" +"gsugerumpyuhtjljbhrdyoj" +"lnjm\xb8wg\"ajh" +"zmspue\"nfttdon\\b\"eww" +"\"w\x67jwaq\x7ernmyvs\\rmdsuwydsd\"th" +"ogtgvtlmcvgllyv" +"z\"fqi\"rvddoehrciyl" +"yustxxtot\"muec\"xvfdbzunzvveq" +"mqslw" +"txqnyvzmibqgjs\xb6xy\x86nfalfyx" +"kzhehlmkholov" +"plpmywcnirrjutjguosh\\" +"pydbnqofv\"dn\\m" +"aegqof" +"eambmxt\\dxagoogl\\zapfwwlmk" +"afbmqitxxqhddlozuxcpjxgh" +"vgts" +"bfdpqtoxzzhmzcilehnflna" +"s\"idpz" +"\xcfhgly\"nlmztwybx\"ecezmsxaqw" +"aackfgndqcqiy" +"\x22unqdlsrvgzfaohoffgxzfpir\"s" +"abh\"ydv\"kbpdhrerl" +"bdzpg" +"ekwgkywtmzp" +"wtoodejqmrrgslhvnk\"pi\"ldnogpth" +"njro\x68qgbx\xe4af\"\\suan" diff --git a/2015/08/puzzle-1.sh b/2015/08/puzzle-1.sh new file mode 100755 index 0000000..ee35d69 --- /dev/null +++ b/2015/08/puzzle-1.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +X=$(tr -d '\n' <input | wc -c) +Y=$(sed 's/\(^"\|"$\)//g; s/\\x[a-f0-9]\{2\}/./g; s/\\[\\"]/./g' input \ + | tr -d '\n' \ + | wc -c) +expr $X - $Y diff --git a/2015/08/puzzle-2.sh b/2015/08/puzzle-2.sh new file mode 100755 index 0000000..a00f13f --- /dev/null +++ b/2015/08/puzzle-2.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +X=$(sed 's/\("\|\\\)/\\&/g; s/^/../' input \ + | tr -d '\n' \ + | wc -c) +Y=$(tr -d '\n' <input | wc -c) +expr $X - $Y diff --git a/2015/10/.gitignore b/2015/10/.gitignore new file mode 100644 index 0000000..3971a19 --- /dev/null +++ b/2015/10/.gitignore @@ -0,0 +1,2 @@ +puzzle-[12] +tmp[12].go diff --git a/2015/10/Makefile b/2015/10/Makefile new file mode 100644 index 0000000..8d258e1 --- /dev/null +++ b/2015/10/Makefile @@ -0,0 +1,12 @@ +all: + m4 -D INPUT=\"$$(cat input)\" -D LOOPS=40 -U len puzzles.go >tmp1.go + m4 -D INPUT=\"$$(cat input)\" -D LOOPS=50 -U len puzzles.go >tmp2.go + go build tmp1.go + go build tmp2.go + mv tmp1 puzzle-1 + mv tmp2 puzzle-2 + rm tmp[12].go + +.PHONY: clean +clean: + rm -f puzzle-[12] tmp[12].go diff --git a/2015/10/README b/2015/10/README new file mode 100644 index 0000000..1102d82 --- /dev/null +++ b/2015/10/README @@ -0,0 +1,10 @@ +====== + NOTE +====== + +I did not come up with the shell script solution myself, that is why I also included the very slow +Go solution. The shell script solution comes from this Reddit post: + + https://www.reddit.com/r/adventofcode/comments/3w6h3m/comment/cxtsigs/ + +I felt that this solution was just too epic, so I included it here. diff --git a/2015/10/input b/2015/10/input new file mode 100644 index 0000000..13dcd63 --- /dev/null +++ b/2015/10/input @@ -0,0 +1 @@ +3113322113 diff --git a/2015/10/puzzles.go b/2015/10/puzzles.go new file mode 100644 index 0000000..65de02f --- /dev/null +++ b/2015/10/puzzles.go @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "strconv" +) + +func process(num string) string { + var newnum string + + for i := 0; i < len(num); { + c := num[i] + j := 0 + for i < len(num) && num[i] == c { + i++ + j++ + } + newnum += strconv.Itoa(j) + newnum = string(append([]byte(newnum), c)) + } + + return newnum +} + +func main() { + num := INPUT + for i := 0; i < LOOPS; i++ { + num = process(num) + } + fmt.Println(len(num)) +} diff --git a/2015/10/puzzles.sh b/2015/10/puzzles.sh new file mode 100755 index 0000000..291ac96 --- /dev/null +++ b/2015/10/puzzles.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +output() +{ + echo $in | tr -d '\n' | wc -c +} + +in=$(cat input) +for i in $(seq 1 50); do + in=$(echo "$in" | fold -w1 | uniq -c | tr -d '\n ') + [ $i -eq 40 ] && output +done +output diff --git a/2015/11/input b/2015/11/input new file mode 100644 index 0000000..a45c477 --- /dev/null +++ b/2015/11/input @@ -0,0 +1 @@ +hepxcrrq diff --git a/2015/11/puzzle-1 b/2015/11/puzzle-1 new file mode 100644 index 0000000..b0e5756 --- /dev/null +++ b/2015/11/puzzle-1 @@ -0,0 +1,7 @@ +The starting string is "hepxcrrq" + +The string must contain two sets of non-overlapping duplicates, this is best done as having the last +5 characters be "xxyzz". The first 3 characters aren't illegal, so we don't need to change them. +This gives an end result of "hepxxyzz". + +QED. (I hope) diff --git a/2015/11/puzzle-2 b/2015/11/puzzle-2 new file mode 100644 index 0000000..444ce35 --- /dev/null +++ b/2015/11/puzzle-2 @@ -0,0 +1,9 @@ +This continues from the last puzzle, so our starting string is "hepxxyzz" + +Following the theme of the previous puzzle, we want to create an "xxyzz" pattern in the lowest +amount of increments possible. Since the string currently ends in "xxyzz", we know that the next +possible value we could have that satisfies this property is "aabcc". In order to go from "xxyzz" to +"aabcc" however, you need to overflow which would increment the "p" to a "q". This gives an end +result of "heqaabcc". + +QED. diff --git a/2015/12/input b/2015/12/input new file mode 100644 index 0000000..bd91fda --- /dev/null +++ b/2015/12/input @@ -0,0 +1 @@ +[["green",[{"e":"green","a":77,"d":{"c":"violet","a":"yellow","b":"violet"},"c":"yellow","h":"red","b":144,"g":{"a":["yellow",-48,72,87,{"e":"violet","c":123,"a":101,"b":87,"d":"red","f":88},{"e":"red","c":2,"a":1,"g":"blue","b":"green","d":"violet","f":170},"orange",171,162]},"f":"orange","i":"orange"},49,[{"c":{"e":"violet","a":-44,"d":115,"c":117,"h":194,"b":{"e":-17,"a":172,"d":"green","c":197,"h":53,"b":106,"g":"violet","f":-10},"g":"red","f":"orange"},"a":-49,"b":["violet","orange","blue"]}],"green"]],["orange"],{"e":"blue","a":["red","yellow"],"d":{"a":[{"c":{"a":181,"b":["orange",-40,"red","orange","yellow",31,60,71,"yellow"]},"a":[114,-40],"b":"orange"},["green",93,10,{"c":11,"a":170,"b":[161,-3],"d":-16},58,{"e":{"c":-2,"a":117,"b":"violet"},"c":["blue","yellow","red","violet","yellow",123,113],"a":"orange","g":19,"b":108,"d":"red","f":"yellow"},{"e":"green","c":"yellow","a":{"e":28,"c":"red","a":"violet","b":"red","d":"green"},"g":"yellow","b":116,"d":148,"f":"red"},[15],["green","green",43],"blue"],[133],"green",134,"violet",{"c":"red","a":[71,41,"blue"],"b":"yellow","d":"violet"},132,[10,"violet",[182,"green","green","orange"],78,{"c":"blue","a":[100,-36,"blue","violet",-10,"orange"],"b":{"e":"orange","c":"blue","a":160,"g":"green","b":190,"d":"red","f":186}},16],[{"c":"green","a":"violet","b":20,"d":"red"},"green","blue",{"c":[0,84,184,"orange",-34,"blue","orange",0,"violet","violet"],"a":10,"b":89},"green",182,127,-2,196]]},"c":-20,"h":[[165,[180,"yellow",-5,16,"red",[{"e":"orange","a":"orange","d":"orange","c":"yellow","h":"red","b":182,"g":21,"f":"violet"},"red",69,"violet",10,"red","orange"]],[160,"blue",{"e":"yellow","c":"violet","a":"green","g":43,"b":[-40,"yellow","yellow",118,57,"green","violet","yellow","violet"],"d":"yellow","f":"blue"}],130,{"e":["yellow",58,"green",139,"violet","red"],"c":"green","a":"green","g":{"e":163,"c":33,"a":15,"b":78,"d":"green"},"b":86,"d":"orange","f":58},"red","red",{"a":37}],"yellow",{"e":44,"a":{"a":136,"b":"yellow"},"d":"yellow","j":39,"c":[-28,["violet",{"e":"red","a":150,"d":189,"c":76,"h":"orange","b":"yellow","g":164,"f":"orange"}],{"e":12,"a":"red","d":"yellow","c":"yellow","h":102,"b":"yellow","g":"red","f":147},"violet",[40,"red",24,193,105,179,"violet","green",{"a":"yellow","b":"violet"}],39,-25,{"a":127},126,{"e":"red","c":151,"a":-46,"b":"green","d":"violet"}],"h":"red","b":122,"g":93,"f":["violet",{"c":102,"a":-16,"b":39,"d":176},"red",187,{"e":"blue","a":172,"d":{"a":-5},"c":25,"h":{"a":"red"},"b":"blue","g":["yellow","red"],"f":{"e":158,"c":85,"a":"blue","g":"green","b":"violet","d":125,"f":93},"i":11},"violet"],"i":[195,{"a":"blue"},48,[44,25,"green","red","violet",172,"orange",49]]},["yellow",[{"e":-4,"a":"red","d":"green","c":"blue","h":"green","b":"green","g":190,"f":30,"i":-2},"green","violet",{"e":92,"c":-11,"a":{"e":"orange","c":0,"a":47,"g":"blue","b":"orange","d":"yellow","f":-47},"b":40,"d":193},97,"violet",[51,168,"violet",{"c":-45,"a":167,"b":"orange"},"blue","orange",64],[188,"green",91,-10,66,"green"],"green","blue"],"green",-42,{"e":"red","c":"red","a":199,"g":84,"b":"blue","d":["blue",194,["green",88,110,-23,"yellow","green",15,"violet"]],"f":"red"}],{"e":"blue","c":-33,"a":-34,"b":"blue","d":81}],"b":{"e":"violet","c":165,"a":"violet","b":{"a":"red","b":"yellow"},"d":[6,71,"orange","orange",{"a":96},74,"yellow"]},"g":["yellow",["orange",[-27],[[[8,"red","blue",-46,62,"yellow",94],[60,"violet",141,"green"],16,"green","yellow","blue",81,[93,"red",183,"blue","red",30,-16,"red","red","yellow"],-21,139],{"c":"blue","a":"orange","b":"violet","d":51}],"blue","yellow",["violet",19,"orange","yellow","red","violet","blue","violet",{"e":"yellow","a":"violet","d":137,"c":"blue","h":197,"b":"orange","g":{"e":"yellow","c":"orange","a":18,"b":42,"d":183,"f":142},"f":68}],"green",["blue",85,"violet"]]],"f":"green"},[92,{"c":-26,"a":{"c":["orange","orange",{"e":131,"c":192,"a":-38,"g":16,"b":27,"d":"yellow","f":-46},120,"orange",-28,-18,3],"a":["red",-15,{"e":56,"c":-15,"a":150,"g":"blue","b":"orange","d":"violet","f":70},-44,{"e":"green","c":53,"a":"blue","b":"blue","d":-34,"f":"violet"},"orange",[161,"orange",-19,{"e":27,"c":98,"a":"violet","g":"yellow","b":-45,"d":191,"f":"green"}]],"b":-41,"d":[["orange","red","yellow",120,140],[{"e":-1,"c":"orange","a":"yellow","b":"yellow","d":86},42,[78,140,"orange","green","orange",-49,159],"yellow","red",90,{"c":"green","a":62,"b":"violet"}],"violet",178,30,"green",186]},"b":"red","d":"violet"},{"e":-21,"a":{"e":{"e":{"e":"orange","c":115,"a":199,"b":-43,"d":"yellow"},"a":"blue","d":"green","c":"blue","h":"violet","b":"red","g":"violet","f":{"a":5}},"a":[{"e":"green","a":[20,"yellow",23,100,"orange",142,"red",-3],"d":19,"c":18,"h":"blue","b":"yellow","g":"yellow","f":{"a":-33}}],"d":"yellow","j":"yellow","c":["red",-2,95,-1,"green","violet",12],"h":"orange","b":{"e":[94,-14,"orange",68],"c":["blue","yellow",[-12,"yellow",126,"orange",199,"red",133],{"e":-14,"a":40,"d":-48,"c":5,"h":"orange","b":"red","g":"yellow","f":"red","i":"orange"},"blue",[-35,87,84,"yellow"],"red","red",86,"yellow"],"a":11,"g":{"e":-34,"a":"orange","d":"blue","j":"blue","c":"yellow","h":"yellow","b":"violet","g":42,"f":188,"i":53},"b":"yellow","d":{"e":"red","c":84,"a":"violet","b":"orange","d":87},"f":["blue","yellow","red",{"c":"orange","a":"blue","b":61},"violet",20,-22,129]},"g":{"e":28,"c":170,"a":["green",98,"orange",150,"orange"],"b":"blue","d":"blue"},"f":"blue","i":[{"e":"green","a":"blue","d":19,"c":177,"h":-18,"b":{"e":-19,"a":"green","d":"yellow","c":172,"h":"red","b":"red","g":"yellow","f":"yellow"},"g":{"c":-36,"a":"red","b":"violet"},"f":121},141,"violet",113,81]},"d":{"e":133,"a":19,"d":-27,"c":{"c":["yellow"],"a":105,"b":{"a":"orange"},"d":{"e":"yellow","c":"orange","a":"orange","b":163,"d":"violet","f":"red"}},"h":"yellow","b":161,"g":110,"f":[[137,6,[195,"violet",179,93,"green",130,"blue","yellow"],70,"orange",-8,-28,"orange",{"e":59,"a":"red","d":128,"j":88,"c":"violet","h":188,"b":0,"g":0,"f":"green","i":2}],86,"green","orange",68,"yellow"]},"c":{"e":"violet","a":-49,"d":["blue",140],"c":-29,"h":["red",4,-45,165,["yellow","blue","blue"]],"b":"blue","g":{"e":{"e":{"e":"blue","c":168,"a":51,"b":-28,"d":"orange","f":"violet"},"c":"violet","a":"green","g":"blue","b":-29,"d":121,"f":69},"a":"violet","d":["orange",[12,192,"green",-17,160,"blue"],131,"blue",41,{"e":"violet","a":"green","d":"blue","c":182,"h":"red","b":10,"g":"blue","f":-37,"i":151},"blue"],"c":{"e":"orange","a":182,"d":155,"j":18,"c":-41,"h":119,"b":148,"g":"green","f":104,"i":141},"h":16,"b":"blue","g":[137],"f":"green","i":-35},"f":[["green","red",19,"yellow","blue","red"],["red",37,[36,"red",-38,183,"violet",-17,119,93],130,-20,77,[64,115,66,"green"]],-13,-23,"green",100,"orange",{"a":"orange","b":"red"}]},"h":["red",{"e":28,"c":{"c":"green","a":149,"b":["orange",137,"violet",184,"orange","green","red",20,72]},"a":114,"g":["blue",{"e":"yellow","a":104,"d":"red","c":-17,"h":"blue","b":"violet","g":"orange","f":"red","i":"red"},181,21,"blue","orange",111,{"e":39,"a":"orange","d":196,"j":119,"c":143,"h":-42,"b":"green","g":190,"f":-43,"i":37}],"b":"orange","d":{"e":["green",44,"green",177,"violet",-44,160,"violet",85,95],"a":{"e":138,"c":"yellow","a":"yellow","b":"blue","d":"green"},"d":"violet","j":"blue","c":100,"h":"blue","b":104,"g":-28,"f":189,"i":"orange"},"f":[121,{"c":110,"a":68,"b":5,"d":57},[108],15,"red",[83,"blue","green",-16,"yellow"],"green"]},[[80],160,68,187,"green","green",94,113,2,163],34,"orange",["yellow",{"e":72,"c":["green",11,"green","green","orange"],"a":{"c":"violet","a":13,"b":66,"d":36},"g":"blue","b":"yellow","d":140,"f":145},"red",53,-11,"yellow","blue",148,{"e":"violet","a":"violet","d":83,"c":"yellow","h":103,"b":-23,"g":36,"f":[154,"red",62,112,35],"i":"violet"}],{"e":174,"a":-49,"d":58,"j":114,"c":"violet","h":[162,"red",54,-8,[142,178,"red",26,"violet",71,-20,38,"orange"],"orange","yellow",[49,25,"violet","green","blue",189,"green","yellow",-25,55],"red"],"b":-13,"g":156,"f":[48,107,-15,167],"i":"blue"},["red",{"a":"red","b":"red"},"violet",[73,"blue","violet","red"],["red","red"],63,-12,108]],"b":{"c":"violet","a":{"a":-39,"b":166},"b":183},"g":36,"f":[45,"yellow","blue","violet",26,7,[[156,-18,"yellow"],-4,-37,[129,-11,["yellow",179,"violet","red","yellow","violet"],"red","red",133],17,"green",137,"red",-9,"yellow"],"yellow",[{"e":"green","a":"yellow","d":52,"c":127,"h":132,"b":38,"g":"yellow","f":"violet","i":"red"},"yellow","red",{"e":{"c":60,"a":126,"b":88},"a":159,"d":"red","j":70,"c":23,"h":195,"b":178,"g":"red","f":"yellow","i":"blue"},13,-37,[196,146,145,"orange",60,"violet",["red",144,51,"red",-26,172,"yellow","red",52,"yellow"],157,"green"],[{"a":-7,"b":"red"},123,{"e":"yellow","c":"orange","a":"orange","b":40,"d":"blue"},139,"green","red",48,{"e":165,"a":60,"d":83,"c":"yellow","h":186,"b":34,"g":"blue","f":178,"i":33},[116,"yellow",179,18,32]],"red"]]},{"c":[6,{"e":{"c":79,"a":82,"b":"orange"},"a":"blue","d":[38,"red",37,[12,134,139,"violet",102,60,"green",82,91],"orange",84],"j":"orange","c":["yellow","green","blue","violet",{"e":"orange","c":157,"a":"green","b":"blue","d":"violet","f":"blue"},64,["violet",176,-7,137,"red",57,"yellow"],"yellow",["blue",170,159],"orange"],"h":170,"b":[3],"g":"violet","f":"violet","i":186},{"e":{"e":"yellow","c":"red","a":"blue","g":["violet",104],"b":124,"d":42,"f":"violet"},"c":-43,"a":-28,"b":[6],"d":[0,97,{"e":-9,"a":"violet","d":31,"c":23,"h":40,"b":76,"g":"red","f":94},["violet"],124,68,"green",37]},[84,{"e":"yellow","c":18,"a":"orange","b":"blue","d":"red"},["yellow",66],81,"orange",-22,-10,"green",139],"red","yellow"],"a":25,"b":"yellow"},[{"e":25,"a":{"e":["violet",22,103,{"e":193,"c":"red","a":"yellow","g":"violet","b":"yellow","d":-33,"f":29},{"e":-10,"a":77,"d":"blue","c":-15,"h":74,"b":-4,"g":"orange","f":153},"yellow",176,94,"green",141],"c":"blue","a":146,"b":-26,"d":-7,"f":149},"d":"green","c":["violet"],"h":"orange","b":[[23,"violet","blue","violet","violet",-40],"orange","yellow"],"g":57,"f":[{"e":141,"a":"yellow","d":"red","c":138,"h":118,"b":{"a":"yellow","b":"red"},"g":133,"f":{"e":169,"c":"violet","a":"green","g":193,"b":"orange","d":"violet","f":-17},"i":"yellow"},72,"green","violet",[106,"red","red","red","yellow",180,"orange",{"a":"green","b":"green"},111,"blue"],147],"i":-7},[[62,65,158,"blue",86,"yellow"],[71,[168,179,"yellow","red","green"],-7],"violet"],"violet",["yellow","red","blue","orange",78,47,{"c":"orange","a":"violet","b":152},[-37,"yellow"],-11,6]],"red",{"e":"red","a":"orange","d":{"e":"red","a":10,"d":"blue","c":{"c":"green","a":91,"b":"yellow","d":-28},"h":158,"b":[["orange"]],"g":"blue","f":[[137,157,50,10,"blue",-12,"violet",76,76,80],[164,46,"orange",-23,{"a":"green"},"yellow","green","green","yellow",48],47]},"j":{"e":["orange",{"e":191,"c":"orange","a":25,"g":"red","b":"yellow","d":148,"f":"orange"},-34,"orange","orange",-36],"a":[{"e":198,"a":["blue",80,121,36,102],"d":{"e":"green","a":"blue","d":76,"j":"red","c":127,"h":"yellow","b":"yellow","g":"yellow","f":163,"i":"red"},"c":"yellow","h":73,"b":"red","g":"green","f":"red"},"violet",{"e":133,"a":"blue","d":"green","j":3,"c":"violet","h":144,"b":25,"g":"green","f":102,"i":"green"},{"e":{"a":"violet","b":"green"},"a":"green","d":[86],"c":"green","h":3,"b":{"c":"orange","a":"orange","b":"yellow","d":193},"g":-34,"f":-35,"i":"green"}],"d":[{"e":"violet","a":"blue","d":{"c":79,"a":"red","b":0,"d":"violet"},"c":77,"h":"violet","b":"green","g":-47,"f":"green"},-49,90],"j":"blue","c":"yellow","h":["violet","green",28,"green",97,"orange"],"b":53,"g":{"e":21,"a":{"c":42,"a":"blue","b":"red"},"d":"violet","c":142,"h":158,"b":"blue","g":["orange",197,"blue","green","yellow",-3,15,-38],"f":62},"f":{"a":32},"i":79},"c":{"e":[{"e":[125,"yellow",-43,"orange","red"],"c":3,"a":"orange","b":"orange","d":{"e":195,"c":16,"a":"yellow","b":94,"d":-20,"f":-13},"f":"yellow"},89,["orange"],"violet"],"c":{"e":"red","a":"orange","d":5,"j":{"a":92,"b":142},"c":22,"h":"blue","b":"orange","g":{"a":[-13,199,"green",133,-41,-22,"orange",169],"b":[134,"blue"]},"f":183,"i":["green",-24,"violet"]},"a":116,"g":[{"e":57,"a":["blue",144,44,43,"orange",34,"yellow",126,"red"],"d":"green","c":"violet","h":"orange","b":"violet","g":"violet","f":[196,60],"i":-21},[168],["red","violet","yellow","green","yellow","green","blue",113,{"e":"orange","a":"red","d":-7,"c":-29,"h":"orange","b":-44,"g":"red","f":-32}],{"a":116},"blue"],"b":{"c":{"e":-41,"a":"orange","d":154,"c":"yellow","h":-12,"b":"yellow","g":"blue","f":"violet","i":105},"a":-23,"b":2},"d":161,"f":"orange"},"h":[187,{"c":"yellow","a":"orange","b":"orange","d":"red"},[[58,"blue"],[111,["yellow","green","green","violet","green"],"orange","blue",112,-45],31,"violet"]],"b":{"e":[[13,"blue",-19,"blue","yellow",144,23,17,110],"violet",{"c":"orange","a":"yellow","b":73,"d":"red"},9,115,"blue","violet","yellow","blue","green"],"a":[-9,"yellow","violet",183,"red",14,"blue",192,"yellow",165],"d":"blue","j":{"e":[86],"a":-14,"d":"yellow","j":"violet","c":"violet","h":{"e":85,"a":["red","yellow",114,111,129,37,71,"blue"],"d":"yellow","c":43,"h":11,"b":72,"g":128,"f":"red"},"b":11,"g":183,"f":34,"i":187},"c":122,"h":{"c":[93,132,"yellow","yellow",91],"a":"green","b":"orange"},"b":[{"e":"blue","a":"green","d":"blue","j":{"e":"orange","a":"violet","d":"orange","j":"yellow","c":"yellow","h":"orange","b":"green","g":"orange","f":"green","i":"green"},"c":186,"h":"yellow","b":145,"g":112,"f":"orange","i":"orange"},100,139,-11,{"e":103,"c":["green","red",-40,90,"violet","violet","yellow"],"a":140,"g":"red","b":"violet","d":"red","f":"blue"},{"c":-43,"a":"orange","b":66},"red",["red","orange",["blue",187],76,192,50,"yellow","violet"]],"g":38,"f":"blue","i":[129,[30,"green",157,92,181,176],{"e":"violet","a":127,"d":172,"j":"yellow","c":148,"h":171,"b":"yellow","g":{"e":115,"a":"red","d":48,"c":-12,"h":"blue","b":"orange","g":"red","f":78},"f":135,"i":79}]},"g":[[173,131,"yellow",193,162,"yellow"],[-5,{"e":[116,102,"orange","yellow"],"a":189,"d":136,"c":{"e":72,"a":"blue","d":-13,"j":"yellow","c":90,"h":"violet","b":169,"g":"orange","f":"blue","i":"blue"},"h":186,"b":"orange","g":"red","f":"orange"},{"e":-8,"a":-37,"d":104,"c":"violet","h":"orange","b":-31,"g":25,"f":168,"i":119},"green",32,[[197,"orange","violet"]],"yellow",{"e":["red",-16,"yellow"],"a":"blue","d":31,"c":"yellow","h":"red","b":"red","g":"violet","f":20,"i":"violet"},31,80],22,{"e":{"e":"red","a":125,"d":"yellow","j":111,"c":34,"h":193,"b":100,"g":"orange","f":31,"i":15},"c":{"e":75,"a":13,"d":-29,"c":["green"],"h":-46,"b":{"a":58},"g":100,"f":{"c":"violet","a":"red","b":-35},"i":["violet","green","orange","violet",183,0,-27,96]},"a":"red","b":[95,"orange","blue","green",170,{"e":3,"a":"blue","d":125,"j":-25,"c":10,"h":25,"b":"blue","g":182,"f":141,"i":27},["violet",7,76,-37,"red",59,"yellow",29]],"d":78,"f":88}],"f":["violet",72],"i":[96,["green","orange",63,"red",83,"yellow"],[{"e":"red","a":{"e":"orange","a":"green","d":183,"c":"orange","h":"yellow","b":146,"g":-1,"f":"red","i":"orange"},"d":"green","j":"red","c":"red","h":"yellow","b":"violet","g":-9,"f":182,"i":"red"},-49,17,"orange",187,-2,[178,"red","red",131,195,[94,-26,"blue","green",0,1,101]]],-25,14,"violet",{"c":"blue","a":"green","b":"orange"},198,-2]},9],[{"e":["green",177,[-38],{"e":"green","a":[147,"green",[56,93,"violet","red"],82,{"e":"blue","a":"orange","d":"red","c":30,"h":"blue","b":10,"g":"orange","f":"orange","i":82},193],"d":"violet","j":69,"c":"green","h":161,"b":-12,"g":{"e":125,"c":-33,"a":-42,"g":70,"b":{"c":81,"a":52,"b":"red","d":"violet"},"d":["violet"],"f":39},"f":["red","green",74,158,14],"i":"yellow"},[144,88,["yellow","violet",-1,"blue",109,[53,86,-36,91,"violet","green",59,15],171,"blue"]],185],"c":{"e":{"a":92},"a":67,"d":"violet","c":"blue","h":[71,"violet",25,154,{"e":16,"a":"red","d":"red","j":"violet","c":54,"h":"violet","b":160,"g":"orange","f":{"e":-47,"a":"green","d":"blue","c":56,"h":175,"b":118,"g":97,"f":"red"},"i":"yellow"},{"e":[107,"violet","violet","blue",-4,"blue","green",82,"red"],"c":{"e":"yellow","c":"violet","a":"orange","b":"blue","d":"green"},"a":172,"b":131,"d":"green","f":43},"red","green",["red","green","violet","violet",132,"green",153,195,-41,[128]]],"b":"yellow","g":"green","f":{"c":72,"a":{"c":"green","a":"violet","b":"green","d":180},"b":48,"d":["blue",70,60,"orange",139,183,"red","red",{"a":"red","b":123},"yellow"]},"i":[66,77,"green","violet",25,[193,"orange",78,"red",["violet","red",163,37,"yellow"]]]},"a":"red","b":175,"d":0,"f":[{"e":38,"a":"yellow","d":"violet","c":68,"h":{"e":"orange","c":129,"a":"blue","b":"green","d":106,"f":"orange"},"b":"red","g":"green","f":{"e":91,"c":46,"a":"blue","g":"red","b":"yellow","d":92,"f":"yellow"}},["green",65,150,86,"orange"],"green",{"c":"green","a":30,"b":"yellow"}]},["blue",70,143,{"a":"green","b":[{"e":83,"c":63,"a":-2,"g":{"e":"green","c":"orange","a":-46,"b":"yellow","d":"red"},"b":39,"d":"red","f":123},"orange",57,34,{"c":"yellow","a":{"c":"blue","a":"green","b":"blue"},"b":"orange","d":{"e":"blue","a":158,"d":"red","c":69,"h":122,"b":6,"g":93,"f":"yellow","i":163}},{"e":183,"c":99,"a":"orange","g":76,"b":42,"d":31,"f":118}]},{"e":31,"c":["orange",186,58,{"e":"violet","c":9,"a":115,"b":[115,"yellow",19,"violet","blue","yellow"],"d":106}],"a":{"e":"red","c":{"a":82,"b":180},"a":71,"b":"yellow","d":100},"g":{"c":68,"a":"red","b":{"a":"blue","b":70}},"b":"yellow","d":"violet","f":-4},"yellow",[{"a":"yellow"},[{"e":"violet","a":159,"d":"violet","c":"blue","h":{"a":195,"b":-16},"b":97,"g":74,"f":126,"i":83},-49,"orange","orange",20,{"e":-37,"c":82,"a":"blue","b":"yellow","d":"orange"},"violet","green",5],"blue",{"a":-2},{"e":-39,"c":"yellow","a":-3,"b":127,"d":[196]},{"c":"red","a":-1,"b":"orange","d":166},{"e":{"e":"red","a":97,"d":"orange","j":47,"c":84,"h":-36,"b":-5,"g":"red","f":"yellow","i":113},"c":55,"a":{"e":[13,108,137,"green","green",-9,71,-36,"orange","blue"],"a":"violet","d":95,"c":6,"h":125,"b":"orange","g":"orange","f":130},"b":-28,"d":[97,46,[-7,"violet",146,155,166,"orange","orange","yellow",148,"red"],"orange",40,"red"]}],[{"c":"violet","a":"yellow","b":64,"d":"orange"},{"e":{"e":"violet","c":"blue","a":{"e":"yellow","a":-41,"d":181,"c":101,"h":"orange","b":"orange","g":"blue","f":51},"g":-25,"b":"red","d":41,"f":1},"a":25,"d":{"e":"orange","a":"green","d":-9,"c":"orange","h":71,"b":"red","g":137,"f":133},"j":[["yellow",116],93,"orange","violet","blue",150,34],"c":66,"h":"violet","b":-49,"g":[60,194,[136,-37,160,"red","orange","red",179,"red"]],"f":[-24,"violet",35],"i":"blue"},{"e":92,"c":"blue","a":"red","b":"blue","d":"green"},"red",[126],96,"red",198],87],{"e":{"e":["orange","violet",{"e":"green","a":-42,"d":103,"c":["violet",-48,37,122,107,"orange","blue",97],"h":"blue","b":92,"g":"orange","f":0},"blue",197,-9,"yellow",{"a":["orange","blue",186,"blue","green","red","red",48,"red","green"],"b":195},121,"blue"],"a":96,"d":"orange","j":94,"c":66,"h":{"a":["violet"],"b":"orange"},"b":"violet","g":191,"f":{"e":"red","c":-32,"a":[149,[69,"green",84,25,"red"],"yellow","violet",4,"violet","green",69],"b":"blue","d":148,"f":111},"i":93},"a":[181],"d":{"e":{"e":{"e":"red","c":36,"a":143,"b":82,"d":11},"a":168,"d":"orange","j":-45,"c":159,"h":"red","b":{"e":120,"a":-37,"d":"green","c":"green","h":"red","b":59,"g":"violet","f":173},"g":166,"f":"orange","i":"yellow"},"a":158,"d":"green","c":126,"h":[[159,"violet","violet","green",101,"orange",141],"violet",122,"yellow","red",79],"b":13,"g":"red","f":{"a":"orange"},"i":{"a":89,"b":{"e":[-20,"green",6,58,18],"a":-17,"d":137,"c":[-25,"orange",95,"yellow","green"],"h":3,"b":"violet","g":26,"f":"green","i":168}}},"c":["orange",{"e":163,"a":{"a":6},"d":-25,"c":164,"h":[-47,"yellow","orange",[139,93,93,"yellow","violet","red",-12],"blue",-32,136,10],"b":"orange","g":"blue","f":174}],"h":["blue",-34,-29,{"e":"violet","a":3,"d":"green","j":"red","c":"orange","h":"green","b":"red","g":"green","f":124,"i":{"e":186,"c":"violet","a":168,"g":110,"b":[127,136,31,109,"blue","red","blue","violet",79,91],"d":"red","f":["violet",191,-15,-22]}}],"b":[124,{"e":-38,"a":{"a":"yellow"},"d":[130,{"c":158,"a":"blue","b":103,"d":197},-36,[153,-6,173,121,"yellow",94,168,"violet",77,-35],168,"red",{"e":-32,"a":"red","d":46,"c":82,"h":91,"b":"blue","g":"yellow","f":"orange","i":174},"green"],"j":[189,-43,41],"c":[185],"h":[182],"b":[139,"violet",-44],"g":"yellow","f":"red","i":["red",-18,"violet","red",31,"red",115,-49,["yellow","yellow","violet","blue","violet","violet"]]},143,"yellow",["violet","red",["blue","violet",{"a":-49},41,"orange","blue"],{"a":"orange"},[93,-8,"yellow",-39]],166,155,"red","violet","orange"],"g":"violet","f":"red","i":[85,126,{"e":{"e":"red","c":-42,"a":51,"b":"yellow","d":"red","f":{"e":130,"c":"violet","a":115,"g":"violet","b":-28,"d":-3,"f":"blue"}},"a":92,"d":114,"c":"violet","h":{"e":-41,"a":"red","d":57,"j":82,"c":"violet","h":"green","b":"red","g":2,"f":-20,"i":78},"b":"yellow","g":"violet","f":86,"i":67},147,146,-33,"blue","violet"]},{"e":[[{"a":174},21,"orange","green","blue",{"e":127,"c":{"c":0,"a":197,"b":"yellow"},"a":"blue","b":["yellow",153,9,"blue"],"d":136}],"blue"],"c":[{"c":"red","a":[-5,"green",["violet"],-47,19,173],"b":106,"d":"yellow"},182,[21,106,"violet",10,"green",20,"orange"],["green"],{"e":-25,"c":"blue","a":"violet","b":["red",27,"blue",21,193,"green",["green","green"]],"d":["orange"],"f":18},"yellow","yellow",{"e":{"e":"violet","a":"green","d":"violet","c":"red","h":171,"b":["red",149,"violet"],"g":"yellow","f":"blue","i":"green"},"c":[86,-30,"orange",56,123,"green"],"a":65,"b":[86,129,"yellow","blue",87,127,182],"d":4,"f":[-36,179,"red",-9,27,{"c":111,"a":178,"b":"yellow","d":25},"red","blue"]},[-3,5,["orange","blue"],70],"yellow"],"a":[{"e":{"c":-15,"a":"red","b":-18,"d":"green"},"a":-42,"d":{"c":-47,"a":"red","b":"green","d":"yellow"},"c":{"e":56,"a":"green","d":"yellow","c":"orange","h":"yellow","b":"blue","g":-35,"f":179,"i":"green"},"h":"blue","b":[35,153],"g":193,"f":{"e":{"e":37,"c":86,"a":"green","g":170,"b":"violet","d":"red","f":-33},"c":187,"a":16,"b":147,"d":19,"f":"red"},"i":88},"green","blue",{"e":{"e":"orange","a":"blue","d":"orange","c":150,"h":-12,"b":"green","g":"red","f":145,"i":"red"},"c":"red","a":"yellow","b":"yellow","d":"blue"},196,{"e":"green","c":186,"a":"green","g":-18,"b":"red","d":[102,"green","orange",[-6,160,128,"green","violet",48,"violet","yellow",50],"blue","green","orange",[199,59,20,15,126]],"f":[[120,"red",69],49,18,84,"red","green",["orange","blue",-31,"green","red",198,115]]},{"e":"yellow","a":196,"d":["orange",{"e":"violet","a":21,"d":"green","c":"red","h":"green","b":18,"g":48,"f":174,"i":"orange"},{"a":-1,"b":"green"},"green"],"c":106,"h":"blue","b":"blue","g":"yellow","f":{"e":-4,"a":61,"d":18,"c":122,"h":"green","b":84,"g":165,"f":"orange"}}],"b":[43,{"e":137,"c":"green","a":"green","b":75,"d":125}],"d":{"e":178,"c":[-21,[116,20,"yellow","blue",161,"orange","blue",30,{"c":181,"a":-30,"b":3}],"orange",-9,"orange",["violet","green",54],"orange",[-20,97,{"c":59,"a":115,"b":-48,"d":-22},28,{"e":59,"c":"green","a":"green","b":"yellow","d":"green","f":-27}],{"a":"violet"},{"e":"blue","c":50,"a":"orange","b":"yellow","d":"orange","f":{"a":"red","b":"green"}}],"a":"orange","b":134,"d":-3,"f":{"e":"violet","a":"orange","d":"green","c":80,"h":"red","b":[140],"g":"red","f":"red"}}},-47,[-28,{"a":[46,["blue",-45,172,193,"blue","green",-2],122,{"a":"green","b":92},-35,[136,[-8,127,20,91,45,"orange"],"green","orange",["orange","yellow",92,162,48,"orange","violet",197],"blue","orange",57,172],"green",135],"b":{"e":[173,{"e":89,"a":96,"d":"orange","c":"orange","h":"green","b":74,"g":"yellow","f":60,"i":135},-11,3,"blue","violet","blue"],"c":160,"a":"blue","b":60,"d":"green","f":"red"}},{"e":[12,"orange"],"c":{"e":45,"c":{"e":-26,"a":86,"d":"yellow","c":["yellow",128,180,135,102,186,"red",194,"green"],"h":"violet","b":{"c":90,"a":-47,"b":56},"g":"blue","f":"red","i":28},"a":71,"b":"violet","d":25},"a":182,"b":"green","d":111,"f":"violet"},{"c":[-21,{"e":[157,13,"red",180,"yellow","green","red",59],"c":-49,"a":82,"b":69,"d":{"e":"orange","a":"yellow","d":98,"j":60,"c":"red","h":199,"b":172,"g":120,"f":"yellow","i":98}},[53,[-23,"orange",135,102,165,170,172,"violet"],"yellow","blue","green",105,97],[74,"violet","orange",["yellow",56,"orange",81,"violet"],"orange",177,75,11],"blue","yellow","blue","red",["blue"]],"a":{"a":-36,"b":"orange"},"b":5,"d":"green"},179,-26,{"a":"green","b":[163,{"a":"orange","b":-35},{"e":180,"a":"blue","d":40,"j":"orange","c":"green","h":"orange","b":"orange","g":131,"f":53,"i":169}]}]],[[{"e":153,"c":"orange","a":"yellow","g":{"e":-4,"c":{"e":115,"c":"red","a":121,"b":151,"d":"red"},"a":"orange","b":194,"d":"orange"},"b":{"a":30},"d":["green",[31,["violet"],["orange",152,"yellow","red"],"yellow"],"violet",{"a":"violet"},171,"violet",{"c":"violet","a":"orange","b":"orange"},"green"],"f":{"e":"yellow","c":["green","red"],"a":"red","g":-17,"b":-3,"d":-42,"f":150}},"orange",{"c":["orange"],"a":"red","b":{"c":-32,"a":{"a":"blue","b":"orange"},"b":{"c":75,"a":{"e":"green","a":101,"d":-3,"j":"violet","c":56,"h":166,"b":192,"g":-5,"f":-22,"i":100},"b":"yellow"},"d":159},"d":{"e":"violet","a":"yellow","d":["green","orange","blue","green"],"j":"yellow","c":[23,"green","blue","yellow","violet","red"],"h":[149,-24,"red",152],"b":-12,"g":"red","f":89,"i":169}},[{"e":{"e":"violet","a":[124,"blue","orange","green",160],"d":113,"c":"red","h":"blue","b":["violet","red","violet",104],"g":85,"f":179,"i":{"e":"orange","a":"violet","d":"violet","j":"yellow","c":191,"h":"red","b":53,"g":-25,"f":"green","i":169}},"a":[147,120],"d":"green","j":["yellow",["yellow",108,"violet",114,"green",195,25,"green"],"green","orange"],"c":["orange",148,141,"yellow",32,-24],"h":124,"b":"orange","g":[121,"blue","red","violet",-18],"f":"violet","i":"red"},["violet","green",94,91,"blue"],{"c":[9,"violet",-18,69,"orange","orange",-24,"yellow","yellow"],"a":"yellow","b":150,"d":73}],110,["blue",-9,"blue","yellow",{"e":[163,45,67],"c":135,"a":50,"b":[43,26,18,120,"green","blue",10,"green",68,-2],"d":{"e":136,"a":15,"d":89,"c":[65,"green",108,122,"yellow","violet","yellow"],"h":"green","b":{"e":125,"a":21,"d":51,"c":153,"h":33,"b":158,"g":"blue","f":26,"i":"green"},"g":-33,"f":[-16,14,"red","red",126,"violet",-16]}},"red",{"e":120,"c":"red","a":{"e":"green","a":"yellow","d":18,"c":150,"h":185,"b":["yellow","red","violet",48,"violet","blue"],"g":"green","f":{"a":"yellow"}},"g":[12,"blue",168,"orange",{"a":"red"},168,"red"],"b":-2,"d":{"e":"violet","c":"yellow","a":86,"g":155,"b":3,"d":-24,"f":149},"f":"yellow"}],[{"c":"green","a":91,"b":"green"},[{"e":"red","c":98,"a":{"c":"red","a":-49,"b":176,"d":105},"b":"red","d":169,"f":"blue"},-46,"green","blue",-30,{"c":154,"a":72,"b":"yellow"},[161,85]],111,"blue",172,57,{"a":-23,"b":"green"},81,[160,["blue","green","green",157],137,["blue",["violet",162],[153,"yellow","orange","violet",127,"green",148,182,29,150],-33,168,"blue"],95]]],["yellow",132,{"c":16,"a":[113],"b":"red","d":{"e":"green","c":24,"a":{"a":"red"},"g":125,"b":["violet",2,101],"d":"green","f":132}},89],[{"e":"yellow","c":[68,"green",[160,146],175,"orange",185,"blue",[198,[179,"yellow","green",72,33,112,179,"violet",194,1]]],"a":["blue","violet",153,"blue",{"a":77,"b":"yellow"},-19,"yellow","green"],"b":"yellow","d":29,"f":{"c":"violet","a":"violet","b":-18}},"yellow",{"e":["violet","green",["red","red","blue",126,137,47,["blue","blue","green",102,"orange","yellow","green"],"red"],[["blue","orange",16,-2],"green","orange","yellow",27,150,0],{"e":62,"c":"yellow","a":"blue","b":94,"d":10,"f":31},[-47,{"e":"green","a":"yellow","d":197,"j":99,"c":"yellow","h":152,"b":"orange","g":85,"f":"green","i":"green"},174,"blue","green"],106],"c":["blue",118,[120,161,-41,["violet"],"violet","yellow"],"red"],"a":["orange","green","red",58,"green",5,178,191,-43],"b":62,"d":"violet"},{"e":97,"a":[["yellow",122,"orange","red",{"e":165,"c":"blue","a":63,"g":"violet","b":"blue","d":"yellow","f":77},[104,118,"green","red","orange",61]],{"c":124,"a":86,"b":"violet"},"yellow",{"e":[98,110,40,104,126,90,140,"blue",46],"a":-42,"d":[77,"green","red",-28,"blue",88,29,-9,-28],"j":-3,"c":"green","h":{"e":153,"c":45,"a":"green","g":127,"b":"red","d":183,"f":"orange"},"b":3,"g":0,"f":["blue","green",62,"red","yellow","green"],"i":"orange"},127,171,[118,[119,"blue"],15,87,"orange",{"e":-34,"c":"violet","a":18,"b":153,"d":37,"f":"red"}],"red"],"d":"red","c":["yellow","red","blue","red","violet","red",-13,179],"h":100,"b":{"e":"orange","a":48,"d":"red","c":{"e":"violet","a":"violet","d":"orange","c":["violet","yellow","blue","yellow"],"h":"red","b":"violet","g":149,"f":"green"},"h":"yellow","b":46,"g":"blue","f":184},"g":16,"f":36,"i":{"e":"green","a":-4,"d":{"c":{"e":"yellow","a":"blue","d":177,"j":"violet","c":"red","h":140,"b":131,"g":137,"f":53,"i":28},"a":16,"b":161},"c":48,"h":[53,7,[137,80,113,160,"blue",105]],"b":"blue","g":"orange","f":"green"}},"yellow",{"c":["orange",{"e":-11,"c":-36,"a":"green","b":"yellow","d":"yellow","f":{"a":186}},-4,170,"green","green",16,123],"a":-29,"b":{"c":"orange","a":"blue","b":"orange"}},{"c":[[161,"violet","blue"],"yellow","yellow",["red",22,["red",92,103,126,-13,67,"blue"],-21,136,"violet",[193]],"blue",-15],"a":{"e":179,"a":1,"d":"yellow","c":[92,15],"h":"orange","b":{"e":-6,"a":"violet","d":"yellow","j":155,"c":198,"h":-18,"b":14,"g":"blue","f":-39,"i":"orange"},"g":{"a":"yellow"},"f":"blue"},"b":87},"yellow",{"c":"blue","a":[{"e":"red","a":"blue","d":"orange","c":"orange","h":-27,"b":"yellow","g":47,"f":{"e":"violet","a":"green","d":185,"j":"orange","c":"violet","h":138,"b":-3,"g":"blue","f":"red","i":150}},{"e":75,"c":168,"a":[12,"blue","green"],"g":{"c":"blue","a":"green","b":107},"b":-36,"d":"orange","f":72},2,[120,"green",182,"yellow",-23,"red"],"green",{"e":"blue","a":"orange","d":"blue","c":157,"h":"green","b":58,"g":"blue","f":-39},"red","orange",32],"b":"violet"},{"e":178,"a":{"c":{"e":59,"a":186,"d":"orange","c":{"a":"violet"},"h":"green","b":198,"g":{"a":"blue","b":"blue"},"f":"orange","i":2},"a":"red","b":[95,130,"blue","violet",98]},"d":176,"c":-38,"h":["yellow",128,"green",39,74,"yellow",5],"b":"blue","g":"violet","f":"orange"}],{"a":{"e":135,"c":{"e":{"e":["orange",-44,81,-11,-1,47,"orange",-36],"c":10,"a":12,"b":"red","d":{"e":"violet","c":"violet","a":161,"b":192,"d":133},"f":77},"c":92,"a":"yellow","g":["blue"],"b":{"e":"violet","a":-48,"d":"orange","c":"blue","h":"orange","b":-40,"g":81,"f":77},"d":102,"f":"yellow"},"a":127,"b":"violet","d":{"e":130,"a":36,"d":148,"c":"yellow","h":117,"b":"orange","g":"orange","f":-19,"i":["green",{"e":"red","a":191,"d":159,"j":"violet","c":"red","h":147,"b":"blue","g":"red","f":"red","i":"green"},"blue",62]},"f":-5},"b":[["green",-36,62,"green","blue",{"c":"violet","a":{"a":-4},"b":"violet","d":88},{"e":"yellow","c":166,"a":["blue"],"g":50,"b":146,"d":"blue","f":142},"yellow"]]},["red","blue",{"e":{"a":-16},"a":[["violet",{"e":"blue","a":171,"d":"blue","c":"blue","h":"green","b":"green","g":"orange","f":"yellow"},186,"orange",195,87,"green",[67,158,"blue",23]],25],"d":[159,74],"c":-28,"h":{"e":-16,"a":"red","d":55,"c":158,"h":167,"b":"red","g":27,"f":{"e":"yellow","c":[34,"blue",-22,"orange"],"a":94,"b":-30,"d":["blue",133,39,102,"orange"]}},"b":119,"g":{"e":104,"c":90,"a":["orange","blue",158,-34,"violet"],"g":"green","b":33,"d":["violet",125,"yellow","yellow",117,["blue",25,"orange"],["red",193,-23,"red","green",146,173],"red","yellow",10],"f":50},"f":47,"i":{"e":[121,144,172,171,{"e":"green","a":9,"d":"violet","c":-33,"h":64,"b":-4,"g":45,"f":75}],"a":8,"d":{"c":68,"a":["yellow","red","green"],"b":"violet","d":9},"c":"blue","h":17,"b":199,"g":115,"f":[["green",108,113,"red",6,"violet","violet","green",57,"green"],"orange",177,"red",34,"blue","red"],"i":-25}},{"e":"blue","a":["orange","yellow",["violet",27,"violet",128,120,{"e":"green","a":"orange","d":"orange","j":"blue","c":"yellow","h":"yellow","b":"yellow","g":139,"f":132,"i":81},"blue","red",53],7,"orange","violet",{"c":"yellow","a":{"a":-11},"b":"orange","d":87},"violet"],"d":[{"a":175},[163,"orange",185],[-30,109,194,119,170,"green","violet","yellow",125,"red"],"blue",{"e":"green","c":152,"a":37,"b":"red","d":["orange"],"f":"orange"},69,"yellow",{"e":{"e":"yellow","c":"violet","a":144,"b":"yellow","d":141,"f":"blue"},"c":"blue","a":"green","g":"yellow","b":178,"d":"yellow","f":-8},"green",["green","orange",-42,"orange"]],"c":"red","h":54,"b":"orange","g":["green",2,146,-6,{"e":52,"a":"orange","d":"red","c":"yellow","h":141,"b":35,"g":{"e":"violet","a":"blue","d":"yellow","c":"blue","h":100,"b":119,"g":"blue","f":"yellow"},"f":136,"i":"yellow"},194,["yellow",139,"green",["blue",14,"green","blue","blue",119,"violet",-5],{"a":61,"b":"orange"},"violet"]],"f":20},{"c":"orange","a":{"e":135,"c":"violet","a":111,"g":{"a":"red","b":96},"b":186,"d":33,"f":127},"b":{"e":83,"a":"yellow","d":"orange","c":"blue","h":"orange","b":0,"g":"orange","f":164,"i":"blue"},"d":-28},-42,{"e":"green","c":{"e":-20,"c":"yellow","a":66,"b":156,"d":"violet"},"a":[-9,129],"g":74,"b":{"e":"violet","c":"green","a":[52,"blue",["green",-8,"green","green"],"red",188,43,"green",{"e":"orange","a":40,"d":-6,"c":"orange","h":93,"b":"green","g":103,"f":"red"}],"g":{"e":"red","c":"yellow","a":16,"b":7,"d":70},"b":{"e":133,"a":150,"d":{"a":34,"b":"green"},"j":166,"c":156,"h":79,"b":"red","g":178,"f":-37,"i":163},"d":"blue","f":"green"},"d":{"c":"blue","a":"violet","b":177,"d":80},"f":[61,88,"yellow",{"c":"blue","a":"orange","b":"violet","d":"yellow"},{"c":119,"a":"violet","b":{"a":"red"},"d":84},95,170]},{"e":191,"c":2,"a":"orange","b":{"a":[-9,"green","violet",["green",132,"red",61,85],3,2]},"d":["green","yellow","violet",-46,48,"green"]}],["violet",["yellow"],["blue",{"e":-15,"c":{"e":["green","violet",0,3,183,165,-1,"orange","blue"],"a":"violet","d":20,"c":"violet","h":"yellow","b":60,"g":"violet","f":163,"i":135},"a":71,"b":{"c":[115,"green",25,"yellow","blue",66],"a":"yellow","b":"green"},"d":"violet","f":{"e":"yellow","c":"blue","a":"blue","b":59,"d":[69,71,"yellow","red",99,"green","yellow",144,43,-38]}},"yellow","blue","orange",55,{"c":[-9,-16,"green",100,28,"red","blue","blue",174],"a":-31,"b":106,"d":"violet"},"blue"],[141,[32,"orange",{"c":-6,"a":-7,"b":64},["blue",{"e":-24,"c":"yellow","a":153,"b":"orange","d":"blue","f":"violet"},"violet",-28,197,"yellow","green","green"],2,{"e":"violet","c":"red","a":"red","b":"yellow","d":"yellow"},["yellow"],"red"],["green",[-16,47],"blue",87,"red","green"],105,"violet",[[127,"violet",81],"red","blue",[193,178,-6],20,"red",61],-2,"blue",-35],{"c":-12,"a":189,"b":"red"},[12,196,["red",27,["violet","green",15,["yellow","green",152,56,187,"yellow",69],"violet"]],127,{"a":"yellow"},-35,[[180,{"c":"yellow","a":191,"b":"violet","d":"red"},41,33,-5],188,"red","violet",23,100,30,91,-15],"blue"],[[129,"blue",{"a":"red"},"violet","green",56,["yellow"],180,[156,"violet"],-49],48,"red",38,{"a":{"e":93,"a":"yellow","d":170,"c":{"e":116,"a":5,"d":89,"j":"blue","c":"blue","h":"red","b":"blue","g":-2,"f":"red","i":-7},"h":148,"b":149,"g":"red","f":-18,"i":-44}},101,183],[25,16,123]],{"e":{"c":"orange","a":{"e":[{"c":"green","a":"orange","b":100,"d":-30}],"a":187,"d":"green","c":{"a":122},"h":-10,"b":118,"g":-12,"f":63},"b":{"e":["violet","yellow","yellow",167,163,5],"a":-28,"d":[-2,61,"red",-18,"red",{"e":"yellow","a":"orange","d":"yellow","j":"green","c":"orange","h":-10,"b":-32,"g":115,"f":141,"i":164},"red",["violet",99,"orange","blue","orange","green","green","violet","yellow"]],"c":-24,"h":"blue","b":"violet","g":47,"f":156},"d":195},"a":{"a":[176]},"d":["violet",[["green",180,"violet","yellow"],{"e":133,"a":"violet","d":{"e":57,"a":"yellow","d":57,"j":"violet","c":"red","h":33,"b":"green","g":"yellow","f":"green","i":79},"j":"orange","c":"violet","h":62,"b":"blue","g":-37,"f":"violet","i":93},-43,"violet",103,"yellow",194,56],{"e":-19,"c":"yellow","a":"orange","b":-19,"d":"red","f":"yellow"}],"c":162,"h":[73,"green",[87,{"a":"green"}],[56,"green",[["green",-2,"green",-47,"yellow",-39,47],"red",129,[90,181,50,"green","green","green","blue",7,"violet"],-3,9,-12,171],"red","orange",159,["violet","yellow",77,86,"yellow","yellow","red",185],145,[81,133]],"yellow",-3,[{"c":["orange",108,82],"a":"violet","b":{"a":"yellow","b":"yellow"},"d":42}],"orange",[-27,["green",{"c":"violet","a":"violet","b":"orange","d":15},78],"red",23],"orange"],"b":{"e":"yellow","a":46,"d":[118,31,142,{"e":-48,"a":"blue","d":"green","c":"violet","h":69,"b":"orange","g":178,"f":"orange","i":"green"},{"e":109,"a":"orange","d":-7,"c":42,"h":168,"b":"blue","g":157,"f":{"a":93,"b":142},"i":38},[59,80],"orange",73,"violet"],"c":122,"h":{"e":153,"c":"yellow","a":11,"b":"orange","d":101},"b":"blue","g":"orange","f":[{"e":48,"c":-39,"a":77,"g":-33,"b":"yellow","d":30,"f":36},153,{"c":"violet","a":78,"b":63,"d":"orange"},117],"i":"red"},"g":"yellow","f":{"a":"orange","b":[{"a":87},"violet","orange",96,154,"orange","violet",{"a":[-45],"b":103}]}},"red"],[{"e":"violet","a":{"e":167,"a":{"e":"orange","c":{"e":"red","c":76,"a":"green","b":"violet","d":146,"f":152},"a":"violet","b":-8,"d":76,"f":"red"},"d":[102,"yellow","blue","blue",22,73],"c":"red","h":{"e":{"c":92,"a":178,"b":{"e":-43,"a":"yellow","d":136,"j":"red","c":193,"h":98,"b":"orange","g":49,"f":"yellow","i":"violet"}},"a":54,"d":138,"j":[0,[177,178],"red",52,[87,"violet",123,"orange","orange","yellow",48,"yellow"],"violet",100,"blue"],"c":3,"h":"green","b":175,"g":{"e":[175,-25,-47,"orange",60,185],"a":["orange",-49,156],"d":"yellow","j":8,"c":-28,"h":129,"b":[89,-12,67,"green",195,"red","violet",150,"red",106],"g":"violet","f":-29,"i":123},"f":"orange","i":71},"b":[172,["yellow","violet","green","blue",194],-46,{"a":102,"b":"green"}],"g":[{"e":{"c":23,"a":"yellow","b":-25},"a":"blue","d":"green","j":185,"c":"yellow","h":["orange","violet",-21],"b":{"c":191,"a":197,"b":"yellow"},"g":115,"f":-41,"i":"blue"},-17,[-23,64,"red",8,"orange",[105,-11,29,-23,30,65,15],170],"yellow","yellow",-46,"green","orange",143],"f":177},"d":"red","c":"red","h":135,"b":{"e":"red","a":"orange","d":["violet",[23,"red","violet","orange",66,{"c":"orange","a":"green","b":169,"d":57},"blue",125,"green"],110,135,[-40,"violet","yellow",-26,-23,44],"orange",28],"c":"orange","h":107,"b":91,"g":105,"f":{"e":{"e":164,"c":180,"a":"blue","b":"yellow","d":144},"c":"violet","a":"violet","g":95,"b":"red","d":"violet","f":"green"},"i":156},"g":["violet",108,["blue","yellow","red",[23,"yellow",3,159,112],{"e":-41,"c":"green","a":22,"b":"violet","d":"blue","f":"blue"},"violet",-27,"green","violet",-17],"green",{"e":{"e":[-19,96,-28,"orange"],"c":"yellow","a":"yellow","g":124,"b":97,"d":{"a":"blue"},"f":"green"},"a":46,"d":["blue",118,"yellow","yellow","yellow","green",["yellow",-10,90,167,"red",54,-15]],"j":106,"c":"red","h":[{"e":"red","c":28,"a":"yellow","b":170,"d":"blue","f":105},-40,"orange",188,"yellow",142],"b":117,"g":"violet","f":{"a":[-5,"red",46,182,"red","orange"]},"i":"yellow"},["orange",88,18,{"e":"blue","a":"violet","d":"blue","c":"violet","h":"violet","b":196,"g":103,"f":67,"i":13}],"blue","blue"],"f":-19,"i":{"a":166}},164],[{"e":{"e":"blue","a":13,"d":{"e":{"e":"orange","a":88,"d":"red","c":"yellow","h":[93,79],"b":"orange","g":109,"f":34,"i":-13},"a":-44,"d":"red","j":[173,78,"red",{"e":"yellow","a":-32,"d":"blue","j":"violet","c":"blue","h":119,"b":"green","g":-30,"f":193,"i":95},"orange",-43,-16],"c":["green",{"e":41,"c":"red","a":109,"b":159,"d":59},173,18,"violet",21,"red"],"h":"blue","b":44,"g":{"a":129,"b":-10},"f":-26,"i":27},"j":"red","c":{"a":{"c":-28,"a":"green","b":188,"d":"blue"},"b":"blue"},"h":[183,[118,[-7,"orange"],132,[23,175,"yellow","green",11,178,171,"orange","blue",18],134,1,"green",[-9,99],103,-25],"red",[65,"red","blue"],"violet","blue"],"b":"yellow","g":164,"f":-9,"i":{"c":51,"a":"green","b":115,"d":{"a":27,"b":"red"}}},"a":[{"e":[143,"violet",128,"red","yellow",185,"green","red","red"],"a":29,"d":"red","c":170,"h":[131,"violet",96,{"a":"yellow","b":"green"},139,22,176,"yellow",[-46,-14,"red","blue",83,141],[132,108,"blue","blue","green",197,"yellow"]],"b":"blue","g":"orange","f":"yellow","i":[-9]},"violet",56,[169,12,155,["red",197,{"e":"violet","a":22,"d":"violet","c":84,"h":"red","b":70,"g":"violet","f":-41},47,"violet"],[["green","green",179,56,"green","violet",171,"violet","violet"],"blue","red","green",-17,"green",190],"green","red",146,60],"yellow","red","yellow","violet"],"d":[[141,40,"yellow",1,"blue","green","yellow",{"e":13,"a":"blue","d":"red","c":"red","h":176,"b":"violet","g":164,"f":4,"i":"violet"}]],"c":72,"h":15,"b":"yellow","g":{"e":[-12,"blue",["red","blue",11],29,{"e":59,"c":"red","a":{"e":55,"a":"blue","d":"orange","c":"yellow","h":"violet","b":-19,"g":"green","f":"violet","i":197},"b":"orange","d":"violet","f":90},[-14,154,"violet","orange",74,{"e":"yellow","a":"violet","d":66,"c":"yellow","h":80,"b":"yellow","g":"yellow","f":"orange","i":"blue"},"green","red",116,149],"green",108],"c":{"c":28,"a":"blue","b":"yellow","d":"blue"},"a":36,"b":["orange","green","orange","green","red",46,55,"blue",["violet",98,[163,-35,163,-28],"blue","red",155,"blue"],-8],"d":163},"f":[9,"green",{"c":"green","a":"violet","b":68,"d":"yellow"},114,33,1,-25]},["red",[-20,{"c":"yellow","a":"red","b":"green","d":{"a":"red"}},"red",[[141,76],[174],100,{"e":126,"c":39,"a":["violet",94,"orange",102,"blue"],"b":55,"d":"yellow","f":"yellow"},146,{"c":169,"a":"red","b":"red"},[["green",-48,"violet","orange"],[80,-7,-22,"yellow","orange","yellow",185,"orange"],"green","violet","orange"],"red"],"yellow"],[{"a":["orange","blue"],"b":[{"a":-42,"b":"violet"},"green",99,-20,"blue"]},{"c":"blue","a":"violet","b":14,"d":9},"green",{"c":["blue",148,[38,139,125,52,"red",40,190,"yellow",21,"violet"],"violet",110,"green"],"a":{"c":97,"a":[35,"orange",44,"red",87,"orange","blue",61,"yellow"],"b":176,"d":144},"b":137},85,[192,-37,"orange",{"c":"yellow","a":-10,"b":[71]},"yellow",176,["green",14],{"a":102},-39],"violet",164],-9,"blue",[["blue"],70]]]] diff --git a/2015/12/puzzle-1.sh b/2015/12/puzzle-1.sh new file mode 100755 index 0000000..7b509fe --- /dev/null +++ b/2015/12/puzzle-1.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +tr -c '\-0-9' '\n' <input | squash | paste -sd+ | bc diff --git a/2015/12/puzzle-2.sh b/2015/12/puzzle-2.sh new file mode 100755 index 0000000..e97fc8a --- /dev/null +++ b/2015/12/puzzle-2.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +jq 'walk(if type == "object" then del(select(.[] == "red")) end)' input \ + | tr -c '\-0-9' '\n' \ + | squash \ + | paste -sd+ \ + | bc diff --git a/2015/14/input b/2015/14/input new file mode 100644 index 0000000..2af1170 --- /dev/null +++ b/2015/14/input @@ -0,0 +1,9 @@ +Vixen can fly 19 km/s for 7 seconds, but then must rest for 124 seconds. +Rudolph can fly 3 km/s for 15 seconds, but then must rest for 28 seconds. +Donner can fly 19 km/s for 9 seconds, but then must rest for 164 seconds. +Blitzen can fly 19 km/s for 9 seconds, but then must rest for 158 seconds. +Comet can fly 13 km/s for 7 seconds, but then must rest for 82 seconds. +Cupid can fly 25 km/s for 6 seconds, but then must rest for 145 seconds. +Dasher can fly 14 km/s for 3 seconds, but then must rest for 38 seconds. +Dancer can fly 3 km/s for 16 seconds, but then must rest for 37 seconds. +Prancer can fly 25 km/s for 6 seconds, but then must rest for 143 seconds. diff --git a/2015/14/puzzle-1.bc b/2015/14/puzzle-1.bc new file mode 100644 index 0000000..d36cafd --- /dev/null +++ b/2015/14/puzzle-1.bc @@ -0,0 +1,25 @@ +/* Return the largest element from array `a` of length `l` */ +define max(a[], l) +{ + auto m, i + for (i = 0; i < l; i++) { + if (a[i] > m) + m = a[i] + } + return m +} + +/* Return the kilometers traveled by a raindeer that flys with speed `s` km/s for `t` seconds before + * needing to rest for `r` seconds. + */ +define calc(s, t, r) +{ + auto a, d + while (d + t <= 2503) { + a += s * t + d += t + r + } + if (d < 2503) + a += s * (2503 - d) + return a +} diff --git a/2015/14/puzzle-2.bc b/2015/14/puzzle-2.bc new file mode 100644 index 0000000..4a41277 --- /dev/null +++ b/2015/14/puzzle-2.bc @@ -0,0 +1,33 @@ +scale = 0 + +/* Return the largest element from array `a` of length `l` */ +define max(a[], l) +{ + auto m, i + for (i = 0; i < l; i++) { + if (a[i] > m) + m = a[i] + } + return m +} + +define calc(speed[], time[], rest[], n) +{ + auto i, j, k, p[], d[] + + for (i = 0; i < 2503; i++) { + for (j = k = 0; j < n; j++) { + if (i % (time[j] + rest[j]) < time[j]) + d[j] += speed[j] + if (d[j] > k) + k = d[j] + } + + for (j = 0; j < n; j++) { + if (d[j] == k) + p[j] += 1 + } + } + + return max(p[], n) +} diff --git a/2015/14/puzzles.sh b/2015/14/puzzles.sh new file mode 100755 index 0000000..b55642d --- /dev/null +++ b/2015/14/puzzles.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +# I use bc-gh(1), but it's just Gavin Howards implementation of bc(1) + +sed -e 's|[^0-9]*\([0-9]*\)[^0-9]*\([0-9]*\)[^0-9]*\([0-9]*\).*|x[y++] = calc(\1, \2, \3)|' \ + -e '$amax(x[], y)' input \ + | bc-gh -q puzzle-1.bc + +sed -e 's|[^0-9]*\([0-9]*\)[^0-9]*\([0-9]*\)[^0-9]*\([0-9]*\).*|speed[n] = \1; time[n] = \2; rest[n++] = \3|' \ + -e '$acalc(speed[], time[], rest[], n)' input \ + | bc-gh -q puzzle-2.bc diff --git a/2015/15/input b/2015/15/input new file mode 100644 index 0000000..d1af06e --- /dev/null +++ b/2015/15/input @@ -0,0 +1,4 @@ +Sugar: capacity 3, durability 0, flavor 0, texture -3, calories 2 +Sprinkles: capacity -3, durability 3, flavor 0, texture 0, calories 9 +Candy: capacity -1, durability 0, flavor 4, texture 0, calories 1 +Chocolate: capacity 0, durability 0, flavor -2, texture 2, calories 8 diff --git a/2015/15/puzzle-1.py b/2015/15/puzzle-1.py new file mode 100755 index 0000000..806737c --- /dev/null +++ b/2015/15/puzzle-1.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +from math import prod +import itertools +import re + + +def main() -> None: + data: list[list[int]] = [] + with open("input", "r", encoding="utf-8") as f: + for line in f.readlines(): + m = re.match( + r"[^\-0-9]+([\-0-9]+)[^\-0-9]+([\-0-9]+)[^\-0-9]+([\-0-9]+)[^\-0-9]+([\-0-9]+)", + line, + ) + data.append([int(m.group(1)), int(m.group(2)), int(m.group(3)), int(m.group(4))]) + + total: int = 0 + for i in range(100): + for j in range(100 - i): + for k in range(100 - i - j): + if i + j + k > 100: + continue + h = 100 - i - j - k + + parts: list[int] = [] + parts.append(data[0][0] * i + data[1][0] * j + data[2][0] * k + data[3][0] * h) + parts.append(data[0][1] * i + data[1][1] * j + data[2][1] * k + data[3][1] * h) + parts.append(data[0][2] * i + data[1][2] * j + data[2][2] * k + data[3][2] * h) + parts.append(data[0][3] * i + data[1][3] * j + data[2][3] * k + data[3][3] * h) + + if not any(map(lambda x: x < 0, parts)): + total = max(total, prod(parts)) + + print(total) + + +if __name__ == "__main__": + main() diff --git a/2015/15/puzzle-2.py b/2015/15/puzzle-2.py new file mode 100755 index 0000000..ec03a82 --- /dev/null +++ b/2015/15/puzzle-2.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 + +from math import prod +import itertools +import re + + +def main() -> None: + data: list[list[int]] = [] + with open("input", "r", encoding="utf-8") as f: + for line in f.readlines(): + m = re.match( + r"[^\-0-9]+([\-0-9]+)[^\-0-9]+([\-0-9]+)[^\-0-9]+([\-0-9]+)[^\-0-9]+([\-0-9]+)[^\-0-9]+([0-9]+)", + line, + ) + data.append(list(map(int, [m.group(i) for i in range(1, 6)]))) + + total: int = 0 + for i in range(100): + for j in range(100 - i): + for k in range(100 - i - j): + if i + j + k > 100: + continue + h = 100 - i - j - k + if data[0][4] * i + data[1][4] * j + data[2][4] * k + data[3][4] * h != 500: + continue + + parts: list[int] = [] + parts.append(data[0][0] * i + data[1][0] * j + data[2][0] * k + data[3][0] * h) + parts.append(data[0][1] * i + data[1][1] * j + data[2][1] * k + data[3][1] * h) + parts.append(data[0][2] * i + data[1][2] * j + data[2][2] * k + data[3][2] * h) + parts.append(data[0][3] * i + data[1][3] * j + data[2][3] * k + data[3][3] * h) + + if not any(map(lambda x: x < 0, parts)): + total = max(total, prod(parts)) + + print(total) + + +if __name__ == "__main__": + main() diff --git a/2015/16/input b/2015/16/input new file mode 100644 index 0000000..ddaeefc --- /dev/null +++ b/2015/16/input @@ -0,0 +1,500 @@ +Sue 1: cars: 9, akitas: 3, goldfish: 0 +Sue 2: akitas: 9, children: 3, samoyeds: 9 +Sue 3: trees: 6, cars: 6, children: 4 +Sue 4: trees: 4, vizslas: 4, goldfish: 9 +Sue 5: akitas: 9, vizslas: 7, cars: 5 +Sue 6: vizslas: 6, goldfish: 6, akitas: 3 +Sue 7: pomeranians: 5, samoyeds: 0, perfumes: 10 +Sue 8: cars: 10, pomeranians: 7, goldfish: 8 +Sue 9: trees: 2, vizslas: 7, samoyeds: 6 +Sue 10: perfumes: 5, pomeranians: 4, children: 9 +Sue 11: vizslas: 5, perfumes: 8, cars: 10 +Sue 12: children: 10, cars: 6, perfumes: 5 +Sue 13: cats: 4, samoyeds: 7, pomeranians: 8 +Sue 14: perfumes: 6, goldfish: 10, children: 7 +Sue 15: perfumes: 4, pomeranians: 3, cars: 6 +Sue 16: perfumes: 7, cars: 9, pomeranians: 6 +Sue 17: goldfish: 3, cars: 6, vizslas: 7 +Sue 18: perfumes: 6, cars: 7, goldfish: 3 +Sue 19: trees: 0, akitas: 3, pomeranians: 8 +Sue 20: goldfish: 6, trees: 2, akitas: 6 +Sue 21: pomeranians: 9, akitas: 9, samoyeds: 9 +Sue 22: vizslas: 2, cars: 9, perfumes: 5 +Sue 23: goldfish: 10, samoyeds: 8, children: 9 +Sue 24: akitas: 4, goldfish: 1, vizslas: 5 +Sue 25: goldfish: 10, trees: 8, perfumes: 6 +Sue 26: vizslas: 5, akitas: 8, trees: 1 +Sue 27: trees: 3, cars: 6, perfumes: 2 +Sue 28: goldfish: 8, trees: 7, akitas: 10 +Sue 29: children: 5, trees: 1, goldfish: 10 +Sue 30: vizslas: 3, perfumes: 8, akitas: 3 +Sue 31: cars: 6, children: 10, perfumes: 7 +Sue 32: cars: 10, perfumes: 3, goldfish: 10 +Sue 33: perfumes: 9, vizslas: 3, akitas: 4 +Sue 34: perfumes: 10, vizslas: 7, children: 8 +Sue 35: cars: 5, perfumes: 5, vizslas: 9 +Sue 36: trees: 9, cars: 9, akitas: 7 +Sue 37: samoyeds: 9, perfumes: 2, cars: 10 +Sue 38: akitas: 7, cars: 5, trees: 5 +Sue 39: goldfish: 8, trees: 9, cars: 10 +Sue 40: trees: 0, cats: 1, pomeranians: 1 +Sue 41: pomeranians: 6, perfumes: 9, samoyeds: 1 +Sue 42: vizslas: 6, akitas: 3, pomeranians: 1 +Sue 43: vizslas: 2, perfumes: 3, pomeranians: 6 +Sue 44: akitas: 5, pomeranians: 0, vizslas: 10 +Sue 45: vizslas: 4, goldfish: 1, cars: 5 +Sue 46: cars: 4, vizslas: 8, cats: 0 +Sue 47: cats: 5, children: 8, pomeranians: 2 +Sue 48: vizslas: 3, perfumes: 6, cats: 0 +Sue 49: akitas: 7, perfumes: 0, trees: 7 +Sue 50: trees: 4, akitas: 10, vizslas: 2 +Sue 51: goldfish: 10, cars: 9, trees: 4 +Sue 52: cars: 5, children: 9, perfumes: 0 +Sue 53: vizslas: 5, cars: 3, cats: 8 +Sue 54: cars: 5, akitas: 1, goldfish: 10 +Sue 55: akitas: 10, vizslas: 2, cars: 6 +Sue 56: cats: 6, trees: 0, cars: 4 +Sue 57: vizslas: 1, akitas: 1, samoyeds: 7 +Sue 58: samoyeds: 6, vizslas: 1, akitas: 7 +Sue 59: akitas: 9, cars: 8, vizslas: 1 +Sue 60: cars: 6, vizslas: 7, goldfish: 0 +Sue 61: pomeranians: 5, akitas: 6, vizslas: 2 +Sue 62: samoyeds: 2, cats: 8, goldfish: 7 +Sue 63: vizslas: 10, goldfish: 7, samoyeds: 9 +Sue 64: perfumes: 2, trees: 1, akitas: 6 +Sue 65: cars: 8, perfumes: 10, vizslas: 9 +Sue 66: akitas: 8, vizslas: 8, perfumes: 8 +Sue 67: goldfish: 7, cars: 9, samoyeds: 9 +Sue 68: perfumes: 2, children: 7, akitas: 1 +Sue 69: perfumes: 7, vizslas: 9, akitas: 1 +Sue 70: samoyeds: 3, vizslas: 1, trees: 1 +Sue 71: vizslas: 8, goldfish: 7, trees: 9 +Sue 72: goldfish: 8, cars: 6, trees: 9 +Sue 73: perfumes: 5, cars: 10, samoyeds: 7 +Sue 74: pomeranians: 4, perfumes: 3, cars: 5 +Sue 75: samoyeds: 1, perfumes: 1, pomeranians: 1 +Sue 76: goldfish: 4, cats: 6, akitas: 7 +Sue 77: perfumes: 5, akitas: 4, vizslas: 8 +Sue 78: perfumes: 4, cats: 3, children: 4 +Sue 79: vizslas: 5, pomeranians: 9, samoyeds: 7 +Sue 80: cars: 3, samoyeds: 5, pomeranians: 7 +Sue 81: vizslas: 2, samoyeds: 4, perfumes: 2 +Sue 82: trees: 1, akitas: 10, vizslas: 9 +Sue 83: vizslas: 0, akitas: 2, samoyeds: 5 +Sue 84: perfumes: 5, vizslas: 7, children: 8 +Sue 85: cats: 3, children: 2, trees: 0 +Sue 86: cars: 3, perfumes: 2, goldfish: 2 +Sue 87: trees: 1, akitas: 7, vizslas: 0 +Sue 88: trees: 1, akitas: 2, samoyeds: 1 +Sue 89: cars: 4, vizslas: 8, akitas: 1 +Sue 90: perfumes: 5, cats: 3, vizslas: 0 +Sue 91: samoyeds: 7, cats: 6, goldfish: 8 +Sue 92: samoyeds: 10, cats: 0, cars: 7 +Sue 93: cars: 6, akitas: 7, samoyeds: 2 +Sue 94: perfumes: 0, goldfish: 6, trees: 9 +Sue 95: cars: 6, pomeranians: 2, samoyeds: 8 +Sue 96: cars: 2, trees: 9, samoyeds: 4 +Sue 97: goldfish: 5, trees: 1, children: 0 +Sue 98: akitas: 9, goldfish: 7, children: 6 +Sue 99: goldfish: 9, akitas: 0, pomeranians: 0 +Sue 100: samoyeds: 6, children: 8, vizslas: 5 +Sue 101: vizslas: 6, cars: 5, goldfish: 4 +Sue 102: vizslas: 6, akitas: 2, perfumes: 6 +Sue 103: samoyeds: 3, akitas: 7, children: 4 +Sue 104: cars: 3, perfumes: 10, cats: 6 +Sue 105: vizslas: 9, pomeranians: 0, cars: 1 +Sue 106: cats: 6, samoyeds: 8, pomeranians: 5 +Sue 107: cars: 7, trees: 4, akitas: 10 +Sue 108: perfumes: 3, vizslas: 1, goldfish: 9 +Sue 109: trees: 6, cars: 8, goldfish: 5 +Sue 110: pomeranians: 2, children: 1, vizslas: 7 +Sue 111: akitas: 0, vizslas: 8, cars: 0 +Sue 112: goldfish: 3, vizslas: 6, akitas: 2 +Sue 113: akitas: 10, pomeranians: 7, perfumes: 7 +Sue 114: cars: 10, cats: 2, vizslas: 8 +Sue 115: akitas: 8, trees: 1, vizslas: 2 +Sue 116: vizslas: 2, akitas: 7, perfumes: 1 +Sue 117: goldfish: 0, vizslas: 10, trees: 9 +Sue 118: trees: 3, cars: 0, goldfish: 0 +Sue 119: perfumes: 7, goldfish: 5, trees: 9 +Sue 120: children: 9, vizslas: 3, trees: 5 +Sue 121: vizslas: 1, goldfish: 7, akitas: 10 +Sue 122: perfumes: 1, cars: 6, trees: 1 +Sue 123: akitas: 2, vizslas: 0, goldfish: 7 +Sue 124: vizslas: 10, pomeranians: 7, akitas: 0 +Sue 125: perfumes: 4, cats: 5, vizslas: 2 +Sue 126: cars: 6, samoyeds: 8, akitas: 3 +Sue 127: trees: 9, goldfish: 7, akitas: 9 +Sue 128: cars: 8, trees: 0, perfumes: 2 +Sue 129: pomeranians: 7, vizslas: 2, perfumes: 6 +Sue 130: vizslas: 9, pomeranians: 3, trees: 6 +Sue 131: vizslas: 7, cars: 9, perfumes: 1 +Sue 132: akitas: 2, pomeranians: 9, vizslas: 7 +Sue 133: trees: 9, pomeranians: 10, samoyeds: 0 +Sue 134: children: 4, akitas: 10, perfumes: 4 +Sue 135: vizslas: 1, cats: 1, trees: 8 +Sue 136: samoyeds: 7, cars: 8, goldfish: 5 +Sue 137: perfumes: 0, children: 1, pomeranians: 10 +Sue 138: vizslas: 4, perfumes: 5, cars: 5 +Sue 139: trees: 2, perfumes: 8, goldfish: 0 +Sue 140: cars: 10, akitas: 5, goldfish: 7 +Sue 141: children: 4, trees: 3, goldfish: 8 +Sue 142: cars: 8, perfumes: 6, trees: 7 +Sue 143: akitas: 6, goldfish: 0, trees: 10 +Sue 144: akitas: 7, pomeranians: 10, perfumes: 10 +Sue 145: trees: 10, vizslas: 3, goldfish: 4 +Sue 146: samoyeds: 4, akitas: 3, perfumes: 6 +Sue 147: akitas: 8, perfumes: 2, pomeranians: 10 +Sue 148: cars: 2, perfumes: 0, goldfish: 8 +Sue 149: goldfish: 6, akitas: 7, perfumes: 6 +Sue 150: cars: 2, pomeranians: 5, perfumes: 4 +Sue 151: goldfish: 1, cars: 5, trees: 0 +Sue 152: pomeranians: 4, cars: 7, children: 1 +Sue 153: goldfish: 8, cars: 1, children: 10 +Sue 154: cars: 6, perfumes: 8, trees: 1 +Sue 155: akitas: 4, perfumes: 6, pomeranians: 2 +Sue 156: pomeranians: 5, cars: 4, akitas: 1 +Sue 157: cats: 5, cars: 9, goldfish: 8 +Sue 158: vizslas: 5, samoyeds: 1, children: 7 +Sue 159: vizslas: 1, perfumes: 3, akitas: 1 +Sue 160: goldfish: 10, pomeranians: 9, perfumes: 5 +Sue 161: samoyeds: 3, trees: 7, cars: 2 +Sue 162: cars: 2, pomeranians: 1, vizslas: 6 +Sue 163: vizslas: 3, perfumes: 5, akitas: 6 +Sue 164: vizslas: 1, trees: 0, akitas: 5 +Sue 165: vizslas: 5, cars: 6, pomeranians: 8 +Sue 166: cars: 10, perfumes: 2, trees: 9 +Sue 167: cars: 10, pomeranians: 6, perfumes: 4 +Sue 168: akitas: 7, trees: 10, goldfish: 7 +Sue 169: akitas: 1, perfumes: 10, cars: 10 +Sue 170: akitas: 5, samoyeds: 8, vizslas: 6 +Sue 171: children: 3, akitas: 2, vizslas: 3 +Sue 172: goldfish: 5, vizslas: 5, perfumes: 9 +Sue 173: perfumes: 5, goldfish: 10, trees: 5 +Sue 174: akitas: 5, vizslas: 2, children: 7 +Sue 175: perfumes: 5, cars: 7, samoyeds: 2 +Sue 176: cars: 8, vizslas: 10, akitas: 7 +Sue 177: perfumes: 7, children: 8, goldfish: 7 +Sue 178: cars: 1, pomeranians: 9, samoyeds: 0 +Sue 179: perfumes: 6, cars: 2, trees: 6 +Sue 180: trees: 3, vizslas: 7, children: 3 +Sue 181: vizslas: 8, samoyeds: 2, trees: 9 +Sue 182: perfumes: 3, cats: 1, children: 5 +Sue 183: akitas: 9, cats: 6, children: 3 +Sue 184: pomeranians: 9, cars: 6, perfumes: 8 +Sue 185: vizslas: 9, trees: 0, akitas: 9 +Sue 186: perfumes: 6, cars: 5, goldfish: 5 +Sue 187: perfumes: 4, cats: 7, vizslas: 2 +Sue 188: akitas: 7, cars: 4, children: 10 +Sue 189: akitas: 0, goldfish: 7, vizslas: 5 +Sue 190: akitas: 5, cars: 5, cats: 6 +Sue 191: cars: 6, children: 0, perfumes: 3 +Sue 192: cats: 2, perfumes: 10, goldfish: 7 +Sue 193: trees: 1, perfumes: 0, cars: 8 +Sue 194: perfumes: 9, children: 4, cats: 6 +Sue 195: akitas: 7, trees: 3, goldfish: 6 +Sue 196: goldfish: 8, cars: 8, samoyeds: 0 +Sue 197: cats: 0, akitas: 10, vizslas: 0 +Sue 198: goldfish: 1, perfumes: 3, cars: 8 +Sue 199: akitas: 10, vizslas: 5, samoyeds: 6 +Sue 200: pomeranians: 9, goldfish: 9, samoyeds: 7 +Sue 201: samoyeds: 0, goldfish: 7, akitas: 6 +Sue 202: vizslas: 0, goldfish: 2, akitas: 1 +Sue 203: goldfish: 3, children: 0, vizslas: 8 +Sue 204: cars: 8, trees: 2, perfumes: 2 +Sue 205: cars: 4, perfumes: 5, goldfish: 8 +Sue 206: vizslas: 3, trees: 2, akitas: 1 +Sue 207: cars: 7, goldfish: 5, trees: 1 +Sue 208: goldfish: 1, cars: 6, vizslas: 8 +Sue 209: cats: 4, trees: 1, children: 0 +Sue 210: cats: 10, children: 0, perfumes: 0 +Sue 211: cars: 4, pomeranians: 7, samoyeds: 5 +Sue 212: cars: 2, pomeranians: 10, trees: 1 +Sue 213: trees: 10, cats: 5, cars: 10 +Sue 214: perfumes: 5, trees: 1, vizslas: 1 +Sue 215: akitas: 10, vizslas: 8, samoyeds: 8 +Sue 216: vizslas: 2, cats: 5, pomeranians: 3 +Sue 217: akitas: 10, perfumes: 0, cats: 10 +Sue 218: trees: 8, cats: 5, vizslas: 2 +Sue 219: goldfish: 10, perfumes: 8, children: 2 +Sue 220: samoyeds: 9, trees: 8, vizslas: 7 +Sue 221: children: 7, trees: 6, cars: 6 +Sue 222: cats: 4, akitas: 5, pomeranians: 0 +Sue 223: trees: 8, goldfish: 2, perfumes: 8 +Sue 224: pomeranians: 9, cars: 8, akitas: 5 +Sue 225: akitas: 10, vizslas: 0, trees: 2 +Sue 226: akitas: 8, cats: 6, cars: 7 +Sue 227: trees: 1, akitas: 3, goldfish: 4 +Sue 228: pomeranians: 6, cats: 3, goldfish: 3 +Sue 229: trees: 10, perfumes: 3, vizslas: 7 +Sue 230: perfumes: 8, cars: 7, akitas: 0 +Sue 231: perfumes: 10, goldfish: 4, cars: 6 +Sue 232: goldfish: 7, trees: 3, cats: 2 +Sue 233: perfumes: 6, trees: 4, akitas: 4 +Sue 234: goldfish: 9, cats: 4, cars: 7 +Sue 235: pomeranians: 6, vizslas: 0, akitas: 6 +Sue 236: samoyeds: 5, cars: 5, children: 4 +Sue 237: vizslas: 10, cars: 4, goldfish: 4 +Sue 238: goldfish: 3, samoyeds: 7, akitas: 2 +Sue 239: cats: 8, children: 2, vizslas: 7 +Sue 240: cars: 9, perfumes: 4, trees: 9 +Sue 241: trees: 8, vizslas: 2, goldfish: 5 +Sue 242: cars: 6, trees: 3, vizslas: 3 +Sue 243: cats: 6, children: 7, cars: 4 +Sue 244: cats: 10, perfumes: 2, goldfish: 7 +Sue 245: akitas: 8, cats: 10, perfumes: 8 +Sue 246: vizslas: 8, akitas: 5, perfumes: 10 +Sue 247: goldfish: 2, vizslas: 5, akitas: 7 +Sue 248: akitas: 3, perfumes: 0, trees: 10 +Sue 249: cats: 4, vizslas: 5, pomeranians: 6 +Sue 250: children: 3, vizslas: 7, perfumes: 2 +Sue 251: cars: 0, pomeranians: 10, perfumes: 0 +Sue 252: akitas: 0, goldfish: 9, cars: 6 +Sue 253: perfumes: 7, cars: 4, samoyeds: 5 +Sue 254: akitas: 9, trees: 10, cars: 4 +Sue 255: samoyeds: 10, children: 6, akitas: 7 +Sue 256: trees: 8, goldfish: 8, perfumes: 8 +Sue 257: goldfish: 3, akitas: 2, perfumes: 6 +Sue 258: cats: 7, trees: 0, vizslas: 1 +Sue 259: perfumes: 7, cars: 7, akitas: 7 +Sue 260: goldfish: 0, vizslas: 0, samoyeds: 2 +Sue 261: vizslas: 2, children: 2, cats: 3 +Sue 262: vizslas: 2, pomeranians: 9, samoyeds: 3 +Sue 263: cats: 1, akitas: 3, vizslas: 1 +Sue 264: pomeranians: 10, trees: 2, goldfish: 7 +Sue 265: samoyeds: 5, trees: 7, perfumes: 4 +Sue 266: perfumes: 10, cars: 1, pomeranians: 3 +Sue 267: trees: 6, goldfish: 1, cars: 0 +Sue 268: cars: 6, samoyeds: 4, pomeranians: 5 +Sue 269: goldfish: 3, vizslas: 3, akitas: 3 +Sue 270: children: 5, cats: 0, cars: 4 +Sue 271: goldfish: 3, perfumes: 8, pomeranians: 7 +Sue 272: samoyeds: 6, cars: 7, perfumes: 10 +Sue 273: trees: 4, cars: 2, vizslas: 7 +Sue 274: samoyeds: 10, perfumes: 9, goldfish: 6 +Sue 275: cars: 4, trees: 2, perfumes: 7 +Sue 276: akitas: 3, perfumes: 9, cars: 9 +Sue 277: akitas: 8, vizslas: 2, cats: 6 +Sue 278: trees: 5, goldfish: 7, akitas: 3 +Sue 279: perfumes: 9, cars: 8, vizslas: 2 +Sue 280: trees: 3, vizslas: 0, children: 0 +Sue 281: cars: 7, trees: 2, cats: 5 +Sue 282: vizslas: 4, cars: 10, cats: 3 +Sue 283: akitas: 10, cats: 3, samoyeds: 9 +Sue 284: trees: 7, children: 5, goldfish: 6 +Sue 285: cars: 2, perfumes: 5, cats: 7 +Sue 286: samoyeds: 5, trees: 10, goldfish: 6 +Sue 287: goldfish: 10, perfumes: 4, trees: 7 +Sue 288: vizslas: 9, trees: 9, perfumes: 0 +Sue 289: trees: 4, goldfish: 9, vizslas: 8 +Sue 290: vizslas: 3, cars: 3, trees: 2 +Sue 291: goldfish: 2, akitas: 2, trees: 2 +Sue 292: children: 1, cars: 0, vizslas: 5 +Sue 293: trees: 5, akitas: 4, goldfish: 6 +Sue 294: akitas: 3, vizslas: 7, pomeranians: 5 +Sue 295: goldfish: 10, vizslas: 3, trees: 1 +Sue 296: cars: 2, trees: 1, akitas: 0 +Sue 297: akitas: 10, vizslas: 6, samoyeds: 2 +Sue 298: children: 5, trees: 1, samoyeds: 9 +Sue 299: perfumes: 9, trees: 6, vizslas: 1 +Sue 300: akitas: 7, pomeranians: 6, vizslas: 6 +Sue 301: cats: 7, children: 6, vizslas: 7 +Sue 302: trees: 2, vizslas: 7, samoyeds: 4 +Sue 303: goldfish: 0, samoyeds: 10, cars: 4 +Sue 304: pomeranians: 9, children: 3, vizslas: 5 +Sue 305: akitas: 8, vizslas: 4, cars: 5 +Sue 306: akitas: 0, perfumes: 2, pomeranians: 10 +Sue 307: akitas: 9, cars: 0, trees: 2 +Sue 308: vizslas: 10, goldfish: 8, akitas: 6 +Sue 309: trees: 0, cats: 6, perfumes: 2 +Sue 310: vizslas: 10, cars: 1, trees: 4 +Sue 311: goldfish: 8, perfumes: 6, cats: 3 +Sue 312: goldfish: 0, children: 1, akitas: 2 +Sue 313: pomeranians: 10, trees: 6, samoyeds: 6 +Sue 314: vizslas: 5, akitas: 4, pomeranians: 2 +Sue 315: goldfish: 7, trees: 0, akitas: 5 +Sue 316: goldfish: 4, vizslas: 5, cars: 7 +Sue 317: perfumes: 7, cats: 10, cars: 4 +Sue 318: samoyeds: 10, cars: 9, trees: 7 +Sue 319: pomeranians: 8, vizslas: 6, cars: 3 +Sue 320: cars: 4, cats: 9, akitas: 4 +Sue 321: cars: 6, trees: 2, perfumes: 6 +Sue 322: goldfish: 1, cats: 2, perfumes: 4 +Sue 323: akitas: 6, cats: 5, cars: 8 +Sue 324: cats: 4, vizslas: 9, akitas: 0 +Sue 325: children: 8, samoyeds: 9, trees: 4 +Sue 326: vizslas: 2, samoyeds: 10, perfumes: 7 +Sue 327: goldfish: 7, pomeranians: 4, akitas: 10 +Sue 328: perfumes: 8, cats: 4, akitas: 10 +Sue 329: trees: 0, cars: 9, goldfish: 3 +Sue 330: trees: 5, samoyeds: 7, perfumes: 8 +Sue 331: cars: 4, perfumes: 2, goldfish: 0 +Sue 332: vizslas: 4, pomeranians: 7, akitas: 1 +Sue 333: akitas: 4, goldfish: 3, perfumes: 0 +Sue 334: samoyeds: 3, akitas: 10, vizslas: 0 +Sue 335: goldfish: 1, akitas: 7, vizslas: 6 +Sue 336: perfumes: 1, goldfish: 1, pomeranians: 8 +Sue 337: children: 5, cars: 4, cats: 4 +Sue 338: vizslas: 5, cars: 10, cats: 3 +Sue 339: trees: 2, goldfish: 3, cars: 1 +Sue 340: trees: 10, goldfish: 6, perfumes: 2 +Sue 341: akitas: 5, trees: 6, cats: 3 +Sue 342: cars: 10, children: 8, goldfish: 0 +Sue 343: cats: 2, akitas: 0, pomeranians: 4 +Sue 344: perfumes: 1, vizslas: 3, cars: 3 +Sue 345: samoyeds: 8, cats: 5, perfumes: 8 +Sue 346: cars: 5, akitas: 10, trees: 2 +Sue 347: vizslas: 9, akitas: 9, cars: 3 +Sue 348: cars: 3, perfumes: 1, pomeranians: 9 +Sue 349: akitas: 1, cars: 4, perfumes: 0 +Sue 350: perfumes: 8, vizslas: 2, trees: 6 +Sue 351: pomeranians: 5, akitas: 9, cats: 8 +Sue 352: pomeranians: 8, vizslas: 3, goldfish: 10 +Sue 353: trees: 2, pomeranians: 0, goldfish: 6 +Sue 354: cats: 5, akitas: 7, goldfish: 6 +Sue 355: goldfish: 6, children: 4, trees: 10 +Sue 356: children: 1, trees: 3, akitas: 7 +Sue 357: trees: 2, samoyeds: 10, goldfish: 3 +Sue 358: samoyeds: 10, cats: 0, goldfish: 0 +Sue 359: perfumes: 3, children: 6, pomeranians: 1 +Sue 360: cars: 10, pomeranians: 1, samoyeds: 5 +Sue 361: samoyeds: 9, pomeranians: 7, perfumes: 6 +Sue 362: goldfish: 6, trees: 8, perfumes: 9 +Sue 363: samoyeds: 10, pomeranians: 9, children: 10 +Sue 364: perfumes: 3, goldfish: 7, cars: 9 +Sue 365: cats: 3, children: 4, samoyeds: 8 +Sue 366: trees: 0, cars: 10, vizslas: 10 +Sue 367: pomeranians: 10, children: 8, perfumes: 2 +Sue 368: cars: 5, vizslas: 0, samoyeds: 3 +Sue 369: trees: 1, goldfish: 8, cars: 8 +Sue 370: vizslas: 0, cars: 2, perfumes: 5 +Sue 371: trees: 2, cars: 3, vizslas: 8 +Sue 372: trees: 10, children: 9, cats: 1 +Sue 373: pomeranians: 3, perfumes: 1, vizslas: 0 +Sue 374: vizslas: 0, perfumes: 6, trees: 0 +Sue 375: vizslas: 7, pomeranians: 1, akitas: 10 +Sue 376: vizslas: 8, trees: 2, cars: 10 +Sue 377: perfumes: 9, cats: 5, goldfish: 5 +Sue 378: cats: 0, akitas: 10, perfumes: 9 +Sue 379: cars: 4, akitas: 1, trees: 1 +Sue 380: cars: 4, perfumes: 5, trees: 3 +Sue 381: goldfish: 3, akitas: 5, samoyeds: 9 +Sue 382: goldfish: 7, perfumes: 5, trees: 5 +Sue 383: akitas: 4, cats: 6, cars: 8 +Sue 384: children: 6, goldfish: 10, akitas: 7 +Sue 385: akitas: 7, vizslas: 5, perfumes: 10 +Sue 386: children: 7, vizslas: 10, akitas: 10 +Sue 387: goldfish: 6, akitas: 7, trees: 2 +Sue 388: vizslas: 6, trees: 1, akitas: 2 +Sue 389: cars: 5, vizslas: 3, akitas: 7 +Sue 390: vizslas: 4, cats: 8, perfumes: 7 +Sue 391: akitas: 3, trees: 0, children: 2 +Sue 392: cats: 7, cars: 3, children: 9 +Sue 393: trees: 10, vizslas: 3, goldfish: 7 +Sue 394: perfumes: 0, goldfish: 7, akitas: 4 +Sue 395: cats: 6, cars: 7, vizslas: 0 +Sue 396: vizslas: 4, perfumes: 6, goldfish: 5 +Sue 397: pomeranians: 8, trees: 1, akitas: 9 +Sue 398: goldfish: 7, pomeranians: 6, samoyeds: 9 +Sue 399: perfumes: 10, cars: 1, trees: 8 +Sue 400: trees: 0, goldfish: 9, children: 6 +Sue 401: trees: 1, cars: 6, pomeranians: 8 +Sue 402: perfumes: 9, cars: 0, vizslas: 10 +Sue 403: samoyeds: 4, akitas: 1, vizslas: 9 +Sue 404: perfumes: 0, trees: 2, cars: 4 +Sue 405: akitas: 0, perfumes: 5, samoyeds: 4 +Sue 406: akitas: 8, vizslas: 6, children: 2 +Sue 407: children: 1, trees: 8, goldfish: 10 +Sue 408: pomeranians: 4, trees: 10, cars: 9 +Sue 409: perfumes: 5, vizslas: 5, akitas: 4 +Sue 410: trees: 1, akitas: 10, vizslas: 6 +Sue 411: samoyeds: 0, goldfish: 9, perfumes: 7 +Sue 412: goldfish: 7, samoyeds: 10, trees: 1 +Sue 413: samoyeds: 0, pomeranians: 10, vizslas: 6 +Sue 414: children: 2, cars: 10, samoyeds: 2 +Sue 415: trees: 2, goldfish: 8, cars: 0 +Sue 416: samoyeds: 4, goldfish: 9, trees: 2 +Sue 417: trees: 8, akitas: 10, perfumes: 3 +Sue 418: samoyeds: 9, goldfish: 2, cars: 1 +Sue 419: akitas: 2, perfumes: 8, trees: 2 +Sue 420: children: 3, goldfish: 6, perfumes: 5 +Sue 421: akitas: 8, perfumes: 2, samoyeds: 6 +Sue 422: vizslas: 10, akitas: 4, pomeranians: 3 +Sue 423: cats: 8, perfumes: 3, trees: 4 +Sue 424: cars: 2, children: 4, pomeranians: 8 +Sue 425: pomeranians: 4, samoyeds: 2, goldfish: 4 +Sue 426: perfumes: 6, cars: 4, goldfish: 4 +Sue 427: akitas: 0, goldfish: 7, perfumes: 5 +Sue 428: perfumes: 4, cars: 3, akitas: 5 +Sue 429: trees: 0, vizslas: 0, goldfish: 1 +Sue 430: perfumes: 4, vizslas: 2, cars: 7 +Sue 431: goldfish: 7, pomeranians: 8, trees: 0 +Sue 432: goldfish: 7, children: 9, trees: 3 +Sue 433: akitas: 1, vizslas: 10, trees: 2 +Sue 434: perfumes: 2, cars: 4, goldfish: 10 +Sue 435: pomeranians: 6, vizslas: 9, trees: 1 +Sue 436: cars: 9, trees: 0, goldfish: 0 +Sue 437: trees: 1, goldfish: 1, vizslas: 8 +Sue 438: goldfish: 7, samoyeds: 8, children: 2 +Sue 439: children: 1, cats: 7, vizslas: 8 +Sue 440: cats: 2, pomeranians: 6, goldfish: 4 +Sue 441: perfumes: 7, cats: 3, vizslas: 6 +Sue 442: akitas: 4, samoyeds: 5, cars: 2 +Sue 443: akitas: 3, perfumes: 3, cats: 9 +Sue 444: perfumes: 10, akitas: 6, trees: 0 +Sue 445: cars: 5, children: 9, perfumes: 8 +Sue 446: vizslas: 10, cars: 3, perfumes: 5 +Sue 447: children: 9, perfumes: 1, cars: 10 +Sue 448: akitas: 0, goldfish: 8, trees: 3 +Sue 449: cars: 7, akitas: 8, children: 3 +Sue 450: cars: 4, akitas: 9, cats: 0 +Sue 451: perfumes: 4, samoyeds: 5, goldfish: 6 +Sue 452: perfumes: 10, akitas: 1, cars: 7 +Sue 453: trees: 1, goldfish: 3, vizslas: 6 +Sue 454: goldfish: 8, pomeranians: 6, trees: 10 +Sue 455: akitas: 5, vizslas: 8, goldfish: 10 +Sue 456: cats: 5, trees: 4, samoyeds: 0 +Sue 457: perfumes: 8, cars: 0, cats: 3 +Sue 458: akitas: 1, trees: 10, vizslas: 2 +Sue 459: vizslas: 6, akitas: 3, children: 10 +Sue 460: perfumes: 7, trees: 9, goldfish: 8 +Sue 461: children: 6, vizslas: 4, perfumes: 5 +Sue 462: vizslas: 6, akitas: 8, perfumes: 9 +Sue 463: goldfish: 8, cars: 4, trees: 10 +Sue 464: pomeranians: 8, cars: 5, vizslas: 0 +Sue 465: cats: 10, goldfish: 7, akitas: 1 +Sue 466: cats: 2, children: 1, cars: 6 +Sue 467: perfumes: 3, samoyeds: 6, cars: 0 +Sue 468: samoyeds: 10, pomeranians: 6, trees: 2 +Sue 469: children: 2, perfumes: 2, pomeranians: 4 +Sue 470: cats: 1, perfumes: 5, vizslas: 9 +Sue 471: vizslas: 5, perfumes: 2, akitas: 7 +Sue 472: samoyeds: 8, goldfish: 6, cats: 1 +Sue 473: goldfish: 10, perfumes: 9, cars: 4 +Sue 474: samoyeds: 0, cars: 4, vizslas: 4 +Sue 475: trees: 2, cars: 7, akitas: 8 +Sue 476: vizslas: 3, perfumes: 5, goldfish: 1 +Sue 477: cats: 7, cars: 4, trees: 1 +Sue 478: vizslas: 8, akitas: 3, goldfish: 0 +Sue 479: cars: 6, cats: 3, perfumes: 2 +Sue 480: goldfish: 1, children: 9, vizslas: 3 +Sue 481: pomeranians: 5, vizslas: 1, cars: 10 +Sue 482: children: 5, perfumes: 5, cats: 1 +Sue 483: perfumes: 2, goldfish: 7, trees: 6 +Sue 484: akitas: 2, goldfish: 4, perfumes: 10 +Sue 485: samoyeds: 3, goldfish: 0, akitas: 1 +Sue 486: trees: 8, vizslas: 9, goldfish: 0 +Sue 487: goldfish: 8, samoyeds: 0, trees: 0 +Sue 488: perfumes: 7, cars: 5, trees: 0 +Sue 489: vizslas: 3, pomeranians: 2, perfumes: 5 +Sue 490: cars: 5, perfumes: 5, akitas: 5 +Sue 491: children: 8, trees: 1, pomeranians: 4 +Sue 492: pomeranians: 0, akitas: 1, vizslas: 8 +Sue 493: akitas: 10, perfumes: 10, samoyeds: 8 +Sue 494: perfumes: 6, vizslas: 4, cats: 6 +Sue 495: children: 6, pomeranians: 5, samoyeds: 4 +Sue 496: vizslas: 1, trees: 5, akitas: 1 +Sue 497: vizslas: 10, perfumes: 10, pomeranians: 3 +Sue 498: samoyeds: 3, trees: 2, cars: 5 +Sue 499: cats: 6, children: 3, perfumes: 0 +Sue 500: pomeranians: 10, cats: 3, vizslas: 5 diff --git a/2015/16/puzzle-1.sh b/2015/16/puzzle-1.sh new file mode 100755 index 0000000..3550231 --- /dev/null +++ b/2015/16/puzzle-1.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env sh + +# Definitely there is a better way to do this, but this is fine +# Original solution was just me using regex in vim lol + +sed '/children/!s/$/, children: 3/' input \ + | sed '/cats/!s/$/, cats: 7/' \ + | sed '/samoyeds/!s/$/, samoyeds: 2/' \ + | sed '/pomeranians/!s/$/, pomeranians: 3/' \ + | sed '/akitas/!s/$/, akitas: 0/' \ + | sed '/vizslas/!s/$/, vizslas: 0/' \ + | sed '/goldfish/!s/$/, goldfish: 5/' \ + | sed '/trees/!s/$/, trees: 3/' \ + | sed '/cars/!s/$/, cars: 2/' \ + | sed '/perfumes/!s/$/, perfumes: 1/' \ + | grep 'children: 3' \ + | grep 'cats: 7' \ + | grep 'samoyeds: 2' \ + | grep 'pomeranians: 3' \ + | grep 'akitas: 0' \ + | grep 'vizslas: 0' \ + | grep 'goldfish: 5' \ + | grep 'trees: 3' \ + | grep 'cars: 2' \ + | sed -n '/perfumes: 1/s/Sue \([0-9]*\).*/\1/p' diff --git a/2015/16/puzzle-2.sh b/2015/16/puzzle-2.sh new file mode 100755 index 0000000..e854c7c --- /dev/null +++ b/2015/16/puzzle-2.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env sh + +# Definitely there is a better way to do this, but this is fine +# Original solution was just me using regex in vim lol + +sed '/children/!s/$/, children: 3/' input \ + | sed '/cats/!s/$/, cats: 8/' \ + | sed '/samoyeds/!s/$/, samoyeds: 2/' \ + | sed '/pomeranians/!s/$/, pomeranians: 2/' \ + | sed '/akitas/!s/$/, akitas: 0/' \ + | sed '/vizslas/!s/$/, vizslas: 0/' \ + | sed '/goldfish/!s/$/, goldfish: 4/' \ + | sed '/trees/!s/$/, trees: 4/' \ + | sed '/cars/!s/$/, cars: 2/' \ + | sed '/perfumes/!s/$/, perfumes: 1/' \ + | sed 's/$/ /' \ + | grep 'children: 3' \ + | grep 'samoyeds: 2' \ + | grep 'akitas: 0' \ + | grep 'vizslas: 0' \ + | grep 'cars: 2' \ + | grep 'perfumes: 1' \ + | grep 'goldfish: [0-4][ ,]' \ + | grep 'pomeranians: [0-2][ ,]' \ + | grep 'cats: \([8-9]\|[1-9][0-9]\)' \ + | sed -n '/trees: \([4-9]\|[1-9][0-9]\)/s/Sue \([0-9]*\).*/\1/p' diff --git a/2015/17/input b/2015/17/input new file mode 100644 index 0000000..09ebd46 --- /dev/null +++ b/2015/17/input @@ -0,0 +1,20 @@ +43 +3 +4 +10 +21 +44 +4 +6 +47 +41 +34 +17 +17 +44 +36 +31 +46 +9 +27 +38 diff --git a/2015/17/puzzle-1.py b/2015/17/puzzle-1.py new file mode 100755 index 0000000..b201e5b --- /dev/null +++ b/2015/17/puzzle-1.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import itertools + + +def main() -> None: + with open("input", "r", encoding="utf-8") as f: + nums = list(map(int, f.readlines())) + + combs: list[tuple[int, ...]] = [] + for n in range(len(nums) + 1): + combs += list(itertools.combinations(nums, n)) + + print(len(list(filter(lambda x: sum(x) == 150, combs)))) + + +if __name__ == "__main__": + main() diff --git a/2015/17/puzzle-2.py b/2015/17/puzzle-2.py new file mode 100755 index 0000000..43f8922 --- /dev/null +++ b/2015/17/puzzle-2.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import itertools + + +def main() -> None: + with open("input", "r", encoding="utf-8") as f: + nums = list(map(int, f.readlines())) + + combs: list[tuple[int, ...]] = [] + for n in range(len(nums) + 1): + combs += list(itertools.combinations(nums, n)) + + combs = list(filter(lambda x: sum(x) == 150, combs)) + conts = min(map(len, combs)) + print(len(list(filter(lambda x: len(x) == conts, combs)))) + + +if __name__ == "__main__": + main() diff --git a/2015/18/input b/2015/18/input new file mode 100644 index 0000000..5efaa1b --- /dev/null +++ b/2015/18/input @@ -0,0 +1,100 @@ +#...##......#......##.##..#...##......##.#.#.###.#.#..#..#......####..#......###.#.#....#..##..###.. +####..#.#...#....#.#####.##.##.#..#.......#....#.##...###.###..#.#.#........#..#.#.##...##..#.####.# +...#..##...#.#.###.#.###..#.##.####.###...#...........#.###..##.#.##.#.###...#.#..###....#.###.#..#. +.#...##...####.#..#.....#..#...#.#.##...#...##..#.#.###....#..###.....##..#.###..###.....##..###...# +..##.#####....##..#.#..##.##..######...#..###.######.....#..##...#.#..##..##..#..#..#..##.#.#.#.#... +.###.###.###...##...##..###..##.###.#.....##..##.#.#########...##..##.#..##.#..##..####..#.#.#.##### +#.#####..###.###.##.##.#...#.#.#.#..#.###...#..##.###.#...####.#..#.#.....###..#..####..#.#.#...##.. +....#...##.....#....####.##.#.###..#.#.##..#.#...##.###.###..#.##..#.#.##..##..#.##.###..#.#.###.### +##.##...#.##...#.#..#.#..#...###...###.#..#..#.#####..###.#......#.....###.#####.#.#..#.#.#.##..#.#. +#.#..#.....#.....##.#..##...###..##...##...###.#.###.#..#.#.###...##..##..#.###...#.#######.#...#.#. +#.#.....####.#..#.##...#.##....#####.###.#.....#####....###..#........##..####...#...#.###....#..### +##.#.##..#.#.##.#.....##.#.....###.####.#..######.....####.#.#..##.#.##...#..#.#.....#.####.#....... +#..#..#.#..#.######.##..##.####.....##.#.##.#.######..#.#....#.#...#.#..#..#.#.###.#..#.#.#..#...### +####..####.#.#.###.....#.#.#.##..#.##.##.##.#..##..##.#.##.....#.#..#.####.....###.#..#.####.#.#..## +###.##..##.#.##..#..##...#.#####.##.#....##.####.#.##....#..###.#.#.##...#.....#.#.#.#.#..##.#.#..#. +......#..####...##.##...#.##.##...##..#..##.###..#...#..##...#.#....###.####...#.##.###.#.##.####.## +..#...#####.#.#..#.##....#..#...#..####.....###...##.###....#..#.###...#........#.#.##..#..#.#.....# +#######.#.#.###.###..######.##..#####.##.###.###....####.#..##.##...###.#..############.#.##....##.# +#.#...##.###.#.###..#.#.#.#.#.#..##..####.#..##.....#.##..#.##...##.#..##..#.#.#....##....##.#..#.#. +..#.#.####.....###..#######.#.#.#.#...##.#####.....##...##...##.###..######.###..#...####.#..###.### +.#.##....#.#.##..##.#.##.##..######...#.....#..#.#.#.#.....#.#..##.#.#.......#######....#.......#... +..###.##.##..##....#.###...#.....##..##......###...##..###.##...##.###.#.#.#.###.###.#.#...###..#... +.##.#.#...#...##.#.#...#..#..#.#...##.#.##...##..#....#.#..##.#..#.#..#.#.....#..#.#...#######.#.##. +...####....#.###.#..###..##...##..#.#.#.###...#..##.##.##..##.#...#..#.##.....#.#........#..#.#.#### +.....##..###...#....#.#.#.#...###.###...#.#...#.#.####....#..####...###..#..######..##.##..###.##### +#####.##..#....###.###....##.....#.#..#....#.#####.##.#.####.#.##...#..###...###..##...#.###.#####.. +###.##..........########.######....####.###.#..##...#.##.####.#.....##..#####..###...#####.....#.#.# +##..#####.##.#.#####.#.##.##..#.##....########.#####.#...#.###.##...#.###.#.#..#....##.#..#...#.#.#. +.##.#....#..#...#..#####..#..##.#......#..#....########...#..#...#.....####.#...##...#.###.#.#..##.# +.##.##.#.##.#.##...#.#.#..##.##.###.#..##..#...###.##.###.#####.#.###..#..###.#...#.###.#...#..#.#.# +.#..#..#.#..#..###..#....###.####.##.#.###.#.##.###.#.##.###.###...###...###.#...####...#.##.##.#.#. +###..##...###...#..##.#..#.#...##....###.##.##..#####....###..#..#....#..###.###.#...#.##...#.#.#..# +#....#.......##.....#.##...#..#.###.#.##..##..#.##..#.###..##.##...#####.#..#####..#####..#####....# +.####.####....###..###.#.##.####.##.#...####.#.###.#.....#...####..#####.###..#.#.###.##.##...##..#. +####..##...##.########...##..###..#..###.##.#.#.#........#.#####.#...#.###.####.#..####..#.#.#....## +###.#..#...###.#..#..#.###...##..###.##.#.#...#..#...####..##....#.#..#..##.#.#...#####.###.#..#.#.# +...##....#.###.#.#..##...##.###.#..#..#......#...#.#..####.#.##..######.####.#...#..#..#..##.#.#.##. +##.####.#...#..#.#.##..##.#.#.###..##...####......#..######.#......#.##.#....##...###.#.#..#......## +#.....#...#######.##.#..#.#...###.#..#.####....#.#.##.#.##...###..#...#.###.##..#.###..#.##...#####. +#####.##...#..#.#.#.......#.##..#####..#####...###..##.#.#..###.#.#####.####..#.#..##...#.##...#.### +.##.#..#######.###.#.####.....##...#.##.#.#..#...##....####......######.#..######.....##########.##. +##...#.#..#.##.###.#.#.#.##.###.##..##.##.##...#.#..###.#######..#.....#####..#....######.#..##..### +.#.#.###.....#..##..#.#..##..#.###...###.#..##...#...#.#####.#.#####..###.#..#...##..#.#..#..####... +.#......##..#.....####.###....##.###.....###.##........#.###.##..#..#.#######.#.######..##..###..... +..##.#.#..#.##...#.###.###...######..#..#.#..#....###.#.#....#..........#...##.##.##.#..##..#.#####. +###.###.#..#.##..##.#..#..##.....##.....#..#######.#..#.#.#.####.###..###.#.#..#.##.##.####.###.#### +#.#.#..#....########.#..#..#...##..#.##..#.#..##..####...##.....#.##.#.#...########..#.###.#..#.#.## +.##.....#...#.#...##.##....###...##..#.####...#..#.#..#..#.##..#.###.##.####.##..####.....##.#.....# +....####.#.##.#.##.#..##.#.######.##.####..#...####.#..###.#.#..#..##.#.#.....##.#####.#.####...#.#. +#..#####.#####.....##....######..##....#..#.#.###.#####.....##.##.####.#...##...#.##.#.#####.##.#... +##.####..###.#....#...#.#.#.#.###.#####.#.####..####...####......##..#..#..#.#.##...########....#... +.###.#.#.#.#..####.##.#..######..#.#.###.....#.#......#.#.#.#..####.##...##.#####.#.##..##..#..#.#.. +.....###...#...#.####.###.#.#.#.#.....#....#.####.###.##.##.##.#######......#.####......#....##..... +##..#..#.#.##..#...#..##.##.##..###.#....##.##....####.#.##.###....#.##.#.#.##...##.###...#..#..#### +...#.#..##..##.#...##.##...#.#......#.#.##..###....####.##...#.#.###.#..#..#.####..##..##..#####.### +.##.##..##########.##...#.##.####.#.#######.##.#.##.##..#...##....########.###..##.##.##.#..##.#.#.# +#####.#....#.##..#.....#......##.##..#.##.###..##.......###..##.#.###.##.###....####.#..#.###..#.#.# +.#...#..#.##....##....#...####....#...#..#...####...########.###.#..##.#.#.##..###..#.#.###.....##.# +##..##.....###......#..###.##.####.##.####.#.#....#..#...#..#.#..#.###.#...#...#..##.##...#..####### +.....##..###..##...#####.#.#.....###.#.#..####...#.#.#..#..####..##.#..###.####.#....##..###....#..# +#.#.##.#....#.#####.#....##...#...##...##....#.#.......#....#..#...###.###.#.####..####....#.##.#.#. +..##...##..###.#.#.##.#..#....#.#.....##.###.#.###.###.....#...#.#..#######.#####..#.###...##......# +#......###..#....#.#..#.###.##.#...##..###.####.#.#....#.##..#.###..##.#..#####..##.###.....#..###.. +##.#.##..##.###.#..##.....#.##.....###....##.####.######.#...#..###....#.#...#.##.....###....#..#.#. +.##.#.#.#.##..#.#.#..##..#.###.####....#..###.######..####.#.....###.##..#...###.#..######.##.#.##.. +...##.####.#..##.#####.##.#...##..#..#...#.#.#.#####...#....#..###...#..#....#.#.##.#.######.#..#### +..#.#.#.#...#.######.#.....#..#.#..###....#.#.########...#....#.#.##..#...##...#.#..#.#.###....##... +#####..#..##..#..##..#..#.#.##.#....#####.####.##.#.###..##..##....#.....#.#####.#...#.#####.##.#.#. +#.#..#####...####.###.###.....####.###.....##...##...#..#..#######.#.##....##..####.....##...#..#..# +#.#.###.#.#..##..#....#.#...#.#.##.##..#.##.....##...#.#..##.......##.#.###..#####.#.##....#.##..... +...#.......#....#.#.####.#.###.###..#....#..##.#..####........#.##..#...#.#...###.#..#.#.#...#...#.. +...##.#####.##.#.###.##.##.#.##..##.#.#.#.#.#.##.#..##...##.#.#..#..##.##.#####.#.###...#####..#..#. +#######.#..#..#....##.#.#..####.#..#..###...#..#.......###.#.#.####....#.###...#.#.###.#.#.#.#..###. +..##.##.#.##.###....###.##.#.###.#...#....#.####..###..###.#.#..#...##.#.#.#..##.###..###.#.##...### +######..######..##..##.#.#.##.##.#..##..#.#.#.##..#.#...#...#.#.#..######.#..#.#.######..#......##.# +#.#####.....#.......#########..###.##...#...##.#.#..#...#####...#...#..#.###.#..#.#...###.#.#.#...#. +#....##....###...##.##.#...##.........##.#.#..#.#.##.#.######.#####..#..###.###.#...#.#.##.######... +#.#...###.#.###.##.#.######.#######.###.##..#.#.#...######.##.####.##..#.#.#.#......##..##.........# +..###..##....#.....##...#.#.###.#.#.....##.#...###.####.#...#...##..##.#.#.####..###...######....#.# +..###.#.##.####.#..#.##....##..#####....#..##.##.#..#######...#.####...##.#.#.##.........#....#....# +.##.#...#.####..#.#...#.##..######.##..##.#.###.##..###.###....##..#.##.##..##.#...###.##.##.###.... +#...###.###.#..#....#.......#..#.....###..#.###.##.##....#.####.#.####.##..##..#..#.....#....##.#.#. +.##.#..#..#.##.......#.####.#######.....#.##.##.#.....#.#..#....######.#..###.##.##.....#.####..##.# +###..#.###.#..####.....##....#..####....#.##.##..#...######.#########...#.#....##...###.#..#.##...#. +#..###..##..#.#.##.###.#.#.##...###.#...##.##..#.###....###..#.#...#.###..######.#..#.###..#..#..#.# +.#........##.#.###..###.#.#.##.....##.##.#.#...##..#.##....###..#.#.#.#.##....#.##..#.#...###...#... +####.####..#....#.#.#..#..##.......##.####...###.##..#.#.##.#..##..######.......##.#.##..#...#.....# +..#..#..###..##.##..######.#..###..###.#.##..##.#..#####.#.#.#.##..#.##..##.##......####.#.......... +...##.##..###.#...###....#.#.#.#.....#.##.....##...#...#......####...##.##....##.#..#.####.#..###.#. +..#.....####.#.###.#####..#..###..#..#.#...#####...###.###....#.###..#...#..#..#.#..#.##..##.#.#.... +..##.#####...###.###.........#....##.####.##..#.#..#.#...#...##.##.##..#.#.##.########......#####... +...###.#.#..#...#.###.###.......##.###.#..#.##########...#..#.#.#.##.#.###...######..#.#...###.##... +.#.#.#######.#..##.##..##...#...####...#..#####.#..##...###.#.#...#.##...#......#..##.####..#.....## +.##.##.#.#......#######..###.....##.#.##..###......#....####...#.###.#.##.#........#..#....##.....## +#...#.###.#.##...##.####....#...#.###..#.#.....#.#....#.#.#.##...#.#..#####.#.#..#..#..#....#...#### +.....##...###......#####..##.##.##...##.#.#####..##...#.#.#.#.###...###.##.####..#.#..#.#..#.####.## +#..#..##.#.##.#.##.#.#.#..###....###.##.#.##.#...#.#..#...#....###.#..#.#.######.#...####..#..##.#.# +#..#.#..#...###.#..##.#...#...##.#......#...#..#..####..##.....#.###...#.#..#.#....#.#####.##.###... +###....#.#..#.#..###..#.##......#...#..#..##.#..###..##..#..#.####..#...########..##.#.##.#.#.#...#. +.#.#.##.##.###..#...#.#....#..#.##..#.#.#.#.##.##.#####...#........####..###..####.#####..#.##.#.##. diff --git a/2015/18/puzzle-1.py b/2015/18/puzzle-1.py new file mode 100755 index 0000000..ef6d36e --- /dev/null +++ b/2015/18/puzzle-1.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + + +def neighbours(data: list[list[str]], x: int, y: int) -> int: + acc = 0 + + for x1, y1 in [ + (x - 1, y - 1), + (x - 1, y), + (x - 1, y + 1), + (x, y - 1), + (x, y + 1), + (x + 1, y - 1), + (x + 1, y), + (x + 1, y + 1), + ]: + try: + if x1 >= 0 and y1 >= 0 and data[x1][y1] == "#": + acc += 1 + except IndexError: + pass + + return acc + + +def simulate(data: list[list[str]]) -> list[list[str]]: + ndata = [["." for i in range(100)] for j in range(100)] + + for i in range(100): + for j in range(100): + if data[i][j] == "#" and neighbours(data, i, j) in [2, 3]: + ndata[i][j] = "#" + elif data[i][j] == "." and neighbours(data, i, j) == 3: + ndata[i][j] = "#" + + return ndata + +def main() -> None: + with open("input", "r", encoding="utf-8") as f: + data = [list(l.strip()) for l in f.readlines()] + + for i in range(100): + data = simulate(data) + + print(sum(data[i].count("#") for i in range(100))) + + +if __name__ == "__main__": + main() diff --git a/2015/18/puzzle-2.py b/2015/18/puzzle-2.py new file mode 100755 index 0000000..9a998b8 --- /dev/null +++ b/2015/18/puzzle-2.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + + +def neighbours(data: list[list[str]], x: int, y: int) -> int: + acc = 0 + + for x1, y1 in [ + (x - 1, y - 1), + (x - 1, y), + (x - 1, y + 1), + (x, y - 1), + (x, y + 1), + (x + 1, y - 1), + (x + 1, y), + (x + 1, y + 1), + ]: + try: + if x1 >= 0 and y1 >= 0 and data[x1][y1] == "#": + acc += 1 + except IndexError: + pass + + return acc + + +def simulate(data: list[list[str]]) -> list[list[str]]: + ndata = [["." for i in range(100)] for j in range(100)] + + for i in range(100): + for j in range(100): + if (i, j) in [(0, 0), (0, 99), (99, 0), (99, 99)]: + ndata[i][j] = "#" + elif data[i][j] == "#" and neighbours(data, i, j) in [2, 3]: + ndata[i][j] = "#" + elif data[i][j] == "." and neighbours(data, i, j) == 3: + ndata[i][j] = "#" + + return ndata + +def main() -> None: + with open("input", "r", encoding="utf-8") as f: + data = [list(l.strip()) for l in f.readlines()] + data[0][0], data[0][99], data[99][0], data[99][99] = "#", "#", "#", "#" + + for i in range(100): + data = simulate(data) + + print(sum(data[i].count("#") for i in range(100))) + + +if __name__ == "__main__": + main() diff --git a/2020/01/.gitignore b/2020/01/.gitignore new file mode 100644 index 0000000..60d075d --- /dev/null +++ b/2020/01/.gitignore @@ -0,0 +1 @@ +puzzle-[12] diff --git a/2020/01/Makefile b/2020/01/Makefile new file mode 100644 index 0000000..c32dafa --- /dev/null +++ b/2020/01/Makefile @@ -0,0 +1,7 @@ +all: + ${CC} ${CFLAGS} -o puzzle-1 puzzles.c + ${CC} ${CFLAGS} -DPART2 -o puzzle-2 puzzles.c + +.PHONY: clean +clean: + rm -f puzzle-[12] diff --git a/2020/01/input b/2020/01/input new file mode 100644 index 0000000..127b7a7 --- /dev/null +++ b/2020/01/input @@ -0,0 +1,200 @@ +1293 +1207 +1623 +1675 +1842 +1410 +85 +1108 +557 +1217 +1506 +1956 +1579 +1614 +1360 +1544 +1946 +1666 +1972 +1814 +1699 +1778 +1529 +2002 +1768 +1173 +1407 +1201 +1264 +1739 +1774 +1951 +1980 +1428 +1381 +1714 +884 +1939 +1295 +1694 +1168 +1971 +1352 +1462 +1828 +1402 +1433 +1542 +1144 +1331 +1427 +1261 +1663 +1820 +1570 +1874 +1486 +1613 +1769 +1721 +1753 +1142 +1677 +2010 +1640 +1465 +1171 +534 +1790 +2005 +1604 +1891 +1247 +1281 +1867 +1403 +2004 +1668 +1416 +2001 +1359 +686 +1965 +1728 +1551 +1565 +1128 +1832 +1757 +1350 +1808 +1711 +1799 +1590 +1989 +1547 +1140 +1905 +1368 +1179 +1902 +1473 +1908 +1859 +1257 +1394 +1244 +1800 +1695 +1731 +1474 +1781 +1885 +1154 +1990 +1929 +1193 +1302 +1831 +1226 +1418 +1400 +1435 +1645 +1655 +1843 +1227 +1481 +1754 +1290 +1685 +1498 +71 +1286 +1137 +1288 +1758 +1987 +1471 +1839 +1545 +1682 +1615 +1475 +1849 +1985 +1568 +1795 +1184 +1863 +1362 +1271 +1802 +1944 +1821 +1880 +1788 +1733 +1150 +1314 +1727 +1434 +1833 +1312 +1457 +160 +1629 +1967 +1505 +1239 +1266 +1838 +1687 +1630 +1591 +1893 +1450 +1234 +1755 +1523 +1533 +1499 +1865 +1725 +1444 +1517 +1167 +1738 +1519 +1263 +1901 +1627 +1644 +1771 +1812 +1270 +1497 +1707 +1708 +1396 diff --git a/2020/01/puzzles.c b/2020/01/puzzles.c new file mode 100644 index 0000000..29384e0 --- /dev/null +++ b/2020/01/puzzles.c @@ -0,0 +1,39 @@ +#include <err.h> +#include <stdio.h> +#include <stdlib.h> + +#define BUFFER 200 + +int +main(void) +{ + int nums[BUFFER]; + FILE *fp; + + if (!(fp = fopen("input", "r"))) + err(EXIT_FAILURE, "fopen"); + + for (int i = 0; i < BUFFER; i++) + fscanf(fp, "%d", &nums[i]); + + fclose(fp); + + /* Inefficient, but small sample size so it's fine */ + for (int i = 0; i < BUFFER - 1; i++) { + for (int j = i + 1; j < BUFFER; j++) { +#ifdef PART2 + for (int k = j + 1; k < BUFFER; k++) { + if (nums[i] + nums[j] + nums[k] == 2020) { + printf("%d\n", nums[i] * nums[j] * nums[k]); + return EXIT_SUCCESS; + } + } +#else + if (nums[i] + nums[j] == 2020) { + printf("%d\n", nums[i] * nums[j]); + return EXIT_SUCCESS; + } +#endif + } + } +} diff --git a/2020/02/input b/2020/02/input new file mode 100644 index 0000000..45e8c19 --- /dev/null +++ b/2020/02/input @@ -0,0 +1,1000 @@ +5-6 s: zssmssbsms +3-6 j: jjjjjrrj +4-7 k: kfkgkkkkk +2-3 n: nkbgfnn +7-12 h: hhhhhhdhhhhhfhhhh +1-4 v: nvvv +6-9 h: hhthplhgmpzsmhhxhh +6-7 r: rrtrrrgrgcc +10-15 h: sdbhvbhfjhwllmrpdv +3-4 s: bsss +5-7 s: sstjsswsspldr +10-14 b: bzbqbbbkpvbblbnrbs +4-11 s: sssmcskwsssssss +2-10 v: rlttvvnvvvvvvksm +4-5 x: xkrxx +2-5 m: bfmmmmm +11-14 r: rlprrtrcrxcrgrrhrr +4-16 l: dzllmllldnllblwcr +3-4 t: nplr +3-5 x: jcxxgkxtjwwgh +3-4 j: msjcjqjgxmjsjfjjj +1-6 z: zgkkdzww +3-5 q: pgqqbq +17-19 t: tttkttwtttttttttttt +5-11 n: nqnlfknntdn +11-12 c: ccccccccccgc +2-14 x: pxmvfrrwlbzxhk +4-5 g: gcggwggxv +4-5 h: phbzhhhqhl +4-5 h: hwbhk +1-2 t: tgmq +16-19 l: llllbjlfvnlhwlllqfp +4-6 r: srrrqggrs +1-3 g: nggwhvcl +1-8 f: pffffffff +2-3 l: lllll +13-15 d: ddrdkdddmdmdddd +11-13 r: rrrgrkrrdrwrrr +3-10 x: xxxxxxxtxq +6-7 p: pspzpvlpxnplhtpc +3-8 f: fsfkfbffvxfc +3-5 z: zzzvwzsfktz +4-7 c: cccgccc +11-12 n: nnnnnnnnnnzn +12-13 n: nnnnnnnmznnpnnn +4-7 q: wqqzgqgfg +5-13 p: tgplpbpmvgpppktps +12-13 x: zwcxlnhwpsvxm +7-10 r: rrrrrrnrrrrgr +1-5 r: rlrrj +15-18 l: nlllllslcllllllllcl +10-11 w: wnwwzwwwwwwwmwrwr +10-11 j: njmmjjjcjjv +3-6 z: vgbdvzgzzzzw +7-8 r: bbcvxzrqpqskcmhwsvx +4-5 c: rgvcgmccc +6-9 d: ddddddddd +6-7 g: gggsggg +4-7 c: ffclfbcdmcvnshw +3-5 n: xnznv +6-7 d: ddddddk +1-2 r: rjvprt +6-7 p: ppphppp +1-11 p: ppppppppppxppp +10-16 x: bxxnxpxxxcxjxtxnw +4-8 s: hzsvsswc +10-12 p: lpwswppppvppphp +2-3 d: bdcddnxc +4-6 s: ssscssp +18-19 k: kkkkkkkjkkkkkkkkkzk +4-6 x: ncxpxx +6-8 h: xhhhqxrhhhfh +15-16 p: qppjnpzfvppzdppgppp +1-7 d: dwvdddddc +3-4 w: wlshzvqw +4-16 s: sbwgjshsznhdsssjts +4-8 t: ptttbkbhtt +11-12 w: wwddwwwwwwwj +2-6 z: zkzzzzzhzzzz +3-6 b: bbxbbb +3-6 z: zztzzq +2-3 h: hhjhh +1-5 x: xptxl +10-11 n: nnwnnnnnndrnpp +5-6 s: jsswmjzkrspsms +2-7 n: nnnnnnnn +4-6 q: qqqhgxg +5-6 r: rrrrqrr +4-5 k: kstjksjbkhhfpzkl +5-6 n: nnnnqpldn +11-13 w: mptdwqgfkwwzb +3-4 x: ccxxmxfzfztxvxdg +2-13 w: wwwwwgjwwwwwwwwwwww +1-5 m: mrmkjqhdcqbz +7-8 l: lldllllh +7-17 d: ddvddddktmckjbmds +3-8 n: htnnnnqlv +3-8 v: chvkvjkvxl +8-12 t: rtffbltcbtttwtqbvt +1-8 n: nhnbvdwq +6-11 b: bblbbmbbbbbbbbbbb +4-7 s: rssbphs +8-9 q: wqqdqqqwqq +10-11 f: sfwfffdffhntffj +4-5 x: xlxbxx +2-4 d: lvdd +3-6 t: djtcsmjrrt +7-11 v: lvvvvvxvvvv +3-4 c: ccpc +3-17 g: nzgjkrpwbfcgzqjvtth +8-15 l: lnhlllgllvgllbgscl +10-11 z: zzzzmzzzzmzzjz +3-10 b: bwntlkjnfbm +5-6 f: vffxnfjffp +1-4 s: dvcssdw +11-13 c: cccctcfccckct +4-6 m: cmtzbmkqqgbmpsmbxwkw +11-13 j: jhjjcjmjjjqjvj +6-7 q: qqqqqqqq +4-10 f: fmxffftfnbm +7-10 n: cdnrfrnvpmmhpnmxbnx +8-9 z: zzzzzzzvz +2-9 h: zrvhddntmhjhhh +11-12 g: gggggggggggg +1-2 h: vhtgfg +1-2 g: gggp +1-2 r: nrktwt +2-8 b: bslkbbbbb +1-5 q: lrfqmq +10-14 q: qbqbqpqqqrqdqqq +7-16 r: nvrrzhsgrwthgbrqkqh +4-5 z: zzzzh +3-8 v: nkvwfvlvv +8-9 z: zzzzzzzfs +2-4 w: vrlrss +1-2 j: jnqswjgps +7-8 f: ffzffffwff +11-12 k: klwqntvkpcthq +5-13 k: kkkkkkkkkkkklk +2-5 w: wwwdxgwwszb +1-13 q: cqqqqtqqdmmnqm +3-8 q: bqtlqqzn +3-12 n: xnzdxdnndpnnqhcnnnnn +6-7 r: kqhrrrxldrmwr +3-5 k: hjkdp +5-6 h: hhhqhrmhbh +14-15 v: vvvvvvvwvvvvkvvvv +2-10 h: nbcpsmpvph +8-9 r: rjrrrrrrp +8-10 j: jjjjjjjcjt +8-13 l: jkfllllllxldvplvll +5-11 m: mmmmmmmmmmmm +5-6 v: vhvvgvv +12-13 n: nndnnnnnnnnnb +3-4 f: wfmfjfffnfflf +4-14 l: llllllvllllllf +10-13 f: vvtfcfxfwdfmnf +4-8 w: wxwwwghwpwrtwww +5-8 g: tsggmgcggg +9-11 w: wcwwwwwwwlqw +8-10 z: zzzzzzzpzz +2-4 m: mmrm +16-17 k: kdkkkkkkkkwkkkpklkkk +4-8 k: kkkkkkkn +2-5 p: wpppqtwkpbptmlds +6-8 f: ffbffnff +2-16 z: ffzjwnbbljfzgfrlz +3-18 j: jjqdrpcjjjjjjbfbjjj +10-11 v: vjvvvvvvvvm +3-8 f: fmnpffflfnd +13-14 n: nmnnnnnnnnnnnr +3-11 k: jrkrkjzccwhlxkgkh +1-4 z: pzzzhzz +6-7 k: kvknwkj +2-10 l: cllblhlwlq +3-4 n: nnnng +3-6 w: tjlzwwc +12-17 l: llllvlllllllllllw +2-4 h: dhhlmhqddhnh +1-2 r: rsqjd +10-13 s: zszlssssssjsswpssssz +2-6 v: vmvvdxvv +9-13 m: qpmdmzmmxjswmmmmm +19-20 f: pzjnfzfwfcffffxmfffl +1-5 n: nnnsknnnn +13-14 r: rrkrrrrrrrrrrr +9-10 h: hhhhhhphfh +6-8 x: ppcxlxhl +1-3 z: bzxwzjhcgwcjgfgrlc +8-9 n: nnnnnnnwwn +5-6 g: qcgghgg +3-4 p: ppxp +7-9 b: phbbtbsbffbjbbb +5-13 t: tcstttjtzdnhkt +10-12 k: mkckkkkkkbkkk +4-5 v: twcpvvzvjsvzqvwkbc +17-18 m: bflhwmndwmkcmqsmmgkm +14-16 t: ptttrtttpttttttfhtlt +7-10 b: bxbrbbbnmcbbvbb +6-9 r: rwvrrpmmr +10-11 h: hxhhhhhhhhx +4-5 h: hmhth +1-3 l: lldl +1-2 d: dqhsxsqmmndx +10-13 l: llllhlqllslld +18-19 z: zzzzzzzzzpzzzzzzzcpz +5-6 j: jjjjjp +7-9 t: tttttttttt +6-8 t: tttttttzc +5-17 x: xxxxxxxxxxxxxxxxxxxx +16-20 x: xdxxxxxwxxxxxcxpxsxw +3-4 f: ffxf +4-9 q: mqqcqqqqqqd +2-6 z: zdjnzjtr +4-7 p: phppppv +11-12 m: mgmshkmmbmqmmmmm +2-5 b: ztltbbpgxmbbptqb +4-10 v: vjvwlvfqmrhffvbkfv +1-3 k: xdcthk +3-9 s: ssssssssm +9-18 w: whjwnwwwkwbwwwwwwwww +16-17 j: jjjkcjjjjpjjjjjjdjjt +9-12 b: bdvjzbwbbgbbqb +2-6 f: ffrrsj +3-8 t: tttttttwt +5-7 c: cczcmcxc +5-6 z: tfwszq +8-9 k: kkkrskkdkkr +5-7 h: hhwhhhghh +8-14 m: smfgmmmkmmmmmmmpxmnn +8-9 w: gwwmplbkjf +1-8 z: kjzwvtvdhpkzjzlxpjq +3-5 b: mgbqbbb +3-4 g: skltgpcng +7-8 k: cxxkktkc +12-20 b: fbbmcbbhkbbbbhbbbbbz +6-19 k: gvflkkgqbkckcmlcqkl +10-11 l: llllllllkdll +3-4 g: ggqg +5-6 d: ddddzd +4-5 n: nvnnn +4-5 j: jsjsjj +1-4 m: mmmmmmmmmmmmmmmmm +11-15 c: fljcwwlnbfzxfqt +3-4 l: lwlndjl +7-10 w: wqwwvwwwwjw +15-16 k: fkkkvkkklbkkxkdkkr +3-4 z: zszz +5-7 z: xzzhlzzzplzzq +8-9 z: zzzzkzzzk +2-13 h: hhhhhhhhhhhhqbhh +6-9 n: dnnzwdnncqnjnnvm +6-10 r: rkwlrdsrrrzrrrr +1-4 b: bbbwbb +1-2 b: vbxm +5-11 m: jrkbkmmmmmmmw +2-3 n: wnmntnxdkl +11-12 f: ffwfnffffvxfffff +1-2 m: xhgmxvmkzj +10-14 s: sssrnsssssssssrsv +3-9 x: xxxxpxxxgx +2-7 d: pddwwpbv +2-5 l: lljslz +3-4 g: ggkg +9-13 r: crrrlwzbrvjzt +4-5 k: kkzpkfk +2-4 q: kqqxq +6-8 c: tcmcccccccfccgcchc +7-17 r: nrsdshrrqhjllsrjrjxr +1-3 b: bpgkwcbnb +3-8 t: zdnjtvttjgt +6-7 v: gpgnwkgnvkv +5-7 v: vmvcnjvvvmv +4-7 z: zvrjzxzzdxzlpz +3-9 m: cdlplfjrmvbdvm +7-8 w: wwjwwwwww +13-15 q: qqqqqqqqhqjqrqjjqrq +8-9 v: vvvvvvvvg +3-6 f: qfffffjf +2-4 d: nddpxd +1-3 q: bqmqqqqq +14-16 j: jjxjbjjjjjfjjjjfgj +5-6 t: ttttgtt +14-18 l: llllllllllllllllwbll +11-15 c: kscccdcdccdccccc +15-17 v: vvvvvjvvvlvvvvhqvvv +5-6 b: bbbbnl +3-10 r: rrrrrrtrqkjr +11-13 w: wwwwhwwwwwskw +13-14 h: hhhhhhhhxhhhhs +8-9 k: kkkkkkzkw +11-12 m: mmmmvmmmdmmcm +2-9 k: kffkknkfkkkkkgkk +4-13 d: dggdndznddddc +4-7 t: kksmtmdswzvt +2-4 z: ppzccxtbcnwswtlc +11-14 r: rrrrrprrrrrrrvr +14-15 x: xxxxxblxxxxxxtxxxc +7-9 b: bkxjjjbtbtlhgrtmb +4-5 p: fgzdp +5-8 l: ncrlljltnllll +1-2 x: mxgcx +7-12 x: xxxxxxxxnxxr +1-2 r: rkrrrrlnrrrr +6-10 q: qqbqbqqqqqqzrqz +2-9 b: bsbbbcvbcxcrbbbbgpcd +12-19 x: xtlrxvxsxxjxxxknxxcx +2-3 p: mzpptxpg +3-5 d: gkdzgdjlzbfvcbhtgl +5-9 t: ttttnzttt +15-16 q: qsqqqqqqqqkqqnwqqq +12-14 q: qqqqqqqqqqlfqpz +3-8 b: lslqgrzbgbjzthlgnrmc +9-12 m: wmxmmsmmvmcm +3-4 t: qxttt +3-11 m: kbzljjmbpxmt +14-15 n: nnnnnnnnnnfnnnvnsnnn +11-17 l: lclglllclzflllbllt +6-7 m: msmmmmskq +6-10 c: ccccccxccc +9-13 l: plpgntbglpbgfj +5-8 l: llxltljlws +3-7 z: zqzlztgzkzszb +11-15 k: kkkkkkkkkkkkfkqkk +15-16 l: mgxlzbvfwbdmptlbjwz +9-13 j: jjjjjjgjjjjjjj +7-8 z: zzkzzzzbz +14-15 j: jjjjjjjjjjjjjlv +3-7 q: qqdtqgqq +2-4 c: cccpzn +4-7 k: hkkxkkk +2-5 k: kxkkkk +14-15 w: jwwwwwvwwwwwwwpw +2-6 g: gmrgdgnwdbhggxgh +5-14 q: djqtxqxkmgqxqqcplwqq +14-15 q: qqqqqqqqqqqqqqq +3-7 x: dqxqxxtrx +8-13 j: jjjjjjjbjjjjjjjjjj +18-19 r: rrrrrrrrrrrrrrrrrcr +3-14 x: xxsxxxxxxxxxxxxx +7-14 s: kknsngsgkfswjlsns +3-4 z: zzjz +2-4 z: zzzd +1-3 d: dqzdgzwdjmdcpfpfd +3-4 p: jppj +14-15 c: lcccctcccccczzdcccc +14-15 f: fffffffmrfffffpffx +1-5 c: qcvvrcqm +2-11 t: trcltttgttttt +8-9 j: jjjljfjkjjj +1-12 t: wttttttttttttt +7-14 q: gsqqqqgmqqqqclqxdq +5-7 h: hhhhslrlhwsmphc +14-15 x: cxrxxxxxxxxxvxrz +3-6 k: rkkkkkk +3-4 t: dtmttt +1-8 z: zzzzzzzgzz +3-17 t: rtlwttmttttxtttttttt +4-7 w: wwwswww +3-4 w: qvsww +8-11 g: ggggdgqdgggnh +14-16 q: qqqqqqqqqqqqqqqqq +11-12 d: ddddddtddrbddd +10-12 v: wvhvxqpvvbvqvtvmv +6-11 c: cpckcmcctccc +5-9 r: djrcrrrrrrmr +5-9 t: ttbcmnbzt +6-11 f: lwxssffcfks +12-17 v: vvvvqjvvvqvzvvnvvck +11-13 k: kwvtzwczgdwqwp +3-6 l: zdglhlklllhk +15-17 x: xxxxxxxxxxxxxxpxsnx +2-7 s: swdsssx +4-8 v: xvxvxgmvvvqwvhtqt +17-19 n: nnnnnnnnnnhnnnnnnntn +2-4 p: jtppkrgpfph +15-16 v: vvvvvvvvvvvvvvrfv +6-9 q: wqxqqdvdqq +14-16 w: wpwwwwwtwwwwwcwwwdbw +5-6 k: kjrrnk +6-13 w: qfcjlwtlbwgvp +2-3 b: sbbbx +1-3 b: bpbf +2-7 r: dsrrnbmdf +3-13 w: wwwwswjmwwwwdww +3-5 l: dzhll +7-9 l: llqllfzxw +2-5 n: cdkhngnnf +4-12 q: dqqkqklqqqqh +14-15 b: twbbbbgbfkbbbbgcbt +10-16 q: qqnqzbqqzgqrqqqqqqqx +1-3 x: sjltfnnx +9-16 g: tcghdqfsqbcllvdsckx +6-9 w: pwhwjwwxdwjw +3-5 l: rlxlflz +7-18 p: pppppppppppppppppppp +4-14 t: wvfglxkbtrqxkjjtqccl +15-16 b: bbhnbbqqfbbbsbcz +3-4 n: znpnfntn +6-9 v: vvvvvvvhfz +17-18 p: pppppppppppppppprp +2-18 n: lnnnnjpnnnnnnnnnnt +12-14 b: bvtbbbbbbbbbbs +2-6 r: rrrwrrrr +3-4 f: fpfk +1-4 s: skcrmsczxwxrn +4-7 n: nnnpnkz +5-17 j: jkjjgjjjjjjjjjjjj +7-8 n: nnnnnnpnjsn +1-5 j: rdjhp +3-5 f: hdfff +1-3 j: qqjj +2-3 j: vhjrz +7-15 r: jrrrrrrrbrrrrrr +3-6 r: pwdpzr +6-10 n: lncrcndstsww +10-11 m: jmqqmmvshmj +3-5 s: sjjnsvshs +11-12 v: vvlvwvvhvgvkcvv +6-8 c: wcpcclcc +10-12 x: dxxxxxxxxgxxx +5-7 s: sssssst +2-6 j: jksjjkjj +3-4 w: wqrw +2-4 c: qgzdchzcsc +4-6 c: cwngwcxwdcpspfccgdcl +9-10 g: ggvggggxgrgg +5-17 h: hhrwhhfwtrfhzhhblxxv +4-13 g: ppcgtcqgdzswgjtp +3-10 r: rmhwrbtrrwktcqrr +2-7 l: vqhgljg +2-9 l: llgmcllqglllczl +14-16 c: zmccccccccbccnccccfc +10-11 z: zzzzzzzzfzz +5-10 b: bbbbbbhrxbbbb +7-9 b: bbnbbbgbb +9-11 t: tlttttttqtstm +11-13 p: pfmwgpzppppgppppp +14-15 d: ddqdddddddddddpd +5-11 x: xcxvxxqvgnlxzxfdp +12-16 x: xxtxxgrxlxzzwgxm +15-16 z: ztzzzzzzzzzzzzlz +2-6 j: jdjjjjjjjj +4-6 p: zqjkgfctlwqplppj +1-2 d: ddzdd +14-16 v: vvvvvvkvvvvvbjvvcvv +3-4 x: xxxxxk +16-19 t: ttttttrtttmttttqttc +8-14 b: pbcbsbhbbbbbbgbn +2-9 v: vkvvvvvvvvvv +3-6 x: xxxxxnxl +13-14 r: rrrrrrsrrrrrrjr +10-12 x: xxxmxtxwxvxxpxx +4-5 h: hntfhzwhhhv +11-16 z: zzzzzzzzzzqzzzzzz +3-8 h: qfhhhhhmd +1-4 r: rbrw +3-5 q: mqqqqqscq +2-9 n: nnnnnnnnnn +12-15 v: vvbvgvvvvvvvvvcqvv +8-10 j: jjjgjrjjjkjj +9-14 m: mmmmmmmmmmmzml +5-7 v: zvvvvvwx +13-14 t: tttttttttttttkt +3-6 l: lvwxlll +6-7 w: xhbgnlg +11-12 z: zzzzzzzzzzwzz +1-11 m: mmxrltjrmmmwm +9-10 b: bbbbbtbbbrbbb +6-8 n: xnnpkncnhlv +14-17 w: wwwjwtwwntsgwwrwm +12-18 z: zzzzzzzzzzbqzzdzzz +1-8 j: kjsjnjjm +14-18 h: hhhqhhhhhhhhhbhhhr +7-15 n: cpxrrxnvbmwktqg +6-8 w: twtwwdwnwww +1-2 s: sfwss +1-6 z: zzcrqfjkcrkcxnwzz +6-18 n: nnnnnnnnknnnnnnnnw +4-10 z: zzzzgzzzzzz +6-9 s: xvrcshqcsmslsshtscj +2-16 w: gwbljbgmwzgpfjtqnjkj +10-12 j: gwjjjjjkjjtjjjjjj +2-5 p: prpps +5-6 f: fffffr +4-5 r: rjnvr +6-9 c: csccccqpgccc +12-14 g: ggggggdggggdgg +9-12 p: pppkpfppppplp +5-11 f: mhfpffffdfzdrnskfwff +6-8 h: hhhhnxhhh +18-19 m: mmmmvsmmmmmmmmvmmzm +7-9 g: ggptdsgzg +1-7 f: kffzqmfp +10-12 p: pppppptppppk +10-11 f: vfftfffffffff +10-11 f: rxxlzzpvcfbtzfww +3-7 b: bbhrhrb +4-7 j: tjjgjwfnrh +10-12 g: gkggpgggggzfrggvgdhg +7-8 z: gpqfckkzknzrvgngpfh +6-9 c: cccgcnfckgt +2-11 x: zlfxsxslzcxp +16-19 j: jfjjkltpxlqjbvjjjbt +13-17 k: kkkkkkkkkkkkkkcknw +5-9 f: ffxhfxflf +7-9 g: gprnxtxlgndg +1-2 l: tjllwll +7-9 w: wwbwccwwvcwwwz +6-7 n: ntmklznfl +4-7 r: rrrlrrpr +7-12 v: vhmvvvgvvvvs +5-7 t: vfwgctwq +16-17 m: mmmmmmmmmmmmmmmjm +11-13 j: jjjjjjjjjjfjg +4-7 d: dfdddcdwzdrd +7-14 j: jgjjljmmjjzkgjjjqx +10-11 b: bdhbblbbbxhbbd +8-17 k: kkkkxvnrmkkskkkkk +13-15 v: vvvvvvvvvvvvvvv +3-7 t: ltptttf +1-2 q: qqqkj +11-13 t: tmttttntttttft +4-6 t: xgtxrt +9-12 q: fqqpvqqqhcqzqqq +5-8 s: qdjtcsfssss +2-17 c: ccdccccccczqcccccc +3-11 q: qqpqqqqqqqqq +4-12 l: qkqxllknxltdlzlsllj +2-8 r: qlrddbplz +16-17 l: xllllllllllllllgb +8-12 j: kjdfjjjjjjrpjfhjjrj +8-9 d: qvddsrddvpvbddbdddm +4-5 p: pptss +4-6 c: cccscc +4-5 c: cccrc +1-6 r: rzrzfd +1-4 t: tttzz +6-8 d: ddgdsjdd +6-8 c: cccdccccccq +6-9 k: kkkkkvkkk +1-4 m: pmrm +15-17 d: ddddddddddcdddzdd +6-10 b: cljmbjbtbbz +6-11 l: lllllwllllvlll +13-14 r: rrrrrrrrrrprrmrrrrg +3-5 w: hnwbd +3-8 f: fffxfffz +5-9 z: zhzzztzqnzzpl +3-4 x: jxvgxhrd +8-9 x: xxgxxxxxjxx +3-6 z: zlvzfzbzzzb +2-3 v: jvrvq +10-11 q: kqjqtpzqwbqzqh +9-10 g: ghgxgcggdg +5-8 r: srmrrqps +3-4 k: kgkkk +3-4 f: dfsflf +3-4 m: mmmxm +10-11 x: xxxxjxxmxwxx +16-17 n: nnnnnnqnnntnnnnnnnnn +2-13 l: lfblltnlrllll +1-4 l: blblllnnlllj +4-17 k: nkltzflkkjmmknxwkf +4-6 s: sstssfssssssssss +1-2 f: fkvbs +3-5 v: vvvhcvv +1-3 t: nttttttt +1-3 p: ppnnppph +10-15 q: qqqqqqqqqqwqnrqq +2-18 v: vvvvvvvvvvvvvvvvvv +2-3 r: zgrrbrmhqtxc +19-20 x: xxxxxxxxxxxxxxxxxxxv +10-16 n: nzvfnnnnnnnnnnffn +3-4 d: dvdcdw +3-16 l: vrqhbhvmlrllllfl +14-16 c: cccbcpcccccccwccc +7-9 l: lmlnllllll +7-9 r: rfrrrqlrrrsbr +9-19 s: snmbxvrcsssnhpswrss +5-6 s: ssssks +4-9 l: llllbllllllllz +5-9 w: wwwwdbwwwww +2-4 w: mvvw +17-18 v: vvvvvvvvvvvvvvvvrvv +8-9 h: hhhhhhhhh +3-4 n: ntcn +3-4 b: nbbr +8-11 b: bbkbbbbfvbbb +5-8 d: nddnjcdd +12-13 v: vvvvvvvvvvzvh +2-5 k: kfxlc +3-4 r: rrrm +10-16 k: kkkkkkkkkpxkkkkkkkkk +5-6 z: zzzzdm +12-18 p: rrpplpwppgppvpppppp +9-15 x: vxpfxftcxlmzccz +7-8 g: kpgmghgrkgggqbnhggg +4-13 k: kkkkkhbktkwbkcvk +2-7 g: bgggcgtxg +18-19 q: qqqqqqqqqqqqqkqqqhqq +12-16 r: rmdvrrrqrbgdxprrr +4-5 v: lrvxvjlxvfkcbsvv +1-10 l: lllwllllnllvlllll +1-5 t: ttttmt +1-3 v: vfrdvj +9-12 j: jhjwjbjjjjjpjw +3-10 m: mnrdhxmmmm +3-11 n: ngnzbxwgcddgtwvxtrt +2-4 q: dqqq +5-9 z: zgdzzzsfzzxslvzwzp +1-10 x: xjxxxxxxxlxx +3-4 x: gnlvxwt +5-10 q: dqqqqdqqfqqqqqqq +8-9 p: nmpcpppzpnpcpppn +5-6 f: fffffr +6-8 h: ghhphhnhmhhhhhz +6-9 h: hhkshhhkhh +3-4 v: cffvrv +7-8 h: qvzvlzxhhqlsrjrgjwf +5-6 t: ntjztwjttv +3-4 b: bbbs +4-5 k: kjkmk +5-7 k: bvbhkkv +6-16 j: jjqjjvjjjjjjjjjl +7-8 t: rtlmzxtr +9-10 n: nznnnnnnhnn +3-4 b: tmnbdrbjbnfksm +3-4 q: lqqq +5-6 b: bbbgbbz +6-8 l: llvtlllzll +12-16 s: stvsnzssssssssml +1-4 k: jkkk +4-7 t: ttttztttttt +14-15 j: jjrjjzjjjjjjjghj +4-11 j: jxqjjxjjjjth +4-10 v: fvsktttspv +3-7 g: tdgwkspnggpfg +2-18 r: rrfbmqhrldrcqrprrrrl +6-7 r: rrrrrfrr +4-6 f: fjffxqzdffr +8-10 l: llllllllkb +8-12 s: wsgssfssssss +14-15 d: xddddfddddwdtvddddd +2-10 f: fffffkfwcr +12-16 l: llllllllllgtldll +6-7 r: rrrrrkrrr +9-12 q: lqqqqmqhnqqq +8-13 q: qdfqqqqqqqqhl +2-6 g: gjfjgggvng +1-3 z: qzzz +8-10 p: ppppppppzbp +7-12 f: dstffffzfkczfffff +1-15 k: kkkkkpdkkkkkmxf +3-6 w: whwwwmkqf +16-17 g: gpnglggggggggggdcg +5-15 s: nsssnssgssssssssss +14-15 q: qqqqqmqqqqqqqqx +2-11 s: psslpssssrsssdssrmp +1-6 d: hdndpdd +3-6 q: sqpqqnpsqjrqq +1-5 b: qbbbb +1-3 v: vvsv +4-5 q: qqqqjqtfqqqtqqn +6-9 h: hhhhhhhhhh +7-8 r: rrrrsndrrr +3-4 r: brrtb +3-8 t: fjtkttxtzt +10-11 b: bcbfbbbbbbkb +1-6 l: llzssp +16-17 f: ffffffffffffffffn +3-4 l: clml +13-14 h: hhhhhhhhhmhnhnhh +9-12 t: lthttttbtthcctv +3-8 x: xxfkbjhxlqxvxxthxb +2-3 l: llrlmlw +1-10 h: hhhhhhhhkhhhhhh +14-18 l: llllllllflllbllllc +14-15 b: bspvbkbpkkbmgjn +10-12 z: zzzwzzxzzzsxzpz +5-7 d: dhmtldrqddmdw +1-4 g: bqzfgqg +7-10 j: wxjbgbjdlz +3-14 q: csqgmhfqgfqlcnw +1-3 m: mmkmltxmn +1-5 l: llllcll +1-3 b: bcbbjzwfdmmnsrtqbsnl +2-4 s: sszs +14-17 k: kkkmkzkkkkskkkkkbk +5-6 g: gnggcg +4-15 t: dfmlshpqhhmwptzkwgt +2-3 w: drwtngwhgw +5-6 t: tttttrn +15-16 b: bbbbbbbbbbbrbbbr +7-11 s: tswssqssfstsssbzs +8-11 j: jjjbdjjjjsjj +4-7 c: mjclkfccpccfcjchqg +11-13 q: qqqqqqqqqqqqqqq +4-5 r: rgrdrb +8-9 n: nnnnnnnntn +12-13 g: gggxgggggggzgg +7-8 q: qqqqqqqq +9-10 m: gcqmlctsmfmstprmmmkm +2-6 h: dhhhhlh +19-20 b: qkzbbbhbwbtbvqbdpfrt +5-11 k: skkkkkqkhkkkz +10-12 l: lllllllplwllf +3-5 x: hxxxb +4-5 z: zdzzwtzz +5-9 f: fmqfffffmpq +2-3 w: xwkg +6-8 x: xxxxxxckxnq +10-13 k: khkkkkkkkkkkbx +7-15 j: xjjjjjjtjjtjjdljjjjj +2-4 p: mpckqmgpbzcb +2-3 r: rwrz +5-12 t: xhgntttllqtpjzttltt +4-12 q: bwwfvqwrmmbqt +1-3 g: cgpggg +7-11 j: vjjjwjjjrvrjbj +6-11 j: jjjjjjjjjjr +4-8 k: klkkwjkkkvkfk +8-16 p: pppppppvppppjpzs +4-5 m: mmmhr +13-14 t: tstttttttttttw +4-6 n: hmnbznk +14-15 z: zzdzzzzqzzzzwzg +1-6 p: hsjlxpppwv +1-18 d: tddddddddddvdmddddd +2-4 n: nznjn +6-10 v: fqvvszfvvtx +13-18 k: qbckrkkmkkktnkknkk +1-6 n: lnfxntnznnbq +3-9 n: lvnwnlnxnggnvdnqpz +1-3 k: skkjb +1-7 m: mwmrcjt +3-5 k: kfkmw +6-7 f: crfbrfcjdjvm +10-11 m: mmmmmmmmmmz +6-7 t: ttsgttzb +4-6 f: fjfbff +10-12 m: mmmmmmmmmmmmb +10-11 z: wzzzzzzzzszz +6-11 z: nbdmzzztpzh +10-13 f: ffdfdfffxlffgf +3-4 s: vcksscsk +1-5 f: ffvfcpffgfww +13-15 c: cccccccpcccchcc +1-16 x: xxxrxxxxxgxxxxxxx +6-9 v: kfxvvvgvlvvjvvs +14-17 f: cfxfdffbjmbjdfptg +6-7 s: sssssss +15-16 b: bbbbbbbwbbbbbbpb +2-4 w: wdww +1-7 m: mpmtmsmmmpm +4-7 z: tzzpzzz +1-2 q: qdqx +6-12 g: gcggwxrjkjgtrgt +14-18 m: mmfmmmvmmdmmjmmmmq +17-19 j: jjjzjjjjzmbsjjqjplj +2-5 m: ljxmmcnmmgmt +3-8 w: wwwwwwwt +5-7 b: bbbbbzsn +1-17 t: btttttttttttttttttt +1-2 s: svsss +5-6 p: pppmmr +2-7 m: vrgmmjmhm +15-16 w: wwwwwwwwwwwwwwgw +10-11 q: pqqqqqqqqlqqq +7-8 k: kjbkkjdkzc +5-9 x: xmxxtxxxxxx +13-14 v: vvvvvvvvvvvvqvv +1-4 z: lzzszz +4-5 x: xxxkxf +13-14 h: hhhhhshhhhhhpfhh +6-8 s: sssgsssvn +14-17 l: nsgfxplzbmljjstld +6-13 j: jjjjjjjjjjjjjjjjvjjj +10-11 q: qqqqqqlqqrq +7-8 l: llfplllwll +13-16 h: hhhhhhhhhhhhhhhp +5-8 s: ssfsssgc +3-4 b: bbbn +16-17 p: ppppppppppppppppn +5-7 w: wwwwcww +6-14 d: ddlhgjtldncddvdrsd +10-12 h: hhhhhhhhhhhrh +4-5 s: ssrss +1-7 z: wkzcvczpcskxfzxxxmzh +4-7 h: rphjtkh +3-5 k: mdtzkjfkq +2-3 c: cwcc +2-6 r: rrnrrmrrlrrr +10-14 n: ntjrrpfpxxwdznjvmh +3-10 h: flhtwzhhhh +3-8 v: vvnkvvvp +6-8 n: bnnnndnnnnnnnn +2-11 p: hpnppgfmpbp +3-8 h: khhmlhxjshsbf +3-4 l: jllnlglrqz +4-9 g: ggqbghggg +5-6 w: wwwwlwwb +1-9 s: hssssssssssss +1-5 j: jjjjbjj +8-10 s: dssrssssgstssss +3-6 c: cctccccp +7-9 v: vvnvvvvvpv +5-16 t: zmspstpctqgrbmlt +8-14 m: mpmmmmjqmmmnmmm +13-16 c: cbdxwzfbjpkvcpdp +3-19 w: wlwwkfxwfwzkvjxjnthw +13-14 l: ldllllllllllmll +8-14 s: spssshxjfnsjsssskkkj +2-7 c: cmccdcpcw +5-14 t: psntttqxbxdqstvkttb +8-9 z: zzzzzzzzbz +4-9 n: lnmnwcvntmhrznc +1-4 v: tvvv +2-8 d: ddqddqtdscsfddblqk +1-2 t: wttttv +5-6 n: nnrnxnnn +4-14 c: zccscgzpzvwlwcjqpfjl +3-11 g: gglggggfggg +11-18 d: ddddddddddfddddddd +1-7 q: qsqkgpf +2-11 q: qqfqqqqnqqhlqqq +8-9 c: ccccsccwcp +4-7 m: mmmqmmmm +7-17 c: cxscnqkjdfkcgqzccdkc +4-5 b: bbbzb +3-4 l: llll +1-2 j: ljcn +11-16 r: rrdrrrrrrrrrrrrz +1-15 l: rrlkklllllllgqllk +14-15 b: bpbbbbbbmbbbbbpwb +2-3 q: xcqqh +1-3 q: qwckphmm +1-6 d: dwdtsfxzvdqbbhlhwtk +3-6 n: nmmzcnnmn +6-7 q: qqqqqzq +1-2 z: jzpzz +2-6 r: rrrfmrvlr +3-4 n: nncn +2-3 l: plblwq +2-7 g: gggckcqgwsk +12-13 q: qqqqqqqqqzqxqqq +16-17 s: sssssssjsssssssqs +1-10 h: hjvvvknhmh +11-12 z: zzzzzpzzzczlzz +6-13 q: qqqjrbqcqqqqqxq +6-9 p: ppcpkfpppptp +15-16 p: pplpppppppppppjdh +7-9 c: hqswstxxcnl +2-4 x: ngbxbqszx +1-2 g: sgfxt +6-7 x: bxgnxxt +16-18 j: mjjtjjjjjjjjljjzjjj +13-14 c: ccpccvcccccccgc +3-7 s: fksrgsbcnfmkxdwd +1-4 q: qwpmqjlbhqfnpdjgqjqx +2-3 p: ptpp +4-8 k: sbkkskgc +4-11 j: gjjbjnjjjnnj +1-16 f: fffbwjwfmfqcjffmf +6-8 b: wbbbbwbbbb +1-3 z: rzzv +2-4 v: wvcjnjmdbjjjvptcsv +4-7 b: bmjdfpfwqvgpbb +9-15 f: fdfqffhfpfnffpwfffhf +4-7 t: ttwbttjtdt +3-14 d: ddhdddddddmsdddddddd +3-4 z: vsmm +7-8 w: wwwwwwhw +3-4 r: rrrlvwvqztszhmr +4-5 c: ccctkcn +1-3 g: ggmpdspfbvb +3-4 c: cccc +5-6 p: pqgppspbkpgxvcsp +7-13 n: nnnnlxnvnnmng +9-14 l: lqlllllxlllllzll +6-12 l: llllllllljlxll +3-8 g: jbkzsshsmsngghn +1-4 r: trrrrz +3-4 p: kppg +1-5 w: whljvw +11-14 v: svnrvvtmvccgcxjfbpkd +12-18 q: rqqvfqqqqqtvqqqmqq +12-18 m: mxmmmqmpmmwmmmmmmm +8-9 k: hkvnxnmkpkmplkkkkkkv +6-8 p: ppppppppp +3-5 t: qpxdtctb +15-18 z: zzzzzzzzhzzzzzbtzzt +10-11 t: ttswttttmttttt +10-11 f: ffffxffffffs +2-3 j: hjrj +6-10 x: xxxctxxjgdz +10-11 r: brrcrrrhwlz +9-10 s: sxssssqssksq +7-13 n: bnkwlnnncnnvnnnnn +11-13 f: lffffffffgffcfffffc +2-4 z: qczzfcztz +10-12 q: qxqqqqqcqqjqqqw +6-9 h: hhjhhhhhrqhch +3-4 l: xjmllb +2-5 m: mmmhm +1-2 w: pwkzww +3-7 s: sgccssszvssnqssj +6-8 j: jjgpjjnj +9-13 s: zjhskrssshssvqdxsrns +7-9 b: bbbbbbfbd +8-10 c: cwczgzcccgcctscfx +4-8 s: ssssmgssslrssp +14-20 z: jzjszzzzzzzzptzlzzzz +5-6 d: dsdddhd +6-7 z: zzzzzzh +2-8 f: fpzsgwsh +2-4 d: dddd +5-6 w: wwwdwc +3-4 r: crnr +4-7 s: zssdvsz +19-20 x: xxxxxxxxxxxxxhxxxxhx +7-8 g: ggggggkg +8-10 f: fffwfcfvdfffff +5-6 v: vvvvmv +9-14 k: wkpkknkkklkknkkkkkc +3-4 h: hhhjhhht +1-5 c: cbccrcbcdczgccfct +13-15 x: xxxxxxkxxxxdxpzqxxx +13-15 b: bbbbbbbbbbbbgbb +1-4 v: wvvvnm +5-8 v: zczvdvmvjvzv +8-9 p: gsppkptps +8-17 r: srrrrhjnrrdrrvrrhrv +9-13 l: lmlclllglqllmlll +1-4 g: gfgj +2-8 c: jtvmkcccdmccfxh +5-7 l: llztkvlb +2-7 v: fvlbrrtdpv +7-9 b: bbbbjbwbbd +6-8 j: jsjjjjjjj +3-5 w: wwwbwbgjmlrvfhkvfqp +15-17 l: llllllllllllllfll +13-14 z: dzzzzzzzzzzzzwz +11-13 z: zzzzzxzzzzzzg +3-4 b: pgbntlqbtbbbnp +7-12 z: zzpzjzzzmzzzzjzjzz +2-11 h: dtjsvvjkvghq +3-5 p: zpcjpp +14-17 z: zzzbzzznwzzzzzzzzzzz +3-6 h: nxhlfxlxngphhbdb +7-10 n: tjnnnncwnnvnnn +1-2 b: bfbm +13-16 t: ttdttttttrttztttt +9-10 t: jthtfttttttttt +8-9 z: cvfzzfnzzzzzlfzz +15-16 b: bbbbjbbpbbbcbbmm +3-9 x: rrqxxgxxt +4-18 j: qqqjlzcjfnjddjnqzvh +3-14 q: qqzqqqqqqqqqqdqq +5-6 h: hhhlch +5-11 z: zzjdzjzdtzww +2-9 w: wwwswwgbftlr +3-4 l: hlllbgdczpl +5-8 c: wwcvccckcccc +1-3 j: czjzxblj +1-3 z: vjzjz +11-16 m: mmmmmxrmmmmmtmxkmmhd +4-10 h: gzkhhxplhhhh +3-7 d: smdxmdfpn +12-17 t: tttttttntttdttttt +3-4 f: kfffjwhbllp +4-10 h: hhgkvhhhnqhh +14-18 w: whlchwwqwwlrwjdbwww +4-6 z: szjzhjhpzzmgz +3-9 x: xxxxxxxxq +5-6 x: rxprlx +3-4 b: pbbbbb +11-13 g: ggggggggggggh +2-3 b: bfbb +6-7 d: dddddvd +2-10 p: ppskvdctvpsn +12-18 r: rrrrsrrrrrrfrrrrrrr +4-5 c: ckclcc +8-13 v: vvtmtvvvvvvvvvzwp +4-18 j: qmdwjqqlpznldltqvjm +1-4 j: dbcjpzk +4-5 f: ffmfqvzf +8-10 p: pprptnfvpphvppp +7-8 z: zzzzzzzzz +10-11 n: xnnnnnnnnnnn +10-17 v: jwmqwvplsvvvfhhll +5-6 w: wwwwqtw +5-13 c: cccwbcccccccncfc +13-17 r: rrrrrrrrrrdrrrcrldn +2-15 b: nbnknkblbdbbhxxn +17-19 n: jwmjbxxvcrqlwpsknnz +5-16 x: xxxxxxxxxxjxxxxnx +1-7 m: mmmmmmvm +4-5 r: rrrrv +6-7 c: xkdzcscg diff --git a/2020/02/puzzle-1.awk b/2020/02/puzzle-1.awk new file mode 100755 index 0000000..77971dc --- /dev/null +++ b/2020/02/puzzle-1.awk @@ -0,0 +1,10 @@ +#!/usr/bin/env -S awk -f + +{ + split($1, bounds, "-") + freq = gsub(substr($2, 1, 1), "&") - 1 + if (freq >= bounds[1] && freq <= bounds[2]) + count++ +} + +END { print count } diff --git a/2020/02/puzzle-2.awk b/2020/02/puzzle-2.awk new file mode 100755 index 0000000..24398e7 --- /dev/null +++ b/2020/02/puzzle-2.awk @@ -0,0 +1,19 @@ +#!/usr/bin/env -S awk -f + +{ + split($1, pos, "-") + split($3, str, "") + char = substr($2, 1, 1) + + # Count the frequency of char + freq = 0 + if (str[pos[1]] == char) + freq++ + if (str[pos[2]] == char) + freq++ + + if (freq == 1) + count++ +} + +END { print count } diff --git a/2020/03/input b/2020/03/input new file mode 100644 index 0000000..6673c40 --- /dev/null +++ b/2020/03/input @@ -0,0 +1,323 @@ +....#..#.......#........#....#. +..##.#.#.#...................#. +....#.#.##..#....#......#...... +.........#.#......##.....#..... +..........#.###.##...##........ +#....#.#.......##.....#..#..... +#...........#.#...#..#..##.##.. +......##.............#.....#... +..##..........###..#.#..##..... +...........#........#......##.. +..##...........##.............. +..#......###.#.....#.#.#....... +..#..#..#..........#.#....#.... +.#.....##...................... +...#...##..#...#.........#..##. +.#......#..#..#...#......#.##.. +..##.##.......#..#.....#..#...# +..............#..#..#...#...... +...#...#....##.....#...#...#... +......................#...#.... +.......#......#...#..##...#.#.. +##......#..#.....#....#.....#.. +....#.#.##.#.#....#............ +#.....##.............#......... +..........#...........#.#.....# +...#...##....#.#........#..#... +................#..#.##.##....# +......#...#...##...##....#..... +##....#..#..#...#..#........... +#..................#...#.#..#.. +....##....##.#....#..#......#.. +.....#...........#.........##.. +..#..............#.........#..# +......##....................#.. +..#.....###...####...#...#.##.. +#..#.#......#.....#.......#.#.. +##.#.........######........#... +..#....###...#.#..............# +.....#..............#.........# +....#......#..#.........#...#.. +.....###.....#.###.......###... +#.#..#.....#....##...#........# +..##....#..#.........#...#.#... +..#..##.............#....#.#.#. +..##.#..#.#.#.........##....... +#.#..#.........#..............# +#..#.........###.......#.#..#.# +.............#...#....#......#. +..........#.#...##.###.....#.#. +..#.....#...................... +.......#......###.#.......#.... +....#....#.........#...###.#.#. +.#.............#............#.. +....#..#.............#.#....#.. +....#.....#...#...##.#......... +..#...#...#..................#. +........#....#.....#........... +.....##.......#...#.#..#..#.... +...#............#..#.#......... +......................#........ +....#......#.....#.#....#...... +.....#..#.........#.........##. +...............#.....#....##... +...#.#.#...#..#...........#.... +.#....###......##...#.#.#.#.... +.....#...#....####....##....... +..#......#..#.....##.#...#..... +...#.##..#....#..##.....#...... +..#......#...#...##.....#...#.. +......#.....#........#......... +..#.#....#..............##....# +..#...#......##............#... +.##.#.......#.......#......#..# +...##.##...#.....#.......#..#.. +......##..#....#.......#....... +.....#..#..#.#.....#.....#...## +##.#...#.#.#.....#...#.#.#.##.# +...................###...#..#.. +.#.....##.#......#........#.... +.##...##.#..........#...#....#. +......#..............#.#......# +...#.......#..#...........#.... +.###...#............##..#...##. +##..#.#.........#............#. +#...#.#......#.##...........#.# +.#.#...#........#......##...... +....#...#...#.....#...#....#... +...##...........##.........#... +.........#...#..###............ +..#........#...............#... +.............#....#.#.......... +........#......#.#.......#....# +.................#....##.#.##.. +..#...##........#.............. +#..#........#...#....#......... +......#.#.....#.....#..###.#..# +....#............#...#.#.#..... +............#..........#...#... +..........#....##.#.........#.. +..............#...#...#..#..... +#......#....#..##....#......##. +...#....#.................#.... +.#.##.............#...#....##.. +....#..#.........#..#....#....# +..#.....##..#......#.#..#...... +..#..#.....#........#...#..#..# +.........##.#.##.#.......#....# +..#.......##.##...#.....#.....# +.............##...#...........# +..#......#..#....#...#..#.##... +....#........#......#.........# +.......#........#..#.#.#..##..# +..#......#...........##...#.... +.....#..#.#...#..............## +.#..#......#......#........#..# +...##...............#....#..... +.......#...#.......##..#....... +.....#....#...#...#..#.....#.#. +...#.........#.....#........... +...#.....###....#....#...#...#. +#..#.....#.........#.........#. +.................#.#.....#....# +...........#..........#..#..... +........#.#....#...#..#.....### +#............................#. +..##..#..#...##.........#...... +......##....#.#...#.........#.. +......#..##.#......#..#.....#.. +...#.......##....#.#....#...... +.....#........#...#............ +#.......#...#.........#......#. +......#......#....#..#......... +..#.#........#..#......#....#.. +.#..#.#..........##....###.#..# +...#....#.##..#...#....#....... +..#.....#......#.###.......#... +..............................# +.....#..#...#...........#...... +.##...#....##....#.#.#.#....#.# +.#...#....#...#........#....... +....#............#...##..#..... +....##..#....#....#.....#....## +.............#..##.#.#.#....... +#.......#.#.#.......#..#..#.... +#..#...........#.......###..#.. +.#..##.#.....#........#........ +..#.#.......#............#..#.. +...........#..#............##.# +.....#.......#.....#..#.##.#..# +......#......##.....##......... +..##.#..#.#..#..#.............. +.....#.............##...#.#.##. +.#......##.#..........#........ +..#..#.........#.....#.#.#..... +..#.....#.......#.....#..#..... +#.#.#........#.#...#....#..#... +.#.#.......#............#....#. +......#..................#....# +.#...#...#.....#.#..........#.. +.#..##....####...........#.#... +..##.....#...#.#....#....#..... +#.....................#....#.#. +###..###.#.#...........#.....## +......#......#..........#...... +...#......#.##.....#......###.# +.............#..#.#...........# +..#.............#.#..#.....#... +...#...............#....##...## +........#.................#.... +#..###.....#.......##.#......## +....#.#..............#......... +#..........#.....#..##...#..... +................#...#..#....#.. +..#...#....##..........#.#..... +......#........##......#..#...# +...#....#..#.....#.......#...#. +.#.....#..#...#..###....#...... +....#.........#....#.#.#.....#. +#.#....#...#....#.....#..##.... +.......#..#..#..........#...#.. +..#.#..#.....##.#.#............ +..#....#.....#..##..#..#.#..#.. +..#.##.#...........#...#..#.... +.........#........#...#........ +..#.#.#.......##.........#.##.. +#.#..........#.#...#..#......## +.#..#....................#.#... +.##......#................#...# +..##.#######......#....#....... +....#...##.#....#.#............ +.##....#...##.......#...#..#... +...........#...#...#...#..#.... +#...#.....#.......#....#.....#. +.............#................. +........#.#.......#...#.#.#.... +..............#............#.#. +......#......##..#.......#....# +##...#..................#...... +.....#......###.....#.......#.# +.....#.#............#.#........ +..#.#..#............#....#.#... +##.#.###.#.#.#..#......#....... +...##........#..#.....#.#.#..#. +##......#.##.....####..#....... +............#...#..#...#..#.... +...#..#................##.#..#. +.#....#.#...........##.#.#...#. +####..#...........#.......###.. +.......#.................#..... +.......#....#.......##....#.... +..#.........#...#....#......... +..........#..#...#.#...##..#... +....##..........#.........##... +#.........##..#.#..#.......#... +.#...........#....#...#...#.#.. +....#..#.....#...##....#.#....# +.#....#.....#......#..##.##.#.# +#......#..#.......##........... +...#..#...#.#.................# +......#.......##....##.#......# +....#....#.#.#.....#....#....#. +..#..........#.##...##..#...... +...#..#........#....#.#..#....# +##.......#........#..........#. +.#........#.......#...#..##...# +..#..#..##..#...........#...### +..#......#..........#..##...... +.#.....#..#.#...#...#.........# +#.#......##.................... +#...#.....##...........#....... +........#...#....#.......##.... +...#.##...#....#....#..#..#..#. +...#..#......##....#..#..##.... +#...#..........#.#............. +##..#........##.....#.........# +.....#......#.#...###..#....... +#..##.#..#.###...........##..#. +.....#....#..........#.......#. +##.........##.#................ +....#.........#............##.. +.......#........#......#..#..## +.#...#...##..#....#..#......... +.............#...#.#........#.. +......#..#...#..#.###..#....... +........##.#..#.#..#..#........ +#.##..#..#..........#...##..### +.##...#............#.#...##..#. +................#....##.#...#.. +#.................#..........#. +...#..#..#..................... +..#...##.#.#................... +.....#...#.......#............# +..#..#.........#..##.#..#.#...# +.....#.#.....#.#.......#.....#. +..................#..#....#.#.. +..#.....###.##.......##....#.#. +..#......##.......#....##.#.... +....#...................#..##.# +.......#....#.##.#.......#....# +..#...#......#..#...###....#.#. +..#..#.#....#...........#.....# +.....#..#..#.......#........#.. +......#.##.#......#...........# +#...#....#.#..##.##..#..##..... +#...##....#.#...##........#.... +..##............#.#.#.......... +....#.....#.#..#.......#..#.... +#..#.#.....#..#..##...#..##.... +...##........#...........#...#. +.####......#..##.........#.#... +.......#....................... +.................#....#..#..... +.........##......###........... +.##......#.#.#....#.#...#..###. +....#......##.###.#.#..#....... +..........#.......##......##..# +...........#.......#..##....... +.....###..#..............##.... +........##..#.#.#......#....#.. +#....#......................... +...........#...............##.. +......#.................#...... +.....#...#..##...##...#...#.... +..........#.#...##.####......#. +..#.#.....##....#...........#.. +..........#....#..#....##...#.. +.#.......#..##...#...#.....#... +...##....#.#......##...##....#. +#.......#.......#.##.#...#.#... +#...#..................#......# +..#.......#...............#..## +#.....#..................#....# +.##.....#.....#......####.....# +..#........#...#.#........#...# +..##.....#....#...#...........# +..#..#.....##..#.##...#........ +..........###..#....##.....#... +...#...#....#.##.#...#.#....... +..##......#.......#.......##... +............#............#..... +.##....#.........#............. +....#....#....#........##...#.# +.......##...................... +..........#.#.................# +......##.#...#.........#.....#. +..#...#......#..#.............# +..........###.#..#.#...#..#..#. +#..#.#..#....##...#...#.#...#.. +.#........##...#......#.##..... +...###.#...##..............##.. +#.#.#...#...#..#....#.#..#..... +.#.#.##..#....#......#.#....... +...#..#.#....##...........#..#. +.....##..##......#.#........... +......#.....#....####....#..... +.#.#.#...#..#..#...........#... +.....#......................#.. +.........#.........#.###.##.... +.....#......##..........#...... +..#...........##...........#... +..............#.........#.....# +..#....#..#...#...##.#......... +.#.#.#....#..........#......... diff --git a/2020/03/puzzle-1.awk b/2020/03/puzzle-1.awk new file mode 100755 index 0000000..3eac2ba --- /dev/null +++ b/2020/03/puzzle-1.awk @@ -0,0 +1,14 @@ +#!/usr/bin/env -S awk -f + +BEGIN { x = 1 } +{ + len = split($0, obs, "") + + if (x > len) + x -= len + if (obs[x] == "#") + count++ + + x += 3 +} +END { print count } diff --git a/2020/03/puzzle-2.awk b/2020/03/puzzle-2.awk new file mode 100755 index 0000000..88e0625 --- /dev/null +++ b/2020/03/puzzle-2.awk @@ -0,0 +1,36 @@ +#!/usr/bin/env -S awk -f + +BEGIN { + slope[1] = 1 + slope[2] = 1 + slope[3] = 1 + slope[4] = 1 + slope[5] = 1 +} + +{ + len = split($0, obs, "") + + right = 1 + for (i = 1; i < 5; i++) { + if (slope[i] > len) + slope[i] -= len + + if (obs[slope[i]] == "#") + count[i]++ + + slope[i] += right + right += 2 + } + + # Specific code for slope 5 + if (NR % 2 == 1) { + if (slope[5] > len) + slope[5] -= len + + if (obs[slope[5]++] == "#") + count[5]++ + } +} + +END { print count[1] * count[2] * count[3] * count[4] * count[5] } diff --git a/2020/04/input b/2020/04/input new file mode 100644 index 0000000..c49fb69 --- /dev/null +++ b/2020/04/input @@ -0,0 +1,1135 @@ +eyr:2029 pid:157374862 +byr:1991 ecl:amb hcl:#a97842 hgt:178cm + +byr:1962 pid:547578491 eyr:2028 ecl:hzl hgt:65in iyr:2013 hcl:#623a2f + +hgt:71in eyr:2037 +ecl:#8e276e hcl:z iyr:2019 +byr:2022 pid:157cm + +hcl:#733820 hgt:175 eyr:2028 iyr:2011 +pid:87786389 +ecl:hzl byr:1980 + +hgt:163in hcl:z pid:8261494508 cid:136 ecl:grn eyr:1958 +byr:2030 iyr:1991 + +iyr:2021 +hcl:6708a3 +ecl:zzz eyr:2034 byr:2010 +hgt:189cm +pid:466438311 + +iyr:2012 pid:9720867166 byr:2006 eyr:2022 hgt:72cm ecl:utc hcl:#c0946f + +ecl:#353bc9 +iyr:2020 pid:874363951 cid:113 +hcl:z eyr:2040 hgt:76in byr:1975 + +eyr:1971 +byr:1955 pid:193cm hgt:189cm hcl:#ceb3a1 ecl:grn +iyr:2023 + +byr:2014 +iyr:2026 eyr:1978 hcl:z cid:312 pid:8294818417 +hgt:169in ecl:#82bb02 + +ecl:amb +byr:1936 hcl:#7d3b0c pid:429853734 +cid:342 iyr:2010 eyr:2025 hgt:160cm + +byr:2025 hgt:176in hcl:a490ac +ecl:#956d3f iyr:2027 +eyr:2021 pid:9858101884 + +hgt:142 pid:175cm +eyr:1952 byr:2004 iyr:2007 ecl:#da035e hcl:#623a2f +cid:194 + +hgt:156cm +pid:349122810 hcl:#b6652a eyr:2026 byr:1948 ecl:lzr iyr:2020 + +byr:1997 ecl:blu +hcl:#888785 pid:381094641 iyr:2014 hgt:192cm eyr:2027 + +hcl:7b10a2 ecl:lzr byr:2022 +eyr:2035 +pid:#38b715 hgt:190in iyr:2029 + +pid:188cm byr:2014 +cid:241 ecl:#dda9bd hcl:#8f6ebc +hgt:188cm iyr:2014 eyr:2029 + +hgt:76cm ecl:gmt hcl:z iyr:2024 +pid:3283057785 +byr:2019 eyr:2026 + +iyr:2010 pid:284327216 hgt:191cm +byr:1970 +hcl:#18171d +ecl:grn +eyr:2023 + +byr:1929 eyr:2026 cid:194 ecl:oth hgt:156cm pid:224596482 hcl:#b6652a iyr:2013 + +eyr:2030 byr:1958 hgt:190cm +pid:162950579 iyr:2010 +ecl:brn +cid:250 hcl:#fffffd + +ecl:xry iyr:2025 pid:#0155c1 +hcl:#341e13 +eyr:2027 hgt:163cm byr:2025 + +hcl:#602927 pid:908859481 byr:1962 ecl:hzl +iyr:2021 eyr:2028 hgt:180cm + +iyr:1966 eyr:1976 pid:#bbfe21 hcl:63454a cid:259 +ecl:blu +byr:2024 hgt:69cm + +ecl:#644daf +byr:2021 eyr:2040 +hcl:bc83fe +iyr:1976 hgt:59in pid:60311335 + +iyr:2018 +pid:121801570 hgt:182cm ecl:blu byr:1922 cid:265 eyr:2024 hcl:#888785 + +byr:1933 +pid:232653422 ecl:gry hcl:#18171d +hgt:171cm eyr:2035 iyr:2011 + +ecl:oth iyr:2015 byr:1937 +pid:828621370 hcl:#602927 +eyr:2026 +hgt:193cm + +iyr:2010 ecl:grn eyr:2022 +hcl:af37d1 pid:761632482 hgt:65in cid:93 +byr:1993 + +hgt:169cm cid:121 +iyr:2018 +hcl:#6b5442 +pid:059725560 ecl:oth +byr:1972 eyr:2028 + +eyr:2024 byr:2023 ecl:gry +iyr:2017 +pid:778551716 cid:256 hcl:#733820 hgt:184cm + +hcl:#ceb3a1 pid:613277258 byr:1941 hgt:67cm eyr:2029 +ecl:hzl +iyr:2017 + +ecl:hzl iyr:2012 pid:498418959 eyr:2022 +byr:1929 hgt:164cm hcl:#a97842 cid:226 + +hgt:157cm eyr:2029 +byr:1922 iyr:2014 ecl:grn cid:233 hcl:#888785 pid:802870003 + +hgt:184cm +ecl:oth hcl:#888785 iyr:2010 byr:1929 eyr:2030 +pid:063671905 + +hcl:#888785 hgt:144 eyr:1961 +iyr:2005 +byr:2027 +cid:164 pid:41787324 +ecl:utc + +hcl:#7d3b0c +pid:570743051 byr:2022 eyr:1975 +iyr:2018 ecl:utc hgt:188in + +eyr:2028 pid:970460968 +hgt:161cm +iyr:2017 ecl:amb +cid:318 byr:1967 hcl:#cfa07d + +hgt:183cm eyr:2036 hcl:070713 iyr:1959 +cid:242 byr:2011 pid:#0855a5 ecl:lzr + +hcl:#ceb3a1 eyr:2023 iyr:2016 +ecl:oth hgt:84 +pid:156cm byr:1949 + +eyr:2025 ecl:brn hgt:172cm pid:487559063 iyr:2013 +hcl:#efcc98 +byr:1985 + +eyr:2023 hcl:#6b5442 byr:2021 hgt:75cm iyr:1943 +pid:427375038 ecl:#70c167 + +ecl:hzl +eyr:2028 byr:1957 iyr:2010 +hcl:#602927 +hgt:151cm pid:755290924 + +cid:184 hgt:172cm +pid:7056500139 iyr:2016 byr:2016 +hcl:e40e08 ecl:#d21247 + +ecl:oth +eyr:2025 +iyr:2010 byr:1971 cid:128 pid:932834922 +hcl:#602927 +hgt:167cm + +ecl:brn hgt:61in iyr:2016 hcl:#341e13 +pid:918193693 byr:1972 eyr:2029 cid:56 + +byr:1956 iyr:2020 eyr:2030 hgt:72in +pid:179969841 +ecl:blu + +ecl:#09fd92 cid:209 hgt:69cm iyr:2014 +eyr:2028 pid:#2ad9c0 hcl:#b6652a +byr:2012 + +ecl:lzr byr:1980 cid:104 +iyr:1965 pid:57029893 hcl:z +eyr:2030 hgt:64cm + +pid:496149551 +hcl:#6b5442 hgt:181cm byr:1978 iyr:2017 +eyr:2026 +cid:291 ecl:hzl + +iyr:2018 hcl:#ceb3a1 +eyr:2021 cid:183 pid:612653062 +ecl:oth +byr:1982 + +hgt:153cm pid:877597531 ecl:gry +iyr:2014 hcl:#866857 cid:333 +byr:1953 +eyr:2022 + +iyr:2015 +ecl:brn +pid:823959694 byr:1998 hcl:#18171d +eyr:2025 hgt:174cm + +iyr:2012 cid:93 +ecl:oth pid:142618419 byr:1955 hgt:193cm eyr:1977 hcl:#602927 + +hcl:z ecl:dne iyr:1926 eyr:2026 pid:175cm hgt:150 byr:2023 cid:234 + +hgt:61cm iyr:1965 byr:1956 +pid:224946350 cid:105 +eyr:1951 hcl:#733820 ecl:amb + +hcl:#866857 +byr:1970 pid:447859408 +eyr:2030 +hgt:65in iyr:2011 ecl:grn + +cid:184 eyr:1976 byr:2021 hgt:187cm +pid:858786336 ecl:#0d63e1 hcl:z + +hgt:178cm iyr:1986 hcl:51ac0c ecl:dne eyr:2023 pid:180cm + +hcl:#cfa07d pid:002093179 +ecl:oth +byr:1983 hgt:159cm iyr:2016 eyr:2025 + +ecl:gry hcl:#c0946f +byr:2009 pid:#e00fc8 +hgt:62in cid:150 iyr:2013 eyr:1957 + +byr:1942 ecl:oth eyr:2020 pid:765036664 hcl:#6b5442 iyr:2015 cid:155 + +ecl:hzl iyr:2014 +hcl:#efcc98 hgt:179cm eyr:2028 +byr:1921 pid:#666905 + +ecl:utc eyr:2040 hcl:669f5b pid:981368190 +byr:2006 iyr:1949 +hgt:179in + +ecl:#062fcd eyr:2035 byr:1962 iyr:2026 hcl:z hgt:161cm pid:75591618 + +hcl:#b25ef5 pid:434943296 +ecl:oth hgt:165cm +iyr:2013 eyr:2020 +cid:78 byr:1924 + +iyr:2018 ecl:oth byr:1972 eyr:2028 pid:035313920 +hgt:59in hcl:#fffffd + +hgt:185cm +hcl:#6b5442 +cid:102 iyr:2020 byr:2001 +eyr:2028 pid:003365121 ecl:amb + +pid:90937712 hcl:z hgt:173in byr:2012 ecl:blu iyr:2009 eyr:2039 + +pid:509460932 eyr:2026 +hgt:71in iyr:2010 cid:138 byr:1929 ecl:grn + +ecl:xry +hgt:119 +pid:051834447 eyr:2033 +iyr:2030 hcl:z byr:2030 + +pid:443984745 eyr:2026 ecl:oth +byr:1948 hcl:#a97842 hgt:168cm +iyr:2017 + +hcl:#602927 iyr:2020 cid:161 pid:069708283 hgt:178cm byr:1960 +eyr:2022 ecl:hzl + +iyr:2026 hcl:766b30 eyr:2032 byr:2030 pid:40361792 hgt:158in ecl:#b300dc + +eyr:1998 pid:#5c21e4 iyr:2029 ecl:#bef182 +byr:1944 hgt:166in +hcl:#b6652a cid:317 + +ecl:amb +eyr:2024 +hcl:#a97842 +pid:086765271 hgt:183cm iyr:2018 cid:314 byr:2001 + +hgt:163in pid:491612094 iyr:2028 +cid:82 ecl:#8a052d +hcl:#ceb3a1 +eyr:2018 + +byr:1970 eyr:2039 +hgt:174in hcl:#623a2f +iyr:2020 cid:154 ecl:grn pid:103138652 + +pid:73895324 eyr:2026 byr:1952 ecl:brn hcl:#733820 hgt:159in iyr:2015 + +hcl:#623a2f ecl:brn eyr:2026 hgt:185cm pid:791563822 iyr:2019 byr:1951 + +hcl:#fffffd +iyr:2014 hgt:83 cid:101 pid:724483094 +eyr:1995 byr:2015 ecl:lzr + +hcl:#ceb3a1 +iyr:2013 +eyr:2021 byr:1994 ecl:hzl +pid:037849486 hgt:60in + +pid:63340670 iyr:1995 hcl:b54c2b hgt:71cm +cid:184 byr:2004 ecl:dne eyr:2026 + +hgt:169cm +ecl:brn byr:1947 iyr:2014 cid:224 hcl:#7374df + +hcl:#623a2f +pid:471948403 ecl:gry +hgt:154cm +eyr:2023 iyr:2016 byr:1925 + +eyr:2024 hgt:180cm hcl:#efcc98 iyr:2020 ecl:gry byr:1961 pid:318184801 + +ecl:blu iyr:2012 eyr:2020 hgt:190cm +byr:1977 +pid:331654452 hcl:#cfa07d + +pid:812502106 byr:1938 +eyr:2020 hgt:169cm ecl:oth hcl:#341e13 iyr:2011 + +cid:286 byr:1942 eyr:2034 hgt:116 +ecl:utc +iyr:2023 hcl:#602927 pid:181cm + +ecl:amb iyr:2011 hcl:#cfa07d eyr:2029 byr:1975 +hgt:183cm pid:548900689 + +ecl:utc pid:182cm +hgt:60cm +eyr:1989 iyr:1993 hcl:z + +iyr:1985 hgt:186 byr:2018 +eyr:2001 pid:9257131167 +hcl:261a65 ecl:lzr + +hgt:152 +byr:1922 pid:72992226 +iyr:1968 +ecl:dne eyr:2028 hcl:5c2950 + +ecl:grn +byr:1943 hgt:74in eyr:2022 +pid:135491924 +iyr:2011 hcl:#623a2f + +iyr:2026 pid:7955389103 +cid:311 +ecl:#b81171 hcl:z eyr:1935 byr:2024 + +byr:1974 iyr:2010 hgt:165cm +ecl:amb cid:343 eyr:2023 +pid:972786259 hcl:#6b5442 + +iyr:2020 byr:1936 +ecl:gry hcl:#efcc98 hgt:170cm eyr:2021 pid:520354073 + +hgt:185cm hcl:#ceb3a1 +pid:317012754 byr:1991 +cid:199 iyr:2011 +ecl:blu eyr:2028 + +ecl:#e4e01f byr:2008 +cid:293 iyr:2013 hcl:z pid:#368f7a eyr:2036 + +eyr:2022 pid:424388475 iyr:2008 hcl:z hgt:61cm +ecl:zzz byr:1985 + +hcl:#18171d iyr:2014 +cid:88 +byr:1951 eyr:2021 pid:812441789 hgt:181cm ecl:blu + +ecl:amb eyr:2029 hgt:70in pid:580245172 +iyr:2010 byr:1927 +hcl:#a97842 +cid:284 + +hcl:#3b85ed +ecl:gry eyr:2029 pid:417534919 byr:1960 +iyr:2010 hgt:71in + +hcl:#c0946f +pid:824103775 hgt:157cm iyr:2018 ecl:brn eyr:2024 byr:1961 + +pid:673501373 +eyr:2033 +ecl:#06523f hcl:z byr:2030 iyr:1978 hgt:153cm + +iyr:2019 +hcl:#a97842 byr:1951 hgt:183cm eyr:2024 ecl:blu +pid:346079429 + +eyr:1937 pid:964649406 +hgt:162 +cid:66 +ecl:#f89cc0 +hcl:#866857 byr:2024 + +hgt:114 ecl:#e7ed3a +byr:2029 cid:190 +eyr:2026 iyr:1986 hcl:z pid:185cm + +hcl:#cfa07d hgt:192cm +pid:12494711 eyr:2028 +iyr:2020 +ecl:brn byr:2004 + +pid:710015269 +byr:2011 eyr:2033 hgt:181cm +ecl:#fb2702 + +cid:259 pid:208799387 +eyr:2025 hcl:#623a2f byr:1947 ecl:oth hgt:164cm iyr:2014 + +ecl:brn eyr:2025 pid:432178809 hcl:#341e13 +cid:50 +hgt:192cm iyr:2012 +byr:1994 + +hgt:150in pid:4902585462 ecl:#7074ad cid:230 iyr:2019 eyr:1931 hcl:z byr:2007 + +ecl:gry +byr:1942 +hcl:#602927 cid:178 iyr:2014 hgt:193cm pid:349100081 eyr:2030 + +byr:1923 hcl:#cfa07d eyr:2021 ecl:brn pid:591544598 hgt:157cm +iyr:2016 + +hcl:e15737 +iyr:2017 byr:2030 +eyr:1994 pid:470833249 +hgt:181cm cid:70 ecl:grn + +eyr:2030 +hcl:#866857 pid:569423049 byr:1948 +ecl:oth + +eyr:2026 +byr:2006 +hcl:#ceb3a1 +iyr:2010 pid:094156115 hgt:64cm ecl:oth + +byr:2002 cid:215 ecl:hzl +hcl:#602927 iyr:2015 pid:53150410 hgt:168cm eyr:2028 + +iyr:2016 hcl:#7d3b0c hgt:162cm +byr:1937 eyr:2020 ecl:hzl pid:728906226 + +byr:1921 +iyr:2018 hcl:#888785 +eyr:2026 hgt:185cm pid:164432370 ecl:brn + +ecl:gry iyr:2011 +eyr:2026 hgt:190cm +hcl:#866857 pid:884570088 byr:1996 + +ecl:blu +cid:257 +iyr:2016 byr:1989 +eyr:2024 hgt:179cm hcl:#c0946f pid:418340261 + +pid:9367990743 hcl:z hgt:182in ecl:utc +byr:1988 eyr:2025 + +ecl:hzl hgt:157cm +iyr:2010 eyr:2027 +hcl:#fffffd byr:1956 + +eyr:2024 pid:834302242 ecl:hzl +iyr:2015 cid:97 hgt:188cm hcl:#888785 byr:1927 + +ecl:brn eyr:2021 byr:1958 +hcl:#a97842 hgt:170cm pid:256795932 iyr:2017 + +hcl:756c4a +pid:812879747 +byr:2002 +eyr:2027 ecl:blu iyr:1952 hgt:66cm + +pid:#c5e14f +iyr:2026 byr:2028 hgt:162 hcl:87ba57 +eyr:1952 ecl:lzr + +hcl:#341e13 hgt:81 eyr:2021 iyr:2029 cid:262 ecl:amb pid:61006868 +byr:2011 + +pid:#e58702 cid:145 hcl:#866857 +ecl:grn iyr:2028 hgt:192in eyr:2025 byr:2017 + +iyr:2026 byr:1969 +ecl:grn +hgt:70cm cid:140 hcl:e0f231 eyr:2027 +pid:2832019 + +cid:112 eyr:2028 iyr:2018 hcl:#7d3b0c pid:868808117 byr:1985 ecl:blu + +iyr:2017 +pid:350399038 +cid:72 hcl:#ceb3a1 +ecl:gry +hgt:151cm byr:1946 eyr:2029 + +eyr:2026 hgt:174cm iyr:2010 pid:534641153 hcl:#733820 byr:1965 + +hgt:66cm +byr:2010 ecl:gmt eyr:2039 +iyr:2024 hcl:z + +pid:626085326 +byr:1971 eyr:2024 +hcl:#cfa07d hgt:170cm +ecl:hzl iyr:2019 + +hgt:185cm pid:995661846 ecl:hzl iyr:2016 byr:1963 hcl:#a97842 eyr:2023 + +ecl:grt iyr:1976 byr:2010 +pid:170cm +cid:343 hcl:#7d3b0c hgt:171cm + +pid:732695396 +ecl:zzz hgt:151in byr:1955 +eyr:2035 iyr:2026 hcl:z + +hgt:187cm hcl:#341e13 iyr:2015 pid:556697270 eyr:2025 ecl:blu byr:1926 + +ecl:oth +pid:515980529 +hgt:168cm eyr:2023 +byr:1983 iyr:2012 hcl:#341e13 + +byr:2010 +hgt:189cm iyr:2016 +hcl:#8ff71e +eyr:2010 +ecl:blu +pid:317940449 + +iyr:2013 hgt:157cm hcl:#a97842 pid:967988435 +ecl:blu cid:214 eyr:2027 byr:1960 + +pid:2666548509 cid:208 hgt:72cm hcl:#7d3b0c eyr:2040 byr:2008 +ecl:amb +iyr:1926 + +eyr:2039 +pid:203432895 hgt:154cm byr:1949 +iyr:2010 +hcl:z cid:144 ecl:xry + +pid:984689798 byr:2016 iyr:1999 ecl:utc +eyr:2037 hgt:68cm hcl:z + +byr:1969 cid:230 hgt:72cm eyr:2032 +ecl:gry pid:849701444 +hcl:#c0946f +iyr:2012 + +eyr:2026 +pid:588870142 +hcl:#ae5619 hgt:173cm +cid:189 +ecl:grn byr:1996 iyr:2013 + +byr:1973 +hcl:#cfa07d ecl:blu +hgt:193cm eyr:2028 cid:115 pid:786380485 iyr:2011 + +hcl:#fffffd eyr:2028 hgt:155cm pid:499022582 +ecl:blu byr:1977 iyr:2014 +cid:212 + +ecl:#92bb4b +pid:815154669 byr:1923 eyr:2023 +hgt:183cm iyr:1929 hcl:#ceb3a1 + +byr:1966 eyr:2021 iyr:2020 hcl:#6b5442 ecl:hzl +pid:3508035599 +hgt:70in + +ecl:amb +hcl:#18171d +byr:1927 +hgt:177cm pid:555764540 iyr:2018 eyr:2025 cid:90 + +hgt:139 ecl:#878a7d byr:2006 cid:275 iyr:1980 hcl:60fca6 eyr:1952 pid:001439727 + +byr:1985 +hgt:174cm ecl:gry +iyr:2018 +cid:204 hcl:#733820 +pid:141048398 eyr:2027 + +ecl:gmt hcl:#6b5442 hgt:158cm +iyr:2025 +byr:2030 pid:966397365 eyr:2029 + +byr:1962 hgt:166cm pid:261989937 cid:320 eyr:2026 +iyr:2015 hcl:#c0946f +ecl:hzl + +pid:852283506 iyr:2018 eyr:2020 byr:1981 hcl:#733820 +ecl:hzl +hgt:162cm + +pid:3873488100 iyr:1982 ecl:grn +hgt:63cm eyr:1936 +byr:2011 hcl:8d118a + +iyr:1937 +hcl:817646 +byr:2026 eyr:2031 pid:#47591d hgt:183in +ecl:blu + +eyr:2025 hgt:153cm iyr:2015 pid:498382864 +cid:307 +byr:1943 +hcl:#f66fe1 ecl:oth + +iyr:2017 hgt:66in byr:1948 hcl:#b6652a eyr:2025 +pid:188366364 +ecl:amb + +ecl:lzr +pid:453174702 iyr:2028 eyr:2032 cid:228 byr:2011 hcl:z +hgt:172cm + +hgt:186cm eyr:2030 cid:316 hcl:z byr:1994 +iyr:2012 ecl:amb pid:993162839 + +hgt:160cm +ecl:grn pid:523473760 byr:1993 +iyr:2016 eyr:2025 hcl:#602927 cid:261 + +iyr:2016 pid:520973843 ecl:gry +eyr:2023 cid:232 +byr:1944 hgt:159cm hcl:#cfa07d + +byr:1969 hcl:#1d37de hgt:184cm eyr:2027 pid:088048141 +iyr:2016 cid:307 ecl:hzl + +eyr:2040 iyr:2012 pid:723592140 +hgt:61cm hcl:#18171d ecl:dne + +eyr:2025 +ecl:oth pid:4697392468 +hgt:183cm iyr:2017 hcl:b07d71 +byr:1996 + +ecl:amb eyr:2022 cid:143 pid:806594272 hgt:158cm byr:1977 iyr:2014 +hcl:#866857 + +ecl:blu +eyr:2022 iyr:2018 byr:1983 hgt:167cm cid:321 hcl:#efcc98 +pid:344179526 + +byr:1925 eyr:2021 +hgt:193cm iyr:2020 ecl:grn +hcl:#888785 + +iyr:2018 +cid:319 byr:1972 hgt:181cm hcl:#fffffd eyr:2023 pid:493780616 + +eyr:2021 +hcl:#733820 +ecl:#e91c71 +iyr:2020 pid:451676066 hgt:166in +byr:1993 + +eyr:2026 +hcl:#b6652a ecl:blu byr:1999 iyr:2020 +hgt:163cm pid:955741810 + +iyr:2016 hgt:179cm hcl:#602927 +pid:673271332 byr:1963 eyr:2027 ecl:amb + +byr:1927 +iyr:2015 hcl:#866857 +ecl:oth +hgt:159cm +pid:992992996 eyr:2030 + +pid:283188332 hgt:168cm hcl:#6b5442 +eyr:2027 byr:2028 ecl:hzl iyr:2030 + +byr:1944 pid:628012522 eyr:2020 +hcl:#866857 +iyr:2019 ecl:amb +hgt:168cm + +cid:317 pid:333228098 hgt:158cm iyr:2014 byr:1958 eyr:2024 hcl:#a97842 ecl:oth + +hcl:#733820 +cid:314 ecl:oth byr:1938 eyr:2030 hgt:71in +pid:790938694 iyr:2014 + +iyr:2020 ecl:grt eyr:2018 +hgt:155cm +pid:1034925815 hcl:#623a2f cid:304 + +ecl:brn hgt:158cm hcl:#38fe6c eyr:2030 byr:1926 pid:0860404500 iyr:1993 cid:348 + +byr:1998 +hgt:185cm +ecl:brn eyr:2021 pid:567032567 hcl:#733820 cid:328 iyr:2017 + +pid:491430863 cid:146 hgt:181cm eyr:2026 iyr:2015 ecl:amb byr:1950 hcl:#c0946f + +eyr:2033 cid:289 +pid:396679011 ecl:oth byr:1988 +hgt:156in +hcl:#cfa07d iyr:2029 + +ecl:grn iyr:2015 +byr:1986 hcl:#a97842 hgt:62in +pid:403990108 eyr:2030 + +pid:42635067 cid:301 +iyr:2027 hgt:173in +byr:2004 hcl:z +eyr:2034 + +byr:2020 hcl:#fffffd +hgt:180in eyr:2040 pid:304951921 +iyr:2030 ecl:#1aaf20 + +iyr:2020 hcl:#888785 ecl:hzl hgt:181cm byr:1992 eyr:2021 pid:936006959 + +hgt:172in ecl:#fd71a7 +hcl:787715 pid:363058480 byr:2020 +iyr:2022 +eyr:2034 + +iyr:2018 ecl:blu eyr:2029 hcl:#cfa07d hgt:155cm byr:1937 pid:851148031 + +byr:2014 +cid:222 ecl:zzz hgt:67cm eyr:2040 pid:#8ab0e2 hcl:z iyr:2027 + +hgt:180cm hcl:#375883 eyr:2027 byr:1925 ecl:brn +iyr:2011 +pid:158752719 + +byr:1935 ecl:oth eyr:2027 pid:041108579 +hcl:#602927 iyr:2011 hgt:190cm + +hcl:#a97842 pid:131728607 ecl:blu iyr:2014 hgt:176cm eyr:2020 +byr:1921 + +pid:11754457 +iyr:2018 +hgt:65cm eyr:2038 +ecl:dne hcl:z +cid:293 +byr:1940 + +eyr:2023 +iyr:2016 +byr:1930 +ecl:hzl +cid:212 +hcl:#733820 hgt:59in +pid:319501919 + +cid:278 +eyr:1967 hcl:#ceb3a1 pid:#9f5254 hgt:177in byr:1977 iyr:2030 + +hcl:#ceb3a1 byr:1998 hgt:72in cid:202 ecl:gry pid:463378493 iyr:2015 +eyr:2030 + +hcl:#7d3b0c hgt:164cm ecl:hzl byr:1960 eyr:2023 +iyr:2017 + +ecl:hzl hcl:#866857 byr:1986 iyr:2018 eyr:2027 hgt:176cm pid:928057092 + +pid:431113230 hgt:186cm eyr:2025 +iyr:2018 ecl:amb byr:1973 hcl:#623a2f + +hcl:#cfa07d hgt:179cm iyr:2017 pid:760075190 ecl:amb eyr:2030 + +hcl:#602927 +iyr:2012 +pid:571020910 ecl:#b6715d byr:1943 eyr:2028 +hgt:161cm + +hgt:176cm cid:121 pid:654127593 ecl:brn hcl:#160d38 iyr:2015 +eyr:2021 byr:1997 + +eyr:2021 byr:1929 +pid:192025713 +hcl:#c0946f iyr:2012 ecl:oth hgt:179cm + +eyr:2024 ecl:gry +hgt:158cm byr:1932 hcl:#ceb3a1 +iyr:2010 +pid:521188306 + +eyr:2028 ecl:brn +hcl:#efcc98 +hgt:157cm +iyr:2012 +pid:212547203 byr:1970 + +eyr:2029 pid:182693366 hcl:#623a2f hgt:130 byr:1972 +cid:310 +iyr:2010 ecl:amb + +byr:1944 iyr:2013 +ecl:brn cid:335 +hgt:163cm +eyr:2025 hcl:#7d3b0c pid:405230824 + +hcl:#ceb3a1 iyr:2015 pid:572001387 byr:1962 +ecl:amb hgt:151cm + +byr:1928 +eyr:2022 +iyr:2018 ecl:blu +hcl:#602927 pid:767081131 + +byr:1948 hgt:180in pid:188cm +ecl:hzl +eyr:2013 hcl:e0b9f3 iyr:1975 + +hcl:#c0946f byr:1989 +eyr:1980 hgt:67cm pid:538025041 +iyr:2014 ecl:gry + +eyr:2028 pid:958756919 hcl:#733820 byr:1945 cid:158 ecl:blu +hgt:168cm iyr:2018 + +cid:200 hcl:#fffffd +byr:2015 ecl:gry eyr:2031 hgt:59 pid:065027646 +iyr:1967 + +byr:1999 ecl:hzl pid:813536928 iyr:2015 cid:296 hcl:#6b5442 +eyr:2025 hgt:186cm + +byr:2000 iyr:2012 +hcl:#fffffd +cid:263 hgt:68in pid:105489529 +ecl:amb eyr:2024 + +eyr:2026 hcl:#602927 hgt:181cm +byr:1982 +pid:603871531 iyr:2018 ecl:blu + +cid:302 pid:387895477 eyr:2027 +hcl:#cfa07d hgt:191cm iyr:2015 +ecl:hzl byr:1940 + +iyr:2018 cid:165 +ecl:blu hgt:181cm byr:1994 eyr:2026 pid:077013268 + +eyr:2022 hgt:174in iyr:2010 byr:2023 +hcl:#733820 ecl:oth +pid:311692961 + +ecl:#10f2a9 pid:964417986 +eyr:2024 hcl:#0aeec7 byr:1965 iyr:1943 hgt:167cm + +hcl:#341e13 iyr:2020 +ecl:brn +hgt:188cm eyr:2021 byr:1952 +pid:077471062 + +byr:1950 cid:110 hgt:160cm eyr:2026 +hcl:#623a2f +iyr:2013 +pid:972823574 + +pid:553704996 hgt:171cm +eyr:2028 iyr:2017 +hcl:#18171d byr:1954 ecl:blu + +hgt:180cm ecl:brn eyr:2029 pid:707999496 hcl:#cfa07d byr:1960 + +pid:9325738036 iyr:1996 hgt:152in byr:2004 cid:292 hcl:14a56f +eyr:2031 +ecl:#dbd99d + +byr:1957 +eyr:2021 pid:557648216 ecl:amb hcl:#7d3b0c hgt:186cm +iyr:2020 + +hcl:#602927 hgt:186cm pid:604175608 +iyr:2013 eyr:2026 ecl:oth byr:1991 cid:65 + +ecl:gry +iyr:2012 hgt:154cm +pid:872898058 eyr:2030 hcl:#341e13 byr:1994 + +pid:228236326 +iyr:2013 cid:347 byr:1942 +eyr:2021 ecl:brn +hgt:165cm +hcl:#fffffd + +pid:392777182 cid:189 hcl:#cfa07d eyr:2027 hgt:191cm ecl:blu byr:1978 + +hgt:158in iyr:2028 +pid:5145408095 byr:2012 ecl:#94c57d hcl:z eyr:1996 + +byr:1949 eyr:2021 +ecl:#5ffbeb iyr:1948 pid:42650064 hcl:z hgt:167cm + +iyr:2013 ecl:xry cid:100 +hgt:138 byr:2013 +eyr:1944 hcl:92b68c + +hgt:187cm +ecl:grn hcl:#602927 +iyr:2010 +eyr:2022 byr:1949 cid:280 pid:251802347 + +ecl:grn +cid:219 +iyr:2018 hgt:165cm +pid:703878503 eyr:2024 hcl:#b6652a +byr:2002 + +hcl:#18171d cid:341 ecl:amb byr:1941 eyr:2021 iyr:1990 pid:865132177 hgt:153cm + +byr:2008 pid:861480549 +cid:97 eyr:2028 hcl:#efcc98 +iyr:2015 +hgt:191cm ecl:#232b23 + +hcl:#cfa07d +eyr:2030 iyr:2013 cid:304 +ecl:gry pid:199056608 hgt:192cm +byr:1926 + +pid:355135528 hgt:153cm byr:1998 iyr:2019 eyr:2027 +ecl:amb hcl:#18171d + +eyr:2028 hcl:8eed9c ecl:grn +iyr:2010 byr:2005 hgt:107 +pid:64892698 + +pid:601671623 hgt:153cm iyr:2011 hcl:#b6652a byr:1975 ecl:grn eyr:2029 + +ecl:grn hcl:#18171d hgt:157cm +eyr:2023 pid:507932715 byr:1920 iyr:2020 + +eyr:2022 byr:1933 hcl:#fffffd iyr:2016 hgt:181cm pid:826522507 ecl:blu + +byr:2002 hcl:#866857 hgt:177cm pid:240202426 +ecl:gry cid:127 +eyr:2022 +iyr:2014 + +byr:1971 +iyr:2017 +pid:733985576 hcl:#c58c6c hgt:178cm +ecl:blu +eyr:2023 + +ecl:blu iyr:2017 pid:558732458 hcl:#1b3ab5 eyr:2025 byr:1967 hgt:176cm + +eyr:2025 ecl:gry iyr:2020 byr:1988 +hcl:#733820 +hgt:189cm cid:151 pid:934827751 + +ecl:gry eyr:1951 +iyr:1932 +pid:309366394 byr:1945 hcl:#623a2f hgt:179cm + +pid:462345884 ecl:hzl +cid:206 eyr:2021 hcl:#733820 +byr:1982 hgt:180cm iyr:2010 + +iyr:2020 hgt:155cm hcl:#341e13 pid:110467532 cid:92 ecl:hzl byr:1975 eyr:2028 + +hcl:#18171d iyr:2010 +hgt:182cm byr:1930 +eyr:2024 +cid:226 + +byr:1956 hcl:fb0c6f pid:181cm eyr:2012 iyr:2020 +ecl:#d38822 +hgt:69cm + +ecl:gry iyr:2018 +hgt:169cm byr:1981 +pid:534824014 cid:287 eyr:2021 hcl:#c0946f + +eyr:2039 hcl:#328e90 iyr:2015 +hgt:170cm pid:#9fa2a4 byr:1999 +ecl:#cd1fd7 + +hgt:190cm hcl:#733820 +pid:302244363 +ecl:brn +byr:1965 iyr:2013 + +iyr:2012 +eyr:2021 +pid:579705743 +ecl:brn hgt:190in +byr:1954 hcl:#888785 + +eyr:2036 hgt:154cm +pid:800720865 byr:2023 ecl:oth iyr:2010 hcl:z + +pid:#92f6a9 iyr:2028 eyr:1943 +hgt:191cm ecl:hzl hcl:z byr:2018 + +hcl:#c0946f +pid:419930442 hgt:167cm +byr:1969 +eyr:2020 ecl:brn + +pid:137802946 +eyr:2020 byr:1947 ecl:grn hgt:192cm iyr:2016 hcl:#888785 + +ecl:#f66cce eyr:1958 iyr:1954 +pid:833131572 +hcl:z +cid:212 +hgt:109 byr:1924 + +hgt:179cm ecl:gry pid:065881341 byr:1985 +hcl:#fffffd cid:204 eyr:2026 + +hgt:167cm +iyr:2017 pid:898571403 byr:1929 +ecl:blu hcl:#d506d0 eyr:2028 cid:100 + +byr:1991 pid:2795214253 iyr:2011 +cid:152 eyr:2028 +hgt:170cm hcl:#a45065 ecl:lzr + +hgt:188cm eyr:2030 iyr:2010 +pid:297292695 byr:1955 hcl:#fffffd +ecl:blu + +hgt:170cm eyr:2029 pid:913242036 byr:1993 cid:89 hcl:#888785 +iyr:2010 +ecl:blu + +iyr:2028 eyr:2025 hgt:150in ecl:grn +byr:1995 +pid:974802728 +hcl:#cfa07d + +eyr:2021 byr:1989 +hcl:#18171d ecl:blu hgt:168cm +pid:626530259 +iyr:2020 + +hcl:#6b5442 hgt:158cm pid:798732187 byr:1922 eyr:2020 iyr:2011 ecl:gry + +hcl:#341e13 pid:092679330 byr:1997 ecl:oth hgt:159cm iyr:2010 eyr:2026 + +hgt:185cm +iyr:2020 byr:1947 +pid:105846744 ecl:gry cid:134 eyr:2027 + +pid:252016128 hcl:9016ff cid:158 hgt:161 ecl:gry +byr:1952 eyr:1955 iyr:2018 + +iyr:2020 hgt:154in byr:1958 +eyr:2029 ecl:#2feb89 pid:99780178 + +hcl:z +eyr:2001 ecl:gmt +byr:2022 hgt:73in iyr:2029 +pid:388744230 + +hgt:186cm +byr:1939 pid:622948608 ecl:oth eyr:2030 +hcl:#c0946f + +cid:272 +eyr:2025 byr:1979 ecl:brn hgt:180cm pid:456545466 +hcl:#fffffd iyr:2012 + +pid:946657041 byr:1999 +iyr:2014 hcl:#ceb3a1 hgt:150cm +ecl:grn + +byr:1957 pid:177cm ecl:blu eyr:2020 hcl:#cfa07d +iyr:2010 hgt:183cm + +pid:161cm eyr:2025 hcl:#b6652a +cid:213 +ecl:xry +hgt:150cm +iyr:2024 byr:2012 + +hcl:ea1960 +ecl:grn +pid:#7127b2 iyr:2012 eyr:2011 hgt:150 + +pid:178699291 +hgt:66in eyr:2027 +byr:1985 iyr:2014 ecl:amb + +iyr:2017 ecl:blu +eyr:2027 hgt:191cm byr:1990 hcl:#b6652a pid:074411798 + +pid:528782860 +hgt:181cm hcl:#c0946f byr:1965 iyr:2012 ecl:grn eyr:2020 + +pid:#ba10da hgt:176in byr:2006 +ecl:grt +iyr:2030 eyr:1949 hcl:d3ca76 + +hgt:66cm ecl:#898478 hcl:#e9f7a5 eyr:2030 iyr:2022 +byr:2025 +pid:159cm + +byr:1994 hcl:#ceb3a1 +pid:028071950 eyr:2022 ecl:gmt hgt:151in iyr:2016 + +byr:2001 iyr:2011 +ecl:brn +pid:487702556 hcl:#602927 +hgt:167cm eyr:2026 + +# The above line MUST be blank diff --git a/2020/04/puzzle-1.awk b/2020/04/puzzle-1.awk new file mode 100755 index 0000000..4c0c474 --- /dev/null +++ b/2020/04/puzzle-1.awk @@ -0,0 +1,30 @@ +#!/usr/bin/env -S awk -f + +length == 0 { + valid = 1 + for (i in fields) { + if (fields[i] == "") + valid = 0 + } + + if (valid) + count++ + + fields["byr"] = "" + fields["iyr"] = "" + fields["eyr"] = "" + fields["hgt"] = "" + fields["hcl"] = "" + fields["ecl"] = "" + fields["pid"] = "" +} + +{ + for (i = 1; i <= NF; i++) { + split($i, data, ":") + fields[data[1]] = data[2] + } +} + +# Why do I need to subtract one? This code is so old I can't remember +END { print count - 1 } diff --git a/2020/04/puzzle-2.awk b/2020/04/puzzle-2.awk new file mode 100755 index 0000000..bb88145 --- /dev/null +++ b/2020/04/puzzle-2.awk @@ -0,0 +1,67 @@ +#!/usr/bin/env -S awk -f + +function between(x, l, h) +{ + return (x >= l) && (x <= h) +} + +BEGIN { + eyecolor[1] = "amb" + eyecolor[2] = "blu" + eyecolor[3] = "brn" + eyecolor[4] = "gry" + eyecolor[5] = "grn" + eyecolor[6] = "hzl" + eyecolor[7] = "oth" +} + +length == 0 { + valid = 1 + + if (!(between(fields["byr"], 1920, 2002) && between(fields["iyr"], 2010, 2020) && + between(fields["eyr"], 2020, 2030) && length(fields["pid"]) == 9)) + valid = 0 + else { + # Test eyecolor + valid = 0 + for (i in eyecolor) { + if (fields["ecl"] == eyecolor[i]) { + valid = 1 + break + } + } + + # Test height + split(fields["hgt"], height, "[^0-9]") + if ((fields["hgt"] ~ "cm" && !between(height[1], 150, 193)) || + (fields["hgt"] ~ "in" && !between(height[1], 59, 76)) || + (fields["hgt"] !~ "cm|in")) + valid = 0 + + # Test haircolor + if (fields["hcl"] !~ "^#[0-9a-f]{6}") + valid = 0 + } + + if (valid == 1) + count++ + + fields["byr"] = "" + fields["iyr"] = "" + fields["eyr"] = "" + fields["hgt"] = "" + fields["hcl"] = "" + fields["ecl"] = "" + fields["pid"] = "" + next +} + +# Non-blank lines +{ + for (i = 1; i <= NF; i++) { + split($i, data, ":") + fields[data[1]] = data[2] + } +} + +END { print count } diff --git a/2020/05/.gitignore b/2020/05/.gitignore new file mode 100644 index 0000000..e2451f9 --- /dev/null +++ b/2020/05/.gitignore @@ -0,0 +1 @@ +seatids diff --git a/2020/05/Makefile b/2020/05/Makefile new file mode 100644 index 0000000..48f7dd4 --- /dev/null +++ b/2020/05/Makefile @@ -0,0 +1,6 @@ +all: + ${CC} ${CFLAGS} -o seatids seatids.c + +.PHONY: clean +clean: + rm -f seatids diff --git a/2020/05/input b/2020/05/input new file mode 100644 index 0000000..e3bc909 --- /dev/null +++ b/2020/05/input @@ -0,0 +1,908 @@ +FBBFBBBRLL +FBBFFBFLLL +BFFFFFFLRL +FBFBFFFLRR +BBBFBFBRLL +BFBBFFBRLL +BBFFFFBRLL +BFBFBBBLRR +FFBBFBFLLR +FBBBBFBRRR +FFBFBBFRLR +FBBFFFFRRR +BFBFFBFRRL +FFFBBFFLLL +FFFFBBFLLL +FFBFFBBRLL +FBBBBBFLRR +FFFBFFFLRR +FBBBBBFRLR +BFFBFFBLRL +FBBFBFBRRL +FBFBFBFRRR +FBBBFBFLRR +FFBBFBFRRL +FFBFFBFLRL +BFBFBFBLRR +BBFBBBFRRL +BFBFBBFRLL +FBBFBFBLLR +BFFFBFFLRR +FBBBFFFRLR +FBBFFFFLLL +BFFFBBBLRL +BFBBBFBRLR +BFBBFFFLRL +FFFBFFFRRR +BBFFBFFRLL +FFBFBBFRRR +BBBFFBBLLL +FFBBBFFRRR +BFFBFBBRLR +BBFBBFFRLR +FFBFBBFLRL +BFBBFBBLLL +FBBFBFBLLL +FBBFBBFLRL +BFBFBBBRLR +FFBFFFFLRL +FBBFFFFRLR +BFBBBFBRLL +FFFBBBBLLR +BFFFBFFLLL +BFFBFFFRRR +FBFFFFBRLL +BFBFFFBRLR +FFBBFFFLRL +FFBFBFBLLL +FBFBBFBRLR +BBBFFFFLLR +BBFFBBBRLR +FFBFBFBLRR +BFBBFBFLLL +FFBFFBBLLR +FBBFFBBLLL +BFBFBFFRRR +BBFB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BBFBBRLR +FBBBBFBRLL +FFBBBBFLRR +BFFFFFBLRL +BBFBFBBRRR
\ No newline at end of file diff --git a/2020/05/puzzle-1.awk b/2020/05/puzzle-1.awk new file mode 100644 index 0000000..831c127 --- /dev/null +++ b/2020/05/puzzle-1.awk @@ -0,0 +1,2 @@ +$0 > max { max = $0 } +END { print max } diff --git a/2020/05/puzzle-2.awk b/2020/05/puzzle-2.awk new file mode 100644 index 0000000..8b9b823 --- /dev/null +++ b/2020/05/puzzle-2.awk @@ -0,0 +1,11 @@ +{ ids[NR] = $0 } + +END { + n = asort(ids) + for (i = 1; i <= n; i++) { + if ((i + 35) != ids[i]) { + print i + 35 + exit + } + } +} diff --git a/2020/05/puzzles.sh b/2020/05/puzzles.sh new file mode 100755 index 0000000..2066d76 --- /dev/null +++ b/2020/05/puzzles.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +./seatids | awk -f puzzle-1.awk +./seatids | gawk -f puzzle-2.awk diff --git a/2020/05/seatids.c b/2020/05/seatids.c new file mode 100644 index 0000000..9c3b797 --- /dev/null +++ b/2020/05/seatids.c @@ -0,0 +1,37 @@ +#include <math.h> +#include <stdio.h> + +/* Parse the input file `input` and print out all of the seat IDs which can be piped into both awk + * scripts + */ +int +main(void) +{ + FILE *fpt = fopen("input", "r"); + /* +2 for \n and \0 */ + char bpass[12]; + while (fgets(bpass, 12, fpt) != NULL) { + int lower_r = 0; + int upper_r = 127; + for (int i = 0; i < 7; i++) { + if (bpass[i] == 'F') + upper_r = (upper_r + lower_r) / 2; + else + lower_r = round((upper_r + lower_r) / 2); + } + + int lower_c = 0; + int upper_c = 7; + for (int i = 7; i < 10; i++) { + if (bpass[i] == 'L') + upper_c = (upper_c + lower_c) / 2; + else + lower_c = round((upper_c + lower_c) / 2); + } + + int seat_id = upper_r * 8 + upper_c; + printf("%d\n", seat_id); + } + + return 0; +} diff --git a/2020/06/input b/2020/06/input new file mode 100644 index 0000000..7153597 --- /dev/null +++ b/2020/06/input @@ -0,0 +1,2167 @@ +adgvrhblps +pghsdrbmalv +hrlbpdasgv +bgvsdplahr + +lgnpfhrm +hwmng +gunhmo + +txkeafsbgjuizd +etmcgdbfajuz + +xdtzjioqavmchsbfrkp +bzjkriqmvxedotpcf +azjckxmqovtidbprf +fcxmevrkojzpdibqt +roifztvxmbpwcndkjq + +ylcixrdoejn +dyoejlrcxin +dnorleijxyc + +u +u + +nfjrt +hvgqxculeszok +pmwryfdiab + +gh +ebzkr +byqusikr + +b +b +alyr +t + +jzbafspmynwgqdeuklxc +anbkgduyexjlzmpcfwq +zxdkiujqeglcfynwpamb +qwcubamjpxyngkdlzfe +upadgfkywmnxeqbhjzcl + +g +l +g +g +pg + +mazi +mnzdai +zmia +izma + +pqzl +pzql +zvciplq +szpqrl +plczqi + +mquiosghkwtjz +tgnewskmjuozqi +gjwzmqcntosuik +ybtjoqzuwmfgisk + +nvwocedxyqiahgt +zbjvipyfeacuwrt + +ojkhxmwqs +kqxhmrzjwo +mqkjxhwo + +t +t +t +t + +dhrxaqejfng +fhdlbxejqra +fqaeldhjrx +seaqjxzdfthr +adjhrqlxef + +t +bczrx +ueit +nu + +idtmkhnlpbsqfxcevjry +pricynubfvdhjqesmktlx + +wt +nw +w + +mhqe +ey +e + +kwclmuovtihabd +aqheucldfwno +adwnhoclqugez + +lbwnohgs +osnbghw +swogbhfn +hnbosgw +gsowhnb + +jsxyihpaotdlvckgeznqfbmwr +xkhfnwitojasqyrgcelpmbvd +synvibmdpfxwqltgcjohkare +grxicqelsovtdfhujwkanypmb + +druazhicbm +spqizhucrdabmv +imucbayhgzdr + +fnx +unqx + +zjm +qfwrycva + +uktvygcmf +yfktcxmv +ctlkvqysfmb + +j +jng +j +j + +t +tw +t +t + +vogs +ogsv + +tzgqxfauw +wgfxqkuaz +dkzawuftgq +gbuwaqzfjo + +iphexunlbs +tayqgzmkjfdcrvow + +fcdplxkhjbngwzqmiry +khuyrlgvxnpfbdmosqizjc +djzyxikqnmbrlgfhcp +jxycgeidnhlkzqpbmrf +xckrhgbzfnjlpdmiyq + +lezco +ezloc +zolec +ocelz +oeczl + +emgluf +flebmhg + +knafibd +kbrnfd + +xktmidfrz +fajlidmrtzy +wftzdm +omeqbfgdzpnut + +tndpxaveifhcmzyjrsqlub +oyanuslpqdcevfih + +hblawudzknspf +gxnstrmiyqpejo + +lesyaikhnvoguwftzrmqdcpx +pxuqoayiwjzvglstrhfkmcend +uvyfepmxokdrhzlcsniagtwq +ynfmkwxqalpdrezhoguvstic + +grscfn +azlgdcn +ovcgzn +lwxgctan +mgkbiyjhpnc + +ji +ji +iaj + +ivtkp +ikwp +ipko +pkiw + +p +p + +yushxnqa +uokzcaxni +xalvuyn + +elw +wle +wlre +wleq +uwel + +bvfxe +ebvfx + +roaygfv +udazcljhy +pbaryv +aptxy + +zdpkslmvnhyfua +czhfkylumrvgoqaspb +twenpsyzkjmihavuflx + +zsv +bnzjfcamkw +rvdzq +ltypirz + +q +w +q +q +q + +uic +uic +uic +iufc + +rdve +cvzre +fqls + +gxmnabhd +xdbwjngmra +gmxebadny +bgahdxomn + +gnoyc +olgy +poyfjg +wsdouiyghqe +jyog + +q +e + +adszvgclfomph +qavsicdlghozpfm + +czfhs +hzfo +zhf + +luzrpeivwagyfktjhnob +tlwynevkojgpbfuihr +gklbpjvyoituefrwhn +vhypwujfrbktonedigl +byknejlowfrptghivu + +xbu +xbu +xub +bux +xub + +vcqtxyf +tqcvfy + +vumkixjhaozgfbneydpr +yxeazjmvbnhukpigodfr +pjnomhaxuvdkbiryzfge +oezrxngvpajfkdmuyibh + +mkgdruoiawfh +dsumegkpjoq + +oucrtxbqienfvsmlzjkdwgpa +akrqisvxbudelwgpmnozcj +xreauzqglpcvmoidbskwjn +mwgpljcusakrbozxvndeqyi +jdrlvcimoewkpxgqasnuzb + +dshfqywgbc +eiqflapjh +vrmjfhnq + +kojresxi +ubclnpghf + +kuitbfh +ofdkqt +fztk + +lsawunycojgvi +ornsyijx +yojpdsnbxri +tjysrinoe + +ezuqslamgi +alimgeuqz +amgfqzluiew +nmalugivwqze + +lrm +mr +vmrgt +mr +mlr + +ybcnizhwt +ycbmztih +octgiqsyhxz +hktzcfyilew + +mqigxepzwudokytanf +ayztcxbigunordqlmhk + +wnfy +wzfp +fjlewksb +pcfwyn + +o +c +na +qku + +zg +gtl + +syr +pbnmqc +j +sk + +abenmqvsyotzrcjwglfdx +cnmqrxatjvowbylfgdezs + +kfzlgphuwqv +levuhkwqcpfg + +iazxrty +xryz + +ikxcpebaruwhlm +iqtxadbeyckuvsh + +wkfsrvgbyjxpq +rqbyxwfpkjgsv +fgwsyjqkxovrbp +frpyqxbjvwsgk + +po +o + +arbnupkvxqodcg +znpobhraxugvdckqt +mkaupgobdvscnqrjx +cbqknjavpgwxuord + +ftpka +vtifcl +dfwusmbyrhto + +y +q + +drsleaqghypbtinmfuo +gzinmrwudjbpyloefqahs +fiomngyurlpheqdabs + +v +bx +c +v + +kh +zk + +qkzicvjbgawfdpxmtsloye +ylofxwpvkqemsaigzjtcdb + +qf +fq +raf + +cbvxjytmsa +tbmxcvyjsa +ybmstxjacv + +aekpuyliz +eqpyxls +rwyepchjflomg +oedybpl +evnyclxqp + +yxtfnavdhopmcw +qlugbvjcz +xvcnymkrh + +yksamve +yksmvxea +mskavye +yamdswevk +eksayvmx + +p +k + +psrgzxmaif +ifraxgzo + +aehoplsvfqr +jfqvkpoas +vsjfxpqcoma +asmfoqpv +uvospqaxf + +ercgdyism +msrvebzc +mgrescq +desfrmico + +dborguxznkyqciavtfs +kzoymfndrsaihqtcbvgxu +anbcwfrdgjxktlyivouzsq +bgifuzsrekocxydqtnva +dtpsikyavoucxqgbhfznr + +jvyhfbpxtkizmlesw +fvmjhkesbpzywixtl +btlezmshjwpxiyfvk + +jawdspkghblyvornxmicuq +nrujdhxokcwgylimvqpba +lcrnhktgvipyubwqdomjax + +vhiatyrwksodemcxn +hdsamtvuikjqecnwryox + +ixthorcaevkp +xiyhrknlboczwjfm + +ck +kc +czkmyet +kc + +wxjqkpgnshue +qojwkefphzcrgaxn +ektphqjxgnwu + +raksq +mdu +a +asb + +putzomyciwaqkvbfsldng +absdvyntgikruqpzoflcmw +dkscznaiwulvogqfybmjpt + +sxbqjv +jqvxbs +vlqsxjbo +xsbqjv +jvqxbsy + +ynbakgvc +yvtnlbsjg +vrqxephwfby + +xhdjkrpltfoe +qjplehkotdbfrx +kxfdaotsperlhj + +ewgsmi +jafkti +yqkf +copzldurbx + +xc +ex +r +rtwce +slk + +zimewg +nmzrj + +qylbm +byqml +lqmyb +mxyqlbr + +egsktr +erskdgt +rkesgt + +zkgqireysupwjthdb +swkoyzdcqibpvnr +kyvmwzpirdqsfbclx + +jvytcgmkeqalzonhx +kvcjnwztxdmlyoaqg +lznqaxcvjytogkm +vabgfulyxkjoimqztcn + +q +q +q +fh +q + +xykitfhn +xnhytzilf +tiznfhx +tfxihnre +xhilzytfn + +zmxyoakgt +yawiomrgsd +oafgmyqr + +lpgqshiyuxjvabz +lzbuhyiqsjagepx +urisxlzjabpyqgh +xsuiqljypzgabh +gkylpamihsotqfdxzcbjwu + +jhf +htdejm +jtabh +cjeigmzh +suljqyorxh + +hcjkbvmlaoen +faojknvxmehblyc +nhmovlejcbka +vonhckilembja +kojnmvebtclha + +clamzrewgonksuqvpb +zusorlkmqpnvwaecgb + +uka +ea +aw +a +lxa + +lg +lwtg +tgl +glw +rlg + +vfsxidctgah +dvhcftsxgia +vdhxgimfsant + +tschpyqa + +ckn +xckznb +mnsvlfqaitjpdk +cwkzn +kzoyenb + +ro +ro +or +or +oer + +icumvltoqafdy +tfsxarpnh +atsfgw + +btfenmovgusqzijxpcrhdakl +diapqfxrnevlzutsycjgbkom + +utvbhgw +vbhgtwu + +nkfgajmvbpyowthxr +cwxrtknpmgfazjoy +rwxmfatgouckjypnd + +kdlubgiap +podcivgyueafkhm +purgnkixazd +sukdgixap +udkpglia + +ajnumbsgr +ibmjsrkagc +bsgozmra + +vkbso +ykglhto +gmodikp + +sxupqv +xvuqps + +x +r +c +x + +fjoyuhztseqrawpciglx +igfeplsxtrhaqyzojwuc +rpwgucisoyhflaxtzejq +yqzjphegfuxltawicsor +wzahifloypuxegjscqtr + +xeironzdugvqc +quevgsfronxzc + +wdjrsknlbihcqzxuv +bzlxjnukvhrsdicwq +cuqiwsxkzvjbrndhl +ubclivhszjdwqrnxk +jldqkihxrzuvsnbwc + +dzklrogfvmn +xuwpaqcetij + +d +o +m +d + +xhgzbj +jvbhg + +snbcamefqhuovxkjpz +htckmpybdgvrsaoeuj +pkcbewsgvojmhauidl + +i +k +tqj + +koyawh +auo +qaoer +zrapo +ioa + +broqhaylgsmxzkjtuvf +hatgluorzvkyxsmfjb +whytbkrvsumgzxoalfij +tzabxgfrqnusomvhjykl + +hoplnck +ayqxdjofr + +dmjspac +dhoazjp +idxfrwepyjo +qlpjgtvndub + +riabvstyxphgoez +projxgyhietsavz + +jhfqikpmz +kfpiyjvmzsqh +vphkqizjmsf +wpqfmlzkjheid + +diap +zkhacy +waog +fojgas +roa + +rujzxoygliqnmvkpc +vlonrgpjqzyxmfkic +zgxqkjocirpvlynm + +lzgja +jlza +kjazrcl + +vteiqrpkjybsmndhfl +lsndjpqertkvhbimyf +lpjmnbyqshvtdfirek +vpibqrehmsnflykjdt + +iwqlhotpjsa +slhjyuiotrdk +szjhlocimt +tiajhwsofl + +poz +dp + +yeqdmto +zgtqyvoli + +ahkfsocmdgnwp +cpwhjsmgodakf +clhudwakftvogsepi +dkargcowsphf + +p +p +p + +eqbcr +jceq +xeocqmi +fqwcve +mjebocq + +xkei +ivuaexqk +kxie +ikxe +kxei + +jsmzk +cmdpyf +xshm + +hdwlcgzyuvke +gjlaqpry +rlgomxy + +comszwhfrqlpnvytei +iqpvwolsmnfhray +oulphgswymvfrqnix + +lcisfxnzwy +csixywfbnlz +zelcfyiwsxn + +lmrsia +gowals + +lyknfogpu +zoiw +tesjova +moes +odi + +ktfajxloz +ojaxzflk +akzlfoxj +fxkolazj + +iwxzmukbhoy +xlzkymbiuwo +bkuzomwxtiqyd +wmokbizxyul + +kr +kr +skr +kr +rk + +bdpfgnwxtk +gwtkdflnjpzx +kngxpfwdt + +xkhmzvylowsgucrfepjai +xriqvhjlozpdkuemcfa + +avxoebdgzmqphfytcn +cvfrmneolxtyzdgpqh + +wjvslhmufgqxcnodz +fswclgdvxnumo + +t +uqi + +xopmekybt +pkrxytebm +mtpxbyek + +vkxcrizwuhtad +wairuvhdmzcxkt + +vrlpifawedksqzhcgnybtjxo +qoplwufekztbhdnvxgarjsciy +svzmteygfbkrlxohjqcpaidwn +rakocwstbpidlhxjgeqzfnuvy + +o +o +o +o + +ihzarybenqmtpg +zqbiyhanpgetrm +hqizynrpbagetm +yhbgrzeqnipatm +gteahmprbyqinz + +jv +uxkasvt +jrgv +qv +ivbpld + +sxigewcouvbj +xjwobcsugive +cbjvxsuowneig +uxobwigsjcev +ejogiwbxvcus + +enmvubp +pvubm + +qrjythvlzubgeikafo +necadbmrtzulvwypx + +rbuslgk +lgsbuzkr +lbkugrs +sgkbulr +rublgks + +whb +wbh +whb +bwh +whb + +khtcw +wkcth +wtkch +ckwth +kwhtc + +mkzdbo +dkjz +kbnzlmd +duytksvzgq + +brkxvtjpdhqw +ntjqizashkpvwd +dqfrptwkshmvzj +phegdjolwvkqtu +dkhnwqacjpmtvf + +bdrioxsqahp +adishrbqoxp +oiqpsbdtyrha +dapobrxsqih + +oqsgiptmzlwcxkhvrfedu +rpwhtlgkcuidvqfosazxjem +rmgkeisxzhqwopltcfvud +vfcxiruwlhgoszmekqdpt +hmprfdvoxetulgizsqwkc + +luzam +mwuplz +mlurjz + +xlpmhzudwriytscobnkfq +uinamwhrtpobfvqceyd +ibflutdsohnqrpcymw +nqprtwuyfdcmiohb +ufhwmrinodkcbtpjyq + +ns +ns +sn +sn + +dufzbegpjrsaiqcthv +pfzqdjhatbuvescrkig +tbehcpfsvagdqirjuk +tebiravqjpfushwgcdx + +gpjafzel +mzgftlead +bleynhgvfcs +egdqfalmz + +zbarcdwiukgoqhmtnyjps +sujqytgrbnwzdmhalicok + +fyvgdcbqx +fqcgdyin +etfmoqgdsjyc +gqfcdy +fyqcngd + +am +bjm +sdm + +frvkaupe +qzipevkya +vzabpkesd +bevpymka +pkxeva + +t +t + +dcveyjgtfkbuo +ebogjfydkvcut +gkoyfeudtcvjb +mvygqckjftuodbe +tujbkeocdgvyf + +bkthnlgp +tnghb +gthnb +gnhbt + +hpkybmeowacsrgnijfl +jzrsgyuwickpfbmolneh +hcflvrgqpwmdoknsjeyib + +qxincam +zdjrlksqhgt +cbafqwo +vqyei + +izdkxrpuqgjte +asyngkxrudpvmie +bdkwpgmexruci +opdiknuxger +gecixdrpluok + +jymuwvfrixclhga +invyhuglxmcjw +imwghculxvjny +gjmlhiwvyctux +yvjhixugwolnmc + +xbcwhv +chdwgxbv + +ujycfnsvgqkpwheal +erugwaykpqcnhomlf + +gyk +glhrk +gwk +qowygk + +vcnju +vuoijbczt +dvcujg + +rlsy +ryls +ylsr + +tjn +t +n +rixz +t + +i +i +i + +elq +qle + +ksahwvdjbtfle +lfksaebjhtwdv + +qfacst +qfaskg +fqasoktb +vmfuilqzprasd + +apuxh +uxpah +onahmwupxb +hxpqau +huqapsx + +hjbnwua +huwbranj + +dj +z +h +hz + +hzqo +oqz +uwsozq +zyqxo + +ckotpfx +lhrcnpmgfviwobd + +wecahmszdjnoix +hmxaijswzydtcgn +njcqtmzixsadlh +cudmxzeasjnh +mxzahjckbnpdvrs + +lsqahvixforkw +fxiqskaohw +afjhnxqowsik +xstiqkhmoafpbw + +htdcbm +ex +sxq + +pfgkrjhub +nptjfixgraubykhld +pmufkbrhjvg +jhrfbgpvuk + +sptnugvdfmckehw +wknfhmsucertpvg + +zolicbnrvtdwhy +oqdunzywp +zodykuwxgspn +wsanojdzxqy + +druisbhpckvwofna +wvcboafsnhipukd +bpsadlcvnkhfziuo +bqfujsvmhcoakitdpne +visaodpfuchkngb + +ewniqoulvgstzchkxdmpyajrbf +cbyihmnuradvlktxpjwsogzfeq + +zgsdqwj +qdzsg + +ombl +yeulqbnimw +hljodbmk + +wtzkorqhupxby +yzxhtkwpord +skwzpjtgyrxho + +mstgrlwo +rpyowgdts + +pidn +ipesrfv +owpdim +pibt + +tu +tu + +pcdatkohjgbelmqvfxwnu +ukevynsprjtclaxhgmdqfwb +twqungiobxflhckapedjvm +pgqvtowflujnmadbeckxh +damfntwkjlcvhbqepxgu + +ilksfovqamrhngcdjyexbt +htkvnbrqaefsloxgciymjd +qfgvrxmbaoeldnkyiswjhtc +ftxpoyhbjkcevdasmigrlqn + +oq +qdo +sdlqoa +eopbizq +sndqo + +iblpgzoekrnmwhjstay +tsropbkwgyaexilujn +salrwjgbtikpeyon +bsyirktpjonxualewg +teaqljpowyrigbknsd + +d +d +d +d + +zgqmhnlvekcyutxsbifw +zmkqgwvyjrcdfbu +ckoawvyzgumrfbqd +fdqbypumcgwvzk + +krqlncwuxvgbdpsmyjfa +lmuybxdqsvkrjfcpwnga +zkbqnhjspdcumrxgaelyfwv + +vafsedqzyrtnjpwug +gvcustypjedaw +owpydujgtaivsmke +tvadlgweiypsju +jebvtoysphugadw + +pyixcohfrvtenaugsdmjq +catjqrivdfseogunymx +tvquyscedoxrgifjman +qagtfiocrjmuvdsenyx +gmeufoqaxcrnjdvstyi + +p +p +p + +jagycukemiqdxw +cmuyadqgkewixjl +fqawimgzjkyuxbdec + +mahdekwibs +admswkhei +debamswk +maovdyeskw +mbsdkweaf + +wfqimrc +rtqhcwlgdxnkvpo +arwysquc + +kroumefnixa +lcn + +hvaugnsf +nfxqkugas + +wheyqtmdvljucnsbia +hvmyteblnuqacw +ehnultwbyacmqv +mlybuhqtcewvna + +pxhafcvymglkzoq +xhwkctlgabz + +or +jodr +or +gro +forha + +fzmohqld +szqf +iqawckfrp + +hkxuwmsbdrpt +ptysjhxkwbmru +tpmbsrkgwh +kphmtrusvwbq +krmhpftsbwzn + +r +r +otr +r +r + +sxtlkvjacpbngoziewq +jiskzqanlowbxpvtge + +r +r +r +r +r + +bqwsz +wsfb + +zwvyqaichxjre +whvayjrzicxqe +arxcivhewqyzj + +mpzasbnregjdwlxuqoft +dnxlrwubzkaosypq + +gfaizbqlchy +zibatqykfu +bsufzjqxyiam + +fsy +sf +efs +fs +fs + +asmugcxhbekl +dkhcluwsmegaxb +kubhcmalegsx +cgluxmbhekas +bajrhelscgumknx + +qdpwfec +wjdqfecy +cwdefqj +wqvdclsfe +dcqpfew + +r +jcowmyplv +itdru +shbfr + +soublfhe +lksfzjdymaw +ywfnrskcl + +zsybelirjfwm +sfxiznhmablgtj +jbcifusqlopmdz +znhjerlkfmybis + +knvmejaydo +mjoaevkw +jkmhcoave +agomevkyj +elqftajmoskvi + +ziajfk +zakifj +kazfij +zfajki +fziajk + +ujzyfat +tyuafjz + +xihdrjyzvl +axujhtldyr +xdohklyjr +xrlejhyd +bxolyrfkjdh + +i +i +i +i + +ocnxzlprutqmhsij +xgmloizutqj +xmtlgioujqz +guoxlamzitjq + +jhoepxcuwvn +xeuvnfaodjwpc +upjoxwcevn +xncelrvojupwg +qeusjvwynkpotxc + +etdilxy +lytdiex +hdeltgryiw +lyixvedt + +rge +gr +grp +gr +grp + +iquzsnh +qsfunwh +qtsgprvhcn + +lipmbftsh +myho +uqzngarkvw + +ybrtackvdgqsmonlezuw +ywlzmsgbtocakedrqnv +rbceqauytzgmowkldvns +tyncgkldqserbjoavwmzh +oydsvatnmwzgceqkrlbx + +qjb +irgfqjope +jkq +jqb + +ncjlbpzedywkshfmqvagxi +jfipaqbmevkgdxnschztl +gbvxnclahmsiqjdekzfp +kedsxbzcvijglphmqfna +szcadkbnpeghjvqifxml + +nfteow +ytewforn +estonfuw +erwtnfo + +vhawcorfpxydzieqmbg +opyqhzdabfwcegrximv +vbpfqzcierhdgawoxmy +dvprwqzfioagxbycehm +yhdvpxzimqeorcabgwf + +bfnrkixsut +jhywbrncziaxkp +iodknxrb +xbrknli +xkfironbu + +xwpqbhyakf +rxayi +ogaxy + +tnwl +wbnl +lhwn + +wjuroesafgizkmvplxc +nxvgfoeucjmprikwlsy +glwrfcumhejisvkpox +kjmuvrwclifaxepogs + +kjxygrvsodimabecwuzh +ihmxrogvjsaudbkwcezy +ykwovzjimbgashrudxec +jsewruvymigxdzkohabc +icmleouvhyzxdabjsgkwr + +wm +wm +miwkg + +slcdjyhbnpi +bxqvejnzwtfag + +a +a +a +a +a + +jxwonlf +jox + +wxhytgp +tpgywx +pgwyuxt +pgxyfwta +dpyzwxrg + +uygwfkxvane +hsdicwzkrenfgalqx +jaknwfxge + +mxs +msk +smx +msoqz +ms + +bxfwc +wcbxf +cxfbw +wkcbxf +cfwxbl + +om +om +a +n + +ikp +wi +iu +biej +i + +aokgqimrnlfbdxzjs +tmqxrbislngykoajd +lsgvboxnkjdqrima +orijsalbqnmdkgx + +zfpd +biok +bxcqnk +yikx + +sulwztbnqkvioafxchemr +qhmcvlexkazuinfrwbsto +mnfutiblxecdqwvkoszhar +bmxzpqrlkafheouvcsntwi +zmchneutwlqoakxbsifrv + +equacsmywgpkixfdv +anxwlcuypskjgfivbqr +iyaksgxmvoufehwpqc + +twfzqxsnr +aqdsp + +yj +dyoje +yj +yhqj +jy + +bhwsczaxunjr +xgcswaflpznruqb +ubzwjxkcsyrnmahd + +xyvgkjo +kgjvoyx +vxyokjg +govjkxy +jgyxokv + +hneolzrtywq +atbs +mtipgd +vts + +flu +lfu +ufcl + +ad +da +da +ad +tgqad + +xfw +bufw + +simdubgowtap +wgbsdomaiutp +bsmodwauigtp + +qi +o + +n +dthokli +nveq + +nvdt +cdglvi + +sdxfaveuwlqzgircnhyobtkjp +uiqjrdenyagwkzhvpxscobtfl +otiungzxecdbyksrfwqjhvlap +dtbcyojehfwvsnrpkliuzgaxq + +zgovqbryphxmjcasuktfl +bwcpqoutvfjykmashrzlgx +iecjhpmxsqytzorflungvabk +vacztqslhmkgoxyrpufdbj +amgfxjqsptdrhovclkzuby + +s +s +fs +s + +b +b +bm +b + +uzc +zbc +cz + +clmeswqpuahi +spahequmlwci + +hrclmu +nhlcdurfxzi +orshcluv +uheclr + +r +k +r + +da +ad +ad + +hlfmnga +amhgn +hgamn +geahwnm +malgnuh + +bhpgndjwecroq +iwxklmtyzsopf + +uqosfv +lmbihrxtedk + +gyrtdosqjnkalicmwvh +rmlygiwktqcoshdavnj +wimjknqvaglhdsocrty +wkosyadhtqgnmcrvijl + +tcpsjerzykogwmqbxinlad +iyzxcgrtqosnbkjaleudmw + +dyzsmnkvuegbwlt +iwrcgs +fpswgqc + +nawtjrgmpyxlibcshfudvkzq +jiblrgwyhtmxvucqz + +vcruatwneqxi +myhgldscjnfb + +qakljbptgwryiuxnmoh +mtquwoagbjknxyrlpih +aktuhpgmqxbwjyonril +wqriogjmubxpknvyltha +mpkuhlxgjtanwoiyrqb + +ptjrmc +ucfjpm +pjcsm + +jofrkgdves +gsdkrivfe +dgsevqkxrf + +fvs +vclsd +s +rehtuyi +vfk + +eafupodb +eyrdpgbujfoa +ukadqobefiwxp +pfgudeobay + +i +p +i +i +i + +udlqpozmayew +dsyalxmupwe +lipydaumwe +delyumpwsa + +zthwnjiuyosakfpxbclm +lcpyfmisbztuknaxo +xsnlcyfzbpokmatui +zblkpsficaxmyoutn + +n +nt +r + +meskuctxrwaflovdpzhj +koxzmhvrcydlbwpsjuae + +l +pqd +lh +f +h + +otzqusgdeyvc +aetugnycqrxz +fhzwtgjqmkyulip + +o +o +o +o +o + +frejdvqokushlxtcgwani +dmfesnxhwgluorjiayt +zdtispaxeobgjhunwfrl + +retxhvnmzsjqpbodif +txnphyomczqfisedrjb + +nmwra +rmvawn +arnwm +mnrwa +wnmra + +yatwdlfbuc +flydbtwacuo +upaybixdlfvtcrw +tncdbalyswfu + +lenfcbjv +jfecnvlb +jlvefcnbr +lvcgqfnaetbji + +bkuycegrnpimoxvfzl +xpmklivbuyrcega +lbktipremguxcyv +pbmirkvglyceux +ykibxregmlupcv + +rwjeyxizhgt +ywxetqgajzriol +wrigyezjtx +werygtjizx + +az +ja + +sumxgwqydjhe +whtdyeqguxsp + +pncwmq +ansluwbycmxoe +cwdnmj +wqhkmcn + +flucitkw +ilucwjktf +lwukticf +lcwifktu +flcubitwk + +qlhnvft +hnvtfl + +bwsegp +bmpgsew +gpsewb +bgwqesp +pgwbse + +ib +mgjsb +bzk +bpmsgj +xb + +bjerpdfuo +wjrbf + +dkmxn +nkmdx +ndxmk +ndmxk + +rnouk +j + +m +m +t + +mrzq +zpqj +qiz +vzq +zhqi + +tkn +nrkt + +yj +jsyqp +awyj +yj +jy + +xl +dlx +olx + +kqdluj +jlkvdqu +qdukjl +qdklpju +ukqldj + +wzy +zy +zy +zy +yz + +vea +aewk +berga +waek +lyaen + +miaoyj +yjvmoiza +yimajo +jymaoi +yjoiam + +azcrbo +bzero + +fig +jbsagif +gfi + +ed +de +ed +de + +naezbtk +ubat +batku +baqvtglmo +treba + +gozafjiuerdpyscb +lxuhqvmktwn + +ysqdjnvwhagmzitpf +vszdapqhijcyln +pcazqibvhsdjyn +rjuaqhspydikznv + +qhgazndtiwb +wtbqdahviou +zbqjhwgtai +qiabwntckh +siawbyfpmxtrheql + +ej +je + +vtqgbimyo +dpwihgamzovlbtf +tmgvboi +emntbvgcio +btgimvoy + +kisynhablrjwempcouxqgdftz +xnzrkiufjpmghsqcadotwebyl +rdqezcmgajpwoylnbusxfhkti +shejiunzgdpwxylqmatrbfkoc + +lcqenihaktdgurpvmysjfxzow +sldaifypqrkhcumextwvjongz +piyslcrajgfenhmdwuovtkzqx +esxwujvtarpzkoldmyfncihgq +xqfvgosbyruephwjdaztklincm + +gyofwzc +jyluxh +dpimyv +rtsbyqa +myluej + +iwcedhs +etdich +cwihaeb +ecihby +licvfeh + +nwlfiydcst +wnldtsfy +lsnwdtyf +fdwytsln +tfsywdnl + +diphkr +ihf + +osagihfnuptwcyxqevz +ynzjfrpqoicklmuvbw +nckfilwvquozjpmy +qzwoivcfpyjun + +tbjh +noyjvqt +ejzuligpxm +hnj +jysha + +fycqbrk +kcndb +czblkq +blfcky + +wpgk +putk +lqamxiv +rd +dcw + +wmludkgnozfe +aoezwflgkmdun +uzekmdgflnwo +kgflnuzowedm +goezkndmwufl + +zmbsxkiwqrh +grjcyiwptzseqxofd +iubrwqlkxzsvn +zaqswibmxr + +soealywdutckrfnbigpxz +dntrgfaopclubeykzwsix +gnswdzialxrckybtfuope +fwodizuepagysxnktlbcr +sbdiefgptynkuwzocxalr + +tkbry +fyxr +ory + +sio +oi +oi +oi + +fipqkjmorwcluenvzx +mvowrcjxsuqpfgikenl +cxrmwvkeulpfqnoij + +jhqfvlnetysazio +osjqykft +otqyjfuxs + +opfrbnw +dbqnhoftpruz +bgeyxrpnfol +royngfpbw + +rvmxfogsbcjkpqltyhandi +xafqvhinsodltpkcwy + +pqrkslwfijgdo +pymoxvzsg +vpszyog +sehgop + +qnmxjglwavzirceu +advwiomgshuqnclzjer +zjqumrcgaiwlevn +kvugjnewclizasqmr +jilzanmtbgfrequvcw + +szkftpg +stkpgzf +ptzkgsf + +mefgopznxlusjych +iocqfmjlzgyxkpunhe + +zemltjrnbso +stbxojkrzgmneqv +zpsjernombt +stjobrmzne + +yblxcozivekmqa +epsrvyigmc + +xs +s +s + +bnmz +fhqg +dxsin +zsm + +brpge +tpm +ptm +p +sp + +utpsykci +ituxbykcwr + +zvxityphsdnuagbmcjwoqrfl +qiuwkplbtczmnvyrsoxhafjgd +qynizxpujhfmbvdcgwleasrot + +y +tx +y +h +y + +fsqatkdlmpux +yxinuvasdpfml +tsdpxafblzomu +axtfpulsmdg +lxwfqpsajudmk + +joanzmhfldbsgwcipkxuqrey +oclnpxwkyqszdjreagiumfhb +ufvoiyxzbrpwdgkcmjsqlanhe + +ciqxenmrlh +ctrfhxiqpnl + +uoxfbrglpwjkhzstidmcyq +hzslfyjxbdgecairompwkqut +ygolzckfbxdmqtpivjshrwu +kpoxzdlhurgimcsftbqywj + +xhgfmplcvwrqneztju +vqbwxtiprfhl +wxaoytfrvhbsldpq + +iop +qvxihy +io + +ftlgqpix +bpigfl +ufbgiplr + +ek +ekb +kclifmge +key +ersk + +ytqglpedjriu +jidgqytrulpe +tgjyudrqplei +jeiytpurgdlq + +anuqyij +auczniy +yanklsxivou +byacinu +inazyue + +tmryzavsnfdoq +ngmjxatvosz + +yurzemitvfqnksxpbdlhgjwa +juwvmadgcpytrkfqnbezishlx +wzudtksjrpevnxagfihlbyqm + +a +xa +ya +a + +gnukiszbvj +nyzbvpksjgmu +sgujnbzeivk +uzgbnksjv + +xoq +qox + +xlberjukaztfnoycqsgwip +tscfaexqwgkrpouzbylijn +owaruypenjqtbslizcgxkf +jzcuswiqgkrbnpyoxletfa + +pxzmb +rzmxpb +bpxznmrc +umbgpzkyox +tzbmxp + +grspmxbyhojdizwlevqfkctu +fixgbtedqomczrjhswupkyl +tlsgyobzpmcqkhrdxewfuij + +xrhelazymwntkv +lhvamxeyrznw +vrmwalyhnezx + +mdbjcizwxh +jpcbzdmxiwh + +xakdgjtimlvzcshw +iskdxfjnlhwrmvtcz + +yrli +lriz +rli +irol +ilr + +lfamcngvojeqyzrkdspwi +slqcznmwdivkrfjopebayg +cwgodjahrqzyfivepknmsl +kyeuvpjmlnftsizrdogqcaw +kjvrcgypqzinwadmoefls + +hfmuzdvyibakcwnsor +cezounhbsydwakmif + +vsajkf +jvf +vofj + +q +v + +h +h +i + +frgo +ogfr +grfo +rofg +gfro + +saomp +mpdosa +posam +mspao +ompsa + +qbxi +xbiq +bixoq +axbqi + +oix +xoi +ixo + +zqkved +ztvydqe +vdekzq + +ubg +vgcub + +wdotn +akp +hv +ipj + +xfcprnv +dfpcrvu +jpvfirc +frphqvwboc +pcvfxr + +prx +rlxp +rxp +ixpr +pxr + +uaozgkwlbfxyvmi +zbkgoxalfwuvymi +yimugvxbkfolwaz + +hwvlbzcauseydgpxrkq +lamwdrzhsbqefkvytxoicu +zktxwlnhysevqbraducj + +vjuprhcl +vjfrlpm +jbplvr +pnvljrbfe + +cwygrulzbe +elyzgwbu +uygezlwb +yebuglzw +ygzwuble + +wbzecjtdrgiyqls +wlsycjgeizdr +zslyderwigcj +dwzcyjgerisl + +qkvegzmnobpuc +pogzvqmkbn + +cnepixbwhklmqzodvyautjgrfs +oepszjgmlcxkdiartnybwhfvqu +gvcxaintlrweupbzfsmykdjqho +xalwvjenruhpkmgfqtoysbdizc + +omrc +tcer +bguaf +vhtk + +rtednpkyxgcs +kxlsredupynt +bartsexnypfmqk + +lqrabmznuhgjfi +chligsdnbjrazum +jpghuibarnzlkom +bamhwrngzjfliuye +yuignrzsamhlxbjt + +aoslfqnjcghb +cnbflgjqaohs +oqshfljbncaxg + +av +av +va +dvqa + +lghqidarnczwfxyu +ylfnhqwczaiuxdg +wfdglzixauchnqy + +pfgknomr +nfegr +vihnlcfdqgy +fgrns +awogfn + +kfdntirsmqap +thjdknbugmr +nxfetkrmd + +ydabnisroqeghk +gryenohbaiqsk +sqbingvyoakehr +ngbkyfaicsrhqeo + +ghxtulq +ntgqxlsz +lgzqtxsi + +qvr +mqljsu +wlqu +gpoqytkbzf +evqw + +khybpm +rhboj + +rmcqdblnto +qlcnmor +rhmzalcsoq +lgxcrmnqovd + +wdfkpmalijbncuvr +qhnmikpzaygxwsovej
\ No newline at end of file diff --git a/2020/06/puzzle-1.awk b/2020/06/puzzle-1.awk new file mode 100755 index 0000000..71d55a8 --- /dev/null +++ b/2020/06/puzzle-1.awk @@ -0,0 +1,14 @@ +#!/usr/bin/env -S awk -f + +BEGIN { RS = "" } +{ + split($0, chars, "") + for (i = 1; i <= length; i++) { + if (chars[i] != "\n") + answers[chars[i]] = 1 + } + + sum += length(answers) + delete answers +} +END { print sum } diff --git a/2020/06/puzzle-2.awk b/2020/06/puzzle-2.awk new file mode 100755 index 0000000..98224ac --- /dev/null +++ b/2020/06/puzzle-2.awk @@ -0,0 +1,23 @@ +#!/usr/bin/env -S awk -f + +BEGIN { + RS = "" + FS = "\n" +} + +{ + for (i = 1; i <= NF; i++) { + len = split($i, answers, "") + for (j = 1; j <= len; j++) + count[answers[j]]++ + } + + for (i in count) { + if (count[i] == NF) + sum++ + } + + delete count +} + +END { print sum } diff --git a/2020/07/input b/2020/07/input new file mode 100644 index 0000000..4e9e60a --- /dev/null +++ b/2020/07/input @@ -0,0 +1,594 @@ +dotted salmon bags contain 2 dark lavender bags, 1 muted red bag, 1 vibrant magenta bag. +vibrant purple bags contain 1 pale cyan bag, 1 dotted lavender bag, 3 striped blue bags, 5 clear magenta bags. +vibrant fuchsia bags contain 4 posh violet bags, 3 bright aqua bags, 1 light silver bag. +mirrored purple bags contain 2 dim yellow bags, 4 dim green bags, 3 vibrant beige bags. +faded coral bags contain 1 vibrant plum bag, 3 pale gold bags, 5 dim purple bags, 1 drab teal bag. +wavy cyan bags contain 4 dark teal bags, 1 dotted magenta bag. +dotted gold bags contain 3 dotted gray bags. +shiny maroon bags contain 2 light white bags, 5 bright salmon bags. +vibrant cyan bags contain 2 dull beige bags. +clear fuchsia bags contain 5 bright bronze bags. +clear violet bags contain 4 clear white bags, 2 drab fuchsia bags, 4 plaid lavender bags, 4 drab beige bags. +wavy tomato bags contain 3 wavy yellow bags, 4 plaid maroon bags, 1 dark beige bag. +shiny indigo bags contain 4 posh aqua bags, 2 dim salmon bags, 3 dotted olive bags, 1 dull gray bag. +dotted indigo bags contain 3 muted bronze bags, 1 striped salmon bag, 5 vibrant violet bags, 3 drab crimson bags. +mirrored magenta bags contain 1 shiny aqua bag. +pale green bags contain 4 striped orange bags, 3 plaid red bags, 3 clear olive bags. +dim crimson bags contain 5 posh violet bags, 3 mirrored crimson bags, 2 striped white bags, 1 dark indigo bag. +light white bags contain 1 dark indigo bag, 1 wavy orange bag. +striped green bags contain 2 clear beige bags, 4 dim coral bags. +dotted lavender bags contain 1 striped white bag, 5 dotted coral bags, 3 striped orange bags, 1 dotted gray bag. +light purple bags contain 5 dim tomato bags, 4 dull plum bags, 1 dim green bag, 3 dotted magenta bags. +shiny violet bags contain 1 shiny white bag. +dark lime bags contain 4 mirrored crimson bags, 2 wavy crimson bags, 4 dim green bags. +dark teal bags contain 3 mirrored orange bags. +muted maroon bags contain 5 dim fuchsia bags. +posh tomato bags contain 3 bright violet bags, 3 dim crimson bags, 4 mirrored beige bags, 3 drab lime bags. +plaid violet bags contain 1 shiny tomato bag, 5 dotted gray bags, 1 muted magenta bag, 5 mirrored crimson bags. +shiny bronze bags contain 3 dim red bags, 2 drab plum bags, 3 striped yellow bags, 1 mirrored yellow bag. +muted tomato bags contain 2 vibrant maroon bags, 3 vibrant beige bags, 5 light coral bags. +muted fuchsia bags contain 2 clear violet bags, 4 shiny gray bags, 1 shiny gold bag, 3 wavy crimson bags. +pale teal bags contain 2 bright beige bags, 3 vibrant cyan bags, 4 bright salmon bags, 3 plaid red bags. +posh salmon bags contain 2 dull beige bags, 1 faded maroon bag. +dim white bags contain 2 dull tan bags, 3 dotted coral bags, 1 light silver bag, 1 dim gold bag. +posh tan bags contain 4 clear blue bags, 4 dim olive bags, 4 striped green bags. +dim lime bags contain 2 drab chartreuse bags, 5 striped magenta bags, 4 striped purple bags. +mirrored white bags contain 2 dotted white bags, 3 striped salmon bags, 3 dull green bags, 3 plaid orange bags. +shiny fuchsia bags contain 3 striped bronze bags, 1 plaid violet bag. +dull indigo bags contain 5 wavy tomato bags. +posh maroon bags contain 2 dark green bags, 4 posh red bags, 3 drab tomato bags. +clear coral bags contain 5 pale yellow bags, 2 muted green bags, 3 faded black bags, 1 striped teal bag. +posh gold bags contain 3 wavy yellow bags, 5 mirrored crimson bags, 1 dotted lavender bag, 2 plaid purple bags. +muted yellow bags contain 3 wavy tan bags, 1 dark beige bag, 3 drab lavender bags. +pale cyan bags contain 5 clear black bags, 3 dull lime bags, 3 wavy olive bags, 5 plaid indigo bags. +drab white bags contain 2 dull green bags, 3 wavy aqua bags, 4 dark indigo bags. +drab lime bags contain 2 drab aqua bags, 5 light turquoise bags. +dotted tan bags contain 1 dotted beige bag, 5 faded maroon bags, 5 light indigo bags, 3 light bronze bags. +muted crimson bags contain 5 faded gold bags. +striped turquoise bags contain 1 shiny silver bag, 4 vibrant salmon bags, 5 dotted yellow bags. +plaid yellow bags contain 2 dim crimson bags, 5 bright tan bags, 3 wavy yellow bags, 1 clear silver bag. +shiny salmon bags contain 2 vibrant yellow bags. +pale maroon bags contain 5 faded silver bags, 3 dull lavender bags, 4 dotted magenta bags. +dotted orange bags contain 4 mirrored brown bags, 2 clear fuchsia bags. +muted gray bags contain 5 dim purple bags, 3 wavy yellow bags. +vibrant gold bags contain 2 wavy maroon bags, 5 faded chartreuse bags, 3 light indigo bags, 4 dark brown bags. +bright fuchsia bags contain 4 pale crimson bags, 3 striped orange bags, 1 shiny tomato bag, 5 bright tan bags. +light cyan bags contain 1 dim teal bag, 3 wavy indigo bags. +pale olive bags contain 3 light fuchsia bags. +dim brown bags contain 2 dotted indigo bags. +mirrored silver bags contain 3 plaid violet bags. +posh cyan bags contain 5 wavy maroon bags, 4 dim gold bags. +bright turquoise bags contain 5 posh bronze bags, 4 shiny aqua bags. +faded fuchsia bags contain 3 dotted gray bags. +dull beige bags contain 3 posh bronze bags. +dark purple bags contain 4 dim salmon bags, 4 faded maroon bags, 2 drab red bags, 1 clear bronze bag. +drab tan bags contain 5 striped maroon bags. +faded green bags contain 3 dark lavender bags, 4 posh lime bags, 2 light purple bags, 2 dark plum bags. +posh indigo bags contain 4 dark tan bags, 2 dark lavender bags, 1 shiny cyan bag. +drab maroon bags contain 3 wavy red bags, 1 dim fuchsia bag, 5 mirrored indigo bags, 2 drab lavender bags. +dim magenta bags contain 4 striped orange bags. +striped teal bags contain 2 dark lime bags. +plaid green bags contain 5 mirrored salmon bags, 4 mirrored brown bags, 2 dark lavender bags, 4 faded indigo bags. +dull blue bags contain 3 faded lime bags, 2 faded violet bags, 4 dull tan bags, 1 shiny tan bag. +muted turquoise bags contain 5 dim silver bags, 4 wavy crimson bags. +dull teal bags contain 1 faded blue bag, 3 light violet bags, 3 faded black bags. +mirrored salmon bags contain 4 muted magenta bags, 3 dotted tomato bags, 2 light cyan bags, 2 vibrant lavender bags. +shiny coral bags contain 1 striped teal bag, 1 drab lime bag, 5 mirrored red bags. +muted chartreuse bags contain 2 striped white bags, 3 bright turquoise bags, 2 faded silver bags. +mirrored green bags contain 2 bright maroon bags. +light brown bags contain 2 clear bronze bags, 4 dark lime bags, 3 muted teal bags, 5 wavy yellow bags. +vibrant indigo bags contain 3 dotted bronze bags. +light coral bags contain 2 dotted bronze bags. +dotted turquoise bags contain 3 plaid red bags, 3 shiny fuchsia bags, 4 faded lime bags. +dark white bags contain 1 dull blue bag, 5 shiny cyan bags, 3 dark beige bags, 2 mirrored brown bags. +pale purple bags contain 5 faded gold bags, 2 drab maroon bags. +wavy beige bags contain 3 faded violet bags, 4 mirrored silver bags, 4 clear gray bags, 2 dotted tomato bags. +light teal bags contain 4 bright magenta bags, 2 drab coral bags. +bright tomato bags contain 3 mirrored crimson bags, 1 muted blue bag, 4 dim brown bags. +plaid turquoise bags contain 4 vibrant blue bags, 1 wavy chartreuse bag, 2 pale magenta bags. +faded tomato bags contain 3 light salmon bags, 2 wavy chartreuse bags. +faded salmon bags contain 5 dark aqua bags, 4 faded bronze bags, 5 bright crimson bags. +light salmon bags contain 2 mirrored silver bags, 3 dotted coral bags, 3 wavy crimson bags. +mirrored lavender bags contain 4 shiny silver bags, 1 wavy crimson bag. +vibrant plum bags contain 5 light orange bags, 4 dull lime bags, 2 dim aqua bags, 5 shiny violet bags. +vibrant tan bags contain 1 drab salmon bag, 2 dull beige bags, 3 dotted bronze bags. +faded red bags contain 3 light indigo bags, 2 dotted tomato bags. +bright purple bags contain 3 light tomato bags, 3 clear gold bags. +plaid magenta bags contain 5 muted orange bags, 3 pale plum bags, 5 faded plum bags. +wavy tan bags contain 1 dull lavender bag. +faded olive bags contain 5 mirrored silver bags. +plaid white bags contain 4 bright bronze bags, 2 dotted cyan bags, 2 dark lavender bags, 5 shiny lavender bags. +striped aqua bags contain 5 light salmon bags. +drab tomato bags contain 1 dark lime bag, 2 muted magenta bags, 5 clear gray bags, 3 dotted gray bags. +clear tomato bags contain 5 plaid bronze bags. +posh teal bags contain 1 plaid maroon bag, 3 light tan bags, 1 clear crimson bag, 5 vibrant aqua bags. +dim tan bags contain 2 drab fuchsia bags, 3 dark beige bags, 3 plaid green bags. +dotted lime bags contain 4 dim red bags. +mirrored beige bags contain 1 bright orange bag, 3 light purple bags. +plaid silver bags contain 2 bright gold bags. +faded orange bags contain 5 faded plum bags. +dim indigo bags contain 4 muted orange bags, 5 vibrant tomato bags. +shiny blue bags contain 3 drab crimson bags, 2 dim green bags, 1 clear violet bag. +dull olive bags contain 2 plaid lime bags, 5 muted maroon bags, 4 shiny crimson bags, 3 dim plum bags. +striped maroon bags contain 1 dim tomato bag, 2 dotted tomato bags, 1 muted magenta bag, 5 faded maroon bags. +dull green bags contain 4 light salmon bags, 1 dim green bag. +vibrant crimson bags contain 4 clear plum bags, 2 faded white bags, 4 wavy crimson bags. +striped chartreuse bags contain 2 plaid lavender bags. +bright chartreuse bags contain 2 vibrant orange bags. +drab lavender bags contain 4 dotted coral bags. +dull crimson bags contain 2 faded silver bags, 2 bright magenta bags. +striped magenta bags contain 4 dull crimson bags, 4 faded maroon bags. +clear bronze bags contain 1 bright bronze bag, 2 shiny red bags. +plaid tan bags contain 5 pale silver bags, 5 muted teal bags, 3 faded beige bags, 2 faded chartreuse bags. +dim black bags contain 2 faded indigo bags. +shiny black bags contain 3 dotted bronze bags, 5 clear olive bags, 3 dark orange bags, 4 pale coral bags. +striped gold bags contain 3 dotted coral bags, 4 faded orange bags, 2 striped purple bags, 4 light cyan bags. +drab chartreuse bags contain 4 dull crimson bags. +bright yellow bags contain 3 wavy crimson bags, 4 bright turquoise bags, 3 plaid red bags. +dark orange bags contain 3 wavy yellow bags. +clear salmon bags contain 5 wavy turquoise bags, 4 shiny aqua bags, 1 shiny brown bag, 1 vibrant tomato bag. +plaid fuchsia bags contain 1 posh olive bag. +wavy magenta bags contain 5 vibrant beige bags, 5 faded chartreuse bags, 5 light purple bags, 4 wavy indigo bags. +dull gold bags contain 2 shiny bronze bags, 4 plaid beige bags, 4 mirrored silver bags, 2 bright lavender bags. +drab magenta bags contain 1 posh red bag. +shiny silver bags contain 4 dark lavender bags, 2 dull tan bags. +shiny crimson bags contain 3 plaid violet bags, 4 muted purple bags. +posh black bags contain 2 dotted magenta bags, 4 dotted gray bags. +vibrant salmon bags contain 1 clear silver bag. +dotted tomato bags contain 4 wavy crimson bags, 3 faded plum bags, 4 muted magenta bags. +dark turquoise bags contain 1 dim beige bag, 3 dotted coral bags. +pale orange bags contain 2 striped silver bags, 1 dotted salmon bag, 3 dim black bags, 4 posh turquoise bags. +mirrored indigo bags contain 5 posh yellow bags. +muted lavender bags contain 5 striped olive bags, 1 muted indigo bag. +light yellow bags contain 5 dark chartreuse bags. +drab bronze bags contain 3 clear beige bags, 3 bright purple bags, 3 bright brown bags. +mirrored blue bags contain 5 dotted bronze bags, 1 dark green bag, 5 clear silver bags, 5 dim maroon bags. +wavy violet bags contain 4 light tan bags, 1 vibrant lavender bag. +clear red bags contain 4 faded orange bags, 1 drab gold bag, 4 dim teal bags, 4 dotted indigo bags. +striped indigo bags contain 5 dim indigo bags. +striped olive bags contain 3 dotted green bags, 4 mirrored cyan bags. +dim fuchsia bags contain 3 vibrant gray bags, 5 wavy brown bags, 2 muted beige bags. +plaid plum bags contain 3 shiny tomato bags, 4 striped orange bags. +striped white bags contain 1 plaid red bag. +mirrored coral bags contain 5 drab teal bags, 4 dotted coral bags, 4 striped chartreuse bags, 5 dotted gold bags. +dull bronze bags contain 4 dim olive bags, 5 posh turquoise bags, 2 clear gold bags. +pale white bags contain 3 vibrant gray bags, 4 wavy coral bags, 5 drab purple bags. +drab green bags contain 1 dim teal bag, 1 faded bronze bag, 3 clear silver bags. +dotted black bags contain 3 drab tan bags, 2 vibrant orange bags, 3 striped maroon bags. +light gold bags contain 5 posh olive bags, 3 striped orange bags, 3 dull orange bags. +pale tan bags contain 1 mirrored fuchsia bag, 4 light silver bags, 5 dim plum bags. +plaid lavender bags contain 1 dim teal bag, 5 shiny aqua bags, 5 wavy crimson bags. +wavy lime bags contain 1 pale chartreuse bag, 5 mirrored white bags, 4 faded olive bags. +bright crimson bags contain 1 plaid green bag. +pale fuchsia bags contain 4 light aqua bags. +striped crimson bags contain 4 shiny plum bags, 3 dull violet bags, 5 clear tan bags. +mirrored fuchsia bags contain 3 posh red bags, 3 plaid violet bags, 5 shiny brown bags, 5 striped chartreuse bags. +faded cyan bags contain 3 striped yellow bags, 3 clear indigo bags. +mirrored plum bags contain 2 vibrant silver bags. +dull turquoise bags contain 2 plaid white bags, 5 striped salmon bags, 5 clear purple bags. +dim orange bags contain 5 dim black bags. +dull orange bags contain 3 dotted magenta bags, 2 mirrored crimson bags, 3 striped bronze bags. +dark gray bags contain 4 dotted crimson bags, 2 vibrant salmon bags. +drab orange bags contain 5 dotted gray bags, 5 muted maroon bags, 5 faded aqua bags, 2 pale maroon bags. +striped bronze bags contain 3 striped white bags, 5 striped orange bags. +light bronze bags contain 2 plaid red bags, 2 faded olive bags. +drab olive bags contain 2 striped salmon bags, 3 drab white bags, 4 pale silver bags. +bright cyan bags contain 5 muted blue bags. +drab black bags contain 1 shiny blue bag, 1 drab yellow bag, 5 muted tan bags, 2 drab violet bags. +shiny green bags contain 5 dim purple bags, 1 dotted crimson bag. +wavy blue bags contain 3 shiny white bags. +pale lime bags contain 1 dotted maroon bag. +dotted red bags contain 1 dotted bronze bag, 1 vibrant lime bag, 4 clear plum bags. +faded bronze bags contain 4 pale magenta bags, 1 faded black bag, 1 faded orange bag, 3 dark crimson bags. +dark green bags contain 1 striped magenta bag. +faded blue bags contain 2 dim maroon bags. +dim violet bags contain 4 posh yellow bags, 5 dim lime bags, 5 faded olive bags. +dark tan bags contain 2 mirrored green bags. +dim teal bags contain 5 mirrored yellow bags, 2 dull tan bags, 2 vibrant lavender bags, 4 clear lime bags. +plaid crimson bags contain 3 striped black bags, 1 faded plum bag, 3 muted red bags. +clear white bags contain 1 shiny gold bag. +dim silver bags contain 5 dull tan bags. +dark cyan bags contain 2 clear black bags, 5 plaid yellow bags, 2 posh coral bags. +dull violet bags contain 5 wavy teal bags, 5 shiny white bags. +muted coral bags contain 5 faded violet bags, 2 drab red bags, 3 muted olive bags, 4 mirrored tomato bags. +vibrant white bags contain 3 muted brown bags, 4 mirrored red bags, 4 dull orange bags, 4 dark crimson bags. +posh red bags contain 2 clear gray bags, 2 bright turquoise bags. +wavy chartreuse bags contain 5 light tomato bags, 5 posh black bags. +striped black bags contain 1 faded green bag, 1 wavy green bag, 4 wavy orange bags. +drab indigo bags contain 4 clear cyan bags, 4 mirrored crimson bags, 4 clear silver bags. +pale gold bags contain 1 dim lime bag. +dark olive bags contain 5 bright white bags, 5 clear lavender bags, 2 vibrant coral bags. +muted salmon bags contain 4 drab beige bags, 3 plaid violet bags, 4 mirrored brown bags, 3 dark lime bags. +posh gray bags contain 1 clear beige bag, 4 vibrant blue bags, 1 shiny aqua bag, 5 dim tan bags. +bright white bags contain 5 muted bronze bags, 5 clear cyan bags. +dull white bags contain 1 vibrant tomato bag. +striped tan bags contain 4 mirrored brown bags, 5 faded chartreuse bags. +wavy teal bags contain 3 plaid red bags. +faded purple bags contain 4 muted orange bags, 3 clear salmon bags, 5 drab cyan bags. +dotted yellow bags contain 4 light indigo bags, 5 drab violet bags, 3 dull tan bags, 3 bright lime bags. +wavy plum bags contain 2 dim aqua bags, 5 dark brown bags, 1 bright gold bag, 2 dull orange bags. +muted blue bags contain 5 plaid tan bags, 4 dim salmon bags, 5 striped tomato bags. +dim green bags contain no other bags. +light lime bags contain 3 mirrored orange bags, 2 muted red bags, 1 dim black bag, 4 posh maroon bags. +mirrored brown bags contain 4 dotted gray bags, 3 clear lime bags, 2 dim green bags. +drab fuchsia bags contain 5 mirrored yellow bags, 5 plaid plum bags. +drab gray bags contain 2 dim violet bags, 4 posh purple bags. +vibrant teal bags contain 4 pale tomato bags, 2 posh lime bags, 2 mirrored silver bags, 1 wavy crimson bag. +dotted plum bags contain 5 bright gold bags. +shiny gold bags contain 4 shiny tomato bags, 5 wavy indigo bags. +bright bronze bags contain 2 faded maroon bags, 2 dim white bags, 5 drab violet bags. +drab yellow bags contain 4 mirrored green bags, 5 faded fuchsia bags, 1 drab turquoise bag. +dark bronze bags contain 5 muted salmon bags, 3 posh cyan bags, 2 shiny tan bags. +light magenta bags contain 3 dark silver bags, 2 striped tan bags. +pale yellow bags contain 5 drab tomato bags, 3 striped orange bags, 4 striped maroon bags. +shiny cyan bags contain 2 light tomato bags, 3 clear purple bags, 2 shiny tan bags, 3 dull tan bags. +pale gray bags contain 2 drab purple bags, 5 dotted turquoise bags, 3 pale salmon bags. +mirrored cyan bags contain 4 faded chartreuse bags. +dotted bronze bags contain 2 faded silver bags. +faded beige bags contain 1 bright red bag, 3 dotted red bags, 2 striped lime bags. +dotted beige bags contain 4 muted turquoise bags, 1 dull beige bag, 3 bright gold bags. +drab plum bags contain 4 clear chartreuse bags. +pale blue bags contain 1 dim chartreuse bag, 1 dark lavender bag, 1 drab tan bag. +faded teal bags contain 1 vibrant tan bag, 1 dim tan bag, 3 dull gray bags, 4 plaid red bags. +plaid beige bags contain 3 plaid tomato bags. +dotted chartreuse bags contain 1 pale maroon bag. +bright gray bags contain 2 bright coral bags, 3 bright turquoise bags, 4 posh tan bags. +bright olive bags contain 1 dotted bronze bag, 4 mirrored yellow bags, 4 light bronze bags. +dotted olive bags contain 5 clear purple bags, 5 muted bronze bags, 5 vibrant tomato bags. +pale tomato bags contain 4 clear gold bags, 4 clear tomato bags. +clear gold bags contain 1 striped lime bag, 1 striped chartreuse bag, 2 muted fuchsia bags, 5 clear salmon bags. +dotted gray bags contain no other bags. +striped brown bags contain 3 pale maroon bags, 5 faded gold bags, 4 wavy yellow bags, 3 bright turquoise bags. +shiny lime bags contain 4 pale violet bags, 4 clear violet bags. +mirrored tan bags contain 1 vibrant magenta bag, 3 mirrored violet bags, 5 faded plum bags. +dull maroon bags contain 5 posh salmon bags, 5 dull coral bags, 2 plaid plum bags, 3 striped teal bags. +dim purple bags contain 1 light tomato bag, 3 shiny violet bags. +bright brown bags contain 1 shiny aqua bag, 1 shiny lavender bag, 1 drab fuchsia bag, 3 faded olive bags. +light maroon bags contain 4 mirrored brown bags. +pale violet bags contain 4 wavy turquoise bags, 5 dull orange bags, 4 dotted black bags, 5 muted fuchsia bags. +mirrored black bags contain 3 dotted silver bags, 2 bright crimson bags. +drab aqua bags contain 3 plaid red bags, 1 plaid violet bag, 5 dim tomato bags. +clear green bags contain 4 dark coral bags. +mirrored aqua bags contain 4 shiny crimson bags, 4 wavy bronze bags. +pale coral bags contain 2 wavy olive bags, 2 muted silver bags, 4 dim tan bags. +mirrored gray bags contain 5 clear plum bags, 5 dark yellow bags. +light blue bags contain 3 dull bronze bags, 3 dotted plum bags. +dark silver bags contain 2 plaid chartreuse bags, 5 plaid lavender bags, 1 wavy indigo bag, 4 dark brown bags. +posh silver bags contain 4 shiny lavender bags. +shiny orange bags contain 4 light magenta bags. +dark blue bags contain 5 pale purple bags. +wavy white bags contain 1 posh olive bag, 1 dotted fuchsia bag, 4 muted maroon bags. +striped orange bags contain 2 faded plum bags. +dull lime bags contain 1 pale yellow bag, 1 clear turquoise bag, 5 faded silver bags, 4 dim beige bags. +dull red bags contain 1 bright aqua bag, 3 light maroon bags, 5 light tomato bags. +light tomato bags contain 3 dull crimson bags, 1 dim beige bag. +bright blue bags contain 3 plaid olive bags. +bright red bags contain 4 muted teal bags, 5 dotted magenta bags. +striped gray bags contain 2 dotted purple bags, 4 dull green bags, 4 dull salmon bags, 4 muted silver bags. +drab salmon bags contain 4 mirrored indigo bags, 5 mirrored silver bags, 5 shiny cyan bags, 1 plaid brown bag. +posh olive bags contain 3 faded silver bags, 5 plaid violet bags, 2 striped bronze bags. +dim salmon bags contain 5 vibrant lavender bags. +mirrored orange bags contain 2 bright white bags, 5 plaid orange bags. +posh fuchsia bags contain 5 vibrant coral bags, 2 shiny plum bags, 5 pale silver bags. +wavy fuchsia bags contain 5 posh cyan bags, 2 bright silver bags, 1 wavy tomato bag, 1 wavy plum bag. +clear olive bags contain 4 pale maroon bags, 2 muted bronze bags, 4 mirrored crimson bags, 2 dull blue bags. +clear blue bags contain 5 shiny white bags, 5 plaid lime bags. +dotted coral bags contain no other bags. +clear black bags contain 4 dull beige bags, 2 mirrored crimson bags, 2 dim beige bags. +mirrored turquoise bags contain 2 light green bags, 4 dull lime bags, 2 drab olive bags, 3 drab purple bags. +muted teal bags contain 2 dim gold bags, 1 light salmon bag, 3 dark crimson bags, 3 muted olive bags. +clear gray bags contain 2 dotted coral bags, 5 shiny tomato bags. +vibrant black bags contain 2 dull blue bags, 1 light magenta bag. +clear yellow bags contain 3 vibrant yellow bags, 2 plaid red bags, 1 dull plum bag, 4 faded violet bags. +dull fuchsia bags contain 4 dim maroon bags, 4 wavy plum bags, 5 dim teal bags. +mirrored gold bags contain 4 mirrored brown bags, 3 dotted coral bags, 4 faded plum bags, 1 mirrored indigo bag. +faded lime bags contain 3 plaid violet bags, 2 drab tan bags. +wavy olive bags contain 3 muted silver bags, 1 pale maroon bag, 5 posh silver bags. +pale bronze bags contain 2 striped purple bags, 5 bright magenta bags, 4 pale crimson bags. +posh crimson bags contain 4 mirrored purple bags, 2 shiny silver bags, 4 bright tan bags. +clear plum bags contain 1 mirrored indigo bag, 4 clear purple bags, 2 dull blue bags, 5 striped bronze bags. +vibrant chartreuse bags contain 5 vibrant yellow bags, 1 faded red bag. +plaid red bags contain no other bags. +dim maroon bags contain 2 pale yellow bags, 4 dotted cyan bags. +pale silver bags contain 2 dark crimson bags. +bright magenta bags contain 5 plaid red bags, 4 faded maroon bags. +dark crimson bags contain 2 bright magenta bags, 1 mirrored silver bag, 2 mirrored brown bags, 1 shiny lavender bag. +dull yellow bags contain 1 dull salmon bag. +dark maroon bags contain 5 muted turquoise bags. +clear indigo bags contain 5 posh purple bags, 3 striped magenta bags. +shiny olive bags contain 3 drab yellow bags. +vibrant bronze bags contain 4 plaid indigo bags. +light plum bags contain 5 faded aqua bags. +dim lavender bags contain 3 drab purple bags, 2 clear salmon bags, 1 wavy bronze bag, 1 plaid tan bag. +mirrored chartreuse bags contain 3 wavy plum bags, 2 muted tan bags. +bright teal bags contain 2 bright lavender bags, 5 plaid plum bags, 3 clear bronze bags. +dull tan bags contain 4 clear gray bags. +shiny magenta bags contain 2 plaid gold bags, 2 dotted turquoise bags, 4 muted teal bags, 3 shiny gold bags. +clear aqua bags contain 4 dim cyan bags, 3 dim plum bags, 5 dim violet bags, 1 plaid yellow bag. +clear tan bags contain 1 shiny brown bag. +faded lavender bags contain 3 faded white bags, 1 faded purple bag. +plaid maroon bags contain 5 plaid orange bags, 4 striped green bags, 2 striped gold bags, 5 bright bronze bags. +wavy lavender bags contain 5 dim black bags, 5 clear fuchsia bags. +plaid olive bags contain 3 dotted crimson bags, 2 pale plum bags, 3 bright orange bags, 1 clear coral bag. +shiny lavender bags contain 3 faded plum bags, 2 mirrored crimson bags, 5 striped orange bags, 5 bright magenta bags. +plaid chartreuse bags contain 5 clear silver bags, 5 pale crimson bags. +bright coral bags contain 4 vibrant orange bags. +wavy yellow bags contain 3 dull plum bags, 4 bright yellow bags, 5 mirrored violet bags, 3 plaid red bags. +dark chartreuse bags contain 4 striped bronze bags, 2 bright tan bags. +mirrored tomato bags contain 1 clear yellow bag, 1 dark lime bag, 2 mirrored silver bags. +plaid gray bags contain 4 muted cyan bags, 4 dark silver bags, 1 wavy orange bag, 4 muted tomato bags. +mirrored red bags contain 5 pale crimson bags, 5 light cyan bags, 1 posh yellow bag. +vibrant silver bags contain 2 dull brown bags, 1 vibrant orange bag, 5 striped red bags. +plaid purple bags contain 2 striped maroon bags, 1 faded olive bag. +dull silver bags contain 4 shiny lavender bags, 5 plaid fuchsia bags, 1 plaid plum bag, 2 light cyan bags. +dark plum bags contain 2 vibrant gold bags, 4 plaid brown bags, 1 drab teal bag, 4 dotted yellow bags. +mirrored teal bags contain 3 drab orange bags, 4 shiny fuchsia bags, 4 mirrored lavender bags, 1 clear brown bag. +light red bags contain 5 striped violet bags. +shiny aqua bags contain 4 wavy indigo bags, 3 posh olive bags, 2 clear gray bags, 2 dim tomato bags. +dull magenta bags contain 1 bright crimson bag, 1 bright bronze bag, 2 drab gold bags, 2 clear lavender bags. +muted gold bags contain 1 striped chartreuse bag, 3 posh olive bags. +dark brown bags contain 1 bright yellow bag. +dull brown bags contain 5 dark brown bags, 1 dim gold bag. +shiny chartreuse bags contain 1 shiny aqua bag, 5 faded chartreuse bags, 4 wavy beige bags. +vibrant maroon bags contain 1 dotted yellow bag, 2 striped green bags, 2 muted olive bags, 2 muted turquoise bags. +faded maroon bags contain 1 striped bronze bag, 5 dotted coral bags, 4 dim green bags, 1 faded plum bag. +wavy salmon bags contain 1 dim white bag, 4 clear purple bags, 5 dark fuchsia bags, 5 vibrant cyan bags. +light beige bags contain 3 dull lime bags, 1 plaid lavender bag. +plaid teal bags contain 2 muted black bags, 2 dull salmon bags, 5 faded red bags, 2 muted turquoise bags. +plaid cyan bags contain 5 faded maroon bags, 2 posh chartreuse bags. +dim chartreuse bags contain 5 muted red bags, 4 dark lime bags. +clear magenta bags contain 1 clear tomato bag, 1 striped orange bag, 3 striped chartreuse bags. +dotted blue bags contain 5 plaid green bags, 3 mirrored crimson bags, 4 dotted magenta bags, 3 clear bronze bags. +clear silver bags contain 4 vibrant lavender bags, 1 wavy turquoise bag, 2 posh purple bags, 5 dull blue bags. +posh beige bags contain 4 muted aqua bags, 3 wavy orange bags, 1 muted coral bag. +dim coral bags contain 1 clear purple bag, 2 plaid purple bags, 5 light gold bags. +faded white bags contain 2 striped orange bags, 3 posh silver bags, 4 shiny tan bags, 5 faded green bags. +pale aqua bags contain 5 shiny tan bags, 5 drab violet bags. +clear brown bags contain 5 shiny tomato bags. +faded tan bags contain 1 pale gray bag, 2 dull beige bags, 3 wavy teal bags, 1 bright maroon bag. +striped silver bags contain 3 shiny green bags. +vibrant brown bags contain 5 shiny aqua bags, 2 pale violet bags, 5 drab indigo bags. +dark yellow bags contain 1 wavy white bag, 3 posh violet bags, 4 bright magenta bags. +dull gray bags contain 3 dark silver bags, 3 mirrored green bags. +dark violet bags contain 2 dark maroon bags, 5 dull aqua bags. +muted brown bags contain 5 dim aqua bags, 3 dim teal bags, 4 faded olive bags, 1 plaid purple bag. +posh chartreuse bags contain 3 dark tan bags, 1 striped salmon bag, 2 dark lime bags, 5 vibrant beige bags. +mirrored maroon bags contain 1 dark red bag. +faded yellow bags contain 5 mirrored beige bags, 1 drab chartreuse bag, 3 vibrant lavender bags. +dotted aqua bags contain 4 vibrant lavender bags, 4 shiny fuchsia bags. +bright maroon bags contain 5 faded maroon bags, 2 dark lime bags, 4 dim beige bags. +dark salmon bags contain 5 clear tan bags. +wavy bronze bags contain 3 dark beige bags. +wavy crimson bags contain no other bags. +drab gold bags contain 2 faded violet bags, 4 faded silver bags. +dark black bags contain 3 wavy bronze bags, 2 dark aqua bags, 4 dotted beige bags. +striped lavender bags contain 2 wavy aqua bags. +vibrant red bags contain 1 plaid aqua bag. +shiny yellow bags contain 5 clear silver bags, 2 dull magenta bags, 5 clear turquoise bags. +dull chartreuse bags contain 5 light tan bags. +bright beige bags contain 2 dim tomato bags. +mirrored yellow bags contain 5 drab aqua bags, 5 mirrored silver bags, 3 dark lime bags. +striped beige bags contain 4 dim white bags. +muted orange bags contain 3 drab beige bags, 5 faded olive bags. +drab turquoise bags contain 1 light green bag, 1 drab tomato bag, 4 clear purple bags. +plaid salmon bags contain 3 posh gray bags, 1 dim beige bag, 1 plaid brown bag. +faded gray bags contain 3 plaid fuchsia bags, 5 plaid magenta bags, 5 plaid white bags, 1 dull beige bag. +posh aqua bags contain 2 mirrored turquoise bags. +mirrored crimson bags contain no other bags. +vibrant magenta bags contain 1 dull purple bag, 4 shiny red bags, 5 drab chartreuse bags, 4 bright red bags. +striped yellow bags contain 1 shiny tan bag. +vibrant orange bags contain 4 plaid silver bags, 5 dim teal bags, 1 striped maroon bag, 3 plaid red bags. +dark indigo bags contain 3 drab purple bags. +shiny gray bags contain 1 wavy yellow bag. +faded plum bags contain no other bags. +dim blue bags contain 2 dotted crimson bags, 5 muted chartreuse bags, 3 dark silver bags, 4 vibrant lime bags. +muted white bags contain 4 muted teal bags, 3 posh purple bags, 1 dull lavender bag, 5 pale crimson bags. +muted lime bags contain 1 shiny turquoise bag, 2 faded indigo bags, 2 vibrant silver bags, 1 pale turquoise bag. +posh coral bags contain 5 faded violet bags. +dotted fuchsia bags contain 1 clear tan bag, 1 striped lavender bag. +wavy brown bags contain 2 dim aqua bags. +posh brown bags contain 1 shiny cyan bag, 5 plaid orange bags, 3 light coral bags. +drab purple bags contain 5 faded orange bags. +muted tan bags contain 2 wavy teal bags, 3 dim salmon bags, 1 bright gold bag, 3 clear gray bags. +dim yellow bags contain 1 vibrant gray bag, 4 vibrant lavender bags, 1 muted magenta bag. +pale salmon bags contain 2 vibrant beige bags, 3 bright maroon bags. +faded turquoise bags contain 4 plaid purple bags, 2 light tomato bags, 3 light salmon bags. +clear teal bags contain 4 muted yellow bags, 3 dim beige bags, 5 faded tomato bags, 1 dim red bag. +vibrant olive bags contain 3 muted lime bags, 5 shiny blue bags, 3 light gold bags, 3 dark olive bags. +dim beige bags contain 1 light cyan bag, 3 faded plum bags. +dull black bags contain 2 striped black bags, 5 wavy brown bags, 1 bright red bag, 1 drab teal bag. +pale turquoise bags contain 5 vibrant violet bags, 3 dotted fuchsia bags, 2 striped blue bags, 4 posh purple bags. +wavy red bags contain 3 drab teal bags. +faded gold bags contain 5 dull lavender bags. +faded black bags contain 5 wavy turquoise bags, 5 mirrored crimson bags. +bright orange bags contain 2 striped maroon bags, 4 light cyan bags, 5 light silver bags, 5 wavy indigo bags. +drab teal bags contain 4 wavy aqua bags, 5 light bronze bags, 1 drab red bag. +dull salmon bags contain 4 dull orange bags. +bright lavender bags contain 2 plaid silver bags, 3 bright crimson bags. +drab cyan bags contain 2 bright bronze bags, 5 bright crimson bags, 2 wavy yellow bags. +dull plum bags contain 3 shiny lavender bags, 2 bright magenta bags, 2 mirrored crimson bags, 4 mirrored silver bags. +dotted teal bags contain 3 muted yellow bags, 3 dotted turquoise bags, 5 mirrored white bags. +vibrant turquoise bags contain 5 clear magenta bags, 5 dark beige bags, 2 vibrant tan bags, 3 plaid blue bags. +pale crimson bags contain 2 bright turquoise bags, 4 dark lime bags. +pale plum bags contain 1 shiny chartreuse bag, 3 vibrant gold bags, 5 plaid violet bags, 5 dim salmon bags. +mirrored lime bags contain 2 plaid green bags. +pale lavender bags contain 5 dotted gold bags, 1 striped maroon bag, 3 shiny tan bags, 5 drab white bags. +muted olive bags contain 3 drab crimson bags, 2 dotted gray bags, 5 dotted tomato bags, 3 posh bronze bags. +drab brown bags contain 3 dull orange bags, 4 posh gold bags, 2 pale crimson bags, 1 plaid white bag. +bright tan bags contain 1 dark white bag, 5 bright turquoise bags. +faded indigo bags contain 3 pale yellow bags, 2 mirrored brown bags, 1 shiny gray bag, 5 bright turquoise bags. +dark aqua bags contain 1 posh gray bag, 4 striped coral bags, 2 posh olive bags, 2 bright white bags. +light tan bags contain 2 faded purple bags, 5 muted fuchsia bags. +dark magenta bags contain 4 posh silver bags, 5 pale plum bags, 5 muted violet bags, 2 faded green bags. +clear maroon bags contain 3 muted maroon bags, 1 clear olive bag, 2 faded black bags. +posh purple bags contain 4 faded orange bags, 4 shiny salmon bags. +bright gold bags contain 1 dull crimson bag, 1 shiny lavender bag. +dull purple bags contain 3 clear silver bags, 1 drab aqua bag, 3 wavy beige bags. +muted cyan bags contain 1 plaid green bag. +vibrant yellow bags contain 3 faded plum bags, 4 vibrant lavender bags, 2 muted magenta bags. +vibrant green bags contain 5 dim chartreuse bags, 2 posh lavender bags. +plaid bronze bags contain 4 dim tomato bags, 3 shiny silver bags. +striped blue bags contain 5 vibrant gold bags. +plaid coral bags contain 4 faded purple bags, 3 drab turquoise bags, 1 light teal bag, 2 posh indigo bags. +posh turquoise bags contain 5 posh cyan bags, 5 mirrored violet bags. +faded crimson bags contain 2 plaid salmon bags, 1 striped magenta bag, 1 striped maroon bag. +striped purple bags contain 1 drab violet bag, 2 pale maroon bags, 2 drab beige bags, 4 faded maroon bags. +clear orange bags contain 5 dotted red bags, 4 mirrored red bags. +striped fuchsia bags contain 2 bright tomato bags, 4 dull magenta bags. +wavy purple bags contain 5 wavy olive bags, 3 shiny silver bags. +dotted crimson bags contain 1 striped teal bag, 5 shiny tomato bags. +dull lavender bags contain 1 dotted tomato bag, 3 wavy indigo bags, 1 faded silver bag. +dotted magenta bags contain 3 dotted coral bags. +drab silver bags contain 5 dark indigo bags, 4 bright bronze bags, 1 dim lime bag, 3 bright aqua bags. +clear cyan bags contain 1 bright maroon bag. +shiny beige bags contain 2 plaid beige bags, 2 striped magenta bags, 4 drab yellow bags, 4 muted yellow bags. +dim turquoise bags contain 2 dull tan bags. +drab coral bags contain 4 striped bronze bags, 3 dull orange bags, 5 plaid silver bags. +light lavender bags contain 1 wavy plum bag, 4 posh purple bags. +posh yellow bags contain 3 dark lime bags, 3 light cyan bags, 4 dull crimson bags. +posh violet bags contain 2 faded chartreuse bags. +shiny teal bags contain 5 mirrored salmon bags, 1 wavy plum bag, 3 posh purple bags, 2 posh cyan bags. +vibrant lime bags contain 1 dotted tomato bag, 1 drab fuchsia bag, 1 mirrored brown bag. +dark fuchsia bags contain 1 vibrant blue bag. +bright green bags contain 4 dark purple bags, 4 bright tan bags, 5 drab turquoise bags. +dull coral bags contain 2 dotted tomato bags. +posh white bags contain 3 dull bronze bags, 1 faded salmon bag, 3 pale tomato bags, 3 vibrant salmon bags. +plaid black bags contain 4 vibrant aqua bags, 2 shiny teal bags. +posh lavender bags contain 4 wavy beige bags, 1 dim silver bag, 2 faded white bags. +posh orange bags contain 4 dim orange bags, 3 faded chartreuse bags. +plaid brown bags contain 5 shiny fuchsia bags, 5 striped magenta bags, 2 wavy coral bags, 1 vibrant beige bag. +shiny plum bags contain 3 light green bags, 4 bright orange bags. +dim aqua bags contain 4 faded gold bags, 1 dotted lavender bag, 3 light gold bags, 4 shiny aqua bags. +wavy gold bags contain 4 clear violet bags, 5 dim red bags, 5 drab crimson bags, 2 dull coral bags. +vibrant tomato bags contain 3 faded olive bags. +bright silver bags contain 2 dull lavender bags, 4 faded aqua bags, 4 dim coral bags. +wavy turquoise bags contain 4 dull lavender bags, 1 drab aqua bag. +wavy aqua bags contain 3 wavy yellow bags. +light indigo bags contain 5 dim beige bags, 3 drab fuchsia bags, 1 plaid violet bag, 5 bright yellow bags. +striped red bags contain 3 bright violet bags, 5 dark indigo bags, 5 dim silver bags. +posh lime bags contain 5 striped teal bags, 3 dark brown bags, 4 bright crimson bags, 2 posh violet bags. +faded magenta bags contain 5 light gold bags, 1 posh indigo bag, 3 plaid lime bags. +vibrant lavender bags contain 5 faded maroon bags, 3 striped orange bags, 3 dull crimson bags. +clear purple bags contain 5 dark green bags, 3 light cyan bags, 3 clear white bags, 4 pale silver bags. +muted purple bags contain 5 drab fuchsia bags, 1 vibrant salmon bag, 5 bright yellow bags. +bright lime bags contain 5 vibrant violet bags, 5 wavy maroon bags. +bright black bags contain 5 dark silver bags, 2 vibrant green bags. +muted magenta bags contain no other bags. +striped tomato bags contain 4 shiny gold bags. +pale black bags contain 3 dull brown bags, 2 wavy coral bags, 2 posh purple bags, 4 faded beige bags. +dim red bags contain 1 dotted tomato bag, 2 wavy beige bags. +light black bags contain 4 dull maroon bags, 3 dotted aqua bags, 3 drab purple bags. +shiny turquoise bags contain 3 dull blue bags, 4 posh bronze bags. +pale indigo bags contain 4 dotted tomato bags. +shiny white bags contain 5 vibrant tomato bags, 4 dotted magenta bags, 3 dull aqua bags. +dark lavender bags contain 4 faded orange bags. +shiny brown bags contain 3 bright orange bags, 2 dotted crimson bags, 2 wavy aqua bags. +light chartreuse bags contain 1 muted lavender bag. +faded aqua bags contain 4 dull green bags, 4 faded violet bags, 4 clear gray bags. +light olive bags contain 4 shiny purple bags, 3 shiny plum bags. +wavy indigo bags contain 3 dim green bags, 5 shiny lavender bags, 3 posh olive bags, 1 dull crimson bag. +dull tomato bags contain 3 light coral bags, 2 light cyan bags, 3 plaid silver bags. +clear turquoise bags contain 1 wavy crimson bag, 4 dim tomato bags. +dim tomato bags contain 5 shiny lavender bags, 2 dim gold bags. +wavy black bags contain 4 wavy chartreuse bags, 4 dull coral bags. +dotted maroon bags contain 5 pale violet bags, 5 vibrant aqua bags, 5 plaid cyan bags. +clear lavender bags contain 2 dotted turquoise bags, 4 light purple bags, 1 plaid plum bag. +dotted cyan bags contain 2 dotted turquoise bags, 4 plaid gold bags, 5 drab red bags, 5 faded orange bags. +muted violet bags contain 3 light teal bags, 2 striped gold bags. +wavy silver bags contain 2 dim coral bags, 1 shiny chartreuse bag, 4 shiny turquoise bags. +drab crimson bags contain 2 drab beige bags. +dull aqua bags contain 4 striped maroon bags, 5 vibrant beige bags, 3 faded gold bags, 3 dark lime bags. +vibrant coral bags contain 4 faded gold bags, 2 dotted black bags, 5 drab tomato bags. +pale beige bags contain 1 dotted coral bag. +dim olive bags contain 5 clear gray bags, 2 muted violet bags, 3 clear gold bags, 4 shiny red bags. +dim cyan bags contain 4 plaid silver bags. +muted bronze bags contain 4 wavy yellow bags, 1 vibrant yellow bag, 5 dim tomato bags, 2 mirrored silver bags. +dim gold bags contain 2 dim green bags, 4 shiny tomato bags, 4 striped white bags, 4 mirrored crimson bags. +vibrant gray bags contain 4 dotted turquoise bags, 4 posh violet bags. +plaid orange bags contain 2 dotted turquoise bags. +posh magenta bags contain 4 dotted lime bags. +light silver bags contain 5 shiny gold bags, 3 dull tan bags. +bright plum bags contain 5 pale magenta bags, 5 dull aqua bags. +drab red bags contain 1 dim gold bag. +striped salmon bags contain 1 vibrant lavender bag, 3 wavy crimson bags, 5 posh olive bags. +dotted purple bags contain 3 dull lavender bags. +bright violet bags contain 2 dotted indigo bags, 4 shiny violet bags. +muted red bags contain 2 mirrored silver bags. +dotted green bags contain 5 muted plum bags. +clear lime bags contain no other bags. +wavy gray bags contain 1 posh cyan bag, 5 dim bronze bags, 5 posh lime bags, 4 drab silver bags. +dotted brown bags contain 4 striped tomato bags. +plaid indigo bags contain 1 plaid purple bag, 3 dark turquoise bags, 3 light purple bags, 5 dotted cyan bags. +mirrored olive bags contain 5 bright gold bags, 3 dotted gold bags, 4 drab gray bags, 4 drab tomato bags. +wavy green bags contain 3 mirrored indigo bags, 4 wavy chartreuse bags, 2 clear cyan bags, 5 bright violet bags. +light gray bags contain 4 vibrant yellow bags, 2 dull blue bags. +posh plum bags contain 3 wavy yellow bags, 5 dim yellow bags, 2 clear chartreuse bags. +posh bronze bags contain 2 clear lime bags. +bright indigo bags contain 4 muted salmon bags, 2 posh violet bags. +mirrored violet bags contain 1 faded plum bag, 3 dull orange bags. +muted silver bags contain 3 mirrored indigo bags, 4 shiny fuchsia bags. +striped coral bags contain 2 posh turquoise bags. +plaid tomato bags contain 1 wavy beige bag, 5 muted green bags. +dark gold bags contain 1 clear gold bag, 2 light maroon bags, 3 pale teal bags. +light green bags contain 1 dull aqua bag, 4 dotted magenta bags, 4 dull purple bags. +plaid lime bags contain 1 faded fuchsia bag. +muted beige bags contain 1 dotted coral bag, 1 plaid fuchsia bag, 2 posh bronze bags. +pale red bags contain 2 wavy gold bags, 1 striped lavender bag. +striped lime bags contain 1 wavy turquoise bag, 4 dim aqua bags. +muted black bags contain 3 dotted black bags. +faded brown bags contain 1 dim turquoise bag, 2 plaid brown bags. +plaid blue bags contain 2 muted salmon bags. +muted indigo bags contain 2 dull fuchsia bags, 2 dull lime bags. +dark coral bags contain 2 faded indigo bags, 3 shiny tomato bags, 2 mirrored salmon bags. +vibrant beige bags contain 4 vibrant lavender bags. +mirrored bronze bags contain 1 mirrored orange bag, 5 plaid red bags, 1 mirrored cyan bag. +shiny red bags contain 1 bright yellow bag. +light crimson bags contain 5 plaid crimson bags, 3 pale white bags, 3 drab fuchsia bags, 3 muted olive bags. +drab blue bags contain 1 mirrored black bag, 3 striped fuchsia bags, 3 drab tan bags. +striped violet bags contain 2 muted gray bags, 5 faded white bags, 5 striped black bags, 3 mirrored tomato bags. +wavy maroon bags contain 2 light cyan bags, 3 muted teal bags, 2 vibrant lavender bags. +pale brown bags contain 2 wavy black bags. +bright aqua bags contain 3 plaid tan bags. +muted plum bags contain 5 light bronze bags, 1 dotted beige bag, 3 vibrant cyan bags. +posh green bags contain 4 faded lime bags, 1 dull coral bag, 4 mirrored silver bags. +dark beige bags contain 3 wavy yellow bags, 5 dim salmon bags. +light fuchsia bags contain 4 plaid coral bags. +shiny tan bags contain 2 drab tan bags, 4 clear gray bags, 2 mirrored crimson bags, 1 vibrant beige bag. +clear crimson bags contain 3 vibrant aqua bags, 4 dotted indigo bags. +clear beige bags contain 4 posh olive bags, 4 bright lime bags, 3 dark green bags. +dim gray bags contain 1 drab beige bag, 3 clear tomato bags, 2 mirrored fuchsia bags. +light violet bags contain 3 plaid purple bags. +faded silver bags contain 5 striped bronze bags, 4 dotted lavender bags. +dotted white bags contain 5 drab green bags. +shiny purple bags contain 3 posh turquoise bags, 2 dark brown bags. +posh blue bags contain 2 vibrant chartreuse bags, 2 muted olive bags, 4 dull brown bags, 5 wavy magenta bags. +striped cyan bags contain 1 pale plum bag, 3 dim maroon bags, 5 light salmon bags, 3 dim crimson bags. +shiny tomato bags contain no other bags. +plaid aqua bags contain 4 clear maroon bags, 4 plaid white bags, 2 posh chartreuse bags. +pale magenta bags contain 5 muted teal bags, 1 vibrant lavender bag. +dim plum bags contain 4 drab coral bags. +drab beige bags contain 4 wavy crimson bags, 1 dull tan bag, 3 dotted tomato bags. +wavy coral bags contain 1 mirrored yellow bag, 1 dull tan bag, 5 drab gold bags, 2 muted bronze bags. +drab violet bags contain 4 faded maroon bags, 2 posh gold bags, 3 wavy maroon bags, 3 bright lime bags. +light aqua bags contain 5 light bronze bags, 1 light tan bag, 1 dull beige bag. +light orange bags contain 1 dark tan bag, 3 dim white bags, 3 plaid plum bags. +pale chartreuse bags contain 3 pale violet bags, 1 drab fuchsia bag, 1 shiny indigo bag, 2 dull turquoise bags. +faded chartreuse bags contain 4 vibrant lime bags, 3 drab tomato bags, 1 vibrant violet bag, 1 vibrant tomato bag. +clear chartreuse bags contain 2 dotted plum bags, 1 muted brown bag, 2 wavy chartreuse bags, 4 faded green bags. +dotted silver bags contain 3 mirrored yellow bags. +dotted violet bags contain 4 muted turquoise bags, 4 light black bags. +wavy orange bags contain 3 shiny fuchsia bags, 4 clear beige bags. +dark red bags contain 1 faded salmon bag, 3 muted purple bags. +dim bronze bags contain 2 clear turquoise bags. +light turquoise bags contain 5 dark red bags. +muted green bags contain 5 bright turquoise bags, 2 wavy coral bags, 3 faded chartreuse bags. +vibrant violet bags contain 3 wavy indigo bags, 1 dotted gray bag, 4 vibrant beige bags. +dull cyan bags contain 3 light maroon bags, 2 posh plum bags. +muted aqua bags contain 2 dotted beige bags, 2 faded yellow bags, 3 plaid gray bags, 3 bright chartreuse bags. +dark tomato bags contain 2 striped purple bags, 2 dark maroon bags, 2 dim silver bags. +vibrant blue bags contain 4 dull orange bags. +faded violet bags contain 2 vibrant lavender bags, 5 plaid plum bags, 4 bright magenta bags, 4 faded silver bags. +bright salmon bags contain 1 dull crimson bag, 2 light maroon bags. +vibrant aqua bags contain 4 dotted aqua bags, 3 vibrant gray bags, 3 dotted lavender bags. +striped plum bags contain 2 mirrored lime bags, 2 dark salmon bags. +plaid gold bags contain 4 dark lime bags, 3 drab aqua bags, 3 dim white bags, 2 mirrored brown bags.
\ No newline at end of file diff --git a/2020/07/puzzle-1.py b/2020/07/puzzle-1.py new file mode 100755 index 0000000..da054b8 --- /dev/null +++ b/2020/07/puzzle-1.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 + + +bdict: dict[str, list[str]] = {} + +# Recursively check if a bag can hold a shiny gold bag +def holds_bag(innerbags: list[str]) -> bool: + if "no other" in innerbags: + return False + elif "shiny gold" in innerbags: + return True + + for subbag in innerbags: + if holds_bag(bdict[subbag]): + return True + + +def main() -> None: + global bdict + with open("input", "r") as f: + lines = f.readlines() + + for baginfo in lines: + data = baginfo.split(" bags contain") + + # { bag_name: [contained_bag_1, containted_bag_2, ...] } + bdict[data[0]] = [" ".join(b.split(" ")[-3:][:2]) for b in data[1].split(",")] + + count = 0 + for bag in bdict: + if holds_bag(bdict[bag]): + count += 1 + + print(count) + + +if __name__ == "__main__": + main() diff --git a/2020/07/puzzle-2.py b/2020/07/puzzle-2.py new file mode 100755 index 0000000..c87ea13 --- /dev/null +++ b/2020/07/puzzle-2.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + + +bdict: dict[str, list[str]] = {} + +# Recursively find the number of sub-bags in a bag +def total_bags(innerbags: list[dict[int, str]]) -> int: + if innerbags[0]["name"] == "no other": + return 0 + + return sum([bag["count"] + bag["count"] * total_bags(bdict[bag["name"]]) for bag in innerbags]) + + +def main() -> None: + with open("input", "r") as f: + lines = f.readlines() + + for baginfo in lines: + data = baginfo.split(" bags contain") + + # { bag_name: [{ count: n, name: bag_name_ }, ...] } + bdict[data[0]] = [] + for b in data[1].split(","): + bdict[data[0]].append( + { + "count": int(b.replace("no", "0").split(" ")[1]), + "name": " ".join(b.split(" ")[-3:][:2]), + } + ) + + print(total_bags(bdict["shiny gold"])) + + +if __name__ == "__main__": + main() diff --git a/2020/08/.gitignore b/2020/08/.gitignore new file mode 100644 index 0000000..60d075d --- /dev/null +++ b/2020/08/.gitignore @@ -0,0 +1 @@ +puzzle-[12] diff --git a/2020/08/Makefile b/2020/08/Makefile new file mode 100644 index 0000000..c32dafa --- /dev/null +++ b/2020/08/Makefile @@ -0,0 +1,7 @@ +all: + ${CC} ${CFLAGS} -o puzzle-1 puzzles.c + ${CC} ${CFLAGS} -DPART2 -o puzzle-2 puzzles.c + +.PHONY: clean +clean: + rm -f puzzle-[12] diff --git a/2020/08/input b/2020/08/input new file mode 100644 index 0000000..49eb92d --- /dev/null +++ b/2020/08/input @@ -0,0 +1,653 @@ +acc +9 +acc -2 +acc -12 +acc +33 +jmp +301 +nop +508 +jmp +216 +acc +27 +acc +35 +acc +43 +acc +31 +jmp +309 +acc +18 +acc -19 +acc +7 +jmp +44 +acc -13 +acc -17 +acc +31 +jmp +311 +nop +612 +jmp +143 +acc +22 +nop +85 +jmp +458 +acc -3 +jmp +13 +acc -19 +acc +27 +acc +12 +jmp +483 +acc +40 +acc +6 +jmp +128 +jmp +10 +acc +0 +acc -3 +acc -2 +jmp -11 +acc +43 +acc -12 +jmp +158 +acc +0 +jmp +240 +jmp +1 +acc +5 +acc +15 +jmp +187 +nop +563 +jmp +51 +acc -16 +jmp +158 +jmp +322 +acc +47 +nop -1 +jmp +299 +acc +26 +acc +25 +jmp +232 +jmp -9 +acc +15 +jmp +54 +jmp +558 +acc +7 +acc -7 +jmp +399 +nop +447 +jmp +71 +acc +26 +acc +46 +jmp +145 +acc +38 +acc +30 +acc +21 +jmp +263 +acc +10 +jmp +168 +acc +22 +nop +561 +jmp -26 +jmp +1 +acc -7 +jmp -5 +acc +28 +acc -6 +jmp +370 +jmp +94 +acc +50 +acc +42 +acc -9 +acc +30 +jmp +70 +acc +29 +jmp +166 +acc -5 +acc -18 +nop +84 +acc +2 +jmp +366 +jmp -40 +acc -4 +acc -15 +acc -1 +jmp +169 +jmp +1 +acc -4 +acc +0 +jmp -45 +nop -21 +nop +241 +acc -18 +acc +19 +jmp +26 +nop -51 +jmp +260 +acc +17 +jmp +428 +acc +6 +jmp +405 +acc +22 +acc +10 +nop +471 +jmp +352 +acc -6 +acc +48 +acc +7 +acc +3 +jmp +57 +acc -10 +acc +16 +acc +16 +acc +43 +jmp +432 +acc -5 +acc +0 +nop +339 +acc +49 +jmp +17 +acc +33 +nop +166 +acc -5 +jmp +392 +nop +246 +acc -7 +acc +21 +acc +30 +jmp +398 +acc +36 +acc +24 +acc -15 +acc -9 +jmp +114 +acc +19 +jmp +11 +acc +43 +nop +182 +jmp -129 +nop -29 +acc -6 +acc +2 +jmp +398 +jmp +78 +acc +36 +jmp +393 +acc +15 +nop -11 +acc -7 +acc -9 +jmp +76 +acc +0 +acc +27 +jmp +25 +acc +27 +nop -54 +jmp +458 +acc +3 +acc +29 +acc -4 +acc +43 +jmp +413 +acc +33 +acc +13 +jmp +382 +jmp -83 +acc +42 +acc +24 +jmp +64 +acc +23 +acc -13 +nop +110 +acc -5 +jmp +114 +jmp +113 +nop +112 +acc +26 +jmp -133 +jmp -12 +jmp +1 +jmp +330 +acc +25 +acc -1 +acc +30 +acc +42 +jmp -187 +jmp +1 +acc +20 +acc +35 +acc +36 +jmp -125 +jmp +165 +acc +28 +acc -17 +acc -12 +jmp +1 +jmp -120 +nop +1 +acc +2 +acc +26 +jmp +398 +acc +20 +acc -1 +jmp -127 +acc +36 +acc +14 +jmp +1 +jmp +331 +acc +50 +acc +1 +acc -10 +nop +159 +jmp -83 +jmp +374 +acc +17 +jmp +372 +acc +44 +nop -39 +jmp +228 +acc +17 +jmp +74 +acc +16 +acc +33 +acc -2 +jmp +152 +jmp +29 +acc +8 +acc +27 +nop +59 +jmp -32 +acc +28 +jmp -227 +nop -35 +jmp -168 +acc +13 +nop +390 +jmp -204 +acc +16 +acc +44 +jmp -230 +jmp +25 +acc +30 +jmp +383 +acc -11 +acc +38 +acc +11 +jmp +341 +acc +35 +acc +46 +acc -1 +jmp +94 +acc -4 +acc +12 +jmp +111 +jmp +133 +nop +283 +acc +13 +acc +37 +jmp +74 +nop -218 +jmp -178 +acc +46 +acc +25 +acc -5 +jmp -174 +acc +28 +acc +39 +acc +36 +acc +22 +jmp -172 +acc +19 +jmp -250 +nop +62 +acc +44 +nop +347 +acc +40 +jmp +345 +acc -3 +acc -13 +acc -11 +jmp +56 +jmp -180 +acc +17 +acc -4 +acc +46 +nop -165 +jmp +321 +acc -4 +jmp +1 +acc +9 +acc -12 +jmp -155 +acc +5 +jmp -96 +acc +0 +acc -2 +acc +38 +jmp +67 +acc -4 +nop -283 +acc +28 +jmp +324 +acc -9 +acc +43 +acc -1 +acc +9 +jmp -290 +acc +3 +acc +22 +nop +84 +acc -17 +jmp -210 +acc +7 +jmp -260 +nop -232 +nop +87 +acc +43 +acc +36 +jmp +96 +jmp +238 +acc +13 +acc -14 +acc +32 +acc +11 +jmp -146 +acc +13 +acc +37 +acc -10 +jmp +187 +acc +49 +acc +15 +jmp -234 +jmp -328 +jmp -136 +jmp +143 +jmp +1 +acc +27 +acc +22 +jmp +1 +jmp -5 +acc +30 +nop -7 +acc -6 +jmp -71 +acc -17 +acc +15 +jmp -52 +jmp -126 +acc -4 +jmp +151 +jmp +52 +nop -86 +acc +25 +jmp +187 +nop -22 +jmp -219 +acc +33 +nop -120 +acc +0 +jmp +215 +acc +46 +acc +38 +jmp +1 +jmp -262 +jmp +157 +acc -15 +acc +48 +acc +39 +acc +10 +jmp -137 +acc +47 +acc +50 +jmp -324 +nop +214 +acc +39 +jmp -178 +acc +49 +acc -10 +jmp -268 +jmp +50 +acc -14 +nop -100 +jmp +20 +acc +45 +acc -12 +acc -4 +jmp -208 +acc -19 +jmp -340 +acc +36 +nop -358 +acc +5 +jmp -348 +acc +47 +nop -18 +acc -12 +jmp -131 +acc +19 +acc +10 +acc +19 +acc +31 +jmp -164 +nop +162 +nop -260 +jmp +146 +acc +32 +acc -1 +nop -14 +jmp -192 +acc +3 +acc +31 +nop -185 +jmp -208 +jmp -69 +acc +43 +acc +43 +jmp -68 +acc -16 +acc +5 +acc -9 +jmp +126 +acc +33 +acc +2 +acc +34 +acc -9 +jmp -16 +acc +34 +acc -19 +jmp -266 +nop +135 +nop -389 +acc +33 +jmp -195 +acc +48 +jmp +1 +acc -12 +jmp +143 +nop -317 +acc -14 +nop -127 +acc +32 +jmp -372 +acc +24 +nop -41 +nop -42 +jmp -344 +acc +23 +nop +117 +nop +92 +acc +42 +jmp +143 +acc +48 +acc -6 +nop -272 +acc -13 +jmp -379 +acc -2 +acc +44 +acc +9 +jmp -369 +acc +6 +acc +25 +acc +34 +jmp -301 +nop -227 +acc +43 +jmp -141 +acc +12 +acc +41 +acc +17 +acc -11 +jmp +29 +jmp -121 +acc +6 +acc +7 +acc +7 +jmp +131 +nop +144 +nop -142 +acc -13 +acc -18 +jmp +149 +acc +14 +acc +49 +acc +25 +acc -17 +jmp -9 +acc +26 +acc -4 +jmp -230 +acc -18 +acc +36 +acc +27 +nop -142 +jmp +21 +acc +34 +nop +54 +jmp -476 +acc +10 +jmp -174 +nop -354 +acc +1 +jmp -324 +acc +40 +jmp +94 +acc -12 +jmp -136 +nop -454 +acc -14 +jmp +116 +acc +12 +acc -1 +nop -453 +jmp -241 +jmp -479 +acc -19 +jmp -87 +acc +27 +acc +48 +acc +0 +jmp -476 +acc +16 +acc +46 +jmp -534 +acc +0 +jmp -344 +acc +0 +acc +28 +jmp +10 +jmp -248 +nop -186 +jmp +1 +acc +26 +jmp -153 +acc +14 +acc -8 +nop -416 +jmp -91 +jmp -409 +jmp -326 +acc +2 +acc +8 +acc -18 +acc +33 +jmp -468 +jmp -175 +acc -7 +acc +45 +jmp -18 +jmp -375 +acc -8 +jmp +28 +acc -16 +nop -38 +acc +37 +acc +48 +jmp -343 +acc +10 +acc +26 +acc -9 +acc -16 +jmp -348 +acc +37 +jmp -453 +acc -2 +acc +27 +acc +17 +acc +28 +jmp -406 +acc +25 +acc +24 +acc +44 +acc +44 +jmp -532 +acc +10 +jmp -531 +acc +39 +acc +40 +jmp -284 +acc +19 +acc +3 +nop -533 +acc -3 +jmp -162 +nop -438 +acc -5 +jmp -114 +acc +45 +acc +1 +acc +28 +acc +9 +jmp -550 +jmp -222 +jmp -106 +acc -7 +nop -263 +nop -375 +jmp -381 +acc -4 +nop -223 +jmp -171 +jmp -465 +acc -2 +nop -562 +jmp -190 +acc +40 +jmp -4 +acc +30 +acc +21 +jmp -435 +acc +1 +acc +10 +jmp +1 +jmp -157 +acc -7 +acc +18 +acc -3 +acc +24 +jmp -113 +acc +21 +jmp -339 +acc +34 +jmp -563 +acc +27 +jmp -589 +jmp -61 +acc +35 +acc +50 +acc +8 +jmp -553 +acc +48 +acc -15 +acc +29 +acc +24 +jmp +1
\ No newline at end of file diff --git a/2020/08/puzzles.c b/2020/08/puzzles.c new file mode 100644 index 0000000..cfa9389 --- /dev/null +++ b/2020/08/puzzles.c @@ -0,0 +1,112 @@ +#include <err.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define LINECOUNT 653 + +struct Inst { + char opp; + int val; +}; + +/* Check if the given instruction has been executed already */ +static bool +repeati(int const * const lines, int const rip) +{ + for (int i = 0; i < LINECOUNT; i++) { + if (lines[i] == rip) + return true; + } + return false; +} + +static int +run_circuit(struct Inst *circuit) +{ + int i, acc, rip; + int lines[LINECOUNT] = {0}; + + i = acc = rip = 0; + + /* Execute the circuit */ + do { + lines[i++] = rip; + switch (circuit[rip].opp) { + case 'j': + rip += circuit[rip].val; + if (rip >= LINECOUNT) + return acc; + break; + case 'a': + acc += circuit[rip].val; + /* FALLTHROUGH */ + case 'n': + rip++; + break; + } + } while (!repeati(lines, rip)); + +#ifdef PART2 + return -1; +#else + return acc; +#endif +} + +int +main(void) +{ + int i = 0; + char cl[10]; + FILE *fp; + struct Inst circuit[LINECOUNT]; + + if (!(fp = fopen("input", "r"))) + err(EXIT_FAILURE, "fopen"); + + /* Load the entire circuit */ + while (fgets(cl, sizeof(cl), fp)) { + char *val; + /* struct Inst operation; */ + + val = strtok(cl, " "); + circuit[i++] = (struct Inst) { + .opp = cl[0], + .val = atoi(strtok(NULL, " ")) + }; + } + fclose(fp); + + int result = -1; +#ifdef PART2 + int count, prev_count; + count = prev_count = 1; + + /* Run circuit until it completes successfully */ + while (result == -1 && count < LINECOUNT) { + for (i = 0; i < LINECOUNT; i++) { + if (circuit[i].opp == 'j' || circuit[i].opp == 'n') + count--; + + /* Swap jmp and nop */ + if (!count) { + circuit[i].opp = (circuit[i].opp == 'j') ? 'n' : 'j'; + break; + } + } + + count = ++prev_count; + result = run_circuit(circuit); + + /* Return to original array */ + circuit[i].opp = (circuit[i].opp == 'j') ? 'n' : 'j'; + } +#else + result = run_circuit(circuit); +#endif + + printf("%d\n", result); + return EXIT_SUCCESS; +} diff --git a/2020/09/input b/2020/09/input new file mode 100644 index 0000000..b6fbe43 --- /dev/null +++ b/2020/09/input @@ -0,0 +1,1000 @@ +42 +27 +23 +19 +4 +26 +31 +29 +11 +49 +38 +9 +45 +1 +40 +46 +39 +28 +44 +16 +13 +5 +32 +17 +50 +12 +20 +6 +7 +10 +22 +14 +18 +60 +59 +8 +19 +9 +11 +15 +21 +23 +39 +24 +25 +16 +26 +13 +29 +17 +27 +28 +20 +35 +30 +31 +22 +32 +44 +33 +38 +47 +34 +36 +37 +41 +55 +64 +40 +42 +43 +46 +39 +45 +61 +48 +50 +52 +65 +62 +53 +67 +72 +69 +70 +74 +73 +98 +86 +76 +79 +81 +108 +84 +82 +91 +160 +153 +93 +253 +100 +102 +105 +115 +175 +166 +151 +149 +142 +218 +147 +152 +162 +155 +161 +163 +165 +173 +255 +184 +191 +193 +293 +195 +357 +252 +295 +220 +257 +404 +289 +291 +322 +294 +314 +415 +343 +316 +318 +324 +328 +512 +364 +517 +379 +384 +511 +636 +615 +574 +472 +477 +509 +644 +1021 +605 +585 +608 +610 +800 +634 +640 +1122 +642 +1255 +692 +841 +893 +981 +763 +1313 +1586 +1046 +949 +986 +1057 +1062 +1094 +1444 +1300 +2393 +1193 +1250 +1244 +1274 +1475 +1282 +1405 +1334 +1533 +1585 +1604 +1744 +2467 +1712 +2986 +2043 +2193 +2255 +2048 +3250 +2338 +2287 +2437 +3711 +2443 +2526 +2494 +2518 +2556 +3382 +2938 +2990 +3527 +4149 +5876 +4660 +4993 +4050 +4724 +4091 +4236 +4241 +4303 +4781 +4625 +4730 +4805 +4880 +4937 +5432 +7280 +9717 +5074 +5494 +9027 +5928 +9505 +7577 +8966 +8141 +8286 +8291 +13021 +12377 +10162 +9535 +8544 +13907 +14235 +14459 +9610 +9685 +19222 +17294 +10506 +18637 +18683 +14040 +33262 +22526 +21882 +15718 +17751 +16427 +16432 +16835 +35110 +28293 +18079 +19050 +28322 +34586 +30339 +40277 +19295 +26520 +20191 +24546 +26224 +26933 +29758 +33090 +47837 +34506 +34914 +32553 +64269 +34178 +52868 +62471 +35885 +37374 +37129 +38270 +38345 +96649 +39486 +43841 +57636 +70898 +44737 +46415 +68387 +66887 +74155 +71307 +85211 +66731 +67059 +67467 +68438 +110684 +82300 +73014 +80622 +74230 +76615 +75399 +106217 +77831 +152678 +126074 +116044 +91152 +111624 +113474 +141117 +133618 +133790 +138366 +134198 +173276 +142668 +157699 +135905 +158453 +206696 +212520 +147244 +157237 +365198 +152014 +239548 +168983 +191305 +224942 +202776 +254591 +276458 +272564 +247092 +267408 +267816 +402014 +301121 +292651 +278573 +506956 +283149 +293142 +304481 +309251 +494139 +565215 +320997 +343319 +441547 +371759 +785529 +449868 +692756 +457367 +537740 +592400 +514500 +761848 +546389 +711265 +561722 +1157615 +585793 +571715 +846991 +1100293 +597623 +874466 +715078 +778364 +881059 +784866 +793187 +813306 +821627 +907235 +1452774 +971867 +995107 +1157508 +1060889 +1076222 +1118104 +1108111 +1340086 +1370659 +1169338 +1183416 +1375987 +1634933 +1508265 +1419250 +1493442 +1499944 +2407179 +1665925 +1578053 +1889528 +1720541 +1728862 +1879102 +1966974 +2400975 +3213983 +2230227 +2137111 +3457155 +2448197 +3379046 +2352754 +2539997 +3306915 +2993386 +5013979 +2912692 +2919194 +3085175 +3071495 +3165869 +3243978 +3545027 +3298594 +5846912 +3449403 +3607964 +3846076 +4104085 +4940972 +4367338 +4489865 +6764070 +4800951 +4892751 +5265446 +5271948 +6362095 +5831886 +6291980 +6237364 +5984187 +6615272 +6156670 +6315473 +6409847 +6542572 +7144670 +11945621 +8593950 +9606073 +7454040 +7950161 +8471423 +9382616 +17777507 +9290816 +11103834 +10537394 +10158197 +17211067 +12654075 +11816073 +18200023 +17719106 +12140857 +12299660 +14106831 +12472143 +16148645 +12952419 +13687242 +15094831 +15404201 +15925463 +16744856 +23009537 +17240977 +26306842 +20695591 +19828210 +20394650 +21641228 +21974270 +39754393 +23956930 +36543295 +24115733 +24440517 +24771803 +37045429 +25252079 +25424562 +29216999 +33515452 +41177542 +28782073 +30499032 +42169418 +54455962 +33985833 +37069187 +37936568 +44600013 +40523801 +40222860 +42035878 +59019699 +53988802 +57631185 +54206635 +48556250 +54034152 +50196365 +50023882 +50676641 +54469078 +58940014 +57999072 +104652327 +69305874 +59281105 +64484865 +71055020 +105132603 +82536581 +80746661 +78159428 +155328968 +82258738 +88779110 +104665443 +159121405 +98580132 +130814988 +98752615 +99232891 +100220247 +123424879 +100700523 +169617468 +112468150 +213328040 +117280177 +135539885 +217798623 +123765970 +142644293 +149214448 +163283242 +158906089 +160418166 +166938538 +171037848 +255112443 +138879426 +197332747 +197813023 +197985506 +231035235 +241046147 +388836471 +340655316 +213168673 +277698343 +282085618 +236234120 +252820062 +278184178 +266410263 +262645396 +272980418 +288093874 +364271285 +297785515 +299297592 +305817964 +550739270 +503150711 +336212173 +700483458 +395145770 +570179492 +411154179 +444203908 +449402793 +465988735 +822999554 +524327994 +637251703 +489054182 +498879516 +515465458 +551164596 +585879389 +535625814 +700963734 +587391466 +597083107 +785614966 +635509765 +893209430 +1004519640 +900208361 +959669366 +806299949 +1137043985 +1229818874 +1897729070 +893606701 +1059953808 +955042917 +987933698 +1013382176 +1014344974 +1024679996 +1034505330 +1121505203 +1336473499 +1621763103 +1810294962 +1601602747 +1497291468 +1953163238 +2428063052 +1441809714 +1959562557 +1706508310 +1699906650 +2922409066 +1819682125 +1881540399 +1907951675 +1848649618 +1906988877 +1942976615 +1968425093 +2001315874 +3927987650 +2048850304 +2734411980 +2156010533 +2618796671 +2778283213 +2939101182 +3043412461 +3148318024 +4436392650 +3141716364 +7069704014 +3555157928 +3406414960 +3519588775 +3817074711 +4098987148 +5821695674 +3730190017 +3755638495 +7572713206 +6878508041 +3911401708 +6548131324 +4779599087 +5353208651 +4204860837 +4774807204 +5095111715 +7317816668 +5919999577 +7578109014 +6191730485 +10966537689 +6958791075 +6661305139 +6926003735 +6961572888 +9299972552 +7249778792 +7485828512 +10459533032 +13150521560 +10396591322 +8979668041 +9558069488 +8116262545 +8686208912 +10128015855 +13461016116 +11130864572 +11286842200 +9869918919 +11015111292 +12111730062 +16465496553 +20419807191 +20573180780 +13920363963 +15077835433 +13587308874 +14211351680 +25537368465 +28059009292 +14735607304 +15602091057 +19973051112 +17674332033 +16802471457 +17095930586 +17986181464 +18244278400 +18556127831 +19997934774 +23126841354 +20885030211 +24605526223 +21981648981 +38975935022 +28577226615 +27507672837 +27798660554 +28131715643 +28322916178 +54053770455 +35340208986 +29813442737 +30337698361 +31831537890 +41979583755 +32404562514 +36230459864 +33898402043 +41113022818 +37980960797 +39441158042 +45108490335 +79093983615 +42866679192 +44011871565 +45490556434 +46587175204 +53813186871 +56084899452 +69435938996 +55306333391 +63138869540 +69238611029 +58660614539 +70385523311 +60151141098 +62742260875 +62169236251 +65729939933 +66302964557 +68635022378 +70128861907 +73339560085 +86603579252 +77422118839 +164025698091 +86878550757 +88357235626 +100400362075 +89502427999 +233461637087 +101893508595 +109119520262 +129587080094 +113966947930 +115457474489 +118811755637 +120829850790 +121402875414 +199715942001 +122320377349 +127899176184 +128472200808 +175422484819 +134937986935 +141974582463 +143468421992 +164300669596 +165779354465 +166924546838 +187278912832 +216465630851 +214367310005 +235369823344 +191395936594 +211013028857 +246710931821 +223086468192 +232778703567 +326333923529 +236860349903 +287182229879 +242232726204 +366640488839 +306275252059 +257258364284 +522740882910 +357835731997 +276912569398 +278406408927 +332703901303 +739206513761 +355696606190 +380146664470 +354203459670 +642878836069 +402408965451 +405763246599 +414482404786 +760244697448 +599419192406 +919791405467 +459946818095 +632609175588 +479093076107 +660478711729 +499491090488 +690539633300 +534170933682 +535664773211 +679321534849 +555318978325 +609616470701 +756612425121 +812577342609 +932123093709 +734350124140 +1140391361918 +1150486451395 +1851914499176 +1096302879899 +808172212050 +820245651385 +874429222881 +939039894202 +959437908583 +1632822993994 +1089489912007 +1394828835869 +978584166595 +2611407160589 +1033662024170 +1069835706893 +1695710340243 +1687006565490 +1164935449026 +1289669102465 +1343966594841 +1490962549261 +2524624573431 +1972701918372 +1542522336190 +1628417863435 +1682601434931 +1694674874266 +1897662124057 +1747212106252 +2717907775442 +1813469117083 +2103975343228 +2661185601526 +2012246190765 +2048419873488 +2103497731063 +2859610323292 +2729372364413 +2198597473196 +2234771155919 +3338088975953 +2454604551491 +2508902043867 +3091178701093 +3868591168272 +4466850742256 +3170940199625 +3237197210456 +3225123771121 +3311019298366 +3377276309197 +3441886980518 +3560681223335 +3759458297017 +6921455293747 +4048240273002 +5490306854006 +4060666064253 +4871856514057 +4689375707410 +5536686449149 +4927969837609 +4433368629115 +4707499517063 +5325949857012 +4963506595358 +10092395493372 +7502553044771 +7878439716688 +6396063970746 +6536143069487 +6408137410081 +7820124361270 +10727676815892 +7070477595383 +8249132823254 +8268180740398 +7621347287588 +11115636927144 +8481608902117 +8108906337255 +8494034693368 +8750041771663 +9122744336525 +9140868146178 +9361338466724 +9396875224473 +11103563487809 +9671006112421 +10289456452370 +11359570566104 +12804201380827 +14414582786175 +14890098664114 +12932207040233 +12944280479568 +13478615005464 +15179383932638 +14691824882971 +20226307824334 +16115381980956 +15730253624843 +16102956189705 +16590515239372 +17231650673780 +16602941030623 +26282816386291 +18502206612902 +24030966810292 +18537743370651 +18758213691197 +19067881336894 +19960462564791 +29535148070856 +21649027018474 +24163771946931 +27983585313465 +25876487519801 +27834379143682 +26410822045697 +26422895485032 +28170439888435 +41102646928668 +30422078507814 +32705897220328 +42141075670540 +31833209814548 +35733857286682 +37192113238571 +33834591704403 +35105147643525 +37039949983553 +37295957061848 +37605624707545 +37826095028091 +38718676255988 +39028343901685 +41609489583265 +45812798965405 +65266418875599 +50040259466732 +66702261569453 +52287309565498 +56004819032117 +52833717530729 +54593335373467 +58592518396249 +66155935794496 +62255288322362 +64539107034876 +65667801518951 +84666927345277
\ No newline at end of file diff --git a/2020/09/puzzle-1.py b/2020/09/puzzle-1.py new file mode 100755 index 0000000..f68fc21 --- /dev/null +++ b/2020/09/puzzle-1.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +from typing import List + + +def is_valid(nums: List[int], lp: int, up: int) -> bool: + for i in range(lp, up): + x = nums[up] - nums[i] + if x in nums[lp:up] and x != nums[i]: + return True + return False + + +def main() -> None: + with open("input", "r") as f: + nums = list(map(int, f.readlines())) + + lp = 0 + up = 25 + + while is_valid(nums, lp, up): + lp += 1 + up += 1 + + print(nums[up]) + + +if __name__ == "__main__": + main() diff --git a/2020/09/puzzle-2.py b/2020/09/puzzle-2.py new file mode 100755 index 0000000..8833f50 --- /dev/null +++ b/2020/09/puzzle-2.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +import numpy as np + + +def main() -> None: + goal = 138879426 + with open("input", "r") as f: + nums = np.array(list(map(int, f.readlines())), dtype=int) + + lp = 0 + up = 1 + + while (x := sum(nums[lp : up + 1])) != goal: + if x > goal: + up -= 1 + lp += 1 + elif x < goal: + up += 1 + + sorted = np.sort(nums[lp : up + 1]) + print(sorted[0] + sorted[-1]) + + +if __name__ == "__main__": + main() diff --git a/2020/10/input b/2020/10/input new file mode 100644 index 0000000..379b145 --- /dev/null +++ b/2020/10/input @@ -0,0 +1,108 @@ +147 +174 +118 +103 +67 +33 +96 +28 +43 +22 +16 +138 +75 +148 +35 +6 +10 +169 +129 +115 +21 +52 +58 +79 +46 +7 +139 +104 +91 +51 +172 +57 +49 +126 +95 +149 +125 +123 +112 +30 +78 +44 +37 +167 +157 +29 +173 +98 +36 +63 +111 +160 +18 +8 +9 +159 +179 +72 +110 +2 +53 +150 +17 +81 +97 +108 +102 +56 +135 +166 +168 +163 +1 +25 +3 +158 +101 +132 +144 +45 +140 +34 +156 +178 +105 +68 +153 +80 +82 +59 +50 +122 +69 +85 +109 +40 +124 +119 +94 +88 +13 +180 +177 +133 +66 +134 +60 +141 diff --git a/2020/10/puzzle-1.sh b/2020/10/puzzle-1.sh new file mode 100755 index 0000000..f31af02 --- /dev/null +++ b/2020/10/puzzle-1.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +sort -n input | awk ' +BEGIN { o = t = 1 } +NR > 1 { if ($0 - prev == 1) o++; else if ($0 - prev == 3) t++; } + { prev = $0 } +END { print o * t }' diff --git a/2020/10/puzzle-2.py b/2020/10/puzzle-2.py new file mode 100755 index 0000000..bdf7bbf --- /dev/null +++ b/2020/10/puzzle-2.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 + +from typing import List + +adaptors: list[str] + + +def combos(i: int, counts: dict[int, dict[int, int]] = {}) -> int: + if i == len(adaptors) - 1: + return 1 + if i in counts: + return counts[i] + + ans = 0 + for j in range(i + 1, len(adaptors)): + if adaptors[j] - adaptors[i] <= 3: + ans += combos(j, counts) + + counts[i] = ans + return ans + + +def main() -> None: + global adaptors + with open("input", "r") as f: + adaptors = list(map(int, f.readlines())) + + adaptors.append(0) + adaptors.sort() + adaptors.append(max(adaptors) + 3) + + print(combos(0)) + + +if __name__ == "__main__": + main() diff --git a/2020/11/.gitignore b/2020/11/.gitignore new file mode 100644 index 0000000..60d075d --- /dev/null +++ b/2020/11/.gitignore @@ -0,0 +1 @@ +puzzle-[12] diff --git a/2020/11/Makefile b/2020/11/Makefile new file mode 100644 index 0000000..c32dafa --- /dev/null +++ b/2020/11/Makefile @@ -0,0 +1,7 @@ +all: + ${CC} ${CFLAGS} -o puzzle-1 puzzles.c + ${CC} ${CFLAGS} -DPART2 -o puzzle-2 puzzles.c + +.PHONY: clean +clean: + rm -f puzzle-[12] diff --git a/2020/11/input b/2020/11/input new file mode 100644 index 0000000..a586f62 --- /dev/null +++ b/2020/11/input @@ -0,0 +1,98 @@ +LLLLLL.LLLLLLLLLLLL.LLLLLL.LLLLLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLL.LLLLLLLLL +LLLLLL.LLLLLLLLLLLL.LLLLLLL.LLLLL.LLLLL.LLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLL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LLLLLLL.LL.LLLLL.LLLLLLLLLLLLLLLLL.LLLLLLLLL +LLLLLL.LLLLLL.LLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLL.LLLLLLLLLLLLLLLL.L.LLLLLL.LLLLLLLLLLLLLLLLL. +L.LL..LLL.L.........L.L....L...LL.L......L..LL.......L.....L.LL.....L..L.L.....L.....L.L...L.L.... +LLLLLL.LLLLLLLLLLLL.LLLLLLL.LLLLL..LLLL..LLLLLLLLLLLL.LLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLL +LLL.L..LLLL.L.LLLLLLLLLLLLL.LLLLL.LLLLL.L.LLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL..LLLLLLLL +LLLLLL.LLLLLL.LLLL.LLLLLLLL.LLLLLLLLLLLLLLLLLLLL.LLLL.LLLLLLL..LLLLLLL.LLLLLLLLLLLLLLLLL.LLLLLLLLL +LL.LLLLLLLLLLLLLLL..LLLLLLLLLLLL..LLLLLLLLL.LLLLLLLLL.LLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLL.L.LLLLLLLLL +LLLLLL..LLLLLLLLLLLLLLLLL.L.LLLLLLLLLLL.LLLLLLLL.LLLL.LLLLLLLLLLLLLLLL.LLLLLLLL.LLLLLLLL.LLLLLLLLL +..L...L...L..L..LL...L..........L.....L......L....L.L..L.L.L..L.LL....L..L...L...L......L.....L..L +LLLLLLLLLLLL..LLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLLLLLLLL.LL.LLLLLLLLLLLLL.L.LLLLLL.LLLLLLLL.LLLLLLLLL +LLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLL.LLLLLLLL.LLLL.L.LLLLL.LLLLLLLLLLLLLLLLL..LLLLLLL.LLLLLLLLL +LLLLLLLLLLLLL.LLLLLLLL.LLLL.LLLLL.LLLLLLLLLLLLLL.LLLL.LLLLLLLLL.LLLLLL.LLLLLL.LLLLLLLLL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LLLLL.LLLLLLLL.LLLLLLLLL +LLLLLL.LLLLLL.LLLLL.LLLLLLL.LLLLLLLLLLL.LLLLLLLL.LLLLLLLLLLLL.LLLLLLLL.LLLLLLLL.LLLLLLLL.LLLLLLLLL +LLLLL.LLLL.LLLLLLLL..LLLLLL.LLLLL.LLLL...LLLLL.L.LLLL.LLLLLLL..LLLLLLLL.LLLLLLLLLLLLLLLL.LLLLLLLLL +LLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLLL.LLLLLLLLLLLL.LLLLLLLLLLLLLLLLLL.LLLLLL.LLLLLLLL.LLLLL.LLL +LLLLLLLLLLLLL.LLLLL.L.LLLLL.LLLLLLLLLLL.LLLLLLLLLL.LL.LLLLLLLLLL.LLLLL.LLLLLLLL.LLLLLLLLLLLLL.LLLL +LLLLL.LLLLLLLLLLLLL.LLLLLLL.LLLLL.LLLLL.LLLLLLLL.LLLL.LLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLL +LLLLLL.LLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLL.LLLLLLLL.LLLL.LLLLLLL.LLLLLLLL.LLLLLLLL.LLLLLLLL.LLLLLLLLL +LLLLLL.LLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLLLLL.L.LLLLLL.LLLLLLLLLLLLLLLLL. +LLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLL.LLLLLLLL.LLLL.LLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLL
\ No newline at end of file diff --git a/2020/11/puzzles.c b/2020/11/puzzles.c new file mode 100644 index 0000000..7c579b9 --- /dev/null +++ b/2020/11/puzzles.c @@ -0,0 +1,158 @@ +#include <err.h> +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> + +#define ROWCNT 98 +#define ROWLEN 98 + +#ifdef PART2 + #define IS_SEAT(a, b) \ + if (rows[a][b] == '.') \ + continue + #define IS_OCC(a, b) \ + if (rows[a][b] == '#') \ + adjecent++ +#endif + +bool changed; +char rows[ROWCNT][ROWLEN + 1]; +char temp[ROWCNT][ROWLEN + 1]; + +/* Check and update a seat at the given index */ +static void +check_seat(int const i, int const j) +{ + if (rows[i][j] == '.') + return; + + int adjecent = 0; + +#ifdef PART2 + /* Up */ + for (int h = i - 1; h >= 0; h--) { + IS_SEAT(h, j); + IS_OCC(h, j); + break; + } + /* Down */ + for (int h = i + 1; h < ROWCNT; h++) { + IS_SEAT(h, j); + IS_OCC(h, j); + break; + } + /* Left */ + for (int h = j - 1; h >= 0; h--) { + IS_SEAT(i, h); + IS_OCC(i, h); + break; + } + /* Right */ + for (int h = j + 1; h < ROWLEN; h++) { + IS_SEAT(i, h); + IS_OCC(i, h); + break; + } + /* Up-Left */ + for (int h = i - 1, k = j - 1; h >= 0 && k >= 0; h--, k--) { + IS_SEAT(h, k); + IS_OCC(h, k); + break; + } + /* Up-Right */ + for (int h = i - 1, k = j + 1; h >= 0 && k < ROWLEN; h--, k++) { + IS_SEAT(h, k); + IS_OCC(h, k); + break; + } + /* Down-Left */ + for (int h = i + 1, k = j - 1; h < ROWCNT && k >= 0; h++, k--) { + IS_SEAT(h, k); + IS_OCC(h, k); + break; + } + /* Down-Right */ + for (int h = i + 1, k = j + 1; h < ROWCNT && k < ROWLEN; h++, k++) { + IS_SEAT(h, k); + IS_OCC(h, k); + break; + } +#else + for (int h = i - 1; h <= i + 1; h++) { + if (h < 0 || h > ROWCNT - 1) + continue; + for (int k = j - 1; k <= j + 1; k++) { + if (k < 0 || k > ROWCNT - 1 || (h == i && k == j)) + continue; + if (rows[h][k] == '#') + adjecent++; + } + } +#endif + /* Edit seats as needed */ + if (rows[i][j] == 'L' && adjecent == 0) { + temp[i][j] = '#'; + changed = true; +#ifdef PART2 + } else if (rows[i][j] == '#' && adjecent >= 5) { +#else + } else if (rows[i][j] == '#' && adjecent >= 4) { +#endif + temp[i][j] = 'L'; + changed = true; + } else + temp[i][j] = rows[i][j]; +} + +int +main(void) +{ + /* Initialize the temp array to be all floor */ + int i, j; + for (i = 0; i < ROWCNT; i++) { + for (j = 0; j < ROWLEN; j++) + temp[i][j] = '.'; + } + + FILE *fp; + if (!(fp = fopen("input", "r"))) + err(EXIT_FAILURE, "fopen"); + + /* Read in seats */ + i = j = 0; + char c; + while ((c = fgetc(fp)) != EOF) { + if (c == '\n') { + i = 0; + j++; + } else + rows[j][i++] = c; + } + fclose(fp); + + /* Update the seats until they don't change anymore */ + do { + changed = false; + for (i = 0; i < ROWCNT; i++) { + for (j = 0; j < ROWLEN; j++) + check_seat(i, j); + } + + for (i = 0; i < ROWCNT; i++) { + for (j = 0; j < ROWLEN; j++) + rows[i][j] = temp[i][j]; + } + } while (changed); + + /* Calculate filled seats */ + int count = 0; + for (i = 0; i < ROWCNT; i++) { + for (j = 0; j < ROWLEN; j++) { + if (rows[i][j] == '#') + count++; + } + } + + printf("%d\n", count); + return EXIT_SUCCESS; +} diff --git a/2020/12/.gitignore b/2020/12/.gitignore new file mode 100644 index 0000000..60d075d --- /dev/null +++ b/2020/12/.gitignore @@ -0,0 +1 @@ +puzzle-[12] diff --git a/2020/12/Makefile b/2020/12/Makefile new file mode 100644 index 0000000..cf466dc --- /dev/null +++ b/2020/12/Makefile @@ -0,0 +1,7 @@ +all: + ${CC} ${CFLAGS} -o puzzle-1 puzzle-1.c + ${CC} ${CFLAGS} -o puzzle-2 puzzle-2.c + +.PHONY: clean +clean: + rm -f puzzle-[12] diff --git a/2020/12/input b/2020/12/input new file mode 100644 index 0000000..5e5e7be --- /dev/null +++ b/2020/12/input @@ -0,0 +1,778 @@ +R90 +N2 +N2 +F94 +R90 +E3 +F2 +L90 +L90 +F66 +S5 +L90 +W3 +R90 +N3 +W2 +N2 +W1 +R90 +E3 +F100 +S4 +F66 +R180 +F96 +R90 +N2 +R90 +E2 +S3 +E1 +F65 +W4 +F6 +L180 +W2 +L90 +F95 +L90 +F97 +E2 +F36 +E2 +R90 +E4 +F98 +N4 +F70 +S1 +R270 +E1 +F13 +R90 +W1 +L90 +F82 +S2 +R90 +N2 +F80 +N1 +R90 +F26 +W4 +F23 +S5 +F72 +N5 +W2 +N5 +F47 +L270 +F18 +W1 +L90 +F91 +R90 +W5 +N2 +F60 +E5 +S3 +R90 +R180 +S3 +L90 +W4 +F80 +S2 +L90 +F31 +W1 +L90 +F45 +S3 +F64 +N1 +W4 +N2 +R180 +W3 +R90 +S1 +F7 +W1 +R180 +W1 +S4 +E4 +W4 +F87 +R90 +N5 +F65 +W4 +F15 +E5 +N5 +L90 +F36 +E1 +F70 +E1 +L180 +F42 +L90 +F9 +L90 +E4 +F2 +F35 +N4 +E4 +N2 +L90 +N4 +R90 +F100 +S3 +F13 +E1 +S4 +F66 +L90 +F75 +E5 +R180 +E2 +L90 +W4 +F89 +S5 +R90 +E4 +F5 +R270 +E3 +S5 +R90 +F65 +S5 +R180 +S3 +W4 +F68 +W1 +F62 +W1 +F99 +F96 +R90 +E1 +R90 +L180 +F96 +W4 +N2 +W2 +R90 +F32 +N1 +E1 +L90 +E1 +S3 +F6 +S4 +E1 +N2 +W5 +S5 +E4 +F3 +F58 +N1 +F96 +E5 +F31 +R90 +F74 +R180 +N2 +W1 +F65 +L90 +F45 +F73 +R90 +S1 +R270 +N5 +L90 +W1 +N3 +L90 +F36 +R90 +N4 +L180 +W4 +N5 +R180 +N1 +R90 +N1 +R270 +F80 +R90 +S5 +E3 +F49 +W5 +F27 +E1 +N2 +W4 +S3 +L90 +F100 +N1 +F28 +E2 +F88 +S1 +R90 +F14 +S4 +L180 +F93 +E1 +L90 +F64 +L90 +L90 +F84 +E4 +F69 +W1 +R90 +E5 +N2 +W1 +N3 +F10 +S2 +F64 +F10 +R180 +W3 +N1 +F82 +S2 +W1 +R90 +W1 +L90 +W2 +N3 +F95 +E4 +N3 +N2 +E3 +E1 +N1 +W5 +R90 +W3 +S3 +E3 +L90 +W3 +N5 +F61 +S3 +F50 +F71 +E1 +E1 +F63 +L90 +W5 +S1 +R90 +F29 +L90 +S1 +R90 +S1 +L90 +W4 +N4 +R270 +S1 +F87 +R90 +F82 +W1 +L90 +S4 +L90 +W2 +N4 +R90 +F61 +R90 +N5 +F38 +W3 +L90 +F56 +N1 +R90 +W1 +S2 +F97 +S5 +R90 +E1 +F97 +R270 +N2 +L180 +F14 +E1 +R90 +F70 +L180 +S4 +E3 +L90 +N3 +F87 +E3 +N3 +R90 +F59 +F18 +W5 +F71 +E3 +S5 +W3 +R180 +F71 +S3 +W5 +F47 +N5 +L90 +F79 +N3 +F40 +W5 +S2 +F59 +W3 +F2 +W1 +F63 +R90 +S4 +L90 +S1 +E5 +F33 +L180 +F83 +E5 +S3 +W1 +F66 +R270 +N4 +F29 +W5 +F83 +W1 +R90 +N5 +W3 +F58 +S4 +R90 +F36 +S1 +F67 +W1 +S4 +F56 +E2 +F88 +N4 +L90 +F71 +W3 +F88 +R180 +F50 +R90 +E4 +R90 +S1 +W2 +L90 +N1 +R90 +E5 +N1 +F39 +L180 +E5 +R90 +W4 +L180 +W3 +R90 +W3 +L90 +S5 +W5 +S2 +L90 +N3 +W5 +R180 +F74 +E1 +N1 +N4 +R90 +N2 +W4 +F34 +L90 +E4 +L90 +S4 +L90 +W3 +F83 +N1 +L90 +F58 +W5 +F38 +L180 +N1 +L90 +S4 +F45 +E4 +S3 +L90 +E1 +S2 +F30 +E2 +L90 +F84 +W4 +F53 +R90 +S5 +F31 +L180 +N1 +L90 +E2 +L180 +W3 +F98 +R270 +S2 +E5 +F84 +S4 +L90 +F26 +E2 +F66 +L270 +E1 +L180 +F11 +E5 +L90 +W1 +F11 +E3 +F70 +E5 +N3 +F78 +W5 +L270 +W5 +N1 +L90 +S4 +F8 +L90 +F95 +L90 +F99 +S3 +F61 +N2 +F84 +S5 +F3 +E5 +R90 +F33 +W5 +S1 +L90 +F52 +E4 +L90 +E1 +N1 +L270 +S3 +W4 +R180 +F89 +R270 +F10 +R90 +N1 +R180 +W5 +N2 +F78 +S5 +F25 +S4 +F25 +N3 +F29 +W1 +F24 +S4 +L90 +S5 +F17 +L90 +S4 +E2 +N3 +F38 +S4 +L90 +F1 +L90 +E2 +F92 +L90 +E4 +S1 +E1 +F28 +N1 +F46 +R90 +N1 +W4 +N3 +E3 +F90 +N5 +L180 +S1 +E3 +F96 +L90 +E1 +R90 +N5 +E1 +F74 +L180 +N2 +L90 +N1 +E4 +R90 +E1 +S2 +F91 +R90 +N5 +E4 +F9 +N2 +E1 +F13 +E2 +S4 +W1 +R90 +S1 +R90 +F18 +L90 +F12 +S2 +F65 +N2 +E3 +F65 +E1 +L180 +E2 +S4 +W4 +F89 +N4 +E5 +L180 +N4 +W1 +F22 +L90 +W2 +S2 +F6 +E4 +F74 +N2 +E2 +S1 +R90 +F87 +W5 +R90 +W4 +R90 +E4 +L90 +N3 +F68 +L180 +N1 +W1 +F81 +R90 +F95 +R90 +R180 +E5 +F51 +F23 +F74 +N3 +F16 +F64 +L90 +W4 +R90 +R90 +W4 +F97 +R180 +N3 +F79 +E3 +L90 +N2 +F14 +S4 +F41 +W2 +L90 +F54 +N3 +E4 +R90 +W2 +R90 +S4 +L90 +L90 +S4 +R90 +E4 +S3 +L90 +F5 +R90 +L90 +W2 +R90 +W3 +N4 +E5 +F14 +E5 +S4 +F96 +S4 +L90 +W2 +F96 +L90 +E3 +L90 +F4 +R90 +F61 +E2 +F56 +E1 +F100 +E5 +R90 +F54 +R90 +E4 +F2 +R180 +S3 +F8 +L90 +W1 +R90 +F19 +W5 +L90 +S1 +L90 +W5 +S2 +F30 +R90 +W5 +F31 +S5 +E1 +N2 +F100 +N1 +F3 +W3 +F46 +R90 +E2 +F62 +L180 +F90 +L180 +S3 +L90 +S5 +F40 +N4 +F95
\ No newline at end of file diff --git a/2020/12/puzzle-1.c b/2020/12/puzzle-1.c new file mode 100644 index 0000000..1a4c7ab --- /dev/null +++ b/2020/12/puzzle-1.c @@ -0,0 +1,73 @@ +#include <err.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int +main(void) +{ + FILE *fp; + char cl[5]; + int north, east; + int direction = 0; + + if (!(fp = fopen("input", "r"))) + err(EXIT_FAILURE, "fopen"); + + north = east = 0; + while (fgets(cl, sizeof(cl), fp) != NULL) { + switch (cl[0]) { + case 'N': + north += atoi(&cl[1]); + break; + case 'E': + east += atoi(&cl[1]); + break; + case 'S': + north -= atoi(&cl[1]); + break; + case 'W': + east -= atoi(&cl[1]); + break; + case 'L': + direction -= atoi(&cl[1]); + goto wrap; + case 'R': + direction += atoi(&cl[1]); + +wrap: + /* 0 <= direction < 360 */ + if (direction >= 360) + direction -= 360; + else if (direction < 0) + direction += 360; + break; + case 'F': + switch (direction) { + case 0: + east += atoi(&cl[1]); + break; + case 90: + north -= atoi(&cl[1]); + break; + case 180: + east -= atoi(&cl[1]); + break; + case 270: + north += atoi(&cl[1]); + break; + } + break; + } + } + fclose(fp); + + /* Absolute value */ + if (north < 0) + north = -north; + if (east < 0) + east = -east; + + printf("%d\n", north + east); + return EXIT_SUCCESS; +} diff --git a/2020/12/puzzle-2.c b/2020/12/puzzle-2.c new file mode 100644 index 0000000..8ac34b4 --- /dev/null +++ b/2020/12/puzzle-2.c @@ -0,0 +1,79 @@ +#include <err.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +struct coords { + int north; + int east; +}; + +int +main(void) +{ + FILE *fp; + char cl[6]; + struct coords waypoint = {1, 10}; + struct coords ship = {0, 0}; + + if (!(fp = fopen("input", "r"))) + err(EXIT_FAILURE, "fopen"); + + while (fgets(cl, sizeof(cl), fp) != NULL) { + switch (cl[0]) { + case 'N': + waypoint.north += atoi(&cl[1]); + break; + case 'E': + waypoint.east += atoi(&cl[1]); + break; + case 'S': + waypoint.north -= atoi(&cl[1]); + break; + case 'W': + waypoint.east -= atoi(&cl[1]); + break; + case 'F':; + unsigned int const val = atoi(&cl[1]); + ship.north += val * waypoint.north; + ship.east += val * waypoint.east; + break; + /* Left and right */ + default:; + int direction = atoi(&cl[1]); + + /* (x, y) -> (-x, -y) */ + if (direction == 180) { + waypoint.north = -waypoint.north; + waypoint.east = -waypoint.east; + break; + } + + /* 0 <= direction < 360 */ + if (cl[0] == 'R') + direction = -direction + 360; + + int const temp = waypoint.east; + if (direction == 90) { + /* (x, y) -> (-y, x) */ + waypoint.east = -waypoint.north; + waypoint.north = temp; + } else { + /* (x, y) -> (y, -x) */ + waypoint.east = waypoint.north; + waypoint.north = -temp; + } + break; + } + } + fclose(fp); + + /* Absolute value */ + if (ship.north < 0) + ship.north = -ship.north; + if (ship.east < 0) + ship.east = -ship.east; + + printf("%d\n", ship.north + ship.east); + return EXIT_SUCCESS; +} diff --git a/2020/13/input b/2020/13/input new file mode 100644 index 0000000..59d4d66 --- /dev/null +++ b/2020/13/input @@ -0,0 +1,2 @@ +1006401 +17,x,x,x,x,x,x,x,x,x,x,37,x,x,x,x,x,449,x,x,x,x,x,x,x,23,x,x,x,x,13,x,x,x,x,x,19,x,x,x,x,x,x,x,x,x,x,x,607,x,x,x,x,x,x,x,x,x,41,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,29
\ No newline at end of file diff --git a/2020/13/puzzle-1.py b/2020/13/puzzle-1.py new file mode 100755 index 0000000..7b21f96 --- /dev/null +++ b/2020/13/puzzle-1.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + + +def main() -> None: + with open("input", "r") as f: + time = int(f.readline()) + ids = list(map(int, f.readline().replace(",x", "").split(","))) + + ids.sort() + + min = -1 + x = 0 + for bus in ids: + res = (time + ids[0]) % bus + if min < res < ids[0]: + min = res + x = bus + + for i in range(time, time + ids[0]): + if i % x == 0: + print((i - time) * x) + break + + +if __name__ == "__main__": + main() diff --git a/2020/13/puzzle-2.py b/2020/13/puzzle-2.py new file mode 100755 index 0000000..3965488 --- /dev/null +++ b/2020/13/puzzle-2.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 + +from functools import reduce + + +def chinese_remainder(n: tuple[int, ...], a: tuple[int, ...]) -> int: + sum = 0 + prod = reduce(lambda a, b: a * b, n) + for n_i, a_i in zip(n, a): + p = prod // n_i + sum += a_i * mul_inv(p, n_i) * p + return sum % prod + + +def mul_inv(a: int, b: int) -> int: + b0 = b + x0, x1 = 0, 1 + if b == 1: + return 1 + while a > 1: + q = a // b + a, b = b, a % b + x0, x1 = x1 - q * x0, x0 + if x1 < 0: + x1 += b0 + return x1 + + +def main() -> None: + with open("input", "r") as f: + ids = tuple(map(lambda x: int(x) if x.isdigit() else x, f.readlines()[1].split(","))) + + buses = tuple(filter(lambda x: x != "x", ids)) + modres = tuple(x if (x := bus - ids.index(bus)) != bus else 0 for bus in buses) + + print(chinese_remainder(buses, modres)) + + +if __name__ == "__main__": + main() diff --git a/2020/14/input b/2020/14/input new file mode 100644 index 0000000..11570c1 --- /dev/null +++ b/2020/14/input @@ -0,0 +1,578 @@ +mask = 00X10101X110010011XX0X011X100000X010 +mem[13197] = 47579321 +mem[37394] = 374943 +mem[48509] = 418284 +mem[29793] = 191792725 +mask = 00100X001010010111XX010X10X01100001X +mem[378] = 9637 +mem[41083] = 1858241 +mem[36394] = 762 +mem[40101] = 15295 +mem[50670] = 9179863 +mem[30384] = 164245 +mem[11676] = 393669095 +mask = 0XX000X1111001010X10XX1101XX00X00100 +mem[17956] = 854 +mem[57595] = 179871 +mem[50596] = 207644327 +mask = X100XX0111X0X1X01101X0X0110010101011 +mem[26867] = 1012 +mem[3061] = 514891024 +mem[35973] = 512 +mask = 01X000111110010X1110X00110000X00000X +mem[3707] = 123619 +mem[37107] = 7325808 +mem[31906] = 102168 +mask = XX00XX0101100X011100000XX00100000X00 +mem[38336] = 2917310 +mem[7166] = 313228 +mem[41771] = 2741721 +mem[52154] = 89454 +mask = 11001111X110X0XX10XX11101111000X0111 +mem[35611] = 58725 +mem[40227] = 8442431 +mem[10029] = 7334 +mem[13345] = 87327004 +mask = 0XX0X0001010011011010XX0X110XX01X001 +mem[4868] = 493430 +mem[40452] = 18191 +mem[4567] = 330532 +mem[13580] = 1662243 +mask = 001X00011000X1X0X1X0110X110111001011 +mem[2096] = 25174 +mem[15283] = 994663544 +mem[16002] = 1359 +mem[4240] = 704816 +mask = 01000011101001001010110X10011X11XX01 +mem[16210] = 279177 +mem[8996] = 6470256 +mem[31049] = 1371071 +mem[20425] = 9683526 +mem[24986] = 142094045 +mask = 0X001X01X1X0110X10XX0X01X00101111010 +mem[61471] = 23661 +mem[57520] = 246980 +mem[57446] = 4169790 +mask = 001000X11110010111X000X00X0011X01001 +mem[25460] = 1461 +mem[528] = 48572826 +mem[61442] = 1487 +mem[60708] = 1804 +mem[51588] = 36111 +mask = 0X000001111001010X1011100100001X0X0X +mem[45713] = 3807909 +mem[26867] = 6236 +mem[39186] = 3023142 +mem[46212] = 5671589 +mem[28686] = 10375260 +mask = 00X0000XXX10X1011100X100001X0X100010 +mem[7272] = 1073 +mem[35482] = 1877478 +mask = 01X00XX11110X11X110X1000010XXX101110 +mem[28892] = 2154970 +mem[33403] = 34104 +mem[56124] = 11230 +mem[11265] = 484054168 +mem[36422] = 1080979 +mask = 00000001X11001X1110001X01000101XXXX0 +mem[8445] = 2387 +mem[55775] = 8215 +mask = 110001101110110X10010X00XX1X01010100 +mem[49202] = 4152007 +mem[49938] = 4676666 +mem[58184] = 43886544 +mem[35840] = 8484248 +mem[25642] = 1980350 +mem[37918] = 1692542 +mem[44918] = 43860354 +mask = 0X000X011110010X1100X10X100X1X111100 +mem[24669] = 15051033 +mem[43432] = 1054 +mem[64706] = 21834 +mem[27336] = 773822 +mem[24406] = 420 +mask = 00XX01111X1001001X0001101001111101XX +mem[48221] = 256859 +mem[1361] = 145480785 +mem[8221] = 32962081 +mem[11649] = 327597066 +mem[6355] = 3866 +mem[33696] = 951794 +mask = X10XX0010110011010111100X010X000000X +mem[51014] = 577 +mem[38304] = 7416 +mem[34256] = 3748 +mem[12926] = 306 +mem[39297] = 1823498 +mask = 0000X00XXX10011XX000000X10X010100001 +mem[18788] = 7298 +mem[39644] = 7675 +mem[33093] = 416832 +mem[5195] = 6722351 +mem[28000] = 53707945 +mem[5336] = 77314873 +mem[992] = 134079888 +mask = 0000X101110X010011X0000000X011X1X101 +mem[8536] = 401336 +mem[1632] = 1267 +mem[6456] = 581 +mem[31682] = 20542 +mem[27729] = 726 +mem[49447] = 37811 +mask = 0X0X00111XX001XX111X1011010X100X0111 +mem[38677] = 9808 +mem[54045] = 28545 +mem[30384] = 49811 +mem[62515] = 19422 +mem[14508] = 49363 +mask = X100X1X1011X1111011X01101000X11XX101 +mem[59468] = 387 +mem[37138] = 121701873 +mem[18728] = 2624430 +mem[28293] = 5039090 +mem[32321] = 839768 +mem[28535] = 647 +mask = XX100X0010100XX1110X11000110X100X00X +mem[2147] = 1562 +mem[25832] = 275992750 +mask = 110XX0X10110X11X10X1110X10100X000000 +mem[22152] = 470276298 +mem[60732] = 716 +mem[52727] = 1427169 +mem[16196] = 9596060 +mem[3910] = 28432777 +mask = 01X0001111100X101110110X011XXX01X011 +mem[8221] = 60956 +mem[1223] = 293 +mem[24130] = 777493 +mem[62002] = 3900 +mem[20316] = 26105612 +mem[58295] = 528344031 +mem[12465] = 1159 +mask = 11000X011110010010011100100XX111100X +mem[59580] = 3601634 +mem[31173] = 325319 +mem[28284] = 2285676 +mem[57595] = 8662764 +mem[32672] = 4111107 +mask = 01000001X1100101XX0X01101X1X00011X0X +mem[33093] = 4612 +mem[61749] = 5692 +mem[28188] = 26420039 +mem[59026] = 1325 +mem[37032] = 149 +mask = 01000X11111001X11110011X111X01100X01 +mem[23793] = 131971 +mem[10420] = 848652 +mem[10469] = 33394600 +mem[23001] = 1875 +mask = 01001111011X1X1XXX1X001XX11100011X10 +mem[38294] = 371641 +mem[17261] = 72227824 +mem[41143] = 213405737 +mem[54246] = 1445548 +mem[41901] = 1849824 +mask = 0X00110X01101100XX101011001110XX1101 +mem[42925] = 176752065 +mem[17255] = 12010392 +mem[37437] = 64942 +mem[57253] = 827582 +mask = 11X10X101111XX0010X10101100100010110 +mem[14344] = 6638562 +mem[40266] = 89477554 +mem[9511] = 1133 +mem[53072] = 748643130 +mem[4567] = 372 +mem[26565] = 4739 +mask = 00010XX1X11X010X11X000100111001X1110 +mem[4247] = 17837 +mem[18674] = 2031700 +mem[47487] = 89684677 +mask = 110X1X11011X101110111101XX01001100X0 +mem[22046] = 3445 +mem[55657] = 29187 +mem[38510] = 159862 +mask = 0100000X11X00100110X01101X0011001100 +mem[12772] = 3394234 +mem[30255] = 47301946 +mem[55181] = 11825301 +mem[2096] = 239 +mem[6355] = 66264 +mem[62103] = 62751352 +mask = X100010XXX10X1001110001001X10X100X0X +mem[18880] = 12756 +mem[52727] = 58449492 +mem[52620] = 106260805 +mask = 01000X011110010XX110X11001100X000XXX +mem[5734] = 3770 +mem[46419] = 12806425 +mem[26866] = 6566928 +mask = X1001XX101101X1X10111X0X1111001101X0 +mem[54847] = 8045 +mem[61036] = 1672 +mem[32929] = 87423486 +mem[48539] = 13896 +mem[14353] = 7009065 +mem[16446] = 32987614 +mask = 00100000X111110X1110X101100000100X00 +mem[23863] = 4070 +mem[52234] = 498973 +mem[20235] = 1706949 +mask = 00X000011110X100110X11100X0X10X01010 +mem[44286] = 26378 +mem[30741] = 14368000 +mem[7396] = 88194752 +mask = 0X001X01X11011X0101X1010XX01X01000X0 +mem[6834] = 2670580 +mem[15903] = 6945101 +mem[10104] = 2517 +mem[65020] = 61602027 +mem[55142] = 1143278 +mem[38596] = 1333 +mem[17509] = 153504934 +mask = 00XX0X01111XX10111X00X10X0111011110X +mem[568] = 1625 +mem[30255] = 248279 +mem[11912] = 538 +mem[12028] = 520033 +mask = 0010XX011X00X10011X001XX1100X1000001 +mem[15654] = 120 +mem[4292] = 57554 +mem[2096] = 346664 +mem[1248] = 10995 +mem[48539] = 656539 +mem[19181] = 147211 +mask = 1010010X110001001100X1X00X0011010X01 +mem[11344] = 4845730 +mem[60639] = 25030928 +mem[1005] = 12960528 +mem[47688] = 107547855 +mem[17509] = 728745 +mask = X00000011X10X10X11000101101000000100 +mem[46621] = 1608 +mem[5562] = 15064109 +mem[28385] = 1651 +mem[5734] = 288099689 +mem[49319] = 97558812 +mem[37739] = 1161 +mem[52727] = 1992490 +mask = 0001010XX110010X110000X01X10X011XX1X +mem[37366] = 735085354 +mem[1739] = 409 +mem[12604] = 754989 +mask = 00000X011110010011000X001X0100XX0000 +mem[29851] = 8508 +mem[44133] = 1998890 +mem[24804] = 6068 +mem[59260] = 1198469 +mem[59580] = 10413954 +mask = 00110111X01X010010X00000X10X00110110 +mem[55579] = 418284890 +mem[7573] = 1800 +mem[26096] = 1469134 +mem[44133] = 25531796 +mem[39628] = 7076590 +mask = 0000000111X0010111X001011XX0000X1X00 +mem[24778] = 24875864 +mem[10420] = 3072761 +mem[2096] = 2762 +mem[30148] = 6696 +mem[17770] = 13204967 +mask = 0011010101X00X0X1100X000110011100101 +mem[57742] = 21044093 +mem[33266] = 56667 +mem[61442] = 1636 +mem[51870] = 1018197644 +mem[40469] = 77760 +mask = X0X001XX11000X0011X00100010011X00X01 +mem[11504] = 438885 +mem[53777] = 6130 +mem[17770] = 808014 +mask = 000X001111100101XX100010X010X1100100 +mem[35611] = 1215 +mem[10397] = 301 +mem[10866] = 8375216 +mem[2499] = 10472 +mem[63504] = 270966 +mem[7719] = 2064 +mem[41088] = 343764913 +mask = 010X1X00X1X0X1101X0X00111101001X0101 +mem[20597] = 773 +mem[14657] = 294987038 +mask = 00XX0001X110010111100000X01010100111 +mem[43170] = 365 +mem[55657] = 4882105 +mem[44170] = 628956 +mem[10429] = 947957 +mem[272] = 36059 +mask = 0X000011X0X0010X1X1011110100101XXXX1 +mem[3910] = 2312 +mem[47735] = 89421 +mem[2197] = 32972549 +mem[49938] = 7005 +mask = 00000100X100X100111X0101011X11010101 +mem[54400] = 830 +mem[43977] = 2412350 +mem[18229] = 19157634 +mem[19181] = 879884567 +mask = 000101X11X100100X100011X000100110001 +mem[37237] = 104037633 +mem[29167] = 1094 +mem[6308] = 6007 +mem[21610] = 80462437 +mem[2261] = 345450311 +mask = 0X0000X1111001011110X01X1XX01010X0XX +mem[10892] = 85035 +mem[38510] = 42597708 +mem[30752] = 2960 +mem[30416] = 123661909 +mem[49045] = 913 +mem[4292] = 75 +mem[17509] = 1382 +mask = 1X00X00111X001X0100101001X110X0001X0 +mem[56241] = 8276 +mem[40782] = 243373 +mem[42397] = 43237586 +mem[13015] = 399 +mem[23129] = 735838 +mem[1385] = 4448 +mask = 0000X011000XX100X110111101X110X010X1 +mem[13015] = 247 +mem[42378] = 546670 +mem[8214] = 63809 +mem[22410] = 155149 +mem[55264] = 454543598 +mem[28778] = 69088880 +mem[48061] = 12489909 +mask = 0XX0X000XX1001X01101001000000100X1X1 +mem[7551] = 11717790 +mem[6107] = 50467 +mem[30752] = 4249755 +mem[17228] = 33884 +mem[59957] = 32163540 +mask = 1X0X0X10111X01001X0101011X0X0X0101X0 +mem[45349] = 1879078 +mem[31733] = 88189 +mem[12577] = 546676501 +mem[53419] = 16199 +mem[59921] = 2546 +mask = 0010001X110001X1X110100101X111000000 +mem[19998] = 179736 +mem[22061] = 30001652 +mem[41371] = 16212851 +mem[64355] = 622251640 +mem[23129] = 98852 +mem[56429] = 266 +mask = 00000X0X11X00XX1100001X0100010X0X100 +mem[37241] = 450 +mem[64833] = 219911344 +mem[16713] = 626602448 +mask = X1X01011X11010111011XX000001X01XX100 +mem[47336] = 15388 +mem[56124] = 582872 +mem[28686] = 27406190 +mem[34623] = 13146 +mem[30384] = 229541309 +mask = X00X011X11100100110X00110001XXX00000 +mem[18660] = 3353 +mem[30741] = 10036798 +mem[47487] = 4090 +mask = 00X0000X11100X011X0001101001X10X10X0 +mem[52567] = 730515 +mem[16156] = 10615261 +mem[29580] = 957414770 +mem[26765] = 19 +mem[24655] = 510031974 +mem[24669] = 30 +mem[46781] = 5769 +mask = 0X0010011110111010X000X0X11X101001X0 +mem[63285] = 8050 +mem[46893] = 981797 +mem[46022] = 984778 +mem[31931] = 67780 +mem[23543] = 3153 +mask = 1100X001X11001X01001X100111X01X0X100 +mem[53172] = 13616323 +mem[31500] = 117639 +mem[59037] = 106552607 +mem[54562] = 3408946 +mem[57159] = 411910 +mem[2824] = 61677145 +mem[47313] = 520051559 +mask = X100010111100100XX0XX110100001010101 +mem[37739] = 3912032 +mem[12772] = 884026 +mem[2217] = 4238 +mem[57159] = 28391 +mem[17146] = 3998 +mask = 00000001111001X11X000110101X1X11X100 +mem[11649] = 516652 +mem[21190] = 526 +mem[6364] = 274816 +mem[25567] = 190071 +mask = XXX00000X111010111001001111000X00000 +mem[25786] = 934 +mem[22026] = 215203 +mask = 0010000110X0110X11X001001101110X0011 +mem[59392] = 400 +mem[59580] = 927 +mem[15208] = 18515970 +mem[59444] = 245687 +mem[36248] = 893 +mem[59134] = 20240 +mask = 0X0XX1X11110X1011010000110000010000X +mem[11344] = 223586488 +mem[41434] = 519191086 +mem[15028] = 1492592 +mem[25631] = 247281 +mask = 11X0XX1011101000X0011X00X101X1111000 +mem[21825] = 1675 +mem[2371] = 663473 +mem[37724] = 4339 +mem[54246] = 855 +mem[9392] = 56579 +mem[35552] = 14454 +mask = 0100010111100100111X110X00X01000X1X0 +mem[44516] = 482691 +mem[26528] = 1559 +mem[53886] = 89643332 +mem[3478] = 12699372 +mask = 0011010111X00100XXX0XX1X10XX10100001 +mem[27239] = 413074512 +mem[15589] = 3001 +mem[10011] = 1136 +mem[59026] = 852921 +mem[5283] = 213015528 +mask = 00X0000XX11XX10111X0000001X000101000 +mem[17298] = 4088539 +mem[54369] = 505389469 +mem[8221] = 132829 +mem[55115] = 5055 +mem[56330] = 1932140 +mask = 01X00001111001010110111001X00010X0XX +mem[37467] = 127273625 +mem[38432] = 3166735 +mem[52727] = 998 +mem[42925] = 1733202 +mask = 11010011011011X01X01010XX10110110000 +mem[26085] = 233531 +mem[57079] = 1526 +mem[53172] = 385838419 +mem[29614] = 254712697 +mem[25466] = 735 +mem[27081] = 7719 +mask = 01000000111X0XXX1101X11X001101X01100 +mem[55941] = 72432190 +mem[16199] = 10097889 +mem[45349] = 10650 +mem[62515] = 8214 +mem[59468] = 965897 +mem[16653] = 386447843 +mem[49447] = 413274 +mask = 01000X011110X1XX1XX10X001111000X1000 +mem[59209] = 14316 +mem[50790] = 705222705 +mem[45621] = 232211796 +mask = 010X111101111XX1101000X1011000111011 +mem[48891] = 3231894 +mem[37241] = 49993 +mem[47016] = 3806 +mem[10469] = 12758 +mem[43871] = 17980 +mask = 0XX00XX11110010011X0010X1X011100X000 +mem[28733] = 801341049 +mem[12772] = 20002640 +mem[30741] = 2248 +mask = 0101X01110100X0111XX11110011000XXX01 +mem[17803] = 65414 +mem[45439] = 13886371 +mem[16184] = 130293 +mem[29313] = 1782 +mask = 01000111111001101X0110000001XX1X1111 +mem[34404] = 202755 +mem[43413] = 1045 +mem[48841] = 381434549 +mem[37238] = 230052 +mem[10175] = 421554 +mem[11939] = 15850 +mask = X0XX0011X110010X011000010111110X1XX0 +mem[54847] = 160031 +mem[53915] = 5111 +mem[6036] = 17132 +mem[36183] = 1360055 +mem[47658] = 127563 +mask = 00100X1111X0010101101X11X11111001X10 +mem[25937] = 8673 +mem[12926] = 834 +mem[43356] = 732346 +mem[5734] = 393 +mem[3822] = 30383 +mask = 110001101110XX00100100XX0X11X1XX010X +mem[821] = 185158312 +mem[64509] = 264189683 +mem[15199] = 1037709 +mem[635] = 437556 +mem[31141] = 14726605 +mem[40468] = 47196 +mask = 00000001XX1001001X0000X01001X0001100 +mem[46740] = 8071 +mem[43144] = 14187193 +mem[51555] = 382 +mem[30741] = 4087 +mem[45411] = 1430 +mem[14377] = 7364 +mask = 11X00110111001001001100X10X1XX00X100 +mem[62803] = 979004797 +mem[4838] = 343 +mem[23241] = 4426 +mask = 001X0101X1100100X1X0X110110XX01001X0 +mem[10799] = 5745 +mem[14789] = 34632 +mem[27068] = 8863 +mask = 001001011XX0010011000111010X10XX0100 +mem[31173] = 109895 +mem[25936] = 4493 +mask = 00000011111X0101X1X01100X00000100000 +mem[32612] = 14472 +mem[22702] = 713 +mem[22779] = 126887839 +mem[43168] = 251908 +mem[11504] = 47004 +mem[7399] = 2215129 +mem[63129] = 4367 +mask = 010001010X10010X111XX1X0111100101X0X +mem[3663] = 187207677 +mem[52928] = 200 +mem[38852] = 8397 +mem[31461] = 223838656 +mem[64706] = 4205924 +mem[26237] = 218385741 +mem[57402] = 258615472 +mask = 11X0X0X1011001XX1001111X011100XX0000 +mem[55334] = 323423 +mem[5833] = 33097 +mem[26924] = 272 +mem[42957] = 47976862 +mem[18798] = 61419 +mem[19947] = 1287 +mask = 1100X101011X10111X11X000111100111XX0 +mem[64472] = 224734 +mem[18079] = 526 +mem[60870] = 3322170 +mem[4013] = 578 +mem[2606] = 83684765 +mem[17048] = 2503 +mask = 0010000XX0000100110000011X0001X0X00X +mem[37789] = 94286 +mem[2499] = 13318890 +mem[29793] = 78507 +mem[45621] = 3626886 +mem[34770] = 2407 +mem[54400] = 38740 +mask = 0010X10111000100110001X0X1000100X101 +mem[11265] = 1297549 +mem[16410] = 948310 +mem[33093] = 893977 +mem[17298] = 53047 +mem[45439] = 14869 +mem[21212] = 870451788 diff --git a/2020/14/puzzle-1.py b/2020/14/puzzle-1.py new file mode 100755 index 0000000..f102316 --- /dev/null +++ b/2020/14/puzzle-1.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 + + +def bitmask(mask: str, num: int) -> int: + binary = bin(num)[2:] + binary = "0" * (36 - len(binary)) + binary + res = "" + + for i in range(len(binary)): + if binary[i] == "1" and mask[i] == "0": + res += "0" + elif binary[i] == "0" and mask[i] == "1": + res += "1" + else: + res += binary[i] + + return int(res, 2) + + +def main() -> None: + with open("input", "r") as f: + lines = f.read().splitlines() + + mem: dict[str, int] = {} + mask = "" + for line in lines: + line = line.split(" ") + if line[0] == "mask": + mask = line[2] + else: + mem[line[0][4:-1]] = bitmask(mask, int(line[2])) + + print(sum(mem[val] for val in mem)) + + +if __name__ == "__main__": + main() diff --git a/2020/14/puzzle-2.py b/2020/14/puzzle-2.py new file mode 100755 index 0000000..45fb6ad --- /dev/null +++ b/2020/14/puzzle-2.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 + + +def bitmask(mask: str, num: int) -> tuple[int, ...]: + binary = bin(num)[2:] + binary = binary.zfill(36) + res = "" + + for i in range(len(binary)): + if mask[i] == "0": + res += binary[i] + else: + res += mask[i] + + n = res.count("X") + combos = tuple(bin(i)[2:].zfill(n) for i in range(2 << n - 1)) + + acc: list[str] = [] + for combo in combos: + temp = res + for i in range(n): + temp = temp.replace("X", combo[i], 1) + acc.append(temp) + + return tuple(int(x, 2) for x in acc) + + +def main() -> None: + with open("input", "r") as f: + lines = f.read().splitlines() + + mem: dict[str, int] = {} + mask = "" + for line in lines: + line = line.split(" ") + if line[0] == "mask": + mask = line[2] + else: + address = line[0][4:-1] + addresses = bitmask(mask, int(address)) + for a in addresses: + mem[a] = int(line[2]) + + print(sum(mem[val] for val in mem)) + + +if __name__ == "__main__": + main() diff --git a/2020/15/.gitignore b/2020/15/.gitignore new file mode 100644 index 0000000..60d075d --- /dev/null +++ b/2020/15/.gitignore @@ -0,0 +1 @@ +puzzle-[12] diff --git a/2020/15/Makefile b/2020/15/Makefile new file mode 100644 index 0000000..c32dafa --- /dev/null +++ b/2020/15/Makefile @@ -0,0 +1,7 @@ +all: + ${CC} ${CFLAGS} -o puzzle-1 puzzles.c + ${CC} ${CFLAGS} -DPART2 -o puzzle-2 puzzles.c + +.PHONY: clean +clean: + rm -f puzzle-[12] diff --git a/2020/15/puzzles.c b/2020/15/puzzles.c new file mode 100644 index 0000000..64d89bb --- /dev/null +++ b/2020/15/puzzles.c @@ -0,0 +1,31 @@ +#include <stdio.h> +#include <stdlib.h> + +#ifndef PART2 + #define BUFFER 2020 +#else + #define BUFFER 30000000 +#endif + +int +main(void) +{ + /* Given starting numbers */ + static unsigned int nums[BUFFER] = {0}; + nums[6] = 1; + nums[19] = 2; + nums[0] = 3; + nums[5] = 4; + nums[7] = 5; + nums[13] = 6; + + unsigned int temp, lnum = 1; + for (int i = 8; i <= BUFFER; i++) { + temp = lnum; + lnum = nums[lnum] ? i - 1 - nums[lnum] : 0; + nums[temp] = i - 1; + } + + printf("%u\n", lnum); + return EXIT_SUCCESS; +} diff --git a/2020/16/input b/2020/16/input new file mode 100644 index 0000000..2895e57 --- /dev/null +++ b/2020/16/input @@ -0,0 +1,269 @@ +departure location: 30-260 or 284-950 +departure station: 29-856 or 863-974 +departure platform: 32-600 or 611-967 +departure track: 44-452 or 473-965 +departure date: 36-115 or 129-950 +departure time: 50-766 or 776-972 +arrival location: 40-90 or 104-961 +arrival station: 40-864 or 887-971 +arrival platform: 32-920 or 932-964 +arrival track: 45-416 or 427-959 +class: 47-536 or 557-964 +duration: 33-229 or 246-969 +price: 25-147 or 172-969 +route: 32-328 or 349-970 +row: 50-692 or 709-964 +seat: 49-292 or 307-964 +train: 28-726 or 748-954 +type: 37-430 or 438-950 +wagon: 46-628 or 638-973 +zone: 39-786 or 807-969 + +your ticket: +89,193,59,179,191,173,61,73,181,67,71,109,53,79,83,113,107,139,131,137 + +nearby tickets: +499,362,657,143,723,763,935,454,473,586,372,489,214,753,765,65,307,56,853,934 +228,664,709,361,856,645,363,171,901,199,62,513,667,808,350,890,715,687,257,721 +531,490,628,88,947,252,832,917,686,571,362,874,837,588,849,140,655,407,90,611 +777,194,111,386,90,598,153,363,373,566,191,945,559,819,289,487,480,590,691,756 +186,366,196,844,655,659,845,109,355,330,71,176,397,380,822,776,369,447,658,949 +783,763,570,184,260,448,856,717,913,646,774,657,841,917,910,193,941,408,110,577 +378,832,670,59,155,911,209,74,57,947,144,514,411,89,690,856,854,286,597,132 +319,684,204,909,342,206,204,943,620,52,516,115,430,319,84,618,593,211,596,581 +66,146,910,225,107,112,918,679,255,757,125,946,863,892,78,525,373,913,87,838 +674,653,588,220,448,941,112,924,474,358,513,649,766,500,847,197,639,836,373,573 +76,115,776,726,598,361,480,772,356,129,506,380,202,810,932,756,408,81,786,889 +311,620,848,357,483,754,181,300,284,60,259,674,596,289,397,113,894,82,291,754 +84,600,751,223,595,478,198,2,402,428,355,517,947,933,624,59,598,711,752,513 +286,664,786,775,510,363,666,229,914,938,196,509,410,528,681,943,477,850,640,595 +365,17,624,375,640,483,208,258,189,222,889,655,852,326,109,428,758,616,889,288 +566,195,201,949,205,517,672,762,180,886,679,63,596,664,678,596,894,384,321,212 +576,316,480,579,925,328,498,194,191,132,106,863,210,416,351,663,643,218,366,942 +776,60,256,400,368,664,469,53,949,689,569,253,319,717,387,591,845,66,499,566 +620,831,379,712,614,176,682,666,83,197,438,916,535,504,218,377,627,155,429,855 +853,525,865,487,190,940,810,251,786,618,895,580,908,86,578,136,781,562,498,759 +671,625,256,592,177,500,523,50,443,692,650,128,441,832,626,491,252,405,661,756 +597,722,922,721,319,388,653,484,83,142,781,451,106,499,515,672,113,374,911,311 +211,716,176,715,627,286,327,531,566,587,916,431,57,371,894,677,778,193,710,447 +559,508,196,178,844,78,114,662,142,558,514,378,375,694,718,314,384,89,816,562 +290,578,105,478,229,260,752,496,187,937,137,898,69,399,980,638,441,84,589,574 +413,592,841,498,793,214,947,582,827,940,446,572,259,623,213,355,853,360,60,195 +481,764,308,384,131,247,595,756,221,361,175,256,407,255,155,752,781,524,403,640 +74,765,914,319,715,86,316,612,197,640,827,760,926,106,520,818,229,824,623,404 +576,504,694,379,75,528,638,257,482,852,837,563,575,389,686,217,852,684,314,184 +481,679,312,796,358,71,376,830,209,946,69,591,939,357,59,284,522,626,218,825 +355,812,691,377,833,938,139,233,643,764,663,692,722,576,495,843,450,536,359,174 +367,749,373,379,69,753,711,81,445,265,405,624,759,814,311,623,228,290,682,195 +475,841,833,415,13,809,478,70,191,228,934,760,765,508,398,655,907,850,487,54 +198,841,184,84,492,945,429,72,753,572,510,408,827,289,177,559,890,837,987,291 +427,198,192,666,319,369,565,861,512,216,81,899,388,761,683,933,529,515,673,674 +355,188,827,614,178,600,641,181,915,728,934,526,904,136,74,649,187,77,381,498 +751,317,780,190,897,781,65,852,933,69,657,811,517,564,842,877,382,84,56,576 +946,839,941,322,409,318,751,850,215,750,394,578,95,284,902,396,409,51,309,938 +54,400,54,307,290,665,125,507,220,600,214,405,864,217,763,284,382,820,129,910 +722,68,841,521,597,286,722,481,451,145,448,389,61,844,650,487,250,781,149,70 +175,323,322,831,857,137,616,686,408,175,709,903,214,917,414,108,367,827,684,593 +321,820,388,220,368,137,403,523,914,839,64,724,482,307,284,448,585,208,764,988 +86,926,414,213,825,682,473,67,318,144,51,311,814,709,520,687,623,396,949,387 +522,369,139,593,122,210,716,906,406,488,681,753,852,189,71,203,51,145,639,412 +322,368,18,663,903,574,203,363,391,643,205,474,182,517,855,486,890,315,725,82 +60,582,819,529,180,140,570,402,191,594,863,146,614,631,51,593,828,583,184,78 +856,622,291,412,503,532,563,217,404,352,349,406,675,277,292,765,748,493,691,626 +647,849,636,64,479,715,623,132,322,408,524,385,212,328,289,104,82,689,908,650 +197,444,249,763,892,86,775,441,172,664,379,596,910,584,574,376,665,899,174,847 +375,906,894,75,895,82,250,367,350,581,912,927,370,888,938,413,109,909,570,481 +104,831,565,413,849,533,861,394,361,511,292,573,567,218,832,135,717,851,134,223 +847,59,369,147,509,80,184,527,199,430,614,687,621,823,132,787,569,109,665,112 +109,983,680,682,191,65,139,643,687,228,828,317,211,784,851,757,672,64,616,173 +403,640,763,704,504,381,201,933,144,597,825,79,496,246,783,113,84,650,720,81 +356,82,615,375,222,361,182,255,112,845,612,298,891,887,382,839,380,691,405,660 +251,535,590,228,181,710,663,485,856,929,389,892,573,247,856,313,679,397,50,850 +895,673,675,513,838,181,135,696,599,327,583,720,486,104,691,777,115,536,724,920 +519,3,55,711,820,572,614,401,751,664,856,779,726,687,672,415,680,536,481,684 +692,781,22,72,586,906,845,356,852,590,777,372,593,579,369,663,619,317,134,138 +623,484,723,936,810,940,824,676,362,172,494,864,360,133,402,911,307,634,828,428 +899,308,410,558,557,452,69,84,65,5,187,849,493,223,441,349,499,677,67,915 +222,758,668,351,782,373,825,839,369,615,904,186,815,379,897,380,863,911,60,981 +576,710,508,63,506,888,638,476,626,616,863,494,434,898,715,759,946,208,932,84 +495,255,259,810,586,387,804,69,564,73,140,628,890,205,213,363,709,683,401,78 +79,582,688,536,114,106,622,289,395,417,786,384,175,55,850,855,327,189,135,254 +379,895,255,498,766,523,291,782,944,839,615,687,892,824,479,77,619,359,702,680 +250,144,611,936,220,851,509,379,260,821,532,859,79,673,906,624,211,780,349,448 +75,643,392,826,139,579,479,618,372,563,823,913,106,286,639,594,455,895,388,776 +370,785,939,918,661,841,582,655,678,109,850,673,423,864,290,677,762,834,383,686 +19,906,528,475,779,174,519,389,715,816,247,500,350,250,54,897,57,942,369,443 +114,684,251,944,56,944,228,217,666,778,650,605,488,284,643,516,754,561,659,938 +292,429,906,605,935,88,140,197,721,438,257,590,324,900,325,785,290,522,491,619 +249,52,649,558,605,914,494,286,373,132,892,766,709,355,655,321,218,473,906,562 +612,908,180,854,475,825,61,516,363,945,896,176,563,763,361,221,847,205,631,112 +936,57,379,279,534,211,889,254,198,381,645,764,318,377,619,850,78,750,181,83 +413,130,497,366,65,307,255,686,181,368,997,560,781,205,69,863,401,809,829,683 +137,227,53,486,826,676,221,896,219,358,981,370,638,528,649,404,482,942,809,676 +918,172,942,948,821,911,291,906,393,438,757,702,215,383,178,219,350,894,757,403 +526,913,180,376,653,617,837,935,896,373,343,184,257,660,784,406,901,904,377,689 +189,388,628,55,723,82,51,369,808,365,137,668,664,596,325,672,360,316,797,939 +88,905,90,284,619,394,326,415,836,891,618,207,754,226,766,572,444,567,177,991 +685,531,67,314,673,136,325,283,659,374,403,60,914,492,478,648,190,320,592,692 +137,146,504,678,691,247,673,438,999,315,639,536,917,416,212,187,896,198,785,452 +855,205,111,600,562,785,489,226,209,941,518,384,700,579,315,657,74,654,591,558 +444,360,672,367,819,108,757,136,621,838,323,785,478,809,492,376,161,508,901,586 +205,500,513,902,408,909,573,663,891,290,326,389,477,376,810,392,596,382,846,989 +141,366,489,481,716,350,589,63,655,558,451,143,289,594,866,933,711,63,213,380 +320,144,949,726,314,576,639,80,287,143,616,713,945,623,228,927,374,385,856,499 +215,135,351,409,69,619,658,639,567,716,227,888,768,66,115,320,77,718,748,369 +614,894,572,515,842,371,253,570,479,574,292,394,463,659,840,227,763,757,777,83 +401,887,116,854,751,683,137,898,104,649,596,779,935,65,570,220,147,850,781,379 +353,808,187,909,895,710,192,903,784,779,755,788,896,292,719,428,843,681,407,313 +83,722,826,829,392,616,655,484,520,720,53,243,145,360,63,594,512,443,850,200 +588,889,187,889,581,215,290,319,821,440,601,220,482,307,217,690,758,512,942,372 +722,183,134,843,807,783,509,657,411,859,561,401,763,719,756,380,756,375,443,207 +289,853,562,190,181,652,988,942,315,225,813,355,404,107,429,442,311,377,259,855 +527,780,526,323,449,218,721,714,84,200,806,717,619,587,821,399,570,518,778,893 +836,309,893,780,943,779,657,256,528,296,512,476,131,641,828,223,807,683,562,313 +855,192,440,557,427,710,776,755,653,920,191,763,631,664,897,580,845,916,659,66 +179,559,920,399,906,720,822,942,852,408,617,690,599,937,949,356,195,982,251,318 +942,990,386,328,473,669,52,324,531,889,854,322,594,762,536,135,672,501,612,229 +627,500,725,255,136,370,403,58,77,838,674,620,858,307,438,189,392,674,568,446 +529,415,438,661,287,511,200,250,179,388,596,582,176,529,514,978,945,106,312,564 +587,392,947,762,110,387,495,115,452,572,416,676,189,751,208,985,478,828,442,638 +439,935,614,357,919,131,385,247,674,113,835,766,908,373,134,257,996,487,145,836 +855,619,843,711,577,427,392,661,485,257,293,504,315,450,190,389,581,197,823,711 +617,816,838,636,257,58,935,668,501,386,226,838,919,660,755,643,438,216,526,753 +685,288,86,781,908,140,310,144,258,52,132,560,803,622,591,134,218,248,566,518 +782,290,896,384,324,452,671,562,508,653,475,996,683,624,494,597,145,682,67,910 +567,532,719,399,50,616,922,914,310,612,353,653,400,384,562,684,492,568,135,689 +170,749,486,901,108,825,887,210,519,226,762,188,590,903,452,617,615,834,363,517 +308,497,496,400,530,512,939,647,514,359,435,625,186,580,66,206,718,491,657,50 +558,698,326,195,809,89,135,378,518,846,692,204,716,573,176,369,583,752,227,651 +399,982,611,404,619,317,86,486,524,673,51,489,751,318,766,486,826,249,381,815 +597,856,16,375,61,137,906,888,439,669,782,893,902,398,785,900,671,319,710,136 +311,653,224,823,442,220,902,603,367,54,945,195,897,67,60,360,814,450,246,665 +358,579,849,813,315,308,825,681,827,114,857,352,481,440,212,944,836,312,501,439 +55,129,66,942,133,137,208,50,478,205,200,916,851,487,889,824,989,691,490,364 +308,381,688,440,135,516,816,504,287,625,750,355,663,714,176,391,229,989,904,284 +213,780,407,912,573,535,585,825,897,842,588,469,893,321,567,831,90,138,613,863 +853,119,581,373,84,761,217,640,752,383,226,650,357,322,438,503,292,559,291,492 +684,874,935,786,89,852,940,397,643,51,722,647,79,50,817,86,585,822,611,575 +777,890,911,915,114,452,635,204,79,289,310,449,628,247,358,948,894,307,350,893 +724,685,936,485,887,82,835,870,481,615,616,751,131,505,111,82,912,438,50,405 +520,826,224,592,411,284,834,668,902,657,661,897,758,369,933,809,704,501,222,777 +624,628,105,260,663,502,447,436,310,851,836,208,911,591,718,755,844,647,854,497 +762,175,201,4,644,111,427,490,713,409,531,143,577,75,287,663,172,411,911,57 +285,225,187,359,57,911,315,56,892,398,216,533,784,916,10,690,912,133,939,328 +754,649,519,319,315,807,640,749,668,404,594,514,175,587,637,582,188,90,219,427 +906,146,274,173,229,562,480,518,897,821,53,913,319,63,189,571,485,613,509,353 +502,646,58,352,505,660,575,133,671,811,586,350,850,802,474,360,911,136,564,753 +106,62,354,247,935,626,978,371,834,214,586,76,659,532,938,444,388,443,668,574 +132,473,368,718,80,754,751,947,903,772,284,256,650,258,251,682,197,619,758,501 +77,892,401,675,270,935,183,658,578,497,373,209,807,187,209,85,205,251,367,57 +750,209,834,811,665,898,361,64,114,685,258,943,644,532,129,614,924,76,377,405 +195,428,488,67,935,19,375,392,484,450,892,416,260,650,256,194,397,483,113,557 +474,852,196,427,375,977,639,643,536,785,66,452,326,623,828,309,909,373,138,113 +219,225,818,84,639,380,856,676,372,82,76,577,517,758,942,182,604,194,400,357 +908,622,568,81,183,901,868,354,818,835,894,430,482,824,856,839,190,77,88,840 +641,572,228,286,936,889,818,777,778,846,643,113,150,138,754,934,582,581,627,685 +898,891,841,0,62,908,110,888,74,831,286,653,407,138,653,932,514,853,357,598 +622,413,899,828,185,194,173,571,481,670,315,515,562,207,836,708,766,683,488,372 +248,457,934,372,564,414,662,665,949,642,202,144,189,842,214,592,374,888,211,247 +668,139,115,132,522,683,205,849,784,481,713,776,689,63,563,658,361,982,196,897 +289,407,60,434,323,561,196,319,517,846,686,855,173,864,611,814,717,618,313,687 +474,892,536,259,888,86,81,328,687,402,375,891,291,666,805,909,386,193,511,898 +131,210,638,840,392,765,565,841,394,781,813,562,316,145,526,528,826,803,87,197 +841,557,935,116,837,478,174,839,623,752,71,484,709,685,495,360,327,143,440,908 +452,86,411,358,847,632,853,716,410,491,934,86,196,598,600,486,402,212,493,714 +766,663,131,474,888,85,569,710,251,225,846,194,692,925,398,783,226,291,189,488 +657,560,388,477,509,87,139,911,258,671,947,753,865,913,324,638,366,526,584,429 +658,181,83,611,259,561,752,121,758,561,612,478,518,763,896,596,68,328,173,446 +625,810,62,508,458,355,847,896,220,838,933,536,376,112,427,190,511,403,479,675 +367,495,523,441,694,656,286,309,203,839,481,848,646,830,383,221,848,185,615,208 +311,526,497,750,473,916,393,396,564,191,479,723,627,182,444,484,173,754,661,8 +759,848,112,516,668,189,217,617,598,117,831,251,906,905,560,86,573,938,63,908 +188,889,534,86,999,187,441,186,762,61,827,106,222,756,814,113,716,54,200,808 +809,259,908,290,905,316,761,593,846,408,509,780,516,447,311,201,773,217,948,932 +210,253,621,481,900,557,318,379,909,511,985,904,681,716,115,70,214,385,825,427 +533,130,571,599,621,141,612,786,838,402,662,186,297,820,759,381,208,592,576,318 +320,253,349,831,394,557,105,752,522,191,181,891,200,13,409,762,833,317,683,55 +401,416,920,309,583,665,570,369,199,54,455,185,513,80,527,912,442,783,615,85 +365,190,504,219,595,618,593,350,782,809,66,919,427,474,406,137,81,14,189,442 +135,187,428,506,662,209,850,905,184,855,935,584,606,944,819,371,825,720,598,912 +622,620,408,224,530,792,894,855,372,667,653,820,514,180,479,685,190,196,107,560 +205,848,375,252,628,479,670,147,413,156,759,949,489,719,681,493,70,508,807,835 +776,676,62,512,658,477,215,748,911,186,500,557,213,862,905,373,677,250,410,250 +58,88,684,855,626,498,574,631,503,749,75,59,641,207,440,404,139,887,751,363 +113,186,66,204,104,726,115,137,617,832,90,755,664,517,452,635,594,749,892,363 +356,863,658,575,896,903,373,645,192,907,277,816,844,532,519,520,402,390,623,507 +83,514,383,674,628,832,584,723,639,307,144,569,191,199,990,718,76,415,193,756 +308,267,503,448,842,228,55,371,63,724,590,894,566,621,477,448,566,752,530,675 +569,327,379,64,84,51,273,863,721,501,592,688,406,814,498,292,505,487,901,398 +830,855,66,534,710,441,623,816,324,368,318,450,232,407,619,639,50,530,413,428 +477,579,480,721,16,713,673,53,687,256,624,444,534,725,653,227,76,750,411,104 +720,405,915,676,80,623,757,141,901,847,493,485,123,379,444,349,832,711,77,73 +528,50,913,528,50,61,354,489,838,600,193,387,382,621,191,822,119,82,211,836 +516,565,76,906,586,638,755,716,588,822,502,15,492,896,391,503,685,382,188,940 +318,583,260,677,873,822,364,255,624,624,147,721,63,218,215,567,136,493,87,511 +58,446,210,582,133,814,719,476,412,863,492,901,580,845,87,179,629,177,915,322 +112,712,386,667,624,369,650,317,177,230,532,56,360,482,479,818,893,835,258,495 +51,492,763,777,287,508,827,138,620,635,915,311,808,510,82,360,564,251,446,138 +198,678,855,410,568,899,712,442,173,438,18,86,777,83,752,144,207,721,587,590 +79,352,414,777,786,384,671,346,600,591,829,316,374,939,229,199,216,219,109,210 +508,154,508,677,510,212,529,903,758,410,199,131,88,476,481,508,825,393,784,287 +55,652,686,521,620,388,785,907,535,683,631,363,186,487,289,406,481,572,360,574 +133,507,413,366,838,939,131,589,678,440,520,912,142,533,909,17,588,753,833,657 +111,356,638,172,491,684,110,846,384,433,679,647,289,846,916,946,352,196,786,479 +567,224,907,310,488,763,195,139,595,512,687,680,493,401,130,749,273,353,498,679 +814,988,813,443,662,948,136,503,517,392,815,317,723,416,400,318,627,780,836,890 +328,196,856,288,623,257,525,285,679,512,564,170,723,534,916,179,67,651,557,834 +450,484,381,441,774,570,664,815,147,319,173,316,137,532,327,657,749,510,200,199 +902,650,327,258,647,667,250,77,579,598,723,473,510,364,923,369,493,357,318,359 +314,824,689,488,809,892,530,384,809,399,497,413,935,133,641,360,996,643,615,215 +365,756,249,585,913,613,821,353,646,851,411,54,710,153,289,199,617,200,383,528 +824,257,831,938,481,841,576,179,321,938,919,81,479,766,705,257,513,112,353,200 +71,748,208,75,250,319,498,179,997,394,409,764,377,678,534,320,113,512,669,115 +260,587,57,671,366,248,175,727,814,596,309,664,757,781,940,62,187,809,642,816 +406,205,569,108,817,414,366,474,86,311,901,682,589,256,283,814,393,596,856,321 +920,613,190,616,616,614,897,384,213,222,158,359,80,837,140,709,854,356,838,820 +496,508,512,509,675,180,89,182,838,208,392,771,177,934,88,513,61,943,903,666 +311,509,478,439,890,692,682,361,914,802,720,600,675,576,664,224,522,252,898,650 +384,587,250,396,715,840,595,679,900,135,141,438,844,122,310,566,850,291,205,676 +414,810,370,856,785,628,172,781,88,450,675,339,308,210,832,660,595,77,475,438 +648,77,650,473,817,977,819,524,846,751,323,823,104,67,112,451,394,627,725,578 +620,327,676,194,664,51,140,368,782,528,111,280,145,73,582,486,821,530,372,764 +370,364,79,252,718,204,370,835,825,904,698,312,137,586,387,360,713,229,725,318 +192,776,258,495,644,836,759,139,147,702,658,779,615,816,478,812,657,712,362,839 +386,530,409,863,110,290,938,75,406,457,190,513,368,133,203,753,514,825,644,687 +615,862,808,721,579,671,807,228,848,307,760,74,451,509,484,403,216,710,892,667 +494,763,935,569,778,396,362,723,113,495,897,486,735,495,288,715,937,590,575,687 +478,108,831,687,817,753,687,528,321,201,574,572,444,897,489,568,876,512,508,288 +829,312,350,843,478,252,584,361,625,307,929,570,514,72,219,825,686,570,655,667 +172,910,658,834,657,182,941,182,246,907,373,147,271,183,77,785,429,320,847,726 +855,523,364,690,564,979,145,892,354,525,326,510,723,856,560,445,620,813,525,618 +748,916,783,872,646,676,596,691,316,373,512,915,512,724,831,723,842,324,908,899 +88,766,253,446,940,533,398,506,751,912,18,130,134,477,855,59,516,395,384,76 +795,638,507,766,947,400,474,505,864,612,653,212,529,378,255,911,358,83,51,491 +765,827,584,196,941,390,402,713,901,82,659,623,345,177,309,191,198,223,863,937 +517,635,510,64,415,765,901,365,723,574,623,850,191,917,943,643,413,523,757,830 +218,854,225,812,523,170,593,357,761,291,621,914,584,60,64,198,65,501,848,939 +83,683,222,750,135,847,864,325,80,668,717,630,757,427,137,430,176,777,809,670 +285,570,846,471,759,572,627,721,753,68,414,920,521,677,517,713,901,475,569,67 +135,319,70,328,495,618,78,479,414,782,107,64,489,378,227,444,861,314,441,179 +766,557,983,577,443,573,225,74,259,680,659,932,916,452,560,763,374,214,446,644 +54,509,310,204,580,484,889,371,935,619,520,188,622,653,491,229,66,926,828,688 +560,311,146,911,907,864,696,386,328,776,393,387,947,364,212,688,677,446,361,64 +79,259,476,926,67,375,59,397,750,909,652,947,568,786,208,107,200,830,527,173 +88,836,587,134,901,176,896,287,68,574,903,562,82,877,75,651,561,813,569,209 +480,566,575,639,198,80,935,142,446,948,784,360,716,835,318,171,536,112,843,835 +519,711,796,581,590,382,317,514,389,488,410,663,840,578,450,906,947,841,507,663 +87,569,890,497,368,361,58,413,145,592,144,221,292,445,72,941,791,60,218,814 +389,810,597,156,190,186,507,725,638,349,86,405,644,947,254,201,391,573,758,826 +500,829,643,858,193,191,485,584,370,940,841,820,832,327,565,389,816,677,819,485 +81,499,388,812,201,848,823,288,715,650,868,307,322,53,780,360,650,491,711,896 +816,443,408,197,316,936,487,792,350,492,287,717,350,201,444,111,579,73,409,289 +509,369,890,671,529,444,428,783,170,139,889,649,905,511,508,410,380,399,203,310 +808,711,711,500,512,227,85,810,940,604,786,74,667,684,400,174,480,224,522,88 +105,897,172,780,432,722,287,529,824,524,52,250,136,219,223,249,384,938,559,856 +827,618,152,625,143,933,529,254,400,257,780,144,182,599,576,376,113,199,353,624 +515,253,651,450,659,382,814,254,522,535,906,180,350,358,725,441,135,591,921,54 +290,354,895,627,399,945,355,311,385,496,756,986,893,80,52,308,414,313,572,599 +211,363,501,189,635,891,131,623,493,109,854,572,190,246,206,562,808,365,889,250 +63,792,659,400,946,835,724,641,566,180,824,892,199,528,175,563,687,571,314,557
\ No newline at end of file diff --git a/2020/16/puzzle-1.py b/2020/16/puzzle-1.py new file mode 100755 index 0000000..f4343c8 --- /dev/null +++ b/2020/16/puzzle-1.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + + +def main() -> None: + with open("input", "r") as f: + data = f.readlines() + + i = 0 + valid: list[int] = [] + while data[i] != "\n": + ranges = data[i].split(": ")[1].split(" or ") + for _range in ranges: + bounds = tuple(map(int, _range.split("-"))) + for j in range(bounds[0], bounds[1] + 1): + valid.append(j) + i += 1 + + # Skip to nearby tickets + i += 5 + acc = 0 + + for j in range(i, len(data)): + fields = tuple(map(int, data[j].split(","))) + acc += sum(field for field in fields if field not in valid) + + print(acc) + + +if __name__ == "__main__": + main() diff --git a/2020/16/puzzle-2.py b/2020/16/puzzle-2.py new file mode 100755 index 0000000..1060049 --- /dev/null +++ b/2020/16/puzzle-2.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 + +from functools import reduce +from operator import mul + + +def not_reduced(label_dict: dict[int, str]) -> bool: + for i in label_dict: + if len(label_dict[i]) != 1: + return True + return False + + +def main() -> None: + with open("input", "r") as f: + data = f.readlines() + + i = 0 + valid: list[int] = [] + labels: list[str] = [] + while data[i] != "\n": + labels.append(data[i].split(":")[0]) + ranges = data[i].split(": ")[1].split(" or ") + for _range in ranges: + bounds = tuple(map(int, _range.split("-"))) + for j in range(bounds[0], bounds[1] + 1): + valid.append(j) + i += 1 + + # Skip to nearby tickets + i += 5 + + vtickets: list[tuple[int, ...]] = [] + for j in range(i, len(data)): + fields = tuple(map(int, data[j].split(","))) + check = True + for field in fields: + if field not in valid: + check = False + break + if check == True: + vtickets.append(tuple(map(int, data[j].split(",")))) + + label_dict: dict[int, list[str]] = {} + for i in range(len(labels)): + label_dict[i] = [] + + # Triple for loop, gross! + for label in labels: + valid: list[list[int]] = [] + ranges = data[labels.index(label)].split(": ")[1].split(" or ") + for _range in ranges: + bounds = tuple(map(int, _range.split("-"))) + for i in range(bounds[0], bounds[1] + 1): + valid.append(i) + + # For each column + for i in range(len(labels)): + allvalid = True + for ticket in vtickets: + if ticket[i] not in valid: + allvalid = False + break + + if allvalid == True: + label_dict[i].append(label) + + # Reduce the label dictionary + while not_reduced(label_dict): + for i in label_dict: + if len((l := label_dict[i])) == 1: + for j in label_dict: + if l[0] in label_dict[j] and i != j: + label_dict[j].remove(l[0]) + + my_ticket = tuple(map(int, data[data.index("your ticket:\n") + 1].split(","))) + print(reduce(mul, [x for x in my_ticket if "departure" in label_dict[my_ticket.index(x)][0]],)) + + +if __name__ == "__main__": + main() diff --git a/2020/17/.gitignore b/2020/17/.gitignore new file mode 100644 index 0000000..60d075d --- /dev/null +++ b/2020/17/.gitignore @@ -0,0 +1 @@ +puzzle-[12] diff --git a/2020/17/Makefile b/2020/17/Makefile new file mode 100644 index 0000000..c32dafa --- /dev/null +++ b/2020/17/Makefile @@ -0,0 +1,7 @@ +all: + ${CC} ${CFLAGS} -o puzzle-1 puzzles.c + ${CC} ${CFLAGS} -DPART2 -o puzzle-2 puzzles.c + +.PHONY: clean +clean: + rm -f puzzle-[12] diff --git a/2020/17/input b/2020/17/input new file mode 100644 index 0000000..3b42c23 --- /dev/null +++ b/2020/17/input @@ -0,0 +1,8 @@ +...#..#. +.....##. +##..##.# +#.#.##.. +#..#.### +...##.#. +#..##..# +.#.#..#.
\ No newline at end of file diff --git a/2020/17/puzzles.c b/2020/17/puzzles.c new file mode 100644 index 0000000..4e98982 --- /dev/null +++ b/2020/17/puzzles.c @@ -0,0 +1,104 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/* PART2 is defined for part 2, but not for part 1 */ +#ifdef PART2 + #define MAXTIME 50 +#else + #define MAXTIME 1 +#endif +#define MAXDEPTH 50 +#define MAXHEIGHT 50 +#define MAXWIDTH 50 + +char space[MAXTIME][MAXDEPTH][MAXHEIGHT][MAXWIDTH]; +char temp[MAXTIME][MAXDEPTH][MAXHEIGHT][MAXWIDTH]; + +/* Check the cubes around the given coordinates and update the temp array accordingly */ +static void +update_cube(unsigned int const t, unsigned int const i, unsigned int const j, unsigned int const k) +{ + unsigned int active = 0; + + for (int tme = t - 1; tme <= (int) t + 1; tme++) { + if (tme < 0 || tme > MAXTIME - 1) + continue; + for (int dep = i - 1; dep <= (int) i + 1; dep++) { + if (dep < 0 || dep > MAXDEPTH - 1) + continue; + for (int hgt = j - 1; hgt <= (int) j + 1; hgt++) { + if (hgt < 0 || hgt > MAXHEIGHT - 1) + continue; + for (int wid = k - 1; wid <= (int) k + 1; wid++) { + if (wid < 0 || wid > MAXWIDTH - 1 + || (tme == (int) t && dep == (int) i && hgt == (int) j + && wid == (int) k)) + continue; + + if (space[tme][dep][hgt][wid] == '#') + active++; + } + } + } + } + + if (space[t][i][j][k] == '#' && (active == 2 || active == 3)) + temp[t][i][j][k] = '#'; + else if (space[t][i][j][k] == '.' && active == 3) + temp[t][i][j][k] = '#'; + else + temp[t][i][j][k] = '.'; +} + +int +main(void) +{ + /* Initialze space */ + memset(space, '.', MAXTIME * MAXDEPTH * MAXHEIGHT * MAXWIDTH); + + /* Read input */ + FILE *fpt = fopen("input", "r"); + char c; + unsigned int t, i, j, k; + + j = k = 0; + while ((c = fgetc(fpt)) != EOF) { + if (c == '\n') { + j++; + k = 0; + } + else { + space[MAXTIME / 2][MAXDEPTH / 2][j + MAXHEIGHT / 2][k + MAXWIDTH / 2] = c; + k++; + } + } + + /* Do the boot cycles */ + for (int cycle = 0; cycle < 6; cycle++) { + for (t = 0; t < MAXTIME; t++) + for (i = 0; i < MAXDEPTH; i++) + for (j = 0; j < MAXHEIGHT; j++) + for (k = 0; k < MAXWIDTH; k++) + update_cube(t, i, j, k); + + /* Copy temp to space */ + for (t = 0; t < MAXTIME; t++) + for (i = 0; i < MAXDEPTH; i++) + for (j = 0; j < MAXHEIGHT; j++) + for (k = 0; k < MAXWIDTH; k++) + space[t][i][j][k] = temp[t][i][j][k]; + } + + /* Count the active cubes */ + unsigned int count = 0; + for (t = 0; t < MAXTIME; t++) + for (i = 0; i < MAXDEPTH; i++) + for (j = 0; j < MAXHEIGHT; j++) + for (k = 0; k < MAXWIDTH; k++) + if (space[t][i][j][k] == '#') + count++; + + printf("%u\n", count); + return EXIT_SUCCESS; +} diff --git a/2020/18/.gitignore b/2020/18/.gitignore new file mode 100644 index 0000000..60d075d --- /dev/null +++ b/2020/18/.gitignore @@ -0,0 +1 @@ +puzzle-[12] diff --git a/2020/18/Makefile b/2020/18/Makefile new file mode 100644 index 0000000..c32dafa --- /dev/null +++ b/2020/18/Makefile @@ -0,0 +1,7 @@ +all: + ${CC} ${CFLAGS} -o puzzle-1 puzzles.c + ${CC} ${CFLAGS} -DPART2 -o puzzle-2 puzzles.c + +.PHONY: clean +clean: + rm -f puzzle-[12] diff --git a/2020/18/input b/2020/18/input new file mode 100644 index 0000000..c39b341 --- /dev/null +++ b/2020/18/input @@ -0,0 +1,379 @@ +6 * 7 * 8 * 9 * ((8 * 3 * 9) * 7 + 2 + 4 * 8 + 2) + 5 +3 * 2 * (5 + (8 + 2 * 2 * 8 + 8) * 8) +5 + 7 * 8 * 2 +(8 + 5 * 9 + (8 * 9 + 7 + 8)) * 4 * 3 * (8 * 9) * 3 +(7 + 2 + 2 + 5 * 6 * 3) * 8 + 5 * 9 +(9 + (2 * 9 + 6 + 5 + 2 + 7) + 4) + 5 + (9 + (7 + 8 * 6 + 3 * 8) * (5 + 3 *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6) +8 + 5 + 7 + 7 * 3 * ((6 * 5 * 4) * 7 * 5 * 3 * 4 * 8) +8 + ((4 + 2 * 4 * 6 * 4) * (3 * 8 * 8 * 4) + 4 + 6 * 6 * 3) * 6 * 8 +9 * 9 + (5 + 3 * (8 * 9 + 8 + 3 + 6) * 2 * 2) * 5 +8 + 7 + (9 * 3 + 9 * (2 + 4 + 8 + 2) + 4) * 3 + 5 * 5 +9 * (3 * 7 * (3 * 6 * 3 * 5) + 5 * 3 + 8) * 7 + 7 * 2 +9 + 2 * (7 * (8 * 7 * 4)) + 7 + 4 +(2 * 4 * (4 * 9 * 7 * 7 + 3) + 5) * 4 + 8 * 5 + 4 * 5 +(7 * 3 + 7 + 7 * 3 + (4 * 4 * 9 + 4 * 7)) * 6 * (4 + 5 * 3) * 4 + 2 +8 + (2 + 6 * 9 * (7 * 4 * 9) + (2 * 4 + 3)) + (5 + 9 * 2 * 9 + 7) + 2 * 5 +6 + 9 * 6 + 6 + (8 + 7) * 4 +8 + 8 * 7 + 6 * 2 + 8 +6 * 2 + 8 +5 + (7 * 9 + 6) * (8 + (3 + 9 + 8)) + (5 + 4 + 5 + 5 * 5) + (8 * 6) +(9 * 9 * 8 + 7 * 2) + 7 +6 + 7 + 8 + (6 * (5 * 8 * 4 + 5 + 7) + 4 + 9 * (3 * 2)) + (7 + 6 + 6) +(5 * 5 * 9 * 6 + (2 + 9 * 5 * 6) + 9) + 7 * 6
\ No newline at end of file diff --git a/2020/18/puzzles.c b/2020/18/puzzles.c new file mode 100644 index 0000000..5afbe00 --- /dev/null +++ b/2020/18/puzzles.c @@ -0,0 +1,126 @@ +#define _GNU_SOURCE +#include <sys/types.h> + +#include <ctype.h> +#include <err.h> +#include <stdio.h> +#include <stdlib.h> + +static unsigned long long parse_number(void); +static unsigned long long parse_digit(void); +static unsigned long long parse_result(void); + +#ifdef PART2 +static unsigned long long parse_sum(void); +static unsigned long long parse_product(void); +#endif + +char *g_current; + +/* Convert the current number from a string to an int */ +unsigned long long +parse_number(void) +{ + unsigned long long number = 0; + while (isdigit(*g_current)) + number = number * 10 + *g_current++ - '0'; + + return number; +} + +/* Parse the current digit pointed to by `g_current` */ +unsigned long long +parse_digit(void) +{ + if (isdigit(*g_current)) + return parse_number(); + + /* If not a digit, it's a parenthesis */ + g_current++; + unsigned long long result = parse_result(); + g_current++; + return result; +} + +#ifdef PART2 +/* Parse and compute a sum */ +unsigned long long +parse_sum(void) +{ + unsigned long long result = parse_digit(); + + while (*g_current == '+') { + g_current++; + result += parse_digit(); + } + + return result; +} + +/* Parse and compute a product */ +unsigned long long +parse_product(void) +{ + unsigned long long result = parse_sum(); + + while (*g_current == '*') { + g_current++; + result *= parse_sum(); + } + + return result; +} +#endif + +/* Parse and compute a sum */ +unsigned long long +parse_result(void) +{ +#ifdef PART2 + return parse_product(); +#else + unsigned long long result = parse_digit(); + + while (*g_current == '+' || *g_current == '*') { + if (*g_current++ == '+') + result += parse_digit(); + else + result *= parse_digit(); + } + + return result; +#endif +} + +/* Remove the spaces from user input */ +static void +remove_spaces(char *str) +{ + char const *c = str; + do + while (*c == ' ') + c++; + while ((*str++ = *c++)); +} + +int +main(void) +{ + FILE *fp; + char *line = NULL; + size_t len = 0; + ssize_t read; + + if (!(fp = fopen("input", "r"))) + err(EXIT_FAILURE, "fopen"); + + unsigned long long acc = 0; + while ((read = getline(&line, &len, fp)) != -1) { + remove_spaces(line); + g_current = line; + acc += parse_result(); + } + + printf("%llu\n", acc); + return EXIT_SUCCESS; +} diff --git a/2020/19/input b/2020/19/input new file mode 100644 index 0000000..d45070d --- /dev/null +++ b/2020/19/input @@ -0,0 +1,562 @@ +72: "b" +45: 46 52 | 9 72 +85: 9 52 | 9 72 +82: 52 87 | 72 77 +133: 52 30 | 72 56 +118: 7 52 | 70 72 +18: 52 113 | 72 52 +119: 72 46 | 52 18 +25: 19 72 | 103 52 +32: 90 52 | 78 72 +50: 113 113 +71: 72 106 | 52 128 +3: 103 72 | 18 52 +41: 86 72 | 19 52 +96: 86 72 | 108 52 +33: 44 52 | 104 72 +127: 52 36 | 72 50 +51: 72 79 | 52 38 +43: 72 50 | 52 106 +14: 32 72 | 129 52 +6: 2 72 | 33 52 +108: 52 72 | 72 52 +129: 6 52 | 82 72 +34: 127 72 | 3 52 +74: 128 52 | 9 72 +80: 52 103 | 72 19 +2: 134 72 | 13 52 +54: 128 72 | 114 52 +19: 72 72 | 113 52 +0: 8 11 +30: 132 72 | 39 52 +60: 72 64 | 52 5 +4: 18 52 | 114 72 +57: 72 71 | 52 54 +111: 52 27 | 72 102 +76: 122 52 | 75 72 +134: 86 52 | 9 72 +49: 17 52 | 81 72 +124: 103 72 | 86 52 +123: 72 28 | 52 121 +117: 18 52 | 86 72 +26: 51 72 | 58 52 +62: 85 52 | 44 72 +55: 126 52 | 92 72 +115: 72 13 | 52 67 +109: 128 72 | 106 52 +52: "a" +93: 60 52 | 133 72 +64: 67 72 | 84 52 +102: 52 128 | 72 48 +84: 86 52 | 46 72 +77: 41 72 | 21 52 +27: 52 9 | 72 108 +95: 89 72 | 105 52 +36: 52 72 +110: 72 50 | 52 9 +9: 72 72 +120: 72 19 | 52 18 +67: 52 48 +112: 65 72 | 119 52 +75: 62 52 | 123 72 +23: 15 72 | 119 52 +42: 131 52 | 61 72 +94: 52 91 | 72 18 +66: 52 128 | 72 103 +10: 113 108 +37: 52 18 | 72 50 +98: 72 69 | 52 94 +126: 115 52 | 29 72 +79: 59 52 | 94 72 +104: 19 72 | 36 52 +125: 96 72 | 4 52 +122: 52 73 | 72 112 +130: 52 20 | 72 45 +90: 72 40 | 52 88 +132: 103 52 +121: 91 52 | 46 72 +7: 52 114 | 72 128 +5: 52 66 | 72 41 +97: 52 18 | 72 91 +89: 72 109 | 52 116 +53: 52 108 | 72 128 +114: 52 113 | 72 72 +16: 1 52 | 110 72 +113: 72 | 52 +31: 52 14 | 72 12 +69: 52 103 | 72 48 +128: 72 52 +40: 72 3 | 52 83 +101: 63 52 | 127 72 +1: 72 91 | 52 114 +58: 52 111 | 72 99 +13: 19 72 | 9 52 +35: 22 72 | 125 52 +65: 72 114 | 52 91 +12: 52 24 | 72 93 +46: 72 72 | 52 52 +20: 9 72 +73: 72 37 | 52 43 +15: 52 50 | 72 108 +103: 52 52 +106: 72 52 | 72 72 +21: 36 72 +28: 72 50 | 52 46 +78: 72 16 | 52 23 +70: 36 72 | 19 52 +87: 72 107 | 52 47 +116: 19 52 | 106 72 +29: 72 68 | 52 65 +8: 42 +68: 9 52 | 128 72 +99: 110 72 | 25 52 +17: 52 118 | 72 130 +11: 42 31 +48: 52 52 | 72 52 +83: 48 113 +105: 52 100 | 72 80 +61: 55 52 | 26 72 +100: 48 52 | 108 72 +56: 52 53 | 72 74 +63: 52 106 | 72 9 +44: 72 114 | 52 128 +47: 52 50 | 72 36 +107: 52 36 | 72 91 +39: 114 72 | 86 52 +86: 52 72 | 52 52 +24: 52 95 | 72 35 +81: 98 72 | 34 52 +131: 49 52 | 76 72 +92: 52 101 | 72 57 +59: 52 114 | 72 50 +38: 52 74 | 72 124 +88: 97 72 | 10 52 +22: 117 72 | 120 52 +91: 72 72 | 52 72 + +bbabbaabaabaaaababbbbabaabbaabab +baaabaaabaaababbabababaabababaaa +aaabbbabaabbbbbbbbabaaba +aaababbbaaabaabbabbbbabbaaaabbbb +ababaabbaabbbaabbbabbababbabbbbbbaaabbbbaaaabbbabbbaaabbaaaabbaa +bbbbaabaababaaabbbaaaaabbbbabbabaaabaabaabbaaaba +bbaababbbbbbaabbbbbaaaabbbbbabaaaabbbabaabbbaaaa +aaaaaaaaaababaaaabaaababaabbbbaababaaaaaaaaabaaabbaabbbaaabaabababbbbaaabbbbbabb +bbbbabbbbbbbbbbababbabbabbbabbbaaabbbbbaabbbbbaa +bbabaaababbbaabababbabbbabaabbbbbaaabbaaaaabbbaaaaabaabbaabbabba +babbbabaaabbaaaabaaaaabbbabaaaaa +ababaabbaaabbabbbbbbbaaaaabaabaabaaaababbaaaaaaa +baaaababaaaaaaababaaabba +bbaabbbaaabababbbaaaaabbbbbbbaaaaabbaabaabaaabaabbbaabaaaaaababbababbbbb +bbababbbaaabbabababbbabaaabbaababbbaaabaaabbbabbabababab +babbabbabbbaabbbbaabaaabbabababbbbbbbbaa +abbaaaaaabbabbaabbabbabababbaabaabbbaaaa +ababaabbabbbbbabbabbbaaaabbbaabbabbbbabb +aaabbbbaabbbababaabaaaaa +babbbaaaabaaabaaabbabbabbabaabab +aaabbaabaabbabaaaaaaaabb +ababbbabaabbaabbabaababababbbbaa +babbabaaabbbababbbababaaaaaabbaaababaaab +bbaababbbabaaababbaaabab +aabababbbbaabbbbabaabaababababaaabababab +baaaaabbbbbaabbbbbababbbbbbabbab +baaaabaaabaabaaabbabaaaababaaaab +aabbbabababaaabababbaaaa +ababbbaaabababbaaabaaababbaaaabaabbbbbab +ababbbaaaabaaaababababba +aaabbbabaabbaababbbbabbbbbabbabaababbabb +aabbabaaaabbaababbabbabbaaabaabababaaabaaaaaabab +abaaabbbabbaaababaaababa +bbaaabbbbababbababaababb +aaabbabababaaabaabbabaab +bbabbaaaabbbaabbaaabbbbbbbbabaabbbbbabbbbabbaabaabbaababaaabaabb +babbabbabbbbababaaaaabaababbbabbaabaabbbabaaaabb +bbabbaababababbabaaababb +babaaabaaabababbaabababbabbababaabbaaabbbababaaaababbbbbaaaabbbbabbbbaaa +aaabaabaaabbbaabbbabbbbbbbababba +aabaababbbaaaababbabaaaa +aaaabaaabbabababbabbbaab +baaabaabbaaaababbbaabaaaaabbabaaabaaabaabbbbbabbbabaabababaabbaaabbaaababbabbbbb +aabaabbbababbbababaababaabbbaaaa +aabaabbaaaabaabaabaaaaaabababbaababaaabbabbbbabbbaaaaaaabababbabbbbbabaa +baaabbbaaaaaabbbbbaaaaabbabbaabaaaaabbba +baaabaaaabbbbaaaaabbaababbabbababaaaabbbbabbaaabaabbbaabbaaaabbb +baaabbbabaabbabaabbabaaabaaabbbaabbaaabbabaaabab +abbaaabbaaabbabbabaaabba +aaaaaaabbabbbabababbbaaaababaabbabbaaabaabbaabab +aabababaaabbaabbbbaabbbababbaaaa +aabbbabaaabaabbbbbbabaabababbbbb +bbbababbbabbbbbbbabaaabaaaabbabaaabbbbabbabababaaabaaaaa +abaabbaabbbabaabbabaaabbaaabbaaaaabbaaabbaaabbbbbabbaabb +abbbbbabaabaabababababbaaabababbaabbbababbaabaaa +aaabbaabaabaaaabbbbabbbbbabaababaaaaabab +aabbbaabbbbbababaabbbbbbaababbbb +bbababbbaabaaaabbaaaaabbbaababaabbaabaab +aabaababaabbbbbbbabbbbab +aaaaabaababbbabbabbbaabbbbabbaaa +baaaabababbbabbbbaaababbbbbababaaaaaaabb +baaaabaabaaabbaaabbbbbbaabaabbaabbbbbbabbbbbbbbbbabaabababbbbabbaababbbb +bababbabaaabaaaaaaababbbbbabbbaabaaabbbb +bbbbbbbabbabaaabaaaaaaabaabaaabaaaaaaaaababbaaabbaabbaaababaaabbabaaaaaa +abbaaababbbabaabbaaabbab +aabaabbbabaaaababaaabbbabaaaabbbbabbbababbbbabaaaaaababbaaabaabbbbbaabababbaabbb +abaaabaabbabaabbaabbaabaababaaaa +babbabaabaaaaababaaaabba +bbabbbbaaabbbabaaaaabbbb +abbabababbabbbbbaaabaaabaaaaabbaabbabbababbaabbaaabbbabbabbaabbbaabbabaaabaabbab +baabaaabbbbbaabbbaaababa +bbaaabbabbbbabbabbaabbaabaaaaabbabaabbba +babbbabaaabbbaaababababb +abaabbbbbbbbbababaaabbbabbababaaabaaaabababaaaab +bbbbbabbbabbbbbababbabaaabbbaabbbbabbbbbabbabababababaabaaabaaabbaaabaaaaaabbaaa +bababababbbbbbaaaabbbbaabbaaabaababbbbaaabbabbab +ababbaabababaababbbbbabbbbabbababaaabbbabaaaabbbaaaaaaba +abaabababbbbabbbbabbaaab +bbaaaaaaabbababaabbbababbabbbabbbaabaaaabbabbaba +abbbaabbabbabaabbbbbbbaabaaaaabbbbaaaabbbbbbabba +aabbbbbbaaabbaabaababbbababbabaaaaabbaaa +abaabbaaaabababbabbabbabbbaaaaab +babbbababbbbbbbababaaaaa +baabbbbbaabbbaabbabbababbbbbbbbb +bbaaabbbbbbabaabaaaaabaa +bbababaaabbabbabbabbbaaabbabbbab +bbbbabbababbababaababbaa +bbababaabbabaabaabbaabab +aabbbaabbbbaababbabababa +ababaaababbbbaaaabbbbaaaaaababbb +baaaababbbaabaaabbabbbabaababbabbaaaaaaabbaaaaaa +abbbababbaababbbbbaabbbbababbbaabaaababaabaababbbabbbbab +bbabaaabbaabbaaabbbaaabaaaaabbabbaaaabaaabbbbabbbaabbbbbabbabaababaaaaab +bbbbabbabbbbbbaaaaaabbbbabaabababbabbbbbbabaabbaaabbbbbbbbbbaaaa +baababaaaaabbbaaabaabbba +bbbbababbbabbaabbbabaaababbaaaababababaa +aaaaaaaaaaaaaababaaababbabbbabaa +aaabbabababbbaaabaabbbbbababbbbaaabbbabb +aabaaaabbbbbaaaaababbaabaaabbbbabbaaaaaabbababbbaababaaabaabbaabbabaaaaa +aaaabaaabbaabbaaaabbabba +bbbbaaabbaababaaababbabb +abbbbababbbbabbbbbbbababbaabbbbbaaabaabaabababbabaaabaaa +baabbabaabbbaababbabbaba +bbbbaabbbabbabaaaabaaaaababbaababaaabaabbbaaabaaaaababab +abbbbbbababbabbbbaababababbabbabababbbbb +aaabbbabbbbaaaaaabbbabaababababb +aabbaaabaaabaaabbbaaabaaaabbaaaaaaabababbbaabaab +babaababbaabaaaababaaaaa +aaabbbaaaabaabbbaaabbbbb +abaabaabbaabbabaaaabbbbaaabbbbabaabbbabb +baaababbabaaababaaababbababbbbba +aabbaaaabbabaabbbabaaabaaaaaaaabbbbaaaaa +bbbabbbbaabbbbaabbbaaaabbbbaaabb +abaaabababbabababbaabbbabaaabaaaaaaaaaabaabbbaaaaabbbbbbabbabbaaabaaaaaa +bbbbbbbabbabbaabbabbbaaabaabbaaa +bababbabbaabaabbaaabbbbabaabbbbaaabaaabb +bbbbbababaaaaabbabbbbbbabaaaabab +babbabaabbbbaaabaaabbbbaababaabbaabbaabb +ababaabbbbbaaababaabbaaaabbabbbbaaabbaaa +ababbaabbbbbbaaaaaabbbbb +babbabaababbabbabaabbbab +bbaabbaabbbbaabbabbbbbbaabbbaabaaaababbbbaaabbbbbaabbaaa +aabaabbbbabbbbbbabbabbaaabaabababbbbbabbbbaabaaa +abbbbbbaaabbbbaaabbabbbb +aaaaaaaaababbbabaaabbaabababbbba +baaabbaabaaaabaaabaabaaabbaabbbbaaaaaaababaababb +ababbbaababbbbabbabaaaaabababbba +aaaaabaaaaabbbababaaabbbabbbabba +bbbabbbaaaaaaaaaaaabbbbb +abbbbbbabbabbabbabababaa +baaaaabaaaaabaaabbaabbba +baaaabbbaababbbaaaaaaabb +bbbabaabbabbabbbabaabbbbaabbaababaaabaaababaabbb +bbbabbaabbbaabbbbbbabbbabbababababbabbbb +baabaabbbbbaabbaaaababab +bbabbaabbababbabbbabaabbbabbbbbaaaabbabaabbbbbbbababbaba +babbabbaabbaaabbbbabbbbabaaaaaaabbbaaaaa +abaabbaabbbabbbaabbabaaaaababaaaaaaaabbb +aababbabbbabbaabbabaaabbabbabaabbbbaaababbabbaaabbaaaababbbaaabbbaabaabaabababaa +abbabababbaaabbbbaababbaabaabbbbbbbbbbaa +bbbabbbabbabbbbabaaabaaababaaababbbaababbbbabababbabbbabaaabaaaaaabaabbb +baaaaaababbabaabbbabaabaabbbbbabaaababab +baabaabababbbbbabbbbaabaaaaabbbb +baabbabaababbbabbabbbbab +bbbbaabbbbbaaaabbbbbaaaa +bbbbaababaabaaababbbbbaa +bbbbbabbaaabaababbbaaaababaaabba +ababbbabbbbaaaababaaaabbbbaabbbaaaaaababababbbbababbbbbaababbbabaaaaaaababaabbababbbaaaa +aabaababbbbbababbaabbbab +baaaaababbbababbababaaab +baabaabbaaabbaaaabaabbbabbabbbbababbbbab +abbbbbbababbbabaaabababbbbaabbbabbbbababaabaaabb +bbabbabbabbabababaaaabba +abbabbbabbbbbababaaabaaa +bbbbbaabbabbbbaaabaaaaaabbbabbabaabbbabbabbabaaaabaababbbbbaaabb +baaabbbaaabaabaababaabab +baabaababaaaaabaabaabbaababbbbbabaaabbababbaabab +bbabbbbabaaaabaaaabababbabbabaab +babbaababaaaaaabbbaabaab +abaabbabaaabbbabaaaaabbbbbabababbbbaabbabbbabbbbabaaaaab +ababbbabaababababaabaaaa +abaaabaaababbbabbaababaabaabbaab +aaabbbbabbbaabbabbabaabbbaabbbaa +aaabbbaaaabaabaaabbbbbbb +abbbbabbababaabbbbaababbaabaabbbabbbbabbababbbab +baabaabbbbaaaababbabaabbbbabbaaaabbbaaaaaaababaaaabaabbbbbaaaaabbbbaaaaaaaaabbababbabbba +abbaababbbaaaaabbaabbaaa +babbbbabbbaababaaaaaaaaaabbbbaabbbababbbabbaaaaabababbaabaabbaaaaabaabbbaaaaaaaaababbbbbabbaabaa +abbbabababbabaaaababaaaaababbbbaabaabbbababbaabb +abbaaabaaabbabaaababbaab +bbaabbbabaabbbbbabbabbbaaabbaaaabbaaabbbabbaabbababbbbababbaabab +abaaabbbbbabaababbabaaaa +bbababbbbbbababbaaaaaaabbabaaabb +bbbaabbbaabbbbaaabbabbaabaabaabbbababaaa +babbbaaaaabaabbbabbbbbaa +abaabbaabaabbbbbabbbaabbaaabbaaa +abbbaabaababbbabaaaaaaaabbbabbbabbbaabab +aaaabbaabbabbaabbbaababaabbabbbbabaaabbaabbbbbbbaababbbbbbaabbabaabbbaaabbaabbba +abababbabbabbabbbbabbbab +bbbababbaaaabaaabaabbbba +bbbbaababbbbbbabbbbbabbaababaabaaababaab +bbaaaaaaaabbbaaabaaabaab +babbbbbbbbbbbaaabbaaabbaaabbabbaaaabbaaa +abaabbabaaabaababbbaaabb +abaababaaaaaaabbbababaabaaaababaabbabaabababbbba +aaabbabaabaababaababbbba +bbaaaaaababaaababababaaa +abbabaaabaabaaabbabbaaba +abbabababbabaabbabbabababbbaaaaa +aabaaabaababbbaaababaaab +bbabbbbaabaaabbbabbaaaab +bbbbababbbbaaababbbaaaba +bbbbbbababbbbbbaaaaaabab +bbababbbabaaabaabaabbaaaabbbabbabbbbbbaaabbabbbb +baababbbaaabbbaaaabaabbbaabaaabb +abaabbabbaaaabababbaabbb +bbbabaababbbbbbabaabaaabbabbbbbbbbbaabaabbabbbaaabbababb +babbabbbbbbbbabbbaaaababbbbbbbbababababa +baabababaabbaabbaabbabba +baabaababaaaaabbbabaabbbababbbaaabbaaaba +bbbbabbbbaabbbababbbaabaabaabaaaaaaaabaaabbaaaaa +bbabababbaabbabaabbabbaabaababaabaaaabba +abbbbbbaaaaabbaabbbbbaabaabbabbbaabababaaaababbbbabbbbbabaaabbab +bbbbaaabaaaabaaaaabbbaab +aabbaabbaaaaaaaaabbbbababaabababbabbabbbbbbbababaaabaabb +bbabababbabbabbbbaaaabaaaabbaababbbaaaaaabbbaaaa +bbabbabbaaabababbabbbbababaabbabbbbabbbababbaaab +abaaaaaabbbaabaaaabbbbabbababaab +aabababbbabbabbabbaabaaa +ababbbaaaaabbabaaaabbabbaaaaaabb +baaaababbbaaaababbbbbabbbbbaaabaabbabaaabbbbbabaaaaaaaababbbababaabbbbbbaabbbbaa +baabbbbbbbbbaabaabbababb +bababbababaabbbbababaaab +baababbbbabbaabbabbabbaabababbabaaaabbbaabaabaaa +aabaabababaaaabaabababbbbaaabaaaabaaabab +abbaaaaababbabbabaaaabbbbaaaabba +babbbaaabaaaaabbbabbbbab +ababbbabbaabbabaabbbabba +abaabbabaaaabaabbaaabbbbbbbabbaaaaabaabb +bbbaabbaaabbbaabbaabaabaababbaab +ababbbaabbbbbbbabaababaaabbabbabaababaaabbbaaababaabbaab +bbbbbbbabbaaaaaaaaabbbababbbbbbb +aabaaababbabbabaaaaabaaabbabbaabaabbbbbbababaaaa +baabaaabaaabbbabbababbabababbaba +abbbabbbababbabbbbbbaaaababbabbbaaaaaaaaabbaabbabbaaaaabbbabaaaabababbbaaabbabbb +baabaaabbabbababbbbaabbaaaabbaabbbbbabbbabbbaaabbbbabaaa +abaaabbbabaabaaaabbbbbabaaabbbbabababbbbbabbbbabaabaaaaa +aaaaaaaaabaaaababbbaaabababababa +bbbbaabbbababaaaaaaaaaab +aaabaaaabaaaababbabbbbbbaaaabbababbbabaa +babaaababbbbbbbaabbbbabb +baaabbaaaabbbbaabbbababa +baababbbaababbbabbbaabbbbbbbabaaaabbaaab +baaaabaabaabaabbbababbababbbaabbaaabbaabbaaaabba +baabaababbbaabbbabbabababaaaaaaa +bbbababbaabbababaaaaabbb +bbbabaaaaaaaaaaabbbaabbbbabaabbaabaaabbbabbaabbbbabbbbab +aaaaaaabbaababaaaaabaaaababbbaab +abababbaababbbabaabbbbaaaaaabaaaabbaaaba +baababbaaabaabbbbbbaabbabbbbaabbaabbabaabbabbbabaabbabba +abaaabbbbabbbaaabbbbaabaabaabababbaaabbbaabbbbabbababbbabaabbaaabaaabaaa +aabaaabaababbaabbbbbbbabbaaaaabbaaaabbba +aabbabaaabbbbabababbbbbbbaaabbbabaabbaaababbbbabbbbabaaa +abaabbbbbbbbabbbabbaaaaabbaaaaaaabbabbbbabababaa +ababaabbbbbbabaaabbaabba +bbbbababaababaaaaaaabbaabaabaaaa +abbbababbbbbaaababaaaabb +aabbbbbbaababbbaababbbabbaabbabaabaababaaaabaaab +aabaababaaabbbaabbaababababbbaaaabababaa +abaabaabbabbbababbaaaabaabaaabaabaabaabbabbababbaaabaaababaaabba +baaaaabbbbbaaaabbbbbbabb +abbbababbbbbbbbaabbaaaaababbbabbabababbaabaababb +aabbaababbabbaabbbbbaabaaaabbabbababbaba +ababbbaababbbbbabbbabaaa +abaaabbbabababbaabaaabbb +abababbabbabbababbbaabbaababbbaaaabbaaab +abbbbabbbaabaabbbaaaabbbbaaabbbbbbbabbbaababbababbbabbab +bbbbbaabbbaababbabbbaaaababbbabaaaababaaabaabbaa +ababbbaababababaaabaabbbabaaabbbbaabababbabbbbbaababbaaa +baababaabbbabbbbaaabaabb +babaabbbbbaabbbbbbabbabaabbbaaaaabbaabbabbbbaabaabbabbbbbbabbbaa +baabbabaaabbbababbaaaaba +abbbbbabbaaabbbabbaabbaaaabbbbaaaabbabbabaabbbba +aaaaaaabbaaabbbaaaaabbab +baabbbbbbaaabbbbaabbabaaaababbabbbaababaaabbbbbaabaaaaaabaabaabababbbaaa +aabbaaaaabbabaaaabbbbbaa +bbbabaabbbaaaaaaaabbbabaababaaab +babbabaaaaabbbababaaaaaa +baabbabaabaaabbbaabaaaaa +aabbaababbababbbbababaabaabbbbba +abbbbabaaabaaababbbbbaaaaaabaaab +bbbabaabbbbbabbaaababaaa +bbbbbabaabbaaabaaaabbbaaabbbbbbabaabbbaaabbbbbbbbaabbaaa +bbbbaaaabaabaabbbbabbabbbbbbbabaaaaabaaabbabbbbbbaabbbabaaabaabb +bbbbbaaabbbbabaabbabbbbbbaabaaabbabbbbbaabbbabbaabbbbbaa +aaabbbabbabbabbbbabaaaaaabbbbbaaaaababaaaaaaabbaabbabababababaaabbbababaabbaaaabbaaabaaababbaabb +abbaaaaaabbababaaababababaaaaabbaaabbaaa +aaaabaaaaabbabaaaaaabbaa +bbbbbbbabaababbbbbbbaaaabbbbbaab +ababaaaababbabbabbbababaabbaaabbabbbbbbbaabbababbbabbaba +bbbbbbbaaaaaababbaabbaaaaaababbbabaaabab +baabbbaaaaabbbbabbababbaaaaababaabbababaaaabbbbbbbbaaaababbbbbaababaaabb +bbbabbbaaabbbaabaaababbaaaabbaaa +baabaababbbbbaaabbbbabaaaabbabbaaaabaabb +abbbaabbabbabbabbbbaabbbbbabbbab +babbabaaabbabbbabaababaabbabaaba +baababbbbaaaabaaabbbaabbbbbaaaaa +bbaababbaaabbbbabbbabaaa +babababaaabbababbbbbabbbbbbababbabbbabbaaabbabbbabbaaaabbabbbabbaabbaaba +bbbbaaaabaaaaaaabbaaabaabaaaababaabaababbbbabababbabbbbaabbaaaabbbbaaababbbabbababaababb +babaaabbaabaaabbbabbbaabaaaabbbaaaaaabababababbabbababba +aaaabaaabbabaaabaabbbaaabbbbabaa +abbababaabaabbaabbbababbbbabbbbbaabbaaaaaaaabbabaaababbbbbabbbaa +aababbbababbabaabbbbabbaaabaaababbbbabababaaabaaaababaaaaabbaaab +ababbbaaaababbbaabbbbabaabaaabaabbbaabbaabbbbbaabbbaaaaabaabbabb +bbbabbaabaabababaabbababaababaaa +aaaaaaabbbbbbbabbabaabaa +abaabaaaaabbaaaabbbbaabaaabaabaabbbaabaa +aabbabaabaaabbaaaaaabbbb +abbabbaabaabababaabbbaabbbbbaababbbbabbbabbbaaab +abbaaabbabaaaabaaaaaabaaaababbbbbaabaaabaaabaabbbbabbabbbbbaaabababbabbabbbbbaaa +abaaabbbbabaaaaaabbaaababaaaaabaababbaababaabaaaabaaaaabbbaaaaab +aababababbbbbbbaabaabbabbbbbbaaaabbbaaaa +aabbaabaaabbaaaaaabaababaabbbbab +aabaaababbaaaaaabbababababaaaaabbababaab +baababaababbabbbabbaabaababbaabbaabaabbabbbbbaab +abaaabaaaaabbbaaabbababababbbabaaababaaa +aabaaababbbbbabbbaabbabb +aaabbabbaaabbbaabbbbbbababbababb +aabaaaabaabbbbaaaaaabaaabbaabbbaabbbbbbb +bbbbabaaaabbababbbabaaabbabaabba +baabaabaaabababababbabbbbbababaaaaababab +aabbbaaaaabbbbaaababbaaaababbbbaababaaaabbbabaab +abbaaabbbaabbbbabababbbabaabbbbaaabbabaabbaaaaba +aaaaaaabbbabaabbaabbbabaabbababaabbbbbbaabbbbaaaabababaaaaaabbbbaabbabba +abbbbabaabaabaabbbabbbbaabbbbabaabababbbbbaabbabbaabaaaa +abaabababbbbbabbbabaaaab +bababbabbbbabaaabbaaaabb +abbabaaabbbababbbbbaabbaaabbbbaababbaaba +bbbbaabaaabbbbbbabaabaaaaabaababbabbabbbabaaabab +babbabbbbbbabbaabbbabaabbbbbbbbb +babaabaaababbbbaabaabbbaababaaabbbabbbaaaaaaaaaabaababbbbaabbaaa +bbbbaabaabbabbaaabaabaaababababa +abbaababbbbabbabaabbbbbaababaaabaaabbbaaabaababbbbbaabaa +aabbaaaabbbbababaaaabbab +aabaababbabbbabaaabababaabaaabbaabaaaabb +bbabbabbbbaabbbbabaabaaaaaaaaaababaaabba +aaababbaabababaabababaaababaabaaabaaaabb +baaabbbabbaaaaabbaabbbab +bababaabbabbbababaaaababbabbaabbbbbaababbabbabbb +bbababaaabbbaabbaaabbbabaaabbbaabbbaaaaa +aabbbbaaabbbbbabaabaaababbaabbaaaabbbbbaabaaababbbbaabab +aaaaaaabaaaababbabababbaaababaabaabaaaaaabbaaaaaabaabbbaaaaabaaa +abaabbbbbbbabbaaaababbab +bbaaaaaaababaabbbaabaaabaababaaa +aabbbababaabababbabbbaab +abaabbbbbbaaaaaabbbbbbbabbbbabbbbabbaabb +aabbbbaabbababaabababbba +bababbabaaaabaaabaababaaaaaaaabb +bbbbaababbbabbaabbaabbaaabbbaabbbbabbaabaaaaaabb +bbbbabbabbbbaabaaaabaaaabaaaaabbaaabbbbaabaabbbaaabaaaaaabbaabbb +abbabaaabbaababbaabaaabbbbabbaabbbaabbbb +bbaaabbabbbbbababababaababaaaaaababaaaaaaabbbbab +aababbbaabbbbabaabbabaab +bbbaabbbaaaaabaabbaaaaab +bbabbabbbbaaabbbbbaaaaaababaabbaababbabbabaabbbabbaaaabb +aaabbabaaabaabbbbbaababbbaaaaaababbabaab +abbabbabbbaabbaabbaaabaa +abaabbabaaaabaaaaaaaabab +abbbbaabaabbabbbaabaaabbbaaaaaaa +abbabbaaaababbbabbabbababbaababaabbabaabbbbaaabb +aabaaaaabbbababbbaaababbabbbbababababaaabbabbbba +aaabbabababbbababbbaabbbbaabbbbaaababaaa +aabababbaaabaaaabbababaaaaaababb +abbaaaaaabababbaabaabaababbaaababaababbbaaaababbbabbaaabaabbabbaabbaabba +bbaaaabaaaabbaabbbaaaabaababbbbb +ababbbabbaababbbabaabaababbbababbbaabbaaabaababbabaaaaab +aabaaabaababaabaababaaaa +baabbbbbbaaaaabbbaabbbaa +abbabbabbabbabbbabbbbabaabbbabbb +ababbaabaabbababbbbababbbbbbabaabbabbbabbabbbbaa +bbbabaabbababbabbbabbbaa +aabaabbbaaabbababaabaaababababbbaabababbabaabbbabaaabaabbababbba +abaabaabababaababaabbabb +bbaabbbaaaabbbabaaababaa +bbbbabbbaabbaaaaabaaabba +baaaabbbbbbbaaabbaaaaabbabaabbabaabaabbbbaabbbabaababbaa +bbabaabbbaababbabbaabbaaaaabbbababaabbbaaaaabbab +babaaababbbabbbbabaabaaababaabbb +baaabbaabaaaabaaaaabaabaaaaabaaaaaabababababaaab +bbbbbabbbbaaaaaabaababbababbaaaaabbaabbb +abaaabbbabbbaabbbaaabaab +bbbabbaaaaabaabaaabababaaaabbbabbbbbabbbaababaab +bbbbabbbbaabbabbaabbbbbbabaaababbbbaaabaaaaabaabaabbaaab +baaaabbaaaaababbbbaaaaabbbbbbbaababbbabb +bbaabbbaababbaabbabbabababbbaababaabaaaa +bbbabbbbbaaaabbbabbbbbbaabaabbabbababaab +baababbbaabaabaabbaababaabaaabbbbbbababbbaaaabba +babbabababbbbbabababbbba +aabbbaaabbaaabbaabaaabab +bbbbbbbaabaaabaabbbbbabaabaababbabbabaab +bbaabbbbaaabbaababaaabbabababbbaaaabababbababaaaaabaaaab +babbbabaaabbabaaaabbbaabbabaabab +bbaaaabaaaaaaabbababbaaaababbbbbabaabaaababbabbbabbaaaaaaaaaababaaabbabbbbbbabaa +ababaabbaabbaaaabaaaaabbababbbba +baaaababbbbbaabbbaaabaaa +aababababbbaabbabbaabbbb +baababbaaaabbabbababbaba +babbabaabbbbbbbaaabbbabb +bbbbbbabbbbbbbabbbbbbabbabaaaabb +bbbaabbbbbbbbababababbbb +aabbaaaabbabbabbbbbaabaa +bbababababbbbaabaaabaababbbbaaabaaaabbab +ababbaabaabbbaababbbaababbabbabbaaabbababaabbaabababaaaaaabaaaaa +aabaababbabbbaaaabababbaaaaabbab +abbaaabbaabbaababbbabbbaababaaaa +aabaabaabbbbbabbaabbaabaaabaabaabaabaabbaaaabaaababbaabb +aabaaaabbbbbaaaabaaabbbbbbbbaaabababaaabababbaabbbaabaabaababbaabaaaabab +bbbabbabaaabaaaabababbaabaaabbbabbaabbba +bbaaaabababbbbaabaaabbaababbabbaaabbbababaaaabaaabbbbbbb +bbaabbaaaaaaabaaaaabbbbabbbbbabbbaabaabaaabbbabb +bbaabbbaabbaaaaaaaabaabababababbaabaaaaa +babbababbaabaababaababbabbbbbbabbbbbaabbbaabbbbbbabaabab +ababaabbaabbbaabaaaabbba +aaaabaaaabbabbbabbbbababbbaabbab +aaabaaaaaaabbabaaaaaabbb +bbbbabbaababbaabbbabbabbabaaaabbabaaabba +ababbaabbbabbbbbaaaabbba +abbbbabaaabbbaabbbbaaaabababaaaa +aaabaabaaabbbbbbaaabaababbabbabbbbbabbab +aaabaababaaaaaabbababbabbabaabbaabababbabaabaabaaaababbabbaabbaa +baaabbbabbabbaababbbaaab +aabbabababaabbabaaaaaaba +aabbbabaabbaaaaaaababbaa +bbbbbbabbaaaabaaabbabbabbaaaababbbababaa +aababababaaaaabbaaaaabaabbabbabbabbbabba +bbbbaaababbbbabaabbbaaaa +babababbbabababaabaabbabbbbbbbbbaaaabbaaaababababbabaaab +abaaabbbaabbbaabbbbaaaba +aabbaabbbabaaabaabbabaaabbbbbaba +bbbbaaabaaabaabaababbaabbbababbbabaaabbbabbaabaababaabababbbbabbbababbba +abaaabbbaabbaabbabbabbbabbbaaaaabaaabaabbbbbaabbaaabbbbaabababab +bbabbbbaaabbbabaababbbaaababaabb +aabababbbaabbabaaaaaabab +abaababaabbababaaabbaabbbbbaabbaaaaababa +aaabbbabaababbbabbbaaaabbabbbbaabaaabaaa
\ No newline at end of file diff --git a/2020/19/puzzle-1.py b/2020/19/puzzle-1.py new file mode 100755 index 0000000..8ca7eb2 --- /dev/null +++ b/2020/19/puzzle-1.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 + +from collections import OrderedDict + + +def main() -> None: + with open("input", "r") as f: + data = f.readlines() + + i = 0 + rules: list[tuple[str]] = [] + while data[i] != "\n": + rules.append(tuple(x for x in tuple(data[i].split(": ")))) + i += 1 + + tests: list[str] = [] + for line in data: + tests.append(line.strip()) + + patterns: dict[str, list[str]] = {} + + # Get "a" and "b" out of the way to do less comparisons in the next loop. Also make use of + # this loop to strip newlines off of all the rules. + for rule in rules: + rules[rules.index(rule)] = (rule[0], rule[1].strip()) + if len(rule[1]) == 4: + patterns[rule[0]] = [rule[1][1]] + + while len(patterns) != len(rules): + for rule in rules: + if rule[0] in patterns: + continue + + res = rule[1].split(" | ") + req_rules = list(OrderedDict.fromkeys(" ".join(res).split(" "))) + all_in = True + for req in req_rules: + if req not in patterns: + all_in = False + break + if all_in == True: + all_combos: list[str] = [] + for re in res: + re = re.split(" ") + if len(re) == 1: + all_combos.extend(patterns[re[0]]) + else: + for x in patterns[re[0]]: + for y in patterns[re[1]]: + all_combos.append(f"{x}{y}") + all_combos = list(OrderedDict.fromkeys(all_combos)) + + patterns[rule[0]] = all_combos + + print(len([test for test in tests if test in patterns["0"]])) + + +if __name__ == "__main__": + main() diff --git a/2020/19/puzzle-2.py b/2020/19/puzzle-2.py new file mode 100755 index 0000000..b0efe15 --- /dev/null +++ b/2020/19/puzzle-2.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python3 + +from collections import OrderedDict +from re import search + + +def check(test: str, patterns: dict[str, list[str]]) -> bool: + chunks = string_divide(test, 8) + search_str = "" + + for chunk in chunks: + if chunk in patterns["42"]: + search_str += "0" + elif chunk in patterns["31"]: + search_str += "1" + else: + return False + + # 42 = 0, 31 = 1 + res = search(r"^(0)+(1)+$", search_str) + return not (not res or search_str.count("0") <= search_str.count("1")) + + +def string_divide(string: str, div: int) -> list[str]: + l: list[str] = [] + for i in range(0, len(string), div): + l.append(string[i : i + div]) + return l + + +def main() -> None: + with open("input", "r") as f: + data = f.readlines() + + i = 0 + rules: list[tuple[str]] = [] + while data[i] != "\n": + rules.append(tuple(x for x in tuple(data[i].split(": ")))) + i += 1 + + tests: list[str] = [] + for line in data: + tests.append(line.strip()) + + patterns: dict[str, list[str]] = {} + + # Get "a" and "b" out of the way to do less comparisons in the next loop. Also make use of + # this loop to strip newlines off of all the rules. + for rule in rules: + rules[rules.index(rule)] = (rule[0], rule[1].strip()) + if len(rule[1]) == 4: + patterns[rule[0]] = [rule[1][1]] + + while len(patterns) != len(rules): + for rule in rules: + if rule[0] in patterns: + continue + + res = rule[1].split(" | ") + req_rules = list(OrderedDict.fromkeys(" ".join(res).split(" "))) + all_in = True + for req in req_rules: + if req not in patterns: + all_in = False + break + if all_in == True: + all_combos: list[str] = [] + for re in res: + re = re.split(" ") + if len(re) == 1: + all_combos.extend(patterns[re[0]]) + else: + for x in patterns[re[0]]: + for y in patterns[re[1]]: + all_combos.append(f"{x}{y}") + all_combos = list(OrderedDict.fromkeys(all_combos)) + + patterns[rule[0]] = all_combos + + print(len([test for test in tests if check(test, patterns)])) + + +if __name__ == "__main__": + main() @@ -0,0 +1,14 @@ +BSD Zero Clause License + +Copyright (c) 2021 Thomas Voss + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. |