Compare commits

...

34 Commits

Author SHA1 Message Date
0d4c2a7b4e Add visualization 2022-12-14 16:14:21 +00:00
3de6c685b3 Day 14 2022-12-14 13:28:34 +00:00
c6e5343b52 Day 13 2022-12-13 07:12:36 +00:00
7ea1b80afe renamed row 2022-12-12 14:20:10 +01:00
f2d6ff15e8 dedpulicated coord checking 2022-12-12 13:48:28 +01:00
1c41e885ad refactor coord checking 2022-12-12 13:35:34 +01:00
e40e06510b Day 12 2022-12-12 06:21:55 +00:00
8a2aa96881 Boilerplate day 12 2022-12-11 15:57:49 +00:00
052d21f132 Add day 11 2022-12-11 15:03:07 +00:00
c09126a27e Move Puter to its own module 2022-12-11 13:30:19 +00:00
dfb8421dec Refactored computer 2022-12-11 13:26:28 +00:00
d42491f71a improved command parsing 2022-12-10 07:37:03 +00:00
8ae3092389 Minor refactor 2022-12-10 06:05:28 +00:00
a0b13e4f3e Day 10 initial 2022-12-10 05:36:25 +00:00
8787215fdf Update dependencies 2022-12-09 12:50:23 +01:00
bf4760a83c Boilerplate day 10 2022-12-09 12:50:14 +01:00
2f467ae7d7 Improve follow_head function 2022-12-09 08:59:08 +01:00
fe66170e3e Simulate chains simultaneously 2022-12-09 08:46:16 +01:00
1e9d553c22 Rename move functions, remove parameter 2022-12-09 07:32:05 +01:00
982dac721f Merge remote-tracking branch 'origin/main' 2022-12-09 07:22:40 +01:00
df71a1f787 Removed esh 2022-12-09 07:22:34 +01:00
ad889622d5 Day 09 2022-12-09 05:48:13 +00:00
a3d1031b05 Day 9 boilerplate 2022-12-08 18:23:45 +00:00
d23fee8c4b Improve score/is_visible calculation 2022-12-08 08:27:43 +00:00
ab0889b661 moved final calculations to their respective parts 2022-12-08 07:58:50 +00:00
8509a884ff Repalce for-loops by flat_map and map 2022-12-08 07:53:26 +00:00
b4f9e56227 Parse numbers once and save to grid 2022-12-08 07:38:37 +00:00
17733c951f Day 08 2022-12-08 07:07:35 +00:00
5ee94b1a86 Boilerplate day 08 2022-12-07 15:31:29 +01:00
e1ebbedc27 Simplified parent access 2022-12-07 09:28:35 +01:00
7a1141f5ee Improved finding min value 2022-12-07 09:20:59 +01:00
cb204b8d62 Day 07 2022-12-07 09:17:05 +01:00
3cca0097ed Merge remote-tracking branch 'origin/main' 2022-12-07 07:38:51 +01:00
7b45a4748c Boilerplate day 06 2022-12-05 09:03:12 +01:00
22 changed files with 5053 additions and 28 deletions

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUST_MODULE" version="4">
<component name="CheckStyle-IDEA-Module" serialisationVersion="2">
<option name="activeLocationsIds" />
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">

