diff --git a/advent-of-code-2022.csproj b/advent-of-code-2022.csproj index 1fc185f..00bfd8a 100644 --- a/advent-of-code-2022.csproj +++ b/advent-of-code-2022.csproj @@ -60,6 +60,7 @@ + diff --git a/inputs/13.txt b/inputs/13.txt index 2f7fb82..4e847c9 100644 --- a/inputs/13.txt +++ b/inputs/13.txt @@ -1,910 +1,449 @@ -688,126 -1237,406 -1228,327 -827,189 -132,457 -641,120 -1255,579 -1310,187 -371,166 -576,332 -1207,835 -746,595 -468,5 -428,282 -540,446 -1253,393 -788,701 -1034,387 -509,526 -209,360 -676,245 -781,107 -515,301 -1235,194 -83,304 -177,568 -159,570 -141,583 -599,763 -519,263 -261,260 -18,281 -870,688 -1190,598 -1287,169 -616,351 -89,488 -23,725 -338,204 -641,792 -693,577 -1278,768 -739,304 -749,565 -1096,742 -504,621 -900,103 -627,11 -1272,543 -281,491 -1185,129 -1293,526 -917,701 -781,395 -1005,264 -843,67 -930,812 -967,746 -1160,845 -1057,313 -164,92 -1089,687 -1267,504 -113,675 -676,469 -1042,82 -1053,777 -877,334 -641,270 -731,855 -1165,526 -638,250 -306,544 -1034,294 -1297,624 -509,78 -549,127 -1001,647 -624,499 -478,509 -261,232 -801,526 -818,810 -213,339 -1064,364 -972,690 -213,555 -117,388 -1146,354 -837,42 -667,672 -223,59 -50,507 -1027,504 -22,397 -3,613 -554,383 -649,31 -806,621 -176,201 -619,88 -847,183 -768,542 -1143,140 -971,110 -574,747 -639,120 -1294,196 -542,94 -1011,39 -89,504 -875,803 -271,37 -729,805 -253,357 -492,806 -622,126 -748,333 -693,465 -780,127 -1057,840 -1086,826 -1200,826 -813,158 -473,42 -277,600 -1022,95 -1064,530 -37,36 -823,1 -1057,651 -962,714 -60,816 -710,794 -82,810 -1277,267 -843,301 -872,866 -482,322 -991,362 -428,164 -127,696 -693,410 -1139,868 -832,873 -32,126 -872,516 -21,182 -875,91 -1310,709 -1290,201 -1283,683 -661,863 -73,306 -194,457 -1094,187 -144,431 -1262,339 -305,525 -507,735 -467,281 -525,627 -1250,78 -1049,773 -900,819 -582,707 -627,211 -124,637 -62,383 -473,78 -975,691 -16,644 -1245,466 -1181,757 -654,485 -594,368 -256,113 -529,787 -637,78 -1141,626 -701,670 -765,347 -397,329 -731,263 -668,721 -291,179 -1217,280 -192,586 -552,154 -785,179 -709,211 -893,628 -1273,484 -89,292 -571,304 -437,883 -1197,614 -667,224 -348,628 -1005,600 -410,551 -401,406 -567,417 -1006,206 -850,247 -1004,96 -674,95 -393,701 -1007,831 -820,418 -888,588 -624,652 -393,774 -257,117 -469,189 -296,567 -373,222 -276,507 -301,332 -440,294 -435,53 -1092,772 -1139,637 -595,350 -1042,530 -435,841 -75,855 -492,536 -93,728 -927,73 -497,46 -673,526 -445,808 -557,652 -401,805 -818,806 -412,114 -1073,280 -323,793 -1293,647 -487,1 -843,145 -112,94 -365,765 -355,487 -1026,369 -1193,782 -694,95 -463,183 -820,707 -57,725 -1123,575 -306,798 -1203,288 -7,868 -15,465 -793,480 -925,277 -811,196 -646,546 -641,326 -88,42 -349,294 -994,268 -841,705 -596,252 -638,644 -214,742 -435,526 -1238,707 -561,166 -577,93 -517,190 -639,317 -92,221 -226,506 -541,488 -517,414 -1019,715 -909,243 -37,410 -601,211 -232,588 -617,186 -37,484 -1248,511 -139,165 -736,747 -216,203 -417,628 -961,712 -659,812 -743,477 -339,784 -316,626 -800,7 -172,322 -893,182 -636,281 -164,585 -547,674 -542,876 -1197,70 -525,267 -15,36 -1240,177 -1005,425 -1006,21 -1245,121 -933,600 -1054,893 -600,100 -949,86 -373,403 -1057,56 -1054,1 -694,799 -550,82 -1057,243 -89,824 -435,501 -1021,577 -1185,107 -483,332 -955,683 -1091,837 -1042,364 -1071,642 -1273,260 -167,140 -619,536 -113,728 -857,877 -437,235 -129,137 -1087,96 -952,253 -659,109 -910,595 -176,693 -952,499 -721,502 -164,354 -529,339 -417,182 -781,787 -170,826 -857,241 -775,372 -453,843 -962,404 -316,268 -744,404 -582,35 -1160,84 -765,498 -589,196 -299,519 -72,259 -164,866 -761,127 -125,765 -1134,693 -795,593 -1015,488 -216,187 -299,855 -52,812 -1002,431 -721,193 -914,252 -304,273 -910,707 -585,728 -510,711 -917,466 -438,68 -43,484 -1041,603 -397,614 -542,352 -400,747 -537,11 -1261,518 -313,624 -495,371 -1116,247 -21,369 -803,159 -566,852 -303,383 -748,781 -656,37 -254,299 -176,497 -1303,691 -0,485 -1241,504 -1163,735 -1064,147 -182,439 -490,707 -214,94 -1129,42 -293,715 -107,9 -542,542 -284,369 -1235,39 -991,469 -1200,467 -632,397 -1014,701 -1130,306 -1015,406 -75,197 -927,427 -1096,800 -1241,838 -1066,810 -765,435 -700,686 -401,651 -1300,647 -815,526 -838,767 -23,189 -708,203 -1034,632 -150,761 -460,247 -1029,491 -1193,800 -633,712 -1134,201 -870,94 -467,491 -401,54 -1056,819 -470,798 -1134,497 -837,852 -602,203 -1190,296 -346,57 -1203,53 -1143,754 -110,68 -890,389 -13,270 -781,339 -991,82 -1017,585 -813,44 -269,277 -393,466 -383,427 -975,469 -1007,383 -955,375 -467,301 -1148,806 -490,418 -1091,78 -505,120 -1287,705 -331,225 -848,196 -346,407 -641,774 -356,798 -27,211 -785,627 -343,792 -599,660 -1109,577 -664,546 -125,129 -102,238 -519,631 -504,49 -344,420 -164,802 -676,649 -372,191 -525,403 -549,739 -1203,368 -1257,659 -589,253 -813,119 -271,256 -842,5 -229,204 -579,476 -264,831 -987,549 -547,501 -22,497 -785,851 -1001,32 -574,299 -1053,329 -760,82 -885,569 -728,299 -171,189 -892,329 -939,614 -566,42 -385,277 -1039,256 -355,519 -1091,501 -7,245 -879,103 -932,632 -242,114 -639,568 -562,673 -763,448 -1019,267 -537,500 -1033,658 -141,311 -1273,36 -8,546 -1163,36 -1193,836 -124,767 -381,683 -431,103 -1186,637 -823,337 -647,355 -1303,245 -167,1 -291,582 -1227,304 -636,799 -1201,396 -490,810 -828,322 -254,819 -1037,737 -633,861 -467,831 -129,267 -721,701 -1057,89 -565,390 -89,614 -738,567 -858,575 -68,866 -1125,637 -1143,893 -1151,324 -1197,675 -729,502 -418,565 -617,484 -75,194 -1129,852 -900,119 -1014,567 -436,122 -1171,749 -1156,147 -1019,806 -55,277 -299,459 -1223,252 -714,28 -415,869 -820,540 -1302,348 -868,331 -514,649 -843,491 -579,253 -6,33 -843,281 -80,694 -487,754 -1062,108 -964,57 -1197,824 -261,120 -1026,525 -763,9 -223,551 -420,389 -1049,54 -987,793 -396,642 -704,555 -1125,201 -843,831 -1014,193 -433,207 -1056,187 -244,810 -873,11 -1054,45 -651,109 -1169,481 -1109,17 -1208,154 -393,120 -219,816 -315,560 -1283,211 -67,351 -875,78 -1183,885 -952,74 -581,805 -726,290 -410,819 -460,701 -1059,855 -641,102 -959,189 -765,95 -1146,707 -365,129 -1093,771 -107,672 -1066,103 -909,54 -214,163 -1171,613 -223,835 -634,245 -714,476 -693,484 -912,45 -328,411 -13,624 -982,483 -310,868 -875,841 -618,163 -646,348 -70,221 -311,466 -818,536 -187,319 -1201,347 -711,763 -453,877 -45,758 -1154,68 -763,226 -1096,549 -507,484 -94,140 -403,476 -1160,581 -574,694 -365,186 -289,129 -770,448 -914,642 -1166,431 -1198,18 -338,367 -714,866 -813,718 -748,221 -676,21 -256,45 -601,235 -425,164 -840,798 -1134,385 -1303,26 -472,127 -639,774 -716,526 -930,82 -795,145 -219,91 -1198,94 -726,738 -800,711 -711,234 -32,768 -540,448 -214,184 -253,854 -311,428 -495,1 -1084,388 -674,799 -237,189 -43,410 -641,494 -1243,543 -201,115 -1181,627 -611,619 -256,449 -1096,688 -976,481 -331,101 -729,306 -545,498 -694,351 -811,114 -561,565 -65,232 -686,690 -445,861 -967,550 -164,84 -89,602 -182,767 -1076,617 -415,421 -113,614 -691,358 -1059,476 -639,858 -372,703 -619,806 -269,603 -902,791 -676,425 -979,793 -309,144 -562,561 -721,698 -1266,367 -1203,526 -305,294 -164,757 -1295,36 -1178,457 -1170,649 -472,15 -939,36 -959,511 -358,820 -718,159 -1039,579 -22,49 -541,518 -172,217 -239,252 -1034,507 -971,784 -1056,299 -836,588 -21,871 -872,28 -1033,600 -17,526 -530,189 -60,78 -273,737 -1307,505 -1297,102 -1019,582 -1310,185 -766,427 -1006,621 -577,281 -1267,410 -979,225 -572,567 -826,826 -542,793 -403,418 -253,812 -268,812 -1223,865 -909,406 -945,129 -875,526 -714,812 -140,245 -271,315 -572,119 -677,871 -987,221 -656,857 -482,665 -387,656 -1275,88 -109,347 -700,238 -125,555 -157,176 -875,53 -387,238 -483,562 -1297,400 -117,800 -361,86 -181,368 -73,406 -632,206 -393,568 -180,451 -485,268 -437,323 -57,110 -1265,136 -530,637 -311,596 -811,780 -221,560 -554,282 -909,530 -1171,281 -438,28 -261,840 -677,182 -150,810 -909,651 -1038,772 -16,219 -284,525 -1007,63 -634,649 -319,362 -565,292 -440,184 -1005,525 -1064,747 -335,691 -828,229 -659,785 -398,45 -952,372 -917,120 -1139,705 -440,94 -82,327 -144,183 -584,290 -1230,136 -589,641 -739,590 -246,147 -828,665 -1294,250 -43,843 -276,387 -1267,51 -1273,410 -781,555 -677,861 -870,294 -253,840 -693,17 -331,345 -768,262 -70,177 -67,543 -97,690 -16,250 -525,851 -252,180 -1002,463 -13,326 -277,294 -103,768 -589,876 -1288,245 -827,637 -253,581 -525,715 -725,504 -467,145 -1256,346 -164,309 -917,326 -244,119 -900,551 -647,474 -537,782 -1094,203 -22,245 -937,403 -219,803 -1146,309 -841,201 -144,887 -1006,721 -1123,319 -11,224 -425,690 -962,628 -170,696 +[[[10],7,3,[[6,4,4,1],[],[2,6,7,10]],6],[]] +[[2,[3,5,[8,6,7,1,9],[6]]],[[4,2,10],[],[[8,5,5,9],[7],5],[],9]] -fold along x=655 -fold along y=447 -fold along x=327 -fold along y=223 -fold along x=163 -fold along y=111 -fold along x=81 -fold along y=55 -fold along x=40 -fold along y=27 -fold along y=13 -fold along y=6 \ No newline at end of file +[[[8,6,4],[6,6,[4]],[10,4,5,[0,3,3,6],[2,9,4]],[0,[4,5,9,1,4]]],[8,1]] +[[6,[10,0,9],[[1,3,7,1],[],[],[9,8,2,5]],[2,[3,3,0,0],[10],6,1]],[7,[8,[9,3,8],9],[[9,7,1,2,4],[6,7,9,3,0],4,[7,9,0],10],1],[[1,0,[3,6,7,9,6],[0,3,10,4,6],[8,1,10,2]],[],[3,[3,5,5],[]],[[1,1],7,2]],[[9,[],[]]],[[[0,5,9],[4,3],[10,10,3],2],[1,[0,10]],9]] + +[[[],[1,9,6,7,7]],[6,[[4,2],[2],2,[2,3,8,10,1],8]],[[[3,8,1,10],[7,5,2,5,3],3,3,5]],[9]] +[[],[[9],[5,8,[10,3],7,7],6,[2],[]],[1,10,[0],[8],7]] + +[[[7,1],[[1,7,8]]],[[3,6,[9]],6,8],[[[5,8,9,10],[5,6,0,4,6]],9]] +[[7,[[8],[3,7,8,1,3]]],[[1,[1,2,3,5,1],1,[9,2,0],[8,8,9,7]],[1,8,[9,0]],[],[],[10,[10,8],4]]] + +[[9,[[10,2],7,3,3]]] +[[1,4,[],4,[]],[2,0,[0]],[[[8,9],[6,3,4],[9,7]],[[],[7,8,7,6],9,5],4,0],[],[]] + +[[[],[[7,9,4,1]],[],[[2],7,[5,9,5,1],10],8],[[7],[[8]]],[2,10,[],[[4,7],6,6,4]],[2,[7,6],4,[9],[1]],[7,[[2,5,7,6]],[[10,10]],[1,3,9,[0,7,1]]]] +[[0],[]] + +[[],[[[],[10,8],[2,7,2,9,10]],3,[4,[0],[8,6,1]],[[9,0,6,3,2],[1],[]],1]] +[[2,[[6,9,8,1,10]],1,10],[[[6,0,2,8,9],[6,7,5,7,3],0]],[[4,8,[3,9,10,5,8],1],10,7],[[[1,7],[7,0,1,4,2],3],1,[[1]],8]] + +[[6],[[[],2,[],8,[5,7,1,0,0]],0]] +[[3,6],[0,[],8,[[],0,3,1],5],[[[8,0],[2,3],5],[[6,3,1],2,9,7,1],[7,6,[1,0,2,6],10,5],[5,[0],5],[2,[1,10,4,8],[10,4,1,3,10]]]] + +[[8,8,[[5,8,2,4,4]]],[],[2,[[2,4,1],2,5,9,9],[[0,0,8],[1,4,1],0,6,9],[],[]],[10,3,[[0,10,9],[3,5],[2,9,8],[8],1]]] +[[[0,8,2,[0,6,0,3,8]],8,[[0,5,4,0,1],[4,4,5,1,2],6],1,[7,0]],[2,3,7,10],[0,7,6,5,[1,[8],[9,7,4,7,9],5,0]]] + +[[[],[9,[1,8,2,0],9,[4]],7,1,[]],[[3,2,7,5],[[0,3]],[10,[4,7,6],[10]],[10,[2,4,0,3,8],[9]],[[3,3],4,[],5,1]],[[1,7,7],0,[1,5],[]]] +[[[],[],[[],[4,1,7,7],2,2,5],1,9],[8,7,10,[[1,9,9,7],2]]] + +[[],[[[4,6,1,0],10,10,8]],[[8,[10,8,9,0,8],[1,10,10,7,3]],2,4,3]] +[[[[],7,0],4,[2,[5],[8,2,1,6,9],[0,10],4],[[7],8,[],4,[6,2,10]]],[6,7,[[],1,[8,9,3,9],[9,6,5],[10,0,8,9]],7,[1,4,1]],[]] + +[[5,4,[5,[1],[7,7,6,2],[1,8,4],[]],1,[[2,3,5,6,7],[10,4,10]]]] +[[10,[[3,7,6,0],9,9,5],7],[[0,9,[2,3,2],[4,5,0]]],[7],[4,[[5,3,8,0],[10,4,4,4,10],[5]]]] + +[[0,[[],3,10,6,[8,8]],[0,[1],8],6],[[5,9,[],0,[5,8,4]],[[],1],[[7,3,7,0,9],[1,7],[5,2,9],[]],[3,[7,8,2,3,2],[3,10],7,10],[3,[2]]],[3],[[2],5,[],[9,[0,0,8,5,0]],[]],[[1,[2],[1,4],4,[2,1,9]],0,2]] +[[],[8]] + +[[6,[1,5,[8,6,6,10],3,5],10,6,9],[[7,9,1,[5,3],[1,7,10,3,4]],[[3,3,1,2,0]],[[8],[1],[3,1,6,10,0],3,8],10,[7,[2,2,3]]]] +[[9,[[1,8,2]],3,7],[[[3,7,9,2],[8,10,0,5,7],2,10],[[7,7,7],0],2,10],[],[[],[0]],[10,4,5,[2,7,[5],0],3]] + +[[[3,[8,2,2]],3,7],[6,[[10,1],[3]],0,2],[],[0,4,[],2],[2,[9],[4,[5,7,5,7],[0,6,1,9,10]],[[10],[10,3],3,10]]] +[[[[0,8,0,5],[2,0,6,9,9]],[[8,1]],[[],[2,4,3]],0,[0,2,[]]],[9,[1],[]],[[]]] + +[[3,[9,9,[9,6,6,2],[]],[3,[5],[4,7,7],[10,5]]],[[5,5],[3],1,10],[]] +[[[[],8,[3]]],[],[],[10,[6,6,[7,8,6],2,7],[8,[1,0,10,4,3]],[[9,0,4],4,[10]],[3,[2,7],[5]]],[9,0,[[0,4,5,2,9],[10,2,8],4,7,7],[0,1,4,[],[4,6,4,3]],[]]] + +[[[[],[7,3,7],[1,2,4,3,3],[1,2],[3,10]],4],[[5,[10,3,2,2,8],1,[7,2,3,0,2]],9,[[10]],[]]] +[[[[6,6,5,5,3],[10,7,5],3,[8],0],7],[],[],[],[]] + +[[0,0,[0,10,5,[9,5],3],[[5,5,2],[]]],[[[8,10,4,3,3],3,5,[10,5]]]] +[[[8,7,9,8]]] + +[[[[],[9,4],[4,5,6,5,4],[2,5],[8]],[2],10,3,[6]],[8,[[6,4,8,3,7],1,[7,1,8,0],6,4],7,9,9],[[[9,4,4],6,[6],[9,8]],4]] +[[4,6,[[6,5,1,9]],8],[[[10],[9,9,4],3,[9,3,4]],[],[[7,9],6,5]]] + +[[10,8],[[5,[]]]] +[[[8,10,6,[6,2,0,10]],9,3,[]],[[[9,7,8],1,[],1],4,[[1,8,7,0,4],[],[],[]],0]] + +[[[[8,8],[2]],[[3,1,8],[10,1,3],[],10,[7,0]]],[]] +[[[10,[8]],[[8,0,8],3,5,1],[4,[0,3,10,8,9],[0,3],[8,8,5,7,0]],[6],1],[[[7,0],4,[7,6,3,10],4,[8,10,8,9]],[0,9,1],[],0]] + +[[]] +[[3,[5,8,[10]]],[7,8,7,[[7],1,2,[4,6],3],[1,[],[]]]] + +[[0,10,[9,4,[]]],[[10,[1,9],6,[8,4,8,2,4],[7,10,2,5,2]],[0,8,2]]] +[[10,[],9,[8,1,[9,9,6,7,10]]],[],[9,7,[[5,1,3,7,3],2,[9],[2],2],[[0,10,2,7,9],1,[6,4,8,4,7],1,5]],[]] + +[[[9,6,0,1,4],6,7],[[],4,[[5,8,9,7]],[[1],[3,7],[0,9,6,1,7],[9],9]],[0],[10,3],[[[10,10],1,[0,3,8],[4,9,7,2,2],[6]],[[5,8,0,9]]]] +[[[[3,9,7,3,5],1],[[0,7,6,6,1],6,2,[6,8,9,1,6],[8]],[[],[10,1,1]],[[5]]],[10,[2,[],[5,6,0,4,10]],[],[],2],[[6],[[8,3,6,5,1],[5,2,5,6,4],5,[3,1,5,2],[2,0,6]]],[[[],[4,0,4]],5,[[9,10,6,7],3,[0,2,10,0],[9,7,8,2],[9,4,9,2]]],[[],9,9,[],[]]] + +[[[]],[[0,[9,6],10,[]]],[[],[[7,1,0,4,6],[3],5,6],[5,[3]],[0,[2,1],2],9],[],[2,[[6,8,4],[]]]] +[[[[2,5,8],1]],[],[4,10,[[8,5,0,2,0],[8,7,0],[1,5,2],[],[6]],0,[]],[[[9],[8,7,7,5],[],[6,7,8,4,6]],[],7,[1],9],[[[2],[7,1],[7,4,9]]]] + +[[[],3,[[0,5,0,9,1],[5,0,5,9],3],1,[[7],[10],4,[1,6,0,5],[3,3]]],[],[1,[[4,3,5,1,2],6,9,5]],[[[4,0]],[[6],6]],[[[1,1,0,10],[2,8]],3,[2,[4,7,10,8,10]],[8,[6,4,8,3],7],[[2,6,5,6,10]]]] +[[[[8],[1,1,5,10,10],[2],10,[5,9,6,8]]],[4],[[],3,[8],7,[4]]] + +[[],[[10,[1,9],4],[4,0,4,4,3],[1,9]],[7,5],[5,[[7]],[2,7,[6,2,8,3,9],[]],[[5,3,6,2,10],6],[[7,4],[0,5,3],[],3,[9,9,2]]],[[[6,2,5,3],2,[9,0,8,7],[10,9,5]],9,4,4]] +[[10,6,8,3,[[4,5,10,10,6],7,[3,4,3,10,3],[],8]],[[[2,4],[8,9,5,7,1]],[],5],[]] + +[[[[4,5,3,10,5],[],[],[2,10,0],[8,5,7,9]],[],8],[2,[10,[4,5,9,6,0],[],0,[]],10,1]] +[[[5,[9,1]],[7,[1,5,8,3]],1,[0,6,[6,8],3]],[1],[[4,5,[1,5,1,10,0],2,[5]],10,[9]],[[],[[],9],6,[[10,1,1,1,7],6]],[6,[[7,7,2,1,10],0,9,[0,5,9]],6]] + +[[[6,[6,5,4,4,6],2,9],[[],[]],1,[1,6,5]],[],[[[2,3,1,10]]],[[]],[9]] +[[[7,[5,0],5,[3,0,7]],[8,[7,7,2,0],6],[]],[],[],[[],[[4,0,9]],4,5],[4,5]] + +[[[6,[6,3],5,[5,3,0]],9]] +[[],[[[0,6,2],[7],[4,8,4]],6,5],[[[]]]] + +[[3,[9,6,9,[2,5,1,3]]],[8],[9,[[9,10,7],[9],[3,6,10]],4],[3,[[],[8],[5,5,2],[3,1,8]]]] +[[[9,0,8,[5],9],2]] + +[[],[4,[4]],[[[],[],4],[0,[3,3,2,8],6,[]]],[[[9]],[4,0,[9,0,9],[7,6,8,4]],[1],[9,10,1,[5,4,2,7,7],[3,3]],[]]] +[[],[4,[1],[[0]]],[[[2,0],[],7],[[],5,[0],8,7],1]] + +[[[3,8,[10,6,6,1],9],6,[],7,8],[1,[2,9,0,2,[]],[10,9,3,[8,3],4],2,[[0,8,8,2],0,4,[5,7,5,0]]],[[2,2,3],9,3],[9],[[]]] +[[[9],3,7],[],[8,6],[]] + +[[[8,4,4,10],0,9,0],[6,[[]],1,7],[[[9,8]],4,[3],[]],[7,9,[9,[3,5,9,3,3],2,[5],2]],[[6,[7,5],[4,9,0,4]],7,9,[8,[10,6],8]]] +[[],[6,[[5,1,0],1,8],4],[6,7,[[5,9,3,9,5]]],[4],[[[],10,3]]] + +[[9,[7,[8],[5]]],[10,2]] +[[[[8,3,3,4,3],8,[4,5,8,2],9],8]] + +[[10],[[4,5,3],[[7,8,4,2],6,[5,7,2],[9,6,8,5],[4,7,7,8,9]],[3],7]] +[[2,1,[4,[4,2],[]],[[],8],1],[[],[[6,2],6,[3,0]],[[4,2,6,8],6,5],1,[9]],[1,10,6,[[2,4,2,2,3],[8,7]]],[2]] + +[[1],[[[],[],6,5],6,[5],6],[],[[4,5,6],[]],[10,[[0],[8,7,2,10],5,8],7]] +[[[2],5,0,2],[],[0,2,0,9,9],[5,0,6],[9,8,[]]] + +[[1,4,[2,3,[],7]],[[3,5,5],8,1,[6,7,[7,4,4]]],[6,2,3,[],5]] +[[6,[[0,2,6,1],5,[],[1,3]],2,[8],3],[]] + +[[8],[[],8,4],[]] +[[0],[],[[1]],[[],[[4],[2],[9,5,0,7,8],10,1],[[0,8,6,6,1]],[]],[]] + +[[4,4,0],[[[1,5,4]],[],10,[[10,7,10],7,[7],6,[10,7,2,5]]],[[9,[6],10],9],[1,[[8,6,0,8,10]],7,9,[[1],[6,6],[7,4,5,0,2],[2,9,4,7]]]] +[[7,[[0,7]],[[10,3,9],[10,7,0,7,7],[6,0,0,7,0],0,4],[9,7,[8]],[1,[5,10,0,9],0,[0,5,1],8]],[0,7,[[1]],[9,7,4,2]],[]] + +[[2,[[2,3,6,0]],[6,2,0,5],[[6,5],6,8],10],[],[6,[[2,3,0,6],[7,10,6,0]],[1],[[5,9,4,4]],[[2,8],[5,5],[3,0,10,8]]],[3,[4,[],[6,4],[7,2,2,9,9],[6,6]],7,2,6],[6,[[2,8],[]],[[4,9,0,1,7],0,3],5,[[9,1,4,2,1],1,[10],4,[6]]]] +[[7,[[4,9,1,8,0],[4,9,10],[8],7],[3,[],8,2]],[]] + +[[[[],[],[7,9]],[4,10,3,[2],4],[1,1,[4,9]],3],[[],[[9],[],3,[5,9]],0],[[[2,5,10],[4,5,10,8,7]],2,[[8]],[0,[6,8,0],[10,2,2,3]],[]],[[0,[3,10,8],[8,7,8,2]],2,5,[4,[5,0,6,5,3],2,7]]] +[[[9,9,8,[7],[]],3,[[3,2],[2,7,3,0]]]] + +[[[[8,9,0,10,0],4,[3,9,2],7,1]],[],[1,[2],6,[]]] +[[],[[[0],[7,5,9,2,8],[],10,10]],[[[6],4,[],[],[4,9,3,5,2]],[[0,6,4,10],[5,2,3,4,2],[7,1],[7,7,0]],[[3,0],7,6]],[9,7],[3,1,[],[[]]]] + +[[2],[[],[3,2]]] +[[10,[[3,5]],[[],[7],2,2,9]],[[[0,6],10,[],[4,10]]]] + +[[8,[[1],2,3,2],4,10,[[10],[6],[0,1,0,10]]],[5,[5,2,[0,1,0,3,2],4,3],[5,0]],[4,[[1,5,6],[5,8,7,7],[5,10,3,0],1,[4,5,5]],[[4,6],0]],[5,2],[0,[6,6,[5,0],[5]]]] +[[[[]],10],[7,[10,[5],[7,4],[2,2,9],3]]] + +[[5],[],[[[7,9],1,3]],[[[6,6,7,7]],[[8,8,4,5],8,[3],[5,7,7]],[0,[2,1],2,[8]]]] +[[[[10,5,10],[0],9,[2,8]],0],[[[6,7,10,1,1]],[[6,6,2],10,1,4],2,[[8,6,1],7,4],[]],[[4,[3,2,8,5,1],7,0],[1,[9,6,0,5,0],[9,5,9,2,3],[5,2]]],[0,6,5]] + +[[],[1,[[],[4,8,6,4,6],0]]] +[[],[[],[5,[8,6,5,8,8],10],[]],[],[5,7,[]]] + +[[2,[[3,10,1,0],9],10,[4,4,4,[6,8,3,0,5]]],[7,7],[[[1,9,4,4,0],[5],[3],[8,0,0,0],1],5,7,[[3,5,10],5,[10,10,8,10],3],4],[[[8,7],10,6,[0,3,10,3,5],9],[[4,6,5,8],1]]] +[[[],7,3,5,7],[[3,2,5,[6,7,0,3]]],[[[2,9],[],5,[],9],[5,0,[7,10,9,4]]],[[[1,4,10,9],9,10,[9,2,10,6],3],2,[9],3]] + +[[[[2,3,0,10],4],9,[2,[],8],[3]],[],[2],[0,8]] +[[[[6],4,1]],[7,[0,[2,0],[]]],[6,[[8],[3,5],1,[3,10,1,9,8],6],5,[0]],[[[3,8,9,0],[10,6,4,7],0,8]]] + +[[2,[[5],10,[2]],[[5,0,10,5,3],[],[6,0,1],[10,10,9,0,5],0]],[[8,9,[2,5,9,6],[0,10,8,7],7]],[4,1,6,10,3],[]] +[[4]] + +[[6,[[9,5,4,2,6],[2],2]],[],[[6,8,1]]] +[[[7],8,[8,[1,2],[5],[9,0,3,6]],[[],[2,4],[8,9,1,7],7,10]]] + +[[[8,8,[9,0,8]],[]],[[10,0,3,9]]] +[[6,[4,[8]]],[[[10,1,2],[6,7],3],6,[[10,7,0,7,0],[8,5],[3,3,5,2],[9]],[[4,0,0,9,10],[0,5],1,[7,0,8,6]],9]] + +[[],[[3,10,[8,5,0,1,10]],[[],1,6,[0,10]]],[[[4]],[[7,10,1,2],5,[],[6]],7]] +[[[7,3],1,[[4,0],[8,2,6,2],[2,7,10,9],[2,1,3,3]]],[],[[9,2,[8,5],[2,0,2,0,3]],[[1,3,1,10],[],[2,7],[0,9,2,3]],[9,[7],[],7,[5,1,9,0]]]] + +[[[5,7,10],[],[],1,[0]],[[],[[3,7,5,6,8],[],5,8],7],[[1,[8,0,4,3,8],[7,4],[6,5,10,2]]],[1,3,10,[2,[0,8,8],[1,0,9,1,8],[6,4],[9]]]] +[[[],[],2,9,[[6],8,[5],9]],[[8,[4],[9],[3,9,9]],5],[[3]],[[[7],10,[9,3,4,2]],[3,5],7]] + +[[[5,9,[2,0,10,9,9]]],[4,0,[[1,0,3]]]] +[[[3,8],1,3,[3],10]] + +[[9,[],[4]],[7,6,[[3,7,1],[1],[],0],[9,7,[3]],[0,[6,5,10,3,0]]],[],[],[[4]]] +[[2,8,[1,0,[],[4,5,7,4,6],5],5,[]],[[[8,8,10],4,[5,7,9,8,1],[]]]] + +[5,1,4,5] +[5,1,4,5,3] + +[[[[10,9,8],[],4,[5,0,8,0,2]],[[1,0,1],[8,4,8,10,10],[5]]],[2,2,[],[[1]]],[[10,8],[[1,1,1,10,5]],8,6,[8,0,2,0]],[[6]]] +[[9,[1,4,[6],[],[8,0]],[[3],[6,10,8,2]],[9,4,6,[]],7]] + +[[3],[[[3,8],[2,8],[4],2],4,[],4,[[],8]]] +[[0],[[3,[1,4,2,5,5],9,2],3],[]] + +[[[[],10,0,[8,3]],[],1,[[6,0]]]] +[[10,9],[],[[[9,8],0,[4,9,3]]],[[8,10],5,[10],[4,[9,7,8,6,2],2,3]],[]] + +[[[1,[0,1,3],[0,6]],[3,[0,6,4]],10],[],[9,[[8]],7,[]]] +[[0,[],7,6,[5,[4,10]]],[10],[],[0,1,2,7,9]] + +[[[[3],2],6,5,4],[4],[1]] +[[],[[[8,5,5],6]],[[2,5,2,[5,7,2]],8,4,[0,1],[7,[6,3,10]]],[],[0,[],[[0,2],[1,2],1,[10,6,6,10,3],[10]],[3,[4,1],[3]],[[7,7,5,3,10],[8,3]]]] + +[[3],[]] +[[6],[[[4,3,3,3,6],[3,4,6,4,9],9,[0,2]],[[8,2,5,9,7],[],10,[]],[]]] + +[[6,[3],4,6],[4,[]]] +[[[[4,10,9,2],10],[]]] + +[[8]] +[[8,2,[1,[4,9,10,1,1],[6,8,1,2,0]],8,[8]],[6,10,[8,6,[3,9,4]],10,0],[[[7,5,3],0],2,[10,8,[8],5]]] + +[[[[6,8,8,7],3,[3,5],1]]] +[[7,9],[[[],[],4],[0,6]],[],[[[],[8],9],1,9,8,[[9,7,8,7]]],[]] + +[[6,2,[10],1],[]] +[[[[4]],5,8,[[],1,[10,9,3,1],[2,1,6,7,3],[]],[[9],[1],[7,4],[8,6,10,3]]],[6],[],[],[9]] + +[[[8,8,[8,4,1],6,[0,4]],6],[[7,6,[0],6]],[[[7,10,10,6],[8]],[1,4,[2],[7,1,1],0],7,7,9],[3,[10,[8,8,10,1,3]],[[6,6,1,5,4]],10],[6,4,7]] +[[9,4,[1],3],[1,[],[],2,6],[[[10,8]],5,[5]],[[10,5,2],[0,[9,8,3,2,6],4],[3,6,[0,6,4,7],[7,4,10,6,3],[]],[[],3]],[5,6,[10],1,0]] + +[[[6,2],9,2,3],[],[],[3],[3,10,[8,3,3,5]]] +[[],[],[[7]],[]] + +[[[9,6],[[8],[9],[7,2],2,7],3],[2,7,2],[8,2,[3],[0,[9],[10,8,7,3],[8,10,7,7,4]],[]],[[9,[9,7,9],[1,7,2,0],10,[4,9,8,10]],2,[[5,2,6,7],[6,7,6],[2,3],[6],[7,2,5,3,4]]],[[[2,5,5],6,[]],5,10,0]] +[[0,8,10],[7,[6,[4,1,5,8]]]] + +[[2,[[5],[6,2],[4,2,6],8],5],[[[8],8,5],[4,5],8,1,8]] +[[[[0],9,[5,5,6,6],[7,9],7],[[],1,0,4],[4,[],2,1,[4,0,1,10]],1,[]]] + +[[[4,2,[6,1]]],[8]] +[[5,9],[[[10,3,1],5],[8,[1]]]] + +[[[9],5],[]] +[[[],[10,9,3,[]],[[6,7],[10,2,2,7,4],[1],10,[5,0,3]],2]] + +[[2,[3,8,[0,5]],[10]],[6,7,9],[4,[],[8,0,[]],[[6,2,5,2,2],[2]],9],[[[7,10,9,8],[1,5],[2],0,5]]] +[[[[6,2,5],8,10,10,[8,5]],[]],[[0],[2,[4],9,1,[1,1,3]],10,[[5,2],[1]],[7,8]]] + +[[],[7]] +[[[[9]],2,[[10,1,0],2,[1]],5]] + +[[[],6,[]],[],[9]] +[[3,[3,1,[5,0,0,6],[]]],[0,[[],6,8,[3],[3,3,1,3,6]],2]] + +[[],[[[6,3,8,5],3,[0,7,5,6],0,9],[8,10,0],2],[0,[[6],4,8,[5],1],0],[[]],[[[10,2],[8,0,7],[]],[],[[7,3],[7,3,1],[5,4,6,5,7]],[[3,2,10,8],0,[9,10,10,9,7],[9,10,8]]]] +[[2,[[10,3],10,[]],[[5,10,9,9,2],10,9,8,5],[[5,3,7,5,2]],[8,[],[7,2,2],[],[9,4,2,3,0]]],[[[7,0,10,9],2,[4,6],5,[10,9,0,1]],8,[[10,6],5,[3]],[[7,0,10,4,4]]],[[],9]] + +[[],[0],[[[8,10,5,7],[],[6,9]],3,9],[[]]] +[[],[1,[0,8,[],9],3],[[6,1,1,[2,9],4],[],[4,4],[4,[4,2,5,5],[1,0],[6,8,1,4,10],[6,9,5,4]]]] + +[[],[[[8,7,6],5,4],[1,[9,2,1],[7,6,0,5],5],9,[]],[7,[]],[0,8,[[],3,8,10,[10,8,7]],[0,[1]]],[[1,[5],[5],10,3],4,[5,[4,4],10],[[0,6,10,3,8],4,1,0,[6]]]] +[[],[],[5]] + +[[6,[2,8,6,1,[]],7]] +[[7,[[3,5,4]],0],[1,[1,4],[[9,5],0,[],[4,7,8],7],2,8],[[[8,9,8]],[7,0,[10,4]],6,[[0,9],[0,6,0,1,7],[0,3,9],8,[1,7,3]]],[2,[[5],[],[1,8,7,1,7],[],3],[[6,1,8,6],0,[9,4,7,5],[1,0],0],[1,6,[],[7,7,10,2,3]]],[4,6,[[],[5,2,1,0],9,2,[]]]] + +[[[4,[2,8,5,2],7,3,1],0,[],[[2,8]]],[],[[[2,5,8],0,3],[7,0,[8]],[4,[10,3,7,4,6],10],10,[[0,9,1],[4]]]] +[[7,[[]],5,[[5,8,8,4,5],1,[10,0,2]],[8]],[[[0,7,6],1,[10,9,3,8],[9,10]],1,2,[8,[5,2,7,1]],2],[0,[[5,3,2,1],0,8,[7,10]],[],[5,2]],[[4,[0,4,8,8,10],[2,2,9,10,4]],2,[[3,6,10,2],[5,10,3],0],8,9]] + +[[[],2],[],[[0],9]] +[[[7,6,2,[0,6,10,5,2],1],5,[[5,5,5,3],[9,7,3],[5,5,6],1,[1,6]]]] + +[[[5,8,[6,6],[]],9,[[9,2],0]],[[9,2,6],[5,[8],[2,2,6],[7,4,8]],9],[5],[[2,5,10,[]]]] +[[2,[7]],[[],[[0,0],[3,1,7],9,[8,9,7]]],[4,[[6]],6,[[4,5],[0,3,6,8,9],[]]],[],[1]] + +[[[[],6],7,[],9],[[[8,10,9,4,3],[0,10]]],[[],[8,4,10,[10],[0,5,4,6,7]],[7,9],7]] +[[[[8,5,4,10],[4,6,2,7]]],[4,7,[1,6,7],2,2],[8,3]] + +[[[[],1],[5,[4]],[[1],[3,2,3,1]],[1,[9],6,2,[1,9,4]],0],[0,[[],[6,0,6],[],5],0],[4,[3]],[]] +[[3,10,9,[[0],5,7]],[[[4,2],10,[5,4,6,3,2]],10],[],[],[4,[[3],6],[[0,10,2,1],[1,9,6,1,4],2]]] + +[3,9,6,3,4] +[3,9,6,3] + +[[[],3,[],[3,[8,1,7,7],4,[8,5,10]],[[3],10,1]],[[8,[0,4,0,10,6],7,[],[7]],[9,3,[4,9]],[[4,6],[7,0,0],10,7,7]],[[[2],9,10,[10,1,5,6],2]],[3,[4],0,2],[[[],[4,6],9,3,[1,9,9]]]] +[[[[]],2,[8,10,8,5]],[[3,[9,1,5,0],7,[8,5]],[1,[4,1],[],[4,10,2,8]],[[10,9,8]],5],[[4,[4,4]],6,8,10],[]] + +[[1,8],[0,[[]],[[10,5,5,1,5]],[],2],[[[],[9,0],1,[5]],[10,1,[2,2,7],[]],[1]]] +[[[[6,10,0],3]],[[[3,6,1,2,3]],[6,0,[]],[[],2,[4,7,8,7]],5]] + +[[[[6,3,4],8,4,[9]],1]] +[[[0,10,8,[10,4,5],[4,9,1,10,5]],1],[[1],9],[[4,[3],[5],6,[6,10,4]],1,10,[[0,4,5,3,6],[0],[8,5,5],[2,5,1,4,6],1]]] + +[[1],[[8,[4,6,1],4,2],[],[8,5,[9,1,3,7,1]],10]] +[[[[4,7,0],3,[5,9,6,6,10],[]],[[9],5],[]],[[4,[1,5]],[10],1],[],[],[[[4,7,1,7]],[10,[0,9,10],[6,10,10,2],3,3],8,[[],3,[9,3,1,4],9],[[0,9,4],[0]]]] + +[[1],[7,[[9,7],3,5],[[1,5,0],3,[10],[2,4],[8]]]] +[[10,2,[[0,1,3,4],[2,9],4,[4,8]]],[8]] + +[[8,[]],[[[4,4,4]],6,1,[7,4,2,4]],[5]] +[[],[4,[0,8,[6],[10]],9]] + +[[[6,[4,7],[8],[],[]],0,[9,[9,8,9,0,3],[6],[10,3,8],[8,3,1,5]],7],[[1,8,[],10],10,[[4,1,6,4],[0,5,3],7]],[5,[4,10],[4,6],0,[]],[[6,[10,3,10]],7,[4],[0,[3],0]]] +[[[[7,10,10,5,4]],9],[10,[[0,5,10,0],0,9,[10,6,1,5]],0,8],[],[[[5,6,1,1],[],4,[7,7,3,8,9]],[0,[1,2]]]] + +[[],[9,[3]],[[[],8,10]],[8,[10,[1,5,2]]]] +[[[[],[4,9],7,[4,2,4]],8,[],0,[[4,10,9,10],[],4,[6,4,5,9],[3,3]]]] + +[[2,[4,10,[10,3,10,9,10],10],4,10,[]],[],[]] +[[[1,[1,1,10]],5],[[[3,6],6,6,[6,7]],[],[],[7,[4]]]] + +[[8,9,[[2,8,6,8]],0,[5,5,[2,10,0,1],6,[4,1]]],[[[9,10]],[[],9,0,[9,8]],[],[],3]] +[[[[],[1,4,5,7],[]],[8],3,2],[[9,4,[0,5,8,2,0]],8,[6,5,1,[9,10,7],5],9],[[[7,6,4],[4],7,0],[8],[[4,1],[2,4,2,7,2],[4,6,5],5],6],[0,7],[[[]]]] + +[[2,4,[8,10,[1,0,2,7],[9,7,10,3,4]]],[],[[[1]],1,2,0]] +[[],[2,4]] + +[[5]] +[[[9,0],5,2,8,[[0,2,8],[3]]],[2],[7,1,[5,[9,4,7]]],[]] + +[[1],[[],0,[5,[],[5,7,0,2,1],[]]],[[[6,9,6],0,[],[2,4,10],[5,9]],8,3,[[2,3,4],[2,10]],[[10,9,0],[2,9,2,6,8]]],[[[10,4,7,5],7],6]] +[[1],[[],[[],2,3,[6,7,3],10],2,[]],[7],[[[10],5,[3,2,2,10]],[[3,3,0,4,4]],[[8,1,8,7,10],[8,6,9,6,9],2,[0,7,4,9,6],[3,7,0,0,3]],[],8]] + +[[4,5],[[9,0,[3,0,0],4],4,6]] +[[3,7,10,[4,9,1,0],[]]] + +[[8,3,[[7,9,9],[9,7,1,5]],[7,2,[6]],10],[10,[],[[7,0,5],[],[],2],[]],[6,[8,[2],[3,4,10],[7,2],4],[],3],[4,[6],9,[0,[4,4,1,4,7],[0],2,9],3],[1]] +[[4,[]]] + +[[[[2,3,7,8],10,[]],9,[[5,2,4]],9,[8,[4],10,0]],[[],[[7,3],7,[7,0,1,8],[5,6],7],10,[[1],[7,4,4,0,4],3,4],6],[],[5,[],[1,[6,5]]]] +[[[10,[1,7,6],8],[10,[],6,[]],8],[6],[9,[[0,6,9,3],4,[],[],[7]],0],[]] + +[[9]] +[[],[1,[[8,10,6],9,[1,5]]],[1,6],[]] + +[[[1,2],2],[[[8,7,10],0],7],[9]] +[[0],[[]],[8,[[10,7,1,5,1],9,9,[],3],[0,[8,6,3],[2,4]],1]] + +[[[10,1,9,[],[0,4]],6,9,5],[[4,[],[2,2,8,9],2,[0]]],[1,8,2],[6,3,0,[[10,10,8,3]]],[[[2,5],[2,2,0,7,4]],1]] +[[],[[]],[],[1,3],[[9],[1],7,4,[[7,7,8]]]] + +[[[6,[6,6,6,6],[3,9,7],3],8,10],[[1,8,1]]] +[[5],[],[7,7,[],9,2],[[9,[5,1,3]],[[9,6,5],[0,4],[4,7,7],[]],[[2,7]]],[[10,[10,5,10],7,[1,6]],[0,3,10,2],10]] + +[[[0,5,[4,1,2,4,0]],5],[5,[]]] +[[6,[[],[9,7],[7,0,5],[1]],[[2,1,1,4,5],[6,8],[2,4,3]]],[[9,8,[3,7,5,10,0],[7,10,9,10,6]],2],[[[8,4,1,2]],2,[5,9],[[4]],3]] + +[[[10,[4],[10,9]],0,[1,9,[10,6,5],1,[2,6,2,5]],[]],[[[],[3,4,7,5],4,[0,0,8,0,6],[]]]] +[[],[1],[[[6,0,7,9]],7,4,5,[[3,5]]],[]] + +[[],[1],[[[7,6,5,3,7],[9],[4,1]]]] +[[[[9],[]],[],[[8,10,10]],[],[]],[]] + +[[7]] +[[[],[1,[],[],[4,4,8]],0,0],[0,1],[1,[[10,7,6,8,4]],[[9]],1],[]] + +[[1,3,6],[],[],[[2,6,[2,3]],0,8,5,6]] +[[[[5,4,1]],7,[[8,6]]],[[10],[[],[8,10],3,[]],3],[4,[7,8,5,[6,5,10,7,4],[]],[[6,5,0,0,4],0,[9,9,1]],10]] + +[[0],[[[3],3,0,[7,2,4]],5],[7,5],[]] +[[0,[[2,7,4,3,9],[2,5]],[6,3,1]],[],[3],[[9,[],1,0,2],7,10]] + +[[],[[9],[[],8,10,1],[[8,5,6],6,[]]],[[[10,1,6],5,[],7,10],[7,2],[3,3,6,[8,0,7,3,3],[9,9]]]] +[[[[8],5],0,7],[2,0,5,[],4],[10,[],7,[[8,6,0],3,[9,9,9,7],5],6]] + +[[],[2,[9,9,[1,6,8,9,4],[]],6,[]],[7,[[4,7],9,[],5,9]],[2,[5]],[1]] +[[7,[4,8,[],3,[1,5,5]],2,7,[[10,1],[2,9,0,1,10],4,7,[3,7]]],[6,7,9,[[9,10,10,2],6],[[4],1]],[[8,9,[8,6,3],0]]] + +[[[[8,8,10,3,3],[6,7,5]]],[5,[[],[8,1]],[6]],[9,[]]] +[[],[]] + +[[[[5,7,8],[4]],[[8,6,10,10],[0]],[1,9]],[[10,[],2,3,[6,3,9,0,7]],10,2,9,5],[6,[0,[],10]],[],[[[3,5,7,5],[],[1,2,7],1],[0,[9,10],[4,7,5]]]] +[[[7,[9,8],[2,6,0,5],[9],[9,7]],[[7,0,0,5,10],[9,7,3]]],[[1,[6,0,8,7,7],[3,2]],10,[3,3,[8]]],[6],[9,[1,[2,8,5],2],1],[6,[[5,1,3,3,7],[],10],4]] + +[[9,7],[2]] +[[[[]]],[[2,2,5],[[6,1,1,4,9],0,6,8,4],[3,[8]]],[9,3,2,2,[0,9,9,[1,4,3,8,7],[2,4,6,4,1]]]] + +[[],[5,[5,[3],[5,10],5],[[1]],0],[[[9,8,5],10,4]],[]] +[[[6,[],[],9]],[[0,[],[10,10,7,9,7],[8,7]],6,1,4],[6,3,[7],4],[[4]],[2,[],6]] + +[] +[[],[5,[10,[1,1],[7,10,4,6],[10]]]] + +[[5,8,[8,1,[10]]],[],[7,9,[5,[7],1,[10,6,6]]]] +[[[[6,8,7],[4,5],1,8],4,1,10,3],[7,1,[7,2],9],[],[3,[[1,7,10],[0],2,[1,9,1,5,2]],[[],9,2,[]],[5],2]] + +[[],[6,[[9,3,9,6,3],[8,5],[0]],7,[]],[[]],[1,[]],[[[0,1,2],[7,5,10,10,8],[3,10,3,2]],[[5,2,10,1],[5,7,5,1,7],10],5,[]]] +[[[[10,5,5,4,10],[9],[6,10,3,7,4],[7,5,8]],[3]],[7,5,[0],[[5,0,2,10],[],5,[],6]],[10,[[10]],9,[[8,3,10,6],[0,4,9,9,9],10]],[4,[2,3]],[[[],[7]]]] + +[[[[10,9,8,8,8]],7],[7,8,5]] +[[[[10,8,7,7,1]],[7,[]],[[],[],7,4,[8,7,2,6]]],[[[2,2,7,7],6,[],7,[]],2,[1,8],10,[2,6]],[5,0,[[7,7,10,8,2],10,[10]],9],[[[7,2,3,0,6],9,[6,5,0,0,7],[9,9,1,8]],0],[2,5]] + +[[6,6],[[8,[7,8]],[[],10,0,[2,2,8]],[[9,0,6]],10],[[2,[0,6,4],[],[],3]],[[3,7,[4,8,4,2]],4]] +[[3,3,[[],0],9],[],[6,[9,[4,7,9,7],3,9,3],[]],[[3,[],[2,9,10,1,3]],[4,6],8,[8,[1,2],9,[]],[1,[3,1],[9,7,6,4,6]]],[[[5],[7,8,3,1],10,[8]],2,10]] + +[[[0,6],[[10,1,0,0],[]],[[],3]]] +[[],[7,3,[[4,6,8]],[8,[6,0,3],1,7],[[6,8]]],[1,[6]]] + +[[0,[7,5],[[],5,[8,6,5,8],0,10],[9,[10,0],5,[4,10],[7,1,3]],4],[1,[[9,7,9],8,1,7,[0,0]],[5,[10,6],4,7,4]]] +[[5,2,[],[0,8,[8,5,9]]],[],[0],[1,[[5,10,7],[5,6,7,5],[0]],[1]]] + +[[0]] +[[[[3,9],9,[1],[3,9,9,0,2]],2,[[9,1,7,0,9]],[],8],[],[[[],[],1,0,[0]],7],[9,[8,2,[7,3,1,0],[5,9,8]],4]] + +[[],[3],[[],3,4],[[[7,0]],[[9,3,6,7,3],[6,5,4],0,[2]]],[8]] +[[1,[[9,0,2,5],[5,2,9]],[[1,2,2],[2,7,2,5,5],[6,3,10,8,7]],4,7],[3],[[[2,9],4,[10]],8],[1,0,10]] + +[[[[10,0,9]]],[2]] +[[[0]],[10,2,8],[],[[[0],4,[4,7],0,9],[[1],2,[3,6,6,6]],4],[3,3]] + +[[],[3],[2]] +[[7,4,[3,[2,3,0],9],[[0,2,7,1],[9,6,5,7,2],8,[6,10,5,8,1],[9,1,7,6,5]]]] + +[[],[[],1,2,[[9,5,3,3],9,9,3,1]]] +[[[3,0],9,[3,[6,6,4,9]],[1,6,9,[8,5]],[[8,5,7,9,6],[3]]],[[8],2,[[],[6],[5,6,10,5,8],3]],[10],[]] + +[[[[7,3,9,4,10],5,9,0,[]],[],[5,0,0,[5,4,0],0],[[4,0,7],7,[10,9,1,10],[5,8],4],10],[[],8,6,10,[[0],[],[9,0],3,6]]] +[[[4,[0,6,2,5],10],0]] + +[[2],[8,[4],[],9],[],[4,6],[]] +[[[10],[4,[7,9],[10,8]],[[4,1,8,5,6]],[[8],[3,2]],4]] + +[[[[6,3]],[[4,9],7,5,1],[],[],[7,4,[7]]]] +[[[[],9,[1],[10,8,7],7],0,0,0,[[6,6],[2,10],6,[0],[]]],[[]],[[[8,6,10]],7,4],[[[8,0],[4,3,4,9],[9]],[[6,9,3,1,0],[10,0,5],[],[10],0],0,[]]] + +[[[],5,5,[]],[[3],2],[1,[[1,2,10,7,3],6],1,2,[[2,9,4,8],6,[9,0,10,8,5]]],[],[]] +[[1,0,0,3,[[10,10,10,6],[0,5,8],[3,9,9],10,0]],[3]] + +[[[],[4,8],5,6,[1,4,5,6,[2]]]] +[[[],[9,10,2]]] + +[[[[1,2,8,10,10],3,[2],[2]],8],[1,10],[8,[10,[6,3,0,1],3],[[8,10],[9,1,2,9]]]] +[[[6,[7,10],[8,9],[5],10],[[4,2]],[4,10,[9]],0],[3,[[8,10,6],[1,4,4],2,10,2],10,[7,[2],[9,1,4,4],[6,0]]],[3,4,10,6]] + +[[[[9],1]],[0,[2],[[4,0,1,5,2]],4,10],[],[[],0,5],[5,[],[2,[5],[5,1,3,7,10],4],[],[]]] +[[5,9,[9,[8],8,[2,8,9,7]],[3,[2,2,6],[8,6],1],[[6,8,4,9,8],3,6,[0,4,6,10],3]],[[[5,0,2],[9,3,1],[6,3,10],4],0,3,[5,8,[0,10,10,5],9]],[[[10]],9],[],[[9,6,2,4]]] + +[[1],[4,[[0,5,1,7],[4,7,3],[0,6,8,3,6],[4,3,6]],[],[[8,3,3,10,3],[2,5,9,1,10]]],[4,[6,2,0]]] +[[4,[[4,4],[0,3,5,9],2,[6,9,5,4,1],7]],[[[7,8],1,[8,9,2],2,10],[[]]],[[2],[1,8,[3,4]],[4,1,[6,5,7],6],[10,[4,10,0,2,9],[1,4]],[[],[2,1,0,5,1],0]],[[2,10],10],[[[],[]],5,[[],[7,9,3,0,10],3]]] + +[[[[2],[10,9,7]],0],[[1],10,2],[[10],[],3,[],[1,[],2,7,9]],[[[]],6,1,8,[[4],[],8,[10,6]]]] +[[7,0,[1],0],[[[5,8,1],0,10,10],6,[4],7,8]] + +[[1,[9,[0],[8,3]],[9,10,[5,10],[7,7,1,8],[7]],[[],[5,0,8],2,5]],[],[6,0,10],[0,4,10,[],[3,2,5]],[]] +[[10,2,4,10],[[[]],[[1]],9],[]] + +[[4],[[],6,[7,[6,10,3,1],4,[7,10,9,10]],7],[3,[4,[5]],[4],0]] +[[[[7,8,4,4],[4,1,1,2],[6,9],4],[[]]],[],[[2,[7,6],[8,5,0,4]],8,2],[[10,10],[[9],10,5,[8,1,6,5]]]] + +[[[[],10,[8,9,8,7],[7,0]],1,8,6]] +[[],[5,10,[1,[],[3,4,9,7]],6],[[[4,9,7,6],9,[5,5]],[4],2],[]] + +[[9,1,[[10,9,2,3,1],9]],[3,5,4],[4],[[[5,3,8,6,1],1,[0],[2,8,9,4],[4,2,2,6,5]],[7,[10,6,2],[1],[9]],[]],[[[7,1],[6,6,2,5]],3,3,[[2,0,8],1]]] +[[[1],[4]],[[8,7,3,[0,9,0]],[]]] + +[[[],7],[[],6,[0,[4,4,3,5,3],4,[]],4,[[4,4],[1,1],2,0]]] +[[],[4],[5,3,[2,[10]],[[5],[7,4,1,6,10],2,8,[1]]],[[5,4,5,[],[3,8]],[]]] + +[[[[9]]],[],[9,[8],8],[[7,[],4],8,[[],1,[0,4,7],[3,10,6]]]] +[[9],[5,[6,7],1,7],[[[0],9,1,[]]]] + +[[[],[[5,7,2,5],[4],[9,2,9,7],1,0],[3,[8,10,8,1,9],9,[9,6,8,9],[]],1,7],[[9],6,[],8],[[6,2,[6,2,10,8,4],8,[10]]]] +[[],[],[]] + +[[5,[[6],[9,6]],[[4,8,8,5],[],1],[[4],[5,5,2,0,2]]],[10,[[1,5],[8,7,9,9,7],[]],[[1]],[[10,10,0,1],[1,9],[1,4,4],6,1]],[],[6,7,[5,[9,4,10],[1,1,1,5,1]],9,6],[]] +[[[[5,3],2],[3,[0,1,6,4]],4,[[0,5,3,8,9],[0,0],[5,9,2],0,[5,2,3,6,5]]],[[],[[9,7,4,2,3],9],2,[6,10,[4,0],[1,0,8,7]],6],[9],[[[4,4],9,[5,6,4,1],[0,2,1]],[5,[4,8,9,6,2],[0,1,8]]]] + +[[3,5,6,8],[3],[[[7,2,7,5,9],[2,7,10,4]],1,6],[7,[[5,3,2,0,0]],[9],6]] +[[[3,2,6,6,1],[0,10],[7,[]],2,2],[],[]] + +[[[7,[7,2]],[9],[2],8],[],[[9,[1,4],[8],6],[3,3]],[[[6,9,4],[10],3,[8,10,4],1]]] +[[[2,[],4,10],5,[5,[],[5],7,9]],[[[7,1,9],6,[7,10,6],10,2],[[5]],[[4,4,9,4,7]]]] + +[[],[[0,4,[8,3,4,8],5,2],10,5,[10,8,3],3],[5,6],[8,3,[[3,7,3,1,5]],[]]] +[[[],4,8,8,4],[[8,[5],[5,10,0],[1,6,9,0,7]],[[],[5,10,7,4]],[],[[5,8,9,4,7],[7,3,10,7,8],[],[0,2,8,9]]],[[5],3,4],[[[8]],5]] \ No newline at end of file diff --git a/inputs/13a.txt b/inputs/13a.txt new file mode 100644 index 0000000..b3a0472 --- /dev/null +++ b/inputs/13a.txt @@ -0,0 +1,23 @@ +[1,1,3,1,1] +[1,1,5,1,1] + +[[1],[2,3,4]] +[[1],4] + +[9] +[[8,7,6]] + +[[4,4],4,4] +[[4,4],4,4,4] + +[7,7,7,7] +[7,7,7] + +[] +[3] + +[[[]]] +[[]] + +[1,[2,[3,[4,[5,6,7]]]],8,9] +[1,[2,[3,[4,[5,6,0]]]],8,9] \ No newline at end of file diff --git a/src/13.cs b/src/13.cs new file mode 100644 index 0000000..6cf63f1 --- /dev/null +++ b/src/13.cs @@ -0,0 +1,209 @@ +using System.Text; + +namespace aoc2022; + +internal class Day13 : Day +{ + abstract class entry + { + } + + class packet : entry + { + public packet(params entry[] _entries) + { + entries = new List(_entries); + } + + public readonly List entries; + public packet? parent; + + public override string ToString() => $"[{string.Join(",", entries)}]"; + } + + class entryint : entry + { + public entryint(int _num) + { + num = _num; + } + + public readonly int num; + public override string ToString() => $"{num}"; + } + + private readonly List<(packet, packet)> packets = new(); + internal override void Parse() + { + packet? one = null; + packet? two = null; + foreach (var line in Util.Parsing.ReadAllLines("13")) + { + if (string.IsNullOrEmpty(line)) + { + continue; + } + + if (one == null) + { + one = parsePacket(line); + } + else if (two == null) + { + two = parsePacket(line); + + packets.Add((one, two)); + one = null; + two = null; + } + } + } + + private packet parsePacket(string line) + { + packet? curr = new(); + + StringBuilder sb = new(); + for (int i = 1; i < line.Length-1; i++) + { + var ch = line[i]; + switch (ch) + { + case '[': + packet embedded = new() { parent = curr }; + curr!.entries.Add(embedded); + curr = embedded; + break; + + case ']': + if (sb.Length > 0) + { + curr!.entries.Add(new entryint(int.Parse(sb.ToString()))); + } + + sb.Clear(); + curr = curr!.parent; + break; + + case ',': + if (sb.Length > 0) + { + curr!.entries.Add(new entryint(int.Parse(sb.ToString()))); + } + + sb.Clear(); + break; + + default: + sb.Append(ch); + break; + } + } + if (sb.Length > 0) + { + curr!.entries.Add(new entryint(int.Parse(sb.ToString()))); + } + + return curr!; + } + + private bool? isValid((packet, packet) pair) + { + for (int i = 0; i < pair.Item1.entries.Count; i++) + { + if (pair.Item2.entries.Count <= i) + { + return false; + } + + var left = pair.Item1.entries[i]; + var right = pair.Item2.entries[i]; + if (left is entryint li && right is entryint ri) + { + if (li.num < ri.num) + { + return true; + } + + if (li.num > ri.num) + { + return false; + } + } + else if (left is packet ll && right is packet rl) + { + var valid = isValid((ll, rl)); + if (valid.HasValue) + { + return valid; + } + } + else + { + var one = left as packet; + var two = right as packet; + if (left is entryint ei1) + { + one = new packet(ei1); + } + else if (right is entryint ei2) + { + two = new packet(ei2); + } + + var valid = isValid((one!, two!)); + if (valid.HasValue) + { + return valid; + } + } + } + + if (pair.Item1.entries.Count < pair.Item2.entries.Count) + { + return true; + } + + return null; + } + + internal override string Part1() + { + List validIndices = new(); + for (int i = 0; i < packets.Count; i++) + { + var pair = packets[i]; + var valid = isValid(pair); + if (valid != false) + { + validIndices.Add(i + 1); + } + } + + return $"Sum of valid indices (1-based): <+white>{validIndices.Sum()}"; + } + + internal override string Part2() + { + var sentinels = new List + { + parsePacket("[[2]]"), + parsePacket("[[6]]"), + }; + var l = new List(sentinels); + foreach (var p in packets) + { + l.Add(p.Item1); + l.Add(p.Item2); + } + l.Sort((a, b) => isValid((a, b)) != false ? -1 : 1); + + int total = 1; + foreach (var s in sentinels) + { + total *= l.FindIndex(p => p.ToString() == s.ToString()) + 1; + } + + return $"Sum of sentinel packet indices (1-based) after sorting: <+white>{total}"; + } +}