Compare commits

...

10 Commits

Author SHA1 Message Date
Petra 14ecdadb1c Update readme 2023-12-08 20:27:35 +13:00
Petra 76d31619cc 2023 Day 8 part 2 2023-12-08 19:09:33 +13:00
Petra 490a9c7b7e 2023 Day 8 part 1 2023-12-08 18:23:21 +13:00
Petra ea9ed0eead Create a template for easier program creation 2023-12-08 17:44:02 +13:00
Petra a786488bca 2023 day 7 2023-12-07 21:35:48 +13:00
Petra 36325259ba 2023 Day 6 2023-12-07 19:44:52 +13:00
Petra 5c5dba9198 fmt 2023-12-06 21:23:56 +13:00
Petra 6fbf94efc8 Finish 2023 day 5 2023-12-06 21:18:01 +13:00
Petra 2caad038bc 2023 day 5 part a 2023-12-05 20:50:28 +13:00
Petra 6a7cd24b23 2023 Day 4 2023-12-04 19:07:09 +13:00
24 changed files with 3347 additions and 1 deletions

View File

@ -2,7 +2,7 @@ FC:=gfortran
FFLAGS:=-Wall -Wno-maybe-uninitialized FFLAGS:=-Wall -Wno-maybe-uninitialized
BIN:=./bin BIN:=./bin
SRC:=./src SRC:=./src
BINS:=./bin/day01.bin ./bin/day01b.bin ./bin/day02.bin ./bin/day03.bin BINS:=./bin/day01.bin ./bin/day01b.bin ./bin/day02.bin ./bin/day03.bin ./bin/day04.bin ./bin/day05.bin ./bin/day05b.bin ./bin/day06.bin ./bin/day07.bin ./bin/day07b.bin ./bin/day08.bin ./bin/day08b.bin
all: aoc19 all: aoc19

203
2023/data/day04.txt 100644
View File

