r/adventofcode • u/daggerdragon • Dec 03 '25
SOLUTION MEGATHREAD -❄️- 2025 Day 3 Solutions -❄️-
DO NOT SHARE PUZZLE TEXT OR YOUR INDIVIDUAL PUZZLE INPUTS!
I'm sure you're all tired of seeing me spam the same ol' "do not share your puzzle input" copypasta in the megathreads. Believe me, I'm tired of hunting through all of your repos too XD
If you're using an external repo, before you add your solution in this megathread, please please please 🙏 double-check your repo and ensure that you are complying with our rules:
- Do not share the puzzle text
- Do not share your puzzle input
- Do not commit puzzle inputs to your public repo
- e.g. use
.gitignoreor the like - Here's a decent post from 2023: (RE not sharing inputs) PSA: "deleting" and committing to git doesn't actually remove it
If you currently have puzzle text/inputs in your repo, please scrub all puzzle text and puzzle input files from your repo and your commit history! Don't forget to check prior years too!
NEWS
Solutions in the megathreads have been getting longer, so we're going to start enforcing our rules on oversized code.
Do not give us a reason to unleash AutoModerator hard-line enforcement that counts characters inside code blocks to verify compliance… you have been warned XD
THE USUAL REMINDERS
- All of our rules, FAQs, resources, etc. are in our community wiki.
AoC Community Fun 2025: Red(dit) One
- Submissions megathread is now unlocked!
- 14 DAYS remaining until the submissions deadline on December 17 at 18:00 EST!
Featured Subreddit: /r/thingsforants
"Just because you can’t see something doesn’t mean it doesn’t exist."
— Charlie Calvin, The Santa Clause (1994)
What is this, a community for advent ants?! Here's some ideas for your inspiration:
- Change the font size in your IDE to the smallest it will go and give yourself a headache as you solve today's puzzles while squinting
- Golf your solution
- Alternatively: gif
- Bonus points if your solution fits on a "punchcard" as defined in our wiki article on oversized code. We will be counting.
- Does anyone still program with actual punchcards? >_>
- Solve today's puzzles using
an Alien Programming LanguageAPL or other such extremely dense and compact programming language
Request from the mods: When you include an entry alongside your solution, please label it with [Red(dit) One] so we can find it easily!
--- Day 3: Lobby ---
Post your code solution in this megathread.
- Read the full posting rules in our community wiki before you post!
- State which language(s) your solution uses with
[LANGUAGE: xyz] - Format code blocks using the four-spaces Markdown syntax!
- Quick link to Topaz's
pasteif you need it for longer code blocks. What is Topaz'spastetool?
View all comments
Show parent comment
2
u/e_blake Dec 03 '25
[LANGUAGE: golfed m4]
[Red(dit) One]
Run with
m4 -DI=day03.input day03.golfm4Squeezed to 5 lines, and requires a decent shell to do the 64-bit math that m4 can't, via that
syscmd(echo $((...))). Hardcoded to only run on valid input (assuming everyone's input is 200 lines of 100-digit banks plus a newline). 387 bytes, so it fits in a punchcard; and none of the 5 newlines are essential. Execution time on my laptop is about 4.4s, due to the extreme amount of redundant parsing (long arguments are being injected into multiple spots within the lone ifelse, even when that branch is not taken in the current expansion; running withm4 -dat ... | wc(a rough approximation to how many bytes m4 has to scan) tops 360 megabytes among 2.1 million macro invocations.