summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--2024/d01.ml20
-rw-r--r--2024/d02.example_input6
-rw-r--r--2024/d02.input1000
-rw-r--r--2024/d02.lisp48
4 files changed, 1074 insertions, 0 deletions
diff --git a/2024/d01.ml b/2024/d01.ml
new file mode 100644
index 0000000..310f6ac
--- /dev/null
+++ b/2024/d01.ml
@@ -0,0 +1,20 @@
+let () = print_endline "hello"
+
+let read_file_into_lists filename =
+  let in_channel = open_in filename in
+  let rec read_lines left right =
+    try
+      let line = input_line in_channel in
+      match String.split_on_char '\t' line with
+      | [l; r] ->
+         read_lines (int_of_string l :: left) (int_of_string r :: right)
+      | _ -> failwith "invalid line format"
+    with End_of_file ->
+      close_in in_channel;
+      (List.rev left, List.rev right)
+  in read_lines [] []
+
+let () =
+  let left_nums, right_nums = read_file_into_lists "d01.input" in
+  Print.printf "Left numbers: %s\n" (String.concat " " (List.map string_of_int left_nums));
+  Print.printf "Right numbers: %s\n" (String.concat " " (List.map string_of_int right_nums));;
diff --git a/2024/d02.example_input b/2024/d02.example_input
new file mode 100644
index 0000000..b49c10d
--- /dev/null
+++ b/2024/d02.example_input
@@ -0,0 +1,6 @@
+7 6 4 2 1
+1 2 7 8 9
+9 7 6 2 1
+1 3 2 4 5
+8 6 4 4 1
+1 3 6 7 9
diff --git a/2024/d02.input b/2024/d02.input
new file mode 100644
index 0000000..7407262
--- /dev/null
+++ b/2024/d02.input
@@ -0,0 +1,1000 @@
+2 4 6 9 10 9
+45 48 51 52 55 58 60 60
+49 52 54 57 58 61 64 68
+23 26 28 29 34
+48 50 47 48 51 54 55
+47 49 52 55 58 57 54
+1 3 4 2 4 6 7 7
+42 43 40 42 44 48
+5 8 10 12 11 16
+2 5 5 8 9
+43 44 45 47 47 44
+31 34 34 36 37 37
+82 84 87 87 90 94
+69 71 71 73 74 81
+71 73 77 78 80 81 84
+29 32 36 39 38
+74 77 78 82 84 84
+10 13 17 19 21 23 25 29
+21 23 27 29 31 32 37
+33 34 39 40 43 44 47 50
+39 40 42 44 45 51 48
+46 48 51 56 58 60 60
+9 12 13 20 24
+26 29 30 33 38 39 45
+27 24 26 29 30 33 36
+55 54 55 56 55
+36 33 35 37 38 40 43 43
+73 72 75 78 79 81 85
+52 49 52 54 61
+66 64 63 65 66 67 69
+14 11 12 14 17 14 11
+11 10 13 15 14 14
+41 38 39 40 38 42
+91 88 86 87 92
+47 44 46 47 48 48 50
+91 89 92 93 93 90
+40 37 37 38 41 41
+60 59 60 63 65 68 68 72
+28 27 28 28 33
+74 71 73 74 76 80 81
+30 28 32 34 32
+51 50 53 54 55 58 62 62
+68 67 70 72 76 80
+17 14 15 19 25
+74 72 75 78 84 87 90 92
+34 32 38 41 42 41
+12 11 12 15 18 24 25 25
+75 74 75 78 79 86 90
+81 78 84 87 88 89 94
+72 72 73 76 78
+22 22 23 24 25 28 26
+47 47 49 50 53 55 55
+19 19 20 23 26 28 32
+23 23 26 27 28 30 32 39
+93 93 94 97 94 96 99
+80 80 83 84 87 84 81
+27 27 30 31 28 31 33 33
+18 18 21 18 22
+51 51 54 51 52 53 60
+24 24 24 27 30
+79 79 79 80 77
+81 81 84 84 86 89 89
+46 46 46 49 52 56
+46 46 46 47 48 54
+40 40 44 47 49 50 53 56
+42 42 45 49 52 54 51
+21 21 24 28 31 31
+66 66 70 71 74 78
+79 79 81 82 83 85 89 94
+18 18 21 26 27
+53 53 58 61 62 59
+57 57 59 61 67 67
+83 83 84 90 94
+4 4 6 11 17
+12 16 17 18 21 24 27 30
+28 32 35 36 38 37
+18 22 25 26 26
+74 78 81 84 86 89 93
+5 9 10 12 13 15 18 23
+57 61 60 63 66
+69 73 74 77 75 76 78 75
+30 34 31 32 32
+77 81 84 86 84 88
+8 12 14 13 15 18 20 26
+61 65 65 66 69
+3 7 10 10 13 15 12
+84 88 90 92 94 94 94
+19 23 26 29 30 30 34
+68 72 75 75 80
+58 62 66 69 71
+9 13 17 18 21 22 19
+7 11 15 16 19 22 22
+23 27 29 33 34 38
+62 66 68 72 78
+54 58 64 67 70 73 74 77
+69 73 78 81 78
+67 71 77 80 83 84 84
+70 74 75 80 84
+40 44 50 51 53 56 61
+65 70 73 75 77
+33 38 40 42 44 43
+43 50 52 53 53
+33 38 41 43 44 48
+72 79 82 85 87 89 92 99
+74 79 81 84 87 84 85
+13 19 21 18 19 16
+89 95 92 94 97 98 98
+35 41 44 47 48 46 50
+35 40 43 41 48
+8 14 16 18 18 19 20
+40 47 49 50 50 51 54 52
+21 26 28 29 29 30 33 33
+40 45 47 48 48 52
+48 53 55 55 61
+54 59 60 64 66 67 68
+35 42 44 46 47 51 49
+40 45 47 51 53 53
+17 22 26 27 31
+75 81 85 87 94
+44 50 57 60 63 65
+48 53 56 63 60
+47 52 54 59 61 61
+27 33 38 41 45
+66 71 72 77 80 83 90
+30 28 27 24 22 21 24
+17 16 15 13 11 8 7 7
+37 36 34 33 31 30 29 25
+93 91 90 87 80
+18 16 15 13 14 11
+77 74 71 70 67 69 70
+49 46 45 44 47 47
+80 79 77 76 77 74 70
+50 49 47 50 49 48 47 42
+86 83 80 80 77
+66 64 61 61 59 57 55 57
+62 60 58 58 55 53 53
+63 60 60 57 53
+59 57 57 56 53 50 48 41
+98 96 92 91 89 88 87
+98 95 91 89 86 88
+78 77 74 72 69 65 65
+15 13 12 10 9 5 1
+62 59 58 54 47
+99 98 97 92 89
+84 83 82 76 75 73 76
+47 44 39 36 35 33 33
+42 39 33 30 29 26 22
+34 32 31 29 27 21 19 13
+55 56 55 54 52
+86 89 88 85 82 83
+72 74 73 70 69 66 66
+70 72 70 68 65 63 60 56
+82 83 82 79 77 76 73 68
+38 41 44 43 40 38
+2 5 4 7 4 5
+79 81 80 83 83
+26 27 24 27 24 23 19
+22 25 26 23 21 18 16 9
+18 21 19 17 17 16
+52 55 53 53 50 49 51
+25 27 26 26 23 21 21
+9 11 8 8 4
+23 26 23 21 21 18 17 12
+54 55 53 51 47 45
+79 82 80 76 75 73 71 72
+69 71 67 64 62 60 60
+26 29 28 24 20
+71 74 70 69 67 64 58
+82 83 76 75 74 73 72
+79 82 80 75 73 75
+7 10 5 3 1 1
+84 87 86 80 78 75 71
+27 28 21 20 17 15 8
+90 90 89 86 84
+35 35 34 32 31 29 26 28
+57 57 55 54 52 49 49
+51 51 50 47 43
+65 65 63 61 59 58 57 52
+44 44 43 40 37 35 38 35
+24 24 22 20 18 21 18 19
+76 76 75 78 78
+39 39 36 39 36 35 31
+39 39 40 38 31
+28 28 25 22 22 19
+12 12 9 8 8 6 4 7
+19 19 16 16 16
+63 63 62 59 59 55
+87 87 87 85 78
+64 64 61 57 55 53 50
+61 61 58 54 56
+17 17 14 10 8 8
+48 48 46 42 41 40 39 35
+29 29 25 22 17
+60 60 57 55 52 47 44
+63 63 62 60 54 53 51 52
+98 98 92 91 91
+46 46 43 41 38 32 28
+37 37 32 29 26 23 21 14
+57 53 52 49 48 46 45
+85 81 79 78 76 78
+24 20 17 16 13 12 9 9
+39 35 34 32 28
+56 52 50 47 46 45 44 38
+13 9 11 9 6
+98 94 92 90 92 90 89 90
+28 24 25 22 20 20
+42 38 35 33 35 33 29
+23 19 17 18 17 14 12 6
+35 31 29 26 25 25 24 23
+23 19 16 14 11 8 8 11
+82 78 78 76 76
+44 40 40 37 33
+45 41 39 38 38 31
+77 73 70 68 64 63 62
+52 48 47 43 40 39 38 40
+74 70 66 63 63
+55 51 47 46 45 44 40
+71 67 64 63 59 58 57 52
+49 45 43 40 39 36 30 28
+44 40 37 35 29 31
+27 23 21 20 19 16 11 11
+55 51 46 45 41
+83 79 77 71 70 68 62
+16 9 7 4 3
+67 62 60 57 58
+30 24 21 19 18 17 14 14
+21 15 13 11 7
+27 22 20 19 16 13 11 5
+15 8 7 8 5
+53 46 43 40 41 38 39
+76 70 69 66 68 68
+39 32 34 32 29 26 25 21
+92 85 83 86 84 81 76
+27 20 18 17 16 16 15
+21 14 11 9 8 8 9
+27 22 21 21 19 19
+58 53 53 51 48 47 43
+66 59 56 56 53 46
+70 64 60 59 56
+48 43 40 39 35 38
+61 54 50 48 46 46
+72 67 63 62 61 60 56
+96 91 87 84 77
+60 55 50 48 47 45
+43 38 35 29 28 25 27
+94 89 88 86 84 78 77 77
+58 51 48 46 43 41 34 30
+35 29 26 20 13
+87 90 91 92 89
+9 10 11 13 15 15
+5 6 7 8 11 14 15 19
+61 64 66 68 69 76
+64 66 67 69 71 74 73 75
+13 14 17 16 18 17
+91 94 97 94 96 96
+87 88 87 88 90 93 97
+47 49 51 48 53
+29 30 33 35 38 40 40 41
+58 61 62 65 68 68 71 69
+4 6 9 9 9
+73 76 77 79 79 81 85
+30 32 34 34 39
+24 27 30 31 35 38 41
+69 72 76 78 77
+29 31 33 37 37
+66 68 70 72 76 80
+82 84 87 91 98
+68 71 74 79 81 84 86
+72 75 77 78 81 86 88 86
+11 14 20 21 21
+44 46 48 49 50 56 57 61
+31 34 35 38 40 41 48 53
+56 53 55 56 58 60
+56 53 56 59 61 62 61
+9 8 10 13 13
+7 4 5 8 9 11 15
+29 27 29 32 38
+10 8 10 11 10 13
+77 74 77 76 73
+80 79 81 83 82 84 84
+68 65 67 64 68
+45 44 41 44 46 47 50 57
+15 14 16 17 17 19 22 23
+28 26 27 27 25
+67 64 64 67 70 70
+10 7 10 12 12 13 17
+56 54 54 55 62
+23 20 22 26 27 30
+29 28 31 35 33
+21 19 23 25 25
+37 35 39 42 43 47
+60 57 61 64 69
+49 47 54 57 58 59 60
+76 74 79 81 78
+60 57 58 64 67 67
+59 57 64 65 69
+80 77 78 85 88 95
+72 72 73 75 77 78 81 84
+91 91 93 94 95 97 94
+62 62 65 68 71 74 74
+31 31 33 36 37 38 41 45
+80 80 83 85 87 88 91 96
+39 39 40 37 40 41 42
+87 87 85 88 90 88
+49 49 52 49 49
+50 50 51 52 50 54
+43 43 45 43 46 49 50 56
+43 43 43 46 48
+21 21 24 25 28 28 27
+3 3 3 4 7 8 11 11
+48 48 51 51 55
+62 62 65 67 70 72 72 79
+29 29 32 36 39 41
+37 37 41 43 44 46 44
+15 15 19 20 21 23 25 25
+71 71 75 78 82
+69 69 73 76 79 82 89
+84 84 86 87 94 96
+75 75 76 82 83 85 83
+44 44 45 48 51 57 57
+71 71 76 77 80 81 82 86
+84 84 90 91 96
+60 64 65 67 69 71
+46 50 52 53 55 58 57
+36 40 43 46 47 49 49
+28 32 35 38 39 43
+26 30 32 34 35 41
+21 25 28 25 28
+35 39 37 40 42 40
+37 41 43 40 42 42
+20 24 25 27 29 28 32
+46 50 53 54 52 54 59
+84 88 89 90 92 92 94
+55 59 59 60 62 65 62
+48 52 54 54 57 60 63 63
+63 67 69 70 72 72 75 79
+74 78 78 79 82 85 86 91
+64 68 71 75 77
+14 18 19 23 21
+47 51 55 58 61 61
+14 18 22 23 27
+72 76 77 78 81 85 86 91
+82 86 88 94 95 96 98
+39 43 46 53 56 54
+10 14 15 18 24 24
+70 74 75 78 85 87 91
+40 44 45 48 50 55 61
+4 11 12 14 16
+48 53 56 58 61 59
+32 37 40 41 41
+10 15 17 20 23 25 27 31
+78 84 86 87 89 90 97
+89 94 92 95 96
+41 46 49 51 52 53 50 47
+84 90 91 89 92 92
+61 66 64 66 68 70 74
+75 81 84 81 86
+13 18 18 21 24 26 29
+39 46 47 48 51 51 48
+12 19 19 21 21
+10 15 15 18 22
+72 78 80 82 82 87
+67 72 75 78 81 85 87
+56 63 67 70 73 72
+81 88 92 95 96 99 99
+1 7 8 12 13 15 19
+21 28 29 31 33 37 40 46
+44 51 52 59 60 63
+12 17 19 24 22
+35 41 46 49 52 54 56 56
+25 32 34 37 44 45 49
+47 52 55 62 67
+30 27 24 23 21 23
+72 69 68 66 65 63 61 61
+84 82 81 78 75 72 68
+86 83 81 79 78 75 70
+58 57 59 57 55
+14 13 11 13 12 9 11
+23 20 23 21 20 19 18 18
+66 64 62 63 59
+45 43 45 42 36
+42 39 37 37 35 33
+12 10 9 8 5 5 6
+56 53 53 51 51
+86 84 83 82 80 79 79 75
+87 84 81 78 78 72
+36 33 29 27 26 25
+73 72 71 69 65 62 64
+41 39 37 34 31 27 27
+51 50 49 46 45 41 37
+70 69 67 65 63 60 56 51
+81 78 76 73 72 70 64 61
+65 63 57 54 52 49 48 49
+53 50 48 42 40 39 39
+46 44 42 40 38 37 31 27
+65 64 63 57 55 53 52 45
+71 73 72 69 66 63 60 57
+62 65 64 63 60 57 56 57
+80 83 82 79 78 76 74 74
+73 74 71 69 68 67 63
+50 52 51 49 43
+14 16 14 11 8 11 8 7
+73 74 76 73 76
+7 10 7 8 5 4 1 1
+37 40 38 37 36 35 38 34
+72 75 72 74 72 71 68 62
+55 56 53 53 52
+2 4 4 2 5
+32 35 32 29 26 23 23 23
+79 81 81 80 77 76 73 69
+69 71 68 68 62
+23 24 22 18 16
+67 68 65 62 58 60
+17 20 16 13 11 11
+28 29 25 23 19
+87 90 86 83 81 76
+42 44 37 36 34 33
+9 10 8 3 2 1 2
+91 93 91 88 81 78 78
+33 36 34 28 27 23
+88 90 84 83 80 77 76 71
+26 26 25 22 19 16 14
+86 86 83 82 85
+65 65 63 60 59 57 55 55
+94 94 93 90 87 85 81
+31 31 30 29 27 22
+31 31 30 29 26 27 26 25
+77 77 76 75 72 73 76
+89 89 87 89 86 86
+80 80 81 80 76
+19 19 18 19 14
+99 99 96 95 95 93 90 89
+19 19 17 14 11 11 13
+18 18 18 15 13 13
+69 69 67 67 65 61
+90 90 87 87 85 83 76
+47 47 44 40 39
+12 12 10 6 4 2 4
+18 18 14 13 11 11
+67 67 63 60 56
+50 50 49 48 47 44 40 35
+51 51 44 41 38 36
+90 90 83 82 80 79 82
+56 56 54 53 48 47 46 46
+83 83 82 76 72
+24 24 21 15 10
+87 83 81 79 77 76 73
+93 89 88 87 84 86
+86 82 80 77 77
+26 22 19 18 14
+38 34 32 31 26
+48 44 45 44 41 39 36 34
+84 80 83 80 82
+99 95 97 95 94 94
+41 37 38 37 34 31 27
+56 52 49 51 50 47 40
+24 20 19 18 15 15 12
+74 70 68 67 66 66 65 67
+83 79 79 76 74 73 73
+49 45 42 41 39 36 36 32
+75 71 70 70 63
+18 14 10 9 6 3 2
+47 43 39 36 38
+54 50 47 45 42 38 37 37
+37 33 30 29 25 22 21 17
+78 74 70 68 65 62 57
+22 18 13 12 10 7 6
+35 31 28 27 26 19 18 21
+53 49 48 46 40 37 37
+81 77 76 69 68 65 61
+49 45 42 41 36 33 31 25
+47 40 37 35 34 32 29
+23 17 15 13 12 10 11
+90 85 83 82 81 81
+62 57 56 55 53 52 51 47
+68 61 60 58 57 54 47
+28 23 22 24 23 20 18
+96 91 90 88 87 85 86 87
+16 11 8 7 10 9 9
+98 93 92 95 94 90
+42 35 34 32 29 28 31 24
+44 39 37 34 34 33 31 30
+26 21 21 19 16 15 18
+90 84 82 80 78 76 76 76
+75 70 67 66 66 65 61
+31 24 24 23 16
+19 13 10 9 8 4 3
+73 66 65 61 59 56 55 58
+82 77 76 75 71 69 66 66
+71 65 61 59 55
+72 66 63 59 56 50
+75 68 65 63 57 55 54 51
+32 27 24 17 16 15 13 16
+41 34 27 26 23 23
+47 40 37 35 32 30 23 19
+68 62 57 55 52 51 49 43
+13 13 12 5 1
+39 36 38 42 43
+34 32 38 39 41 44 46 44
+95 98 96 94 92 89 86
+15 21 23 24 25 27 27
+13 11 12 15 14
+72 72 74 75 76 79 81 84
+93 87 83 82 83
+62 60 63 64 71 78
+26 26 28 30 33 37 35
+63 60 57 57 56 53 50 48
+33 38 41 43 47
+93 95 95 94 91 90 86
+60 65 67 64 65 66 69 69
+48 52 55 59 61 64 64
+9 14 15 17 17 20
+86 88 90 92 92 95 95
+61 55 53 53 56
+19 20 17 16 11
+46 52 54 59 57
+20 20 21 18 20 21 18
+73 74 77 75 76 79 77
+57 58 59 61 65 65
+97 97 95 92 89 82 82
+3 7 8 12 19
+54 57 58 62 65 68 71
+46 49 55 56 57 58 62
+82 78 77 78 74
+74 73 75 78 80 86
+85 85 83 82 82 82
+51 54 56 57 57
+17 16 14 11 11 8 6 9
+65 65 60 58 55 52 51 49
+3 7 8 15 18 20 18
+66 70 74 77 78 82
+67 67 67 64 62 64
+63 60 59 57 54 53 49
+44 51 53 56 58 57
+36 37 32 30 26
+50 53 50 45 42
+23 19 17 15 13 16 11
+81 77 71 69 69
+32 28 25 21 22
+68 71 74 77 81 86
+11 15 17 18 18
+86 86 85 84 79 77 75 78
+39 36 37 42 42
+10 10 7 5 3 1 1
+11 10 10 11 15
+85 78 77 77 75 69
+50 49 52 50 50
+19 14 11 10 8 7 4 4
+62 63 59 58 56 54 52 46
+74 70 70 69 65
+90 90 93 94 94 92
+50 49 48 45 43 42 42
+58 57 58 59 59 58
+24 19 18 16 15 8 6
+2 2 4 3 6 7 7
+61 63 60 61 61
+22 19 16 14 11 14 10
+10 16 19 23 24 27 34
+90 90 91 95 96
+32 36 38 38 40 40
+72 69 70 71 73
+60 64 62 65 71
+28 35 38 40 43
+26 19 17 15 11 8
+87 87 84 81 80 82
+76 80 84 86 85
+92 92 91 88 90 88 90
+56 63 65 66 68 70 72 77
+10 13 15 17 20 20 26
+14 16 14 11 7 6
+58 59 58 52 53
+33 31 30 23 21 18 12
+23 25 27 29 33
+59 63 65 63 64 65 69
+68 70 68 69 68 67
+98 98 95 92 87 84 79
+32 34 33 32 29 26 25 26
+70 64 62 61 60 59
+66 63 60 57 57 54 50
+86 84 82 80 77 73 71 67
+15 18 19 19 23
+29 25 22 19 17 14 11 5
+83 87 90 93 90 93 96
+64 62 60 57 59
+12 12 13 14 17 21
+61 68 69 68 74
+30 23 21 24 18
+70 66 66 64 62 59 59
+63 60 59 55 48
+96 96 98 95 95
+54 54 60 61 64 65 68 71
+54 55 58 59 65 67 69
+85 79 76 75 75 71
+93 87 86 84 77 76 74 77
+62 63 66 73 79
+78 81 84 86 87 86
+53 52 50 44 41 38
+13 17 19 22 24 28
+96 90 83 81 80 74
+69 69 71 77 77
+2 5 7 7 4
+45 45 43 40 34
+79 81 79 79 78 75 72
+86 84 87 88 90 92 95 95
+65 67 68 69 70 76
+53 50 52 56 57 58 60 67
+49 51 54 53 49
+42 39 41 44 47 44 46
+84 83 81 78 75 73 71 65
+89 83 82 85 84 82 79
+75 74 71 69 65 62
+29 30 32 33 38 36
+33 26 23 22 15 11
+39 32 30 28 27 26 20
+48 48 50 51 52 56 56
+58 52 49 46 45 41 34
+94 93 91 89 89 87 85 80
+84 87 90 90 92 93
+21 21 19 21 15
+37 37 35 33 29
+65 62 61 64 65 66 63
+58 58 61 62 67 69 70 68
+26 26 31 33 37
+59 65 66 68 75 79
+6 12 13 15 19 22 24 28
+38 38 39 42 43 42 45 49
+44 44 40 39 35
+81 77 76 73 76 73 70
+25 28 27 23 24
+20 20 23 20 16
+18 22 25 24 26 26
+59 61 60 63 64 68
+72 76 79 81 84 86 90 92
+46 46 49 49 51 52 56
+89 85 83 82 82 83
+5 12 14 18 18
+63 63 62 61 60 60 57 51
+53 49 48 46 44 41 37
+26 22 19 17 14 12 10 12
+78 82 83 85 87 90 90 91
+43 42 37 36 34 31 31
+85 82 80 79 81 80
+84 87 89 86 80
+35 29 28 25 23 19 19
+30 26 24 23 23 21 19
+37 37 34 32 32 29 27 23
+95 97 99 96 96
+40 36 34 33 29 28 24
+21 21 22 25 28 35
+91 91 89 88 84 82 79 80
+80 85 88 90 92 90 87
+81 79 80 81 80 81 83 87
+31 31 32 31 29 27
+21 14 13 14 12 8
+66 66 64 61 59 59 57 56
+33 35 32 30 29 29 32
+94 91 89 91 97
+29 35 40 41 44 50
+73 77 78 84 85 88 94
+25 27 24 24 19
+37 41 43 40 41 44 47 45
+29 23 20 19 15 14 12 8
+87 87 90 93 93
+78 80 81 80 83
+25 27 26 25 22 18
+84 80 79 74 71 67
+37 39 43 46 49 50 49
+68 67 70 70 72 73 76 83
+95 95 93 89 88
+13 18 15 18 21 24 27 31
+8 12 15 16 16 17 22
+38 37 40 42 42 45 46
+28 28 28 30 31 33
+93 94 92 93 95 96 97
+14 12 12 15 16 16
+19 23 24 29 32
+81 81 82 84 87 88 92 98
+95 91 86 84 83 80
+25 23 23 20 18 18
+21 20 17 13 16
+57 59 56 53 51 44 44
+95 89 87 84 83 81 75 75
+22 22 23 25 25 26 26
+5 5 7 9 10 14 16 20
+58 54 52 51 50 48 48
+26 22 19 18 12 9 8 9
+48 44 42 41 34 29
+56 56 58 56 59 61 62 63
+12 16 18 20 22 22 21
+55 58 61 65 67 68 69 73
+43 43 40 38 35
+34 28 25 22 24 21 19 19
+7 13 14 17 20 21 25 28
+54 59 61 64 67 70 70 77
+28 24 21 21 15
+73 70 69 68 71 69 72
+71 64 62 64 61 64
+49 50 49 48 44 43 41 37
+55 59 61 63 66 68
+77 73 72 68 67 66 66
+82 83 86 84 85 86 88 95
+28 28 27 24 20 17 12
+50 54 54 56 60
+21 22 19 17 17 15 12 12
+74 70 69 68 71 69 69
+12 16 23 24 28
+77 74 71 69 64 67
+18 22 23 30 33 33
+11 12 17 18 18
+11 8 11 12 13 14 18 18
+51 58 57 58 61
+74 68 65 63 66
+11 11 13 15 16 19 22 21
+83 80 79 78 75 73 71 68
+76 74 73 70 67
+96 94 91 90 88
+18 20 22 23 25
+60 63 64 67 69 71 74
+15 16 18 21 24 27
+20 18 15 13 10
+64 62 59 57 56 53 50
+34 37 40 43 45
+4 7 9 12 14
+18 19 20 22 25 27 29 32
+67 64 63 60 59 57 56 55
+25 23 21 18 17 16 14
+15 18 20 22 25 28 30
+94 91 89 88 85 84
+83 85 86 87 89
+82 85 86 87 90 91 93 95
+73 70 67 65 62 59 56 53
+78 81 84 85 88
+94 92 89 88 87
+90 87 85 83 81 80 79 76
+29 30 33 36 38 39 41 44
+37 40 41 42 45 46 48 49
+29 30 31 33 34 35
+29 26 23 21 18 15
+14 12 11 10 9 6 5
+65 63 60 57 54
+40 39 38 37 35 33 32 31
+49 51 53 54 55
+43 46 48 49 50
+3 6 8 10 12
+25 22 21 19 18 15 13
+23 25 27 29 31 34 35 38
+45 46 47 49 50
+55 58 60 62 65 68 69 70
+53 55 58 61 63 64 65
+69 66 64 63 62
+80 83 84 85 86 88 91
+52 54 55 57 59 61 63 66
+27 30 33 36 37 38 40
+90 89 87 86 84 82
+32 34 36 37 39 40 41 42
+89 86 83 81 80 79 78
+21 20 19 17 14
+77 78 79 80 82 83 84
+81 82 85 86 88 90 93 96
+68 70 71 74 76 77 79
+41 39 38 37 35 32 31
+40 43 45 47 48 49 51
+89 88 86 85 84 82 79
+14 15 17 18 21 22 25 27
+79 77 74 73 72 71 69 68
+73 76 78 81 84 87 90 92
+78 81 84 87 90 93
+33 31 29 27 25 22 21
+65 64 62 59 57 54
+81 83 86 87 90
+27 30 33 35 38 39 42 45
+59 56 53 50 49 47
+68 65 63 62 61 58 56 54
+55 52 49 47 45 43 40
+83 85 87 90 91
+76 73 72 71 68 65 64 63
+43 44 46 49 52
+18 21 23 26 27 28 31 33
+84 81 79 77 76 74
+13 15 17 20 22 24 27 30
+12 15 18 21 22
+60 59 56 53 51 48 47 45
+59 60 62 63 66 69 70
+48 46 43 42 41 38 37
+54 51 48 45 42 39 36 34
+61 62 63 64 66 67
+22 23 26 28 30
+37 36 33 30 27 26
+68 65 62 59 56
+19 22 24 26 27 28 30 33
+36 37 39 42 44 45 47
+65 62 59 56 53
+42 45 47 48 50
+58 57 55 52 51
+34 36 38 40 43 44 45
+5 6 8 10 11 14
+88 86 84 81 79 77
+27 26 23 22 20 17 16
+73 71 70 68 65 63 62
+62 64 67 70 71 73 76 79
+57 60 61 63 64
+99 98 96 95 94
+37 35 34 33 32 30 29 27
+87 84 82 80 77
+61 63 65 66 68 71 73 74
+25 22 20 18 16 13 11 8
+22 19 18 15 12 10 7 5
+97 96 95 94 93 92 91 88
+82 83 86 87 90 91 92 94
+46 48 49 50 51
+53 51 50 47 44 42
+41 42 45 46 48 49 51
+87 85 84 83 82 81
+24 21 18 17 14 11 10
+27 25 24 22 20 17
+14 12 11 9 7 6 5
+21 24 26 27 28 31 33
+13 12 9 8 7
+33 34 35 38 40 43
+84 81 78 77 74 71 68
+15 16 18 20 21 23 24
+24 21 18 17 14 12
+87 84 82 80 79 77
+94 91 90 88 85 82 79
+53 52 51 49 47 44 42
+43 42 40 39 38 37 34 31
+25 27 29 32 33 35 38
+40 37 34 33 31 29 28
+88 89 91 92 95 98
+74 75 77 80 83 84 85 86
+16 19 21 22 24
+59 58 55 53 52
+48 51 52 53 55 58 59
+27 28 31 32 33 36
+54 56 57 60 62 65 66
+25 26 29 30 33 36 37 39
+35 32 30 27 26 23 20 18
+36 37 40 43 44 45 46
+47 44 41 38 36 35
+64 62 60 58 55 52
+56 57 60 62 63 65 68
+20 21 22 23 26
+95 94 91 90 88 86 85
+95 94 91 88 86 85
+61 58 56 53 50 47
+83 85 86 88 91
+29 26 25 22 19 18 16 15
+76 74 72 69 66 63
+25 26 28 30 32
+66 65 63 61 58 57
+12 14 15 18 21 22
+52 51 48 47 46 43 40
+13 15 16 17 18 19
+60 63 64 65 67 68 69
+15 13 10 8 6 4 2
+53 54 57 59 61 62 65
+75 78 79 81 84 85
+27 26 25 22 19
+13 15 16 18 19 20 22
+96 93 90 87 84 81 79
+73 72 69 66 64 63 60 57
+20 22 25 28 29 32 33 35
+34 33 32 29 26
+89 88 87 84 82 80 78
+8 10 12 14 15 18 21 23
+34 35 36 37 39 41 44
+44 46 47 50 53 55 56 59
+49 46 44 42 41
+15 18 20 23 25 27
+39 41 43 44 47 48 50 53
+93 92 91 89 86 84 83 80
+34 32 29 28 26 23 21 18
+61 60 58 55 53 50
+46 44 42 39 37 36 33
+23 21 19 17 16 15 12 9
+5 7 8 9 10 12 15 16
+98 96 94 93 91 90 87 85
+92 91 88 87 86 83 82
+83 84 86 89 90 93 95 96
+87 89 90 91 93
+11 14 17 18 21 23 25
+7 8 9 12 14
+28 29 32 34 37 40 43 46
+81 83 84 86 87
+1 3 5 7 8
+59 58 56 55 54
+66 65 62 61 59 58
+92 89 87 84 82 79
+4 6 7 10 12 13 14
+43 46 47 50 53 55
+55 56 59 60 61 62
+65 64 63 61 60 59 58
+14 16 18 20 22 24
+89 91 93 96 98
+56 59 60 63 66 68 69 72
+32 35 36 37 39 40 42
+79 78 77 75 72
+60 62 65 66 68 71 73 76
+90 87 84 83 82 80 78 75
+38 40 43 44 47 49 52
+56 55 53 51 50 48 46
+70 68 66 64 61 59 57
+32 35 37 38 41 44 45 48
+21 24 26 29 32 34 36 38
+25 23 21 19 17 14
+36 35 34 32 31 29 26
+73 74 77 80 82 84 87 88
+22 20 17 16 13 12 11
+50 51 53 54 56 59 61
+8 11 14 16 18
+94 93 91 88 86 84
+84 87 88 90 92 95
+78 77 74 72 70 69
+46 44 43 40 37 36 33
+22 23 25 28 31 34
+72 70 68 65 64
+22 24 27 30 33
+70 69 67 65 62 60
+53 52 49 48 47
+28 26 23 22 19 16
+24 22 21 19 16 14 12 11
+44 41 40 37 35
+33 35 37 40 41 44 45 46
+40 37 35 33 32
+74 75 78 81 82 85
+72 74 76 79 80 81 82
+78 81 84 87 90 93 95 98
+44 45 48 51 52 54 56
+78 76 74 72 71 68 66 65
+86 85 84 82 81
+62 65 66 67 69
+11 13 16 19 20 22 25
+3 4 7 10 13 14 15
+18 16 13 10 8 5 4 2
+81 78 75 74 71 70 68 66
+49 46 44 43 42 41
+57 60 63 64 67 69 70
+18 15 12 11 9 8 5
+17 14 13 11 9 6
+21 24 27 30 32 35
+34 36 37 38 41 43 46
+83 82 79 78 75 73 71
+27 30 33 34 35 38 39 40
+74 75 77 78 79
+77 79 81 82 84 85 86
+77 74 72 69 68 67 65
+80 78 77 75 74
+16 19 22 25 27 29 32 34
+80 78 76 74 73
+35 33 31 30 28 26 24
+41 44 46 49 50 52 53
+52 54 56 57 60 61 62 63
+34 35 36 39 41 42 43 46
+73 76 77 79 82
+82 84 87 89 90 92
+67 65 62 60 57 56 55 52
+39 36 35 34 33 31 29
+40 39 36 33 32
+69 70 71 73 76 77 79
+46 49 52 54 57
+63 60 59 57 55 52
+47 44 42 40 38 37 34
+33 30 27 26 23 22
+16 18 20 22 23 26 29 30
+3 4 6 8 11 13 14 17
+8 11 14 16 18 20 22
+13 11 9 6 4
+35 33 30 28 27
+6 7 9 12 14 17 18 19
+77 74 71 69 67 66 64 61
+59 58 55 52 50 49
+69 71 74 76 79 82 85 87
+80 79 76 75 74
+75 72 70 67 64 63 61
+60 58 57 56 53 51 50 47
+21 24 26 28 30 31
+21 22 24 25 27 28 31
+98 96 94 93 90 87
+48 51 54 55 57
+83 86 88 89 91 93 94 97
+71 68 66 64 63 60 59
+34 36 37 40 43 45
+11 14 16 17 18 21 23 24
+97 94 91 88 85 83
+59 56 55 54 53 50 47
+68 65 62 60 57 55
+46 44 41 38 36 35
+42 39 37 34 31 29 27
+41 43 45 46 47 50 52 54
+85 84 82 81 80
+96 95 94 93 91 88 86 85
+71 73 75 77 80 81 84
+5 6 7 10 11 12 13 14
+14 11 8 5 4 3
+29 31 34 35 38 41 44 47
+68 70 72 73 76 78 80
+51 54 57 58 61 64
+93 91 90 89 86 83 80 77
+44 45 46 48 50 52
+71 73 75 76 79 81 84 86
diff --git a/2024/d02.lisp b/2024/d02.lisp
new file mode 100644
index 0000000..96817a7
--- /dev/null
+++ b/2024/d02.lisp
@@ -0,0 +1,48 @@
+(in-package :aoc/2024)
+
+(defparameter *input/d2*
+  (asdf:system-relative-pathname :advent "2024/d02.input"))
+
+(defun split-by-one-space (string)
+  "Splits the string at spaces and parses the values as ints"
+  (loop for i = 0 then (1+ j)
+        as j = (position #\Space string :start i)
+        collect (parse-integer (subseq string i j))
+        while j))
+
+(defun readlists (filename)
+  "Reads the given file into a list of reports containing levels"
+  (let ((reports '()))
+    (with-open-file (stream filename :direction :input)
+                    (loop for line = (read-line stream nil nil)
+                          while line
+                          do (push (split-by-one-space line) reports)))
+    (nreverse reports)))
+
+(defun diff-safe-p (a b)
+  "Checks if the given two numbers are within of 3 of each other"
+  (<= (abs (- a b)) 3))
+
+(defun ordered-p (lst)
+  "Checks if all conditions apply"
+  (and (or (apply #'< lst) (apply #'> lst))
+       (every #'diff-safe-p lst (rest lst))))
+
+(print (count-if #'ordered-p (readlists *input/d2*)))
+; 287
+
+(defun remove-nth (n lst)
+  "Remove the nth value from the given list"
+  (remove-if (constantly t) lst :start n :count 1))
+
+(defun fixable (lst)
+  "Check if the given list if fixable when removing a value"
+  (loop for i from 0 below (length lst)
+        thereis (ordered-p (remove-nth i lst))))
+
+(defun part-2 (lst)
+  "The conditions for the second part"
+  (or (ordered-p lst) (fixable lst)))
+
+(print (count-if #'part-2 (readlists *input/d2*)))
+; 354