@ -0,0 +1,203 @@
Card 1: 27 61 49 69 58 44 2 29 39 10 | 97 96 49 78 26 58 27 77 69 9 39 88 53 10 2 29 61 62 48 87 18 44 74 34 11
Card 2: 65 22 99 75 72 29 38 82 80 66 | 87 15 21 50 55 72 4 54 46 29 95 2 65 75 18 89 99 80 38 82 56 33 22 66 71
Card 3: 27 95 96 34 14 42 40 60 50 93 | 35 95 22 34 50 27 29 77 78 4 5 61 93 8 59 63 16 45 80 81 92 23 42 88 82
Card 4: 58 73 96 88 51 32 1 40 19 85 | 93 72 7 85 52 51 2 96 40 90 32 57 89 12 88 44 19 53 58 78 73 25 50 1 84
Card 5: 69 52 10 51 73 47 22 84 36 8 | 40 84 69 32 73 33 98 76 51 22 10 97 36 52 68 8 43 93 29 44 85 13 26 47 77
Card 6: 39 57 46 20 17 67 10 77 90 99 | 73 26 60 41 77 61 96 25 59 94 22 5 55 95 14 33 62 15 7 75 86 93 74 32 42
Card 7: 7 25 29 75 24 19 78 77 18 8 | 77 80 54 85 4 66 12 82 23 17 53 20 91 32 94 59 9 6 3 97 8 55 60 11 36
Card 8: 14 82 46 78 3 64 62 69 92 6 | 87 14 88 92 48 64 52 83 37 29 56 3 86 27 6 62 1 13 82 78 69 25 15 31 46
Card 9: 53 43 10 8 47 41 67 95 90 11 | 10 3 71 67 54 59 24 25 53 70 43 7 93 41 85 42 26 98 8 13 87 99 11 58 2
Card 10: 72 45 30 67 14 98 15 27 62 66 | 36 59 90 14 98 66 45 26 97 76 62 58 67 33 64 39 22 15 30 68 27 41 24 7 72
Card 11: 45 3 18 55 42 83 79 37 30 49 | 88 97 34 71 74 14 53 79 50 18 55 60 72 28 3 19 30 63 1 90 49 32 86 70 37
Card 12: 94 10 20 82 41 84 40 71 33 3 | 48 19 94 87 56 64 16 20 4 95 31 36 37 40 57 39 18 14 46 82 47 1 3 23 83
Card 13: 5 27 33 28 51 14 99 68 38 65 | 2 27 14 39 41 51 69 77 38 28 15 5 65 11 57 97 76 34 99 87 31 46 68 33 16
Card 14: 94 37 74 54 72 20 22 53 70 59 | 26 25 96 10 20 21 5 52 72 85 37 73 22 56 94 23 59 84 34 54 44 27 70 92 76
Card 15: 6 7 59 98 17 34 15 97 72 45 | 48 50 77 6 35 7 86 17 1 27 59 54 44 97 47 72 3 34 12 37 15 69 49 64 80
Card 16: 35 27 20 21 94 40 80 4 53 34 | 1 80 22 16 97 96 87 55 93 70 13 95 76 24 41 85 83 46 67 68 79 98 48 25 86
Card 17: 3 48 35 96 80 15 54 16 67 92 | 94 96 34 38 57 1 67 41 9 60 80 54 15 85 4 21 75 59 66 81 84 43 48 23 3
Card 18: 34 59 22 95 30 44 91 57 78 53 | 82 47 55 36 67 7 59 25 84 70 37 49 77 20 88 97 98 61 44 46 54 4 86 11 58
Card 19: 31 19 44 79 94 29 18 90 3 54 | 60 76 7 48 87 36 31 57 11 21 94 20 62 53 66 39 72 85 17 63 49 24 79 37 68
Card 20: 37 33 5 55 69 42 96 91 50 49 | 19 60 46 35 57 39 7 5 86 4 73 84 28 20 81 87 18 61 29 56 68 42 27 64 38
Card 21: 23 95 53 13 56 62 76 64 98 63 | 36 20 61 21 67 14 82 44 59 97 56 9 47 93 63 18 16 46 25 87 19 88 85 95 29
Card 22: 70 84 58 75 23 68 35 39 31 22 | 49 13 6 12 24 83 97 76 43 57 65 42 98 16 54 15 91 44 55 90 81 9 36 2 27
Card 23: 61 4 42 33 21 94 67 86 91 66 | 81 34 17 92 97 12 50 69 19 63 68 44 80 72 83 95 10 31 42 75 5 74 60 9 24
Card 24: 1 31 21 84 98 51 2 6 86 53 | 95 23 99 47 9 57 7 27 36 89 24 77 46 39 25 78 17 14 16 87 73 61 90 32 5
Card 25: 54 19 59 74 58 36 46 39 31 27 | 54 42 46 56 59 45 39 79 19 88 27 91 74 38 48 15 36 31 73 35 64 60 62 58 78
Card 26: 83 26 43 71 24 22 93 94 10 6 | 94 76 93 22 8 85 62 24 40 79 31 97 64 71 10 87 26 83 58 28 43 6 44 3 54
Card 27: 47 73 50 11 5 55 46 97 8 84 | 41 75 97 8 23 15 26 86 42 98 43 47 49 62 11 9 69 92 88 5 73 18 76 93 22
Card 28: 60 6 84 1 90 4 45 25 44 30 | 65 13 69 61 91 50 89 88 71 36 21 5 86 10 41 28 59 47 79 98 14 78 7 25 54
Card 29: 65 16 91 46 52 7 1 41 49 32 | 10 6 32 53 12 43 62 50 37 49 66 3 97 16 72 57 81 86 91 46 89 52 71 82 14
Card 30: 94 63 59 54 49 17 68 84 91 64 | 37 91 13 24 14 73 96 1 90 87 2 66 5 74 34 93 41 48 79 6 33 16 40 49 64
Card 31: 34 6 27 31 92 2 25 13 5 83 | 92 2 20 11 34 48 13 25 39 87 10 16 12 15 83 57 22 76 51 55 6 5 74 38 31
Card 32: 3 67 34 83 26 14 47 32 42 15 | 30 79 62 25 63 41 53 84 40 8 94 44 9 54 93 18 77 95 59 37 86 50 51 17 87
Card 33: 65 88 76 95 94 71 22 99 66 60 | 7 81 32 62 5 99 69 55 19 74 96 20 36 40 84 51 8 39 48 3 93 6 98 46 41
Card 34: 50 25 13 64 95 62 24 5 7 85 | 15 13 43 65 55 2 99 27 24 42 82 64 77 21 41 85 72 62 52 89 81 96 61 95 10
Card 35: 33 11 79 32 91 86 12 39 5 71 | 5 91 62 16 29 82 88 2 51 80 17 99 38 58 36 12 81 43 6 49 42 37 35 46 47
Card 36: 48 60 23 73 91 80 17 57 12 85 | 23 11 98 10 89 15 26 3 91 43 33 27 77 80 90 45 28 81 75 29 69 16 60 96 86
Card 37: 64 82 14 98 90 74 57 60 54 45 | 30 49 57 3 46 11 64 97 6 47 41 77 82 94 15 29 61 48 75 89 21 23 78 55 33
Card 38: 25 18 35 45 98 72 47 83 64 16 | 8 58 86 29 33 37 71 87 4 25 31 89 24 63 36 16 73 93 48 65 67 91 75 60 13
Card 39: 88 36 73 50 12 61 8 4 45 53 | 35 31 97 68 41 10 52 38 7 49 50 3 23 25 21 13 90 75 47 73 27 2 9 48 77
Card 40: 15 60 33 4 31 87 54 13 18 47 | 71 42 36 49 37 14 9 22 1 97 16 53 45 10 32 52 79 63 66 83 25 57 82 99 77
Card 41: 96 67 69 23 6 24 77 81 32 13 | 58 78 54 26 50 62 49 17 38 85 89 90 25 5 51 91 52 53 65 44 93 12 8 98 73
Card 42: 93 53 56 41 39 13 54 20 96 66 | 65 81 30 90 95 74 51 85 41 86 13 22 78 46 62 35 87 57 21 5 83 10 7 55 69
Card 43: 49 29 51 42 62 46 44 65 92 47 | 46 47 49 42 92 54 12 68 29 3 81 51 64 44 17 1 62 23 56 87 65 85 70 6 32
Card 44: 68 21 97 69 99 31 67 5 7 88 | 48 80 41 69 13 63 23 59 9 54 6 85 35 91 46 2 60 64 29 25 89 28 61 37 95
Card 45: 57 39 86 33 23 96 69 46 40 83 | 8 93 40 72 43 85 33 70 15 52 3 27 89 25 75 23 86 83 42 88 97 73 80 96 47
Card 46: 64 3 77 80 20 63 30 99 26 85 | 99 26 81 82 20 63 65 67 77 83 64 34 45 33 40 97 7 80 60 92 12 90 6 71 85
Card 47: 94 44 75 30 86 26 45 69 89 38 | 27 50 10 12 16 32 30 45 89 37 20 43 39 7 44 86 38 87 26 9 22 79 11 35 53
Card 48: 53 35 32 39 21 17 95 79 76 5 | 21 14 32 39 43 35 70 99 46 86 71 40 50 64 11 60 92 93 5 72 83 18 95 53 34
Card 49: 23 7 72 99 49 95 63 20 44 88 | 47 20 74 27 88 82 91 52 49 46 92 72 13 12 80 7 75 9 99 39 23 4 31 95 84
Card 50: 85 34 33 69 60 87 99 51 71 14 | 18 23 33 48 66 6 56 68 26 35 41 71 45 64 20 19 2 92 74 39 46 32 31 17 21
Card 51: 59 26 52 31 47 96 25 36 63 67 | 35 18 56 71 90 84 47 66 63 96 7 10 3 50 32 70 94 49 62 74 46 33 60 93 9
Card 52: 21 80 84 6 95 8 98 4 91 55 | 79 36 18 85 86 10 32 70 30 91 66 69 34 49 98 23 4 55 22 81 83 38 52 3 99
Card 53: 30 40 10 21 29 58 31 85 2 61 | 92 3 91 33 19 32 42 21 76 95 93 94 82 67 18 63 25 62 20 99 30 54 72 78 74
Card 54: 2 5 33 40 32 27 36 61 89 13 | 40 83 80 32 14 23 55 49 74 45 71 82 6 13 76 35 72 28 98 29 11 24 2 86 53
Card 55: 95 33 11 78 50 89 27 4 35 32 | 58 14 4 57 59 10 65 29 85 71 9 51 17 49 98 25 7 31 97 15 36 80 79 1 22
Card 56: 11 2 50 52 4 38 60 78 68 26 | 65 23 57 37 44 47 28 75 32 22 66 67 58 53 99 59 89 70 19 64 54 1 18 82 71
Card 57: 35 87 26 17 27 58 99 75 79 90 | 78 19 59 98 83 69 29 86 23 45 61 21 41 34 66 15 94 4 22 12 89 71 73 92 65
Card 58: 25 60 78 79 27 86 77 3 37 75 | 43 99 62 82 88 44 51 59 21 73 39 30 11 38 29 16 87 8 33 95 13 14 32 10 23
Card 59: 53 93 58 1 28 27 64 34 76 20 | 16 53 69 63 56 51 90 95 34 37 1 77 93 27 45 17 64 12 84 58 13 76 28 6 20
Card 60: 5 23 68 9 38 12 10 97 70 82 | 43 60 21 95 14 69 61 74 22 40 33 49 17 84 4 24 13 19 1 57 62 37 92 45 72
Card 61: 39 98 85 63 87 5 91 61 57 74 | 33 39 61 54 87 37 13 69 57 85 98 7 83 5 91 97 50 63 74 20 26 30 71 56 23
Card 62: 62 85 77 98 66 84 69 16 24 83 | 78 66 46 58 12 31 29 92 77 85 59 24 83 84 43 69 62 96 16 81 98 32 35 3 1
Card 63: 54 56 39 78 46 26 36 65 61 33 | 53 78 36 25 16 31 30 10 90 46 9 62 80 61 29 76 18 91 51 8 74 58 54 65 70
Card 64: 8 97 74 12 13 83 23 6 40 69 | 30 85 50 69 40 83 36 4 13 88 12 97 67 55 71 64 65 38 8 91 74 56 23 52 6
Card 65: 29 38 74 28 88 34 8 1 44 73 | 34 28 41 27 73 9 95 65 35 46 15 80 21 72 68 64 26 43 47 1 29 74 8 31 76
Card 66: 19 86 49 80 95 54 1 41 24 77 | 11 41 54 65 86 20 9 45 16 55 6 80 60 5 58 76 24 49 38 77 34 1 82 19 95
Card 67: 14 10 60 4 5 77 82 94 9 24 | 48 19 99 73 89 78 43 26 62 28 71 96 38 57 7 68 63 60 10 85 93 50 5 41 76
Card 68: 27 70 37 12 51 73 99 47 33 32 | 43 9 38 8 65 73 82 42 17 84 55 46 31 35 44 49 95 62 52 10 14 25 66 37 92
Card 69: 90 69 60 85 34 56 72 16 20 35 | 13 90 42 65 72 56 39 34 20 59 28 92 40 69 32 85 16 93 79 97 35 98 5 60 26
Card 70: 23 98 49 33 51 58 47 7 70 32 | 69 85 66 86 32 58 28 23 47 51 48 3 52 87 7 16 92 25 75 89 33 39 14 90 70
Card 71: 70 84 44 96 76 49 34 93 87 14 | 59 14 19 67 17 28 5 56 37 52 6 18 2 44 8 63 82 57 66 34 91 73 16 54 97
Card 72: 77 48 90 12 62 14 73 51 7 10 | 76 54 70 56 78 65 25 18 2 42 26 61 36 1 13 58 92 27 47 90 4 3 28 39 72
Card 73: 89 29 6 91 49 99 2 27 75 36 | 22 67 98 35 71 1 99 9 33 78 97 19 73 46 47 57 90 15 92 10 12 69 7 62 95
Card 74: 38 74 32 85 47 41 87 59 61 73 | 28 68 34 40 61 1 21 42 8 90 51 82 77 3 80 71 67 87 41 45 92 64 70 13 2
Card 75: 1 41 81 26 87 15 63 16 83 67 | 64 83 11 34 7 36 37 15 4 52 87 50 24 21 26 41 94 70 67 43 99 12 20 55 51
Card 76: 62 94 6 8 2 40 43 42 46 53 | 59 80 8 99 26 48 23 38 15 24 61 27 46 70 93 94 11 81 42 74 67 89 12 6 53
Card 77: 17 15 62 90 77 30 5 97 59 10 | 6 53 67 83 63 44 43 25 11 20 41 70 39 69 97 93 5 92 51 37 23 19 65 71 56
Card 78: 14 27 34 77 78 25 94 93 70 80 | 89 1 38 45 15 18 14 86 81 8 87 60 21 40 12 85 70 97 73 76 62 94 23 20 75
Card 79: 87 22 38 56 58 10 94 19 68 83 | 8 76 58 87 34 52 30 32 9 55 71 97 50 6 33 22 51 11 88 44 47 42 5 41 27
Card 80: 53 88 71 44 3 43 64 93 83 37 | 34 65 18 47 82 96 99 38 4 20 74 12 45 59 43 35 84 29 46 39 98 33 8 17 50
Card 81: 49 78 31 83 35 16 46 43 25 12 | 94 74 28 54 67 21 16 30 7 86 93 6 95 26 80 10 55 5 1 85 79 58 18 51 72
Card 82: 80 17 56 49 97 9 94 2 53 65 | 75 31 62 92 48 40 32 19 27 21 39 57 5 10 8 70 83 52 89 76 51 38 13 88 98
Card 83: 8 64 56 30 93 73 40 7 27 24 | 38 76 27 25 40 83 42 17 55 89 34 7 5 39 93 74 37 29 51 3 19 1 18 30 52
Card 84: 50 4 99 75 59 57 96 61 46 6 | 51 46 4 53 27 63 30 68 76 61 99 75 15 13 6 20 96 36 59 50 26 62 25 57 52
Card 85: 14 82 80 7 4 59 31 15 21 23 | 15 98 45 25 4 9 23 30 14 75 59 80 35 46 82 76 31 81 21 7 11 69 91 96 49
Card 86: 99 17 2 89 42 19 3 94 4 12 | 17 94 34 47 64 57 19 77 96 42 2 33 99 73 63 89 41 32 15 56 4 12 98 3 39
Card 87: 43 60 77 76 78 19 51 99 39 57 | 49 26 8 1 92 70 61 54 16 98 37 32 44 43 51 9 6 30 66 74 75 72 14 40 3
Card 88: 24 22 59 84 72 98 92 75 52 82 | 80 56 85 37 68 71 62 4 38 84 22 16 98 75 23 52 64 59 92 72 29 24 82 93 50
Card 89: 79 5 64 69 73 95 74 49 56 47 | 47 49 61 93 6 69 85 42 5 88 66 59 19 96 72 95 26 84 9 44 79 92 25 73 1
Card 90: 67 63 84 5 13 81 38 78 9 2 | 97 53 90 13 29 38 62 46 83 70 33 47 45 99 54 65 81 11 61 82 26 91 27 88 22
Card 91: 39 72 25 54 90 11 79 42 4 14 | 53 83 63 25 34 11 13 78 2 15 42 62 7 28 72 91 38 54 37 75 71 5 20 14 59
Card 92: 46 70 28 3 20 9 45 32 77 14 | 85 79 49 45 64 78 33 9 53 36 96 28 29 21 50 80 27 87 22 3 31 73 14 32 2
Card 93: 81 59 32 19 80 13 78 70 65 38 | 32 14 23 73 65 81 56 26 50 70 19 59 27 15 17 13 48 38 53 3 77 16 80 78 36
Card 94: 86 53 49 85 95 70 27 32 4 24 | 41 84 58 73 4 13 88 55 94 46 90 6 50 65 21 53 97 14 10 44 69 59 56 79 68
Card 95: 59 99 76 63 47 4 8 67 23 96 | 69 9 21 8 47 75 44 29 4 12 88 38 11 13 23 85 6 18 97 2 34 1 17 32 16
Card 96: 82 97 72 34 28 52 78 80 20 92 | 56 83 32 84 21 74 25 24 61 23 88 66 94 1 29 73 35 70 57 11 81 26 60 63 58
Card 97: 34 76 39 38 23 51 55 25 40 22 | 91 43 59 66 40 3 45 24 56 96 98 73 29 71 30 1 50 46 78 8 11 9 27 64 26
Card 98: 66 42 1 45 92 32 71 88 5 82 | 50 88 42 70 60 6 27 49 36 1 35 53 82 14 71 77 5 7 78 48 31 81 52 92 45
Card 99: 12 2 77 94 59 98 95 10 39 32 | 76 88 5 12 45 55 27 17 11 98 10 87 97 99 20 78 46 4 96 26 14 82 22 39 16
Card 100: 22 96 56 41 90 47 29 58 87 32 | 15 65 80 82 49 24 33 85 20 74 70 54 50 12 78 47 28 9 32 16 67 71 99 1 17
Card 101: 1 23 74 4 72 26 75 68 89 83 | 83 58 63 1 52 20 26 33 64 41 53 65 57 80 69 38 4 90 74 39 32 13 61 55 14
Card 102: 75 14 28 46 23 36 68 71 70 98 | 19 33 54 4 5 8 41 6 14 88 46 3 62 10 48 7 77 92 16 39 40 27 31 99 1
Card 103: 65 33 61 53 51 29 26 83 19 18 | 7 2 82 55 13 22 6 27 90 99 14 50 79 25 63 46 97 81 85 61 87 28 75 31 96
Card 104: 51 87 57 78 60 94 82 12 88 11 | 72 78 77 70 54 39 55 24 86 18 58 52 20 63 29 33 31 97 66 69 62 6 56 25 35
Card 105: 17 55 95 42 16 52 72 9 79 59 | 98 30 35 20 46 43 51 66 75 48 52 44 34 96 65 37 41 50 74 21 38 18 73 10 76
Card 106: 44 91 36 94 24 31 83 50 70 52 | 18 38 42 17 12 56 64 32 79 76 39 73 60 80 53 57 96 88 82 77 4 69 23 45 7
Card 107: 45 48 58 26 5 2 35 63 78 70 | 49 71 10 21 50 13 95 6 68 84 4 40 45 31 1 34 27 2 5 85 39 44 98 83 46
Card 108: 18 4 63 24 83 40 16 48 21 26 | 87 48 21 59 22 6 26 40 98 69 43 14 83 4 16 15 58 68 64 57 63 72 18 60 24
Card 109: 36 46 49 57 83 68 45 30 1 58 | 35 38 22 12 39 90 86 26 72 67 81 87 79 27 25 29 4 99 41 59 96 94 9 28 75
Card 110: 58 2 71 72 92 91 75 4 19 81 | 75 26 14 91 71 19 88 11 13 72 32 58 92 24 96 33 74 46 27 38 4 81 20 28 2
Card 111: 3 78 14 85 53 1 2 32 59 10 | 20 62 53 94 72 45 2 46 87 17 98 74 44 25 47 60 83 59 65 81 38 24 23 39 12
Card 112: 61 37 90 17 55 94 89 87 5 39 | 90 27 88 64 94 13 41 55 44 21 30 37 84 39 5 32 46 86 14 54 85 17 89 35 31
Card 113: 73 76 33 37 82 79 56 22 57 6 | 76 20 41 85 2 60 37 32 6 82 94 26 63 56 16 28 33 47 70 99 73 40 22 79 57
Card 114: 11 54 66 70 60 78 89 94 80 96 | 14 76 70 33 48 53 90 47 66 6 64 96 83 20 56 34 35 11 75 89 41 60 7 39 1
Card 115: 45 5 33 12 63 95 27 42 1 84 | 51 10 31 27 45 42 1 74 48 72 53 69 63 47 83 33 91 95 39 12 84 11 23 28 65
Card 116: 5 77 89 65 52 69 32 63 23 85 | 82 73 70 91 11 28 41 14 15 62 37 94 90 95 56 30 96 25 63 47 43 49 83 68 29
Card 117: 64 80 98 39 45 11 40 22 49 55 | 44 88 40 80 49 67 69 79 62 42 43 30 55 18 5 59 87 98 54 23 45 39 22 11 64
Card 118: 44 61 75 42 48 66 36 88 9 54 | 62 81 70 3 35 34 79 38 10 32 19 14 65 30 18 42 55 64 92 88 45 83 11 43 23
Card 119: 82 29 59 20 19 18 66 28 23 49 | 20 19 25 70 59 18 14 36 58 40 23 3 24 80 30 78 88 2 79 72 82 7 66 49 47
Card 120: 61 40 26 25 4 42 19 76 51 22 | 6 25 11 24 22 44 4 98 49 97 46 88 23 55 66 48 9 33 85 65 84 29 13 60 83
Card 121: 97 31 11 71 90 96 84 76 53 8 | 71 82 44 99 98 47 40 4 52 53 84 43 27 94 13 88 3 18 28 11 60 24 21 20 38
Card 122: 29 65 38 48 52 55 3 32 35 95 | 91 45 82 57 38 78 47 75 2 12 46 50 23 87 60 99 18 29 65 25 1 89 35 86 59
Card 123: 4 91 26 38 36 83 60 72 19 56 | 35 26 36 22 46 69 14 5 70 3 74 47 7 63 72 89 25 60 17 19 62 76 93 75 38
Card 124: 16 17 73 87 56 22 10 44 92 58 | 54 61 96 42 83 97 5 2 73 69 37 9 50 79 6 57 63 40 75 49 64 70 34 52 11
Card 125: 37 77 17 70 18 59 65 81 48 15 | 59 49 62 81 12 1 71 90 99 36 25 37 60 64 19 83 21 11 3 27 52 32 45 46 72
Card 126: 30 34 31 37 3 7 10 8 45 25 | 78 25 12 34 89 63 59 96 41 75 58 71 93 28 17 90 84 7 4 21 13 33 52 14 19
Card 127: 3 31 15 35 26 88 75 82 77 68 | 13 33 47 92 51 32 74 66 99 44 79 62 22 64 43 23 12 49 60 57 4 83 89 65 21
Card 128: 9 72 20 10 14 95 86 50 85 82 | 82 25 99 53 97 31 42 8 89 68 58 43 15 30 47 1 26 67 87 57 78 18 60 61 75
Card 129: 73 72 68 95 79 76 69 24 1 98 | 15 51 83 7 74 5 93 8 27 40 78 81 3 37 44 14 21 99 97 67 57 71 84 86 64
Card 130: 30 80 40 86 26 36 75 44 41 57 | 81 23 30 73 12 44 8 97 39 42 87 58 33 85 98 57 26 92 80 45 63 21 43 11 99
Card 131: 22 20 60 75 26 57 33 88 74 38 | 21 92 47 36 5 65 69 9 39 1 33 87 34 53 72 44 15 51 58 25 18 67 19 2 93
Card 132: 49 65 86 52 33 67 8 83 61 3 | 43 7 74 30 19 53 89 94 32 11 83 59 71 33 51 20 65 41 86 82 49 25 21 63 18
Card 133: 91 17 74 21 23 47 9 57 82 35 | 23 98 88 82 33 5 92 99 7 57 74 96 9 84 66 24 65 46 40 17 2 4 47 21 51
Card 134: 47 26 41 16 61 76 72 98 24 93 | 2 25 93 11 31 14 91 73 48 47 64 98 85 26 95 19 16 69 13 10 61 9 56 52 24
Card 135: 23 13 58 83 99 69 93 33 10 37 | 35 54 80 42 58 46 88 19 99 81 47 89 10 30 33 92 69 23 13 37 59 34 39 93 62
Card 136: 1 36 37 12 22 19 42 56 98 17 | 70 42 47 17 29 61 73 18 94 72 20 80 7 78 6 15 66 37 71 97 44 96 24 43 23
Card 137: 81 73 66 58 28 36 27 19 67 4 | 21 85 77 72 99 29 38 73 71 86 6 16 58 93 79 91 39 66 80 67 81 20 11 34 40
Card 138: 30 89 31 51 9 63 81 38 91 14 | 1 32 6 9 91 81 56 95 89 74 96 31 44 23 82 54 39 16 66 87 93 46 20 12 60
Card 139: 7 22 84 59 50 53 73 13 97 26 | 17 7 46 18 98 82 53 81 10 39 90 45 16 47 95 15 43 19 50 58 99 13 35 14 12
Card 140: 93 88 6 10 70 26 9 98 29 73 | 35 46 6 48 13 93 61 83 25 19 67 45 89 58 28 39 3 98 75 59 4 81 88 50 54
Card 141: 12 6 9 54 93 16 99 71 36 11 | 88 98 87 30 35 93 14 54 82 48 78 13 55 90 36 80 46 63 83 39 61 23 69 96 8
Card 142: 23 50 74 59 27 44 9 24 48 97 | 51 20 19 44 28 83 50 67 70 32 69 37 62 45 65 82 55 2 33 97 14 60 86 87 27
Card 143: 79 37 21 69 97 74 33 16 39 83 | 98 39 81 84 66 24 17 87 27 48 20 47 78 61 90 53 43 41 42 92 1 52 5 15 59
Card 144: 92 31 18 6 70 10 93 56 95 43 | 47 32 28 23 77 55 94 42 4 64 14 59 81 97 96 45 29 78 54 69 21 76 92 48 7
Card 145: 14 42 45 75 62 1 47 66 31 23 | 30 68 76 97 65 83 22 89 34 80 38 42 62 59 74 56 44 48 71 33 51 82 36 54 40
Card 146: 22 80 81 31 45 84 91 69 47 66 | 5 43 24 39 70 78 58 79 68 88 53 11 63 32 92 99 40 10 34 83 65 28 76 30 19
Card 147: 83 67 45 87 14 75 29 97 64 94 | 2 86 23 53 1 63 34 54 79 82 35 88 41 44 17 13 37 12 10 56 57 31 70 30 68
Card 148: 90 42 32 81 64 66 88 60 97 7 | 46 92 67 88 89 7 81 90 66 73 57 37 26 12 10 60 3 97 42 32 87 49 75 58 64
Card 149: 26 62 65 96 74 6 48 61 91 83 | 74 26 85 51 89 6 44 91 75 65 1 3 96 54 20 77 87 42 61 14 62 68 24 88 17
Card 150: 14 58 89 56 74 82 75 60 17 29 | 83 27 62 14 66 58 89 75 17 74 16 5 46 56 29 50 57 55 39 54 98 60 4 82 68
Card 151: 24 33 68 94 57 59 46 17 84 80 | 43 76 66 46 92 39 73 59 84 68 11 81 87 85 62 33 80 99 95 24 17 57 30 97 94
Card 152: 69 58 62 31 16 20 40 98 96 64 | 63 71 56 31 54 5 85 3 77 42 53 51 19 55 37 49 79 13 80 75 39 6 50 84 40
Card 153: 43 50 22 2 47 75 76 56 26 80 | 80 70 19 52 43 27 56 26 86 47 50 13 2 88 93 11 74 23 22 57 90 81 40 76 75
Card 154: 10 79 52 43 44 26 55 6 73 88 | 37 57 55 40 65 47 14 17 39 1 18 51 67 19 21 12 83 59 45 73 3 32 23 88 10
Card 155: 69 40 90 61 59 70 77 50 31 15 | 31 34 76 14 10 91 12 86 37 24 68 8 15 59 3 35 84 97 30 77 46 70 40 69 61
Card 156: 65 28 6 23 17 62 13 37 86 73 | 9 69 65 75 18 14 97 57 20 61 94 56 8 58 1 66 21 60 89 63 54 55 76 30 87
Card 157: 52 34 98 50 56 69 68 45 20 11 | 34 54 69 41 68 20 44 50 76 65 35 24 84 56 45 51 98 64 23 33 9 43 91 2 97
Card 158: 12 52 92 10 96 84 2 24 14 51 | 85 15 21 63 72 37 95 93 24 5 67 96 6 58 46 22 3 65 99 17 11 10 13 92 78
Card 159: 85 42 96 78 39 75 21 50 14 20 | 57 88 68 79 61 20 1 78 35 59 12 76 42 92 96 75 52 13 50 89 53 81 11 69 49
Card 160: 67 59 62 15 26 85 53 79 42 63 | 53 46 1 30 92 23 91 95 88 89 60 38 2 83 96 4 78 37 14 28 69 22 32 41 3
Card 161: 38 4 97 98 20 55 51 64 80 53 | 53 34 94 65 3 23 45 1 4 72 64 67 51 39 24 63 90 66 29 14 61 40 91 82 49
Card 162: 41 19 60 53 94 79 1 77 63 47 | 79 6 42 68 95 94 66 27 24 76 61 96 20 84 60 25 85 78 67 63 53 12 89 8 51
Card 163: 33 83 82 29 51 57 63 88 66 74 | 9 71 58 88 64 70 96 29 77 25 24 55 21 35 81 33 23 45 18 34 63 6 44 83 17
Card 164: 1 34 54 15 24 97 8 96 73 26 | 42 6 3 21 11 27 69 92 39 59 45 96 73 26 24 98 2 81 83 17 62 54 70 52 95
Card 165: 75 92 74 11 5 1 91 36 32 24 | 87 16 28 41 79 88 96 63 86 31 58 35 65 68 8 77 42 52 38 19 70 59 14 57 37
Card 166: 22 87 29 9 56 32 96 28 61 71 | 80 50 45 12 42 72 5 11 63 62 84 39 20 85 95 47 37 91 60 27 81 2 14 33 51
Card 167: 60 89 56 55 84 30 95 86 11 79 | 26 94 42 66 52 2 98 8 38 71 11 80 19 4 62 10 89 27 91 61 70 90 63 16 68
Card 168: 59 90 46 84 16 39 34 88 81 83 | 37 56 92 96 59 26 5 45 67 1 63 73 55 21 33 12 79 13 17 89 82 3 43 85 18
Card 169: 40 31 62 10 36 69 84 23 95 98 | 22 78 4 46 94 83 60 19 90 70 86 8 20 27 35 17 95 85 14 21 28 61 16 74 37
Card 170: 11 57 4 84 3 28 89 37 50 23 | 42 59 63 33 62 61 75 14 73 68 69 72 67 45 47 58 10 79 91 98 44 49 27 76 25
Card 171: 37 47 28 12 74 3 96 26 95 22 | 94 79 13 35 89 57 19 71 15 11 78 45 24 32 87 61 67 51 36 73 14 23 70 2 56
Card 172: 81 58 92 24 61 10 29 77 93 68 | 92 8 77 73 86 57 93 91 61 19 49 88 23 24 72 64 10 31 32 12 81 4 29 58 68
Card 173: 4 79 39 55 62 88 18 87 24 96 | 79 87 74 39 16 91 55 71 2 88 54 1 58 20 90 18 62 86 43 4 93 24 99 84 96
Card 174: 15 69 50 70 4 98 73 68 46 22 | 93 36 96 73 49 64 74 46 78 38 22 23 53 17 69 68 89 43 71 94 79 16 58 60 19
Card 175: 29 61 14 30 9 23 7 31 60 49 | 78 73 61 91 31 27 63 30 9 64 12 51 8 56 74 36 22 88 1 29 21 80 96 38 99
Card 176: 36 3 35 86 6 93 47 25 79 48 | 91 79 11 20 23 25 30 97 90 24 17 50 60 89 96 52 98 88 99 51 48 68 67 82 61
Card 177: 89 81 54 66 51 77 61 11 42 39 | 36 26 40 59 90 8 33 65 11 38 96 79 80 2 13 56 46 86 71 92 72 73 95 39 85
Card 178: 56 34 78 53 2 7 97 88 27 16 | 12 6 97 8 53 17 50 19 21 41 70 86 25 63 84 52 59 78 81 83 85 72 75 71 39
Card 179: 63 98 17 49 6 40 18 8 82 25 | 56 66 49 33 53 59 2 21 6 80 76 4 17 8 62 57 82 55 98 58 93 52 51 22 25
Card 180: 56 80 35 88 2 24 98 66 71 76 | 77 28 86 36 70 85 65 58 15 32 19 56 61 33 27 79 81 35 16 69 55 57 59 45 82
Card 181: 6 31 42 96 19 4 68 28 58 99 | 48 73 97 4 68 42 70 49 39 56 14 67 89 85 81 96 27 16 15 5 94 69 33 11 44
Card 182: 36 8 13 24 90 99 52 1 56 87 | 12 85 1 9 88 30 74 13 26 80 48 72 10 65 91 44 21 37 70 3 93 29 90 61 7
Card 183: 83 30 76 63 77 11 22 33 15 72 | 83 12 60 16 42 31 63 55 99 1 89 93 88 85 47 48 96 97 29 45 7 75 71 8 33
Card 184: 91 4 17 34 61 70 48 64 38 68 | 66 99 94 3 98 44 90 23 14 38 55 56 68 42 87 95 54 13 7 65 5 18 79 62 57
Card 185: 92 81 63 22 41 13 59 79 40 70 | 94 26 80 48 82 50 23 8 93 49 19 24 58 5 43 16 53 61 37 42 44 40 95 67 25
Card 186: 3 65 75 74 68 4 61 28 91 42 | 56 85 83 29 63 11 20 18 66 53 71 62 33 69 30 93 67 47 72 51 7 80 46 44 9
Card 187: 76 60 87 97 68 27 52 20 12 54 | 87 7 8 14 30 19 39 22 65 24 40 34 61 20 64 81 33 25 69 26 52 76 71 11 60
Card 188: 39 87 24 31 93 1 91 18 20 28 | 47 50 84 24 38 7 37 57 91 96 28 10 14 55 76 35 2 45 29 58 79 27 70 23 21
Card 189: 69 77 14 29 62 32 37 57 61 8 | 73 39 51 80 89 32 8 87 81 62 92 21 4 49 79 40 10 96 55 98 69 74 97 72 37
Card 190: 69 46 86 75 59 29 78 72 16 54 | 18 86 68 63 9 49 50 10 19 77 65 69 79 12 24 76 64 58 1 16 30 13 98 11 75
Card 191: 52 35 79 94 34 5 96 38 70 90 | 65 46 49 11 48 1 29 82 24 85 51 61 84 81 18 20 67 41 33 88 89 25 6 83 68
Card 192: 8 66 41 82 36 43 50 97 29 3 | 5 56 32 47 13 82 50 1 39 8 70 20 97 99 33 76 3 46 43 36 26 66 83 61 29
Card 193: 22 70 17 82 6 24 4 35 32 61 | 24 22 67 2 89 35 95 1 34 82 39 14 5 51 27 26 4 32 43 76 45 9 70 17 30
Card 194: 54 90 83 51 22 45 97 41 92 61 | 32 37 94 87 41 21 98 54 40 14 4 79 61 82 97 59 44 45 28 73 66 84 63 35 23
Card 195: 68 89 18 86 4 5 82 78 3 35 | 14 21 75 98 88 28 44 49 20 95 25 68 67 79 65 30 37 87 61 78 8 73 77 31 16
Card 196: 16 64 6 99 67 55 51 50 37 71 | 12 89 81 63 62 82 85 60 76 8 4 32 83 51 38 69 92 35 10 90 58 56 77 99 29
Card 197: 85 67 81 59 28 36 13 84 83 92 | 67 56 68 12 34 30 60 41 58 92 49 81 22 23 21 18 5 69 71 75 94 53 90 36 9
Card 198: 99 10 39 1 13 21 15 84 44 40 | 64 58 40 26 8 97 83 87 86 85 29 54 44 99 6 80 55 36 84 82 18 92 81 35 15
Card 199: 16 74 44 41 37 70 15 20 36 9 | 63 89 93 59 81 76 85 14 92 30 67 71 69 49 7 39 99 97 62 18 55 83 11 79 36
Card 200: 78 75 82 83 61 95 2 56 49 53 | 66 19 77 94 74 97 79 34 33 16 83 41 81 91 52 62 14 21 35 4 99 50 30 42 36
Card 201: 97 48 74 15 5 4 40 64 95 33 | 83 54 73 81 37 53 85 20 68 51 82 41 27 42 60 63 50 58 98 35 9 23 18 2 32
Card 202: 83 90 4 89 57 72 30 13 8 23 | 99 33 38 70 39 12 71 35 46 94 82 79 44 62 98 74 64 16 32 66 65 95 47 58 23
Card 203: 38 61 14 84 65 96 90 69 53 11 | 24 50 66 56 26 25 3 60 95 19 10 21 12 87 92 37 99 76 71 57 17 55 30 6 44

