r/adventofcode • u/daggerdragon • Dec 01 '25
SOLUTION MEGATHREAD -❄️- 2025 Day 1 Solutions -❄️-
It's that time of year again for tearing your hair out over your code holiday programming joy and aberrant sleep for two weeks helping Santa and his elves! If you participated in a previous year, welcome back, and if you're new this year, we hope you have fun and learn lots!
As always, we're following the same general format as previous years' megathreads, so make sure to read the full posting rules in our community wiki before you post!
RULES FOR POSTING IN SOLUTION MEGATHREADS
If you have any questions, please create your own post in /r/adventofcode with the Help/Question flair and ask!
Above all, remember, AoC is all about learning more about the wonderful world of programming while hopefully having fun!
REMINDERS FOR THIS YEAR
- Top-level
Solution Megathreadposts must begin with the case-sensitive string literal[LANGUAGE: xyz] - Obviously,
xyzis the programming language your solution employs - Use the full name of the language e.g.
JavaScriptnot justJS - The List of Streamers has a new megathread for this year's streamers, so if you're interested, add yourself to 📺 AoC 2025 List of Streamers 📺
COMMUNITY NEWS
- Veloxx will continue to drop some lit beats for 1.5 hours after today's unlock!
- /u/jeroenheijmans is back again this year with their Unofficial AoC 2025 Participant Survey!!
- As there is no longer a global leaderboard, there is no need to lock megathreads/delay the unlocking of megathreads anymore
- AoC_Ops is still monitoring every day's unlock status
- If there is an anomaly that warrants correction *knocks on wood* (e.g. servers got DDoSed [pls don't hammer the AoC servers kthx]), we may temporarily lock the megathread until the anomaly is resolved. We will provide timecoded updates in the megathread, obviously.
- Advent of Code Community Fun 2025: Red(dit) One
- I will be your host for this year's community fun event: Red(dit) One
- Full details, rules, timeline, templates, etc. will be in the Submissions Megathread
(post and link incoming very shortly!)
AoC Community Fun 2025: Red(dit) One
Featured Subreddit: /r/{insert your programming language here!} e.g. /r/perl
"Now I have a machine gun. Ho-ho-ho."
— Hans Gruber, Die Hard (1988)
(Obligatory XKCD)
(Die Hard is absolutely a Christmas movie and you will not change my mind)
We'll start off with an easy one today. Here's some ideas for your inspiration:
- Tell us why you chose this programming language
- Tell us what you learned about this programming language
- Solve today's puzzle by doing something funky with this programming language
GOTO,exec, andevalare fair game - everyone likes spaghetti, right?- The worse the code, the better we like it
- To be fair, we like good code too!
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 1: Secret Entrance ---
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?
25
u/oantolin Dec 01 '25 edited Dec 09 '25
[Language: Goal]
This has a bug pointed out by r/ap29600 below: for part 2 it doesn't count the times you land exactly on 0 at the end of a left rotation! There apparently where no such instances in my input!
EDIT: here's a corrected version:
15
u/jonathan_paulson Dec 01 '25
[Language: Python] Video of me solving.
13
u/SheepiCagio Dec 01 '25 edited Dec 02 '25
[LANGUAGE: Excel]
P1:
MOD(a+--MID(v;2;10)*x;100))))=0))
P2:9
u/JustinHuPrime Dec 01 '25 edited Dec 01 '25
[LANGUAGE: x86_64 assembly]
Part 1 was fairly straightforward, although I did have to do fancy footwork to get around the fact that x86_64 does not, in fact, have a modulo instruction. If you're asking how that can be if all major programming languages have a modulo operation as a primitive operator, I must inform you that many don't, in fact, have such an operator - they provide a remainder operator (the difference here is that negative modulo positive is positive, but negative remainder positive is negative).
Part 2 was a lot less elegant, and involved a bunch of messiness handling the negative remainder - it usually indicated that there was an extra passing of zero, but there were two edge cases to handle - the first one was that you could get to zero by going left less than a full rotation, and this wouldn't show up in the division results (zero divided by 100 results in zero with a remainder of zero), so this had to be counted in a special case. The second one was more annoying to find, but I eventually figured out that I was over-counting the case where you started from zero and went left, in which case I would be over-counting by one because of the negative remainder not actually indicating a passing of zero. I'm not too happy with the pair of special cases, and I suspect I could have simplified it more if I had more time, but I forgot AoC started on November 30th at 9pm in my time zone, so I had to quickly bang out a solve before going to bed.
Parts 1 and 2 run in about 1 millisecond. Part 1 is 8,864 bytes and part 2 is 8,984 bytes as executable files.
[Red(dit) One]
I'm writing this in assembly because I find it fun and useful to be able to peak behind the curtains of abstractions that modern languages and compilers put up for us (and to be fair, they're very good and only very rarely leaky abstractions). In my day job, there do come times where something's going wrong near C level because of actual bugs, undefined behaviour, language specification bugs, or compiler bugs, and it's useful to be able to hold your breath and duck your head under C level and peer at and talk about the actual instructions emitted by the compiler whose abstraction, in this case, did in fact leak.
It's also humbling to learn how to program in assembly because it makes it very obvious that your compiler and programming language are presenting many layers of abstraction to you - structured control flow, like
ifandwhile, is an abstraction over conditional and unconditional jumps, variables and the stack are an abstraction over raw memory, and even functions as a unit of code are an abstraction over a block of instructions. These are immensely useful abstractions, but there was a time before they existed, and someone had to make them.6
u/Smylers Dec 01 '25
[LANGUAGE: Vim keystrokes]
Hello, everybody. Good to be back.
These are Vim normal-mode keystrokes, not VimScript. To ‘run’ the above, load your input into Vim then type the keystrokes and the input will be transformed. By the end of it, the
⟨Ctrl+G⟩will display the number of lines in your window, which is your answer to part 1.:s///commands to turnLandRin the input into^Xand^A, and put them at the end of the line rather then the beginning.50to the top, clear out the"aregister, and record into the"akeyboard macro the keystrokes for duplicating the50on to another line, deleting the command from the next line of input (which, usingD, ends up in"-, the ‘small delete’ register), then run the deleted command with@-. SoL68from the sample input became68^Xwhich when run as keystrokes is like typing68⟨Ctrl+X⟩and subtracts from the current value, turning50into-18.@ainside the macro to make it repeat. Then stop recording the macro and run it.:v//dcommand deletes all the lines that don't match the specified pattern. The pattern is for a0at the end of a line, preceded by either the beginning of the line or another0. In other words, it matches0or any multiple of100(including negative multiples) — which indicate states when the dial would have been back at zero if I'd bothered to implement modular arithmetic properly.Please do try it out and let me know how you got on. I'm happy to answer any questions.
5
u/mist_mud Dec 01 '25
[LANGUAGE: Typescript]
Initially slipped up counting 'crossing zero's by including those that started from, or ended at zero (which I'd already tracked). Luckily, the test input caught this slip, but it'll teach me to be more careful (or probably not)
https://github.com/Cluracan/Advent-of-Code/tree/main/2025/Day01
4
u/DFreiberg Dec 01 '25
[LANGUAGE: Wolfram Mathematica]
Not quite funky, but it is nice to have built-ins like
Accumulate[]to allow for easy one-liners.Setup:
Part 1:
Part 2:
4
u/Nnnes Dec 01 '25
[LANGUAGE: Ruby]
Not very many half-punchcard solutions yet (and an unfortunate number of oversized solutions in comments). Here's one for both parts including an attempt at descriptive comments:
For parsing,
Ls andRs are simply turned into-s and+s before the string is parsed as an integer.For Part 2's edge case handling, I initially used a multiply-by-zero trick
(a[0] * (n - 1) < 0 ? 1 : 0), but that's the same length as the much clearer version above.Results are added up using a simple
.reduce()accumulator (thea).4
u/doodlebug80085 Dec 01 '25 edited Dec 02 '25
[LANGUAGE: Swift]
I chose Swift because I love writing in it! And I don't get to use it in my day job, which is mostly Python and Bash. Hopefully on a less busy day I can cheese some of the cooler language features, but for now, here's my basic solution.
4
u/bread-dreams Dec 02 '25
[LANGUAGE: F#]
https://github.com/unleashy/aoc-2025/blob/main/Aoc/Day1.fs
I gave up doing it the smart way in part 2 and just expanded every rotation into its +1/-1 constituents.
4
u/Secret_Caramel2095 Dec 03 '25 edited Dec 04 '25
[LANGUAGE: LaTeX]
https://pastebin.com/6R78GKh3
Maybe not the most optimal, but does the work !
4
u/nicuveo Dec 03 '25 edited Dec 04 '25
[Language: Brainf*ck]
like every year, i've been cheating a bit: i use my brainfuck "compiler" that lets me use functions (even if the result is fully inlined). The worst part has been handling left rotations, since there's no notion of signed numbers in brainfuck at all... i end up just doing a +1000 before doing my modulo. it's crude, but it works.
https://github.com/nicuveo/advent-of-code/blob/main/2025/brainfuck/01-A.bs (pre BF generation)
https://github.com/nicuveo/advent-of-code/blob/main/2025/brainfuck/01-A.bf (generated BF)
3
u/synack Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Ada] Part 1 Part 2
Definitely doing some dumb stuff here, looking forward to reading more clever solutions.
3
u/nxrblJugger Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Nim]
Could not figure out how to not use loops, so i gave up and defaulted to that
paste
3
u/Boojum Dec 01 '25
[LANGUAGE: Python]
Part 1 was very straightforward, with simple modulo arithmetic to check for a rotation stopping on zero.
For Part 2, I'll admit that I ran into an embarrassing number of edge conditions. My initial solve consisted of just brute-forcing it to iterate over each step of the rotations and count if the step touched zero at the end. That worked, and got me the second star, but felt really inelegant, since if this were a later AoC day, there'd be a R1125899906842624 in there or something. So using that as I baseline, I went back and was able to work out how to fix up the more "clever" solution:
It was that
if n < dline that took me a while to find.3
u/encse Dec 01 '25
[LANGUAGE: C#]
Continuing the tradition from previous years, I'll make an illustrated journey of my solutions.
I use C# in a more functional style.
https://aoc.csokavar.hu/2025/1/
3
u/Sprochfaehler Dec 01 '25 edited Dec 01 '25
[Language: Python]
'CLICK'
3
u/Parzival_Perce Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Python]
God tired of trying to figure out boolean logic for part 2 so I just simulated the dial one click at a time. Nice day 1 puzzle I'm scared for day 2 lol.
ok is my code block formatted weirdly? im not used to 4 space format. do i have an extra space? i used cmd + ] with python indents (which does give 4 spaces) but it looks like i have an extra space for some reason
3
u/Prof_Farnsworth1729 Dec 01 '25 edited Dec 02 '25
[LANGUAGE: JavaScript]
[Red(dit) One]
I xhose JS, because as evil as certain parts are, ive always had a soft spot for it. Love the instanity options it provides.
Favurite thing I've learnt is the type coercion to boolean isnt always the same as truthy/false values see
[] == ![]Horrible "one liner", executable in console on the page with input
Explanation, basically I'm parsing the text and converting it into executable code.
Each L is replaced with
next-=so that it updates the next variable and equivelent for R.\nis Where we put the logic. Part one is trivial, just check if we are now at 0.For Part two we have to see how much our 100s place changed, but we have to correct for the undercount in the situation that we end on a 0 while going left, and then we have to correct for the overcount it causes in the situations where we then keep going left.
Is this the best way to do it? No but i got to use eval and type coercion
As a simiplified view of the code (purely for here, not what I used) (My actual full solution that I used to solve it is in the code block above)
3
u/dossantosbr Dec 01 '25
[LANGUAGE: Python]
<GitHub Link>
3
u/jhandros Dec 01 '25 edited Dec 02 '25
[LANGUAGE: Python]
3
u/Czh13 Dec 01 '25 edited Dec 04 '25
[LANGUAGE: Typst]
Typst is a markup-based typesetting system. Think LaTeX, but without the confusing boiler-plate and with near instant compiling. This means that the full solution includes a cool visualization!
Code-wise the notable part is this:
(The link to the visualization also includes the full code: go to files in the top left corner using the icon just above the magnifying glass and find day1.typ.)
3
u/jpjacobs_ Dec 01 '25 edited Dec 02 '25
[Language: J] Nice puzzle to start with!
p1 and p2 take the raw input as string. I had fun with modular arithmetic and a modifier train. Modular + doesn't get recognised for fast execution of +/\ though, so better to reverse the list (|.), and operate in the other direction (+m.100/.). I wanted a smart solution, but spelling out each instruction per click was so fast and elegant ( (|#*) ) ...
3
u/Saser Dec 02 '25 edited Dec 02 '25
[LANGUAGE: OCaml]
Solution
Runs in about 250us on my 2021 mid-range laptop. Been a long time since I did any functional programming so the code isn't super elegant but it works. Having fun though :) expect tests are great for toying around with the code and seeing how it behaves.
3
u/PhotoCold5763 Dec 02 '25
[LANGUAGE: Java]
Cool mod trick.
Solution: https://topaz.github.io/paste/#XQAAAQDLBQAAAAAAAAA4GEiZzRd1JAeq0u88xungTX/E/RXmuOUCU57eVZFPep5vBRZxYgrQb/NB5GoSj+H5837xDFpIyHvfaSlEd96mOwluTOGyI+/AEi/s9pB6JhH4ZzY9th43zW0nCUyCd3ccGAbKO4pDYB3W6kqbfgMSg4eNOaKObD7K+v5HfLrxxbi6OIcXH5DuGpd39nQvtfDdfpc21Nf7UqN4f1HvgJ7jGV80TZ4iJhOP3umEqv9XtaFRLPps6ud6X8drnrebop7fwRPg2BQYX3J+HCSKz/Smfr7Vzztcn3BEjbYOdsZDhwHvFc3UyUa+UJ9z6Pytjq+5XTUr6caTOSjvsg8vvmbTcS9axmDYS4gmKJeRbW0LuLG5vvKbOSFAkjtO6itXF8k0OqDGju1uc2Pm4OrndECbPqrqwhDe21h7R5ML49khBIxlAPaMTPs7ZzRzf2124J6VBdnFc7vgyUnaAtGy4RDeTtSKhX5GzbhxLoZ1sjwrwTBUdLKI1E+VHt3MbwPi3WMSUrBHYQcDOXQO15UDcWMw42OmSY0NpwD9ljnhdDmxVWhbd5EGhUtsZojWc6/IMmrjb9UZzXfp/RTc/S/20KhCjikBb3WN83SuBd9HCZxhKtWbrxhcZh+RX3Olk/sNHSL/hiNgAA==
3
u/ploki122 Dec 02 '25 edited Dec 02 '25
[Language: T-SQL]
Github repo
Struggled a bit on phase 2 to conceptualize when the knob was clicking (which lead to the weird CASE, to adjust L movements at the end), but overall it runs in ~1s including the data retrieval and plan caching. On a 2nd execution, it ran in ~0.5s.
I could probably make it much less memory intensive with a cursor, or a similarly iterative approach, but where's the fun in that?
3
u/e_blake Dec 02 '25 edited Dec 03 '25
[LANGUAGE: m4]
In all its punchcard glory, parts 1 and 2 solved with the same code:
Run as
m4 -DI=day01.input day01.m4; on my laptop, it takes about 3.7 seconds with GNU m4 1.4.19, but less than 100ms with the branch-1.6 future release of m4 (where shift($@) recursion is optimized). Probably room to golf this well below its current 306 bytes, while still dropping from two defines into one.3
u/SethGefion Dec 03 '25 edited Dec 05 '25
[LANGUAGE: Python]
For absolut programming beginners (like me):
Part 2:
3
u/Few-Orchid-8393 Dec 04 '25 edited Dec 04 '25
[Language: Ruby]
part two in 9 lines (at a comfy and traditional 80-char width):
I chose Ruby because it's an elegant language, and I've been doing a little scripting in it recently. It's not as popular as it deserves to be, imo.
Since I stripped the comments from this rendition, here's the whole idea: because integer division with negatives is a little weird, for password computation purposes I render "negative" (leftward) rotation as "positive) (rightward) rotation. To do that I want to flip the sign on the rotation if it's positive, and flip the sign on the position (before restoring it to Zmod100, no negatives allowed).
By computing the sign of the rotation, I get to do this without any
ifexpressions, which is pretty cool. When the direction is rightward, all the extra computation in thepassword +=expression does nothing; it's the same as(position + rotation) / 100. But when the direction is leftward, that formula inverts both the original position and the rotation, treating it as rightward rotation from the equivalent complementary position on the dial.2
u/KindComrade Dec 01 '25 edited Dec 01 '25
[Language: С#]
It’s nice to dive back into the Advent of Code atmosphere again - wishing everyone a wonderful time!
Code
2
u/WilkoTom Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Rust]
Solution
I'm sure I could golf this to be far more concise, but for day 1 at 5am, I'll take it.
2
u/sashko-ev Dec 01 '25 edited Dec 01 '25
[LANGUAGE: JavaScript] I wanted to try something new this year, so I made a Strudel music piece about the Advent of Code problem — thankfully, problem 1 lended itself well to it by mapping each position to a note!
Shortened link: https://tinyurl.com/4hkwx65p
GitHub link to code: https://github.com/stubailo/advent-of-code/blob/main/2025/01.strudel.js
2
u/fegte Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Haskell]
I'm trying to improve in Haskell, I love the language, but I feel I'm not great at it, any tips are welcomed!
part1 and part2 on github
From now I hate the mod operator and "AMOUNT COMES BEFORE START, THATS WHY" was shouted at least 3 times
2
u/Complex-Point-9702 Dec 01 '25 edited Dec 01 '25
[LANGUAGE: C++]
for part 2
https://topaz.github.io/paste/#XQAAAQCzAgAAAAAAAAA7G8lg1wA5hxmY5mQtu+adcqmscr0DJfSGznuVIRO7DIzXs6nkYYPyXGh+zWbl+fUcyFneD/02OdBIW8YQy6/c2+mozuXZ7eOF3S2hfRwW4MPD7hvLc7tEjwGaFMXQ9+1OdpwLF4hEQaCOqc01sgHT9OnOhjZCqz4erlcNiKCUKgZ3XEUiza5nGAHz5oY1JsPbQRcQRRv1MfOFaMiHSKm+X1BWWaGBVMprj2jOPBsCnzmCOBMSJobdlnLTMEbP+sR/xgvXzl8roUsXJ9li1YfxXczM1pT1hxKFnz4Psu7qRR+ddhRJwn5m8WnUgkJf6O2Yf5iZ/hiKXt/pC/M8mELlXB/+9aUy5A==
2
u/Longjumping_Grade441 Dec 01 '25
[Language: C++]
Yes, good old, C++ - Documented it all over here - https://github.com/srivatsan0611/aoc2025/tree/main/Day1
Maintaining the repo for daily updates :)
2
u/Tarmen Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Haskell]
Quick and easy with modulo+scanl. Part 2 reuses Part 1 and and does div.
https://github.com/Tarmean/AOC2025/blob/main/src/Day1.hs
For part2 flipping the direction for left turns was easiest, but the chain of subtractions/mod/div looks so ugly:
2
u/Varoo_ Dec 01 '25
[LANGUAGE: Typescript] + Bun needed for native fs read
I did it by hand so if you guys wanna check a not that optimized code BUT what I think is explicit and understandable:
Solution
Bun ftw! appreciate corrections here :)
2
u/BrookeB007 Dec 01 '25 edited Dec 01 '25
[LANGUAGE: JavaScript]
UPDATE: My Gist now has the solution to part 2 included.
Hi, this is my first Advent of Code, and I didn't see any JavaScript solutions yet, so I'm putting mine into the mix!
This is part 1 only: https://gist.github.com/brookenf/22298509f5699523de30fd99946c3187
2
u/Xenoxygen4213 Dec 01 '25
[LANGUAGE: Rust]
I thought this was a fun challenge but thought I would post here to see how many Rust idioms I have not followed. I'd also be curious to know why and how to fix them as i've done very little rust but it intrigues me.
Both part 1 and 2 hve been completed.
https://github.com/grab-a-byte/advent-of-code/blob/main/2025/rust/src/day_01.rs
2
u/Sufficient_Age404040 Dec 01 '25 edited Dec 02 '25
[Language: Matlab]
I used SolveItWithCode to help with some of the concept/vectorization.
2
u/Ok-Specific-5640 Dec 01 '25
2
u/Caconym32 Dec 01 '25
[Language: Python]
Solution: https://github.com/tdrown32/Advent-of-Code-2025/blob/main/day_1.py
2
u/Wrong-Signature-4778 Dec 01 '25 edited Dec 02 '25
[LANGUAGE: Bash]
Part1
Part2
While the second part is not efficient at all, I think it runs reasonably fast. Also, first time writing Shell/Bash for actual programming instead of fast and dirty script. Feedback appreciated.
Edit: hide link behind a shorter word
2
u/edrumm10 Dec 01 '25
[LANGUAGE: Python]
Thought I'd finally give advent a go this year
Part 1: https://github.com/edrumm/advent-of-code-2025/blob/master/day1/day1_pt1.py
Part 2: https://github.com/edrumm/advent-of-code-2025/blob/master/day1/day1_pt2.py
2
u/Dense-Virus-1692 Dec 01 '25 edited Dec 02 '25
[LANGUAGE: gleam]
Terrible, terrible code. I can't believe it worked
paste
2
u/know_god Dec 02 '25 edited Dec 02 '25
[LANGUAGE: C]
GitHub: https://github.com/BolvarsDad/adventofcode/tree/main/2025/01
Part 1:
Part 2:
2
u/West-Perception-9085 Dec 02 '25 edited Dec 06 '25
[LANGUAGE: JAVA]
https://github.com/x1yl/AdventOfCode/tree/master/src/year2025/Day01
Part 2 had me stumped but it worked out in the end
2
u/xiej Dec 02 '25
[LANGUAGE: LLVM IR]
parsing is still the worst, especially since the only way I could debug it was stepping through the generated assembly until I got
itoadone.2
u/vsaraph Dec 02 '25 edited Dec 02 '25
[LANGUAGE: Lean]
Part 1: link
2
u/5stripe Dec 02 '25
[LANGUAGE: Python]
Part 2
2
u/Markavian Dec 02 '25
[LANGUAGE: JavaScript]
https://github.com/johnbeech/advent-of-code-2025/blob/main/solutions/day1/solution.js
My over engineered solution again to start the year... I ended up formatting the output to match the test case. Part 2 was definitely tricky; kept getting caught up either double counting or miscounting 0 positions. In the ended needed to carve out an exception to set 0's to 100 to make my core logic work consistently.
2
u/e_blake Dec 02 '25
[LANGUAGE: Forth]
[Red(dit) One]
Here's my implementation in HenceForth. Yes, there is an r/Forth community, although I've never really hung out there before. My real reason for trying a solution in HenceForth is that it is a dialect of Forth that I have heavily modified to be almost ANS-2012 compatible, but written entirely using Intcode. In turn, my Intcode engine can run on top of crippled m4 (although performance-wise, a quarter-second with my C intcode engine is a lot more palatable than the 8 minutes it took to run on my m4 intcode engine). This solution also runs with bleeding-edge gforth (note that Fedora 42 ships a gforth that is too old to support rec-number that I use in my solution).
Something I learned about Forth while writing this solution: EVERY implementation of Forth has its own quirks. Writing something that works portably across multiple implementations is hard (I tried swiftforth, but it recognizes EOF differently in such a manner that my solution quit early rather than process the last line, at least until I tweak my next-word function).
2
u/Venzo_Blaze Dec 03 '25
[LANGUAGE: Brainfuck]
I am challenging myself to solve this year's advent of code in Brainfuck.
This is the actual 501 lines of program for day 1 with a looot of comments describing what is happening.
And I have time stats, I am using a interpreter I built using C :
Execution for just Part 1 took around 12 minutes.
Execution for both Part 1 and 2 combined took around 20 minutes.
I also made a post with some more info. :)
2
u/Rock_Me-Amadeus Dec 04 '25 edited Dec 04 '25
[LANGUAGE: Rust]
I am currently learning Rust. I haven't programmed anything for about a decade, unless you count bash which I don't.
I feel like I dramatically overcomplicated this!
Since my goal is to learn Rust, I'm going to do some extras that aren't necessary, like pulling the input via HTTPS, simply to learn how these work.
I'm also trying to use match where possible in place of if, since that seems to be good practise although currently I don't 100% understand why.
Paste link to my full code
Here are the interesting bits and what I learned:
There are lots of ways of making get requests, and the reqwest crate seems to be the easiest for simple use cases. I initially wanted to use the blocking method so that I didn't have to deal with an async crate, but I had trouble making it work and it ended up being easier just to use the async example and add Tokio to my project even though I have no idea what Tokio actually does at this point.
Since you need to be logged in, I decided to try just grabbing my session token from my web browser and sending it as a header. That worked. (I was quite surprised it was that simple!)
Extracting the movement direction and number of steps was trivial using substring (which in rust is in its own crate - with Rust I am learning I will have to use a lot of crates to replace functionality that is just present in other languages)
Dealing with the left rotation first
Take the current position and since we're turning counter-clockwise, subtract the number of moves. If this is a positive number, we don't pass zero so we are now at the new position and can continue. If it's a negative number we have gone past 0, so our new position will be 100 minus the new position.
Now the right rotation:
Add the number of moves to the position. If it's less than 100, we are now at the new position. If it's equal to 100 we are at zero. If it's more than 100, we need to wrap around, so we just subtract 100 to find our new position.
The final step is just to check if the new position is zero, and if so, increment the password by 1.
I was happy to find that this logic worked first time once I'd wrapped my noodle around it. Except for one gotcha: some of the moves were more than 100 (so the wheel was being turned redundant full revolutions, often a large number).
To deal with that case I did the following before entering my conditional logic:
This divides the number of movements by 100, discards the quotient and keeps the remainder. This has the effect of taking out all the redundant revolutions and just leaving you with the number of movements you need to make.
The code now worked and I moved on to the second part of the puzzle.
Since my code didn't use really any shortcuts to get to the answer, it was pretty simple to count every time the dial rotated through 0 since I had a separate match for this in my conditional logic.
To deal with the number of times it passed through 0 in the redundant turns, I added the following when I dealt with those:
this does the opposite of the operation to remove the redundant rotations. It uses the divisor to count the number of whole rotations, then you just need to add that to the password count.
I still got the wrong result at this point. I wasn't sure what I was doing wrong, so I read the puzzle again, and it suggested if I got stuck I should run my code on the sample inputs. Doing that allowed me to identify when I was incrementing the password incorrectly: there was an edge case where if you START on 0, my code would increment the password even though the rotation did not pass through 0.
All I needed to do was add an
if pos > 0before incrementing the password. Now my result was correct.2
u/gabrieltriforcew Dec 08 '25 edited Dec 09 '25
[Language: Rust]
Both parts can be found here
I'm using this as an opportunity to learn Rust and also keep my skills sharp. Apologies in advance for any jank!
2
u/abnee Dec 10 '25 edited Dec 24 '25
[Language: C#]
Late to the party, but enjoyed this. I avoided brute force, but was challenged with the edge cases in part 2.
Full program here: https://github.com/ke5dto/AdventOfCode/blob/master/2025/adventofcode-day1/adventofcode-day1/Program.cs
Critical Parts
2
u/MrJakobsen Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Python]
Initial working version of both parts. Modulo algebra can surely be improved.
https://github.com/BoJakobsen/AoC/blob/main/AoC2025/src/puz_01.py
A rather clean version using modulo calculation:
also at: https://github.com/BoJakobsen/AoC/blob/main/AoC2025/src/puz_01_retake.py
30
u/ziadam Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Google Sheets]
Part 1 & 2 (expects input in A:A)
Repo
27
u/Muph_o3 Dec 01 '25 edited Dec 02 '25
[LANGUAGE: SantAS]
I made up a language (GitHub) for solving AoC in style. I converted to stream of +1/-1 for part2 because I'm lazy.
20
u/4HbQ Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Python] 8 lines.
In addition to my original solution, here's one that's a bit more FP-inspired. First we build lists of rotations ([-68, -30, …] for part 1, and a much longer [-1, -1, …, +1, …] for part 2):
We then take the cumulative sums of these lists, and count the number of zeroes (mod 100):
Update: not sure whether I should be proud or ashamed for creating this one-liner (indented for readability):
16
u/Andreasnl Dec 01 '25
[Language: Uiua]
Link
15
u/gfitzy7 Dec 01 '25
[LANGUAGE: Python]
I decided to transform left turns into right turns in an attempt to treat all input the same way:
11
u/stevie-o-read-it Dec 02 '25
[LANGUAGE: Intcode]
ASCII input/output. Both parts.
Compiled Intcode file
Original assembly
Compiler
10
u/Radiadorineitor Dec 01 '25
[LANGUAGE: Dyalog APL]
Good to be back for another year. Let's get those stars!
8
u/michelkraemer Dec 01 '25
[LANGUAGE: Rust]
Solution
Solving both parts in one go.
Oh man, this was a rough first day for me. I somehow wasn't able to figure out the right formula for left turns and kept submitting wrong answers. It took me many minutes until I resorted to brute force. Should have done this right away. :-/
8
u/azzal07 Dec 01 '25
[LANGUAGE: awk] Dial goes click, click, click...
No modulo tricks here, just plain iteration and addition, with some regex to check zeroes.
PS. The dial value even stayed nicely within 16 bit range.
8
u/RazarTuk Dec 01 '25 edited Dec 01 '25
[LANGUAGE: LOLCODE]
I haven't actually done part 2 yet, but... paste
Note that LOLCODE is not well documented. There may well be an actual substring method, but I can't actually find a list of everything that's in the STRING library. So instead, I just made do with a LEN function and an AT function. For example, this is how I actually parsed the input for each line.
Also, I just did some preprocessing by adding the number of lines at the beginning of the file, but in retrospect, I could probably have just looped until the input's empty.
EDIT: Now with part 2
EDIT: Updated it to use the STDIO library and read from the file. part 1, part 2
8
u/Perend Dec 01 '25
[Language: Python]
Ain't got time for modulo bs. Decided to go with the dumbest, unoptimized junior-style possible code and it's not even slow with that input size.
7
u/TallPeppermintMocha Dec 01 '25
[Language: Python] My trick for part 2 is that if you reflect the dial - left rotations become right rotations. This means no weird edge cases in part 2, and no nested loops (imagine we had L4000000 ;) ).
7
u/gisikw Dec 01 '25
[LANGUAGE: INTERCAL]
Not the tidiest of solutions, and I definitely need to brush up on my unary bitwise operators. And I _may_ have spent a little time ahead of time figuring out the Turing tape STDIO. But ya know what? It works!
Parts 1 & 2: https://github.com/gisikw/advent-of-code/blob/main/2025/01/intercal/solution.i
6
u/xoronth Dec 01 '25
[LANGUAGE: Python]
paste
Going to be a fun 12 days.
6
u/XamazingX5 Dec 01 '25
[LANGUAGE: Haskell] Link to full solution
I haven't done much Haskell before so I'm keen to get better at it over these 12 days.
Notable section of part 2 (parsed is a list of ints which are positive for right turns and negative for left turns):
6
u/sim642 Dec 01 '25
[LANGUAGE: Scala]
On GitHub.
In part 1 I just use my
%+operator, which ensures a non-negative modulo result.In part 2 I was lazy and just split each rotation into many
L1orR1rotations, such that the individual clicks become observable and part 1 can basically be reused without thinking about div-mod weirdness with negatives.6
u/0rac1e Dec 01 '25 edited Dec 02 '25
[Language: J]
EDIT: Credit to u/ap29600 for pointing out to that part 2 can be done in a "flat" fashion, simplifying part 2 to
6
u/flagofsocram Dec 01 '25
[LANGUAGE: Uiua]My solution: in the Uiua Pad
String parsing in
17characters and Part 1 and Part 2 in13and17respectively.6
u/Antique_Cup_7622 Dec 01 '25
[LANGUAGE: python]
6
u/dellfm Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Google Sheets]
One formula for both
6
u/icub3d Dec 01 '25
[LANGUAGE: Rust]
Great start to the year! Rust has rem_euclid and div_euclid to make some of the math here easier.
Solution: https://gist.github.com/icub3d/dc8ef4474449d327fda2336f3fe79df9
Video: https://youtu.be/oQbHga6A608
6
u/pLaze Dec 02 '25
[Language: Python]
Pretty efficent part 2 without any if-statements
Didn't bother with modulus to cap it at the 0-99 range. The algorithm is counting the number of times we are passing numbers divisible by 100 (0, 100, 200 and so on). If we go from say 410 to 115, we integer divide by 100 to get 4 and 1 respectively. Taking the difference (4 - 1) gives 3 crosses. But to handle the case of going from say 410 to 400 and up again, we take the positions minus one (the 'hi' variables) and do the same thing, and dividing by 2 at the end to account for the double counting.
5
u/4HbQ Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Python] 7 lines.
Happy to be back for another year! Looking forward to share my solutions here, and maybe learn something new along the way.
My Python trick of the day is to use a hardcoded dictionary instead of if-statements:
5
u/maneatingape Dec 01 '25
[LANGUAGE: Rust]
Solution
rem_euclidcomes in handy. Part 2 left turns need a bit more math to avoid off-by-one errors.5
u/kyle-dickeyy Dec 01 '25
[LANGUAGE: Go]
Both parts: https://github.com/dickeyy/adventofcode/blob/main/2025/day-1/main.go
Lowkey forgot about math.FloorDiv so part 2 took a second
5
u/stOneskull Dec 01 '25
[LANGUAGE: Python]
oh man.. part 1 took like 5 minutes, then part 2 took 2 hours! i kept confusing myself with % and negatives, forgetting there's no negative numbers on the dial at all.. lol..
https://github.com/stOneskull/AoC/tree/main/2025/01
5
u/tymscar Dec 01 '25
[LANGUAGE: Gleam]
This year I picked Gleam and it's quite interesting! Loved today's puzzle. I think overall it was much harder than you'd expect a day 1 to be, but very doable and fun.
The weird issues I had were realising I can't pipe into a when clause in Gleam. Wish I could instead of having to create a new anon function there. Strange also how there's no File IO built into the standard library.
One thing I've loved was the "debug" keyword which is like a print statement that works with any value, without having to fuss about with strings. I do miss string interpolation though.
For part 1 the thing that bit me was modding with 99 instead of 100, other than that it was pretty straightforward.
For part 2 I think I overcomplicated my logic when going to the left. Going to the right is a very nice one liner that just divides the position by 100, but going left has to account for when you underflow but you started above 0, or when you started at 0, as well as counting it when you end up on a zero. There's probably a cleaner way to do it.
Part1 and Part2
5
u/munchler Dec 01 '25 edited Dec 01 '25
[LANGUAGE: F#]
Like others have commented, the easy-but-slow way to solve Part 2 is to generate each click of the dial separately and then count how many clicks are zero, just like Part 1.
5
u/CCC_037 Dec 01 '25
[Language: Rockstar]
part 1
5
u/Main-Reindeer9633 Dec 01 '25
[LANGUAGE: SQL]
[DIALECT: PostgreSQL]
This was a problem very well suited to SQL – no recursion, only one loop layer, and so on.
paste
5
u/The_King_Of_Muffins Dec 01 '25 edited Dec 02 '25
[LANGUAGE: Rust]
EDIT: my challenge input didn't have certain edge cases that others' did. Part 2 fails on a friend's input.
My love for iterators cannot be tamed.
5
u/zer0_k00l Dec 02 '25 edited Dec 02 '25
[LANGUAGE: SystemVerilog]
part1
A synthesize-able systemverilog implementation for an FPGA.
No multiplication/division to keep area low.
5
u/Botskiitto Dec 10 '25
[Language: Vim keystrokes]
Part 1. This took a while. It is always fun when you run into challenges due to the nature of solving issues with vim. And then need to get through those issues. Learn a lot this way.
1 Read the file contents to current buffer
2 First line is empty when using the read command, and the cursor is in second line so move up and insert 50
3 Start macro
4 find L or R
5 From the current line substitute L to - only if L is present otherwise substitution would fail and macro would be aborted.
6 Same for R and +
7 Go to line above insert ( in the beginning
8 Join line below to it, in the first time this will result in (50-68
9 Add closing parenthesis and modulo to the end of line
10 Vims modulo returns negative if number is negative so make sure the value we are taking modulo from is between 0-100
11 Calculate the current line
12 Copy current line at the end of the file if it is 0
13 Go back to first line, this is because in case copy was done the cursor would have moved with the copy to bottom
14 End macro
15 Execute the macro as many times as there are lines in the current buffer
16 Print count of lines are zero excluding first line in case the end result was zero
4
u/python-b5 Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Lily]
Doing this year in a little-known scripting language I've been writing a game with in my spare time (https://lily-lang.org). It's an embeddable scripting language like Lua, but with static typing - an interesting niche I haven't really seen covered elsewhere.
I agree with others that this was harder than the typical Day 1 puzzle, but it still wasn't too bad. I took some time after initially solving it to try to figure out a cleaner solution, but eventually just gave up and committed my original code. The input was small enough it didn't really matter.
https://github.com/python-b5/advent-of-code-2025/blob/main/day_01.lily
4
u/mstksg Dec 01 '25
[LANGUAGE: Haskell]
https://github.com/mstksg/advent-of-code/wiki/Reflections-2025
Another tradition of advent of code day 1 --- everything is just a scan!
Once we parse the input into a list of integers:
Then we can do the cumulative sum and count the zero's. It actually becomes even easier if we restrict ourselves to the integers modulo 100 using the finite-typelits library and
Finite n, usingmodulo :: Integer -> Finite nto cast:Part 2 you can probably do using more modulo and division tricks but the simplest way is probably just to explode all of the ranges and do the same counts. We use
mapAccumLto map a stateful function, where the state is our current position and our output is the list of all the traveled numbers:4
u/__tml__ Dec 01 '25
[Language: Elixir]
Code
4
u/trevdak2 Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Javascript]
I love golfing these solutions
Part 1, 87 bytes
Part 2, 139 bytes:
4
u/AvailablePoint9782 Dec 01 '25 edited Dec 01 '25
[LANGUAGE: PHP]
Surprisingly hard not to double count. Still, happy with my solution.
If you want to be on a PHP only leaderboard, let me know. Not using AI preferred, but I won't be able to control you on it.
In general trying to write code with comments and without a lot of libraries,
https://github.com/LiseAndreasen/AdventOfCode/blob/master/2025/d01a.php
4
u/YenyaKas Dec 01 '25
[LANGUAGE: Perl]
In part 2, I did not manage to avoid many special cases, such as keeping both old and new values. Other than that, my solution is pretty straigthforward, the most perl-ish part being the
y/LR/-+/substitution.Part 1, Part 2.
4
u/[deleted] Dec 01 '25
[LANGUAGE: Rust]
Part 1 (759µs):
A nice warmup for string parsing and basic math operations.
Part 2 (747µs):
The right rotations was easy, but i had some problems fixing the left rotations but managed to solve it fairly quickly.
Solutions: https://github.com/Elyrial/AdventOfCode/blob/main/src/solutions/year2025/day01.rs
4
u/flwyd Dec 01 '25
[LANGUAGE: dc] (on GitHub)
My theme this year is “scripting languages you might have sitting around on your computer.” I originally thought I would be doing a bunch of puzzles on my phone, so wanted some really terse languages that I could run from termux without installing a large compiler. Turns out I’ll mostly be coding from a Chromebook, but I’m still trying to use a different scripting language each day, with a focus on languages that aren’t really intended as a general purpose language.
I wrote code generators and runners for half a dozen languages, but didn’t feel inspired to figure out how to make
dcdo I/O to meet my runner framework expectations. When I read part 1 I checked all my ready languages to see if they had an “unsigned modulus” operator, but no luck. After some thought I realizeddcwas a reasonable choice for part 1, and wrote asedscript to transform the input file into a series of stack-oriented desk calculator commands. Part 1 alone, with theiandasedlines insertingdccode:This keeps an unsigned running position rather than storing the modular value. The
sedcode transformsL68into68-andR14into14+; thedccode runsmod 100on a copy of the running total and increments a counter if that modulus is zero.Part 2 was more complicated, since we need to know when we’re crossing zero, so some awareness of the prior state is needed. I had a bunch of almost-right answers and had trouble keeping the entire
dcstack in my head, but finally worked out the following to handle both part 1 and part 2, with spaces added for “readability.”Now we keep the actual (unsigned) lock face value rather than incrementing and decrementing without bounds. “Larger than 100” spins are handled by doing a divmod; keep a copy of the unsigned remainder, and increment part 1 if it’s 0. Then add the absolute value of the quotient to part 2. The tricky bit is to increment part2 if a left turn takes us past zero, but only if the face isn’t currently 0 (right turns are completely handled by the divmod).
dcdoesn’t have anandoperator per se, so this is done by calling thevmacro on every left turn;vcallsVif the current value isn’t 0, andVincrements part 2 if the new value is larger than the current value.Red(dit) One: despite being one of the oldest Unix programs,
dcis such a niche “language” that r/dc doesn’t exist. r/sed is for the other language in the mix, and I think “generate code for a language that looks like line noise using sed” qualifies for “the worse the code, the better we like it.” Also, I think everything you do withdcis something funky. I did finally learn how to use the program, though. But I’ll take the spartan standard library of PostScript (even though I did build my own library in 2024) over the “it’s almost assembly” limitations ofdc.4
u/kerr0r Dec 01 '25
[LANGUAGE: SQL]
(DuckDB)
Solution: https://pastebin.com/raw/yDFChgVD
Modulo and integer division with negative numbers was no fun, so I cheated by starting at 100050. Some loss of generality there, but we take those.
4
u/melochupan Dec 01 '25
[LANGUAGE: Crystal]
I'm sure those formulas can be simplified; I'm bad at maths :(
4
u/kristianhassel Dec 01 '25
[LANGUAGE: Midio]
Decided to try some of the advent of code puzzles in the visual language I'm building called Midio.
https://github.com/midio/advent-of-code-25/blob/main/day1.midio
Will post more details in the repo about how it works and how to run it, in case anyone is interested.
4
u/thedrj0nes Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Intersystems ObjectScript / MUMPS]
MUMPS is an old language and rarely used outside of the fields in which it was used many years ago (finance and healthcare)
Today's task was brute forced moving one position at a time, but it ran in < 35ms ... so no need to optimize yet. I try to start simple if I can then work up the complexity when needed.
Part 2 was pretty much a case of checking when the number hit 0, since I already iterated every single number as it passed by.
Day 1
4
u/TheZigerionScammer Dec 01 '25
[Language: Python]
Well that was tricky for a day 1 problem, which I guess is to be expected since it's probably the equivalent of a day 2 or 3 problem in any other year.
Part 1 was easy, and in fact I had a working solution up before I could even get my browser to open so I could download the input. (I read the problem on my tablet while my computer was sorting its issues.) Pretty easy, separate the letters and numbers, keep a running tally, add or subtract the number value depending on whether it's right or left, modulo by 100, check if it's equal to zero and add one if it is. Got is perfectly.
Part 2 was trickier, I had the thought that I could just simulate it click by click but decided against it since that would be inefficient and I had a modulo based system already. So I added another check to see if the final position after a rotation was either zero or negative, or 100 and over, and if it was then add one to Part 2 Answer, but this was wrong. At first I realized this would fail if there were any numbers above 100 in the input, and of course there were, so I added a line to just add to the Part 2 Answer by however many multiples of 100 there were, but still got it wrong. Then I realized that if the rotation was exactly a multiple of 100 then that would double count, so I fixed that and it didn't change anything. (Turns out my input didn't have any numbers that were exact multiples of 100, but someone else's might have). Then I had to go into Serious Debugging Mode to find what it was missing, and it turned out that just because the dial went into the negatives, doesn't mean it crossed zero to get there if it started at zero. So I was double counting them, do'h. Fixed that, got the answer.
Paste
4
u/This-Bug4559 Dec 01 '25
[LANGUAGE: C]
Didn't feel like dealing with negative numbers, so I am reversing the dial whenever I change the direction of rotation. Then it always turns forward! And no special cases when starting or ending at 0.
4
u/Cerebrum01 Dec 01 '25
[LANGUAGE: TeleBASIC]
4
u/XLNBot Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Python]
I tried to think of "out of the box" ideas to make it with only one loop in the simplest way possible.
I came up with this interesting solution where, instead of moving the arrow backwards, I just "flip the clock" and keep moving the arrow forwards. Did anyone else think of this? I think it's a pretty elegant solution, it only uses one loop and one if.
4
u/CutOnBumInBandHere9 Dec 01 '25
[LANGUAGE: Python]
Fewer lines is better, right?
Part 1:
Part 2:
Here's the full code including any imports and a bit of an explanation of what I'm doing
4
u/SlayahhEUW Dec 01 '25
[LANGUAGE: Python]
Part 2
4
u/Verulean314 Dec 01 '25
[LANGUAGE: Kotlin]
[Red(dit) One]
GitHub
I really enjoy Kotlin for Advent of Code since it has a huge standard library for collection types, which lends itself well to a lot of the puzzles. It also has just enough opportunities for writing cursed code to make things interesting.
Not a ton of funky language-specific stuff today since the problem was pretty straightforward. One thing I learned while solving this puzzle is the
String.replaceFirstCharmethod, which made the input parsing nice and compact. I also love Kotlin's extension functions, which allow defining new methods on existing classes, such as theInt.floorModfunction I added today to compute the non-negative remainder.4
u/WolfRushHour Dec 01 '25
[LANGUAGE: Julia]
The logic for both parts is in the loop in the
count_zerosfunction.4
u/NeilNjae Dec 01 '25
[LANGUAGE: Haskell]
Misusing the Either data type to store instructions. Part 2 had painful off-by-one errors until I stumbled across this solution. Full writeup on my blog, code on Codeberg.
4
u/ssnoyes Dec 01 '25
[LANGUAGE: Rockstar]
https://gist.github.com/snoyes/603ef29b60e86d4df66a37ee563b4677
The rhyme scheme and meter might look random, but are they really?
(yes)
4
u/acquitelol Dec 01 '25
[LANGUAGE: The TypeScript type system]
https://github.com/acquitelol/aoc2025/blob/mistress/01/solution.ts
Unfortunately, I doubt this solution would run in reasonable time for the full input, but at least it works for the sample! Perhaps one day I will try to implement arithmetic operators (add, sub, etc) without an accumulator so I don't hit the recursion depth, but until now I haven't figured out a way to do that yet.
4
u/aurele Dec 02 '25
[LANGUAGE: Uiua]
4
u/[deleted] Dec 02 '25
[LANGUAGE: COBOL]
Earlier I posed my solution in Haskell here.
Because I'm absolutely feeling sick and demented today, I ported my solution to COBOL:
Part 1
Part 2
Tested to work and give correct answers with GNU COBOL. Not guaranteed to work with other COBOL implementations - YMMV. Enjoy.
4
u/Jumbledswp Dec 02 '25
[LANGUAGE: C++]
I tried to maximize readibility
4
u/slzbnd Dec 02 '25 edited Dec 02 '25
[LANGUAGE: python]
I enjoy how clear a direct an inefficient approach reads for a problem like this. Take it one tick of the dial at a time, check the position after every adjustment, and count the zeros.
4
u/Busy_Coffee779 Dec 04 '25 edited Dec 04 '25
[LANGUAGE: R]
I thought my solution had some uniqueness to it in that it is short, and I get around the edge case by noticing that when the dial goes to zero and reverses, it either counts it twice or not at all, and there's a symmetric case for rounding classes up rather than down. So I just combine them.
1
u/seligman99 Dec 01 '25
[LANGUAGE: Python]
github
Fun start, and I'm so happy to have AoC back again this year!
1
u/Infamous-Room7508 Dec 01 '25
1
u/psm_pm Dec 01 '25 edited Dec 01 '25
[Language: TypeScript]
JS's useless remainder operator strikes again.
1
u/madSimonJ Dec 01 '25
[Language: c#]
I've done this in a pretty pure functional style in C#: FunctionalProgrammingWithCSharp/AdventOfCode/AdventOfCode/2025/Day01.cs at main · madSimonJ/FunctionalProgrammingWithCSharp
1
u/InnKeeper_0 Dec 01 '25 edited Dec 15 '25
[Language: C# in Unity3D]
source: paste
1
u/plutack Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Go]
Trying to make Go my go-to language and evolve past javascript I started with. I really just tried to use most of what I know and just pop up in my head so the style of code might not be the best. Got stuck on the part 2 particularly managing edge cases when moving back
https://github.com/plutack/advent-of-code-2025/blob/main/day-1.go
1
u/rumi124 Dec 01 '25
[LANGUAGE: C#]
https://github.com/dr124/advent-of-code/blob/master/Advent._2025/Day01.cs
About 50 µs for both parts.
1
u/MuhammadSaadSiddique Dec 01 '25
[LANGUAGE: Python]
Get working code
1
u/kiekiekiekiekie Dec 01 '25
[LANGUAGE: TypeScript]
https://github.com/Jiralysm/advent-of-code-25
1
u/marvinborner Dec 01 '25
[LANGUAGE: Effekt]
Git
Effekt is a research language all about effects and handlers. Here, I used effectful streams for IO and parsing as well as effects for the ticking of the password dial and emitting of the solution. This makes the final solution:
1
u/Electronic-One-7577 Dec 01 '25
[LANGUAGE: Python]
Day 1 solution: https://github.com/olganowak/advent_of_code/blob/a00718328ea5933564265e497889d59a951ba9cd/2025/01/result.py
1
u/Objective-Dealer1059 Dec 01 '25
[LANGUAGE: Python]
[Part 1 and 2](https://github.com/salmiyounes/advent-of-code/blob/master/2025/day1/sol.py)
1
u/SnooHesitations6473 Dec 01 '25
[LANGUAGE: Haskell]
[Part 1](https://github.com/Sammers21/advent-of-code-2025-haskell/blob/main/Day01a.hs)
[Part 2](https://github.com/Sammers21/advent-of-code-2025-haskell/blob/main/Day01b.hs)
1
u/LeoCx1000 Dec 01 '25 edited Dec 03 '25
[LANGUAGE: Python]
Part 1:
Part 2:
I have also proper solutions, that arent cursed
1
u/fatherboard_28 Dec 02 '25
[LANGUAGE: Java]
Probably not the best way to do it, but it works.
https://github.com/fatherboard28/2025-AOC/blob/main/day1/Main.java
1
u/No-Present8648 Dec 02 '25 edited Dec 02 '25
[LANGUAGE: python]
https://github.com/rickyjonesus/advant_calendar-2025/tree/main/Day1
1
u/AnotherRoy Dec 02 '25
[LANGUAGE: Elixir]
[Github link](https://github.com/gonzafernan/adventofcode/blob/main/2025/lib/aoc25_day1.ex)
This year I’m tackling something that has been sitting in my backlog for quite some time, a functional language. I decided to go with Elixir, and [this is my solution for day 1](https://github.com/gonzafernan/adventofcode/blob/main/2025/lib/aoc25_day1.ex) (also here are [the tests in case you are interested](https://github.com/gonzafernan/adventofcode/blob/main/2025/test/day1_test.exs)).
To be honest, it was more challenging than I expected. Reading through Elixir’s docs was great, but actually solving the puzzle was a big step. It's interesting how different the way you approach a solution could be with a functional language.
Anyway, really fun so far!
1
u/sebastianblaster Dec 02 '25
[LANGUAGE: nim]
https://github.com/Naitsabot/adventofcode2025/blob/main/day01/day01.nim
there is no difference in the "partx" functions really, everything happens in templates
1
u/Fresh_Mission_9745 Dec 02 '25
[LANGUAGE: C Sharp - C#]
https://github.com/IlanWanounou/AdventofCode-2025/blob/master/adventofcode/Day1/Day1.cs
1
u/nikcorg Dec 02 '25
[LANGUAGE: Go]
Link to full source below embed. Took a long while to get my head in gear, but pretty happy with my solution. Could definitely be more compact, but opted in favour of readability.
Full source: https://raw.githubusercontent.com/nikcorg/advent-of-code/refs/heads/2025/2025/01/main.go
1
u/a9sk Dec 02 '25
[LANGUAGE: Golang]
https://github.com/a9sk/adventofcode/blob/main/year-2025/day-01/main.go
1
u/Rahbek89 Dec 03 '25
[LANGUAGE: Python]
First time participating :)
Tried to make it look neat: GitHub
run the test file
python3 main.py testrun the challenge filepython3 main.py run1
u/Orange_Pineapple719 Dec 05 '25
[LANGUAGE: Python]
Day 1 - part 1, this was easy :)
Day 1 - part 2 (started with first solution, couldn't figure out edge cases so wrote solution two, then used that to get the edge cases in the first solution as well)
3
u/Pyr0Byt3 Dec 01 '25
[LANGUAGE: Go] [LANGUAGE: Golang]
https://github.com/mnml/aoc/blob/main/2025/01/1.go
3
u/cay_horstmann Dec 01 '25
[Language: Java]
Boring Java solution with unfussy math. Shoutout to floorDiv/floorMod.
3
u/TraditionalWinter676 Dec 01 '25
[LANGUAGE: Zig]
Simple is better
3
u/M1n3c4rt Dec 01 '25
[LANGUAGE: Haskell]
Both parts: https://github.com/M1n3c4rt/adventofcode/blob/main/2025/Day2025_01.hs
3
u/Meamoria Dec 01 '25
[Language: Kenpali]
Using AoC to test out my experimental minimalistic language.
Part 1
Part 2
3
u/mendelmunkis Dec 01 '25
[LANGUAGE: C]
Sometimes the stupid way is good enough
819 μs/848 μs
3
u/_rabbitfarm_ Dec 01 '25
[Language: Prolog]
Part 1: https://adamcrussell.livejournal.com/61781.html
Part 2: https://adamcrussell.livejournal.com/61999.html
In both parts I use a Definite Clause Grammar (DCG) to keep track of the state of the dial. The bookkeeping got a little grungy in Part 2, but it's good enough for puzzle code.
3
u/Hath995 Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Dafny]
Part 1 and 2
Includes a couple nice proofs that explain part 2.
3
u/Adventure_Agreed Dec 01 '25
[LANGUAGE: TypeScript]
Struggled with a lot of edge cases on part 2 and had to rewrite when the condition checking got out of hand but I am happy with my solution. So pumped to be back in the saddle!
https://github.com/AnthonyGReed/Advent-of-Code/blob/main/2025/01/puzzle.ts
3
u/gyorokpeter Dec 01 '25
[LANGUAGE: q]
3
u/alehandy Dec 01 '25
[LANGUAGE: Python]
Took me a moment with part 2 to figure out the 0 > 0 & mistakes with negative numbers in modulo. Still had type 1 fun.
Part 1 & 2
3
u/lunar_mycroft Dec 01 '25 edited Dec 01 '25
[Language: Rust]
This took me far longer than I'd like, and longer still fiddling with it (I'm still not happy with the final result).
Full code, part 1, part 2. Mean execution time (on my machine) is ~65µs for parsing, ~19µs for part 1, and 22µs for part 2.
[edit: fixed full code link]
3
u/sup3rmari0 Dec 01 '25
[LANGUAGE: Go]
Using Go since I'm having to use it professionally now.
Part 1 - used modulo to count zeros then normalized "dial" position
Part 2 - stumped me for a minute, until I realized I could apply the same logic from part 1, except do it while looping over a range of the delta amount.
https://github.com/thismarioperez/aoc-go/blob/main/years/2025/day01/solution.go
3
u/nilgoun Dec 01 '25
[Language: RUST]
Boy, I did confuse myself way more than I should have with a "clever" solution... But now I'm relatively happy and looking forward to see where I could have improved.
here
3
u/cypok037 Dec 01 '25
[LANGUAGE: Kotlin]
Nice, clean, idiomatic. :)
3
u/bramhaag Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Haskell]
Both parts, fairly straight forward solution.
And a bonus solution, exploiting the symmetry of the rotations:
3
u/CowImaginary3155 Dec 01 '25
[LANGUAGE: Scheme]
3
u/careyi4 Dec 01 '25
[LANGUAGE: Rust]
1 & 2: https://github.com/careyi3/aoc/blob/master/y2025/solutions/d01.rs
3
u/Jadarma Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Kotlin]
A nice puzzle involving modulo arithmetic, part one is easily solved with a simple running fold, but the second part gave me a few headaches with off-by-ones. In the end I rewrote my solution to solve both parts with the same code.
The second part can easily be brute-forced given the relatively small input size, but we can do it with math as well! Basically, we first try to get the dial to zero, then see how many more hundreds we have left in our bump instruction and divide that by 100, giving us the extra times the dial passes through zero. We don't really care about the remainder of this division, because the actual dial position is calculated with the simple modulo logic from part one, here we just care about counting the extra passes through zero.
It was a bit sneaky that part two didn't also give an example with values bigger than 100, but at least there was the text hint about the edge case.
Extra hint for Kotlin users: use
x.mod(y)instead ofx % yto get the correct values whenxis negative!AocKt Y2025D01
3
u/geza42 Dec 01 '25
[LANGUAGE: Emacs Lisp]
3
u/RugglesIV Dec 01 '25
[Language: Python]
Props to everyone doing the teeny tiny Python answers. My cope is that mine is more readable
P1:
P2:
3
u/Naturage Dec 01 '25 edited Dec 01 '25
[LANGUAGE: R]
Code here!
(not going to bother with a public repo as code sits in a work one)
Honestly, I don't like P2. My brain tells me there's an elegant div 100 solution, but it's too early in the morning for the off-by-one errors, so slightly bruteforced it.
3
u/UseUnlucky3830 Dec 01 '25
[LANGUAGE: Julia]
We are back! Solved with div/mod, although it took a while to figure out the correct logic.
GitHub
3
u/stribor14 Dec 01 '25
[LANGUAGE: C++]
I couldn't find a way to avoid (N - n), i.e., old_N, to check the zero crossing
3
u/Own_Concept_7835 Dec 01 '25
[LANGUAGE: Python]
A good start to this year's challenge. Swiftly got the answer to part two using brute force, but took ages to get my head around the modulo maths for the improved version.
Code on my GitHub.
3
u/WillingnessFluffy Dec 01 '25
[LANGUAGE: Godot]
Day 01 GDScript Solution
Perfect opening storyline for Advent of Code. Really enjoying the challenge of doing this in `gscript`.
3
u/lboshuizen Dec 01 '25
[Language: F#]
Git
Modulo fun.
3
u/silverarky Dec 01 '25
[LANGUAGE: Rust]
First time using Rust so this probably isn't idiomatic
Part1
Part2
3
u/lokedhs Dec 01 '25 edited Dec 01 '25
[LANGUAGE: Kap]
The following are two independent functions, solving part1 and part2.
The parsing is 19 characters, and the actual solution for part1 is 12 characters. The solution for part2 is longer, at 33.
3
u/dannybres Dec 01 '25
[LANGUAGE: MATLAB]
https://github.com/dannybres/Advent-of-Code/blob/main/2025/Day%2001/day1puzzle2.m
Spent way too long working on a vectorised solution to part 2. Thanks, u/JWinslow23 for the inspirations!
3
u/sunnyjum Dec 01 '25
[LANGUAGE: JavaScript]
Are parallel universes acceptable?
3
u/msschmitt Dec 01 '25
[LANGUAGE: Python 3]
Part 2 solution
I'm hoping we can now scratch off "Modulo Arithmetic" on the puzzle list.
Python's weird treatment of the // and % operators for negative numbers was causing me too much trouble. Maybe there's something in the math library that would have worked better. But I ended up just converting the negative case into positive numbers.
The big problem I was having with first attempts was that it worked on the sample data but not on the real input. So to figure it out, I added a brute force calculation and flagged where it differed from the algorithmic method. To my surprise, it was flagging sample data! Which meant, my original algorithm didn't work at all, but the incorrect individual results ended up with the correct total.
3
u/IlliterateJedi Dec 01 '25
[LANGUAGE: Python]
Part b only:
I spent two hours off and on trying to work out the clever way to solve this with modulo/divmod, and eventually I just realized "There's no universe where this takes too long to run... Let's just do this the old fashioned way". And whipped that out in about ten seconds.
3
u/SurplusSix Dec 01 '25
[LANGUAGE: Gleam]
File was read and turned into a list in an outer func
3
u/WestOfRoanoke Dec 01 '25 edited Dec 01 '25
[LANGUAGE: C]
Boring 'ol C. I am slowly working through 2017 with it so I used it for today's puzzle too. One small thing I like about working with C is that the stdlib documentation is just a man page away. Forget the order of arguments?
M-x man sscanf. Same is true for many libraries like ncurses.Part two. Brute force. No attempt made at efficiency. :-)
GitHub
3
u/Mr-Doos Dec 01 '25
[LANGUAGE: Smalltalk]
To me, Smalltalk was always one of "those languages": the ones you've heard of, think you know about and probably could learn if you found the time. Well, 2025 is the time.
Using Pharo, because I could figure out the GitHub tools, which I couldn't with Squeak. https://pharo.org
First day's solution was simple and to the point. Didn't want to screw it up. Is using higher-level functions in a pure OO language considered heresy?
https://github.com/sbiickert/AdventOfCode2025-Pharo/blob/master/src/AdventOfCode/Day2025_01.class.st
3
u/smallpotatoes2019 Dec 01 '25
[LANGUAGE: C#]
I've written about 10 different versions of my Part 2 and gone back over the logic again and again until I realised that my use of % 100 on negative numbers had messed things up very slightly. Corrected with a great big power of ten and all is well.
https://github.com/TimN1987/AdventOfCode/blob/main/CSharp/AoC2025/Days/Day1.cs
3
u/hugh_tc Dec 01 '25
[LANGUAGE: Python 3]
Thanks, Eric, for another year of Advent of Code!
It's a bit odd, but I'm happy to have gotten each part into a single Python comprehension.
https://github.com/hughcoleman/advent-of-code/blob/main/2025/01.py
3
u/Brogrammer- Dec 01 '25
[LANGUAGE: bash]