From 0b525ccb1fc020daac1a33b76c28fd9eb79f88b2 Mon Sep 17 00:00:00 2001 From: Hans Goor Date: Sun, 7 Dec 2025 22:42:06 +0100 Subject: [PATCH] Add solution to day 5. --- 2025/aoc/aoc.cabal | 14 + 2025/aoc/app/day5/Main.hs | 75 +++ 2025/aoc/inputs/day5.txt | 1173 +++++++++++++++++++++++++++++++++ 2025/aoc/inputs/day5_test.txt | 11 + 2025/aoc/package.yaml | 9 + 5 files changed, 1282 insertions(+) create mode 100644 2025/aoc/app/day5/Main.hs create mode 100644 2025/aoc/inputs/day5.txt create mode 100644 2025/aoc/inputs/day5_test.txt diff --git a/2025/aoc/aoc.cabal b/2025/aoc/aoc.cabal index 09d8a06..7ab9494 100644 --- a/2025/aoc/aoc.cabal +++ b/2025/aoc/aoc.cabal @@ -93,6 +93,20 @@ executable day4 , base >=4.7 && <5 default-language: Haskell2010 +executable day5 + main-is: Main.hs + other-modules: + Paths_aoc + autogen-modules: + Paths_aoc + hs-source-dirs: + app/day5 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N + build-depends: + aoc + , base >=4.7 && <5 + default-language: Haskell2010 + test-suite aoc-test type: exitcode-stdio-1.0 main-is: Spec.hs diff --git a/2025/aoc/app/day5/Main.hs b/2025/aoc/app/day5/Main.hs new file mode 100644 index 0000000..2c681af --- /dev/null +++ b/2025/aoc/app/day5/Main.hs @@ -0,0 +1,75 @@ +module Main (main) where + +import Data.List (isPrefixOf, sort) + +type Range = (Int, Int) + +type FreshDatabase = [Range] + +takeWhileList :: ([a] -> Bool) -> [a] -> [a] +takeWhileList _ [] = [] +takeWhileList f (x : xs) + | f (x : xs) = x : takeWhileList f xs + | otherwise = [] + +splitOn :: (Eq a) => [a] -> [a] -> [[a]] +splitOn x [] = [] +splitOn x xs = + let e = takeWhileList (not . isPrefixOf x) xs + in e : splitOn x (drop (length e + length x) xs) + +processRange :: String -> Range +processRange s = + case splitOn "-" s of + [a, b] -> (read a :: Int, read b :: Int) + _ -> error "Invalid range!" + +isFresh :: FreshDatabase -> Int -> Bool +isFresh [] _ = False +isFresh ((start, end) : xs) v = start <= v && v <= end || isFresh xs v + +buildDatabase :: String -> FreshDatabase -> FreshDatabase +buildDatabase range db = processRange range : db + +freshIngredients :: FreshDatabase -> [Int] -> [Int] +freshIngredients db = filter (isFresh db) + +parseDatabase :: String -> FreshDatabase +parseDatabase = foldr buildDatabase [] . lines + +parseIngredients :: String -> [Int] +parseIngredients = map (\x -> read x :: Int) . lines + +parseInput :: [String] -> (FreshDatabase, [Int]) +parseInput [a, b] = (parseDatabase a, parseIngredients b) +parseInput _ = error "Wrong input!" + +part1 :: IO () +part1 = + getContents + >>= print . length . uncurry freshIngredients . parseInput . splitOn "\n\n" + +data RangeEvent = StartEvent | StopEvent deriving (Eq, Ord, Show) + +rangeCoverage :: [Range] -> Int +rangeCoverage = + (\(_, _, _, c) -> c) + . foldl countCoverage (0, 0, 0, 0) + . sort + . concatMap (\(s, e) -> [(s, StartEvent), (e, StopEvent)]) + where + countCoverage :: (Int, Int, Int, Int) -> (Int, RangeEvent) -> (Int, Int, Int, Int) + countCoverage (_, lastEnd, 0, coverage) (start, StartEvent) + | start == lastEnd = (start + 1, lastEnd, 1, coverage) + | otherwise = (start, lastEnd, 1, coverage) + countCoverage (lastStart, lastEnd, n, coverage) (_, StartEvent) = (lastStart, lastEnd, n + 1, coverage) + countCoverage (lastStart, _, 1, coverage) (end, StopEvent) = (lastStart, end, 0, coverage + ((end + 1) - lastStart)) + countCoverage (lastStart, lastEnd, n, coverage) (_, StopEvent) = (lastStart, lastEnd, n - 1, coverage) + +part2 :: IO () +part2 = + getContents + >>= print . rangeCoverage . fst . parseInput . splitOn "\n\n" + +main :: IO () +main = part2 diff --git a/2025/aoc/inputs/day5.txt b/2025/aoc/inputs/day5.txt new file mode 100644 index 0000000..d5d2b4b --- /dev/null +++ b/2025/aoc/inputs/day5.txt @@ -0,0 +1,1173 @@ +1655071119701-2036139951240 +282420790922884-290825089106666 +449386234224753-452115392068715 +93932960914364-97096041797051 +141069029205537-141782831115740 +86910356821814-88768842417878 +6074618800137-6919766515552 +312280995013442-314291814749698 +228408317456873-228408317456873 +248639241640267-250344640596798 +71612729890033-77571971108161 +141069029205537-141439781721936 +115455699917053-119739127275498 +213248850373267-220165671211298 +5375859256207-6074618800137 +1456801270414-1862815467074 +304970740108223-309078563473549 +38255039971915-38255039971915 +316846363862322-319717981047088 +84374268985162-86323996200785 +523718685006199-530321229089646 +235336029221686-239583999322242 +435477646107434-436004729023784 +149592458212773-149955416319994 +478434365075482-481569819739865 +383059647557664-386106067036209 +413258809107986-417714294228933 +140940285560201-141439781721936 +445953383992681-448411380758156 +410874486674553-411556204897556 +191539978545282-199539933703255 +262745896589483-267424515756810 +7943475911805-8678289919663 +413258809107986-413258809107986 +149068657061301-149592458212773 +51788272107026-59656827315788 +233635116196780-235336029221685 +313424067821390-316012763161771 +440371147822373-440938433143202 +3869663920914-4371641426307 +409871811407953-410317848010797 +201865410851063-208132721112038 +245101961133800-246661521061271 +147911543484598-148626352214953 +405079208406968-405660046218472 +463407578410441-466222675937857 +463407578410441-469970025274094 +172876836346765-179828231865718 +292967201192475-299118069515275 +516491003250364-518990617277806 +267424515756812-270066601161903 +215795681823224-220165671211298 +383059647557664-391428151448820 +7582330851238-8221734138618 +224558106245926-228408317456873 +61698995041022-69884347631459 +148626352214953-149317499860929 +402485160566513-403282601642719 +405660046218472-406464445503469 +4625611056497-5165363127104 +246145812892023-247251309735150 +438928237107625-439766507508486 +5886781937871-6074618800137 +3203006528874-3486334377171 +509602401977774-509602401977774 +307684522928-1110109620128 +454018108501111-462089665975548 +63766671898076-65655952039632 +456809042678061-458227093285318 +535862781913795-541174836228383 +44981127782956-48903279211723 +299118069515276-299118069515276 +15519289873818-17744961849726 +191539978545282-195248997572481 +393407539311640-398279097986826 +437430160816383-437912720262218 +241599152922884-242808655043892 +533885467078256-538341980112087 +441404534158889-441670875906124 +2581891194834-2938209235899 +5754910159277-5886781937871 +434932830803014-435578076468333 +247742893039025-249250450106907 +491054112566330-491054112566330 +505513053445065-509602401977774 +315257468674580-317675035942738 +105629678962501-109134858676431 +546570015578939-546570015578939 +8410633326027-8678289919663 +85907593907156-87680707094354 +71612729890033-74419824655567 +410874486674553-411043455686605 +41118938014282-47100018588253 +408960907412757-409871811407953 +111378694375343-115455699917052 +181639912998906-187405189535396 +433877475331933-434165674107044 +546570015578940-550907277679863 +272295175227785-272295175227785 +447576091595224-450467703765211 +794175129155-1456801270414 +407711674000795-408308227200346 +528281574171527-530321229089646 +555014039423328-560747532698997 +498685252592714-500535937758878 +324039920477225-329643132044797 +272295175227785-280630653823210 +131862233254102-136598229137385 +356119063703161-359632553973214 +435211085990270-436004729023784 +163670453018644-169458398765566 +376326840890413-379742847570968 +103362892420026-105629678962499 +11051622749117-17744961849726 +327274832235706-329643132044797 +147549698244422-148092107411926 +124216845078648-129072508999878 +395749249678667-400331556316934 +254858524011711-258882206286305 +335849789798639-338039926388684 +254858524011711-258882206286305 +438498997381838-438635963627099 +136598229137385-136598229137385 +425031887133980-428925354127549 +402485160566513-402996070607518 +93932960914363-93932960914363 +81926643832307-83669224754435 +24453454414952-24453454414952 +243229285253014-244572543121239 +83350550926534-85294997885460 +473406359132554-478434365075480 +442415536818876-445332303039440 +335849789798638-335849789798638 +32060173997759-38255039971914 +51788272107026-59656827315788 +362937483688203-367433797533915 +174818460219114-177642786566376 +157151986572873-157151986572873 +372913350007794-376326840890411 +318817591194247-321433929601467 +439766507508486-440371147822373 +5375859256207-6074618800137 +309078563473549-309078563473549 +9091500660915-9446359256314 +353198600177047-356119063703160 +433308411983642-433877475331933 +433877475331933-434618989488580 +343342993115191-348444105423794 +494741622964928-498685252592713 +284581219392036-287127735445674 +362937483688203-367433797533915 +7943475911805-8410633326027 +147303259982849-147549698244422 +485564841619712-491054112566329 +155097583132186-157151986572872 +144788333057957-145642164960280 +407222990481964-407711674000795 +425031887133980-428925354127549 +555014039423328-555014039423328 +249893716111862-250989814662294 +80580557918318-82577264603263 +242388859287558-243657013061234 +409436008617675-409871811407953 +244232460133381-245777513292354 +147303259982849-147549698244422 +8410633326027-8678289919663 +201865410851062-201865410851062 +161603134668167-168016229054149 +444361684514399-446989989221557 +247141173111092-248195269505606 +88220642965230-90378292842065 +24453454414952-27950126097685 + +58492390712539 +257880818088899 +221094506591112 +141904249360786 +428773673911025 +89477928627906 +313589050213388 +269964932188378 +64254576248938 +267081016882098 +298134557785228 +474364796190026 +144838284276491 +81122335167400 +494746476901458 +230480688371562 +124562327691363 +202199622700398 +182490809772092 +114745181687397 +13588957488430 +505363836083585 +385813716934026 +117271469193054 +397842184979937 +523974941012758 +529716204983343 +126874245704709 +541163298878755 +356128593879407 +13333383247848 +328144334865659 +445303285232940 +229377669435367 +297507890017484 +454762301865278 +88609431617559 +432536283802759 +490773006913365 +168262812981996 +414806580748855 +135389972521029 +257673076225864 +191804630637587 +231691782229631 +132485949716399 +488662450387761 +145635389978257 +474195445564661 +112230282296339 +489633833171379 +122094029194756 +226109483569790 +454557712004723 +229358934103113 +80991696181079 +87298882932391 +21763394328308 +195452505776192 +273185658711453 +81276286183976 +320067836124903 +177389373768959 +176623194783683 +101385018092103 +112382846813840 +294231186020862 +449468080338352 +359037026496485 +413380583727475 +402192057637577 +388428745394308 +189761318905880 +217548714102653 +458311333575622 +298978558135493 +386228159026256 +553380372231816 +107919107818206 +287160826063873 +539606536515907 +523809032823945 +1416137365350 +72635139982064 +559646649180689 +447827468043914 +238046703245286 +8280913424378 +308637142700599 +554014794928663 +267580989485767 +527894060221642 +438559023769379 +399806528141445 +344218516739035 +365234003197351 +300000021147907 +423481473916873 +368326766108423 +232807443005138 +306963544865124 +538067019791726 +455969040018098 +32920847101688 +33788113063878 +481414498497946 +336735654577470 +25282481504639 +339234496280231 +372358712690652 +52790275388995 +141316589088682 +238478700970449 +464550806189082 +515644403085450 +214563878079298 +345458390235226 +162112365668631 +450851406660137 +432423012861472 +81753037866304 +75939099956457 +217718307611543 +448398602024625 +383440014490815 +425107307230625 +227449964628933 +325451449047691 +88139310627444 +449502739421263 +469484206352363 +184694529357734 +254687510484867 +85454343804486 +272782573955018 +381965058233257 +295235869262436 +13023825500482 +149725531044346 +488202148372149 +116509276374081 +363545235217180 +420408204279644 +428752177049302 +80906938398863 +449071348187691 +552707390082713 +13897310912568 +202191382925825 +449682403238298 +367839847394157 +174597352397700 +496792802688627 +28221968236348 +296749475828043 +293700652922013 +286669622175710 +145360947737766 +514304895534864 +118776279647349 +279968842685883 +298975182659158 +13336302448157 +76859266865647 +238821961095451 +425777344011003 +12296267617949 +235192472540222 +282426861154684 +523681253457175 +335171924052951 +24748138298570 +460722878819697 +58112626018855 +94257858937565 +406809895733881 +308428161986957 +304478129783221 +203576932984285 +550555389957363 +471077982927707 +95181130490289 +485885736110643 +497633565750421 +190527221027163 +319764239901587 +217301497440551 +536282120728826 +52558947345163 +466717866500280 +136492974179443 +30581454453792 +207286448565595 +554041751031762 +45443363878886 +216998613947238 +235767920879789 +487304505371460 +192750719302857 +259365448566088 +345393498973258 +540997657660996 +64316669981888 +307705788119621 +15676318156679 +318849461285036 +491989008858227 +509434278152210 +240054658189108 +39282722078912 +558299729297974 +66517524714385 +123104021163366 +136062163318660 +66469654306270 +365563581958885 +296690645233896 +107525522127008 +40804924040141 +35484018705868 +148342255165160 +416819307333991 +283522804178854 +171975870862460 +266070818750196 +44349501803088 +244414030618224 +95853910651653 +24380270761787 +186291916432974 +386199403723695 +286587117872987 +183926289543436 +538882129189262 +98586831520932 +555234758089737 +266963181403597 +125534922558496 +502418509122012 +350188934573967 +426442939853660 +86484427668259 +491300317101322 +109007791291573 +56501548661035 +477197919946524 +205107499763192 +166590941939093 +104422395024014 +445587141364959 +85185426295667 +278348607605231 +42949449134529 +263249063418743 +397024009054705 +3635395628307 +550143530603962 +96122938112295 +84266125170578 +131163138022818 +450193611215135 +156717190588010 +87715668010719 +182196134555996 +276956253313253 +42208406444988 +354942515701093 +463609169763625 +423287612585677 +50699614174884 +279885678316453 +71656379694898 +314580331890684 +440860909888667 +330855063955167 +153982471405425 +164948695997704 +184582266442924 +263945400092924 +498766275925335 +535515519299130 +549895617297678 +522207438937650 +224292563636659 +487382095312066 +393932297901813 +85871264808261 +68465890183994 +65033062283730 +224043849131423 +508115450601940 +473579424477302 +225364378497316 +190999312166273 +266309365152517 +399365102606725 +192301648821074 +148794360071829 +415048767661967 +396260689275360 +178263803550977 +334053976114828 +216802744157649 +176659423911077 +205219999781808 +198259423826617 +532663448231515 +427734509075325 +488023901079795 +135310600195224 +458970388985903 +42780974666164 +94171800275206 +66124859227784 +30445361775250 +445731275435747 +177444220806668 +44112910576269 +464803156793201 +59011971096232 +119832115111817 +350306267809014 +448367976617023 +390437592816903 +85996215915359 +352890124320001 +165699089888286 +145310922076251 +355061995661608 +87838688250733 +317305482608566 +175897519904928 +285358946809931 +84670199076128 +288415462211726 +297196365730772 +437783576641071 +184474651306175 +214749013391259 +32433247146078 +234345355889628 +461362973814882 +67477797025359 +465316230631526 +527322018701070 +410683612168165 +41930382247905 +37590203370625 +496486039779631 +319862921169396 +374818105013892 +374344884999551 +277882630436295 +37805588249008 +65117015353162 +265746124908577 +51850668845474 +455570476871304 +207004685747968 +385939760674573 +347758135160772 +105579195194389 +41216889779601 +72232868506649 +86065926377626 +362846489227322 +126470877529366 +155579433328996 +210259801604716 +207468878704894 +180957932916436 +375084963326751 +61453227454867 +114859012913991 +228258021750307 +522632603871927 +320241886744904 +286290570455286 +69688008395284 +65264176028316 +399622001535363 +176120548252637 +327846604894770 +15156289883817 +357690021103795 +480177758959128 +75651727097667 +268084210675502 +87561070980455 +561857167156200 +133178791616071 +182117098146556 +52090633315842 +344344401358607 +526873357419905 +324548742763942 +321911067829633 +216705492420891 +145930250871692 +244920250051730 +170995031501353 +536078308602134 +42761013732431 +199354938727620 +446911516792103 +250512757875530 +538719246443258 +217792720176263 +70217530311661 +237312328649258 +440646443778801 +476161494539330 +87432495142447 +385870613691706 +3984643897834 +217069926114950 +385754712419890 +56085934594459 +120073704979699 +216987733815952 +224347305934251 +297178786200210 +364653307987637 +127964247336810 +255802300672938 +176538821507611 +216230113857785 +335785145256137 +130036953389783 +558289731869968 +37245009626416 +525976363168633 +285699540117060 +546753517960210 +44499932332783 +439485591356651 +124363727514988 +222192523567327 +313530979351829 +156278543544793 +477791210376247 +537304310781138 +58071319194342 +109235325360508 +1875063497651 +302153003191445 +176687457517644 +107835242520097 +54085199127910 +331966116974625 +86510508082758 +459874117268580 +465225152964718 +95990066798585 +455377577192825 +1231054273982 +415630472825361 +185093624413782 +345264269881239 +9040448453304 +383151087294482 +290817723888819 +110663810554948 +536590090971326 +318124889220054 +57206093055360 +118570178946667 +62296390813409 +275941399765546 +509573330432992 +470149427909378 +128266503508620 +55911169285095 +243307149064428 +51822089214947 +9279530776380 +333930282248762 +27743871849712 +92258005347147 +545548345541121 +63046812372037 +410949083651853 +340518029013188 +337523702547128 +107417259345200 +533973408150671 +489554778098927 +161154956951944 +242847420976803 +543761833908705 +333545873353729 +227271256446733 +317917347015909 +376255609720719 +144231562701675 +16073222147041 +48840582934969 +141771778129668 +523748221879495 +68867452615604 +83029632981058 +408831210869063 +326676341129335 +383431856633747 +58043065888974 +396350290737297 +263689966582409 +338663170450337 +312723123203529 +494474248922621 +466083648646763 +67047935996700 +390807002672076 +477720502738018 +171465525901721 +514303851688353 +265724081825777 +237694949857465 +507024514636032 +428154434713604 +234736724833201 +481283777538864 +89158896272968 +174810610482794 +246249965235591 +319104497615111 +76237740347338 +175390538434441 +287187391035599 +459981977669011 +69145028345972 +548182200804060 +52839674123685 +96808872975775 +288523079330912 +354548026385052 +538254060261527 +9472595524137 +196396508540212 +460074812116165 +359870661641675 +345589053689140 +428197409016437 +336680841660493 +365864879476127 +391171215967810 +152591194504258 +491019518529590 +155897774166494 +538604375239233 +102458072093688 +7630041612543 +391086172205352 +366116516535710 +270397433451239 +396501706531687 +327031159861564 +317155792353685 +266905496916103 +271856354205246 +539901874162141 +58173585685980 +422943979855932 +363284530472938 +285072626476226 +242041157464758 +117083804930519 +284337628354257 +169544819587997 +186640517014691 +87669882408262 +549690591166922 +279171304259531 +449390739082513 +468694017058390 +428051924075211 +556381501070388 +164847269731707 +18709162801094 +201622391755989 +34234158839147 +72608243845922 +120468684570370 +111194971386796 +376286453118534 +85128372816371 +512666162971772 +218930691733095 +159142734141867 +136257347807855 +47230836882445 +428993325019449 +561465241332430 +109016033423473 +364254811192547 +327572274486902 +62309354422397 +538395618408851 +73587012564882 +445769372743256 +18854568982910 +290705904681255 +397004996875785 +242780345492290 +497383873767872 +464961894311230 +288592177816045 +251907409742298 +10989928687821 +496711685667067 +189795582271513 +508205300025366 +382407879181937 +305309974812000 +183657150434521 +515312180099693 +183287186414388 +85951004556411 +84615298669580 +132365457398028 +288076972516675 +510578476534964 +557358544414798 +1903077292882 +456380042994011 +210644943668764 +206952191923964 +153069928762205 +538564028142620 +13721016868762 +48441078073799 +197264400417909 +328629420637406 +317581806524263 +215820367596308 +117149817818643 +327383941487607 +249711911059895 +274383987524348 +234167400836766 +288159424200840 +83070838371528 +536669374926627 +202495512979204 +539519359017075 +5851964252128 +265030815718304 +210571430896649 +255305466408306 +528939860075696 +468409380384193 +156982270650580 +396148743621222 +445056727335124 +201329022215998 +32695012602919 +4631904467358 +538741251772266 +138409445773641 +528557622486548 +202868156099086 +355845904132304 +5103560039082 +351529836033099 +319439007759032 +463858285605282 +394877703521074 +350799809747815 +458391034553431 +195461946154940 +17185603611667 +41875559594101 +294580767429111 +148875332833851 +365849747739084 +124219699546975 +70699967467667 +376933356879585 +286686022083409 +323558911307049 +79186081438143 +266486467257511 +85150204913458 +44744576708888 +134140158764948 +172777671666114 +465908578857945 +389252610121627 +105936294623378 +315621527196756 +222261532301880 +136921960828890 +283117319459059 +42549501070976 +54677624439786 +250698991173858 +354649204726818 +191911989657975 +224587152272739 +320253470123829 +491853756849516 +443421390869807 +82903192860980 +29876065939528 +84396279488571 +59880543815361 +163568723309806 +379552968068534 +42244361613566 +251329646410591 +82055666962099 +503950442754811 +379593012153553 +185663250286428 +448591977220732 +238661723995257 +4238765966223 +184590643674274 +64472951272136 +351772640809599 +459002051140721 +544036931555050 +380793657276821 +327120585299495 +172391971495971 +360860189176013 +229930953274372 +12638609837200 +244132503877387 +377199541181464 +152507676106651 +313735928681443 +557405511533560 +33787940173389 +366298129008345 +388986501436747 +317857583827090 +542303078017579 +290324131530679 +237886728330823 +317754862790411 +558192160256492 +333522032732089 +226307800918022 +411311069466077 +474982992768452 +35093696815876 +357698817308495 +366074936399291 +431917214848784 +248333946789750 +273940963110741 +216571469788535 +412032990871670 +278588635419254 +43617981599795 +550598497251685 +325565374983164 +210844888747229 +318553534187945 +231215077608190 +114851410558715 +387482516867241 +129610642748524 +169737064741859 +241874639481044 +455274677498946 +161508379121029 +210663900366547 +268299088407772 +323228385696786 +373482449743804 +507444048283413 +506471298764692 +390156267045594 +390723743514221 +90880487392259 +198348426995108 +450802725181122 +536219191910469 +362546210963561 +162913859196219 +153920167372926 +43578629431534 +536315126028866 +43562054697322 +296978869666562 +2848665337977 +174870641196323 +202302465853405 +460754303894900 +181417225418918 +187360950090649 +241760128163719 +459102533045435 +337675978406746 +44827579293534 +255612982586490 +468870767669249 +268065331481131 +201281613111001 +459947455563594 +466846874193535 +459241245636597 +513257739618974 +144789628765627 +54994862748127 +50747550911093 +333258134527592 +555343139941639 +471427809530223 +465905667286996 +178713411195237 +268683954775200 +321428850683638 +197484895372444 +415815970425087 +234023372176568 +317498654304945 +329826402944954 +539362245591739 +233622476527848 +247925266612456 +54847869155938 +495890883747280 +479593347092709 +185634029531629 +501674249006193 +464678621923526 +399613096212380 +454157106185566 +243596776120347 +454176698984518 +396594740958344 +290672016841329 +184814512340105 +461330781569642 +364728118923757 +445089972774762 +273144154216190 +107407954073460 +220161518857082 +447931659897935 +486743038865655 +524783485872732 +187402132365207 +283745351916152 +318865270179739 +510545032825153 +293719828530845 +551767689009922 +213837246511628 +516558865932757 +337952040086673 +376038046831899 +506205559745521 +48024799669247 +348410332168689 +100292600173670 +9659306118174 +521062064809579 +336340041679356 +270902565429773 +119571458132667 +56965667297219 +124837466354710 +517057493773638 +536267959522506 +529742828434324 +355559136315410 +377262777708419 +547519274940759 +460269880236021 +431486109989564 +147136766412815 +312454292402017 +138527515639386 +414225521312214 +33210353137990 +268454065307058 +13695738896489 +152740619561933 +359526285913432 +101397507887775 +84523794958221 +399036151570232 +274912312534433 +342696665540048 +68992952537952 +294266096884259 +44294597020610 +179964109828518 +493041450848754 +268993238872167 +410171921639441 +442265254925257 +398492958852285 +220567331577169 +361825851912072 +291334042549103 +480261311920340 +196813733808434 +473369609889375 +456945500142899 +306077639591560 +203956071173852 +264166357563433 +105193673817006 +356746740168347 +313811069786234 +41060894089364 +373157043886788 +233840793684534 +178283043574335 +533793263906392 +329604523145106 +416842694318760 +210318518752992 +336134508012815 +460079709392169 +93061508874167 +59330564330535 +517865319782173 +214547483875761 +202621043360017 +82834187850395 +275295311320611 +257192714217128 +374229804581319 +306244312875607 +170107606561860 +38605273656077 +513367654054544 +507880656077685 +169351122394327 +8009137829347 +257693679903502 +45284212414593 +259787398793546 +441417532424153 +537164815130208 +301001683045249 +542570605621512 +414469987022412 +549436396287946 +23129082749690 +335087207973071 +330471568537782 +32261617681255 +326139389251199 +272831191086369 +301915939035548 +313123090472917 +389768176875518 +83918245359603 +58566650591464 +2010800591009 +13863661177109 +551749040334946 +477201535215742 +242496416071012 +134725509538633 +411245439983879 +176369317357751 +560206113090311 +518038375907154 +341815945215039 +403243869833659 +287793232135146 +336246095535236 +126939286983897 +363376468443020 +315317870247141 +242748937172000 +229640858763197 +439654840025823 +27519011500762 +428741453216207 +373991941515080 +462533769758224 +411428938573277 +496251392838638 +508996862374142 +312774536746431 +318123117529993 +347676227560823 +225456847090919 +477447337243829 +128618884884717 +124862789403843 +7983621675354 +494199885397584 +499544393731969 +508709624866128 +163650234749807 +312505980210184 +64180281082909 +273958085137433 +533028955230358 +353229804297750 diff --git a/2025/aoc/inputs/day5_test.txt b/2025/aoc/inputs/day5_test.txt new file mode 100644 index 0000000..2e9078d --- /dev/null +++ b/2025/aoc/inputs/day5_test.txt @@ -0,0 +1,11 @@ +3-5 +10-14 +16-20 +12-18 + +1 +5 +8 +11 +17 +32 diff --git a/2025/aoc/package.yaml b/2025/aoc/package.yaml index 85692d7..17ef665 100644 --- a/2025/aoc/package.yaml +++ b/2025/aoc/package.yaml @@ -73,6 +73,15 @@ executables: - -with-rtsopts=-N dependencies: - aoc + day5: + main: Main.hs + source-dirs: app/day5 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + dependencies: + - aoc tests: aoc-test: