commit e22a08a3afeafe96c80bac8c54d0d55db8645c52 Author: talksik Date: Thu Jun 15 21:01:21 2023 -0700 adding in solution for day one diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..741aef5 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1119 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aoc-2023" +version = "0.1.0" +dependencies = [ + "reqwest", + "tokio", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base64" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bumpalo" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "errno" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "h2" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.1", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "ipnet" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" + +[[package]] +name = "itoa" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.146" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" + +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "num_cpus" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +dependencies = [ + "hermit-abi 0.2.6", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "openssl" +version = "0.10.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69b3f656a17a6cbc115b5c7a40c616947d213ba182135b014d6051b73ab6f019" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2ce0f250f34a308dcfdbb351f511359857d4ed2134ba715a4eadd46e1ffd617" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "proc-macro2" +version = "1.0.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + +[[package]] +name = "reqwest" +version = "0.11.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "rustix" +version = "0.37.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "ryu" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" + +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "security-framework" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.164" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" + +[[package]] +name = "serde_json" +version = "1.0.96" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "syn" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +dependencies = [ + "autocfg", + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +dependencies = [ + "autocfg", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..5c35657 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "aoc-2023" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +reqwest = "0.11.18" +tokio = { version = "1", features = ["full"] } diff --git a/src/input.txt b/src/input.txt new file mode 100644 index 0000000..61621d9 --- /dev/null +++ b/src/input.txt @@ -0,0 +1,2251 @@ +2494 +8013 +1055 +5425 +9104 +10665 + +10642 +10677 +10300 +7374 +9085 +8508 +7569 +6214 + +5300 +5960 +8252 +5852 +4308 +9991 +6367 + +1361 +5356 +6114 +3379 +5996 +3822 +3785 +1622 +1143 +6009 +2211 +4951 +3093 +6395 + +4892 +6648 +3022 +6063 +5436 +2174 +4264 +2004 +6444 +2926 +2651 +2749 + +17121 +17879 +11056 +15642 + +3926 +6751 +2643 +7882 +4006 +1351 +4912 +2735 +2985 +4015 + +3043 +6923 +10352 +9998 +2470 +7346 +1077 +3024 + +21632 +34735 + +8525 +1982 +9285 +4188 +7017 +6666 +6538 + +7019 +2696 +2707 +3639 +3674 +3642 +4837 +3804 + +3570 +8191 +6054 +8727 +7323 +3522 + +1442 +5794 +3774 +2398 +5615 +5786 +1832 +2234 +7906 +4799 + +12978 +17621 +9788 +9237 + +3006 +2799 +5627 +2478 +3159 +6430 +3843 +1469 +2006 +4131 +2269 +6201 +3593 +1423 + +30560 + +5281 +3850 +2894 +4056 +4341 +4117 +8216 +2700 +1327 +2379 + +1597 +7217 +1003 +2555 +4820 +2881 +4051 +4550 +2457 +6518 +5480 +3044 + +9465 +4325 +5593 +5606 +9317 +1026 +3707 +9456 +7801 + +6217 +7814 +3159 +3866 +1035 +4302 +1498 +1160 +1510 +4650 + +13306 +15884 +9699 +11206 + +24775 +21119 +12643 + +12737 +10893 +3450 +10732 +8670 +7597 + +35714 + +3380 +3513 +6559 +6891 +7767 +5311 +7086 +5345 +3498 +3091 +2516 + +11565 +12877 +13416 +10568 +16033 + +1380 +4192 +5815 +6230 +2434 +2443 +3682 +5568 +6134 +3316 +5878 +4493 +3857 +2110 + +4341 +2469 +5606 +4268 +3525 +5555 +5771 +2284 +1921 +3279 +1901 +5991 +2868 +4866 +2310 + +5969 +18172 +1931 + +3598 +2837 +1105 +7300 +11781 +10686 + +3698 +4698 +3891 +4481 +4089 +3511 +4949 +2148 +4017 +2529 +3572 +1912 +1837 +1937 +2688 + +6485 +7072 +7964 +13114 +5864 +5280 + +12413 +7196 +12856 +18069 + +1367 +2238 +3089 +3189 +5022 +3877 +5238 +3566 +1081 +1525 +1958 +5796 +2498 +1517 +1481 + +25527 +17474 +4705 + +6722 +2844 +3856 +1780 +4518 +5679 +4775 +6067 +2695 +5979 +2488 +1515 +5071 + +7155 +4147 +4406 +4169 +2156 +7110 +6837 +4673 +3599 +2672 +2768 +3195 + +8040 +5248 +6440 +1830 +2281 +4938 +6116 +6842 +5743 +5788 +5703 + +2527 +3362 +5630 +4976 +1989 +5157 +4951 +3382 +4525 +4057 +4077 +3717 +4035 +4907 +1795 + +1069 +7242 +2438 +7224 +8058 +6215 +7770 +5958 +2445 +1702 +3558 + +6075 +4164 +5797 +1051 +3104 +2966 +3653 +3933 +1546 +5111 +4811 +4145 +3532 +2289 +1468 + +9540 + +1830 +6422 +7523 +2131 +3072 +2873 +1423 +7560 +4640 +4476 + +10022 +15927 +14403 +2312 + +3056 +5371 +4501 +6465 +4761 +2050 +4187 +1179 +3746 +6089 +1365 +6495 +4844 +4984 + +1812 +2671 +1805 +4200 +1986 +5327 +5548 +1872 +4364 +3147 +5447 +5882 +2602 +5501 +2446 + +9725 +8080 +9941 +10636 +6852 +5378 +4137 + +25228 +22215 +10199 + +15394 +28799 + +3620 +1758 +4663 +2715 +5642 +6209 +5361 +4582 +2165 +7485 +7611 + +6910 +6782 +2177 +2763 +6877 +3922 +1355 +2400 +6139 +5362 +5737 +3766 +3535 + +6587 +6770 +3729 +3316 +4161 +2828 +3886 +7483 +2746 +5923 + +1647 +6201 +1200 +5810 +4493 +5373 +1856 +5507 +1833 +4277 +2897 +4473 +4433 +4352 + +3807 +18028 +7426 +18476 + +6493 +1157 +3125 +7736 +1208 +3243 +7737 +1953 +1970 +3245 +1600 + +12034 +12959 +9334 + +8432 +3424 +4506 +5758 +10840 +11056 + +7284 +4013 +4217 +7307 +6367 +1977 +3617 +2165 +2969 +6595 +6651 +2446 + +1083 +5636 +1785 +2553 +4634 +3790 +7465 +2970 +2725 +4267 +2861 + +3145 +7872 +5049 +3368 +4009 +2348 +6877 +6956 +2359 +8064 +4386 + +4764 +6236 +4923 +4395 +2974 +3985 +2725 +1831 +2755 +4068 +2383 +2138 +2998 +4346 + +6673 +2519 +2754 +5734 +4796 +3389 +6931 +5771 +5936 +2328 +5684 +3171 +4608 + +15166 +11415 +9051 +3437 +10405 + +1590 +7370 +7003 +5030 +3852 +6353 +7054 +3765 +2925 +6968 + +9678 +2846 +8939 +10270 +7196 +11860 +4221 + +4447 +5407 +1459 +1693 +3774 +3978 +5240 +2331 +1903 +4421 +1152 +5084 +1969 +2365 +4526 + +5249 +5631 +3701 +6419 +6003 +6884 +2315 +5745 +1341 +6370 +5430 +6442 +3156 + +2112 +3970 +1000 +1981 +3528 +3490 +1510 +1629 +5413 +4277 +6347 +6134 +1855 + +8848 +3187 +9361 +16338 +5644 + +8477 +6983 +8052 +4156 +8204 +3216 +4797 +3024 +3499 +6006 + +7326 +14394 +7169 +17160 + +3282 +5582 +6657 +5435 +2096 +3038 +5747 +2545 +1927 +6331 +6785 +1199 +1794 + +1471 +4089 +8406 +3811 +7060 +1164 +1042 +5968 +8721 + +6191 +17967 +6680 +15071 + +1811 +2960 +4046 +4196 +5271 +1982 +2324 +8928 +4517 + +12525 +5174 +5986 +14713 +15516 + +4412 +5282 +6035 +5882 +5488 +5797 +1101 +2763 +6159 +3886 +5358 +5802 +4033 +3113 + +9534 +4195 +9134 +4093 +2988 +7170 +10552 +1724 + +1768 +8793 +5606 +8771 +5365 +9465 +6618 +3528 + +2206 +4623 +4108 +3138 +5818 +4907 +2036 +1646 +5703 +3097 +3475 +1167 +2515 +5095 +4964 + +3633 +6926 +5402 +4602 +8429 +9575 +7807 +3691 +1060 + +1142 +10612 +6215 +9965 +6377 +2889 + +3544 +3870 +1373 +1166 +2068 +5111 +1958 +4383 +1868 +5305 +3620 +5304 +3126 +2972 + +36719 + +6297 +1347 +1423 +7325 +1798 +7102 +2585 +7973 +7084 +6963 +2423 + +23242 +10969 +22162 + +13407 + +3392 +4473 +1448 +4470 +2740 +2249 +1154 +2212 +3078 +3817 +6471 +3506 +3395 +1906 + +4808 +1923 +8332 +8636 +2919 +5259 +7210 +10191 + +7183 +4475 +5652 +6992 +7492 +7906 +7275 +6680 +5776 + +2752 +9069 +11736 +9659 +11337 +1120 +9412 + +3199 +3488 +13447 +10265 +6076 +13516 + +1651 +3970 +7077 +6774 +6915 +4838 +10860 + +5737 +6268 +1718 +10759 +3572 +5494 + +24537 +10330 + +10316 +2956 +5555 +6248 +5263 +1249 +5783 +5774 + +3525 +2066 +2616 +7191 +3926 +1532 +5964 +5512 +1695 +2512 +6491 + +2975 +1916 +10644 +5182 +5339 +8680 +3275 +10289 + +4593 +4274 +4044 +4904 +1989 +4851 +1555 +3703 +5231 +2427 +3096 +4461 +5178 +5241 +1141 + +2331 +1706 +5359 +5149 +3273 +4602 +3067 +6598 +6665 +3244 +2654 + +2959 +3036 +1202 +4882 +1152 +1667 +4291 +2393 +3774 +5366 +1414 +3985 +4260 +2775 +3831 + +2474 +1259 +2835 +6583 +6997 +6502 +5069 +6551 +3077 +5282 +2469 +7110 + +8600 +5500 +15337 +13901 +1000 + +18310 +10484 + +6280 +8351 +4405 +5826 +1032 +6646 +1367 +3758 +7046 +2308 + +4888 +8942 +6060 +2012 +9154 +6142 +1923 +7135 +3387 + +9170 +5125 +1487 +6729 +8642 +10296 +7469 + +1373 +9559 +6106 +2405 +7721 +5877 +5946 +6080 + +4164 +2747 +4312 +5824 +2960 +2506 +6274 +5887 +4796 +3492 +4477 +2933 +1811 +4957 + +8728 +9090 +7028 +8869 +3362 +3784 +7482 +8101 +3665 + +5341 +8591 +3108 +9080 +6248 +6100 + +7454 +28472 + +7151 +4060 +9436 +9008 +1333 +6366 +8098 +7046 +1869 + +34017 +11550 + +4232 +6470 +3007 +4974 +6384 +5389 +2818 +3389 +2533 +6309 +2500 +2012 +2348 +3439 + +2004 +2786 +6125 +2455 +3910 +2408 +1037 +2979 +3755 +3838 +2639 +5705 +4765 +3057 + +2257 +2999 +6940 +2994 +5671 +1779 +2765 +5705 +2980 +4426 +6194 +4142 +5594 + +31017 +14466 + +5123 +4500 +5594 +2181 +3229 +4797 +3006 +5755 +3988 +3184 +2501 +5516 +5401 + +23717 +19963 +23101 + +22339 +24909 +1460 + +4560 +2544 +3862 +4631 +2156 +7098 +3945 +1190 +1009 +1850 +2418 +2600 + +3012 +1803 +1248 +1391 +3975 +4870 +6010 +4507 +5351 +2986 +6310 +4678 +4341 +4420 + +18246 +20268 +12620 + +2308 +9249 +3234 +11647 +5717 +10514 +10348 + +6993 +14784 +22089 + +2456 +7956 +4644 +11788 +10286 +10176 +6059 + +7692 +10510 +11255 + +6235 +2861 +1136 + +11444 + +11241 +2893 +3679 +12208 + +8913 +9505 +3537 +15868 + +4555 +9248 +18262 + +12005 +1419 +5608 +3454 + +14026 +3426 +9822 +6157 +1034 + +3063 +1146 +10723 +1798 +10569 +3361 +8119 +5926 + +11894 +8410 +3507 +8343 +15469 + +16610 +3588 +11982 +2953 + +3112 +4710 +4522 +2766 +4143 +3462 +1736 +2128 +2889 +4421 +2772 +1153 +4622 +3897 +4013 + +3483 +1728 +3257 +4736 +11723 +2254 +7438 + +4465 +5761 +1625 +5566 +1391 +5720 +2158 +5331 +1482 +1734 +4974 +1276 +2704 +1386 +5426 + +18780 +10740 + +5245 +1769 +7853 + +2539 +6400 +4704 +3929 +6819 +4483 +1535 +1689 +6851 +2644 +1799 +6513 +4817 + +6631 +13675 +2737 +15282 +10426 + +4102 +2574 +4427 +2824 +1083 +4480 +3898 +2459 +4123 +4502 +2174 +4804 +3109 +3121 +3408 + +9018 +2604 +9256 +6568 +4487 +4133 +3395 +9266 +2025 + +3920 +1556 +6177 +5349 +6296 +13639 + +4313 +1156 +8342 +7415 +4000 +11858 +4709 + +8780 +5173 +6162 +6344 +1941 + +1301 +4685 +1841 +2222 +3305 +3965 +6551 +7114 +5399 +3747 +1839 +6706 + +7853 +11264 + +14768 +14746 +5840 +1731 + +4166 +1442 +2971 +8507 +1859 +5344 + +2874 +1080 +4159 +2491 +3860 +6050 +6523 +1136 +1478 +6370 +6541 +3607 +1908 + +4652 +5783 +4407 +5261 +1017 +3165 +3589 +1771 +1700 +1308 +2280 +5742 + +4598 +4281 +2933 +5351 +2897 +3983 +6840 +4827 +3726 +7356 +5221 +4955 + +5184 +9444 +4616 +2549 +4979 +4577 + +4998 +1639 +1189 +2612 +1072 +2130 +1044 +3009 +4132 +2712 +1223 +5394 +4698 +3702 +2456 + +5523 +6843 +6182 +4741 +6514 +5068 +4521 +2424 +6076 +7273 +3125 +6378 + +5675 +5075 +4462 +2155 +2621 +6955 +6893 +5037 +1935 +6837 +2225 +5190 + +23738 +30667 + +3332 +4507 +4454 +3274 +6417 +5739 +1855 +5078 +2040 +2472 +6068 +5696 +1449 + +12606 +17528 + +1761 +8980 +8137 +12561 +1838 + +23685 +5576 +2070 + +2014 +2573 +1478 +3902 +6247 +5167 +3393 +3723 +6336 +4675 +6430 +5310 +1484 +4109 + +9842 +3374 +4250 +6939 +3975 +5106 +4823 + +27517 +29161 + +3861 +2633 +15717 + +4392 +3840 +3178 +4148 +1419 +4242 +5498 +3890 +6033 +4700 +6624 +4499 + +7872 +1829 +9261 +3780 +3815 +11309 +5207 + +10646 +3597 +8139 +4802 +6588 +8367 +9006 + +3268 +4153 +4070 +3310 +1132 +6237 +3285 +4461 +1418 +3315 +5840 +3931 +4168 +4059 + +12562 +15842 +4084 +5075 +4652 + +13950 +9685 +24437 + +13322 +17454 +3563 +6272 + +3171 +4566 +2828 +2367 +3947 +3408 +4149 +3323 +2995 +5217 +2740 +5365 +1857 +3393 +5257 + +25535 +4255 +4792 + +2725 +7987 +4898 +4443 +6620 +7232 +5562 +8511 +8551 +6817 + +4986 +1999 +9609 +4028 +7978 +7833 + +7122 +3544 +1386 +6190 +2119 +3479 +3638 +2645 +4651 +6909 +3419 +6260 + +4884 +24630 +16892 + +1404 +3127 +3142 +5332 +1979 +1038 +4098 +3841 +3620 +3092 +5325 +3685 +5385 +3439 + +25512 +4994 +1339 + +65852 + +5886 +2370 +2424 +7331 +4765 +8599 +3997 +4213 +1185 +4739 + +3268 +6752 +3238 +8925 +4044 +9369 +4423 +6024 + +7615 +7582 +1946 +6493 +6969 +2369 +2498 +4231 +6898 +2301 + +13338 +15159 +1007 +1579 +4532 + +3111 +4477 +2628 +2009 +1361 +3171 +5895 +5000 +3213 +5536 + +3384 +6723 +5558 +3445 +7104 +4590 +2005 +1142 +4239 +2804 +2136 +5493 + +8745 +8221 +2669 +3171 +5469 +2077 +7506 +1388 +6350 + +1347 +1620 +2690 +4070 +4859 +6068 +4170 +4634 +2749 +3346 +3541 +3841 +3558 +5879 +1725 + +1630 +8268 +4370 +1609 +6617 +5419 +4991 +3865 +5722 +4530 + +5677 +17141 +16522 +13806 + +18659 +25364 +19945 + +27851 +31094 + +4535 +5908 +4391 +1243 +1037 +4963 +1570 +5836 +3720 +3066 +2995 +4234 +3073 +5882 + +37830 + +8609 +8530 +6527 +2145 +8647 +7720 +5906 +2524 +8666 + +1143 +1080 +4034 +2107 +2539 +4458 +5898 +2709 +4941 +1011 +1232 +3069 +1527 +2769 +5071 + +2092 +6346 +6041 +8472 +10954 +2509 +3632 + +23978 +1578 +23954 + +3027 +2598 +1818 +5892 +2519 +5083 +3793 +5849 +1488 +3357 +1350 +6813 +4486 + +2282 +6271 +2548 +6333 +7978 +4451 +5808 +5716 +7485 +6615 +2823 + +63025 + +5701 +2013 +5327 +3534 +4144 +1980 +5576 +5075 +5456 +3808 +2466 +5444 +4918 +6048 +4177 + +3240 +1730 +5306 +7215 +2278 +4619 +3812 +4873 +4453 + +1467 +2152 +6616 +3839 +3422 +3110 +4447 +6771 +2967 +4994 +6764 +5722 +3680 + +58287 + +6434 +1137 +15936 +15651 +14632 + +1074 +5120 +1340 +4497 +4947 +2195 +1243 +5123 +2076 +4464 +2615 +3780 +5693 +1208 +2180 + +14965 +10684 +2049 +10628 +9532 + +24592 + +4560 +4156 +3363 +1751 +4886 +5216 +2888 +1327 +1285 +6123 +2701 +4501 +6007 + +6445 +1701 +3886 +3597 +3854 +2593 +3249 +3424 +1703 +3036 +1670 +5705 +5781 +1953 + +11411 +7632 +1419 +5620 +7953 +7273 +10715 + +12735 +1860 +6909 +9353 + +6189 +10627 +9335 +5646 +5375 +6886 +3897 +5716 + +8653 +12542 +6082 +15244 + +4819 +1613 +1332 +3125 +1897 +3675 +3688 +3393 +3794 +1146 + +2603 +6838 +6037 +5540 +2335 +6837 +4425 +3437 +5965 +3449 +4752 +5173 +1971 + +25800 +14272 +12870 + +4840 +6051 +2429 +2372 +2533 +4184 +4051 +5449 +1321 +2738 +4450 +4473 +4618 +2936 +5818 + +9966 +9565 +4598 +6548 +6832 +1749 + +6333 +7723 +7084 +7305 +2609 +8143 +10400 +7867 + +2652 +6421 +6630 +4124 +8490 +8618 +6380 +2636 +8045 + +1382 +6541 +2533 +3419 +3661 +4779 +5466 +6163 +5536 +4844 +2600 +1126 +4297 + +4541 +10317 +5900 +4278 +2540 +4385 +3048 +3079 + +7542 +4938 +1913 +7746 +7472 +7621 +1307 +2142 + +12358 +6813 +15347 +14448 +4584 + +8653 +14358 +1689 +3466 +13581 + +18460 +15717 +11921 + +5002 +1450 +1233 +5553 +2723 +3811 +4765 +1001 +4513 +5847 +4403 + +20065 +10696 + +8007 +1090 +2875 +4585 +7707 +7823 +2009 +8498 + +9586 +8143 +8021 +4245 +7291 +3936 +11899 + +26024 + +14163 +9586 +12371 +2127 +4436 + +2613 +6450 +3236 +7142 +6570 +6405 +2444 +3243 +6166 +7090 +3461 +6534 + +3176 +4477 +4562 +3589 +5280 +5548 +3708 +4632 +3836 +4171 +5284 +3667 +3313 +4312 + +12262 +7518 +13586 +14339 +2951 + +30207 + +3979 +2163 +7147 +3726 +4358 +7572 +3345 +1296 +2755 +4608 + +5723 +3754 +2684 + +19384 +3722 + +2024 +8540 +6504 +12081 +4812 +3647 +2731 + +18117 +13193 +13899 +19853 + +3533 +4991 +2034 +3914 +5920 +2455 +2660 +3175 +1410 +1127 +2272 +3689 +5804 +1311 +1121 diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..967bde1 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,113 @@ +async fn read_elf_calories(file: &str) -> Vec { + // read file + let data = std::fs::read_to_string(file).expect("Unable to read file"); + + // put data into a vector + let mut result: Vec = vec![]; + for line in data.lines() { + if let Ok(num) = line.parse::() { + result.push(num); + } else { + result.push(0); + } + } + + result +} + +// (elf winner, winner calories) +fn get_elf_with_max_calories(inventory: &[u32]) -> (u32, u32) { + let mut current_calories: u32 = 0; + let mut last_max_calories: u32 = 0; + // the current elf that is eating + let mut current_elf: u32 = 1; + let mut current_winner_elf: u32 = 1; + + for (index, &item) in inventory.iter().enumerate() { + current_calories += item; + + if item == 0 || index == inventory.len() - 1 { + if current_calories > last_max_calories { + last_max_calories = current_calories; + current_winner_elf = current_elf; + } + current_calories = 0; + current_elf += 1; + } + } + + (current_winner_elf, last_max_calories) +} + +// takes a list of calories and bunches them up per elf +fn consolidate_calories(inventory: &[u32]) -> Vec { + let mut result: Vec = vec![]; + + let mut current_elf_calories: u32 = 0; + for (index, &item) in inventory.iter().enumerate() { + current_elf_calories += item; + + if item == 0 || index == inventory.len() - 1 { + result.push(current_elf_calories); + current_elf_calories = 0; + } + } + + result +} + +// sort the array of calories by max first +fn sort_vec(arr: &mut [u32]) -> &mut [u32] { + arr.sort_by(|a, b| b.cmp(a)); + arr +} + +// (elf winners, winners' calories) +fn top_three_elves_calories(inventory: &[u32]) -> u32 { + let mut consolidated = consolidate_calories(inventory); + let sorted = sort_vec(&mut consolidated); + + let mut result: u32 = 0; + for elf_calories in sorted.iter().take(3) { + result += elf_calories; + } + + result +} + +// write test +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_get_elf_with_max_calories() { + assert_eq!(get_elf_with_max_calories(&[1, 2, 3, 4, 0, 45]).1, 45); + } +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + println!("Hello, world!"); + + let inventory = read_elf_calories("./src/input.txt").await; + let elf_with_max_calories = get_elf_with_max_calories(&inventory); + + let test_inventory = read_elf_calories("./src/test.txt").await; + let test_elf_with_max_calories = get_elf_with_max_calories(&test_inventory); + + println!("Elf with max calories: {}", elf_with_max_calories.1); + + println!( + "Test Elf with max calories: {}", + test_elf_with_max_calories.1 + ); + + let top_three_elves = top_three_elves_calories(&inventory); + println!("Top three elves calories: {}", top_three_elves); + + let test_top_three = top_three_elves_calories(&test_inventory); + println!("Test top three elves calories: {}", test_top_three); + + Ok(()) +} diff --git a/src/test.txt b/src/test.txt new file mode 100644 index 0000000..2094f91 --- /dev/null +++ b/src/test.txt @@ -0,0 +1,14 @@ +1000 +2000 +3000 + +4000 + +5000 +6000 + +7000 +8000 +9000 + +10000