View File

@ -0,0 +1,6 @@
Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53
Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19
Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1
Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83
Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36
Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11

243
2023/data/day05.txt 100644
View File

@ -0,0 +1,243 @@
seeds: 1514493331 295250933 3793791524 105394212 828589016 654882197 658370118 49359719 4055197159 59237418 314462259 268880047 2249227634 74967914 2370414906 38444198 3291001718 85800943 2102534948 5923540
seed-to-soil map:
3352941879 1247490906 129850502
1738919961 2189748071 56658550
1795578511 292133467 518088747
1519757661 1666834550 130335907
1650093568 133993362 88826393
2813914030 2262539545 40894545
2698412916 2661705133 115501114
2854808575 810222214 437268692
410530961 1545057218 121777332
0 242661076 10731898
532308293 2303434090 61476099
3292077267 1797170457 2282798
2313667258 0 133993362
2447660620 2410952837 250752296
3294360065 253392974 38740493
10731898 1377341408 167715810
1457582089 2364910189 46042648
593784392 3009289500 824592362
3333100558 222819755 19841321
1418376754 1799453255 39205335
1503624737 2246406621 16132924
178447708 2777206247 232083253
3482792381 1838658590 351089481
soil-to-fertilizer map:
3513795976 4258851234 36116062
3393453635 4148223693 110627541
3504081176 3494735450 6350258
2671742993 3596285367 235915393
991290653 256764866 25867175
2907658386 3330719253 68855819
3336496635 4091266693 56957000
3161141476 2536943456 80523019
1961696534 304660310 29551079
812996514 1560772632 178294139
1562163347 2321959023 78904062
31289107 1039870587 339682886
1520029818 1928417376 42133529
3510431434 3832200760 3364542
3549912038 3272523584 58195669
0 149071717 31289107
3608107707 3501085708 5732766
503523937 1739066771 189350605
3071674583 3506818474 89466893
3241664495 3996434553 94832140
1708133363 454333361 253563171
3813493721 3097084118 175439466
1991247613 1970550905 351408118
3613840473 2897430870 199653248
2536943456 2762631333 134799537
1641067409 244319429 12445437
3994753216 3913095788 83338765
2976514205 3399575072 95160378
1354883134 0 143118415
1349131883 2400863085 5751251
1498001549 282632041 22028269
2342655731 180360824 63958605
370971993 1379553473 126598642
4149802438 2617466475 145164858
1017157828 707896532 331974055
692874542 334211389 120121972
497570635 143118415 5953302
3988933187 3907275759 5820029
4078091981 3835565302 71710457
1653512846 1506152115 54620517
fertilizer-to-water map:
3053686523 2028998994 1241280773
1492748555 1562401968 269616514
554432178 1000324407 562077561
2944878746 3270279767 108807777
2501520804 3379087544 52288887
1762365069 20686928 69653413
2028998994 3431376431 472521810
1431309984 814973200 3653900
409832614 0 20686928
430519542 818627100 123912636
1116509739 500172955 314800245
2553809691 3903898241 391069055
0 90340341 409832614
1434963884 942539736 57784671
water-to-light map:
2774754469 1598606098 15160294
3832622498 1469118874 129487224
4125818569 3997047227 169148727
1108418694 1130695768 196125912
637654660 517892123 26551592
2519230072 3399515763 135968347
2751000257 3126996880 23754212
861800165 884077239 88532605
1469118874 2566660966 63929427
2789914763 3150751092 63425583
2853340346 2561960449 4700517
1692681911 3397592997 1922766
2858040863 1773257241 287341147
2655198419 2851614649 15098309
950332770 972609844 158085924
591049922 471287385 46604738
3482333989 3849276196 108901632
1694604677 1613766392 159490849
3591235621 3958177828 38869399
3630105020 4166195954 128771342
3205039781 3535484110 277294208
2706794606 2060598388 44205651
386607659 544443715 110595292
3962109722 2540862463 21097986
697311924 0 92263281
558450415 404456802 11447837
2409200012 3214176675 110030060
569898252 862925569 21151670
1354525884 415904639 55382746
789575205 790700609 72224960
3832262624 2690248164 359874
163757080 181606223 222850579
1533048301 2967363270 159633610
497202951 784452458 6248151
2670296728 3812778318 36497878
3145382010 2630590393 59657771
1854095526 2104804039 436058424
0 655039007 74414138
2390804262 2690608038 18395750
1304544606 1326821680 49981278
3758876362 3324206735 73386262
664206252 1376802958 33105672
74414138 92263281 89342942
3983207708 2709003788 142610861
503451102 729453145 54999313
2290153950 2866712958 100650312
light-to-temperature map:
2054128675 422374783 216418447
3729049939 3132111492 565917357
524183620 1261361039 34450583
723901655 638793230 74616934
304496246 795175951 115896188
1128506994 1008723417 50927515
958650763 2074746732 3056214
0 1224918384 36442655
558634203 1059650932 165267452
2052385426 713410164 1743249
833053864 1953862956 120883776
36442655 715153413 80022538
1455705971 1506174459 386316618
1842022589 1295811622 210362837
2270547122 2077802946 24477429
116465193 2102280375 188031053
1179434509 945607414 63116003
798518589 911072139 34535275
3373647615 3893335786 195498774
3696979816 3698028849 32070123
1242550512 1892491077 43410067
3051130577 2566857633 322517038
3002478931 3844684140 48651646
2311039190 3730098972 114585168
2425624358 2311039190 187630064
2819387158 2889374671 183091773
1285960579 103791186 85466201
1371426780 338095592 84279191
1110545182 1935901144 17961812
953937640 2290311428 4713123
420392434 0 103791186
961706977 189257387 148838205
3637334768 3072466444 59645048
3569146389 2498669254 68188379
2613254422 4088834560 206132736
temperature-to-humidity map:
2032423062 2486277941 26281270
333062067 2316624216 6051173
1716048249 1385455997 91409968
460397469 2512559211 69041956
25538975 668468772 15388105
2090913379 324344034 71221218
2804805674 3018690414 130533369
529439425 908821722 476634275
1106765273 448560048 219908724
2162134597 1476865965 445565302
0 395565252 25538975
4004204691 4019550481 43244121
2058704332 0 32209047
1516375281 2116951248 199672968
3888833667 2764269134 115371024
40927080 32209047 292134987
1490276549 2581601167 26098732
1360818538 2322675389 129458011
1006073700 2043715496 73235752
1079309452 421104227 27455821
1807458217 683856877 224964845
339113240 1922431267 121284229
4155917040 2879640158 139050256
2764269134 4171262830 40536540
4047448812 4062794602 108468228
2935339043 3149223783 870326698
1326673997 2452133400 34144541
3805665741 4211799370 83167926
humidity-to-location map:
3928575650 3147563455 98804874
2357899446 2418187254 26586982
449562184 2261875136 59054833
308294839 60287808 141267345
1872062279 1591999301 10857495
1227084719 574109504 259895254
1980177059 1765508840 13399403
1162615704 1941046629 64469015
2384486428 2654234915 114059261
702311863 1515542756 40659242
1993576462 2005515644 256359492
3047301127 3246368329 27789688
650396000 1713592977 51915863
3701335066 3862068622 181049310
1122863338 1673840611 39752366
3075090815 4174917460 120049836
3882384376 2778717800 46191274
1626219043 201555153 245843236
4027380524 3325898523 267586772
3417979817 4043117932 13866284
3281454033 2925002624 18592540
110359150 1556201998 35797303
2558833497 2444774236 209460679
508617017 834004758 141778983
1574315753 975783741 51903290
2249935954 1027687031 107963492
0 463750354 110359150
2778717800 3593485295 268583327
3195140651 2824909074 86313382
3445626269 2943595164 203968291
3324037823 4080975466 93941994
742971105 1135650523 379892233
146156453 1778908243 39038597
3300046573 4056984216 23991250
1503331938 1602856796 70983815
185195050 1817946840 123099789
3649594560 3274158017 21920411
1486979973 447398389 16351965
3671514971 3296078428 29820095
2498545689 0 60287808
3431846101 2911222456 13780168
1882919774 2320929969 97257285

View File

@ -0,0 +1,33 @@
seeds: 79 14 55 13
seed-to-soil map:
50 98 2
52 50 48
soil-to-fertilizer map:
0 15 37
37 52 2
39 0 15
fertilizer-to-water map:
49 53 8
0 11 42
42 0 7
57 7 4
water-to-light map:
88 18 7
18 25 70
light-to-temperature map:
45 77 23
81 45 19
68 64 13
temperature-to-humidity map:
0 69 1
1 0 69
humidity-to-location map:
60 56 37
56 93 4

View File

@ -0,0 +1,2 @@
Time: 42 89 91 89
Distance: 308 1170 1291 1467

View File

@ -0,0 +1,2 @@
Time: 42899189
Distance: 308117012911467

View File

@ -0,0 +1,2 @@
Time: 7 15 30
Distance: 9 40 200

1001
2023/data/day07.txt 100644

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
32T3K 765
T55J5 684
KK677 28
KTJJT 220
QQQJA 483

777
2023/data/day08.txt 100644
View File

@ -0,0 +1,777 @@
LLRRRLLRLRRRLLRLRLRLRLRRRLRRLRRLRLLLRRLLRRLRRLRRLRRRLLLRRLRLRRRLRRRLRLRRLRRRLRLRRRLRLRLLLRLRRLRLRRLRRRLRLRRRLRRRLRRRLRRRLRLRRRLRRRLRLLRRLRLRLRRRLRRLRRRLRRRLRRRLRRRLLLLRRLLRLRRLRRLRRRLRRRLLLRRLRRLRLRRLRRRLRRLRLRRRLRLRRLLRLLRRLRLRRRLRRLRRLRLRRLLLRRRLRLRRRLRLRLLRLRLRRRLRLRLRRRLRRLRRLRRRLRRLLRRRR
VTM = (VPB, NKT)
LHN = (DLF, GQV)
CRN = (TGB, XCM)
TXR = (JQL, JQL)
LJX = (SPR, LLM)
HSH = (SKP, MFC)
JSC = (QPB, VCP)
KKG = (BFT, NBS)
BCB = (GRT, TLB)
GPA = (SDK, MRM)
CNJ = (FDR, GGT)
GQV = (BSJ, DGF)
CNT = (FLM, TVQ)
RLL = (BRB, CRH)
PPN = (KCF, PSJ)
TFL = (GCD, DMF)
KPM = (TKS, CGP)
FBN = (GPF, LCJ)
DQJ = (MHL, VKQ)
NDD = (QLT, PPG)
GNL = (QGD, LTM)
NBG = (XPM, HTV)
LTT = (RLP, NHB)
QHH = (DDD, ZZZ)
DLN = (KNP, KNP)
XMN = (DGV, DNL)
BCL = (FVG, QMH)
GLR = (JDH, RBR)
LXL = (BVC, RSG)
TCV = (JKG, BTF)
HJC = (KTD, JFQ)
DBK = (RCR, CVZ)
FMD = (QGQ, TJX)
JQG = (FHN, HKX)
XFV = (JJM, LBM)
GXQ = (XFV, MVV)
HTT = (THT, CFL)
FTG = (JRP, VGH)
XJF = (FCL, HNF)
MPT = (RDF, NDJ)
FJG = (VPF, LGQ)
CSK = (NSD, MFH)
QJN = (MPT, PLV)
HJP = (VCP, QPB)
KCF = (LVM, XMX)
FPZ = (FMR, GSL)
LRB = (RFF, GQR)
MHN = (TVD, MVF)
FSH = (VPF, LGQ)
GGT = (XJF, RQQ)
RRL = (JTG, TNF)
MPM = (QBD, QHH)
SHG = (JMJ, TLK)
TTD = (DLK, BBJ)
HLF = (JLF, SKB)
XMG = (CGM, RTL)
FFT = (DFJ, RPJ)
FQL = (PTM, LDJ)
NQJ = (CQM, DDL)
VKQ = (TGR, DBC)
RCD = (XPP, FPP)
HPC = (FLM, TVQ)
PBB = (LQR, PQS)
KBS = (BFT, NBS)
HTD = (JMS, HNX)
SKF = (NLJ, NLJ)
GTA = (GSL, FMR)
RSG = (MLL, LJX)
KRB = (PSG, FMD)
XNP = (LFN, XGC)
TVH = (GDG, MNT)
TXM = (JPK, JVQ)
LPB = (CTQ, VQF)
PST = (VPB, NKT)
BSX = (PLS, HQJ)
TKS = (CMC, TFJ)
DCD = (LXR, KTM)
XKR = (BHS, BBT)
JMS = (LDT, JQG)
BVG = (JMQ, BCS)
SPT = (HFN, SPV)
HNF = (NFQ, KPH)
HXG = (VKC, LKM)
DBL = (MDR, VHG)
NVK = (CGQ, SRF)
PLS = (RJN, DVS)
SPR = (XMG, HSS)
FPQ = (VRX, RQX)
LTM = (DBH, KSB)
VRQ = (SXT, KLQ)
XFX = (PFT, NNK)
GFC = (RCH, MFK)
FLK = (DLK, BBJ)
QVN = (LCV, LCV)
HGP = (GMS, MHR)
BVH = (VLQ, CNJ)
BXS = (GQR, RFF)
SKP = (VDS, QPH)
VRM = (TCK, SND)
CGM = (FVK, HGP)
LDT = (FHN, HKX)
BJK = (GFS, PLM)
PVT = (FDX, QHX)
XGC = (TXR, QKJ)
PKF = (NBQ, RCD)
XJB = (RBR, JDH)
GSC = (PTM, LDJ)
SHQ = (KXR, QGK)
TJR = (QGR, NRN)
GQH = (XJB, GLR)
QSM = (MKQ, VRB)
XRF = (NRN, QGR)
PKV = (NQP, JXT)
QNB = (CTL, JVP)
FDX = (DFL, VRQ)
HDS = (QJH, HBF)
NNK = (NDQ, RBL)
RQM = (DQJ, BBQ)
GJG = (QBC, TRD)
NRL = (HTD, SJR)
TKP = (SKF, VDL)
CQM = (TJS, FJF)
KSC = (PFP, DCC)
RSB = (JTQ, HJJ)
DHC = (BQN, SJP)
PFS = (SKP, MFC)
MDP = (LJQ, BML)
CLK = (BJK, QTG)
KST = (CRH, BRB)
MJS = (NDS, TGD)
QBR = (PSG, FMD)
BSB = (PST, VTM)
FPP = (DCD, TGM)
VLF = (LDR, PSP)
NPF = (KBC, PHJ)
TCK = (DFX, RLN)
QNV = (PST, VTM)
JJM = (HMT, DGT)
PTM = (HQV, QLM)
MNS = (JVP, CTL)
KNP = (CPT, CPT)
GGN = (MTG, VVT)
RBT = (MNM, VSQ)
GFH = (VLB, NSK)
HHC = (NGJ, XFT)
QKJ = (JQL, RKB)
XXC = (VJP, HXP)
PSJ = (XMX, LVM)
CFD = (PFL, PPL)
HXD = (BSN, QMC)
HKX = (SSD, CKC)
XPP = (TGM, DCD)
TQB = (FPD, DRT)
PTT = (HHK, HHK)
XRG = (JRP, VGH)
MBN = (KML, KCN)
JDP = (VMS, LCB)
FJF = (STK, GXR)
XQQ = (BST, SPB)
STK = (CKJ, MVM)
LJQ = (DTG, TMF)
DDD = (PBJ, RXK)
FVL = (PXT, NLS)
HRG = (HMV, XTC)
LDN = (JSQ, HQD)
FMJ = (HLP, GXQ)
RQX = (DPD, SNH)
QML = (CCH, PPF)
VGN = (VJP, HXP)
QLH = (FXX, RFB)
GMS = (BVG, SHR)
QCP = (LBC, RBT)
RMS = (LHN, KDR)
RTC = (NDS, TGD)
GBT = (KSJ, GGS)
FNN = (HTH, LXP)
JMQ = (LTX, LKQ)
HMV = (FJS, KCM)
GGM = (XDB, XNP)
NNC = (PBB, NLF)
HSG = (GJG, DSB)
DTG = (LRD, DXH)
TJS = (STK, GXR)
NQB = (RFB, FXX)
BKL = (PDP, XTB)
VQB = (LCV, HPG)
NQP = (CTG, HRG)
TVK = (NQT, QSM)
TJX = (JPH, GRF)
SPB = (MRF, FMJ)
QPH = (XXC, VGN)
TQS = (MPF, MSC)
LQF = (GHS, BQR)
VRB = (CSK, QLG)
NVH = (QXX, TQB)
FPD = (PKV, MFX)
NDB = (JPR, HDS)
HVM = (XRS, SPN)
BSJ = (PHC, FSD)
NPQ = (VBC, HSG)
BXH = (RKS, RPB)
VJP = (HMC, TVX)
NDJ = (FFT, SRP)
SRP = (DFJ, RPJ)
FHQ = (PDP, XTB)
THD = (VMG, DPL)
MRF = (HLP, GXQ)
SND = (DFX, RLN)
BFT = (BVH, BDJ)
MLL = (LLM, SPR)
RKF = (XRQ, STZ)
HGB = (VJQ, MHN)
CBM = (BXH, KMM)
VPD = (HDS, JPR)
RQR = (SMH, KPM)
FVG = (MMM, CLK)
FMP = (VFC, LCC)
QBD = (DDD, DDD)
RGC = (RLL, KST)
HQV = (PKF, TCS)
PLL = (KSJ, GGS)
PPF = (PNT, GFX)
FRN = (LCJ, GPF)
XPM = (TTT, VTP)
BCH = (NFC, FPQ)
KML = (FCB, RMP)
JBM = (VBH, LLG)
VKL = (RMS, SBX)
MMN = (MDR, VHG)
HMG = (PMN, XBV)
BHS = (NPQ, RTT)
XPC = (GGM, KCC)
DGV = (SPT, DNB)
JSB = (DPS, THK)
MND = (KML, KCN)
VCP = (TLD, TVK)
PFX = (RRL, DMX)
SXK = (TVB, PDR)
BML = (TMF, DTG)
XBV = (HXJ, QJB)
DRR = (MSC, MPF)
DCK = (SLD, VRM)
HFP = (LJQ, BML)
RQG = (DDP, TFL)
MRM = (MND, MBN)
PHC = (HHC, GFT)
VGX = (MHN, VJQ)
LMX = (PLL, GBT)
CQF = (FJG, FSH)
MVV = (LBM, JJM)
HSS = (CGM, RTL)
HJK = (HXG, RQF)
CRV = (LCC, VFC)
SHR = (BCS, JMQ)
TDM = (FNR, MSX)
XFS = (LRX, HPP)
TBC = (SKF, VDL)
JXM = (GSL, FMR)
KCC = (XNP, XDB)
LVM = (NJX, GFC)
XRS = (MSL, BSM)
TGV = (LBC, RBT)
SDH = (XPM, HTV)
HGV = (FVL, CSF)
GNH = (SJP, BQN)
TDN = (MNT, GDG)
HJS = (KBC, PHJ)
QGK = (PRK, RSB)
JRN = (FRN, FBN)
TNP = (QVN, VQB)
FXX = (HLF, KPB)
VBH = (QTV, TFR)
XBL = (MSX, FNR)
TRN = (SQR, MQN)
RHP = (JSC, HJP)
JPC = (NNK, PFT)
BSM = (TRN, MCS)
DPD = (DBL, MMN)
DPP = (BSX, NMG)
GFM = (GGN, LLX)
DBC = (SXK, NSL)
KGB = (CBM, DQT)
MCS = (MQN, SQR)
PDR = (NNC, RXP)
MTG = (FGV, LDN)
VGH = (SJH, BRX)
GPF = (QGB, KKM)
PFL = (JPC, XFX)
FFF = (QSR, HMG)
XSS = (PPG, QLT)
LDM = (KNV, BCL)
RMP = (CFD, LHR)
NQT = (VRB, MKQ)
BXM = (FTX, NVK)
CTL = (TKG, RHP)
NBS = (BVH, BDJ)
BVQ = (VPD, NDB)
PGB = (FGQ, KGB)
SLB = (GQH, VSP)
GPV = (JMJ, TLK)
NJX = (RCH, MFK)
LKQ = (JQN, MCR)
BPB = (RFQ, GSP)
FHN = (CKC, SSD)
CKC = (RQM, FCQ)
HTH = (HJC, NTF)
DJP = (NQB, QLH)
TGD = (XPL, KNQ)
CPT = (RCR, RCR)
LLM = (HSS, XMG)
MFC = (QPH, VDS)
VSP = (GLR, XJB)
FMR = (KSC, JVM)
DGF = (FSD, PHC)
KNQ = (XLB, RQR)
CNB = (KRB, QBR)
QHX = (DFL, VRQ)
HBL = (NMN, QJN)
XTC = (FJS, KCM)
LGQ = (LPB, FLQ)
NGJ = (HJK, VTL)
TVX = (MKF, QSN)
GVG = (HRQ, XFS)
QGD = (DBH, KSB)
VPB = (CDD, TNP)
MFK = (BSB, QNV)
SXT = (KDJ, DJP)
GVJ = (GGK, JPT)
HQD = (SXS, CPD)
VRP = (XSQ, KKH)
FNR = (DHC, GNH)
CLT = (BSN, QMC)
CKJ = (VRG, BVQ)
TVQ = (CRV, FMP)
DPS = (XPC, FCP)
SJR = (JMS, HNX)
FLQ = (VQF, CTQ)
HBF = (GVG, XML)
CPD = (RGC, QMS)
BBN = (FPQ, NFC)
MQN = (KBS, KKG)
QTV = (CTB, QJX)
QPJ = (FQL, GSC)
BPD = (CPT, DBK)
FJS = (MNS, QNB)
DDF = (QMD, BPB)
DDL = (FJF, TJS)
QPB = (TLD, TVK)
DFJ = (DJK, FGN)
PFT = (NDQ, RBL)
DQK = (QGD, LTM)
LXR = (LDM, BGD)
FQF = (QJN, NMN)
SLD = (TCK, SND)
RTT = (HSG, VBC)
QSN = (MJQ, KXN)
GGK = (HTG, XNF)
KSB = (VPL, TCV)
BKR = (HSH, PFS)
VRG = (VPD, NDB)
QXX = (DRT, FPD)
LMK = (PTT, XTP)
PQS = (HQR, CQF)
NXS = (TLB, GRT)
VFB = (MFP, CNB)
JVM = (PFP, DCC)
JPK = (XKD, HGV)
KTD = (LXL, QSH)
KKM = (DLN, JXD)
NHB = (NQJ, PFR)
QXK = (KXV, HBV)
CHX = (RRL, DMX)
KKH = (LTT, FHJ)
KDR = (DLF, GQV)
RJD = (RLH, MBJ)
QBC = (VVB, MMD)
MFH = (JRN, RHL)
TLB = (PSN, HNB)
XTB = (FFF, XVV)
SKZ = (VLF, TVV)
DMF = (PDB, JBM)
FMG = (FTX, NVK)
QXP = (DNL, DGV)
GSP = (PXX, PVL)
KXN = (THR, FSN)
GFT = (NGJ, XFT)
QLT = (MDP, HFP)
NBM = (QBD, QBD)
PFP = (BKR, GLT)
NDQ = (KBD, PKH)
JFH = (PTL, QCT)
HRQ = (HPP, LRX)
PNV = (LCB, VMS)
JTG = (NGR, DPP)
THR = (SHQ, CTP)
CBG = (XKR, DRD)
PPL = (XFX, JPC)
RFB = (KPB, HLF)
LCV = (JXM, JXM)
RJN = (SSF, DCK)
NKT = (CDD, TNP)
NTF = (KTD, JFQ)
KLQ = (DJP, KDJ)
QMD = (RFQ, GSP)
TLP = (CNB, MFP)
FGV = (JSQ, HQD)
FGN = (TKH, QKX)
RXK = (TJR, XRF)
PXX = (VJC, FNN)
PHJ = (XRP, PVT)
MVM = (VRG, BVQ)
FSD = (GFT, HHC)
GSL = (JVM, KSC)
VRC = (CFL, THT)
RBL = (KBD, PKH)
RLP = (NQJ, PFR)
BBT = (RTT, NPQ)
MHL = (DBC, TGR)
QGR = (HGB, VGX)
XPL = (XLB, RQR)
SSF = (VRM, SLD)
KRM = (THK, DPS)
MTP = (BCH, BBN)
PDB = (VBH, LLG)
BST = (MRF, FMJ)
DRD = (BHS, BBT)
VHG = (SMJ, QFC)
FTX = (CGQ, SRF)
PNT = (DCT, QPJ)
QJB = (LDX, FPJ)
JKG = (TVH, TDN)
FCQ = (DQJ, BBQ)
HBV = (NBM, MPM)
MDR = (QFC, SMJ)
PTL = (FLK, TTD)
LDR = (HBL, FQF)
NVN = (VFM, VJR)
DQT = (BXH, KMM)
RHL = (FRN, FBN)
MBM = (TLP, VFB)
TVD = (XNJ, VKL)
DNL = (DNB, SPT)
TKH = (XSS, NDD)
JPH = (PVJ, RQG)
VRX = (DPD, SNH)
CVV = (TGB, XCM)
QGB = (DLN, JXD)
SPN = (BSM, MSL)
TGM = (LXR, KTM)
LRD = (XXP, PND)
VMS = (THD, KTF)
MHR = (BVG, SHR)
DMX = (JTG, TNF)
HKJ = (GCF, FXT)
VTP = (DRR, TQS)
VPL = (BTF, JKG)
RCH = (BSB, QNV)
KTM = (LDM, BGD)
QSR = (PMN, XBV)
PXM = (QXP, XMN)
TLK = (CTD, LMX)
BBJ = (MCN, RJD)
RCR = (SDK, MRM)
TVV = (LDR, PSP)
LMQ = (CLT, HXD)
XML = (HRQ, XFS)
RFQ = (PVL, PXX)
QCT = (FLK, TTD)
GXR = (MVM, CKJ)
HPG = (JXM, FPZ)
FCP = (GGM, KCC)
LDX = (PNV, JDP)
MVG = (DQK, GNL)
BNP = (VRC, HTT)
RLH = (QXK, TFF)
DCT = (GSC, FQL)
MFP = (KRB, QBR)
VDA = (CBP, VRP)
THK = (FCP, XPC)
DJK = (QKX, TKH)
VLB = (BXS, LRB)
FCF = (QMD, BPB)
QLM = (TCS, PKF)
BCS = (LKQ, LTX)
MSL = (MCS, TRN)
VQF = (THQ, RBB)
HNB = (QCP, TGV)
SMH = (TKS, CGP)
HMC = (MKF, QSN)
BDJ = (CNJ, VLQ)
NRN = (VGX, HGB)
GSD = (JPK, JVQ)
SXS = (RGC, QMS)
VJR = (CNT, HPC)
RQQ = (FCL, HNF)
FCL = (NFQ, KPH)
JFQ = (QSH, LXL)
TRD = (VVB, MMD)
CTD = (PLL, GBT)
NGR = (BSX, NMG)
MSX = (DHC, GNH)
XNJ = (RMS, SBX)
VHH = (VLB, NSK)
CTG = (XTC, HMV)
NFC = (VRX, RQX)
TNF = (NGR, DPP)
XDB = (LFN, XGC)
PND = (BKL, FHQ)
MFX = (NQP, JXT)
TCS = (RCD, NBQ)
FCJ = (QDF, BNP)
CDQ = (XHV, RSJ)
MBJ = (QXK, TFF)
KPG = (GQH, VSP)
BRX = (NHD, SXL)
HHK = (TVV, VLF)
KCM = (QNB, MNS)
KXR = (RSB, PRK)
HQJ = (RJN, DVS)
XGP = (TQB, QXX)
PCM = (DQN, MKZ)
CDD = (QVN, QVN)
FXT = (DMT, RKF)
FPJ = (JDP, PNV)
DFX = (RSL, HVM)
TFJ = (XBL, TDM)
VFM = (HPC, CNT)
CSF = (PXT, NLS)
MMD = (PGB, PDN)
LHR = (PFL, PPL)
PDP = (FFF, XVV)
GDG = (TKP, TBC)
SNH = (DBL, MMN)
VTL = (HXG, RQF)
KNV = (QMH, FVG)
HMT = (GQT, JFH)
GLT = (PFS, HSH)
QFC = (TXM, GSD)
ZZZ = (RXK, PBJ)
PSG = (QGQ, TJX)
PPG = (HFP, MDP)
RDF = (FFT, SRP)
NSL = (PDR, TVB)
XFT = (HJK, VTL)
GFS = (DDF, FCF)
VPF = (LPB, FLQ)
HTG = (FXN, NVN)
SQR = (KKG, KBS)
SDK = (MND, MBN)
THT = (QML, CTN)
NLS = (GFH, VHH)
KTF = (VMG, DPL)
VDL = (NLJ, LMK)
HFN = (NMQ, LMQ)
QMC = (CFJ, HKJ)
VVL = (KPG, SLB)
DMT = (XRQ, XRQ)
LDJ = (QLM, HQV)
PFR = (DDL, CQM)
HPP = (NXS, BCB)
QLG = (MFH, NSD)
KBC = (PVT, XRP)
FCB = (CFD, LHR)
GCD = (JBM, PDB)
SMR = (GGK, JPT)
CTP = (KXR, QGK)
HXP = (HMC, TVX)
VLQ = (FDR, GGT)
DDP = (GCD, DMF)
JMJ = (CTD, LMX)
CGQ = (KRM, JSB)
XJD = (BCH, BBN)
MNM = (SHG, GPV)
GCF = (DMT, DMT)
DBH = (TCV, VPL)
RKB = (TCX, PCM)
DGT = (JFH, GQT)
JXT = (CTG, HRG)
KPB = (JLF, SKB)
JPT = (XNF, HTG)
NSD = (JRN, RHL)
HTV = (TTT, VTP)
TCX = (DQN, DQN)
MCN = (MBJ, RLH)
CTN = (PPF, CCH)
CTB = (RGB, PXM)
PBJ = (XRF, TJR)
HXJ = (FPJ, LDX)
LLX = (VVT, MTG)
HJJ = (FCJ, NNJ)
CCH = (PNT, GFX)
JVP = (RHP, TKG)
SJH = (NHD, SXL)
RSL = (SPN, XRS)
QMH = (MMM, CLK)
SKB = (FML, MBM)
NBQ = (FPP, XPP)
GQR = (BXM, FMG)
BGV = (DRD, XKR)
HMX = (BQR, GHS)
PVL = (FNN, VJC)
DFL = (SXT, KLQ)
NSK = (BXS, LRB)
MNT = (TKP, TBC)
LTX = (MCR, JQN)
RFF = (BXM, FMG)
NMG = (PLS, HQJ)
LCB = (THD, KTF)
DPL = (QGL, NRL)
SNG = (DQK, GNL)
HQR = (FSH, FJG)
GRF = (RQG, PVJ)
BBQ = (MHL, VKQ)
TMF = (LRD, DXH)
XTP = (HHK, SKZ)
DSB = (QBC, TRD)
QTG = (GFS, PLM)
PKH = (GFM, MXX)
BGD = (BCL, KNV)
LCC = (XJD, MTP)
DQN = (LQF, HMX)
RSJ = (XGP, NVH)
RXP = (PBB, NLF)
LXP = (NTF, HJC)
TGR = (NSL, SXK)
MKF = (MJQ, KXN)
BVC = (LJX, MLL)
BBA = (TVV, VLF)
PDN = (KGB, FGQ)
PLM = (FCF, DDF)
FHJ = (RLP, NHB)
VVT = (FGV, LDN)
STZ = (VRP, CBP)
FVK = (MHR, GMS)
QJX = (PXM, RGB)
GGS = (BGV, CBG)
XRQ = (CBP, VRP)
PSP = (FQF, HBL)
KMM = (RKS, RPB)
VMG = (NRL, QGL)
KXV = (NBM, NBM)
JLF = (MBM, FML)
RLN = (RSL, HVM)
TFF = (KXV, HBV)
DLK = (MCN, RJD)
BTF = (TVH, TDN)
MCR = (PPN, CKH)
TLD = (QSM, NQT)
QKX = (XSS, NDD)
VJC = (HTH, LXP)
XVV = (HMG, QSR)
DNB = (HFN, SPV)
JTQ = (NNJ, FCJ)
XLB = (KPM, SMH)
KSJ = (BGV, CBG)
VDS = (VGN, XXC)
CKH = (PSJ, KCF)
CFJ = (GCF, GCF)
QDF = (VRC, HTT)
VFC = (XJD, MTP)
MPF = (SMR, GVJ)
LRX = (NXS, BCB)
KBD = (MXX, GFM)
XMX = (NJX, GFC)
GHS = (FTG, XRG)
PMN = (QJB, HXJ)
AAA = (PBJ, RXK)
FXN = (VJR, VFM)
XKD = (CSF, FVL)
RQF = (LKM, VKC)
CTQ = (THQ, RBB)
RPJ = (DJK, FGN)
FML = (VFB, TLP)
TKG = (HJP, JSC)
JVQ = (XKD, HGV)
TFR = (QJX, CTB)
JRP = (SJH, BRX)
QGL = (SJR, HTD)
KDJ = (NQB, QLH)
SSD = (RQM, FCQ)
THQ = (VVL, QRN)
CBP = (KKH, XSQ)
LKM = (PFX, CHX)
VSA = (LQF, HMX)
XSQ = (LTT, FHJ)
FDR = (RQQ, XJF)
JQN = (PPN, CKH)
SRF = (KRM, JSB)
NLJ = (PTT, PTT)
PVJ = (DDP, TFL)
CFL = (QML, CTN)
FLM = (FMP, CRV)
DVS = (SSF, DCK)
DXH = (PND, XXP)
PLV = (RDF, NDJ)
NLF = (PQS, LQR)
NMN = (MPT, PLV)
PSN = (TGV, QCP)
RTL = (HGP, FVK)
SJP = (SDH, NBG)
LLG = (TFR, QTV)
DRT = (MFX, PKV)
BQN = (SDH, NBG)
RGB = (XMN, QXP)
NNJ = (BNP, QDF)
JQL = (TCX, TCX)
CRH = (MQF, CDQ)
RBR = (SNG, MVG)
HLP = (MVV, XFV)
MKZ = (HMX, LQF)
TTT = (DRR, TQS)
NHD = (RTC, MJS)
GFX = (DCT, QPJ)
JXD = (KNP, BPD)
XCM = (HJS, NPF)
QGQ = (GRF, JPH)
MKQ = (QLG, CSK)
VJQ = (TVD, MVF)
SBX = (KDR, LHN)
JPG = (BST, SPB)
QRN = (KPG, SLB)
MXX = (LLX, GGN)
QJH = (GVG, XML)
NMQ = (CLT, HXD)
MMM = (BJK, QTG)
PRK = (JTQ, HJJ)
RPB = (CVV, CRN)
LCJ = (QGB, KKM)
FGQ = (DQT, CBM)
SMJ = (GSD, TXM)
KPH = (JPG, XQQ)
BRB = (MQF, CDQ)
HNX = (LDT, JQG)
SXL = (MJS, RTC)
XNF = (NVN, FXN)
LBC = (MNM, VSQ)
BSN = (CFJ, HKJ)
FSN = (SHQ, CTP)
VKC = (CHX, PFX)
MJQ = (THR, FSN)
CGP = (TFJ, CMC)
NFQ = (JPG, XQQ)
NDS = (XPL, KNQ)
LBM = (DGT, HMT)
PXT = (GFH, VHH)
RBB = (QRN, VVL)
JPR = (QJH, HBF)
QSH = (BVC, RSG)
SPV = (NMQ, LMQ)
JSQ = (SXS, CPD)
XXP = (FHQ, BKL)
BQR = (FTG, XRG)
QMS = (KST, RLL)
VSQ = (SHG, GPV)
TGB = (HJS, NPF)
XHV = (NVH, XGP)
CMC = (XBL, TDM)
LQR = (CQF, HQR)
DLF = (BSJ, DGF)
DCC = (BKR, GLT)
VVB = (PGB, PDN)
TVB = (NNC, RXP)
GRT = (PSN, HNB)
VBC = (GJG, DSB)
CVZ = (MRM, SDK)
GQT = (PTL, QCT)
MVF = (VKL, XNJ)
RKS = (CVV, CRN)
MSC = (GVJ, SMR)
KCN = (FCB, RMP)
LFN = (TXR, QKJ)
MQF = (RSJ, XHV)
XRP = (QHX, FDX)
JDH = (SNG, MVG)

