From 52c33969d7b358cdac40f02a8562e37f82a96135 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 26 Feb 2024 23:16:00 +0100 Subject: Add day4 --- 2023/ocaml/.gitignore | 29 ++++++ 2023/ocaml/day4/.ocamlformat | 0 2023/ocaml/day4/bin/dune | 4 + 2023/ocaml/day4/bin/main.ml | 45 +++++++++ 2023/ocaml/day4/day4.opam | 31 ++++++ 2023/ocaml/day4/dune-project | 26 +++++ 2023/ocaml/day4/example.txt | 6 ++ 2023/ocaml/day4/input.txt | 203 ++++++++++++++++++++++++++++++++++++++ 2023/ocaml/day4/lib/dune | 2 + 2023/ocaml/day4/test/dune | 2 + 2023/ocaml/day4/test/test_day4.ml | 0 11 files changed, 348 insertions(+) create mode 100644 2023/ocaml/.gitignore create mode 100644 2023/ocaml/day4/.ocamlformat create mode 100644 2023/ocaml/day4/bin/dune create mode 100644 2023/ocaml/day4/bin/main.ml create mode 100644 2023/ocaml/day4/day4.opam create mode 100644 2023/ocaml/day4/dune-project create mode 100644 2023/ocaml/day4/example.txt create mode 100644 2023/ocaml/day4/input.txt create mode 100644 2023/ocaml/day4/lib/dune create mode 100644 2023/ocaml/day4/test/dune create mode 100644 2023/ocaml/day4/test/test_day4.ml diff --git a/2023/ocaml/.gitignore b/2023/ocaml/.gitignore new file mode 100644 index 0000000..a18e084 --- /dev/null +++ b/2023/ocaml/.gitignore @@ -0,0 +1,29 @@ +*.annot +*.cmo +*.cma +*.cmi +*.a +*.o +*.cmx +*.cmxs +*.cmxa + +# ocamlbuild working directory +_build/ + +# ocamlbuild targets +*.byte +*.native + +# oasis generated files +setup.data +setup.log + +# Merlin configuring file for Vim and Emacs +.merlin + +# Dune generated files +*.install + +# Local OPAM switch +_opam/ diff --git a/2023/ocaml/day4/.ocamlformat b/2023/ocaml/day4/.ocamlformat new file mode 100644 index 0000000..e69de29 diff --git a/2023/ocaml/day4/bin/dune b/2023/ocaml/day4/bin/dune new file mode 100644 index 0000000..add70da --- /dev/null +++ b/2023/ocaml/day4/bin/dune @@ -0,0 +1,4 @@ +(executable + (public_name day4) + (name main) + (libraries day4)) diff --git a/2023/ocaml/day4/bin/main.ml b/2023/ocaml/day4/bin/main.ml new file mode 100644 index 0000000..9d1a6ad --- /dev/null +++ b/2023/ocaml/day4/bin/main.ml @@ -0,0 +1,45 @@ +let input_file = "input.txt" + +let read_file f = + let ic = open_in f in + try + let lines = really_input_string ic (in_channel_length ic) |> String.trim in + close_in ic; + lines + with e -> + close_in_noerr ic; + raise e + +let nums_from_string str = + String.split_on_char ' ' str + |> List.filter (fun ch -> String.length ch > 0) + |> List.map int_of_string + +let rec parse ?(result = 0) lines = + match lines with + | [] -> result + | x :: tail -> + let numbers = + List.nth (String.split_on_char ':' x) 1 + |> String.split_on_char '|' |> List.map String.trim + |> List.map nums_from_string + in + + let winnings = List.nth numbers 0 in + let plays = List.nth numbers 1 in + + let k = + Int.shift_left 1 + (List.length + (List.map + (fun win -> if List.mem win plays = true then 1 else 0) + winnings + |> List.filter (fun i -> i = 1)) + - 1) + in + + parse tail ~result:(result + k) + +let () = + let result = read_file input_file |> String.split_on_char '\n' |> parse in + Printf.printf "%d\n" result diff --git a/2023/ocaml/day4/day4.opam b/2023/ocaml/day4/day4.opam new file mode 100644 index 0000000..36cd213 --- /dev/null +++ b/2023/ocaml/day4/day4.opam @@ -0,0 +1,31 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "A short synopsis" +description: "A longer description" +maintainer: ["Maintainer Name"] +authors: ["Author Name"] +license: "LICENSE" +tags: ["topics" "to describe" "your" "project"] +homepage: "https://github.com/username/reponame" +doc: "https://url/to/documentation" +bug-reports: "https://github.com/username/reponame/issues" +depends: [ + "ocaml" + "dune" {>= "3.12"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/username/reponame.git" diff --git a/2023/ocaml/day4/dune-project b/2023/ocaml/day4/dune-project new file mode 100644 index 0000000..2bf259e --- /dev/null +++ b/2023/ocaml/day4/dune-project @@ -0,0 +1,26 @@ +(lang dune 3.12) + +(name day4) + +(generate_opam_files true) + +(source + (github username/reponame)) + +(authors "Author Name") + +(maintainers "Maintainer Name") + +(license LICENSE) + +(documentation https://url/to/documentation) + +(package + (name day4) + (synopsis "A short synopsis") + (description "A longer description") + (depends ocaml dune) + (tags + (topics "to describe" your project))) + +; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project diff --git a/2023/ocaml/day4/example.txt b/2023/ocaml/day4/example.txt new file mode 100644 index 0000000..9bdb874 --- /dev/null +++ b/2023/ocaml/day4/example.txt @@ -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 diff --git a/2023/ocaml/day4/input.txt b/2023/ocaml/day4/input.txt new file mode 100644 index 0000000..93f8c7b --- /dev/null +++ b/2023/ocaml/day4/input.txt @@ -0,0 +1,203 @@ +Card 1: 87 75 80 68 71 57 58 59 70 48 | 56 67 75 76 31 49 48 22 43 68 98 86 70 91 27 46 4 87 72 37 71 58 29 79 80 +Card 2: 95 97 90 91 79 71 60 87 46 80 | 28 90 55 87 82 34 44 96 77 15 22 63 31 33 5 99 36 91 17 10 64 59 68 37 13 +Card 3: 23 73 50 78 93 30 56 10 8 64 | 61 48 87 46 12 75 92 37 62 45 24 81 79 55 76 82 9 1 16 72 13 27 41 86 19 +Card 4: 16 50 13 24 94 27 74 58 15 53 | 58 53 20 57 69 28 47 2 41 4 66 61 15 44 24 68 50 74 86 45 36 73 43 27 91 +Card 5: 39 53 29 10 84 22 83 4 5 32 | 50 28 45 5 6 65 18 7 92 83 3 55 81 26 80 39 44 60 90 37 91 36 54 14 74 +Card 6: 84 12 96 93 72 97 91 76 7 82 | 85 15 29 33 37 60 14 30 63 73 38 62 77 44 86 39 51 2 99 75 70 36 32 98 78 +Card 7: 78 12 1 50 48 62 33 8 83 99 | 12 50 79 48 59 81 26 14 5 11 37 8 36 91 95 20 46 44 21 32 58 93 53 90 54 +Card 8: 55 58 8 36 16 23 88 73 45 65 | 19 10 34 64 52 27 75 22 33 58 74 45 16 11 63 56 12 14 8 25 59 4 95 47 78 +Card 9: 95 14 83 17 7 69 44 31 45 37 | 2 69 81 39 76 86 29 73 72 32 67 5 9 16 95 90 36 27 88 55 61 6 37 79 1 +Card 10: 24 83 98 76 87 6 32 59 4 96 | 54 5 68 85 76 50 60 33 58 32 88 61 27 55 90 65 93 13 53 29 44 15 6 45 24 +Card 11: 55 92 57 65 44 21 49 8 13 48 | 17 44 79 11 65 50 46 14 40 69 31 62 55 86 36 60 30 52 25 93 41 56 48 99 51 +Card 12: 14 93 52 89 35 42 13 22 76 26 | 14 5 46 80 22 39 1 67 43 31 78 87 68 95 90 83 96 71 74 29 15 88 36 11 76 +Card 13: 55 78 95 85 43 53 80 12 1 59 | 42 60 32 70 10 91 94 88 68 99 45 71 54 93 76 52 44 30 2 18 72 90 9 7 63 +Card 14: 6 44 46 59 91 60 47 26 12 17 | 35 52 36 5 18 30 63 79 75 55 45 99 84 81 71 34 48 24 14 70 11 69 1 4 77 +Card 15: 29 17 94 87 84 3 96 33 5 48 | 65 25 20 45 85 1 43 37 14 11 69 81 6 92 93 46 8 23 31 2 30 61 22 79 71 +Card 16: 73 81 13 23 61 35 49 48 99 5 | 10 69 22 40 73 29 61 23 13 99 26 7 39 70 5 56 88 46 49 81 68 25 35 48 14 +Card 17: 64 47 6 10 16 74 26 95 28 73 | 86 27 47 6 68 49 64 48 74 26 16 28 20 99 61 10 12 25 73 88 70 95 67 3 76 +Card 18: 1 29 86 72 65 52 67 64 68 79 | 5 88 77 52 18 31 67 41 37 55 68 65 39 22 72 97 23 64 34 29 48 1 79 49 86 +Card 19: 71 33 43 91 59 35 69 18 78 9 | 86 55 54 59 91 36 45 9 94 43 39 11 44 1 93 23 66 97 4 62 71 98 18 31 28 +Card 20: 72 86 59 6 85 1 74 25 87 20 | 21 14 6 39 4 54 37 2 61 83 82 59 10 67 19 50 12 16 51 55 1 5 45 98 73 +Card 21: 35 39 40 21 19 87 58 49 78 32 | 28 91 27 45 44 25 11 35 84 26 98 87 14 97 93 70 55 19 34 16 8 7 67 54 5 +Card 22: 87 30 6 9 73 47 29 7 33 63 | 87 80 21 3 63 38 14 7 20 9 73 31 33 29 11 30 22 68 57 54 43 42 47 34 6 +Card 23: 51 61 36 99 86 88 21 6 30 74 | 30 42 99 86 20 44 74 64 72 67 81 93 79 51 5 48 21 75 36 23 6 60 4 66 88 +Card 24: 96 21 44 42 57 34 59 45 58 2 | 6 81 92 13 66 98 47 73 26 10 84 62 93 49 57 35 90 27 75 19 52 1 37 32 85 +Card 25: 17 55 53 49 25 59 71 33 35 11 | 55 82 92 74 29 17 46 40 2 26 25 32 96 49 11 35 53 3 87 59 71 33 73 36 38 +Card 26: 33 85 26 21 13 51 73 76 20 7 | 85 53 42 21 31 76 33 97 71 73 20 90 13 52 95 98 93 99 11 32 26 51 24 37 7 +Card 27: 62 39 22 67 69 5 89 1 36 34 | 10 52 68 95 32 82 22 94 21 29 5 45 87 51 18 4 15 19 59 55 11 78 60 63 84 +Card 28: 65 31 58 70 2 49 46 14 72 11 | 24 95 11 14 27 22 38 65 15 35 36 18 59 49 6 70 69 62 46 58 60 34 92 72 2 +Card 29: 78 6 94 55 65 17 97 30 66 33 | 80 32 56 48 49 16 88 61 57 20 37 75 51 58 86 29 42 39 41 60 62 69 10 81 24 +Card 30: 72 33 93 5 58 92 10 90 29 20 | 77 73 41 42 67 17 24 28 23 69 27 43 80 49 75 74 2 3 21 26 76 32 48 30 4 +Card 31: 9 93 77 42 49 71 36 98 46 1 | 68 39 10 32 36 7 47 55 95 33 48 56 31 61 98 40 50 81 94 77 45 12 16 6 35 +Card 32: 35 54 65 19 62 37 63 68 17 47 | 14 20 65 27 84 48 85 56 64 37 51 81 11 52 63 40 93 15 92 90 19 35 43 68 7 +Card 33: 21 80 78 56 29 65 6 12 57 22 | 51 61 7 1 19 22 77 62 78 54 58 29 89 97 34 83 56 57 11 98 73 6 17 16 70 +Card 34: 57 83 56 87 58 68 46 86 78 77 | 98 58 46 51 14 1 17 60 11 13 5 49 56 96 19 15 99 28 62 38 9 40 57 92 22 +Card 35: 34 29 33 85 95 9 47 11 39 25 | 49 91 61 13 99 84 80 96 77 82 97 59 20 30 4 65 70 74 5 37 41 81 75 93 48 +Card 36: 42 30 69 88 84 90 58 26 2 47 | 98 14 3 30 56 20 49 83 29 48 46 34 99 51 12 61 92 1 55 60 70 53 75 52 27 +Card 37: 7 70 87 71 25 85 50 86 77 72 | 94 23 90 73 52 79 31 30 49 71 8 26 88 38 42 5 81 82 69 51 63 35 80 22 19 +Card 38: 37 4 98 58 7 95 19 22 17 86 | 60 38 13 79 62 49 85 77 8 52 63 20 16 81 21 59 43 36 80 70 87 35 51 10 12 +Card 39: 68 79 63 42 17 92 99 95 2 29 | 85 24 88 25 52 81 61 1 27 50 84 98 31 49 19 51 38 93 33 15 22 28 14 70 67 +Card 40: 7 15 73 55 87 18 52 17 34 12 | 87 73 42 77 21 33 44 69 24 52 94 17 7 16 78 12 34 97 67 41 15 47 55 91 18 +Card 41: 70 1 14 88 52 46 32 59 67 75 | 17 1 75 13 46 87 64 32 48 52 53 80 30 21 3 88 94 14 38 70 73 67 28 41 86 +Card 42: 65 18 51 72 76 7 93 64 21 92 | 51 64 94 77 45 98 28 67 11 42 41 72 93 22 21 56 65 76 54 7 26 92 74 18 55 +Card 43: 35 82 2 99 52 68 81 38 14 94 | 51 46 27 10 21 7 56 71 77 6 38 44 25 79 94 33 76 15 22 99 68 84 5 14 81 +Card 44: 7 47 1 61 51 46 36 87 43 34 | 14 43 91 86 47 51 29 95 76 61 39 85 84 7 87 69 46 56 88 36 27 1 10 67 34 +Card 45: 17 83 85 90 65 18 67 75 68 25 | 89 67 31 51 99 46 85 42 84 75 59 96 17 68 26 79 65 81 32 83 25 90 37 4 18 +Card 46: 2 56 38 47 9 11 61 68 51 49 | 53 56 60 47 49 61 82 5 38 2 97 9 51 80 86 22 68 31 11 59 24 4 35 13 8 +Card 47: 39 2 68 61 28 8 23 62 46 89 | 23 15 46 78 62 1 60 36 52 35 10 65 90 67 4 18 16 72 44 61 6 59 14 45 91 +Card 48: 60 49 62 14 88 84 80 18 7 20 | 88 91 77 10 2 59 94 25 67 9 16 72 80 20 32 78 14 69 56 70 73 96 15 6 92 +Card 49: 14 67 94 15 12 40 7 68 22 88 | 91 15 67 61 7 95 85 72 94 78 12 68 14 35 41 89 60 22 88 81 93 86 40 84 92 +Card 50: 65 75 63 30 38 28 27 51 58 54 | 30 99 21 28 2 81 77 85 25 38 27 63 70 62 87 58 16 9 75 54 65 69 51 78 8 +Card 51: 30 18 35 67 45 87 27 13 82 51 | 9 51 95 45 2 67 61 82 81 30 52 35 5 43 27 87 83 49 13 44 21 22 48 78 18 +Card 52: 23 21 13 53 5 78 43 94 98 59 | 72 57 18 34 11 39 95 26 56 68 22 10 21 98 96 87 4 43 74 7 46 40 88 97 58 +Card 53: 39 55 57 87 6 68 78 14 36 7 | 74 76 20 58 87 6 67 26 57 1 41 44 17 14 42 7 43 81 35 39 55 36 59 66 96 +Card 54: 26 62 39 28 76 32 98 19 2 61 | 9 62 61 75 28 42 40 39 64 32 98 37 58 16 15 19 35 2 80 76 10 26 70 18 47 +Card 55: 31 47 13 40 5 80 94 45 54 43 | 61 17 52 78 60 2 37 58 19 85 89 14 20 10 3 13 80 41 25 79 4 70 36 75 11 +Card 56: 59 68 42 47 97 53 32 46 17 76 | 64 94 32 46 68 5 49 14 91 19 59 53 26 80 33 39 6 99 18 73 45 87 69 54 66 +Card 57: 70 23 37 94 4 46 26 33 71 72 | 64 38 71 53 37 96 29 80 41 90 60 94 18 45 27 62 72 33 79 32 26 92 49 12 4 +Card 58: 47 44 65 83 91 78 17 60 7 35 | 95 65 26 52 68 9 69 61 19 87 93 27 90 57 49 23 24 17 86 16 28 62 11 63 85 +Card 59: 3 92 67 72 64 2 74 14 49 73 | 41 57 98 95 91 78 20 42 25 60 54 36 56 34 86 37 9 10 52 79 80 53 88 18 46 +Card 60: 38 5 63 77 69 9 79 50 58 51 | 20 72 80 52 68 64 33 61 47 84 65 90 29 48 16 82 4 98 83 89 17 94 81 41 85 +Card 61: 13 65 75 26 39 63 88 92 72 87 | 98 43 81 95 26 69 27 7 57 37 82 41 71 18 55 53 10 36 64 47 84 4 20 77 67 +Card 62: 19 70 5 25 23 76 90 29 61 97 | 17 20 38 58 1 29 74 13 94 47 86 56 60 14 82 83 87 91 52 39 33 37 77 62 45 +Card 63: 22 24 17 19 55 48 23 3 8 11 | 4 67 90 50 99 54 49 78 94 20 96 2 86 74 83 79 76 15 70 52 34 98 5 82 88 +Card 64: 15 92 72 63 95 34 58 85 18 57 | 64 40 67 81 89 27 84 54 75 43 70 77 13 52 19 35 46 30 12 61 78 10 82 55 45 +Card 65: 66 35 28 50 30 80 15 85 4 23 | 3 30 99 96 70 47 4 64 35 66 78 41 65 63 23 28 44 67 85 80 61 50 17 15 92 +Card 66: 71 67 68 20 93 6 76 30 15 89 | 12 69 80 11 91 34 2 65 95 8 37 86 38 10 79 3 43 90 87 45 92 50 88 39 56 +Card 67: 94 46 12 2 53 27 57 45 33 1 | 33 72 74 64 25 97 17 2 73 48 3 56 63 40 31 24 45 83 85 79 6 75 38 55 49 +Card 68: 82 68 40 3 73 81 61 1 60 50 | 15 29 82 51 73 28 43 94 85 50 96 11 98 9 86 20 6 14 5 95 10 23 61 12 62 +Card 69: 25 94 17 29 2 34 48 87 51 49 | 95 17 84 91 14 34 3 89 87 71 2 51 35 93 7 29 74 55 48 25 49 56 94 20 68 +Card 70: 37 51 36 79 15 29 88 69 6 97 | 27 66 88 90 41 29 25 36 82 56 69 37 18 40 33 97 42 91 62 6 65 79 15 28 51 +Card 71: 77 28 31 19 40 35 80 11 76 26 | 10 74 63 70 11 67 76 31 40 75 96 77 60 80 35 28 68 53 19 64 51 43 26 9 25 +Card 72: 18 96 9 79 87 37 94 69 8 74 | 69 18 9 41 21 80 72 96 71 20 15 12 36 87 99 37 44 79 46 54 94 19 8 74 39 +Card 73: 11 60 75 68 66 57 51 70 20 30 | 6 12 35 45 56 38 46 65 54 59 19 68 64 11 57 22 74 30 90 13 37 93 5 20 51 +Card 74: 6 20 99 75 87 1 70 52 4 61 | 97 98 99 34 75 11 8 92 49 81 19 12 87 20 70 6 27 4 44 61 52 67 82 1 55 +Card 75: 95 80 34 33 66 55 63 19 7 46 | 19 83 58 4 46 57 72 99 98 63 36 80 34 30 11 64 24 52 93 55 22 76 78 32 89 +Card 76: 55 56 58 16 50 24 27 75 35 44 | 75 42 35 87 7 13 55 44 8 27 56 14 24 78 61 4 19 38 18 58 50 1 16 51 22 +Card 77: 99 2 77 33 48 47 44 87 32 23 | 46 71 47 54 23 55 18 28 56 48 69 14 26 44 24 32 77 60 81 2 40 33 83 11 87 +Card 78: 67 46 27 29 44 1 22 4 13 52 | 80 98 63 29 97 67 58 86 25 52 95 23 92 76 27 74 13 93 78 22 81 96 1 46 64 +Card 79: 60 94 4 59 76 64 34 69 35 62 | 10 8 82 43 76 44 69 20 41 29 1 35 34 59 42 22 13 32 4 40 65 28 16 84 99 +Card 80: 88 60 47 76 82 5 14 63 58 16 | 83 62 57 21 89 79 53 60 87 22 76 20 78 96 63 68 56 91 5 7 47 16 94 98 45 +Card 81: 46 67 14 43 39 44 48 35 6 94 | 2 31 12 42 78 76 61 62 40 37 29 36 16 75 4 41 21 19 85 49 84 73 89 96 3 +Card 82: 61 73 72 47 71 96 4 2 41 20 | 76 78 94 65 51 85 92 60 31 80 81 34 46 69 90 70 17 74 89 40 27 35 14 15 10 +Card 83: 82 60 62 23 81 27 61 26 75 28 | 29 78 79 9 13 39 30 97 31 96 86 84 42 28 14 55 81 44 17 8 25 12 35 34 82 +Card 84: 91 61 73 55 98 28 11 40 33 50 | 21 55 27 2 54 44 94 59 58 67 79 66 82 87 92 25 9 7 65 80 38 30 10 97 16 +Card 85: 39 81 47 2 8 95 35 63 36 10 | 75 58 6 19 20 55 18 99 88 25 78 77 65 93 59 57 12 13 66 91 3 67 34 41 29 +Card 86: 15 33 8 84 57 35 50 76 43 17 | 34 20 55 59 97 51 44 46 53 5 10 79 58 89 39 82 16 42 71 81 22 40 85 63 56 +Card 87: 44 7 57 42 53 85 62 9 56 63 | 95 60 69 56 24 43 7 4 91 44 63 76 30 39 62 9 85 57 16 34 53 99 50 66 42 +Card 88: 47 85 12 1 98 86 94 84 33 51 | 27 54 45 55 38 12 96 51 1 83 36 65 13 85 32 94 29 52 47 59 33 48 86 82 98 +Card 89: 45 15 77 41 57 43 54 2 32 24 | 44 79 10 28 23 97 99 40 95 25 22 9 35 59 53 74 14 37 34 61 39 30 71 12 94 +Card 90: 76 75 36 82 28 2 87 81 31 14 | 38 67 87 90 6 9 19 2 13 37 24 15 65 84 32 85 44 18 98 79 23 35 80 60 47 +Card 91: 21 19 37 97 7 29 34 79 45 13 | 17 42 12 71 21 4 51 37 7 81 34 65 36 19 13 59 96 97 31 16 79 87 29 86 45 +Card 92: 16 14 67 60 39 25 26 34 12 96 | 79 66 11 93 38 29 37 12 50 32 7 82 39 59 84 54 42 83 43 92 19 1 34 26 77 +Card 93: 70 37 71 28 22 62 85 9 65 27 | 78 91 28 65 42 22 70 30 92 54 9 72 38 24 62 51 10 49 89 13 14 66 84 61 93 +Card 94: 80 48 40 83 87 19 53 66 69 33 | 80 79 66 76 58 94 60 70 20 42 72 87 19 30 75 40 67 12 36 96 11 29 59 63 33 +Card 95: 68 91 48 52 79 40 83 97 16 63 | 77 73 52 88 97 91 48 22 35 64 31 40 63 68 60 28 57 30 51 54 36 16 92 19 79 +Card 96: 78 81 13 87 20 8 80 63 2 3 | 20 29 62 72 44 90 54 22 3 35 55 16 96 80 37 93 73 23 50 33 6 63 78 8 13 +Card 97: 32 39 59 73 8 34 36 46 85 47 | 14 22 15 87 46 34 67 77 44 91 47 5 73 68 59 7 40 94 98 36 21 76 64 86 39 +Card 98: 19 75 37 82 94 6 57 15 78 58 | 9 79 6 71 91 39 38 61 59 89 90 1 80 17 86 35 98 63 27 74 5 49 25 70 73 +Card 99: 44 22 48 23 31 78 15 89 49 24 | 36 89 27 81 67 56 22 28 74 47 25 18 44 3 15 23 58 73 69 39 75 17 85 1 7 +Card 100: 56 15 30 64 37 89 51 96 63 90 | 56 23 24 57 44 9 41 65 6 26 69 36 21 66 94 67 7 10 34 59 14 40 99 93 98 +Card 101: 42 95 60 30 25 87 82 98 40 54 | 22 85 24 84 19 34 3 43 97 8 18 57 58 26 91 44 56 11 16 66 78 73 62 50 68 +Card 102: 14 64 72 79 55 78 44 12 76 36 | 69 74 13 78 59 82 15 46 49 11 81 83 97 9 58 4 98 60 43 34 30 67 2 47 37 +Card 103: 64 82 36 57 33 8 80 91 95 32 | 84 45 12 44 59 94 86 53 48 96 26 66 70 65 39 37 21 72 49 60 56 35 82 98 92 +Card 104: 76 18 88 52 69 44 57 99 20 12 | 60 74 21 35 77 39 40 29 46 37 95 65 93 36 43 86 48 59 6 11 16 72 28 55 97 +Card 105: 91 30 6 25 7 64 41 28 72 53 | 93 63 59 31 4 87 45 97 70 29 39 80 98 66 44 51 54 62 57 46 56 18 13 81 27 +Card 106: 15 59 45 36 74 86 35 62 87 14 | 29 35 81 53 60 69 47 25 61 43 13 62 84 96 79 75 68 23 32 18 37 72 63 4 36 +Card 107: 62 41 56 15 66 50 63 20 43 84 | 43 66 99 3 49 20 80 50 36 38 52 22 23 24 41 62 84 83 15 68 63 56 94 35 97 +Card 108: 67 51 97 26 11 61 91 55 7 23 | 47 96 26 78 22 87 33 51 34 59 53 3 97 91 86 11 21 89 13 61 23 67 55 7 24 +Card 109: 72 23 61 6 1 65 83 47 10 41 | 27 16 98 74 55 61 5 1 88 68 41 47 99 48 76 31 85 83 38 72 91 93 36 90 80 +Card 110: 34 22 81 62 40 25 43 60 12 69 | 69 81 71 66 54 15 17 79 25 93 34 51 43 62 40 12 30 56 27 47 60 33 22 94 65 +Card 111: 48 24 75 46 37 65 33 74 64 92 | 75 46 25 65 92 33 64 83 39 16 45 48 97 56 11 78 94 62 4 24 37 96 74 31 40 +Card 112: 94 92 39 58 34 78 61 7 50 88 | 83 6 52 39 92 17 40 63 54 34 7 85 89 64 25 50 99 77 33 13 11 81 35 78 41 +Card 113: 23 25 75 44 18 8 29 79 48 60 | 7 70 80 63 60 42 88 25 44 23 21 11 51 93 47 82 16 86 73 62 96 75 2 29 19 +Card 114: 52 42 66 15 57 29 21 47 89 22 | 77 81 52 8 66 21 98 61 71 2 85 34 42 95 93 25 67 60 82 47 78 56 63 87 84 +Card 115: 63 81 53 30 8 94 75 76 45 71 | 53 93 40 18 45 71 76 67 75 92 15 72 35 94 65 30 88 22 81 8 63 50 80 5 82 +Card 116: 8 33 23 82 63 25 65 4 97 28 | 79 75 71 46 41 74 6 86 64 33 24 70 82 87 9 76 36 3 5 97 92 4 1 12 62 +Card 117: 9 97 4 59 31 78 73 99 84 11 | 93 65 12 39 29 76 80 82 43 37 26 57 79 27 46 90 98 54 31 34 17 62 95 51 9 +Card 118: 11 42 73 23 28 62 68 15 31 48 | 17 81 29 15 10 86 25 68 28 80 33 78 89 11 82 96 12 34 19 99 67 13 64 59 91 +Card 119: 22 16 61 76 19 92 5 89 86 1 | 37 35 77 44 7 42 86 92 41 81 16 95 12 1 85 60 63 79 5 25 62 46 73 45 19 +Card 120: 97 11 71 31 44 24 12 49 15 17 | 97 44 78 49 64 61 42 55 31 38 12 87 53 32 41 6 68 62 19 94 13 79 29 56 71 +Card 121: 5 50 95 7 14 6 35 64 99 94 | 30 54 80 90 68 98 6 71 61 81 23 24 64 37 40 15 53 63 31 35 7 49 14 99 42 +Card 122: 5 72 29 22 71 35 41 82 15 56 | 3 45 61 68 70 41 56 26 82 62 29 36 84 80 95 81 96 83 20 35 28 54 21 76 47 +Card 123: 80 4 93 25 97 10 20 84 3 67 | 14 18 12 20 86 96 63 67 60 54 13 85 23 37 10 16 71 65 33 5 98 1 74 53 51 +Card 124: 43 64 62 31 86 1 30 23 15 28 | 77 1 99 27 48 35 2 40 57 61 23 9 37 74 91 46 92 83 24 90 96 32 80 45 31 +Card 125: 53 47 45 50 82 37 26 41 22 57 | 43 25 37 29 89 20 17 8 1 46 2 55 53 44 61 78 65 72 69 85 12 93 28 34 80 +Card 126: 36 27 94 41 56 21 18 13 59 96 | 73 91 2 14 29 98 79 8 11 3 38 16 69 71 77 92 66 60 18 9 1 57 12 22 43 +Card 127: 19 12 69 97 81 26 73 83 34 51 | 91 47 89 62 94 8 66 43 35 93 48 24 71 40 42 75 13 14 65 28 61 95 32 25 9 +Card 128: 99 78 81 4 44 58 10 83 67 5 | 5 83 95 17 34 68 91 10 4 88 56 38 49 44 66 11 78 7 50 67 45 21 98 99 58 +Card 129: 94 35 8 59 72 56 51 98 47 63 | 98 71 61 72 51 54 35 34 95 9 82 88 47 8 66 57 90 55 81 33 59 56 64 63 94 +Card 130: 81 25 85 84 88 26 87 14 40 77 | 25 74 20 13 30 11 72 77 88 40 70 67 47 14 80 86 81 26 45 87 79 33 85 84 39 +Card 131: 28 83 7 69 87 48 46 67 33 10 | 37 10 48 96 38 99 14 60 28 42 26 94 46 24 84 68 87 72 85 67 4 83 31 7 47 +Card 132: 33 65 47 66 48 9 69 68 76 73 | 21 18 70 64 55 19 31 81 20 77 12 94 59 15 98 44 57 52 92 54 93 40 89 16 78 +Card 133: 67 54 21 71 43 56 68 65 55 99 | 16 83 20 45 85 92 34 61 88 33 51 65 24 68 58 55 91 81 54 43 5 1 77 49 25 +Card 134: 73 82 41 78 91 72 13 7 46 88 | 78 88 32 57 12 56 44 73 41 79 27 99 49 13 82 91 87 97 62 46 83 7 23 60 71 +Card 135: 19 30 91 16 15 88 5 4 72 38 | 38 41 23 87 3 78 75 11 88 53 5 72 4 56 54 65 19 76 15 27 82 39 70 69 17 +Card 136: 39 66 64 79 90 51 69 6 44 23 | 51 1 21 44 23 78 27 66 69 42 6 50 74 48 39 79 57 29 53 3 10 13 30 90 64 +Card 137: 82 75 28 96 13 25 30 59 76 5 | 25 45 59 79 96 44 88 75 82 30 13 18 20 97 21 5 70 31 76 95 17 37 27 28 53 +Card 138: 23 21 53 59 82 11 99 30 68 1 | 51 11 21 53 8 43 24 71 33 63 75 66 23 82 1 20 92 50 86 59 99 45 84 30 68 +Card 139: 43 44 12 68 14 70 83 84 39 40 | 72 18 54 48 43 91 56 1 11 49 83 59 29 73 87 40 37 6 50 14 74 61 70 2 36 +Card 140: 64 4 86 61 11 72 66 73 83 14 | 74 86 84 8 36 5 76 73 83 88 10 28 38 64 4 12 72 23 53 42 33 91 61 45 55 +Card 141: 46 33 44 21 99 64 29 4 28 30 | 1 95 13 97 9 59 15 41 89 35 43 98 81 27 94 3 65 88 91 12 17 10 23 61 48 +Card 142: 2 85 8 98 74 62 76 7 79 60 | 59 42 2 49 24 34 25 76 8 71 98 86 6 7 16 33 74 62 89 13 39 31 85 79 87 +Card 143: 50 10 55 73 71 3 20 57 15 9 | 42 20 71 54 11 9 55 37 15 3 53 41 13 99 63 57 7 73 28 84 18 35 5 32 10 +Card 144: 26 38 75 71 89 40 96 81 83 48 | 42 77 11 76 78 15 19 86 10 34 61 58 29 14 64 94 63 33 70 13 88 82 59 28 93 +Card 145: 72 35 67 80 78 20 57 48 64 28 | 44 70 79 37 5 96 31 13 10 83 93 29 46 94 66 47 6 34 14 18 33 8 69 49 20 +Card 146: 42 10 61 56 2 22 38 15 67 6 | 72 83 53 80 52 31 74 73 20 12 87 71 78 95 25 45 75 43 32 85 82 7 13 90 19 +Card 147: 30 2 48 5 16 25 70 89 35 85 | 3 5 55 90 16 86 70 87 17 29 74 14 22 78 39 37 71 45 79 42 2 60 21 62 89 +Card 148: 61 50 41 22 75 80 46 93 55 6 | 62 68 95 45 74 21 13 52 66 2 17 53 97 83 90 40 44 28 25 86 14 82 15 30 84 +Card 149: 49 54 61 92 19 16 78 83 15 71 | 7 33 40 69 2 34 70 9 91 79 74 42 67 38 82 60 28 43 23 80 39 56 30 66 1 +Card 150: 47 85 71 36 9 98 45 28 7 58 | 94 88 20 62 13 77 85 27 43 92 18 41 31 3 2 45 74 99 30 40 26 93 19 23 65 +Card 151: 65 90 39 91 53 76 79 51 9 36 | 5 84 49 13 70 64 15 33 92 67 41 57 19 21 22 87 54 50 46 66 52 24 71 29 16 +Card 152: 61 62 51 11 14 44 10 29 31 35 | 95 47 96 16 5 32 88 90 52 65 70 94 9 80 81 56 50 43 15 34 45 68 67 42 18 +Card 153: 91 86 12 23 53 39 96 79 14 76 | 68 66 83 69 73 42 59 67 4 38 11 46 16 95 71 52 88 13 19 48 9 99 30 62 43 +Card 154: 47 44 72 6 95 7 21 64 59 29 | 72 7 12 33 21 14 91 3 99 71 64 44 70 63 6 22 88 16 43 57 73 59 76 60 47 +Card 155: 38 36 24 69 59 58 96 45 39 30 | 17 64 59 31 80 36 25 89 96 4 27 12 30 74 11 29 57 63 45 19 42 38 69 58 39 +Card 156: 60 93 14 54 53 40 34 26 1 28 | 46 62 40 69 48 39 35 68 86 22 19 10 42 25 88 67 58 96 54 44 56 85 31 90 99 +Card 157: 82 93 7 76 69 1 36 5 4 3 | 66 96 92 52 29 5 91 62 45 27 25 31 28 78 99 95 73 14 37 26 9 98 42 55 11 +Card 158: 34 52 78 67 96 62 54 85 86 31 | 21 42 63 51 12 70 15 83 34 35 62 69 52 54 36 85 31 86 67 41 53 7 1 96 82 +Card 159: 67 49 58 35 82 57 29 6 20 25 | 30 46 2 75 38 57 99 7 29 69 94 40 12 45 97 49 66 6 35 76 32 37 71 60 68 +Card 160: 17 49 10 5 34 2 23 91 3 19 | 29 39 67 53 14 61 41 85 18 65 56 77 54 55 13 27 28 45 60 7 62 6 96 38 35 +Card 161: 4 42 38 50 85 92 27 25 82 7 | 82 5 83 71 52 43 12 75 73 92 96 1 61 59 25 85 7 22 23 80 35 15 97 88 30 +Card 162: 42 69 75 64 40 12 29 56 33 62 | 57 5 83 79 26 55 84 60 70 16 47 2 19 30 7 62 89 76 20 90 66 78 21 9 87 +Card 163: 52 10 27 86 7 72 95 88 13 75 | 94 76 43 33 31 69 35 68 39 78 48 83 28 66 67 15 72 34 32 25 85 53 40 46 1 +Card 164: 14 95 31 43 91 56 22 68 17 33 | 74 98 24 59 4 93 67 23 64 35 51 42 92 88 63 20 29 70 16 82 89 45 39 27 12 +Card 165: 29 5 49 25 67 79 56 44 43 93 | 20 54 10 52 8 50 98 9 73 92 78 24 86 69 77 82 80 41 94 36 35 22 32 38 3 +Card 166: 63 92 68 93 58 16 90 6 13 46 | 31 45 39 8 65 49 23 81 62 72 7 15 82 35 53 4 80 83 48 13 10 11 71 40 61 +Card 167: 58 70 1 3 7 81 65 83 79 77 | 87 8 59 29 18 6 14 48 35 9 60 94 80 92 51 2 73 36 47 27 86 89 41 42 4 +Card 168: 69 93 96 77 76 90 17 88 11 26 | 31 13 77 9 86 82 51 67 53 99 76 35 81 6 28 92 24 14 87 59 41 37 88 18 96 +Card 169: 99 40 11 87 24 55 4 46 66 49 | 60 67 72 31 94 69 42 46 86 17 47 70 95 90 6 4 3 59 61 24 93 73 28 58 96 +Card 170: 29 84 4 80 72 94 9 7 55 68 | 24 62 7 35 21 55 85 94 29 4 84 38 42 33 2 77 58 9 11 80 41 72 76 13 68 +Card 171: 93 7 9 11 12 13 79 51 99 62 | 99 28 51 12 82 11 35 18 93 34 7 17 2 13 63 54 9 69 62 84 68 79 58 36 70 +Card 172: 16 79 33 10 58 22 67 98 46 43 | 75 24 96 64 4 50 38 10 5 31 45 21 98 7 17 34 60 72 97 92 6 3 99 86 9 +Card 173: 98 73 26 29 85 75 13 22 27 35 | 87 76 25 43 82 17 79 74 16 91 37 97 46 15 14 40 52 70 31 68 81 5 36 72 57 +Card 174: 4 29 72 26 46 89 61 15 16 11 | 4 68 89 24 58 94 46 26 55 15 67 61 72 98 75 84 29 11 47 2 54 13 9 28 16 +Card 175: 40 49 71 63 25 47 44 26 98 31 | 26 20 18 96 64 92 88 63 62 95 47 33 86 35 70 75 90 27 1 59 54 74 80 41 77 +Card 176: 92 17 34 39 64 49 70 69 44 91 | 49 24 4 81 74 31 28 36 69 39 68 16 98 2 3 26 96 76 57 19 44 95 93 29 34 +Card 177: 60 32 48 84 3 86 62 55 22 58 | 17 91 95 50 64 89 32 60 82 62 49 58 25 12 86 3 40 16 84 87 66 61 77 55 9 +Card 178: 92 4 66 65 13 87 57 16 78 3 | 92 16 81 7 78 42 25 44 43 24 66 29 50 40 19 71 89 53 59 77 67 76 39 84 1 +Card 179: 6 67 72 98 79 45 12 87 77 60 | 19 12 57 66 14 26 28 31 18 24 45 6 15 29 99 27 90 87 10 59 92 36 58 72 79 +Card 180: 6 9 43 74 48 87 52 56 76 30 | 97 8 88 19 2 54 9 29 3 39 23 71 93 41 95 87 98 68 36 42 94 40 45 84 85 +Card 181: 26 5 23 14 59 6 33 89 97 96 | 16 7 41 8 45 71 47 98 67 88 58 13 79 66 85 81 32 17 60 91 51 49 27 69 3 +Card 182: 53 5 83 87 3 44 25 98 48 24 | 14 77 95 98 40 81 97 85 80 15 33 38 75 17 5 56 71 43 65 28 87 10 66 22 70 +Card 183: 67 20 49 89 38 55 16 79 27 45 | 43 57 35 34 26 93 13 63 5 87 72 69 28 96 78 3 48 47 61 94 59 7 37 95 1 +Card 184: 1 73 35 99 24 74 64 21 14 81 | 48 81 57 15 28 49 31 82 91 8 62 79 54 20 95 13 21 97 98 19 51 6 83 70 61 +Card 185: 31 6 98 7 17 45 42 37 67 56 | 53 73 7 91 20 63 57 96 28 72 15 44 55 29 23 77 58 32 1 11 62 65 95 83 25 +Card 186: 93 81 16 50 3 40 87 46 90 58 | 89 70 62 28 4 19 2 63 21 53 14 9 55 25 54 38 94 82 47 86 36 96 49 8 80 +Card 187: 45 71 74 81 84 18 23 35 86 25 | 34 90 45 74 63 35 1 3 88 12 84 71 97 29 32 26 40 18 76 89 9 80 86 94 64 +Card 188: 3 21 56 32 1 26 54 60 13 28 | 40 24 26 28 78 12 11 92 17 98 30 27 1 87 25 97 57 49 52 38 51 32 42 47 7 +Card 189: 41 82 69 64 35 71 79 61 44 36 | 35 69 22 37 44 29 79 39 14 3 56 66 36 62 82 26 72 61 88 33 97 64 41 98 34 +Card 190: 96 84 47 27 31 17 59 40 64 67 | 16 32 82 27 21 75 93 74 60 80 29 48 23 31 54 98 79 58 17 67 18 43 12 25 96 +Card 191: 35 60 71 44 21 62 81 14 67 85 | 36 37 69 9 34 35 62 40 54 41 1 13 23 58 85 86 24 55 14 7 92 96 50 11 81 +Card 192: 82 95 6 69 48 56 42 96 94 93 | 98 92 96 63 42 76 16 50 95 48 28 8 39 6 94 47 69 97 56 82 44 93 21 26 7 +Card 193: 22 86 12 38 3 6 44 77 27 59 | 53 80 89 25 92 38 63 86 65 34 99 46 27 75 8 1 7 47 66 29 2 77 61 12 54 +Card 194: 15 20 33 91 80 61 37 99 58 92 | 10 76 99 58 97 91 71 64 33 36 29 30 42 37 87 66 90 6 49 22 68 40 92 2 73 +Card 195: 10 59 86 92 5 55 25 48 36 45 | 27 5 48 84 25 57 35 78 56 63 82 28 87 92 88 10 19 42 36 53 86 60 81 39 55 +Card 196: 69 95 34 9 80 55 11 30 49 88 | 15 89 44 26 48 49 74 54 35 77 47 11 9 21 25 95 31 88 53 56 42 69 18 10 60 +Card 197: 62 23 83 63 24 58 57 72 8 68 | 41 25 26 58 80 45 99 55 63 96 46 60 84 33 98 42 50 62 44 52 47 7 57 75 12 +Card 198: 86 22 73 29 41 40 11 76 69 83 | 78 20 14 67 51 93 8 47 43 44 82 16 2 55 96 98 61 48 31 49 91 24 3 27 87 +Card 199: 27 59 83 12 76 82 74 98 47 73 | 30 20 63 53 67 68 16 4 66 10 93 61 89 80 36 75 62 99 1 5 70 31 17 82 22 +Card 200: 49 66 64 92 36 61 44 96 68 67 | 57 55 19 18 78 64 90 85 72 84 5 10 38 71 74 34 68 30 46 83 86 25 89 50 49 +Card 201: 83 53 58 64 84 72 70 19 41 17 | 22 55 50 90 65 88 6 76 43 70 26 63 41 91 82 79 89 98 71 54 80 67 59 36 49 +Card 202: 70 55 83 56 42 25 11 1 41 49 | 32 54 80 59 53 23 75 8 68 6 94 45 86 3 61 98 36 14 44 18 89 39 81 51 88 +Card 203: 12 10 29 80 87 71 65 37 55 9 | 11 5 75 46 3 81 6 54 64 32 95 33 49 34 74 48 92 20 21 56 53 50 41 61 36 diff --git a/2023/ocaml/day4/lib/dune b/2023/ocaml/day4/lib/dune new file mode 100644 index 0000000..19bf7d4 --- /dev/null +++ b/2023/ocaml/day4/lib/dune @@ -0,0 +1,2 @@ +(library + (name day4)) diff --git a/2023/ocaml/day4/test/dune b/2023/ocaml/day4/test/dune new file mode 100644 index 0000000..403e363 --- /dev/null +++ b/2023/ocaml/day4/test/dune @@ -0,0 +1,2 @@ +(test + (name test_day4)) diff --git a/2023/ocaml/day4/test/test_day4.ml b/2023/ocaml/day4/test/test_day4.ml new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3-18-g5258