140
Cargo.lock generated
View File

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "aho-corasick"
version = "0.7.19"
version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [
"memchr",
]
@ -25,8 +25,11 @@ name = "aoc-2022"
version = "0.1.0"
dependencies = [
"chrono",
"indextree",
"itertools",
"peg",
"regex",
"sscanf",
"tuple-map",
]
@ -44,9 +47,9 @@ checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
[[package]]
name = "cc"
version = "1.0.76"
version = "1.0.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f"
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
[[package]]
name = "cfg-if"
@ -79,6 +82,26 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "const_format"
version = "0.2.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7309d9b4d3d2c0641e018d449232f2e28f1b22933c137f157d3dbc14228b8c0e"
dependencies = [
"const_format_proc_macros",
]
[[package]]
name = "const_format_proc_macros"
version = "0.2.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d897f47bf7270cf70d370f8f98c1abb6d2d4cf60a6845d30e05bfb90c6568650"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.3"
@ -87,9 +110,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]]
name = "cxx"
version = "1.0.81"
version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97abf9f0eca9e52b7f81b945524e76710e6cb2366aead23b7d4fbf72e281f888"
checksum = "bdf07d07d6531bfcdbe9b8b739b104610c6508dcc4d63b410585faf338241daf"
dependencies = [
"cc",
"cxxbridge-flags",
@ -99,9 +122,9 @@ dependencies = [
[[package]]
name = "cxx-build"
version = "1.0.81"
version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cc32cc5fea1d894b77d269ddb9f192110069a8a9c1f1d441195fba90553dea3"
checksum = "d2eb5b96ecdc99f72657332953d4d9c50135af1bac34277801cc3937906ebd39"
dependencies = [
"cc",
"codespan-reporting",
@ -114,15 +137,15 @@ dependencies = [
[[package]]
name = "cxxbridge-flags"
version = "1.0.81"
version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ca220e4794c934dc6b1207c3b42856ad4c302f2df1712e9f8d2eec5afaacf1f"
checksum = "ac040a39517fd1674e0f32177648334b0f4074625b5588a64519804ba0553b12"
[[package]]
name = "cxxbridge-macro"
version = "1.0.81"
version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b846f081361125bfc8dc9d3940c84e1fd83ba54bbca7b17cd29483c828be0704"
checksum = "1362b0ddcfc4eb0a1f57b68bd77dd99f0e826958a96abd0ae9bd092e114ffed6"
dependencies = [
"proc-macro2",
"quote",
@ -159,6 +182,12 @@ dependencies = [
"cxx-build",
]
[[package]]
name = "indextree"
version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497f036ac2fae75c34224648a77802e5dd4e9cfb56f4713ab6b12b7160a0523b"
[[package]]
name = "itertools"
version = "0.10.5"
@ -178,10 +207,16 @@ dependencies = [
]
[[package]]
name = "libc"
version = "0.2.137"
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.138"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
[[package]]
name = "link-cplusplus"
@ -232,6 +267,33 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]]
name = "peg"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a07f2cafdc3babeebc087e499118343442b742cc7c31b4d054682cc598508554"
dependencies = [
"peg-macros",
"peg-runtime",
]
[[package]]
name = "peg-macros"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a90084dc05cf0428428e3d12399f39faad19b0909f64fb9170c9fdd6d9cd49b"
dependencies = [
"peg-runtime",
"proc-macro2",
"quote",
]
[[package]]
name = "peg-runtime"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fa00462b37ead6d11a82c9d568b26682d78e0477dc02d1966c013af80969739"
[[package]]
name = "proc-macro2"
version = "1.0.47"
@ -274,10 +336,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898"
[[package]]
name = "syn"
version = "1.0.103"
name = "sscanf"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
checksum = "887a5b09bbf30cc01d059ccb4b7a0b508a0cef3028df2f2ee0d745bc9e624c56"
dependencies = [
"const_format",
"lazy_static",
"regex",
"sscanf_macro",
]
[[package]]
name = "sscanf_macro"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b124cd4c68600cc3188a26987b1c3bed8cadcfd1be93124026096c668f2c0ee8"
dependencies = [
"proc-macro2",
"quote",
"regex-syntax",
"strsim",
"syn",
"unicode-width",
]
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908"
dependencies = [
"proc-macro2",
"quote",
@ -295,9 +389,9 @@ dependencies = [
[[package]]
name = "time"
version = "0.1.44"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
"libc",
"wasi",
@ -322,6 +416,12 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
name = "unicode-xid"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"

View File

@ -7,8 +7,11 @@ edition = "2021"
[dependencies]
chrono = "0.4.23"
indextree = "4.5.0"
itertools = "0.10.5"
peg = "0.8.1"
regex = "1.7.0"
sscanf = "0.4.0"
tuple-map = "0.4.0"
[features]
@ -36,6 +39,7 @@ day17 = []
day18 = []
day19 = []
day20 = []
visualize = []

File diff suppressed because it is too large Load Diff

99
input/08.txt Normal file
View File

@ -0,0 +1,99 @@
000110211310120301121312200301013204213433321324454125534120411314221421432204213123312010120220212
020012220322312203320423330100141123432232555552131513413333243201041414120414404222300212031212210
012220223030033030244430211234220045555352514254335343332514243345202201013120303123003031322301122
122212123203002004034001203313232515112543525251445353434224414533524014020242242322320223010131111
221102333103333221411324203034235135343455415425134251221521352512445343444242410343133031022213111
012230110220232130043321130142424543415542352534155145434324432553532253510101043422110311302133322
121211332110331222432012225134422432341112144421535153351545122134242232152130110334114400332212301
021003020222222304114022552315552411255554221162455263643351112333322235214353424140101110301013303
211101331332303134320025235254523341134225246335554356533426415514344521433235223100024100322012213
333121033001133202211331144545334545442426462335662255342342626524313432432255113203322322002312200
010322322141333044304115552115413253563353625666244464226452656243424545525555553333333441121311231
032330304041422420432124324244236264255242536445626642464646454324353143112245143242140134012131113
113222323414023431235314252222246225364232452564335525523344525664226653522112244131121334130320322
121002342323322351314412423235433523643565644552335525522462425253643354453342113152132444223043001
303334322134140123154241513636446642663346536533667552624355222224332425555525121255313000110224301
220002230431013514545542433426226364623335746773567356566543235364324426533313525143244100121033121
000021230222223532342154546526322562455734556753354636566447345465225625536633243334425112234211423
100240131421551532143146364665353436655665676767645757767765365733656436442643144352144332403323231
231322213332442222125662224633422364634335777574764763343776757435645252662432644231412254011230044
120320134105242421434423353553635756666465645446464476746533434474737333355643266531333324433212400
040301032133333254244335264252755376435754666436667554445363634375377335452223443455551432333010144
122213043542434415443363356663454534757746355453573654756377543673443533255466446625122132310014334
404243133333412213345434336533364653576735676667576876848337555643553537554265552455111211141430132
443341301142235415336322424546477554637688787745866488887577434344636437734332223546335121555322312
010101032453544354452355447644336446437444776676584487868688446743777537543333245666541212524431033
130342114125121245655353346445355733446776587588784546588474685553536367574445523434254125522412333
201242125553223436463223777745535566487874456667845657466784588644655657455355352552555444112241410
234243354255336642454256767534444878687668756444875858587854778474484437455656353656253411335452400
314411514514125254223353563444477554768588585448654748855456656667558676453446723446433551542333323
320425133145356325256655577477467888556845884576957768675647786647464447677575756555366251552252023
402024545131232242524557435777674845786545558766585956759687647846545584454443736545244555225513404
221122211244626363325464534767668748756767978988996968588875755867566656577763547532353323245443324
241532435425235552535674564444576465866975867987658575886697775645646467874734565535246546512244511
003324252512442566553463345787864877859757886699855979689556865965885747456343365533654353244413223
212315155352232566544737454548674574998798699555866589956966599795788486474536636336336342425134412
415441242523246256336374766665674457785867567956675565789686897696764587674446666642422423644424325
003554554162525244354667375865755578679858897996697678587867758755877644755534673566366364215111142
125233324364265264545556378688676958976975966767698999896779575577774547466453456456443363332524521
133515233335323373765654467667486986756665797876767877886899897979969475847765767637544446523515551
423321431443554355375376748446757899656688998798978687676986796699688855776746674753723255464344423
135533214666522656775554775567665797957679899988997898976779768787598768878445373375735633533152423
424233114545442654745646856857767575855668667669968786879669768579688844877458655735443652256255431
122311356255465443775736754747756597959866677969777897778796669799996864878444747533472262262432453
444412515423634374457557568574698568569796689667999968899788697787968667768664344766546653236143151
152311513646633365333568844555559779697686687699777998989779788768756594585758837374575424224211225
432411444656462746443756865787956975798986999787977978996987778795768586656655473453364365634145515
512553242524235344467755668868885977997876879978998878787888776866887566586456466377353633526612112
115351124324666765477575484768566785899876668997898988879879687896986577677786744336653645225533134
521325356522544377445774755666867759866698988779997998778687879779588576866784766376455535443334445
433451166554445354353554886675567598968878879979777887878988976979689787756548837435743345242455141
251112342434644676347767747746557587886869778877788877789787767787779598548856756754774536542212331
255533535452264557543768667886686886969966689777797988888776799775755889645756557644656535253352415
324425154344254736457678866646677886667896679787789878898879666995998757877665757356457366362624453
133124434355236446553476678549686757888986787979777777777688968798699766877778645555763233323653111
222452162524456534544666745659767986569977869888798889797967869896588579678645466757742223536551125
424113153224246464437444666655586769888767899997999998888899787785789988565667547344466324245444121
342222535222265477673374467445978889589796696777887788896778866766575958886864746654456432465143345
343222443646553344666565758455597897568767997897989877768698886656896987444854633767335332566315312
031554353342263455343465844688566996587977697767668887776787776985778754456646747553435562222553224
433344426223464443364358688754655656655796979887796696799797776855755885854676557736723432655514323
013424132332422364434378758577758958968878668787687777668989797955778846555856344635566224523432451
425553255655633236466566556555858699675969687978968799698978595977567446657483654746364253324544543
432514124535636275635556647685849565689989686678799779666769657669586678877883365364425535653142315
234213331454244233774547658465845955685598696976697898886596997865578648447647767565654326321345225
033142335256632253667547655784646566787758855877679696866998778855965474867574633636266434253231343
433312355254243222736457466486484557878576698897857857878667659897748755645557367664665624322214245
414352553244643424464634565857556876595979575859559697897855757678648446474443347476454343621315123
142445323134524455344767565745845466776955777775867689676669795765547875554364474423523255433452550
420122443552465225677645453567777645666955697588578797786675779777688864467444476525625534353143351
013443533555256553426677376778475746848576769888786588999657647784787744733675443533555552342334414
041143134325455654456573473653567744748677959966765568889765584875786654736746477425243323345412331
432143141143446546334633656476476747668864878778688989957788768655568457357565474424624643255141123
433102225554544652566677347757675544755546776854548575485655786465456345347635444252452425412221021
323443424115135364655624436464533765445864646766688454775574785855547635756475456566323553413444404
040133323452356462366536677466667655766665575477656846545868855587636377637445452653223313533353431
112321424255322325434562636744647576545484488884676746485886457756657434733352222326531315442212112
414000041225332224365336457576353475444476854684468466666787764643346356664452563552325454125532334
333211225554233356326636546733667664766764488678465547455847554453346674333644366565122142144303010
201332104431213354534342624674574463634343535468776645455555777363557644444632234452452514524001241
221121011452151314652546563557737463367364573534653347663557476557753774362253653622553112413343020
301020124355152323443536262535766773343757377576554465333456475773466764562232455333212154220142002
322244112312155113454636553224336764436375336773533577673334677767346562553664626122341142230310021
023103242244551224134442622342463557736536665447475654776476664656746264566536561531213151202033312
000241244142514451335326646524645362354365656733573556434643567466354436652444155224421243124420312
211134103233321112311333366243566524426453645455335474755773645624422266326533321441535122300041202
010100412012005141235135226623364644564632374554665337675444336522352336344211133431343203034321031
120100431404011341421515543345452262445624345326474644544443332326425454424431513314250240023131303
302230432233042151414231553363365325522333634334265345542443426352642445554145124343411121104121203
303233311431323211311335332253563563355242335445366433543356662343656654554132224132234403131422203
113031120441440344151555331254253525425556245652343434526624622453624343111341315343030233140303323
113030023221043232305142142324135442534246224522233522334666345254334253143442354430224400423233033
031102021123340100023323433221314345163424223524353422623255522232122453215412122243144210131021220
123100111112040244104314311535251111141234335442354234236235354514311422435123332031213231120131013
221222103112033302010413133424335241315253243263446652241133155434215112225523013040443233102021312
000012122130221202130324443534215451343511144224113442315342555214421524454224402343214132100123030
112012230223002044203111222225321532514541153222214115443212344354545231533442344002011210202230120
221200232013222231032340233141433354514311213113224441111332422254143133440204220101431230200002121
211212213121303211020441232042142451254444244521121152121224435112515234204202321124222332312210022
202120032200122003044340422223002041534554215334252122413441432141223402244034330212233311001312221

2000
input/09.txt Normal file

File diff suppressed because it is too large Load Diff

145
input/10.txt Normal file
View File

@ -0,0 +1,145 @@
noop
noop
addx 5
addx 21
addx -16
noop
addx 1
noop
noop
addx 4
addx 1
addx 4
addx 1
noop
addx 4
addx -9
noop
addx 19
addx -5
noop
noop
addx 5
addx 1
addx -38
addx 5
addx -2
addx 2
noop
noop
addx 7
addx 9
addx 20
addx -3
addx -18
addx 2
addx 5
noop
noop
addx -2
noop
noop
addx 7
addx 3
addx -2
addx 2
addx -28
addx -7
addx 5
noop
addx 2
addx 32
addx -27
noop
noop
noop
noop
noop
addx 7
noop
addx 22
addx -19
noop
addx 5
noop
addx -7
addx 17
addx -7
noop
addx -20
addx 27
noop
addx -16
addx -20
addx 1
noop
addx 3
addx 15
addx -8
addx -2
addx -6
addx 14
addx 4
noop
noop
addx -17
addx 22
noop
addx 5
noop
noop
noop
addx 2
noop
addx 3
addx -32
addx -5
noop
addx 4
addx 3
addx -2
addx 34
addx -27
addx 5
addx 16
addx -18
addx 7
noop
addx -2
addx -1
addx 8
addx 14
addx -9
noop
addx -15
addx 16
addx 2
addx -35
noop
noop
noop
noop
addx 3
addx 4
noop
addx 1
addx 4
addx 1
noop
addx 4
addx 2
addx 3
addx -5
addx 19
addx -9
addx 2
addx 4
noop
noop
noop
noop
addx 3
addx 2
noop
noop
noop

55
input/11.txt Normal file
View File

@ -0,0 +1,55 @@
Monkey 0:
Starting items: 54, 82, 90, 88, 86, 54
Operation: new = old * 7
Test: divisible by 11
If true: throw to monkey 2
If false: throw to monkey 6
Monkey 1:
Starting items: 91, 65
Operation: new = old * 13
Test: divisible by 5
If true: throw to monkey 7
If false: throw to monkey 4
Monkey 2:
Starting items: 62, 54, 57, 92, 83, 63, 63
Operation: new = old + 1
Test: divisible by 7
If true: throw to monkey 1
If false: throw to monkey 7
Monkey 3:
Starting items: 67, 72, 68
Operation: new = old * old
Test: divisible by 2
If true: throw to monkey 0
If false: throw to monkey 6
Monkey 4:
Starting items: 68, 89, 90, 86, 84, 57, 72, 84
Operation: new = old + 7
Test: divisible by 17
If true: throw to monkey 3
If false: throw to monkey 5
Monkey 5:
Starting items: 79, 83, 64, 58
Operation: new = old + 6
Test: divisible by 13
If true: throw to monkey 3
If false: throw to monkey 0
Monkey 6:
Starting items: 96, 72, 89, 70, 88
Operation: new = old + 4
Test: divisible by 3
If true: throw to monkey 1
If false: throw to monkey 2
Monkey 7:
Starting items: 79
Operation: new = old + 8
Test: divisible by 19
If true: throw to monkey 4
If false: throw to monkey 5

41
input/12.txt Normal file
View File

@ -0,0 +1,41 @@
abaaaaacccccccccccccccccccccccccccccccccccccccaaaaaaaccccaaaaaaaaaaaaaaaaacccccaaaaaacccccccccccccccccccccccaaaaaaaaccccccccccccccccccccccccccccccccaaaaaa
abaaaaaacccaaaacccccccccccccccccccccccaccccccccaaaaaaaaccaaaaaaaaaaaaaaaaccccccaaaaaacccccccccccccccccccccccccaaaaccccccccccccccccccccccccccccccccccaaaaaa
abaaaaaacccaaaacccccccccccccccccaaaaaaaacccccccaaaaaaaaacaaaaaaaaaaaaacccccccccaaaaacccccccccccccccccccccccccaaaaacccccccccccccccccccaaaccccccccccccaaaaaa
abaaacaccccaaaaccccccccccccccccccaaaaaacccccccccaaaaaaaccccaaaaaaaaaaacccccccccaaaaacccccccccccccccccccccccccaacaaaccccccccccccccccccaaacccccccccccccccaaa
abaaacccccccaaacccccccccccaacccccaaaaaaccccccccaaaaaaccccccaacaaaaaaaacccccccccccccccccccccccaaccccccccccccccacccaaaaacccccccccaaccccaaacccccccccccccccaaa
abccccccccccccccccccccccccaaaaccaaaaaaaacccccccaaaaaaaccccccccaaaaaaaaaccccccccccaacccccccccaaaccccccccccccccccccacaaacccccccccaaaaccaaacccccccccccccccaac
abccccccccccccccccccccccaaaaaacaaaaaaaaaaccccccaaccaaaaacccccaaaaccaaaaccccccccccaaacaacccccaaacaaacccaaccccccccaaaaaaaacccccccaaaaakkkkkkcccccccccccccccc
abccccccccccccccccccccccaaaaaccaaaaaaaaaacccccccccccaaaaaaccccacccaaaaaccccccccccaaaaaaccaaaaaaaaaaaaaaaccccccccaaaaaaaaccccccccaaajkkkkkkkaccccccaacccccc
abcccccccccccccccccccccccaaaaacacacaaaccccccccccccccaaaaaaccccccccaaaacccccccccaaaaaaacccaaaaaaaaaaaaaaaaaccccccccaaaaaccccccccccjjjkkkkkkkkccaaaaaacccccc
abcccccccccccccccccccccccaacaacccccaaacccaccccccccccaaaaaaccccccccaaaacccccccccaaaaaaacccccaaaaaacaaaaaaaacccccccaaaaacccccccjjjjjjjooopppkkkcaaaaaaaccccc
abcccccccccccccccccaacaacccccccccccaaaaaaacccccccccccaaaaacccccccccccccccccccccccaaaaaaccccaaaaaaccaaaaaaacccccccaaaaaacciijjjjjjjjoooopppkkkcaaaaaaaacccc
abccccccccccaaaccccaaaaacccccccccccccaaaaacccccccccccaaaaccccccccccccccccccccccccaacaaaccccaaaaaaacaaaaacccccccccaccaaaciiiijjjjjjoooopppppkllcaaaaaaacccc
abccaaccccccaaaaacaaaaacccccccccccccaaaaaacccccccccccccccccccccccccccccccccccccccaacccccccaaaacaaaaaaaaacccaaccccaaaaaciiiiinoooooooouuuupplllaaaaaacccccc
abcaaacccccaaaaaacaaaaaacccccccccccaaaaaaaaccccccccaacaccccccccccccccccccccccccccccccccccccaccccccccccaaccaaaccccaaaaaciiinnnooooooouuuuuppplllaaacacccccc
abaaaaaacccaaaaaacccaaaacccccccccccaaaaaaaaccccccccaaaaccccccccccccccccccccccccccccccccccccccccccccccccaaaaacaacaaaaaaiiinnnnntttoouuuuuupppllllcccccccccc
abaaaaaaccccaaaaacccaaccccccccccacccccaaccccccccccaaaaaccccccccccccccccccccccccccccccccccccccccccccccccaaaaaaaacaaaaaaiiinnnnttttuuuuxxuuupppllllccccccccc
abaaaaacccccaacaaccccccccccccccaaaccccaacccccaacccaaaaaacccccccccccccccccccccccccccccccccccccccccccccccccaaaaaccaaaaaaiiinnnttttxxuuxxyyuuppppllllcccccccc
abaaaacccccccccccccccccccccaaacaaaccccccaaacaaaaccacaaaacccccccccccccccccccccccccccccccccccaacccccccccccaaaaaccccaaaccciinnntttxxxxxxxyyvvvqqqqqlllccccccc
abaaaaaccccccccccccccccccccaaaaaaaaaacccaaaaaaacccccaaccccccccccccccccccccccccccccccccccccaaacccccccccccaacaaaccccccccciiinntttxxxxxxxyyvvvvvqqqqljjcccccc
abccaaaccaccccccccaaacccccccaaaaaaaaaccccaaaaaacccccccccccccccccccccccccccccccaacccccccaaaaacaaccccccccccccaacccccccccchhinnnttxxxxxxyyyyyvvvvqqqjjjcccccc
SbccccaaaacccccccaaaaaacccccccaaaaaccccccaaaaaaaaccccccccccccccccccccaaccccccaaaaccccccaaaaaaaacccccccccccccccccccccccchhhnnntttxxxxEzyyyyyvvvqqqjjjcccccc
abccccaaaacccccccaaaaaaccccccaaaaaacccccaaaaaaaaaacccccccccccccccccccaaccccccaaaaccccccccaaaaacccccccccccccccccccccccccchhhnntttxxxyyyyyyyvvvvqqqjjjcccccc
abcccaaaaaaccccccaaaaaacccccaaaaaaaccccaaaaaaaaaacccccccccccccccccaaaaaaaacccaaaacccccccaaaaaccccccccccccccccccccccccccchhmmmttxxxyyyyyyvvvvvqqqjjjdcccccc
abcccaaaaaacccccccaaaaacccccaaacaaacaaaaaaaaaaccccccccccccaaacccccaaaaaaaaccccccccccccccaacaaacccccccaacaaacccccccccccchhhmmmtswwwyyyyyyvvvqqqqjjjjdddcccc
abcccccaacccccccccaacaacccccccccccacaaaaaccaaaccccccccccaaaaacccccccaaaacccccccccccccccccccaaccccccccaaaaaacccccccccccchhhmmssswwwwwwyyywvrqqqjjjjdddccccc
abcccccccccccccccccccccccccccccccccaaaaaccccaaccccccccacaaaaaacccccaaaaacccccccccccccccccccccccccccccaaaaaacccccccccccchhhmmssswwwwwwywywwrrqjjjjddddccccc
abcccccccccccccccccccccccccccccccccaaaaaccccccccaaacaaacaaaaaacccccaaaaaaccccccccccccccccccccccccccccaaaaaaaccccccccccchhmmmsssswwsswwwwwwrrkkjjddddcccccc
abccccccccccccccccccccccccccccccccccaaaaacccccccaaaaaaacaaaaaccccccaaccaacccccccccccaaccccccccccccccaaaaaaaacaacaaccccchhhmmmsssssssswwwwrrrkkjddddaaccccc
abcccccccccccccccccccccccccaaaaaccccaacccccccccccaaaaaacaaaaacccccccccccccaacccccccaaaaaacccccccccccaaaaaaaacaaaaaccccchhgmmmmssssssrrwwwrrrkkddddaaaccccc
abcccccccccccccccccccccccccaaaaacccccccccccccccccaaaaaaaacccccccccccccccaaaaaaccccccaaaaaccccaaccccccccaaacccaaaaaaccccgggmmmmmmllllrrrrrrrkkkeedaaaaccccc
abcccccccccccaaccccccccccccaaaaaacccccccccccccccaaaaaaaaacccccccccccccccaaaaaaccccaaaaaaacccaaaacccccccaaccccaaaaaaccccggggmmmmllllllrrrrrkkkkeedaaaaacccc
abcccccccccccaaacaacaaaccccaaaaaaccccccccccccccaaaaaaaaaacccccccccccccccaaaaaaccccaaaaaaaaccaaaacccccccccccccaaaaaccccccgggggglllllllllrrkkkkeeeaaaaaacccc
abcccccccccccaaaaaacaaaacccaaaaaaccccccccccccccaaacaaaaaaccccccccccccccccaaaaaccccaaaaaaaaccaaaacccccccccccaaccaaaccccccgggggggggffflllkkkkkkeeeaaaaaacccc
abaccccccccaaaaaaaccaaaacccccaaacccccccccccccccccccaaaaaacaccccccccaaccccaaaacccccccaaacacccccccccccccccaaaaaccccccccccccccgggggffffflllkkkkeeeccaaacccccc
abaccccccccaaaaaaaccaaacccccccccccccccccaaaccccccccaaacaaaaaccccccaaacccccccccccccaaaacccccccccccccccccccaaaaaccccccccccccccccccaffffffkkkeeeeeccaaccccccc
abaaaccccccccaaaaaaccccccccccccccccccccaaaaaacccccccaaaaaaaacaaaacaaacccccccccaaaaaacccccccccccccccccccccaaaaaccccccccccccccccccccaffffffeeeeecccccccccccc
abaacccccccccaacaaaccccccccccccccccccccaaaaaaccccccccaaaaaccaaaaaaaaacccccccccaaaaaaaaccccccccccaaccccccaaaaacccccccccccccccccccccaaaffffeeeecccccccccccaa
abaacccccccccaaccccccccccccccccaaccccccaaaaacaaccaacccaaaaacaaaaaaaaacccccccccaaaaaaaaccccccaaacaacccccccccaacccccccccccccccccccccaaaccceaecccccccccccccaa
abaacccccccccccccccccccccccccccaaaaaacccaaaaaaaaaaaccaaacaaccaaaaaaaaaaaaacccccaaaaaaacccccccaaaaaccccccccccccccccccccccccccccccccaaacccccccccccccccaaacaa
abcccccccccccccccccccccccccccccaaaaaccccaacaacaaaaacccaaccccccaaaaaaaaaaaacccccaaaaacccccccccaaaaaaaccccccccccccccccccccccccccccccaaacccccccccccccccaaaaaa
abcccccccccccccccccccccccccccaaaaaaaccccccccaaaaaaaaccccccccccaaaaaaaaaaccccccaaaaaaccccccccaaaaaaaaccccccccccccccccccccccccccccccccccccccccccccccccaaaaaa

449
input/13.txt Normal file
View File

@ -0,0 +1,449 @@
[[[6,10,[],[8,1,6],6],[],[[1],7,1,0]],[9]]
[[[5]],[[[5],[7],[1],8],2,2,1]]
[[[3,[2,1,4],2,[],[4]],[1,[]]]]
[[1,[],[[3,8,9],9,2,[3,6,5]],[2,[7,1,3,0,9]],9],[[[4],4,7,3,[7,5,1,10]],1,[[5,10,7],[5,3,2,1],[4,5,0,10,9],[2],7],[7,8,5,[10,4,10]]],[4]]
[[3,8,0,6,[10,6,[10,0]]],[[[3,4],[7,9],[]],9],[10],[]]
[[1,10,2,3],[4],[]]
[[1,0],[[[5,3],10,[],[4]]],[[],8,9],[[2],[[6,5,10]]],[[[2,10],2]]]
[[9,[0],[],5,6],[2],[],[1,[4,[7,4,3,8,0],[1,5,1,1],[3],7],[4,10,5,[4,10]]]]
[[[[],2,[7,5,4,7,7],10],[[3],[2,8],1,6,[]],2],[[9,[3,6,5],[9,10,1,6]]],[],[[[3,10,5,6,0],[],[4,4,9,6,6],1,[8,4,7,1,0]]]]
[[1,[2,5,[10,6]],0,10],[[0,3]]]
[[9],[3],[2,4]]
[[],[],[],[]]
[[[3]],[[]],[[1,[],[6,8,5,8,8]]]]
[[],[[2,0,7],[]],[]]
[[],[[[5,5,6,0,4],[6,0,8,2]],4],[[10,3,2,3]],[[[6]]],[[]]]
[[],[[7,1,[],[2,1],7],[[9],0,5],[10,[7,6,3,7],[9,3],9]],[],[[[9,4,9,4],[5,1,1,5]]],[10,5,7,0,[[3,8],[],2]]]
[[[],[7,[],4,0,[7]],[1]],[[5,[8]]],[],[5]]
[[],[[[6,7,7],1,4,[7,6,6],0],[[2],9],[[3,4,5],2],[7],4],[[[9,1,4,0,3],[3,9,4]],[[7,8,7,10,1],9],[0],9,3],[[],[],[],[4],[[2,6,5],[5,4,8,7],[1],1]]]
[[],[[],[9,[1,8,8,7,6],2],0,[[0,0,7],[1,5,2,8,4],[8,5],0],[]],[[[10],0],2,[9,[2,10,0,5],3],1]]
[[[6,5]],[[[3],[3,3,4,5]]]]
[[3],[10],[[],[0,5,[2,2,4],8,[]],[[0,3],6,0],0]]
[[[],10,[[5,2,0]]],[10,2,9]]
[[],[[0,10,1,9],[2,[9,9]],[0,8,10,6]],[0,3,6,[[5,5,0],9,4]],[[7,[3,7]],5,4,[[8,6,0,1,10],[],[0],[],10],7]]
[[],[8,1,1]]
[[[2,[4,7,10]],3,1,[]],[],[[0,[6],4,1],2,[2,3,[5,7],9],9],[[8,[],[1],5],8,[[9],2,10,1],[[3,1],1],[[9,6,1,8]]],[3,3,4,3,[[],[10],1]]]
[[9,0,8,[[4,3,4,7,10],[8,9,6],2],[]],[9,[[1,0],9,7,9,[0,10,7]],[[8,10],[5,2,0]],4],[5,8,[7,[7,6,9,8,8]],[]],[2,[],2]]
[[],[6,5]]
[[10,5,2],[[1,8]]]
[[2,1],[9,[5]],[1,0,8,[]],[],[[4,5,[8,9,9],2,8],5,[0,[0,9],6,8],[],[3,10,4]]]
[[1,10],[]]
[[[0,9,[4]],[[7,8,9,8],[7],10]],[9]]
[[[[8,7],[2,5],8,6,9],10,7,[10],1],[6,0,0,4,0]]
[[[9,[3,4,10,8,0]],2],[[6,[0,6,10,9,10],0,[2,0,6,0],[4]],2,0],[[0],[[1,10,10]],[10,[6,5,2,9,9],[9],[8,8,7,1]],[5,5],6]]
[[[9],0,3,[[]],[[8,9,4]]],[]]
[[9],[8],[[8,5,2,4]],[],[[10,3,[8,3,3,1]],[[],0,[5,8,3,6],[]],[3]]]
[[],[[[0],[],10,[4,9]]],[[[3,2,3,2],1]]]
[[4,1,2,[[6],[8]],7],[7,0,[[7,5,3,10,7],[4,10,4,7,9]]],[0,[],[1,9],[8,2]],[7,3,[[4,3,4,0]],2,[8,[8,2,7],[3,2,0,4,6]]]]
[[],[]]
[[3,8,8,[],[[6],[9,9,1,0,3],[6,4,3]]]]
[[7,[[7,7,0],5,[1],10,10]],[2,7,[],3,[[],[5,8,7]]],[],[0,1],[[9,2,[0,1],[4,8,3,6]],[5,2,5,6],[9,[5,1,6,1,4],[8,5,9,4,9],[8,8]]]]
[[],[[8]],[8,[5,9,4,7],4,[8]],[2,[2,0],6,[[2,2,8],[9,7],10,5,[5,7]],[[9,6,0],7]]]
[[9,4],[[1,4,1,[6,9],5],4],[0,[9,7,[]]],[[[10,10],[9,2,7]],[0,6],[5,8],[]]]
[[[6,[10],[7,4,9,3]],[[],[5,0],[5,1,2,10,3],[]],3,[],3],[[],[7,8,2,10,[8,3,4,2]],1,[7,[6,3,9,6],2,4],10],[[]],[[],[[6],[5],[7],[9]]],[10,7,6,8]]
[[],[[4,[5,1,9],6,10],[[3,8,3,5,9],9,[7,6,10,9],10],[[3,7,8],9,[],8]]]
[[6,8,9,[[4,10,4,6,8]]],[],[[[],[7,6],8,[5,8,7,5],[7,3,0,1,1]],2,3],[5,10,[7,2,[5,5,2],[3],3]],[]]
[[],[1,9,8],[9],[7,[1],1]]
[[],[4,[[9,7,10],6,7]]]
[[[[6]],[[],3,0]]]
[[4,1],[],[5,3,3,[4]]]
[[[[10,7],10,[5,4,5,6,5],[8,2,5,4],[5]],[[8],[],9],[5,[2]]],[[[2,6,4],[1,5,4,10],[10,7],0,8],[6,6,[]],3,[[5,7,9,2],10],10]]
[[4,7,0,2]]
[[4,[],[2],[5,4,0],4],[[],9,[[7,1],2,9]],[10,1,[0,5,[6,2,7,1]],[[8]],[[9,9,7,8],5]],[],[[[4]],3]]
[[8,[],5,[[1],[3,5,7]]],[]]
[[[0],[5,5]]]
[[[8,[0],[0,2,6,9]],10,[],1]]
[[8,4,0],[],[7,9,[[10,4],10,10,0],[],0],[],[3,5,3]]
[[3,6,7],[4,5,6,[9,6],7]]
[[2],[[[6,6,4,5],[1,9]],[8,4,[5,5]],6,[3,[0,0,7],[3,9],[8,3,9],[2,0]]],[[[5,1,4,0,5],[10,5,9],3,2],[[4,0],[4,6],[4]]]]
[[6,4],[],[[]],[[[],1,2,0,[10,2]],6,4,5]]
[[1,[[],[3],[1,5]],[10,[],[2,8,4,10],[9,2]],[7,4,3,5,0],0]]
[[[[5,1,7],4],[]]]
[[[7,2,[]],[]],[[6],4,5,[[]],[[7,0,8],[0]]],[10,1,1,[[4,9],6,[10,2,3,9,0],[2,3,4,3]],3],[0,2,[7],5,2]]
[[4,3,[1,[9,0,8,7],1],[[],[],4,[5,7,10,6],10]],[]]
[[1,[4,5,[6,0,9,4,9],[],[1]],3,9]]
[[[],[6]]]
[[4,9,[3,[3,10,2,8],0,10,[2,3,2,10]],3,[2,[]]],[2,6],[],[6,0,5,[[6,1,3,5],5],[[3,8,1,9,10],[2],[1,4,10]]],[[[0,2],[7],[10,9,4,1],[4,2]],4,[]]]
[[[4]],[6,[[4],[8],[2],[4,0]],[4,9,[3]],[[8,10,6,10],[9]],9]]
[[[],5,[8,10],[4,[4,6,7,4],6,[4,10,5,4],[8,10,4]],8],[[[3,4,1],[1,6,6]],4,[[6,9,9],7,[],0,[1,4,7,2,1]],10,[[7,1,2],[6,3,3,8,10]]],[[[2,9,0,4,5]],[[9,0],4,[8,7]],[5,[3,9,2,8],9,[1]]],[6]]
[[[[8,10,10,1,7],[],1]]]
[[[3,3],[],[4],[]],[],[],[[],[7,8,3],10]]
[[],[0]]
[[8,[]],[6,[[1,10,7]],[2]],[],[],[[1,[],1,10],3]]
[[[6,7,4]],[2,5,[0,7,0,[],1],[10,4,[0,6],[5],[9]],[[5,7],[0,10,7,9]]],[[[1],6],[0,3,10]]]
[[[[9,0,1],7,[3,6,5,1],3,8],[[10,10],4,[4,8,1,10,2],[5,2,9]]]]
[]
[[]]
[[],[],[[[1,8,3],8,3,[9,6,1,9,1],1],[],2,4],[[0,[1,8]],8,[[5,0],[0,2,9],10,[5]],[[1],[],[9,2,1,0,7],6],5],[2,[5,7,8,[3],[1]],[[10,9,10],5,3]]]
[[2,10,6,4,[5,[]]],[0,[9,5,[2,6,10,3,8]],[]],[6,7,[[0,6,6],5,[4,3,0],[],3],6],[6,9,[[7,6,0,0,9],[9,10],7],[[],2],[4,2,7,[4],[4,6,2]]]]
[[2,5,[[2,0,5,8]],[1,[0,0,10],9,6,[1,9,3]],[[8,2,0,8,8],[9,10,3,9,7],[0]]],[6,[3,[1,2,1,7,4],[6,10,10,1],[10,0,9,7,2],8],9,8,[[],2,8,8]],[],[]]
[[4,9,[[3,1,2,5,0],5,[9,0,9,7],[8,5,7]],8],[[],2,[],[3,8]],[0,8,1,[[7,5,7,1],7,[10,9],4,8]]]
[[],[7]]
[[],[[3,[10,3,5,8]],[[0,9]],[[],10]],[[],0],[]]
[[2,9,0],[8,5],[[1,[0,1],7]],[[8,[2,9,6,4],9,[8,4],4],7]]
[[[[6,5,5,5,8],[9,1,1,0],[],[1],[2,5,2,7,10]],10]]
[[[[4,4,10,5],2,[]],[9],[[9,7],[2,0,1,1,5],0,10],10,5],[],[3,7,[9,9],4,2],[[[5,9],[],4],[[],[0,8]],[[10,4,6],7,3,[],[]]],[3,[0,2],[[0],7,[],6],3]]
[[],[9,[[6,3,2,8],[8],[2,8,0]]]]
[[[9],[[3,9,8,1,0],[3,10,7]],[5,[10,10],5,[],[1,6]],[[6,0,0,10,10]]],[],[5,[9,[1,3],[4,9,0,10],[8,5],[10]],[]],[[2,8,[5,1,6,1,4],10],6,[[4,6,6],8,[4,8,10],[10]],10,2]]
[[[[8,9,0,0],1,10],4],[6,5,0,[5,[6,0,9],[3,9,5],10,[4,8,3,6]],[]]]
[[[10],[5,[2,10,4],9,7,[6,5,10,7,6]],[9,[],[],[0,4]]]]
[[],[[9,[8],9],[[1,3,5],[5],[4,6,10,4],[7,8,10,9]],[[4,0,7,5],6,[]],[0]],[[[2,4,5,8]]],[5,[8],[[6,2,8,2,3]],[5,[],[2,0,4,1,4],[8]],6],[[8,0,6]]]
[[[],9,[[5,4]],4],[]]
[[3],[[[4,5],[2,1,8,9],[9,9,2]],6],[1,[10,4]],[10,[3],[[9],2,[10,0,8,5],4],[],8],[2,9]]
[[[2,5],7,8],[0,1,[],2]]
[[1,6],[[],9,7,0]]
[[[5,1,[3,2,6]]],[10,1,9,1],[]]
[[8,10],[],[[[8,7]],[10,[0,3,9]]],[[8,[7,3,2],[7],[2,1],[1]]],[4,0,1]]
[[[[2],[4],9,[0,1,0,1],6],[],[8,[4],5,9]],[]]
[[[5,[10,1]],[6,2,[6,4],[6,1],8]]]
[[[5],[6,0],1],[[[8,7],[1,6]]],[0,9],[],[0,0,[9,0,[],3]]]
[[[[8,10,3,0],[4],[0],[5,2,7,2],[4,7,5,5,4]],[[4,10,9,9],[1,1,4,8,0],10,[2,10]]]]
[[[[5,4,5,4,2]]],[8]]
[[[8,7,6],1,3,9,[[3,4,2,7],[],[10,10],[8,7,7,10,10]]],[5,8,3]]
[[4,[0]],[5,[5,1,1],[[2,1,6,4],[8,1,8,6,6],[10],7,1]],[],[],[5,9,3,3]]
[[6,[1,[5,1,4,8],[],[6,0,4,0,7]],9,[[6,5],[4,5,8],[4,10,8,7],[3,0],6]],[[3],[],7,9,[[6,10,1,2]]],[[],5,[[7],3,10],3]]
[[[0,[2],[8,4,4,2],[8,5,8,3,6]],[[6,4,0,8,1],[],4,[3,2]]]]
[[4],[[[6,0,1,3],[5,2,4,4],6],[[],1],[8,[]],7,[]]]
[[[[0,0],[3,4]]],[]]
[[[9,[10,0,9,10]],2],[4,6,[[8]]]]
[[],[[[8],[8,1,5],9,[9,0,1],[5,10,3,0]]],[]]
[[[1,[8,5],6,[]],[10,1,1,[2,10,4]],[],[8],[[4,10,6,3,0],[2,10],6,8,[0,10,10]]],[[[1,4,4,7,6]],9,8,[[6],4,[8,9],[0]],[[9],[4],3,3,[6,5,6,0,3]]]]
[[9],[[10,[5,2,8,0],7,[9,7,6,2,1],[5]],[9,[5,3],[4,10],[5,4,6,9]],[5,[6,8,4,4,7],[0,9,5,4],[1,0],3]],[],[[8],[[5,7,0]]]]
[[[8],[],4,9,1],[[1,[5,6,3,1],[8,6,0,5,0]],8,2,[[7,5,1]],1],[[[10,6,4],[8,6,1,4,9]],[[]],9,[7,[9,4,6],8,[6,4],7],[8,3,9,[10,6]]],[[7,8,[2],[7],[6,4,9,3]],10,[4,8,[0,6,2,1],6]]]
[[[4,1,6],3,[6,7]],[0,[6,0,[7,9,9],5],[10,2,[2,2,1,9],[4,0],[2,1]]],[[]]]
[[],[8,6,7,[9,[6,9,2,4,7],[10,0]],[]],[1,[5,3,10,[6],[8,6,3,6]],2,3],[[],[[9,3,10,0]],2,[[9,3,10,6],4],0],[[[0,5,10,9],6,[2],[1,2,2]]]]
[[[[],[8,1,5],[1,6],[2]],8],[[]],[1,5,[6],[[]]]]
[[],[[],[5,9,[3],[0,6,5],5],10,4,[8,[],6]],[8,0,[[3,4,1,10]],0]]
[[7,2],[],[[5,7,3],[],[[2,2],[],9,[2,6,7]]]]
[[[[2,9,2]]],[]]
[[4,3,10],[0,[1,9,[1,10,5]],8,[[8,6],[3,1],[9,8],1,[4,8,4,5]],3],[[[2,2],[8,5,5,2,0],3,[5]],[1,[3,10]]],[8,[[],[3,8],1]],[[]]]
[[[4,5,[],[10,3,10,4,10],8],[9],2,4,6],[[6,[10]]]]
[[[6],8,4,2],[1,[]],[[],10,[]]]
[[2,6,1],[[[7,6],7,[],[2,0],[3]]],[10],[[9],10,[7,3,[],9,7],6,9]]
[[0,6,9,[[0,10,1]]],[[[],7,3],[]],[],[8,9,2],[1,[0,8,[9,8]],[[3]],[1,7,7,1,[5,4,4,10]]]]
[[7,8,[]],[4,[8,[6,3],6],0],[2,9,7,[10]],[5,[[],0,3,[9]]],[]]
[[],[0,[7,6,[2,6],[7,2]],[4,3,6,7,8],7,1]]
[[[[3],7,[],2,[3,9,4]],[[0,4,10,8,0],0,9,[4,6,4,0],[4,6,2,8]],[[5],[2]],1,[]],[[3,7,6,7,10],[[10,3,9],[4,1,7],0],7,[0]],[3,7,6],[7,[8],7,[[0],5,9,9,1],0]]
[3,2,7,8]
[3,2,7,8,2]
[[[6,[10,3],0],4,[[1,7,9,9,10],1,3,[1,4,4,5]],[[8],[],9,9],[[6,8,9,7,3],9,[0],[2,7],0]],[3],[[10,[],6],[]],[[[9],10]]]
[[9],[10,7],[[0,[9,10,10],10],7,10]]
[[8,9,2,[],[9,7]],[[2,[7,6,2,3],8,6],[[7,7,9,4,5],[],[6,2,7,2],4,2],10,4],[4],[]]
[[10,0,[[],9,0],[[7,3,7,1],8,[0,3,8,5]]],[9,[4,0,10,9]],[]]
[[[[6,1,4,0,2],[4],[5,1,0]],[5,[1,7,2]],5,7,[[]]]]
[[],[[[],0,4],[[0,8,5,10]],[5],[4,8,10],6],[[5,10,[8,8,4,4],7,[6,8,10,7]],10,[],[[7,6],[1,8,10,10,0],2,[1],5]],[[6,[],0,2],0],[7,[[9,7,0,0,2],[3],0],9]]
[[[[1,1,8,8],5,[1],[5,3,6],[1,7,7,10,7]],10],[[1,[8,0,5,4],8],[[],6,5]]]
[[],[5,[],[6,8,5,[4]],[[4],[7,8,10,4],[6],[4,5,0]]],[3,[[3],[6,0,7,1,6],3,8,[6,10]],8,7],[[4,5,[2,8],[]],9]]
[[[7,0,7,3]],[],[6,1,[0],9]]
[[[8,10,9]],[7,[7,[],[9,3,6],[1,2,4,7]]],[0,2,[]]]
[[[[4],[7,4,6,7,1],8,6,9],6],[4,[],[1,[6,7,5],[7,7,4],8],9],[[9,10,7]]]
[[[0,[],[0,2,10]],7],[6,1,[[4,0],2,4,[10,3,5],10],9,[4]],[0],[[[6,3,4,4]],[[],[10,10],[8],9],0],[]]
[[[9,[1,2,6,6,2],[9,7,0,3,4],[5,9,10,4,0],5],7,[[5],0,[2,7,4]],[[9,6,10,5,10],8,5,[3]]]]
[[3,[4,1,7,5],[9,4,[2,6],[7,5]],[[9,0,6,6]],3],[[]],[],[5,[],9,8]]
[[0,5,[[],[8],[2,5]],4],[[1,[8,3,10],[6,3,8,1],[4,10,6,5],[9]]]]
[[0,3,2,4,4],[1,[],[[2,8]]]]
[[[[9],8],7,5,[0,[8,6]],[6,3,[10],[]]],[[1,[]],[[9,10]]],[[[10,2,10,5,5]],[],4],[[7],6]]
[[],[6,[],[],5,4],[[3,[1,5,10],7],[4,[6,4,4,0,5],[0,4,2,9]],[2,8,4,[6],[0]]],[[],[7,[4],[]]],[[],[[]],[[6,6,9],[9,5],8,[3,2,3]],[[8],6],10]]
[[[],5,1],[[[2,1,3,10],4,[],[4,1,4],10],7],[8,5,[6]],[[],0,[4,[7,1,2,4]],1,1]]
[[[[0],1],[2,[4]],[[],9,[3,7,6,2],[5,10,7,0]]],[],[[[1]],[[0,5],[0,6]],[[1,10],[0,7],[6,9,4,10]],5,[[3,6,5]]],[]]
[[[0,[0,6,7,6,3],2,[]]]]
[[7,5],[3,3,8,[8,[9,7],[2,2],[2,10,5,7],[7,1,8]]]]
[[[6,[3,4,8],[4],[1,1,1],9],3,[[7,5],4,[9,8,0],[1,6,4,10,3]],[3]],[[3,[1,5,3,3,1],9,8],6,[0,[2,10,7,3]],[7,2,[6]]],[9,4,[],[[10,4,4,10,8],7,[3,2,0,1,0]]],[[4,9]]]
[[[[7,5,9],[1,3],1,0,8],[[10,2]],5,4],[[[],4,[],6,[0,3,1,6,10]],1,2]]
[[9,9,[[],[7,5,4,3]]],[3,3,[],[4,[9,0,0,1]],8],[6],[[],6,[4,3,[],[1,7,6,9,6]]]]
[[10],[],[],[8],[9]]
[[4],[[0,[10,1],[2,7,9,4,6],3],5],[[[1,4],[3,8,10,4],8,[7,8,1,4,8],[]],3]]
[[],[3],[1,[0,[2,7,0],2,8,[3,8,6,1,8]],9],[]]
[[10],[],[[[3,9,9],[],[7,8,6,7,5],6],6,8,[4,[10,10,2,9,9],9,4,1]]]
[[6],[1,4,5,[[10,6],[],9,6]],[[0,[2,5],[5,9],7],[[0],3,1]],[[10],7],[[[8,4,2,7]],4,7]]
[[[7],1,[],[[],5,1],4],[],[0],[2,[1,[0],5],3,8],[10,[7,9,4,[2,5,1,7]],0]]
[[[],4,9,[1]],[6,10,[[9,7],[4],[0,10,6]],[1,10],8]]
[[[[],9,3,[5]],1,[4,[6,10,6,5,2],[],[6,7]],[10]],[2,[],4],[[10,8,0,[],2],[[],6,1,[5,6,8,7],[10,1,1]]],[[5,[2,9]],8,10,[7,10,[0,9],[8,5]]]]
[[[[6],0,8,2,[4,8,1,9]],[8,10,7],0],[4,[]],[9,2,[10,[]],6],[8,9,[5]],[]]
[[[[],8],[1,[4],[8,1,8,4,0],[9,7,4,1]],10,8,[[3,1],[10,0,9,10,10]]],[[]],[6,8,[[10,3],8,6,[0,9,5]],3,[]],[[6,8],1,6,[[4,10],[],5],[[3,8,6,1,1],[10]]],[[],[[7,1,3,8],0,[]]]]
[[8,[[9,9,4]],[[6,4,8,10],1,[6]],3]]
[[[[3,5],8,[0,0],2],[6,[2,5,5,7],[4,10],[6,6]],[[3,4,2,6]],[[1,7,2,6,0],[4],10,[9,2]],10]]
[[[[7,6,8,5,10],[7,0,9,8,9],5,[7,7],[2,8,1,0,5]]],[7],[],[[4,3,[2]]],[[[10,1],0,1],6]]
[[0,[[10,7,8],3,9,[10,4,2,0]],[10,7]],[0,10],[[]],[[[6,9],9],10,6,5,4],[[[],6,9],4,2]]
[[[9],[[]]],[5,[8,9,[4,9,6,6,6],1,[]],[0]],[[],5,[7,7,7,3,0]],[[8],6,4,7,[[9,4,7,8]]],[[[10,6,0,6,3],9,[7,7]],[9,1,[],9],[[3,4,10,8],5,9,2,5]]]
[[5],[]]
[[[10,[9,3,2],0,[7,10,8,0,1]]]]
[[[[],0,0,8,[5]],[8],[0,[2,7],[10]]]]
[[[[10,7,1,8],8,[],1],4,10,2],[[[9,3,10]],5,[[3,5],[4],[]]],[1]]
[[[3,[7,7,0],9],[5,[7,1],[4,5,1,1],8]],[[1],[7,5,1,9]],[[],[[5,10,0,1,5],3]]]
[[4,9,[5,[10,9,9,3,7],3,[4,1,3,3]],4,10],[],[[]],[[5,[10,3]],[[10,0,7],[2,1]],[8,[],4],4],[9,[0],[],[6,[1,9]],9]]
[[[],8,4,[1]],[[[2,1,2,1],[10]],10,7,4],[[5,8,[8,3,1,5,1],[5,6,8]],[[2,10],[]]]]
[[[9,[2,4,9],[10,5],[],3],0,[0,[],4],[8],3],[],[9,[9],2],[],[]]
[[10],[[]],[3,[],1,8,9],[0,[5,[8,7,8,6],8,[10,9,3,0]],[[],3,[8,1,7,8],2,7]]]
[[],[[4],3,[[8,8]],[],1],[],[4,0,4,[9,10]],[[9,[7,4,5],7],8,[6,[8,7,5,7,9]]]]
[[[[3,1,9,7,2]],1,3],[3,1,[[],[10,7,1,5,1]],[[2,5],[1,9,9]]],[10],[],[[[5,8,8,4,3],0,[2],[5,9]],2,2,[]]]
[[[[7]],2]]
[[7,[9,6],[[4,1,1,8],9,[]],[[],9],[0,0,[8,6,0,2]]],[[],[1]]]
[[4,7],[],[10,1,[9,0,[5,9],[0,5],7],[8,0,7],[[8,1,4,5],8]]]
[[10,[[8,10,4]],9,[]],[],[[10],7],[3,4,5,10,[[6,4,8,7,9],3,[0,5]]]]
[[9,[6,[2,8,9],3,[2],[0,1,5,0]]],[5],[[[9,8,1,9,8],[],[9,4,8],1,6],4,[3]],[[8,10,3,3,10],8,1,4],[]]
[[8],[[1,9,4],[9],0],[[],5,0],[3],[[9],3]]
[[0,5],[0,[[9,6,8]],8]]
[[1,[],[[8,10,2,5],6,[5,0,7,2,8],2]],[]]
[[6,5,10,9,[5,7,8,[2,3,9,8,10]]]]
[[],[8],[[4],[1,9,1,3],3]]
[[1,[[],[],10,[10,2],6],0,[]]]
[[[],10,[[7],[1,0,9],7]]]
[[1,2],[],[[[4,10]]],[[1,[6,9,1,0],4,[7]],4,[[8,10,0,5,5],1,6,[8,7,10,0],[5]],7]]
[[[],[5,9,[2,4,7,7],[10],7]]]
[[[1],2,[7,0,[7,9,3,5,10],6,[6,3,3,0]],[],[2,5]]]
[[],[[9,4,[5,5],[]],5,2,[6,10,10,[0,1,3],10],6],[10,[[5,3,0],[],2],[[1]],4]]
[[[[4,6,9]]],[[10,0,[8,1,5,3,6],[],10],2],[8,[[2,3,10,5,10]],[[9,1,3,3,2]],[[7,2,8],1]],[]]
[[],[[[],[],5,[1],[2,7,1,7,2]],7,9,[[6,2,3,4,0],8,2],2]]
[[],[4,2,5,[[1,3],1,[6,5],[3,5,7],[5,5,8,10,5]]],[],[]]
[[7,[2,[4,0,6,6],0],3]]
[[3,3,[[1,5]]]]
[[[[4],[5,5],[9,10,2,6],[4,2,1,4]],0,0,10,[[],[6],[3,4,4,2,6],[2,8],[]]]]
[[2,[[10],10,7,[],7],[[2,3,2,9],[2,2,8,6,2],[5,5,2,9,1]]],[[],2,8,1,[2,[4,5,9,5,1],8]],[[[]],6,[10,[6,5],[6,10,9,5,5],2]]]
[[4,[9,[3,2,2],[3,2,2,10],3,[10,8,5,2]]]]
[[0,9,8,[[2,1],[0,7,2,9,4],[6]]],[[5,9,[3],7],0,7,[0,[8,1,2],[2,10,9,3,6]],7]]
[[[1,[7,5],7],0],[2,0,4,1,7],[[2,9,4,[8,3,8],[2]]]]
[[],[[6,10],6,7],[0,9,6,4,[2,1,[5,1],[]]],[[],[[7],2,5,[6,0,6,2]],[[0,9,2,3],3]],[[[],10],0,6,8]]
[[],[],[2],[[4,[10,10]],[1],[7,3,[9,9],0],[[3,7],10,[5,1],9]]]
[[7,[[6,9]],4,6,2],[[],[],[6,6]]]
[[[10,5,10,7,7],4,3,1,3],[],[4]]
[[3,[5,2,7,[5],5],[[5]],0,2],[[],[[6,7,0],[0,8]],7,[2,0,8],[[0,2],[]]],[1,7,10,[7,3,1],[]],[4,[[9,1,10,7],[7,9,3]],[],[1,1,9,5]],[9,4,5,[[3,2,7,0],[1],7,4,6]]]
[[[[3,4,4,8],[],[5,9,10,4,3],[1]]],[2],[4,3,[],[4],[[3,3],3,[8,8],[1,4,10],[3]]],[[[0,7,10],[10,9,3,0,10],6,7,6],0,[9,4,0,0,[9,10,0,7]],[6],[]]]
[[3,[[]],0,[5],4],[6,8,10,6,[[8,1,5,5,7],3,0,[],4]]]
[[[5,4,5,8,1],6,[8,[],[0,6,0],[3,8,10,0]]]]
[[[[10,4,1,4],[2,5,9,2],[6,3,2,5,2],[],8],[10],2],[[2]]]
[[[7,[7,10,2,7],[]],[4,7,[0,10,10],4,10],[],10],[3,4,9,[],2],[[8],9,[7,[8,7,2],[2,4,6],4,[8,4,6]]]]
[[6,6,[[3],[3],[1]],8],[[9,[8,8,3,9],10]],[[5,5,4,[]],9,[]],[8,[[3],6,6],[1,[3,7],0,9,0],[[],[],9,3],[2]],[[[3],[6,6,4,9,6],[7,5],[3],8]]]
[[0,3,[7,10],[7,[7,1,5,4]]],[[7,7,10,[7,1,5]],[4,[2,3],[1],9,[]],4]]
[[4,[[3,6,10,8]],9,9],[[[6,0,9,7],[0,9,5,3],9]]]
[[[4,1],[1,1,[6,5,7],3,[9]]],[8,8,0,[6]],[0,[[8,8,4,0,0],[8,9,1,8,8],[2]]]]
[[9,1],[5,1,[[7],[6,5],[],[7]],10,3],[2,3],[1,5,[],[]]]
[[[[5,9,0,6]],[0,[9,9],0,[]],6],[[]],[[[6,4],10],10,0]]
[[],[[]],[[1,3,[7,8,6]],[[3]],8],[[[],[2,3,8,5,4]],8],[9,6,[5,[]],[9,[6,9,7,3]],9]]
[[5,3,1],[2,5,[[],1,[1,10,9,0,7],[],[]]],[5],[3,10,[[8,4],[5,7]],5],[[5,8],[[1,6,4],10,6,3,[7,5,1,8,3]],[],[[],[3,7],2,[5,7],[10,7,3]],[[5,10],1,[5,8]]]]
[[[1,[5,0],0,0],10,7,[],3],[[[0,0,6,9,0],[10,4,9,0]],3],[8]]
[[6,6,3,[6,0,10,[1,6,0,6],6]],[1,[[2,9,2,5,1],9],[6,[1],0,4,7]],[[[1,10,8]],[1,3,[2,1,10,0],10],0,8],[[[8,1,2,9,5],[4,6,10,8]],6,0,[],6]]
[[[[0,8,2,2],[9,1,5,8,6],8],1,0,[2,[0,4],[10]],[[9,4,2,3,3],[4,6,0],9,7]],[[6,[],0,[5,7,4]]]]
[[[[2],[8,9,1,3,3],[3,8,5,6],[7,3],5],[10,5,[8,0,5,7,8]],[],3],[4,[[0,4,7,4],1,[8,0,7,3],9,[10]]]]
[[[[7,1,8,1]],10,[10,[1,8,1,5],[9,9,9],[5,10,10]],5,[]],[],[],[[10],[[0,1,8]],2,[[],9,[0],5,[]]]]
[[0,0],[[],3,[[4,8,4,6],3,[1,5,0,0]]],[[],10],[[8,[5,8,7],8],2,0,[]],[8,5,[[],[]],2]]
[[10,[10],[],7,10],[[9,[10,6],2,4],[[6,9,6,0],4,7,1],[8,9,[]],[[5,3,10]],7],[8,[[5,1,1,1,5]],[[1,6,3,5]],[[4,5,7],[],3],[[7,1,5,4],[0,10,10],[1]]]]
[[6,1],[],[4,[[9,10,7,8,2],[8,2],10],3,10,[[8,8,3],4,7,[2,1,5,5,3],[8,6,7,5,0]]]]
[[[0,[4],[4],[2,5,4,7,7],5],0,[]],[]]
[[[],3,8,[[7,5,3,8,9],3,[8,10,4,7]]],[[[10],10,[0,9,3]],5,[[10,2,10,10,6],10,7,[7,4,7,9,9]]],[],[[7,[],5],9,[10,[4,9,0,2],[9]],[5,[1,10,2],[4,4],[8,2]],[[3,7,8],5,[9,2,5,5,5],[2,10,2]]],[[[9,9,9,10],[9],[10,10,9],[8]],8]]
[[],[[9,[10,7,7,4]],10],[[1,5,9,4],[[6,6,3,10],[],5],3,[[],9,[6,7,3],3,4],10],[[0,[6,8,10],10,[1]],[[2,2,5,5]]]]
[[8,0,9],[0,1,[0,1,4],0],[3,4],[[[0,1]],1,[9,5,9],[5,[3],5,[3],[2,1,6]]]]
[[[[10,3,10,2],7,3],4,[[1,5,6,4,5],[9,4,6,9],3,[9]],[[1,5,7],[4,10,7],[4,2],10,[9,6,0]]]]
[[5,5,[1,[9,6,9],4],1,0],[[[8,4],[6],5,[4,3,9,7],3]],[5,4,7,5,[]],[3,2]]
[[2],[9,[[3,7,1],[2,3,4,9],3,6,[1,2,9,0,4]],8]]
[[1],[[2,[2,2],[3,3,1,3]],1,[[8],[0,5]],[7,8]],[[[10,5],3,[9,6],2,[9,6,8,6]]],[[4],9,5],[3]]
[[6,[],[4],[[3,0,9],[4,9],[4,4,6],0,10],9]]
[[[8,7],2,[[]],6],[10,8],[1,3,8],[3],[4]]
[[7,[4,7,8,[0,2]],1],[[[10,9,9,6],9,[9],7,1],5,[[8],1,[10,4,10],6],9]]
[[[[2,5,1,8,0],10,7,[5,4,10,0]],6,6,[[4,6,7,9],2,[],[6,10,7,9]]],[[8,[8,6,10,0],4,5],6,4,[[4,2,3],8,6,3,3],[[9],[1,4,7,5,5],[4],7]],[[],[6,2,[6,5,4,6]],10,8],[3,[4,8,[0,2,10,10,9],4],[6],[[]]],[[]]]
[[[[3,7,2],10,10],6,[1,4,0,0,[]],[[0,5]]],[[0,[5,2,1,0,10]],[2],[0,[7],8,3]]]
[[],[6,5,3,6,[3,4,[7,2,9],0]],[3],[7,[[],4,[]],7,[]],[[[10,10,6],10],[[8],4,[9,9,0,10,7],4,4],9,[[1,8,10,7,4]],6]]
[[],[10,[6,2],[5,3],2],[4],[[7,[7]],8,[2,9,[10,2,0],2],[],[[7,1],1,9,[4,2]]]]
[[[],8,[9,0]],[],[4,2,[1,[1,5,7,4]]],[1,4,0,[[],5,4,9,[10,9]]],[[],[4,10,[1,10]],9,[]]]
[[[[7],[7,0,10]],[3],[[]],[]],[[[6],[],[6,0],1,[9,5]],[10,[5],[],1],[[1,8],[],9,[7],[1,8,8,8]],[],[0]],[[[]]],[1,[],[6,[],7,[5,5,2],1],8]]
[[8,[],7,[]],[5,6,[],9,[[7,9,9],1]],[3]]
[[[4,[3],[9,4,4,9],1,6],[10],2],[[0],[],[[2,3,7,2,3]],[[3,9],10,[4]]]]
[[[[2,3,9,1,6],[10],[10]],[0,9,[0,4,10],7,[3,2,7]],5]]
[[[7,[9],5],4,10,[[3,9,8],[5,6,1,0,9],9,[]]],[1,[[7],[5,10]],8,[[4,8,5],2,9]]]
[[[[3],9,2,8,[]],[10,[1,10,6],[10,7,9],4,[10]],[2,[3,6,9,6],[5,0],[3,5,10],8],4]]
[[7,[[10,10,3],1],4,[0,[8,9,6],9,[6,3,9,1,6]]],[]]
[[[8,[3,1,3,2,3],5,10],[3,2],9],[8]]
[[4,7],[],[7,6,[[10,5,0,3,4],9],7,[[0,5,9,5],7,2,[5,8]]]]
[[2,[],2],[2,[5,[2,2,10,2,4],[3,3,5,10],[6,1]],[6,[6]],2,8]]
[[[7,3,4],4,[[7],[10,6,9],[],[]],[[2,7,5],[8],[4,7,10,9,6],[]],[3,0,8]]]
[6,4,3,7,0]
[6,4,3,7]
[[[[0,2,5],9],1,8]]
[[[1,[4],[8,7,5,7,3]],10],[]]
[[8,[5,[9,1,2],5,10]]]
[[[4],7,8]]
[[7,[]]]
[[[[9,5],[2,10,6,7]],2,4,[],[10,6,8,3,8]],[[[]],9,[[2,9],10,3,6],[[1,10],[9]]]]
[[5,[[1,7,9],10],8],[[6,[7,1,9,2],10,[5],[6,4,9]],[10]]]
[[[2,8,6,[]]]]
[[9,8]]
[[3,9,[[0,2,0,3,3],[9,6,7,3,9],3,10,4]],[1,3,[[],[1,7,5],[8,4,8],0,[2,2]],9,6],[]]
[[[],[[0,4,9]],[[1,10,9,8,7],6,[5,1,6,10],4]],[[[],[9,0,2],10],[3],9,[]],[2,6],[[],1,[9,8,[5,3],[],[4]],6,10]]
[[0]]
[[1,3],[7,[],[[2,6,8,7,5],2,[],[7,0,6]]]]
[[[6,[],7,3],5,[2,[],[9,8,1,4],3]],[[[0,7]]],[10,[[6,0,1,7],[],[8,2,5],7],1],[]]
[[[],[],5,[],[[8,5,10]]],[10,[[0,3],[1],[6,3,1],[5,4,1]],4,1],[1,[],[],[[3],1,[9],5]]]
[[[7,[4,10],10,[0,3,10],6],1]]
[[[[3,4,6],7,[0,1,6,8,10],7],[[1,9,5,10]],9]]
[[[6,[2,7,5,9],0]]]
[[8]]
[[[[1,0,6],2,[3,10,1,9]],6]]
[[[7],0,[4,[4,0,7,8],[7,10,4,6,10],[]]]]
[[[10,7,[8,10,2,0,6]],6,[8,4,[8]],1,5],[8,[1,6],3]]
[[8,[7]],[7,0,0,6],[[[4,8,9,7],8,[6,0,1,3],9],1,1,10,7],[2,[7,[4,9,2,9,4],5,[10,9,5,4]],[5,[10,3,6,7],[8],[4,6],[3,1,1,5]],9,4],[4,[[8,7,2,2,0]],[[3,10]],[],[10,0,7,8]]]
[[[[5,4,9,4,9]],[[7,6,2,8],[3,9,10],2,3,9],9,[[10,2,8,2,0]]],[9,[4,[1],9],4],[],[5,5]]
[[[[8,2,4],[8,7,3]]],[7,[2,10,8,[7]]],[9,[[6,3]],[],8,6]]
[[[[],[0,1,0],[6,9,8,7,2]],[[3,1,0,10]]],[[6,[0,10],[],5,[4,2,1,6,5]],[]],[1],[3,[6,1,[6,7]],4],[[[],3,10,[10,1]],7]]
[[[10,[1]],8,5,[]],[9]]
[[[3,[1],10],[10,9]],[10],[1,9,[[7,2,1,8,7],[]],3,0]]
[[[],[[3,5,5,7,7],[9],2],[[10],0],8],[7,[[6,6,5,8],0,2,[4,7,3,5]]],[[1],2,[[2],[7,3,7]],6]]
[[],[3]]
[[4,[],[[2],[6,7],0],4],[10,[[9,4,7,6,10],[0,0,1,10,6],6,1,3]]]
[[4,1,0,1],[],[],[[1],[],[[9,10,5,0],[10,7,4],[10,9,1,10,3]]]]
[[[[4,8,8,0],[7],3,2],8,[[10,9,1]]]]
[[[1,6,[10,4,2]],1],[1,[4,[2,7],6,[7],2]],[3,9,10,9],[]]
[[[[10,1,4,6,5],[2,8,10,6],3],2,2,[6,3],[[4]]],[4,[[7,6,8,0],[4,0,3],0,[10,9]],[3,8,10],1]]
[[[2,5]],[[5,[8,7,2,0],8,[9,1,5],[9,8,0]],10,10,[9,3,[10]],3],[[2,2,7,[3,10,7,10,8],7],8],[4,0,[6,2,10],[10,3,0,[4,6,5,4,2]]]]
[[[],2],[0,6,[[2,7,7,2,4],[7,1]],6,2]]
[[3,[],[[10,2,1,5]]],[]]
[[],[8,[[5,10,5]],9]]
[[[[2,8,4],[2,0],4,6,4],2,[[10,5,10],1,[10,9,1,1]]],[2,7],[],[[[3,1,4,8,4],4,[0,5,9,3],4,[]],[],[8,2]]]

173
input/14.txt Normal file
View File

@ -0,0 +1,173 @@
480,150 -> 485,150
459,100 -> 464,100
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
504,19 -> 508,19
467,59 -> 472,59
463,103 -> 468,103
472,68 -> 477,68
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
470,103 -> 475,103
479,36 -> 479,40 -> 477,40 -> 477,48 -> 489,48 -> 489,40 -> 483,40 -> 483,36
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
467,128 -> 467,132 -> 462,132 -> 462,138 -> 477,138 -> 477,132 -> 472,132 -> 472,128
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
452,112 -> 458,112 -> 458,111
460,115 -> 460,117 -> 456,117 -> 456,125 -> 469,125 -> 469,117 -> 464,117 -> 464,115
486,25 -> 490,25
471,109 -> 476,109
467,179 -> 467,180 -> 472,180 -> 472,179
487,150 -> 492,150
501,16 -> 505,16
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
479,36 -> 479,40 -> 477,40 -> 477,48 -> 489,48 -> 489,40 -> 483,40 -> 483,36
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
464,109 -> 469,109
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
489,22 -> 493,22
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
460,115 -> 460,117 -> 456,117 -> 456,125 -> 469,125 -> 469,117 -> 464,117 -> 464,115
471,55 -> 471,56 -> 479,56
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
498,25 -> 502,25
467,128 -> 467,132 -> 462,132 -> 462,138 -> 477,138 -> 477,132 -> 472,132 -> 472,128
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
498,13 -> 502,13
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
472,144 -> 477,144
466,150 -> 471,150
479,36 -> 479,40 -> 477,40 -> 477,48 -> 489,48 -> 489,40 -> 483,40 -> 483,36
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
507,22 -> 511,22
467,128 -> 467,132 -> 462,132 -> 462,138 -> 477,138 -> 477,132 -> 472,132 -> 472,128
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
479,36 -> 479,40 -> 477,40 -> 477,48 -> 489,48 -> 489,40 -> 483,40 -> 483,36
498,19 -> 502,19
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
458,68 -> 463,68
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
475,65 -> 480,65
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
492,19 -> 496,19
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
460,115 -> 460,117 -> 456,117 -> 456,125 -> 469,125 -> 469,117 -> 464,117 -> 464,115
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
467,128 -> 467,132 -> 462,132 -> 462,138 -> 477,138 -> 477,132 -> 472,132 -> 472,128
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
466,100 -> 471,100
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
464,62 -> 469,62
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
456,103 -> 461,103
484,28 -> 484,30 -> 481,30 -> 481,33 -> 488,33 -> 488,30 -> 487,30 -> 487,28
467,179 -> 467,180 -> 472,180 -> 472,179
467,128 -> 467,132 -> 462,132 -> 462,138 -> 477,138 -> 477,132 -> 472,132 -> 472,128
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
467,106 -> 472,106
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
474,50 -> 474,51 -> 486,51
468,65 -> 473,65
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
479,68 -> 484,68
476,147 -> 481,147
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
453,106 -> 458,106
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
484,28 -> 484,30 -> 481,30 -> 481,33 -> 488,33 -> 488,30 -> 487,30 -> 487,28
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
484,28 -> 484,30 -> 481,30 -> 481,33 -> 488,33 -> 488,30 -> 487,30 -> 487,28
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
483,147 -> 488,147
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
501,22 -> 505,22
465,68 -> 470,68
479,144 -> 484,144
484,28 -> 484,30 -> 481,30 -> 481,33 -> 488,33 -> 488,30 -> 487,30 -> 487,28
484,28 -> 484,30 -> 481,30 -> 481,33 -> 488,33 -> 488,30 -> 487,30 -> 487,28
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
474,106 -> 479,106
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
471,55 -> 471,56 -> 479,56
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
475,141 -> 480,141
460,115 -> 460,117 -> 456,117 -> 456,125 -> 469,125 -> 469,117 -> 464,117 -> 464,115
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
484,28 -> 484,30 -> 481,30 -> 481,33 -> 488,33 -> 488,30 -> 487,30 -> 487,28
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
457,109 -> 462,109
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
467,128 -> 467,132 -> 462,132 -> 462,138 -> 477,138 -> 477,132 -> 472,132 -> 472,128
504,25 -> 508,25
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
495,22 -> 499,22
492,25 -> 496,25
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
467,128 -> 467,132 -> 462,132 -> 462,138 -> 477,138 -> 477,132 -> 472,132 -> 472,128
460,106 -> 465,106
469,147 -> 474,147
450,109 -> 455,109
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
452,112 -> 458,112 -> 458,111
461,65 -> 466,65
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
467,179 -> 467,180 -> 472,180 -> 472,179
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
460,115 -> 460,117 -> 456,117 -> 456,125 -> 469,125 -> 469,117 -> 464,117 -> 464,115
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
462,97 -> 467,97
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
510,25 -> 514,25
495,16 -> 499,16
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
458,81 -> 458,77 -> 458,81 -> 460,81 -> 460,73 -> 460,81 -> 462,81 -> 462,80 -> 462,81 -> 464,81 -> 464,77 -> 464,81 -> 466,81 -> 466,78 -> 466,81 -> 468,81 -> 468,73 -> 468,81
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
479,36 -> 479,40 -> 477,40 -> 477,48 -> 489,48 -> 489,40 -> 483,40 -> 483,36
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
472,176 -> 472,175 -> 472,176 -> 474,176 -> 474,174 -> 474,176 -> 476,176 -> 476,174 -> 476,176 -> 478,176 -> 478,175 -> 478,176 -> 480,176 -> 480,166 -> 480,176 -> 482,176 -> 482,172 -> 482,176 -> 484,176 -> 484,167 -> 484,176
460,115 -> 460,117 -> 456,117 -> 456,125 -> 469,125 -> 469,117 -> 464,117 -> 464,115
448,94 -> 448,87 -> 448,94 -> 450,94 -> 450,93 -> 450,94 -> 452,94 -> 452,91 -> 452,94 -> 454,94 -> 454,88 -> 454,94 -> 456,94 -> 456,91 -> 456,94 -> 458,94 -> 458,86 -> 458,94 -> 460,94 -> 460,86 -> 460,94 -> 462,94 -> 462,89 -> 462,94 -> 464,94 -> 464,90 -> 464,94
479,36 -> 479,40 -> 477,40 -> 477,48 -> 489,48 -> 489,40 -> 483,40 -> 483,36
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
464,163 -> 464,158 -> 464,163 -> 466,163 -> 466,154 -> 466,163 -> 468,163 -> 468,153 -> 468,163 -> 470,163 -> 470,160 -> 470,163 -> 472,163 -> 472,162 -> 472,163 -> 474,163 -> 474,159 -> 474,163 -> 476,163 -> 476,155 -> 476,163 -> 478,163 -> 478,159 -> 478,163
473,150 -> 478,150
471,62 -> 476,62
484,28 -> 484,30 -> 481,30 -> 481,33 -> 488,33 -> 488,30 -> 487,30 -> 487,28
479,36 -> 479,40 -> 477,40 -> 477,48 -> 489,48 -> 489,40 -> 483,40 -> 483,36
478,109 -> 483,109
474,50 -> 474,51 -> 486,51
460,115 -> 460,117 -> 456,117 -> 456,125 -> 469,125 -> 469,117 -> 464,117 -> 464,115

View File

@ -1,18 +1,66 @@
use crate::read;
use itertools::Itertools;
use tuple_map::*;
use indextree::Arena;
#[derive(Debug)]
struct Directory {
pub size: usize,
pub name: String
}
pub fn run() {
let input = read("04");
let lines = input.lines();
let lines = input.split("\n\n");
let arena = &mut Arena::new();
let mut current_directory = arena.new_node(Directory {
size: 0,
name: "/".into(),
});
let root = current_directory;
for line in read("07").lines().skip(1) {
if line.starts_with("$ cd") {
current_directory = match line.split_once("cd ").unwrap().1 {
dirname if ".." == dirname => arena.get(current_directory).unwrap().parent().unwrap(),
dirname => current_directory
.children(arena)
.find(|c|arena.get(*c).unwrap().get().name == dirname)
.unwrap_or_else(||{
let nc = arena.new_node(Directory {
size: 0,
name: dirname.into(),
});
current_directory.append(nc, arena);
nc
})
};
} else if line.chars().next().unwrap().is_numeric() {
let filesize: usize = line.split_once(" ").unwrap().0.parse().unwrap();
arena.get_mut(current_directory).unwrap().get_mut().size += filesize;
}
}
let total = root.descendants(arena).map(|desc|{
desc
.descendants(arena)
.map(|d|arena.get(d).unwrap().get().size)
.sum::<usize>()
}).collect::<Vec<_>>();
#[cfg(feature = "part1")]
{
println!("Day 7, Part 01: {}", "TODO");
println!("Day 7, Part 01: {}", total.clone().iter()
.filter(|s| *s <= &100000)
.sum::<usize>());
}
#[cfg(feature = "part2")]
{
println!("Day 7, Part 02: {}", "TODO");
let total_used = root.descendants(arena)
.map(|d|arena.get(d).unwrap().get().size)
.sum::<usize>();
let free_needed = total_used - 40000000;
println!("Day 7, Part 02: {}", total.iter()
.filter(|s|*s >= &free_needed)
.min()
.unwrap());
}
}

83
src/day08/mod.rs Normal file
View File

@ -0,0 +1,83 @@
use crate::read;
pub fn run() {
let grid: Vec<Vec<u32>> = read("08")
.lines()
.map(|l| {
l.chars()
.map(|c| c.to_digit(10).unwrap())
.collect::<Vec<_>>()
})
.collect::<Vec<_>>();
let width = grid.first().unwrap().len();
let res = grid
.iter()
.enumerate()
.skip(1)
.flat_map(|(row, row_vec)| {
row_vec
.iter()
.enumerate()
.skip(1)
.map(|(col, height)| {
let values = [
if let Some(sc_score) = (0..col)
.rev()
.map(|col_left| (col - col_left, row_vec[col_left]))
.find(|(_sc_score, other_height)| other_height >= height)
{
(1, sc_score.0)
} else {
(0, col)
},
if let Some(sc_score) = (col + 1..width)
.map(|col_right| (col_right - col, row_vec[col_right]))
.find(|(_sc_score, other_height)| other_height >= height)
{
(1, sc_score.0)
} else {
(0, width - col - 1)
},
if let Some(sc_score) = (0..row)
.rev()
.map(|row_above| (row - row_above, grid[row_above][col]))
.find(|(_sc_score, other_height)| other_height >= height)
{
(1, sc_score.0)
} else {
(0, row)
},
if let Some(sc_score) = grid
.iter()
.enumerate()
.skip(row + 1)
.map(|(row_below, l)| (row_below - row, l[col]))
.find(|(_sc_score, other_height)| other_height >= height)
{
(1, sc_score.0)
} else {
(0, grid.len() - row - 1)
},
];
let is_visible = values.map(|e| e.0).iter().sum::<i32>() < 4;
let scenic = values.map(|e| e.1).iter().product::<usize>();
(is_visible, scenic)
})
.collect::<Vec<_>>()
})
.collect::<Vec<_>>();
#[cfg(feature = "part1")]
{
let count = res.iter().filter(|e| e.0).count();
println!("Day 8, Part 01: {}", count);
}
#[cfg(feature = "part2")]
{
let max_score = res.iter().map(|e| e.1).max().unwrap();
println!("Day 8, Part 02: {}", max_score);
}
}

117
src/day09/mod.rs Normal file
View File

@ -0,0 +1,117 @@
use crate::read;
use std::collections::HashSet;
use itertools::Itertools;
#[derive(Debug, PartialEq, Eq, Default, Clone, Hash)]
struct Position {
pub x: i32,
pub y: i32,
}
impl Position {
pub fn move_right(&self) -> Self {
Self {
x: self.x + 1,
y: self.y,
}
}
pub fn move_left(&self) -> Self {
Self {
x: self.x - 1,
y: self.y,
}
}
pub fn move_up(&self) -> Self {
Self {
x: self.x,
y: self.y - 1,
}
}
pub fn move_down(&self) -> Self {
Self {
x: self.x,
y: self.y + 1,
}
}
pub fn follow_head(&self, head: &Position) -> Self {
// Based on jenarvaezg/aoc2022
// https://old.reddit.com/r/adventofcode/comments/zgnice/2022_day_9_solutions/izi6s4p/
if self.x.abs_diff(head.x) < 2 && self.y.abs_diff(head.y) < 2 {
self.clone()
} else {
Self {
x: self.x + (head.x - self.x).signum(),
y: self.x + (head.y - self.y).signum(),
}
}
}
}
struct Chain {
pub knots: Vec<Position>,
visited: HashSet<Position>
}
impl Chain {
pub fn new(num_knots: usize) -> Self {
Self {
knots: vec![Position::default(); num_knots],
visited: HashSet::with_capacity(10000)
}
}
pub fn num_visited(&self) -> usize {
self.visited.len()
}
pub fn move_knots(&mut self, direction: &str, count: usize) {
let move_head_func = match direction {
"R" => Position::move_right,
"U" => Position::move_up,
"L" => Position::move_left,
"D" => Position::move_down,
_ => unreachable!(),
};
for _c in 0..count {
self.knots[0] = move_head_func(&mut self.knots[0]);
for i in 1..self.knots.len() {
self.knots[i] = self.knots[i].follow_head(&self.knots[i - 1]);
}
self.visited.insert(self.knots.last().unwrap().clone());
}
}
}
pub fn run() {
let res = simulate(vec![2, 10]);
#[cfg(feature = "part1")]
{
println!("Day 9, Part 01: {}", res[0]);
}
#[cfg(feature = "part2")]
{
println!("Day 9, Part 02: {}", res[1]);
}
}
fn simulate(chain_sizes: Vec<usize>) -> Vec<usize> {
let chains = read("09")
.lines()
.filter(|l|!l.is_empty())
.map(|l|l.split_once(' ').unwrap())
.map(|(dir, count)|(dir, count.parse::<usize>().unwrap()))
.fold(chain_sizes
.iter()
.map(|c|Chain::new(*c))
.collect_vec(),
|mut chains, (dir, count)| {
chains
.iter_mut()
.for_each(|chain|chain.move_knots(dir, count));
chains
});
chains.iter().map(|c|c.num_visited()).collect()
}

21
src/day10/mod.rs Normal file
View File

@ -0,0 +1,21 @@
use crate::puter::Puter;
use crate::read;
pub fn run() {
let input = read("10");
let mut device = Puter::new();
device.run(&input);
#[cfg(feature = "part1")]
{
println!(
"Day 10, Part 01: {}",
device.signal_strengths().iter().sum::<i32>()
);
}
#[cfg(feature = "part2")]
{
println!("Day 10, Part 02: \n{}", device.output().join("\n"));
}
}

104
src/day11/mod.rs Normal file
View File

@ -0,0 +1,104 @@
use crate::read;
use itertools::Itertools;
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
enum Operation {
Multiply(u64),
Add(u64),
Square,
}
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
struct Monkey {
pub items: Vec<u64>,
pub operation: Operation,
pub test: u64,
pub throw_to: [usize; 2],
pub inspected: usize,
}
impl Monkey {
pub fn parse(s: &str) -> Self {
let (_, items, operation, operand, test, throw_true, throw_false) = sscanf::sscanf!(
s,
"Monkey {usize}:
Starting items: {str}
Operation: new = old {str} {str}
Test: divisible by {u64}
If true: throw to monkey {usize}
If false: throw to monkey {usize}"
)
.unwrap();
let items = items.split(", ").map(|i| i.parse().unwrap()).collect_vec();
let operation = match operation {
"*" => match operand {
"old" => Operation::Square,
n => Operation::Multiply(n.parse().unwrap()),
},
"+" => Operation::Add(operand.parse().unwrap()),
_ => unreachable!(),
};
Self {
items,
operation,
test,
throw_to: [throw_true, throw_false],
inspected: 0,
}
}
}
fn simulate(monkeys: &mut Vec<Monkey>, is_part_1: bool) {
let test_product: u64 = monkeys.iter().map(|m| m.test).product();
let rounds = if is_part_1 { 20 } else { 10_000 };
for _ in 0..rounds {
for i in 0..monkeys.len() {
let items = monkeys[i].items.clone();
for mut item in items {
item = match monkeys[i].operation {
Operation::Square => item * item,
Operation::Add(n) => item + n,
Operation::Multiply(n) => item * n,
};
item = if is_part_1 {
item / 3
} else {
item % test_product
};
let other_monkey =
monkeys[i].throw_to[if item % monkeys[i].test == 0 { 0 } else { 1 }];
monkeys[other_monkey].items.push(item);
}
monkeys[i].inspected += monkeys[i].items.len();
monkeys[i].items = Vec::new();
}
}
}
fn calculate_monkey_business(monkeys: &[Monkey]) -> usize {
monkeys
.iter()
.map(|m| m.inspected)
.sorted()
.rev()
.take(2)
.product()
}
pub fn run() {
let input = read("11");
let mut monkeys = input.split("\n\n").map(Monkey::parse).collect_vec();
#[cfg(feature = "part1")]
{
let monkeys = &mut monkeys.clone();
simulate(monkeys, true);
println!("Day 11, Part 01: {}", calculate_monkey_business(monkeys));
}
#[cfg(feature = "part2")]
{
simulate(&mut monkeys, false);
println!("Day 11, Part 02: {}", calculate_monkey_business(&monkeys));
}
}

BIN
src/day12/.DS_Store vendored Normal file

Binary file not shown.

103
src/day12/mod.rs Normal file
View File

@ -0,0 +1,103 @@
use crate::read;
use itertools::Itertools;
#[derive(Debug, PartialEq, Eq, Clone, Hash, Default)]
struct Coord {
pub row: usize,
pub col: usize,
}
pub fn run() {
let input = read("12");
let lines = input.lines();
let mut start: Coord = Default::default();
let mut target: Coord = Default::default();
let map = lines
.enumerate()
.map(|(row, l)| {
l.chars()
.enumerate()
.map(|(col, c)| match c {
'S' => {
start = Coord {
row,
col,
};
0
}
'E' => {
target = Coord {
row,
col,
};
25
}
c => (c as u8) - ('a' as u8),
})
.collect_vec()
})
.collect_vec();
#[cfg(feature = "part1")]
{
println!("Day 12, Part 01: {:?}", bfs(&map, start, target.clone()).unwrap());
}
#[cfg(feature = "part2")]
{
let min = map
.iter()
.enumerate()
.flat_map(|(row, v)| {
v.iter()
.enumerate()
.filter(|(_, vv)| **vv == 0)
.map(|(col, _)| Coord {
row,
col,
})
.collect_vec()
})
.filter_map(|start| bfs(&map, start.clone(), target.clone()))
.min()
.unwrap();
println!("Day 12, Part 02: {:?}", min);
}
}
fn bfs(map: &Vec<Vec<u8>>, start: Coord, target: Coord) -> Option<usize> {
let mut visited = vec![vec![false; map[0].len()]; map.len()];
let mut queue = std::collections::VecDeque::new();
queue.push_back((start, 0));
while let Some((next, path_length)) = queue.pop_front() {
if next == target {
return Some(path_length);
}
for coord in [(1, 0), (-1, 0), (0, 1), (0, -1)]
.iter()
.filter_map(|(dr, dc)|make_coord((next.row as isize) + dr, (next.col as isize) + dc, &map)) {
if map[next.row][next.col] + 1
< map[coord.row][coord.col] || visited[coord.row][coord.col] {
continue;
}
visited[coord.row][coord.col] = true;
queue.push_back((coord, path_length + 1));
}
}
None
}
fn make_coord(row: isize, col: isize, map: &Vec<Vec<u8>>) -> Option<Coord> {
if row >= 0
&& col >= 0
&& row < map.len() as isize
&& (col as usize) < map[row as usize].len() {
Some(Coord {
row: row as usize,
col: col as usize
})
} else {
None
}
}

95
src/day13/mod.rs Normal file
View File

@ -0,0 +1,95 @@
use crate::read;
use itertools::Itertools;
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub enum Content {
Number(i32),
List(Vec<Content>),
}
#[derive(Debug, PartialEq, Eq, Clone, Hash, PartialOrd, Ord)]
pub struct Packet {
pub content: Vec<Content>,
}
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub struct Pair {
pub first: Packet,
pub second: Packet,
}
impl Pair {
pub fn in_order(&self) -> bool {
self.first < self.second
}
}
impl Ord for Content {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match (self, other) {
(Content::Number(a), Content::Number(b)) => a.cmp(b),
(Content::Number(a), Content::List(b)) => vec![Content::Number(*a)].cmp(b),
(Content::List(a), Content::Number(b)) => a.cmp(&vec![Content::Number(*b)]),
(Content::List(a), Content::List(b)) => a.cmp(b),
}
}
}
impl PartialOrd for Content {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
pub fn run() {
let input = read("13");
#[cfg(feature = "part1")]
{
let p1 = input
.split("\n\n")
.map(|pair| pair.split_once('\n').unwrap())
.map(|pair_lines| Pair {
first: packet_parser::packet(pair_lines.0).unwrap(),
second: packet_parser::packet(pair_lines.1).unwrap(),
})
.enumerate()
.filter(|(_, pair)| pair.in_order())
.map(|(idx, _)| idx + 1)
.sum::<usize>();
println!("Day 13, Part 01: {:?}", p1);
}
#[cfg(feature = "part2")]
{
let div1 = packet_parser::packet("[[2]]").unwrap();
let div2 = packet_parser::packet("[[6]]").unwrap();
let mut p2 = input
.lines()
.filter(|l| !l.is_empty())
.map(|l| packet_parser::packet(l).unwrap())
.collect_vec();
p2.push(div1.clone());
p2.push(div2.clone());
p2.sort_unstable();
let product =
(p2.binary_search(&div1).unwrap() + 1) * (p2.binary_search(&div2).unwrap() + 1);
println!("Day 13, Part 02: {:?}", product);
}
}
peg::parser! {
grammar packet_parser() for str {
pub rule packet() -> Packet
= content:content() { Packet { content }}
rule value() -> Content
= content:content() { Content::List(content) } / int:int() { Content::Number(int) }
rule int() -> i32
= n:$(['0'..='9']+) {? n.parse().or(Err("u8")) }
rule content() -> Vec<Content>
= "[" content:(value() ** ",") "]" { content }
}
}

248
src/day14/mod.rs Normal file
View File

@ -0,0 +1,248 @@
use crate::read;
use itertools::Itertools;
use std::{
collections::*,
hash::{Hash, Hasher},
};
#[derive(Debug, Clone, Eq)]
pub struct Coord {
pub x: i32,
pub y: usize,
pub is_rock: bool,
}
impl Hash for Coord {
fn hash<H: Hasher>(&self, state: &mut H) {
self.x.hash(state);
self.y.hash(state);
}
}
impl PartialEq for Coord {
fn eq(&self, other: &Self) -> bool {
self.x == other.x && self.y == other.y
}
}
impl Coord {
pub fn down_left(&self) -> Self {
Coord {
x: self.x - 1,
y: self.y + 1,
is_rock: self.is_rock,
}
}
pub fn down_right(&self) -> Self {
Coord {
x: self.x + 1,
y: self.y + 1,
is_rock: self.is_rock,
}
}
pub fn down(&self) -> Self {
Coord {
x: self.x,
y: self.y + 1,
is_rock: self.is_rock,
}
}
}
pub fn run() {
let input = read("14");
let lines = input.lines();
let mut rocks: HashSet<Coord> = lines
.flat_map(|line| {
line.split(" -> ")
.map(|c| {
let nums = c.split_once(',').unwrap();
Coord {
x: nums.0.parse().unwrap(),
y: nums.1.parse().unwrap(),
is_rock: true,
}
})
.tuple_windows()
.flat_map(|(s, e)| {
let mut path = vec![];
for nx in s.x..=e.x {
for ny in s.y..=e.y {
path.push(Coord {
x: nx,
y: ny,
is_rock: true,
})
}
}
for nx in e.x..=s.x {
for ny in e.y..=s.y {
path.push(Coord {
x: nx,
y: ny,
is_rock: true,
})
}
}
path
})
.collect_vec()
})
.collect();
// Hide cursor
print!("\x1B[?25l");
#[cfg(feature = "part1")]
{
#[cfg(feature = "visualize")]
print!("\x1B[2J\x1B[1;1H");
let _count = p1(&mut rocks.clone());
#[cfg(not(feature = "visualize"))]
println!("Day 14, Part 01: {:?}", _count);
}
#[cfg(feature = "part2")]
{
let floor = rocks.iter().map(|r| r.y).max().unwrap() + 2;
(-1000..=1000)
.map(|x| Coord {
x,
y: floor,
is_rock: true,
})
.for_each(|coord| {
rocks.insert(coord);
});
// Clear screen
#[cfg(feature = "visualize")]
print!("\x1B[2J\x1B[1;1H");
let _count = p2(&mut rocks);
#[cfg(not(feature = "visualize"))]
println!("Day 14, Part 02: {:?}", _count);
}
// Restore cursor
print!("\x1B[?25h");
}
fn p1(rocks: &mut HashSet<Coord>) -> usize {
let bottom = rocks.iter().map(|r| r.y).max().unwrap();
let sand_start = Coord {
x: 500,
y: 0,
is_rock: false,
};
let mut count_p1 = 0;
loop {
let mut sand = sand_start.clone();
loop {
if sand.y > bottom {
#[cfg(feature = "visualize")]
print(rocks, &sand, 1, count_p1);
return count_p1;
}
let d = sand.down();
let dl = sand.down_left();
let dr = sand.down_right();
if rocks.contains(&d) {
if rocks.contains(&dl) {
if rocks.contains(&dr) {
count_p1 += 1;
rocks.insert(sand.clone());
#[cfg(feature = "visualize")]
print(rocks, &sand, 1, count_p1);
break;
}
sand = dr;
} else {
sand = dl;
}
} else {
sand = d;
}
}
}
}
fn p2(rocks: &mut HashSet<Coord>) -> usize {
let sand_start = Coord {
x: 500,
y: 0,
is_rock: false,
};
let mut count_p2 = 0;
loop {
let mut sand = sand_start.clone();
if rocks.contains(&sand) {
#[cfg(feature = "visualize")]
print(rocks, &sand, 2, count_p2);
return count_p2;
}
loop {
let d = sand.down();
let dl = sand.down_left();
let dr = sand.down_right();
if rocks.contains(&d) {
if rocks.contains(&dl) {
if rocks.contains(&dr) {
count_p2 += 1;
rocks.insert(sand.clone());
#[cfg(feature = "visualize")]
print(rocks, &sand, 2, count_p2);
break;
}
sand = dr;
} else {
sand = dl;
}
} else {
sand = d;
}
}
}
}
#[cfg(feature = "visualize")]
fn print(rocks: &HashSet<Coord>, sand: &Coord, part: i32, count: usize) {
let (min_y, min_x, max_y, max_x) = (10, 442, 182, 514);
if sand.x < min_x || sand.x > max_x || sand.y < min_y || sand.y > max_y {
return; // Don't render if not displayed
}
let status = format!("Part: {}, Count: {}", part, count);
let bounds = " ".repeat((max_y as usize) - (min_y as usize) - status.len());
let mut out = format!("{}{}\n", status, bounds);
for x in (min_x..=max_x).rev() {
for y in min_y..=max_y {
let testing = &Coord {
x,
y,
is_rock: false,
};
let c = match (sand == testing, rocks.get(testing)) {
(true, _) => "\x1B[31mo\x1B[0m",
(_, None) => " ",
(_, Some(coord)) if coord.is_rock => "#",
_ => "\x1B[33mo\x1B[0m",
};
out += c;
}
out += "\n";
}
out += &bounds;
// Clear terminal, position cursor at (1,1)
print!("\x1B[1;1H{}", out);
let ms = if part == 1 { 34 } else { 8 }; // Go faster in part 2, takes too long otherwise
std::thread::sleep(std::time::Duration::from_millis(ms));
}

View File

@ -8,6 +8,14 @@ mod day04;
mod day05;
mod day06;
mod day07;
mod day08;
mod day09;
mod day10;
mod day11;
mod day12;
mod day13;
mod day14;
mod puter;
fn main() {
let today = Local::now().day();
@ -33,6 +41,27 @@ fn main() {
if cfg!(feature = "day07") || (cfg!(feature = "today") && today == 7) {
day07::run();
}
if cfg!(feature = "day08") || (cfg!(feature = "today") && today == 8) {
day08::run();
}
if cfg!(feature = "day09") || (cfg!(feature = "today") && today == 9) {
day09::run();
}
if cfg!(feature = "day10") || (cfg!(feature = "today") && today == 10) {
day10::run();
}
if cfg!(feature = "day11") || (cfg!(feature = "today") && today == 11) {
day11::run();
}
if cfg!(feature = "day12") || (cfg!(feature = "today") && today == 12) {
day12::run();
}
if cfg!(feature = "day13") || (cfg!(feature = "today") && today == 13) {
day13::run();
}
if cfg!(feature = "day14") || (cfg!(feature = "today") && today == 14) {
day14::run();
}
println!("Finished, time taken: {:?}", now.elapsed())
}

105
src/puter/mod.rs Normal file
View File

@ -0,0 +1,105 @@
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub(crate) enum Command {
AddX(i32),
Noop,
}
impl Command {
fn from_str(s: &str) -> Self {
match s {
"noop" => Command::Noop,
s => {
let (c, i) = s.split_once(' ').unwrap();
match (c, i.parse::<i32>()) {
("addx", Ok(i)) => Self::AddX(i),
_ => unreachable!(),
}
}
}
}
fn num_cycles(&self) -> usize {
match self {
Self::Noop => 1,
Self::AddX(_) => 2,
}
}
}
pub(crate) struct Puter {
register_x: (i32, i32),
cycle: usize,
pixel_row: [bool; Puter::LINE_WIDTH],
rows: Vec<String>,
cycles_processing_left: usize,
signal_strengths: Vec<i32>,
}
impl Puter {
const LINE_WIDTH: usize = 40;
const SPRITE_WIDTH: usize = 3;
const SPRITE_WIDTH_HALF: usize = Puter::SPRITE_WIDTH / 2;
pub fn new() -> Self {
Self {
register_x: (1, 1),
cycle: 1,
pixel_row: [false; Puter::LINE_WIDTH],
rows: Vec::with_capacity(6),
cycles_processing_left: 0,
signal_strengths: Vec::with_capacity(6),
}
}
fn execute(&mut self, cmd: Command) {
match cmd {
Command::Noop => {}
Command::AddX(v) => {
self.register_x.1 += v;
}
};
self.cycles_processing_left = cmd.num_cycles();
}
pub fn run(&mut self, program: &str) {
let mut lines = program.lines();
loop {
if self.cycles_processing_left == 0 {
match lines.next() {
Some(s) => self.execute(Command::from_str(s)),
_ => return,
};
}
self.cycles_processing_left -= 1;
let pixel = (self.cycle - 1) % Puter::LINE_WIDTH;
let is_lit = pixel.abs_diff(self.register_x.0 as usize) <= Puter::SPRITE_WIDTH_HALF;
self.pixel_row[pixel] = is_lit;
if pixel == Puter::LINE_WIDTH - 1 {
self.rows.push(
self.pixel_row
.map(|l| if l { '#' } else { ' ' })
.iter()
.collect(),
);
} else if pixel == (Puter::LINE_WIDTH / 2) - 1 {
self.signal_strengths
.push(self.cycle as i32 * self.register_x.0);
}
if self.cycles_processing_left == 0 {
self.register_x.0 = self.register_x.1;
}
self.cycle += 1;
}
}
pub fn signal_strengths(&self) -> Vec<i32> {
self.signal_strengths.clone()
}
pub fn output(&self) -> Vec<String> {
self.rows.clone()
}
}