From a64def6dd936a48d96f1d1aaa3b754ab0deda472 Mon Sep 17 00:00:00 2001 From: Burnus Date: Fri, 1 Dec 2023 12:46:41 +0100 Subject: [PATCH] Added Solution for 2023 day 01 --- 2023/day01_trebuchet/Cargo.toml | 8 + 2023/day01_trebuchet/challenge.txt | 27 + 2023/day01_trebuchet/src/lib.rs | 58 ++ 2023/day01_trebuchet/tests/challenge_input | 1000 ++++++++++++++++++++ 2023/day01_trebuchet/tests/sample_input | 11 + 5 files changed, 1104 insertions(+) create mode 100644 2023/day01_trebuchet/Cargo.toml create mode 100644 2023/day01_trebuchet/challenge.txt create mode 100644 2023/day01_trebuchet/src/lib.rs create mode 100644 2023/day01_trebuchet/tests/challenge_input create mode 100644 2023/day01_trebuchet/tests/sample_input diff --git a/2023/day01_trebuchet/Cargo.toml b/2023/day01_trebuchet/Cargo.toml new file mode 100644 index 0000000..e3017b3 --- /dev/null +++ b/2023/day01_trebuchet/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day01_trebuchet" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/2023/day01_trebuchet/challenge.txt b/2023/day01_trebuchet/challenge.txt new file mode 100644 index 0000000..6c8df0a --- /dev/null +++ b/2023/day01_trebuchet/challenge.txt @@ -0,0 +1,27 @@ +Something is wrong with global snow production, and you've been selected to take a look. The Elves have even given you a map; on it, they've used stars to mark the top fifty locations that are likely to be having problems. + +You've been doing this long enough to know that to restore snow operations, you need to check all *fifty stars* by December 25th. + +Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants *one star*. Good luck! + +You try to ask why they can't just use a [weather machine](/2015/day/1) ("not powerful enough") and where they're even sending you ("the sky") and why your map looks mostly blank ("you sure ask a lot of questions") and hang on did you just say the sky ("of course, where do you think snow comes from") when you realize that the Elves are already loading you into a [trebuchet](https://en.wikipedia.org/wiki/Trebuchet) ("please hold still, we need to strap you in"). + +As they're making the final adjustments, they discover that their calibration document (your puzzle input) has been *amended* by a very young Elf who was apparently just excited to show off her art skills. Consequently, the Elves are having trouble reading the values on the document. + +The newly-improved calibration document consists of lines of text; each line originally contained a specific *calibration value* that the Elves now need to recover. On each line, the calibration value can be found by combining the *first digit* and the *last digit* (in that order) to form a single *two-digit number*. + +For example: + +``` +1abc2 +pqr3stu8vwx +a1b2c3d4e5f +treb7uchet + +``` + +In this example, the calibration values of these four lines are `12`, `38`, `15`, and `77`. Adding these together produces `*142*`. + +Consider your entire calibration document. *What is the sum of all of the calibration values?* + +To play, please identify yourself via one of these services: \ No newline at end of file diff --git a/2023/day01_trebuchet/src/lib.rs b/2023/day01_trebuchet/src/lib.rs new file mode 100644 index 0000000..f95f4dd --- /dev/null +++ b/2023/day01_trebuchet/src/lib.rs @@ -0,0 +1,58 @@ +pub enum NumberFormat { DigitsOnly, DigitsAndSpelledOut } + +/// Extract the first digit of String `line`, concatenated with its last digit, as a usize. If `f` +/// is `NumberFormat::DigitsOnly`, only the ASCII characters `0` through `9` count as digits, if it +/// is `NumberFormat::DigitsAndSpelledOut`, the English words `one` through `nine` count as well. +/// In the latter case, overlaps are allowed. +/// +/// ## Example +/// ``` +/// use day01_trebuchet::{NumberFormat, calibration_value}; +/// assert_eq!(calibration_value("foo123four", NumberFormat::DigitsOnly), 13); +/// assert_eq!(calibration_value("twone3elevenzero", NumberFormat::DigitsAndSpelledOut), 23); +/// ``` +pub fn calibration_value(line: &str, f: NumberFormat) -> usize { + // Replace number words with digits for part 2, but keep all Es, Ns, Os and Ts at the beginning + // and end, because the words may overlap (which is allowed). Tho other letters, as well as + // longer overlaps cannot occur in these words (i. e. while `one` ends in `ne`, no number + // starts with `ne`; conversely, `six` starts with an S, which no number ends with). + let line_v2 = line.replace("one", "o1e").replace("two", "t2o").replace("three", "t3e").replace("four", "4").replace("five", "5e").replace("six", "6").replace("seven", "7n").replace("eight", "e8t").replace("nine", "n9e"); + let line = match f { + NumberFormat::DigitsOnly => line, + NumberFormat::DigitsAndSpelledOut => &line_v2, + }; + let digits: Vec<&str> = line.matches(|c: char| c.is_ascii_digit()).collect(); + if digits.is_empty() { + 0 + } else { + 10 * digits[0].parse::().unwrap() + digits[digits.len()-1].parse::().unwrap() + } +} + +pub fn run(input: &str) -> (usize, usize) { + let first = input.lines().map(|l| calibration_value(l, NumberFormat::DigitsOnly)).sum(); + let second = input.lines().map(|l| calibration_value(l, NumberFormat::DigitsAndSpelledOut)).sum(); + (first, second) +} + +#[cfg(test)] +mod tests { + use super::*; + use std::fs::read_to_string; + + fn read_file(name: &str) -> String { + read_to_string(name).expect(&format!("Unable to read file: {name}")[..]).trim().to_string() + } + + #[test] + fn test_sample() { + let sample_input = read_file("tests/sample_input"); + assert_eq!(run(&sample_input), (351, 423)); + } + + #[test] + fn test_challenge() { + let challenge_input = read_file("tests/challenge_input"); + assert_eq!(run(&challenge_input), (54644, 53348)); + } +} diff --git a/2023/day01_trebuchet/tests/challenge_input b/2023/day01_trebuchet/tests/challenge_input new file mode 100644 index 0000000..857ec0b --- /dev/null +++ b/2023/day01_trebuchet/tests/challenge_input @@ -0,0 +1,1000 @@ +76xkqjzqtwonfour +sixthree8sixjxjqsjgjgp +38bgcczgtninefivefive +sixthree4eight +nhp3zdc +279four +vzxf4tqrljgxmthreejcr +bbm4twoeight8oneone3one +nineninesix6nine +fourseven5seveneightsvtkcjdrfour +3mkmnpsix5ggfive7 +twotwoqbv5qrpnfl7seven8 +56snzkgsone2cxtpvvh +threenine3 +9dd3twocnrfljs58 +mqtrqnrgrcxbvpgdsmsqhmxlxx4 +nine9mdxzlrbmrxceight94eight +jtqsrmmbonentvmnxbdsseven4 +ninefive8fjnjj +nine53 +33 +ftjhckeightfourvkbd3eight9 +rhpnppsfour7 +95ht1x +fivezqfcvmgdxb5mfvtnlfkonesix +ninefgxxltpkszdnb89ninefivebdbdhckhb +9vtglcdvkgcgrvm4sevenrhppknqfvhldfgqhpgdqfv +852bfkjmccknlqreight1 +fiveone8threethreezsfpzsrbb9fourfive +1one58eightseventhreeqfpxcpv3 +11fg1 +tbrcgcqj2three9sixeight1five +seven2m6 +eightzhqvdrjknb622btfrs41seven +67nine8 +3one8ncctmbsixeighttwonegb +7fivefive +m5sqxstbxp9xx +1onejjz7gcddeightnkfqgxbbtl1 +3jrjkxvhctzmkmqccrmbrvlcvsjnqjjb +ndjfls337six2three87 +bconekhvtkblfour2n5dq2 +922twonmxfeight4 +7two59xvmzc2two3czdn +ninesrdsq99tskfpfpdqqfive6 +tbzgvh4ninesixjzdtxhbpsjlbkr62 +5fourthreebdpnqzbeightjpchone +8ktdbjtvfvkseven +3zhjbjqbpff +6hh7twofourcvmpfjp +sqfzkmrponechzzzbhz34one +jkdrxxbrn43qbjllcfbptddb7 +jdjbq1lcsz5 +fivehlpltzfrzfznxrpnfourmhpkjsjzz971 +gjc5qbgrhlj2one9 +tdn1676spccqqjc4eight2 +one2966lfourldlnxmzqdplzptp +qlkjthree5eightdztseven +512ninexrqpvktwoner +lkgqvlgdqbjhkxp58one7six3 +4two1one7zxxtvxtdvpgfrjh56 +4qbbmlpmjx5fiveninepkcnqgqgdjsrzkgxjsxnkqnd2 +1jjfive7xjfmdfvnz2 +fourxbfsdqlmmmnh9 +c5 +z4s8gdmkbkhbhd18 +threevsnkmbrcgdsvdkqeightqstlvvdtlvp4seven +7eighttwo64nlgxcbthpbgnbf +1mvbvrx +drhgqkfrln2 +three1sixthreelvjthreeffptnm1 +qzlqvjz8ninefive +eight23n1teight2 +31twoqqbmz88 +68fivesixqzfcfsjjzxfiveeight6 +sqpfonezdtpqrfbhzgjmgv7 +4mcmtqnonexkdpnrcfkfxhq5one +hhrldnffive7six6onefivezllprrncczseven +5dfxsn7hjgztpeightqnnninekjxlzdv +vtwobjxdfrkrzeightfxtlkct4 +seven4fiveksnsix7128 +onenfzxhpc7gxthree +jgtwone321fourkjg3 +dphnmspctdfour3 +four91zmlpbxchmsixpn +9eighteight8pgvrngxszvnlnzlzmbqgs1 +fgznzclmcrjhtbdjoneone9 +fttdr4five8vmxrlnr +1nspvnsrdddfhjjdcvltjl +7fiveone8nshjlrxgkeight +57eighteightsrgvcnbncv83 +5xnine5blgjqdjmtgx3 +6rjzh487eight9nndgvj7 +2seven2bvqlftkcplffivefour +x8 +vdbxxb2six4skntkvfcgdfcp2cnvhr9 +7hmqxgvdfgmxhfzfxfour +eight92jckrxshsrbtwophbfvnb +sevenxzjc6 +drflhlxphzspnnzdbcfbpcbtddvd8three56 +fournjhqnxrkjpvjssl9 +81333 +five1gmccznfseven8xlzvlrjsbffour1 +6dlbklsddnqhtwotwo2 +m27six +5mflrcmbbqnztndxtwoonekcsevenone +m24njqdqxrjmn1cjprdzdcntwoldzsgfkpvxbrnrg +ngjrvdd3onezcklpsfoureighteightwoxg +tkrzphtvthreeeightfsxbbdtone762svzt +khqtnrppp81183one +onetplmtp2zbrmbnrzt9sixknkrblt +662 +fivekhclmzchthree3 +5fhgcfzvss +zhgsq2hfbzjxgxgrxvhdkppbdljk +zqd9stvrrddk +7kthreesix7 +46six8eight +hthpnnghjglhhmg8seventwo86seven +5ffr8 +fbdxn76twofourlfdxxbgvmd98five +eight4mjjn4ninelgpc5qnxgneight +oneszfjdcxzc2five +4nzjqv3six +qtnfiveeightkjhhkckrpcdnine9 +6eightggsddqcjhptp9tmhconelg +eight45eightfour87 +25523 +two54nine2mnxszzxeightqf +2kbqpv2sgcskg +4three5njdpbnine +9rdmninejbbdgtffiveseven6 +tmnoneightdlrtninenines847bhldgkpdm +nine762gkknhhfvrbmck82 +three9xdbnxvnvqsvjmnzzdfoursmrspxxrdkgsv +twofour73zjj +4hvdbthree1four +1threeoneone +2576 +ztgbfpsznntnpl3six +1ctllvsztwo6 +2eightsevenbldhvhctpck69ninefour +nzdrfive4zsbrshcmqm5fkzzfptxntgzffthzhxbffskz +1nineqdmlfourlsfn94 +lqvfhgqkbncvzrnptwofourfivefour42jpg +92dtmcpzskzp1 +2djkdgsrrtcnklpxfmfrbcjmnddqntn5six +2nzxgtd75one4four2 +hbvjjrfd74five1six56 +zcnxmgvmhfsevenxxzkxnine1fxxpmkthreejfppctls +2sevenqsrdvchgpfdjfjpld +6njl7fivemkkxlhkmgm1ndlgjbpjt +jneightwofivetwo9eightgjtnrneight +zfvjfive3gfourfiveeight +five71zgxk8chrfzdzjpxxdkqfour +zbx78sevennsninethree7 +rrs8one2jtznfcgdsfxcmkznpptlglnmf +nldfdgpd5seven6tjg4fourddhfg +65sevennlckct93 +qjhgdqgpcfivevleight63two +4jqrzmthree +5llfourfourlvtvtx8vjksjlnrchrkthree +dcpdbsvsshgklkronefourqnsevenf6eightwohf +6ctlhskqqch +threeseven2mpvsdlx +1hnjrxsrflxjtlzqrzvpjsjjjpz6 +nineninervqqmnsevenjtlkfvzpdztwo8three +3bmthsgsix23sevenzvkszfpfq +6sixeightfour1bnhvpsv +3592nine +ttz117ninesix +bgtmckkpq5sevensix +354nine +7spsevens2 +512htbtgxkzdvqtqg +fhkbrst1 +6cr2xsevenchdvgqqht +cmbcdqkjd1xffkggmthree4chklqone1 +gsevenqnfpjzgbv7 +four2njkqbfszj +9qblmmzbtwonkzr +sixsixeightgnflxglkttxk2 +nine3vcfghmgm +two7lgnmpnz87nqrqgczrt +klvsx15 +rrkltqfttf8two2rzzgjbrffxvcbseven3 +5sixctgqr31 +qkhjklpztmkffql45seven213 +pjstvthree4lrmrznbvdseven +sixvnxfltnqv9fpbfbmninesix +pnvthree4threetfjqnvxbxvxb +two1nine +twosix1ninehkqjtkn2 +8pchlzgsixonevrzmqgbf +fxrccmfourthreesix9nineseven +seven929two3zgz +4four386nine +six8three75onehpgsnpjbczninevvcszkr +onefive6eight5 +foureightfour34 +six6mndfhgcjzjreight7sjbv4 +9dlmsnlgj2 +seventhreelmkn5sixjllfqfourlpznlhv +zfgvmzgv95seven +ppdsbnxxx1four +vvfnvbkvtzfourfour675nine8 +2fourthree1 +eight4pqdpjdzbmn31 +pksvg9bzzdcgktgstwosevenvnvftzblfive4eight +seveneightonethree1three +nine69dkv8oneoneone +72phzthreexqlhvsqfoursixninefive +2ninexqpplhqclpl5 +1nineeight +7nineonefour9two3fournine +8mkzqpnnlqljrfive +9nine5foureightthreegdbcrjhnthree5 +sixt69 +rzfg5 +vqdb8bc7mftdt +ngzlhznbtbone38srxvrfrjxsxkglvrpvqgm +9xgrjgq7eighthnbmkbdsdnine4qt +5dfcrkhzbvfourkkkqjfcb77sevensix +loneightfive8seven3 +7ncqhjdhzqeightnine +bsngnjfcone8bhd49tzfdb +deightggcb27four41lfrdbctl +3sevenoneninentjdsxmsixlpqgb +threernmpfptnmcmmrmlngppmbtwofour7sevens +eightjxxlm86 +twoninefmdtnk6rjkpdqzdzfiveninecrlgjrvctgtrrdkfkm +3threethreeonefive +three8thq +bfccdtfmtvhkhp5fourdcgszjgcseven2 +8xcxscl +sixzvdbpqcheight3twothree5lqtcmjdmpq +nbspfour32lddhpsz9 +jgleightcdm9twosllxnzqhjq +2three3sevenfour +jrnineone8qltfvgskbs2244 +zmbonemblfourkfjmvntjhvkbk69bnsjzdkxc +vxxlcpslfdzbhm91 +fjxhtfnqfive3zpctnfive +smxmdtbtfpthree8lkmvlljdcx1six +5bnine3614 +8cdfktkdd8 +twosix9 +4rxgx895drgvoneqxdvvh +threedljsix9cv5jlkvsmgzgbhnkmmfdpqxgzx +twoone7oneqvqoneonefive6 +2tvvmplskcgbxdkzh +gfvffive9six83mhgxkgdprxtwo +2threeeightmnmrtzmdtfivesevenrsmkkslsm7 +ztv23316three6seven +eightcvjqlfbh6fourvpgdpgz +1fivefive9 +brxmhgnnthreethreeoned2 +dgrcgr5xgpnxjbd6ninejsqmgmrvmqz +mtl6three +97bjvklbkpzktckfivenvcmftnnrp4 +7fivejmf +six54 +jktdhlbjbztpp7gjjc46fmkb +64xdrnfxgccrxkdpfxpnninelbmldlmllknine13 +9jbpcbsgk +6hqszplnjk +sixseven1721two44 +6threenzsjtj5cfqvdpcpfbcnfpnp9 +141moneonepzcvtnjpgnine +7n +8cgglsksnz1sixgkhqseven9 +ninescvxnzslj7lldvskqphrqhlsmthreeseven +8twofive3psmxh +4xclmfour3 +4sevenxz5onen3sixvgdmbtzk +3cclhckninejkmddqjkj +7eighthxsntjskvdonefour9eightfiveseven +three2six2seveneightqrlcvvczzfcgcm +plxthreefivethsmpqhzfour5 +6two3sevenrbscccjhxbd +rdzxlnbxbh7eight67 +65four +23mdqdh2 +bsrmxvmfoursixgdssplvshdjlnvgf7gt +823jvfour +5eighttwosixjmlthreeqgtlzbpfqhc7 +35foursljjvpfour7seven5 +nsfourdtgzffvh763 +9thtmpjtpsfnine +mkqcz9pmkpgnd +one6xmpjfkpsdcnfghs5 +jqzgsf834 +twotqpvxjc88659 +4onetxvccvkclcqhl6two +kbgzsixfive7one1four4 +gbkvfour93fivesixseven66 +97pjzlvmonesix +fivenjmtgkjfz7nine3threexsntbqxg55 +fivefive5threemfour526 +bdpdqklfgxninegsrsixmkqbhq33 +twosix9five +nineninenngsevenonegscxlttn7 +sevenpllnzvqjlksevensevenjtkone32five +7dhjbnjvzxfdrhc5r3gtxgxgzzx24 +kqsct1nzzbxldhfive6 +964eight4jp1two +4cds99 +twotworcqrpvgtcq3twoffqz8 +6sixtwosixvzpzlr +ninebkktjnineone9sixfiveseven +fp6sixrrj3sqncfvzqtkcthree +6foursevenninekdbmqbbccjeight8nxvvnbvcdv +nkzthree9471seven +fivecdtrjone4seven22 +twothree6onemvfourvtkrnnvvvbcs +56ninesixmscnd1seven +lnzntzqdeight2foureightthreexjpcprdncd +56zeightz8jfzthgf +eightthreeonegrnine24hsk +hlm185nrphc1 +9five5 +threegqtxmeight9rfkvqnineqnjxhskndqzf +1eightsix +539tzsgsjhnx7 +cxhd32lksevenseven +2qnbljpnjgssbzbhxtcfcxsqjlh5 +eights2kpfznvgghqtrmlb +2six2nine +cdrxjsxvvseven4bdljtxffdjhfive +399hvclz +1six18 +xlnrghvfmz5qthzss +67rcgjkqckptsthree6twofourztsknx +4qhsh2five67cgkjsnqtfvtwo1 +4lghphnh8 +1vpvslztbphninezbttbskeight8 +9fccbx +2zvsxhlceight +threehlmpkghvpz3cpseventhreetwonsix +lsbttpxhlnqzppm868fourtwo9qz +three17 +69513zfxqjvlpfh6mvrr1 +threenkchdrkqnfive5nine +two2tcmsnfivekfh6rfhthree +dtthree61stgcdkxqtm +4hldzqzxqd1dcddroneone +5jknllhktmhqjngc +qphxzsgtwozmpcdq2fiveonevz +three15three4eightthreeeight +vckqkjtonexnzrdbm6vsxfivefive7 +three6eightsfnslxjnc7fourchtxdvftxpnzm +sixfxrxx2 +9crhcfive8tlkr7qmxbcdcqb +6hvjqxjzzsz24bc +fbgsrsqmfv5hpkvlnxsfkpsccprhnv36 +mbpmgvmjcmpgxmfive1fxmh4smb4ct +fourvpdcjttndp9qbfclcz6rnrhnkqjgv +onemhqsm69 +rrz9 +5qfsxdxktfjbdnzcrfvt15eightjmsvhrnks3 +rgmvhprvkm3seven +twolxvjhc269tsnpjhvone +fiveeightrsrgxfjxn96 +mfourjcxsvss3oneightlxh +sevenqjfg67k49xnqddlvf +hgxhtwo6kbkeight +97fivethree8 +ncv228 +95vjxzdpvxb6vxxtwo +rsfeightmrcccsvqsdsfxgonenine7 +fsvjgqhgxsone64zdkdpghcjbprpzlmjfxsfknfd +xbhbtph8eight +1pdgmtwoslhkrtlfour91 +16crzkxrxpxjfourfourfive8 +slhmvmsixfrbggqdxfjcllbzn535two +twosdjxhpseven5eighth +6qdrmmvc9bvs +onedljtrk2pvgvqpfkqc2lgslhfd1 +ninesevenxfqd4ztxnb7fourseven +fpvbdpjkqfive2tsxb +fglmcrcd9xsnxsxgkzmmgtcjlxlfiveseven +gkgmm5onethree7jn +ztmg3onetwo4 +hhbgmpnrh3 +188btpjkpdsix3oneightkpl +xbqjpdst9762onethree +4tqcdrzgljs19g8oneseven +ninezs46eight +grkgdppchchpzfive31 +298three +2ghmxfjdjcfthreefive +9hrq3sevenonezxrvgxbr +n12kjninelvm +sixfourvgpctkk48seven +sixllxqmndkfcqvcdnssxjthreesixseven46 +nine7six +lkcmctcnbeight8364 +k2zqvznsrjjvtjtwo +zcxjvpgmllnlxxsonekrgsmqlntzsfxx4 +twocgzfcj6nskqj84 +rldlhnine5onefourvrstwo +lqfr92eightnsbgrpncdlheightpvktkd +vthreems422sevenninenine +zcmhzlnonerqtnl1zxdjtqqeightseven +8six3ps +blqhvpgt7 +6gdf +3jrl54xchxvgclqq +8twosixfournine6ckrbnzr1oneightpp +twonine5three9 +kmvmvrznj28eight4tlfourmqtmcgt +prpmhkpg5sixqqkhvjtsmdjlgsxgjnfour +5jfmzsprdmngm2nine +ltzvtgkc5nine1sldgncp +four6fivenine4 +hgsjtwo47qg15 +twoninesevennpmzshts4 +hjkcjjkdqxplmsjxdjphcb77eight6eightf +8six3four2twoeighttwo +tgrh83ninethree3seven +bb6nineseven +trpbxtzfour24skvqhc8 +rm4 +pqrtvrtfivefour52 +pdhtwo1q3 +fivefour4 +ninevvlfgvbzvdk7hkvsdjf8 +two3nlprsnkgfzxbhlfoureight5onepdqgtcjp +one4hdjrvcnlfgpckx +52six6nplcqfvxnf +fzqgdmzdjeight8four +two7zlk +fg16seven8476cvthhjoneightt +ldcmngfninetwo2eight +eightsix8 +twojlm2onetjn +3prnfrbng +276onebpks2 +fournineeight52 +3198hvd64 +sixthreejmrl2 +zsvmnnfsjbfourfour54sfnlghlv +5six4 +6dvrgdfncvd +two4sevenhhvxsljvqtj3 +dcmgr7five13 +cmrgqdlthreemvcc9six +fivekjsx8eight +vhlvninefourtwotwo4five +vffxj9 +pglbr7 +rghtnsixfkbnrthreesix8seven +3fivenine5x17 +3rdonet2ninexbslcnsevenflqxplkxbs +xbdgjfjttfhlrfldsmeightfour1tfjvcljc +sixrjp1 +9sevengnsj +dpmmrqksixeightsmnt58three +2six66ninemnj6qjtvqpzcj +sevenfzgg2six +eightnine9sevenmhvxtbjxnh33 +tscsvpdtjzsjmlfvrzceight8eighttwo6 +seven193ltgmzczzqqmrrgseven +fourtwovjhqfzlrnine1xmkqcs5fjrcxfssh +83nbqmsrbbfhnjsixvgcbbtmphg +3ccdbzjpkx7nrjnmfljgfour842 +threeseven8 +foureightpjlj9 +ctf5eightjnsvcrlfvz351 +4sixfivehqbs16tgqhf +fourninekbvbtrbkl2h8nvflxrlvjdtrhz9 +dgpvtwonbspfvtkqfgxsixonefour4nine +fournine15 +66tpr6frphqtfgcvpsjctqccbl +foursvfjslmkb3rmxseven +jtqsntfvpbthreejsqqgqnxq7766 +bjttrrvl9two +one73three4rffjxsm +fvmmheighttwokmcx7eightlzxcb +3kvkhkrzld7sixtwo +2three3mjqnpjznone2 +gfhvmznd8431two5three9 +62xdgeightqjgsfggzbrjcfsvmfourn +pdznineeightsevenhxb4 +fiveone3sjqvhh +4nineqzrh +lhp5sixseven +2blntmnfourmnn +kcnxhnppzbsstbtvdrzt55three +1gtrkltzfzsixs6 +85nsix3threethree +32three +six9fivefive4nineeightoneone +fivektmbvvlzl5 +pdhfcjfrtprpqtqdnvnchl5356 +one2sevensixsixmhfhsevenzvkrgxsmhd1 +snvhxpxsevenc4twofivefour +dqrvvlxrcrmnjkmjpgr8threeshzgnfbcsb92eight +nkpll5nflrcffourtwoeightthreehzjvvdhm +sntlr3rthreetwonzxzlvxxbbnsbkrl6 +eight26vhjjz4foureightwojk +five24414lbddfpxnqdxptlzl +dgqdninekmrs81n7x +pfgnp5sevenqpnckfkz8 +eighteightgpxhrhprmmfpcp6 +hqgxtkckqxvfcxskrhn9 +4five8 +sevensix5 +rpk88gfxxz384brvgtkcqjnine +ninexjk21onetwo1hzdhsm +41hbthnkbl7gssdksjddone5kqkvxzc +jjhmxrb56fd +4kxxtmqjpfivesixone4nffllnkj +8jlkmhmjjfour +281one +qeightwofkzzzkgcspgxp1threeqmjcksr64four +xnbv3 +4seven3ktgrjvdfive7five +dgroneightjmcrmplthdrncvld8one +4ninegkxpztlbzs3 +1onetwosklsjcmsjh +nine16 +8sixtwonine +3qhtzxzqfmh +twozgbcpzvsffthree4 +48fkbpfpkzhfpnvmctsjq9 +seven2two6zprbpmqdk1 +4hhztrv7sixfournine +3threemxlshrpv59clfrt +sevenmqmnine4eight +xg36mlvzsix3kbqttvhtpd +699fourqhbhsdhrflmbfdk +gzjhseven63251 +two8twonqplqkq +eightrbsgj21three +sdckkgcvmsjbvn5nine +624onesix +pjdnz7nctxzssf +kl5232rqkdrkd8five5 +three53fourthreesixpjm +6sxpnjnqn79nineoneoneeighttwonenf +five398nine +96srrjjvjkpkbmhzdxgpkzszxxbseven +812vjlglflnd +34six9five7threeftcqxtcxxz +4threelpcjptwo +fivefivebldxbxeightjzsixthreefqmgb8 +9cmrblfnd4 +nine53one +seven3one +tsqrmmlvqjqone43 +one5bm1ninefourthree +p882seven +c3eight +3eightsix +4sevenfqdrpdqbjpxdbjdsevenmsfxsmjdtcdhpd +cbeightxkttcgmsmone2nine88 +nb7jtsvpggtcrntrbpzjthrsix35 +5ninevtv3712 +five3two2fivezbvfcvlnkskccj2 +six8seventhree14 +1eightmkzbxone9nv46 +three4one +3njpjstjvzh9xjxnqr +threetwo9sml3 +6rmzg6 +seven91xbpnine8onefxktwo +ppmpn2oneone +qch5 +rjrkk2zqzndfb7chzmtdv +vgkqbtwosix48zrntbhpn +82oneeightmbzvzvjb3four +6hrxnlmsfsngpklbrlrsvcl4 +65sevenfivesixvjm +kkkhbdcnxfbfourfoursevenonesevenfour5 +68qkcfd4four2 +two94twofour +zzmz2jbl46kjnktxnvqrj +982 +ninezrj9six +snxrvhctcrvzvfivehldldnjttonerstc4 +bsftwonezfhnm5vlsjtnpnzj +onefiven57 +seven6vbkrk +5five9 +twoseven9 +hglskzhzs7fpmmjzvmx9six9 +1vsb +4lrhsh +gnln3ccc +four23 +threebxljqlxkssmvndjbltcvfc4 +fournine6eight2fourthree +4sevenqtsfccrrpdhseven +6sdzjdrfcxmdztrhpxbfshmrstq7fiverrcmtdfxmqphnpfxhkt +jsnbngsppbhgsixeight9xmhkvvqcdjzgplvztspone +rtbrqpgdcmmx9nnjjs8seventhree1 +93five21 +tss6eight +cpgvone9four +1eightwom +rgrsvtv48857 +fptwonesixfivenine2 +8xdbvf1zgfiveslb +ninenine3 +p637sevenqbbvbpmlgrk +723onethreedhhvgls +four7five91pjlpnbmlfzvhrfhvs7 +six547eighttwo7rg +vphlckdvqx3three +four12th +2kqzlthree8 +sevenbl22 +two68six4four7 +lmrbqzgrsm2sixnine +fivexspftvthreezvjtgfbknp9mzslnb3two2 +8twofive2 +9vbngfdjmp +1qzphhnlbqz76411km +sevenfivethreetdnpmxllmkgnvhdz7tvjv +threectnine1seven +9fone +9sxbxsix6zmqllpzftsftbdf9nine +xninehhxsbzzspctdbpfdscbjq687glqdsqtvqz +threemjrdnvqrk7bvvsgfjfbone17 +npntthqz4nine9fourbrdsqgnzlf5 +133xqjvmjmpqdkt4 +2dnvzgtnl5d9vvjlknxxqfourfive +mtntzxzvkmqr748 +foursix6sixfour2vmqzxtzdqbzgmbrggmgtnine +hphqmdsgmvtwo35qnmsqnqnhlkb +flsxtqfxhsevensixgtkdseven6qzvscqbztwo +sixgxbmgchcrksixfivedznxzkzpttsvtzqhkdzrhqnhtwo5 +69zpddjrnztqbr +1fourone2four1hfgsrvgtht +1rbr2gpfpdghtwo7ninedzx +4sixfour +9fivebcckvbdnkqhhhskb2 +fghbcczsmhnbm1ninexdcpzjknqvfive6 +5sevenjtmhs1one +8htpbfhgsdh55one2two +mmxsmst1fivefivesevenfivetwo4 +984six6eight96 +bhrrjtgdmj4two +seven8three +three3onefour8v +five9qbf8fzlvtsix +nkcmtl16four +gkdlzkfrnteighttworjjmtbrb451 +txpkjjztlkth221seven +frtrvninesixlftgsxtxvbdnjmxc7 +4mzdfjsxzvs9one6jrjv5 +96threecxhhdjkmjhsrgz +one8sixcrchbgpz +grjvxszd1s6 +qbxvjggkfrcfivempdck4 +7one32jzpxdgstwo3pspjhmg +gsvgpdhthreesixeighttwo5hkncndcmthree +xksmqqsvzthreebjzr1fiveseven8seventwo +mlgjjjhn44 +threefour12sixseven16 +one2ghggthree4 +ninefiveseven8tbldpbcmmvn +jxtxlqcc6twoh2 +1xlsjrcfourqvlx9one +twothreetwo5 +tmsqz1vrrj72 +lcxdvtsl3onesix +fxqbcnpjzeight8seven +scpqzdhss13seven7nlkxmkntk64 +fnlcc74 +five4lkxcvztwo1two +85nmsjmgvcv +sixbqsxnq4 +6fiveeightfiveseven +mbcxhgrjdtdtfpclfxzc1fnvlnz1five +9587sixptttpksnbnzzsrls +1jcqnzffpmrninesevenssxfndgkx +7zffzsjgzbgzzfvv2vnrrfvnclseven +mbghnmthjjfmcxzsixfive44 +hklcflkm7four3 +fddnsshjxf6twospgtkzzkfsix +sevenninesevenlkrhnzdzxfive6six +55bqeight +5nine6mfbeightsixone1 +rjlkpq77 +jqeightwofourtbcqvkvvqzcmrbbmzfiveseven59qmtz +ldb2jfqll +4nineftshkg77jtxggdt9four +nine2seven47seven487 +8lpctcvhvfivezqcrtrxrsevenqhhtxrdplfbqpr1mjfkcfrrfc +zmlhsn6tfiveseven +djfmdf6 +fhcthree5 +9sevenbftsixone +four11tprnmdmvczfourgpjx +eightfourninexdchgfblq7 +4c5sevendgtngqxzghpxpcs2 +xdqcfmhsz3ktf +eightkvhvqgqn88rrftxjzzsrfb +gznfkfbtbnthree1four +273kfrsjbpzbzseven +five9foureightvlpmphnp +1qtgttxninetwosqfffcsfgxdz68psbmvvpmt +nine9fivefcnpbnl6tmbsjkrr9three +szmthreeonesix2bqfqrxkljlseven +jvphjsqzlc2dbzchmronetwo +8sixthree2v9threesixqkqb +fourone3eight6fiveeightrgjmfive +9ppveight +two6vgkdlv73ninesix +44886488 +lsjxprxdz58eight32 +four95skp +2eight3three9jq7nkftgzn +cssgnvhvnnrlklmmxdfxhtvptwo6fmtmchspb +9five7xnx4hxvdlslgpfourfour +onetwo9six3cpsdjprgkjthcfmkkx +1threeeightqgxvvvgvs1lqrfivegfqqslmc +five7eightfivesix9one29 +59eighttwooneone +4s44549fiverhcbmpqgjm +nineffkpxf2 +seven8fqsvjnjzphsevenj +eightmpgfxkspplninekqzlplrmmn224twonezxf +mqqqctworfpjkkhninevgh7eightonezdmfrrvv +one31 +8nbcjdx3 +rdprrrcjjflkxszthreetworvfksix4 +one59three +2rhxjrb6kjdpxqbthree6xlzgvk +threexbsvqsseven7cxmggqrnsthree9 +gmqxghthreeone7fourvfivefoursix +5nine8 +khcnjsfourzxjkvp5zfhpcvv +three3xnbzpmjqsix5 +3ninehvdbz43 +47ssqq5fourfoursixcggslftbttlpb +2threemdtlrprfzc +2threethree +nine84fczsrqzd7six +fourmrbqh79 +gqdhhggdxfive6 +d99fphzhxghqt44seven +lldllhmzrskzzbzsixfour6two91seven +3xzjfsppg +7five6nzfpvcpm5 +one9mpggcblrpstzpvfffivelkrqvkvkkhtzseven +eightbr3ksix +4eighttwothree2bzfivebn +18twoseven +bdjbgtxdjx57seven +eightthree89two3vmsbxbskclh +lgnbbjxtmgvfsix5three +cgrsfsns653five7 +two1sevenkqllxjvqbfvfxnr +jptmclgmdzhndpkbcd9 +twosix62threeone2 +three5chntgfivegkbzfrvvxkb +5djqstgsrbhl8 +9v3 +8four9four89 +five2nineseven +h3cpsxzx3four2 +fivehpzczrl5zxkzkpxcvdkshsfqzxpjqqhdg5 +bdfftptqt8kmpbdgsncceightzmtfjphnxqbslplrqxv8 +two74tworvzjftxvqzpvx +bpjslrgkbonethreelfsxshjtpfour2kjxgzgv +rqktwopdlvjrrxlgvrfnnine3qonesix +fivefivec4sixgdldnine9 +eightz1zzqph +dgmcl5153qtgxlkzgtzseven8three +knkrvlxvjs6svsrj51fourhjbqzq +three96 +szxkfqthreethreenine1 +9gxtwofourzeight +fninel8 +ninevzddbcfhttwo1onesj +mdbg8qxvzfsgmh9eighthpqcrzklheightwofp +78lqjv3fourdthreethreeeightwonlq +fourkkrzcbphdseight8brqjsfsbfktwo +4tnvlcfjqsixql +zd7nbzhclh8 +plkrkone2 +mksjljks4xfslzzlp +nine22462seven2 +gbtwonine93 +vkvb6fiveltone2eight2 +cnxxhvlcj863sixsevenmckrblvvtbzqbc +nfldnvnxx2eightninexnsbseven +1six6 +nine83 +one5djxkzxrttqthree8jzqdfvthmtwooneone +gjdj1eight +3fivetwonzflsvgdmgtbz +threetwosixvbssrqxjfvffour3 +2ninefivernscgdfrgpsnvtchzfxmdhjfsfivefour +threegsmtcn12 +foursmbzsrhnnseven6twodnnjhbthree +62twortpndjsgfgmd +ktxsgdskqtlbnj5one1mxhztxgb2four +threefourfmfxrmnlhninersxz1eight +3jkqdvsevensixhbxfq +slmseven8sndphqlhjgbzhrdrfxzphfvs +6gfvsxprrmg7nzmjkvnm8 +34qgtjsnoneqbqrmkz9 +2sevendvqvdtjrjrhpfzkphpsixtwozkfg +72nineseven +nsgmfsfive8two +71sixhzsl9sixfnrjntxpv +onennncchq73eight3 +vsxbb13cpdpvhnmz2 +681 +mpgd2 +bzh72seven +fiveeight4589jknzbnjlrt57 +one3dm4 +91nine6mbspjn +bzmztdlkqslzbnghlsxtvfk2 +3two12vpl7dkkjjln4 +zdmgeight9kfvtpx7nine +7114nine655xxx +332 +six183fourfivelstnlsvgvx +zsxbg9tbpsnbvzhj6eight +nqqctrzlpggjrrrlzdfkjthree2 +fivecsvzxptmhk8 +d7hssmvk6one +kngdgssixeight1four3 +sevengptvbjtkbxsdgzdeight8twop +fourlmscbhkkfour89kflkf +7bxl6mcgzfxv +klkqmz29 +kmszrdfour2ppkkdlffivendgcfthree8 +kcvpt7 +sdjttwokhtzdksix6 +eight83four31nine4 +4eight4vxctcsgzf31qhjptxhfrjtl +dhhfmbhtst6ninehmb2 +1ninesevenkhfmgjjltgkrgxvm48cxtzzvhn +dczpdbfl45jcpmckczpssnqn2six7 +6tsmftwokdgltlkzqdqttflqhm +1qthkhrrjxvbkngldslmzp2 +2sevenr6zzcvkqgkn93 +1fivec1x2gbdkqvkqpsix7 +3znplrfxnrq +ninetwofiveseven44bsn +onefive9zqknglr8thzhx +sevenfourcts5lttdprpg8three9seven +seven9vfjqdfkg3 +5tjmtkhseven3five +crf14 +5fourxxn +r3fivejbvrzgnl +4nine5 +svhmflmpbkjjponemj2threefslgpxsrprjzvfxcrvp +91threeeightfour6bmqfmr +6krhfmtwothree2sixeight +pdpvrlqb36 +4sixsevenseventhreegjthree +threehgckkksz8eight3 +qqhtjq3lnvqkpjvrp42 +3three8four942 +mggbbhxd4eightvmmdvl +fourtqpgjkszglhthree752 +ninehsnqzkrzpfgdvlg5six +6two8xstlhvhkhdone +fivesix55eightqpjdxkpnine +ftwone4seventhreenine3two +sixfivetwoqplqntzlldbmkgzsix78 +onenlqnxcr4 +seven5spnronedhtxsdgtfgsgjl1jlhf +fivethreednbvgpbr7four5 +qchoneightpbgdzxjbshqf527four4 +51threetwo5sevenhnnpjvx +qdkcbnkjssixtwobkfzcnfkb84 +qsjgzbgpxq9 +7eight3six +8jvmxgnp6cqpsqtqgfive1nine +nineg11sj +3fourfour +pg6djcsdmdlgjtwo1 +bxcbznvnqbfjjbfonedgl3foureightjgsqbqhzhg +twofivetwosixv5fiveonenine +l8eight6gdmd +nine15bcseven2 +l4 +g5ldxkrk4fivevft +fourxmf35 +nine6xdhfmltwofnqkf +phbcjjmnmcvjgzfsixfour6eight5 +2ckvh +rzone3745 +keightwosixfour466 +one3lbkl7tssqxqrbbmxkh +6oneonezllhftdf4bfpxj +6eightpc +ninenine4nbfbqrtnvkl +sixqbbffgdsixtwofivesix8 +zfplftwosixsixnine9 +two4rncnine77nineczlfdrp +43jseven +7mntc +6z146fourtwo +seventhreethreevxmbzhmpktj6twohxzjnhp7 +tz6vrdbzgzhxcfd +seven6eighttgglxnhmknine +8eightseven41crvrxbonetmscnl +xbhtfgg5four86onesixthreejk +3dlblsjq +sevenmsrgcfmxmthreegzgxdqmkcgkjcbnx45pzlcjc +5nine69 +9cpjmdgf +4fourkgzmjnhplrlmeight +ninetwo6sixmdz +dcdbk71twothree56fourtbzkz +tcc3nineeightseven2flrlndb4 +sixcpztsj72zpdhmvfp4two +9hnine5 +two7kktkms +1sevennine +5zczmvxthreethreetwovvnfvvsjnv +9dhjcgnnsvh4five4 +bbv46hvj68eight7 +sdmntqgftc5blnhkktqmg1five +5ninefour +gmg6bzgrxhgtssthreenine1 +78twothree4mtbfthree +hclggrdf9 +jnbmj3seven4 +xdhcgkrkrtrfourcxmlzp1scxkxxzlsdjfccchzg +rpdphff9blkl22csthreex +stwone791seven +cdfkxhfqr4sdlcleightnine72tkftldjnq +tklpckfour7seven1qvxthlfourhtrdn2 +b4three4cninetwonebbv +nfourdzxjxcp7mnzkzdnmpqsixgn +jfcfncxone9kmdrbxfjtpvfp26 +6threeseven21ssblsvrbfsvzmbktkpztcsmpt7 +vgchkqhxrbjnlqnvpml77twonejcv +gxklhvtwo55five +sevenfivetwo1mtdfjgcp2sevenpj +qvrjceightcjlp5 +tbl4zxthxzpsix +rvzlvnhnineeight2cxxcslhpph +shrxnz9rtfrtrtr +1drmztt2zfournrmxfivejzksgzqfour +chtmdlppljlllhg8threendnhkn1qzxkrtnqgrtwo +two15eighttdlrpqjx45 +1kqd5 +3krsbnzthreetxpv +7ninefivesix67sixseven +sevenninesmjkdfssnl3two7 +pmjmkzdrvfour4nineseven +t1xnlcvlfninecbrzxc5 +nine3qnjcktfiveeightkhb +psqrone1nxcsrntkjg9 +6lgdfgxts9two9 +48six4 +threehvxfhzvxhs8three2two +onesrmxjlv43gtsjtdneight +5eight14fournineeightfour4 +3mljsmn7mrnvnc844 +5dmdvxxddhone9fiveone +twogscrq26xfppjzhthreervonefour +6ndcblbmdjpthreetwotwovpcsmffive +5gkqzhgvrcthreeseven +sixkhgqjqnineqhxl4 +z6ltpkcqxmd +fivetwo5rstcq9 +threetwo563 +4fourtvksk8onefive +294tv +7flzfzm22brfgxsqhhckzc5 +twoone9sixsixninethree7 +2glqfourseven1one +nine4five7418 +9xfivezxrr1xpjm896 +foursixtwoninevtzzgntnlg6oneightbxp +2eight1fiveeightfive +mzjxlhjmqp58six +one34 +8fivejdmljr +tsblxssixseven4djq +8drrmf32 +11twok9663 +hsoneight3sevennpsbbkdvsb46 +dtrnnhxcdmzzlssffhgvbxxrgbcz2fiveonesix +kkeightwo6975six +jcftbeight9 +fivefivephbpdtkqfm246 +5eight97nine +4sixfour4nppgsr36one3 +glxlmnvhjxsevensix1fourseven +sevensixjczjhjzbj8fnsnrsevenfive2seven +jjpngnpzglkbltbrv2tjmqrpb +4txvpps9kvjhgsqpcv6eight2jxk +onesix8qfvkckg145ndkfdcvznine +nkthree86b5fgzzfoneqn +eightgndhmrfouronexldvdvqnzxqjczfk1 diff --git a/2023/day01_trebuchet/tests/sample_input b/2023/day01_trebuchet/tests/sample_input new file mode 100644 index 0000000..d3804cc --- /dev/null +++ b/2023/day01_trebuchet/tests/sample_input @@ -0,0 +1,11 @@ +1abc2 +pqr3stu8vwx +a1b2c3d4e5f +treb7uchet +two1nine +eightwothree +abcone2threexyz +xtwone3four +4nineeightseven2 +zoneight234 +7pqrstsixteen