From 43448aaeb62f4b47b1f049543c2adea8e82bb694 Mon Sep 17 00:00:00 2001 From: Feiko Wielsma Date: Sat, 6 Dec 2025 20:36:52 +0000 Subject: [PATCH] Day5 --- .devcontainer/Dockerfile | 12 + .devcontainer/devcontainer.json | 2 +- CMakeLists.txt | 1 + day2/main.cpp | 160 ++--- day4/main.cpp | 3 +- day5/CMakeLists.txt | 2 + day5/main.cpp | 144 ++++ day5/puzzle_input | 1187 +++++++++++++++++++++++++++++++ day5/test_input | 12 + 9 files changed, 1434 insertions(+), 89 deletions(-) create mode 100644 day5/CMakeLists.txt create mode 100644 day5/main.cpp create mode 100644 day5/puzzle_input create mode 100644 day5/test_input diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6590d35..ba31a04 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -13,8 +13,20 @@ RUN apt-get update \ python3 \ python3-pip \ ca-certificates \ + curl \ + wget \ + tmux \ + ripgrep \ + fd-find \ + unzip \ && rm -rf /var/lib/apt/lists/* +RUN curl -LO https://github.com/neovim/neovim/releases/download/stable/nvim-linux-x86_64.tar.gz \ + && rm -rf /opt/nvim \ + && tar -C /opt -xzf nvim-linux-x86_64.tar.gz \ + && ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/nvim \ + && rm nvim-linux-x86_64.tar.gz + # Create workspace folder (VS Code devcontainer convention) ARG WORKSPACE_FOLDER=/workspaces/aoc25 RUN mkdir -p ${WORKSPACE_FOLDER} && chown -R root:root ${WORKSPACE_FOLDER} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9f3dd8d..caccf13 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,7 +14,7 @@ "ms-vscode.cpptools", "ms-vscode.cmake-tools", "llvm-vs-code-extensions.vscode-clangd", - "xaver.clang-format" + "vadimcn.vscode-lldb" ], "postCreateCommand": "cmake -S . -B build || true" } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index ec35a8f..5219901 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,4 +38,5 @@ add_subdirectory(day1) add_subdirectory(day2) add_subdirectory(day3) add_subdirectory(day4) +add_subdirectory(day5) diff --git a/day2/main.cpp b/day2/main.cpp index f139552..d7c70ef 100644 --- a/day2/main.cpp +++ b/day2/main.cpp @@ -1,35 +1,32 @@ -#include -#include -#include -#include -#include +#include #include +#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include struct IDRange { long leftRange; long rightRange; }; -auto parseRanges(const std::string& filename) -> std::expected, std::string> { - std::ifstream inputF {filename}; - - if (!inputF){ +auto parseRanges(const std::string &filename) -> std::expected, std::string> { + std::ifstream inputF{filename}; + + if (!inputF) { return std::unexpected{"Some file open error.\n"}; } - std::vector idRanges{}; + std::vector idRanges{}; std::string bigString{}; - std::getline(inputF,bigString); + std::getline(inputF, bigString); auto ranges = std::ranges::to>(std::views::split(bigString, ',')); - for(const auto& range : ranges){ + for (const auto &range : ranges) { auto subParts = std::ranges::to>(std::views::split(range, '-')); idRanges.emplace_back(std::stol(subParts[0]), std::stol(subParts[1])); } @@ -39,115 +36,106 @@ auto parseRanges(const std::string& filename) -> std::expected& idRanges) { +auto countDoubles(const std::vector &idRanges) { long doubles{}; - for(const auto& rng : idRanges){ - //std::println("{}-{}", rng.leftRange, rng.rightRange); - for( long i = rng.leftRange; i <= rng.rightRange; i++){ - auto str_version = std::to_string(i) ; + for (const auto &rng : idRanges) { + // std::println("{}-{}", rng.leftRange, rng.rightRange); + for (long i = rng.leftRange; i <= rng.rightRange; i++) { + auto str_version = std::to_string(i); auto str_len = str_version.size(); - //std::print("Checking {}. Length: {}", str_version, str_version.size()); + // std::print("Checking {}. Length: {}", str_version, str_version.size()); if (str_len % 2 == 0) { - //std::print(" Divisible by two, splitting..."); - std::string_view left_half = std::string_view(str_version).substr(0, str_len/2); - std::string_view right_half = std::string_view(str_version).substr(str_len/2, str_len); - //std::print("Halves: {}/{}",left_half, right_half); - if(left_half == right_half){ - //std::print(" EQUAL!"); + // std::print(" Divisible by two, splitting..."); + std::string_view left_half = std::string_view(str_version).substr(0, str_len / 2); + std::string_view right_half = std::string_view(str_version).substr(str_len / 2, str_len); + // std::print("Halves: {}/{}",left_half, right_half); + if (left_half == right_half) { + // std::print(" EQUAL!"); doubles += i; } } - //std::println(); + // std::println(); } } return doubles; -} +} - - -auto calculatePossibleSplits(int length) -> std::vector{ - //std::println("Possible ways to split a str of length {}: ", length); +auto calculatePossibleSplits(int length) -> std::vector { + // std::println("Possible ways to split a str of length {}: ", length); std::vector returnVec{}; - for(auto toCheck : std::views::iota(2, length+1)){ - if(length % toCheck == 0) - { - //std::println("{}", toCheck); + for (auto toCheck : std::views::iota(2, length + 1)) { + if (length % toCheck == 0) { + // std::println("{}", toCheck); returnVec.push_back(toCheck); } } return std::move(returnVec); } std::unordered_map> splitMap{}; -auto getPossibleSplits(int length) -> const std::vector&{ - if(!splitMap.contains(length)){ - //std::println("Caching {}",length); +auto getPossibleSplits(int length) -> const std::vector & { + if (!splitMap.contains(length)) { + // std::println("Caching {}",length); splitMap[length] = calculatePossibleSplits(length); } return splitMap.at(length); } -auto countRepeats(const std::vector& idRanges) { +auto countRepeats(const std::vector &idRanges) { long doubles{}; - for(const auto& rng : idRanges){ - //std::println("{}-{}", rng.leftRange, rng.rightRange); - for( long i = rng.leftRange; i <= rng.rightRange; i++){ - auto str_version = std::to_string(i) ; + for (const auto &rng : idRanges) { + // std::println("{}-{}", rng.leftRange, rng.rightRange); + for (long i = rng.leftRange; i <= rng.rightRange; i++) { + auto str_version = std::to_string(i); auto str_len = str_version.size(); - //std::print("Checking {}. Length: {} ", str_version, str_version.size()); + // std::print("Checking {}. Length: {} ", str_version, str_version.size()); - std::vector numsToCheck = getPossibleSplits(str_len); - //std::println("Possible splits: {}", numsToCheck); - for (int checkNum : numsToCheck) - { - //std::print("Splitting in {}: ", checkNum); - std::vector splits(checkNum); - for(auto toCheck : std::views::iota(0, checkNum)){ - auto window = str_len/checkNum; - splits[toCheck] = std::string_view(str_version).substr(toCheck*window, window); - //std::print("[{}]: {} /{} ", toCheck, splits[toCheck], window); + const std::vector &numsToCheck = getPossibleSplits(str_len); + // std::println("Possible splits: {}", numsToCheck); + for (int checkNum : numsToCheck) { + // std::print("Splitting in {}: ", checkNum); + std::vector splits(checkNum); + for (auto toCheck : std::views::iota(0, checkNum)) { + auto window = str_len / checkNum; + splits[toCheck] = std::string_view(str_version).substr(toCheck * window, window); + // std::print("[{}]: {} /{} ", toCheck, splits[toCheck], window); } - - if(std::equal(splits.begin() + 1, splits.end(), splits.begin())){ - //std::print(" EQUAL!"); + + if (std::equal(splits.begin() + 1, splits.end(), splits.begin())) { + // std::print(" EQUAL!"); doubles += i; break; } - - //std::println(); + + // std::println(); } - //std::println(); + // std::println(); } - //std::println(); + // std::println(); } return doubles; -} +} auto main() -> int { - auto testCase = parseRanges("test_input"); - if(testCase) { - auto testResult = countDoubles(*testCase); - auto testResultP2 = countRepeats(*testCase); - std::println("P1 Testcase result: {}", testResult); - std::println("P2 Testcase result: {}", testResultP2); + if (testCase) { + auto testResult = countDoubles(*testCase); + auto testResultP2 = countRepeats(*testCase); + std::println("P1 Testcase result: {}", testResult); + std::println("P2 Testcase result: {}", testResultP2); + } else { + std::print("{}\n", testCase.error()); } - else{ - std::print("{}\n", testCase.error()); - } - auto realRanges = parseRanges("puzzle_input"); - if(realRanges) { - //auto realResult = countDoubles(*realRanges); - auto realResultP2 = countRepeats(*realRanges); - //std::println("P1 Real result: {}", realResult); - std::println("P2 Real result: {}", realResultP2); + if (realRanges) { + // auto realResult = countDoubles(*realRanges); + auto realResultP2 = countRepeats(*realRanges); + // std::println("P1 Real result: {}", realResult); + std::println("P2 Real result: {}", realResultP2); + } else { + std::print("{}\n", realRanges.error()); } - else{ - std::print("{}\n", realRanges.error()); - } - + return 0; } diff --git a/day4/main.cpp b/day4/main.cpp index 572cb64..71e2669 100644 --- a/day4/main.cpp +++ b/day4/main.cpp @@ -19,7 +19,6 @@ struct Diagram { auto grid() { return GridView(data.data(), height, width); } }; -namespace { auto printMap(Diagram &diagram) { auto grid = diagram.grid(); for (auto row = 0UZ; row != grid.extent(0); row++) { @@ -137,7 +136,7 @@ auto moveMoveablePaper(Diagram &diagram) -> long { return totalPaperRemoved; } -} // namespace + auto main() -> int { auto testCase = parseMap("test_input"); if (testCase) { diff --git a/day5/CMakeLists.txt b/day5/CMakeLists.txt new file mode 100644 index 0000000..229ee3d --- /dev/null +++ b/day5/CMakeLists.txt @@ -0,0 +1,2 @@ + # Use top-level helper to add the target and copy input files + aoc_add_day(day5 "${CMAKE_CURRENT_SOURCE_DIR}" main.cpp) \ No newline at end of file diff --git a/day5/main.cpp b/day5/main.cpp new file mode 100644 index 0000000..c03d478 --- /dev/null +++ b/day5/main.cpp @@ -0,0 +1,144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// struct FreshRange { +// long long left; +// long long right; +// }; + +using FreshRange = std::pair; + +struct PuzzleInput { + std::vector freshRanges; + std::vector ingredients; +}; + +static auto parseInput(const std::string &filename) -> std::expected { + std::ifstream inputF{filename}; + + if (!inputF) { + return std::unexpected{"Some file open error.\n"}; + } + PuzzleInput puzzleInput{}; + + std::string puzzleLine{}; + while (std::getline(inputF, puzzleLine)) { + if (puzzleLine.empty()) { + std::println("Empty string"); + break; + } + auto subParts = std::ranges::to>(std::views::split(puzzleLine, '-')); + puzzleInput.freshRanges.emplace_back(std::stoll(subParts[0]), std::stoll(subParts[1])); + std::println("Range: {}", subParts); + } + + while (std::getline(inputF, puzzleLine)) { + // std::println("Ingredient: {}", puzzleLine); + puzzleInput.ingredients.emplace_back(std::stoll(puzzleLine)); + } + + // std::println("Ranges: {}\nIngredients: {}", puzzleInput.ingredients, puzzleInput.ingredients); + + return std::move(puzzleInput); +} + +static auto countFreshIngredients(const PuzzleInput &puzzleInput) -> long long { + const auto &freshRanges = puzzleInput.freshRanges; + const auto &ingredients = puzzleInput.ingredients; + long long totalFresh{}; + std::println("Ranges: {}\nIngredients: {}", ingredients, ingredients); + for (const auto ingredient : ingredients) { + std::println("Checking {}", ingredient); + for (const auto &range : freshRanges) { + if (ingredient >= range.first && ingredient <= range.second) { + std::println("{} fits in range: {}:{}", ingredient, range.first, range.second); + totalFresh += 1; + break; + } + } + } + + return totalFresh; +} + +static long long countAll(const std::ranges::range auto &ranges) { + std::println("Final count:\n\n"); + + long long bigNum{}; + for (const auto &range : ranges) { + std::println("{}:{}", range.first, range.second); + if (range == FreshRange(-1, -1)) { + continue; + } + bigNum += range.second - range.first + 1; + } + return bigNum; +} + +static auto countFreshIngredientsRange(std::vector &ranges) -> long long { + std::ranges::sort(ranges); + std::list rangeList; + rangeList.assign_range(ranges); + + auto cur = rangeList.begin(); + while (true) { + auto next = std::next(cur); + std::println("Starting with {}", *cur); + + if (next == rangeList.end()) { // No need to compare against the end + break; + } + + if (cur->second >= next->first) { + std::println("\t Merging! {}", *next); + cur->second = std::max(cur->second, next->second); + + rangeList.erase(next); + + } else { + cur++; + } + } + + return countAll(rangeList); +} + +auto main() -> int { + auto testCase = parseInput("test_input"); + if (testCase) { + + // auto testResult = countFreshIngredients(*testCase); + // std::println("P1 Testcase result: {}", testResult); + + auto testResultP2 = countFreshIngredientsRange((*testCase).freshRanges); + std::println("P2 Testcase result: {}", testResultP2); + } else { + std::print("{}\n", testCase.error()); + } + + auto realPuzzle = parseInput("puzzle_input"); + if (realPuzzle) { + // auto realResult = countFreshIngredients(*realPuzzle); + // std::println("P1 Real result: {}", realResult); + + auto realResultP2 = countFreshIngredientsRange((*realPuzzle).freshRanges); + std::println("P2 Real result: {}", realResultP2); + } else { + std::print("{}\n", realPuzzle.error()); + } + + return 0; +} diff --git a/day5/puzzle_input b/day5/puzzle_input new file mode 100644 index 0000000..39ce2f5 --- /dev/null +++ b/day5/puzzle_input @@ -0,0 +1,1187 @@ +271989803577321-279602339477609 +424856501898112-428035763754024 +553860524271401-558642119641208 +207805184611983-207805184611983 +259193819454825-259579144927094 +531011436262632-532730188496897 +324862150905536-325308627426439 +544360641242438-547252096319631 +202013426255968-207805184611982 +329605467972299-330335188096945 +435210058526292-440885261025799 +3039566344631-8780284248360 +282056648700908-282056648700908 +260203725552350-260755039702968 +271989803577321-279602339477609 +18242858078610-18638426261426 +324862150905536-325308627426439 +324862150905536-325044312776734 +484733718753429-491106133143809 +257280321419896-257561344188619 +259579144927094-259887082783455 +525437082250281-526791498069427 +65132562924432-66605592627596 +323558917364514-324075416509607 +406193608821034-408168799055066 +328183851347826-328640174740800 +153799112188589-159057230596012 +528672148056836-530237898465989 +258398126590623-259193819454825 +330335188096945-330571374271893 +293745406346302-296134734367662 +233417222089379-236454326007261 +68887081363771-70179545208574 +196203070850441-197671936927213 +83601830902361-88811433216491 +253698285888197-254156336938296 +410028326377766-411872120273854 +540204623759364-540204623759364 +477624672045619-481587433161886 +527641323687467-529170439253009 +547252096319632-550226444710148 +557317022307496-561320493657545 +143315822500838-145341640037020 +442679343521760-450963215547943 +194119940344508-195775703661920 +313500392036477-317802415874525 +114789108995787-118131082521453 +354006104054142-358029052535840 +259656789085393-260408002531089 +259579144927094-259656789085393 +401574504732002-401574504732002 +153799112188589-156773441117183 +454431257650778-454745474192772 +461619308398096-461709712097701 +12945459374913-13753313843628 +263123328245679-263123328245679 +403768523635990-405784300113328 +11153000610845-11904672251575 +20911003491799-24570741404840 +413653492774758-413653492774758 +184834500481233-190552013585440 +460967792177441-461389825566712 +121892924219118-124709874329070 +134168330743304-138751333072845 +522846068497218-524749442788212 +131781153203947-137565552299000 +241966466023478-247538924615937 +236454326007263-240356164320285 +524258900397609-525588193639542 +67965081413733-69351184467133 +407592473471010-409282294211509 +61580111499717-62943004932264 +456949846141041-457210650441325 +526482215724361-528052649665586 +453907956610471-454431257650778 +251355192273177-252020484688526 +18242858078610-18638426261426 +256414648686056-257280321419896 +328814024820102-329605467972299 +257280321419896-257682827606630 +317802415874526-320050289578187 +218755331345817-218755331345817 +213975655910015-218755331345817 +199346873235546-200972242884851 +338924801981436-338924801981436 +384938237303506-389929445000398 +74533474022084-80014782216789 +424856501898112-429421199503325 +455697252831967-456090881967237 +282056648700908-289333717195223 +257058141699377-257682827606630 +8780284248360-8780284248360 +20911003491799-27336977177185 +62507243649689-63683238603270 +225450272970029-225450272970029 +43210442205293-43210442205293 +293745406346302-298864830299098 +11904672251575-12349393819325 +192116367282109-193669577891517 +252538556142402-253262877704082 +329605467972299-329777112062469 +373296193323759-379826278181472 +12349393819325-13294582526136 +322010292610589-322301623759062 +325611202304677-326316917466355 +60457053147925-61852083696905 +520129808208409-520129808208409 +335786035262195-338924801981435 +30926050414828-34785328273716 +465815676283179-465815676283179 +83601830902361-88811433216491 +529595539905674-531237853004103 +193088404654685-194896624310986 +504447035954503-512046286698630 +191169042088688-192591319565059 +14993908640268-15426379531707 +487018431941306-488178342570191 +344978521379824-347852045956401 +327143065617465-327913284256749 +324363675495837-325044312776734 +73050226184974-80014782216789 +257561344188619-258000908248297 +67087880762277-68392720951013 +358029052535842-359641379336804 +64280639438393-65575415225541 +413653492774759-420586740646991 +165537879983308-166816500738401 +11904672251575-12709378563146 +325044312776734-325611202304677 +366641227347444-371164193793316 +65959403612120-67269801884749 +15426379531707-16178537015127 +362596403571597-369097925168210 +408645901112182-410695464307274 +323733726736892-324075416509607 +344978521379824-347852045956401 +175668219272352-179523578907972 +461389825566712-461619308398096 +10761663443019-11482767016252 +263123328245679-269424819112624 +94848678981469-97272648305346 +59749740770698-59749740770698 +458278364943949-458505241894800 +225450272970030-227959563253319 +197449061819121-198683589429334 +515592371976786-520129808208409 +537071608233810-540204623759363 +302120972948137-311082208603585 +104239993358694-107248717575918 +456841478786180-457210650441325 +161193251191000-170536968520140 +459022275533952-459210040395256 +15740924364997-15877396631575 +251355192273177-252020484688526 +474023505726540-477624672045617 +455182289861662-455697252831967 +13448477373680-14130268351116 +465815676283179-471384589995789 +457518211583577-458278364943949 +124709874329072-128734486210889 +504447035954503-512046286698630 +181637819793547-190552013585440 +17241903641249-18028653570911 +100886868756696-109983166017250 +447916160860724-450963215547943 +402647482103478-404437900354673 +305769989384312-307657685358090 +195364902709756-196690490473022 +405018294546298-406719280482034 +494065458799067-494065458799067 +63114472571355-64566128897112 +494065458799068-499759327329908 +10761663443019-10878351433614 +376467236171744-379826278181472 +43210442205294-47747675827605 +395113352308695-401574504732002 +460543967015030-460699380548033 +330335188096945-330791180770028 +53880356812324-59749740770697 +94848678981469-94848678981469 +198088157615608-199815780668674 +13294582526136-13753313843628 +171418380448853-177022495852888 +34785328273717-38385448704653 +145341640037021-149501272960877 +453907956610471-454745474192772 + +458327422927289 +394215407176444 +538891116278254 +405630245230909 +94104066952380 +490914420236647 +329162244276677 +337170868862383 +124143772076037 +49313051002477 +518597387249600 +454503205839759 +500538464502754 +506402699020456 +195175767566125 +326494844879790 +173622326009288 +192716435136867 +96258580072281 +427407845084944 +25969297025967 +22364063486557 +186606183309183 +173038818430010 +529986016721396 +47643534882070 +260046549148935 +329274610102164 +558996086494953 +295460727254594 +219446765189119 +507235198636856 +48067033503175 +172693620758127 +496355862627545 +312841778665021 +264005458329286 +77016029117164 +38740383015881 +507840572936712 +153263369018332 +94295249718093 +347014879821613 +226822087171661 +152100262627511 +511065333100685 +375828819349585 +365732735223393 +314883643337028 +341500143340839 +257133876656426 +487662767494631 +124497171972191 +413870194408785 +354872610851716 +370166355026649 +32543972327364 +188346277431914 +214514703393600 +217649005386532 +309680125025957 +221839365419880 +388309623274502 +247243740026493 +551635053712739 +62631843750908 +28536891116392 +343002453753319 +105715806804166 +260580739637505 +4293983100205 +294351140769475 +512941804100043 +66066830520477 +44265519278575 +354942494125368 +140658624681030 +403914389669102 +145302873315703 +264814181679309 +69592996364537 +400473756682698 +388736285797326 +73457117069047 +349720620367144 +113692557880970 +309720071298841 +314981698532816 +354272964145449 +389628477267233 +34668719798922 +184197039881177 +126802949190768 +510036524657346 +200914528882681 +79001548033078 +419303360466404 +88419109842739 +227941697191272 +286291099572389 +124296263780421 +97492462219212 +329601423851712 +470913589358124 +425375574922652 +333171267088847 +207863644274997 +216892844180304 +336446918798931 +531719520176552 +238730460543734 +117592195145362 +411723555558930 +370899420228828 +276441768810072 +259767015020532 +191906975018143 +33648191972902 +134154745433713 +137973691291006 +39642964491208 +74158729988518 +303107287663611 +418194521411980 +96132628931616 +60852542661195 +201105399540428 +253663052961806 +330653939865651 +411544967406103 +307792568069587 +501167185747568 +531774986143525 +325045609674676 +445653664589522 +294229566939402 +290785258849994 +417840629397785 +510557372478499 +72866476010166 +490720597204973 +37089006124864 +278284126759481 +531476400543975 +519743281693160 +83629777876782 +181505131502854 +394986876589204 +96923984978984 +303226667829097 +122561193918774 +278274399638161 +241244666285517 +506236259318880 +498165003314850 +285939528619580 +466786391686936 +56117277674071 +57505533882316 +385808425459025 +342044075419135 +286157769011958 +552903564331350 +272139178119913 +351997788183785 +268246928607309 +310148336709316 +127414882750341 +456563305309866 +69697388758698 +375242241607858 +327222563173912 +400866075133446 +257982371542084 +454836466266167 +412068053311989 +108098159985482 +129234597034147 +298431428321347 +91097752001150 +447809598587258 +237203080048342 +132549385678301 +198329103918918 +84703966205659 +134265552074317 +456777897585872 +62798656430512 +18333640805217 +197597788820849 +325206936120228 +325299331391709 +436076980465594 +376599978063096 +346516187343853 +63990892063473 +47299095707397 +478664778545154 +86542453593450 +120874517826365 +498930392815708 +77383127354413 +499910866258124 +252281210340782 +560131177228849 +469194358192961 +328846809400586 +298163103570893 +501111561852020 +165966949674046 +108865317239947 +356902430080759 +204239119197728 +557244982663038 +487093475549218 +250035116932735 +526589784989870 +461186424278850 +464977014966880 +523473005767081 +171468451427898 +164889865124181 +237295822648300 +190388216724477 +478398313749920 +74778042091143 +189326921629866 +429617209116692 +378608713724961 +169404218318391 +457880538334667 +85164480348055 +519516704837204 +525186119079620 +406200425145786 +509767106837487 +131802518152125 +467765423823216 +471729667923935 +354073036689764 +225343091386759 +467771763090692 +544789160597886 +433553786755203 +63549619521590 +188369669038113 +399776296790326 +36210995559156 +83885970646117 +442738106881761 +75641165696484 +446167693900755 +555981322966854 +35974278098327 +246501714935843 +106048336421199 +60685341573922 +86677818599500 +285960592928759 +158081989093534 +15461664398419 +185982618791928 +180824209224165 +187064712305239 +27182304196794 +450473006792683 +486695554217069 +351159221756758 +399034510350195 +419976944717238 +101430618720420 +496129307740629 +143398653904751 +368202852668998 +176289028564714 +265043776879992 +552973889946738 +253029939868832 +387590090718128 +102590179418116 +425989432553932 +397172514102059 +294775592339219 +447008425967879 +85190523981137 +328208155612519 +35088253115733 +534421600384928 +132325161284465 +51740636690063 +58455641357314 +428225850995588 +375093074769772 +115138118586243 +492378324675667 +371748248255077 +179330594087960 +545001189712803 +168780495717497 +508453745018792 +206624675537749 +375315307012977 +422453669238754 +327346110035590 +54041792989293 +408437723917606 +124942526134063 +115947105259027 +436687151979377 +403503569803995 +54493252937207 +325807060510103 +221572225897171 +449817071695017 +103785785756575 +502943074538197 +552759156368282 +252995567798781 +5625128329044 +334113689048034 +152493749959358 +113142681761821 +159479086481323 +511253830856063 +512938904759706 +57058789192382 +146844998521702 +155861569916407 +364551362885873 +158340380932347 +107074418649846 +249989724259182 +55469148358097 +157411136396611 +187824788815171 +547966053319322 +97544141911518 +428014715830556 +46632476621146 +40220689144698 +448420059488817 +85594048467133 +245937459272729 +133257323087880 +108009359325092 +398127366599560 +69022622672484 +458060021950790 +183499000107892 +488219957568858 +264806028578268 +401894945071708 +547142428073591 +282845862365549 +499561637539732 +159097890812668 +206526007165250 +74206329890267 +334385547886896 +264673682935268 +157972306229159 +138476622325475 +118613726062144 +72776725130505 +48921301154122 +527765289892753 +6477732311431 +554396254979389 +318382948107921 +450269395978355 +543991023952815 +518339234021578 +35762867406088 +247408829029611 +453199652413114 +56368162155242 +197812180337470 +415052627812816 +530125132541848 +145746711093010 +24740257149691 +424022303205149 +307677041632054 +425449072095166 +526370378821945 +523980130576058 +411776114982322 +257178363887156 +408563164872309 +284911489194802 +298741929272481 +17616338830700 +223812140606355 +483114503303086 +36207624196387 +415627872601143 +557918493831740 +498198642036452 +188170560437046 +493211885321161 +242856591964828 +506886953453938 +109538165275168 +143830472501694 +170294496683677 +47577139100477 +386661150156796 +493081033903417 +232376326209866 +183370905099965 +24578734370839 +178852921338612 +195705399324317 +128601803607530 +530305709080691 +203326505727342 +310917552807921 +214976447138401 +333894122457534 +124586033117065 +487438039773389 +133418436071933 +185264794099583 +125023683130888 +258604599254513 +371414496400132 +21196395966396 +454651898865420 +319223483883473 +453208883136219 +171354223302146 +358285167175788 +472321677546060 +371825891559629 +142059745438432 +391086297020238 +474528813089882 +327326350398737 +213748584130890 +269542356903842 +399186707388437 +308459192689748 +555716907218646 +3728609437847 +305109911170442 +238691292699567 +443763664105975 +494289821108172 +389149774834579 +70382081780433 +3374341252529 +307040829960813 +18608053984037 +296162500758778 +31651755698688 +316610746176539 +493527313540240 +308551783590065 +143701128409807 +485800052399167 +305321781960396 +364921832713540 +54863051991840 +481064259216724 +381201415040099 +249703964713172 +184786391882011 +47631057460690 +60668869041711 +257067496208634 +414740665025523 +123609887621604 +168054805448625 +200721739202724 +442703595839391 +295213925736174 +558912593050893 +467416792426139 +187559895281744 +76206920302603 +279043395665827 +372860665780539 +75121822808315 +523573483390371 +371023104774156 +146052627480807 +276688857589368 +67343918041127 +242315066872662 +540043942677043 +434790547627688 +122962983521446 +36335722503599 +409789827738010 +516262660226130 +31338449343015 +188178500554278 +368969672680873 +11743892383361 +416565850477683 +104103047140360 +409044661554882 +147016405089136 +57010815310671 +365117102696623 +503995438866268 +349852841785393 +241892904057716 +146788631861534 +16087575614805 +407409848287265 +447941498973179 +185124823698807 +46287891456113 +26304336802762 +323427963897316 +55723062811413 +481360686763460 +64258982245999 +76418607820240 +154033383788942 +66195171862536 +45586366037712 +102672930322848 +307670443388355 +482406132978957 +13073828716416 +545500728073892 +322239076094029 +473380707708222 +366296084792730 +242295593820231 +114175996562574 +320395886350177 +407797234874160 +521084379001846 +92748520377609 +307751600480484 +459121420232432 +453197144899185 +243142222684891 +437139047388396 +330837532594308 +281531765190920 +386099242243738 +475560696429041 +395284904740960 +328889465723026 +10866296517061 +108022540417608 +478119458711304 +282468348471179 +143512428166580 +368305889854963 +459909885835246 +345633927576519 +370570992278410 +102746794578427 +178313242530557 +124127634742642 +239352529453157 +75247444720713 +221926170229305 +438486414042829 +463679098018314 +376519117620318 +268046781847032 +78328870354256 +424740877348748 +370305493832893 +145389971884619 +396933994363136 +396024148203031 +516835011111901 +82495306808354 +349948657868150 +539186844708366 +224049984522610 +552413123174047 +215531640263871 +346775713247585 +531770879319023 +471321902966887 +305192767609811 +475421845170061 +245447383194350 +258068362282234 +146171287209160 +274943114190305 +24043356945326 +142761813496185 +362964775027951 +391391275358111 +496450177615678 +276903231958271 +306838083700797 +243780429842861 +65852223333953 +5551292536799 +320944463278322 +66887889165742 +540196861088020 +51699416254807 +322427936171551 +264991859570679 +8626278525799 +337426118535234 +358064544800857 +365852930407249 +145498966388681 +76643089041568 +16530803010510 +395807582546015 +213489202000234 +346610524674690 +47625585763061 +78131074853941 +37367061186031 +267527717419861 +148748320059747 +157064269148378 +436054074724866 +436752925505623 +399664674899695 +37689785721105 +20871244062434 +497297437724454 +128706791264801 +468159965440920 +242199508250130 +385408948418311 +164847118259753 +124540772176000 +44795001902123 +196628852105608 +254037400350662 +540855943757425 +242415428366147 +292403541816116 +418348246557333 +71569906395523 +127985327023826 +519611557594543 +401108355331662 +451024315561610 +475600703250339 +306285713218637 +138004814788736 +134799598190495 +274722722575199 +128458005220181 +265925647573266 +484976166638368 +164041054077470 +58856991687761 +469830560138037 +174747945561708 +350296434133829 +352429997898258 +36255446586228 +465652169013336 +477793777873452 +531090961291198 +33768271548871 +372945285009825 +252717501379076 +552947772116577 +61597060433337 +18671571652806 +377936643209901 +442379618386200 +443047308729562 +74669907069235 +191986017756969 +277825589464036 +486005036465508 +552478585643466 +473608070339088 +195779112630540 +397548251264217 +497960024456563 +37575559252865 +87448083418776 +264665909229097 +132385876967762 +494627765130770 +156813457785409 +488169649943449 +155595056390938 +23246576047938 +136901426608080 +450911560170921 +249332844887038 +24329844552476 +278535031387975 +130536866244934 +13513977785870 +227752109357950 +554026332883793 +552793902578246 +394730661976158 +66022936259331 +299474262305442 +506062561501885 +488413967673964 +535434465384784 +75118766722132 +155221589062982 +96803918708123 +305725638197202 +345835565126513 +27087580519261 +94799989673934 +46674378252175 +552353687420172 +171170393949409 +493366993411276 +316193605812519 +138503566925534 +356585046933552 +203200833005423 +373694021202215 +136313561577975 +361872735843660 +402670372217318 +259462551324938 +198174853798697 +548937048128234 +372407074490501 +536412518077644 +216608650940091 +376066284042550 +256959856297446 +86318121547232 +159883697737029 +539588901820634 +220454652994930 +9743728142604 +129277559277683 +132459031658079 +277319166424095 +156939175673148 +22249831402499 +170011927501330 +444691749490736 +373607346877526 +79809389584481 +99524232960093 +433705500835993 +560432893195051 +431063418710633 +124276457246023 +13053401720296 +241648867906433 +132520586815617 +555855464579479 +234146084564365 +91133323212389 +408632625438027 +229778417279828 +4471345069482 +191764132475392 +316025640136120 +272839118151753 +85496635984742 +414198811814304 +167636461940450 +5201356233128 +427184879492845 +512468138905162 +183620266472424 +358696357490010 +64337768841297 +509417889136474 +288871150704029 +55543543930093 +517082723750236 +315832295593030 +296538682351497 +143145898370228 +107057998665065 +175813714986405 +274720685455586 +537263506521650 +198700265544821 +47491525695898 +88211587792956 +437030877984113 +258130836873066 +189732343622014 +429257443009028 +176142432456281 +221709991692508 +529863237642389 +183339891043266 +434322261769538 +101766641642490 +296776687887060 +26456003689200 +510668379874999 +455754038318874 +171646172649002 +469378142173298 +399589057347904 +284066265627264 +263385271975147 +419536517766424 +13354044617072 +178822079889657 +550501762461012 +471691762212082 +165264611884915 +455775417746806 +486826067250849 +190276750848969 +133876934641731 +386582506223120 +379063945616852 +362492690642278 +398338865336917 +365172189499901 +76704258105809 +338369422420212 +389973884640149 +252757971226606 +443390994289711 +205714015291845 +479183724654211 +245417323832656 +504947906167678 +198493413080472 +478321965882789 +369923398066096 +280912238877543 +59600813796403 +299464028272383 +261503757327793 +2045777760591 +404602774408076 +135448783216576 +158162580553744 +175328690037324 +448697032499301 +479237241513008 +283165510711708 +12015356986118 +11418402914061 +252972453868540 +81010139754174 +133420371350253 +337503782128560 +355204365878095 +286281439514839 +191926160757177 +437887784709707 +526845723196622 +463884577548187 +494509121786818 +99664537166703 +314453479367154 +243588335920220 +264662293660949 +65914514134714 +33549107443615 +447077464824428 +528146606220449 +37266808620647 +77716399345081 +127261567802258 +338262377980624 +283817008689610 +507762733381516 +545015665912168 +381141574235704 +192870561602934 +513284628435465 +150954536167284 +446869644405229 +111621309624806 +532357272291367 +513206208747658 +11910955203184 +236946143086891 +168960365396365 +281976687022648 +285498272049325 +313423312056264 +466011035212899 +506650232562157 +253978238992971 +419323184416694 +404271192540792 +155732638643490 +12479745744791 +137794599693011 +507001027326782 +96855331383798 +296488976841910 +185464312518579 +401403128856357 +471603171473831 +288528016414523 +69873978721749 +381334179219470 +155355954306792 +506000016806445 +216776088829397 +35308489186611 +77435710486916 +266702576131844 +198878930180046 +253854042542758 +240267475791027 +382967468516510 +358970045666269 +23705687454735 +103744800434012 +267347529089847 +249732261001991 +494688363337646 +74175803831983 +390769256857385 +468082649371222 +188035547774476 +52491082139500 +518620214105388 +96281161228800 +483933945960261 +360191718365681 +185563720644950 +77549457302492 +415492131886988 +333787547636528 +175874211052630 +378959849274657 +103465480488188 +540141577576067 +39980432192770 +76324849429158 +257744521147007 +219240084114609 +501427479697223 +403618819105490 +241220767125753 +199810550039858 +166711817071069 +453469542892815 +115288729187202 +40764060722112 +480643919186985 +197396302829234 +14370701970166 +310153571162926 +345908233565732 +428101430943232 +311011552933310 +499643673945317 +437794171267027 +77370587871317 +310081165909925 +191223093190116 +553743871865667 +486325282834640 +394865589732341 +136604301374963 +296903039048028 +256454980010608 +491850473814286 +212456880919302 +514536616011740 +214664236449269 +129809734635369 +517698412264210 +273745371185692 +509272269679970 +443405630772391 +472677831402477 +302359690564713 +279823601496959 +560172806193846 +199908755481779 +179349439698716 +1710553991144 +146502644132599 +139368121522262 +73082126145753 +529005742411009 +35313890983638 +327531148982025 +63798609724287 +469403566865430 +256744186512721 +118563069045627 +435507892453610 +454444128136012 +457362496449292 +193781395140293 +136498133797815 +304159047802520 +103536384128125 diff --git a/day5/test_input b/day5/test_input new file mode 100644 index 0000000..b716064 --- /dev/null +++ b/day5/test_input @@ -0,0 +1,12 @@ +3-5 +10-14 +10-13 +16-20 +12-18 + +1 +5 +8 +11 +17 +32 \ No newline at end of file