From f9bc6172e9998d495cbfff9dfe251fc287cbe7f8 Mon Sep 17 00:00:00 2001 From: Juris Date: Tue, 3 Dec 2024 18:23:47 +0200 Subject: [PATCH] 2024-03 Rust --- ReadMe.md | 1 + rust/Cargo.lock | 1 + rust/y2024/Cargo.toml | 3 +- rust/y2024/resources/03-test-00.txt | 1 + rust/y2024/resources/03-test-01.txt | 1 + rust/y2024/resources/03.txt | 6 ++ rust/y2024/src/bin/solution_2024_02.rs | 11 ++- rust/y2024/src/bin/solution_2024_03.rs | 96 ++++++++++++++++++++++++++ 8 files changed, 113 insertions(+), 7 deletions(-) create mode 100644 rust/y2024/resources/03-test-00.txt create mode 100644 rust/y2024/resources/03-test-01.txt create mode 100644 rust/y2024/resources/03.txt create mode 100644 rust/y2024/src/bin/solution_2024_03.rs diff --git a/ReadMe.md b/ReadMe.md index 5c67bb6f..eef06644 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -6,6 +6,7 @@ | Year-Day | Task | Scala | Rust | Others | |----------|:-------------------------------------------------------------------------------|:-----------------------------------------------------------------------:|:----------------------------------------------:|:----------------------------------------------------------------------:| +| 2024-03 | [Mull It Over](https://adventofcode.com/2024/day/3) | [Scala](scala2/src/main/scala/jurisk/adventofcode/y2024/Advent03.scala) | [Rust](rust/y2024/src/bin/solution_2024_03.rs) | | | 2024-02 | [Red-Nosed Reports](https://adventofcode.com/2024/day/2) | [Scala](scala2/src/main/scala/jurisk/adventofcode/y2024/Advent02.scala) | [Rust](rust/y2024/src/bin/solution_2024_02.rs) | | | 2024-01 | [Historian Hysteria](https://adventofcode.com/2024/day/1) | [Scala](scala2/src/main/scala/jurisk/adventofcode/y2024/Advent01.scala) | [Rust](rust/y2024/src/bin/solution_2024_01.rs) | | | 2023-01 | [Trebuchet?!](https://adventofcode.com/2023/day/1) | [Scala](scala2/src/main/scala/jurisk/adventofcode/y2023/Advent01.scala) | [Rust](rust/y2023/src/bin/solution_2023_01.rs) | | diff --git a/rust/Cargo.lock b/rust/Cargo.lock index bafdfe0a..49c25f82 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -119,6 +119,7 @@ version = "0.1.0" dependencies = [ "advent-of-code-common", "itertools", + "regex", ] [[package]] diff --git a/rust/y2024/Cargo.toml b/rust/y2024/Cargo.toml index 5d1292af..a8952a59 100644 --- a/rust/y2024/Cargo.toml +++ b/rust/y2024/Cargo.toml @@ -11,4 +11,5 @@ workspace = true [dependencies] advent-of-code-common = { path = "../common" } -itertools.workspace = true \ No newline at end of file +itertools.workspace = true +regex.workspace = true \ No newline at end of file diff --git a/rust/y2024/resources/03-test-00.txt b/rust/y2024/resources/03-test-00.txt new file mode 100644 index 00000000..2e1a90a5 --- /dev/null +++ b/rust/y2024/resources/03-test-00.txt @@ -0,0 +1 @@ +xmul(2,4)%&mul[3,7]!@^do_not_mul(5,5)+mul(32,64]then(mul(11,8)mul(8,5)) \ No newline at end of file diff --git a/rust/y2024/resources/03-test-01.txt b/rust/y2024/resources/03-test-01.txt new file mode 100644 index 00000000..b774ec98 --- /dev/null +++ b/rust/y2024/resources/03-test-01.txt @@ -0,0 +1 @@ +xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5)) \ No newline at end of file diff --git a/rust/y2024/resources/03.txt b/rust/y2024/resources/03.txt new file mode 100644 index 00000000..bdd4ae06 --- /dev/null +++ b/rust/y2024/resources/03.txt @@ -0,0 +1,6 @@ +}mul(620,236)where()*@}!&[mul(589,126)]&^]mul(260,42)when() when()$ ?{/^*mul(335,250)>,@!<{when()+-$don't()*'^?+>>/%:mul(422,738),mul(694,717);~;%<[why()>@-mul(417,219)?&who(474,989){select()-{#mul(366,638)mul(773,126)/*{mul(757,799)]when()mul(778,467)^mul(487,365)]*'{where(952,954){?who()who()when()mul(172,666)#?$,-mul(250,228)(]when()}mul(760,139)mul(892,161)!'@[%when()<(mul(775,872)+~#)//$select()mul(946,63)how()??select()?from(277,915)~'mul(637,565)~mul(881,294)who()what()}mul(995,866)?mul(952,57)who()mul(387,599)mul(46,724)who()[how()select()mul(992,19)'~mul(909,687)where()mul(953,804)from()/;where(474,270)from()}mul(907,410)&(&what()%{mul(192,898)who()-,mul(196,400)#--{%]how()mul(144,141)~@[when()!%:[mul(377,942)^*mul(89,46)who()<}when()?!'%mul(172,448){]@mul(351,18)~]&!$mul(490,127)/]] }}mul(851,465)when()*-why()what()))@+^<-select()do()%#+;%:mul(549,307)#mul(968,958)mul(125,903)what()who()$where()%who()how()mul(139,859)<&/+how()mul(339,100)@(:mul(306,909)?)--what()who()/)*mul(724,497)'how()from()mul(489,24)${/%/:how()>(mul(397,282)}?from()who()$/'mul(86,511)mul(463,903);(^@mul(302,904)-,who()what()from(892,368)where()-mul(707,359)/who()/';;++;mul(687,987)^:select()select():mul(915,123)<]!:'/[select()mul(809,835)why()when())* mul(139,828))why()who() ,mul(807,713)where()>:mul(350,287)where()-where()+:~{who() mul(437,102) %when()select(),mul(813,883)]when()>(from()don't()]where()@/:how())'#mul(337,905)*>>*!don't()>(+}:mul(488,283)<~>mul(703,476),what()@(} mul(487,921)from()select()why()mul(761,203)who()how()mul(32,930)[how()do())/}where()mul(778,306))mul(593,810)mul(629,319)';$mul(122,109){ ^^-mul(720,536)?!+mul(519,541)$'/@who()!~where()$mul(461,98) +$[mul(647,228)^why()how()>why()^{mul:from()%who()/$%}%mul(810,82)]^+[mul(377,189)){&select()/(select()$$mul(343,443)who():-don't()}how()'how()]:select()why(){mul(963,385)/^why()who()^mul(131,676)mul(113,570)~';*mul(853,789)${>%{:](*$mul(736,139)??%^where()what()~]mul(447,113)don't()(^;select(921,651)<[#why()mul(912,658)/{&from()where()-what()why()who()mul(587,480)]!how()]from()mul(389,102)'@mul(200,564)>#/,#;mul(24,400){):,!+;];mul(595,551)!who()how()]$select()mul(969,989)/?%mul(899,264)@what(507,249)&mul]~*mul(354,715)>,mul(914,563)>'};~!select()don't()&{mul(50,819)select()@>:+ when(501,666)!mul(970,506)who()mul? }~[when()%mul(358,287)!mul(291,276):#what()::mul(946,666)'??;+'/>'mul(31,79)~#*}#-}/where(532,773)mul(919,720)where()@^@]&#how(){^;mul(561,111)^&^? select()[why(803,159)(*mul(716,153)};{]how()[#+',mul(883?:from()why()what()?%]!why(393,804)~mul(231,805)how()when()why()@select()mul(552,136)$;[!where(454,987)who()what()mul(555,591)mulfrom()?from()^select()mul(467,281)mul(702,811)}}{;don't()[mul(543,7)from(608,658)&^?mul(144,343)from()who()-?&don't()mul(860,384)where(611,825)%&+,^{where()@select()%}%what()}do()/who())}where(740,982)#-why():,mul(523,265)+select()[):]when():mul(200,994)}when(436,935)<%;)&!mul(156,920)when()mul(822,281)~>mul(3,591)when()*select()$mul(993,139)where()(!$why():%+from()mul(167,958),;select(579,937)from()?{?from(644,816)mul(675,905)why()mul(787,123)%mul(982,476)~mul(613,499)#;)'mulhow(280,254)mul(393,812)#mul(54,319)(;what()%/@(mul(23,133)mul(401,60)who()$mul(615,621)]@what()$mul(77,795)from()+{!+!;mul(935,990)select()+!>mul(843,623)what()]$,/#)/mul(374,785)@ /don't()how()%select() -how()#who()*^mul(113,822)from()%what()/from()mul(305,505)what())<&~from()mul(841,37)when()#(select()& /mul(879,852)]from()/mul(485,947)?where(276,795)mul(197,752)?;mul(926,356) mul(701,87)who(66,480))~who(514,148)@!mul(533,170)%!+mul(983,219)!&$]@ @ *mul(409,813)/)^>@{/why()?mul(411,364@$$:mul(367,910)??what()+~ > -mul(475,252)from()]/])%select()~mul(726,104)when()&&'/mul(463,124)where()how()(!how()[(~[%-&mul(487,73)]]/mul(818,611)~where()&what(){$'mul(669,330)}(mul(14,255)'(why()don't()%$mul(748,857)+)<:don't()<]-'[mul(205,925),/ select(),mul(611,78))%where()+why()what()])$^mul(922,30where(), :do(),why(),what()$when(){when()%%mul(788,912){&!*what()what()#from(550,915)mul(414,182)!how()who() select():~^where()mul(361,64);,when()$?why()<(why()mul[}when()/&?mul(404,92)}from()!(where()why()mul(162,794)mul(156,595)&&what()/#~'<@;mul(619,461)}who();what()$%who()>'mul(84,893)*how()!>* ;:[~mul(904,58)when()>~mul(397,193)&/<]{<(;^how()mul(835,565)select()][?mul(179,388)from()*mul(590,514^~-[mul(141,691)[!how()from()do()select()mul(662,493)who()mul(852,288)what(289,959)from()&%){mul(388,80)<;)mul(129?$>:;![mul(838,473)%'-~mul(521,965)!mul(301,798){when()/ '&how()from()>mul(412,607)~~;~>who(759,414)mul(505,681)]why()&>mul(11,690):]@&where()where()!}how(){don't()^what())mul(896,34)(]when()+]%from(676,897)mul(352,130)}select():(how(962,114)$-why()how()}mul(346,43)where()select()}why()don't()< mul(253,930),how()+? mul(980,251)from():where()}[,mul(824~where(837,118)-select()/mul(389,969)& )!from()from()where() mul(477,689)#select()!^how()mul(270,320)$@&,-from()mul(505,37)what()!who()+?,don't()from(644,533)@&mul(946,497)why()where()+select()%$@mul(985,698) :[@/do()mul(634,683)from()[<&mul(471,76),)from()(mul(765,236)where()[}mul(103,839))')where()+],(mul(415,82)?]how()[/mul(545,345);~(mul(717,102)from()@>mul(873,432~[[!{mul(407,39)>{~%where()*mul(66,512)mul(408,714]who()when()don't()why()@@'{/:mul(823,809)what():]mul(501,427)mul(667,732)from()^from()@;mul(84,235)?}%from() : #mul(788,725)mul(140%>}[where():)when()mul(693,122)'(?+]!!mul(644,111)!+*-~where()select()+*mul(366,69)*]when()&^({)--mul(931,970)%~from())]{<@@mul(983,532)]&^]+who()!&$mul(558,679)(@who()where();^mul(140,309)how()^don't()'who()>('*mul(83,388)mul(421,988)@::what()mul(385,22),)%:}who())/mul(754,201)~{when()mul(606,345)-[?]mul(762'from()from()mul(502,876)select()@,<{@]mul(595,401)**select()$mul(669,55)~~+(,#!/usr/bin/perl&(mul(621,865)[select() -+select()how())mul(852,28<>-what()'mul(808,223) +>#@,mul(49,51)+'+ {what()mul(459,620)mul(676,939)mul(785,481)[%,how()->#when()mul(941,842)?when()who()mul(626;don't() ##mul(369,396)why()why()mul(18,620)mul(660,703)~$don't()from(891,902)mul(624,59!!+mul(881,448):;mul(103,918),>}why(295,520)?mul(975,493)~where()/mul(500,773);&/what()$);%>mul(574,896){when()& -{why()!mul(767,832)%^^?mul(176,339)^$?? {?>mul]+/who()<}~why()select()when()mul(585,105)mul(326,283) @select()mul(881,190)@(,[@$[-!:mul(978]how()mul(244,274)(why()mul(107,435)~'@}how()who(),mul(514,868)select()how():;/mul(371,314)how(683,764)#%~;where()}why(),mul(630,194)+,-(how()mul(556,839)!@]:how(904,253)/+)mul(949,374)'>>~@what(702,586)how()mul(93,979)^(who()})${mul(500,125) mul(554,209))[where():/where()mul(489,287)#when(),&',mul(857mul(735,380)*!<&{^mul(908,597)?]what()who()mul(830,216)~'mul(131,112)mul(214,624);>[ why(727,278)from()(*mul(277,717,{how()mul(491,389)<'mul(308,352)*#mul(473,610)(#;#mul(96,433)-what()how(893,680)where()]*>mul(15,226)*}do() &/;[&<]mul(570,554)(:mul(162,708)where():+{^when()who(195,632)from(512,233)(mul(735,501);mul(47,211)}^$how()~do()#+@from()mul(403,568)~who())what()from(519,688)mul(479,938)why()')?['mul(912(&~(don't()%why()%why()]>mul(901,522)mul(236,396)-,who()what()where()%#:when(738,307)mul(638,827)%! what()%^when()-don't():mul(69,715);^who()select()~who()+what()mul(483,819))^/mul(692,711)<>?,,who()'mul,mul(45,587)why()}'select()/[how()-what() mul(623,228)-?'>mul(738,552)%>!/when()?[why() mul(364,106)'when()^who(382,157)who()&>mul(417,796))where()(mul(792,820)[from()(*/*where()%mul(504,794)mul(342,18)@'how()mul(929,33)how()}mul(336,88)'+;where()}mul(114,443)why();when()[@!'when()mul(66,853)]select();(&$&why() *mul(255,88)#*when()^mul(118,466)when()/!')%from()mul(396,750)$when():)-select()~mul(711,817)who()~ ,]select()**how()mul(531,995)from()mul(816,42)mul(801,817)'?:;'~mul(830,904)%[/why()who()-mul(296,626)/^~*where()+(+from()mul(311,114)mul(266,973)~^)$--,:mul(372,293)!+,what()mul(376,438)$/]}~,@>{mul(324,122)mul(207,152)'mul(568,638)!>[,>+/>>mul(514,968)why()why(8,771)who()~ #>/?mul(190,876)!mul(70,561)who()how()>mul(265[/where() from()$why()#^mul(101,15);$^from()-!mul(570,448)/?(]who()/how()$-{mul(621,492)@?don't()who()}>*#mul(659,911))how()what():)<(do()from()-)%mul(134,954)select()mul(572,608)why()-)$+mul(392,779) +;who()~mul(268,986)#/from()],}mul(632,679) when()select() -& select()~mul(707,831),^~*from()how(),[mul(210,504)why()select()@)who()mul(188,858)$#;select()mul(828,586)&#where()@mul(48,75)$#+!])what()$mul(899,170)#$ from()mul(786{?#{~%@:mul(96,375)[mul(958,29)what()&where(203,927)>*#)select()-*mul(519,379)why()]mul(750,986)%+;#when()[$<[mul(144,674)*^who()mul(523,649)#-mul(48,556)!@~)/@->mul(170,217)mul(628,552)how()};mul(433,161)when()-,/%'what(891,571)mul(797,743)from()</^-mul(412,25)when()<)??}:*mul(409,767)how()!<}[)select()!,,mul(978,831)why(5,443);[{-mul?from()>@where()>mul(596,740){#mul(853,990)+:when()#/{mul(418,161)[:why()$/}mul(728,815)*mul(448,232)#+why()/~select()mul(798,812)what():(mul(305,330)where()<>do()# mul(485,702)$@what())mul(33,730)^mul(250,103)>[/}from()who())}why()/mul(580,640)~mul(39,871)/)@how():where()what())~mul(66,708)select()where())!)when()+:'mul(886,576)from()(when()]mul(664,110)^why()($ from()+(@mul(301~select()}:mul(198,8)^![mul(558,124)mul(271,988);<<[//-&mul(79,763)+ 'mul(389,9)(select();-;when()mul(678,773)+,(}{-when()#@mul(522,262)]don't()what()[<%where(412,191)*:(mul(522,99)#>+*where()'mulfrom()*}who()how())who()&when()mul(809,282)(&how()?mul(389,999)#what())$why() select()mul(646,75)@mul(864,690)}mul(951,939)from()%where()mul(957,667)? >/]mul(22,31)?,mul+mul(970,622)^^{ *-^%mul(166,954)when(){#from(178,855)]mul(697,375)<:*@why()-&why()mul(745,382)$>how()@^%why();who()what()mul(501,986)why(782,397)[?( mul(491,604),(mul/,@*##]++where()<}mul(678,467);-+how()/do()/)?$what()mul(483,452,+[~mul(179,979)+}($>(#!*)mul(143,707){mul(732,344)mul(743,974)#mul(580,824)why()what()!when()when()&who())how()mul(10,399)}*)when()&~what(375,175)#mul(540,576)select(156,142)<*(&);%*from();~mul(377,827)what()@^mul(2,573)what(891,305)+(~mul(192,965)#mul(411,367),+mul(181,566)why()how()select()?]~^)-mul(571,574),who()&[ @select()mul(721,269); ->why()#mul(641,715)why()mul(38,177) *]<$why(65,872)!mul(251,717)<{mul(490,192)mul(334,149)mul(921,662)(+~mul(767,331)](^$>?'do())&(@#mul(873,278)!when()how()$what()mul#^how(511,214)]]mul(726,818) +(~from()mul(961,791)$)^>]+~mul(320,807)mulfrom()^+<;>,mul(425,375)where()/^$from()what()}?mul(310,951)when()why(38,420){(?from(84,74)[&select()mul(18]when();[when()from()how()select();@]mul(434,652)%>select()]-?mul(984,804)*mul(363,658)*/ &from()?how();^how()mul(909,440)+!*)&<*@{where()mul(237when()'&mul(624,801)? [!mul(473,118)mul(421,299)when()select()mul(358,981)mul(179,656)@#{:from()^$]$)do();how()+$where()%#from()(&!)^mul(446,656)-:$from()why()}@;when()*mul(831,757):who()! %%? do()mul(554,594)@when()who()how()>'>#mul(992,883)from()[(how()what()'mul(684,266)from()where()$?{'mul(656,521how()-);}~mul(413,681)^how(){!*{-mul(605,813/&who()/mul(208,330)&select()%[~how()[mul[@;+mul(291,832)[mul(954,916)-<, }(mul(360,461)??+?'select()select()mul(176,724)--:%mul(529,706)<'who(807,145)( '^~:mul(394,403)>mul(461,505)/])#+'-mul(555,534)who()what()^ ]*mul(972,671)+ *who(){mul(7,361),}}when()/[mul(519,583)?*who()+do()@where()where()* how(),#how()mul(907,286)>/@why(929,601)'&,@mul(174,628)<^from()mul(400,722)-/~&mul(705,103)&from() (~}mul(821,931)select()$^+what()'^do()/ mul(741,976)who();@,how()mul(11,473)/who(97,948)<:when():!;'mul(486,596)~%why() mul(972,412)&;mul(915,634)),<~>*[^%mul(810,448)+-mul(696,812))-{{mul(141,61)where(806,736)>!;mul(969,802))how()why()?[:mul(269,857)when()select()who()>#@:what() where()mul(722,901)+'from()]mul(284,470)select()when()$why(){~why()!what()don't(),why();<(select()mul(17,245)][?/when()&;mul(582,931)select(604,965){+do()]$select()mul(388,976)' :#mul(368,451)+mul(191,133)$'mul(121,338)#:where()who()#$/mul(477,95)(mul(868,121)?where()/^';,*:mul(241,456)(mul(565,994)&mul(435,842)<,~/+{mul(866,963)'+;when()where()[mul(649,460) when()(!mul(306,571)who()when()(select()mul(946,26)&)~/}mul(681,34)!from()%#'what()$$mul(71,890)^:select()/where()mul(974,246)mul(198,364))what()mul(256,64)from(650,475),!-+%*+/where(126,215)mul(267,232)where()@$-*^ mul(357,369)select()(&{:&^mul(488,801)select())?don't()]#+{}*#?;mul(584,742)&>]where()?where()'mul(939,130)mul(802,6)(what()+what(567,791)*&-#!(mul(738,680)where()^{^):&%%mul(203,350)]{;mul(14,735){from(527,639)/-+mul(234,797)!mul(416,25) ,>]from()&from()];mul(495,316),where()~!)%*who()mul(666,581)?^[!*what()mul(386,330)who()~$what()- \ No newline at end of file diff --git a/rust/y2024/src/bin/solution_2024_02.rs b/rust/y2024/src/bin/solution_2024_02.rs index 0fb017a9..966e8856 100644 --- a/rust/y2024/src/bin/solution_2024_02.rs +++ b/rust/y2024/src/bin/solution_2024_02.rs @@ -30,12 +30,11 @@ fn valid_diffs_1(row: &[N], range: &RangeInclusive) -> bool { #[allow(dead_code)] fn valid_diffs_2_straightforward(row: &[N], range: &RangeInclusive) -> bool { valid_diffs_1(row, range) - || (0 .. row.len()) - .any(|idx| { - let mut row = row.to_vec(); - row.remove(idx); - valid_diffs_1(row.as_slice(), range) - }) + || (0 .. row.len()).any(|idx| { + let mut row = row.to_vec(); + row.remove(idx); + valid_diffs_1(row.as_slice(), range) + }) } fn valid_diffs_2_dp(row: &[N], range: &RangeInclusive) -> bool { diff --git a/rust/y2024/src/bin/solution_2024_03.rs b/rust/y2024/src/bin/solution_2024_03.rs new file mode 100644 index 00000000..523af593 --- /dev/null +++ b/rust/y2024/src/bin/solution_2024_03.rs @@ -0,0 +1,96 @@ +const DATA: &str = include_str!("../../resources/03.txt"); + +type R = usize; +type Data = &'static str; + +use regex::Regex; + +const MUL: &str = r"mul\((\d+),(\d+)\)"; +const DO: &str = r"do()"; +const DONT: &str = r"don't()"; + +fn to_regex(s: &str) -> String { + s.replace('(', r"\(").replace(')', r"\)") +} + +fn solve(data: &Data, regex: &str) -> Result { + let regex = Regex::new(regex).map_err(|err| format!("Error compiling regex: {err}"))?; + + let mul = Regex::new(MUL).map_err(|err| format!("Error compiling regex: {err}"))?; + + let mut active = true; + let mut result = 0; + + for s in regex.find_iter(data).map(|m| m.as_str()) { + if s == DO { + active = true; + } else if s == DONT { + active = false; + } else if let Some(captures) = mul.captures(s) { + if active { + let c_1 = captures.get(1).ok_or(format!("Invalid capture: {s}"))?; + let a = c_1 + .as_str() + .parse::() + .map_err(|err| format!("Failed to parse: {err}"))?; + let c_2 = captures.get(2).ok_or(format!("Invalid capture: {s}"))?; + let b = c_2 + .as_str() + .parse::() + .map_err(|err| format!("Failed to parse: {err}"))?; + result += a * b; + } + } else { + return Err(format!("Invalid operation: {s}")); + } + } + + Ok(result) +} + +fn solve_1(data: &Data) -> Result { + solve(data, MUL) +} + +fn solve_2(data: &Data) -> Result { + let regex = [MUL.to_string(), to_regex(DO), to_regex(DONT)].join("|"); + solve(data, regex.as_str()) +} + +fn main() -> Result<(), String> { + let result_1 = solve_1(&DATA)?; + println!("Part 1: {result_1}"); + + let result_2 = solve_2(&DATA)?; + println!("Part 2: {result_2}"); + + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + + const TEST_DATA_0: &str = include_str!("../../resources/03-test-00.txt"); + const TEST_DATA_1: &str = include_str!("../../resources/03-test-01.txt"); + + #[test] + fn test_solve_1_test() { + assert_eq!(solve_1(&TEST_DATA_0), Ok(2 * 4 + 5 * 5 + 11 * 8 + 8 * 5)); + } + + #[test] + fn test_solve_1_real() { + assert_eq!(solve_1(&DATA), Ok(187_825_547)); + } + + #[test] + fn test_solve_2_test() { + assert_eq!(solve_2(&TEST_DATA_1), Ok(2 * 4 + 8 * 5)); + } + + #[test] + fn test_solve_2_real() { + assert_eq!(solve_2(&DATA), Ok(85_508_223)); + } +}