View File

@ -0,0 +1,9 @@
RL
AAA = (BBB, CCC)
BBB = (DDD, EEE)
CCC = (ZZZ, GGG)
DDD = (DDD, DDD)
EEE = (EEE, EEE)
GGG = (GGG, GGG)
ZZZ = (ZZZ, ZZZ)

View File

@ -0,0 +1,5 @@
LLR
AAA = (BBB, BBB)
BBB = (AAA, ZZZ)
ZZZ = (ZZZ, ZZZ)

View File

@ -0,0 +1,10 @@
LR
11A = (11B, XXX)
11B = (XXX, 11Z)
11Z = (11B, XXX)
22A = (22B, XXX)
22B = (22C, 22C)
22C = (22Z, 22Z)
22Z = (22B, 22B)
XXX = (XXX, XXX)

98
2023/src/day04.f90 100644
View File

@ -0,0 +1,98 @@
program day4
implicit none
integer, parameter :: max_chars = 200
integer, parameter :: max_cards = 1000
character(200) :: fname
integer :: n_arguments
integer :: n_winning, n_have
character(max_chars) :: str
integer :: card
integer :: pos_col, pos_pipe, str_len
integer :: sum_points = 0
integer :: points, matches
integer :: istat
integer, allocatable :: winning_nums(:)
integer, allocatable :: card_nums(:)
integer :: extra_cards(1:max_cards)
integer :: total_cards = 0
integer :: card_iter
integer :: this_cards
n_arguments = command_argument_count()
if (n_arguments .eq. 3) then
call get_command_argument(1, fname)
print *, "File: ", fname
call get_command_argument(2, str)
read (str, *) n_winning
call get_command_argument(3, str)
read (str, *) n_have
else
print *, "Wrong number of arguments: ", n_arguments
stop
end if
allocate(winning_nums(1:n_winning))
allocate(card_nums(1:n_have))
open(10, file=fname)
do card=1,max_cards
extra_cards = 0
end do
do card=1,max_cards
read(10, "(A)", iostat = istat) str
str_len = len_trim(str)
if (is_iostat_end(istat)) then
exit
else if (str_len .eq. 0) then
exit
end if
pos_col = scan(str, ":")
pos_pipe = scan(str, "|")
read(str((pos_col + 1):(pos_pipe - 1)), *) winning_nums
read(str((pos_pipe + 1):(str_len)), *) card_nums
matches = cal_matches(winning_nums, card_nums)
this_cards = extra_cards(card) + 1
if (matches .gt. 0) then
do card_iter = 1, matches
extra_cards(card + card_iter) = extra_cards(card + card_iter) + this_cards
end do
end if
points = cal_points(matches)
sum_points = sum_points + points
total_cards = total_cards + this_cards
end do
close(10)
print *, "Total points: ", sum_points
print *, "Total cards: ", total_cards
deallocate(winning_nums)
deallocate(card_nums)
contains
function cal_matches(win_nums, held_nums)
integer, intent(in) :: win_nums(:)
integer, intent(in) :: held_nums(:)
integer :: cal_matches
integer :: i1, i2
integer :: l_win, l_held
cal_matches = 0
l_win = size(win_nums)
l_held = size(held_nums)
do i1 = 1,l_win
do i2 = 1,l_held
if (win_nums(i1) .eq. held_nums(i2)) then
cal_matches = cal_matches + 1
end if
end do
end do
end function cal_matches
function cal_points(matches)
integer, intent(in) :: matches
integer :: cal_points
if (matches .eq. 0) then
cal_points = 0
else
cal_points = 2**(matches - 1)
end if
end function cal_points
end program day4

