diff options
author | Santo Cariotti <santo@dcariotti.me> | 2024-02-09 11:42:04 +0100 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2024-02-09 11:42:04 +0100 |
commit | db2686c798378738020a0951a521358586e21aa0 (patch) | |
tree | 8d585ceb9bdc302ae10a2458cc343be40d60acb7 /2023/rust | |
parent | 67dff579e91c13ef40ecb17d14497d145861c5e7 (diff) |
Add day2 in OCaml
Diffstat (limited to '2023/rust')
56 files changed, 9097 insertions, 0 deletions
diff --git a/2023/rust/Cargo.toml b/2023/rust/Cargo.toml new file mode 100644 index 0000000..7f6cc11 --- /dev/null +++ b/2023/rust/Cargo.toml @@ -0,0 +1,2 @@ +[workspace] +members = ["day1", "day2", "day3", "day4", "day5", "day6", "day7", "day7_2", "day8", "day9", "day11", "day13", "day15"] diff --git a/2023/rust/day1/Cargo.toml b/2023/rust/day1/Cargo.toml new file mode 100644 index 0000000..a3c4e52 --- /dev/null +++ b/2023/rust/day1/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day1" +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/rust/day1/example.txt b/2023/rust/day1/example.txt new file mode 100644 index 0000000..7bbc69a --- /dev/null +++ b/2023/rust/day1/example.txt @@ -0,0 +1,4 @@ +1abc2 +pqr3stu8vwx +a1b2c3d4e5f +treb7uchet diff --git a/2023/rust/day1/example2.txt b/2023/rust/day1/example2.txt new file mode 100644 index 0000000..41aa89c --- /dev/null +++ b/2023/rust/day1/example2.txt @@ -0,0 +1,7 @@ +two1nine +eightwothree +abcone2threexyz +xtwone3four +4nineeightseven2 +zoneight234 +7pqrstsixteen diff --git a/2023/rust/day1/input.txt b/2023/rust/day1/input.txt new file mode 100644 index 0000000..f2984df --- /dev/null +++ b/2023/rust/day1/input.txt @@ -0,0 +1,1001 @@ +eightqrssm9httwogqshfxninepnfrppfzhsc +one111jxlmc7tvklrmhdpsix +bptwone4sixzzppg +ninezfzseveneight5kjrjvtfjqt5nineone +58kk +5b32 +1dtwo +six7two7sixtwo78 +mvhsixpptztjh13sixthree2 +six1bqqvrxndt +fourmk5grmqone944nbvtj +twofiveqxfivezpkvfvxt5eightjhnpl +fpfqp7three7 +scmlf76ninegjzjkj97two +fivetkhfnnx22 +sevenxvbcbsvxr7eighttwo +1hvhqqmrs1bgttshthg6 +4bvnccbdh4onefztdrpq62vvbnvpxxvgrngnfjgfk +653spgrvd +sixctlhkjmmxh2fourfivenine37 +229mjp3txmqsxxqdbnnnbrtrcctgzseven +jfourdbpcjc39bhglgnine +bvnltxdmsp7twoxzpdjdvkxeight4twothree +jlvcdrkhzh8seven3 +418oneeight +53flcrlvqdeight84frmdcsixchcbc +114sixone1eight2 +xrbtzbklqsl11 +bhfhszrhzgrhsfd2threeseventwosevenoneseven +four9one +5p +twovhjpdxmcxshnhv5vs +qkkqeightcxcltnn7one9pmhlmvsxnine +4cbptmvp1 +84xgm +bzsmqhkrdtdmhhjgrjsdfour1ninetwo61 +onetwoeightgflhlgksevennine7two6 +mbjhkhfour6 +8cvqk6eightonethree1 +qhbllbnlkr3rcsmjvztgd +18eight4 +hhc6onegvkgkqs5mvsone +66bnfj +one99xvrhninefive +eight96nxcjjddmseightxvgsixfiverrzpvmgnl +rpgpczdsxpjgql39 +855dnthhxld6eight +four29twosspz1 +sixfiveqvrbcdr9fourlrkpkmxphlsbone +341 +mhqjjg9six9nine +7pvjctsgvsix64 +75twotwothreegcvssgbvhpzcnbgteight +7keight8eight +52threerhfmklssxcptmnlr4hqc4 +xndfqvgxn3five +974lknineseven +rlnsix3 +771m1 +xvtjhq7six64threeeightgspmxgv +4sbqdxbmmzj6fiveone +onesvvch4rvhmvncnk +mkzsftp69six6 +fiveptnn7 +94lsgsjxrrghxxsr4 +1grnvgpeightjthqmrfnszpfhfninefive9mbtf +qtsdfour2 +5mfhmskpcvqbxjzzxt4lq3sevenkv +rbhjk1cdzjhtzkcbtvmfm +nine4eightpmrptkb +bfiveeight1lxzkzvbtkkgxxs38 +mxcgbjqvhd1sevensevenrgp7two +fourxrdzzmjfmtr62one +sevenppqtlhvtwo7phlrbssxb +dhbnjmxg3bsgbhmlfiveseventwo +twoonemrbftgtzeightqjmjctmq55 +ggk2lt586dfzqbjsvj1one +jtgpzjjtwo86seventwo +37nine4onebqvsnmvg277 +hmpnzmqsfour6 +xzfhgzllmcbc56vpbpbbjffmgr3jrc +5lclone +hjbvkdtmrgvpfive9sevenfive1nlzqlkfrg +htwonetgxvjdkrvjsfjjbfmcthseven29 +six89bdlssd +3eight6one +vtbsix2twolzrhfr1 +vhdcvtj5 +167nsnmgxhtvn54fivedcbgrhm +4three1five82four +15eightonethreesixthree +dvhtsccljt51 +pbnfrxblk3sevenxjcmcvhlgrghpbgdnpl8xsr3fiveoneightq +242three8 +2fivehgqfxgl8kpdknxhmk5bmmsbz +fivejvjeight6fsqgtpvcb +1threelgkbhlhhlmrbvxqqgf +klmqfgfg1gnine253psn8 +47eight +eight83mvdtsqppjhgjnsvngfive +7mcmzvsv6seven +56seven98three4three +pfnbthreegthreefknjm4five +2nqgrdcshfpjfpqdrvnq1twoccpmxpxvv +xtwo7threemxbtpsvjkgrfivethree2 +9pkdfourfour1zjvczkhpbj +1three2 +pkkbphkgqfivellrnvnkdxpql3 +ppc62 +one73ptfxsbbpqqgctdjhzjsjc91 +nine7threefourvvk +six59542xcxqcbnrvzfbshcxxddz2 +ftsfj2ninesix1hdjsrpkonelklfpltv +ninehmxgkqbmhvtlvdmdtvpeighttqfour1three +frbnineeight4168ksmjstpqvzhnn +rgnrntwohvqhgxxfkonefour4mfdr5ftgtjjv +3ninejbszdvdgznfourxpcxspqxnthlngkncvnineccq +threemjglxtp5cqmtwotwo2seventwonerkl +eightsevensevenlmbjzprggthree1eight +57nineninezdcf +cqoneighteightjnrfkplvninefivemck18mnhszhkv4 +tbvdcsjsvmxtshv3fourseven4kmxvvfour9 +bxcsix19six8dnqsbx +7five81ncchkdk +four4ck7rtjmjpccpeightone +fivetwo6nine1tdczktmfninelrbnnine +onetwo9twoeight5sevensix +cvvtbmninebneightsix1dnnfkgmnm +h7three3 +tpnzsdm9sixtg5sixqvcqsq3 +1sevenzmbcpgtfrjvq +r8757 +fournineseven6fourfour +798dpbrkfourtwoxdrgqkrkmfeight7 +threebvqqjcldjx4nine5 +3hbl +twodndcfddkvfivermvkrfzsnqthree5 +mhdcvsixmnqlvmvxmxfour3ct +25dpfsrbcllhtwothree2pthreezfhjx +dcfggnine1onetwoone +vtbmbpgffive2hdmzjzqqqc4one +zg11 +txrknhvhbv183 +dlvscqszz82nvtpb7tktvtgjbml +twofour5sevensmqfjrjcndmvcvqdfsrsix +446sixeight6rbrltdzf +132ncq1 +4ninezdfzgvzf4four7qkzstcq +7rx5xntgxfpmvsevenzmzmbjlc3fivefive +threeseven7tshthree +gnbqhninecjnhlpcfivenine18 +gjntwonenllmzgqsvq36lc45fourdrtzlctr +3tqgbfrk +zldl3zxpfbpveight +2ninetgppcvqrq +7one1sixeighttxcnhltwooneeight +bsm3hslqcr8xslndqnnvfpzvprlkt +khvptwo7kkbznndpqsevensevenvlr +sevenscneight8one4qnkc +2v +2threerjnineonev +68qhknonebtxvmqh +3btb +kcxbqzbjqt3twofourfxdlprsxkzlmflbveight +9bmdcninecjdv7 +ceightwoninelkbbfxgsv9fb5n +ztwo2 +7four9cpkclqxtrmpdgzxgtwo +8dghrmgprdjeight8knnb852one +2three36eightfournone2 +6ztwofkzlhvjdrxtsmlbgczf +knine6ninebpmzjbkg9tttkhtgcklbfive +sevenv3 +411one4483 +88jvjggxqfour3zrbvbxjzmthree +fivelqcnqfvgp18t +fivejceightqlsdrmrnbzfbjskstzrllxrdlcxpjkvf1 +832 +sixfive77rhkjdhvbpdfjxpkmfdq66qqtfpfs +fv6svkbnsgtpznblnvkvk5 +sixsevenfoursixeight486 +gsbfrjpngshpmlxf2 +gbmmmvdhffbbcq3 +5fivehxx28 +snjxttwo1zd5sixklfl +szsvdzsix3nine32nine +onervkhknmnsix3four363 +1btphrrvxdeightonekdhv8 +gkphmq73lfhflk66xpfive2 +611four3gnjsdkvksjdxfiveeight +klbvb9zk4eightninetwo +mreight59sevengqbhnspvhqcj2six +hnvgkmljlpthsgjrzmsevensix6fcvtxddbnx5 +ckfvkblhvv6gbsnlsevenktblt29three +eightfoursevendnsghkfsg8fivextnnine +5hrdqmfjq +twojcvkkjklzmfive2fourxqgdsdgzrjltwo7 +onetwonvxnxnntxcthree3 +threentwonine6 +sprfmxlqvb9jnbzltskxppqzdscrvhpfvjjcqhxcf +sixhfour95 +41fourqhpjbztknqnfpxvzc +two23sevenfgmmnszone113 +one41seven57 +oneninebqqklhk6gmdzddbhgzqcmxxfnmrvr +4mkpgv87eightckzjjfm +vhgdmvncxn88ldbt7464 +gcczfprplf7 +6eightninesxthreefive99 +two69fivecjxjhgjmgvttl9 +mztbzjmgxnpkfrqnrbgkgfourjjfjtone8eight +63mggldkcprlz +6sevenfourfive +1zvmrdnpzcsqqmxscn +five5tkgb8rrztmcfivebknjd +7pscpfive +eight9sixgfvhvlcnineeight +seven99fourtwojvxfrqmrdlthree +sppcgnjzeight93j +fivek7seventhree +twornbhtrlnznpctrxhqtngzdtnvfb2 +sevenfivefour63five38nlrxfcjpm +qvtdcspc4zxmmhpklhcdlznqfg46lct5one +1bnndtnsfjdsevenfivetwo3k85 +8five9six +3ltcc7trmmhbbbpjfive +cmbchhhczmqlp3 +nctz78twodljcqvplcqg +nine4sevenpnbbztpvkbgztb +zseven9eight +fourktzscmnrvddnnzsqfnfctzpdvtwo9 +nrtbgdjpm2ldcfdm5jjhx9 +jq9two68kjttwo67 +lnneightfourzqz6lgvxnthreeseven7 +fiveglp85 +ninefouronesix7k1three +3five5sevendhtmjhbh2 +rbjhnmmgsvmtk8four +vtrvvjsixhnctwocvskgzt3two3 +kxfive5threezgtd2 +2fivemcnngtzxsgbxmvbl +eightlrlztkvhfivefour5 +2twojcq7qrrbddmpsb +3twosixthreebqtoneone2 +nine9six3vlmpqbgjjqdftldpq +tgrglqfxxc2onetwo76oneonex +one48one +fivesgsnrzsms6one +fiveseven1tzhxdknkseven4 +3sprtonefivelxg47 +twotwoseven3ninenqdvxgm +nskjpvvqeightnine93fivecngkjcd3 +ltfxscllxk9pjznpnmhfmrzmqbq +4nineeight6four7 +fjtpj763 +four6six73htbstbbpztwofj +oneonetwo2five43three +five8bgcjnlzcgqpfkn +11mcn +9twovhkltdpkqzc65six +8fkprfkg9xfjxspqpshlfkqpnrt +4sblrf7745 +lblxmbzfour6187tggqllj +dhdmlx71mbbxtvhszhsvcm +six1qbqglfsssx +164tsthbb2 +8nineldrtltqfivebqnrthrm +sevenlsjbsklhxxfiveclbldxxtrdllxzthree6eight +18gnkrxfmnineone +six4threetwoeightgcn +vmknclnmnphb2czdbjmcone +eightq67 +eighthnzslhbblr85eight3 +3457kdzhnppqz5four8two +crcskvmhthree41 +8pccnsbv8ln3 +4eightonevd +pdz9threenine +3sg5gkrncz +6dxnslkl3xqlnm965twonexxn +9nlhmmkzsdbpdctd7ninec +62eightnine7nine3lrd +qbprlzczreight7threegqnrshrhc +3qlmr +three1twojgptkzgxmf +twosvdsfourone8 +5sixfourzvjtkpk +six418 +five523fivecbs +nineninesevenztfggvfkgkzfcm2 +qnsix5dnv7three +three5twofour +hlmtnzsmlnjxdtwo6 +9sixnglrctg +onecrgfq5hdldpc +nhzctlx94eight +19djvld +tzp8zzv8six1 +1nsnine5sixhqxfk +33sixtwojrdvksrfsnltglggxdhbsxf +bbvtpxptrnvjqzl3rldseventhree6 +2lcntfphb2lgpjbdeight +fivetwo1jjgkt9kltwo1nc +7xnmrscpfkthreejqbhlrtf4sixrbfrone +3threetqfkv1twofive +95ninejlftlxrs1nxxfsqz +hrsrszgrcl9seven8eightksdnhqsq7eight +5436ninefour +one5five +prcmxone8lhkblvr714three +92btgsllktgf7fivejhgsg2eight5 +fourmm61nine558nine +bxjx2 +one6onetwotjxthreefour8 +threedkpnpfvgt1one3nine1 +bxfour3two2sb4twondmfdpsz +11sevennrpxftwooneeightmx6 +9mqxcrjxnp7hdjgqktxm +2rnjlg7mbxstzbdh +qmsixhckzone1 +qzsnq6sixtwosixtwohhgbsrqgnine3 +foureight7scksqtkmnfiveseven765 +15oneckvshqd +41tzlxsfivebsckffdps +threefivefournine7 +5fiveonefour8lhqmltwoeighttwo +four5six +mhnrspfourmflmvkc52cjkvxheightsevendtddjdcnb +vxrrlfnlqf1twoeightninesixonetwo +8xonetwo2 +rveightwo79three +onebjlr9sixldqrbtwo4 +f1lhrbsix +mbbkv7ffpk +8twofourmxqvkqfcjfoureightplgpmrtxm3 +2rtrxjzqeighteightqtmsfnpdscpgqvxd7 +nineqggljvzvxltwozsvsfournine9 +ninexpmnnvqsfhnprqrqlcgfive9mtnflvttwoqlgphhb +11kbpmv1 +htspdnh1xhbbh3lzcjjx1 +five6fivefive5six +sxtbktj7 +ncvkgvgbeightfour89ttbrjthree +xcgxzxbfnkxdqn73eight +5nine4fivesixtwotwo1 +ffgzdfhn6 +fourzvtfcczlxhnnx5three +threednfntx4eightwovql +sixtwoveightnine7twonineseven +seveneightcclmgknrgninemnjsrsqsevenfftmlqkch7 +pvqnltjs2hghkrphnine3scngkjfcsn +62vdnbzrcrjsndqqr2 +5cxhscqpgdzbrnnq1m9b +gnkclhmbjfourfivemmxpqx2qlxvsix +sevenxcp4fourdlqgpxcl +8eighttwoone +bjslbfrspcnffnine9rvnjjrvcsix2 +six7tfive6hkllf56six +km3 +sixtjt2threefour2vqqcxj84 +9vflltwo4five +nineprprrcjt3eightmxfour +4twoninehvsbszqr +dtdmkcsd41eightfourxppqzkjb +xmdmghzdp9sevennine94 +2bbjsdlxoneeight +ninefivetwonine8 +68four +ninepdjpfmzxthree3dkxgttvncbr +52threesevenninefour6lfrlrsgzk +ghkczjt86bdk3czvhcone +cdjsd6jhnnnhzbzllqdjgpgnninevmcvbcxxltsix +1mxfsrninegfmgvnine14hbfnshgbprone +39four8 +bxnnjqkninetwotwo58txgvrbxvq +k4bftq68seven4nineseven +seven97fivekxjnseven4fourfour +drgttpqpsevenvrkxdlmvtctsc72seven +eight298 +2zsqmjskp +six5bgdkhzqt +fournlknxg35vqdqmnln6f +565rqtzdpqhlldxgnine7oneeight +3jfthree7vlkpfour1 +fourgngnqtgd675vgrrjf +25nrfive +kmlbnrm5dtvqndldh +vgbzkpnltxrp5tpvb +5mbzzk3nine7cqkngz1mm +sevenfive952 +4pxk8four +seven87fourlzlnineone +zxllsctgqmsevensix72 +9ggkqvsrhftwobndlt +8sixsfzlfpztjtwofourqvnptkgllxcf +5dvsjvtm +29dsvjrl3pvgjqncbgcxc +9mhvrb8fbtppbhm2s +eightninel5 +jltnzpcdr8one5szgf3nine88 +8xzgs4chdkfour +three7vgnbtqvhthree8sixq +2onesix354jj58 +175rpdmxfeightwos +gmngst7hpfvgmtfrqbb +9hd2lsxprdvtqxcv55 +four13cjqkvgxvbseven8 +1kqfrqsevenqgjttjrspd +7seveneight6zfmdbzdj2 +9sixpfjbnthreedgbhblmr +7hdqqqkone6htzthree +hmnxstkbzlhqjpdn3three2 +dpbjgmnn1 +ninefivecznsbttpcvkthreeoneeight1zqtxb +6hlxdlpgrl7six +fourdhczrzd9mmmdthcngsmdqkq9fivetwofkb +7fbcrzcxjvxtqbfive168 +sevenhlrkxgrggkqgd12 +vzmpvhqvkpdfmthreetwo9 +21cqxtjtwoljsixxbf3 +bzzxkxtl3rhsrpnnzseven +threevhdqqvtwothreenine48frqsfhgsgptbbn +foureighteight3pgbcftjdbbsmcqjcrmt21 +twovpfbsd42five +6foureightwofh +5185cbhgvkvpfzk1 +1one3two5 +seven3mdjks6kctnnchjgpnineeight +sixfivecjfkx5 +sccbfqfive28bhconexmztpcftrbz +qfzhgl1nine5four59nbxhclpk +mjrvgdz3nine6gkvznv83 +mfxqslvpzeight2 +ztwoneeightknnjh4nine +onefivesevenfsmmhkbcplj6seven +2lfgzblvdflgxnsqfxtksbb +blmvzczjs61fourmtds +5two2 +jqppjfxfour2 +3five2bcrn653 +86five6bseven +rzztlcbvteight135 +1sjngcngjrsht3ninehninefive +81sixkrhvrhxqhn65 +dkrgmnlcbjdjxblbfnp5 +three85xrckdqtjqphjsjqflmt +5fmptvmz19fourmbzrttnxnk +dptwonefbqhrxtljddtkhh6four23 +xfvgkfive69 +cbtfrbpxphj2sevenmmzrpccnine +5twotwoseven +fivetwoeightonefive954 +zxccrkvgdqtklbnhtdtdsghcseventwo6 +three6vqmtchfdjxveightone +onenine39twodksvrdsxflthree +threesbpseven5zqtwobtmpgqjg1 +326dgjmzzfivehkhsjrseven +dgthreeeightthreefbhbltbdjnineseven3klvx +4xkcqeighttwo2 +eightonerhlnchp17 +2jcmzbczstsrmbpzxpftkmznzckhv7three +7foursixbrcc6twosixgnf +4lqxfourtvxhqtlhlx7xcfxhmqzbone +2sevenz6sixtwo +nine1pv +95jzlkxn +onerzfnqhmtjpqff93lrctjgqhseveneight +5eightrdjnine3 +threetwo6fourrcrq9dfmbsznshkfqmpvcb +five3hpjznhbtjonecvfgfsk9n9 +2gkbqpqn31 +sevenfivefgcvtpsxjprfh8nine +lvfxml6992 +5threexmjjgkv8985zzjqdbtwo +eight3bkqdnbmrtb5 +7sevenoneznpx +9hjg4eightrcsvdkbmldjclfqfm +9four2one4 +koneightonecdfcrjkqtcsevennlvr8hbrc +seven3lthbv8 +ninexzznsix5nine +ninentdd6qvkclninefivenine +four11pgmxz7pnjfiveeight +threeninefourpmtmlgllftnvxzn5twonine +four46eight9sevenfive3three +blztvfkqggcbshlzxppxgrxsr4three3 +one9pvlnv +8l37 +brjvlvjrhbfourxshh1vlclvrz2 +5flqnkntnxkzhcftmzb9rlfzxlg +sixfourseven77onekone +6xfmdgjfeight4qzrncxdpmb4four +four28 +seven74zrtpftdldc7fqlseven5 +6gxjzskpkfvmmd +zkoneight99jrrmgsfpsixfiveone +9jbbdtdxjsm8szxblgjppx4tpnvqvtlrj +rsrlrcb32ngsixfourfivenine +6seven9one7threegrfqpncjthree +onebjvpzzqhvlhg1pxkvmgqvxsrglb8fourptbjs +1fch +njhs4p86n22 +two1one6four1six +fourphxjkjtwo8eight +3svqrzd1fourcmlcknhvninetddpbcmbtgqpcjms +vkndzm684sixjlgkcvz4 +25five +pkzt2fivetwo2zffkjqrhgfive4jpsj +sevenmpfcthreembjgbfpkdzqlr4 +49four1mpldzb3 +hdzddkxf1cxftflb73 +zrmhdlhk2v7 +25zcd +11eighteight5qcqzpvvk +38nine43 +8lstwo +12sixnfbrgbhdpn1three3 +8eightcd82rzkzlvthqnvhjvgfour +24jcbjplcnqbcrxs25 +3fivebfkgpkglfchbmbfps +pgmvbnhskgzdmz2sixeightcjq5 +cdpmrlj1one +6hxqoneightjjv +34gxbjzrtg5 +pvddskbslqnrfngmcjgsdthree3 +6nkjjlknp9 +hflkjhgjmeightc5n1 +dmkeight1223 +five9three8 +eight7mqfsjplfprrfpkzctgtdvrmxphm +phbs2fck4sixfourqvqbr +2bnvktn +sfvkgzone83 +2threetqnthdnq32ninetwo9 +sixhdkvdcmp5three23j +8615four +twosix54vrrbvzszk9 +53671 +threevklcphgkjsnine4eight4fmtffknglthree +sixninethreeh4dj +oneone1pmdthreesrfsssbkt8 +7foureighteight3 +srpvkzrqfive378 +6twodnnrvfjrjv +4kpxlslqfbktwo +bvzpgrc9twotqsvdztwoseven8 +xkjdltjgzbjhxkjvtwo6 +five27sixsevensixtwo9nine +jk468qgkr +fourtwo89 +fourthreethreedtnzbmlfhmgjr5nineseven7 +44seven +two3psfive122jps +sevensevenghzmpdvrffive9nine3eight +497ftdf9five +gklfive6rnvpnvvkqheight +2hvdfiveprrdqspsix6 +5m8nine +bnctbninexsixonesix8five8 +xkqqlmfmrveightsix4nine93nine +6k +3foursevensix6cksix5six +7twoone +three73lfddzhd1fkxmjdzsix7twonex +sthjlrjrhd741prcsqh3rmllvjmtvgfour +4dvffpjkn +tpbttcslvz7twoneq +fourtwoninej5snfxnqzthree +n7cmsfsqd +eightssrzkxj5 +239 +three8five7xxthreebqrbx +zrlchvsevenfournine4ktvskhjgh3h +7fourfdjsnhdbgqjvnltzj6three +mrjsndmzkz7rszqnbhxt3fvsix1 +neight85eightggtnxtgljsevenfivekz +6vknslh4onetwonrlzm +37zlrksix1skbsdkpjf6twonejtx +three2843five6 +txgdvvdg959 +zfjrs2zvtbqctcdqgrpfmqsjbdone5 +six9eightninetwo72sxxnzvblthree +2jdpslvbnpqjpglczkmzggkfkdkx8hgpxtcz +threefive5eight5mnbllfpcsp29vlnbrntt +gfxndggbs16twozpcsckzqcj3sthsgq6 +gcjjvqkvzdbcsnmqqhnzzqvj4 +flcpl3btfmbbpnkjvnlmcthreetwo1eightwops +bdmeight67tvkfh2 +three645qcv1zbbheight +3ninethvbxxppxgqcqrclptxczgrcneighttwofivebrqxl +25eight41 +six22 +pcp5 +dtmgxkdqsixdhmsbj821 +eightprbxpj5oneightcxj +qvrn3jbhlxjsdq +oneclvhjhr5 +9nkmqpjjxxhvtpndls9 +215ltwo75 +threeeight16nine2mzhxnine +ktfxkmdvzprhkpdhvxhzsc68 +fivesix8five +4z1eighttwofive +73twotwo4 +gmjlpchdzfthreesix1vljxdqsrlxmmqs2 +twofxh3 +threeqzcglsdcfm4four +three1eight8 +seven7dtqhr7 +4xbjlxlptj8hzfjnz +37jzgxbjcggone +81fouronenine489four +eight3fiveoneseven135 +stzts59zqdvrdcqrc +sixnklrjbeightn2six +bqdtntwonine1eightttzlzvzfn54xmj +sjk6 +qmrbnhczj624394sevenseven +kkjdcjhfh93eight +3ptmslnconethree +cfjgdffcgvldsnvkbjqrxhxcl7fjlxdrlrrthreeseventwo +187oneseven6 +fiveprnppdg2tjfbfmlvhpmkggjc +9onetwo4 +fivesvjxkzzm59vtsevenhzxtkggdhr8hvjtjvv +kpxkbbxseveneight89sevenrbhqqpk +drhkpssxqvvnssq59four4 +oneeight17 +gteightwoone268four +eight7fourbjnlzfiveczlzppnxck +jdqpxsevenone2eight +pvh5six4hddrhfzpxfmtwo +5six56nineone2 +v96k9115three +phqhhthree5ksqhfjlbfg +gpsskbfhhllnxfvjspkjndtlfour5 +three5zqbnsrdthree8 +b4mkfpkltlfdfive4mdqxjnb8tdpnpf3 +qfivejjggrpktxponetrjzceightseven9xhdf +34cpfxc +jl9 +84four +fourthree9three48 +7threevgvtj2five4pbq +7kjkjc +seventfsvjbsh5smmdd3frthree +smgmzqzn5 +gmtd5kvglxsixeight8twothvkprlbc5 +twofour62 +nine5k +hbxnpb4four4h +6sixgnmnjv4fourone1 +9eightseventhree +9jpvccsvhqpnhsl8 +nvcnninefour9 +v237ppqbhb +78six +four165oneightxcm +9pjcsfbrghnineqzth4smx +46fpfptrq1mbqmbnktqeight +stbxvlcqz5krd1threethreeonefour +48six5seven +6bmltlrvrgpcfhjhmfiveqzfxptjtwo4zvsqqxgbrdlzsfmtzdd +jeightwo47three86twoseven +njxzmthree8fivevvchvjqdvn3foursix +83t34 +oneznzqptpxbrtqxstkmz3kmtstds +1sixsfrnqd +brs7fgkbhntv5s5 +twohs7m +gfljsixseventmgdvhqthree3threefive +f1twonekdh +oneone735eightnine +pfjvfspsseven9qgfrnmckxzsix94 +7nineninelrcqqcgcnmmqf3 +1vjdhjtrfourfive2nine278 +oneone7 +threelcxlqrzhdghp4zkjfivepjj +hcshggsmzpdmkvtdvdgqtfxlt8 +1vdjtvpfhkhfive1 +2eightstnj6three +93threeeightntjblpljbv +onermlmtncmj6pxkmhmqchzvzf +4eightfnjzfzhvg +hmjvmtwovnl8nine84 +threets6 +six9twofivexgz63 +692five +fkgblptntvhvmlv8threethreenine +seven86 +nine1n7 +97two +4threebqqnmvmqleightthreefiveszppmbhxrxvpxz +6bxbmbdkxqmzeightlrqdqvrkr5threethree +llqcbpeight1vpjninekpdvzg +6qgtdqvtvkcbcskfqtq +6threegrrmxxxqkflltr3 +312 +hqmhsxpmkxtwosix3 +rpzqtmzgdfdxcgsix1six63lxjpbxfq8 +zzkbtkghmmqfourrtsixxxfjnvvccmpsd5six +13two4bxdcqzrkqtxm1mplvqxcfhcjsc +threesixqj8two +9seventhree +dtnine5twoseven6zxd +lsqbvgjnznineone7lxtvmkmflrfcqdjmjtwo +zpkjlfp6onevxtdtdzmcqjprfive +gxplqqsz412sevenninejs1 +psvjsvvnrv796 +69tfxkbkchvlhkjbrmone +fivehnrvtb6 +eightzdlqrbzxteightptlgmcmvtwothreergcddqxf2twonepxh +343sevenxsffneightdvft +fivednmrpmvv8fiveninesevenzbggk +seventwot3hpfrzbhxlhfivetwo7zvmpmq +xnsxz8fivezhzdcbzsvp +sfzch8twoned +5rstpx +12six +gqznine5gpg +6zrmsp825seven +2493twothree +9fivemksdnmgbvx +6dvdpdpkmqpxvfive28six +dzvnrdksixonetwoonetr4 +7fncndxbqj6onetwosixsixthree +7cnprcdgk2three2dvtccqnskvzfsevenxdrnqf +cxfcdvbsjqjbnxddlggjfourtnfzvtgx4twoddkkpdd +pxjgqrmdg5mpcgcdmfeight825jxxqcnfive +1tkhgtzzfrbdvnbft +hgxfive14ddcfhshfd4 +onenzlhvtdgkjmjgldmddhngdv9onebkt +foureight8rzxkktk9eighteight1 +478nshqhnhjrmlqbmp +ddjzzxgj75zktccgqrltfivethree +eightmcnmt5jnmnqhqdfive +rcdxshk1seven5 +rdcmbznk79 +2gtbskjxpmmvdclgmfjrc48one +8mqgnfive7chknsixrfourseven +4hgdxjgbn1sixseven7twosixseven +mkjslkltjd59 +fourfoursixfkjrcfsfivenrtzv4eight +five8threeseven4 +81821tcmfourddhmzvzfive +onesix943fivejld +5eighteight3cmvvpqmdq72vrvb +two86 +nqjrpqvgqr7rjjjxglqzrmt +5kqjjvzxt +6fourvstjrlnvone3ndphzphkrnsqmkmsthreep +six8four7 +two1dntwo +eightgmcgrnptrcvztbdp4three +xxbpnnztr5eightpnqeight +three9pfpnjx6rkphpjeight3five +sevendzstsjl3krspscb1 +fsevenfqtxxhjzvnineninesixeight8 +kznjhnxbnk7qbxjrztltv +rkeightwo6zfpvrfgqr7qxbkkg43lrjqtzjrprqttxmbrzg +mcfive77vgzxonehglbj +9319 +4mzds +sevensixthree5sixdvzxkndhvjfive +9mjhfkeight88v +seven5zhdthbmrkdpdxfcp8njtqvpnjj14 +8ninetwo +95tnjldjqcrzdxlm3 +fourgffour8 +nine821qbv6five +jbtfg83two +twozcpjrcnplnz5bdtgpdctb87lzlvqhtrjj +tr4 +5foureightfourfcs +1cqjts1jgzkfm +66threetwo +jsdpkfnineeightzpjdmrvxkbhdntj9 +pgcqrsix6mqrr8threeqxgkftbmzninevndn +kmvqsqhbrcnbqqgninet6 +bxtstqzpqfzqnhjfb8htszvgqhpnggvqt +ninecpqpffivehg8 +kxmstxkffourqmx41 +scfourlkfbrjvbtwo5 +qr88fivenine1lfvksgrtqseven +four6foursix +twoqmnxrjql5fourpdlstnnsfkdjgt9 +4zsvbsjqv97bpxvncr +xhqlhsbqjhvdqqonesevenfive3qvrtbkhhlfbzsj9 +sixeight4six5szgzcjhpj1 +7vpjq9hjtrjgone +f92eight +eighteightnc8134 +22onespjpxlttsqsix8eighthxdfvsdx +5ninefourgrrmxsxjfxk +threeninepmvsv763xlxjp +oneone7lzzhjqqrg +9fourtqqmhrpmkxhrvlnjvvhsevenseven +threethreetvjpnoneseven8 +two46onetwoqbvntlxbrftpjf9 +8one5nine1three8 +three69sgdkstpqbqdz +q8rzcl +onepjmchxtlqnmrcrvm6 +61fivegjjsevenqgdkq +49fxhdzfntmk6tb8dpdkknzsb +bbseven1xvqmlrhx +2j +seventwozjqszlhzxlpgphnkz2foursixfour +1sixhgvhrbonetwom +fournine8gvmrpgdxvcbdspzdcqt87bdzvxbf5 +3sevennine2fzpt +threedcdlq9kcjhtmtz +86five +tpfqhqs3977 +8four1cgmm12shfl58 +xlkrrkpkqjtslblqfnxp7two16jzpmpkrfvdzh +243 +three9hkgnmrh6lqrsx5 +fivexsczpmltrmcgrvfc58 +mxngrsh2sevensixthreelgrmg +ljqmflvone76 +ksponeightthree2ninenine +tdsdmjznr5nine7fourtwojgjsdfsevenone +eightfive1fourseven3gsqhtv +1xfdmqtmgkmjkthree +rztwonelztpgkxzzcbn1eightttssdpone71 +zthhsgvmhqsgvdponetwo9p +293rmjjjpmjchjnbdcssfrneightvdzrkbhdln +7nfkdntfourthreefzrfxmxgqone5 +tkgrnhbflp7zltmbdoneeightwoh +7bspgfklffgsix4 +eighthcmlrpbhjjmvbjrleightgd94 +sixbgfjzgzbxsb4qsixthreehbbn +ninerhzjpjdfnsevenonenine8 +38kqzjxqmmm +jngngvc412 +4twosponesixdpj15five +41four2oneonekr2 +cpsixjnlhkthree353seven +bknflgv1sixfivefive5 +3qkhnsjqkcjmlg7gl4jthreethree +dhlngstrvbxjjll2979kjsttsfgjkc +4kkq7rqlxcldqqtwo +jfh74 +lkfpcdghgq8gpgldrsnzkzzzzskrvcvsjthree +57fivefive3cxqj2 +ztwone7vcd37122 +4qrrhhlxgpr4 +twokzfjg2sevenlnvlpzxknznpsc1 +4jjbcdbfm8six6four +5eightninesixvzvf98two +8flntwomkktkpvsone78sixone +sevenzltjhkptjfjbrppm85eight +fivemfrmnqptthreepninepd5 +6one9 +vkqxgzmbm2b4pjqjddsbjnjcqqvm9 +5443nfkv +leightwo5 +8fiveeightonetwovgvhzgzfjh16eightwohlk +fivexnbhkzjfg1 +chkxvgrgb1sqxsnhngnrtqsnqgjkd +96twoone5553dv +36pfltskrbcmlmnspn +4jbbrh95249 +xfzspqssdfourhnmtzfive2pfzczh +onexzbzhddkqgfr2 +sevenninerrlveight5nine3 +eight7qvgkbk238fiveeight +sevenseveneightgtxtxkjsgdgklzzxxc3two8 +tvfjhvtclm75skqdxsskqhrjkbg +45 +sevenfive82 +425zkhjhmk +onexdchhtxmhsevenbczrslrppneightonenbnhfmbsvdcnzjx1 +zfkscdbmtwoeightrksdmgx4 +lnseightnine9eight +fourhmbhlcpht53ngkbzjmfivesixg +threestrhbj9sixggczcg +9twoskgrps8 +3four6xdqczgtzlzf +ldfn2 +qlzjsnbzfourfdq476 +tpkczdh5hdbxvvmmt3sixsix +tdpxzld5 +lnveightwohdkgcvvrjs38 +zz8eightstvmhvrh7hftdhkrjcneight1 +9kdbcpqtx15 +rbqgdbvrstgninefive4bqq2six +nine3psmkzkgnjbndrcninesevenzvcr6 +eight4jfrqcbqfninedxmdtjgqgtrg6four5 +3mmnineninenjjpmfivetwo +cv4znxcjthreeqqtdqmzxfknnp +8pjkm +ptwonethreegrgvseven7 +onethree1bgjsix5sevengpts +96xlmmthreeeightcbdnrstvpncmr +rtc94tcninefive +onespqnnptpdbrgqsqrldstl1 +qkeightwotwocjcngknkztwo7 +gzjhzlf4fdglcrzckbrlkmg +3eighttwopninefour +2seven1c +17nine447qkmfour2 +six6xfgqddnfpsc +mkbgbkvzdpzxfmrhdcjklxfoureightzzpn3eight +95ninevhctbgznbzz871sixoneightr +31onekmseveneight2four +mlxqgmvj2six6 +2sixgvsbmrhtwofour +eight221three99two3 +88xrrbjdlzrfour8plv +xdglmrpxbz5xpjxzpmvrgsixthreeseven7threebtqfkqp +lbd2onethree +seventwoseven7threesixbpld +1pstwofour8eight3dsdfrseven +gnvzm19htsbvcsfmlrmbgtstzmm3twoqzffkrrq +94nvrbbj +one71rsfbpnnbkrklmxqfive +4six1 +eight48chsrmsix +vqxrnmsix98hlzdgvd3sevenninekng +12threehscqzvzcbgfive6three2zhtthr +6sixkzrnv +5gmnhhzkfmp +four35seven7onenvdsevenftnpbcj +6zxrhcxxkppkn2 +dgshxchmhgtgjk281seven +lbdsmfvdsfzlp6dfpgd3 +three2dpsdhfld95eightwoht +jbktdklsqkgnhnfmseven1lhdsbjksixtwo +3fdqfour +5jpljkkpmdsix +qfeightwo9threethree +hpqdx4911tzfcxlrtccqf9one +q79zspgmjpdzs63 +344zk5xbthreezgbffcb +nlzmjfqxmneightxqjdnjvr21 +8cxtrkpvzj21xfgbdgcvgrztwo +three18444 +sntrptktwo2one1five +qxjrgfcnpcjtnfjljqnq1onehzfcqlnine +kflgzv58dbzbjjdvclgtseven +twofive4eightwozz +eightfive365 +7nqnksvphhnine88 +t8eight +bjd6five +khbrbtsx5jqxmbsqtf5nine3sevenskhfg6 +seventlkmfhqkgxkbhqr6ncjztnfive +152one +three5cbpqkzb4eightseventgmqzflsfksix +seven32threegfddgtf +two5twofivexzkkvcqs3 +tvvdgrnqlmkfour1zrcznqkhseveneight1q +92threesix89 +3zbdlttpbh7fivepgxmrvbzlnfgmbkzknndfqk5 +threefnhxtdbl1jtxeightwol +5vgthldgfmgdjphvcgh53dshmdkc +3nineeightwokh +57eighttddbcdsjdss +tkcgn86xfgbmzt7rksvnchnrh +five3dn5 +three2eighteight15nine +49bn1zvbm57 +351six6xfzfjvpz +5one5zchddj4dkksn +xfhtwonesevenfivethreepqzmrzrrfourthree5 +ninetzmcgp47four +sevenbcfbpnrvkkscrjtpctdtb69bvvnvlgsmjltlvs +6threev +ninerlsbznvfn9 +fourbm2 +sdxd22 +n7 +7sixcjdsxfourfmvzrbvlnine5 +threeqtbhgznine7one +ftmkmxkd9fvvlg353rp51 +9zjhmpnjv5jvndz +58three59nineonesix +rmjvhrjjmkqsn6gqthreeonefivemxqhrzvffone +xsslv7gpgkbzdmr434four +pnzxp4nbtsjqctkvqncxzxzj +eightseven52five4ninekntfjrdt +4sixldsmv +pknxkqgdpnc7fivedbvhkn +qkpjhjlxone4sixpfkvhlmxmd3 +four3ninerkrcvgcmbb2qm +fivenine6six1eight +69sixnine +bvjx5lg5vgrqq +21ninegnhdkcxhzkcfdksvsmdthree +zjrnmhclxhrkjpffhxkthnvj83jnshbqvx +bzfphcg9fourthreegkchdvrgsx +2ninebvgdcfxtktqjxjqvxfgjdqfhv5threegqtsfhtfxg +6rqskvckjzq2qzrnbxjmlthreeeight6hrs +sixthree6lxcrsevenseven69twonegs +2dcvcqcbpshsixone3 +drkdbmv4zbjbznsqtj +eightbqfhnmvqsoneninezbrzcqkz4ftv +1eightcrcjcbdthreebscfpvznqfrj6 + diff --git a/2023/rust/day1/input2.txt b/2023/rust/day1/input2.txt new file mode 100644 index 0000000..a82beef --- /dev/null +++ b/2023/rust/day1/input2.txt @@ -0,0 +1,1000 @@ +eightqrssm9httwogqshfxninepnfrppfzhsc +one111jxlmc7tvklrmhdpsix +bptwone4sixzzppg +ninezfzseveneight5kjrjvtfjqt5nineone +58kk +5b32 +1dtwo +six7two7sixtwo78 +mvhsixpptztjh13sixthree2 +six1bqqvrxndt +fourmk5grmqone944nbvtj +twofiveqxfivezpkvfvxt5eightjhnpl +fpfqp7three7 +scmlf76ninegjzjkj97two +fivetkhfnnx22 +sevenxvbcbsvxr7eighttwo +1hvhqqmrs1bgttshthg6 +4bvnccbdh4onefztdrpq62vvbnvpxxvgrngnfjgfk +653spgrvd +sixctlhkjmmxh2fourfivenine37 +229mjp3txmqsxxqdbnnnbrtrcctgzseven +jfourdbpcjc39bhglgnine +bvnltxdmsp7twoxzpdjdvkxeight4twothree +jlvcdrkhzh8seven3 +418oneeight +53flcrlvqdeight84frmdcsixchcbc +114sixone1eight2 +xrbtzbklqsl11 +bhfhszrhzgrhsfd2threeseventwosevenoneseven +four9one +5p +twovhjpdxmcxshnhv5vs +qkkqeightcxcltnn7one9pmhlmvsxnine +4cbptmvp1 +84xgm +bzsmqhkrdtdmhhjgrjsdfour1ninetwo61 +onetwoeightgflhlgksevennine7two6 +mbjhkhfour6 +8cvqk6eightonethree1 +qhbllbnlkr3rcsmjvztgd +18eight4 +hhc6onegvkgkqs5mvsone +66bnfj +one99xvrhninefive +eight96nxcjjddmseightxvgsixfiverrzpvmgnl +rpgpczdsxpjgql39 +855dnthhxld6eight +four29twosspz1 +sixfiveqvrbcdr9fourlrkpkmxphlsbone +341 +mhqjjg9six9nine +7pvjctsgvsix64 +75twotwothreegcvssgbvhpzcnbgteight +7keight8eight +52threerhfmklssxcptmnlr4hqc4 +xndfqvgxn3five +974lknineseven +rlnsix3 +771m1 +xvtjhq7six64threeeightgspmxgv +4sbqdxbmmzj6fiveone +onesvvch4rvhmvncnk +mkzsftp69six6 +fiveptnn7 +94lsgsjxrrghxxsr4 +1grnvgpeightjthqmrfnszpfhfninefive9mbtf +qtsdfour2 +5mfhmskpcvqbxjzzxt4lq3sevenkv +rbhjk1cdzjhtzkcbtvmfm +nine4eightpmrptkb +bfiveeight1lxzkzvbtkkgxxs38 +mxcgbjqvhd1sevensevenrgp7two +fourxrdzzmjfmtr62one +sevenppqtlhvtwo7phlrbssxb +dhbnjmxg3bsgbhmlfiveseventwo +twoonemrbftgtzeightqjmjctmq55 +ggk2lt586dfzqbjsvj1one +jtgpzjjtwo86seventwo +37nine4onebqvsnmvg277 +hmpnzmqsfour6 +xzfhgzllmcbc56vpbpbbjffmgr3jrc +5lclone +hjbvkdtmrgvpfive9sevenfive1nlzqlkfrg +htwonetgxvjdkrvjsfjjbfmcthseven29 +six89bdlssd +3eight6one +vtbsix2twolzrhfr1 +vhdcvtj5 +167nsnmgxhtvn54fivedcbgrhm +4three1five82four +15eightonethreesixthree +dvhtsccljt51 +pbnfrxblk3sevenxjcmcvhlgrghpbgdnpl8xsr3fiveoneightq +242three8 +2fivehgqfxgl8kpdknxhmk5bmmsbz +fivejvjeight6fsqgtpvcb +1threelgkbhlhhlmrbvxqqgf +klmqfgfg1gnine253psn8 +47eight +eight83mvdtsqppjhgjnsvngfive +7mcmzvsv6seven +56seven98three4three +pfnbthreegthreefknjm4five +2nqgrdcshfpjfpqdrvnq1twoccpmxpxvv +xtwo7threemxbtpsvjkgrfivethree2 +9pkdfourfour1zjvczkhpbj +1three2 +pkkbphkgqfivellrnvnkdxpql3 +ppc62 +one73ptfxsbbpqqgctdjhzjsjc91 +nine7threefourvvk +six59542xcxqcbnrvzfbshcxxddz2 +ftsfj2ninesix1hdjsrpkonelklfpltv +ninehmxgkqbmhvtlvdmdtvpeighttqfour1three +frbnineeight4168ksmjstpqvzhnn +rgnrntwohvqhgxxfkonefour4mfdr5ftgtjjv +3ninejbszdvdgznfourxpcxspqxnthlngkncvnineccq +threemjglxtp5cqmtwotwo2seventwonerkl +eightsevensevenlmbjzprggthree1eight +57nineninezdcf +cqoneighteightjnrfkplvninefivemck18mnhszhkv4 +tbvdcsjsvmxtshv3fourseven4kmxvvfour9 +bxcsix19six8dnqsbx +7five81ncchkdk +four4ck7rtjmjpccpeightone +fivetwo6nine1tdczktmfninelrbnnine +onetwo9twoeight5sevensix +cvvtbmninebneightsix1dnnfkgmnm +h7three3 +tpnzsdm9sixtg5sixqvcqsq3 +1sevenzmbcpgtfrjvq +r8757 +fournineseven6fourfour +798dpbrkfourtwoxdrgqkrkmfeight7 +threebvqqjcldjx4nine5 +3hbl +twodndcfddkvfivermvkrfzsnqthree5 +mhdcvsixmnqlvmvxmxfour3ct +25dpfsrbcllhtwothree2pthreezfhjx +dcfggnine1onetwoone +vtbmbpgffive2hdmzjzqqqc4one +zg11 +txrknhvhbv183 +dlvscqszz82nvtpb7tktvtgjbml +twofour5sevensmqfjrjcndmvcvqdfsrsix +446sixeight6rbrltdzf +132ncq1 +4ninezdfzgvzf4four7qkzstcq +7rx5xntgxfpmvsevenzmzmbjlc3fivefive +threeseven7tshthree +gnbqhninecjnhlpcfivenine18 +gjntwonenllmzgqsvq36lc45fourdrtzlctr +3tqgbfrk +zldl3zxpfbpveight +2ninetgppcvqrq +7one1sixeighttxcnhltwooneeight +bsm3hslqcr8xslndqnnvfpzvprlkt +khvptwo7kkbznndpqsevensevenvlr +sevenscneight8one4qnkc +2v +2threerjnineonev +68qhknonebtxvmqh +3btb +kcxbqzbjqt3twofourfxdlprsxkzlmflbveight +9bmdcninecjdv7 +ceightwoninelkbbfxgsv9fb5n +ztwo2 +7four9cpkclqxtrmpdgzxgtwo +8dghrmgprdjeight8knnb852one +2three36eightfournone2 +6ztwofkzlhvjdrxtsmlbgczf +knine6ninebpmzjbkg9tttkhtgcklbfive +sevenv3 +411one4483 +88jvjggxqfour3zrbvbxjzmthree +fivelqcnqfvgp18t +fivejceightqlsdrmrnbzfbjskstzrllxrdlcxpjkvf1 +832 +sixfive77rhkjdhvbpdfjxpkmfdq66qqtfpfs +fv6svkbnsgtpznblnvkvk5 +sixsevenfoursixeight486 +gsbfrjpngshpmlxf2 +gbmmmvdhffbbcq3 +5fivehxx28 +snjxttwo1zd5sixklfl +szsvdzsix3nine32nine +onervkhknmnsix3four363 +1btphrrvxdeightonekdhv8 +gkphmq73lfhflk66xpfive2 +611four3gnjsdkvksjdxfiveeight +klbvb9zk4eightninetwo +mreight59sevengqbhnspvhqcj2six +hnvgkmljlpthsgjrzmsevensix6fcvtxddbnx5 +ckfvkblhvv6gbsnlsevenktblt29three +eightfoursevendnsghkfsg8fivextnnine +5hrdqmfjq +twojcvkkjklzmfive2fourxqgdsdgzrjltwo7 +onetwonvxnxnntxcthree3 +threentwonine6 +sprfmxlqvb9jnbzltskxppqzdscrvhpfvjjcqhxcf +sixhfour95 +41fourqhpjbztknqnfpxvzc +two23sevenfgmmnszone113 +one41seven57 +oneninebqqklhk6gmdzddbhgzqcmxxfnmrvr +4mkpgv87eightckzjjfm +vhgdmvncxn88ldbt7464 +gcczfprplf7 +6eightninesxthreefive99 +two69fivecjxjhgjmgvttl9 +mztbzjmgxnpkfrqnrbgkgfourjjfjtone8eight +63mggldkcprlz +6sevenfourfive +1zvmrdnpzcsqqmxscn +five5tkgb8rrztmcfivebknjd +7pscpfive +eight9sixgfvhvlcnineeight +seven99fourtwojvxfrqmrdlthree +sppcgnjzeight93j +fivek7seventhree +twornbhtrlnznpctrxhqtngzdtnvfb2 +sevenfivefour63five38nlrxfcjpm +qvtdcspc4zxmmhpklhcdlznqfg46lct5one +1bnndtnsfjdsevenfivetwo3k85 +8five9six +3ltcc7trmmhbbbpjfive +cmbchhhczmqlp3 +nctz78twodljcqvplcqg +nine4sevenpnbbztpvkbgztb +zseven9eight +fourktzscmnrvddnnzsqfnfctzpdvtwo9 +nrtbgdjpm2ldcfdm5jjhx9 +jq9two68kjttwo67 +lnneightfourzqz6lgvxnthreeseven7 +fiveglp85 +ninefouronesix7k1three +3five5sevendhtmjhbh2 +rbjhnmmgsvmtk8four +vtrvvjsixhnctwocvskgzt3two3 +kxfive5threezgtd2 +2fivemcnngtzxsgbxmvbl +eightlrlztkvhfivefour5 +2twojcq7qrrbddmpsb +3twosixthreebqtoneone2 +nine9six3vlmpqbgjjqdftldpq +tgrglqfxxc2onetwo76oneonex +one48one +fivesgsnrzsms6one +fiveseven1tzhxdknkseven4 +3sprtonefivelxg47 +twotwoseven3ninenqdvxgm +nskjpvvqeightnine93fivecngkjcd3 +ltfxscllxk9pjznpnmhfmrzmqbq +4nineeight6four7 +fjtpj763 +four6six73htbstbbpztwofj +oneonetwo2five43three +five8bgcjnlzcgqpfkn +11mcn +9twovhkltdpkqzc65six +8fkprfkg9xfjxspqpshlfkqpnrt +4sblrf7745 +lblxmbzfour6187tggqllj +dhdmlx71mbbxtvhszhsvcm +six1qbqglfsssx +164tsthbb2 +8nineldrtltqfivebqnrthrm +sevenlsjbsklhxxfiveclbldxxtrdllxzthree6eight +18gnkrxfmnineone +six4threetwoeightgcn +vmknclnmnphb2czdbjmcone +eightq67 +eighthnzslhbblr85eight3 +3457kdzhnppqz5four8two +crcskvmhthree41 +8pccnsbv8ln3 +4eightonevd +pdz9threenine +3sg5gkrncz +6dxnslkl3xqlnm965twonexxn +9nlhmmkzsdbpdctd7ninec +62eightnine7nine3lrd +qbprlzczreight7threegqnrshrhc +3qlmr +three1twojgptkzgxmf +twosvdsfourone8 +5sixfourzvjtkpk +six418 +five523fivecbs +nineninesevenztfggvfkgkzfcm2 +qnsix5dnv7three +three5twofour +hlmtnzsmlnjxdtwo6 +9sixnglrctg +onecrgfq5hdldpc +nhzctlx94eight +19djvld +tzp8zzv8six1 +1nsnine5sixhqxfk +33sixtwojrdvksrfsnltglggxdhbsxf +bbvtpxptrnvjqzl3rldseventhree6 +2lcntfphb2lgpjbdeight +fivetwo1jjgkt9kltwo1nc +7xnmrscpfkthreejqbhlrtf4sixrbfrone +3threetqfkv1twofive +95ninejlftlxrs1nxxfsqz +hrsrszgrcl9seven8eightksdnhqsq7eight +5436ninefour +one5five +prcmxone8lhkblvr714three +92btgsllktgf7fivejhgsg2eight5 +fourmm61nine558nine +bxjx2 +one6onetwotjxthreefour8 +threedkpnpfvgt1one3nine1 +bxfour3two2sb4twondmfdpsz +11sevennrpxftwooneeightmx6 +9mqxcrjxnp7hdjgqktxm +2rnjlg7mbxstzbdh +qmsixhckzone1 +qzsnq6sixtwosixtwohhgbsrqgnine3 +foureight7scksqtkmnfiveseven765 +15oneckvshqd +41tzlxsfivebsckffdps +threefivefournine7 +5fiveonefour8lhqmltwoeighttwo +four5six +mhnrspfourmflmvkc52cjkvxheightsevendtddjdcnb +vxrrlfnlqf1twoeightninesixonetwo +8xonetwo2 +rveightwo79three +onebjlr9sixldqrbtwo4 +f1lhrbsix +mbbkv7ffpk +8twofourmxqvkqfcjfoureightplgpmrtxm3 +2rtrxjzqeighteightqtmsfnpdscpgqvxd7 +nineqggljvzvxltwozsvsfournine9 +ninexpmnnvqsfhnprqrqlcgfive9mtnflvttwoqlgphhb +11kbpmv1 +htspdnh1xhbbh3lzcjjx1 +five6fivefive5six +sxtbktj7 +ncvkgvgbeightfour89ttbrjthree +xcgxzxbfnkxdqn73eight +5nine4fivesixtwotwo1 +ffgzdfhn6 +fourzvtfcczlxhnnx5three +threednfntx4eightwovql +sixtwoveightnine7twonineseven +seveneightcclmgknrgninemnjsrsqsevenfftmlqkch7 +pvqnltjs2hghkrphnine3scngkjfcsn +62vdnbzrcrjsndqqr2 +5cxhscqpgdzbrnnq1m9b +gnkclhmbjfourfivemmxpqx2qlxvsix +sevenxcp4fourdlqgpxcl +8eighttwoone +bjslbfrspcnffnine9rvnjjrvcsix2 +six7tfive6hkllf56six +km3 +sixtjt2threefour2vqqcxj84 +9vflltwo4five +nineprprrcjt3eightmxfour +4twoninehvsbszqr +dtdmkcsd41eightfourxppqzkjb +xmdmghzdp9sevennine94 +2bbjsdlxoneeight +ninefivetwonine8 +68four +ninepdjpfmzxthree3dkxgttvncbr +52threesevenninefour6lfrlrsgzk +ghkczjt86bdk3czvhcone +cdjsd6jhnnnhzbzllqdjgpgnninevmcvbcxxltsix +1mxfsrninegfmgvnine14hbfnshgbprone +39four8 +bxnnjqkninetwotwo58txgvrbxvq +k4bftq68seven4nineseven +seven97fivekxjnseven4fourfour +drgttpqpsevenvrkxdlmvtctsc72seven +eight298 +2zsqmjskp +six5bgdkhzqt +fournlknxg35vqdqmnln6f +565rqtzdpqhlldxgnine7oneeight +3jfthree7vlkpfour1 +fourgngnqtgd675vgrrjf +25nrfive +kmlbnrm5dtvqndldh +vgbzkpnltxrp5tpvb +5mbzzk3nine7cqkngz1mm +sevenfive952 +4pxk8four +seven87fourlzlnineone +zxllsctgqmsevensix72 +9ggkqvsrhftwobndlt +8sixsfzlfpztjtwofourqvnptkgllxcf +5dvsjvtm +29dsvjrl3pvgjqncbgcxc +9mhvrb8fbtppbhm2s +eightninel5 +jltnzpcdr8one5szgf3nine88 +8xzgs4chdkfour +three7vgnbtqvhthree8sixq +2onesix354jj58 +175rpdmxfeightwos +gmngst7hpfvgmtfrqbb +9hd2lsxprdvtqxcv55 +four13cjqkvgxvbseven8 +1kqfrqsevenqgjttjrspd +7seveneight6zfmdbzdj2 +9sixpfjbnthreedgbhblmr +7hdqqqkone6htzthree +hmnxstkbzlhqjpdn3three2 +dpbjgmnn1 +ninefivecznsbttpcvkthreeoneeight1zqtxb +6hlxdlpgrl7six +fourdhczrzd9mmmdthcngsmdqkq9fivetwofkb +7fbcrzcxjvxtqbfive168 +sevenhlrkxgrggkqgd12 +vzmpvhqvkpdfmthreetwo9 +21cqxtjtwoljsixxbf3 +bzzxkxtl3rhsrpnnzseven +threevhdqqvtwothreenine48frqsfhgsgptbbn +foureighteight3pgbcftjdbbsmcqjcrmt21 +twovpfbsd42five +6foureightwofh +5185cbhgvkvpfzk1 +1one3two5 +seven3mdjks6kctnnchjgpnineeight +sixfivecjfkx5 +sccbfqfive28bhconexmztpcftrbz +qfzhgl1nine5four59nbxhclpk +mjrvgdz3nine6gkvznv83 +mfxqslvpzeight2 +ztwoneeightknnjh4nine +onefivesevenfsmmhkbcplj6seven +2lfgzblvdflgxnsqfxtksbb +blmvzczjs61fourmtds +5two2 +jqppjfxfour2 +3five2bcrn653 +86five6bseven +rzztlcbvteight135 +1sjngcngjrsht3ninehninefive +81sixkrhvrhxqhn65 +dkrgmnlcbjdjxblbfnp5 +three85xrckdqtjqphjsjqflmt +5fmptvmz19fourmbzrttnxnk +dptwonefbqhrxtljddtkhh6four23 +xfvgkfive69 +cbtfrbpxphj2sevenmmzrpccnine +5twotwoseven +fivetwoeightonefive954 +zxccrkvgdqtklbnhtdtdsghcseventwo6 +three6vqmtchfdjxveightone +onenine39twodksvrdsxflthree +threesbpseven5zqtwobtmpgqjg1 +326dgjmzzfivehkhsjrseven +dgthreeeightthreefbhbltbdjnineseven3klvx +4xkcqeighttwo2 +eightonerhlnchp17 +2jcmzbczstsrmbpzxpftkmznzckhv7three +7foursixbrcc6twosixgnf +4lqxfourtvxhqtlhlx7xcfxhmqzbone +2sevenz6sixtwo +nine1pv +95jzlkxn +onerzfnqhmtjpqff93lrctjgqhseveneight +5eightrdjnine3 +threetwo6fourrcrq9dfmbsznshkfqmpvcb +five3hpjznhbtjonecvfgfsk9n9 +2gkbqpqn31 +sevenfivefgcvtpsxjprfh8nine +lvfxml6992 +5threexmjjgkv8985zzjqdbtwo +eight3bkqdnbmrtb5 +7sevenoneznpx +9hjg4eightrcsvdkbmldjclfqfm +9four2one4 +koneightonecdfcrjkqtcsevennlvr8hbrc +seven3lthbv8 +ninexzznsix5nine +ninentdd6qvkclninefivenine +four11pgmxz7pnjfiveeight +threeninefourpmtmlgllftnvxzn5twonine +four46eight9sevenfive3three +blztvfkqggcbshlzxppxgrxsr4three3 +one9pvlnv +8l37 +brjvlvjrhbfourxshh1vlclvrz2 +5flqnkntnxkzhcftmzb9rlfzxlg +sixfourseven77onekone +6xfmdgjfeight4qzrncxdpmb4four +four28 +seven74zrtpftdldc7fqlseven5 +6gxjzskpkfvmmd +zkoneight99jrrmgsfpsixfiveone +9jbbdtdxjsm8szxblgjppx4tpnvqvtlrj +rsrlrcb32ngsixfourfivenine +6seven9one7threegrfqpncjthree +onebjvpzzqhvlhg1pxkvmgqvxsrglb8fourptbjs +1fch +njhs4p86n22 +two1one6four1six +fourphxjkjtwo8eight +3svqrzd1fourcmlcknhvninetddpbcmbtgqpcjms +vkndzm684sixjlgkcvz4 +25five +pkzt2fivetwo2zffkjqrhgfive4jpsj +sevenmpfcthreembjgbfpkdzqlr4 +49four1mpldzb3 +hdzddkxf1cxftflb73 +zrmhdlhk2v7 +25zcd +11eighteight5qcqzpvvk +38nine43 +8lstwo +12sixnfbrgbhdpn1three3 +8eightcd82rzkzlvthqnvhjvgfour +24jcbjplcnqbcrxs25 +3fivebfkgpkglfchbmbfps +pgmvbnhskgzdmz2sixeightcjq5 +cdpmrlj1one +6hxqoneightjjv +34gxbjzrtg5 +pvddskbslqnrfngmcjgsdthree3 +6nkjjlknp9 +hflkjhgjmeightc5n1 +dmkeight1223 +five9three8 +eight7mqfsjplfprrfpkzctgtdvrmxphm +phbs2fck4sixfourqvqbr +2bnvktn +sfvkgzone83 +2threetqnthdnq32ninetwo9 +sixhdkvdcmp5three23j +8615four +twosix54vrrbvzszk9 +53671 +threevklcphgkjsnine4eight4fmtffknglthree +sixninethreeh4dj +oneone1pmdthreesrfsssbkt8 +7foureighteight3 +srpvkzrqfive378 +6twodnnrvfjrjv +4kpxlslqfbktwo +bvzpgrc9twotqsvdztwoseven8 +xkjdltjgzbjhxkjvtwo6 +five27sixsevensixtwo9nine +jk468qgkr +fourtwo89 +fourthreethreedtnzbmlfhmgjr5nineseven7 +44seven +two3psfive122jps +sevensevenghzmpdvrffive9nine3eight +497ftdf9five +gklfive6rnvpnvvkqheight +2hvdfiveprrdqspsix6 +5m8nine +bnctbninexsixonesix8five8 +xkqqlmfmrveightsix4nine93nine +6k +3foursevensix6cksix5six +7twoone +three73lfddzhd1fkxmjdzsix7twonex +sthjlrjrhd741prcsqh3rmllvjmtvgfour +4dvffpjkn +tpbttcslvz7twoneq +fourtwoninej5snfxnqzthree +n7cmsfsqd +eightssrzkxj5 +239 +three8five7xxthreebqrbx +zrlchvsevenfournine4ktvskhjgh3h +7fourfdjsnhdbgqjvnltzj6three +mrjsndmzkz7rszqnbhxt3fvsix1 +neight85eightggtnxtgljsevenfivekz +6vknslh4onetwonrlzm +37zlrksix1skbsdkpjf6twonejtx +three2843five6 +txgdvvdg959 +zfjrs2zvtbqctcdqgrpfmqsjbdone5 +six9eightninetwo72sxxnzvblthree +2jdpslvbnpqjpglczkmzggkfkdkx8hgpxtcz +threefive5eight5mnbllfpcsp29vlnbrntt +gfxndggbs16twozpcsckzqcj3sthsgq6 +gcjjvqkvzdbcsnmqqhnzzqvj4 +flcpl3btfmbbpnkjvnlmcthreetwo1eightwops +bdmeight67tvkfh2 +three645qcv1zbbheight +3ninethvbxxppxgqcqrclptxczgrcneighttwofivebrqxl +25eight41 +six22 +pcp5 +dtmgxkdqsixdhmsbj821 +eightprbxpj5oneightcxj +qvrn3jbhlxjsdq +oneclvhjhr5 +9nkmqpjjxxhvtpndls9 +215ltwo75 +threeeight16nine2mzhxnine +ktfxkmdvzprhkpdhvxhzsc68 +fivesix8five +4z1eighttwofive +73twotwo4 +gmjlpchdzfthreesix1vljxdqsrlxmmqs2 +twofxh3 +threeqzcglsdcfm4four +three1eight8 +seven7dtqhr7 +4xbjlxlptj8hzfjnz +37jzgxbjcggone +81fouronenine489four +eight3fiveoneseven135 +stzts59zqdvrdcqrc +sixnklrjbeightn2six +bqdtntwonine1eightttzlzvzfn54xmj +sjk6 +qmrbnhczj624394sevenseven +kkjdcjhfh93eight +3ptmslnconethree +cfjgdffcgvldsnvkbjqrxhxcl7fjlxdrlrrthreeseventwo +187oneseven6 +fiveprnppdg2tjfbfmlvhpmkggjc +9onetwo4 +fivesvjxkzzm59vtsevenhzxtkggdhr8hvjtjvv +kpxkbbxseveneight89sevenrbhqqpk +drhkpssxqvvnssq59four4 +oneeight17 +gteightwoone268four +eight7fourbjnlzfiveczlzppnxck +jdqpxsevenone2eight +pvh5six4hddrhfzpxfmtwo +5six56nineone2 +v96k9115three +phqhhthree5ksqhfjlbfg +gpsskbfhhllnxfvjspkjndtlfour5 +three5zqbnsrdthree8 +b4mkfpkltlfdfive4mdqxjnb8tdpnpf3 +qfivejjggrpktxponetrjzceightseven9xhdf +34cpfxc +jl9 +84four +fourthree9three48 +7threevgvtj2five4pbq +7kjkjc +seventfsvjbsh5smmdd3frthree +smgmzqzn5 +gmtd5kvglxsixeight8twothvkprlbc5 +twofour62 +nine5k +hbxnpb4four4h +6sixgnmnjv4fourone1 +9eightseventhree +9jpvccsvhqpnhsl8 +nvcnninefour9 +v237ppqbhb +78six +four165oneightxcm +9pjcsfbrghnineqzth4smx +46fpfptrq1mbqmbnktqeight +stbxvlcqz5krd1threethreeonefour +48six5seven +6bmltlrvrgpcfhjhmfiveqzfxptjtwo4zvsqqxgbrdlzsfmtzdd +jeightwo47three86twoseven +njxzmthree8fivevvchvjqdvn3foursix +83t34 +oneznzqptpxbrtqxstkmz3kmtstds +1sixsfrnqd +brs7fgkbhntv5s5 +twohs7m +gfljsixseventmgdvhqthree3threefive +f1twonekdh +oneone735eightnine +pfjvfspsseven9qgfrnmckxzsix94 +7nineninelrcqqcgcnmmqf3 +1vjdhjtrfourfive2nine278 +oneone7 +threelcxlqrzhdghp4zkjfivepjj +hcshggsmzpdmkvtdvdgqtfxlt8 +1vdjtvpfhkhfive1 +2eightstnj6three +93threeeightntjblpljbv +onermlmtncmj6pxkmhmqchzvzf +4eightfnjzfzhvg +hmjvmtwovnl8nine84 +threets6 +six9twofivexgz63 +692five +fkgblptntvhvmlv8threethreenine +seven86 +nine1n7 +97two +4threebqqnmvmqleightthreefiveszppmbhxrxvpxz +6bxbmbdkxqmzeightlrqdqvrkr5threethree +llqcbpeight1vpjninekpdvzg +6qgtdqvtvkcbcskfqtq +6threegrrmxxxqkflltr3 +312 +hqmhsxpmkxtwosix3 +rpzqtmzgdfdxcgsix1six63lxjpbxfq8 +zzkbtkghmmqfourrtsixxxfjnvvccmpsd5six +13two4bxdcqzrkqtxm1mplvqxcfhcjsc +threesixqj8two +9seventhree +dtnine5twoseven6zxd +lsqbvgjnznineone7lxtvmkmflrfcqdjmjtwo +zpkjlfp6onevxtdtdzmcqjprfive +gxplqqsz412sevenninejs1 +psvjsvvnrv796 +69tfxkbkchvlhkjbrmone +fivehnrvtb6 +eightzdlqrbzxteightptlgmcmvtwothreergcddqxf2twonepxh +343sevenxsffneightdvft +fivednmrpmvv8fiveninesevenzbggk +seventwot3hpfrzbhxlhfivetwo7zvmpmq +xnsxz8fivezhzdcbzsvp +sfzch8twoned +5rstpx +12six +gqznine5gpg +6zrmsp825seven +2493twothree +9fivemksdnmgbvx +6dvdpdpkmqpxvfive28six +dzvnrdksixonetwoonetr4 +7fncndxbqj6onetwosixsixthree +7cnprcdgk2three2dvtccqnskvzfsevenxdrnqf +cxfcdvbsjqjbnxddlggjfourtnfzvtgx4twoddkkpdd +pxjgqrmdg5mpcgcdmfeight825jxxqcnfive +1tkhgtzzfrbdvnbft +hgxfive14ddcfhshfd4 +onenzlhvtdgkjmjgldmddhngdv9onebkt +foureight8rzxkktk9eighteight1 +478nshqhnhjrmlqbmp +ddjzzxgj75zktccgqrltfivethree +eightmcnmt5jnmnqhqdfive +rcdxshk1seven5 +rdcmbznk79 +2gtbskjxpmmvdclgmfjrc48one +8mqgnfive7chknsixrfourseven +4hgdxjgbn1sixseven7twosixseven +mkjslkltjd59 +fourfoursixfkjrcfsfivenrtzv4eight +five8threeseven4 +81821tcmfourddhmzvzfive +onesix943fivejld +5eighteight3cmvvpqmdq72vrvb +two86 +nqjrpqvgqr7rjjjxglqzrmt +5kqjjvzxt +6fourvstjrlnvone3ndphzphkrnsqmkmsthreep +six8four7 +two1dntwo +eightgmcgrnptrcvztbdp4three +xxbpnnztr5eightpnqeight +three9pfpnjx6rkphpjeight3five +sevendzstsjl3krspscb1 +fsevenfqtxxhjzvnineninesixeight8 +kznjhnxbnk7qbxjrztltv +rkeightwo6zfpvrfgqr7qxbkkg43lrjqtzjrprqttxmbrzg +mcfive77vgzxonehglbj +9319 +4mzds +sevensixthree5sixdvzxkndhvjfive +9mjhfkeight88v +seven5zhdthbmrkdpdxfcp8njtqvpnjj14 +8ninetwo +95tnjldjqcrzdxlm3 +fourgffour8 +nine821qbv6five +jbtfg83two +twozcpjrcnplnz5bdtgpdctb87lzlvqhtrjj +tr4 +5foureightfourfcs +1cqjts1jgzkfm +66threetwo +jsdpkfnineeightzpjdmrvxkbhdntj9 +pgcqrsix6mqrr8threeqxgkftbmzninevndn +kmvqsqhbrcnbqqgninet6 +bxtstqzpqfzqnhjfb8htszvgqhpnggvqt +ninecpqpffivehg8 +kxmstxkffourqmx41 +scfourlkfbrjvbtwo5 +qr88fivenine1lfvksgrtqseven +four6foursix +twoqmnxrjql5fourpdlstnnsfkdjgt9 +4zsvbsjqv97bpxvncr +xhqlhsbqjhvdqqonesevenfive3qvrtbkhhlfbzsj9 +sixeight4six5szgzcjhpj1 +7vpjq9hjtrjgone +f92eight +eighteightnc8134 +22onespjpxlttsqsix8eighthxdfvsdx +5ninefourgrrmxsxjfxk +threeninepmvsv763xlxjp +oneone7lzzhjqqrg +9fourtqqmhrpmkxhrvlnjvvhsevenseven +threethreetvjpnoneseven8 +two46onetwoqbvntlxbrftpjf9 +8one5nine1three8 +three69sgdkstpqbqdz +q8rzcl +onepjmchxtlqnmrcrvm6 +61fivegjjsevenqgdkq +49fxhdzfntmk6tb8dpdkknzsb +bbseven1xvqmlrhx +2j +seventwozjqszlhzxlpgphnkz2foursixfour +1sixhgvhrbonetwom +fournine8gvmrpgdxvcbdspzdcqt87bdzvxbf5 +3sevennine2fzpt +threedcdlq9kcjhtmtz +86five +tpfqhqs3977 +8four1cgmm12shfl58 +xlkrrkpkqjtslblqfnxp7two16jzpmpkrfvdzh +243 +three9hkgnmrh6lqrsx5 +fivexsczpmltrmcgrvfc58 +mxngrsh2sevensixthreelgrmg +ljqmflvone76 +ksponeightthree2ninenine +tdsdmjznr5nine7fourtwojgjsdfsevenone +eightfive1fourseven3gsqhtv +1xfdmqtmgkmjkthree +rztwonelztpgkxzzcbn1eightttssdpone71 +zthhsgvmhqsgvdponetwo9p +293rmjjjpmjchjnbdcssfrneightvdzrkbhdln +7nfkdntfourthreefzrfxmxgqone5 +tkgrnhbflp7zltmbdoneeightwoh +7bspgfklffgsix4 +eighthcmlrpbhjjmvbjrleightgd94 +sixbgfjzgzbxsb4qsixthreehbbn +ninerhzjpjdfnsevenonenine8 +38kqzjxqmmm +jngngvc412 +4twosponesixdpj15five +41four2oneonekr2 +cpsixjnlhkthree353seven +bknflgv1sixfivefive5 +3qkhnsjqkcjmlg7gl4jthreethree +dhlngstrvbxjjll2979kjsttsfgjkc +4kkq7rqlxcldqqtwo +jfh74 +lkfpcdghgq8gpgldrsnzkzzzzskrvcvsjthree +57fivefive3cxqj2 +ztwone7vcd37122 +4qrrhhlxgpr4 +twokzfjg2sevenlnvlpzxknznpsc1 +4jjbcdbfm8six6four +5eightninesixvzvf98two +8flntwomkktkpvsone78sixone +sevenzltjhkptjfjbrppm85eight +fivemfrmnqptthreepninepd5 +6one9 +vkqxgzmbm2b4pjqjddsbjnjcqqvm9 +5443nfkv +leightwo5 +8fiveeightonetwovgvhzgzfjh16eightwohlk +fivexnbhkzjfg1 +chkxvgrgb1sqxsnhngnrtqsnqgjkd +96twoone5553dv +36pfltskrbcmlmnspn +4jbbrh95249 +xfzspqssdfourhnmtzfive2pfzczh +onexzbzhddkqgfr2 +sevenninerrlveight5nine3 +eight7qvgkbk238fiveeight +sevenseveneightgtxtxkjsgdgklzzxxc3two8 +tvfjhvtclm75skqdxsskqhrjkbg +45 +sevenfive82 +425zkhjhmk +onexdchhtxmhsevenbczrslrppneightonenbnhfmbsvdcnzjx1 +zfkscdbmtwoeightrksdmgx4 +lnseightnine9eight +fourhmbhlcpht53ngkbzjmfivesixg +threestrhbj9sixggczcg +9twoskgrps8 +3four6xdqczgtzlzf +ldfn2 +qlzjsnbzfourfdq476 +tpkczdh5hdbxvvmmt3sixsix +tdpxzld5 +lnveightwohdkgcvvrjs38 +zz8eightstvmhvrh7hftdhkrjcneight1 +9kdbcpqtx15 +rbqgdbvrstgninefive4bqq2six +nine3psmkzkgnjbndrcninesevenzvcr6 +eight4jfrqcbqfninedxmdtjgqgtrg6four5 +3mmnineninenjjpmfivetwo +cv4znxcjthreeqqtdqmzxfknnp +8pjkm +ptwonethreegrgvseven7 +onethree1bgjsix5sevengpts +96xlmmthreeeightcbdnrstvpncmr +rtc94tcninefive +onespqnnptpdbrgqsqrldstl1 +qkeightwotwocjcngknkztwo7 +gzjhzlf4fdglcrzckbrlkmg +3eighttwopninefour +2seven1c +17nine447qkmfour2 +six6xfgqddnfpsc +mkbgbkvzdpzxfmrhdcjklxfoureightzzpn3eight +95ninevhctbgznbzz871sixoneightr +31onekmseveneight2four +mlxqgmvj2six6 +2sixgvsbmrhtwofour +eight221three99two3 +88xrrbjdlzrfour8plv +xdglmrpxbz5xpjxzpmvrgsixthreeseven7threebtqfkqp +lbd2onethree +seventwoseven7threesixbpld +1pstwofour8eight3dsdfrseven +gnvzm19htsbvcsfmlrmbgtstzmm3twoqzffkrrq +94nvrbbj +one71rsfbpnnbkrklmxqfive +4six1 +eight48chsrmsix +vqxrnmsix98hlzdgvd3sevenninekng +12threehscqzvzcbgfive6three2zhtthr +6sixkzrnv +5gmnhhzkfmp +four35seven7onenvdsevenftnpbcj +6zxrhcxxkppkn2 +dgshxchmhgtgjk281seven +lbdsmfvdsfzlp6dfpgd3 +three2dpsdhfld95eightwoht +jbktdklsqkgnhnfmseven1lhdsbjksixtwo +3fdqfour +5jpljkkpmdsix +qfeightwo9threethree +hpqdx4911tzfcxlrtccqf9one +q79zspgmjpdzs63 +344zk5xbthreezgbffcb +nlzmjfqxmneightxqjdnjvr21 +8cxtrkpvzj21xfgbdgcvgrztwo +three18444 +sntrptktwo2one1five +qxjrgfcnpcjtnfjljqnq1onehzfcqlnine +kflgzv58dbzbjjdvclgtseven +twofive4eightwozz +eightfive365 +7nqnksvphhnine88 +t8eight +bjd6five +khbrbtsx5jqxmbsqtf5nine3sevenskhfg6 +seventlkmfhqkgxkbhqr6ncjztnfive +152one +three5cbpqkzb4eightseventgmqzflsfksix +seven32threegfddgtf +two5twofivexzkkvcqs3 +tvvdgrnqlmkfour1zrcznqkhseveneight1q +92threesix89 +3zbdlttpbh7fivepgxmrvbzlnfgmbkzknndfqk5 +threefnhxtdbl1jtxeightwol +5vgthldgfmgdjphvcgh53dshmdkc +3nineeightwokh +57eighttddbcdsjdss +tkcgn86xfgbmzt7rksvnchnrh +five3dn5 +three2eighteight15nine +49bn1zvbm57 +351six6xfzfjvpz +5one5zchddj4dkksn +xfhtwonesevenfivethreepqzmrzrrfourthree5 +ninetzmcgp47four +sevenbcfbpnrvkkscrjtpctdtb69bvvnvlgsmjltlvs +6threev +ninerlsbznvfn9 +fourbm2 +sdxd22 +n7 +7sixcjdsxfourfmvzrbvlnine5 +threeqtbhgznine7one +ftmkmxkd9fvvlg353rp51 +9zjhmpnjv5jvndz +58three59nineonesix +rmjvhrjjmkqsn6gqthreeonefivemxqhrzvffone +xsslv7gpgkbzdmr434four +pnzxp4nbtsjqctkvqncxzxzj +eightseven52five4ninekntfjrdt +4sixldsmv +pknxkqgdpnc7fivedbvhkn +qkpjhjlxone4sixpfkvhlmxmd3 +four3ninerkrcvgcmbb2qm +fivenine6six1eight +69sixnine +bvjx5lg5vgrqq +21ninegnhdkcxhzkcfdksvsmdthree +zjrnmhclxhrkjpffhxkthnvj83jnshbqvx +bzfphcg9fourthreegkchdvrgsx +2ninebvgdcfxtktqjxjqvxfgjdqfhv5threegqtsfhtfxg +6rqskvckjzq2qzrnbxjmlthreeeight6hrs +sixthree6lxcrsevenseven69twonegs +2dcvcqcbpshsixone3 +drkdbmv4zbjbznsqtj +eightbqfhnmvqsoneninezbrzcqkz4ftv +1eightcrcjcbdthreebscfpvznqfrj6 diff --git a/2023/rust/day1/src/lib.rs b/2023/rust/day1/src/lib.rs new file mode 100644 index 0000000..3240d6d --- /dev/null +++ b/2023/rust/day1/src/lib.rs @@ -0,0 +1,97 @@ +pub fn part1(input: &str) -> u32 { + let mut res: u32 = 0; + + for line in input.split('\n') { + let mut d1: i32 = -1; + let mut d2: i32 = -1; + for ch in line.chars() { + if ch.is_digit(10) { + if d1 == -1 { + d1 = ch.to_digit(10).unwrap() as i32 * 10; + } + + d2 = ch.to_digit(10).unwrap() as i32; + } + } + + if d1 + d2 > 0 { + res += (d1 + d2) as u32; + } + } + + res +} + +pub fn part2(input: &str) -> u32 { + let mut res: u32 = 0; + + let hs: [(&str, u32); 18] = [ + ("one", 1), + ("1", 1), + ("two", 2), + ("2", 2), + ("three", 3), + ("3", 3), + ("four", 4), + ("4", 4), + ("five", 5), + ("5", 5), + ("six", 6), + ("6", 6), + ("seven", 7), + ("7", 7), + ("eight", 8), + ("8", 8), + ("nine", 9), + ("9", 9), + ]; + + for (i, line) in input.strip_suffix('\n').unwrap().split('\n').enumerate() { + let mut idx: Vec<(i32, u32)> = vec![]; + for (k, v) in &hs { + let ms: Vec<_> = line.match_indices(k).collect(); + for m in ms.iter() { + idx.push((m.0 as i32, *v)); + } + } + + idx.sort_by(|a, b| a.0.cmp(&b.0)); + println!("{i} {}", idx[0].1 * 10 + idx[idx.len() - 1].1); + res += idx[0].1 * 10 + idx[idx.len() - 1].1; + } + + res +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 142); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 54159); + } + + #[test] + fn example_part2() { + let input = include_str!("../example2.txt"); + let result = part2(input); + assert_eq!(result, 281); + } + + #[test] + fn input_part2() { + let input = include_str!("../input2.txt"); + let result = part2(input); + assert_eq!(result, 53866); + } +} diff --git a/2023/rust/day11/Cargo.toml b/2023/rust/day11/Cargo.toml new file mode 100644 index 0000000..8f5b9a5 --- /dev/null +++ b/2023/rust/day11/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day11" +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/rust/day11/example.txt b/2023/rust/day11/example.txt new file mode 100644 index 0000000..986aad4 --- /dev/null +++ b/2023/rust/day11/example.txt @@ -0,0 +1,10 @@ +...#...... +.......#.. +#......... +.......... +......#... +.#........ +.........# +.......... +.......#.. +#...#..... diff --git a/2023/rust/day11/input.txt b/2023/rust/day11/input.txt new file mode 100644 index 0000000..6ba87be --- /dev/null +++ b/2023/rust/day11/input.txt @@ -0,0 +1,140 @@ +.......................................#..........................................................#......................................#.. +.....................#................................#..................................................................................... +....#.....#...................#...............#....................#.....................#.....................#....................#....... +............................................................................................................................................ +.................#......................................................#......#..............#....................#........................ +......................................#..................................................................................................... +.......................................................#...................................................#..............#................. +.............................................................#..........................#................................................... +............#..............................#.................................#.................................................#............ +#.................................#.............#................#....................................................................#..... +....................................................................................#................#...................................... +....#..........#............#...........................................#..................#..................#...................#......... +......................................#...................#.................................................................#.............#. +........#....................................#.......#...................................................................................... +........................................................................................#..........#........................................ +..#................................................................#........................................................................ +..............................#...............................................#.....................................#............#.......... +...................#........................................................................................................................ +...........#......................#........#................................................................................................ +...............................................................#.................#.........................#................................ +......................................................#.....................................#............................................... +........#............................................................................#................................#.........#........... +................#...........#............................................................................................................... +.....................#........................#........................#.....................................#............................#. +....#........................................................#................#.............................................#............... +............................................................................................................................................ +.....................................................................................................#.............#...................#.... +..........................#...........#.........................................................................................#........... +#......................................................#.........................................#............#........#.................... +.........#.....................................#....................................#....................................................... +.................................#..................................#......................................................#........#....... +.........................................................................................................#.................................. +......#.............#....................................................#.................................................................. +..........................#........................................................................................#........................ +.#.......................................#...................#...............#........................#..................#.................. +..................................#..............#...........................................................#.................#............ +.........#.........................................................#........................#............................................... +....................................................................................#....................................................... +.....#........#............................#...............................#.........................................#...................... +......................................................................#..................................#.................................. +............................#..................#........#..............................................................................#.... +.......................#.............#...................................................................................................... +#..........#...................................................#.......................#........................#......#.................... +....................................................#.............................................#......................................... +.................................................................................................................................#.......... +..................................#....................................................................#.................................... +........#.......................................#............#.....#........#............................................................... +............................................................................................................................................ +............................................................................................................................................ +..........................#.............................................................#.........................#......................... +..#............................#..........#..................................................................................#.............. +..................#...................................................#.............#.......................#.............................#. +............#.................................#........#.....#.............................................................................. +............................................................................................................................................ +.......................................................................................#..............#.................#...........#....... +....................#.....#....................................................#............#.................#............................. +....#............................................................................................#..............................#..........# +............................................................................................................................................ +...............................#......................#...............................................................#..................... +.................................................#...............#..................#.........#.............................#............... +........#......#.....................#................................................................................................#..... +.............................................#.................................#............................................................ +.#......................#..............................................................#................#................................... +............#.....#.....................................................................................................#................... +..................................#.....................................................................................................#... +............................................................................................................................................ +......#...............................................................#........................#..............................#............. +.....................#...........................#....................................#..............................#...................... +............................................................................#............................................................... +............#................#........#.......................#.....................................#....................................... +............................................................................................#.................#...........#................. +...................#................................................................................................................#....... +...................................#...................#..........#............#............................................................ +#.........................................#.....#..................................................................#........................ +............................................................................................................#....................#.......... +..........#..........................................................#.................................#...................................# +............................................................................................................................................ +......#.................#.......................................................#...............#.........................#................. +.............................#................#...................#.............................................#........................... +.............#.......................................#......................#.......#................................#...................... +........................................#................................................#...........................................#...... +...................................#........................................................................................................ +.................#...........................................#..............................................................#............... +.........#................#.......................................................................................#......................... +.....................#...................................................................................................................... +.#..............................................................#............#..........#.....#.........#................................... +......#.................................#.............................#..................................................................... +................................................................................................................................#........... +......................................................#............................................#....................#..............#.... +.........................#...................#.............................................................................................. +...............................................................#............#..........#.................#.................................. +..................................#......................................................................................................... +...............#..........................................................................................................#......#.......... +............................................................................................................................................ +......#........................................#..................................#................#..................................#..... +.#..........................#.........#.............................................................................#....................... +.......................................................#......................#.......#..................................................... +.............................................................#.................................................................#............ +...............#......................................................................................#.......#...........................#. +.....#....................................................................#...................#............................................. +..........................#................#.....#................#......................................................................... +..................................................................................#.................................#......#...........#.... +.................#.......................................................................................................................... +..................................#......................................................................................................... +...........#.........................................#.................#...............#.................................................... +................................................................#..............................#..........#....................#............ +...............#.............#............................#..................#.............................................................. +..#............................................#...........................................................................#................ +......................#..................................................................................................................... +.......................................#.................................#..........................................................#....... +...................................................................#........................................................................ +....#.............#................................................................#..................................#......#.............. +.............................................................#.............................................................................. +.........#................#.....................#.....................#.....#.....................#.......#................................. +...................................................................................................................................#........ +...........................................#...............................................#................................................ +.....................................................#..........#....................#...........................#............#.........#... +.#.............#......#..................................................................................................................... +.............................#............................................#..............................#.................................. +.......................................#............................................................................#....................... +..................#......................................#............#.............................#....................................... +.........#................#.....................................................#..............#.............#....................#.......#. +..#..............................................................#.........................................................#................ +...................................#..........#.............................#.........................................................#..... +......#..............................................................................................................#...................... +..............#............................................................................................................................. +......................................................#........#.................#.......................................#.................. +......................#.......#.................#......................................#.......#...............#............................ +..#..............#.......................#.................................................................................................. +.......................................................................#...................#.............#.................................. +.........#..........................................................................#.................................#..................... +......................................#..................#.......................................#....................................#..... +.........................#............................................................................#.......#.............#............... +....................#.........................................#............................................................................. +...............#............................................................................................................................ +......................................................................#...........#........#...................................#............ +.................................#..........#............................................................................................... +......#..........................................#............................#....................................#........................ +...............................................................#...........................................#.............................#.. +..#.........#..........#.................#..........................................................#....................................... diff --git a/2023/rust/day11/src/lib.rs b/2023/rust/day11/src/lib.rs new file mode 100644 index 0000000..66c95c4 --- /dev/null +++ b/2023/rust/day11/src/lib.rs @@ -0,0 +1,130 @@ +fn expand(m: &mut Vec<Vec<i16>>, ch: i16) { + let rows = m.len(); + let mut cols = m[0].len(); + + let mut i = 0; + while i < rows { + if m[i].iter().filter(|&x| *x != 0).count() == 0 { + m.insert(i, vec![ch; cols]); + i += 1; + } + i += 1; + } + let rows = m.len(); + i = 0; + + while i < cols { + let mut c = 0; + for j in 0..rows { + if m[j][i] != 0 { + c += 1; + } + } + + if c == 0 { + for j in 0..rows { + m[j].insert(i, ch); + } + cols += 1; + i += 1; + } + i += 1; + } +} + +pub fn part1(input: &str) -> u32 { + let mut res: u32 = 0; + + let mut m: Vec<Vec<i16>> = input + .trim_end() + .split('\n') + .map(|y| y.chars().map(|x| if x == '#' { 1 } else { 0 }).collect()) + .collect(); + + expand(&mut m, 0); + let mut hs: Vec<(usize, usize)> = vec![]; + let rows = m.len(); + let cols = m[0].len(); + for i in 0..rows { + for j in 0..cols { + if m[i][j] != 0 { + hs.push((i, j)); + } + } + } + + let n = hs.len(); + for i in 0..n { + for j in i + 1..n { + res += ((hs[j].1 as i16 - hs[i].1 as i16).abs() + + (hs[j].0 as i16 - hs[i].0 as i16).abs()) as u32; + } + } + + res +} + +pub fn part2(input: &str) -> u32 { + let mut res: u32 = 0; + + let mut m: Vec<Vec<i16>> = input + .trim_end() + .split('\n') + .map(|y| y.chars().map(|x| if x == '#' { 1 } else { 0 }).collect()) + .collect(); + + expand(&mut m, 1); + let mut hs: Vec<(usize, usize)> = vec![]; + let rows = m.len(); + let cols = m[0].len(); + for i in 0..rows { + for j in 0..cols { + if m[i][j] > 0 { + hs.push((i, j)); + } + } + } + + let n = hs.len(); + for i in 0..n { + for j in i + 1..n { + res += ((hs[j].1 as i16 - hs[i].1 as i16).abs() + + (hs[j].0 as i16 - hs[i].0 as i16).abs()) as u32; + } + } + + res +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 374); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 9623138); + } + + #[test] + fn example_part2() { + let input = include_str!("../example.txt"); + let result = part2(input); + assert_eq!(result, 1030); + } + // + // #[test] + // fn input_part2() { + // let input = include_str!("../input.txt"); + // let result = part2(input); + // assert_eq!(result, 71585); + // } +} diff --git a/2023/rust/day13/Cargo.toml b/2023/rust/day13/Cargo.toml new file mode 100644 index 0000000..36c9510 --- /dev/null +++ b/2023/rust/day13/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day13" +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/rust/day13/example.txt b/2023/rust/day13/example.txt new file mode 100644 index 0000000..3b6b5cc --- /dev/null +++ b/2023/rust/day13/example.txt @@ -0,0 +1,15 @@ +#.##..##. +..#.##.#. +##......# +##......# +..#.##.#. +..##..##. +#.#.##.#. + +#...##..# +#....#..# +..##..### +#####.##. +#####.##. +..##..### +#....#..# diff --git a/2023/rust/day13/input.txt b/2023/rust/day13/input.txt new file mode 100644 index 0000000..023748d --- /dev/null +++ b/2023/rust/day13/input.txt @@ -0,0 +1,1361 @@ +######....####### +..#...####...#..# +.###.#....#.###.# +....##.##.##....# +.##....##....##.. +.####...#..####.# +##..#..##..#..### +..#.########.#... +#..#.######.#..#. +.##..#.##.#..##.. +###.#.####.#.###. +###.#.####.#.###. +.##..#.##.#..##.. +#..#.######.#..#. +..#.########.#... + +......##....# +.#.#.##...#.# +.##.#..#..#.# +.##.#..#..#.# +.#.#.##...#.# +......##..#.# +....#.#....#. +...#.###...## +.#.##.#.###.. +###.....##.## +#.##..##...#. +###.#..##.##. +#..#######..# +#..#######..# +###.#..##.##. + +#.#.#.#.. +#.#.#.##. +#.#.#.##. +#.#.#.#.. +...#..... +#..#.##.. +....#...# +####....# +#####.... +.###.#.## +####...## +.#.#...#. +#....#.#. + +.########..## +.###..###.#.# +###....###.## +#...##...##.# +.########.#.. +#...##..##### +#.##..##.#... +....##....#.. +....##....#.. + +.........##..#..# +.#....#.######.## +.#....#.######.## +.........##.....# +.######.#..#.#..# +##.##.###.##..#.# +#########...#..#. +###..###...#.#### +#......#....#..#. +##....##.....###. +..####..##.#....# +.............#.#. +..#..#...####.... + +##......##. +....##..... +##..##..##. +..#.##.#... +..........# +..##..##... +####..####. +####..####. +#.##..##.#. + +......#..###### +######.#....... +.####.###..##.. +..##..##.#....# +.####.#...#..#. +..##..#.##....# +#.##.##..#....# +##..####....... +.####..#.###### +##..##..#.....# +......####.##.# +#....#......... +######..##....# +######....#..#. +#....#####....# + +##........... +..########### +##..###..###. +##.########## +..#.......... +##...#....#.. +..###..##..## +##.##.#..#.## +..#.###.####. +###.###..###. +....#..##..#. +##.#.#....#.# +...####..#### +....#.####.#. +##.##......## + +#.#....##.. +#..##...#.# +#.###..##.# +#.###..##.# +#..##...#.# +#.#....##.. +.#..####.#. +..#..###### +#..###.#.#. +.#.######## +.#.######## +#..###.#.#. +..#...##### + +....###.#.##..# +....###.#.##..# +#.##..####..... +#.##.....##..## +.#..##....#.##. +.#......##.#.#. +....#.#...###.# +....#.#...###.# +.#......##.#.#. +.#..##....#.##. +#.##......#..## +#.##..####..... +....###.#.##..# + +#..#..#..##.. +#.##......... +#.##......... +...#..#..##.. +##..#.#.###.. +#.#.######### +...#.##....## + +..########..#.### +....####....#.#.. +........#...###.. +..##....##...##.. +####....####.#.## +###..##..###.#.## +#....##....###.## +###......####.#.. +#.##.##.##.##..## + +.####.##. +......##. +..##..... +..##..##. +#....#..# +##..##..# +#....###. +##..##..# +##..##### + +####..####### +.##....##..## +..######....# +..##..##....# +#...##...##.. +#.#....#.##.# +#.######.##.# +###....###### +###.##.###### +.#..##..#..#. +##....#.####. + +###.#.#..#.#.## +##..##....##..# +..#.########.#. +##.#..#..#..#.# +###..##..##..## +##.#.#....#.#.# +..#.#......#.#. +####.######.### +##.##.#..#.#### +..##.#....#.##. +..#.##.##.##.#. +..#.#.#..#.#.#. +###.########.## +###.#......#.## +##...#.##.#...# + +#...... +##..### +##..##. +#..#... +..##... +###.#.. +.##.### +..#.... +#....## +#....## +..#.... + +.#####....##.#... +..####....##.#... +##.#.####..#.###. +##...##...#..#.#. +##...##...#..#.#. +##.#.####..#.###. +..####....##.#... +.#####....##.#... +.#..##......###.. +#.#####...###.##. +....#..#.#..##### +..###....##...... +.#...###...#.##.# +#...#.....#..##.# +#..##.###.#..#.#. +.#...#....###.#.. +##..#..###......# + +###.##.## +##.####.# +##.#..#.# +####..### +....##... +##.#..#.# +...#..#.. +##..###.# +##......# +##......# +..#.##.#. +...#..#.. +##.####.# +....##... +...####.. +....##... +##.####.# + +###..##.# +#####.... +.##.#.##. +#.#.###.. +##...#..# +#.#.##.#. +#####.##. +###.#.... +###.#.#.. +###.#.#.. +###.#.... + +..#...# +..#...# +.....#. +#.#.#.# +.###.#. +###.#.. +##....# +#.#.#.# +###..#. +.###..# +.###..# +###..#. +###.#.# +##....# +###.#.. +.###.#. +#.#.#.# + +.###..... +...###..# +....##.#. +#.#..###. +#.#..###. +....##... +...###..# +.###..... +.###..... +...###..# +....##... + +########...##.# +########.#.#... +##.##.####.#### +########.##...# +#......##..#### +##....##.###..# +##.##.##.##..## +##....###..#### +###..#####..##. +..####...#####. +..####...#####. +..####......#.# +#########.##..# +..........##.#. +..#..#...###..# + +###.#.###.... +####...##..#. +..#..##...##. +..##.#######. +###.#.####..# +##.....####.. +...####..#..# +..###.#.#.##. +##....###...# +..##..##.#### +###.##.####.# +..####.....## +...#.#..#.#.. +...#.#....#.. +..####.....## + +#..#... +.##...# +.##..#. +.##..## +.##.#.# +.##.#.# +.##..## +.##..#. +.##.... +#..#... +....#.# +.##.... +####.## +####.#. +....### + +#.#..#.#.#.....#. +...##...#.#.#.#.# +.######.#.......# +..#.##..#..###.## +###..####.##.#..# +#......######.... +############.#.## +.#.##.#...#.##### +.#.##.#.##..#.#.. +.........#.#.#.## +........#.#.#..## +###..####.##.#..# +.##..##..#.###..# +.##..##..#.###..# +###..####.##.#..# +........#.#.#..## +.........#.#.#.## + +###.####.###### +....#.......##. +.#..####..#.##. +#.##.##.##.#### +.#..#..#..#.... +..#..##..#..##. +#...####...#..# + +....### +#...#.# +.###### +..##### +....#.. +.###.## +.##.#.. +..#.... +....#.. +..##### +.#...## +#...### +#...### +.#...## +..##### + +####.###..###.# +#.##.########.# +....##......##. +...##..#.##..## +....##.#..#.##. +##..#.#....#.#. +......##..##... +#..##........## +..#...#....#... +.##...#.##.#... +.##...#.##.#... +..#...#....#... +#..##........## + +.###.#..... +.##.##.#### +.####..#.## +#.##..#.##. +.#####..... +..##...#### +...#..#.##. +...#..#.... +...#..#.... +...#..#.##. +..##...#### + +.....#..#.. +...###..##. +#####.#.#.# +.##..#.#.## +#..#..#.#.# +#..######.# +....##..##. +....##..##. +#..######.# + +##.###.##.# +.##.#####.. +.#..#.##.## +.#..#.#..## +.##.#####.. +##.###.##.# +.#....#.### +.#....#.### +##.###.##.# +.##.#####.. +.#..#.#..## +.#..#.##.## +.##.#####.. +##.###.##.# +#..#..#.#.# + +###..###.#.## +.##..###.#.## +..###.#.#..#. +.#......####. +#...#...###.. +.#.#####.##.# +.#.#####.##.# +#...#...###.. +.#......####. + +.##.##...##...##. +#####..##..##..## +.....##..##..##.. +.##.#.#.####.#.#. +.##...#.#..#.#... +....#..........#. +#..#..#......#..# +....###.....####. +.##...#.#..#.#... +.....#..####..#.. +#..#...##..##...# +....#...#..#...#. +#..#.##########.# +#..##...####...## +#####.##.##.##.## + +...##...####### +.##..#..##..... +.#....#....#..# +.##..##.....##. +###..####.#.... +##.##.##.###..# +########.###..# +.#....#.###.... +#.#..#.##..#..# +..........##..# +########.##.##. + +..##..... +...###..# +#...##..# +.###.#### +##...#### +##....... +...##.##. +#..#..##. +...#..... +...#..... +#..#..##. +...##.##. +##....... +##...#### +.###.#### +#.#.##..# +...###..# + +.#..##..#.##... +..#.##.#..##### +.##.##..#..#.#. +.########.###.# +..#....#..#.##. +##..##..###.... +##..##..###.... +..#....#..#.##. +.########.###.# + +#####..###.#.## +###....##.#..## +##....####..... +...#.#..##.#.#. +..#.#..#.#..... +...#..###..#..# +..##..###..#..# +..#.#..#.#..... +...#.#..##.#.#. +##....####..... +###....##.#..## +#####..###.#.## +..###...#....#. +##.#...#..##... +###.#...##.#.#. +..###.#....#.#. +..#####...###.# + +..##.####..#..# +..#.###..##.##. +##.#..##.###..# +##.#.#.####.... +###..#.#.##.... +####.#.##.##..# +##.##....###..# +###########.... +..#.##..####..# +...##..#.#.#..# +....####.###### +..#...#.#.#.##. +###...##..##..# +##.#...#.#.#..# +##.#.#.....#### +..##..###.##..# +##.#.#....####. + +#..#..##... +#..#..##... +.#..#.#...# +#...##..### +###.###.### +##...##.### +..##...##.. +##....#.#.. +#.#...###.. +###.#...#.. +......##... + +#....###. +#....###. +.#..#.### +#....##.. +.......#. +#.#..###. +#.##.#.#. +.......#. +.####.##. +##..##.## +.####.#.# + +....#.##### +..#.#...... +###.##..##. +..#.#...... +.....#.#..# +.#...#.##.# +..###...... +#..#####..# +#.##...#### +##.###..##. +.#.##..#..# +..####.#..# +#......#### +##....#.... +#####..#### +#####..#### +##....#.... + +....#........ +#..#.#.#...#. +....#.......# +.##..#.##.... +....##...#### +#..#.##..###. +####.##....#. +####.#.#..##. +......#....## +....###..##.# +.##..#.#....# +.##..#.##...# +....###..##.# +......#....## +####.#.#..##. + +....### +.#.#### +..####. +##.#.## +##.#.## +..####. +.#.#### +....### +###...# +###...# +.....## + +.#...###... +..#.####### +#..#.##.### +....##..... +..#.##..### +...#.##.### +.#.##.#.... +.##.#..##.. +#.####...## +#.##....... +#.##...#... +#.####...## +.##.#..##.. +.#.##.#.... +...#.##.### + +.#..#.### +#....#... +######... +#....##.. +.######## +######... +##..##### +.#..#.#.. +.......## + +##....#.##..##. +#...#####.####. +.#.##.#....#..# +#.....#####.... +.#...#....####. +#.#..#...#..#.# +#.#..#...#..#.# +.#...#....####. +#.....#####.... +.#.##.#....#..# +##..#####.####. +##....#.##..##. +.##...#..#...## +#.######..##.## +........#####.. +........#####.. +#.######..##.## + +.#..#.#...##.#. +..#..#....#.### +#.#.#..#.#.##.. +#....##....#### +#.###.#.##.##.# +##..#...###...# +##..#...###...# +#.###.#.##.##.# +#....#.....#### +#.#.#..#.#.##.. +..#..#....#.### +.#..#.#...##.#. +.#....##.####.. +#.#.#####.#...# +#.#.#####.#...# + +.#.####.####.## +.#.#.#........# +###.#...#..#... +###.#...#..#... +.#.#.#........# +.#.####.####.## +..##..##.##.#.. + +#..####.#.##...## +.....###.#####..# +......##.#..##.## +....#.#.#.##.#..# +....#.#.#.##.#..# +......##.#..##.## +.....###.#####..# +#..##.#.#.##...## +#..####.#.#.####. +.##.####.#.#...#. +.##.###...##..##. +####.#.#...#.#..# +####.#.###.#..### +#..#####....##.#. +#..#####.#..##..# + +#.####.#### +##....##..# +#......#### +.#.##.#.... +..####..##. +..####..##. +.#.##.#.... +.#.##.##..# +.##..##.##. +..####..... +#.####.#..# + +..#.#..#.###....# +.#.######.##...## +#.#.###..##..###. +.#...#####.#..#.. +#.##.#.#..#.#..## +#.##.#.#..#.#..## +.#...###.#.#..#.. +#.#.###..##..###. +.#.######.##...## +..#.#..#.###....# +..#.#..#.###....# + +....#.##... +.#.#..#..## +.#.#..#..## +....#.###.. +.......#.## +..##.#...## +...#.#..... +####..#...# +#..#.#...#. +#..#.#...#. +####..#...# +...#.#..... +..##.#...## + +..######... +..#.##.#..# +#.##..##.## +#.##..##.#. +..#.##.#..# +..######... +##..##..##. +.#..##..#.. +.#..##..#.# +###....#### +..#.##.#... + +#......####.. +..#..#......# +.##..##.##.## +.#.##.#....#. +..#..#..##..# +#..##..####.. +##.##.######. +########..### +#..##..##.#.. +.##..##....## +.##..##....## +.######....## +...##...##... + +.####..## +..####### +.#......# +##..#.#.. +####..#.. +..#....#. +..#....#. +####..#.. +##..#.#.. +.#......# +..####### +.####.### +#..#.##.. +#..#.##.. +.####.### + +#.#..#..#...... +##...####..#.## +####..#.#..#.## +.##..###.#.#..# +..#.##.####.... +.#..##..##.##.. +##.###.##.#.### +#..#.#..#.##.## +##..#####....## +####..#.####..# +#.....#.####.## +......###....## +..#...###....## +.##.##.###..### +.##.##.###..### +..#...###....## +......###....## + +####..#.. +.....##.# +...###... +.....#.## +....##.#. +##.#.#.## +##.#.#.## +....##.#. +.....#.## +...###..# +.....##.# + +######...###... +#.##.#.##....## +......##..###.# +#....##....#.#. +.......##...#.# +#######.#...#.# +#######.#...#.# +.......##...#.# +#....##....###. +......##..###.# +#.##.#.##....## +######...###... +.####.##..####. +#.##.#..###.... +..##.....##.#.# + +#.######.##.#.# +#..####..#.###. +..........#.#.. +..#.##.#....... +..#.##.#....... +..........#.##. +#..####..#.###. +#.######.##.#.# +###....#######. +...#..#.....#.# +.#..##..#.###.# +.##.##.##.#..## +.#.####.#...##. + +##.#..#..##..#..# +##.#..##....##..# +#.#....#.##.#.... +....##.##..##.##. +###.##..#..#..##. +.#####...##...### +...#####.##.##### + +###..####.. +##...#..... +##...#..... +###..####.. +#.#......## +.##....#.## +.###.#....# +#..##....## +.##......## + +........#..## +........#.### +........#..#. +#######.#..#. +.#..#...####. +##..###.###.# +#.##.#....### +########..... +#....##.....# +##..###..###. +.#..#.#.####. +......####..# +..##..##.#... + +....#.#..##.#.#.# +....#.#..##.#.#.# +..#####.##...#.#. +###..#..##....#.# +###.#....#...#### +#..#..#.#...###.. +#....###.#.###### +..#..##.#..#..##. +..#..##.#..#..##. +#....#.#.#.###### +#..#..#.#...###.. +###.#....#...#### +###..#..##....#.# +..#####.##...#.#. +....#.#..##.#.#.# + +...#.##...### +...#.##...### +...##.###..## +.##..#.##...# +#..#..#.#..## +.#....##.#.## +..#.#.###..#. +..#.#.###..#. +.#....##.#.## +#..#..#.#..## +.##....##...# +...##.###..## +...#.##...### + +###.######. +##.#.####.# +..#.#.##.#. +..#.#.##.#. +...#.#..#.# +..##.#..#.# +##...####.. +..###....## +###.#.##.#. +##.#.#..#.# +##......... +####.####.# +###..#..#.. +..#......#. +....#....#. + +#..###.##..##.# +.##...#......#. +##.###.##..##.# +##.#.########## +###.##.######.# +#.#...#......#. +..#..#........# +..#..#........# +###...#......#. + +..#.####. +..##.##.# +###.#..#. +#.#...... +.....##.. +.#.###### +.######## + +..#..#..###...##. +#####.#...#..#... +.......#.#.#.##.# +#...#.........##. +.#.##.#.....#.... +.#.##.#.....#.... +#...#.........##. +.......#.###.##.# +#####.#...#..#... +..#..#..###...##. +#..#..#...#...### +#.#.#.###.#...#.. +#.#.#.###.#...#.. + +....#..#..... +##........### +#....##....#. +##........##. +...#.##.#.... +####....####. +.....##...... +....#..#..... +..##.##.##... +..##.##.##... +...##..##.... +.....##...... +####....####. + +...........#. +.........#.#. +##.##.##..### +.........##.# +#..##..###### +#.#..#.#..#.# +..####..#.#.. +..#..#..#.### +#.#..#.#...#. +.##..##....#. +########.#.## + +.##......##..##.# +.##......##..#..# +.#...##...#.#.... +...#....#...#...# +.#.##..##.#..#.#. +..##.##.##......# +###..##..###..### +.####..####.#.#.# +............##.## + +...##....##.... +.####.##.####.. +.####.##.####.. +##..##..##..### +.#.#.#..#...#.. +##.#.####.#.### +#..#..##..#..## +#.#........#.## +#...##..##...## +#....#..#....## +...#.#..#.#.... +##.###..###.### +####.####.##### + +..#...##...#. +#.##.####.##. +##.#..##..#.# +....######... +....##..##... +...#.#..#.#.. +##.#.####.#.# +..###.##.###. +###.#.##.#.## +..#..####..#. +....#.##.#... + +#......##..##.. +#.####.#.###### +...##....##..## +...##...#.#..#. +##....##.##..## +..#..#.###.##.# +#.####.#.#....# +##....##.##..## +.#....#...#..#. +...##...#.####. +#.#..#.#.#.##.# +..####..#.#..#. +#########.#..#. +...##.......... +.##..##....##.. +.######..###### +###..###....... + +#..#......#.# +#####.#..#.## +....###..###. +#..##.####.## +.##..#....#.. +#..##.####.## +.##..######.. +#..##..##..## +####..#..#..# +.......##.... +.....##..##.. +######.##.### +.##.########. + +######.#. +##..#.#.. +##..###.# +##.##.#.. +.##...##. +#....#### +#....#### +.##...##. +##.##.##. +##..###.# +##..#.#.. +######.#. +######.#. + +.##..#### +.###.##.# +.####.... +..#.###.. +.#..#.... +.######## +.##.##... +.###..### +.##..#### +##.#..... +##.#..... + +#..#.#....#...... +######.######.##. +####..####...##.# +.##...##.####.#.. +.##...##.####.#.. +####..####...##.# +######.######.##. +#..#.#....#...... +###.#######.....# + +#..##.###.##### +#..######.##### +.####.##.#.##.# +..#.##...#.#.## +#..######...#.. +#..######...#.. +..#.##...#.#.## +.####.##.#.##.# +#..######.##### +#..##.###.##### +####.####.#..#. + +.........####.##. +#####.#.#..#.##.# +.##.##...#...#.#. +#..#...#.#.....#. +#..#...#.#.....#. +.##.##...#.#.#.#. +#####.#.#..#.##.# + +.##..###### +#####.####. +#..##.#..#. +.###.###### +.##.##....# +#####...... +.##.#...... +.##........ +####...##.. +####....... +#..##..##.. +.##..###### +####.##..## +......#..#. +.##.#.####. +....####### +#####.#..#. + +#.##.#..##..#.# +.#..#..####..#. +.#..###....###. +#######....#### +.####.##..##.## +.#..#........#. +##..####..####. +#.##.###..###.# +#.##.##.##.##.# +.#..#..####..#. +.####..####..## +.#..#.######.#. +......#.##.#... +##..##.#..#.##. +.####.##..##.## + +###.####..# +##.#......# +...#..#...# +...#..#...# +##.#......# +##..####..# +##.#.#.#..# +..###.###.# +####.#.###. +##..#.#.### +...#....#.. + +.###..##..### +..#.##..###.. +##..#.#####.. +##..#.#####.. +..#.###.###.. +.###..##..### +..###....#.#. +...###..##..# +..#..#..#..#. +.##..##.....# +.##..##.....# + +...#.#..# +###..##.. +...#.##.. +##......# +##......# +...#.##.. +###..##.. +.....#..# +##.##.### +######.#. +.....#### + +.##...####### +....##.#.##.# +.##...##..... +.##..#..####. +######..####. +.##..##..##.. +.##.#..#....# +####..#..##.. +....#...####. +....#....##.. +#..#.##...... + +..##..# +.#.#..# +.#..##. +..##..# +..##..# +.#..##. +.#.#..# +..##..# +##.#### +.#.#..# +#.#.##. +.##.##. +#..#### +#.##... +#...... + +###.##....##.#### +###..######..#### +.....#.##.#...... +.#.###.##.###.#.. +..#.##....##.#... +###..#.##.#..#### +###..#....#...### +.#.#........#.#.. +.#..#.#..#.#..#.. + +.##.#.##..... +#.##.#.###... +#....##...#.. +....##.#..### +#.#.#.#...### +.#..###...#.. +##.....#...## +......#..#... +.##.#..###.## +#.###.#.#..## +#.#####...### +..#.#....##.. +..#.#..#.##.. +#.#####...### +#.###.#.#..## + +...##.#######.... +.....#..#..###### +##..#..###....#.. +##.#.#..##.###.## +..#.#.#..##.###.. +..#..#..##.##.#.. +.##..#..#..#.#.## +##...##..###..... +.......#.#.###### +####.##.#...#..## +###.#.#.##..##.## + +##.#.#..... +.#..###.#.. +####.#..### +##.....#... +.#.#.#...## +##...#.#### +..###...### +####..#.... +####.##.... +..###...### +##...#.#### + +###.#..#.## +..#......#. +...#.##.#.. +##..#..#.## +####.##.### +..###..###. +##.#....#.# +###......## +...#.##.#.. +####.##.### +###..##..## +##.##..##.# +...#....#.. + +#..###...####.. +#.####...####.. +##.###...####.. +...#..#..#..#.. +##...###..##..# +.##.##..#.##.#. +.#.#.#.###..### +#####.#.######. +.###.####....## +####...######## +.#..#.###....## +#........#..#.. +#..#.#.######## + +#...#..######.# +#.#...#....##.. +#.#...#....##.. +#...#..######.# +###.####.###... +.#.#..#..#..#.. +.#.#.###...#..# +######..#..#.#. +.#.####..#....# +#.....#..#.#.## +.##...#.#.....# +##...###..#.##. +...#...##.#..#. +#.#.#..#.##.#.. +#.#.#..#.##.#.. +...#...##.#..#. +##..####..#.##. + +#.#.##..#.. +...###..### +.####.##.## +##..##..##. +##.######## +.###.####.# +####......# +.#...#..#.. +###...##... +##...#..#.. +##.#.#..#.# +##.#.#..#.# +##...#..#.. + +..#.##.###. +..#.##.###. +#.######.## +.#..#..###. +.#.#....... +.#.#....... +.#..#..#.#. +#.######.## +..#.##.###. + +###........###### +..#.#....#.#....# +.#.##....##.#..#. +###.##..##.###### +...##.##.##...... +..##......###..## +.#.########.#..#. +.##..#..#..##..## +##..#....#..####. +.##.#.##.#.##..## +.###..##..###..## +##.#......#.####. +###........###### +.#.########.#..#. +.##...##...##..## + +#.#.#.#..#.###. +##....##.#.#... +#.#.###.#.....# +..##.##..###.## +..############# +..#######....## +..#....##.####. +..#....##.####. +..#######....## +..############# +..##..#..###.## +#.#.###.#.....# +##....##.#.#... +#.#.#.#..#.###. +#.#.#.#..#.###. + +........###.###.# +........###.###.# +.#.##.#..##..#.#. +###..###.#.#.##.# +##..#.##.#####... +..#..#..#..###.## +...##....#.##..## +##....##.####.... +#.#..#.##.#.##..# + +....#.#.###.#.. +.##........#### +.##.##..#.##.## +####.#...#..#.. +.......##.##.## +####..##.#..### +.##..###..##.## +...#.##.#....## +....####.#.#... +#..#######..#.. +#..###....#.### +.....#..#.#.### +.##...#.###..## +.......#..##.## +#..#..##...#### +.##.##.###..... +#..#.##.#.#.... diff --git a/2023/rust/day13/src/lib.rs b/2023/rust/day13/src/lib.rs new file mode 100644 index 0000000..03af2b8 --- /dev/null +++ b/2023/rust/day13/src/lib.rs @@ -0,0 +1,146 @@ +pub fn part1(input: &str) -> u32 { + let mut res: u32 = 0; + + let m: Vec<Vec<String>> = input + .trim_end() + .split("\n\n") + .map(|x| { + x.split('\n') + .map(|y| y.chars().collect::<String>()) + .collect() + }) + .collect(); + + for s in m { + let n = s.len(); + + // Search by column + // 012345678 + // >< + // #.##..##. + // ..#.##.#. + // ##......# + // ##......# + // ..#.##.#. + // ..##..##. + // #.#.##.#. + // >< + // 012345678 + // + let m = s[0].len(); + let mut mc = 0; + for i in 0..m { + let mut j = m - 1; + while j > i { + let mut s1 = String::new(); + let mut s2 = String::new(); + for k in 0..n { + s1.push(s[k].chars().nth(i).unwrap()); + s2.push(s[k].chars().nth(j).unwrap()); + } + if s1 == s2 { + mc = std::cmp::max(mc, i); + } + j -= 1; + } + } + + let mut check = true; + + let mut i = mc; + let mut j = mc + 1; + + while i > 0 && j < n { + let mut s1 = String::new(); + let mut s2 = String::new(); + for k in 0..n { + s1.push(s[k].chars().nth(i).unwrap()); + if j >= s[k].len() { + break; + } + s2.push(s[k].chars().nth(j).unwrap()); + } + if s1 != s2 { + check = false; + break; + } + i -= 1; + j += 1; + } + + if check { + res += (mc + 1) as u32; + continue; + } + + // Search by row + let mut mc = 0; + for i in 0..(n / 2) + 1 { + for j in ((n / 2)..n).rev() { + if s[i] == s[j] { + mc = std::cmp::max(mc, i); + } + } + } + + let mut check = true; + + let mut i = mc; + let mut j = mc + 1; + + while i > 0 && j < n { + if s[i] != s[j] { + check = false; + break; + } + i -= 1; + j += 1; + } + + if check { + res += (mc + 1) as u32 * 100; + continue; + } + } + + res +} + +// pub fn part2(input: &str) -> u32 { +// let mut res: u32 = 0; +// +// res +// } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 405); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 2331); + } + // + // #[test] + // fn example_part2() { + // let input = include_str!("../example.txt"); + // let result = part2(input); + // assert_eq!(result, 2286); + // } + // + // #[test] + // fn input_part2() { + // let input = include_str!("../input.txt"); + // let result = part2(input); + // assert_eq!(result, 71585); + // } +} diff --git a/2023/rust/day15/Cargo.toml b/2023/rust/day15/Cargo.toml new file mode 100644 index 0000000..f52c8dc --- /dev/null +++ b/2023/rust/day15/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day15" +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/rust/day15/example.txt b/2023/rust/day15/example.txt new file mode 100644 index 0000000..4f58f74 --- /dev/null +++ b/2023/rust/day15/example.txt @@ -0,0 +1 @@ +rn=1,cm-,qp=3,cm=2,qp-,pc=4,ot=9,ab=5,pc-,pc=6,ot=7 diff --git a/2023/rust/day15/input.txt b/2023/rust/day15/input.txt new file mode 100644 index 0000000..b12bf11 --- /dev/null +++ b/2023/rust/day15/input.txt @@ -0,0 +1 @@ +fnln-,bkxf-,spfc=9,ds-,trzx-,dtck-,xs-,bg=4,fgmpc=5,xmxf=1,cl=9,md-,ct=2,ftz=5,xhd-,vkqx-,hxd=6,mlcn=6,ctdbt=6,txpsv-,nkx=3,jfz-,fzm=3,rvcd=4,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=3,cq-,pt-,vttk-,px-,smtd=7,ctf=8,zn=4,kl-,jjd=4,bzj=7,cnn-,mtx-,pzd=1,ssmflk=4,jgmnxd-,ccf=4,jmthd-,vnhfc=7,srp-,qxj=7,chpn-,nh=2,kkcd-,dm-,mmsz=4,fnln-,lq=6,kkc=1,bq-,nl=3,mmn-,jfz-,zf=4,sl=3,sqd=7,dtt=3,ql-,jmthd-,ndmt-,vqc=2,jjd=2,jpc=4,vrc=9,kpn-,gs-,mjz-,ftz=7,bq=5,cv-,xv=2,mktlhp=9,cmbv-,mtx=6,ggqq=7,fq-,rknz=3,xxj-,zngsp=3,rsn=5,xrb=3,vrc-,fb-,phsl-,plp-,pl=9,cr-,vpxv-,lk=4,khx-,rpgj=2,kd=7,md-,dvz-,rl-,dkz=9,fsz=8,vq-,pm-,xf=7,tv-,tk-,dz-,qqp-,bg=7,xb-,nfgp=9,ng=7,kfp=2,mp-,vbz-,lxg=5,xqv=1,npd-,pvv-,xzl-,slzd-,dmp-,jzxp-,dphx-,txpsv=7,mldgtn-,ql=2,xgk-,mv=7,rl=7,kjrc=6,rl-,jfz-,ctdbt-,tdl-,fq=6,lcr=6,hzlzn-,qpx-,nbtq-,td-,mr=8,zngsp=4,vps-,ssmflk-,djmlb=9,pxn=7,cqq-,nlcrm-,rt-,vgln=9,gn=2,nsxz-,cfnbp=2,xrb=8,ts-,bfz-,lh=1 diff --git a/2023/rust/day15/src/lib.rs b/2023/rust/day15/src/lib.rs new file mode 100644 index 0000000..e9d36eb --- /dev/null +++ b/2023/rust/day15/src/lib.rs @@ -0,0 +1,56 @@ +pub fn part1(input: &str) -> u32 { + let mut res: u32 = 0; + + let inputs: Vec<String> = input.trim_end().split(',').map(|x| x.to_string()).collect(); + + for i in inputs { + let mut s = 0; + for ch in i.chars() { + s += ch as u32; + s *= 17; + s %= 256; + } + res += s; + } + + res +} + +pub fn part2(input: &str) -> u32 { + let mut res: u32 = 0; + + res +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 1320); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 2331); + } + + // #[test] + // fn example_part2() { + // let input = include_str!("../example.txt"); + // let result = part2(input); + // assert_eq!(result, 2286); + // } + // + // #[test] + // fn input_part2() { + // let input = include_str!("../input.txt"); + // let result = part2(input); + // assert_eq!(result, 71585); + // } +} diff --git a/2023/rust/day2/Cargo.toml b/2023/rust/day2/Cargo.toml new file mode 100644 index 0000000..8aa34bb --- /dev/null +++ b/2023/rust/day2/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day2" +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/rust/day2/example.txt b/2023/rust/day2/example.txt new file mode 100644 index 0000000..295c36d --- /dev/null +++ b/2023/rust/day2/example.txt @@ -0,0 +1,5 @@ +Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green +Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue +Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red +Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red +Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green diff --git a/2023/rust/day2/input.txt b/2023/rust/day2/input.txt new file mode 100644 index 0000000..249bfe4 --- /dev/null +++ b/2023/rust/day2/input.txt @@ -0,0 +1,100 @@ +Game 1: 18 red, 8 green, 7 blue; 15 red, 4 blue, 1 green; 2 green, 17 red, 6 blue; 5 green, 1 blue, 11 red; 18 red, 1 green, 14 blue; 8 blue +Game 2: 16 blue, 12 green, 3 red; 13 blue, 2 red, 8 green; 15 green, 3 red, 16 blue +Game 3: 6 green, 15 red; 1 green, 4 red, 7 blue; 9 blue, 7 red, 8 green +Game 4: 8 red, 2 blue; 11 red, 5 blue, 1 green; 12 red, 1 green, 5 blue; 1 blue; 2 blue, 9 red +Game 5: 9 blue, 3 red, 12 green; 3 green, 4 red, 17 blue; 15 blue, 2 green, 5 red; 3 blue, 5 green, 6 red; 6 red, 4 blue, 7 green; 3 green, 10 blue +Game 6: 11 red, 2 blue, 6 green; 2 blue, 9 red, 4 green; 3 blue, 12 red, 8 green; 5 red, 11 green, 4 blue; 2 blue, 9 red, 13 green; 15 red, 3 blue, 7 green +Game 7: 2 red, 9 green, 12 blue; 14 blue, 1 green, 6 red; 7 blue, 9 green; 9 green, 8 red, 4 blue; 5 red, 3 green, 16 blue; 4 red, 8 green +Game 8: 11 red, 12 green, 1 blue; 4 red, 7 green; 11 red, 6 green; 17 green; 15 green, 1 red +Game 9: 1 red, 1 green, 12 blue; 3 green, 12 red, 6 blue; 14 red, 1 blue; 9 blue, 1 red, 3 green +Game 10: 1 red, 4 blue; 3 blue, 4 green; 3 green, 3 red, 8 blue; 2 blue, 3 red; 3 green, 4 red, 3 blue +Game 11: 8 blue, 1 red; 8 green, 1 red, 1 blue; 13 green, 9 red, 6 blue +Game 12: 2 red, 2 blue, 1 green; 3 red, 1 green; 1 blue, 3 green +Game 13: 12 green, 4 blue; 2 red, 2 blue, 8 green; 6 green, 3 red; 3 red, 5 green; 9 green, 7 blue, 1 red +Game 14: 1 red, 7 green; 5 green, 12 red, 10 blue; 9 red, 11 blue, 7 green; 7 blue, 3 red, 9 green +Game 15: 7 green, 1 blue; 1 red, 2 green, 1 blue; 7 green +Game 16: 1 green, 1 blue; 2 blue, 4 green, 2 red; 2 green, 2 blue +Game 17: 6 red, 11 green, 7 blue; 1 blue, 13 green, 4 red; 4 green, 6 blue, 7 red +Game 18: 2 red, 8 blue; 7 red, 11 blue; 1 green, 16 blue, 7 red; 18 blue, 1 green, 14 red +Game 19: 2 red, 2 blue; 1 green, 6 red; 1 green, 3 red, 2 blue +Game 20: 6 red, 2 blue, 5 green; 4 red, 1 blue, 9 green; 3 blue, 2 red, 9 green; 8 red, 12 green, 5 blue +Game 21: 6 red, 7 blue; 3 blue, 16 red, 2 green; 2 blue, 13 red; 3 blue, 11 red, 3 green; 1 green, 18 red, 6 blue; 12 red, 5 blue, 2 green +Game 22: 9 red, 6 blue, 14 green; 1 blue, 5 green, 13 red; 6 red; 18 red, 4 green; 2 blue, 10 green, 16 red; 1 red, 18 green, 1 blue +Game 23: 6 green, 4 red, 3 blue; 1 blue, 2 red, 9 green; 5 green, 1 red, 3 blue; 5 blue, 4 red, 4 green +Game 24: 1 red, 5 green, 2 blue; 4 red, 7 green, 9 blue; 9 blue, 7 green; 7 green, 13 blue; 4 blue, 1 green, 4 red +Game 25: 13 blue, 10 red, 11 green; 10 green, 1 blue, 3 red; 15 red, 5 green, 8 blue; 19 red, 10 green, 13 blue; 12 blue, 4 green, 16 red; 7 red, 5 green, 9 blue +Game 26: 20 red, 6 blue, 12 green; 15 blue, 17 red, 9 green; 19 red, 6 green, 3 blue; 8 green, 1 red, 15 blue; 10 green, 8 red, 5 blue; 4 green, 20 red, 18 blue +Game 27: 2 blue, 3 green, 7 red; 2 blue, 4 red; 5 blue, 5 green; 8 blue, 6 green, 2 red +Game 28: 1 green, 6 red; 3 red, 3 blue; 1 green, 4 red; 1 red, 2 blue; 2 red +Game 29: 8 blue, 1 green; 7 blue, 1 red; 6 red, 2 blue; 2 red, 3 green; 3 red, 6 green, 5 blue +Game 30: 11 blue, 17 green, 10 red; 9 blue, 12 green, 14 red; 16 green, 2 red, 8 blue; 18 green, 1 red, 1 blue; 5 blue, 7 red, 18 green; 9 green, 3 blue, 11 red +Game 31: 5 blue, 13 green; 2 green, 3 red, 4 blue; 3 red, 15 green, 2 blue; 5 blue, 19 green; 5 blue, 18 green; 3 green, 7 blue, 3 red +Game 32: 12 red, 2 green, 3 blue; 2 green, 16 red, 1 blue; 13 red, 4 green, 6 blue +Game 33: 18 green, 8 blue, 3 red; 15 green, 2 blue, 4 red; 14 blue, 3 red, 6 green; 20 green, 13 blue; 1 red, 19 green +Game 34: 1 green, 7 blue, 2 red; 8 green, 10 blue, 2 red; 3 blue, 1 green, 1 red; 6 green, 13 blue, 1 red; 1 green, 4 blue, 2 red; 1 red, 5 green, 7 blue +Game 35: 7 blue, 8 red; 2 blue, 3 red; 4 blue, 3 red; 7 red, 4 blue; 1 blue, 1 green, 3 red +Game 36: 1 red, 8 green; 1 red, 6 green; 3 green, 8 red; 1 blue, 2 red, 1 green +Game 37: 3 blue, 13 red; 2 blue, 7 red; 5 red, 1 green; 3 red, 3 blue; 1 blue, 12 red, 1 green; 14 red, 3 blue +Game 38: 7 blue, 18 red, 12 green; 11 red, 6 green, 1 blue; 9 green, 1 red; 9 green, 13 blue, 16 red +Game 39: 12 red, 3 green, 2 blue; 3 blue, 3 green, 10 red; 2 blue, 5 red; 2 blue, 1 green; 5 blue, 4 green, 7 red; 2 green, 1 red +Game 40: 1 red, 7 blue, 5 green; 1 red, 4 blue, 8 green; 3 red, 5 blue, 14 green; 10 green, 2 blue, 1 red; 11 blue, 7 green, 1 red; 14 green, 2 blue +Game 41: 8 green, 5 red, 3 blue; 5 red, 4 blue, 12 green; 10 green, 6 blue; 13 green, 7 blue; 1 red, 2 green, 15 blue +Game 42: 17 red, 1 blue, 5 green; 9 green, 16 red; 1 blue, 15 green, 2 red; 1 blue, 12 red, 12 green +Game 43: 12 green, 5 blue; 3 red, 8 blue, 10 green; 8 blue, 2 green, 1 red +Game 44: 1 green, 7 red, 2 blue; 1 blue, 10 red; 4 green, 3 blue, 19 red; 1 blue, 3 green, 1 red; 1 blue; 4 red, 2 green, 3 blue +Game 45: 16 red, 12 blue, 1 green; 13 blue, 16 red, 9 green; 7 green, 3 red, 8 blue +Game 46: 1 red, 17 green, 6 blue; 6 blue, 1 red, 3 green; 12 green, 1 blue; 4 blue, 2 green +Game 47: 2 green, 12 red, 15 blue; 9 blue, 2 green, 2 red; 3 green, 6 blue, 2 red; 11 blue, 3 green, 5 red; 6 green, 9 red, 17 blue +Game 48: 5 blue, 6 red; 7 green, 14 red, 4 blue; 2 green, 5 blue, 2 red; 11 blue, 5 red, 5 green +Game 49: 7 green, 7 blue, 4 red; 11 green, 12 blue, 2 red; 12 blue, 4 red, 9 green; 3 red, 8 blue, 17 green; 16 green, 3 red, 14 blue +Game 50: 5 green, 4 red, 10 blue; 7 green, 14 red, 5 blue; 12 red, 18 blue, 14 green +Game 51: 12 green, 3 blue; 10 green, 4 blue, 2 red; 3 green, 5 blue +Game 52: 12 green, 6 red, 7 blue; 20 green, 6 red, 18 blue; 1 green, 5 blue, 11 red; 2 green, 15 blue, 6 red +Game 53: 6 red, 2 green, 5 blue; 13 green, 1 blue, 14 red; 7 green, 1 blue; 3 green, 4 blue, 6 red; 10 red, 6 green, 4 blue +Game 54: 4 blue, 1 red; 1 red, 1 blue, 9 green; 3 red, 2 blue, 4 green; 3 green, 2 red, 5 blue; 9 blue, 2 red, 7 green +Game 55: 7 blue; 6 blue, 1 red; 4 red, 7 blue; 3 red, 3 blue, 1 green +Game 56: 2 green, 7 blue; 3 red, 10 blue; 1 green, 2 red; 3 red, 8 blue, 4 green; 1 green, 11 blue, 3 red; 2 green, 8 blue +Game 57: 3 red, 1 green; 1 green, 1 red, 1 blue; 1 red, 4 green, 15 blue; 9 blue, 2 red, 1 green +Game 58: 12 blue, 13 red, 5 green; 2 blue, 6 green; 12 red, 15 green, 7 blue; 5 red, 4 green, 14 blue; 15 red, 2 green, 9 blue +Game 59: 5 green, 5 blue; 4 red, 6 blue, 2 green; 5 blue, 3 green, 6 red; 3 red, 6 green, 4 blue; 3 blue, 7 green, 10 red +Game 60: 1 red, 1 blue, 3 green; 1 red; 3 green, 6 blue; 6 blue +Game 61: 7 green, 1 red, 1 blue; 4 red, 3 green, 1 blue; 7 blue, 7 green; 11 blue, 2 green, 5 red; 5 red, 4 green, 5 blue +Game 62: 17 green, 2 red, 3 blue; 1 red, 3 blue, 2 green; 1 green, 3 blue, 2 red; 1 red, 17 green; 2 red, 15 green, 4 blue; 5 green +Game 63: 2 green, 4 red, 3 blue; 9 blue, 10 red; 1 green, 13 blue, 2 red; 2 green, 1 blue, 5 red +Game 64: 6 red, 8 blue; 3 red, 6 blue, 5 green; 13 red, 11 blue, 8 green; 11 red, 3 blue, 1 green +Game 65: 4 green, 1 blue, 2 red; 3 blue, 3 green, 11 red; 6 green, 3 blue, 3 red; 5 red, 4 blue; 8 red, 5 blue, 2 green +Game 66: 10 green, 13 red; 1 blue, 2 red, 4 green; 7 red, 7 green; 19 green, 9 red, 1 blue; 16 green, 16 red, 2 blue; 10 red, 11 green +Game 67: 3 blue, 4 green, 2 red; 6 blue, 19 red; 4 blue, 2 red, 5 green; 4 green, 5 blue, 1 red +Game 68: 13 blue, 15 red, 7 green; 5 blue, 20 red; 6 green, 12 blue, 8 red; 5 blue, 8 green +Game 69: 13 red, 13 green; 13 green, 3 red, 1 blue; 8 green; 9 green, 9 red +Game 70: 8 blue, 11 red, 2 green; 12 red, 2 blue; 13 red, 6 blue, 3 green; 7 blue, 3 green, 5 red; 15 red, 1 blue, 3 green +Game 71: 7 red, 9 green; 4 blue, 9 green, 7 red; 4 blue, 2 green; 6 blue, 2 red, 9 green +Game 72: 14 blue, 1 green; 4 red, 1 green, 9 blue; 6 blue, 8 red, 2 green +Game 73: 17 green; 10 blue, 2 red, 9 green; 1 green, 10 blue, 2 red; 8 blue, 1 red; 5 blue, 16 green +Game 74: 12 green, 6 red, 5 blue; 2 red, 4 blue, 10 green; 3 green, 4 blue, 2 red; 8 green, 2 red, 5 blue; 5 red, 2 blue, 2 green; 6 green, 1 red, 1 blue +Game 75: 4 blue, 19 green; 15 blue, 7 green; 18 blue, 5 green, 7 red; 16 green, 15 blue; 7 red, 4 green, 13 blue; 9 green, 13 blue +Game 76: 1 red, 2 green, 7 blue; 13 blue, 7 green, 1 red; 13 blue, 5 red +Game 77: 3 red, 10 blue, 6 green; 1 green, 2 red, 10 blue; 7 green, 1 red +Game 78: 11 green, 2 blue; 6 blue, 8 red, 5 green; 10 red, 6 green, 4 blue; 6 blue, 3 green, 10 red; 5 green, 6 red +Game 79: 4 red, 6 blue, 1 green; 1 red; 2 green, 3 blue, 4 red; 4 red, 1 green, 2 blue; 2 green, 1 red +Game 80: 2 red, 1 green; 1 red, 1 green; 7 red, 1 green; 1 blue, 7 red, 3 green +Game 81: 1 blue, 15 red, 4 green; 2 green, 12 red; 4 green, 13 red; 1 blue, 3 green, 13 red; 12 red, 2 green, 1 blue; 3 green, 8 red, 1 blue +Game 82: 18 red, 4 green, 1 blue; 14 red, 1 green, 2 blue; 10 red, 2 blue, 7 green; 13 red; 3 red, 7 green, 1 blue; 5 red, 4 green +Game 83: 4 red, 10 green, 5 blue; 2 red, 12 blue, 13 green; 19 blue, 9 green, 1 red; 2 red, 14 blue, 3 green; 13 green, 8 blue, 5 red +Game 84: 12 blue, 7 red, 9 green; 1 blue, 1 green, 14 red; 1 green, 8 red, 11 blue; 11 blue, 12 red, 3 green; 11 blue, 8 green, 13 red; 7 green, 7 red, 10 blue +Game 85: 10 red, 2 blue; 11 green, 9 red, 4 blue; 3 red, 5 blue, 13 green; 5 red, 5 green; 5 red, 2 blue, 4 green; 11 green, 4 blue, 19 red +Game 86: 1 blue, 6 green, 2 red; 1 red, 1 blue, 8 green; 3 red, 1 blue, 4 green; 1 green, 4 red; 9 green, 2 red; 6 green, 7 red, 1 blue +Game 87: 8 green, 8 blue, 4 red; 5 red, 2 blue, 10 green; 3 red, 13 green; 1 red, 3 blue, 4 green +Game 88: 3 blue, 9 green, 3 red; 2 blue, 15 green; 2 red, 9 green +Game 89: 9 red, 6 green, 15 blue; 10 blue, 7 red, 2 green; 7 green, 16 blue, 4 red +Game 90: 1 red, 1 blue, 7 green; 7 green, 1 blue, 8 red; 3 red, 1 blue, 1 green +Game 91: 1 green, 2 red, 6 blue; 4 green, 4 red, 3 blue; 4 red, 11 green, 4 blue; 3 blue, 5 red; 8 green, 2 red, 8 blue +Game 92: 2 red, 3 blue; 3 blue, 2 green, 2 red; 9 red, 3 green +Game 93: 2 blue, 5 green; 2 green, 5 blue, 3 red; 2 green, 5 blue, 1 red; 7 blue, 4 red, 9 green +Game 94: 1 red, 9 blue, 14 green; 6 green; 2 blue, 11 green; 4 blue, 16 green, 1 red +Game 95: 10 green, 2 blue, 7 red; 4 blue, 4 red, 6 green; 3 red, 2 blue, 3 green +Game 96: 12 red; 3 green, 10 red; 6 blue, 14 red, 2 green; 7 green, 15 red; 3 green, 3 red, 1 blue; 5 blue, 1 red +Game 97: 3 red, 1 green, 1 blue; 1 green, 3 red; 4 red, 1 green +Game 98: 4 red, 5 green, 6 blue; 2 red, 9 green, 6 blue; 2 blue, 11 red, 14 green; 6 green, 4 blue; 11 blue, 11 red, 8 green +Game 99: 2 green, 20 blue; 12 blue; 3 red, 12 blue; 7 blue; 3 green, 10 blue, 2 red; 3 red, 2 green +Game 100: 2 blue, 8 green, 12 red; 2 green, 13 red; 2 red, 4 green; 2 green, 7 red; 10 green, 5 red, 1 blue diff --git a/2023/rust/day2/src/lib.rs b/2023/rust/day2/src/lib.rs new file mode 100644 index 0000000..e18469c --- /dev/null +++ b/2023/rust/day2/src/lib.rs @@ -0,0 +1,99 @@ +pub fn part1(input: &str) -> u32 { + let mut res: u32 = 0; + + for (i, line) in input.trim_end().split('\n').enumerate() { + let game = line.split(": ").collect::<Vec<&str>>()[1]; + let mut flag = true; + for point in game.split(";") { + for _play in point.split(',') { + let play = _play.trim(); + let play_s: Vec<_> = play.split(' ').collect(); + let (p, c) = (play_s[0].parse::<i32>().unwrap(), play_s[1].to_string()); + if c.chars().nth(0).unwrap() == 'r' && p > 12 { + flag = false; + } else if c.chars().nth(0).unwrap() == 'g' && p > 13 { + flag = false; + } else if c.chars().nth(0).unwrap() == 'b' && p > 14 { + flag = false; + } + } + } + + if flag { + res += (i + 1) as u32; + } + } + + res +} + +pub fn part2(input: &str) -> u32 { + let mut res: u32 = 0; + + for line in input.trim_end().split('\n') { + let game = line.split(": ").collect::<Vec<&str>>()[1]; + // r, g, b + let mut balls: [u32; 3] = [0, 0, 0]; + for point in game.split(";") { + for _play in point.split(',') { + let play = _play.trim(); + let play_s: Vec<_> = play.split(' ').collect(); + let (p, c) = (play_s[0].parse::<u32>().unwrap(), play_s[1].to_string()); + + let bi = match c.chars().nth(0).unwrap() { + 'r' => 0, + 'g' => 1, + 'b' => 2, + _ => panic!("wtf is this color?!"), + }; + + balls[bi] = if balls[bi] < p { p } else { balls[bi] }; + } + } + + println!("{:?}", balls); + let mut tot = 1; + + for j in balls { + if j != 0 { + tot *= j; + } + } + + res += tot; + } + res +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 8); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 2331); + } + + #[test] + fn example_part2() { + let input = include_str!("../example.txt"); + let result = part2(input); + assert_eq!(result, 2286); + } + + #[test] + fn input_part2() { + let input = include_str!("../input.txt"); + let result = part2(input); + assert_eq!(result, 71585); + } +} diff --git a/2023/rust/day3/Cargo.toml b/2023/rust/day3/Cargo.toml new file mode 100644 index 0000000..898e70d --- /dev/null +++ b/2023/rust/day3/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day3" +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/rust/day3/example.txt b/2023/rust/day3/example.txt new file mode 100644 index 0000000..b20187f --- /dev/null +++ b/2023/rust/day3/example.txt @@ -0,0 +1,10 @@ +467..114.. +...*...... +..35..633. +......#... +617*...... +.....+.58. +..592..... +......755. +...$.*.... +.664.598.. diff --git a/2023/rust/day3/input.txt b/2023/rust/day3/input.txt new file mode 100644 index 0000000..898bc27 --- /dev/null +++ b/2023/rust/day3/input.txt @@ -0,0 +1,140 @@ +............409..........784...578...802......64..............................486.248..............177....................369............... +.....-939..........524#...#....=.......*.........+......90.................................76..615..-..@.....961..........$.......*......... +............951*........................736...955..258....*.....253@.............210.10.....=...*.......776...*....&...............600..274. +152.78..........671.....936.......................*..........14...............................575.=.........214..519.....787.739........*... +...*....591......................514*155..........807...............516.............23...5#.......250.531...................*......-..71.... +.............................................254..........69&........*..............*....................*...............*........785....... +....5....../.42..908*166..242*825.....................19%............148..822......127..+...+...........971...........206.540.753........... +........111.........................%...............$..........635..........*..........222.286..823..........%................&...=630...... +..821&.......815.............424$...303.322.311..156...........*....786.....91..620............*....319......406......187..............&865. +........................&975...............*.........649.40..417.......+.........../............39....................*...........%......... +...300............546...........................640...=...................................319............246....883.253...690...526......435 +.................*......#..............571..121*.........542..938.13...532*....726....795.........%........*.............*...........683*... +......173.568.624....190................*..........*542....................464..*..................519.144..652.65......926................. +.......=....*..............................-...@................................592..658..78*537..........#...................303.200*...... +..780.....716.......858..527.775.....587.314...374.......375....777.166.............................................677*394.....*.....512... +....&..............*...........-......*......*.....900...*.../../............287..255.......431...........104..440..........803..844........ +...............%....875.............920...615.556......488.308....888........@.......$..522*..........511.*............/.....&.............. +........688....778.............410.................+...............*..#322......234...........692....*.....583.240+....800.............&.... +.......*........................*......844-.........683....941..341...............*..........#......637.....................=768..983.80.... +.......312...........113.........858........427.685........................*211..336..........................502........................... +......................*......151........293.+.....*...454................63.............39........831+.........%......./...$................ +..187........677......165....*......104..*.......145.@.........444..767...................*...975................659.352.844....*.160....... +......+.967.#..............116.........+..866...........=.......*......*404..............659.....*...............*............293...*....... +...801....*.....937............................/.........553..623....*........567....244......%...816....994.....510....173........547...... +...........609...............................783.....848..........511.718.....*.............116.........*......................&.......65.46 +102...................356..810......................*.....721..............244...$.....315...........&..605...22..........665.411..../...... +..................956*.....*......523.............622........*.................322........*........703............888.......*.......714..... +...896.....580.............146.....&..861..............327...766..93.......534...........482..327.........494.....*.......978............... +....*.........*..-.....&.........................701.....-.........*...429....................%...$.........*..895..................../..... +..561..517..994.248.596......&...$.....196.701.....*............217...*....160........240..+....265..471..76............509..15........245.. +.........*...............615.801.837......*......661.181...707......613...-.......495......959..........*....#...........*....$............. +.....-...107............@...................&................*.....................*....$............853.....808..249.160.......725......151 +....549......137..........288@...759.$......961....#..........................788.....846......920................../.......774............. +........865...%...993...........#.....850...........636.104..204.192...387...%............382.....+..&.......436........682*.......532...... +........................893*660...........................-.....*.........&......$........../.334....505.+....-..732*................*...... +........./....976....*..........35....178.18*970.752...+..........................567..258.......*.......829...........+..358*..*464..189... +.....676.319..........222......*.................*......559...604.......-.....687.....*..........16..........492......376................... +....*.............157.........909................266..........*.........971..+.....211..885...........$.......%.....@............#.......... +.284.....167.....*....83...........408....290...............538........................../....&.84*...885........575..........511..481...... +............*770..844.=..599..........*......*457.....$861................779..240...$......897..........................520%......*........ +...........................*..972.527.844.........................&........*..........26........957.................787.........759......... +...530#.396&.............670.*.....+.......*.....503*689....486#.558....522........................=..........629..%........................ +..................96*........320..........972...............................$..776.....................755...*...................265*53..265 +....48............................736...........*..........771..85..360..705......*501..793..................685........................*... +.....*...@705.233....648#..........+.........780.....13...=......*....*.........................*..................898%....282........478... +..186.....................369............327.........=.........14...472..........942...*.....817.......611....66-..........&......236....... +..................308*......#.......226.....&..............573..................*....85.9.........801..*..........217*........237*.......... +.........*............728......847...#................+.......*......267.....634.................=......979...........14...............364.. +....99.213.......=........468...............%446...647......%..822..../...........819................*.........469.........70.37.......*.... +.................143..762*....977.........................649..................../.....123....-...902.67..939..&.............*........793... +.......982...=......................................414...................477.........=......266..........=.............622*....672*........ +..........#.797...../608.......173...=.........................111...............219.....252....................438.726.....902.....25.=.... +......-..................863..*......805.9.......107..............*........151.....*........*234...422....995....*.....*................866. +....670...........544.....*....311.......*....$.$............................-..943.......*........*......=.......167...695................. +..................../......508..........278..78.........459+...........................922.201....513.518....985............476%............ +..556......905..341....683........732*..........437.753..........331*..342..374.475..@.................*....*.........591............+972... +.../.........*...*........*...........................*.....833.......*...............566....*..........460..621.836..*..................... +.............627..912......49.........289.....910...737.....*........645.....977..159.....707..104.644............-...872..........&....453. +.......................................*...../...............287.........375*........-.........*....*..723+...256...........361....184.*.... +...%..231.......187......8.....*569.138..................963.........184.........899........571...836..........*...*..........*.........349. +546...*............+....*....29...........885......20......./......................*.........................95.....660........470.......... +.....568..902........178.............313..*.........*...............706.....19....724....338..........880*......701........996......84.701.. +....................................*.....253..535.893........+.............=..............*..............520...............&......-........ +..............&..747............877..990................./.....45.........................604....&...................152......275.....%931.. +......515....26....=..128........*..........%.....753...374...........522*835.........838.....344...222..........602....+....*.............. +.....................*.....975....12......717.966*.............734.............486...*.................*.....634*..........431..%........645 +115.388......#......670...............................251..851....*.....666.....*..887.18..532......661..685.....................947....+... +...*..........977.........308...........279......63....*..........194..*.....886.........*.../.............*......543.419................... +....................355....*....489...............*.....496.............933......714....91.....558*669.....475.../....*..........501........ +...737..807.................545...*..............873............763....................................864..........152............*........ +......*..$...553......695..........623..319........................+..681./....@835..669...........530*.......................402.538....... +....334.....$.............................................186........*.....977.......*.....................82.....950.....985*...........751 +...................222......847.........347..............&.........213............+..168..........820&.......@...*....211............150*... +.....*520......................$.......*......630..............193.......597....266.........744..................950.....*...584............ +..947.......................@.....903.....889*.......693......-.........*......................*365..........846........655...*............. +......*609.........425.478..597.....*..................#..=........=...............469......*............721....*267..........872........... +...997.......975..........*.........419........630.691...646......939.................*..865.933.805*676....*............................... +.........102*....544..984.258.526.........*...=...........................@........473......................932......247...............955.. +.................*......=.......*........553....................517...600..344.....................742...............%....=...........+..... +....................351......970..........................280......*.....*........&.........782........................486..............&... +...........359...........604.......997...274....682.673....*..156.831.392.....@..228.814......*.........145.......835.............222.570... +..694...........+....157.%...848..*.....*.........$....*.246.+.............447.......*......259..@381......*54.....@............%.*......... +.....*.......433....#..........*..594.184...........743............196.........967.987.......................................649...941.@.... +......97......................386...............%........................839..............760.............151...&...344................871.. +.....................186..937.....*528.....263.179....#976....405...................+...............522........65...*...........*........... +......-893........+....*....*..........@.........................#.401.....72+....719.104.....731...*....31#......93..274+....41.348........ +...........854.....855...879.........950.....342....771...............................*.......*....546...................................... +........$......601...........526*943.........*....#..*..............124.&839..#......161....558...............140........................... +.......131.................................665.266...732.....949......*.......31................@754...*...........932*................&.... +...............169....889.....271*613........................*.....194...+............................107..............142....551*925.56.... +........267.....%....*...................................281.750.......563...........848.477..655..........674.............................. +............312....716.......................#.....802.....*.......281......../.........*......*...........*...708.......................... +.......594..*...............359....462*......405.....=...............&.........439.........759....*........987....*330...................... +736....*.....580.....26.......*.........................467.........................456...*.....13.102.460..................693.....960..... +........227..........&...861...523.554..877.............=.....429................./........383...........*......$.......623....*.........651 +....568........988......+..................%.....................*689.......@..691...39.........=.....123.......869...........1.........$... +....+.....892......581*.............876....................................603.........*......399......................927-................. +.........*....-........611............*....+......443.=.....856.%559................679..592....................853.........925...34........ +...26.303.....944...........726.....444.....961....*...433....*......*215...26...95.............82...........................*.....@./...... +..........710......130..........13..............443../.....391....260......&.......*.....751....*...........................508.......555... +.........*.....958*.....93..235*......................460........................491.......*.....324.........$409..972...2.................. +....352..534...........*........./.........#.................580.........834................973......102.632......*.......*............48... +.................&...820.206..890..66....683....................%...*493.....256...$....................*................434.....884..&..... +.585/.........664........*...............................%...............512..*..914..188....*................941*...........282....@...+... +..........521.........168..../....94.139..............793...............*....827.....*....215..........24.............................787... +..790........*...............148...&.*.........................172.205..728...........153.......176......*963..649.....628......19.......... +......883....806.....686..............226...763.......................#...........229.............*...........*....321..-....../.......60... +.495....*....................................=..........21..357...839........*968...*............469........339....................../.*.... +......457.495.........@.....-.....89.613..........214..*......*.....$.....958.......341...%.....................645...274..37......82..465.. +...70.................932..83.787..*..$..........$.....218..787............................7..287...............*.......*....+.............. +....*..104...559...92...........*.373....$.............................163...........304.........*...........667.....547..67................ +.851................*.....267.189.........312...434...$837.........344.#..............=......604.679.......................@................ +....................883....-......258.896....................*.....-.......687..488............*...................615$..................... +.746................................*...+.173*605.....609...812........721..=..*...........582..906......../...85.........940.409..928...... +.......................136......49.493............../....@..............*.....721....857...*.............62......-...465....*..=......*..... +.................736.............*.........*.....968..........685..949.755............*.....37..*.............=....................*..53.... +466..621....812=..*......203....151.....828.48............871*......*............/.....764.....384.........37..905.............&.314........ +.....*.............575....*...........8..........#244............708...........131.....................546..*........641....189............. +...801........554..........772.............989.......................................751...523...117......*..538........*..........*........ +.......82/........+..202........*749..........*../....402...140%......................+.....*.......#..202............93..604*..438.567..128 +.307............564..........353............442...153.*.......................516..5.......414................131.......................*... +...........765.........259.......148...632..................722..348&..115.........-.............195.$186.729.......19*................602.. +...69.249....$......+.*......452..*.........288.........975....&......../.....865.................*.........*...744....423........756*...... +...*...=..........882..801..../..455..........=............-.........16........*..957..841......912..581....887..-...........745......464... +....62.................................734......544..........898.....*.......548..=....*.............+.............516..632....*............ +...............$..............977%......&...512*..............*.......473...............985.678..128.............+...*.....+..330........... +..942........181......831$................................430..399...........637*356..........*...../...........656...500.........135*403... +...*.........................501.6@..307....174*722..........*........................*281.663..............101............................. +.997..53.......-.......................*....................67.324%.117........=...227......................./.............385.......198..26 +.......@..634.669...............743.....869..........233...............*......948..........................#....817.......&...........*..... +.........%.........280..+.........-.66.............%...+......393.999..745..$.......$........472..940.......70.....*........$......+..615... +....................@..718..%464....*...........797..........*...............134.....38..560*........*..............388......307...49....... +..113.......274.800..............992.......373#......791.....775.873.................................227..849=.357.......................... +....*..........*........75..........................*....775........*..179......................................*......77.........=293..987. +...501..............766*...............26*805......692......*.....917....#.........................+.....483.413..........810...........*... +.......358.160..............555...798......................684.....................676..........229......*........+..815.................657 +..........*....432.........-......*..............................550....795...816...$.................758........193....-.......222%.666.... +......139...$.....#.894..........226.....826..........*248..850$..........#..*....@...........895*..8.....340.+...........922.........=..... +..892*....162.........*..................@.........249...........*............845..902...+................#....800..974....*................ +....................86...337...............710....................143.....................179.....976.......................419.........468. diff --git a/2023/rust/day3/src/lib.rs b/2023/rust/day3/src/lib.rs new file mode 100644 index 0000000..e70b994 --- /dev/null +++ b/2023/rust/day3/src/lib.rs @@ -0,0 +1,184 @@ +#[derive(Debug)] +struct Digit { + value: u32, + s: usize, // start index + f: usize, // start end +} + +#[derive(Debug)] +struct Symbol { + elem: char, + i: usize, +} + +fn parse(s: &String, border: &i32) -> (Vec<Digit>, Vec<Symbol>) { + let n: i32 = s.len() as i32; + let chars = s.chars().rev(); + + let mut pos1: i32 = -1; + let mut pos2: i32 = -1; + let mut incr = 1; + let mut digit = 0; + let mut symbols: Vec<Symbol> = vec![]; + let mut digits: Vec<Digit> = vec![]; + let mut multiples: Vec<usize> = vec![]; + + for i in 0..150 { + multiples.push(*border as usize * i); + } + + for (idx, ch) in chars.enumerate() { + if ch.is_digit(10) { + if pos2 == -1 { + pos2 = n - idx as i32; + } else if multiples.contains(&idx) && pos2 != -1 { + pos1 = n - idx as i32; + digits.push(Digit { + value: digit, + s: pos1 as usize, + f: pos2 as usize, + }); + incr = 1; + digit = 0; + pos2 = n - idx as i32; + } + digit += ch.to_digit(10).unwrap() * incr; + incr *= 10; + } + + if !ch.is_digit(10) { + if digit != 0 { + pos1 = n - idx as i32; + if pos1 == -1 || pos2 == -1 { + panic!("wtf is that?!"); + } + digits.push(Digit { + value: digit, + s: pos1 as usize, + f: pos2 as usize, + }) + } + pos2 = -1; + incr = 1; + digit = 0; + + if ch != '.' { + symbols.push(Symbol { + elem: ch, + i: n as usize - idx, + }) + } + } + } + if digit != 0 { + pos1 = 0; + if pos2 == -1 { + panic!("wtf is that?!"); + } + digits.push(Digit { + value: digit, + s: pos1 as usize, + f: pos2 as usize, + }) + } + + digits.reverse(); + symbols.reverse(); + + (digits, symbols) +} + +pub fn part1(input: &str) -> u32 { + let mut res: u32 = 0; + + let arr: String = input.split('\n').map(|c| c.chars()).flatten().collect(); + let border = input.find('\n').unwrap() as i32; + + let (digits, symbols) = parse(&arr, &border); + + let mut valid_s: Vec<usize> = Vec::new(); + for symbol in &symbols { + valid_s.push(symbol.i - 1); + } + + for digit in digits { + // 13 with border=10 + // --> 12, 14, 2, 3, 4, 22, 23, 24 + let mut discover: Vec<usize> = vec![]; + for i in digit.s..digit.f { + let mut js = vec![ + i as i32 - 1, + i as i32 + 1, + i as i32 - border - 1, + i as i32 - border - 0, + i as i32 - border + 1, + // i as i32 + border - 1, + i as i32 + border - 0, + i as i32 + border + 1, + ]; + + if digit.f as i32 + 1 >= border { + js.push(i as i32 + border - 1); + } + + for j in js { + if j >= 0 + && !((digit.s..digit.f).contains(&(j as usize))) + && !(discover.contains(&(j as usize))) + { + discover.push(j as usize); + } + } + } + + for d in &discover { + if valid_s.contains(&d) { + res += digit.value; + break; + } + } + + discover.sort(); + } + + res +} + +// pub fn part2(input: &str) -> u32 { +// let mut res: u32 = 0; +// +// res +// } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 4361); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 556367); + } + // + // #[test] + // fn example_part2() { + // let input = include_str!("../example.txt"); + // let result = part2(input); + // assert_eq!(result, 2286); + // } + // + // #[test] + // fn input_part2() { + // let input = include_str!("../input.txt"); + // let result = part2(input); + // assert_eq!(result, 71585); + // } +} diff --git a/2023/rust/day4/Cargo.toml b/2023/rust/day4/Cargo.toml new file mode 100644 index 0000000..8842130 --- /dev/null +++ b/2023/rust/day4/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day4" +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/rust/day4/example.txt b/2023/rust/day4/example.txt new file mode 100644 index 0000000..9bdb874 --- /dev/null +++ b/2023/rust/day4/example.txt @@ -0,0 +1,6 @@ +Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53 +Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19 +Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1 +Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83 +Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36 +Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11 diff --git a/2023/rust/day4/input.txt b/2023/rust/day4/input.txt new file mode 100644 index 0000000..93f8c7b --- /dev/null +++ b/2023/rust/day4/input.txt @@ -0,0 +1,203 @@ +Card 1: 87 75 80 68 71 57 58 59 70 48 | 56 67 75 76 31 49 48 22 43 68 98 86 70 91 27 46 4 87 72 37 71 58 29 79 80 +Card 2: 95 97 90 91 79 71 60 87 46 80 | 28 90 55 87 82 34 44 96 77 15 22 63 31 33 5 99 36 91 17 10 64 59 68 37 13 +Card 3: 23 73 50 78 93 30 56 10 8 64 | 61 48 87 46 12 75 92 37 62 45 24 81 79 55 76 82 9 1 16 72 13 27 41 86 19 +Card 4: 16 50 13 24 94 27 74 58 15 53 | 58 53 20 57 69 28 47 2 41 4 66 61 15 44 24 68 50 74 86 45 36 73 43 27 91 +Card 5: 39 53 29 10 84 22 83 4 5 32 | 50 28 45 5 6 65 18 7 92 83 3 55 81 26 80 39 44 60 90 37 91 36 54 14 74 +Card 6: 84 12 96 93 72 97 91 76 7 82 | 85 15 29 33 37 60 14 30 63 73 38 62 77 44 86 39 51 2 99 75 70 36 32 98 78 +Card 7: 78 12 1 50 48 62 33 8 83 99 | 12 50 79 48 59 81 26 14 5 11 37 8 36 91 95 20 46 44 21 32 58 93 53 90 54 +Card 8: 55 58 8 36 16 23 88 73 45 65 | 19 10 34 64 52 27 75 22 33 58 74 45 16 11 63 56 12 14 8 25 59 4 95 47 78 +Card 9: 95 14 83 17 7 69 44 31 45 37 | 2 69 81 39 76 86 29 73 72 32 67 5 9 16 95 90 36 27 88 55 61 6 37 79 1 +Card 10: 24 83 98 76 87 6 32 59 4 96 | 54 5 68 85 76 50 60 33 58 32 88 61 27 55 90 65 93 13 53 29 44 15 6 45 24 +Card 11: 55 92 57 65 44 21 49 8 13 48 | 17 44 79 11 65 50 46 14 40 69 31 62 55 86 36 60 30 52 25 93 41 56 48 99 51 +Card 12: 14 93 52 89 35 42 13 22 76 26 | 14 5 46 80 22 39 1 67 43 31 78 87 68 95 90 83 96 71 74 29 15 88 36 11 76 +Card 13: 55 78 95 85 43 53 80 12 1 59 | 42 60 32 70 10 91 94 88 68 99 45 71 54 93 76 52 44 30 2 18 72 90 9 7 63 +Card 14: 6 44 46 59 91 60 47 26 12 17 | 35 52 36 5 18 30 63 79 75 55 45 99 84 81 71 34 48 24 14 70 11 69 1 4 77 +Card 15: 29 17 94 87 84 3 96 33 5 48 | 65 25 20 45 85 1 43 37 14 11 69 81 6 92 93 46 8 23 31 2 30 61 22 79 71 +Card 16: 73 81 13 23 61 35 49 48 99 5 | 10 69 22 40 73 29 61 23 13 99 26 7 39 70 5 56 88 46 49 81 68 25 35 48 14 +Card 17: 64 47 6 10 16 74 26 95 28 73 | 86 27 47 6 68 49 64 48 74 26 16 28 20 99 61 10 12 25 73 88 70 95 67 3 76 +Card 18: 1 29 86 72 65 52 67 64 68 79 | 5 88 77 52 18 31 67 41 37 55 68 65 39 22 72 97 23 64 34 29 48 1 79 49 86 +Card 19: 71 33 43 91 59 35 69 18 78 9 | 86 55 54 59 91 36 45 9 94 43 39 11 44 1 93 23 66 97 4 62 71 98 18 31 28 +Card 20: 72 86 59 6 85 1 74 25 87 20 | 21 14 6 39 4 54 37 2 61 83 82 59 10 67 19 50 12 16 51 55 1 5 45 98 73 +Card 21: 35 39 40 21 19 87 58 49 78 32 | 28 91 27 45 44 25 11 35 84 26 98 87 14 97 93 70 55 19 34 16 8 7 67 54 5 +Card 22: 87 30 6 9 73 47 29 7 33 63 | 87 80 21 3 63 38 14 7 20 9 73 31 33 29 11 30 22 68 57 54 43 42 47 34 6 +Card 23: 51 61 36 99 86 88 21 6 30 74 | 30 42 99 86 20 44 74 64 72 67 81 93 79 51 5 48 21 75 36 23 6 60 4 66 88 +Card 24: 96 21 44 42 57 34 59 45 58 2 | 6 81 92 13 66 98 47 73 26 10 84 62 93 49 57 35 90 27 75 19 52 1 37 32 85 +Card 25: 17 55 53 49 25 59 71 33 35 11 | 55 82 92 74 29 17 46 40 2 26 25 32 96 49 11 35 53 3 87 59 71 33 73 36 38 +Card 26: 33 85 26 21 13 51 73 76 20 7 | 85 53 42 21 31 76 33 97 71 73 20 90 13 52 95 98 93 99 11 32 26 51 24 37 7 +Card 27: 62 39 22 67 69 5 89 1 36 34 | 10 52 68 95 32 82 22 94 21 29 5 45 87 51 18 4 15 19 59 55 11 78 60 63 84 +Card 28: 65 31 58 70 2 49 46 14 72 11 | 24 95 11 14 27 22 38 65 15 35 36 18 59 49 6 70 69 62 46 58 60 34 92 72 2 +Card 29: 78 6 94 55 65 17 97 30 66 33 | 80 32 56 48 49 16 88 61 57 20 37 75 51 58 86 29 42 39 41 60 62 69 10 81 24 +Card 30: 72 33 93 5 58 92 10 90 29 20 | 77 73 41 42 67 17 24 28 23 69 27 43 80 49 75 74 2 3 21 26 76 32 48 30 4 +Card 31: 9 93 77 42 49 71 36 98 46 1 | 68 39 10 32 36 7 47 55 95 33 48 56 31 61 98 40 50 81 94 77 45 12 16 6 35 +Card 32: 35 54 65 19 62 37 63 68 17 47 | 14 20 65 27 84 48 85 56 64 37 51 81 11 52 63 40 93 15 92 90 19 35 43 68 7 +Card 33: 21 80 78 56 29 65 6 12 57 22 | 51 61 7 1 19 22 77 62 78 54 58 29 89 97 34 83 56 57 11 98 73 6 17 16 70 +Card 34: 57 83 56 87 58 68 46 86 78 77 | 98 58 46 51 14 1 17 60 11 13 5 49 56 96 19 15 99 28 62 38 9 40 57 92 22 +Card 35: 34 29 33 85 95 9 47 11 39 25 | 49 91 61 13 99 84 80 96 77 82 97 59 20 30 4 65 70 74 5 37 41 81 75 93 48 +Card 36: 42 30 69 88 84 90 58 26 2 47 | 98 14 3 30 56 20 49 83 29 48 46 34 99 51 12 61 92 1 55 60 70 53 75 52 27 +Card 37: 7 70 87 71 25 85 50 86 77 72 | 94 23 90 73 52 79 31 30 49 71 8 26 88 38 42 5 81 82 69 51 63 35 80 22 19 +Card 38: 37 4 98 58 7 95 19 22 17 86 | 60 38 13 79 62 49 85 77 8 52 63 20 16 81 21 59 43 36 80 70 87 35 51 10 12 +Card 39: 68 79 63 42 17 92 99 95 2 29 | 85 24 88 25 52 81 61 1 27 50 84 98 31 49 19 51 38 93 33 15 22 28 14 70 67 +Card 40: 7 15 73 55 87 18 52 17 34 12 | 87 73 42 77 21 33 44 69 24 52 94 17 7 16 78 12 34 97 67 41 15 47 55 91 18 +Card 41: 70 1 14 88 52 46 32 59 67 75 | 17 1 75 13 46 87 64 32 48 52 53 80 30 21 3 88 94 14 38 70 73 67 28 41 86 +Card 42: 65 18 51 72 76 7 93 64 21 92 | 51 64 94 77 45 98 28 67 11 42 41 72 93 22 21 56 65 76 54 7 26 92 74 18 55 +Card 43: 35 82 2 99 52 68 81 38 14 94 | 51 46 27 10 21 7 56 71 77 6 38 44 25 79 94 33 76 15 22 99 68 84 5 14 81 +Card 44: 7 47 1 61 51 46 36 87 43 34 | 14 43 91 86 47 51 29 95 76 61 39 85 84 7 87 69 46 56 88 36 27 1 10 67 34 +Card 45: 17 83 85 90 65 18 67 75 68 25 | 89 67 31 51 99 46 85 42 84 75 59 96 17 68 26 79 65 81 32 83 25 90 37 4 18 +Card 46: 2 56 38 47 9 11 61 68 51 49 | 53 56 60 47 49 61 82 5 38 2 97 9 51 80 86 22 68 31 11 59 24 4 35 13 8 +Card 47: 39 2 68 61 28 8 23 62 46 89 | 23 15 46 78 62 1 60 36 52 35 10 65 90 67 4 18 16 72 44 61 6 59 14 45 91 +Card 48: 60 49 62 14 88 84 80 18 7 20 | 88 91 77 10 2 59 94 25 67 9 16 72 80 20 32 78 14 69 56 70 73 96 15 6 92 +Card 49: 14 67 94 15 12 40 7 68 22 88 | 91 15 67 61 7 95 85 72 94 78 12 68 14 35 41 89 60 22 88 81 93 86 40 84 92 +Card 50: 65 75 63 30 38 28 27 51 58 54 | 30 99 21 28 2 81 77 85 25 38 27 63 70 62 87 58 16 9 75 54 65 69 51 78 8 +Card 51: 30 18 35 67 45 87 27 13 82 51 | 9 51 95 45 2 67 61 82 81 30 52 35 5 43 27 87 83 49 13 44 21 22 48 78 18 +Card 52: 23 21 13 53 5 78 43 94 98 59 | 72 57 18 34 11 39 95 26 56 68 22 10 21 98 96 87 4 43 74 7 46 40 88 97 58 +Card 53: 39 55 57 87 6 68 78 14 36 7 | 74 76 20 58 87 6 67 26 57 1 41 44 17 14 42 7 43 81 35 39 55 36 59 66 96 +Card 54: 26 62 39 28 76 32 98 19 2 61 | 9 62 61 75 28 42 40 39 64 32 98 37 58 16 15 19 35 2 80 76 10 26 70 18 47 +Card 55: 31 47 13 40 5 80 94 45 54 43 | 61 17 52 78 60 2 37 58 19 85 89 14 20 10 3 13 80 41 25 79 4 70 36 75 11 +Card 56: 59 68 42 47 97 53 32 46 17 76 | 64 94 32 46 68 5 49 14 91 19 59 53 26 80 33 39 6 99 18 73 45 87 69 54 66 +Card 57: 70 23 37 94 4 46 26 33 71 72 | 64 38 71 53 37 96 29 80 41 90 60 94 18 45 27 62 72 33 79 32 26 92 49 12 4 +Card 58: 47 44 65 83 91 78 17 60 7 35 | 95 65 26 52 68 9 69 61 19 87 93 27 90 57 49 23 24 17 86 16 28 62 11 63 85 +Card 59: 3 92 67 72 64 2 74 14 49 73 | 41 57 98 95 91 78 20 42 25 60 54 36 56 34 86 37 9 10 52 79 80 53 88 18 46 +Card 60: 38 5 63 77 69 9 79 50 58 51 | 20 72 80 52 68 64 33 61 47 84 65 90 29 48 16 82 4 98 83 89 17 94 81 41 85 +Card 61: 13 65 75 26 39 63 88 92 72 87 | 98 43 81 95 26 69 27 7 57 37 82 41 71 18 55 53 10 36 64 47 84 4 20 77 67 +Card 62: 19 70 5 25 23 76 90 29 61 97 | 17 20 38 58 1 29 74 13 94 47 86 56 60 14 82 83 87 91 52 39 33 37 77 62 45 +Card 63: 22 24 17 19 55 48 23 3 8 11 | 4 67 90 50 99 54 49 78 94 20 96 2 86 74 83 79 76 15 70 52 34 98 5 82 88 +Card 64: 15 92 72 63 95 34 58 85 18 57 | 64 40 67 81 89 27 84 54 75 43 70 77 13 52 19 35 46 30 12 61 78 10 82 55 45 +Card 65: 66 35 28 50 30 80 15 85 4 23 | 3 30 99 96 70 47 4 64 35 66 78 41 65 63 23 28 44 67 85 80 61 50 17 15 92 +Card 66: 71 67 68 20 93 6 76 30 15 89 | 12 69 80 11 91 34 2 65 95 8 37 86 38 10 79 3 43 90 87 45 92 50 88 39 56 +Card 67: 94 46 12 2 53 27 57 45 33 1 | 33 72 74 64 25 97 17 2 73 48 3 56 63 40 31 24 45 83 85 79 6 75 38 55 49 +Card 68: 82 68 40 3 73 81 61 1 60 50 | 15 29 82 51 73 28 43 94 85 50 96 11 98 9 86 20 6 14 5 95 10 23 61 12 62 +Card 69: 25 94 17 29 2 34 48 87 51 49 | 95 17 84 91 14 34 3 89 87 71 2 51 35 93 7 29 74 55 48 25 49 56 94 20 68 +Card 70: 37 51 36 79 15 29 88 69 6 97 | 27 66 88 90 41 29 25 36 82 56 69 37 18 40 33 97 42 91 62 6 65 79 15 28 51 +Card 71: 77 28 31 19 40 35 80 11 76 26 | 10 74 63 70 11 67 76 31 40 75 96 77 60 80 35 28 68 53 19 64 51 43 26 9 25 +Card 72: 18 96 9 79 87 37 94 69 8 74 | 69 18 9 41 21 80 72 96 71 20 15 12 36 87 99 37 44 79 46 54 94 19 8 74 39 +Card 73: 11 60 75 68 66 57 51 70 20 30 | 6 12 35 45 56 38 46 65 54 59 19 68 64 11 57 22 74 30 90 13 37 93 5 20 51 +Card 74: 6 20 99 75 87 1 70 52 4 61 | 97 98 99 34 75 11 8 92 49 81 19 12 87 20 70 6 27 4 44 61 52 67 82 1 55 +Card 75: 95 80 34 33 66 55 63 19 7 46 | 19 83 58 4 46 57 72 99 98 63 36 80 34 30 11 64 24 52 93 55 22 76 78 32 89 +Card 76: 55 56 58 16 50 24 27 75 35 44 | 75 42 35 87 7 13 55 44 8 27 56 14 24 78 61 4 19 38 18 58 50 1 16 51 22 +Card 77: 99 2 77 33 48 47 44 87 32 23 | 46 71 47 54 23 55 18 28 56 48 69 14 26 44 24 32 77 60 81 2 40 33 83 11 87 +Card 78: 67 46 27 29 44 1 22 4 13 52 | 80 98 63 29 97 67 58 86 25 52 95 23 92 76 27 74 13 93 78 22 81 96 1 46 64 +Card 79: 60 94 4 59 76 64 34 69 35 62 | 10 8 82 43 76 44 69 20 41 29 1 35 34 59 42 22 13 32 4 40 65 28 16 84 99 +Card 80: 88 60 47 76 82 5 14 63 58 16 | 83 62 57 21 89 79 53 60 87 22 76 20 78 96 63 68 56 91 5 7 47 16 94 98 45 +Card 81: 46 67 14 43 39 44 48 35 6 94 | 2 31 12 42 78 76 61 62 40 37 29 36 16 75 4 41 21 19 85 49 84 73 89 96 3 +Card 82: 61 73 72 47 71 96 4 2 41 20 | 76 78 94 65 51 85 92 60 31 80 81 34 46 69 90 70 17 74 89 40 27 35 14 15 10 +Card 83: 82 60 62 23 81 27 61 26 75 28 | 29 78 79 9 13 39 30 97 31 96 86 84 42 28 14 55 81 44 17 8 25 12 35 34 82 +Card 84: 91 61 73 55 98 28 11 40 33 50 | 21 55 27 2 54 44 94 59 58 67 79 66 82 87 92 25 9 7 65 80 38 30 10 97 16 +Card 85: 39 81 47 2 8 95 35 63 36 10 | 75 58 6 19 20 55 18 99 88 25 78 77 65 93 59 57 12 13 66 91 3 67 34 41 29 +Card 86: 15 33 8 84 57 35 50 76 43 17 | 34 20 55 59 97 51 44 46 53 5 10 79 58 89 39 82 16 42 71 81 22 40 85 63 56 +Card 87: 44 7 57 42 53 85 62 9 56 63 | 95 60 69 56 24 43 7 4 91 44 63 76 30 39 62 9 85 57 16 34 53 99 50 66 42 +Card 88: 47 85 12 1 98 86 94 84 33 51 | 27 54 45 55 38 12 96 51 1 83 36 65 13 85 32 94 29 52 47 59 33 48 86 82 98 +Card 89: 45 15 77 41 57 43 54 2 32 24 | 44 79 10 28 23 97 99 40 95 25 22 9 35 59 53 74 14 37 34 61 39 30 71 12 94 +Card 90: 76 75 36 82 28 2 87 81 31 14 | 38 67 87 90 6 9 19 2 13 37 24 15 65 84 32 85 44 18 98 79 23 35 80 60 47 +Card 91: 21 19 37 97 7 29 34 79 45 13 | 17 42 12 71 21 4 51 37 7 81 34 65 36 19 13 59 96 97 31 16 79 87 29 86 45 +Card 92: 16 14 67 60 39 25 26 34 12 96 | 79 66 11 93 38 29 37 12 50 32 7 82 39 59 84 54 42 83 43 92 19 1 34 26 77 +Card 93: 70 37 71 28 22 62 85 9 65 27 | 78 91 28 65 42 22 70 30 92 54 9 72 38 24 62 51 10 49 89 13 14 66 84 61 93 +Card 94: 80 48 40 83 87 19 53 66 69 33 | 80 79 66 76 58 94 60 70 20 42 72 87 19 30 75 40 67 12 36 96 11 29 59 63 33 +Card 95: 68 91 48 52 79 40 83 97 16 63 | 77 73 52 88 97 91 48 22 35 64 31 40 63 68 60 28 57 30 51 54 36 16 92 19 79 +Card 96: 78 81 13 87 20 8 80 63 2 3 | 20 29 62 72 44 90 54 22 3 35 55 16 96 80 37 93 73 23 50 33 6 63 78 8 13 +Card 97: 32 39 59 73 8 34 36 46 85 47 | 14 22 15 87 46 34 67 77 44 91 47 5 73 68 59 7 40 94 98 36 21 76 64 86 39 +Card 98: 19 75 37 82 94 6 57 15 78 58 | 9 79 6 71 91 39 38 61 59 89 90 1 80 17 86 35 98 63 27 74 5 49 25 70 73 +Card 99: 44 22 48 23 31 78 15 89 49 24 | 36 89 27 81 67 56 22 28 74 47 25 18 44 3 15 23 58 73 69 39 75 17 85 1 7 +Card 100: 56 15 30 64 37 89 51 96 63 90 | 56 23 24 57 44 9 41 65 6 26 69 36 21 66 94 67 7 10 34 59 14 40 99 93 98 +Card 101: 42 95 60 30 25 87 82 98 40 54 | 22 85 24 84 19 34 3 43 97 8 18 57 58 26 91 44 56 11 16 66 78 73 62 50 68 +Card 102: 14 64 72 79 55 78 44 12 76 36 | 69 74 13 78 59 82 15 46 49 11 81 83 97 9 58 4 98 60 43 34 30 67 2 47 37 +Card 103: 64 82 36 57 33 8 80 91 95 32 | 84 45 12 44 59 94 86 53 48 96 26 66 70 65 39 37 21 72 49 60 56 35 82 98 92 +Card 104: 76 18 88 52 69 44 57 99 20 12 | 60 74 21 35 77 39 40 29 46 37 95 65 93 36 43 86 48 59 6 11 16 72 28 55 97 +Card 105: 91 30 6 25 7 64 41 28 72 53 | 93 63 59 31 4 87 45 97 70 29 39 80 98 66 44 51 54 62 57 46 56 18 13 81 27 +Card 106: 15 59 45 36 74 86 35 62 87 14 | 29 35 81 53 60 69 47 25 61 43 13 62 84 96 79 75 68 23 32 18 37 72 63 4 36 +Card 107: 62 41 56 15 66 50 63 20 43 84 | 43 66 99 3 49 20 80 50 36 38 52 22 23 24 41 62 84 83 15 68 63 56 94 35 97 +Card 108: 67 51 97 26 11 61 91 55 7 23 | 47 96 26 78 22 87 33 51 34 59 53 3 97 91 86 11 21 89 13 61 23 67 55 7 24 +Card 109: 72 23 61 6 1 65 83 47 10 41 | 27 16 98 74 55 61 5 1 88 68 41 47 99 48 76 31 85 83 38 72 91 93 36 90 80 +Card 110: 34 22 81 62 40 25 43 60 12 69 | 69 81 71 66 54 15 17 79 25 93 34 51 43 62 40 12 30 56 27 47 60 33 22 94 65 +Card 111: 48 24 75 46 37 65 33 74 64 92 | 75 46 25 65 92 33 64 83 39 16 45 48 97 56 11 78 94 62 4 24 37 96 74 31 40 +Card 112: 94 92 39 58 34 78 61 7 50 88 | 83 6 52 39 92 17 40 63 54 34 7 85 89 64 25 50 99 77 33 13 11 81 35 78 41 +Card 113: 23 25 75 44 18 8 29 79 48 60 | 7 70 80 63 60 42 88 25 44 23 21 11 51 93 47 82 16 86 73 62 96 75 2 29 19 +Card 114: 52 42 66 15 57 29 21 47 89 22 | 77 81 52 8 66 21 98 61 71 2 85 34 42 95 93 25 67 60 82 47 78 56 63 87 84 +Card 115: 63 81 53 30 8 94 75 76 45 71 | 53 93 40 18 45 71 76 67 75 92 15 72 35 94 65 30 88 22 81 8 63 50 80 5 82 +Card 116: 8 33 23 82 63 25 65 4 97 28 | 79 75 71 46 41 74 6 86 64 33 24 70 82 87 9 76 36 3 5 97 92 4 1 12 62 +Card 117: 9 97 4 59 31 78 73 99 84 11 | 93 65 12 39 29 76 80 82 43 37 26 57 79 27 46 90 98 54 31 34 17 62 95 51 9 +Card 118: 11 42 73 23 28 62 68 15 31 48 | 17 81 29 15 10 86 25 68 28 80 33 78 89 11 82 96 12 34 19 99 67 13 64 59 91 +Card 119: 22 16 61 76 19 92 5 89 86 1 | 37 35 77 44 7 42 86 92 41 81 16 95 12 1 85 60 63 79 5 25 62 46 73 45 19 +Card 120: 97 11 71 31 44 24 12 49 15 17 | 97 44 78 49 64 61 42 55 31 38 12 87 53 32 41 6 68 62 19 94 13 79 29 56 71 +Card 121: 5 50 95 7 14 6 35 64 99 94 | 30 54 80 90 68 98 6 71 61 81 23 24 64 37 40 15 53 63 31 35 7 49 14 99 42 +Card 122: 5 72 29 22 71 35 41 82 15 56 | 3 45 61 68 70 41 56 26 82 62 29 36 84 80 95 81 96 83 20 35 28 54 21 76 47 +Card 123: 80 4 93 25 97 10 20 84 3 67 | 14 18 12 20 86 96 63 67 60 54 13 85 23 37 10 16 71 65 33 5 98 1 74 53 51 +Card 124: 43 64 62 31 86 1 30 23 15 28 | 77 1 99 27 48 35 2 40 57 61 23 9 37 74 91 46 92 83 24 90 96 32 80 45 31 +Card 125: 53 47 45 50 82 37 26 41 22 57 | 43 25 37 29 89 20 17 8 1 46 2 55 53 44 61 78 65 72 69 85 12 93 28 34 80 +Card 126: 36 27 94 41 56 21 18 13 59 96 | 73 91 2 14 29 98 79 8 11 3 38 16 69 71 77 92 66 60 18 9 1 57 12 22 43 +Card 127: 19 12 69 97 81 26 73 83 34 51 | 91 47 89 62 94 8 66 43 35 93 48 24 71 40 42 75 13 14 65 28 61 95 32 25 9 +Card 128: 99 78 81 4 44 58 10 83 67 5 | 5 83 95 17 34 68 91 10 4 88 56 38 49 44 66 11 78 7 50 67 45 21 98 99 58 +Card 129: 94 35 8 59 72 56 51 98 47 63 | 98 71 61 72 51 54 35 34 95 9 82 88 47 8 66 57 90 55 81 33 59 56 64 63 94 +Card 130: 81 25 85 84 88 26 87 14 40 77 | 25 74 20 13 30 11 72 77 88 40 70 67 47 14 80 86 81 26 45 87 79 33 85 84 39 +Card 131: 28 83 7 69 87 48 46 67 33 10 | 37 10 48 96 38 99 14 60 28 42 26 94 46 24 84 68 87 72 85 67 4 83 31 7 47 +Card 132: 33 65 47 66 48 9 69 68 76 73 | 21 18 70 64 55 19 31 81 20 77 12 94 59 15 98 44 57 52 92 54 93 40 89 16 78 +Card 133: 67 54 21 71 43 56 68 65 55 99 | 16 83 20 45 85 92 34 61 88 33 51 65 24 68 58 55 91 81 54 43 5 1 77 49 25 +Card 134: 73 82 41 78 91 72 13 7 46 88 | 78 88 32 57 12 56 44 73 41 79 27 99 49 13 82 91 87 97 62 46 83 7 23 60 71 +Card 135: 19 30 91 16 15 88 5 4 72 38 | 38 41 23 87 3 78 75 11 88 53 5 72 4 56 54 65 19 76 15 27 82 39 70 69 17 +Card 136: 39 66 64 79 90 51 69 6 44 23 | 51 1 21 44 23 78 27 66 69 42 6 50 74 48 39 79 57 29 53 3 10 13 30 90 64 +Card 137: 82 75 28 96 13 25 30 59 76 5 | 25 45 59 79 96 44 88 75 82 30 13 18 20 97 21 5 70 31 76 95 17 37 27 28 53 +Card 138: 23 21 53 59 82 11 99 30 68 1 | 51 11 21 53 8 43 24 71 33 63 75 66 23 82 1 20 92 50 86 59 99 45 84 30 68 +Card 139: 43 44 12 68 14 70 83 84 39 40 | 72 18 54 48 43 91 56 1 11 49 83 59 29 73 87 40 37 6 50 14 74 61 70 2 36 +Card 140: 64 4 86 61 11 72 66 73 83 14 | 74 86 84 8 36 5 76 73 83 88 10 28 38 64 4 12 72 23 53 42 33 91 61 45 55 +Card 141: 46 33 44 21 99 64 29 4 28 30 | 1 95 13 97 9 59 15 41 89 35 43 98 81 27 94 3 65 88 91 12 17 10 23 61 48 +Card 142: 2 85 8 98 74 62 76 7 79 60 | 59 42 2 49 24 34 25 76 8 71 98 86 6 7 16 33 74 62 89 13 39 31 85 79 87 +Card 143: 50 10 55 73 71 3 20 57 15 9 | 42 20 71 54 11 9 55 37 15 3 53 41 13 99 63 57 7 73 28 84 18 35 5 32 10 +Card 144: 26 38 75 71 89 40 96 81 83 48 | 42 77 11 76 78 15 19 86 10 34 61 58 29 14 64 94 63 33 70 13 88 82 59 28 93 +Card 145: 72 35 67 80 78 20 57 48 64 28 | 44 70 79 37 5 96 31 13 10 83 93 29 46 94 66 47 6 34 14 18 33 8 69 49 20 +Card 146: 42 10 61 56 2 22 38 15 67 6 | 72 83 53 80 52 31 74 73 20 12 87 71 78 95 25 45 75 43 32 85 82 7 13 90 19 +Card 147: 30 2 48 5 16 25 70 89 35 85 | 3 5 55 90 16 86 70 87 17 29 74 14 22 78 39 37 71 45 79 42 2 60 21 62 89 +Card 148: 61 50 41 22 75 80 46 93 55 6 | 62 68 95 45 74 21 13 52 66 2 17 53 97 83 90 40 44 28 25 86 14 82 15 30 84 +Card 149: 49 54 61 92 19 16 78 83 15 71 | 7 33 40 69 2 34 70 9 91 79 74 42 67 38 82 60 28 43 23 80 39 56 30 66 1 +Card 150: 47 85 71 36 9 98 45 28 7 58 | 94 88 20 62 13 77 85 27 43 92 18 41 31 3 2 45 74 99 30 40 26 93 19 23 65 +Card 151: 65 90 39 91 53 76 79 51 9 36 | 5 84 49 13 70 64 15 33 92 67 41 57 19 21 22 87 54 50 46 66 52 24 71 29 16 +Card 152: 61 62 51 11 14 44 10 29 31 35 | 95 47 96 16 5 32 88 90 52 65 70 94 9 80 81 56 50 43 15 34 45 68 67 42 18 +Card 153: 91 86 12 23 53 39 96 79 14 76 | 68 66 83 69 73 42 59 67 4 38 11 46 16 95 71 52 88 13 19 48 9 99 30 62 43 +Card 154: 47 44 72 6 95 7 21 64 59 29 | 72 7 12 33 21 14 91 3 99 71 64 44 70 63 6 22 88 16 43 57 73 59 76 60 47 +Card 155: 38 36 24 69 59 58 96 45 39 30 | 17 64 59 31 80 36 25 89 96 4 27 12 30 74 11 29 57 63 45 19 42 38 69 58 39 +Card 156: 60 93 14 54 53 40 34 26 1 28 | 46 62 40 69 48 39 35 68 86 22 19 10 42 25 88 67 58 96 54 44 56 85 31 90 99 +Card 157: 82 93 7 76 69 1 36 5 4 3 | 66 96 92 52 29 5 91 62 45 27 25 31 28 78 99 95 73 14 37 26 9 98 42 55 11 +Card 158: 34 52 78 67 96 62 54 85 86 31 | 21 42 63 51 12 70 15 83 34 35 62 69 52 54 36 85 31 86 67 41 53 7 1 96 82 +Card 159: 67 49 58 35 82 57 29 6 20 25 | 30 46 2 75 38 57 99 7 29 69 94 40 12 45 97 49 66 6 35 76 32 37 71 60 68 +Card 160: 17 49 10 5 34 2 23 91 3 19 | 29 39 67 53 14 61 41 85 18 65 56 77 54 55 13 27 28 45 60 7 62 6 96 38 35 +Card 161: 4 42 38 50 85 92 27 25 82 7 | 82 5 83 71 52 43 12 75 73 92 96 1 61 59 25 85 7 22 23 80 35 15 97 88 30 +Card 162: 42 69 75 64 40 12 29 56 33 62 | 57 5 83 79 26 55 84 60 70 16 47 2 19 30 7 62 89 76 20 90 66 78 21 9 87 +Card 163: 52 10 27 86 7 72 95 88 13 75 | 94 76 43 33 31 69 35 68 39 78 48 83 28 66 67 15 72 34 32 25 85 53 40 46 1 +Card 164: 14 95 31 43 91 56 22 68 17 33 | 74 98 24 59 4 93 67 23 64 35 51 42 92 88 63 20 29 70 16 82 89 45 39 27 12 +Card 165: 29 5 49 25 67 79 56 44 43 93 | 20 54 10 52 8 50 98 9 73 92 78 24 86 69 77 82 80 41 94 36 35 22 32 38 3 +Card 166: 63 92 68 93 58 16 90 6 13 46 | 31 45 39 8 65 49 23 81 62 72 7 15 82 35 53 4 80 83 48 13 10 11 71 40 61 +Card 167: 58 70 1 3 7 81 65 83 79 77 | 87 8 59 29 18 6 14 48 35 9 60 94 80 92 51 2 73 36 47 27 86 89 41 42 4 +Card 168: 69 93 96 77 76 90 17 88 11 26 | 31 13 77 9 86 82 51 67 53 99 76 35 81 6 28 92 24 14 87 59 41 37 88 18 96 +Card 169: 99 40 11 87 24 55 4 46 66 49 | 60 67 72 31 94 69 42 46 86 17 47 70 95 90 6 4 3 59 61 24 93 73 28 58 96 +Card 170: 29 84 4 80 72 94 9 7 55 68 | 24 62 7 35 21 55 85 94 29 4 84 38 42 33 2 77 58 9 11 80 41 72 76 13 68 +Card 171: 93 7 9 11 12 13 79 51 99 62 | 99 28 51 12 82 11 35 18 93 34 7 17 2 13 63 54 9 69 62 84 68 79 58 36 70 +Card 172: 16 79 33 10 58 22 67 98 46 43 | 75 24 96 64 4 50 38 10 5 31 45 21 98 7 17 34 60 72 97 92 6 3 99 86 9 +Card 173: 98 73 26 29 85 75 13 22 27 35 | 87 76 25 43 82 17 79 74 16 91 37 97 46 15 14 40 52 70 31 68 81 5 36 72 57 +Card 174: 4 29 72 26 46 89 61 15 16 11 | 4 68 89 24 58 94 46 26 55 15 67 61 72 98 75 84 29 11 47 2 54 13 9 28 16 +Card 175: 40 49 71 63 25 47 44 26 98 31 | 26 20 18 96 64 92 88 63 62 95 47 33 86 35 70 75 90 27 1 59 54 74 80 41 77 +Card 176: 92 17 34 39 64 49 70 69 44 91 | 49 24 4 81 74 31 28 36 69 39 68 16 98 2 3 26 96 76 57 19 44 95 93 29 34 +Card 177: 60 32 48 84 3 86 62 55 22 58 | 17 91 95 50 64 89 32 60 82 62 49 58 25 12 86 3 40 16 84 87 66 61 77 55 9 +Card 178: 92 4 66 65 13 87 57 16 78 3 | 92 16 81 7 78 42 25 44 43 24 66 29 50 40 19 71 89 53 59 77 67 76 39 84 1 +Card 179: 6 67 72 98 79 45 12 87 77 60 | 19 12 57 66 14 26 28 31 18 24 45 6 15 29 99 27 90 87 10 59 92 36 58 72 79 +Card 180: 6 9 43 74 48 87 52 56 76 30 | 97 8 88 19 2 54 9 29 3 39 23 71 93 41 95 87 98 68 36 42 94 40 45 84 85 +Card 181: 26 5 23 14 59 6 33 89 97 96 | 16 7 41 8 45 71 47 98 67 88 58 13 79 66 85 81 32 17 60 91 51 49 27 69 3 +Card 182: 53 5 83 87 3 44 25 98 48 24 | 14 77 95 98 40 81 97 85 80 15 33 38 75 17 5 56 71 43 65 28 87 10 66 22 70 +Card 183: 67 20 49 89 38 55 16 79 27 45 | 43 57 35 34 26 93 13 63 5 87 72 69 28 96 78 3 48 47 61 94 59 7 37 95 1 +Card 184: 1 73 35 99 24 74 64 21 14 81 | 48 81 57 15 28 49 31 82 91 8 62 79 54 20 95 13 21 97 98 19 51 6 83 70 61 +Card 185: 31 6 98 7 17 45 42 37 67 56 | 53 73 7 91 20 63 57 96 28 72 15 44 55 29 23 77 58 32 1 11 62 65 95 83 25 +Card 186: 93 81 16 50 3 40 87 46 90 58 | 89 70 62 28 4 19 2 63 21 53 14 9 55 25 54 38 94 82 47 86 36 96 49 8 80 +Card 187: 45 71 74 81 84 18 23 35 86 25 | 34 90 45 74 63 35 1 3 88 12 84 71 97 29 32 26 40 18 76 89 9 80 86 94 64 +Card 188: 3 21 56 32 1 26 54 60 13 28 | 40 24 26 28 78 12 11 92 17 98 30 27 1 87 25 97 57 49 52 38 51 32 42 47 7 +Card 189: 41 82 69 64 35 71 79 61 44 36 | 35 69 22 37 44 29 79 39 14 3 56 66 36 62 82 26 72 61 88 33 97 64 41 98 34 +Card 190: 96 84 47 27 31 17 59 40 64 67 | 16 32 82 27 21 75 93 74 60 80 29 48 23 31 54 98 79 58 17 67 18 43 12 25 96 +Card 191: 35 60 71 44 21 62 81 14 67 85 | 36 37 69 9 34 35 62 40 54 41 1 13 23 58 85 86 24 55 14 7 92 96 50 11 81 +Card 192: 82 95 6 69 48 56 42 96 94 93 | 98 92 96 63 42 76 16 50 95 48 28 8 39 6 94 47 69 97 56 82 44 93 21 26 7 +Card 193: 22 86 12 38 3 6 44 77 27 59 | 53 80 89 25 92 38 63 86 65 34 99 46 27 75 8 1 7 47 66 29 2 77 61 12 54 +Card 194: 15 20 33 91 80 61 37 99 58 92 | 10 76 99 58 97 91 71 64 33 36 29 30 42 37 87 66 90 6 49 22 68 40 92 2 73 +Card 195: 10 59 86 92 5 55 25 48 36 45 | 27 5 48 84 25 57 35 78 56 63 82 28 87 92 88 10 19 42 36 53 86 60 81 39 55 +Card 196: 69 95 34 9 80 55 11 30 49 88 | 15 89 44 26 48 49 74 54 35 77 47 11 9 21 25 95 31 88 53 56 42 69 18 10 60 +Card 197: 62 23 83 63 24 58 57 72 8 68 | 41 25 26 58 80 45 99 55 63 96 46 60 84 33 98 42 50 62 44 52 47 7 57 75 12 +Card 198: 86 22 73 29 41 40 11 76 69 83 | 78 20 14 67 51 93 8 47 43 44 82 16 2 55 96 98 61 48 31 49 91 24 3 27 87 +Card 199: 27 59 83 12 76 82 74 98 47 73 | 30 20 63 53 67 68 16 4 66 10 93 61 89 80 36 75 62 99 1 5 70 31 17 82 22 +Card 200: 49 66 64 92 36 61 44 96 68 67 | 57 55 19 18 78 64 90 85 72 84 5 10 38 71 74 34 68 30 46 83 86 25 89 50 49 +Card 201: 83 53 58 64 84 72 70 19 41 17 | 22 55 50 90 65 88 6 76 43 70 26 63 41 91 82 79 89 98 71 54 80 67 59 36 49 +Card 202: 70 55 83 56 42 25 11 1 41 49 | 32 54 80 59 53 23 75 8 68 6 94 45 86 3 61 98 36 14 44 18 89 39 81 51 88 +Card 203: 12 10 29 80 87 71 65 37 55 9 | 11 5 75 46 3 81 6 54 64 32 95 33 49 34 74 48 92 20 21 56 53 50 41 61 36 diff --git a/2023/rust/day4/src/lib.rs b/2023/rust/day4/src/lib.rs new file mode 100644 index 0000000..ca38b56 --- /dev/null +++ b/2023/rust/day4/src/lib.rs @@ -0,0 +1,132 @@ +fn parse(input: &str) -> Vec<String> { + input + .trim_end() + .split('\n') + .map(|x| { + let b = x.to_string(); + let k = b.split(':').last().unwrap(); + + return k.trim().to_string(); + }) + .collect() +} + +pub fn part1(input: &str) -> u32 { + let mut res: u32 = 0; + + let cards: Vec<String> = parse(input); + for card in cards { + let numbers: Vec<String> = card.split('|').map(|x| x.trim().to_string()).collect(); + assert_eq!(numbers.len(), 2); + + let nums: Vec<Vec<_>> = numbers + .iter() + .map(|x| { + x.replace(" ", " ") + .split(' ') + .map(|x| x.trim().parse::<u32>().unwrap()) + .collect() + }) + .collect(); + + assert_eq!(nums.len(), 2); + let (winnings, plays) = (&nums[0], &nums[1]); + + let mut k = 0.5; + for win in winnings { + if plays.contains(&win) { + k *= 2.; + } + } + res += k as u32; + } + + res +} + +// +// +// +// 1 -> 4 | x +// 2 -> 2 | y x +// 3 -> 2 | y y y x +// 4 -> 1 | y y y y y y y x +// 5 -> 0 | y y y y y y y y y y y y y x +// 6 -> 0 | x +// +// +pub fn part2(input: &str) -> u32 { + let mut res: u32 = 0; + + let cards: Vec<String> = parse(input); + let mut incr: Vec<u32> = Vec::new(); + incr.resize_with(cards.len(), Default::default); + + let mut i = 0; + for card in cards { + let numbers: Vec<String> = card.split('|').map(|x| x.trim().to_string()).collect(); + assert_eq!(numbers.len(), 2); + + let nums: Vec<Vec<_>> = numbers + .iter() + .map(|x| { + x.replace(" ", " ") + .split(' ') + .map(|x| x.trim().parse::<u32>().unwrap()) + .collect() + }) + .collect(); + + assert_eq!(nums.len(), 2); + let (winnings, plays) = (&nums[0], &nums[1]); + + let mut k = 0; + for win in winnings { + if plays.contains(&win) { + k += 1; + } + } + + for j in (i + 1)..(i + 1 + k) { + incr[j] += 1 + incr[i]; + } + + res += 1 + incr[i]; + i += 1; + } + + res +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 13); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 25174); + } + + #[test] + fn example_part2() { + let input = include_str!("../example.txt"); + let result = part2(input); + assert_eq!(result, 30); + } + + #[test] + fn input_part2() { + let input = include_str!("../input.txt"); + let result = part2(input); + assert_eq!(result, 6420979); + } +} diff --git a/2023/rust/day5/Cargo.toml b/2023/rust/day5/Cargo.toml new file mode 100644 index 0000000..f9b62bf --- /dev/null +++ b/2023/rust/day5/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day5" +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/rust/day5/example.txt b/2023/rust/day5/example.txt new file mode 100644 index 0000000..f756727 --- /dev/null +++ b/2023/rust/day5/example.txt @@ -0,0 +1,33 @@ +seeds: 79 14 55 13 + +seed-to-soil map: +50 98 2 +52 50 48 + +soil-to-fertilizer map: +0 15 37 +37 52 2 +39 0 15 + +fertilizer-to-water map: +49 53 8 +0 11 42 +42 0 7 +57 7 4 + +water-to-light map: +88 18 7 +18 25 70 + +light-to-temperature map: +45 77 23 +81 45 19 +68 64 13 + +temperature-to-humidity map: +0 69 1 +1 0 69 + +humidity-to-location map: +60 56 37 +56 93 4 diff --git a/2023/rust/day5/input.txt b/2023/rust/day5/input.txt new file mode 100644 index 0000000..7dfa9ed --- /dev/null +++ b/2023/rust/day5/input.txt @@ -0,0 +1,237 @@ +seeds: 41218238 421491713 1255413673 350530906 944138913 251104806 481818804 233571979 2906248740 266447632 3454130719 50644329 1920342932 127779721 2109326496 538709762 3579244700 267233350 4173137165 60179884 + +seed-to-soil map: +1389477588 1222450723 86190269 +2369327568 3429737174 127508203 +88123474 1366319913 182655004 +1475667857 405321476 41320497 +1258939826 536917987 41172751 +1924266396 3404859218 24877956 +1762699703 957158780 33280161 +3452528837 3222194776 182664442 +2196573512 1924266396 172754056 +433176947 990438941 6166389 +4047092335 2681059373 30705388 +439343336 1626695089 181842577 +1949144352 2940939059 125726128 +979719551 446641973 90276014 +2184073848 2711764761 12499664 +4077797723 2605613670 27940277 +2074870480 4240432416 54534880 +3048538268 3066665187 104068222 +621185913 1124514126 97936597 +1157547656 773812762 84277017 +1300112577 20266514 6655368 +1151949413 1808537666 5598243 +3435484067 2724264425 17044770 +380487497 1308640992 52689450 +1644897150 26921882 117802553 +1516988354 996605330 127908796 +1241824673 858089779 17115153 +3932455534 2269053207 114636801 +3319415958 3854507632 116068109 +2129405360 4237225295 3207121 +2729160001 2097020452 172032755 +3635193279 3557245377 297262255 +1795979864 578090738 107598550 +2901192756 3970575741 147345512 +4105738000 2416384374 189229296 +0 685689288 88123474 +1903578414 0 20266514 +719122510 144724435 260597041 +2132612481 3170733409 51461367 +2496835771 2741309195 199629864 +1306767945 1548974917 77720172 +3200111916 4117921253 119304042 +1069995565 875204932 81953848 +3152606490 2633553947 47505426 +270778478 1814135909 109709019 +1384488117 1361330442 4989471 +2696465635 2383690008 32694366 + +soil-to-fertilizer map: +1796371314 958475699 90518367 +4004397333 4049196179 245771117 +2175877891 3813840430 96544159 +1966430612 3997904997 51291182 +3155151482 799623922 79310846 +4250168450 2358444962 15280909 +4265449359 3910384589 29517937 +3087542169 2534702057 67609313 +1202725381 3631683738 113825873 +852357580 2833874802 40691288 +1452732352 2128818900 25726830 +291197164 3745509611 68330819 +1316551254 2602311370 60535393 +2017721794 2764291908 69582894 +498502503 445768845 353855077 +3367678481 1860885729 203469524 +3845535174 1124639771 94398512 +1041749195 2373725871 160976186 +2330424521 2874566090 757117648 +1478459182 127856713 317912132 +3234462328 1680414394 31771008 +359527983 1219038283 138974520 +893048868 1712185402 148700327 +3571148005 1406027225 274387169 +3939933686 2064355253 64463647 +3266233336 2662846763 101445145 +1886889681 878934768 79540931 +87297932 2154545730 203899232 +39283510 1358012803 48014422 +2272422050 3939902526 58002471 +1377086647 1048994066 75645705 +2087304688 39283510 88573203 + +fertilizer-to-water map: +3988818582 3038666130 306148714 +2927763871 3008779749 29886381 +124309691 99049201 282856506 +99049201 381905707 25260490 +407166197 2131018623 602068357 +3442767659 4213146266 81821030 +2957650252 3344814844 485117407 +3907802704 2927763871 81015878 +1009234554 407166197 1723852426 +3524588689 3829932251 383214015 + +water-to-light map: +1071892650 2651787028 57679970 +1129572620 3396952543 81593150 +1240611714 2163493623 488293405 +0 2068015044 95478579 +1211165770 3074252590 29445944 +2592854025 0 138938366 +2523843782 1948369545 69010243 +924090948 883610805 76353493 +2022159128 174281796 501684654 +1000444441 2923208140 71448209 +95478579 959964298 268093632 +684655532 1228057930 239435416 +3410916028 2709466998 213741142 +363572211 1627286224 321083321 +3324937342 2017379788 50635256 +3183141431 3068711832 5540758 +2939436746 3478545693 243704685 +3624657170 2994656349 74055483 +1728905119 3103698534 293254009 +3930463154 3978112708 316854588 +2731792391 675966450 207644355 +3375572598 138938366 35343430 +4247317742 3967989739 10122969 +4257440711 3930463154 37526585 +3188682189 3722250378 136255153 +3698712653 1467493346 159792878 + +light-to-temperature map: +4148509456 1952010509 126270832 +856886372 936932802 97162803 +829640090 282271594 27246282 +244444108 1274282332 107584318 +1528329058 3192525971 211478915 +2566760651 2178128911 792500107 +478140779 1162859130 51849897 +4274780288 1528329058 20187008 +352028426 265852816 16418778 +1739807973 2970629018 221896953 +188336830 840381853 56107278 +529990676 0 265852816 +2424714410 1911677980 40332529 +795843492 896489131 33796598 +969062248 324530949 412804402 +954049175 309517876 15013073 +3359260758 3868594872 426372424 +2465046939 3404004886 101713712 +375094277 737335351 103046502 +0 1214709027 59573305 +2324866840 2078281341 99847570 +1961704926 1548516066 247670884 +2209375810 1796186950 115491030 +59573305 1034095605 128763525 +3785633182 3505718598 362876274 +368447204 930285729 6647073 + +temperature-to-humidity map: +645925588 927807414 87140162 +0 398577479 157531253 +1936153073 3766846194 135269565 +3964800672 3492411188 1957783 +3660032389 3460150664 32260524 +1374126579 1182630672 364804866 +2334938774 2586583717 132274954 +3729993364 4148156458 139151684 +2071422638 2398735028 187848689 +461859499 894601505 33205909 +1128085880 3902115759 246040699 +3966758455 1609937892 328208841 +733065750 1045187965 45230417 +3692292913 2718858671 37700451 +1738931445 2854070578 51145436 +3869145048 2758414954 95655624 +446537472 670580619 15322027 +3468753739 2905216014 191278650 +1790076881 1547435538 62502354 +3103241907 3096494664 363656000 +778296167 1014947576 30240389 +2467213728 3653280748 113565446 +2739690951 1959797890 363550956 +430471457 878535490 16066015 +934173831 836762826 41772664 +272165118 90734051 80200203 +2259271327 1128614382 54016290 +1852579235 2323348846 75386182 +808536556 272940204 125637275 +1927965417 4287308142 7659154 +1935624571 1128085880 528502 +352365321 194834068 72750816 +495065408 685902646 150860180 +248265304 170934254 23899814 +975946495 556108732 114471887 +157531253 0 90734051 +3466897907 2756559122 1855832 +2580779174 3494368971 158911777 +425116137 267584884 5355320 +2313287617 1938146733 21651157 + +humidity-to-location map: +2297594568 1304834363 199636291 +964984478 962777545 102011627 +3376226732 2612009119 78542873 +3210191679 3257561655 73324720 +960734175 2732971245 4250303 +3552752951 3643184542 128526794 +1654967093 1268999863 35834500 +2805486965 2087320949 359714826 +72263011 1608745500 171195806 +4225512580 3861994731 69454716 +1240952852 431398165 68767410 +3695056291 298067962 76655045 +1309720262 500165575 32124036 +2768212426 260793423 37274539 +258896561 532289611 263781213 +1967976997 1084282606 71977571 +2255175315 2690551992 42419253 +1514000396 0 28227011 +0 2539746108 72263011 +3283516399 2447035775 92710333 +1233825691 3330886375 7127161 +614836670 2866104927 345897505 +1341844298 88637325 172156098 +2039954568 1779941306 215220747 +3861994731 3931449447 363517849 +1950982711 414403879 16994286 +3454769605 3219988623 37573032 +1690801593 3433704416 164490238 +1855291831 3338013536 95690880 +1195879484 1080226916 4055690 +522677774 1995162053 92158896 +2601505705 796070824 166706721 +2497230859 1504470654 104274846 +1199935174 380513362 33890517 +3492342637 28227011 60410314 +1066996105 2737221548 128883379 +243458817 1064789172 15437744 +3165201791 3598194654 44989888 +3689265936 374723007 5790355 +3681279745 3212002432 7986191 +1542227407 1156260177 112739686 diff --git a/2023/rust/day5/src/lib.rs b/2023/rust/day5/src/lib.rs new file mode 100644 index 0000000..fb3ef96 --- /dev/null +++ b/2023/rust/day5/src/lib.rs @@ -0,0 +1,159 @@ +use std::str::Split; + +fn get_data(data: &mut Split<&str>) -> Vec<Vec<u64>> { + data.nth(0) + .unwrap() + .split(':') + .nth(1) + .unwrap() + .trim_start() + .split('\n') + .map(|x| x.split(' ').map(|y| y.parse::<u64>().unwrap()).collect()) + .collect() +} + +pub fn part1(input: &str) -> u64 { + let mut input = input.trim().split("\n\n"); + + let mut seeds: Vec<u64> = input + .nth(0) + .unwrap() + .split(':') + .nth(1) + .unwrap() + .trim() + .split(' ') + .map(|x| x.parse::<u64>().unwrap()) + .collect(); + + let mut data: Vec<Vec<Vec<u64>>> = vec![]; + for _ in 0..7 { + let x: Vec<Vec<u64>> = get_data(&mut input); + + data.push(x); + } + // 0 -> seed-to-soil + // 1 -> soil-to-fertilizer + // 2 -> fertilizer-to-water + // 3 -> water-to-light + // 4 -> light-to-temperature + // 5 -> temperature-to-humidity + // 6 -> humidity-to-location + + for d in &data { + let mut checked: Vec<u64> = vec![]; + for i in d { + let drs = i[0]; + let srs = i[1]; + let incr = i[2]; + + for seed in &mut seeds { + if !checked.contains(&*seed) && *seed >= srs && *seed <= srs + incr { + *seed = *seed - srs + drs; + checked.push(*seed); + } + } + } + } + + *seeds.iter().min().unwrap() +} + +pub fn part2(input: &str) -> u64 { + let mut input = input.trim().split("\n\n"); + + let s: Vec<u64> = input + .nth(0) + .unwrap() + .split(':') + .nth(1) + .unwrap() + .trim() + .split(' ') + .map(|x| x.parse::<u64>().unwrap()) + .collect(); + + assert_eq!(s.len() % 2, 0); + let mut seeds: Vec<u64> = vec![]; + let mut i = 0; + while i < s.len() { + for j in s[i] as usize..(s[i] + s[i + 1]) as usize { + seeds.push(j as u64); + } + + i += 2; + } + println!("{seeds:?}"); + + let mut data: Vec<Vec<Vec<u64>>> = vec![]; + for _ in 0..7 { + let x: Vec<Vec<u64>> = get_data(&mut input); + + data.push(x); + } + // 0 -> seed-to-soil + // 1 -> soil-to-fertilizer + // 2 -> fertilizer-to-water + // 3 -> water-to-light + // 4 -> light-to-temperature + // 5 -> temperature-to-humidity + // 6 -> humidity-to-location + + for d in &data { + let mut checked: Vec<u64> = vec![]; + for i in d { + let drs = i[0]; + let srs = i[1]; + let incr = i[2]; + + for seed in &mut seeds { + if !checked.contains(&*seed) && *seed >= srs && *seed <= srs + incr { + *seed = *seed - srs + drs; + checked.push(*seed); + } + } + } + } + + let mut res = seeds[0]; + for seed in seeds { + if seed < res { + res = seed; + } + } + + res +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 35); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 251346198); + } + + // #[test] + // fn example_part2() { + // let input = include_str!("../example.txt"); + // let result = part2(input); + // assert_eq!(result, 46); + // } + // + // #[test] + // fn input_part2() { + // let input = include_str!("../input.txt"); + // let result = part2(input); + // assert_eq!(result, 71585); + // } +} diff --git a/2023/rust/day6/Cargo.toml b/2023/rust/day6/Cargo.toml new file mode 100644 index 0000000..89d04ae --- /dev/null +++ b/2023/rust/day6/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day6" +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/rust/day6/example.txt b/2023/rust/day6/example.txt new file mode 100644 index 0000000..28f5ae9 --- /dev/null +++ b/2023/rust/day6/example.txt @@ -0,0 +1,2 @@ +Time: 7 15 30 +Distance: 9 40 200 diff --git a/2023/rust/day6/input.txt b/2023/rust/day6/input.txt new file mode 100644 index 0000000..f4a8fdc --- /dev/null +++ b/2023/rust/day6/input.txt @@ -0,0 +1,3 @@ +Time: 41 66 72 66 +Distance: 244 1047 1228 1040 + diff --git a/2023/rust/day6/src/lib.rs b/2023/rust/day6/src/lib.rs new file mode 100644 index 0000000..b3e33cb --- /dev/null +++ b/2023/rust/day6/src/lib.rs @@ -0,0 +1,102 @@ +pub fn part1(input: &str) -> u64 { + let mut res: u64 = 1; + + let td: Vec<Vec<_>> = input + .trim_end() + .split('\n') + .map(|x| { + x.split(':') + .nth(1) + .unwrap() + .trim() + .replace(" ", " ") + .replace(" ", " ") + .replace(" ", " ") + .split(' ') + .map(|y| y.parse::<u64>().unwrap()) + .collect() + }) + .collect(); + + assert_eq!(td.len(), 2); + let (t, d) = (&td[0], &td[1]); + + for i in 0..t.len() { + let mut r = 0; + for j in 0..t[i] { + if (t[i] - j) * j > d[i] { + r += 1; + } + } + res *= r; + } + + res +} + +pub fn part2(input: &str) -> u64 { + let mut res: u64 = 1; + + let td: Vec<Vec<_>> = input + .trim_end() + .split('\n') + .map(|x| { + x.split(':') + .nth(1) + .unwrap() + .trim() + .replace(" ", "") + .split(' ') + .map(|y| y.parse::<u64>().unwrap()) + .collect() + }) + .collect(); + + assert_eq!(td.len(), 2); + let (t, d) = (&td[0], &td[1]); + + for i in 0..t.len() { + let mut r = 0; + for j in 0..t[i] { + if (t[i] - j) * j > d[i] { + r += 1; + } + } + res *= r; + } + + res +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 288); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 74698); + } + + #[test] + fn example_part2() { + let input = include_str!("../example.txt"); + let result = part2(input); + assert_eq!(result, 71503); + } + + #[test] + fn input_part2() { + let input = include_str!("../input.txt"); + let result = part2(input); + assert_eq!(result, 27563421); + } +} diff --git a/2023/rust/day7/Cargo.toml b/2023/rust/day7/Cargo.toml new file mode 100644 index 0000000..b170ccb --- /dev/null +++ b/2023/rust/day7/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day7" +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/rust/day7/example.txt b/2023/rust/day7/example.txt new file mode 100644 index 0000000..e3500c3 --- /dev/null +++ b/2023/rust/day7/example.txt @@ -0,0 +1,5 @@ +32T3K 765 +T55J5 684 +KK677 28 +KTJJT 220 +QQQJA 483 diff --git a/2023/rust/day7/input.txt b/2023/rust/day7/input.txt new file mode 100644 index 0000000..a39a921 --- /dev/null +++ b/2023/rust/day7/input.txt @@ -0,0 +1,1000 @@ +4KTJ4 575 +38T4K 449 +4T437 860 +55954 240 +Q8K89 150 +85838 21 +68668 464 +JQT77 737 +99497 155 +A444A 653 +AA6QQ 28 +4Q39T 332 +8Q579 835 +58JQ5 397 +KJ77A 271 +88Q8T 365 +AATAJ 30 +3T582 325 +Q8AQQ 321 +KA6J4 215 +KA322 403 +54225 219 +4ATA4 225 +4222A 543 +2J9KK 749 +477AT 561 +6J699 880 +J4348 655 +K4444 175 +775AA 567 +J8AK6 334 +93A58 307 +JT43J 872 +A6662 929 +Q74JK 779 +AQAQQ 827 +55557 902 +6JAA6 512 +676T2 763 +QA3KK 181 +99939 377 +43T44 473 +AK48A 968 +44464 897 +7A454 475 +6JJQ8 496 +5KAKK 419 +77AKT 802 +K4K4K 719 +33739 959 +325K2 534 +93979 751 +QK9AK 290 +8J887 79 +8QKQK 203 +Q657Q 328 +23647 869 +4568K 686 +49374 63 +88882 578 +94A9A 680 +5T5T5 759 +95JJ5 502 +Q66QQ 771 +6A886 845 +74777 982 +2K222 49 +TQTQT 704 +J7KK2 47 +98A5J 187 +66AA6 53 +57J68 443 +Q77Q7 610 +63KJJ 661 +6K46K 803 +K6279 596 +79999 85 +K2J29 592 +3T625 980 +2Q555 236 +3TTQK 687 +924A2 762 +6KQ2K 4 +3473K 418 +22QQ2 947 +J69A7 915 +KJJKK 617 +989K5 993 +333JJ 257 +J27TT 626 +K22KK 942 +2A4A3 801 +49JJK 398 +328J2 50 +4K5Q7 491 +TT2QQ 651 +KA5JQ 773 +A277K 160 +AAQQA 873 +7775A 318 +73377 847 +2J898 366 +88Q88 958 +QQQ2Q 756 +J58AA 996 +387K3 190 +92999 149 +3Q5A9 843 +63434 865 +69992 643 +56983 619 +8T8AK 107 +25Q62 148 +444JJ 364 +24JA6 808 +J8J82 967 +JKA98 347 +455Q8 249 +T65T8 713 +763A8 500 +QAT67 936 +9TT99 143 +39TQ3 425 +2J448 831 +393T9 904 +79KQ6 628 +8JA4Q 371 +8TQ8T 829 +3K2A9 277 +98T77 970 +96T7Q 306 +QKKJK 207 +QTQTQ 791 +2J9QA 344 +T84QQ 137 +J4822 90 +77J77 800 +99994 858 +JK6J7 833 +QQ472 589 +389K6 761 +K35K4 547 +22244 284 +AT78K 164 +A848J 798 +57782 924 +AT998 660 +TQ8TT 663 +4J285 890 +Q7JQQ 960 +88JJJ 370 +JKKK7 866 +22J2J 916 +JT333 292 +555JJ 267 +7K75K 228 +4Q46J 66 +43T63 695 +T6TTT 606 +QQQ82 154 +86JKT 700 +KK464 111 +9QTJ8 541 +QJJQQ 386 +J5989 110 +4JAJT 794 +7K7K6 707 +K4484 747 +JJK9J 3 +97555 10 +6QJ74 717 +95582 975 +T7468 51 +A37A3 416 +KK888 639 +J2223 233 +8T7AA 944 +A3A78 16 +739T6 850 +945T2 654 +6J633 41 +2T222 339 +27469 851 +TT333 811 +A7JA8 129 +T6T93 995 +75488 459 +JQJ58 376 +7J6QQ 941 +TTTT8 787 +27JJJ 705 +JT3Q3 983 +7KKK6 668 +88899 162 +336K7 893 +5A35A 950 +T8T88 903 +7Q4K7 274 +22K27 429 +838J8 469 +27257 792 +J666J 560 +AA2AT 554 +22228 112 +4997K 943 +KJ3J2 431 +KQ373 984 +9J694 901 +65259 917 +58885 372 +JT634 45 +K5777 848 +33TTT 720 +33233 422 +26J7K 114 +K8T45 170 +92A5K 480 +84884 218 +94739 739 +3472J 815 +J5AT4 383 +8QJ3Q 946 +T99T6 891 +46674 135 +T66J7 125 +738QQ 100 +TT4T8 490 +98268 765 +465T6 477 +J77QQ 624 +9K98J 199 +J6666 176 +23KTJ 69 +7779Q 563 +46T7J 871 +8QQQQ 442 +84TK8 965 +KA3T9 326 +AKT25 448 +2J65J 253 +7KK77 714 +74Q44 36 +A498A 684 +359AK 615 +TTTQ5 874 +J22JJ 121 +25247 59 +AJ322 613 +26222 27 +A57T5 355 +89886 544 +K9333 104 +36J98 566 +KQKJ4 142 +22276 716 +Q7222 436 +AAAA4 499 +66KK3 68 +89629 909 +T9KK9 208 +5ATT8 646 +69J59 894 +J68T6 744 +57A2K 454 +93585 92 +JQT63 485 +4K4AA 877 +9936K 986 +6KK6K 65 +44484 841 +76557 672 +8T273 882 +QQ9QQ 956 +K6549 863 +3QJ39 324 +KKKJK 565 +737Q7 562 +99494 641 +TJTJT 445 +46AT4 728 +8K2AT 896 +2QT22 590 +K7JTK 156 +2K929 503 +TT2JT 799 +JAK7A 213 +32K59 470 +87899 881 +K2KK4 579 +K3AJ5 588 +68666 461 +Q4QQK 727 +QA9K8 261 +95999 122 +5A446 885 +3J335 291 +8K685 453 +K5KA5 231 +37KJK 586 +KQ6Q6 532 +QKKKA 82 +9KJ36 846 +83JJ6 202 +33T33 466 +QQQAQ 439 +Q4A94 282 +35AJT 577 +47ATQ 753 +44AAQ 745 +3AA99 330 +88533 774 +T9T6T 971 +5KT6T 685 +A999Q 913 +59555 44 +6J66Q 196 +TA542 268 +55598 487 +926A7 523 +4Q3J9 693 +47274 582 +2Q999 830 +J599T 574 +T6TTJ 116 +6K5A2 358 +88J8A 580 +T22K2 161 +444A4 884 +A5J7A 842 +3JT3T 101 +TATTA 279 +82A82 531 +A9JTA 120 +KK4KT 60 +88J8K 314 +JKKJJ 722 +37797 467 +AA999 555 +52543 145 +55Q55 83 +4444J 408 +TTT97 232 +TKTTK 243 +8J882 602 +AJK6Q 724 +32TK9 536 +7569Q 823 +37777 410 +27772 462 +6T6JA 932 +99448 797 +69669 659 +83T89 382 +QQ68Q 392 +Q94TK 390 +4TTTT 8 +Q7QA7 998 +8JT8A 237 +K7J77 74 +AT5TT 518 +6KK66 336 +83388 89 +867Q2 629 +Q9889 409 +8J7A6 616 +333Q3 511 +333KQ 879 +9TAT9 319 +KQJ46 819 +2AA4A 93 +27774 849 +2T6J4 194 +TTKKA 597 +K9437 535 +K4J48 48 +A5J52 86 +22266 952 +AQ6Q6 245 +QJ24T 669 +QA779 638 +Q4263 694 +QQ7QQ 421 +9942J 174 +TJTJK 173 +T96A9 832 +55553 608 +K78KA 127 +444QQ 305 +AA99A 516 +33J22 348 +Q7TQT 25 +87888 793 +86884 217 +94Q99 742 +A3336 514 +K6492 748 +36363 201 +JT657 474 +AK766 905 +Q333J 788 +494Q4 171 +67776 144 +33939 701 +J8265 557 +97KK7 197 +4T5TJ 614 +44494 109 +99J79 192 +3A9Q9 977 +77783 205 +A4575 14 +8K9QT 226 +8555J 32 +JAAAA 818 +4T4T4 428 +6J6J2 378 +55534 471 +76J5J 752 +3J58J 189 +7A447 681 +9T5TJ 501 +43KAJ 222 +TTJT5 524 +QA9Q5 755 +93Q74 23 +34344 781 +AQT3A 696 +A5855 766 +T532J 259 +4J278 839 +4J56Q 645 +5J588 853 +67K3A 238 +88938 674 +J8A3A 852 +2883T 402 +8Q337 637 +TTT9T 732 +T3666 978 +537J8 128 +56794 167 +3AAQQ 356 +38J38 593 +JJAAA 153 +7676A 301 +AT79K 906 +T6T3T 962 +K845K 95 +4KT79 573 +T5956 825 +2J424 969 +A7847 478 +8T8K8 919 +T88T4 310 +J92J2 368 +6Q636 64 +5943Q 56 +3KKK4 786 +45542 746 +Q6838 551 +8665J 1000 +A3757 312 +KAT4Q 721 +2T623 488 +887J7 252 +5JK55 495 +389J5 353 +77877 13 +8A2QJ 103 +JQ798 342 +85TQ2 709 +QKJ63 39 +5Q5Q5 836 +66762 940 +33AAA 293 +TJTTT 472 +6A7Q2 520 +54455 671 +334QA 75 +JQ455 169 +A4447 360 +77755 484 +KK8K8 394 +2KAAA 289 +7KJ44 886 +43444 286 +5T862 569 +333K3 113 +A5J85 508 +4A3J2 105 +42J92 224 +95922 255 +5947A 961 +K3JJ7 507 +44J49 581 +4474T 712 +AT7TT 273 +74667 925 +JT737 990 +6T222 991 +TT2JJ 70 +52225 159 +66J6A 743 +53533 227 +9J99Q 600 +85888 840 +22527 287 +67A52 895 +8888A 406 +Q5Q8Q 652 +J77JJ 807 +K2252 605 +AA5AA 381 +66966 505 +T87A5 933 +K2848 620 +JQQTQ 140 +JT889 953 +7948K 989 +8648J 393 +AAQAA 862 +69969 42 +9Q998 251 +45KKK 157 +362QA 907 +JQ9KQ 430 +99JQA 838 +QKKQ4 195 +86688 463 +5736T 126 +J5929 62 +6TAQK 198 +378K4 537 +TA3T3 84 +3QQQ8 733 +83T32 178 +K3K23 997 +TAAAA 618 +3J6J3 979 +89QQ9 810 +7Q755 299 +7A875 423 +93275 813 +89K8A 118 +KKTKT 320 +Q6K68 689 +9TK58 481 +47927 612 +2A3AJ 515 +3K343 585 +52554 859 +A7A77 265 +Q88AT 938 +4T3JQ 601 +Q9333 350 +A2A46 374 +Q9JT9 327 +KQ286 254 +QQ2J8 837 +3J333 784 +7777K 587 +252JQ 527 +42222 985 +87QQ8 939 +6JK35 482 +5KTQ9 139 +QQ4JQ 647 +93J37 546 +KTA8J 782 +5A597 741 +A4JAA 385 +QTAQT 29 +AAAKA 545 +7722Q 132 +QQ44J 401 +4Q3QQ 43 +J5494 244 +3K884 844 +24662 828 +2K552 591 +59K24 108 +4T43T 816 +AAJ44 434 +KQKQQ 285 +33433 340 +33449 414 +9TTTJ 568 +JTT64 177 +45J54 730 +66965 492 +TJJK2 313 +A8KQ2 298 +JQ683 564 +927KK 777 +JJJJJ 550 +888J6 679 +5KJ7K 834 +QQQQ6 650 +KKK6K 625 +9KJKA 678 +47Q77 35 +6262J 163 +47T3A 78 +84J82 166 +594KA 649 +27272 607 +9JTT2 420 +9K9KK 180 +6238A 22 +893KJ 987 +4544J 389 +88KT6 783 +696AJ 611 +7A2A7 486 +7845J 335 +T3488 927 +5AAA5 52 +T6TT5 234 +JTT2A 296 +7J747 456 +28J22 785 +Q8AQ9 908 +72JJT 898 +A86J5 440 +94545 94 +T4553 71 +2J96Q 216 +95T45 264 +KKJ2K 223 +JA59A 682 +722AA 692 +3434T 572 +8KK97 806 +2TA2J 517 +3KKTK 526 +ATJ6K 19 +A9K9A 124 +4K943 235 +9A999 395 +74K7K 530 +666J2 757 +9J888 627 +5J572 734 +J8888 387 +478QA 417 +82K5A 667 +KK47K 809 +J3743 81 +T2TA8 945 +A557A 698 +93939 583 +488KK 384 +46464 778 +76665 427 +2J4A4 367 +89663 632 +24444 450 +9K8T6 444 +3393T 438 +545J5 910 +QQJQQ 821 +5A4J4 972 +AAQJA 379 +79977 40 +AT33A 812 +6J669 856 +6JKK7 211 +J2K22 61 +28228 930 +J69AA 210 +7348J 657 +975J5 37 +6J787 920 +7J7J7 34 +96J2J 458 +8888K 117 +4Q867 375 +JA2AT 58 +38535 294 +Q5TT7 17 +AK58K 9 +45KQ2 57 +4J477 411 +29TA7 750 +88Q2T 644 +Q39Q6 767 +56T87 258 +37997 715 +77T77 814 +63KJT 489 +22722 963 +K9999 723 +57J55 887 +79J94 12 +Q77AA 278 +7ATQ3 861 +Q5QQ4 570 +AAA7A 457 +84267 91 +5555J 146 +45544 246 +3558A 106 +J97A2 179 +T3422 2 +78878 441 +44A4Q 796 +QJQ8Q 519 +KQ83Q 333 +3K4K3 283 +A4AA4 548 +72K63 864 +854T7 622 +68968 373 +8K7J2 18 +K923Q 186 +22229 131 +AJ7KT 621 +K8KJ7 559 +4Q444 540 +TT6AK 921 +55J25 804 +66998 900 +555KK 736 +J33A3 388 +J3677 6 +K85A7 665 +K94TJ 735 +T6AQT 415 +5Q68Q 133 +T38T9 256 +349T7 677 +9QTQ2 99 +63644 413 +68J86 876 +63366 1 +AKAJT 703 +25555 248 +Q4788 239 +TTTKT 214 +TAT3K 957 +29292 315 +QATQQ 329 +5ATA5 15 +3A3A2 183 +66787 424 +5QT9T 775 +55K35 934 +K5T4Q 230 +667Q6 115 +Q83J8 275 +6555J 522 +44AK4 711 +TT2TT 923 +JA33A 432 +2272J 922 +58787 688 +423QA 528 +7JK55 529 +68T9J 297 +89777 280 +655T5 483 +33384 948 +46258 404 +TT77T 955 +8AAAA 918 +JQ478 928 +62422 38 +2Q2QQ 754 +6QT54 630 +Q4Q4Q 191 +3J22K 826 +4J499 889 +26J25 875 +69T2K 184 +93333 702 +425TK 726 +Q745J 220 +85J29 346 +T4858 935 +43A38 634 +7JA7A 165 +JQ6QQ 247 +T6282 46 +J9343 363 +84383 300 +7J737 609 +Q9A89 123 +T8T8T 77 +95AK7 98 +87A86 345 +5482A 304 +33338 542 +9TJQ6 188 +9883J 26 +5J537 914 +9JQ45 820 +T2T2A 316 +2KKKK 209 +7529K 974 +7677Q 263 +88QK8 912 +486Q6 764 +AA3TJ 331 +47334 7 +JK8J8 455 +KKQJ5 740 +99J9T 999 +J8AKA 805 +Q5TQJ 966 +6T66T 988 +74J39 892 +A7JA6 357 +534QQ 433 +3J586 994 +TJ32Q 193 +K3KKK 738 +J8488 55 +93AA6 399 +28J82 595 +A7328 262 +366J6 656 +KJ397 640 +37A77 72 +696AA 412 +76J77 426 +K3444 676 +QJQKQ 168 +AA7KK 633 +KKJAA 951 +32Q2Q 31 +5Q6K9 981 +58252 636 +8A887 11 +67788 479 +KAQKA 760 +K7KK7 635 +K2555 666 +5K226 683 +27JT2 521 +AKA88 308 +938Q4 776 +JA5A5 790 +AK66K 468 +63JT5 772 +9Q47K 33 +5K2JQ 405 +36K63 354 +7T8TT 270 +68644 212 +2K2K7 460 +A7ATT 172 +J8K8T 949 +62656 780 +444JT 276 +K8KK7 690 +48K3Q 822 +AQQ86 525 +6A98J 899 +22256 789 +32794 673 +2835K 20 +45456 362 +88555 200 +Q635T 396 +QT646 662 +KK8KK 556 +QQ282 76 +655J6 119 +33363 931 +AA8J8 599 +A2A22 182 +2A293 623 +T849J 96 +52286 699 +82A59 138 +QTQQ8 369 +Q844T 795 +6Q666 67 +KQQQQ 549 +8TA8A 992 +74444 338 +J6543 498 +43JTT 80 +85555 710 +Q6QKQ 134 +QQ3Q3 691 +Q3499 576 +6TQ48 706 +QQQ37 758 +J888J 642 +8Q88Q 494 +26293 708 +J66J3 343 +QT464 317 +TTT59 558 +QA9KQ 309 +3TJTT 883 +9655K 204 +J6999 311 +KTT9K 584 +K9K92 868 +97752 855 +AAT6T 504 +9298A 976 +T37J3 337 +467K7 141 +99QQ9 250 +KJ29Q 857 +22J42 295 +4T27A 870 +2J533 888 +TAA98 631 +K3336 768 +544A5 926 +42657 725 +8533K 260 +AAA2J 400 +57995 452 +4JKJQ 509 +QQK59 867 +TQ469 206 +A844A 380 +263TJ 731 +79J27 185 +9J562 269 +2J222 552 +J7494 447 +TAA3T 493 +2A49Q 658 +33299 435 +5QQQQ 513 +9999J 281 +T5KK2 341 +KJJJ6 451 +K7K5Q 323 +58QKA 648 +JK5KK 24 +K337K 937 +QJ468 302 +KA43T 854 +3TTTT 697 +9KKKK 5 +9T3TT 352 +48788 152 +KKJQA 361 +9954J 349 +TTQJ5 538 +QTTTT 229 +6Q976 533 +4666J 221 +A3323 351 +Q7778 770 +55JTK 73 +5K593 594 +222A2 878 +3KQJK 598 +7K53K 446 +AAJA8 817 +3Q269 272 +QKQAQ 729 +QQ9Q5 675 +7J7A7 147 +JJ99K 603 +58T8T 303 +33572 911 +94J99 824 +9JA33 130 +J4446 670 +J5A9Q 158 +6AAJA 359 +K48KK 954 +QJQ79 102 +7KKAK 964 +56Q73 242 +AJKJK 322 +6TT84 539 +757J7 437 +6T666 718 +TA2QA 476 +23327 241 +44225 510 +949A9 571 +399Q9 97 +J97J9 391 +9AA5A 664 +89599 288 +3JA4T 87 +T3869 151 +9A599 88 +8K884 465 +KTKKJ 973 +78K65 506 +AAAA9 407 +22322 553 +KQ752 54 +KKK55 136 +8K76K 604 +555TK 266 +49K3A 497 +8JJJJ 769 diff --git a/2023/rust/day7/src/lib.rs b/2023/rust/day7/src/lib.rs new file mode 100644 index 0000000..02cd337 --- /dev/null +++ b/2023/rust/day7/src/lib.rs @@ -0,0 +1,153 @@ +use std::{collections::HashMap, str::FromStr}; + +#[derive(Debug, PartialEq, PartialOrd, Eq, Hash)] +enum HandType { + Five, + Four, + Full, + Three, + Two, + One, + High, +} + +#[derive(Debug)] +struct Play { + hand: Vec<u32>, + bid: u32, + hand_type: HandType, +} + +#[derive(Debug)] +struct PlayError; + +impl FromStr for Play { + type Err = PlayError; + + fn from_str(s: &str) -> Result<Self, Self::Err> { + if !s.contains(' ') { + return Err(PlayError); + } + + let s: Vec<String> = s.split(' ').map(|x| x.to_string()).collect(); + if s.len() != 2 { + return Err(PlayError); + } + + let mut diffcards: HashMap<char, u32> = HashMap::new(); + let hand = s[0].chars().collect::<Vec<char>>(); + + for ch in &hand { + if diffcards.contains_key(&ch) { + *(diffcards.get_mut(ch).unwrap()) += 1; + } else { + diffcards.insert(*ch, 1); + } + } + + let card_points: HashMap<char, u32> = HashMap::from([ + ('A', 13), + ('K', 12), + ('Q', 11), + ('J', 10), + ('T', 9), + ('9', 8), + ('8', 7), + ('7', 6), + ('6', 5), + ('5', 4), + ('4', 3), + ('3', 2), + ('2', 1), + ]); + let hand: Vec<_> = hand.iter().map(|x| *card_points.get(&x).unwrap()).collect(); + + let b: Vec<u32> = diffcards.clone().into_values().collect(); + let max_labels: u32 = *b.iter().max().unwrap(); + + let hand_type: HandType = match diffcards.keys().len() { + 1 => HandType::Five, + 2 if max_labels == 4 => HandType::Four, + 2 if max_labels == 3 => HandType::Full, + 3 if max_labels == 3 => HandType::Three, + 3 => HandType::Two, + 4 => HandType::One, + 5 => HandType::High, + _ => panic!("wtf is this?"), + }; + + Ok(Play { + hand, + bid: s[1].parse::<u32>().unwrap(), + hand_type, + }) + } +} + +pub fn part1(input: &str) -> u32 { + let mut res: u32 = 0; + + let plays: Vec<_> = input + .trim_end() + .split('\n') + .map(|x| x.parse::<Play>().unwrap()) + .collect(); + + let mut hs: HashMap<HandType, Vec<Play>> = HashMap::from([ + (HandType::Five, vec![]), + (HandType::Four, vec![]), + (HandType::Full, vec![]), + (HandType::Three, vec![]), + (HandType::Two, vec![]), + (HandType::One, vec![]), + (HandType::High, vec![]), + ]); + + for play in plays { + if let Some(p) = hs.get_mut(&play.hand_type) { + p.push(play); + } + } + + let mut rank = 1; + + for kind in [ + HandType::High, + HandType::One, + HandType::Two, + HandType::Three, + HandType::Full, + HandType::Four, + HandType::Five, + ] { + hs.get_mut(&kind) + .unwrap() + .sort_by(|a, b| a.hand.partial_cmp(&b.hand).unwrap()); + + for h in hs.get(&kind).unwrap() { + res += rank * h.bid; + rank += 1; + } + } + + res +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 6440); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 248179786); + } +} diff --git a/2023/rust/day7_2/Cargo.toml b/2023/rust/day7_2/Cargo.toml new file mode 100644 index 0000000..4f1e5ad --- /dev/null +++ b/2023/rust/day7_2/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day7_2" +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/rust/day7_2/example.txt b/2023/rust/day7_2/example.txt new file mode 100644 index 0000000..e3500c3 --- /dev/null +++ b/2023/rust/day7_2/example.txt @@ -0,0 +1,5 @@ +32T3K 765 +T55J5 684 +KK677 28 +KTJJT 220 +QQQJA 483 diff --git a/2023/rust/day7_2/input.txt b/2023/rust/day7_2/input.txt new file mode 100644 index 0000000..a39a921 --- /dev/null +++ b/2023/rust/day7_2/input.txt @@ -0,0 +1,1000 @@ +4KTJ4 575 +38T4K 449 +4T437 860 +55954 240 +Q8K89 150 +85838 21 +68668 464 +JQT77 737 +99497 155 +A444A 653 +AA6QQ 28 +4Q39T 332 +8Q579 835 +58JQ5 397 +KJ77A 271 +88Q8T 365 +AATAJ 30 +3T582 325 +Q8AQQ 321 +KA6J4 215 +KA322 403 +54225 219 +4ATA4 225 +4222A 543 +2J9KK 749 +477AT 561 +6J699 880 +J4348 655 +K4444 175 +775AA 567 +J8AK6 334 +93A58 307 +JT43J 872 +A6662 929 +Q74JK 779 +AQAQQ 827 +55557 902 +6JAA6 512 +676T2 763 +QA3KK 181 +99939 377 +43T44 473 +AK48A 968 +44464 897 +7A454 475 +6JJQ8 496 +5KAKK 419 +77AKT 802 +K4K4K 719 +33739 959 +325K2 534 +93979 751 +QK9AK 290 +8J887 79 +8QKQK 203 +Q657Q 328 +23647 869 +4568K 686 +49374 63 +88882 578 +94A9A 680 +5T5T5 759 +95JJ5 502 +Q66QQ 771 +6A886 845 +74777 982 +2K222 49 +TQTQT 704 +J7KK2 47 +98A5J 187 +66AA6 53 +57J68 443 +Q77Q7 610 +63KJJ 661 +6K46K 803 +K6279 596 +79999 85 +K2J29 592 +3T625 980 +2Q555 236 +3TTQK 687 +924A2 762 +6KQ2K 4 +3473K 418 +22QQ2 947 +J69A7 915 +KJJKK 617 +989K5 993 +333JJ 257 +J27TT 626 +K22KK 942 +2A4A3 801 +49JJK 398 +328J2 50 +4K5Q7 491 +TT2QQ 651 +KA5JQ 773 +A277K 160 +AAQQA 873 +7775A 318 +73377 847 +2J898 366 +88Q88 958 +QQQ2Q 756 +J58AA 996 +387K3 190 +92999 149 +3Q5A9 843 +63434 865 +69992 643 +56983 619 +8T8AK 107 +25Q62 148 +444JJ 364 +24JA6 808 +J8J82 967 +JKA98 347 +455Q8 249 +T65T8 713 +763A8 500 +QAT67 936 +9TT99 143 +39TQ3 425 +2J448 831 +393T9 904 +79KQ6 628 +8JA4Q 371 +8TQ8T 829 +3K2A9 277 +98T77 970 +96T7Q 306 +QKKJK 207 +QTQTQ 791 +2J9QA 344 +T84QQ 137 +J4822 90 +77J77 800 +99994 858 +JK6J7 833 +QQ472 589 +389K6 761 +K35K4 547 +22244 284 +AT78K 164 +A848J 798 +57782 924 +AT998 660 +TQ8TT 663 +4J285 890 +Q7JQQ 960 +88JJJ 370 +JKKK7 866 +22J2J 916 +JT333 292 +555JJ 267 +7K75K 228 +4Q46J 66 +43T63 695 +T6TTT 606 +QQQ82 154 +86JKT 700 +KK464 111 +9QTJ8 541 +QJJQQ 386 +J5989 110 +4JAJT 794 +7K7K6 707 +K4484 747 +JJK9J 3 +97555 10 +6QJ74 717 +95582 975 +T7468 51 +A37A3 416 +KK888 639 +J2223 233 +8T7AA 944 +A3A78 16 +739T6 850 +945T2 654 +6J633 41 +2T222 339 +27469 851 +TT333 811 +A7JA8 129 +T6T93 995 +75488 459 +JQJ58 376 +7J6QQ 941 +TTTT8 787 +27JJJ 705 +JT3Q3 983 +7KKK6 668 +88899 162 +336K7 893 +5A35A 950 +T8T88 903 +7Q4K7 274 +22K27 429 +838J8 469 +27257 792 +J666J 560 +AA2AT 554 +22228 112 +4997K 943 +KJ3J2 431 +KQ373 984 +9J694 901 +65259 917 +58885 372 +JT634 45 +K5777 848 +33TTT 720 +33233 422 +26J7K 114 +K8T45 170 +92A5K 480 +84884 218 +94739 739 +3472J 815 +J5AT4 383 +8QJ3Q 946 +T99T6 891 +46674 135 +T66J7 125 +738QQ 100 +TT4T8 490 +98268 765 +465T6 477 +J77QQ 624 +9K98J 199 +J6666 176 +23KTJ 69 +7779Q 563 +46T7J 871 +8QQQQ 442 +84TK8 965 +KA3T9 326 +AKT25 448 +2J65J 253 +7KK77 714 +74Q44 36 +A498A 684 +359AK 615 +TTTQ5 874 +J22JJ 121 +25247 59 +AJ322 613 +26222 27 +A57T5 355 +89886 544 +K9333 104 +36J98 566 +KQKJ4 142 +22276 716 +Q7222 436 +AAAA4 499 +66KK3 68 +89629 909 +T9KK9 208 +5ATT8 646 +69J59 894 +J68T6 744 +57A2K 454 +93585 92 +JQT63 485 +4K4AA 877 +9936K 986 +6KK6K 65 +44484 841 +76557 672 +8T273 882 +QQ9QQ 956 +K6549 863 +3QJ39 324 +KKKJK 565 +737Q7 562 +99494 641 +TJTJT 445 +46AT4 728 +8K2AT 896 +2QT22 590 +K7JTK 156 +2K929 503 +TT2JT 799 +JAK7A 213 +32K59 470 +87899 881 +K2KK4 579 +K3AJ5 588 +68666 461 +Q4QQK 727 +QA9K8 261 +95999 122 +5A446 885 +3J335 291 +8K685 453 +K5KA5 231 +37KJK 586 +KQ6Q6 532 +QKKKA 82 +9KJ36 846 +83JJ6 202 +33T33 466 +QQQAQ 439 +Q4A94 282 +35AJT 577 +47ATQ 753 +44AAQ 745 +3AA99 330 +88533 774 +T9T6T 971 +5KT6T 685 +A999Q 913 +59555 44 +6J66Q 196 +TA542 268 +55598 487 +926A7 523 +4Q3J9 693 +47274 582 +2Q999 830 +J599T 574 +T6TTJ 116 +6K5A2 358 +88J8A 580 +T22K2 161 +444A4 884 +A5J7A 842 +3JT3T 101 +TATTA 279 +82A82 531 +A9JTA 120 +KK4KT 60 +88J8K 314 +JKKJJ 722 +37797 467 +AA999 555 +52543 145 +55Q55 83 +4444J 408 +TTT97 232 +TKTTK 243 +8J882 602 +AJK6Q 724 +32TK9 536 +7569Q 823 +37777 410 +27772 462 +6T6JA 932 +99448 797 +69669 659 +83T89 382 +QQ68Q 392 +Q94TK 390 +4TTTT 8 +Q7QA7 998 +8JT8A 237 +K7J77 74 +AT5TT 518 +6KK66 336 +83388 89 +867Q2 629 +Q9889 409 +8J7A6 616 +333Q3 511 +333KQ 879 +9TAT9 319 +KQJ46 819 +2AA4A 93 +27774 849 +2T6J4 194 +TTKKA 597 +K9437 535 +K4J48 48 +A5J52 86 +22266 952 +AQ6Q6 245 +QJ24T 669 +QA779 638 +Q4263 694 +QQ7QQ 421 +9942J 174 +TJTJK 173 +T96A9 832 +55553 608 +K78KA 127 +444QQ 305 +AA99A 516 +33J22 348 +Q7TQT 25 +87888 793 +86884 217 +94Q99 742 +A3336 514 +K6492 748 +36363 201 +JT657 474 +AK766 905 +Q333J 788 +494Q4 171 +67776 144 +33939 701 +J8265 557 +97KK7 197 +4T5TJ 614 +44494 109 +99J79 192 +3A9Q9 977 +77783 205 +A4575 14 +8K9QT 226 +8555J 32 +JAAAA 818 +4T4T4 428 +6J6J2 378 +55534 471 +76J5J 752 +3J58J 189 +7A447 681 +9T5TJ 501 +43KAJ 222 +TTJT5 524 +QA9Q5 755 +93Q74 23 +34344 781 +AQT3A 696 +A5855 766 +T532J 259 +4J278 839 +4J56Q 645 +5J588 853 +67K3A 238 +88938 674 +J8A3A 852 +2883T 402 +8Q337 637 +TTT9T 732 +T3666 978 +537J8 128 +56794 167 +3AAQQ 356 +38J38 593 +JJAAA 153 +7676A 301 +AT79K 906 +T6T3T 962 +K845K 95 +4KT79 573 +T5956 825 +2J424 969 +A7847 478 +8T8K8 919 +T88T4 310 +J92J2 368 +6Q636 64 +5943Q 56 +3KKK4 786 +45542 746 +Q6838 551 +8665J 1000 +A3757 312 +KAT4Q 721 +2T623 488 +887J7 252 +5JK55 495 +389J5 353 +77877 13 +8A2QJ 103 +JQ798 342 +85TQ2 709 +QKJ63 39 +5Q5Q5 836 +66762 940 +33AAA 293 +TJTTT 472 +6A7Q2 520 +54455 671 +334QA 75 +JQ455 169 +A4447 360 +77755 484 +KK8K8 394 +2KAAA 289 +7KJ44 886 +43444 286 +5T862 569 +333K3 113 +A5J85 508 +4A3J2 105 +42J92 224 +95922 255 +5947A 961 +K3JJ7 507 +44J49 581 +4474T 712 +AT7TT 273 +74667 925 +JT737 990 +6T222 991 +TT2JJ 70 +52225 159 +66J6A 743 +53533 227 +9J99Q 600 +85888 840 +22527 287 +67A52 895 +8888A 406 +Q5Q8Q 652 +J77JJ 807 +K2252 605 +AA5AA 381 +66966 505 +T87A5 933 +K2848 620 +JQQTQ 140 +JT889 953 +7948K 989 +8648J 393 +AAQAA 862 +69969 42 +9Q998 251 +45KKK 157 +362QA 907 +JQ9KQ 430 +99JQA 838 +QKKQ4 195 +86688 463 +5736T 126 +J5929 62 +6TAQK 198 +378K4 537 +TA3T3 84 +3QQQ8 733 +83T32 178 +K3K23 997 +TAAAA 618 +3J6J3 979 +89QQ9 810 +7Q755 299 +7A875 423 +93275 813 +89K8A 118 +KKTKT 320 +Q6K68 689 +9TK58 481 +47927 612 +2A3AJ 515 +3K343 585 +52554 859 +A7A77 265 +Q88AT 938 +4T3JQ 601 +Q9333 350 +A2A46 374 +Q9JT9 327 +KQ286 254 +QQ2J8 837 +3J333 784 +7777K 587 +252JQ 527 +42222 985 +87QQ8 939 +6JK35 482 +5KTQ9 139 +QQ4JQ 647 +93J37 546 +KTA8J 782 +5A597 741 +A4JAA 385 +QTAQT 29 +AAAKA 545 +7722Q 132 +QQ44J 401 +4Q3QQ 43 +J5494 244 +3K884 844 +24662 828 +2K552 591 +59K24 108 +4T43T 816 +AAJ44 434 +KQKQQ 285 +33433 340 +33449 414 +9TTTJ 568 +JTT64 177 +45J54 730 +66965 492 +TJJK2 313 +A8KQ2 298 +JQ683 564 +927KK 777 +JJJJJ 550 +888J6 679 +5KJ7K 834 +QQQQ6 650 +KKK6K 625 +9KJKA 678 +47Q77 35 +6262J 163 +47T3A 78 +84J82 166 +594KA 649 +27272 607 +9JTT2 420 +9K9KK 180 +6238A 22 +893KJ 987 +4544J 389 +88KT6 783 +696AJ 611 +7A2A7 486 +7845J 335 +T3488 927 +5AAA5 52 +T6TT5 234 +JTT2A 296 +7J747 456 +28J22 785 +Q8AQ9 908 +72JJT 898 +A86J5 440 +94545 94 +T4553 71 +2J96Q 216 +95T45 264 +KKJ2K 223 +JA59A 682 +722AA 692 +3434T 572 +8KK97 806 +2TA2J 517 +3KKTK 526 +ATJ6K 19 +A9K9A 124 +4K943 235 +9A999 395 +74K7K 530 +666J2 757 +9J888 627 +5J572 734 +J8888 387 +478QA 417 +82K5A 667 +KK47K 809 +J3743 81 +T2TA8 945 +A557A 698 +93939 583 +488KK 384 +46464 778 +76665 427 +2J4A4 367 +89663 632 +24444 450 +9K8T6 444 +3393T 438 +545J5 910 +QQJQQ 821 +5A4J4 972 +AAQJA 379 +79977 40 +AT33A 812 +6J669 856 +6JKK7 211 +J2K22 61 +28228 930 +J69AA 210 +7348J 657 +975J5 37 +6J787 920 +7J7J7 34 +96J2J 458 +8888K 117 +4Q867 375 +JA2AT 58 +38535 294 +Q5TT7 17 +AK58K 9 +45KQ2 57 +4J477 411 +29TA7 750 +88Q2T 644 +Q39Q6 767 +56T87 258 +37997 715 +77T77 814 +63KJT 489 +22722 963 +K9999 723 +57J55 887 +79J94 12 +Q77AA 278 +7ATQ3 861 +Q5QQ4 570 +AAA7A 457 +84267 91 +5555J 146 +45544 246 +3558A 106 +J97A2 179 +T3422 2 +78878 441 +44A4Q 796 +QJQ8Q 519 +KQ83Q 333 +3K4K3 283 +A4AA4 548 +72K63 864 +854T7 622 +68968 373 +8K7J2 18 +K923Q 186 +22229 131 +AJ7KT 621 +K8KJ7 559 +4Q444 540 +TT6AK 921 +55J25 804 +66998 900 +555KK 736 +J33A3 388 +J3677 6 +K85A7 665 +K94TJ 735 +T6AQT 415 +5Q68Q 133 +T38T9 256 +349T7 677 +9QTQ2 99 +63644 413 +68J86 876 +63366 1 +AKAJT 703 +25555 248 +Q4788 239 +TTTKT 214 +TAT3K 957 +29292 315 +QATQQ 329 +5ATA5 15 +3A3A2 183 +66787 424 +5QT9T 775 +55K35 934 +K5T4Q 230 +667Q6 115 +Q83J8 275 +6555J 522 +44AK4 711 +TT2TT 923 +JA33A 432 +2272J 922 +58787 688 +423QA 528 +7JK55 529 +68T9J 297 +89777 280 +655T5 483 +33384 948 +46258 404 +TT77T 955 +8AAAA 918 +JQ478 928 +62422 38 +2Q2QQ 754 +6QT54 630 +Q4Q4Q 191 +3J22K 826 +4J499 889 +26J25 875 +69T2K 184 +93333 702 +425TK 726 +Q745J 220 +85J29 346 +T4858 935 +43A38 634 +7JA7A 165 +JQ6QQ 247 +T6282 46 +J9343 363 +84383 300 +7J737 609 +Q9A89 123 +T8T8T 77 +95AK7 98 +87A86 345 +5482A 304 +33338 542 +9TJQ6 188 +9883J 26 +5J537 914 +9JQ45 820 +T2T2A 316 +2KKKK 209 +7529K 974 +7677Q 263 +88QK8 912 +486Q6 764 +AA3TJ 331 +47334 7 +JK8J8 455 +KKQJ5 740 +99J9T 999 +J8AKA 805 +Q5TQJ 966 +6T66T 988 +74J39 892 +A7JA6 357 +534QQ 433 +3J586 994 +TJ32Q 193 +K3KKK 738 +J8488 55 +93AA6 399 +28J82 595 +A7328 262 +366J6 656 +KJ397 640 +37A77 72 +696AA 412 +76J77 426 +K3444 676 +QJQKQ 168 +AA7KK 633 +KKJAA 951 +32Q2Q 31 +5Q6K9 981 +58252 636 +8A887 11 +67788 479 +KAQKA 760 +K7KK7 635 +K2555 666 +5K226 683 +27JT2 521 +AKA88 308 +938Q4 776 +JA5A5 790 +AK66K 468 +63JT5 772 +9Q47K 33 +5K2JQ 405 +36K63 354 +7T8TT 270 +68644 212 +2K2K7 460 +A7ATT 172 +J8K8T 949 +62656 780 +444JT 276 +K8KK7 690 +48K3Q 822 +AQQ86 525 +6A98J 899 +22256 789 +32794 673 +2835K 20 +45456 362 +88555 200 +Q635T 396 +QT646 662 +KK8KK 556 +QQ282 76 +655J6 119 +33363 931 +AA8J8 599 +A2A22 182 +2A293 623 +T849J 96 +52286 699 +82A59 138 +QTQQ8 369 +Q844T 795 +6Q666 67 +KQQQQ 549 +8TA8A 992 +74444 338 +J6543 498 +43JTT 80 +85555 710 +Q6QKQ 134 +QQ3Q3 691 +Q3499 576 +6TQ48 706 +QQQ37 758 +J888J 642 +8Q88Q 494 +26293 708 +J66J3 343 +QT464 317 +TTT59 558 +QA9KQ 309 +3TJTT 883 +9655K 204 +J6999 311 +KTT9K 584 +K9K92 868 +97752 855 +AAT6T 504 +9298A 976 +T37J3 337 +467K7 141 +99QQ9 250 +KJ29Q 857 +22J42 295 +4T27A 870 +2J533 888 +TAA98 631 +K3336 768 +544A5 926 +42657 725 +8533K 260 +AAA2J 400 +57995 452 +4JKJQ 509 +QQK59 867 +TQ469 206 +A844A 380 +263TJ 731 +79J27 185 +9J562 269 +2J222 552 +J7494 447 +TAA3T 493 +2A49Q 658 +33299 435 +5QQQQ 513 +9999J 281 +T5KK2 341 +KJJJ6 451 +K7K5Q 323 +58QKA 648 +JK5KK 24 +K337K 937 +QJ468 302 +KA43T 854 +3TTTT 697 +9KKKK 5 +9T3TT 352 +48788 152 +KKJQA 361 +9954J 349 +TTQJ5 538 +QTTTT 229 +6Q976 533 +4666J 221 +A3323 351 +Q7778 770 +55JTK 73 +5K593 594 +222A2 878 +3KQJK 598 +7K53K 446 +AAJA8 817 +3Q269 272 +QKQAQ 729 +QQ9Q5 675 +7J7A7 147 +JJ99K 603 +58T8T 303 +33572 911 +94J99 824 +9JA33 130 +J4446 670 +J5A9Q 158 +6AAJA 359 +K48KK 954 +QJQ79 102 +7KKAK 964 +56Q73 242 +AJKJK 322 +6TT84 539 +757J7 437 +6T666 718 +TA2QA 476 +23327 241 +44225 510 +949A9 571 +399Q9 97 +J97J9 391 +9AA5A 664 +89599 288 +3JA4T 87 +T3869 151 +9A599 88 +8K884 465 +KTKKJ 973 +78K65 506 +AAAA9 407 +22322 553 +KQ752 54 +KKK55 136 +8K76K 604 +555TK 266 +49K3A 497 +8JJJJ 769 diff --git a/2023/rust/day7_2/src/lib.rs b/2023/rust/day7_2/src/lib.rs new file mode 100644 index 0000000..2651e98 --- /dev/null +++ b/2023/rust/day7_2/src/lib.rs @@ -0,0 +1,189 @@ +use std::{collections::HashMap, str::FromStr}; + +#[derive(Debug, PartialEq, PartialOrd, Eq, Hash)] +enum HandType { + Five, + Four, + Full, + Three, + Two, + One, + High, +} + +#[derive(Debug)] +struct Play { + hand: Vec<u32>, + bid: u32, + hand_type: HandType, +} + +#[derive(Debug)] +struct PlayError; + +impl FromStr for Play { + type Err = PlayError; + + fn from_str(s: &str) -> Result<Self, Self::Err> { + if !s.contains(' ') { + return Err(PlayError); + } + + let s: Vec<String> = s.split(' ').map(|x| x.to_string()).collect(); + if s.len() != 2 { + return Err(PlayError); + } + + let mut diffcards: HashMap<char, u32> = HashMap::new(); + let hand = s[0].chars().collect::<Vec<char>>(); + + for ch in &hand { + if diffcards.contains_key(&ch) { + *(diffcards.get_mut(ch).unwrap()) += 1; + } else { + diffcards.insert(*ch, 1); + } + } + + let card_points: HashMap<char, u32> = HashMap::from([ + ('A', 13), + ('K', 12), + ('Q', 11), + ('T', 9), + ('9', 8), + ('8', 7), + ('7', 6), + ('6', 5), + ('5', 4), + ('4', 3), + ('3', 2), + ('2', 1), + ('J', 0), + ]); + let hand: Vec<_> = hand.iter().map(|x| *card_points.get(&x).unwrap()).collect(); + let jokers = hand.iter().filter(|&n| *n == 0).count(); + let b: Vec<u32> = diffcards.clone().into_values().collect(); + let max_labels: u32 = *b.iter().max().unwrap(); + + let mut hand_type: HandType = match diffcards.keys().len() { + 1 => HandType::Five, + 2 if max_labels == 4 => HandType::Four, + 2 if max_labels == 3 => HandType::Full, + 3 if max_labels == 3 => HandType::Three, + 3 => HandType::Two, + 4 => HandType::One, + 5 => HandType::High, + _ => panic!("wtf is this?"), + }; + + match jokers { + 1 => { + hand_type = match hand_type { + HandType::High => HandType::One, + HandType::One => HandType::Three, + HandType::Two => HandType::Full, + HandType::Three => HandType::Four, + HandType::Four => HandType::Five, + _ => panic!("wtf is this?"), + } + } + 2 => { + hand_type = match hand_type { + HandType::One => HandType::Three, + HandType::Two => HandType::Four, + HandType::Full => HandType::Five, + _ => panic!("wtf is this?"), + } + } + 3 => { + hand_type = match hand_type { + HandType::High => HandType::Three, + HandType::One => HandType::Four, + HandType::Two => HandType::Five, + HandType::Three => HandType::Four, + HandType::Full => HandType::Five, + _ => panic!("wtf is this?"), + } + } + 4 => { + hand_type = HandType::Five; + } + 0 | 5 => {} + _ => panic!("wtf is this?"), + }; + + Ok(Play { + hand, + bid: s[1].parse::<u32>().unwrap(), + hand_type, + }) + } +} + +pub fn part2(input: &str) -> u32 { + let mut res: u32 = 0; + + let plays: Vec<_> = input + .trim_end() + .split('\n') + .map(|x| x.parse::<Play>().unwrap()) + .collect(); + + let mut hs: HashMap<HandType, Vec<Play>> = HashMap::from([ + (HandType::Five, vec![]), + (HandType::Four, vec![]), + (HandType::Full, vec![]), + (HandType::Three, vec![]), + (HandType::Two, vec![]), + (HandType::One, vec![]), + (HandType::High, vec![]), + ]); + + for play in plays { + if let Some(p) = hs.get_mut(&play.hand_type) { + p.push(play); + } + } + + let mut rank = 1; + + for kind in [ + HandType::High, + HandType::One, + HandType::Two, + HandType::Three, + HandType::Full, + HandType::Four, + HandType::Five, + ] { + hs.get_mut(&kind) + .unwrap() + .sort_by(|a, b| a.hand.partial_cmp(&b.hand).unwrap()); + + for h in hs.get(&kind).unwrap() { + res += rank * h.bid; + rank += 1; + } + } + + res +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part2() { + let input = include_str!("../example.txt"); + let result = part2(input); + assert_eq!(result, 5905); + } + + #[test] + fn input_part2() { + let input = include_str!("../input.txt"); + let result = part2(input); + assert_eq!(result, 247885995); + } +} diff --git a/2023/rust/day8/Cargo.toml b/2023/rust/day8/Cargo.toml new file mode 100644 index 0000000..4879259 --- /dev/null +++ b/2023/rust/day8/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day8" +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/rust/day8/example.txt b/2023/rust/day8/example.txt new file mode 100644 index 0000000..9029a1b --- /dev/null +++ b/2023/rust/day8/example.txt @@ -0,0 +1,9 @@ +RL + +AAA = (BBB, CCC) +BBB = (DDD, EEE) +CCC = (ZZZ, GGG) +DDD = (DDD, DDD) +EEE = (EEE, EEE) +GGG = (GGG, GGG) +ZZZ = (ZZZ, ZZZ) diff --git a/2023/rust/day8/example2.txt b/2023/rust/day8/example2.txt new file mode 100644 index 0000000..5b3fa58 --- /dev/null +++ b/2023/rust/day8/example2.txt @@ -0,0 +1,10 @@ +LR + +11A = (11B, XXX) +11B = (XXX, 11Z) +11Z = (11B, XXX) +22A = (22B, XXX) +22B = (22C, 22C) +22C = (22Z, 22Z) +22Z = (22B, 22B) +XXX = (XXX, XXX) diff --git a/2023/rust/day8/input.txt b/2023/rust/day8/input.txt new file mode 100644 index 0000000..ac178d0 --- /dev/null +++ b/2023/rust/day8/input.txt @@ -0,0 +1,796 @@ +LRRLRLRRRLLRLRRRLRLLRLRLRRLRLRRLRRLRLRLLRRRLRRLLRRRLRRLRRRLRRLRLRLLRRLRLRRLLRRRLLLRRRLLLRRLRLRRLRLLRRRLRRLRRRLRRLLRRRLRRRLRRRLRLRRLRLRRRLRRRLRRLRLRRLLRRRLRRLLRRLRRLRLRLRRRLRLLRRRLRRLRRRLLRRLLLLLRRRLRRLLLRRRLRRRLRRLRLLLLLRLRRRLRRRLRLRRLLLLRLRRRLLRRRLRRRLRLRLRRLRRLRRLRLRLLLRLRRLRRLRRRLRRRLLRRRR + +RBX = (TMF, KTP) +RBP = (MKS, MKS) +CGR = (XDR, VDX) +KBX = (DGP, JKM) +BNJ = (NJC, QRL) +BXQ = (DKX, CJQ) +NDX = (PHJ, TRQ) +KFQ = (KXN, GBQ) +LRF = (CTS, MTT) +RTN = (VMK, JTK) +QKP = (FDS, SFG) +BVB = (BHS, VRQ) +NBT = (BPJ, DFF) +HQM = (QMV, XVG) +XMR = (RKH, NJQ) +PHC = (XHP, DKM) +HTX = (BXK, BQP) +TPJ = (TNQ, QDX) +RDJ = (KHB, MFG) +XTF = (PPR, FHG) +DVA = (DBM, MVD) +HFP = (CXV, VCD) +HPS = (GTD, NBL) +LBK = (FVN, LHX) +KKS = (FKM, LHN) +FJV = (LVN, PLP) +MLH = (SFR, RJK) +SVQ = (RCS, FFD) +PTB = (TMC, QCR) +RFL = (RXP, VRL) +PTH = (XTS, GFG) +QNM = (TJR, MHX) +BJT = (PJG, SHG) +JJD = (FMJ, QVV) +GMX = (CLD, QRM) +DGZ = (BSL, BRS) +BVM = (SFC, JGD) +GNQ = (PLP, LVN) +XPG = (VLH, BCM) +PND = (RXV, VGM) +RNV = (GVL, MTB) +JSG = (QVP, XCX) +QHP = (KQG, BML) +XBK = (NPP, CRN) +QRL = (RQH, BGH) +HDJ = (VRQ, BHS) +XPD = (HSB, LRC) +KJK = (XCV, MDG) +NJB = (RKL, SHQ) +MCQ = (XFT, MRQ) +QRC = (XVS, CSN) +FCT = (DFF, BPJ) +MTF = (PQT, CNQ) +RXG = (QVP, XCX) +MVZ = (QRC, GHJ) +RKL = (QQM, BFT) +VRT = (GMJ, BDK) +BNS = (HQV, HPS) +JSQ = (HTC, PGD) +BHB = (VGQ, BTM) +NLP = (RKB, XQB) +FGF = (CVK, VRT) +FPM = (GDS, LTG) +BCX = (NDX, GSL) +GVL = (VCX, PSP) +KRM = (MHK, JCX) +GLJ = (XNX, RKP) +LBV = (FDC, TPJ) +GSP = (KMC, LQR) +TFR = (HXJ, MFJ) +DLX = (FNK, GLJ) +DKX = (XSR, LHP) +SVR = (KPX, QTM) +JMT = (GXV, RTX) +XSX = (HHD, HHD) +RJF = (BRH, HGP) +BDK = (TGX, HKP) +TFF = (DSX, DSX) +TJR = (BKB, LCB) +BDQ = (CLD, QRM) +NTC = (BQL, BQL) +CVS = (RQC, FFV) +BML = (VNT, JRH) +CBK = (TGB, RTN) +HQV = (GTD, NBL) +PDT = (SRQ, MLD) +RXV = (KJK, FCD) +XTS = (SCG, KQJ) +PXG = (LKG, MTQ) +PCX = (FKJ, FCV) +HKR = (LMK, BJR) +CKK = (XSX, XSX) +TNP = (TDH, JPR) +PCH = (RBP, PQH) +KHB = (RQR, BXQ) +CJZ = (CNC, HJX) +JPN = (FRP, QTB) +RKP = (NKH, FQC) +BDP = (GCM, VKT) +HQX = (TQF, NJB) +PFV = (FPM, VNP) +NFQ = (GFX, GXH) +STX = (MCQ, DNS) +CKX = (CFS, BNS) +NRJ = (SBG, TLK) +DHS = (VBH, VMT) +TVL = (BPQ, NBM) +QTF = (MPS, RJB) +FHV = (LMK, BJR) +JCV = (JSQ, STQ) +RGX = (GVL, MTB) +CTS = (PCB, GJV) +RCS = (TNT, XTF) +PCS = (NJH, RLX) +KNG = (CHP, FNN) +FJL = (KKH, QGQ) +CPK = (KTX, CGR) +BLF = (PCQ, TKN) +FCR = (STF, SVQ) +BSL = (GFJ, CDL) +FKS = (GRG, JSB) +FCM = (LFX, RJF) +XLK = (CDP, CBD) +KNB = (VGQ, BTM) +KGC = (TJR, MHX) +JHM = (JSP, XDN) +HFN = (STF, SVQ) +GCM = (CKX, KPS) +CGV = (MHK, JCX) +TQP = (JRM, XSB) +GSM = (FJV, GNQ) +KBL = (DLX, BGD) +CBC = (MQK, RRF) +NJM = (KLQ, BVL) +THG = (CPG, PND) +DXP = (HDJ, BVB) +DTT = (XDN, JSP) +PLP = (BKF, FGP) +MSZ = (MVD, DBM) +BQC = (NPL, VXF) +CGB = (LRM, MTH) +RLX = (DBT, RJN) +RXP = (HFP, JNS) +TTH = (QNF, KNG) +LHS = (QFR, GTN) +NBL = (THT, VTQ) +DRS = (PJH, STX) +PSP = (CPK, QKF) +PPR = (LQK, VSN) +QHT = (RLG, TDG) +FVM = (MLR, HXF) +DHB = (CQC, BKK) +MVP = (GHJ, QRC) +TDG = (RVX, CDB) +LKN = (HXF, MLR) +CNR = (KCV, CDR) +SMC = (BBR, BMS) +QDP = (LXV, VPS) +LLD = (CGC, NGQ) +KXN = (PRR, PSR) +LRC = (SHB, PBK) +SQD = (LBV, CRP) +QTB = (KNS, JTS) +MTT = (GJV, PCB) +GMV = (JNH, MJF) +DTG = (SQD, KVV) +RTV = (DSB, SJB) +CDL = (FTQ, CPN) +JHR = (JRM, XSB) +BFP = (PFG, MTD) +DTB = (NDX, GSL) +SQM = (CXL, NBD) +NBP = (KBN, LQH) +BTC = (LJT, TCV) +PQT = (PXG, BSF) +QDH = (FPM, VNP) +VPT = (PRT, VHJ) +VKC = (GXK, QSB) +NXB = (QKP, TGK) +FDF = (VRT, CVK) +NTG = (FRV, BQR) +RKB = (PHC, JSD) +MHV = (XXL, THG) +PHV = (SNM, TFR) +XRK = (JNN, LKR) +XVS = (CBK, NNM) +GDQ = (BDQ, GMX) +TKR = (CKJ, LVQ) +XCX = (LSP, FNB) +JCX = (FGF, FDF) +MFJ = (DBB, HBH) +BQP = (HRT, DQD) +VNC = (BDQ, GMX) +SSC = (LQH, KBN) +TJD = (QFV, KRS) +NKL = (CKK, DDC) +NTM = (QHG, MCC) +JBQ = (HXV, JPN) +DGP = (FVM, LKN) +SJB = (LRQ, DMG) +LJT = (MMT, MDL) +RFC = (MVM, JXP) +FFV = (TPG, QMD) +PJH = (DNS, MCQ) +VCD = (FHV, HKR) +MPS = (DHH, LPT) +VHJ = (RGX, RNV) +FLT = (FRF, NHG) +DSF = (SDV, VKC) +HJQ = (CDR, KCV) +BQR = (PDX, PMX) +CRJ = (BPN, KKS) +MQN = (PNN, DHB) +KCC = (KMC, LQR) +BTH = (VLH, BCM) +KNS = (GGM, SJS) +SCG = (MBF, RDR) +VDQ = (JNN, LKR) +XFT = (VPT, FLH) +RDR = (GTF, GJR) +CXS = (RRF, MQK) +XDN = (SSF, VGC) +JPR = (VGX, TCF) +BTF = (LKM, GBG) +GCJ = (VPS, LXV) +FGJ = (XVG, QMV) +MBF = (GJR, GTF) +TPG = (TND, QSF) +BNR = (BHG, SMC) +GJV = (FLB, PCX) +LQF = (BJT, KTN) +VSB = (JVB, FVK) +NHB = (HQX, LLQ) +CKC = (PJD, TRS) +JVB = (QQV, NRS) +BKK = (LSR, LJN) +SBV = (GTN, QFR) +JMK = (MFG, KHB) +LPX = (NBP, SSC) +KLJ = (CDX, VTL) +KQJ = (RDR, MBF) +VMK = (JXJ, BMT) +TRS = (LQM, JJD) +KCM = (XBD, XMH) +JCT = (NFQ, NDJ) +FGM = (HMK, PGQ) +QKK = (RLS, LPX) +QJD = (PDT, RPQ) +LHP = (PLN, MQN) +NPL = (TFF, TFF) +XHP = (PJQ, KBL) +HMK = (JNV, XPS) +KMC = (VCG, NTG) +QDX = (TMM, HHM) +VNP = (LTG, GDS) +PDR = (CDX, VTL) +HVK = (BQC, SCN) +QMV = (BNJ, CRL) +DDR = (KRS, QFV) +RDG = (QHP, QXN) +CRL = (NJC, QRL) +SHB = (SQX, JVV) +TSP = (BPX, FVC) +RRF = (KJB, PTB) +CSG = (FRX, RTP) +RPQ = (SRQ, MLD) +VXS = (MTN, DJQ) +PJK = (NGD, NTM) +QHG = (NXT, DHS) +LSP = (MTR, GGH) +SHN = (JJS, RVC) +TNQ = (TMM, HHM) +NPK = (GCM, VKT) +MJF = (NBT, FCT) +JNN = (PTH, HFK) +NRS = (CLT, HGV) +HSX = (BPX, FVC) +MVM = (DSF, NQS) +PBK = (SQX, JVV) +HHD = (DBM, MVD) +MTD = (DVB, BTX) +PXP = (NPP, CRN) +TMF = (LPF, QPD) +BRT = (FJV, GNQ) +MFQ = (BHG, SMC) +DJQ = (MVP, MVZ) +LKR = (PTH, HFK) +STQ = (HTC, PGD) +DXF = (JBX, TRT) +RJN = (PDR, KLJ) +CGC = (KKL, RJV) +SRG = (QKK, LND) +MCC = (DHS, NXT) +JMG = (RLX, NJH) +NKH = (DGF, FJL) +JXP = (DSF, NQS) +GXX = (CKC, MFL) +MXD = (KBC, FGK) +SCH = (XPG, BTH) +XSR = (MQN, PLN) +KKD = (NBD, CXL) +CLJ = (GCN, GCN) +QVV = (THK, LQV) +VLH = (FFB, STD) +RTP = (CBC, CXS) +RVX = (BLF, PTM) +KBN = (JNF, BTC) +PFX = (JHM, DTT) +NVL = (KCM, DLK) +QRM = (CQK, RBB) +HKP = (SHN, TMV) +VXF = (TFF, JRP) +LDL = (LHM, JMT) +BQL = (DRS, VQQ) +FDC = (TNQ, QDX) +MMT = (MSL, JCT) +CXV = (HKR, FHV) +BKB = (FCM, QTC) +HRQ = (RXG, JSG) +RKH = (JFF, TKR) +VQR = (JGD, SFC) +KCV = (LNG, NCV) +XSB = (DTG, DFK) +JGD = (HLP, FNS) +VCK = (RXP, VRL) +GTN = (BCP, CKB) +QDK = (CBD, CDP) +SNF = (JNH, MJF) +FVK = (QQV, NRS) +HHM = (VXK, PJK) +JRM = (DTG, DFK) +QPL = (XLK, QDK) +SCV = (QHP, QXN) +RQC = (QMD, TPG) +LFX = (BRH, HGP) +FRX = (CXS, CBC) +BTM = (FPK, JVF) +BPN = (LHN, FKM) +LRQ = (LSQ, PMP) +TPV = (LQF, KDN) +XBN = (QDS, DXP) +RBB = (FCR, HFN) +XSM = (LNT, STB) +SBR = (PQT, CNQ) +LVM = (SBV, LHS) +KBC = (JHR, TQP) +DLJ = (FGK, KBC) +LKG = (VJX, HLQ) +NXT = (VMT, VBH) +CBD = (HGN, HBG) +BHS = (VTF, MRV) +BTP = (GBG, LKM) +DSM = (CKK, CKK) +LSR = (CMB, NLP) +NPP = (BCX, DTB) +XCV = (SMS, QJD) +PNM = (BPQ, NBM) +VPS = (JJB, XMR) +JNH = (FCT, NBT) +KTN = (SHG, PJG) +FMJ = (LQV, THK) +GFX = (NBB, NBB) +SRQ = (GNS, QGB) +FQC = (DGF, FJL) +MPA = (BRS, BSL) +BMS = (FKS, SKF) +BMT = (JMG, PCS) +QFV = (SCH, FDJ) +STF = (RCS, FFD) +JTS = (GGM, SJS) +NJQ = (TKR, JFF) +MTQ = (HLQ, VJX) +FGK = (TQP, JHR) +JNF = (TCV, LJT) +LKM = (KGC, QNM) +MXV = (BQP, BXK) +FRF = (LVM, HGK) +GGH = (BHB, KNB) +BGH = (KBX, FDN) +LQH = (JNF, BTC) +JVF = (LDS, DCD) +CLT = (QPL, LFV) +HRV = (TRD, RXH) +NBD = (PXP, XBK) +PJD = (JJD, LQM) +XMV = (BBF, LKX) +BCN = (PBH, HPL) +XMH = (JNG, GCX) +HFK = (GFG, XTS) +VTL = (RFC, VPF) +MSL = (NFQ, NDJ) +THH = (KNG, QNF) +PCB = (PCX, FLB) +GBQ = (PRR, PSR) +NMS = (BQC, SCN) +PDX = (BGP, SFH) +LDS = (TLJ, LLD) +HGV = (QPL, LFV) +LMK = (VKX, JCV) +NBM = (PKR, QCS) +NLR = (LKJ, DGZ) +QDN = (TRT, JBX) +MTH = (HMT, NJM) +CKF = (LKJ, LKJ) +FDN = (DGP, JKM) +CDR = (NCV, LNG) +SGJ = (GBQ, KXN) +TMM = (VXK, PJK) +JSL = (CTS, MTT) +QGB = (TBK, NHB) +TDA = (GHJ, QRC) +GTF = (QDP, GCJ) +TCG = (FVK, JVB) +LXJ = (FVN, LHX) +TQF = (RKL, SHQ) +ZZZ = (VQQ, DRS) +NCV = (CRJ, GBL) +BKF = (CJP, PRL) +QPD = (DQN, JBQ) +MFL = (PJD, TRS) +NHG = (HGK, LVM) +MRV = (MLH, TBV) +XHS = (PSN, HRQ) +JJB = (NJQ, RKH) +TGK = (SFG, FDS) +CGS = (TRD, RXH) +GCN = (NCN, CVS) +PNN = (BKK, CQC) +LSQ = (KCC, GSP) +LND = (RLS, LPX) +CPG = (VGM, RXV) +GSF = (HMJ, RMH) +JRH = (VQR, BVM) +FJB = (DTT, JHM) +FKM = (BFK, XCQ) +LPT = (PRD, CGB) +XVG = (CRL, BNJ) +KRS = (FDJ, SCH) +BNL = (BQL, ZZZ) +JMB = (XVD, MBH) +KKH = (RLN, PHV) +MTB = (PSP, VCX) +NCN = (FFV, RQC) +FVC = (QJC, SRG) +FTS = (THG, XXL) +SFG = (BCN, DBN) +RXH = (XQT, SDR) +MLR = (GDQ, VNC) +TRD = (XQT, SDR) +BGD = (GLJ, FNK) +XDJ = (MPS, RJB) +JMJ = (MDJ, RTV) +RVC = (PXQ, NRJ) +QQV = (CLT, HGV) +MLD = (QGB, GNS) +KPH = (HRQ, PSN) +RLN = (TFR, SNM) +JRP = (DSX, HPD) +SJS = (DSM, NKL) +PGD = (CGS, HRV) +HPL = (GKH, CVN) +MQK = (PTB, KJB) +QCR = (MHV, FTS) +VCG = (BQR, FRV) +LXV = (XMR, JJB) +PKR = (QSH, XMV) +JSB = (DLJ, MXD) +VRL = (JNS, HFP) +PHJ = (BTF, BTP) +CXL = (XBK, PXP) +FNN = (TSP, HSX) +XQT = (VHH, QHT) +LQV = (DQK, JMB) +RLS = (NBP, SSC) +TCV = (MDL, MMT) +QTC = (LFX, RJF) +LRK = (MFL, CKC) +MHK = (FGF, FDF) +RLJ = (HJX, CNC) +TLK = (RFL, VCK) +CNC = (HJQ, CNR) +LQL = (FRX, RTP) +QQM = (MFQ, BNR) +VBH = (HLB, JMJ) +GKX = (TGK, QKP) +KQG = (JRH, VNT) +XDR = (DNF, KJV) +GMJ = (HKP, TGX) +VRQ = (VTF, MRV) +HGP = (VNB, LDL) +LNG = (GBL, CRJ) +BSF = (LKG, MTQ) +BRH = (VNB, LDL) +PJQ = (BGD, DLX) +QKF = (CGR, KTX) +QMD = (TND, QSF) +PQH = (MKS, STP) +FRV = (PDX, PMX) +LPF = (JBQ, DQN) +CQM = (TDH, JPR) +HJX = (CNR, HJQ) +AAA = (DRS, VQQ) +TDH = (VGX, TCF) +TGX = (TMV, SHN) +BDH = (XFV, GSF) +GXK = (BFP, TFH) +BFT = (MFQ, BNR) +NGD = (QHG, MCC) +FPK = (DCD, LDS) +MTR = (KNB, BHB) +SNM = (MFJ, HXJ) +HLP = (RHQ, SVR) +JSP = (VGC, SSF) +NJH = (RJN, DBT) +SKF = (GRG, JSB) +PTM = (TKN, PCQ) +QGQ = (PHV, RLN) +SSF = (NVL, JPB) +PCQ = (LTC, PCH) +KJV = (GMS, XGF) +JSD = (XHP, DKM) +RRB = (LQF, KDN) +GJJ = (FLT, BNV) +FJA = (HJX, CNC) +HLQ = (XRK, VDQ) +KTP = (LPF, QPD) +PRD = (LRM, MTH) +QNF = (CHP, FNN) +DQK = (MBH, XVD) +TMS = (CLJ, XML) +QVP = (FNB, LSP) +BPX = (QJC, SRG) +QXN = (KQG, BML) +VGQ = (JVF, FPK) +BRS = (CDL, GFJ) +NQS = (VKC, SDV) +LFV = (XLK, QDK) +SMS = (RPQ, PDT) +BBF = (CGV, KRM) +VMT = (HLB, JMJ) +QSF = (JSL, LRF) +CJQ = (XSR, LHP) +RDF = (KKD, SQM) +MKS = (CKF, CKF) +STD = (MNM, TMS) +DNS = (MRQ, XFT) +MFG = (RQR, BXQ) +GBG = (QNM, KGC) +JNG = (RDG, SCV) +CVN = (GJJ, QVC) +HMT = (BVL, KLQ) +VTQ = (NTC, BNL) +TGB = (JTK, VMK) +PSR = (NPK, BDP) +MDJ = (DSB, SJB) +CKB = (VSB, TCG) +DNF = (GMS, XGF) +LQK = (XFR, RDF) +RHQ = (KPX, QTM) +VKX = (STQ, JSQ) +BRX = (DDR, TJD) +LJN = (NLP, CMB) +DJR = (HMK, PGQ) +VNB = (JMT, LHM) +DBM = (SBR, MTF) +KLQ = (XBN, MNH) +MDL = (MSL, JCT) +SQX = (TPV, RRB) +CLD = (CQK, RBB) +HPD = (RLJ, CJZ) +LHN = (BFK, XCQ) +KJB = (TMC, QCR) +RLG = (RVX, CDB) +PBH = (GKH, CVN) +DMB = (HHD, MSZ) +SDV = (GXK, QSB) +KPX = (XDJ, QTF) +NBB = (MTN, MTN) +BTX = (BRT, GSM) +HGN = (HJT, RBX) +GDS = (XSM, BGG) +KDN = (KTN, BJT) +GSL = (TRQ, PHJ) +SFR = (XHS, KPH) +JNV = (TVL, PNM) +JNS = (VCD, CXV) +LHM = (GXV, RTX) +TFH = (MTD, PFG) +GHJ = (CSN, XVS) +KNQ = (LRK, GXX) +PRT = (RNV, RGX) +JTK = (BMT, JXJ) +MRQ = (VPT, FLH) +TKN = (LTC, PCH) +VSN = (XFR, RDF) +HXJ = (DBB, HBH) +PRL = (THH, TTH) +GCX = (RDG, SCV) +MNH = (DXP, QDS) +CMB = (XQB, RKB) +CHP = (TSP, HSX) +BCP = (TCG, VSB) +LNT = (HQM, FGJ) +FNK = (XNX, RKP) +HRT = (FJB, PFX) +HTC = (CGS, HRV) +SDR = (QHT, VHH) +CQK = (FCR, HFN) +LVN = (FGP, BKF) +FDS = (DBN, BCN) +QCS = (QSH, XMV) +TRT = (KFQ, SGJ) +RQH = (FDN, KBX) +QJC = (QKK, LND) +MVD = (SBR, MTF) +SBG = (RFL, VCK) +DSX = (RLJ, RLJ) +JBX = (KFQ, SGJ) +JVV = (RRB, TPV) +BBR = (FKS, SKF) +KTX = (VDX, XDR) +CSN = (NNM, CBK) +NNM = (RTN, TGB) +VXK = (NGD, NTM) +DQD = (FJB, PFX) +CDB = (BLF, PTM) +GBL = (BPN, KKS) +BGP = (SNT, BRX) +CRP = (FDC, TPJ) +DFK = (KVV, SQD) +LVQ = (KNQ, FBX) +HSB = (PBK, SHB) +PJG = (TNP, CQM) +JPB = (KCM, DLK) +JJS = (PXQ, NRJ) +XGF = (QDH, PFV) +DKM = (KBL, PJQ) +DVB = (GSM, BRT) +TMC = (MHV, FTS) +TRQ = (BTP, BTF) +FLB = (FCV, FKJ) +BVL = (MNH, XBN) +XPA = (NCN, CVS) +XPS = (PNM, TVL) +CPN = (RDJ, JMK) +RQR = (DKX, CJQ) +SFH = (SNT, BRX) +DBT = (KLJ, PDR) +MBH = (XCS, XPD) +DLK = (XMH, XBD) +HBG = (HJT, RBX) +THK = (DQK, JMB) +DGF = (KKH, QGQ) +BPJ = (GKX, NXB) +MTN = (MVP, MVP) +TMV = (RVC, JJS) +GMS = (PFV, QDH) +FDJ = (BTH, XPG) +FFB = (MNM, MNM) +RTX = (LBK, LXJ) +BGG = (LNT, STB) +LRM = (HMT, NJM) +XVD = (XPD, XCS) +THT = (NTC, NTC) +GXH = (NBB, VXS) +LTG = (XSM, BGG) +GKH = (GJJ, QVC) +TNT = (FHG, PPR) +CDP = (HGN, HBG) +DQN = (HXV, JPN) +FNS = (SVR, RHQ) +DSB = (DMG, LRQ) +DCD = (TLJ, LLD) +FTQ = (JMK, RDJ) +VGX = (SFN, BDH) +VDX = (KJV, DNF) +PMX = (SFH, BGP) +VTF = (TBV, MLH) +LQM = (FMJ, QVV) +VNT = (VQR, BVM) +XML = (GCN, QFZ) +VPF = (MVM, JXP) +TBK = (LLQ, HQX) +PXQ = (TLK, SBG) +LKX = (CGV, KRM) +DBN = (PBH, HPL) +XXL = (CPG, PND) +BHG = (BBR, BMS) +VQQ = (STX, PJH) +VHH = (RLG, TDG) +RJK = (KPH, XHS) +BFK = (MXV, HTX) +VJX = (XRK, VDQ) +GFJ = (CPN, FTQ) +GRG = (MXD, DLJ) +CQC = (LJN, LSR) +RJB = (DHH, LPT) +FGP = (CJP, PRL) +BCM = (FFB, STD) +FBX = (GXX, LRK) +FLH = (VHJ, PRT) +GTD = (THT, THT) +GNS = (NHB, TBK) +QTM = (XDJ, QTF) +VGM = (KJK, FCD) +XBD = (JNG, GCX) +QVC = (BNV, FLT) +FCV = (LQL, CSG) +SCN = (NPL, VXF) +KKL = (HVK, NMS) +MDG = (QJD, SMS) +QSB = (BFP, TFH) +LKJ = (BRS, BSL) +XCS = (HSB, LRC) +HLB = (MDJ, RTV) +TLJ = (NGQ, CGC) +MNM = (CLJ, CLJ) +STB = (HQM, FGJ) +HJT = (TMF, KTP) +TND = (LRF, JSL) +FVN = (QDN, DXF) +SNT = (TJD, DDR) +JKM = (LKN, FVM) +LTC = (RBP, PQH) +STP = (CKF, NLR) +DMG = (LSQ, PMP) +CDX = (RFC, VPF) +CNQ = (PXG, BSF) +PMP = (KCC, GSP) +VKT = (CKX, KPS) +CKJ = (FBX, KNQ) +VGC = (JPB, NVL) +LCB = (QTC, FCM) +TCF = (BDH, SFN) +DDC = (XSX, DMB) +SFN = (XFV, GSF) +HXF = (GDQ, VNC) +BPQ = (QCS, PKR) +FFD = (TNT, XTF) +TBV = (SFR, RJK) +DBB = (FGM, DJR) +FHG = (VSN, LQK) +GGM = (DSM, NKL) +RJV = (NMS, HVK) +NGQ = (RJV, KKL) +CFS = (HQV, HPS) +PFG = (BTX, DVB) +VCX = (QKF, CPK) +XCQ = (MXV, HTX) +DHH = (PRD, CGB) +HBH = (DJR, FGM) +RMH = (GMV, SNF) +HXV = (QTB, FRP) +QFZ = (CVS, NCN) +CVK = (BDK, GMJ) +SHQ = (QQM, BFT) +PGQ = (XPS, JNV) +LQR = (NTG, VCG) +QDS = (BVB, HDJ) +CJP = (THH, TTH) +FNB = (GGH, MTR) +PSN = (RXG, JSG) +LHX = (QDN, DXF) +GFG = (SCG, KQJ) +PRR = (NPK, BDP) +QSH = (LKX, BBF) +KVV = (LBV, CRP) +DFF = (NXB, GKX) +JFF = (CKJ, LVQ) +FCD = (MDG, XCV) +SFC = (FNS, HLP) +KPS = (BNS, CFS) +PLN = (PNN, DHB) +SHG = (CQM, TNP) +GJR = (QDP, GCJ) +NDJ = (GFX, GXH) +XQB = (PHC, JSD) +FKJ = (CSG, LQL) +FRP = (KNS, JTS) +MHX = (BKB, LCB) +HGK = (LHS, SBV) +JXJ = (JMG, PCS) +NJC = (RQH, BGH) +LLQ = (TQF, NJB) +QFR = (BCP, CKB) +BXK = (DQD, HRT) +XFR = (KKD, SQM) +XFV = (HMJ, RMH) +HMJ = (GMV, SNF) +BNV = (NHG, FRF) +GXV = (LBK, LXJ) +XNX = (NKH, FQC) +BJR = (VKX, JCV) +CRN = (BCX, DTB) diff --git a/2023/rust/day8/src/lib.rs b/2023/rust/day8/src/lib.rs new file mode 100644 index 0000000..31f2e2c --- /dev/null +++ b/2023/rust/day8/src/lib.rs @@ -0,0 +1,115 @@ +use std::collections::HashMap; + +pub fn part1(input: &str) -> u32 { + let mut res: u32 = 0; + + let lines: Vec<String> = input + .trim_end() + .split('\n') + .map(|x| x.to_string()) + .collect(); + let ltype = &lines[0]; + let mut hm: HashMap<String, (String, String)> = HashMap::new(); + for play in &lines[2..] { + hm.insert( + play[..3].to_string(), + (play[7..10].to_string(), play[12..15].to_string()), + ); + } + + let mut current = "AAA".to_string(); + for i in ltype.chars().cycle() { + current = match i { + 'R' => hm.get(¤t).unwrap().1.clone(), + 'L' => hm.get(¤t).unwrap().0.clone(), + _ => panic!("wtf is this?"), + }; + res += 1; + + if current == "ZZZ".to_string() { + break; + } + } + + res +} + +pub fn part2(input: &str) -> u32 { + let mut res: u32 = 0; + + let lines: Vec<String> = input + .trim_end() + .split('\n') + .map(|x| x.to_string()) + .collect(); + let ltype = &lines[0]; + let mut hm: HashMap<String, (String, String)> = HashMap::new(); + + for play in &lines[2..] { + hm.insert( + play[..3].to_string(), + (play[7..10].to_string(), play[12..15].to_string()), + ); + } + + let mut currents: Vec<String> = hm + .keys() + .filter(|x| x.ends_with("A")) + .into_iter() + .map(|x| x.to_string()) + .collect::<Vec<String>>(); + + dbg!("{currents:?}"); + 'o: for i in ltype.chars().cycle() { + for k in 0..currents.len() { + currents[k] = match i { + 'R' => hm.get(¤ts[k]).unwrap().1.clone(), + 'L' => hm.get(¤ts[k]).unwrap().0.clone(), + _ => panic!("wtf is this?"), + }; + res += 1; + } + + for current in ¤ts { + if !current.ends_with("Z") { + continue 'o; + } + } + break; + } + + res +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 2); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 21389); + } + + #[test] + fn example_part2() { + let input = include_str!("../example2.txt"); + let result = part2(input); + assert_eq!(result, 12); + } + + // #[test] + // fn input_part2() { + // let input = include_str!("../input.txt"); + // let result = part2(input); + // assert_eq!(result, 248179786); + // } +} diff --git a/2023/rust/day9/Cargo.toml b/2023/rust/day9/Cargo.toml new file mode 100644 index 0000000..b5e5273 --- /dev/null +++ b/2023/rust/day9/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day9" +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/rust/day9/example.txt b/2023/rust/day9/example.txt new file mode 100644 index 0000000..539a763 --- /dev/null +++ b/2023/rust/day9/example.txt @@ -0,0 +1,3 @@ +0 3 6 9 12 15 +1 3 6 10 15 21 +10 13 16 21 30 45 diff --git a/2023/rust/day9/input.txt b/2023/rust/day9/input.txt new file mode 100644 index 0000000..2d0cfd3 --- /dev/null +++ b/2023/rust/day9/input.txt @@ -0,0 +1,200 @@ +11 33 79 170 328 578 967 1621 2872 5498 11130 22891 46343 90829 171308 310792 543505 918895 1506641 2402808 3737314 +-4 12 58 149 300 526 842 1263 1804 2480 3306 4297 5468 6834 8410 10211 12252 14548 17114 19965 23116 +4 9 26 66 146 290 544 1024 2021 4198 8945 19036 39915 82362 168258 343303 705045 1463670 3070651 6483469 13694943 +0 -1 4 30 99 245 525 1038 1973 3753 7431 15644 34662 78403 175746 383088 804886 1625931 3160350 5923858 10737621 +21 28 35 42 49 56 63 70 77 84 91 98 105 112 119 126 133 140 147 154 161 +22 30 38 46 54 62 70 78 86 94 102 110 118 126 134 142 150 158 166 174 182 +23 32 41 50 59 68 77 86 95 104 113 122 131 140 149 158 167 176 185 194 203 +17 24 42 85 177 360 712 1386 2687 5210 10068 19245 36115 66174 118038 204766 345573 568004 910646 1426461 2186829 +13 21 32 47 68 115 262 694 1798 4335 9803 21207 44641 92458 189568 385972 781800 1577454 3174336 6378503 12816737 +11 30 74 153 286 528 1018 2059 4246 8678 17345 33906 65340 125498 242657 475189 943094 1889595 3798425 7612912 15140047 +27 46 72 118 215 434 924 1975 4137 8477 17150 34609 69993 141534 284300 563515 1097813 2101901 3970290 7451561 14023129 +2 -1 1 17 53 107 171 257 483 1295 3974 11705 31719 79466 186642 416552 893420 1858051 3772775 7517333 14749965 +22 44 94 189 349 596 956 1482 2328 3920 7297 14748 30975 65212 135122 274090 545170 1068268 2073636 4006875 7732265 +21 47 92 165 274 421 597 777 915 939 746 197 -888 -2735 -5621 -9879 -15903 -24153 -35160 -49531 -67954 +16 46 103 194 323 506 799 1339 2398 4450 8251 14932 26105 43982 71507 112501 171820 255526 371071 527494 735631 +21 33 45 66 116 230 466 920 1764 3352 6500 13173 28066 62062 139525 313342 695599 1519803 3266545 6915774 14449172 +21 41 82 166 322 582 977 1533 2267 3183 4268 5488 6784 8068 9219 10079 10449 10085 8694 5930 1390 +15 32 65 131 248 432 704 1122 1858 3342 6504 13183 26880 54285 108538 216211 431869 867304 1747887 3516991 7022508 +14 38 71 114 187 343 682 1365 2628 4796 8297 13676 21609 32917 48580 69751 97770 134178 180731 239414 312455 +7 9 10 21 70 217 591 1471 3450 7744 16735 34866 70039 135714 253990 460106 809089 1385779 2320288 3812243 6169100 +7 16 40 99 234 521 1085 2114 3873 6718 11110 17629 26988 40047 57827 81524 112523 152412 202996 266311 344638 +21 44 93 194 398 804 1598 3120 5987 11341 21374 40427 77190 148871 288683 558651 1070601 2019298 3733091 6749144 11922430 +12 15 14 7 -6 -23 -40 -51 -48 -21 42 155 334 597 964 1457 2100 2919 3942 5199 6722 +9 31 66 121 217 407 805 1631 3280 6437 12303 23097 43194 81597 156980 307347 607507 1199155 2340472 4484921 8402439 +14 22 26 26 22 14 2 -14 -34 -58 -86 -118 -154 -194 -238 -286 -338 -394 -454 -518 -586 +5 13 26 52 105 213 434 881 1777 3610 7548 16410 36670 82208 180884 385710 793921 1580563 3060030 5802092 10852699 +8 7 16 38 76 138 242 421 728 1241 2068 3352 5276 8068 12006 17423 24712 34331 46808 62746 82828 +12 20 38 66 104 152 210 278 356 444 542 650 768 896 1034 1182 1340 1508 1686 1874 2072 +11 28 56 96 158 290 632 1517 3663 8544 19118 41257 86513 177343 356747 705695 1374143 2635504 4981096 9281682 17059596 +5 14 50 138 313 615 1083 1763 2771 4490 8043 16309 36006 81865 184821 407664 873997 1819974 3683540 7253236 13908603 +22 52 110 209 362 582 882 1275 1774 2392 3142 4037 5090 6314 7722 9327 11142 13180 15454 17977 20762 +22 41 74 129 225 403 747 1437 2868 5888 12235 25293 51368 101893 197507 376218 710574 1344127 2567364 4970517 9739327 +14 16 21 26 33 71 225 669 1711 3882 8151 16448 32862 66200 135126 278004 571179 1162423 2331940 4603961 8951410 +18 22 38 89 211 462 950 1891 3718 7280 14198 27490 52649 99468 185064 338766 609802 1079042 1876414 3205983 5381031 +1 13 37 85 177 350 680 1317 2528 4731 8496 14508 23557 36765 56498 88749 148207 267717 514331 1014563 1991669 +16 37 75 140 260 494 948 1795 3311 5972 10736 19796 38393 78822 168725 367451 797225 1701138 3549550 7234285 14423393 +13 34 69 139 293 621 1267 2442 4437 7636 12529 19725 29965 44135 63279 88612 121533 163638 216733 282847 364245 +15 22 29 36 43 50 57 64 71 78 85 92 99 106 113 120 127 134 141 148 155 +12 13 24 72 203 502 1124 2338 4602 8719 16173 29806 55063 102088 188981 346500 624384 1099249 1883630 3135164 5064083 +16 22 31 57 136 332 737 1459 2591 4157 6057 8120 10584 15760 32504 86828 245372 665255 1697550 4099589 9468672 +18 20 22 35 84 212 485 999 1888 3330 5546 8785 13286 19206 26501 34745 42870 48808 49014 37847 6784 +26 40 60 100 185 365 753 1608 3505 7668 16599 35239 73093 148135 294064 573935 1105880 2111392 4004662 7554350 14169005 +14 37 79 157 301 568 1066 1991 3687 6748 12192 21750 38328 66717 114645 194286 324364 533015 861597 1369667 2141375 +26 46 80 139 236 397 692 1291 2558 5207 10554 20905 40120 74386 133218 230687 386850 629332 994988 1531559 2299236 +1 8 26 59 113 196 318 491 729 1048 1466 2003 2681 3524 4558 5811 7313 9096 11194 13643 16481 +0 4 29 86 181 316 500 777 1289 2426 5187 12003 28474 66768 151844 332218 697718 1407600 2733553 5123540 9294139 +12 7 4 11 50 181 537 1383 3231 7080 14929 30865 63312 129553 264648 538893 1092110 2201596 4417932 8837368 17646010 +15 19 30 60 135 306 678 1466 3095 6390 12973 26143 52850 108034 223821 468228 981780 2047002 4217481 8554651 17060138 +4 23 62 145 315 646 1261 2365 4324 7855 14438 27119 51943 100338 192865 364855 674572 1214671 2127862 3627845 6026747 +0 -2 1 17 70 225 639 1664 4038 9205 19811 40451 78840 147845 269432 482915 862636 1555638 2860301 5386215 10370274 +9 16 36 81 178 382 793 1573 2968 5363 9450 16694 30481 58719 119464 252853 546219 1186490 2567764 5506931 11663356 +8 12 29 70 149 283 492 799 1230 1814 2583 3572 4819 6365 8254 10533 13252 16464 20225 24594 29633 +2 0 4 23 66 142 260 429 658 956 1332 1795 2354 3018 3796 4697 5730 6904 8228 9711 11362 +13 32 57 90 148 285 627 1420 3091 6322 12137 22002 37938 62647 99651 153444 229657 335236 478633 670010 921456 +21 32 44 61 106 241 607 1495 3457 7463 15099 28772 51831 88420 142742 217210 308613 400694 449818 356347 -94816 +6 4 -2 -7 0 48 214 692 1942 4996 12059 27638 60570 127510 258691 507089 962526 1772732 3173972 5534535 9415188 +20 38 72 131 224 360 548 797 1116 1514 2000 2583 3272 4076 5004 6065 7268 8622 10136 11819 13680 +14 23 32 41 50 59 68 77 86 95 104 113 122 131 140 149 158 167 176 185 194 +13 28 43 58 73 88 103 118 133 148 163 178 193 208 223 238 253 268 283 298 313 +20 32 54 85 126 194 353 775 1844 4325 9661 20564 42270 85202 170484 341139 684723 1379417 2788967 5659626 11527921 +12 42 94 190 372 707 1290 2244 3715 5862 8851 12896 18508 27457 45805 92242 218753 557969 1425339 3529889 8394603 +1 16 52 121 245 478 939 1856 3627 6908 12736 22683 39011 64754 103587 159250 234173 326792 426852 507757 514745 +9 23 49 92 169 312 569 1010 1759 3101 5767 11605 25054 56263 127560 286684 633455 1372598 2916433 6081111 12456613 +8 8 4 -4 -16 -32 -52 -76 -104 -136 -172 -212 -256 -304 -356 -412 -472 -536 -604 -676 -752 +26 50 92 159 258 396 580 817 1114 1478 1916 2435 3042 3744 4548 5461 6490 7642 8924 10343 11906 +7 6 17 60 181 465 1050 2151 4118 7575 13716 24876 45577 84429 157644 295650 555589 1044640 1962503 3676488 6850057 +10 22 50 115 247 480 857 1461 2494 4432 8290 16037 31207 59758 111237 200315 348762 587938 961882 1531087 2377055 +22 44 88 166 295 510 888 1586 2898 5337 9747 17448 30422 51580 85246 138213 222154 358926 591542 1005502 1768013 +6 14 41 90 173 328 648 1335 2797 5811 11780 23117 43794 80099 141649 242712 403896 654268 1033971 1597412 2417099 +11 22 32 41 58 123 337 898 2137 4539 8720 15312 24684 36398 48265 54827 45047 -1060 -117176 -357189 -803906 +4 14 40 86 151 234 349 562 1075 2413 5840 14278 34296 80279 182833 405042 872646 1827912 3722368 7371206 14202685 +15 31 63 134 282 578 1161 2296 4461 8469 15631 27966 48464 81408 132761 210624 325771 492267 728175 1056358 1505382 +10 16 17 21 46 120 281 577 1066 1816 2905 4421 6462 9136 12561 16865 22186 28672 36481 45781 56750 +3 3 4 24 106 323 775 1573 2804 4484 6546 8990 12455 19672 38535 87897 207673 475425 1032328 2122284 4148976 +18 23 20 2 -27 -33 73 468 1460 3543 7466 14318 25631 43503 70743 111040 169158 251159 364656 519098 726089 +-6 4 34 91 180 308 508 892 1734 3580 7384 14674 27752 49914 85622 140447 220402 329964 467606 616981 730972 +7 10 12 9 -4 -31 -65 -51 207 1234 4216 11535 27576 59885 120767 229423 414735 718818 1201468 1945645 3064140 +19 25 32 40 49 59 70 82 95 109 124 140 157 175 194 214 235 257 280 304 329 +5 7 27 90 242 556 1145 2198 4062 7416 13636 25544 48873 94970 185545 360820 693659 1315057 2462389 4573894 8475508 +17 30 60 126 262 519 965 1696 2892 4985 9054 17635 36258 76249 159748 328622 660175 1294516 2481452 4659216 8583698 +10 25 69 169 366 716 1304 2281 3933 6796 11854 20926 37510 68672 129125 249524 492296 980111 1944451 3804703 7291826 +9 28 54 82 114 173 320 681 1502 3269 6974 14709 30979 65516 139058 294709 619447 1283730 2613166 5217048 10218000 +9 23 51 111 234 465 864 1517 2574 4343 7497 13505 25482 49760 98589 194440 376331 708331 1289779 2265607 3833254 +2 1 2 9 26 57 106 177 274 401 562 761 1002 1289 1626 2017 2466 2977 3554 4201 4922 +6 10 14 15 20 71 275 848 2196 5070 10846 21995 42822 80567 146975 260456 448970 753786 1234278 1973935 3087776 +3 13 30 54 85 123 168 220 279 345 418 498 585 679 780 888 1003 1125 1254 1390 1533 +8 8 14 28 56 116 247 516 1032 2012 4014 8574 19687 46897 111270 256338 567509 1206143 2470123 4904763 9513099 +1 0 -2 -8 -11 25 191 680 1894 4693 10930 24493 53162 111684 226585 443458 838118 1535101 2743069 4832537 8518726 +6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 +12 19 33 54 82 117 159 208 264 327 397 474 558 649 747 852 964 1083 1209 1342 1482 +12 15 20 35 69 134 255 497 1035 2331 5557 13539 32728 77088 175449 385066 816382 1678303 3361374 6590903 12707671 +12 38 77 141 271 567 1233 2637 5386 10416 19097 33353 55797 89881 140061 211977 312648 450682 636501 882581 1203707 +2 -2 5 33 103 269 656 1523 3360 7028 13951 26369 47661 82747 138578 224723 354062 543594 815369 1197553 1725635 +6 19 34 61 126 273 566 1091 1958 3303 5290 8113 11998 17205 24030 32807 43910 57755 74802 95557 120574 +13 28 52 98 190 356 631 1090 1943 3739 7746 16604 35393 73320 146304 280813 519357 928026 1606324 2699210 4410612 +11 25 41 60 83 111 145 186 235 293 361 440 531 635 753 886 1035 1201 1385 1588 1811 +-1 9 37 101 235 490 935 1658 2767 4391 6681 9811 13979 19408 26347 35072 45887 59125 75149 94353 117163 +13 23 33 43 53 63 73 83 93 103 113 123 133 143 153 163 173 183 193 203 213 +3 18 48 113 249 507 943 1597 2475 3572 5003 7342 12318 24135 52013 115394 255183 558334 1210486 2604295 5552483 +-3 -11 -12 2 39 107 212 354 521 681 772 690 275 -705 -2572 -5758 -10827 -18499 -29676 -45470 -67233 +5 2 2 15 59 159 340 624 1055 1805 3471 7786 19205 48346 119383 285791 663345 1497620 3297968 7094833 14917719 +7 13 31 67 134 273 596 1373 3200 7319 16241 34988 73571 151821 308464 617466 1216269 2352705 4460235 8274849 15011628 +18 30 42 54 66 78 90 102 114 126 138 150 162 174 186 198 210 222 234 246 258 +5 12 22 39 72 145 333 835 2093 4964 10950 22489 43308 78837 136681 227145 363805 564116 850046 1248723 1793080 +18 30 42 54 66 78 90 102 114 126 138 150 162 174 186 198 210 222 234 246 258 +23 31 34 42 74 151 297 564 1100 2289 5028 11295 25347 56244 123056 265289 563085 1175063 2406874 4831400 9492944 +24 34 44 70 151 373 907 2068 4414 8929 17391 33143 62698 118976 227618 439040 851304 1653716 3210518 6221840 12031157 +5 5 6 9 25 93 298 784 1757 3473 6206 10191 15537 22105 29346 36094 40309 38765 26678 -2731 -58743 +8 30 65 113 181 304 577 1206 2612 5663 12165 25814 53897 110131 219145 423241 792216 1437188 2529545 4326327 7203557 +3 -3 2 45 172 456 1007 1994 3698 6624 11709 20672 36561 64561 113136 195587 332117 552503 899484 1432983 2235290 +16 28 42 55 65 82 154 417 1176 3020 6973 14694 28780 53330 95148 166377 290076 511444 919320 1685677 3135807 +18 42 77 132 229 414 786 1567 3248 6857 14418 29731 59741 117031 224435 423500 789622 1458244 2668651 4834758 8656005 +22 33 53 94 170 308 580 1163 2439 5174 10885 22642 46793 96506 198710 407198 826684 1656043 3264645 6324818 12037692 +9 2 -5 4 60 221 589 1330 2700 5103 9257 16631 30457 57846 113895 229237 463363 927376 1821807 3497966 6555306 +20 29 43 70 124 227 415 751 1362 2544 5016 10456 22541 48887 104627 219002 447452 893523 1747765 3355078 6328150 +10 30 76 166 319 551 871 1277 1752 2260 2742 3112 3253 3013 2201 583 -2122 -6246 -12176 -20358 -31301 +-1 -4 -12 -25 -43 -66 -94 -127 -165 -208 -256 -309 -367 -430 -498 -571 -649 -732 -820 -913 -1011 +21 42 78 141 255 462 838 1529 2822 5276 9951 18788 35210 65034 117809 208728 361307 611086 1010692 1636719 2599033 +17 22 32 65 156 375 869 1946 4237 9006 18747 38346 77349 154341 305211 598293 1161213 2226966 4210582 7833071 14316598 +23 35 56 97 184 372 770 1588 3227 6448 12676 24520 46620 86967 158882 283885 495735 845977 1411392 2303811 3682824 +12 22 50 102 193 369 738 1519 3123 6285 12283 23336 43417 80027 148066 277964 531906 1034564 2028564 3970366 7689797 +9 24 56 105 167 230 283 360 645 1665 4596 11702 26919 56585 110303 201907 350481 581358 927000 1427631 2131463 +14 41 82 137 206 289 386 497 622 761 914 1081 1262 1457 1666 1889 2126 2377 2642 2921 3214 +15 15 25 55 122 265 572 1228 2593 5319 10515 19969 36436 64001 108526 178190 284131 441199 668829 992043 1442590 +6 12 33 73 141 260 476 867 1552 2700 4539 7365 11551 17556 25934 37343 52554 72460 98085 130593 171297 +1 1 11 56 170 393 762 1305 2075 3308 5874 12352 29361 72304 174536 404269 894401 1893019 3845673 7524704 14225928 +16 34 67 130 253 498 998 2037 4211 8749 18154 37491 76971 157065 318416 640655 1277578 2522408 4928725 9534976 18281777 +-4 7 28 69 151 314 645 1333 2768 5722 11693 23596 47228 94470 190320 388188 802635 1678168 3530805 7432530 15567904 +18 36 71 135 251 451 770 1238 1875 2697 3744 5144 7230 10730 17053 28697 49808 86922 149925 253269 417485 +17 27 39 53 69 87 107 129 153 179 207 237 269 303 339 377 417 459 503 549 597 +12 30 62 105 166 290 607 1404 3228 7032 14409 28053 52790 97915 182299 345074 667188 1313670 2614596 5216937 10363390 +-3 3 14 34 79 179 385 791 1581 3111 6036 11492 21343 38503 67343 114193 187949 300795 469050 714150 1063775 +20 27 34 42 57 94 185 406 955 2332 5700 13574 31162 69089 149059 315518 658934 1360377 2773254 5567058 10970703 +12 31 66 136 277 553 1084 2099 4022 7604 14135 25826 46566 83450 149722 269974 488312 879201 1557928 2681748 4422091 +-6 -12 -15 -10 7 50 176 548 1548 3988 9514 21369 45783 94400 188345 364791 687222 1261020 2256551 3942608 6733911 +9 11 24 56 115 209 346 534 781 1095 1484 1956 2519 3181 3950 4834 5841 6979 8256 9680 11259 +19 28 47 85 150 249 393 608 953 1545 2589 4408 7464 12356 19775 30389 44623 62290 82019 100415 110874 +-7 -3 23 96 256 573 1173 2275 4239 7625 13263 22334 36462 57817 89229 134313 197605 284709 402455 559068 764348 +5 17 36 77 173 376 752 1366 2253 3371 4532 5307 4901 1994 -5456 -20452 -47243 -91659 -161500 -266983 -421251 +-10 -1 35 108 224 390 635 1065 1983 4134 9187 20644 45469 96853 198665 392271 746516 1371737 2438683 4203132 7036782 +25 38 65 120 217 370 593 900 1305 1822 2465 3248 4185 5290 6577 8060 9753 11670 13825 16232 18905 +-9 0 31 93 201 391 757 1533 3259 7106 15519 33524 71431 150402 313665 648355 1326471 2678800 5323567 10382883 19835829 +26 43 77 141 253 444 771 1351 2445 4634 9142 18374 36750 71929 136530 250470 444052 761949 1268243 2052691 3238403 +3 23 56 102 159 224 304 453 872 2156 5868 15800 40606 99088 230553 514885 1111321 2333185 4790980 9662890 19196825 +5 7 11 11 11 41 177 569 1488 3426 7340 15251 31643 66547 142001 305012 652619 1378773 2859373 5802111 11503367 +22 36 51 78 145 311 707 1627 3695 8141 17236 34977 68211 128605 236311 426997 765336 1370358 2461653 4440740 8029569 +6 11 26 57 119 258 583 1305 2775 5516 10276 18226 31642 55815 103621 205270 427380 907857 1916302 3954039 7913625 +15 31 62 110 187 328 607 1156 2187 4017 7096 12038 19655 30994 47377 70444 102199 145059 201906 276142 371747 +0 3 16 55 149 340 683 1246 2110 3369 5130 7513 10651 14690 19789 26120 33868 43231 54420 67659 83185 +-1 -7 -20 -48 -97 -155 -157 87 1031 3644 9836 23143 49779 100190 191275 349472 614943 1047131 1732004 2791346 4394503 +2 1 11 55 171 420 898 1747 3154 5329 8473 12793 18703 27498 43092 76090 152970 336313 768231 1760599 3975675 +17 23 30 37 38 32 58 269 1059 3257 8402 19113 39568 76106 137966 238177 394613 631227 979478 1479965 2184282 +-2 -5 -6 10 70 213 500 1061 2230 4863 11016 25301 57457 126982 271071 557577 1105218 2113727 3906986 6992264 12138316 +15 31 72 145 263 460 824 1562 3120 6398 13135 26613 52974 103703 200257 382480 723413 1354473 2506834 4577305 8230185 +19 44 99 206 404 767 1426 2586 4530 7614 12296 19331 30440 50097 89734 176986 375280 824379 1822508 3988499 8572027 +17 21 33 79 200 453 925 1781 3379 6502 12778 25380 50112 96984 182346 331572 582141 986731 1615599 2557037 3914040 +17 17 25 61 159 381 834 1684 3174 5694 10033 18079 34436 69710 146592 310348 645927 1304631 2544169 4786953 8702701 +0 -5 -16 -27 -22 19 120 326 748 1647 3568 7535 15318 29783 55336 98472 168440 278035 444528 690745 1046306 +-5 0 21 67 147 270 445 681 987 1372 1845 2415 3091 3882 4797 5845 7035 8376 9877 11547 13395 +6 12 28 65 133 250 460 861 1655 3260 6582 13659 29103 63147 137747 298222 634504 1318424 2666836 5245089 10031765 +6 18 41 81 140 211 283 381 694 1883 5722 16328 42405 101185 225113 472799 946338 1817748 3367939 6042215 10526702 +20 37 65 118 226 454 941 1966 4057 8184 16121 31129 59206 111276 206873 380241 690732 1242056 2221884 3989792 7277474 +9 19 50 117 246 497 1001 2011 3967 7575 13900 24473 41412 67557 106619 163343 243685 355003 506262 708253 973826 +2 4 2 0 21 119 402 1079 2547 5554 11537 23379 47108 95539 195615 402326 823680 1663384 3290796 6351474 11936431 +7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 +9 2 1 28 118 328 760 1600 3179 6074 11287 20568 36984 65880 116430 204036 353901 606178 1023181 1699236 2773850 +23 30 32 29 21 8 -10 -33 -61 -94 -132 -175 -223 -276 -334 -397 -465 -538 -616 -699 -787 +7 18 34 64 130 265 512 930 1611 2712 4509 7487 12495 21028 35768 61654 108003 192634 349640 643518 1193940 +25 41 63 97 150 223 302 347 276 -60 -896 -2467 -4479 -4246 8519 64329 241515 721811 1894997 4544673 10161184 +4 15 39 94 222 501 1072 2196 4356 8419 15873 29154 52078 90393 152466 250120 399636 622935 948955 1415238 2069742 +23 37 51 66 79 81 57 -11 -127 -225 -24 1310 5911 18795 51062 126073 290811 635857 1329097 2670530 5178487 +6 6 13 40 103 217 395 652 1010 1507 2246 3601 6868 15981 41506 109097 276067 661833 1501004 3232495 6646054 +-5 -10 -3 41 171 485 1169 2548 5143 9732 17438 29930 49949 82618 138512 240597 439619 847736 1710719 3559493 7520095 +20 45 85 142 224 354 580 995 1791 3392 6744 13910 29276 62012 131130 275921 577546 1203739 2501051 5183334 10710516 +7 2 -8 -8 30 147 402 898 1853 3748 7598 15426 31110 62005 122301 240325 474579 948318 1921648 3936104 8093318 +4 16 42 89 180 376 809 1728 3571 7103 13720 26137 49890 96451 189423 376603 753528 1510350 3027408 6073069 12213482 +16 39 81 168 346 699 1394 2771 5514 10971 21737 42674 82616 157095 292526 532405 946204 1641791 2782361 4609036 7470478 +0 8 24 66 178 456 1093 2460 5256 10786 21465 41707 79473 149013 275959 507333 931952 1722236 3218006 6088132 11628236 +13 32 63 120 220 378 598 858 1098 1239 1289 1635 3690 11180 32545 85226 203063 448694 933791 1851278 3525444 +21 36 68 130 243 444 794 1386 2353 3876 6192 9602 14479 21276 30534 42890 59085 79972 106524 139842 181163 +7 7 16 42 102 243 575 1314 2830 5692 10709 19002 32234 53313 88239 150435 270173 514121 1024546 2095878 4320626 +4 20 45 88 171 329 615 1129 2109 4150 8654 18660 40258 84855 172634 337629 634930 1150632 2015251 3421448 5647029 +15 33 53 88 175 390 873 1877 3862 7661 14752 27691 50842 91789 164433 296086 543337 1025693 1992739 3950666 7888377 +21 41 85 175 345 637 1092 1743 2624 3816 5558 8458 13846 24318 44527 82284 150039 266819 460707 771953 1256815 +-5 -4 -1 4 11 20 31 44 59 76 95 116 139 164 191 220 251 284 319 356 395 +7 20 45 91 166 275 418 588 769 934 1043 1041 856 397 -448 -1814 -3861 -6776 -10775 -16105 -23046 +16 29 53 90 144 217 312 463 835 1973 5324 14213 35544 82670 180222 372347 736982 1410761 2632275 4816136 8677196 +15 36 81 165 317 603 1168 2310 4617 9241 18462 36823 73327 145569 287449 563757 1098426 2130571 4127378 8012790 15629588 +13 16 36 94 229 505 1026 1979 3736 7055 13432 25685 48934 92364 172697 321490 600845 1137023 2190924 4302259 8577205 +15 33 62 100 137 145 70 -153 -527 -813 -180 3392 14047 39431 92632 194815 378699 693037 1208274 2023572 3275405 +9 17 26 43 87 194 424 880 1758 3457 6794 13396 26384 51528 99142 187109 345583 624113 1102178 1904417 3222189 +15 28 60 127 254 494 975 1984 4105 8449 17045 33490 63970 118770 214450 377138 648203 1095478 1837082 3092037 5284118 +10 22 46 91 176 339 651 1243 2358 4441 8278 15190 27280 47720 81051 133452 212914 329232 493702 718381 1014736 +6 15 24 33 42 51 60 69 78 87 96 105 114 123 132 141 150 159 168 177 186 +-6 -11 -16 -21 -26 -31 -36 -41 -46 -51 -56 -61 -66 -71 -76 -81 -86 -91 -96 -101 -106 +7 24 56 112 206 361 614 1035 1799 3399 7184 16588 39739 94671 219193 488711 1047141 2158900 4294817 8274127 15504252 +7 28 60 109 202 412 903 2013 4400 9280 18800 36656 69277 128420 237158 443522 850421 1678603 3394366 6960828 14320024 +15 27 40 54 69 85 102 120 139 159 180 202 225 249 274 300 327 355 384 414 445 +14 24 40 73 153 333 702 1425 2852 5779 12001 25373 53704 111983 227731 449783 862713 1610849 2939409 5268068 9329214 +10 7 4 1 -2 -5 -8 -11 -14 -17 -20 -23 -26 -29 -32 -35 -38 -41 -44 -47 -50 diff --git a/2023/rust/day9/src/lib.rs b/2023/rust/day9/src/lib.rs new file mode 100644 index 0000000..a1b0588 --- /dev/null +++ b/2023/rust/day9/src/lib.rs @@ -0,0 +1,122 @@ +pub fn part1(input: &str) -> i32 { + let mut res: i32 = 0; + + let m: Vec<Vec<i32>> = input + .trim_end() + .split('\n') + .map(|x| { + x.split(' ') + .map(|y| y.parse::<i32>().unwrap()) + .collect::<Vec<i32>>() + }) + .collect(); + + for i in m { + let mut aux: Vec<Vec<i32>> = vec![i]; + + let mut z = 1; + loop { + aux.push(vec![]); + for j in 1..aux[z - 1].len() { + let x = aux[z - 1][j] - aux[z - 1][j - 1]; + aux[z].push(x); + } + + if aux[z].iter().filter(|&k| *k != 0).count() == 0 { + aux[z].push(0); + break; + } + + z += 1; + } + + let n = aux.len() - 1; + for j in (0..n).rev() { + let t = aux[j + 1][aux[j + 1].len() - 1]; + let r = aux[j][aux[j].len() - 1]; + aux[j].push(t + r); + } + + res += aux[0][aux[0].len() - 1]; + } + + res +} + +pub fn part2(input: &str) -> i32 { + let mut res: i32 = 0; + + let m: Vec<Vec<i32>> = input + .trim_end() + .split('\n') + .map(|x| { + x.split(' ') + .map(|y| y.parse::<i32>().unwrap()) + .collect::<Vec<i32>>() + }) + .collect(); + + for i in m { + let mut aux: Vec<Vec<i32>> = vec![i]; + + let mut z = 1; + loop { + aux.push(vec![]); + for j in 1..aux[z - 1].len() { + let x = aux[z - 1][j] - aux[z - 1][j - 1]; + aux[z].push(x); + } + + if aux[z].iter().filter(|&k| *k != 0).count() == 0 { + aux[z].push(0); + break; + } + + z += 1; + } + + let n = aux.len() - 1; + for j in (0..n).rev() { + let t = aux[j + 1][0]; + let r = aux[j][0]; + aux[j].insert(0, r - t); + } + + res += aux[0][0]; + } + + res +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn example_part1() { + let input = include_str!("../example.txt"); + let result = part1(input); + assert_eq!(result, 114); + } + + #[test] + fn input_part1() { + let input = include_str!("../input.txt"); + let result = part1(input); + assert_eq!(result, 2008960228); + } + + #[test] + fn example_part2() { + let input = include_str!("../example.txt"); + let result = part2(input); + assert_eq!(result, 2); + } + + #[test] + fn input_part2() { + let input = include_str!("../input.txt"); + let result = part2(input); + assert_eq!(result, 71585); + } +} |