From 398227a5554d9d2f3f5ecf38a76f4344f4c896e5 Mon Sep 17 00:00:00 2001 From: Niklas Kapelle Date: Sat, 9 Dec 2023 13:41:00 +0100 Subject: [PATCH] initial commit --- .gitignore | 1 + Cargo.lock | 54 +++ Cargo.toml | 9 + README.md | 3 + input/1.txt | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++ input/2.txt | 100 +++++ input/3.txt | 140 +++++++ input/4.txt | 197 ++++++++++ input/5.txt | 211 +++++++++++ src/common.rs | 16 + src/five.rs | 17 + src/four.rs | 96 +++++ src/main.rs | 31 ++ src/one.rs | 114 ++++++ src/three.rs | 63 ++++ src/two.rs | 112 ++++++ 16 files changed, 2164 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 README.md create mode 100644 input/1.txt create mode 100644 input/2.txt create mode 100644 input/3.txt create mode 100644 input/4.txt create mode 100644 input/5.txt create mode 100644 src/common.rs create mode 100644 src/five.rs create mode 100644 src/four.rs create mode 100644 src/main.rs create mode 100644 src/one.rs create mode 100644 src/three.rs create mode 100644 src/two.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..ba4653d --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,54 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "aoc" +version = "0.1.0" +dependencies = [ + "regex", +] + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..a163620 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "aoc" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +regex = "1.10.2" diff --git a/README.md b/README.md new file mode 100644 index 0000000..c53dc51 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Advent of Code 2023 in rust + +[AoC2023](https://adventofcode.com/2023) diff --git a/input/1.txt b/input/1.txt new file mode 100644 index 0000000..36374dd --- /dev/null +++ b/input/1.txt @@ -0,0 +1,1000 @@ +eighttkbtzjz6nineeight +5knjbxgvhktvfcq89onefive +hnjcrxeightonejnlvm4hstmcsevensix +trsdgcxcseven39dpmzs +oneninesixtwo26 +dppthreeh32twobhrqzks +1cxklgfbvhsnccfive4 +foursgjsevenseven5five19 +nrrk87 +63ntkjbvcv3ntdcptmvheight78 +7xv3one +3tzjcrfbvhtqctfmqmdcbjhxln9eightnqbcqztmxcthree +sevensszlgdrlrhnptonethree3qvrxkbgfxtthree +3nckzkpkjsvztqkgvm99 +fourthreeonesevencqdv2gnvblhr +528ksdcbx +six342 +3twozrfrtljql9eightgcqrgmbzz7dlcr5 +6five2threesevenone65 +4onejrg23sevensxfive +fourthreecszzvhzfsevensix916 +spqzvdxxjeightninejzbpzone7 +cfivesevensix332lfpcffmld +ninesevenhrdvmzj24bcxxz6 +khpn3fourvhqmntjxfhsvrlnvc +bfzxhzftwo2czsrv +mmblpnnineseven4gtfvqscghfour +1zjgqlz +five1ninetjjtfxqpdkgrxtgxrcsevenkfdzlh +s8twoned +8fiveone53nineeightthree7 +926xrfcjzvpd7 +3sevenqnzjsqh6fnssjdsbv3nine +rjbbsevenvzkghzsixsbjchs59 +221fsnxtbstone1 +seven9fourpdseven1four2eight +two1nine4nine7 +9seven7 +fourcjmdgjsfive2l +twokvhrdldggn15twoxfivenine +mmjtldgmvq157hchsnvpbjvrvtvnineeight +cgzeight3sjmhdcvlnthree5vkgfmx +8sevenfourgnxdpp62xx5 +jgdk3z7mmkkjkm +9xrdltttpqznsljbvcdvtz +62zthreethree6 +sjbxq9ptsvjhpzmxfoureightmdbnlsckfqlqr +91xrnsbxxsvk6brxfftpttsevencszfhsnrfive +two9ljdfskpfive +1seven384 +xbfkhfvlts8dhtnxhxgn93three7one1 +3xkjrnqnqhgcfgjvfmxhghp15 +nine9844 +5onepczqjfcgfrbmtstbqbktphkvqcmbbvhpld +eightsixhnsbnine1twonevrs +eightcmbm2zbxsixone34 +five99qccjbklfivevqskhpxzd +seven9four2kzkjbrp +ttdbhd4gqzdlqldnm +9cqcztfourrsfskdjf +njttzmcrchfd4 +r414tzqnfddrbf +4tzbfcjksjsn7eightonelvkjzkch +ls7four +6eightsixrtkcrcbmqq6eight3nine +onesix5five7six1 +dvrqseven5ninegqthree4two9 +fourgdkmbrlgc8 +three7nine +sixqrpzqvxd7xnbkftn5seven +oneonerbpgk5ljpqh5threevtpkpfxtsv2 +ljttxthreefour3three4gxzgsfm +sixttjvhdggbk357 +eightlb4 +fourtwo4twonekzb +8one2cdsnrbfxbsixztcfour1 +ldveight19lg +seventpd84dscfmxj +one34flpg6eight76 +cfninepkscscc5 +flqv5v6twooneprlprlkcbk +qsqlrvmkq5457ninetwosevenm +xlvvtxgspct4gmrgeight +hpbbkqthree4gzbq768five +5dqfsixeightonenine +seven4nfshmhvgqm4 +rhfgvzxtfckbtmxtt9rqms9one +3gsgfbrnkhqrjddvlx59four2jfz +fdl4two +9sevennine158 +five9eight49 +3mfsixnkxdbpdxqdgfdqnk +six9fivefive +fourjdmvlvkrp5seventhreejnqncmktwonev +8cjfqkkgtzlnine +3nnsevenjdbjfp1 +ghthree1mhgtklfqdkqthree7seven4 +4mqsstftj +sixprblqsevendsxvqnk5 +four45one +dxhvj23188xz4 +dcmnr2 +xfoneightsixnine6fiveseven +6cxbbxkrxphsix +5ckkzlzjngvssfx +223zgb +six4qsf +hfxgsfhfhpjlvb329eightone +9zjkckhxoneightbnj +xsdp23seven3four7 +8five53eightthreenljbtgcnfive +fnjn36 +eightkpkxrvssix2lhctc +6ninebqcksevensevenhk +2one98rrtlncrxhllbgthreelgvkdf +sixzdnlfrvvd4 +lltjs8sixqbblmfdhctwo +6twonclq98sscjn +six3niners7eightwokjj +sixeighttwo1onerxrvvbfxxqmxnq9 +conetfpbsrm81sixsgkfqk8six +jbqs5277 +kjbncjlqthxzlznld89bgqgkxfzpqsptwo +onefive1 +pchlnspk52one4sgqj +zd3 +43fsfplhgxtjthree7gs4npllqvll +eight8sixeightone6onexr +six6hqltskzpkgbggjktlzlpktdqhzdbnine9 +eightnpfbmfninevgpjsleightxh3mz +rninenine7nine +fourbbjnjrbzdvshfeight62 +3hzpfsfsdm +2vzhjbv6 +27bpninejhbcjrmz7zfqf4 +ppflreightpmztvhvonetnjmrxdd31one +threeseven7 +srf5hcxvhsmn5five +onersvqvqgkfiveeightqxgrjgfcqj5ntgdzxp3zxdcmbsjqn +mcb643fivetwo +onermbkvmkc9pfvlpdhkzj +3oneeight64 +qtnptg5two36nine2tprkbtb +15lbhtcqfnj1qgjk +eightkzrnlrrnlltdmxlbxfourpbpghtgkb9nvlvsm +26kmmkz +jhnldxdtpseven46oneightnb +4lfftjtbzvppxsix17nxpgvjkxd +vszsbxdzjfourhlxldrthdzpqg6slnj8four +nineone2njsfpcb +5sevenone6five +jrmdhdvrb53onelgvlkd29seven +qqqg7eightseven +sevenm9 +3dfcfcdb9twoqbvxjgt56six +xq88jjmv83pspctxthree +38five5 +six7rbrvjb +eightlvqn335nine +rgmfflzxzd9hs3foureight5 +qm6qvmrone4 +fournine8 +two688qqdtdfbmzn5 +8joneonefourljvbjntkngtskcgfnszpgxt +ninethree5pjzcvntl984five +mfgqzcjbglx7 +ninemxnfcqrbjonek1nineggj +8dcfkfdtwo +4cltttbrlzpgzbdbqsevendtwosspqk +8eight9klmcbninetwozdcznsv +six85pjqldfbqvclntpnqgv +1dgprzx53 +4sixthreeh3fjqpggtjzq +fourone8fiveseven4kgbs7 +seven64npxthreeonefour +xvntvgxv9twotlgcsbgsix4 +hcqtdzthfour2xvqmnmgrncjt51 +qhlpksvnntjq8 +3rtmfngqccktwovpppqfqdlxmk2 +sixfoureight9tqpdln3eightbjnqfldblnine +eight2sixthree +3plpm +6two3two2 +1cfszpnxgtk5fivefive8one +lxrdvls2 +sevenfqszrfhone5dxcqsq +42 +3dmpsix9nhgzhbmknfour19oneightlng +six2dfglxszbjone +eightone88 +9hffzxl7five4 +seven8fknjk +fivefoursevenllljzrvjf7 +eightmsxfkbszh2 +6fiveqhkttbsthreefghn4 +3eight98vsnzbkvzcjfive +spmzsdztzgcfbhvbzqlv5 +fourtwozlsst9sevenjjmbmqk4 +jtmlgrjcpkone2twockgc5four +one35five4 +four8tltpxqfour +57sevenbmhceightbhttrzxfvt +qlvrrlnxgvjgnine1four2two +sixoneseven3sevenm +fivejxfghfp81two +rkp3zbzfnrrqfour4eight +eightnine7tpflkbqpz +28fourlmxlhdzctxkrsix +2fiveeightnineninexhfourseven7 +mnlrszkr18tfive7l +3eight639 +gqpbkntddpeight22lxqjqqone +txxrdbx4bvsfxd +343nsctfvndmp93four2 +9lqjvtjcrrtthree +bsffrmtwo2fivesix +qltdtgl3eighttwo91mjq +rh4rddsfr +fourfive7seven +pbqmx7twoqdk +6onesixclklzfzsq992 +kzxkxvqzjffourdtm4onefive6xoneightsnl +k4snine4three39 +sevenone2xcnscqhcdplnonekcxmgt +seven7ninepmeighthqr8 +xpspdx3twoqpc3881 +5two5four8eightfive +sevenseven2bcbsf +1sevenrjstpdxfiveseven +2zsxfivefivesix43 +eightone5j99nhvbfqhzbvrv5 +onefive35m +2kfnqftkkcxtskj +twoeight8 +1one8bzzsmgvj2kmqcnqjrz4 +1one4sixsixbzbcglm +fiveqqhbmnjgz5ninerlrxkl2seven +4eight4two1xgkb91fdzgxlp +nine8onefive5scxlfrf +gbrqllhnine9 +1fouronesixfiveseven95 +7qjrprpseightshfzfxvn +2vkbbxfrthreenineeight +58three4 +lmfsgdzxnqfdbxtjsnp9 +zlbqglfseventprsqvsmt1one9 +fmksmtlc8dvhbtdvpfgdz +3six1 +mkdthree67jkprftqhdzvjxxftthree8 +bstlpptcfghsrrnine7bz +5m1qfscxncvkqgtf +62four16threeoneightg +twoxlrhpc8n9nine +q5sixfour +ninesix2ninepzvxxlpcbxsfpz28hxtccfzmdq +sevenccq4npgpkkb +k79four9fp +ssqptjqvld1pjfdjnkvsevenkjdzks +2bgpbgqfournine614 +16threeeightwot +five68jnhzdfqp2qlqbmnjmjdtfbj +vplnzg4545seven +two3two +zcbhzsvc68cnppjpqhfl5 +nine68seventwo8pfzgfzbsh +onethreethreeknngnmzhpmlnsd7 +46two +sixhdg748blmlkbdtjbtwobgpzzlhzqrbvl +2smcthmql84seveneighthnmdkmfg +5fourrpscd3 +sppzzjbckgsixone1sixfour +ltkzb3v3ltwo +four61nineeightdkgtcjfvds +eightd5nfcvvdxhkkddhb +four6q7thbpnz +5rknhshlhgnzz7sixone1six +327rkthreesixeight +cnbqtvptwo1qnsevenpzqh +threeqthreepmhgcqhseven2sevenggmpjcldz +ninedlvlgnglqf3 +4two993ninetwo +eightzpfournine72oneseven7 +ninejdfkznz62kflbvgpblcgchpzz +448 +6rktvxxjpfpqtntbsonefive +6lngttwodshgtworkvvsrnfhjmvpvvbseven +eight43gpssneight +6seven3threefourninesevenrnxx +three22rblfvqjr1four5six6 +xtdsqqbv43cxxvfpvtwoklhnqgjlkrrg +threevpvxgddmhl576 +3cxccdsevenmvzhqvpfn3btldbhbmfg +kklcmgptl931threenineeight +vj42ntvkrcjtq7sk6 +llsvqthreefive5 +xspgshknq3kpld2lfour6mhzrzvqf +4bfl38onesix9 +seven1vjzjmcrrvnh +7sixsevensix +gqnkgzmvpsnnzcvldlftrzhnpcbq6hzvbqbmnqvsix +5jvbldxsh +jrmvplfive7mfpbsmklzfivefivelsm +8seven5nppxjfjsevenbxrmzmdjnine +seveneightnrkconeqgjfkxjr532 +m9seven7 +vdn5hdghzvphfour +cpceightwo3 +sixtdxhninesevenmmzrpdqcp24 +tghjrkhltwojgrcnnbbq1 +cfrqlvsevengkthnsbtwo4twovffpv5six +two6pcxj4eightgbctk71 +five93nrqpshmxpbdnzssb2 +jnxjdzm2xcfhnzkxxz948twonejv +sixfive4four5nkdxzvd +twoqvnxzgcg883fivejgvltjq4 +7mzsqvrxlf6kpfjgvdpvj +tzhkjn813six7 +5qjbtklseven +rddmfnjgdlnkx5fourzkxlttqdfourrrjfdd +qtr2qrrqvhrkvmtqgbkdq +five56ninesschfzxone +lkb3 +3zmbbqdqqnineeightlvlfqqxleighttloneightv +7threetwofive168 +njxgnsqcpnine2 +zthreerfnvvone7 +three4one8 +8ppmjj983seveneight9 +p4 +8tshsgmkb516three6four +7seven8 +twosixthreenine6three +gvqz9 +n89ninethreesix8 +ptqrhhvztxsjbxfour81lncqpkjt +8flvhqljqpmlf6fivenine28 +zhbsl7seightwoczd +four1pspgxdvtbzdcd7vsbkzmt +fourj9sdnqtwotwonine3ftzrbzckqk +1fourkkfnndsdxnklrl +zpcdvrszc4ggjcpngkqeight +6twonxhgzcsrgxtwosixvblddxgfmsmqtfcthree +6pltsptthreefive5jjqtzncslmxrmbv7 +sixfourqfxtfour9onefivehsgdvpmdsfive +ksevensevenonebdxdxffive5threeeight +zztvdjzlnqtbrfccctsknppmx5seventhree9 +soneight716 +1fqnntfjhcj2threekmcpzqnbzlqps +twopcftkx8twofourcsixfour +8six2sixgxzzhpkv +four9nine4tgq +htfmtchrx634four5zsmkmdv +45dltlvdvv +dtl848three36 +nine7sixonetwo8vsix +twobxctmqvdnt96mnljbpxtsptjpznrjctgtwooneightqv +peightwosixeightseven4 +1seven8ds4five6pone +zjftdkvpkpfrhzj97nine56 +4sdcdr53beightwocjc +onezxmtfive7ttbbttjeighttwo +rlcjone3sixonezvbmzcgpk4eightwotnm +5ddmcsfzhntpnzntlllthreevqvct +twoeight9 +tfhmxsbf2foursqrrfourmfrzjffive6 +dhhnlbkjmfourthree6 +dxtkbxjlphpqcbmhpdfpqlmreight775bh +sixklvmtjgsevennine33qgvplfourb +gkjmcxsmhtwopkcszlrjd1onesevenseven +8xxvzzqvzszcn1onevmdfsrrtbbjgeighttgpmhh +eightpndprhrf7 +three7fpxtxghx +fivenssevengrrlntzldl87 +484sixjsxcmmtvbftrfive +t8onesevenvqsfc2k +sevenoneoneeightsevenfive71 +sevennvnvbtzsnqggrsrgq35sevenfive7 +feightfive12 +twoc846cf +1mtvlxhhxlsdbphgltlgzpl +xddrlslrdl9 +fiveqvfjvcqlcfour27 +9fjqp9rrkqbtpv3 +23fqccxsvsix94tkzsqmrhsg +6lvrsqnz +9four7hvlfl9 +gbgsnmkrxjxpgnj828 +56grzmb6onekf9six +87bjn4 +sjdzmqkrlkbsmxzsmn3 +seven91eightsix +svhfnxzdzqczc2 +vbnz92chjjfqftxfourqzzxseven +seventwofour5jbqvlmqknbznfbhtonefour +dqdmntkfsnbmjqxxgmkvm6vqpgpnnreight +one1431 +1five4 +twoone8thtxlrrdxbone +qftpltmjd1zpxckthreeeight +9xg +pjpdjrkltnrkkmd9five75rdctppdhjtghrffczdx +mtvbhnpzjfive7nine +thlzdgxcqvsknczrdslsh7 +eighteight4kkt7four5 +71ninekzfntxtjthreeone3 +gzseven2fssqrgmbj +52j +nsv16seven +stwone1 +twodbqgfivegsrrvxvone3 +jckhqbdlvgbgn7vtx3vggrdm +ntzftfhfeighteight2 +48eight6 +flzfqonezvskbf1668one6 +sevensix864eightfour3 +dnsdrsxvcxnsevengxrszqxfnd4fmnine +tjjngfourhdfzpfkh24 +foursmgvlqjxsqmz8ninekthktdhz +three435 +tkfqhpz8zjmcqbxcb46 +mmvstlmln3kxnkvjcmxtrdxp4seven +rmfour13vkgnnmbzbzgd +three6nnbljchmzthreeg +68onep9five1one2 +rbvzvgmkbmdrnmvone7kqtxtrtbone +three13six4 +qksfrmvgztsfournnvp66nine +34three +11fourpzkmqnfmjqkdgrlgqbsixsixcqtgdggbdx +nineone2seven4twoninesix +ninez6qpnnbpmcdhcr +sixbdbkhgntpsevencpn3 +1fivehvlrzpninemkfbfgtvfivesix3 +7kpeightzlvqsgkfjznpfpfsseven66 +c7hxrgkglfivebfctxk +5rfdxgshzmnzqscpqzlbnrhbg9strxdthree8kntkhdpdll +4gfzcjcjsm63fvxpvflv +nine8526 +6scslfpnrveight1seven5bdllknjj +seven94hnxddjv26s +two48seven3four58four +fourseven1smh5 +1zzdzmbjpjfzlhsvzgxf61gvtnklgx6 +ninefour63 +nine3nrfzn +gthreeseventwonine1eights +sdonejzdmtxtpl9onerzztvqr8 +eight15kqnjrggpblhsbdz1 +lkkxnzjrgsixsixthreeeighteight4twonem +d17two44 +6seveneight1fourthreesevenbdpvg +cjgchvhq4386five8 +1threefive426rsxmthree8 +sixnztppjtn9twossfjrdkzkrldztfbbv +threesevenlqrdmvzdcphmqj3four5three +fivethreepcfxdxmc3vdbprghd5sevenszprlbzrbn +threethree88xcgdmrcssevenrlflv39 +eightonezchscllpfone9 +zreight6sevennine +fmrhqrxr7 +sixnlqccjchpxpqg86five5 +sdpxjrxtk4sevenfivetmddbpqgtqffive2 +hrvrgjgvxt7vrsr +2zj8 +35fourspthreeseven3zgddrmbxmsz +four8kkxmtsscf +4six98 +five9four +four5one7pjbninefourbmss +4sixsixt138seven +fourxsevenseveneighthsgmmpdx5 +tonexhgcjxbjn8 +chbkd2183 +six8fivefourglszgngfgqthree +pghkzrftwo6 +fourpfx572 +62zfvzp +sixsixnzvtxdgsixzxsgmpz1zvtwo4oneightpg +425twothreebv4twoxbx +8nineeight55eightflkpggltsr4spl +seven45clkrkrxj +65six594twofive +4ktvpfjeight +nnslpmkqc5five5four +nineonetzmft8jcxqzrk +fivefivethree99 +2l2 +4mhdj +3eight7fivejqhvrszgh3 +5four7mbfz8 +one8sevenmltbgqcbq22 +1zgfnfvt9seven +2lhbfrndhmfiveone +fivekzgch424zbpgxhtkbjdljxkxvnz +1vd6vpmzjmnhhn +vlqcbhskb5onerqbql6 +six3tplqcxthreethreefoureightzldgvgxrthree +4fourtwo4 +cvznvxbxlszjpxvzbqn7gt2fjtxddzmjv +kjqthree67twosixfour4nine +dmjrhflfzslhkjmthreemfgqvzcpm9bcnfbpz +nfpcsevenone3two58 +eight4kdqczz96five1four +1mzfour +57tdcmtmns4 +bdxeightrjvkrddrm3nftmzxlftthree +2three2kvfourgrtvxmrzgdninecseven +threemxpfnthree5onehjdxfntvtzlxhr +8onelqtjpkmtwotwoseven91 +rzhzg1fouronecqkdpfkgdkkftsixhllvphvtjv +vxgrlptk48one14two +kqncz3znmkppxs3hlggbmsfj81 +ddrp3 +three8hjdccgthrtbd6lvhnbfivemzh +twomptzvkqmssix7bjvpsix6nine +phrdjxmzj3xxkmfour7dsix +5threeshtmlsjbmfzgdq +96eight +three6rqqxgzthreejphvs +69seven52kmnpbqmjdhtjvxcnlxfgldbs +veightwozbbcmqrdxv6hxxpdknf +nxbtwone1vktdvlbbhnfour +4five864 +2dn1fiveeightthree +two4twofoureight43 +1eight51 +71fourhjrnqssxqvf +sevenqxkccdxndfgqhctsfsx6 +xqgsjvdmnb31sixfourtksqshz5 +4ghkqfzxceighteight2eightfiveeightwotf +ninelsnldgslfxfqfsrc24six +3seven3ctbf9eightmshd +mbqpfourfive44sixbnmqrmkgxt +flgdrvjj4dks +oneqslfbjgfx8 +jmmssm2 +hjfbzsix1 +bvjdxseven8 +fivenhfccvg9 +four5sevengkvslppponerhlvfms +b9one +89znlhgbnkmmxsix3two +sixsqtjcdfbs87ninejvznvmeightfvst1 +sevenktnzdkcsrzzdqtb9jnbtwotgxsptxcd5 +6mqvbhsddnmb21sixskg8 +threenb2four74five1lcmdzrvq +ftvone7 +5msevenpdqgzncvzxeight +foursixpshnbrpm64 +six2twotwordzf +nine7lbnxsfjtbb1seven4ggt4 +zlnfkkconept36 +9sevenfqlxjmts94xpcxqseven +foursevenseven15ninedqff1kmzfgvnks +xktjdhb115 +threeeightcnlpzrb8 +91six +376kkgmlblrcbthree7jgxvgfcdv +9xpz3 +rrcvpkgtwo2one6vjfone24 +sevenhfour3three +pxfvzltqrg9twotwogqdtzbp +lrgseveneight5pmxvppjdhtwoone +97six +four8bjdhpmszdeightprkgone +mb6lfcdkcn +8fbvxnjone +z9vdthreethreesbsrkzgnsxp8 +sevengftjmm1onegqhpninesnr3 +f4fourrbbngrdm37five +ninerbmdqfvkfx9eightone8eight2 +rxdvclfr714 +oneggchmt2dgh7 +tvbfour9four +four474fourgmdtm +nffourpbxtlcs7ninethree3 +bpjlrztwo2sdttcghc +hfflhmdc18 +4ninepsrmtbqrfeightk3xxxf +433hdvcggkr1xjcntvtnvsc +7nine2nine6 +9zctwo +9vvfjvctgtzpjh7jtdjcrh +qrtgcd5six31khd5 +fourbjshrq845zg +ghconeight35jljdqgtg4fjdtxtsfiveone4 +one7kxscgcxnsx +43threethree54four +vmninetwo2onetqgblrsgcpfkrreightwokg +threefour38 +fivesixeights26three +jtmzzxvmxone2four9jgtxjrvpcthree +fdqgczkq8sevenvcnhpseven8three88 +7ninezone3 +frj4eighttwobgx1threesjckzsvvxlone +oneseven2cspzhqfsix4 +ljmnbbcnxffkmdn5 +tmzlnl8oneseven86ninelbrzjgqn +fthree3seven6sixtwo34 +6two8fivexteight +89seven5twosix63 +63pzsjcjzvbhseven +msqvppsgnfbjrjmdrrhbfxrjqdlkpfourjbrjks3dthree +eight6twoklkdfgvxzteighttctqz +4gjpfmqs233six +onefourninenxcnkgfour8rmmrzln +1sptlpstqb6eightqgfhzzgpgp24 +eightlrjlhqfoureightjvj937 +595oneighthpt +44five +two2sevenbtwo +7fivefivepxonebbrlthreefive +klxnlfjlsrgjcd7eightninefive +threeqzpptnzhjnkqfsixpvk3xxlrpl +mqkhsdtbqqzgjb7149ninesix +1dbrrvjsx34cbdxhqpzbfhtgpm9three +3onesix6eight +five34 +6qcv9nzngtsjv +9lttthreegttzjstt +four47 +95onetwoftdzmhsfmhbnblnine +chcsqhnp72qjdqtjxzc8fourfourfour +fourfive28 +81eighttwoqdjkmnleightdbmzz +vzzqpjx8 +qq1six +qbktqgrjcqq75 +772 +njvnhnzdz6threefivetwonelt +pcfzzjfhqkxhfpztpv7 +fivemztfourqjrtngrkpcbfc3qq +bfjhbm6ghtdpsmlvb86eight +94883 +6onegbxmcqmdfive +sevenonesixcngsrgcz9 +sevenzhxktd22fourgnr9 +tdxpzvggnlpdxxrcpsp3threexjrldrkmp +34kjtbsxppmxfoursixlbzgqxbltv +fivethreezfive2 +7seven1seven +4fhvxbg58eighteightone +631gqtwosix +xqn1chrcjjrqxp4threezjcd +jtssvppxlnsix49rfvjdzntwoone +sevencmpmdnczcfdprgfdbjnzzkgnine26 +hkbnggqfk7mfmfsone68sxpdmf +fourtlhsmksvzg4foursixseven +pprkj3sixseven +kzxjpdczxhxckxtgbbtwothreethree5dztmdfrlfivedgcfmmrt +hjvrdhnckspl5eight3three9 +74two95eightfourdkzzlkxszm +one7tbfour1cpjtrxsqgvbjtpbcct2 +fivefour4hsix8hjsxrmpqqxnkhmjseven +nine8fivehvmnxsfour7four75 +sjfrjr2ds +fivefourqt95vbndnzns665 +sixssbznthreethree6f8lnzcgpprl +ninepfbpfnflrfnpzhq9 +nh9fvrldpkjmq7six5p +75zsixnqbhrcbpmddshjfqthtq +sevennine377fourfrtvpqrseven6 +97eightnine +52fiveonetrq5 +threehgjqt7rvfsljtzkfour +tjkxc1 +jthreerqbpzpzmeightntjlrhdmfour2 +fourmgv2three4one +four91 +9bone +oneseven1sevenpdvdqhlq +xlhbqxcpfp7 +twothreefive43 +1ctjmfn9one2 +htfivesixcdkjrjbr45eightseven +onefour8rrhltfl897 +37ljvmcnjhonevxkqpjk +3891sevencfgjhh45 +twoone5tbznkdmv1fourpltvnnsvk19 +55bcnzbfggd2 +17zpskbgeight2dx3 +vbdshtdkxllttwo65 +tzvmcmltfphztpplrxjxpbnine3qvktlctfrpxncb +1sixppzlfvkbnm +eight1gdvlzrfkc +four74fivefseven +hlzlvnjrp9312jxeightnine1 +sixsevenkjpbz5sevencksb2 +9rtvlgdpfnmgzdzcjggsq7sevendxglftncmbninefive +eight8gxkrbkgcvbxbbxlonefivesevenjnffhjsk +99twobdmcnfthreevr +sevenlpjbbthree58 +eightthree32 +14fhxsqshmjbngrhdzvxvvhxgvqnlxnnvrsgsheightninenine +6twotwo +kr573eightseven78 +9six18 +2seven8six1qdvf +ones9three1lcqj2 +sixbfour6gbd +tfpvtbbjtwormxz6 +49eighttwoonesixeighteight +fcrhntggdvseventhreeeight9foureightxjxqvtb +oneone3rnngppxj8fzpsncjmzn +9fiveonejjdpthreetwo9 +sixsixjzckvmbbszsl1nrrfphj5 +zgjvnttth7sbmtxczggxbbqpzq467 +3mhslltk +9six16three79three +fxprlhbm3zljzd49gdsrtt +6eightoneseveneightfourrfive +fourfive11six +6gmrfxnsmnnljf8ninenlctx +seven5threehninecnhbkgbnvqbsfx +pxzccjqz8 +xgzpzljnfour7threethrxskjlz9 +fourseveneight292eightone +5bjpzjseven21four +xbtf88nine +6nfjllxh4 +67five4c8 +1qbzdkvmlrzgj3rzqczz4 +mjjzblg3 +x3five +jrpxsrqgr9hqsddmscmsrsbhkdc63eightxfscd +6eightsixone +5dggfbgclz7htvpcx1 +onethree46psdlfpgbsix +lqbnine978 +7nrrdzfksbtjlnbgfxttzfourstqkd +mtfptwo9six23hctpbrxtbx +eightfznvmmp7cllpkggknttwoxbbv +rggdrlsgcm2hdljxzjhjrfour83 +vhtmhvjdzzkzmzqgr7fourfourfourgzbqqpz +dfjctmlnkqzzjhhltpvhfmhsixvclfive7vgm9 +nine642sevenseven9mblrhxxktfhdhbcztvx +4rzrdfmtvlpthree86 +qkdoneighttwo1one3 +dnnvkvpcmn2cltbzc6five59s +sixsnzpnfplrn38hthhbfive4 +tsrxkzfxcdgckxrgzkmrctqvrngfnvdscnpc6jgszldglnhsg +vvtfhtgxjbdgznjjzqjjclfg1lvpdcpjsevenseven3 +xrhbrpg8zb8 +4nine5qfxlhmvzsjsbznmklseven +lffl2six733jtrfrs3 +7nbvpkdpzjtc8qckhbqfsqqgz +cfljnthreecninedt2xldzbgl5six +nrggf7four +hbkpxrxonetwo969fivethreegspmzcfr +jjpmzlzfvqbvbzqcz2eightninepfqjkjrkfivebzcthgrpqx +xsccsbmcninefive4kkrvrht +sgnzzschtwotwofzjt9seven +8tworpzncglnmninenjmf368 +2one1zjtgllvsone +7nine4nqqxnvvnsbsevenvddcvfdr +three117 +shcjhvrfourpthree12 +1zxcxninegpdfrfhzlbzg +7eight9gkkfbdhplnmjkksbqzp6htmbhg +sixeight76sixfive +5twonemt +three86 +4three52psgzhnlhgvgcsbzbleight5oneightkj +cnztwone1 +six9sgx +79clrpmeightninepkh39 +rmfplpsixsixlvrdbqgpljgl5onetwo3 +7ninelznqjxjgtwohhk6five +1659two7onefive +rskpnrmfbbghttvklkg773fourczdqeight +xftwo4 +2nine5ccrgsmfcseven9seven52 +8sixseven +k33threehgqtljcdqxkl +hfgdvngttzfivecflmcc31three +eightninethreensjxxlzhgk9b51x +ninejktfhnnphkkgm2dms5dpxrbcd +eight7skzllgxgmkd1three4thhdpsjtvnq +7ninehhhdngbxjvvxldvbrhzrbvntl2 +pxgsixone75llslx +31tgrvtvvlbhnshjfgnqc +knzgkjfckf2sevendfive +bmxcnznineeight9dvkbngzmxz +gzqdjfsxq9pbseven +212 +h3 +9sixfourbrfsfivekttxzhrmdsppps +3vxtbtrzqzxfhgsksbvqd +9lbxdjmckrhfgjqlnsrrfzqxktqkrmmjshfnine +7pjmmxdcffxgspeightgpdcftjtdxjgdrfthree +t84ninefive4 +fgfour63sevendmtrrc9 +64three +btjnc3g6f3one +pm9 +threefourvjmsx5four +14one2rtcccqc +jhcckpv84xntpzdn +rpjrhgddzfvrzpqnfg5twoseven3threehvcmnkreightwotl +74one +six4ninesnbxlonesix5three +kfxjzjone76xppxgddstgfhxphpffrjlone +sixthreedsdccpqff4 +4951 +zszgqjxbx7 +three4pqqvfzf622 +vc77threetd +sixlbglxqhn52 +1sgktgvxp +bdsonekxsevenpgssslcq3fgp7 +pvnxnhdjmndnhthreefive49 +kgvkszsixone4 +3mjvqjpglzhphg67ninehnnine +one6xvvnvkxp4dfcxv +eightfour7threesevenp +7ggdl1 +ztwonethree427ninetnmzntj4 +fttwone258seventwotwo +75sixseven59 +7kmfzqgjpqkpdhthjlseven674xdgmphfk +eighttwo6five7 +3eightwoxg +22434five +khjmcpzvfpr9 +3rrzqzlrljgcvdnxj6four8six +63qrgqklszpgthreefkpzx +574htclbtzfivetwo +jtwofqfpkflzt9 +xnjzxpmmdln4lzlmlk41 +6jdzjjmz7jt7seven8fourkgttztbsktwoneps +72s166zpslq5 +3553lhkdcxvhqbddrfdbc5two +4gktbmone +fouronefives3qhglmzttwoeightone +one87rxkkhfrjfrpdjjt485 +one437nine +119one +5lseven87nmxxqvhmn +pphfmcfhxlsevensqdmtvtpvq1 +18eightfivefour +three98 +4onephzhtq4qc5four +26zglkpjvz3twoeight +7mxkdrbpnk29 +ppeight15 +9jnprvtmscsixbbpsixfivecktgvdpf5 +lbftvcngvkvxf5cmmrqljjb471 +eight3knrvtwo +one6pvbpkqkpdsixbv +eight2onethree6eight +5rztcbtfjkb2twoeight39hxppvpxqg +8threemlllncmfourthree +vhtsmncssixbmlpggvmlzdxbczgc1fxrgvsbhsrbs +ninebnpv7575three +4mthree +fourtwo1qrbfourjrjmlxjr +3jbkcsrqznc8 +pcgrxgf4eight54 +seven5mjk +ninenine6vmcmlxmcrbvq1nine8 +sixone2ninesixrdqfgpxddzthreetcheight +899lfbzhgn151 +46nineone +7one2qthree +nine2hjnfourninesixvblnqbgctwoeight +qkggsnnthrxnrccbgs583 +351zkxqtmbd9sixthreegjjxt +zrchlhmqcthreeninesmxz9 +219fivejrxgbjvvcxkjtwoseven +8threebzzsxdx +nine249ninefmlhj8rfour +16zfljhfdcmkthree +7sixjvdqgpvhmndpmhhzsphceight +two2zjqc4nfd6732 +41threeseven1fourseven +296fourgnq7three +tbzdhbhs7ntshptcgrbkjspjdz +55qcrmclmcck9 +25mhmtb3dscmjbhgv3four +bjmhkxsffourhnxkxv1 +jvntlbn5fivegjdcjl +7gndbbbneight +357623chktvtfzvf +169plhsshseven +nhgsrxcdfktpbzf9vpppxzkznine9 +xrdnlbmtdeightone3threeeighttwo +bnnqzcfoneeight2hhdfkrrqzt +342tlmjgtfcnine +47rvtfqlzgmjlqbqthree +7gnmxplrjbvfour6 +mcgbldbhlh1eightnine +two9eightxnpdj61kzcdpnpnpfgsdrbcflh +6541fourpkdplksnkpvkjxpdnvfttlfdflz +kfour7 +x4tpbnnvnjlseven +55nineninesevenzttsztwo9nlcqjq +1drhjrzsbvpl +mpknzhj9vmqckrpznqthreesj9 +211zqgpdlmpn +4jxzrztg5onehnzvdbtcqdtsnkqtdvsd1fournine +bvcrcz5four4 +4nineninecfhgtdphone9 +zbkjgbshqqkrcb3qmtfmdrdcckcsxshjb2 +1eightrblhbhljvkpshmrxc5 +hjcrrdsvnbqktxrgmq9nqgcztbv +6lzsixl5one +twofivesevenfivesixonenine5seven +fourmldkgnzb8djlsdmjnzxbmmvpf59seven +8hnfkknnsrhm +three2krtqmmxqzs4jbrnrtrxzxsllblbkjmthcrlxxkdlh +mglfmvvnthreefour1 +onehxz4fourhqcfvdlhg +zrzqdgs5jsttkrone +sevenrdmhnldsmdnineqfrgjhmhnnqkztxzm7 +63seven +2seven3mrsltqb17 +fdbtvthmmrb5gbxvcmtwosixt5five +eightlzglvxfone5five7dlqpmseven5 +dmzdkbfive98onefivehhbljrnz +eight8ninefour +24nvmftwofive +seven3onefourrmgkxtcsfour +fgpxmqqsfdrk8eight8zhcrzvrzmdxbbfive +eightonetwo7ninesjsrlr +rrkrrtnkq941sixone +threeffspgv3eightfivesix5 +lthnrlgfcnine2scdcvnineseven +sx86 +cxklrckbz5lsqq28 +5seven298 +933five5cmddfj46 +hrhhs76343 +one3two4fourst4three +nine3three +dhtscvgm9foureight81vp +btpeightpzbtphdlcm8fiverknbrhthreelxndqcv +one96six45tm +fourninetkdrvnbznnine22 +vxeightwothree5cd3jcnine +seven5one4one7ninefive3 +nflkr2dlmtsrkrgkfvsixxvznjbvz3btxkhhqcc +eightrtz6jslqxsixoneeightnine +xmvxn5 +tgnlrmjtkjdpbnpmsixbxfnl7sixone +htwonezcshpqgsix73qlgdqnkjskjthree +nrlkxq6fnfourseven +zmrlngjdhc41four4fourptrhddthreenhzv +n9twogdrzkcsbk8hph6 +436sevens7cnkrrk +6qkdvkhtwo +mztkszm39 +fourtwo4mqhjkkdzgffhqfktwonine +hbthree2hvpbznlgrxfgkthfour8 +34prfzlx4three +29zzfdvghll9three6 +two83 +one982 +36hhgdf7 +seven6ninednnine9mbtzfm1 +one38 +seventhree5lsjxknqtdsbtxrkone +eightmfctkbc9jlxgdnchlq9one8nine +p371b +9ninejszqsnpkfbthree1h5xscpfzvl +three9ljd +fbbv9 +five582 +58dctdbhbninesixczhd +qp4 +6pfqdeight +3onethreekqnnlt +m4fgbmdtwo3 +twodkrmtqs4 +9three6 +six1798nineeightsqpvpsmcbmh +9qxxmrmbnine3fivefourfive3four +one7sevenone78ninetwozqps +973keight9seventwo +keightwothreethreeh6threeeightlnqdzhlt +five94 +mqlltnfive8eighttwoqhztggvqqkcxgvgmch +2kpnsevenfive6 +gtmszpsjmggr3 +pm126one3 +rvcqbtz9zjtndbxlrdcxzf3 +mkninekhmtxzbjpd8threeeight7eight +5274xm636 +bleightfive9vdddzjdntthreerxtvdslrvbcvf +9eight4sixdqzrltgpzlpxtcrzxbhmsmdtwothree +cpneightwofive3fourtwo +one61threejxbjvsltxzpntpv +19581 +six2qllhlxhr1foursixz8 +6278teight3three +8gstxqdngxzlxvnvphlsznr3kknftvzxcqqbrfteightthree +4jlzjvjfltwo7pv +7dvt +blhsm4xcrbrf68ninezvhhtqgphnzxlhl +9dvjvfourtcthree +onethreenfkgrvsevenkczctlgkt7 \ No newline at end of file diff --git a/input/2.txt b/input/2.txt new file mode 100644 index 0000000..c5ab8c4 --- /dev/null +++ b/input/2.txt @@ -0,0 +1,100 @@ +Game 1: 1 green, 1 blue, 1 red; 1 green, 8 red, 7 blue; 6 blue, 10 red; 4 red, 9 blue, 2 green; 1 green, 3 blue; 4 red, 1 green, 10 blue +Game 2: 9 red, 7 green, 3 blue; 15 green, 2 blue, 5 red; 10 red, 3 blue, 13 green +Game 3: 3 red, 1 blue, 4 green; 6 red, 3 green, 2 blue; 6 red, 16 blue, 1 green +Game 4: 2 blue, 2 green, 19 red; 3 blue, 11 red, 16 green; 18 blue, 13 green, 20 red; 18 red, 12 blue, 16 green; 8 green, 16 blue, 16 red +Game 5: 8 green, 1 red, 12 blue; 10 green, 6 red, 13 blue; 1 red, 3 blue, 6 green; 14 blue, 2 red, 7 green +Game 6: 1 red; 1 blue; 2 green, 1 blue; 1 red, 3 blue; 1 red, 2 blue, 2 green; 1 green, 7 blue, 1 red +Game 7: 2 red, 1 blue, 5 green; 5 green, 1 red; 3 red, 7 blue; 8 blue, 1 red, 4 green +Game 8: 6 green, 4 blue; 10 green, 7 blue; 5 blue; 1 red, 7 blue; 11 green, 1 red +Game 9: 2 green, 2 blue; 8 red, 5 blue, 6 green; 11 green, 6 blue, 8 red; 4 blue, 3 green, 8 red; 2 green, 10 red, 5 blue +Game 10: 2 blue, 8 green, 2 red; 10 blue, 3 green; 12 blue, 1 green, 2 red; 9 green, 2 red; 3 green, 2 red, 5 blue +Game 11: 12 red, 1 green, 1 blue; 7 green, 1 red; 2 blue, 1 red, 3 green; 15 green, 8 red +Game 12: 4 red, 10 green, 4 blue; 3 red, 10 blue, 18 green; 5 red, 2 blue, 18 green; 8 blue, 16 green, 2 red +Game 13: 3 green, 1 blue, 8 red; 8 blue, 2 green, 6 red; 6 blue, 3 green, 11 red; 2 red, 13 blue; 1 blue, 5 red, 2 green; 6 red +Game 14: 3 blue, 15 green, 10 red; 7 green, 6 red, 6 blue; 8 red, 13 green, 4 blue; 4 green, 1 blue, 9 red; 9 red, 7 blue +Game 15: 8 green, 9 blue, 4 red; 8 blue, 4 green, 4 red; 8 green, 7 blue, 10 red +Game 16: 12 red, 8 blue, 2 green; 4 green, 10 red, 4 blue; 9 green, 4 blue, 5 red; 7 red, 1 blue +Game 17: 1 blue, 4 red, 6 green; 1 blue; 6 red, 8 blue, 10 green; 2 blue, 2 red, 3 green; 8 green, 14 red, 6 blue +Game 18: 5 blue, 1 green, 5 red; 1 green, 11 blue; 3 green, 18 red, 8 blue +Game 19: 2 blue, 2 red, 16 green; 5 blue, 2 red, 17 green; 10 green, 6 blue; 2 blue, 11 green; 15 green, 3 blue, 5 red; 18 green, 8 red +Game 20: 7 red, 6 green, 3 blue; 7 red, 16 green; 1 blue, 6 green; 1 green, 7 red +Game 21: 10 red, 10 blue; 16 green, 4 blue, 7 red; 2 red, 9 blue, 11 green +Game 22: 12 green, 7 red, 2 blue; 6 blue, 3 red, 10 green; 11 red, 12 green, 3 blue; 8 red, 3 green, 3 blue; 3 red, 4 green, 7 blue +Game 23: 7 red, 9 blue; 5 red, 1 green, 4 blue; 8 green, 9 blue, 10 red; 8 green, 9 red, 11 blue +Game 24: 4 blue, 2 red, 15 green; 1 green, 4 blue; 7 green, 2 blue +Game 25: 12 red, 12 green; 11 red, 5 blue, 15 green; 15 green, 5 red, 3 blue; 15 green, 6 blue, 10 red; 3 blue, 1 green, 5 red +Game 26: 7 red, 18 green, 6 blue; 3 red, 2 green, 7 blue; 1 red, 1 green, 1 blue; 16 green, 5 red, 2 blue; 5 blue, 4 red; 12 red, 2 blue +Game 27: 1 blue, 5 red, 5 green; 11 blue, 7 red, 5 green; 8 blue, 7 green, 4 red; 3 green, 3 blue; 14 green, 1 blue +Game 28: 12 green, 1 red, 1 blue; 17 green, 1 red, 1 blue; 1 red, 1 blue, 15 green +Game 29: 15 green, 10 blue; 6 green, 5 blue, 2 red; 19 green, 5 blue +Game 30: 10 red, 13 green, 2 blue; 5 blue, 14 green, 1 red; 9 green, 14 red, 3 blue; 14 blue, 14 green, 17 red; 15 blue, 9 green, 16 red +Game 31: 6 green, 1 blue, 8 red; 12 red, 8 green; 5 red, 8 green; 9 green, 11 red +Game 32: 6 red, 7 green; 12 green, 1 blue, 2 red; 2 red, 3 green; 4 red, 13 green; 7 red, 9 green +Game 33: 3 red, 7 blue, 10 green; 4 blue, 3 red, 15 green; 6 red, 7 blue, 18 green; 5 red, 10 green, 10 blue; 2 blue, 6 red, 10 green; 7 blue, 3 green, 6 red +Game 34: 1 red, 6 blue, 3 green; 2 green, 13 blue, 2 red; 2 red, 7 green, 5 blue; 4 red, 2 blue, 5 green; 3 red, 4 blue, 3 green +Game 35: 3 red, 4 blue; 3 green, 6 red, 2 blue; 8 green, 4 blue, 3 red; 11 red, 4 blue, 3 green; 5 green, 1 blue, 6 red; 8 red, 7 green +Game 36: 2 blue, 8 red, 2 green; 11 green, 14 red; 14 red, 1 green; 7 green, 2 blue, 11 red +Game 37: 2 green, 10 red; 1 green, 5 red; 5 red, 11 green; 1 blue, 11 green, 2 red +Game 38: 11 red, 1 green, 11 blue; 9 red, 1 green; 5 red, 2 blue, 1 green; 2 red, 6 blue +Game 39: 3 red; 2 green, 18 red, 2 blue; 2 green; 6 red, 2 green; 12 red; 3 green, 11 red +Game 40: 3 blue, 4 red; 2 red; 7 red, 1 green, 2 blue; 1 green, 1 blue; 5 green; 2 green, 2 red, 1 blue +Game 41: 5 green, 3 blue, 10 red; 6 green, 3 blue, 12 red; 2 blue, 5 green, 7 red; 2 blue, 3 green, 2 red +Game 42: 11 green, 1 red; 6 green, 4 red; 4 red, 4 blue, 7 green; 11 green, 5 red, 5 blue +Game 43: 1 blue; 6 green, 16 blue; 7 green, 1 red; 2 red, 15 green, 7 blue; 2 red, 16 green, 3 blue; 3 red, 14 blue +Game 44: 3 green, 1 red, 5 blue; 9 blue, 1 red; 14 blue; 7 blue, 1 green, 2 red +Game 45: 1 blue, 1 red; 1 blue, 1 red; 3 green, 1 red; 1 green, 1 blue +Game 46: 1 green, 8 red, 2 blue; 13 blue, 7 red, 2 green; 3 red, 4 blue; 2 green, 18 blue, 5 red; 4 red, 5 green, 9 blue; 3 red, 7 blue, 1 green +Game 47: 8 blue, 1 red, 8 green; 2 red, 6 green, 1 blue; 2 green, 6 blue, 5 red; 6 blue, 6 red, 6 green; 6 green, 9 blue, 7 red +Game 48: 5 blue, 14 green, 8 red; 7 blue, 10 green, 7 red; 9 green, 9 blue, 6 red; 9 green, 5 blue, 17 red +Game 49: 10 green, 6 blue, 2 red; 3 blue, 5 green, 4 red; 8 red, 8 blue, 11 green; 5 red, 6 green, 5 blue +Game 50: 3 red, 2 green; 1 red, 8 blue; 2 red, 2 green, 3 blue +Game 51: 4 green, 8 red; 8 red, 5 blue, 13 green; 3 red, 11 blue, 14 green; 5 blue, 11 green, 3 red; 5 red, 9 blue, 11 green; 6 green, 4 red, 12 blue +Game 52: 2 green, 1 red, 1 blue; 3 blue, 2 green, 2 red; 1 green, 3 blue, 4 red; 2 blue; 8 red, 2 blue +Game 53: 18 blue, 4 green, 9 red; 6 blue, 9 green; 14 blue, 9 green, 9 red +Game 54: 2 red, 7 blue, 3 green; 6 green, 3 red, 2 blue; 1 blue, 3 green, 3 red; 2 green, 4 red, 9 blue +Game 55: 3 green, 6 blue; 6 green, 8 blue, 6 red; 5 green, 3 red; 4 blue, 8 green, 1 red; 1 red, 2 blue +Game 56: 4 green; 2 blue, 4 green, 1 red; 3 blue, 6 green +Game 57: 15 red, 3 green; 15 red, 1 blue, 2 green; 15 red, 1 green +Game 58: 1 red, 5 blue; 5 green; 6 green, 8 blue, 2 red; 1 red, 6 blue, 6 green +Game 59: 3 green, 8 blue, 5 red; 1 green, 12 blue, 4 red; 2 green, 18 blue; 2 red, 4 green; 16 blue, 3 red, 1 green +Game 60: 7 green, 6 blue, 2 red; 6 blue, 2 red, 4 green; 11 green, 5 blue; 4 green, 4 blue, 3 red; 2 red, 7 green, 8 blue; 6 green, 4 red, 1 blue +Game 61: 6 green, 6 red; 1 green, 3 blue; 6 green, 1 red, 7 blue; 5 red, 19 green, 7 blue +Game 62: 3 red, 4 green; 2 red, 4 blue; 1 red, 13 blue, 5 green +Game 63: 2 red, 13 green, 4 blue; 10 green, 5 red, 10 blue; 13 blue, 6 red, 3 green +Game 64: 5 blue, 2 green; 1 blue, 1 red, 6 green; 3 blue, 11 green; 2 blue, 8 green, 1 red +Game 65: 4 red, 5 green, 2 blue; 2 blue, 4 red, 1 green; 3 red, 5 green, 4 blue; 6 red, 3 blue; 3 blue, 2 green, 5 red; 2 green, 3 red +Game 66: 14 red, 17 green, 1 blue; 2 red, 12 green, 2 blue; 1 blue, 4 green, 14 red +Game 67: 7 green, 4 red, 10 blue; 11 blue, 4 green; 7 green, 2 red, 3 blue; 11 blue, 3 red, 9 green +Game 68: 5 blue, 4 red; 10 blue, 8 green, 5 red; 1 green, 1 red, 10 blue +Game 69: 1 red, 15 blue, 2 green; 16 blue, 15 green; 1 red, 15 green, 14 blue; 2 red, 5 green, 11 blue; 5 green, 1 red, 13 blue; 2 blue, 16 green +Game 70: 1 red, 2 blue, 9 green; 2 green, 1 red; 7 green, 4 blue +Game 71: 5 blue, 1 green; 2 green, 5 blue; 2 blue, 1 red, 1 green; 1 red, 5 blue; 1 red +Game 72: 5 green, 5 blue; 8 green, 3 red; 7 blue, 8 green +Game 73: 1 green, 4 red, 3 blue; 5 green, 5 blue, 3 red; 8 blue, 7 green, 1 red; 3 blue, 3 red, 9 green; 13 green, 2 red, 10 blue +Game 74: 2 red, 4 green, 5 blue; 3 blue, 6 green, 4 red; 2 blue, 6 green, 5 red +Game 75: 10 red, 20 green, 14 blue; 9 blue, 15 green, 17 red; 8 green, 18 blue, 6 red +Game 76: 7 green, 1 red, 9 blue; 1 green, 3 red; 3 red, 3 green; 4 blue, 20 red, 9 green; 12 red, 7 blue +Game 77: 1 blue, 9 green, 7 red; 5 green, 7 red; 4 red, 1 green, 1 blue; 6 green, 3 red, 3 blue; 3 blue, 5 green, 18 red +Game 78: 11 red, 4 green, 4 blue; 12 red, 3 green, 4 blue; 11 red, 4 green, 13 blue; 8 red, 5 blue, 6 green +Game 79: 1 blue, 16 red; 9 red, 2 green, 2 blue; 2 blue, 12 red; 3 green, 12 red +Game 80: 2 blue, 3 green, 5 red; 5 red, 8 blue, 3 green; 10 blue, 8 red, 8 green; 5 blue, 4 red +Game 81: 1 green, 3 red; 6 blue; 6 red, 1 green, 8 blue; 1 green, 8 blue +Game 82: 4 blue, 2 red; 7 blue, 10 green, 3 red; 7 green, 1 red +Game 83: 12 blue, 9 green; 10 green, 7 blue; 7 green, 1 red, 12 blue; 5 green, 12 blue +Game 84: 1 green, 2 blue, 1 red; 2 green, 9 red; 14 red, 1 blue, 2 green; 2 green, 9 red; 4 blue, 2 green, 9 red +Game 85: 1 blue, 8 red, 8 green; 1 green, 4 red, 4 blue; 8 red, 7 green, 18 blue; 5 green, 3 red, 15 blue; 11 blue, 1 red, 4 green; 4 green, 3 red, 1 blue +Game 86: 14 green, 11 red, 14 blue; 9 green, 14 blue; 12 red, 4 green, 13 blue; 14 green, 9 blue, 2 red; 5 red, 17 green, 1 blue +Game 87: 3 red, 3 green, 7 blue; 3 green, 2 red, 20 blue; 12 green, 9 blue; 3 blue, 3 red, 8 green; 12 green, 9 blue, 2 red +Game 88: 4 green, 1 red, 4 blue; 1 green, 3 red, 1 blue; 2 green, 3 blue, 3 red; 5 green, 1 blue +Game 89: 8 blue, 1 red; 4 red, 6 blue, 1 green; 12 blue, 3 red; 1 red, 4 blue; 3 red, 5 blue, 1 green; 7 red, 7 blue +Game 90: 3 red, 2 green; 4 blue, 13 red; 1 blue, 7 red +Game 91: 8 blue, 2 red, 9 green; 5 blue, 17 green; 2 green, 7 blue, 1 red; 8 blue, 11 green, 3 red; 2 red, 5 blue, 1 green +Game 92: 8 red, 11 blue; 7 green, 9 blue, 2 red; 6 red, 3 green, 3 blue; 4 green, 8 blue, 2 red; 9 blue, 12 green, 8 red; 6 red, 14 blue +Game 93: 4 blue, 1 red, 3 green; 7 green, 1 red, 3 blue; 6 green, 1 red, 3 blue; 3 blue, 10 green, 1 red; 3 blue, 7 green +Game 94: 11 red, 13 green, 3 blue; 4 green, 15 red, 5 blue; 1 red, 7 green +Game 95: 4 green, 10 blue, 6 red; 4 green, 9 blue; 8 blue, 9 red, 5 green; 7 green, 12 blue; 12 blue, 8 green, 3 red; 2 green, 5 red +Game 96: 2 red, 2 green, 1 blue; 1 red, 4 green; 1 green +Game 97: 4 red, 5 green; 5 blue, 3 red; 8 blue, 2 green, 1 red +Game 98: 1 blue; 2 green, 1 red; 5 red, 2 green; 4 red, 1 green; 2 red, 2 green, 2 blue +Game 99: 6 blue, 5 red, 2 green; 9 red, 1 blue; 2 green, 2 red, 5 blue; 10 blue, 2 green; 11 blue, 1 green, 4 red +Game 100: 1 blue, 13 green, 14 red; 11 green, 11 blue, 7 red; 2 red, 1 blue, 2 green; 10 blue, 15 red \ No newline at end of file diff --git a/input/3.txt b/input/3.txt new file mode 100644 index 0000000..2e4adf4 --- /dev/null +++ b/input/3.txt @@ -0,0 +1,140 @@ +....................................18..........889.270.....748.280...997.................617..............622........763............476.... +...529......434.....191..489...717...@.....................&....................939*7.....*....................606............760....*...... +....*...473....*221................$........182......812........493.84....793..........794.......589..407..41...*.....................68.... +..380.................553..559..105.....749.............*..........*.........*.............-968....@.....*..*....908..603................... +.........................................#...600.........441..#833...490....366.........................225..488........&...456.........224. +........288=......896*469..........831..........*....................*..............#...@.146.......*.............790#......%...194....@.... +..730.........................250+......./......359....=.462..............138...#.49..713.-........342...604*676.........=.....*.........418 +....*....907.......526................274...........346.....*.876..........-..725.............376......................541...600.....366*... +.....747...*..........*......56$...10........422........-.86.....*.......................728./............*................................. +.........486.........349............*..........=......696....$.............850&......906*......831.....539.195.........202.................. +..............592.............................................592....+.847.......676......365..=......................*........469.%........ +.542............*...............385....60.................329......657..@......=..*....&...........355.........=....52.........*....352..... +.............994......937...................45.....48........*..............835...791..654....................75.............523............ +...................&..............269.486.....+...*......&....954.........#........................246&...&..............203......693....... +.....262..........920...248.454......*...........289...822.........530...569..............................256.......929....*......*......... +........%............../.........................................../..............+..57.@............616=...........*...462...198.757....... +...............65........=.........764*.....$581.727........62.......4.....796..280......444.807...............174@.20................512... +.........877....*...687..187.522.......853..........*321.....*........*345...........513.....=.......849..........................@....*.... +.........*...635......*........=..............................380...........77...44*..*................#......*......484.....65.886......... +.....153.........@.&.....320........96..619....510......221.............139..*........957..977......20.....232.20......&.....*.............. +......*...397*.610..479...*....=....%.....*.......*.............839.......*................*............*.................144........#554... +..510...................927.....384........714...286....................799.....733.........832......815.187.....*....470................... +........892..................................................645.427.............%......562...................133.442....*906............... +.........=..........803............577.......%.....447..185.........*957.637*97..............132...............................83.258@..$... +...........=55......+....+...435.......930...143.............475................./..............#......................=..675...%......709.. +777....................841..*...........*......................*........*.........859...../...............640%..955..903.*.................. +..............639/...........803.829.....877........#.........716....873....387.........857..837.................*.......390................ +.................................*...............994......................%....*.............&.......749.........718.174.....138..697...463. +.....................697...873#.435......*141...........914*656....@......414..981.....541.......%....*...+.#.........*......&....+......... +.....................*................544.......524.............446.......................+.397..486....603.463......497.................... +.........161........412....273..218..............*..80............................708.......=....................899........+......-........ +............*..435*.........-..$.........666..401.....*897.214..472..499............*...955......................@...867....607.491..43@.... +666%.851..653......44...............152....................*....@.....*..........294.....*...313...237....580............................... +............................989....*.....954.....69.....488../.......90.495*..........697....*.......*.....*..686.......=.......594*981..... +.....104..#...................=.....773...$../.....*396.....959.............272...........433........889.821.....*759.469................... +.......*..865.318.@812........................267...............969.............................758........................913........646... +......132......*.........*699......+...............+.......126......468.....651............424........270.765.....53...965.*...19........... +..............725.....449.......337..187........862.............553*........*....=282.28....*........*....*........*.....%.779..&....218*... +.....744...36.....203.......452.......%..846........&......................................811..501..342...891.....776...................395 +.................$.....567&...@..689.......%.......619..392.........847#..#.....236*833............*.........................408............ +............./.....732............*........................*..............568................375..561..-270..111....=..565.................. +...........801............221....336...493....263..81*.....981...........................449*....................809......*239...........686 +...................+.........*87......*..........#....510...........20*684.../..387.....................................*...........132..... +.......674......&..364...........734.141.854*290...........................572.*......878...929.141.#.......526...919.646..*..........*..... +..............980...............*...............................500...229......876....*..............220.....*.....*........809......522.... +394....374......................194......660.....172..............&.....*...........774...................367......452..952................. +.......*...................918/............*.....*.......220........776.542..............843..857....560.................................... +........728.......@951.668.........651......589.857.........../.....*.........354....509.......@........*.................+.....151......... +......-......262.........#.....*95...................878./...563.642.............#.......................586........638..933....=........... +504.454.......*............540..........524..........*...531...........942...................632@.830.........302..-................%....... +.........498..357..........*....&..........%.......340.........925.......*....623.707.479............*36....%........+.....659*149.401.117.. +34..................608.....156.747...602@...............................748..*....*..$............*.........565.....93................*.... +........426.................................60.938...........................615.328.....818....143.118..................*.@...........916.. +...............547..............25*32.......*..*.......64..-813..........405.........802...*............188............246.236.............. +652................*426...................74.....822...*.................*...533....*....764..............*....................%............ +....920.64......437......598....738..#..............+..44...625...*....879......*..879.......668.#.......509...385..123....677..553.62...... +....*....+.783..........*..........*.552...534...............*.....312........=.........@...-....819............#..-..........*............. +....779.......&....21..582......264.........*.............564...............561........811...........................943....68..$........... +.....................&.....................915.472*918.................848.......943.........803....................*..........386.......... +...........................62........668..........................*801.*.........*...............878.......212....613....................... +.......208.......302..313*...*........*...........&.717........237.....11.........551.569.................*...............717............... +...742*......886*.........15.402....806...84...527.....*....=................650......*.....56.....401...276......964......-.....@.......... +..........................................*.........411...277.722.337.........*.....915.252*........*................+..........356....553.. +.......*...2.........406...............922.....=605............*............403......................316..........84.......%..........=..... +.......385.+....%893........200............150...........420.548.......+111...........70............................*675.895................ +...........................+.......198-...@.........532...........23..........349#....*......#...............................920.........844 +.....#.....387/.............................31..638..*....580.....#...........................397..720..........161...+.......*..628....*... +......816..............669....36..#393..848..........884.+...........&676.....876*341...565%.......*..........*....#...914...356..-..210.... +...............646........&..$.........*...................542....................................370......686.567.......................... +............../....94................414......18.............................861....*.....878..........24@.............875=.693*320..864.989 +...................*.........665..............*...595..........201......738..+...784..187....*237..../..............................*....... +......236-.......126.....641*..../............486.*.....638.............................*.%.......242....*153....+.........63.837.723.41.... +...........35....................114...............661....-....534.........626*......796..28..........579......367..78.929...*.............. +......108.........271*144.........................................*............5.....................................*.*.......669.533..704. +.........*635................#..@947.......290.....544.............707...................465..632.....771...181........471.380*......*...... +.....114..........89$.....699...........=....*........=.....416...........................&.....$......$..........365...............131..... +.......-.............................410....64......*.........*.........&....684.....15.....317...340*..............*....................... +.........26.609........152........................94.498.....26......671.......*.221*..........*......718...824.....56...........915........ +..218..............707*.......786.....839................790.....192.........181......836....287..............%.......................-..... +......937.722...............%.........*...378$...........*.........@.449..............%............226...........&...........428.......341.. +.795....*...&..185..405.....60.121....159.......275...996............*....981.....710........363...%...528....-.888....*641...*....880...... +...-..806.......*.....*......................@.....#......545..467...289..*.........*....681..........*.....86......326.......664.&......... +.............221.....142...860+....933..653..291......52&../..*............300.%...811...*.................................................. +......................................-....*.....861.........149...............673......762........./284..588..................%.....316.... +..373......290..............................665.....*................&.............&552.....51.............=.......105.......162.......*.... +...-........*.....388........%...772....................=...57....163..932..41...............*...693.116*......#.....*..............434..... +......*489...248..*........395...=.....................676..#..........*...................835...........570.199..678....................... +780...............713................952...479...379..................83.554.........919.......486..980...............984.$468.....720...... +..........66..-.....................*.......*....*...........................380%.....$.........*..........899*..118..............*......... +............*..694........382....793.........668.92.....747.......49.....&..........#.....284...462....303........*....518......50.....798.. +...*146..642.......@880...*............79=.............*.....93....&...885...785..780.......*..........=...-.....663..................*..... +533...........996.........352..................619%...200......+......................142....408....=....634............379*491.588@..183... +........$127........970...............902..........................943.649............$..........909.........619............................ +................-..*....640............*.......-459..#.....446......&.....*.934.....#....313............/....*........509...473..901....132. +..........*..415..805..*.....786.....12...............863...*...........674....$...296.....&...474......281...326.......&....*......$....... +........909...........136.......@.........645................961................................/...250...............$................*554. +...*.........589....................253..../...166.....&429.........96......568*684.%186...............*958........678..............466..... +.759............*96..........658.......*......*...............105...-....................428.............................=...73............. +......54*...................+......168.592..536.=................*8...671........753+.......*.................74........564....*............ +.304.....728..764................=...*...........804.575....266........*.....................94......27.316....=.-644.*.......209...485..... +.....997.......*.........#....792...855.................#......*169...496./615........683.......225.*..................474............$.395. +............573....206.477...................*158..........702....................298../......*...=..100....................714.........*... +448...............*..................769...27........691..$.......178....675......*........980.28...............*727...%.....@...201.545.... +............223...561..........261.....*.............*................+...........610.250....................496......408..........*........ +....@775.....*............&.....@....195..........303..+.............141..865..............629..+....659...................855*....958...... +...........407........92...22................493......605..................@..........477...*....160...................743.....163.......... +......................../......*......602@......=..+.......*....668$..245................*...731..........69.....213.....*........./....%... +................213*........903.75..........64......945...221.........+.......740........739..........393*...301*......562...../...53...4... +...164&.....145.....580.......................*................425........900......828*............................*........536............. +...............*.....................91....185..................../....................85.................414...890.204..................... +....772............422..*.351...218..................584................263...849...............*...639*.....*.............................. +.......*307...897...*..28.*........*.*49.......300....=../72...........%......*.....544......974..@.....214...55.......347.............914.. +901............*..67......840...343.........................................447....*...............400...................*.................. +.......684..498.........*......................544...347..+........493.............612..........59.........741..........593.........416*.... +..........*........369.577........690...770....*......*..983.*160....#.................623*248.#......437..*........258.................275. +....+...603....+...*............./......*...913....609.................823........................62.%....83...........&.................... +....538.....356..=..117......-.........556................................*..............920.......*...............746...................... +................483.......197...................&....................231...210......92....*.....982..&......199....$........848.$.....$..... +...370..413.........$.............*............556........325...902@....$..........@...182..........933................*.....&...829.402.... +......*..%...........524.131..134..163.....185...............*...............................756........282&.774......822................... +....340....373...*...............*...........*....649.20....289....799..549.939.....120..........61............*..345.......778...550.267... +............&...699......&319..170...492....61.....*.......................*.....+.................*.........345.....@........*...+......... +534.............................................144..849.......174......*........219.....$......140...476..................970.............. +.../....681............444.....819$...................*..=305../.....413.95...............589.................229...235................644.. +...........-.....28.......*403................&....548.............&...........17..........................33..........+........962......... +373..........500....%429.....................291........*....881.296.....163*....*..............796...585....&.............802..*.......138. +................*..................983&................809.....*.............417.999....$.......*...............633.........*...322....*.... +......907..$921.............665...........731...............903.........................638..662..............-..........495.........130.9.. +.........*......168............&..353.....-..........639.........#...........349......................660....914...570...................... +...%......695..*....679...........=..........$...958.+.....494..369..........*...........................*44........*.........964......548.. +...826.........268..*.....675..............136....-...................650.964....728.823.403..................842.983..........*......*..... +...................328................................519.....210.......................*....143.....*46....../.................241..55..... +.......855$...199.......526.....849...764*294..........#.....*.....280..........261.885.........#.434...................610................. +...............=...............+...................498.......936......*..831.......*.......&...........462.939+..439.......*845.....443..... +.....@360.842......986%.902-.....21.307....234*......*...324.......505....*.............315..............*.............................*.... +..........*....................*.*....*..............42..*................474...../919................50.674..713................./..27..... +........249....291...........448.622..228.......308.........189...............629........-...................*............594..127......782. +..................*173..817.....................*.......91.....*..#................*649...492...400.........17...878.....*..........950..... +...32.674......-........%.....402/...........610..%.....*.....549..853...........96.................=.............*....779.......@.......... +.............885.................................600.456...........................................679.............16.........392.....841... \ No newline at end of file diff --git a/input/4.txt b/input/4.txt new file mode 100644 index 0000000..f23b21e --- /dev/null +++ b/input/4.txt @@ -0,0 +1,197 @@ +Card 1: 24 76 32 40 51 61 89 6 30 60 | 30 69 24 86 6 8 92 61 51 88 63 67 32 62 15 49 22 77 40 27 89 60 76 58 79 +Card 2: 97 3 51 52 79 8 89 76 10 59 | 59 48 52 76 97 16 92 81 62 25 89 51 54 3 79 18 94 78 8 32 99 66 10 70 38 +Card 3: 8 67 56 82 96 2 21 47 41 38 | 6 83 17 36 8 21 82 27 68 67 7 38 56 42 66 3 47 87 41 71 88 96 2 98 72 +Card 4: 41 83 77 61 91 13 84 63 81 79 | 29 28 85 84 19 83 37 55 7 97 8 11 12 50 72 42 48 92 30 2 27 18 38 89 59 +Card 5: 31 96 75 87 56 8 79 80 49 89 | 32 75 80 56 77 48 59 89 6 67 87 33 14 44 50 49 28 82 79 40 9 31 99 8 96 +Card 6: 32 94 17 27 59 63 7 87 68 53 | 2 37 31 69 17 7 75 53 87 26 51 96 19 63 59 68 34 56 35 30 93 79 89 61 71 +Card 7: 19 40 50 67 3 2 79 33 14 98 | 51 30 70 72 2 20 35 50 94 37 40 74 14 91 33 98 67 92 3 59 79 19 97 75 31 +Card 8: 67 12 63 96 61 48 95 40 73 46 | 67 12 40 63 15 46 33 16 43 92 78 74 95 73 4 53 14 9 90 94 72 13 96 54 61 +Card 9: 47 23 84 63 95 98 26 90 99 64 | 98 95 4 47 1 23 26 11 74 84 36 82 63 60 53 44 6 59 64 99 17 42 90 85 19 +Card 10: 70 82 46 43 38 21 2 98 33 64 | 93 3 64 21 96 80 32 70 79 58 34 42 2 19 39 61 46 31 88 43 87 54 67 69 9 +Card 11: 44 79 34 75 85 94 2 81 55 66 | 55 85 6 58 72 51 37 44 29 79 39 66 49 48 75 15 83 81 2 24 94 99 34 59 33 +Card 12: 74 34 8 69 16 83 80 97 22 29 | 96 97 5 87 50 84 94 19 93 52 40 46 15 7 41 37 98 12 16 56 65 95 27 90 54 +Card 13: 2 56 8 43 13 72 33 11 36 29 | 57 40 14 35 18 65 78 87 58 84 51 2 43 61 37 66 30 10 39 60 64 54 48 9 15 +Card 14: 43 84 95 53 44 69 9 94 5 17 | 65 74 88 75 81 10 62 83 33 51 76 26 89 94 80 17 56 42 21 6 87 1 46 95 9 +Card 15: 57 7 28 1 5 11 81 43 69 34 | 52 49 8 91 34 2 29 74 94 81 77 58 11 83 96 43 40 55 89 27 10 30 7 57 28 +Card 16: 6 14 70 53 54 52 26 72 59 42 | 37 52 60 53 86 49 91 33 4 77 64 51 23 85 89 10 42 8 29 66 61 74 99 26 87 +Card 17: 10 86 55 81 40 23 25 67 93 59 | 68 62 15 32 54 85 99 5 10 2 56 38 64 11 55 84 50 67 34 12 52 59 76 1 36 +Card 18: 32 90 99 60 31 54 58 78 88 61 | 63 93 58 47 80 60 46 88 21 48 83 31 35 64 23 24 55 91 1 73 45 20 29 77 66 +Card 19: 80 1 28 63 37 42 24 81 99 94 | 15 10 33 88 28 2 16 62 81 72 42 67 49 38 65 95 63 61 24 52 11 6 26 39 70 +Card 20: 44 26 16 4 55 63 33 36 82 86 | 70 3 46 58 41 95 96 73 15 13 99 69 91 75 87 57 92 65 51 38 53 80 14 52 48 +Card 21: 48 36 78 7 17 2 61 54 49 11 | 56 41 84 37 45 62 40 18 35 33 43 57 80 9 32 13 25 46 61 58 55 48 30 11 74 +Card 22: 83 30 3 9 31 13 82 81 15 74 | 64 47 66 39 14 17 10 79 84 62 27 81 73 96 43 42 36 40 70 80 90 41 50 55 16 +Card 23: 84 6 52 97 89 48 62 20 15 53 | 41 66 12 56 86 61 45 38 1 51 31 92 14 96 16 37 67 98 64 57 77 10 73 39 80 +Card 24: 90 8 46 94 95 43 31 74 80 66 | 49 91 47 1 37 48 72 45 29 26 76 58 44 97 20 70 55 77 13 86 19 87 59 4 34 +Card 25: 80 52 16 86 65 84 31 36 49 59 | 95 72 65 80 52 97 59 9 81 2 96 36 86 31 16 8 48 6 50 66 84 49 78 18 56 +Card 26: 32 56 87 82 62 97 42 22 61 83 | 85 29 58 59 48 20 69 50 98 46 60 25 40 52 73 28 66 63 1 6 74 12 88 37 64 +Card 27: 46 65 51 32 83 91 67 52 43 71 | 98 83 43 46 36 71 38 14 30 26 5 47 3 85 61 51 4 91 35 28 67 48 60 52 74 +Card 28: 26 60 29 89 24 28 95 92 78 97 | 39 95 41 34 16 25 62 60 53 97 24 92 77 78 29 68 35 86 71 58 89 12 28 9 11 +Card 29: 66 6 93 49 51 2 48 96 62 89 | 2 17 62 39 6 51 93 18 95 54 72 1 97 66 84 96 60 89 90 69 13 48 49 36 16 +Card 30: 53 95 92 75 76 56 48 87 79 15 | 1 4 97 3 6 79 11 76 88 7 56 75 48 95 60 94 59 36 46 86 70 69 91 2 73 +Card 31: 80 63 37 67 35 98 97 72 87 52 | 67 77 58 66 54 19 87 75 76 51 29 80 53 26 24 49 88 91 52 72 86 81 4 39 37 +Card 32: 67 23 77 16 4 31 24 13 76 86 | 16 6 69 31 51 4 28 83 1 89 79 24 46 38 99 77 43 50 19 87 90 73 85 56 70 +Card 33: 38 41 64 25 96 99 68 58 92 40 | 84 59 5 94 49 6 2 40 73 96 38 23 43 91 47 88 24 17 9 25 35 52 13 92 64 +Card 34: 24 52 69 59 55 8 43 15 45 92 | 56 47 84 62 4 81 88 92 54 96 52 89 42 46 49 33 69 10 51 12 5 82 85 65 20 +Card 35: 19 82 84 29 58 44 65 87 26 32 | 95 63 13 56 77 3 57 17 32 20 81 2 82 76 48 39 71 93 84 8 15 88 89 74 11 +Card 36: 41 13 70 23 65 66 47 75 24 98 | 17 94 89 42 47 9 55 54 48 57 71 69 63 33 35 97 90 20 43 24 18 6 76 82 29 +Card 37: 23 39 77 90 56 47 2 82 66 72 | 2 61 16 48 65 62 77 5 49 35 72 93 22 83 18 3 38 1 14 31 99 54 52 8 13 +Card 38: 99 18 59 51 94 52 44 71 30 7 | 95 31 1 58 94 8 28 18 50 81 59 26 57 82 67 30 17 86 87 79 37 23 10 83 3 +Card 39: 98 3 38 42 18 71 66 80 39 79 | 51 88 43 25 90 27 9 35 29 4 21 10 79 13 54 42 11 61 36 30 24 15 6 65 26 +Card 40: 6 27 58 3 67 72 45 12 63 61 | 36 39 75 2 78 95 64 22 41 93 54 91 50 11 55 74 17 56 92 88 87 89 85 6 40 +Card 41: 37 76 61 43 25 29 89 11 35 93 | 27 30 81 38 62 4 33 92 71 77 6 22 75 76 97 67 70 13 65 96 15 17 36 56 78 +Card 42: 42 7 79 61 98 92 2 95 14 44 | 62 88 67 48 82 59 27 34 6 39 25 97 87 81 37 50 65 10 41 56 12 32 68 30 38 +Card 43: 12 9 34 93 71 99 95 86 87 40 | 6 24 93 79 85 25 90 72 71 13 66 86 9 8 12 50 57 30 39 59 29 34 26 17 51 +Card 44: 24 96 61 97 83 98 10 1 29 81 | 74 43 92 5 1 56 15 60 83 96 50 72 81 98 29 52 49 24 97 90 95 10 84 12 61 +Card 45: 12 29 82 5 83 92 86 51 98 32 | 61 14 28 80 48 55 17 5 19 12 62 27 51 18 86 91 49 58 11 65 13 79 68 98 36 +Card 46: 67 47 77 25 15 64 90 76 16 88 | 64 86 26 25 77 78 56 84 87 76 15 88 36 90 93 96 8 13 67 47 10 16 42 27 6 +Card 47: 97 25 76 83 35 90 53 16 34 18 | 5 26 77 53 36 90 43 61 94 89 41 99 93 92 56 2 10 29 1 47 55 38 66 13 15 +Card 48: 3 75 52 55 41 86 9 54 26 98 | 93 30 12 72 36 62 79 25 61 90 31 87 59 88 27 56 99 6 5 11 58 80 78 77 43 +Card 49: 34 44 25 93 74 5 15 37 14 30 | 8 15 89 36 38 60 9 48 93 74 96 20 44 67 30 97 5 70 86 80 31 25 14 51 66 +Card 50: 93 78 49 98 76 74 58 7 60 46 | 44 15 1 78 67 28 13 36 46 64 49 98 56 12 97 60 18 55 91 32 89 94 99 66 76 +Card 51: 36 78 35 85 27 17 18 42 75 92 | 63 5 62 52 65 71 28 3 15 97 22 99 23 44 16 10 88 4 67 34 80 38 27 83 69 +Card 52: 70 74 14 71 11 83 86 18 99 77 | 26 49 98 94 35 67 31 66 46 36 73 87 10 43 92 7 25 81 62 82 55 39 64 78 4 +Card 53: 14 83 11 94 46 63 42 29 34 56 | 25 71 3 39 2 64 70 5 68 90 32 75 36 14 74 79 10 58 16 60 83 19 54 35 52 +Card 54: 35 77 49 19 41 94 36 83 73 75 | 62 17 8 13 20 98 21 31 88 6 14 30 42 53 59 61 57 22 54 27 74 66 50 58 7 +Card 55: 25 6 23 81 19 51 17 58 29 72 | 12 67 61 97 85 76 2 66 27 1 41 73 78 90 22 10 82 79 39 60 42 72 96 17 24 +Card 56: 23 13 16 27 17 15 9 66 89 93 | 48 67 53 22 96 33 5 25 94 24 43 68 49 77 63 42 73 97 86 83 56 62 36 31 76 +Card 57: 36 67 99 41 58 76 8 72 70 35 | 62 47 69 27 9 48 34 83 50 7 98 78 94 93 15 52 25 84 4 80 24 10 40 91 11 +Card 58: 14 6 7 21 88 32 54 42 56 33 | 55 62 54 7 14 21 88 25 11 80 58 5 93 12 23 86 6 42 33 96 67 61 49 56 32 +Card 59: 61 60 16 27 13 15 17 49 3 19 | 49 94 17 19 15 1 18 37 4 77 55 12 8 13 9 89 64 60 69 22 16 43 27 3 61 +Card 60: 14 95 23 48 96 36 16 77 13 17 | 24 77 53 16 11 36 52 13 26 23 85 50 14 83 96 71 41 48 45 81 95 44 31 17 21 +Card 61: 72 13 69 70 52 8 16 76 3 65 | 27 96 13 37 49 79 70 57 23 86 9 18 65 21 1 72 85 22 16 68 31 24 81 73 55 +Card 62: 28 94 10 97 71 42 89 53 27 75 | 28 97 12 89 2 54 21 42 48 43 91 82 63 10 71 90 38 3 75 27 46 53 94 66 77 +Card 63: 1 36 27 90 97 33 87 9 89 44 | 12 30 97 7 33 5 39 47 14 16 28 83 74 3 38 80 99 20 69 27 85 72 31 18 2 +Card 64: 59 52 91 93 90 38 36 9 98 3 | 98 90 52 92 78 36 87 75 9 76 59 39 53 63 86 29 5 64 3 32 93 80 65 38 91 +Card 65: 78 61 30 58 32 23 1 28 37 39 | 5 35 32 37 1 20 21 70 30 61 93 34 76 40 58 89 27 26 36 28 39 71 78 56 23 +Card 66: 88 68 34 6 60 23 14 94 91 33 | 11 31 50 58 14 33 80 82 99 79 87 40 75 93 88 24 23 6 94 91 63 34 39 38 16 +Card 67: 93 88 20 45 69 97 54 80 43 79 | 2 34 18 85 60 63 30 28 90 77 80 65 41 37 69 94 1 71 59 38 40 50 73 96 64 +Card 68: 20 7 49 18 56 86 8 43 35 42 | 95 86 35 93 94 6 18 84 42 3 20 14 5 54 17 41 88 82 71 24 87 27 43 16 53 +Card 69: 69 46 23 15 97 36 34 24 4 31 | 34 43 6 36 46 4 69 17 97 79 96 67 54 64 23 89 45 76 60 15 2 31 94 24 70 +Card 70: 88 55 97 13 26 68 28 25 92 39 | 55 54 80 5 40 39 84 13 60 14 70 90 92 27 26 31 62 91 23 59 28 97 68 88 25 +Card 71: 76 78 20 57 1 26 42 50 92 65 | 5 88 16 65 92 17 97 42 74 50 71 76 46 57 26 47 25 9 90 77 78 56 98 20 1 +Card 72: 1 49 13 29 14 84 38 73 2 80 | 28 13 92 86 65 89 87 50 98 25 10 30 52 33 40 44 75 21 88 57 5 8 34 70 91 +Card 73: 60 30 20 5 76 59 58 77 44 24 | 43 18 77 24 44 76 41 51 53 4 59 5 84 46 45 35 82 1 78 65 58 95 86 30 73 +Card 74: 32 92 95 62 46 1 12 53 31 6 | 59 35 65 91 39 40 72 61 45 60 98 51 6 66 43 81 89 47 75 19 85 16 69 96 25 +Card 75: 9 2 82 57 36 17 91 11 54 5 | 7 97 11 27 2 36 98 88 45 44 80 34 17 39 31 57 77 73 47 68 62 78 61 91 67 +Card 76: 79 36 67 27 35 90 14 1 43 31 | 26 96 48 32 28 11 87 45 81 71 58 5 86 57 34 78 91 12 51 56 40 84 9 64 39 +Card 77: 82 36 42 46 40 13 76 51 49 34 | 84 88 68 76 11 56 66 17 96 7 72 31 65 13 97 90 9 39 23 93 28 46 78 44 34 +Card 78: 91 20 12 28 84 50 14 94 93 86 | 97 72 58 82 87 67 12 71 50 61 9 35 29 55 39 92 54 7 24 18 41 38 22 49 51 +Card 79: 31 6 69 83 94 47 34 33 23 21 | 11 10 61 35 59 90 7 12 54 45 92 52 19 4 64 24 50 71 73 30 65 36 39 79 15 +Card 80: 70 39 43 66 31 90 27 88 78 97 | 5 76 31 21 80 11 71 53 15 79 55 93 3 64 14 1 96 41 8 4 44 73 91 77 45 +Card 81: 46 69 21 40 35 16 74 50 17 86 | 45 96 48 15 11 20 73 1 59 38 98 55 4 39 24 44 85 13 63 94 92 68 37 10 78 +Card 82: 20 42 3 4 71 63 38 83 51 41 | 66 70 34 61 89 96 91 15 62 87 43 23 28 55 67 82 1 53 35 60 16 29 56 95 54 +Card 83: 78 1 65 82 90 45 55 67 37 15 | 50 40 46 79 1 80 86 94 85 53 84 13 90 17 16 32 21 19 7 58 44 77 57 81 74 +Card 84: 59 82 8 99 1 24 16 48 51 6 | 8 3 22 35 36 58 97 55 73 95 51 48 70 57 84 69 40 66 13 78 5 63 94 49 18 +Card 85: 76 83 7 37 28 79 44 39 92 18 | 65 97 61 68 92 40 80 95 29 91 81 6 62 73 44 21 4 17 28 48 36 37 19 25 42 +Card 86: 72 77 6 23 42 93 19 87 45 56 | 78 21 18 86 73 2 22 9 98 65 87 89 40 7 69 71 79 37 67 20 74 10 34 15 28 +Card 87: 92 72 98 30 24 74 86 52 69 87 | 94 15 60 6 3 5 4 69 33 74 49 51 72 41 76 10 52 67 86 35 34 22 98 92 66 +Card 88: 48 96 2 25 95 28 37 94 45 30 | 38 39 56 22 71 21 18 87 46 14 79 77 43 72 10 89 34 57 58 92 31 5 91 54 66 +Card 89: 63 31 84 20 99 21 30 67 60 38 | 50 29 21 5 1 8 9 14 76 16 24 17 33 42 99 62 96 39 83 32 44 51 23 88 63 +Card 90: 90 96 82 28 20 8 79 94 84 17 | 74 45 12 55 24 94 28 35 4 7 79 57 82 63 84 73 20 10 96 89 69 90 22 16 17 +Card 91: 99 44 27 28 15 66 61 41 54 81 | 77 50 8 26 33 28 61 81 41 15 92 2 66 36 62 43 27 11 58 30 88 65 53 57 82 +Card 92: 35 99 38 22 33 70 65 14 51 91 | 68 35 65 77 78 33 53 99 38 96 87 34 69 6 83 17 30 91 70 20 85 75 82 14 15 +Card 93: 77 42 61 83 98 28 5 34 23 88 | 88 61 20 98 13 36 68 44 5 14 52 80 55 37 25 32 96 58 77 46 28 26 21 83 75 +Card 94: 57 17 27 35 62 85 92 7 65 67 | 93 68 79 95 59 64 10 97 96 35 90 6 5 80 73 85 70 62 19 13 52 74 72 17 81 +Card 95: 38 96 40 36 44 78 28 47 70 90 | 82 47 32 78 9 84 42 62 6 37 68 7 31 97 93 22 11 58 23 63 79 35 98 36 70 +Card 96: 37 66 81 97 23 51 40 31 86 17 | 63 39 23 12 97 55 31 11 47 24 43 8 79 61 49 14 88 53 92 30 94 93 35 60 9 +Card 97: 76 97 35 85 90 70 53 54 40 91 | 22 12 33 32 56 23 59 62 6 48 67 17 65 84 94 96 9 41 68 21 10 61 91 52 51 +Card 98: 99 14 64 51 61 40 30 59 87 4 | 57 53 36 26 78 37 86 7 43 74 44 33 34 58 3 85 67 82 2 94 38 32 65 80 45 +Card 99: 69 79 90 36 45 71 94 43 50 70 | 11 67 31 25 84 57 39 89 34 78 51 68 9 35 54 70 95 29 56 83 63 47 20 58 23 +Card 100: 39 35 5 66 47 37 2 90 20 4 | 56 61 1 57 48 14 96 11 42 98 6 24 45 19 31 49 21 74 53 41 25 95 69 40 79 +Card 101: 89 50 4 33 80 44 14 92 51 28 | 11 51 95 73 80 44 50 89 93 72 33 29 23 60 59 28 54 49 14 75 92 82 7 24 78 +Card 102: 96 88 16 82 75 33 44 72 6 85 | 7 42 68 56 98 30 44 20 62 6 91 95 16 40 18 11 83 13 52 50 61 45 80 74 4 +Card 103: 37 42 77 46 8 41 30 62 90 82 | 70 90 72 8 46 9 35 45 37 41 4 93 99 81 42 14 20 57 85 83 82 30 62 43 77 +Card 104: 59 43 8 48 32 69 58 40 44 60 | 50 17 95 27 44 89 53 34 59 11 72 48 43 64 40 88 3 58 32 60 37 8 91 69 92 +Card 105: 5 63 74 79 60 89 78 95 54 6 | 97 47 24 70 22 92 63 41 67 33 84 16 62 6 52 90 57 82 74 86 46 50 5 32 78 +Card 106: 81 64 44 37 41 36 59 50 20 22 | 25 22 39 11 15 36 90 88 16 59 19 84 20 44 58 63 53 71 29 40 94 56 61 81 6 +Card 107: 69 39 95 35 82 15 84 49 74 31 | 95 76 61 38 64 58 33 28 97 23 35 78 8 5 34 43 59 65 4 26 30 87 96 50 11 +Card 108: 16 36 75 64 66 29 77 12 40 10 | 66 10 83 15 49 40 37 86 9 52 24 50 29 20 23 41 16 25 64 76 56 36 19 34 77 +Card 109: 70 41 35 15 46 74 40 77 42 93 | 82 99 30 12 49 64 70 41 56 38 5 6 87 68 80 26 39 35 63 22 27 23 74 93 46 +Card 110: 6 77 75 51 74 66 45 80 48 73 | 48 87 5 62 70 56 9 96 12 21 83 49 25 99 3 38 44 18 13 2 28 88 58 78 65 +Card 111: 78 28 72 47 41 44 90 74 68 87 | 80 95 90 26 54 48 56 29 96 67 8 98 62 59 63 53 68 5 72 12 18 41 51 14 93 +Card 112: 28 91 33 83 81 73 15 24 21 75 | 39 92 21 52 71 85 89 53 62 33 28 95 43 65 88 78 40 55 34 66 20 12 32 91 29 +Card 113: 55 40 8 1 7 35 70 65 42 41 | 12 80 19 62 48 39 87 89 96 13 16 88 54 63 9 28 73 43 86 33 26 72 35 17 1 +Card 114: 61 15 3 7 35 76 9 66 33 74 | 16 7 38 20 79 70 56 27 99 5 95 39 43 49 73 78 25 11 96 84 85 55 67 91 29 +Card 115: 87 99 8 31 43 82 67 74 76 49 | 91 77 49 41 6 45 81 34 24 72 79 1 60 59 12 10 9 22 96 5 83 70 7 93 63 +Card 116: 27 96 16 90 61 72 73 9 64 35 | 89 55 44 2 11 7 74 76 85 13 48 15 50 40 63 73 31 58 46 8 38 37 10 97 98 +Card 117: 28 83 58 84 81 23 76 41 69 46 | 73 55 87 71 3 20 43 26 7 24 23 92 97 27 88 22 11 6 45 10 38 68 65 5 82 +Card 118: 84 47 70 88 25 20 58 82 7 87 | 52 91 53 26 79 73 85 2 12 86 69 49 67 13 92 63 36 62 23 46 35 95 90 40 64 +Card 119: 12 28 10 43 44 49 38 36 7 30 | 63 84 43 30 10 44 73 98 49 66 86 82 38 36 76 60 20 28 12 3 26 74 7 79 72 +Card 120: 64 47 61 68 90 84 54 10 81 12 | 47 64 10 34 85 7 98 73 68 12 92 42 31 81 54 2 49 4 61 90 84 5 74 93 25 +Card 121: 47 50 44 35 40 60 28 80 23 99 | 15 22 16 93 60 40 88 83 34 89 46 69 57 33 3 98 5 81 28 2 44 54 87 71 4 +Card 122: 46 53 63 32 87 37 49 25 99 73 | 95 65 7 80 35 74 98 30 8 52 84 40 64 36 23 45 67 33 76 96 90 31 39 78 22 +Card 123: 92 37 35 10 89 84 85 16 3 9 | 10 28 15 60 6 21 58 95 75 84 35 99 44 59 37 9 51 91 1 61 3 92 69 85 89 +Card 124: 94 67 68 3 39 78 76 79 36 74 | 17 73 75 29 86 89 72 70 12 6 66 85 13 83 37 42 28 2 84 30 10 95 20 65 44 +Card 125: 28 64 58 33 90 97 7 98 66 16 | 7 66 46 9 86 56 16 33 47 90 65 87 15 32 31 67 64 28 49 17 25 84 97 55 57 +Card 126: 14 22 7 83 85 89 27 39 78 69 | 66 45 2 20 62 38 51 90 11 43 60 57 27 3 18 94 54 59 46 58 37 73 87 12 67 +Card 127: 14 39 77 20 29 55 94 38 88 11 | 55 38 51 87 72 4 69 27 41 68 9 94 37 29 58 59 48 20 17 39 92 19 53 14 16 +Card 128: 43 1 85 87 45 51 64 91 93 73 | 21 13 55 72 14 57 46 43 2 83 62 36 59 33 86 48 68 19 40 54 50 35 39 81 41 +Card 129: 61 90 20 1 76 79 66 18 94 99 | 92 30 20 8 73 28 38 15 13 36 79 1 64 76 33 3 26 88 18 23 93 12 58 91 37 +Card 130: 31 34 13 96 55 85 51 95 54 78 | 6 21 47 48 94 27 86 46 8 25 84 15 43 13 23 76 60 32 58 11 99 1 79 88 55 +Card 131: 71 52 74 6 43 37 73 89 9 16 | 22 24 12 11 76 40 99 87 17 78 61 63 53 75 1 77 25 58 31 23 86 20 97 49 38 +Card 132: 75 27 99 16 5 17 60 1 28 34 | 44 3 82 47 97 30 4 69 23 11 98 46 29 96 81 31 51 7 94 67 83 38 32 73 60 +Card 133: 21 46 70 93 7 66 60 51 63 35 | 4 24 17 62 61 15 9 95 72 43 67 83 6 75 88 12 8 22 40 68 54 76 20 37 32 +Card 134: 55 33 24 47 9 6 86 43 89 30 | 49 23 59 98 72 90 13 93 1 26 78 44 83 82 40 41 71 79 68 57 96 92 48 17 10 +Card 135: 18 88 45 34 65 8 92 37 98 30 | 72 34 88 65 50 30 9 64 8 13 10 36 69 3 22 18 78 35 98 97 81 83 57 92 37 +Card 136: 62 13 33 30 58 9 21 68 54 48 | 55 49 81 38 48 39 75 17 54 84 47 24 71 44 91 37 4 3 10 64 86 92 30 51 40 +Card 137: 49 8 77 76 25 88 39 17 63 22 | 56 71 8 7 17 41 76 74 77 15 88 3 97 25 48 98 64 39 55 49 33 83 63 22 2 +Card 138: 11 36 77 55 53 47 37 76 66 8 | 37 13 24 66 96 35 4 22 53 98 70 50 76 77 97 11 38 8 75 47 51 43 15 36 55 +Card 139: 61 9 64 99 47 50 6 75 45 65 | 9 99 31 10 72 66 45 75 14 47 60 2 64 6 50 65 8 52 58 61 25 38 29 90 19 +Card 140: 79 41 61 71 96 11 60 24 74 95 | 40 71 11 96 75 33 41 64 49 55 61 76 95 34 24 20 9 60 26 69 1 97 86 29 74 +Card 141: 64 44 35 96 32 78 94 53 68 97 | 9 78 40 97 56 83 48 64 95 69 35 68 59 43 17 32 4 60 53 52 98 61 96 94 44 +Card 142: 73 34 61 17 49 3 35 66 85 58 | 28 13 21 45 85 19 67 29 49 5 30 61 38 52 2 3 48 31 17 99 58 34 80 9 14 +Card 143: 99 8 50 43 75 69 88 40 13 91 | 85 43 67 24 91 62 99 38 18 16 2 34 26 82 98 6 53 37 77 33 30 42 3 31 36 +Card 144: 90 86 40 96 44 43 91 93 20 80 | 66 64 19 79 18 10 95 52 72 31 89 92 62 68 23 75 78 84 37 15 13 36 38 26 81 +Card 145: 2 92 97 59 98 96 34 41 25 72 | 10 20 43 6 42 22 92 61 73 99 21 46 41 25 34 96 63 50 59 13 91 38 79 57 72 +Card 146: 50 81 51 16 9 34 30 65 60 53 | 55 6 75 29 96 42 86 11 18 45 46 77 87 54 25 91 43 94 23 24 99 82 31 72 93 +Card 147: 84 27 17 26 33 98 36 58 5 13 | 90 65 96 28 31 10 14 95 46 94 22 16 68 50 77 73 9 42 59 64 91 19 67 63 99 +Card 148: 67 62 86 8 87 92 94 80 93 25 | 9 3 60 66 47 23 20 72 28 75 11 37 50 13 34 58 2 64 16 98 88 56 81 7 38 +Card 149: 20 93 31 26 11 42 53 37 3 84 | 22 79 34 17 42 94 32 55 33 2 13 36 80 63 14 11 59 12 98 8 50 93 20 53 84 +Card 150: 1 75 15 7 80 59 99 86 71 58 | 31 72 14 67 85 18 96 15 8 13 80 47 45 64 60 24 46 98 6 97 39 49 69 4 54 +Card 151: 56 46 61 40 86 85 74 79 94 36 | 10 9 2 32 22 43 87 40 68 20 36 94 89 86 45 27 42 71 92 59 16 6 24 81 73 +Card 152: 65 40 13 51 60 42 1 99 19 73 | 74 72 39 50 49 27 37 78 51 38 7 41 23 95 81 43 97 19 73 28 89 17 91 6 62 +Card 153: 28 76 9 48 94 45 23 32 26 21 | 4 63 33 28 36 81 98 14 50 55 3 31 1 71 62 17 70 80 46 59 51 20 38 22 12 +Card 154: 11 53 34 58 30 8 86 71 2 96 | 85 92 62 82 90 75 51 15 41 19 70 55 67 74 77 27 64 6 14 48 76 88 25 83 42 +Card 155: 19 83 27 70 46 16 57 48 18 86 | 13 4 73 2 75 36 53 69 15 21 9 10 64 95 78 61 43 71 12 99 92 56 6 42 28 +Card 156: 87 63 55 52 11 78 15 42 83 38 | 70 40 42 97 41 48 87 78 83 73 72 99 63 66 11 22 6 69 76 3 61 1 91 16 51 +Card 157: 63 87 28 40 56 50 64 73 43 51 | 16 21 7 50 44 88 35 9 32 80 51 30 95 82 5 46 76 65 37 25 29 61 26 4 56 +Card 158: 47 63 14 74 88 90 71 87 95 32 | 14 30 47 88 15 29 41 11 59 90 92 64 77 94 68 89 12 19 85 28 62 87 33 71 95 +Card 159: 21 46 50 45 92 35 73 33 25 81 | 17 38 72 94 29 6 49 7 71 21 9 80 99 39 58 25 44 45 35 57 20 33 61 50 73 +Card 160: 18 1 12 75 88 32 59 51 73 9 | 94 83 70 5 1 73 18 75 9 92 76 45 7 36 30 65 60 32 25 12 33 51 88 59 23 +Card 161: 6 15 69 39 76 73 99 84 21 32 | 82 5 64 79 92 91 2 48 6 12 45 43 80 95 33 21 55 15 66 34 73 16 58 39 54 +Card 162: 74 67 93 73 40 6 54 81 30 99 | 89 4 36 18 6 17 31 71 96 70 77 83 20 99 11 26 93 62 85 74 24 30 8 84 3 +Card 163: 74 58 30 34 37 66 28 22 88 25 | 82 47 88 36 93 81 35 20 12 79 54 24 40 68 41 51 86 30 11 65 34 1 8 69 76 +Card 164: 71 77 50 90 5 56 92 80 34 22 | 82 31 50 70 69 90 5 85 39 80 73 77 54 56 75 34 15 92 26 32 22 42 17 71 23 +Card 165: 21 41 33 75 19 88 18 40 86 64 | 35 53 99 80 86 30 63 19 50 74 4 41 8 32 21 64 75 51 27 6 23 18 90 72 40 +Card 166: 76 73 55 71 90 22 12 81 34 9 | 66 63 23 30 87 62 59 7 67 89 78 24 64 68 27 97 19 25 94 53 48 56 45 70 33 +Card 167: 98 60 45 13 8 9 66 82 41 95 | 86 19 46 44 78 23 41 83 84 13 54 12 10 5 98 22 57 21 59 80 58 1 69 82 93 +Card 168: 40 36 18 3 44 29 86 23 13 75 | 18 44 3 9 40 62 55 1 78 49 27 13 87 48 12 36 86 17 29 76 34 20 32 50 94 +Card 169: 64 4 61 79 17 20 84 37 70 99 | 73 5 90 54 55 96 60 36 28 74 64 99 68 61 4 33 29 70 27 42 8 67 15 17 34 +Card 170: 12 91 87 50 84 14 38 93 43 78 | 95 46 66 64 47 60 36 70 97 73 56 93 83 65 11 1 15 7 42 41 59 40 84 82 62 +Card 171: 3 6 81 89 27 88 46 37 69 14 | 60 31 64 61 65 25 83 43 19 20 74 75 17 92 4 53 1 91 97 16 26 22 95 50 84 +Card 172: 40 35 87 27 3 58 81 45 59 80 | 90 21 88 64 66 52 5 63 65 40 13 79 82 62 85 34 78 37 33 27 87 26 58 95 75 +Card 173: 8 45 37 66 63 7 97 42 95 28 | 56 45 24 78 82 57 83 51 18 95 5 79 59 50 30 11 19 43 88 90 49 62 17 68 22 +Card 174: 8 56 80 50 6 12 36 32 24 98 | 53 22 70 13 62 58 15 79 78 7 9 38 26 63 75 44 17 82 67 59 71 86 39 46 93 +Card 175: 43 47 46 35 94 39 67 3 2 24 | 86 23 52 91 66 45 81 75 61 80 10 17 60 16 44 57 83 62 32 37 38 12 48 93 84 +Card 176: 82 97 11 25 15 68 7 24 77 46 | 18 35 2 80 48 75 19 47 70 39 99 43 28 62 33 50 13 17 10 58 86 45 16 88 60 +Card 177: 95 59 14 68 13 22 4 75 2 70 | 64 45 12 31 99 77 59 28 91 42 21 89 67 9 90 78 37 14 46 75 52 15 22 79 96 +Card 178: 83 17 81 96 9 2 80 70 57 53 | 85 80 62 9 29 25 8 83 2 66 17 68 84 3 81 42 57 23 15 72 96 53 70 7 73 +Card 179: 48 84 29 81 88 3 10 27 21 16 | 74 21 97 28 18 81 84 6 42 76 29 89 48 83 50 3 88 73 22 10 2 55 16 27 36 +Card 180: 30 77 49 58 39 1 97 13 25 34 | 75 53 61 99 34 62 48 1 51 77 84 25 49 26 79 59 13 11 30 60 21 39 97 93 58 +Card 181: 73 52 53 23 83 74 1 87 86 54 | 23 53 54 5 11 1 55 73 74 44 46 82 34 41 60 67 31 96 35 52 86 15 18 87 83 +Card 182: 90 48 22 80 52 41 78 11 55 32 | 60 9 2 21 87 42 68 16 15 50 95 51 99 40 30 52 20 12 26 49 92 19 84 36 76 +Card 183: 33 63 2 19 24 61 10 14 37 1 | 59 20 32 69 98 55 85 36 29 71 61 68 14 2 7 88 39 16 94 92 74 45 90 38 35 +Card 184: 85 65 43 1 75 27 17 10 91 18 | 27 42 55 89 38 66 82 75 64 43 50 39 52 10 59 93 18 3 91 1 85 40 26 8 65 +Card 185: 74 7 10 70 95 76 27 50 13 36 | 70 15 58 18 13 74 4 64 50 44 54 27 56 35 87 28 76 92 85 36 66 95 90 96 78 +Card 186: 45 59 16 99 43 79 89 90 40 49 | 18 97 56 67 61 29 80 34 91 88 33 95 41 76 78 68 28 46 51 93 98 72 54 74 8 +Card 187: 87 69 84 72 92 86 13 76 40 38 | 38 8 37 71 30 49 50 21 51 39 34 90 84 16 11 10 4 63 7 42 36 77 48 85 20 +Card 188: 96 18 79 50 81 65 84 74 76 58 | 21 48 35 12 83 70 23 88 58 3 74 84 72 76 43 71 8 27 2 37 46 89 5 54 81 +Card 189: 22 90 97 45 19 70 36 23 81 2 | 6 60 40 57 41 16 91 42 58 38 92 31 15 76 35 73 11 33 24 30 32 85 18 51 93 +Card 190: 72 69 52 65 14 74 64 57 70 33 | 41 99 32 49 96 34 82 80 42 1 69 40 64 44 88 86 14 31 28 22 38 46 45 54 29 +Card 191: 86 70 76 64 97 6 56 34 87 41 | 96 81 52 89 28 16 29 90 41 32 70 68 9 88 30 5 60 92 61 49 56 50 46 37 11 +Card 192: 14 42 66 20 48 94 55 51 23 75 | 83 74 97 43 28 72 18 26 13 59 93 19 10 60 89 82 63 50 3 21 4 79 91 98 36 +Card 193: 13 33 98 37 19 86 32 15 95 96 | 56 90 5 60 24 21 46 73 29 3 58 75 77 66 41 48 82 84 10 53 43 15 18 2 89 +Card 194: 77 6 10 48 14 79 73 51 49 25 | 86 12 37 23 43 34 5 89 97 27 53 70 75 19 15 79 45 26 1 73 68 36 2 78 18 +Card 195: 94 57 24 37 46 75 73 10 29 5 | 78 25 21 48 22 46 38 76 19 17 64 32 88 99 63 12 20 41 16 7 14 54 81 97 89 +Card 196: 76 48 15 89 44 50 79 80 52 78 | 93 55 21 18 73 31 47 20 97 83 87 30 6 24 77 74 67 45 76 65 37 43 42 98 38 +Card 197: 67 21 75 10 9 6 47 88 45 70 | 91 95 58 82 52 50 87 81 78 13 64 53 57 14 55 25 36 76 19 86 56 2 16 54 1 \ No newline at end of file diff --git a/input/5.txt b/input/5.txt new file mode 100644 index 0000000..4a2a7c8 --- /dev/null +++ b/input/5.txt @@ -0,0 +1,211 @@ +seeds: 630335678 71155519 260178142 125005421 1548082684 519777283 4104586697 30692976 1018893962 410959790 3570781652 45062110 74139777 106006724 3262608046 213460151 3022784256 121993130 2138898608 36769984 + +seed-to-soil map: +2977255263 3423361099 161177662 +3464809483 1524036300 40280620 +1278969303 2583891002 282823382 +3766263020 1796922321 171061976 +411885923 23002578 152894367 +564780290 442452799 75000259 +2421385924 1454220354 69815946 +3348169880 3014668733 58677303 +903828313 1975611534 37514769 +3406847183 1396258054 57962300 +4043490501 3171884304 251476795 +941343082 2866714384 147954349 +1089297431 1206586182 189671872 +2891116902 3584538761 18778869 +0 517453058 122327491 +2491201870 932395829 274190353 +388883345 0 23002578 +3944952233 3073346036 98538268 +3505090103 671222912 261172917 +2073455492 2013126303 347930432 +2909895771 2361056735 67359492 +1561792685 3603317630 511662807 +2765392223 2458166323 125724679 +3168183021 4114980437 179986859 +3138432925 2428416227 29750096 +122327491 175896945 266555854 +671222912 1564316920 232605401 +3937324996 1967984297 7627237 + +soil-to-fertilizer map: +895998030 0 382128379 +2851625320 2664267363 205943350 +2518444693 3961786669 333180627 +1879667741 2025490411 638776952 +0 1243838521 558555556 +3280896340 2870210713 1014070956 +558555556 906396047 337442474 +3057568670 3884281669 77505000 +3135073670 1879667741 145822670 +1278126409 382128379 524267668 + +fertilizer-to-water map: +0 1845976330 336090970 +3299138007 3322545218 12048535 +336090970 0 11457152 +1280501317 1371665084 474311246 +2583893821 3334593753 715244186 +3311186542 2468197905 738651397 +2468197905 3206849302 115695916 +347548122 11457152 932953195 +1754812563 944410347 427254737 + +water-to-light map: +1121222108 519789808 4326619 +1125548727 524116427 429792955 +1052043895 3930896885 69178213 +3210593080 0 36442681 +1669405426 2787769857 138341045 +1919839172 3142586910 277606697 +2197445869 2466152271 321617586 +1555341682 3816833141 114063744 +3431283943 3092543143 50043767 +3481327710 1975836414 28620233 +136025352 1371812880 335069822 +0 3420193607 136025352 +2600375975 3610804829 206028312 +3247035761 36442681 184248182 +3676380184 1048117966 323694914 +2519063455 966805446 81312520 +483991238 1706882702 268953712 +3509947943 2926110902 166432241 +1862332341 2408645440 57506831 +752944950 220690863 299098945 +2806404287 2004456647 404188793 +1807746471 3556218959 54585870 +471095174 953909382 12896064 + +light-to-temperature map: +3941111261 382813357 83783792 +4083751028 2792620142 62769876 +2924924808 517646744 141124785 +10073304 296361721 86451636 +2112077648 3356571260 325360811 +2097723771 930487406 14353877 +1038821361 2233157447 330985253 +1604981575 0 157737476 +4232208439 2231398376 1759071 +3126943010 2564142700 228477442 +3355420452 3681932071 528033316 +3066049593 1302213021 60893417 +2893234140 1091417457 31690668 +4146520904 1005729922 85687535 +764412615 658771529 271715877 +4024895053 4212658256 21309254 +1601614929 3144601228 3366646 +2813498518 3276835638 79735622 +0 944841283 10073304 +3883453768 1363106438 57657493 +1036128492 4209965387 2692869 +1762719051 1160654846 141558175 +2437438459 157737476 138624245 +96524940 1420763931 667887675 +2576062704 3147967874 128867764 +1904277226 2855390018 50699775 +1420621949 2906089793 129943385 +1550565334 466597149 51049595 +2704930468 3036033178 108568050 +4046204307 1123108125 37546721 +1369806614 954914587 50815335 +1954977001 2088651606 142746770 + +temperature-to-humidity map: +3744493855 2753433800 53429527 +3926657179 2806863327 207882975 +567844723 1829271702 6392959 +3797923382 3046866321 128733797 +1711260618 465872733 110275892 +2947786208 2530091374 223342426 +2371290430 3335177849 39675908 +1900678095 703125986 238513863 +1521940365 941639849 16040471 +979702084 962957535 519048585 +2678536664 3987414423 22824189 +316276095 2006380474 251568628 +574237682 576148625 7838036 +2512589774 2369848229 129456424 +1821536510 386731148 79141585 +659847979 2257949102 32337475 +1498750669 0 23189696 +2139191958 1482006120 151094619 +2410966338 2361085516 8762713 +248695366 629624702 67580729 +1705983403 957680320 5277215 +3436386005 3680199681 275987831 +896869843 23189696 23822140 +1540019357 265437244 43521643 +3171128634 4029709925 265257371 +700698880 1633100739 196170963 +2659065351 4010238612 19471313 +1660345362 583986661 45638041 +2642046198 3175600118 17019153 +4134540154 3966392426 21021997 +145503080 1903188188 103192286 +4155562151 3467714480 139405145 +920691983 1844178087 59010101 +2805227630 3192619271 142558578 +692185454 1835664661 8513426 +2732147574 3607119625 73080056 +3712373836 3014746302 32120019 +2361085516 3956187512 10204914 +2701360853 2499304653 30786721 +582075718 308958887 77772261 +1583541000 188632882 76804362 +3882034 47011836 141621046 +0 699243952 3882034 +1537980836 697205431 2038521 +2419729051 3374853757 92860723 + +humidity-to-location map: +3880387060 2052152805 97611299 +2442736538 3295723734 10591308 +3014234548 3058886861 44150293 +2722522139 3413370195 153277538 +2877652345 3226748198 68975536 +678696757 79205913 5515453 +3758528684 3103037154 121858376 +3648288667 2533118408 110240017 +3457871155 4266074310 28892986 +2176930761 3905620500 135283057 +2312213818 2369019482 56130623 +2875799677 3224895530 1852668 +2052152805 3780842544 124777956 +2598433171 3306315042 56382802 +1279041455 278559111 48074772 +2964261570 2302916483 49972978 +344154771 1539624544 79809331 +1030322972 1619433875 248718483 +1905012367 1868152358 115533200 +105230362 326633883 51970437 +4085966662 2880778716 178108145 +684212210 1466450827 73173717 +919250672 396737705 108684083 +868993622 1215278638 50257050 +2962757902 2879275048 1503668 +1847630888 378604320 18133385 +3232700402 4040903557 225170753 +2575587736 3390524760 22845435 +3977998359 2425150105 107968303 +3058384841 3362697844 27826916 +789787709 0 79205913 +4264074807 2272023994 30892489 +3114006964 3594442940 118693438 +460824111 202771015 75788096 +423964102 1983685558 36860009 +2946627881 2352889461 16130021 +157200799 505421788 186953972 +3486764141 2717750522 161524526 +1027934755 692375760 2388217 +2453327846 2149764104 122259890 +2368344441 2643358425 74392097 +0 1407620238 58830589 +2654815973 3713136378 67706166 +1865764273 117123148 39248094 +3086211757 3566647733 27795207 +58830589 156371242 46399773 +536612207 1265535688 142084550 +757385927 84721366 32401782 +1327116227 694763977 520514661 diff --git a/src/common.rs b/src/common.rs new file mode 100644 index 0000000..4d7efa6 --- /dev/null +++ b/src/common.rs @@ -0,0 +1,16 @@ +use std::{fs::File, io::{BufReader, BufRead}}; + + +pub fn load_input(filepath: &str) -> Result, Box> { + let file = File::open(filepath)?; + + let reader = BufReader::new(file); + + let mut result: Vec = vec![]; + + for line in reader.lines() { + result.push(line?); + } + + Ok(result) +} \ No newline at end of file diff --git a/src/five.rs b/src/five.rs new file mode 100644 index 0000000..743f62d --- /dev/null +++ b/src/five.rs @@ -0,0 +1,17 @@ +use crate::common::load_input; + +struct TranslationRange{ + source_start: u32, + destination_start: u32, + range: u32, +} + +struct TranslationMap { + ranges: Vec +} + +pub fn run() -> Result> { + let lines = load_input("./input/5.txt")?; + + Ok(999) +} \ No newline at end of file diff --git a/src/four.rs b/src/four.rs new file mode 100644 index 0000000..d89ce10 --- /dev/null +++ b/src/four.rs @@ -0,0 +1,96 @@ +use std::collections::HashMap; + +use regex::Regex; + +use crate::common::load_input; + +struct Game { + id: i32, + played: Vec, + winning: Vec, +} + +fn nums_in_string(s: &str) -> Vec{ + let rx = Regex::new(r"(\d+)").unwrap(); + let result = rx.captures_iter(s); + + result.map(|e| e.get(0).unwrap().as_str().parse().unwrap()).collect() +} + +fn parse_input(lines: &Vec) -> Vec { + + return lines.iter().map(|line| { + let (game_part, num_part) = line.split_once(":").unwrap(); + let game_id:i32 = game_part.split_at(5).1.trim().parse().unwrap(); + let (played_str, winning_str) = num_part.split_once("|").unwrap(); + + return Game{ + id: game_id, + played: nums_in_string(played_str), + winning: nums_in_string(winning_str) + }; + }).collect(); +} + +fn games_won(game: &Game)-> i32 { + return game.played.iter().filter(|e| game.winning.contains(e)).count().try_into().unwrap(); +} + +fn p2_cards(game: &Game) -> Vec { + let mut rtn: Vec = Vec::new(); + + for i in 0..games_won(game){ + rtn.push((game.id + i+1) as usize); + } + + return rtn; +} + +fn p2_num_cards(games: &Vec, game: &Game, cache: &mut HashMap) -> i32 { + return match cache.get(&(game.id as usize)) { + Some(value) => {*value} // Cache hit + None =>{ + let cards = p2_cards(game); + let mut sum = 1i32; + + for card in cards.iter() { + match games.get(*card){ + Some(value) => { + sum += p2_num_cards(games, value,cache); + }, + None => {} + } + } + + cache.insert(game.id as usize, sum); + + sum + } + } +} + +pub fn run_part2() -> Result> { + let lines = load_input("./input/4.txt")?; + let games = parse_input(&lines); + + let mut lookup_table: HashMap = HashMap::new(); + let mut sum = 0i32; + + for game in games.iter() { + sum += p2_num_cards(&games, game, &mut lookup_table) + } + + + Ok(sum) +} + +pub fn run() -> Result> { + let lines = load_input("./input/4.txt")?; + let games = parse_input(&lines); + let points = games.iter() + .map(games_won) + .filter(|e| *e > 0i32) + .map(|e| 2i32.pow(e as u32 -1 )) + .sum(); + Ok(points) +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e14b0c2 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,31 @@ +use std::env; + +mod common; +mod one; +mod two; +mod three; +mod four; +mod five; + +fn main() { + let args: Vec = env::args().collect(); + + let day = args.get(1).unwrap(); + + let result = match day.as_str() { + "1" => one::run(), + "1p2" => one::run_part2(), + "2" => two::run(), + "2p2" => two::run_part2(), + "3" => three::run(), + "4" => four::run(), + "4p2" => four::run_part2(), + "5" => five::run(), + _ => Ok(-1), + }; + + match result { + Ok(val) => println!("Result: {}",val), + Err(err) => println!("Err: {}",err) + } +} diff --git a/src/one.rs b/src/one.rs new file mode 100644 index 0000000..2dc9984 --- /dev/null +++ b/src/one.rs @@ -0,0 +1,114 @@ +use std::str::FromStr; + +use regex::Regex; + +use crate::common::load_input; + +extern crate regex; + +fn num(line: String) -> i32 { + let mut digits: String = String::from_str("").unwrap(); + + for (_, c) in line.chars().enumerate() { + if c >= '0' && c <= '9' { + digits.push(c); + } + } + + return get_num_from_digits(digits); +} + +fn num_part2(line: String) -> i32 { + let mut last_digit: &str = ""; + let mut last_digit_index: usize = 0; + + let mut first_digit: &str = ""; + let mut first_digit_index: usize = usize::MAX; + + for pattern in [r"(one)",r"(two)",r"(three)",r"(four)",r"(five)",r"(six)",r"(seven)",r"(eight)",r"(nine)",r"(\d)"]{ + let regex = Regex::new(pattern).unwrap(); + let result = regex.captures_iter(&line); + + for mat in result { + let match_str = mat.get(0).unwrap().as_str(); + let match_index = mat.get(0).unwrap().start(); + + // Check first digit + if match_index <= first_digit_index { + first_digit_index = match_index; + first_digit = match_str; + } + + if match_index >= last_digit_index { + last_digit_index = match_index; + last_digit = match_str; + } + } + } + + let mut picked_digits: String = String::from_str("").unwrap(); + + if first_digit.len() > 1 { + picked_digits.push_str(num_lookup(first_digit)); + }else{ + picked_digits.push_str(first_digit); + } + + if last_digit.len() > 1 { + picked_digits.push_str(num_lookup(last_digit)); + }else{ + picked_digits.push_str(last_digit); + } + + return picked_digits.parse().unwrap(); +} + +/// Converts a written number into its digit +/// Panics if failed +fn num_lookup(str: &str) -> &str{ + match str { + "one" => "1", + "two" => "2", + "three" => "3", + "four" => "4", + "five" => "5", + "six" => "6", + "seven" => "7", + "eight" => "8", + "nine" => "9", + _ => panic!("Nan") + } +} + +fn get_num_from_digits(digits: String)-> i32{ + let mut picked_digits: String = String::from_str("").unwrap(); + + picked_digits.push(digits.chars().nth(0).unwrap()); + picked_digits.push(digits.chars().last().unwrap()); + + return picked_digits.parse().unwrap(); +} + +pub fn run_part2() -> Result> { + let lines = load_input("./input/1.txt")?; + + let mut sum = 0i32; + + for line in lines { + sum += num_part2(line); + } + + Ok(sum) +} + +pub fn run() -> Result> { + let lines = load_input("./input/1.txt")?; + + let mut sum = 0i32; + + for line in lines { + sum += num(line); + } + + Ok(sum) +} diff --git a/src/three.rs b/src/three.rs new file mode 100644 index 0000000..9c785ba --- /dev/null +++ b/src/three.rs @@ -0,0 +1,63 @@ +use regex::Regex; + +use crate::common::load_input; + +fn has_adjacent_symbol(lines: &Vec,pos: (usize,usize)) -> bool { + let check = move |x: i32,y:i32| { + is_symbol(get_char(lines, ((x + pos.0 as i32) as usize,(y + pos.1 as i32) as usize))) + }; + + if check(-1,0){return true} + if check(1,0){return true} + if check(0,-1){return true} + if check(0,1){return true} + if check(1,-1){return true} + if check(-1,-1){return true} + if check(1,1){return true} + if check(-1,1) {return true} + + return false; +} + +fn get_char(lines: &Vec,pos: (usize,usize)) -> char{ + lines.get(pos.1).unwrap_or(&String::from("")).chars().nth(pos.0).unwrap_or('.') +} + +fn is_symbol(c: char) -> bool{ + if c >= '0' && c <= '9' {return false;} + if c == '.' {return false;} + return true; +} + +fn check_nums(lines: &Vec)-> i32 { + let re = Regex::new(r"(\d+)").unwrap(); + let mut sum = 0i32; + + for (y,line) in lines.iter().enumerate(){ + let caps = re.captures_iter(line); + + for mat in caps { + let x_start = mat.get(0).unwrap().start(); + let x_end = mat.get(0).unwrap().end(); + + for n in x_start..x_end{ + if has_adjacent_symbol(lines, (n,y)){ + let match_str = mat.get(0).unwrap().as_str(); + let num: i32 = match_str.parse().unwrap(); + println!("{}",num); + sum += num; + break; + } + } + + } + } + + return sum; +} + + +pub fn run() -> Result>{ + let lines = load_input("./input/3.txt")?; + Ok(check_nums(&lines)) +} diff --git a/src/two.rs b/src/two.rs new file mode 100644 index 0000000..062554f --- /dev/null +++ b/src/two.rs @@ -0,0 +1,112 @@ +use crate::common::load_input; + + +struct Game { + id: i32, + sets: Vec, +} + +/// Red, Green, Blue +struct Set { + red: i32, + green: i32, + blue: i32, +} + +fn parse_line(line: &str) -> Game { + let (game_part, sets_part) = line.split_once(":").unwrap(); + let sets = sets_part.split(";"); + + let game = Game { + id: game_part.split_at(5).1.parse().unwrap(), + sets: sets + .map(|set| { + let mut rtn = Set { + red: 0, + green: 0, + blue: 0, + }; + set.split(",").for_each(|color| { + if color.contains("red") { + rtn.red = color.split_at(color.len() - 4).0.trim().parse().unwrap(); + return; + } + if color.contains("green") { + rtn.green = color.split_at(color.len() - 6).0.trim().parse().unwrap(); + return; + } + if color.contains("blue") { + rtn.blue = color.split_at(color.len() - 5).0.trim().parse().unwrap(); + return; + } + }); + return rtn; + }) + .collect(), + }; + + return game; +} + +/// Returns a set with the maximum value for each color +fn max_set(sets: &Vec) -> Set { + return Set { + red: sets + .iter() + .max_by_key(|e| e.red) + .unwrap_or(&Set { + red: 0, + green: 0, + blue: 0, + }) + .red, + green: sets + .iter() + .max_by_key(|e| e.green) + .unwrap_or(&Set { + red: 0, + green: 0, + blue: 0, + }) + .green, + blue: sets + .iter() + .max_by_key(|e| e.blue) + .unwrap_or(&Set { + red: 0, + green: 0, + blue: 0, + }) + .blue, + }; +} + +pub fn run_part2() -> Result> { + let lines = load_input("./input/2.txt")?; + + let max = lines + .iter() + .map(|e| parse_line(e)) + .map(|game|{ + let max = max_set(&game.sets); + return max.blue * max.green * max.red; + }).sum(); + + Ok(max) +} + +pub fn run() -> Result> { + let lines = load_input("./input/2.txt")?; + + let sum_ids = lines + .iter() + .map(|e| parse_line(e)) + .filter(|game| { + let max = max_set(&game.sets); + return max.red <= 12 && max.green <= 13 && max.blue <= 14; + }) + .map(|game| game.id) + .sum(); + + Ok(sum_ids) +}