109
2023/src/day05.f90 100644
View File

@ -0,0 +1,109 @@
program day5
implicit none
integer, parameter :: i_kind = selected_int_kind(20)
integer, parameter :: max_chars = 300
integer, parameter :: max_iter = 20
character(200) :: fname
character(max_chars) :: fline
integer :: n_arguments
integer :: istat
integer(kind=i_kind), allocatable :: seedvals(:)
integer(kind=i_kind), allocatable :: dat_source(:), dat_dest(:)
integer(kind=i_kind) :: ldat(1:3)
logical, allocatable :: dat_point_found(:)
integer :: pos_col, num_seeds, num_chars, i, sec
integer(kind=i_kind) :: s_min, d_min, r_len, source_val
integer(kind=i_kind) :: min_val
integer :: min_index
print *, "Number of bits: ", i_kind * 8
n_arguments = command_argument_count()
if (n_arguments .eq. 1) then
call get_command_argument(1, fname)
print *, "File: ", trim(fname)
print *
else
print *, "Wrong number of arguments: ", n_arguments
stop
end if
open(10, file=fname)
read(10, "(A)", iostat = istat) fline
pos_col = scan(fline, ":")
num_seeds = 0
num_chars = len_trim(fline)
do i=pos_col + 1,num_chars
if (fline(i:i) .eq. ' ') then
num_seeds = num_seeds + 1
end if
end do
print *, "Number of seeds: ", num_seeds
allocate(seedvals(1:num_seeds))
allocate(dat_source(1:num_seeds))
allocate(dat_dest(1:num_seeds))
allocate(dat_point_found(1:num_seeds))
read(fline((pos_col + 1):(num_chars)), *) seedvals
read(10, "(A)", iostat = istat) fline
dat_dest = seedvals
do sec=1, max_iter
dat_source = dat_dest
dat_dest = 0
dat_point_found = .false.
read(10, "(A)", iostat = istat) fline
if (is_iostat_end(istat)) then
exit
end if
do
read(10, "(A)", iostat = istat) fline
num_chars = len_trim(fline)
if (is_iostat_end(istat) .or. (num_chars .eq. 0)) then
exit
end if
read(fline, *) ldat
s_min = ldat(2)
d_min = ldat(1)
r_len = ldat(3)
do i=1,num_seeds
source_val = dat_source(i)
if ((source_val .ge. s_min) .and. (source_val .lt. (s_min + r_len))) then
dat_point_found(i) = .true.
dat_dest(i) = source_val - s_min + d_min
!write(*, 20) ldat(1), ldat(2), ldat(3), source_val, dat_dest(i)
end if
end do
end do
do i=1,num_seeds
if (.not. dat_point_found(i)) then
dat_dest(i) = dat_source(i)
!write(*, 21) i, dat_dest(i), dat_dest(i)
end if
end do
!print *
if (is_iostat_end(istat)) then
exit
end if
end do
close(10)
min_val = huge(min_val)
min_index = -1
do i=1,num_seeds
if (dat_dest(i) .lt. min_val) then
min_index = 1
min_val = dat_dest(i)
end if
end do
print "(a, i11)", "Minimum location number: ", min_val
deallocate(seedvals)
deallocate(dat_source)
deallocate(dat_dest)
deallocate(dat_point_found)
!20 format(i4, i4, i4, ': ', i4, ' -> ', i4)
!21 format(i4, ': ', i4, ' -> ', i4)
end program day5

