Compare commits

...

10 Commits

Author SHA1 Message Date
Ben Kyd
2859a83b88 day 5 2025-12-05 21:47:57 +00:00
Ben Kyd
dda4d56f53 d4 fast 2025-12-04 15:22:41 +00:00
Ben Kyd
9ac4656d4d Day 3 part 2 & Day 4 2025-12-04 13:46:32 +00:00
Ben Kyd
791e374f33 day 3 part 2 (not working) 2025-12-03 07:15:40 +00:00
Ben Kyd
4b55321c84 day 3 part 1 naive 2025-12-03 07:01:20 +00:00
Ben Kyd
1cc596397d day generator 2025-12-02 18:05:25 +00:00
Ben Kyd
6f85994e16 2025 day 2 part 2 2025-12-02 17:16:47 +00:00
Ben Kyd
8ff43a4793 2025 day 2 part 1 2025-12-02 11:44:46 +00:00
Ben Kyd
d6c8e382d0 2025 day 2 part 1 2025-12-02 11:44:29 +00:00
Ben Kyd
ea97c808e5 2025 day 1, splitbyindex & day timings 2025-12-01 14:05:54 +00:00
20 changed files with 7158 additions and 0 deletions

6
2024/3.txt Normal file
View File

@@ -0,0 +1,6 @@
]select(23,564)/$!where()>%mul(747,16)*why()mul(354,748)how()<?mul(29,805)where()mul(480,119)!,why()mul(685,393)(~'&[what()what()mul(376,146)-,<)do()^(mul(735,916)/~~,] what()where()mul(321,623)select()$#what() %#who()<*mul(363,643)where()[mul(360,266),:do()'mul(95,167)who()-select()@[{,)$select()mul(802,119) how()^: {from()mul(147,169)*select())^mul(488,194)$?when()mul(540,154)from()from()*^select()who()mul(8,750)where()mul(140,841)when()] >$(when()<:mul(428,793) where()from()how()/how()]*?mul(156,996))what()!,what()~@((mul(976,569)]-,>$-~%;mul(426,703)/mul(948,128)>+?+>?%select()*mul(477,567)why()%select()?!(@~how(){mul(182,79),mul(203,707)?[mul(186,170)select(283,626)*/*when()mul(130,392)')^&when(),[;mul(563,902)where()}*}<$/)how()mul(953,129)!!what()#what()!who()mul(852,652)~)+mul(973,163)$?why()]where()mul(158,596)when()@}what(29,454)mul(968,252)<'^'how()when()<*^mul(617,885)when()) +&;'mul(264,456)/mul(713,804),-mul(803,862)mul(575,310)[ why(527,60) )from()mul(475,876)from()when()*^$@:do()mul(557,2)'{^:-*what()mul(611,157) >- when()mul(894,415)!mul(856,397)from(),where()mul(13,373),!where(),do() {how()select()^:(#select(622,699)[mul(395,375)-##>+[what()?mul(535,15)/(];)mul(115,296)mul(201,604)^+[>+do()&:}how()/:mul(34,586)?where(375,645)?:-who()select()'why()>mul(389,101)don't()<^}who()mul(501,691)'select()mul(551,120),]?from(545,381)?*%~mul(492,926),:(who() {$ when()mul(348,721)'?/)?!what(784,670)mul(811,483): where()why()why()>$[when()do(),~*# {/mul(312,382),}*what(944,486)?^{+%mul(224,412)~why();?<]who()*^mul(199,783)what()from()@why()where()what()?select()(}mul(267,247) mul(126,337)select()mul(534,156)($%%}+*@mul(103,848):;'%mul(237,35)<&-where()mul(423,484),!]where()#!mul(281,866)select(750,996)(( *{<^%who()mul(437,982)}:mul(357,682)@< mul(124,834)}~mul(668,671)mul(787,282)</{[@+mul(669,479)&+who(324,639)when()mul(217,891)why()who(),who()!+~%who()from()mul(157,768)what()why()/mul(654,217)/?]+how()($mul(173,829))#(what()mul(78,373)(+{?&${([from()mul >from():where()'[mul(985,702)*{: -&where()how()mul(180,738)(from()@mul(240,76),[:'#!:select() mul(822,179)*#how()~!%!<mul(806;+from(28,284);@select()why()?what()how()#don't()select();;?how()[<mul(682,60)%+mul(166,261)!#<~who()'@who()/mul(991;mul(602,939)why()*how()mul(815 ~>who()who()how()where(184,532)#from() [mul(771,388)how()'~!^!@+mul(646,938)+,(({-mul(486,708)^%^from()-(;what()]mul(144,833)~why()%select()&<~how())mul(439,873)mul(677[[;{:?{>[ (mul(25,577))@:mul(727,412)why();?select()?what()};from()*mul(826,116)#*)/where()who();<@<mul(457,847)mul(145,20)^when()mul(547,892)}mul(368>!where()~when()where(597,883)-mul(835,616)'((where(808,96)',mul(649,224)&/ mul(35,958)who(871,394) :!-who()where()where()(mul(322,104^what()%,}[why()what()**who()mul(983,838)mul(614,657)what()&,mul(238,871)-{},select()>who()#>mul(943,599)select()select(558,572)?^who() <:mul(572,265))who()[why()!$,-mul(454,326)<mul(620,631)[who()]from()>mul(300,416)what()who()what()[;when()mul(786,381!<who()@}mul(588,123)mul(912}?-,&mul(757,105)*!!mul(646,183)~*^mul(208,472)^>&who()when()where(381,479) from()<!mul(374,508)',mul(936,836)&when()don't()<mul(87,618)
#-#$&?,mul(549,158):>!?$,what(),who()mul(429,727)}from(401,661)>{?<?:)mul(883,372);when()&who()mul(778,374)[+*+select(896,509):?(why()<mul(156,180)why(),don't()why()mul(186,452)-who()+don't()mul(801,495)what(226,680)( who()do()//~how()mul(810,508)}:from(){$where(285,907)'mul(101,25)?>%mul(518,766)-@who()!mul(276,326),select()%{mul(211,710)/mul(414,532)@!-,>mul(494,611)?%((@)[&who()mul(547/why()]who()*% $'who(675,908)mul(90,974)}mul(427,683)how()[:;mul(443,135)*^+~^{when()who()}[mul(579,135)@:who()mul(267,452)[&!;;where()$}who()mul(662,85)~>what()mul(724,771)$!mul(206,909)@^%mul)when()select(567,468)mul(260,632)who()what()</><}what()}@do()mul(866,137why()~)mul(13,816)^!*(mul(351,795)from()(?^ ;;,~'mul(313,157)?mul(222,186)!> &how()$mul(558,129)how()[select()from()'/&when()[^mul(927,606)@?<+how()-}(mul(749,285)!![%~>mul(919,804)+&-->where()!&$/mul(889,472):why() <]++from():)mul(597,828)!*~@mul(61,536)(why()what(): >why()*mul(50,308)mul(980,618){-! ?*why() *mul(506,77)#/where()^~';who()%<do(){&{mul(540,5)%&'mul(128,695)!mul(96,956):(${'where()<(mul(45,167)mul$?what()>who():mul(11,806)mul(226,600)?how()% /{//mul(601[><<&mul(70,238)select(176,735)mul(447,978)(^#mul(583,880)@[<mul(509,562)[&why(){-select(513,478)who()~mul(966,836when(763,296)](?-mul(131,634)from(261,473)%mul(212,467)(why()mul(876,253~mul(426,669)&select()>mul(722,873)>mul(110,728)/+mul(948,566)where(760,139)[ -*why()-mul(92*,:-$how(),where()<mul(873,257)select()/!*don't()&#?from()why()where()%}mul(210,425)how()--mul(819,836where()<!why()'>select(),+mul(954,569)&<what()$(&-'[mul(514,751)?#);#mul(570,718)where()mul(369,56)mul(701,888)select()when()why()when(932,357)mul(954,415)select()^!&mul(975,208)<select()when()#}mul(123,114)#?/where()'-]do()>?#+(mul(482,680)]mul how()&what()%-mul(455,447)-from()+>?[/where()!:mul(502,951)?~mul(953,617)[/]&>^when()mul(234,738who(134,419))&$<what()mul(351,35)!mul(450,397)~@why()/$why()mul(315,592)?('$)]mul(361,911),+ $$, @?mul(648,348)why()*(~mul(741,895)]don't()who()/$<from()<what()@where()mul(914?!from()select()mul(221,704)mul(869,570)']/ '&why() ;who(970,163)mul(891,301{what()what()who()?$])mul(304,61)[,mul(380,797):'mul(134,245<}>-${)when()#why()/mul(266,78)&- ;mul(336,100)?$'#{'~:^mul(963,726)/&@mul(738,99){where(903,414)how()<mul(433,254)mul'%who()*where()mul(612,425):how()%mul(925,380)'('#/:mul(590,924)&where()%'mul(629,151)**;%<%?when()mul(231,925)mul(535,69),mul(695,901),?{+-~select()@mul(173,181)#what()/<^-select(),]what()mul(478,661)how()'/mul(269,398)}?$mul(203,769):select()^<<,^-mul(440,541)( (why()mul(264,622));where()mul(53,921)when()]mul(802,877)where()&?when()mul(24,441)where()mul(83,37)/where()--/how()'mul(278,236)]from(380,409)mul(486,676)-+]<mul(332,224)%#~'$$from(){how()(mul(786,79),>>)mul(249,770)$&@ ]from()$how()!select(521,465)mul(617,783)}<>):[,select(333,996)mul(416,179)[[don't()$]>why()@:mul(148,463)from()-do()when()-/how()when()&from(930,269)[mul(10,173)#mul(613,997)(<where()^< mul(359,962)where()#what()what(), mul(276,357)!who()){!where()'}'mul(860,748)
#(^(who()what():+don't()where()who()-,mul(407,102))~^how()<<$&from()mul(640,494)@who();!where()'do())~>>when(); *'@mul(724,407)don't()-when()why(533,992),')(:mul(472,652)?mul(350,214)!>where(401,417)/from()$where()mul(108,897)*where()<%select();,$mul(177,623)mul(674,586);mul(188,601)where()&/]mul(892,181)$from()?mul(904,15)why()(from()select()?@{?mul(832,651)<)mul(485,621)?%from()^);from();-who()mul(964,655);((select()mul(950,896)mul(103,475)when())/mul(165,476)(*},)where()!(@mul(417,206)&]?why()%-{[select(),mul(162,447)don't()why()!(/# from()~!mul(794,412)':&?why()mul(419,168);&who()%]who()mul(689,382)who(754,484)select())@)#[('mul/#/,select() why()??&mul(868,352)!from()!who(201,267)what(971,755)mul(245,790):!(^~&^where()--mul(334,775),why()why() when()'@?mulwhen()$?!]- '~@)mul(874,152)when()mul(771,202)(>@~;who()/]@mul(331,997)] select()%&mul(230,638)<%/mul(729,194)when()why()-@-select()select()'!&mul(669,652)/@%where()*;mul(799,156)from(){%why()mul(666,169)-#mul(381,557)&'??>+/>[what()mul(534,338)(mul(631,275),#[{when()~select()mul(847,310)when()]~}where()what(661,551)from()!mul(321,129);$where()@ why()where(616,873)-~(mul(888,479)who(),mul(229,502)])when()don't() mul(246,553)why()?select()',*?mul(242,385)}}where()mul(522/why();mul(445,61)mul(746)$why()from()don't()+mulfrom()#mul(521,245)]%?]}mul),[who()where()mul(784,56)!why(): when(893,294)&[mul(373,342)<$ *! {[why()mul(513,340)how()}where()'[^)^mul(967,981)^from(740,8)^{what()')mul(244,532)+ who()/*mul(686,40)>mul(178,177),][)-<([mul(595,777)<-how()>(,)}mul(210,328)?why() )$why()where()<what()mul(252,597),when()}[!mul(940,426)select()[[mul(71,619)%select()~::%where()mul(811,55)[from():mul(442,618) how()select()~mul(569,19&why()!select(){]$<[what()mul(71,211)/%!]mul(146,583)]from()?when(610,567)^from():where()select()don't()mul(453,186){;%mul(667,596),/^{,(select()mul(387,262)%select()'mul(720,489)'#*$+/what()-*/mul(715,93)^{who(564,37)[mul(440,43)-who()what()-{who()]mul(546,613)??^~&select()mul(69,463)how(){+(<mul(255,367)]~![what(){who()don't()-from()'why()>/['*%mul(654,641)select()$[select()mul(620,43)$from()!mul(573,638)<,#/>why(451,392)/how()mul(450,634) ,%@&,don't()select()~~}%select()when()@%<mul(142,868)]:?:#@}-mul(723,185)$mul(305,502)>@+!^%mul(621,328){@{)when()#)who(685,504)mul(179,100)select(){from()why()]>-mul(94,187);mul(509,291)-how()when()do()why()@) how()select()+mul(379,538)mul(830,641), /&+-@mul(180,491)how():why()!!'%%where()mul(266,732)when();select():+how()(;%mul+who()}{+do()mul(575,752))<what()~(~(>how()mul:&from()>who(854,820)mul(850,918)&select()(}+}mul(782,495))<'?(>){where(),mul(957,190)/when()what()who()mul(352,79)why()'mul(652,626)mul(973,815)>[)-];@'mul(327,736)$@mul(221,196)~;>,[what()mul(170,288)what()~:$<don't()[-]what()$mul(115~()mul(65,844)/mul(152,544)>what()'from(468,557)%&>~who()how()mul(847,27){where()?'mul(736,195)mul(663,417)%mul(301,538)don't()what()select();+[how()?+}/mul(271,885)[when()] select()mul(251,286)],{-why()how()-% what()mul(664,742)from()>^!&mul(583,557)%#{}where()why()))don't()[^[mul(636,736)mul(733,889)mul(415,907)#what()what()from()where()mul(746,170)what()how()%who()/mulhow()don't()*'why()[select(769,463)$'/from()mul(520,584)*who()from()~]>who(862,907)why()mul(423,117)why();mul(100,371)!@<{from()mul(434,31)
*why(816,889)& &:!#!/usr/bin/perl/<$!{ (mul(142,115)where()[}/'when()mul(444,725 ~*:why()& from()when(493,415)&mul(863,234)<@?$/when()'+,mul(722,893),%'don't()~where()why()^,;%;%mul(823,490})$<*$#mul(101,716)&from()%@who() what()mul(881,570)who()@+(/@mul(676select()when()*;@@]why()#mul(315,278)[%'select()[{[mul(237,596)mul(782%^<^+:/:~how()when()mul(565,260))~where()??mul(4,427)'where()(when()?-}select(314,151)mul(361,206)-what()!!mul(575,211)!@}select()% ;mul(996,776) how()!#'+)what(861,201)<from()mul(803,47)how()@[^+who()[from(334,635)when()mul(239,900)^what() mul(129,262)$}what()?when()from()when(){};mul(433,265)when()[:}who()when()from():<mul(653,369)mul(299,195)+when()mul(885,839)}~((]:,)mulselect() %~ ^&}why()mul(335,155)select()&~<mul(775,440)mul(599,234)$#why(64,305)!!what()(+<+do(),-mul(339,978) who()select()];~!:^from()mul(404,428)mul(148,78)who()select()>who()]when()how()what()#mul(862,926)when()*;#:['mul(189,238) :[how()who(971,4)~+<(mul(481,269)<from()what(509,537)from() what()mul(97,894)/{where()}mul(164,658)<<mul(459,615)@>%mul(632,943)from(){{}'why()who(); select()mul(364,748){;,mul(214,990)from(){>$?:why())mul(206,633)where()what()]*@<$who()}+mul(14,141))mul(822,373)]? how()[from(){mul(978,657{,%]{^mul(688,489)##![why(){}do()#why(),];)when()who()mul(305,206)<]<~ ]don't()?mul(304,632) [mul(291,282)+}{when(),from()#mul(662,53)}mul(5,779)#mul(111,303)where()+!<*'%how(960,285);>mul>mul(852,693)%;)*$':;]who()mul(249,548)@)select()]mul(387,459):/'when()$-[>!mul(112,988)from()@~> $mul(191,655);mul(79,498)~)<@/$@;when()#mul(513,202)][*how()$[from()mul(224,73)&'-&,why()@#from()mul(737,275)who()<mul(739,419)}%-)*'why():mul(842,699)why(251,569)-)why()who()when()>-[from()mul(816,564)mul(66,866)'from(239,497)how()>>%/<%who()mul(846,687)how()how(854,968)<mul(768,457who()>don't()@@[*>where()!mul(268,28)+[#(? -mul(398,631)&?}}^-$&~mul(283,82)@what()don't()<mul(837,666)%[~,$+ mul(31,972);#mul(850,483)why():from()?) ]mul(58,370)%mul(363,410);'+({]mul(617,613)([*/from()^from(885,5)who()mul(876,980)where()~mul(749,501)select()}> what()mul(720,734),? who()mul(380,889)%+select())*how()how();%[mul(48,988)$;mul(968,247)* mul(884,462)*#from()>mul(366}what()]((<<what()-don't()~how(432,457)$select()(mul(177,831)mul(4,455)@select()from()mul(729,440)^#/+how()[&mul(688,376)how()&mul(211,599)$select()'who()how()?who();mul(192,204)}>+mul(133,244)*'{-where()mul(729,105)how(619,497);from()+from()when()when()when()from()mul(900,829)$mul(83,600)*how()why()mul(434,610)don't())(?@^,mul(691,992)}^:why(784,454)don't()$&#mul(892,279);':what(){~when()what(361,846)']mul(720,864),why()where()mul(303,491)&;[what()mul(720,732)$~,who();/!mul(407,549)-select()!mul(127,272)-%['???select()what(412,125)]don't()&where()]mul(322,71)@/+select()why()$<who()>?mul(650,186)&@>@[:![mul(887,229)why()]select(298,963)where()when()?where(992,533):mul(753,118)[what()what()$@(what()]mul(683,687)<why() &;>@[mul(471,355)why()who()$>^?how()mul(271,372)mul(68,707)#when(358,219)'&who()mul(811,52)who()<-:#(from()~mul(160,946)!'@>?[;what()mul(206,444)[$why();why()&:mul(299,200)?what()[what() (+mul(298,431)<$^'(mul(822,566)why()when()+how()-#]]?mul(401,194),mul(320,99)when()*$where()!+]mul(635,430)mul(474,531)%' <how(){mul(915,913){what()select()from(367,196)>}mul(896,524)
@who()$don't()who()#&##mul(245,843)mul(707,597):!,mul(864,931);$mul(605,621)&@mul(700,646)>%what(225,888)!%who()[:select()mul(297,15)]^%~]who()mul(87,793)?+{<-where()%mul(518,305)why()+,(~ /!mul(588,968)mul(295,237):-,}%:{+:who()mulwhat(){~*~/'<>mul(590,124)/mul(719,423)))?:+select()mul(902,901)when(){>mul(455,460)$,what()(&{}how()*{mul(24,765)/]mul(529){[#+>/select()?(+mul(19,771)where()+/+mul(380,138)who()when(){from()@mul~$/don't()))select()mul(333,659)< select(213,174)*!select()mul(310,90)mul(494,223)!$when()~how()@mul(656,481)!</;mul(985,195)when() /(]who()^[how(){mul(156,227)[mul(475,974)/@:;,mul(981,216):?!&%^+*mul(243,273)#}<&where()mul(510,175)>*!$mul(705,700)mul(7,569)!#;%}> '?mul(324,975) ^/who()$~^ from();do()~!mul(883,226)]mul(660,990)*select()select()[#}!^mul(426,750)when()')#(when()$select()#mul(790,641)what(196,61)&?where()what()mul(751,795)why()#what()/((*who()select(465,475)'mul(633,76)~%&don't()}/why()where()mul(320,249)who()^{how();?'mul(239;;[}]*(;//mul(51,601)%/~%+!'!how(665,519)mul(611,916)what();mul(174,972)when()-where()-how()('do()mul(108,242)?+mul(870,660)]when()%what()?<:mul(635,416)why(924,420)[<$from()>how(260,907)#where()mul(236,788),,@<do()/who()]why()),mul(104,324),,+}<why()mul(81,926)?mul(703^/$~[(what()mul(77,726)[<%}{how()mul(56,385)$from()[,#when(529,538)where()]~why()mul(497,356)[]mul(870,813)/)/where()-mul(537,196)select()where()++%+where(){do();mul(584,253)when()&who(),select()mul(788,391)don't()}how()&{~}where()mul(157,737)[mul(908,38)mul(818,655['+,~mul(773,541)what()(, >?from())>mul(97,620):select()!+mul(899,189):!}mul(566,974)'why()select()*where()what())why()~why()mul(908,528):)}^mul(71,100)from(296,15)when()from())&from()#how(869,278)mul(628,153)how()mul(765,691)*mul(186,21)how()/mul(487,725)do()##/::from(){what()%)mul(110,152)*&**,$ from()*mul(992,213)[*/!~mul(797,726)-from()mul(969,578)when(112,655)*how()when(),where()'(mul(440,56))*{'(from()-&mul(113,81)^^what()#!))')[mul;~<mul(277,301)#,,%from()mul(121,117)]+$$mul(15,795)[@select(),!how()'mul(575,181)^&mul(178,328)<:select()#mul(801,216)who()what();{where(594,478)<&why()mul(431,843)>mul(147,629)!@<#&^]@select()mul(993,659),{ mul(254,347<<>}why()(who()>!)how()mul(518,738)what(29,303)from()mul(160,896)do(){/;?what()where()where()how()mul(173,649)</:mul(463,794)from()mul(480,942)-where()($%$~~mul(731,892)&how()'}mul<,mul(948,47)<{@how()from()]mul(219,441)''~@}(mul(383,202) ${&}<?select()who()>mul(969,370$~>mul(679,266)how()>@):@where()mul(206,774))[from()what()where()mul(950,797-) ,^%%mul(996,344)what();select()#mul(332,248)*!'<&~mul(408+how()mul(114,169)$<who() &+^mul(692,942)do(),[$@!how(684,237)-{mul(120,876)how()}%/&mul(761,409);who())who()#where():*mul(518,173)select(675,835)$ ^why()}where()/mul(405,527)from()< ^who()how()what()from()how()!mul(950,134)what()?<^mul(814,585)from())who()mul(816,366)+~-+when()what()why(262,438)what(420,569)mul(105,532)!'%mul(151,891)how()@*(:where()!(mul(178,962)mul(751,447)/[+/-mul(851,764)mul(588,654)mul(882,76)'where()$~(where()-mul(526,650){(}*#; :)who()mul(29,13)?}:what()who(520,6)/mul(56,722)
mul(946,420)~)where(719,224)mul(718,516)select()/{# when(),*?<mul(400,748)}who()where()select(308,170):]from(2,72)mul(357,947){what()*how(){*where()what()select()mul(430,803)::from()-*'$where()from()mulwhen(660,983)mul(445,455)mul(490,913)select()#*mul(646,393)>@~select()@~who()mul(901,342)*mul(499,634)%!mul(996,710)~/$}select()mul(8,949)$;(!};from(): mul(860,166)(@-from()'',mul(739,160)$%who(265,676) mul(988,26) ,+/mul(293,416)where()+#}-from(){(@(mul(215,463)mul(152,776)+*]'#'mul(447,726)how()-#}select()what()select(892,487)% mul(182,115)^$<(why()mul(335,275)when(801,993)];select()}'>^how()>do()mul(704,863)+why()'*&mul(709,745)who(){select()mul(17,822)}from()!+;!+,where()]mul(280,107)~?}how()/'(?who()mul(288,599)%what() ]$)mul(463,772)@mul(992,279)what()!:why()>>who() (mul(348,687)*]mul(477,896)when(47,10)&where()?what()%[mul(804,970)from()from()select()+what()[who()-?mul(166,890)&-^mul(892,532)mul(905,17)*)/]>@ {*:mul(361,902)[$]~*mul(629{*<)how()$from()#({mul(924,910)'who()why()'&)}mul(322,152) &mul(503,282)^ )/what()what()%mul(678,160)when()!?&#<%^*mul(661,59)(*mul(936]'<what()what()![[{)!mul(572,448)]#!from()mul(509,887)^&?how()from()?why()]mul(393,953)don't()@what()what()why()~,+*when()mul(546,677)when()^where(292,766)mul(968,760-&!why()mul(657,456)select();~mul(527,553):how()#~#mul(639,12)>;)];)who()&&mul(437,929)who()mul(298,239)<(%:>}do()mul(727,688)~(<)who(846,894)mul(720,201)!$@)}mul(139,406)~!$mul(123,17)&select(564,607)(]<mul(407,428);^):{+how()mul(606,64):)mul(652,400)%:;who()/][mul(850,192)mul(184,269)why()< }!@*<}mul(655,422)>:who()where();^//mul(905,342)&%)mul(185,967)--~+$ when()@mul(594,891)#:[%,;mul(641,786),@>'how()don't(),mul(185,960)(mul(702,204)]]!(%$++# mul(24,904)!mul(109,193)+[{when()mul(579,493)%where():!mul(473,16)$from()]mul(33,997)mul(104,325)'mul(486,457)select()who()<-who()]&mul(720,711)&do()how()!/!%*^^mul(239,525),from()select()mul(77,963)how()]where()<who()'-~/:mul(856,16);<mul(356,792)+/(where():}}mul(15,617)mul(878,763))~when()where()%#(select():mul(427,938)^where()^<mul(208,838)*)who()*'< %mul(982,594)-%mul(683,977)-+;,mul(541,415)~why(){*(what()$,when()mul(648,533) when()'?%<*how()do();how(108,300))when()mul(291,292)mul(65,4):from()&mul(466,215)#%&;[,select()<what()do()+select(){?{~where()'what()mul(637,530)mul(75,335),;)[+%mul(738,984)(select()/{what()when(773,881)mul(916,756)?:]:!^mul(991,341)mul(145,20)mul(279,825)[](when(879,87)({<#)how()mul(326,199)#:{what()what()<}:where()mul(112,738)when()<select(930,412)from()mul(887,573)^-,from()mul(795,440)mul(94,274)$when()(select()how()$when():mul(841,178)how()$mul(127,186)!:~/-where()<what(10,606)mul(291,547):mul(21,379)&^when()what()+/mul(172,574)@+@what()$'why()~mul(765,254)where()mul(448,944),>{what()+mul(452,303);/~mul(55,517)&>^~when()-mul(949,308)(@~@what()@**how()mul(185,245)+}how() select()mul(89,379)~&!@ where()-)

BIN
2024/aoc

Binary file not shown.

View File

@@ -3,6 +3,7 @@
#include "aoc.hpp"
#include "day1.hpp"
#include "day2.hpp"
#include "day3.hpp"
int main(int argc, char** argv)
{

104
2024/day3.hpp Normal file
View File

@@ -0,0 +1,104 @@
#include "aoc.hpp"
#include <cctype>
class Day03 : public AOCDay
{
public:
Day03() {}
~Day03() {}
int Day() override {return 3;}
int PartOne(File& f) override
{
int result = 0;
for (std::string input : f.Lines())
{
// for each char
bool searchingParams = false;
bool firstComma = false;
bool closeBrace = false;
std::string leftS;
int left = -1;
std::string rightS;
int right = -1;
for (int i = 0; i < input.length(); i++)
{
if (closeBrace)
{
std::cout << "mul(" << left << "," << right << ")=" << left*right << std::endl;
if (left != -1 && right != -1)
{
result += left * right;
} else
{
std::cout << "Failed to parse" << std::endl;
}
searchingParams = false;
firstComma = false;
closeBrace = false;
leftS = "";
left = 0;
rightS = "";
right = 0;
i -= 2;
continue;
}
if (searchingParams)
{
if (!firstComma)
{
if (input[i] == ',')
{
left = std::atoi(leftS.c_str());
firstComma = true;
continue;
}
leftS += input[i];
}
if (!closeBrace && firstComma)
{
if (input[i] == ')')
{
right = std::atoi(rightS.c_str());
closeBrace = true;
continue;
}
rightS += input[i];
}
if (std::isdigit(input[i]) == 0)
{
searchingParams = false;
firstComma = false;
closeBrace = false;
leftS = "";
left = 0;
rightS = "";
right = 0;
std::cout << "found bad char : " << input[i] << " IsDigit? : " << std::isdigit(input[i]) << std::endl;
continue;
}
}
if (input[i] == 'm' && input[i + 1] == 'u' && input[i + 2] == 'l' && input[i + 3] == '(')
{
i = i + 3;
continue;
searchingParams = true;
}
}
}
return result;
}
int PartTwo(File& f) override
{
}
};
ADD_AOC_DAY(Day03);

4392
2025/1.txt Normal file

File diff suppressed because it is too large Load Diff

1
2025/2.txt Normal file
View File

@@ -0,0 +1 @@
10327-17387,74025-113072,79725385-79874177,964628-1052240,148-297,3-16,126979-227778,1601-2998,784-1207,831289-917268,55603410-55624466,317-692,602197-750430,17-32,38-58,362012-455626,3622441-3647505,883848601-883920224,62-105,766880-804855,9184965756-9185005415,490073-570277,2929273115-2929318135,23251-48475,9696863768-9697013088,229453-357173,29283366-29304416,4526-8370,3095-4389,4400617-4493438

200
2025/3.txt Normal file
View File

@@ -0,0 +1,200 @@
2232133233333122223222321121432322323324333234233221423334362333113343833132233313523312322224432234
9544718948279477416294977734546287758964484675984344448638555429875995525496945633428322464129775449
2342431222323242222322132121222212212132223222221322252221222222422212122222231227223222421241422222
6244953925232293122334482643333513353336433435373235433333433333344373324258246634153623454355543453
7736344447654414443368344654254336514625323365763557557347345633456536654753356543554224337423655645
7678256455884537672778638766849667285882535872669457673757574863687675953957763739884526852357676358
6418138815172751627482363178142568277778573255724443532712835875457855664165654688176581654473178739
6854446345485434355456557454552353525455763235344855551758634555554555645555644535645534531743242554
2222222322322223322332612212222225222322331322242221255172251455232132122221223222221221222241222221
3522465222652563115529464642233332216344152233612263521373322232245234334452353472671944353144627333
5545321222222522222344243223154223534233224542342331245267254214331654424232831423343325435272544421
3542524122211624341522322226153222251432222222223323326252321225121362141322235161225221111222227241
2455322717243462411254243226323523121523342233134641142441394244224254232641451244318434422422224383
4553343324447136364342223433344524634414373234332183266461265223446463254334435343223462442245322567
6563436486136355463655575366345554384456562545629262586425424652243626548657625466455656653543945665
7535454577563343346435454343443457475576543343854334614444838455344744678754354444737744257755677424
5564445435564444634466844337565445844465549459245334613233554632368925514334436545333343645355776454
8687888777879988878786888689883788878676787767787678887576788777889856868587889748756884386837718787
2232412541224222322223222276932221124212222125272222222211222152123223225321262122552222226222425222
4367133344544422433442443532453333443413434346523142232414343334324332325334334344244542343334544237
3333352232143322323333322333313212323124323333333344323233231333234333263223423333332233323324333333
3413221222121422224313122242223232422123223114221342223232222113722222222422342323332232242313233343
2333245223264434343533344443342324333344512585354324463634444223333444444444314323334344443944441334
1321263414534312232212221232224263311122443321313323123542213232222213122211333322133342142442322512
5234832322232222341332323232223423322353544163291633234233432333233323421323132323426422212322312243
2222272225322222521313431322212652311262252232321522122312222123132225324154112232242423632352323232
1233322333332233324333323222323234333332242125322233332233135232333343331233133333333332323223413332
1312424453343532223551344364432434354347433354424723733371315333224226424334434614235534445274332431
3333222231433223233328333143332343233323313231223323333413325234311233222233254111233223342433224413
3333222655333336333322323255253323533335253333652336321225333233224452233423332325333333253323223333
5442432232322344133222221323243283242223312342542332152332352351236334222332422231332432235543252524
3533343334332332529234332635513353343333312739332332563333213353323121263322322323325226163333269332
2122222244442433423244142412444333335443132364364534743313414423244243245343424211134123233441243732
4633963376156266384333658525662638893353359263721347373868352835376452436935238733834236233534373967
2868546568874346646545656477657574895553666666558685549546665585686962555965744696697655946493595695
2424225323222312222223222152333122224122412215154212252311412222247265222212525114212422232122122412
4122125146221433231332322546242212133253432131543424113132355232443113244544336232221214432244331542
4316244124525612322532522225222222523221664223522294732225222321222441382426222447462326223431346222
5464524566374845443775253524262353365414473446366263943245443654534643234274644327649441535672314333
2222226211121221331222221522224252212122322222122212222243222221643222132222322222221326263232142232
3333252553243533452223224422312333322233213232324543232252125425312234413225543223321933125342423142
3332223222222433147322232631122323433333223331233133332232133231313331312234134243113322422313332323
3352113432568212214452342423233422512652142236263412243242444223222554315232212432252432223462242221
7333543341233454333343233343333364334313464323334291434332344333638433574433417333432823333334433833
3264323365333111323333343336334333333224343233252323333333322231145335333333123233233335232334333533
2432322325121422112312235223112123222222522232222733313233433224212232223232131221423123342235222122
4322122333221422312325222324131434225242432232913422253233241331422332232314322353311222232125223432
2724243234112245242225422434212431122341124421154322328252112244221525272534232222234424223252272222
6263444344135654233444434353424513343334244643543244344552442244473444344534444335444243223333444344
5652456451676873241633354363633342254384434464235654741335434444443364444349248666733344414676344424
3332234444433333132133232334413433434342544333333333332133433324334351233235333213234412432355333433
5253244864383445455545484741654848745663334656346555654783452554459476247734877397397479436544545535
8847848634467769875277674783864637763348776585487564877575446789458658887576743878774573537768857846
3465232634212442535222152333343332414424443235324424245225244656253234443454326334233233343712233242
2526424327586513436454654476775737662269387645787541237764227642652736745535462656515468637462462272
2435133332535344754333243263585245556234826664432357313443546253542483751473335539432333256263939333
8382382578536859647359748967547585734844587735757947889135698988238798976595788728827485377567664443
2323333232332224332333333132132223332332233334333134322223332322322331323223342212211342323423133112
2222223231325222321233222222232235322222131322134223434372222513322651221231121523323221222433421122
4343333333353433133333432533433534423434442333344142233435324333432233343333413433234343443332444133
3435843213132344233334752343345344336253342532313323325472445232541333328233323334423541324432222453
5344384444237343444782523452775445754348886564424435585784776766424342433744438325484356577344888333
1224244324222262324522232424222642321661225332423222223231222122222223122223251414233371222214244224
3543443335325823355433332433232363341313324563431344435344334634224312333333143434333333343693437623
3222444622443242233334533343431223432343263144442444242344413342243411444323111333422334172843235313
3233243443233433233232333344313433332321342333333334333332322334333324324224233333335134433232343313
2322382122121323222232222224422355232222223232212122222223222322322212222212322232222222222222222211
4438874627283769846545858477542757538887557577785678557696594525464885577588345473865884555825561648
7324232222222223222327122222222333124142233231222221222213623122235281121154322132231522522312221232
2333433334433422333333433433412334433334523334443333442543323423432335444141133424433334329334222422
3134463377323343243327234347364223313333433142833225473216361353553398231433232233134221371355315334
2286532255124664377635386342833365262327225754851573844435254235445111322654684446255426313359435562
2332221234222223233225242232333231341432233433313215322243233232332331433823432243433223332282413422
4452645222243142511223334433245244322342425224221373244442233412443521333664343443244123333552252344
6342492286728826426533414885485313383365538228643655268866833443862544644641653154644262754544665538
4348222441234532331362213144243172444641324435312344445342524624344244334537324313348132332536622632
1312343222332333342331132332222313523432333323322613133333224212322342151431233322333243233323342221
2432343233323222322412213232342333224322223143332232332324232323232332223322332222542332412225243222
2452344334433343323244445245322257264463432342324322134422221321224314133334353354524452342424143224
4442333443444454443442443444443434533244354446444443443344445322433454242343332344344424333434644424
8634324339339317534223333323739328623427333734521177196243735432834223827834436832731312246232273785
6485236322212732224522124122122252242252126221211282288242279272225242442642278527645921222194723223
3615215333285423223433333532642133413313532352344233263453434225344523343343452434433224335235441422
2422544126132223324321252211123142222233213322231312222322112122232433423283224233222121323124242261
2344463434152382333281434454344553345433362453133442343344445443543324392453343439443324324763633442
3437353315538337595346532555635436876443356345954234333432342327246437754343343335325354283333534437
2452212263422223574224222423225223423433651242252355232223626336323325426253433434623433274324474216
5765276675264696695461433224346233783941273322233552212723372159556463264643637125566446246446333751
3732223222221552433423122222122443232222243442122452922332422212133222247236721143422123632722356222
2363434624333134423342523424343332246312346134473384231393741244763633254642436332242324232232237352
6647421644234223129224541461443174244433333345533642413652347443544544333735247415613455436354433343
4425834244465436335445345632343233424345425444442346382432242336236441342233344461354245646534344742
5743433673433313638653536582345321453457651837423642123458226734277346423997436443274433233333666648
2322465252234422122212243222232312124251421223122231432222132319527222264211322226221245522911222111
4132544322238334333235333252282333243543433333423435144535222226223364345423181323324531343342362332
6395732553634323536534635664454563666335534687635322745452356365676654356865366655543558761452346463
8525333555554553354625353535661444334216356565765655347495733536664755363546554556655675334665345632
2224222223412322662244223232425261752321222222226595213212115242532344225522486216122231222742326333
4344445434433371234434444237244241324422432333382443122234325144245365444452241273223442333442464534
3225334632332322633326544153233322232363522334723123331243322134221335232423333533223251127322333236
6286125832212222224332231722212222722222122312222152228113212222311223632422225222512242221222212222
2622233222222442111322422244125322211322122122221423461222222132212442943623136145262312122322262222
2422272424326821663242123334232322242561943233452352322263216846337363646625544232212142221223692322
2222323332324212311332331122122333222223233211223312322231133124322323322334322322233823242322232233
3371333745646334334582444935636634348123863349243334762443545833343369542293533743454247388843454335
6537724565567775777467774785767414549447727266273565567747667766444476766567878157655753673663544567
4232456132623232124482415652321558451214723562396612244136524425122125765455552424223244422146222532
2212323232122322222322113332433323522472132233232332343233336133211312212231232333521114232222232122
5155553546841455454558325264555553434375556552555257235515455534455515535535525544612654551556453524
9722515125324323362444125472327421252358654235635924222635231244315621287234335525325576533463224849
1668336355465725434223666523665616453433664366665644647241246212551332582536336235544653338583343525
2342313322332521582422234378343223122233333212153252233326562322353443222534132143235631222243225231
3512333132246411343713435343335333335134243322323234423253343242463434234133342434353423243323541236
2455375222533521242123424433216423384424242442312521232359426424132423124225424483242432223241412437
3233218222223222112222312222232212222212122222123222212222132321222322222223221312212253122211223222
3234532211453232241212332322222243442412123922323322223141422421223423322324442222342355445523212331
3429536326344342532553888333258463373336453332333234433333335537325237137423534323744133635593353433
1434363334311314233411433264324535442213456833323132422333223343323434414343231414426223345135344335
3222322222222222122232212232232242122233213222322411222243222421222232233233232422222211222212222514
6245324443534665534554336746249753563335341556444551723734362444643464344474745553444253347339624453
5334426434433344534332343143438432432335433324463233234221334323468433944352243324231363434332625232
8835353872326366238572332425353324479424422434333346836423292341543941333134553678322426837372329372
3353353533434332533732453332323332653233444333665433535362635253376331553353453332533343753423532332
3343243356114224312352353422632522434115634344445422323511425423314221221433522323356223423225255632
2131222191232122222212222132222242322422222222222122222622222121311323322232531223112212232316222312
2611324436312524222533222646396144443463214214855314424162675322243512222352222445432472255223323232
3321544624337424523342534434446442223443444852334474733733453347434543434247424241449444324392444414
3232232122231222412322554334342222225242243221431313242333235232421342242444532333422232232212223143
2235543354323222423532241735522524422433353321334432454254235522425133355446542154332373422331222322
6656555559464658486564666446555555958585543486575355545856447758556755747565596255555657556545666643
3427121822212112122524323222422442222736172215222531143142252533823222221215614162522316266442225222
2118213211352282332213226223228122142262542422222222221522227223334212554222247222352222322213224222
3144232433314411535242444333342145242444623322445244434143422434423543324232351334133423424211334444
3216432126534223385221653121423325142416433252224592351254332242343442122112124243172322248634423422
8232224118222323245252122234212612222232232222243334227235223222322623333122822231222442722214641521
5225453455364344623154425264523386354642337433564515232333324534423324233424444233445243425411233426
2129343373333483292343353333723633533722324323233576454932343124233235332494433273254332333363323223
3132237211131224222323222232233112513122242322323331222321222322362323314212323251122122142321314332
4754225344465673553443332554442234332368453223434322243554338472333376322322323373264335834444444454
1136836833853233743825433251843363363773263235234234436336233123333822323634323732233628834362573344
4844243444444551634446643424544135465684324528815345344224634234224549498346492425564256444423334644
3422823122474323322211211254233232242225113311222244651822522625442272221125622442222422332281437221
6623252422332233132333335332333332244232349323342345464333133432235323413344143243122423326233443233
2242262441326222126522262538422244221311432233276326222662122251577211323433432322272254237218227255
1522262322523152212423563322522212212254632142224423643515523222221221124424533333236365124123422163
4242444771425444442434324143363324444462243374423432343434743443433325334244444242663444542333332364
4467443545345563442425445446144526644534454645534344422432453362525386241432143354236394394455643442
6343374593516625614864577324773453644234545343335665954344436954943544863347328561423354849629433463
6454554753858656445365796554643561451495685364644648447664466634661655686334288549414845625665536336
4232223224223322422223222242225232232192241422224242342225222242424232212342134212122432222125232222
4334423968793346242226322514232422321226553255315372343155358422135233422454522342335118123474233432
3472434344433651194343225239333452324232557832655444224444434422433262332942445234324383555182422444
4424351655527244337373445455333533736563356654243556467635353733355335333646623435448534356333545735
3232222225222424231212121223122225224224225422122252523121122251222222321221452622226222222522122224
2122212232422222231322222222212221121222222222232321232211222622222235722272211335212221222212232315
6454725483654746576544566678744754568736666737374787768825686646756657486465676458756567577645549754
6543332464452892654265421473452246152323334243132461133232268432326464344224434241334347224223637423
2625625445315322983553485264538578269825762565283434262436532372363665472636353672583331262724383282
3232873321113226222144282428233322212428413493131222282337243214426225432312212464183227223215322622
5533353553464424514343342332242153433523454444333321443556343543325535242335142343654353353454554552
2232234232322134112222233232222131322421223112222322222322312222122322121422221222223132223222421221
2542714544725485233345575425263952272367274717554242355655462443557222473293232951342343442452324423
1522272222252132246221322112223226252743225122222221245222123121226621223522223223222222252252222112
2222325482123525443465251443231132323225535255131422551222625533222225254232153225134255222122243222
6656454363343651412324333545111113136525316222354554652432154354434131665442413114245242521545146789
4442322122221211111142431111423134131114232312212433444323424121424432331422121141332422343232356789
3212335244334332433262134213122321124252125232331433231143313223122235224431221423232261233323231242
4735243252264454742487242145543733424454475231547442975364451544354542541564536434255546274455744268
2231333322232223222332242321222223213222223212355253221312232111223222343232333221422222222522332233
1211433622312212212252257222812222298229429222234222222272222222232227219221222121422422123212322722
4232445421241534473275551254233253262432233593325542424423222323312234235422461255251554212224221394
2332221333232122335822323313352132222332523221332337122231331282323412322322232344233222223343434232
2725485313222257742465511364531545622523277422426227222232736162236656569732283124765582223755732564
2422422232232222231293223211214131221333322214223422221241221232223223222422133221343123232222211212
4423356255222445231344243352545445254524241242223343454331311552242422314224432453144352242224445432
2423222112524244313125332315155211253125555344355233321155112141531113141441113132323412443334156789
2132222232222222322323425223212233214222323222221212431223222243222212322222241223222232311222233212
3233323244222222223133244314225325253125542422222225433336144222413422222435123533244422532542733532
3179924698386238367236593939527652322332466621532864535417839339549568538333386378572432732335294933
4556625964624535444457459976684768643867379699957697477636867849789767443477999249975628749748535594
4629452241643442562722514324244522252334424122221442154624212436246324434432222446882442858183638814
2762633653564553234324556522227332322287612643631342575896463774526327166372715867363623524434541342
6354275125434124325317724755566423441362644754622366364521264253744362443226444235265644424464421425
5685441376483994474989626583976445565259674397656552955383597645927397356293554543768262246758236737
3355743464265538557364156954953826744564335659344225554364562673453556857364557845562528462524532648
2362233223421632223453484622242433341232273332325542322263251323724722123733237174753332323244476511
2223212212222222222322222211223223122232121452523223223221222423225232122221122222622321325322221225
2232722133422322222122222221232225311222212222333312222331212321136222233241321352225623324234222122
2122122222221223212221222222322221522222122325212252222211222222112252222312242121231224233324522212
2223132337112363331242233333233452222523212322133631228262514223262121583222722631526321222222163139
4263448542324314343424413363325543434433334323134243243423633624444423334244343343421363444344453444
2333245422112423332222554513223345313442243431132323334323233222241233235321254565235234453221354432
7122232324231443228212622222222811323422231442226922122722222193132286284324226229232424221722326323
2332333635333393223294339443286233343344333354433323346333333343435484332344635232331535134363334334
4342233233223235333442222354362232461233325223213133322335223322232162123352235334432323835145224146
5325724624322453232513342246246424252324311563425123725212653322744243224221343256233543532546328374
5167221272721721513145417116271723735472261435635543175711143567436751671556535526773233635213713589
4222217222352426574636595434452626345767335635745413424952434246665862444324244533526544264882645424
3363134416249632478713332445322358253276633544356437455435523166425363424223275532472253554853752493
8433153548467574565345443536354435745576547444746273754765547465643444685959385677525454323444357566

139
2025/4.txt Normal file
View File

@@ -0,0 +1,139 @@
...@@@@@..@@@@@@@@@..@@@@.@@@@..@@.@@@@@.@.@@@@.@@@@@@@.@@@@@@@...@@.@@@.@.@@..@.@@@@..@.@@@@@@@..@@@@@@@@@@@.@@.@@@@.@@@.@.@@@.@@@@.@..@@.
@@.@@@@@.@@@..@.@@@@@@.@@@@.@.@.@@..@.@.@..@.@@@@@@.@@.@@@@..@.@@@@@@.@.@@.@.@@@..@.@@.@.@@@.@@.@@...@@..@@.@.@@@@..@..@@@@..@.@.@...@@@@@.
..@.@.@@@.@@@@@@...@@@.@.@@.@@@.@.@@@@@.@...@.@.@@@..@.@@@@@.@..@@.....@@@@@@@@@.@@.@..@@@@@...@@@@..@.@@@@@.@@@@@.@@.@@@@@@.@@@...@.@@@@@@
.@@.@.@@@.@.@@@@@.@@..@@@@@@@@.@@...@.@..@.@.@@.@@@.@@@@.@..@.@@..@.@@.@@@@..@@@@@@@@@.@@@@@@@@@..@@@@....@..@@@.@.@@@@@@@@.@.@@.@@...@.@@.
@..@@@@.@@...@@@@@@@@@@...@@@@@@@@.@.@@@@.@@@@.@@.@@..@@@@@@.@@@@@.@@@@@@@@..@.@.@@.@@@@.@@@@@...@@@@@.@@.@..@@@..@@@@..@@..@.@@@@.@@.@...@
@@@..@@..@.@@.@.@@@.@@.@...@@@@@.@@@@@...@@..@@.@@@@@@@@@.@.@@..@@@@.@@@@@..@@..@@@@@@@@@@@...@@.@@.@@@.@..@....@.@@@@@@@.@..@....@@@@@.@..
@@@@.@@@@.@@@@@..@@@.@.@@@@@@@@.@...@@.@@..@@@..@@.@@@@@.@....@@.@@.@@.@.@.@@@@..@.@....@@@.@.@...@@.@.@@@@@@..@@@..@.@@@.@...@.@@@.@.@@@@@
@@@@@@..@@@@@@.@@@@@@@@@@..@@@@.@.@@@.@@@..@@@@@@@....@@..@@.@@@@..@.@@.@.@@.@@@@.@@@@@..@...@@@@@@@@@@@.@@@.@@.@.@..@@@.@@..@@.@@@@@@@..@.
@@.@@@..@.@@@@.@@@@@@@@@@@@.@@@@@@.@@.@..@@@@..@@@@@@@@....@.@@@.@@.@@@.@@.@.@@@@@@@..@@...@@@@.@@@@..@@@@.@@.@...@....@.@...@@@.@@..@@...@
@.@@.@@@@@@@@@@.@@@.@@@@.@@@@@@.@..@..@@@@@..@@.@@..@@.@@@.@@.@@..@@@.@@@@@@.....@@@@.@..@@@@.@@..@...@.@@@@..@.@@@.@@@..@@@@..@@@@@@@@@.@@
...@@@@@.@@.@@@.@...@.@..@@.@@..@@@@@@@@@.@@@@@@@@..@@.@@@...@@...@@@@@@@@@@...@.@@.@.@@.@@@@@@.@@@@...@@@@@@@@@@@@.@..@@@@@.....@@@@@..@@@
@...@@.@@@@.@@@@@....@@@@.@@..@@@..@.@@..@.@.@@...@.@...@@......@.@@@@..@@@@@@.@@@@.@@@@@@@@@@@..@@@@@@.@@.@@@@..@@@@.@.@@@.@@.@@.@..@...@@
@@@@.@.@@.@.@.@@.@@..@@@@.@.@.@..@@@@..@@...@@@@.@@@@@.@.@@.@@@@@.@@@@@@@@...@.@@..@@@..@@@.@@@@.@@.@@.@@.@.@@..@@.@.@.@@@@@@.@@...@@@..@..
@.@....@@@@@...@@@@@.@@@.@.@@@.@@.@.@@@@@@@@.@@.@@.@@@@.@.@@@...@@@@@@.@..@@@.@.@.@@@.@@@@.@@@..@@@@..@.@@@@.@@@@@@.@.@@@@.@.@.@@@..@@..@@@
@@@@@.@.@.@@@@....@@.@.@.@@@@.@@..@@.@..@@@@.....@@@.@@.@.@@.@@@@@@@@.@...@@@@@...@@.@@@@@@@@.@@@@@@@.@@...@@@@.@.@@@.@....@@@@....@@@...@@
@@@@@@@@.@@.@@@@..@.@.@..@@.@.@..@@@@@@@.@..@@@@@.....@....@@@.@@.@@.@.@@.@@.@@@@.@.@@.@..@@.@@..@@@..@@@.@@@@@@@.@@.@@@.@..@@@@@..@@@.@.@@
@@@..@.@.@@.@@.@@.@.@....@@@@.@@@@@.@@...@@@@@@...@@.@@@@@@@@@..@.@...@.@....@.@@@@@@@...@@..@.@@@.@@@@.@@.@@@@@.@@@@@@@@..@.@.@@@@@@@.@@@.
@@@.@@@@@.@..@@.@@@..@.@@....@.@@.@.@@@@@.@@@@@.@..@.@@@@@.@@..@@.@.@@@..@.@@@@.@@@@..@@@@.@@@@@.@@.@@.@@@.@@@@@@@@@@@.@.@.@@@@@@@@.@@...@.
@@...@.@@@.@@..@@.@@@.@..@.@...@@.@@@@@@@..@..@@.@...@@@@@.@@@.@@@@..@@@@.@@@@@@@@.@@@.@@@@....@@@@@.@@..@.@.@@@.@@@@@.@.@@@@@@@@.@.@@@@@@@
@@@@..@@...@@.@@@..@@.@.@@.@@.@@@.@@@.@@.@@@.@...@@@@@..@.@@@@@.@@@@..@@@@.@.@....@..@@@@@@@......@.@@..@.@@@.@@@@@@.@.@@@.@.@@@..@@@@@@@@.
@.@@.@..@@@.@@@@@@..@@@.@@@..@@.@@@@@@.@@@.@@@@@@@@@.@.@...@@.@.@.@@.@@@@@@..@@@@@.@@@@@.@.@@@...@@@...@@@@@@@@@..@.@.@@..@@..@@@..@.@@@@.@
@@@@.@@@@@@@@@@@@@@.@@@@@@.@@@.@@@@@@..@@@@..@@@@@@@@.@...@....@@@@.@@...@@@@@.@@@@...@@.@@@@@@.@@.@@@..@..@...@@@@@@@@.@@@@.@@@.@@@@@@.@@@
.....@@@@@@@........@....@@@@@..@@.@@.@...@@@..@@@@@@..@.@@@.@@@@@.@..@@.@@.@@.@@.@@@@@.@@@@.@@@@@.@.@@@..@@..@@.@.@.@.@.@@@.@@@.@@.@.@...@
.@@.@@..@@@.@@.@...@@@@@.@@@...@@@@@@@@@..@@.@@@.@@.@@@..@@@...@@@@@.@@@@...@@@.@@@...@.@@.@@@.@@..@.@.@@@@.@@@.@@@..@.@@@@@@@@@@.@@@.@.@.@
.@@@@..@@@@@.@.@.@.@@@@@@@@.@@.@@@@.@.@..@@@@@@@@@.@@@@@.@@@@@@@@.@@@.@@@@@@..@..@@@.@@@..@@@....@.@@@@@..@@.@..@@.@@..@@@.@@..@@@@@@..@@.@
@..@@@.@..@.@@@@@@@@..@@@.@@.@..@...@@...@@@@@@@@@.@@@@@@.@@.@@@@@@@@.@@@...@@.@.@..@.@@@@.@....@@@@@@.@..@@@.@@@@.@@@.@@@.@.@.@@.@@@.@@@@@
@.@@@@@@.@@@@@@.@@@@@@@@.@.@.@@......@@@@@..@..@@@@@..@@@.@.@.@@@@.@@@.@...@..@@@@@.@@@@..@@@@@@@@@..@@@@.@@@@@..@@@@.@@@.@@@@@.@.@.@@..@@@
..@..@@.@@.@.@@@@.@@.@@@.@@@@@..@@@@@@..@@@@@@.@.@......@@..@@@.@.@@.....@@.@.@@@...@..@@@@@.@@.@.@....@@.@.@@..@@@@.@@.@@@.@@.@@@@..@.@..@
@@@@@..@@@@@@..@@.@@@.@..@@@.@@.@@.@@@@.@.@.@..@@@@@@@@@@@@..@@..@.@@.@@.@@.@.@@.@.@@...@.@.@.@@@.@@@.@@@@@@@@@@..@@@@@.@.@.@.@@@.@@..@.@@@
@@.@.@@@@.@@.@.@@.@.@@.@@..@@@@@@...@@@@.@@.@@@..@@@.@..@.@.@@@@@..@@@@@.@@@@@@.@@@@.@.@@@@...@..@@@.@.@..@@..@@..@@....@@.@@@@@@@@..@@@@@@
..@.@....@@@@.@@..@@.@@...@@.@@@...@.@..@@.@@@@.@@@@@..@.@@@@..@@@@@@@.@@@.@.@@.@@@@@@@.@@@.@.....@..@@@@.@.@@@@.@@@.@@@.@..@@@@@.@@@@@.@@.
@@..@@@@@.@@@@@@@.@@@@.@@@@....@..@..@@..@@@@...@..@@.@.@@@@@@@@..@@@.@..@@@@@@@..@@@.@@@@@@@@@@@@@@.@@.@@@@@.@.@.@.@.@@.@@.@.@.@@@@.@.@@@@
@@@.@@@@@.@..@.@@@@@@.@@@@@.@.@@@...@@.@..@.@@@@@@.@.@@.@@@@@.@@@..@@.@..@@@@..@.@.@..@@.@.@@.@@.@@@@...@@@..@@@@@@@@.@@@@@@.@...@..@@@@@@.
...@@@@@@@@@..@@@.@@..@@.@@.@@@.@@@@@@@..@..@@.@@@@@@@@@.@...@@@.@..@@@@.@@@@.@@@@@.@.@....@.@.@..@...@@.@.@@@@@.@@@@@.@.@@@@@@@@@.@.@@.@@.
@@.@.@@@@..@.@@@@@.@@@@@@@@.@.@.@..@@.@.@..@@@@@@@@.@@@.@..@@.@@@@@@@@@@@.@@.@@.@@@.@@@@.@@@.@..@@...@@@...@.@...@@.@...@@@...@@.@.@@.@@@..
..@@@@@..@@...@@@@@...@@.@@@.@@@@@@@@..@.@@.@@@@.@.@@@@@@@@...@@.@...@@@.@@.@@@@.@@@@..@@.@@@@@@@..@.@@@@@..@..@@.@@..@..@.@@@.@@@@.@....@@
.@@.@.@...@@.@@@@.@@.@@.@@@.@@@@.@.@@@@.@..@@@@@@@@.@@@...@@.@.@..@.@.@@.@....@.@@@..@@.@@@@@@@@..@.@...@@@@@@@@@@@..@..@@@..@.@.@..@@@..@@
@@.@@.@@@@@@@.@@..@@@@.@@@@.@@..@@.@..@@.@@@@@.@..@.@@@@@@@@.@@.@@..@..@@@@@@.@..@@@@.@@.@.@@.@@@@@.@@@@.@@@@@@@.@.@@@..@@@@@.@@@@..@@@@@@@
@@@@.@.@@@@@@@@@.@@.@@@@@@..@@.@.....@@@@@..@@@@@@@.@....@@@@.@@.@@@@..@@@@...@.@@@@@.@..@@@@@@@.@.@@..@@@@@@.@@@.@@@@.@.@.@@.@@@@@@@@@@@.@
.@@.@.@@@@@....@@..@..@.@.@..@@.@@..@.@@@@@@@..@@@@@@@.@@@@@.@..@.@.@@@@@@@@.@@.@@@@@@.@@@@@@@.@@@.@@@@@@@@@@@@@.@@.@..@@@@@.@@.@.@.@.@.@@@
@@.@@@@@.@@@@@...@@@.@.@.@.@...@.@.@@..@@@@@.@.@.@.@.@@@@..@.@@.@@@@@@.@@@@@@.@@@@@..@@@.@@@@@@@.@@.@@@@..@..@.@@..@.@.@.@..@@.@@.@..@...@@
@@@@@..@@.@@@@..@@@@@@@@@@@@@@..@@@@@@@.@.@.@@.@@@.@...@.@@@@..@@.@.@.@@@.@.@@.@@@@..@.@@@@..@@@@@.@@@@@@@@..@.@@@@@.@@.@@@@.@.@.@@...@..@.
@@@@@@.@.@.@@@.@.@@@@@.@@@@.@.@@@@.@..@@@@@.@@@@.@.@..@.@.@@.@.@@..@@@@@@.@.....@@@@.@.@..@@..@@@..@.@.@.@@.....@@..@@..@@.@@@.@@@@.@@.@..@
@@.@@@.@@.@@.@@.@@@@@@@@@.@@..@@..@@.@@@@.@@@.@.@.@@@@@@@@@...@@.@@@@@@@@@.@.@@@@@@@.@@@..@.@@.@@..@@.@.@@@.@@@@@@@@..@@@@@@@..@@@.@@@@@@..
@@@@@..@.@.@.@.@@@@@@@.@@@@@@@@.@@@.@@..@@.@.@.@@@@..@@@@.@@@@@@@.@@....@..@.@@..@@@@.@....@@@@.@.@.@@@@@.@@@@@.@.@@@@..@@@.@@.@....@@.@@@@
.@@@@@@@..@@.@@.@.@.@@..@..@@..@@@@.@@..@@@.@@@@@@@@@.@.@@.@.@@@@@@@@..@@....@..@@@@@@..@.@.@@@.@@.@.@@@.@..@@@.@@@@@@@..@@.@@@..@@@@.@@@@@
@...@@@...@@.@...@.@@@@.@@@@..@.@@@@..@@..@@..@@.@..@@@.@@.@..@.@.@@@@.@@@@@.@.@@@..@@.@@@@@@@@.@@.@.@@@.@.@@@@@@.@.@@@@@@@@@.@@.@@@@@.@.@@
.@@.@.@...@@@.@@@..@...@@.@@.@...@@@.@....@.@@@.@@@@@@.@.@...@@.....@@.@@..@@@@@@@@@.@.@.@@@.@...@@....@@..@@@@@.@@@@@@@@@@.@..@@.@@@@...@@
..@@@@@.@..@@@@@.@..@@@.@..@.@@@....@@@..@@@@.@@.@.@@@@...@@.@.@.@@@..@@@@@@.@@@@@@@..@@@@@@@....@@.@@....@@@@.@.@.@@..@.@@@.@.@..@@@@@..@@
@.@.@@@@@@@.@@@.@.@@@@@@@@@.@.@@.@@@..@@@.@@@..@@@@.@.@@@@.@..@.@@@@@@@@@@@@@.@@....@@@@@@.@@@.@@@.@@@@@@@.@@.@@@@.@@@@@..@.@@...@@@@@@..@@
.@@@@@..@@.@@@.@@.@.@@..@@@@@@@.@.@..@@@@.@@@@@@@@@..@@@...@@.@@@@@@@@@@..@..@@@@@@@@.@.@@@@@@@..@@@@@@@@@@@..@.@@@.@..@.@.@@..@.@@@..@@.@.
...@@@@@@.@@@@@@@@@.@@@@@@@..@@@@.@@@.@.@@@@@@..@.@@@@..@@.@@@@@.@@@.@.@@.@..@.@@@@@.@.@@.@@.@..@@@..@@..@@@.@@@.@.@@@..@.@@@....@@@..@@@@@
@..@..@@@@@@@@@@@@@@@....@@@@@@.@@@@@...@@@@.@@@.@.@@@..@....@@@@@..@@...@@..@@@@.@@..@@@@@.@@.@..@@.@...@@@@..@.@@@@@@.@.@.@@.@@.@@.@.@@@@
....@.@@@..@@@...@.@@.@@@@.@@.@@@@..@@@@@@@.@@@@.@@@@@.@@@.@@..@@...@@.@@..@.@@@@@.@@@@@..@.@@...@@.@@.@.@@@.@.....@@@.@@.@@.@@..@..@.@@@.@
@@@@@@@.@@@@@@..@..@.@@@.@@..@@@@@@@.@.@@@..@@@@@@..@@.@@@@@@@@@.@@@@@@@@@@@.@.@@.@@@@..@.@..@@.@@.@@@@.@@.@...@@@@@@@@.@@.@@..@@@@..@@@@..
@@@@@@.@@@@.@.@.@@.@@..@@@.@...@@@.@@@@.@@@@..@.@..@@@@.@..@@@.@@@@@@@@.@@@@..@@@..@@.@@@.@@@@.@@@.@.@.@@@@@.@@.@@@@@...@.@....@.@.@@.@.@@@
@@..@@@...@@.@@@.@.@@...@@@@@@@@@.@@@.@@..@@@.@@.@@@@@.@.@@@@@@..@@@@@@@@@@.@@@...@....@@....@..@@.@.@@..@@@@@@@@@.@@@@@@@.@...@..@@.@@@.@@
@@.@.@@.@@@@@@..@.@@.@...@@@@@@@.@@@.@.@@@@@.@@@@@@.@..@@@@@@@.@@.@@@@...@..@..@@.@@.@..@@@@..@.@@@@.@@@.@@...@@.@...@@@.@.@@@.@@.@.@@@..@@
@..@.@.@@.@......@.@@@@@@.@@.@@.@@...@@@@@@@@@@@@.@@@@@@@@.@.@.@@.@..@@.@@.@@@@@.@@.@.@..@@@.@@@@@@.@@@@@.@.@@@@@.@@..@@@.@@@.@.@@.@@@@.@@.
@..@@.@.@.@@.@.@.@.@.@......@@@.@@@@@@....@.@@@.@.@@@.....@@@@@@.@@@@@@@@@@@...@..@@@@@@..@.@.@@@@.@@@...@@@@...@@@.@@@@.@.@.@..@@@@@.@.@..
@@@.@@...@...@.@@@@@@....@@@@@.@.@@@@...@.@@..@@..@.@.@@.@..@.@@@@.@@.@.@@.@@@@@@@@@@@@.@@@@.@.@@@@@@...@@@.@@.@@@@@...@@@@@@.@.@@..@@@.@@@
.@.@..@@.@@@.@@@.@...@@.@@.@.@@@@...@...@@@.@@@@..@.@@.@@..@@..@@.@@@.@.@@.@.@.@.@@@@.@@@@@@@@@@@.@@@@@@@@@@@@.@.@@@.@....@@.@.@@@..@@@@.@@
@@..@.@@.@.@.@@.@.@@@@@@@@@@.@..@@.@@@..@.@@.@@@@..@...@@.@.@@@@...@@@@@.@.@@..@@@.@@@@@@@@.....@@@.@@@..@@@@@@@@.@@@..@@..@.@@.@.@.@@.@..@
..@@.@@.@@.@.@@@@.@..@..@@@@.@@.@@@@@@.@@@@@..@@@.@@@.@.@@@@..@..@@@@@@@@.@@..@@@@@@@.@.@@@@@..@@@@@@.@@@.@@.@@@.@...@@@@@@@@@..@.@.@...@@.
@@.@@@.@.@.@@@@@@@.@@@@@@.@@@@@..@@.@@@.@@@@@...@@@..@.@@@@.@@@@@..@.@..@.@@@@.@@.@..@@@@@@@@@@.@.@.@.@@@@@@@@.@.@@..@@@@.@@@.@..@.@.@...@@
.@@@.@@@.@@@@.@.@.@@@@@@@..@@@@...@@.@@.@.@@@@@..@@.@@@@.@@.@@.@@@@.@@.@.@@.@@.@@..@@@@@...@.@.@@@...@@@@.@..@@@.@@@..@@..@..@.@@.@@@@@@...
@.@@@@@@...@@@@@@.@@@@.@@.@..@@@@@@@@@.@.@@@..@..@@.@...@.@@@@.@@@.@..@@.@@@...@@.@@@@.@.@.@@@@@.@@@@@.@@...@.@...@.@@@@@@@..@.@.@.@@.@.@@.
@@@..@@@.@@@@@@@@@@@..@.@.@.@..@@@@.@@@..@@.@@.@@.@.@....@.@.@@.@@.@@@@@.@@@..@@@@@@@@@..@..@......@.@.@.@@@@.@.@.@@.@@@@@.@@.@.@@.@@.@@..@
.@...@.@@@@@@..@@@@.@.@@@@@@@.@@@@@..@@@@@@..@.@@@@...@@@@..@@@@@@...@@@@.@@@@@....@@@.@@@@@@@.@..@@@..@@..@@@@...@@.@.@@@.@@.@...@@.@@.@..
@@@@..@@@@@@..@@@@@.@.@@@@@@@@@@....@..@@@.@@@.@.@.@..@@@@.@....@@@@@@@@@...@@@.@@@@@@@.@@@.@@@@@@@@@@@@...@@.@@@@@@@@.@@@.@@@.@@.@@@.@@@.@
@@@.@.@@.@.@@@@@.@.@@@@.@@.@@@..@@.@.@.@@.@@.@@..@@@@.@@@@@@..@@@@@..@.@@@@@@@@@@@@.@@.@@.@@.@@.@..@..@..@.@@@...@@@.@.@.@@@...@@@@@@@@.@@.
.@@....@...@@..@@@.@@@@@.@@.@@@..@@...@@@@.@.@@@@@@.@..@@@..@@@@..@@@@@@@@.@....@@.@.@@@@@.@@@@@..@@@@@@@.@..@@.@@@@@.@@@@..@@.@.@.@@@.@@@@
@....@@@@.@.@@.@@.@@@@@..@@@.@.@@@@....@@@@.@@.@@@.@..@.@@@@..@@@.@@@.@.@@..@.@...@@@.@....@@@@@..@@@@..@@@..@..@.@@@.....@....@@@.@@@@@.@@
.@@@@@.@.@.....@.@@@@@@...@@@...@@.@@.@.@@..@@@@@@@.@@.@@.@@@@.@@@@@.@.@@.@@@..@@.@..@@....@.@.@..@@@.@.@@.@@@@@.@@.@@.@@@@@..@.@@.@@.@@@@.
.@@.@@@.@@.@.@.@..@.@.@..@@@@....@@@@..@@@...@@@...@@.@.@...@@...@@@@@.@.@@...@@.@@.@@.@.@@..@@..@@.@@@@@.@@@@@@@@@@@.....@@@.....@...@@@.@
@.@.@@@.@@.@@@@@.@.@..@@.@@@@.@.@@@@@@@.@@@@@.@@@@@@.@...@.@@.@@.@.@@@.@@@@@@@@@@@@@@.@.@@..@@@@@@@@...@.@.@.@.@@..@@@@@@@@@@@@.@@@@..@..@.
.@.@@.@@@..@.@.@.@@..@.@@@..@@@..@.@..@@.@.@@@.@@@@@.@.@.@@.@@@@.@@@@....@@.....@@@..@@@.@@@@@@@@.@@.@@..@@@@@@..@..@.@@.@@....@@@@@@@.@.@.
..@.@@.@@@@@@@@.@..@@@.@@@...@.@@@.@@@...@.@.@..@.@@@@@@@..@..@..@...@@@@@.@@@..@.@@.@@@@.@.@@@@..@.@@.@..@@..@.@@....@@@.@.@@@.@.@@..@@@.@
@..@@@.@@..@@@.@@@.@@..@.@@..@@@@@@.@@@.@.@.@@@.@@@@@.@..@@..@@@@@.@.@.@@...@.@...@@.@@.@@@@.@@@.@.@@@.@....@@.@@...@@@@@..@@@..@@@@.@@@@@@
.@.@@@@@@@@@@@..@@.@@.@@@..@@.@@.@@@.@.@@@@.@.@@@@@.@@@@...@.@@@@.@..@@@@@.@.@@@.@@@...@..@@.@@@@@..@@@@@@@.@.@@@..@.@@@..@@@.@.@@@..@....@
@@@.@@@..@@..@@.@.@@@@..@.@@@@@@@@@@....@@@.@@.@.@@.@.@.@@@.@@@.@..@@@@@@.@@@@@@...@@...@@@@..@@@@@@@@@@@....@@@@@@.@@@.@@.@@@@@@@@.@@@@.@@
.@@@@.@..@@@@@@@@.@@@@@.....@@@@@@.@....@@.@@@@..@..@.@.@.@@@@@..@@@@..@.@@@.@@@@.@@.@@@..@..@@@@@.@@@..@@.@.@@.@@.@.@.@.@@.@.@@@..@@@@@@@@
@@@@@@@@@@@...@.@..@.@.@@@.@@@.@.@.@..@@.@.@.@@@@@@.@@@..@.@@.@@@@@.@..@@@@@@.@.@@@@@@@.@.@..@@@.@.@@@.@@@@.@@@.@.@..@.@@@@@@@@.@@@.@@@@@@@
..@.@..@@.@...@@@@@@@@@@@@@.@.@@@.@@@@@.....@@@@@@@@@@@.@@..@@@.@.@@@@....@.@.@@@.@@..@.@@@.@@@..@@@@@@@@.@..@@@@@@@@.@@@@@.@.@@.@@@..@@..@
@.@.@.@@....@@.@@@@@@.@.@.@@@.@@.@...@.@@@@@.@@..@@.@@...@@@@@@@.@@@@@@@@@@..@.@..@.@.@.@.@.@..@@@@@@.@.@@@@.@..@.@.@@.@..@@@...@..@..@.@..
@@@.@@@.@@@@@@@@.@@.@..@..@@.@.@@@@@@@@@@@@@@@@@..@@@@@@@.@@@@@.@.@..@..@@..@@.@@@@@.@@@@@.@@...@.@@@@@..@@@@@@@@.@@@.@@@@@@@..@@@@.@@.@...
@@@@.@@.@@@@.@@.@@.@.@.@@@@.@@@@.@.@.@@@@@@...@..@.@@@...@@@@.@@@@@@.@@.@..@@@@@@@..@@@@@@.@..@@@.....@@....@@@@.@@@.@@.@.@..@..@@@@@.....@
..@@@.@.@@.@@@@@@@.@.@@@@@..@.@@@@@..@@..@@@.@@.@@@@@@@@@@@..@@@.@.@@.@.@.@@..@.@@.@@.@.@@@@@@@@.@@@@@@@.@.@.@@@@@.@@@...@@@@..@@.@@@...@@@
@@.@@..@.@@@@@..@@..@@@.@@@..@..@.@@.@@@@@@@@.@@@@@@@@.@@.@@@.@...@@@@@@@@.@...@...@@@...@@@@@.@@.@.@..@.@..@@@@@@@..@@.@.@@@.@@@.@...@..@@
@@.@..@.@@.@.@@@.@@.@...@@.@@.@@.@@@@@@@@.@@.@@@@@@@@.@@.@.@@@@@.@..@@@@@@@@.@@@@...@.@@@...@@@@@...@@@..@@@@@@.@@@...@.@@@@@@@.@@@@@@.@...
@.@@@.@..@@@.@@@@@@..@@@...@@.@@@@.@@.@@.@..@@@@..@@.@@@@@..@...@.@@.@@..@@..@@..@@@@@...@@@@@@@@.@@@@.@.@@@..@@...@.@@@...@@@@@@.@@..@@.@@
@@@@.@@.@@..@@.@@.@.@.@@@@.@@@@@@.@...@@@@@.@@@@@@....@@@@.@@@@@@@@@@@@@@..@@@@@@@..@@@@....@@@@.@..@@....@@@@@@@.@.@@@@@@@@@@@@@@@@..@@..@
@@@@.@.@..@.@@@@.@@@@.@@@@@@.@@@@...@@@@@@...@.@@@@....@@@@.@@@@..@@.@@@@.@@@@@..@@@@.@.@@@.....@@.@@@.@..@@@@.@@.@@.@@.@@.@@...@...@@@@..@
.@@@@@.@..@..@@.@@@@@@@@@..@@.@..@.@@.@@..@@@@@@@@@@.@..@.@@@@@@@.@...@@.@@..@..@..@@@...@@@@.@@@@@@@.@@.@.@.@@..@.@..@.@@.@@@@@@@@.@.@.@..
@@@@@@@..@@@@@@.@.@@@@@@@@.@@.@.@..@.@@.@@@@..@.@@.@.@@@@@@@..@@@@.@@@....@@@.@@@@.@@..@@@..@...@.@@.@.@@@@@.@@@..@@@....@..@@@..@@@@@.@@..
@.@...@.@.@@@.@@.@.@@@@..@.@.@...@..@.@@@@...@.@@@@@..@@@@@@@@...@.@@.@.@.@@@@@@@@@..@@@.@@@@@@@@@@@@@@@@..@.@.@.@@@@@.@@.@@@@@.@@@@@.@@@@@
@@@@.@@@@@@@.@@.@@.@@@@.@@.......@..@.@@...@@@@@@@@.@@@@@.@.@@@@@@@@.@@....@@...@.@@@..@@@@@@..@.@@...@.@.@@@@.@@@.@....@@@@@@@..@@@@@.@@@@
.@@..@.@@@.@@@..@@@@@@@@@@@@@.@...@@@@.@@@.@@@@@@@@.@@@@@.@@@..@@.@@@.@@@@@.@@@@@.@@@@@@@@@@@...@..@@.@.@.@.@@@.@@.@@...@@.@@..@@@@..@.@.@@
.@@.@.@..@@@@.@@.@@@.@@..@@.@@@@@@@@@@@@@@....@.@@..@.@@@..@@@@.@@..@@@.@@@@@@@.@..@......@.@.@@@@..@..@@@@.@@@@..@@@.@@@@..@@.@.@@@@@@.@@.
@..@@@@..@@.@@..@@..@@.@@@@@@.@@@@.@...@.@.@.@@.@@.@@.@@@@..@@@@@@@@@@@...@@@@@.@@.@.@@..@@........@.@@@@@.@..@@@@..@.@......@@@@.@@@@@@@.@
.@.@.@@@..@@@@@@@@@..@@@@@@@@.@.@@@@@...@@..@@@..@.@@@@.@@..@.@@.@@@@.@@..@.@.@@@.@@.@@@@@@@@@@@@@..@@..@@.@@@@...@@...@@@@@@@@.@@@.@@.@@@@
@..@@.@@@@@@@@@..@@@@@@.@..@.@@@..@@.@.@@.@..@@@@@@@.@@@@.@@@.@@.@@...@@..@@@.@@..@@@@.@..@.@.@.@@.@@@@@@@@.@...@@.@.@@@@@.@.@@@.@.@@.@.@.@
.@@@...@.@....@@@.@@@@...@@..@@.@@@@@@@@@@@@..@..@.@@@.@.@@..@.@@.@.@@@@.@.@..@.@@@@@@@.@.@.@..@@@@@...@@@@@@@@...@@@@@@@@@.@@@@@@@..@@@@@@
.....@...@.@@@..@@@.@@@@@.@@.@.@.....@@.@@...@@@@.....@@@@.@@@@@@@@.@@@..@@..@@.@@.@@@@@@@@..@..@..@@..@.@..@@@.@@@@.@@@@@@@..@@@.@@@..@@@.
.@@@@.@@..@@.@@@@@@@..@@@.@@@.@@@@@@.@@....@@@@.@@.@.@.@@@..@..@.@@..@@@@@@@@.@@@.@..@@@@.@@@.@.@@@.@@.@@@..@@@@@@@..@.@@@@@.@...@.....@...
.@@@@.@@@@..@.@@@@@@...@@@@@..@@.@@@@..@.@@.@@..@@@@@@..@@@@@.@@@@.@....@@@@@@@@@.@.@@..@@@@.@@@@@@.@.@@@@@@@@@@@@.@.@@@@@@@@@@..@.@.@.@...
@@..@@@.@@@.@@@@@@..@@@@@@.@@@@@@..@@@.@@..@@@@@@@..@@@@@@.@@@@@@@@@@@@@..@.@.@.@..@.@@@@@@.@@@..@....@.@.@@@...@@.@.@.@@@@@@.@.@..@@..@@@@
@@..@@.@@@@@@@@@.@@@@@@..@@@@@..@@@.@@..@@@@@@@@..@..@.@.@.@.@.@..@....@@.@@@.@@@@@@@@.@@@.@@@@@@.@.@.@@.@..@@@@@@@@@.@@@@..@..@.@@...@.@@@
@@@@@@@@@@@@.@@@.@@@@@@@@@..@.@.@....@@@.@@.@@@@@@....@@@.@@...@@@.@.@@@..@@@.@@@.@@@@@@.@@@.@@@@.@.....@@@@@@@@.@@.@@@@@@@.@.@.@.@@.@@.@@@
@..@@@..@.@..@@.@@.@@@@@@@@@@@@@@@@.@@@...@.@..@...@.@@@@@@@@@..@@.@@@@.@.@@@@..@.@@@@@@@..@@...@@@..@..@..@@.@@@@.@@@.@@@..@...@.@.@@.@@@@
@@@.@@.@@@..@..@@@@@@@@@@.@...@@@@.@@@.@.@.@.@@@@@.@.@@@@@.@@.@@..@...@@@..@.@.@.@@@@@@.@@@@..@@@@.@.@..@....@@@.@@.@@@@.@@@@@@..@@...@@.@.
.@@@@.@@@@@@.@@@@@...@@@@.@@@@.@@@..@@@@@@@.@@@@@@@@@@...@@...@@@@@@...@@@@@@@.@@@..@..@@@.@..@.....@..@.@@..@@@@@@@@@..@@.@.@..@@@@@@.@@@@
@@.@@@...@.@@@@@.@...@@@.@@@@.@@@.@@.@@@.@.@@@@...@@@@.@@.@@@.@@@...@.@..@@@.@@@@@.@.@@@.@@@@@@@.@@..@@@@...@..@...@@@..@@@@@@@.@..@@..@@@.
@@@@@.@@.@..@@...@@@@.@@@@@..@@@..@@...@...@@@@@@@@@@.@@.@.@.@@.@@@@@@..@@@@@@.@@@@@@@@.@@@.@.@..@@.@@@@...@..@@@@@@.@.@@..@@..@@....@.@@@.
.@@@..@.@.@@@@@@.@@.@@@@@@.@@@.@@.@.@.@@..@...@.@@@.@.@@.@@@@@@.@@.@@@@@..@@@@...@@@..@...@@...@@..@.@.@@@.@.@@@@@.@@.@@@@.@@@.@@@@...@@@@@
@@.@.@..@@....@@.@@@@@@@.@@@.@..@@@@..@@@@.@.@@@@@.@@....@@@@@@@@@.@@..@.@@....@.@.@.@@@@@@@@.@@@@..@..@.@@.@@@..@...@@@@@.@..@@..@@@.@.@@.
@@.....@@@@@@@..@@@....@@@.@..@..@@.@..@@..@..@.@@@@.@@.@@@@@@.@@@..@@@.@@.@.@.@@@@@@@@@.@@..@.@.@@.@@@@@...@.@@@@@@@@.@@@@.@@@@.@@@..@.@@@
.@@....@@@@@@@.@@@.@.@@@.@.@@..@.@@@.@@@@@@.@@@@@..@@.@@@.@@..@.@@..@@@@@@@@@@@@@@...@@@@.@.@....@..@@@.@@@@@..@@@@@.@@@@@@@@@@@.@...@@@@@.
..@@@@.@@..@@@@@.@@@@@@@.@@..@@@@@.@...@@..@.@@@@@@@@@@@@@@@.@@@@..@@@.@@@@@@@@..@@@@@...@@@@@.@@@@@@.@.@.@...@@@...@@@@@@.@@@@.@@..@@@@@@@
@@@.@@@@@..@@@....@.@.@@@.@..@@.@@@@@@@@.@@..@@.@.@@@@.@..@@@.@@.@@@@@@@@@@.@.@.@@.......@@@@@..@@@..@@@@.@@@@@@@@@.@.@@@.@@..@@..@@.@@@..@
...@@@@.@@@@@@@@@@@@@@..@@.@..@.@@.@@@@@@@@@@@.@@.@@@@.@.@@@@.@@@@@...@.@@@.@@@@@.@@.@@@..@@@..@@@@@@@@@@@@@@@@@@@@@@@..@.@.@.@.@@.@.@@@.@@
@.....@@@@.@@@..@@@@..@.@@.@@@.@@.@@@@@@..@@@@@@@@@@..@..@@.@@@.@@@@@.@@@.@@@@@@.@.@@@@@@@@@@@@@@..@@..@.@@.@@@@..@@@.@@@..@@@...@@@@.@@@@@
@...@.@.@@.@@@@@@@..@.@@.@@@...@@@@@@@@@@@@.@@@@@@@@.......@@@..@@.@@@..@.@@.@.@@@@@..@...@@.@..@.@.@@@@@@@@@.@@.@.@...@@@.@@@@.@@@.@..@@@.
@@@@@@...@@.@@@@.@@@@.....@@.@@@.@..@@.@@@@@@@.@@.@@@@@@.@.@.@@@@@.@..@@@@@@@@@.@..@@.@@@.@@@.@.@.@@@..@@..@@@.....@....@@@@@@@.@@@@.@.@..@
.@@..@@@@@@@@@@.@@@.@@@@..@@@.@@@@.@@@@@...@..@@@.@@.@@@@.@..@@.@@@.@.@@...@@@@@@...@@@.@@@@@@@@@@..@..@.@@@@@...@.@@@@@..@@@@.@.@.@@@@.@..
@@@@..@@..@@@@@@.@@@.@@@@@...@@@@.@@@..@@.@@@@@@.@.@@@@.@@..@@@@.@@@.@...@......@@@@@@..@@@@@@.@@.@@@@..@@.@@@@.@@.@@@.@@.@@@@.@@..@@..@@.@
@@@..@@@@.@.@@...@@.@@@@@@@....@.@@..@@@@@..@.@@@@@@@..@@@@@@..@.@@.@.@@...@...@@@.@@@@@@..@.@@..@@@..@@@.....@.@@@@@@.@@.@@@.@@.@@@@@@....
...@@@.@..@@@.@.@@@@@...@@.@@.@@@.@@.@.@.@@.@@@@@@@.@@@@..@@@@@@...@@@..@..@.@.@@.@@@@@....@@@@@@.@@@@@@@..@@..@.@@@@@@@@@@@.@@@@.@@.@@@@@@
@..@@@@@..@@@@...@.@@@.@@@.@@@@..@@@.@@@@@@@@@@..@...@@..@@@@@@.@@@@..@@@@@@@@@.@.@.@@@..@@@@@@.@.@@@...@@@.@@@.@@@@@@@@@@.@@.@.@...@@@@@@.
..@@@@@@.@@@.@@@@@@.@@@@@@@..@.@.@@.@@@@@@@@.@.@@@@@.@@.@.@@..@@@@@@.@@..@..@@@.@@@@@@..@.@...@@@@.@@@@..@@@@@@@@@@.@.@@.@...@@@....@@..@.@
.@....@...@@@@@@..@.@.....@@.@@@.@.@.@@.@.@.@.@@@@@.@@@@.@@@@@.@@.@@@@@@.@@@.@@@.@..@@@@@.@..@@@@@.@.@..@@.@@...@@.@.@@@.@@@.@.@@@@@.@@@@@@
...@.@@@@@@@@@@@..@..@@@.@@@@@@@.@@@.@.@@.@@@....@.@@@.@@@@..@@.@@.@@.@.@.@@@@@@...@.@@..@@.@.@@..@.@@@@.@@@...@..@.@@@..@..@@@@@@@@..@@..@
@@.@@@@@@@....@.@@..@.@@.@@@.@.@@@......@.@@@..@.@.@.@...@@..@@@.@@@.@.@@@@@..@@@@.@..@@@@@@@...@@@@@.@....@.@@..@@@@@@@@.@.@@@.@@@@..@..@@
@@.@@.@.@@.@@@@......@..@.@@@@@.@@.@@@@@@@@@@@.@@@@@@@@@@@@@@@@@@..@@..@@@.@@@.@@@@@.@.@@@@@..@.@@...@@@@..@.@.@...@@@@@@@@@.@.@@@.@.@@@@.@
@@@.@@@@@@@@@@@@@@@.....@@@..@@@.@.@.@@@.@..@.@.@.@@...@..@..@.@@@.@.@@@@@@.@@...@.@@@@..@@@@@.@@.@@@.@..@@..@@@@@@.@@@..@.@.@@.@@@@@@.....
@@..@@@@.@.@.@@@@@@@@.@@@@@...@@.@@@@@@@.@@@@@@@.@@@@@.@@@.....@.@@@@....@.@.@@@.@.@.@.@@@@@@....@.@@@...@@@@.@@@@...@@@@@@@.@@.@@@....@.@@
@@@@@.@@.@...@@....@..@@@..@@.@@@...@.@@@@@.@.@@@@@.@@@@@@.@@@@@.@.@@@@..@.@@.@@@@@@.@.@@@@@@@@.@@...@.@@..@@..@.@.@@@.@@@@@@@@@@.@....@@.@
@@@@.@.@..@.@..@.@.@@@@@.@@@.@@@@...@@@..@.@@.@...@.@@.@@.@@@@..@@@@@@@@@@@@.@@@@@.@.@@@@.@@@@.@.@.@....@@@@@.@.@.@@.@@@@@@@@@..@@@@@..@@.@
@@.@@@@.@.@....@@@.@@@@.@..@@@@@@@.@@@@@@@....@@...@@@@@@...@@@.@@.@@@@.@@@@@@@@@@@.@.@@@@.@@@@@@@@@.@.@@@.@@@.@....@@.@.@..@@@@@@@@@.@.@@@

1170
2025/5.txt Normal file

File diff suppressed because it is too large Load Diff

0
2025/6.txt Normal file
View File

15
2025/Makefile Normal file
View File

@@ -0,0 +1,15 @@
CXX := clang++
CXXFLAGS := -std=c++17 -Wall -Wextra -I. -O3
TARGET := aoc
SRC := aoc.cpp
all: $(TARGET)
$(TARGET): $(SRC)
$(CXX) $(CXXFLAGS) $(SRC) -o $(TARGET)
clean:
rm -f $(TARGET)
.PHONY: all clean

BIN
2025/aoc Executable file

Binary file not shown.

237
2025/aoc.cpp Normal file
View File

@@ -0,0 +1,237 @@
#include <iostream>
#include <chrono>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <vector>
#include "aoc.hpp"
#include "day1.hpp"
#include "day2.hpp"
#include "day3.hpp"
#include "day4.hpp"
#include "day5.hpp"
void GenerateDay(int day, std::filesystem::path base)
{
std::cout << "Generating template for day " << day << std::endl;
std::ostringstream className;
className << "Day" << std::setw(2) << std::setfill('0') << day; // Day01
std::string classStr = className.str();
std::string headerName = "day" + std::to_string(day) + ".hpp"; // day1.hpp
std::string inputName = std::to_string(day) + ".txt"; // 1.txt
std::filesystem::path headerPath = base / headerName;
std::filesystem::path inputPath = base / inputName;
if (std::filesystem::exists(headerPath)) {
std::cerr << headerName << " already exists. Aborting." << std::endl;
return;
}
std::ofstream out(headerPath);
if (!out) {
std::cerr << "Failed to write " << headerName << std::endl;
return;
}
out << "#pragma once\n";
out << "#include \"aoc.hpp\"\n\n";
out << "class " << classStr << " : public AOCDay\n";
out << "{\n";
out << "public:\n";
out << " " << classStr << "() {}\n";
out << " ~" << classStr << "() {}\n";
out << " int Day() override { return " << day << "; }\n\n";
out << " uint64_t PartOne(File& f) override\n";
out << " {\n";
out << " return 0;\n";
out << " }\n\n";
out << " uint64_t PartTwo(File& f) override\n";
out << " {\n";
out << " return 0;\n";
out << " }\n";
out << "};\n\n";
out << "ADD_AOC_DAY(" << classStr << ");\n";
out.close();
std::ofstream input(inputPath);
input.close();
std::cout << "Generated:" << std::endl;
std::cout << " " << headerPath << std::endl;
std::cout << " " << inputPath << std::endl << std::endl;
std::cout << "Remember to include `" << headerName << "`" << std::endl;
}
int main(int argc, char** argv)
{
std::cout << "Advent of Code 2025 runner" << std::endl;
std::cout << "©Ben Kyd 2025, All Rights Reserved" << std::endl;
// Very shit command-line parsing :tm:
int run_day = 0;
int num_runs = 1;
std::filesystem::path base = "./";
for (int i = 1; i < argc; ++i)
{
std::string arg = argv[i];
// Day flag
if (arg == "-d" || arg == "--day")
{
if (i + 1 >= argc)
{
std::cerr << "Error: -d requires a day number\n";
return 1;
}
++i;
run_day = std::atoi(argv[i]);
std::cout << "Selected day to run: " << run_day << "\n";
}
// Runs flag
if (arg == "-r" || arg == "--runs")
{
if (i + 1 >= argc)
{
std::cerr << "Error: -r requires a number of runs\n";
return 1;
}
++i;
num_runs = std::atoi(argv[i]);
if (num_runs < 1) num_runs = 1;
std::cout << "Number of runs for averaging: " << num_runs << "\n";
}
// Path flag
if (arg == "-p" || arg == "--path")
{
if (i + 1 >= argc)
{
std::cerr << "Error: " << arg << " requires a path\n";
return 1;
}
++i;
base /= argv[i];
std::cout << "Selected base path: " << base.string() << "\n";
}
if (arg == "-g" || arg == "--generate")
{
if (i + 1 >= argc)
{
std::cerr << "Error: -g requires a day number\n";
return 1;
}
++i;
GenerateDay(std::atoi(argv[i]), base);
return 1;
}
// Help flag
if (arg == "help" || arg == "--help" || arg == "-h")
{
std::cout << "\nUsage:\n"
<< " -d [day] Run a specific day\n"
<< " -r [runs] Number of runs to average timings (default: 1)\n"
<< " -p [path] Set a base path for input\n"
<< " -g [day] Generate a new day! (Still need to add to compiler)\n"
<< " help Show this help message\n"
<< " (no args) Run all days\n";
return 0;
}
}
//
// Run days
if (run_day == 0)
{
for (auto& [num, day] : GetRegisteredDays())
{
std::cout << "Running Day " << num << ":\n";
std::string filename = std::to_string(num) + ".txt";
std::filesystem::path path = base / filename;
std::cout << "Reading " << path << "..." << std::endl;
File file{path};
File file1{path};
uint64_t partOne = day->PartOne(file);
uint64_t partTwo = day->PartTwo(file1);
std::cout << "Part 1: " << partOne << "\n";
std::cout << "Part 2: " << partTwo << "\n";
}
}
else
{
for (auto& [num, day] : GetRegisteredDays(run_day))
{
std::cout << "Running Day " << num;
if (num_runs > 1) {
std::cout << " (averaging over " << num_runs << " runs)";
}
std::cout << ":\n";
std::string filename = std::to_string(num) + ".txt";
std::filesystem::path path = base / filename;
std::cout << "Reading " << path << "..." << std::endl;
// Storage for timing results
std::vector<double> part1_times;
std::vector<double> part2_times;
std::vector<double> total_times;
part1_times.reserve(num_runs);
part2_times.reserve(num_runs);
total_times.reserve(num_runs);
uint64_t partOne = 0;
uint64_t partTwo = 0;
// Run multiple times
for (int run = 0; run < num_runs; ++run)
{
File file{path};
File file1{path};
auto start = std::chrono::high_resolution_clock::now();
partOne = day->PartOne(file);
auto endpart1 = std::chrono::high_resolution_clock::now();
auto startpart2 = std::chrono::high_resolution_clock::now();
partTwo = day->PartTwo(file1);
auto end = std::chrono::high_resolution_clock::now();
part1_times.push_back(std::chrono::duration<double, std::milli>(endpart1 - start).count());
part2_times.push_back(std::chrono::duration<double, std::milli>(end - startpart2).count());
total_times.push_back(std::chrono::duration<double, std::milli>(end - start).count());
}
// Calculate averages
double p1_avg = std::accumulate(part1_times.begin(), part1_times.end(), 0.0) / num_runs;
double p2_avg = std::accumulate(part2_times.begin(), part2_times.end(), 0.0) / num_runs;
double total_avg = std::accumulate(total_times.begin(), total_times.end(), 0.0) / num_runs;
// Print results
std::cout << "Part 1: " << partOne << " - took "
<< std::fixed << std::setprecision(3) << p1_avg << "ms" << std::endl;
std::cout << "Part 2: " << partTwo << " - took "
<< std::fixed << std::setprecision(3) << p2_avg << "ms" << std::endl;
std::cout << "Day " << run_day << " ran in "
<< std::fixed << std::setprecision(3) << total_avg << "ms" << std::endl;
}
}
}

369
2025/aoc.hpp Normal file
View File

@@ -0,0 +1,369 @@
#pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <filesystem>
template<typename T>
class Grid
{
public:
Grid() = default;
Grid(size_t h, size_t w) : height(h), width(w), data(h * w) {}
Grid(const std::vector<T> d)
: height(d.size())
, width(d.empty() ? 0 : d[0].size())
, data(d) {}
size_t Height() const { return height; }
size_t Width() const { return width; }
const T& At(size_t r, size_t c) const
{
return data[r * width + c];
}
const T* SafeAt(size_t r, size_t c) const
{
if (r >= height || c >= width) return nullptr;
return &data[r * width + c];
}
void ReplaceAt(size_t r, size_t c, const T& value)
{
data[r * width + c] = value;
}
size_t Neighbours4(size_t r, size_t c, const T* out[4], bool wrap = false) const
{
size_t count = 0;
if (wrap)
{
out[count++] = &data[((r - 1 + height) % height) * width + c];
out[count++] = &data[((r + 1) % height) * width + c];
out[count++] = &data[r * width + ((c - 1 + width) % width)];
out[count++] = &data[r * width + ((c + 1) % width)];
} else
{
if (r > 0)
out[count++] = &data[(r - 1) * width + c];
if (r + 1 < height)
out[count++] = &data[(r + 1) * width + c];
if (c > 0)
out[count++] = &data[r * width + (c - 1)];
if (c + 1 < width)
out[count++] = &data[r * width + (c + 1)];
}
return count;
}
size_t Neighbours8(size_t r, size_t c, const T* out[8], bool wrap = false) const
{
size_t count = 0;
if (wrap) {
for (int dr = -1; dr <= 1; ++dr)
{
for (int dc = -1; dc <= 1; ++dc)
{
if (dr == 0 && dc == 0) continue;
size_t rr = (r + dr + height) % height;
size_t cc = (c + dc + width) % width;
out[count++] = &data[rr * width + cc];
}
}
} else {
for (int dr = -1; dr <= 1; ++dr)
{
for (int dc = -1; dc <= 1; ++dc)
{
if (dr == 0 && dc == 0) continue;
size_t rr = r + dr;
size_t cc = c + dc;
if (rr >= height || cc >= width) continue;
out[count++] = &data[rr * width + cc];
}
}
}
return count;
}
private:
size_t height = 0;
size_t width = 0;
std::vector<T> data;
};
struct FileFragment
{
int Line, Col;
std::string Data;
};
inline std::pair<FileFragment, FileFragment> SplitToken(std::string del)
{
}
class File
{
public:
File() = default;
explicit File(const std::filesystem::path& path)
{
Load(path);
}
void Load(const std::filesystem::path& path)
{
if (!std::filesystem::exists(path))
{
throw std::runtime_error("File " + path.string() + " does not exist");
}
std::ifstream file(path.string());
if (!file.is_open())
{
throw std::runtime_error("Failed to open file " + path.string());
}
_lines.clear();
std::string line;
while (std::getline(file, line))
{
_lines.push_back(line);
}
}
/// Split each line by a multi-character delimiter
void SplitBy(const std::string& delim)
{
_tokens.clear();
for (size_t lineIndex = 0; lineIndex < _lines.size(); ++lineIndex)
{
const auto& line = _lines[lineIndex];
std::vector<FileFragment> lineTokens;
size_t start = 0;
int colIndex = 0;
while (true) {
size_t pos = line.find(delim, start);
if (pos == std::string::npos)
{
lineTokens.push_back({
static_cast<int>(lineIndex + 1),
colIndex,
line.substr(start)
});
break;
}
lineTokens.push_back({
static_cast<int>(lineIndex + 1),
colIndex,
line.substr(start, pos - start)
});
start = pos + delim.size();
++colIndex;
}
_tokens.push_back(std::move(lineTokens));
}
}
void SplitByIndex(const int index)
{
_tokens.clear();
_tokens.reserve(_lines.size());
for (size_t lineIndex = 0; lineIndex < _lines.size(); ++lineIndex)
{
const auto& line = _lines[lineIndex];
std::vector<FileFragment> lineTokens;
// Bounds check
if (index < 0 || static_cast<size_t>(index) >= line.size())
{
// Just return whole line as single token if index is out of range
lineTokens.push_back({
static_cast<int>(lineIndex + 1),
0,
line
});
}
else
{
// Left part (may be empty, e.g. index = 0)
lineTokens.push_back({
static_cast<int>(lineIndex + 1),
0,
line.substr(0, index)
});
// Right part (may be empty)
lineTokens.push_back({
static_cast<int>(lineIndex + 1),
1,
line.substr(index)
});
}
_tokens.push_back(std::move(lineTokens));
}
}
/// Access tokens for a given line (1-based)
const std::vector<FileFragment>& TokensForLine(int line) const
{
if (line < 0 || line > static_cast<int>(_tokens.size()))
{
static const std::vector<FileFragment> empty;
return empty;
}
return _tokens[line];
}
// Access a chunk of tokens for a given line
// E.g. Iterate [1,2], [2,3], [3,4]
std::vector<std::vector<FileFragment>> ChunkView(int line, size_t size, size_t stride)
{
const auto& v = _tokens[line];
std::vector<std::vector<FileFragment>> chunks;
if (v.empty() || stride == 0)
return chunks;
for (size_t i = 0; i + size <= v.size(); i += stride)
{
std::cout << "max " << i + size << " tokens " << v.size() << " index " << i << " size " << size << " stride " << stride << std::endl;
chunks.emplace_back(v.begin() + i, v.begin() + i + size);
}
return chunks;
}
template<typename T>
Grid<T> AsGrid() const
{
const size_t height = _lines.size();
if (height == 0) return Grid<T>(0, 0);
const size_t width = _lines[0].size();
Grid<T> grid(height, width);
for (size_t r = 0; r < height; ++r)
{
const auto& line = _lines[r];
for (size_t c = 0; c < width; ++c)
{
char ch = line[c];
if constexpr (std::is_constructible_v<T, char>)
{
grid.ReplaceAt(r, c, T(ch));
}
else if constexpr (std::is_constructible_v<T, std::string_view>)
{
grid.ReplaceAt(r, c, T(std::string_view(&ch, 1)));
}
else if constexpr (std::is_arithmetic_v<T>)
{
if (std::isdigit(ch))
grid.ReplaceAt(r, c, T(ch - '0'));
else
throw std::runtime_error("Grid<T>: cannot convert character to numeric T");
}
else
{
static_assert(sizeof(T) == 0, "Grid<T>: T must be constructible from char or string_view");
}
}
}
return grid;
}
/// Iterate through all lines and their tokens
auto begin() const { return _tokens.begin(); }
auto end() const { return _tokens.end(); }
/// Access raw lines (before splitting)
const std::vector<std::string>& Lines() const { return _lines; }
private:
std::vector<std::string> _lines;
std::vector<std::vector<FileFragment>> _tokens; // [line][token]
};
class AOCDay
{
public:
// The "driver" will expect the Name
// to have the same string as the input
// return 1 -> 1.txt
virtual int Day() = 0;
virtual uint64_t PartOne(File&) = 0;
virtual uint64_t PartTwo(File&) = 0;
};
inline std::unordered_map<int, AOCDay*>& GetRegisteredDays(int day = 0)
{
static std::unordered_map<int, AOCDay*> days;
if (day != 0)
{
static std::unordered_map<int, AOCDay*> single;
single.clear();
auto it = days.find(day);
if (it != days.end())
single[day] = it->second;
else
std::cerr << "Warning: requested day " << day << " not found.\n";
return single;
}
return days;
}
template<typename T>
struct AOCDayRegistrar
{
AOCDayRegistrar()
{
auto* instance = new T();
int day = instance->Day();
auto& days = GetRegisteredDays();
if (days.count(day))
{
std::cerr << "Duplicate registration for day " << day << "\n";
delete instance;
return;
}
days[day] = instance;
}
};
#define ADD_AOC_DAY(DAYCLASS) \
static AOCDayRegistrar<DAYCLASS> DAYCLASS##_registrar_instance;

74
2025/day1.hpp Normal file
View File

@@ -0,0 +1,74 @@
#include "aoc.hpp"
#include <algorithm>
#include <unordered_map>
class Day01 : public AOCDay
{
public:
Day01() {}
~Day01() {}
int Day() override {return 1;}
int dial = 50;
void RotateDial(int diff)
{
dial = (dial + diff) % 100;
if (dial < 0) dial += 100;
}
uint64_t PartOne(File& f) override
{
f.SplitByIndex(1);
dial = 50;
int res = 0;
for (const auto& lineTokens : f)
{
char direction = (char)lineTokens[0].Data[0];
int amount = std::stoi(lineTokens[1].Data);
if (direction == 'L')
{
amount = -amount;
}
RotateDial(amount);
if (dial == 0) res++;
}
return res;
}
uint64_t PartTwo(File& f) override
{
f.SplitByIndex(1);
dial = 50;
int res = 0;
for (const auto& lineTokens : f)
{
char direction = (char)lineTokens[0].Data[0];
int amount = std::stoi(lineTokens[1].Data);
int dir = 1;
if (direction == 'L')
{
dir = -1;
}
while (amount > 0)
{
RotateDial(dir);
if (dial == 0) res++;
amount--;
}
}
return res;
}
};
ADD_AOC_DAY(Day01);

109
2025/day2.hpp Normal file
View File

@@ -0,0 +1,109 @@
#include "aoc.hpp"
#include <algorithm>
#include <unordered_map>
class Day02 : public AOCDay
{
public:
Day02() {}
~Day02() {}
int Day() override {return 2;}
uint64_t PartOne(File& f) override
{
f.SplitBy(",");
uint64_t res = 0;
// Range of ID's (11-22)
for (auto range : f.TokensForLine(0))
{
int dash = range.Data.find('-', 0);
uint64_t a = std::stoll(range.Data.substr(0, dash));
uint64_t b = std::stoll(range.Data.substr(dash + 1));
for (uint64_t i = a; i <= b; i++)
{
// Convert number back into string
std::string current = std::to_string(i);
// import 'is-odd' lol
if (current.length() & 1) continue;
int mid = current.length() / 2;
uint64_t l = std::stoll(current.substr(0, mid));
uint64_t r = std::stoll(current.substr(mid));
if (l == r)
{
res += i;
}
}
}
return res;
}
uint64_t PartTwo(File& f) override
{
f.SplitBy(",");
uint64_t res = 0;
// For every range like "11-22" in line 0
for (auto range : f.TokensForLine(0))
{
int dash = range.Data.find('-', 0);
uint64_t a = std::stoll(range.Data.substr(0, dash));
uint64_t b = std::stoll(range.Data.substr(dash + 1));
// Loop every ID in the range
for (uint64_t id = a; id <= b; ++id)
{
std::string s = std::to_string(id);
int digits = s.length();
bool invalid = false;
for (int L = 1; L <= digits / 2 && !invalid; ++L)
{
// MUST divide evenly, otherwise blocks won't align
if (digits % L != 0)
continue;
uint64_t base = 1;
for (int i = 0; i < L; i++)
base *= 10; // base = 10^L
uint64_t block = id % base;
uint64_t tail = id;
int count = 0;
while (tail > 0)
{
if (tail % base != block)
break;
tail /= base;
count++;
}
if (tail == 0 && count >= 2)
invalid = true;
}
if (invalid)
res += id;
}
}
return res;
}
};
ADD_AOC_DAY(Day02);

103
2025/day3.hpp Normal file
View File

@@ -0,0 +1,103 @@
#include "aoc.hpp"
#include <algorithm>
class Day03 : public AOCDay
{
public:
Day03() {}
~Day03() {}
int Day() override {return 3;}
uint64_t PartOne(File& f) override
{
uint64_t totalJoltage = 0;
for (auto bank : f.Lines())
{
int joltage = 0;
// find biggest (can't be last)
int biggest = 0;
int biggestIndex = 0;
for (int i = 0; i < bank.length() - 1; i++)
{
if (bank[i] - '0' > biggest)
{
biggest = bank[i] - '0';
biggestIndex = i + 1;
}
}
joltage = biggest;
joltage *= 10;
biggest = 0;
for (int i = biggestIndex; i < bank.length(); i++)
{
if (bank[i] - '0' > biggest)
{
biggest = bank[i] - '0';
}
}
joltage += biggest;
totalJoltage += joltage;
}
return totalJoltage;
}
std::pair<int,int> FindNextBiggest(const std::string& s, int start, int k)
{
int remaining = 12 - k - 1;
int lastAllowed = s.size() - remaining; // inclusive upper bound
int bestDigit = -1;
int bestIndex = start;
for (int i = start; i < lastAllowed; i++)
{
int d = s[i] - '0';
if (d > bestDigit)
{
bestDigit = d;
bestIndex = i;
}
}
return { bestDigit, bestIndex + 1 };
}
uint64_t PartTwo(File& f) override
{
uint64_t totalJoltage = 0;
for (auto bank : f.Lines())
{
uint64_t joltage = 0;
int start = 0;
for (int k = 0; k < 12; k++)
{
joltage *= 10;
auto res = FindNextBiggest(bank, start, k);
joltage += res.first;
start = res.second;
}
totalJoltage += joltage;
}
return totalJoltage;
}
};
ADD_AOC_DAY(Day03);

134
2025/day4.hpp Normal file
View File

@@ -0,0 +1,134 @@
#pragma once
#include "aoc.hpp"
class Day04 : public AOCDay
{
public:
Day04() {}
~Day04() {}
int Day() override { return 4; }
uint64_t PartOne(File& f) override
{
const auto grid = f.AsGrid<char>();
int res = 0;
const size_t height = grid.Height();
const size_t width = grid.Width();
const char* neighbours[8];
for (size_t i = 0; i < height; i++)
{
for (size_t j = 0; j < width; j++)
{
if (grid.At(i, j) != '@') continue;
size_t count = grid.Neighbours8(i, j, neighbours);
// Unroll, unroll unroll
int rollsOfPaper = 0;
rollsOfPaper += (count > 0 && *neighbours[0] == '@');
rollsOfPaper += (count > 1 && *neighbours[1] == '@');
rollsOfPaper += (count > 2 && *neighbours[2] == '@');
rollsOfPaper += (count > 3 && *neighbours[3] == '@');
rollsOfPaper += (count > 4 && *neighbours[4] == '@');
rollsOfPaper += (count > 5 && *neighbours[5] == '@');
rollsOfPaper += (count > 6 && *neighbours[6] == '@');
rollsOfPaper += (count > 7 && *neighbours[7] == '@');
if (rollsOfPaper < 4) res++;
}
}
return res;
}
uint64_t PartTwo(File& f) override
{
const auto input = f.AsGrid<char>();
const size_t width = input.Width();
const size_t height = input.Height();
const char* neighbours[8];
std::vector<uint8_t> counts(width * height);
for (size_t i = 0; i < height; i++)
{
for (size_t j = 0; j < width; j++)
{
const size_t idx = i * width + j;
if (input.At(i, j) == '.')
{
counts[idx] = 255;
continue;
}
size_t count = input.Neighbours8(i, j, neighbours);
uint8_t roll_count = 0;
for (size_t k = 0; k < count; k++)
{
roll_count += (*neighbours[k] != '.');
}
counts[idx] = roll_count;
}
}
int64_t removed = 0;
bool updated = true;
Grid<uint8_t> grid(height, width);
for (size_t i = 0; i < height; i++)
{
for (size_t j = 0; j < width; j++)
{
grid.ReplaceAt(i, j, counts[i * width + j]);
}
}
while (updated)
{
updated = false;
for (size_t i = 0; i < height; i++)
{
for (size_t j = 0; j < width; j++)
{
uint8_t val = grid.At(i, j);
if (val >= 4) continue;
updated = true;
grid.ReplaceAt(i, j, 255);
removed++;
size_t count = grid.Neighbours8(i, j, (const uint8_t**)neighbours);
for (size_t k = 0; k < count; k++)
{
size_t ni, nj;
// AAAAA
const uint8_t* base = &grid.At(0, 0);
size_t offset = (const uint8_t*)neighbours[k] - base;
ni = offset / width;
nj = offset % width;
uint8_t nval = grid.At(ni, nj);
if (nval < 255 && nval > 0)
{
grid.ReplaceAt(ni, nj, nval - 1);
}
}
}
}
}
return removed;
}
};
ADD_AOC_DAY(Day04);

82
2025/day5.hpp Normal file
View File

@@ -0,0 +1,82 @@
#pragma once
#include "aoc.hpp"
#include <set>
class Day05 : public AOCDay
{
public:
Day05() {}
~Day05() {}
int Day() override { return 5; }
std::vector<std::pair<uint64_t, uint64_t>> freshIDs;
uint64_t PartOne(File& f) override
{
bool ranges = true;
int ret = 0;
for (auto line : f.Lines())
{
if (line == "")
{
ranges = false;
continue;
}
if (ranges)
{
int dash = line.find('-', 0);
uint64_t a = std::stoll(line.substr(0, dash));
uint64_t b = std::stoll(line.substr(dash + 1));
freshIDs.push_back({a, b});
}
else
{
uint64_t foodStuff = std::stoll(line);
for (auto range : freshIDs)
{
if (foodStuff >= range.first && foodStuff <= range.second)
{
ret++;
break;
}
}
}
}
return ret;
}
uint64_t PartTwo(File& f) override
{
// sort by first ID
std::sort(freshIDs.begin(), freshIDs.end());
uint64_t total = 0;
uint64_t curL = freshIDs[0].first;
uint64_t curR = freshIDs[0].second;
for (size_t i = 1; i < freshIDs.size(); i++)
{
auto [L, R] = freshIDs[i];
if (L > curR + 1)
{
total += (curR - curL + 1);
curL = L;
curR = R;
}
else
{
curR = std::max(curR, R);
}
}
total += (curR - curL + 1);
return total;
}
};
ADD_AOC_DAY(Day05);

22
2025/day6.hpp Normal file
View File

@@ -0,0 +1,22 @@
#pragma once
#include "aoc.hpp"
class Day06 : public AOCDay
{
public:
Day06() {}
~Day06() {}
int Day() override { return 6; }
uint64_t PartOne(File& f) override
{
return 0;
}
uint64_t PartTwo(File& f) override
{
return 0;
}
};
ADD_AOC_DAY(Day06);