176
2023/src/day05b.f90 100644
View File

@ -0,0 +1,176 @@
program day5b
implicit none
integer, parameter :: i_kind = selected_int_kind(20)
integer, parameter :: max_chars = 300
character(200) :: fname
character(max_chars) :: fline
integer :: n_arguments
integer :: istat
integer(kind=i_kind), allocatable :: seedvals(:)
integer :: n_seeddefs, num_chars, pos_col
integer :: i
integer, parameter :: max_defs = 100
integer(kind=i_kind) :: t1_defs(1:2, 1:max_defs)
integer(kind=i_kind) :: t2_defs(1:2, 1:max_defs)
integer :: t1_i, t2_i, t1_n, t2_n
integer :: sec
integer, parameter :: max_iter = 20
integer(kind=i_kind) :: ldat(1:3)
integer(kind=i_kind) :: sw_l, sw_h, offset
integer(kind=i_kind) :: c_l, c_h
integer(kind=i_kind) :: min_loc_val
print *, "Number of bits: ", i_kind * 8
n_arguments = command_argument_count()
if (n_arguments .eq. 1) then
call get_command_argument(1, fname)
print *, "File: ", trim(fname)
print *
else
print *, "Wrong number of arguments: ", n_arguments
stop
end if
open(10, file=fname)
read(10, "(A)", iostat = istat) fline
pos_col = scan(fline, ":")
n_seeddefs = 0
num_chars = len_trim(fline)
do i=pos_col + 1,num_chars
if (fline(i:i) .eq. ' ') then
n_seeddefs = n_seeddefs + 1
end if
end do
print *, "Number of seed definitions: ", n_seeddefs
allocate(seedvals(1:n_seeddefs))
read(fline((pos_col + 1):(num_chars)), *) seedvals
print *
print "(2i11)", seedvals
print *
do t2_i=1,n_seeddefs/2
t2_defs(1,t2_i) = seedvals(t2_i * 2 - 1)
t2_defs(2,t2_i) = seedvals(t2_i * 2 - 1) + seedvals(t2_i * 2) - 1
end do
t2_n = n_seeddefs/2
print "(2i11)", t2_defs(1:2, 1:t2_n)
read(10, "(A)", iostat = istat) fline
do sec=1, max_iter
t1_defs = t2_defs
t2_defs = -1
t1_n = t2_n
t2_n = 0
t2_i = 0
read(10, "(A)", iostat = istat) fline
if (is_iostat_end(istat)) then
exit
end if
do
read(10, "(A)", iostat = istat) fline
num_chars = len_trim(fline)
if (is_iostat_end(istat) .or. (num_chars .eq. 0)) then
exit
end if
read(fline, *) ldat
sw_l = ldat(2)
sw_h = ldat(2) + ldat(3) - 1
offset = ldat(1) - ldat(2)
do t1_i=1,t1_n
c_l = t1_defs(1,t1_i)
c_h = t1_defs(2,t1_i)
if ((c_l .eq. -1) .and. (c_h .eq. -1)) then
! Already dealt with
continue
else if ((sw_h .lt. c_l) .or. (sw_l .gt. c_h)) then
! Not in range
continue
else if ((c_l .ge. sw_l) .and. (c_h .le. sw_h)) then
! Entirely contained
t2_i = t2_i + 1
if (t2_i .gt. max_defs) then
print *, "Overflow t2"
end if
t2_defs(1, t2_i) = c_l + offset
t2_defs(2, t2_i) = c_h + offset
t1_defs(1:2, t1_i) = -1
t2_n = t2_n + 1
else if ((c_l .lt. sw_l) .and. (c_h .le. sw_h)) then
! Overlap - low
t2_i = t2_i + 1
if (t2_i .gt. max_defs) then
print *, "Overflow t2"
end if
t2_defs(1, t2_i) = sw_l + offset
t2_defs(2, t2_i) = c_h + offset
t1_defs(1, t1_i) = c_l ! No change
t1_defs(2, t1_i) = sw_l - 1
t2_n = t2_n + 1
else if ((c_l .ge. sw_l) .and. (c_h .gt. sw_h)) then
! Overlap - high
t2_i = t2_i + 1
if (t2_i .gt. max_defs) then
print *, "Overflow t2"
end if
t2_defs(1, t2_i) = c_l + offset
t2_defs(2, t2_i) = sw_h + offset
t1_defs(1, t1_i) = sw_h + 1
t1_defs(2, t1_i) = c_h ! No change
t2_n = t2_n + 1
else if ((c_l .lt. sw_l) .and. (c_h .gt. sw_h)) then
! Entirely contained by
t2_i = t2_i + 1
if (t2_i .gt. max_defs) then
print *, "Overflow t2"
end if
t2_defs(1, t2_i) = sw_l + offset
t2_defs(2, t2_i) = sw_h + offset
t1_defs(1, t1_i) = c_l ! No change
t1_defs(2, t1_i) = sw_l - 1
t1_n = t1_n + 1
if (t1_i .gt. max_defs) then
print *, "Overflow t1"
end if
t1_defs(1, t1_n) = sw_h + 1
t1_defs(2, t1_n) = c_h
else
! ??
print *, "Unclear situation"
stop
end if
end do
end do
do t1_i=1,t1_n
c_l = t1_defs(1,t1_i)
c_h = t1_defs(2,t1_i)
if ((c_l .ne. -1) .or. (c_h .ne. -1)) then
t2_i = t2_i + 1
if (t2_i .gt. max_defs) then
print *, "Overflow t2"
end if
t2_defs(1, t2_i) = c_l
t2_defs(2, t2_i) = c_h
t2_n = t2_n + 1
end if
end do
print *
print *, "Ranges after section ", sec
print "(2i11)", t2_defs(1:2, 1:t2_n)
print *, "Number of ranges: ", t2_n
if (is_iostat_end(istat)) then
exit
end if
end do
min_loc_val = huge(min_loc_val)
do t2_i=1,t2_n
if (t2_defs(1, t2_i) .lt. min_loc_val) then
min_loc_val = t2_defs(1, t2_i)
end if
end do
print *
print "(a, i11)", "Lowest location value: ", min_loc_val
close(10)
deallocate(seedvals)
end program day5b

84
2023/src/day06.f90 100644
View File

@ -0,0 +1,84 @@
program day6
implicit none
integer, parameter :: ikind = selected_int_kind(12)
integer, parameter :: max_chars = 300
character(200) :: fname
character(max_chars) :: fline
integer :: n_arguments
integer(kind=ikind), allocatable :: times(:)
integer(kind=ikind), allocatable :: records(:)
integer :: pos_col, n_races, race
integer(kind=ikind) :: i, c_over, dist, win_mult = 1
print *, "Number of bits: ", ikind * 8
n_arguments = command_argument_count()
if (n_arguments .eq. 1) then
call get_command_argument(1, fname)
print *, "File: ", trim(fname)
print *
else
print *, "Wrong number of arguments: ", n_arguments
stop
end if
open(10, file=fname)
read(10, "(A)") fline
pos_col = scan(fline, ":")
n_races = num_ints(fline)
allocate(times(1:n_races))
allocate(records(1:n_races))
print *, "Number of races: ", n_races
read(fline((pos_col + 1):max_chars), *) times
read(10, "(A)") fline
pos_col = scan(fline, ":")
read(fline((pos_col + 1):max_chars), *) records
do race=1,n_races
c_over = 0
do i=1,times(race)-1
dist = i * (times(race) - i)
if (dist .gt. records(race)) then
c_over = c_over + 1
end if
end do
win_mult = win_mult * c_over
write(*, 20) race, c_over
end do
print *
print *, "Tolerance: ", win_mult
20 format("Race: ", i1, ". Ways to win: ", i12)
contains
function num_ints(str)
implicit none
character(*), intent(in) :: str
character(10), parameter :: digits = "0123456789"
integer :: num_ints
integer :: cur, cur0
integer :: str_len
cur = 0
cur0 = 0
num_ints = 0
str_len = len_trim(str)
do
cur = scan(str((cur + 1):str_len), digits) + cur0
if (cur .eq. cur0) then
return
end if
cur0 = cur
num_ints = num_ints + 1
if (cur + 1 .ge. str_len) then
return
end if
cur = verify(str((cur + 1):str_len), digits) + cur0
if (cur .eq. cur0) then
return
else if (cur + 1 .ge. str_len) then
return
end if
cur0 = cur
end do
end function num_ints
end program day6

171
2023/src/day07.f90 100644
View File

@ -0,0 +1,171 @@
program day7
implicit none
integer, parameter :: max_chars = 300
character(200) :: fname
character(max_chars) :: fline
integer :: n_arguments
integer, parameter :: max_hands = 2000
character(len=5) :: hands(1:max_hands)
integer :: bids(1:max_hands)
integer :: rank(1:max_hands)
integer :: i, i2, n_hands
integer :: istat
integer :: beats, winnings, total_winnings
n_arguments = command_argument_count()
if (n_arguments .eq. 1) then
call get_command_argument(1, fname)
print *, "File: ", trim(fname)
print *
else
print *, "Wrong number of arguments: ", n_arguments
stop
end if
open(10, file=fname)
n_hands = 0
do i=1, max_hands
read(10, "(a)", iostat = istat) fline
if ((len_trim(fline) .eq. 0) .or. (is_iostat_end(istat))) then
exit
end if
read(fline, *) hands(i), bids(i)
n_hands = n_hands + 1
end do
close(10)
print *, "Number of hands: ", n_hands
rank = -1
rank(1) = 1
print *
do i=2,n_hands
beats = 0
do i2=1,(i-1)
if (rank_correct(hands(i), hands(i2))) then
! hand i ranks higher than hand i2
if (rank(i2) .gt. beats) then
beats = rank(i2)
end if
write(*, 21) i, hands(i), i2, hands(i2)
else
! hand i ranks lower than hand i2
rank(i2) = rank(i2) + 1
write(*, 22) i, hands(i), i2, hands(i2)
end if
end do
rank(i) = beats+1
end do
print *
total_winnings = 0
do i=1, n_hands
winnings = bids(i) * rank(i)
write(*, 20) hands(i), bids(i), rank(i), winnings
total_winnings = total_winnings + winnings
end do
print *
print *, "Total winnings: ", total_winnings
20 format("Hand: ", a5, "; Bid: ", i4, "; Rank: ", i4, "; Winnings: ", i8)
21 format(i4, " (", a5, ") beats ", i4, " (", a5, ")")
22 format(i4, " (", a5, ") beaten by ", i4, " (", a5, ")")
contains
function hand_type(hand)
character(len=5), intent(in) :: hand
integer :: hand_type
character(len=1) :: dist_cards(1:5)
integer :: card_count(1:5)
integer :: n_dc
integer :: i, i2
character(len=1) :: this_card
logical :: existing_card
integer :: sets(1:5)
dist_cards = ' '
card_count = 0
n_dc = 1
dist_cards(1) = hand(1:1)
card_count(1) = 1
do i=2,5
this_card = hand(i:i)
existing_card = .false.
do i2=1,n_dc
if (dist_cards(i2) .eq. this_card) then
existing_card = .true.
exit
end if
end do
if (existing_card) then
card_count(i2) = card_count(i2) + 1
else
n_dc = n_dc + 1
card_count(n_dc) = 1
dist_cards(n_dc) = this_card
end if
end do
sets = 0
do i=1,n_dc
sets(card_count(i)) = sets(card_count(i)) + 1
end do
if (sets(5) .eq. 1) then
! Five of a kind
hand_type = 7
else if (sets(4) .eq. 1) then
! Four of a kind
hand_type = 6
else if ((sets(3) .eq. 1) .and. (sets(2) .eq. 1)) then
! Full house
hand_type = 5
else if (sets(3) .eq. 1) then
! Three of a kind
hand_type = 4
else if (sets(2) .eq. 2) then
! Two pair
hand_type = 3
else if (sets(2) .eq. 1) then
! One pair
hand_type = 2
else
! High card
hand_type = 1
end if
end function hand_type
function tiebreak(hand1, hand2)
! True if hand1 would tiebreak ahead of hand2
implicit none
character(len=5), intent(in) :: hand1, hand2
logical :: tiebreak
character(len=13) :: cards = "23456789TJQKA"
integer :: pos_1, pos_2, i
do i=1,5
pos_1 = scan(cards, hand1(i:i))
pos_2 = scan(cards, hand2(i:i))
if (pos_1 .lt. pos_2) then
tiebreak = .false.
return
else if (pos_1 .gt. pos_2) then
tiebreak = .true.
return
end if
end do
tiebreak = .true.
end function tiebreak
function rank_correct(hand1, hand2)
implicit none
character(len=5), intent(in) :: hand1, hand2
logical :: rank_correct
integer :: h1_type, h2_type
h1_type = hand_type(hand1)
h2_type = hand_type(hand2)
if (h1_type .gt. h2_type) then
rank_correct = .true.
else if (h1_type .lt. h2_type) then
rank_correct = .false.
else
rank_correct = tiebreak(hand1, hand2)
end if
end function rank_correct
end program day7

188
2023/src/day07b.f90 100644
View File

@ -0,0 +1,188 @@
program day7b
implicit none
integer, parameter :: max_chars = 300
character(200) :: fname
character(max_chars) :: fline
integer :: n_arguments
integer, parameter :: max_hands = 2000
character(len=5) :: hands(1:max_hands)
integer :: bids(1:max_hands)
integer :: rank(1:max_hands)
integer :: i, i2, n_hands
integer :: istat
integer :: beats, winnings, total_winnings
n_arguments = command_argument_count()
if (n_arguments .eq. 1) then
call get_command_argument(1, fname)
print *, "File: ", trim(fname)
print *
else
print *, "Wrong number of arguments: ", n_arguments
stop
end if
open(10, file=fname)
n_hands = 0
do i=1, max_hands
read(10, "(a)", iostat = istat) fline
if ((len_trim(fline) .eq. 0) .or. (is_iostat_end(istat))) then
exit
end if
read(fline, *) hands(i), bids(i)
n_hands = n_hands + 1
end do
close(10)
print *, "Number of hands: ", n_hands
rank = -1
rank(1) = 1
print *
do i=2,n_hands
beats = 0
do i2=1,(i-1)
if (rank_correct(hands(i), hands(i2))) then
! hand i ranks higher than hand i2
if (rank(i2) .gt. beats) then
beats = rank(i2)
end if
write(*, 21) i, hands(i), i2, hands(i2)
else
! hand i ranks lower than hand i2
rank(i2) = rank(i2) + 1
write(*, 22) i, hands(i), i2, hands(i2)
end if
end do
rank(i) = beats+1
end do
print *
total_winnings = 0
do i=1, n_hands
winnings = bids(i) * rank(i)
write(*, 20) hands(i), bids(i), hand_type(hands(i)), rank(i), winnings
total_winnings = total_winnings + winnings
end do
print *
print *, "Total winnings: ", total_winnings
20 format("Hand: ", a5, "; Bid: ", i4, "; Type: ", i1, "; Rank: ", i4, "; Winnings: ", i8)
21 format(i4, " (", a5, ") beats ", i4, " (", a5, ")")
22 format(i4, " (", a5, ") b. by ", i4, " (", a5, ")")
contains
function hand_type(hand)
character(len=5), intent(in) :: hand
integer :: hand_type
character(len=1) :: dist_cards(1:5)
integer :: card_count(1:5)
integer :: n_dc
integer :: i, i2
character(len=1) :: this_card
logical :: existing_card
integer :: sets(1:5)
integer :: n_jokers
dist_cards = ' '
card_count = 0
n_dc = 1
dist_cards(1) = hand(1:1)
card_count(1) = 1
do i=2,5
this_card = hand(i:i)
existing_card = .false.
do i2=1,n_dc
if (dist_cards(i2) .eq. this_card) then
existing_card = .true.
exit
end if
end do
if (existing_card) then
card_count(i2) = card_count(i2) + 1
else
n_dc = n_dc + 1
card_count(n_dc) = 1
dist_cards(n_dc) = this_card
end if
end do
sets = 0
n_jokers = 0
do i=1,n_dc
if (dist_cards(i) .ne. 'J') then
sets(card_count(i)) = sets(card_count(i)) + 1
else
n_jokers = card_count(i)
end if
end do
if (n_jokers .eq. 5) then
sets(5) = 1
else if (n_jokers .gt. 0) then
do i=4,1,-1
if (sets(i) .gt. 0) then
sets(i + n_jokers) = 1
sets(i) = sets(i) - 1
exit
end if
end do
end if
if (sets(5) .eq. 1) then
! Five of a kind
hand_type = 7
else if (sets(4) .eq. 1) then
! Four of a kind
hand_type = 6
else if ((sets(3) .eq. 1) .and. (sets(2) .eq. 1)) then
! Full house
hand_type = 5
else if (sets(3) .eq. 1) then
! Three of a kind
hand_type = 4
else if (sets(2) .eq. 2) then
! Two pair
hand_type = 3
else if (sets(2) .eq. 1) then
! One pair
hand_type = 2
else
! High card
hand_type = 1
end if
end function hand_type
function tiebreak(hand1, hand2)
! True if hand1 would tiebreak ahead of hand2
implicit none
character(len=5), intent(in) :: hand1, hand2
logical :: tiebreak
character(len=13) :: cards = "J23456789TQKA"
integer :: pos_1, pos_2, i
do i=1,5
pos_1 = scan(cards, hand1(i:i))
pos_2 = scan(cards, hand2(i:i))
if (pos_1 .lt. pos_2) then
tiebreak = .false.
return
else if (pos_1 .gt. pos_2) then
tiebreak = .true.
return
end if
end do
tiebreak = .true.
end function tiebreak
function rank_correct(hand1, hand2)
implicit none
character(len=5), intent(in) :: hand1, hand2
logical :: rank_correct
integer :: h1_type, h2_type
h1_type = hand_type(hand1)
h2_type = hand_type(hand2)
if (h1_type .gt. h2_type) then
rank_correct = .true.
else if (h1_type .lt. h2_type) then
rank_correct = .false.
else
rank_correct = tiebreak(hand1, hand2)
end if
end function rank_correct
end program day7b

76
2023/src/day08.f90 100644
View File

@ -0,0 +1,76 @@
program day8
implicit none
integer, parameter :: max_chars = 400
integer, parameter :: max_nodes = 1000
integer, parameter :: max_iter = 100000
character(200) :: fname
character(max_chars) :: fline
integer :: n_arguments
integer :: istat
character(max_chars) :: dir_ins
integer :: n_dir_ins
integer :: n_nodes
character(len=3) :: node
character(len=1) :: dir
character(len=3) :: nodes(1:max_nodes), lnodes(1:max_nodes), rnodes(1:max_nodes)
integer :: i, i2, cur, LRcur
n_arguments = command_argument_count()
if (n_arguments .eq. 1) then
call get_command_argument(1, fname)
print *, "File: ", trim(fname)
print *
else
print *, "Wrong number of arguments: ", n_arguments
stop
end if
open(10, file=fname)
read(10, "(a)") dir_ins
n_dir_ins = len_trim(dir_ins)
read(10, "(a)") fline
n_nodes = 0
do i=1,max_nodes
read(10, "(a)", iostat=istat) fline
if ((len_trim(fline) .eq. 0) .or. (is_iostat_end(istat))) then
exit
end if
read(fline(1:3), "(a)") nodes(i)
read(fline(8:10), "(a)") lnodes(i)
read(fline(13:15), "(a)") rnodes(i)
n_nodes = n_nodes + 1
end do
close(10)
cur = -1
do i=1, n_nodes
if (nodes(i) .eq. "AAA") then
cur = i
exit
end if
end do
do i=1,max_iter
LRcur = mod(i-1, n_dir_ins) + 1
dir = dir_ins(LRcur:LRcur)
if (dir .eq. "L") then
node = lnodes(cur)
else
node = rnodes(cur)
end if
do i2=1, n_nodes
if (nodes(i2) .eq. node) then
cur = i2
exit
end if
end do
if (nodes(cur) .eq. "ZZZ") then
exit
end if
end do
if (nodes(cur) .eq. "ZZZ") then
print *, "Found node ZZZ after ", i, " iterations"
else
print *, "Did not find node ZZZ after ", i, " iterations"
end if
end program day8

124
2023/src/day08b.f90 100644
View File

@ -0,0 +1,124 @@
program day8b
implicit none
integer, parameter :: max_chars = 400
integer, parameter :: max_nodes = 1000
integer, parameter :: max_iter = 100000
character(200) :: fname
character(max_chars) :: fline
integer :: n_arguments
integer :: istat
character(max_chars) :: dir_ins
integer :: n_dir_ins
integer :: n_nodes
character(len=3) :: node
character(len=1) :: dir
character(len=3) :: nodes(1:max_nodes), lnodes(1:max_nodes), rnodes(1:max_nodes)
integer :: periods(max_nodes)
integer :: cursors(max_nodes)
integer :: n_cursors
integer :: i, ic, i2, LRcur, i3
logical :: found_z
integer, parameter :: b_kind = selected_int_kind(20)
integer(kind=b_kind) :: p_sum
n_arguments = command_argument_count()
if (n_arguments .eq. 1) then
call get_command_argument(1, fname)
print *, "File: ", trim(fname)
print *
else
print *, "Wrong number of arguments: ", n_arguments
stop
end if
open(10, file=fname)
read(10, "(a)") dir_ins
n_dir_ins = len_trim(dir_ins)
read(10, "(a)") fline
n_nodes = 0
do i=1,max_nodes
read(10, "(a)", iostat=istat) fline
if ((len_trim(fline) .eq. 0) .or. (is_iostat_end(istat))) then
exit
end if
read(fline(1:3), "(a)") nodes(i)
read(fline(8:10), "(a)") lnodes(i)
read(fline(13:15), "(a)") rnodes(i)
n_nodes = n_nodes + 1
end do
close(10)
cursors = -1
n_cursors = 0
do i=1, n_nodes
if (nodes(i)(3:3) .eq. "A") then
n_cursors = n_cursors + 1
cursors(n_cursors) = i
end if
end do
print *, "Number of cursors: ", n_cursors
periods = 0
do i=1,max_iter
LRcur = mod(i-1, n_dir_ins) + 1
dir = dir_ins(LRcur:LRcur)
do ic=1,n_cursors
if (dir .eq. "L") then
node = lnodes(cursors(ic))
else
node = rnodes(cursors(ic))
end if
do i2=1, n_nodes
if (nodes(i2) .eq. node) then
cursors(ic) = i2
exit
end if
end do
end do
found_z = .true.
do ic=1,n_cursors
if (nodes(cursors(ic))(3:3) .ne. "Z") then
found_z = .false.
else if (periods(ic) .eq. 0) then
periods(ic) = i
end if
end do
if (found_z) then
exit
end if
end do
if (found_z) then
print *, "Found nodes ending in Z after ", i, " iterations"
else
print *, "Did not find nodes ending in Z after ", max_iter, " iterations"
print *, "Periods:"
print "(1i9)", periods(1:n_cursors)
p_sum = 1
print *
do ic=1,n_cursors
p_sum = p_sum * periods(ic)
end do
print *, "Potential answer: ", p_sum
do i=1,n_cursors-1
do i2 = i+1,n_cursors
do i3=2,periods(i2)
if (mod(periods(i), i3) .eq. 0 .and. mod(periods(i2), i3) .eq. 0) then
do
periods(i) = periods(i) / i3
if (mod(periods(i), i3) .ne. 0) then
exit
end if
end do
end if
end do
end do
end do
print *, "Factors: "
print "(1i9)", periods(1:n_cursors)
p_sum = 1
print *
do ic=1,n_cursors
p_sum = p_sum * periods(ic)
end do
print *, "Potential answer: ", p_sum
end if
end program day8b

View File

@ -0,0 +1,18 @@
program day
implicit none
integer, parameter :: max_chars = 300
character(200) :: fname
character(max_chars) :: fline
integer :: n_arguments
n_arguments = command_argument_count()
integer :: istat
if (n_arguments .eq. 1) then
call get_command_argument(1, fname)
print *, "File: ", trim(fname)
print *
else
print *, "Wrong number of arguments: ", n_arguments
stop
end if
end program day

View File

@ -6,4 +6,8 @@ Structure:
* Makefile * Makefile
* src/ * src/
* bin/ * bin/
* 2023
* Makefile
* src/
* bin/