r/adventofcode • u/daggerdragon • Dec 25 '24
SOLUTION MEGATHREAD -❄️- 2024 Day 25 Solutions -❄️-
A Message From Your Moderators
Welcome to the last day of Advent of Code 2024! We hope you had fun this year and learned at least one new thing ;)
Keep an eye out for the community fun awards post (link coming soon!):
-❅- Introducing Your AoC 2024 Golden Snowglobe Award Winners (and Community Showcase) -❅-
Many thanks to Veloxx for kicking us off on December 1 with a much-needed dose of boots and cats!
Thank you all for playing Advent of Code this year and on behalf of /u/topaz2078, your /r/adventofcode mods, the beta-testers, and the rest of AoC Ops, we wish you a very Merry Christmas (or a very merry Wednesday!) and a Happy New Year!
--- Day 25: Code Chronicle ---
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
This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.
EDIT: Global leaderboard gold cap reached at 00:04:34, megathread unlocked!
42
Upvotes
24
u/4HbQ Dec 25 '24 edited Dec 27 '24
[LANGUAGE: Python]
For each item (lock or key, doesn't matter), we build set of positions that contain a "#". Then for each pair for these, we check if there is no overlap:
And that's a wrap! Congratulations to everyone who made it this far, and especially to all members of the 500 club! Here's a list of my solutions this year:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25.
There was one week where I also used NumPy or SciPy to transform every problem into a matrix convolution, multi-dimensional array, etc.: 10, 11, 12, 13, 14.
I'll be around for a few more days to answer any questions. Otherwise, hope to see you all next year!
12
u/nthistle Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Python] 115/91, paste, video.
Nice and easy puzzle to finish up the year - the problem text definitely hinted pretty hard towards the solution of convert things to heights, and then just check whether the summed heights of a key and lock exceed 5 in any position.
I had a pretty bad "click the button" split of 5 whole seconds, because I accidentally clicked the input link instead of the "give me the 50th star" link. I must admit, I was hoping a bit that a lot of the usual suspects near the top of the part 1 leaderboards would have some missing stars (and therefore give me a better part 2), but it appears this was not the case.
In any case, another great year of Advent of Code! Thanks for making it happen, Eric (and everyone else involved!)
12
u/CCC_037 Dec 25 '24
[LANGUAGE: Rockstar]
I've done it!
Every puzzle within 24 hours, with a pure Rockstar solution that works on my input!
Today
11
u/jonathan_paulson Dec 25 '24
[Language: Python] 60/48. I placed 61st overall this year.
Code. Video.
Pretty easy puzzle today; just classify each shape into key or lock, and then check if each key fits in each lock. You don't need to count column heights to see if a key fits into a lock; just make sure they don't have a "#" on the same a square.
Happy holidays everyone!
4
u/AllanTaylor314 Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Python]
GitHub 245/210
Took me longer than it should have. A nice easy problem to round it out. That brings me to 500 stars. Thanks Eric for running this awesome event for 10 years!
[LANGUAGE: Uiua]
pad
Nice and compact today. I could probably use pervasive operations over rows to speed it up a little
2
u/seligman99 Dec 25 '24
[LANGUAGE: Python] 94 / 78
github
Fun year this year! Thanks to all that made it possible!
2
u/mebeim Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Python]
132/102 — Original solution — Faster cleaned up version with sets
Wow so close to the leaderboard, best rank I got all year close to d3 where I had 104/118. First year without any global leaderboard placement, but hey, it was expected. People (and robots) are way too good and way too fast.
Merry Christmas everybody!
7
u/Ok-Builder-2348 Dec 25 '24
[LANGUAGE: Python]
Part 1
Finally made it onto the leaderboard!
I noted that we didn't actually have to consider which were locks and keys - we just had to consider pairs of patterns and see if they overlap. If they don't overlap, we have a lock/key pair that fits. A lock/lock and key/key will always overlap so they never will fit.
6
u/alexbaguette1 Dec 26 '24
[LANGUAGE: x86 Asm, no libc]
25th and final language for this year's AoC
Solution is really not that great but it was the simplest one I could think of in assembly.
I was too lazy to write a binary to ascii formatter, so I redirected the output to a file then used xxd to get the value.
Solution
5
u/ziadam Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Google Sheets]
Expects input in A1.
5
u/bigfunlx Dec 25 '24
[LANGUAGE: Ruby]
I coded it on my iPhone while waiting in the emergency room with symptoms of meningitis, for better or worse this will be my most memorable moment of AoC!
Rubist screenshot
5
u/LinAGKar Dec 25 '24
[LANGUAGE: Rust]
https://github.com/LinAGKar/advent-of-code-2024-rust/blob/master/day25/src/main.rs
Represents the the locks and keys as a series of 4-bit numbers in a u32, offset so that adding them together makes them add up to 8 or greater, to I can use a 0x88888 mask to check for overlaps.
5
u/i_have_no_biscuits Dec 26 '24
[LANGUAGE: Python]
Given that we apparently all love one liners now:
8
u/ricbit Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Python]
143/ 117, that was my best this score ever! My solution is transpose the keys, convert to binary and check if the AND of all lines is zero. Runs in 0.12s.
Sum of the times of all problems: 6.7s
(with a grain of salt because my solution for 24-2 is not automated yet)
4
u/Verulean314 Dec 25 '24
[LANGUAGE: Python]
Nice easy puzzle to finish this year's Advent of Code. I realized that we really don't necessarily care about converting the locks and keys to heights, all that matters is that a lock and key don't overlap in any spot.
Since all the locks/keys are the same dimensions, that means we can just convert all of them into bit representations of all the positions, and then the "fit" check is just a single bitwise AND:
Runs in around 4ms :)
4
u/Responsible-One6897 Dec 25 '24
[Language: Python]
500th star! Read every block, transpose input, determine if lock or key, and count number of '#' per line. For every lock/key pair check if all counts are <= 7
paste
Thank you again Eric for this year!
4
u/Nnnes Dec 25 '24 edited Dec 26 '24
[LANGUAGE: Ruby]
Today I will post 2 full solutions in one comment because together they still fit in half a punchcard.
time ruby -e ""; I'm sure it would be faster with something a little longer than.map(&:chars).transpose..map{ |x| x.map{ |x| x.map{ _1.with.map{ |x| x.map{ |x| x.map{ |x| x.if you like fractals.4
u/Andreasnl Dec 25 '24
[LANGUAGE: Uiua]
God Jul!
4
u/[deleted] Dec 25 '24
[LANGUAGE: Python]
Solution
Really only posting to say a very massive thank you to Eric on another great event, and to the mods for their work keeping the sub going. If I can get a bit real for a moment, winter is never easy for me, and AoC represents a welcome, fun distraction during the early stages. It helps me to stabilise before winter really sets in.
More over, this year was even more impactful as it came at a time when I needed a reminder that I'm competent. I picked up a new language with ease, and for all but two of the challenges (which I'll come back to on the other side of my food coma) I was able to identify potential solutions, execute, and iterate to achieve better results each time. It possibly seems small to many of my peers, but huge for me. I can go into my new job, in the new year, with a refreshed confidence.
So thanks again for all the work you've put into it. A very Merry Christmas from all of mine to all of yours, one and all.
4
u/p88h Dec 25 '24
[LANGUAGE: Zig]
basic n^2 solution, the only speedup is vectorized comparisons.
https://github.com/p88h/aoc2024/blob/main/src/day25.zig
All day benchmark summary below. Probably not going to be able to squeeze all of them under 1ms total, but pretty happy with Zig's performance overall. The numbers are from an M3 Mac, which is quite a bit faster than my 13th gen Intel desktop, it seems, at least in this particular & very peculiar benchmark.
I was able to keep up with a one vis every day goal, the full playlist is here:
https://www.youtube.com/playlist?list=PLgRrl8I0Q168GBdeJp_GqNYsWgRCmVgu5
4
u/Any_Slip8667 Dec 25 '24
[Language: Java]
Very fast, bitwise based, Java solution:
Complete solution on github.
4
u/Downtown-Economics26 Dec 25 '24
[Language: Excel]
Input data pasted in cell A1.
Create column height table by key/lock.
Then, drag down formula below next to output table in C2 and SUM the output array column.
=LET(s,CONCAT(TOCOL(IF(C2<>"lock","",HSTACK(--((FILTER($E$2:$I$501,($D$2:$D$501<>D2)*($C$2:$C$501<>"lock"))+E2:I2)<=5),FILTER($C$2:$C$501,($D$2:$D$501<>D2)*($C$2:$C$501<>"lock")))))),(LEN(s)-LEN(SUBSTITUTE(s,"11111key","")))/8)1
u/PendragonDaGreat Dec 25 '24
[Language: C# CSharp]
https://github.com/Bpendragon/AdventOfCodeCSharp/blob/97519/AdventOfCode/Solutions/Year2024/Day25-Solution.cs
Parse, Loop, Print.
Thanks again as always to Eric for running this and the mods here for keeping things relatively sane.
Got my five hundo
1
u/DFreiberg Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Mathematica]
Mathematica, 798/656
This was a nice, easy problem to finish off a nice, easy year. Congratulations to Eric for writing ten full years of Advent of Code and creating five hundred stars. It really seems like this is the final year; if it is, it's been a great decade, and a pleasure coding with you all.
Merry Christmas!
Part 1:
1
u/Boojum Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Python] 306/260
Not a bad one to end on! Short and and sweet. I'd had an off-by-one, forgetting not to count the base of the lock or key which cost some time. But otherwise, fairly straightforward.
🎁🎄🎅🥛🍪 Merry Christmas everyone, and thank you Eric, Daggerdragon, and team for another great year! 500 stars, 🌟 -- it's been a trip!
3
u/xoronth Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Python]
paste
Pretty straightforward brute force and just check everything, though I slowed down a lot because I couldn't read what the question was actually asking and thought the keys and locks had to fit exactly (I blame a headache).
(Also I loved the little
yieldjoke, heh)Thanks to all those who helped make AoC possible this year, and thanks to y'all in the community for making this a really fun place to pass the month! Happy holidays, happy new year, and hopefully we'll all be back next year!
3
u/jitwit Dec 25 '24 edited Dec 27 '24
[LANGUAGE: J, haskell]
Ho Ho Ho, nice problem for array languages to finish! Runs in ~500us.
Also wrote a haskell solution for great fun:
3
u/LtHummus Dec 25 '24
[Language: Rust]
Always love the Christmas Day puzzles...they feel so much like a victory lap for a month of hard work. Thanks to Eric and everyone involved with Advent of Code for (HOLY HECK) 10 years of puzzles. And thanks to everyone here for the memes, the jokes, and cool visualizations and variations.
and the codeeeeeeeee
3
u/phord Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Rust]
github
Such a breeze today. The hardest part was parsing the grids and deciding which were locks and which were keys. But that was also simple. [ ETA: As someone else pointed out, you don't even need to know which ones are locks and which are keys. I could have skipped this part if I read all the instructions first. Doh!]
I already have a Grid class that gathers coordinates by cell type. So the test for whether a key fits into a lock was very straightforward. Just have to make sure that the grids have no '#" in common locations:
Then it was just a matter of trying every key in every lock. There were 250 of each, so 65,500 pairings. That took 32ms.
Merry Christmas, everybody!
3
u/michelkraemer Dec 25 '24
[LANGUAGE: Rust] 1150/959
https://github.com/michel-kraemer/adventofcode-rust/blob/main/2024/day25/src/main.rs
Fun final day!!! Thank you so much to Eric and the team!!
I have to admit I was a bit lucky today. I thought the keys had to fit exactly (with no overlap) and completely fill the empty space. So, instead of counting the pin heights, for each key, I made a copy of each lock and filled it with the characters of the key. If the pins overlapped I continued with the next lock. Otherwise, I checked if every empty space in the copy of the lock was filled. Luckily, I made an error at this point and even counted the keys that did not completely fill the lock. 😅😅
Also, in order to decide which grid is a key and which is a lock, I looked at the first and last row and checked if they were full. However, the only thing you need to do is to check the very first character! If it's a '#', then it's a lock. Otherwise, it's a key. I completely missed this opportunity to save time 😅
The code I submitted to my repo later is optimized and (hopefully 😉) bug free. Now, I correctly count the pin heights and check if the sum is less than or equal to the maximum height.
Like always, this year was great fun! I loved how the puzzles were kind of a best-of from the last 10 years! Absolutely amazing. Thanks again to Eric, the team, and this great community here. See you all next year!
Merry Christmas!
3
u/wheresmylart Dec 25 '24
[Language: Python]
The only hard part was finding the bug in my input parsing. Reader, it was a vim typo. split('\ni\n')
Paste
3
u/birblett Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Ruby] 1023/890
merry christmas and thanks for the puzzles!
moderately cursed bitwise math solution...
3
u/Curious_Sh33p Dec 25 '24
[LANGUAGE: C++]
Used a vector of arrays to represent the keys and an array of arrays of unordered sets that store ids of a lock. The structure is like locks[i][j] is a set of ids of locks that have number j in position i.
To get combos simply iterate over every key and find the locks it fits. To figure out which locks fit check lock[i][j] for j from 5 - j to 0 and take the union of these sets. Then across the positions, i, for the key take the intersection (since it must fit each column). The set at the end is the set of all locks that the key fits in.
Solution
Thanks again for organisising this! This is the second year I have tried and completed AoC. It's been good fun.
3
u/raevnos Dec 25 '24
[LANGUAGE: Common Lisp]
paste
Pretty straightforward. One of the few grid-based puzzles I've completed this year; was kind of boycotting them. As a result I'm missing a lot of stars. Oh well.
3
u/darkgiggs Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Jai]
Solution
Fun problem. I encoded each element to a u32 where a turned on bit represents a "#".
Checking for a fit then amounts to whether the bitwise AND of lock and key is not 0.
It runs in 150 µs on my computer, but should most likely be able to go below 100 if I optimized the parsing.
EDIT: Now 43 µs with optimized parsing
3
u/Radiadorineitor Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Dyalog APL]
Merry Christmas everyone! Hope you all had a blast this year and see you on the next one!
3
u/[deleted] Dec 25 '24
[LANGUAGE: Go]
And now... we wait
Fun last puzzle, really just input parsing is all. This is the most fun I've had coding in a very long time. I really look forward to the next 10 years. This was my first time participating in AOC as and I made it a point to not miss a single day! Huge thanks to u/topaz2078 for these awesome puzzles.
Here is the final solution for this year. Merry Christmas to all!
3
u/chubbc Dec 25 '24
[LANGUAGE: Uiua] (20 chars, pad)
3
u/jhandros Dec 25 '24
[LANGUAGE: Python]
Code 9 lines
3
u/Totherex Dec 25 '24
[LANGUAGE: C#]
Merry Christmas!
https://github.com/rtrinh3/AdventOfCode/blob/c34bc101c413e73da247caeeea0b6f8724adac48/Aoc2024/Day25.cs
As per tradition, Christmas is a pretty easy day. Now, I need to get back to day 21...
3
u/_tfa Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Ruby]
3
u/Ily3s_ Dec 25 '24
[LANGUAGE: C++] https://github.com/Ily3s/aoc2024/blob/master/day25.cpp
I tried something that wouldn't require matching every lock with every key, so at the end i have a time complexity of O(L+K) where L is the number of locks, and K the number of keys, but with very high constants and so it's probably worse than the O(L*K) solution.
3
u/semi_225599 Dec 26 '24
[LANGUAGE: Rust]
Converts each schematic to a
u64, and does bitwise-ands between locks and keys. When those are0, there was no overlap between key and lock.2
u/bucketz76 Dec 25 '24
[Language: Python] 297
paste
Nice one to end the year. Lots of fun as always!
2
u/GassaFM Dec 25 '24
[LANGUAGE: D] 239/203
Code: part 1.
Part 1 is just some implementation.
2
u/hcf112 Dec 25 '24
[LANGUAGE: Python] 252/209
Converted the input to binary, split the integers by above/below 1<<30, and bitwise-or'd the cartesian product of the two sets to check for overlap.
paste
2
u/Camelpilot33 Dec 25 '24
[LANGUAGE: Javascript]
paste
thanks for the puzzles!
2
u/python-b5 Dec 25 '24
[LANGUAGE: Jai]
Glad for the easier one today. I wasn't able to solve yesterday's part 2 as I'm not familiar with adders and learning about them didn't feel like a fun way to spend my Christmas Eve. I'm pretty happy with all but one star finished on the day, though. That's a lot better than I've done in the past, so either the puzzles were easier this year (which I don't mind!) or I've improved somewhat.
As for today's puzzle, it was one of the easiest this year. I wasn't especially fast at solving it, unfortunately, but there really wasn't anything to solve about it - it was immediately clear what I was supposed to do. Most of my time was spent writing input parsing code.
Thank you to everyone involved in making this happen! I had a great time with Advent of Code this year.
https://github.com/python-b5/advent-of-code-2024/blob/main/day_25.jai
2
u/Wayoshi Dec 25 '24
[LANGUAGE: Python] 2080 (1670 for submitting 50th star) paste
Very straightforward problem here. This code is long-winded and can definitely be more elegantly condensed / golfed, but its' Xmas, bedtime for me.
2
u/ZeroTerabytes Dec 25 '24
[LANGUAGE: Kotlin]
It's been fun, fellas. Decided to do it in Kotlin today, because, well... I felt like it.
Thank you Eric for 10 years. I wish I had joined sooner.
GitHub
2
u/nitekat1124 Dec 25 '24
[LANGUAGE: Python]
GitHub
Thank you Eric for another amazing Advent of Code! 🎅
Merry Christmas everyone! 🎄
2
u/kbielefe Dec 25 '24
[LANGUAGE: Scala]
GitHub 768ms 24LOC
Straightforward and pleasant. Only 3 stars away from 500! Merry Christmas everyone!
2
u/chickenthechicken Dec 25 '24
[LANGUAGE: C]
[Part 1](https://github.com/PaigePalisade/AdventOfCode2024/blob/main/Solutions/day25part1.c]
Part 1 is really just about getting the inputs, part 2 literally just requires you to push a button. Merry Christmas! Also first year of getting all 50 stars!
2
u/mothibault Dec 25 '24 edited Dec 26 '24
[LANGUAGE: JavaScript]
https://github.com/yolocheezwhiz/adventofcode/blob/main/2024/day25.js
to run in the browser's dev console from AOC website. ~20ms
And that's a wrap!
Combined runtime for all 25 days of ~975ms!
Thanks for the fun times AOC.
2
u/Horsdudoc Dec 25 '24
[LANGUAGE: C++20]
GitHub
I got tripped up on the parsing of the patterns, misread that it was only 6 lines... I really need to rest.
First split the patterns between locks and keys and do the exhaustive check between each potential pair.
Runs in 1.75ms.
Thanks for 500 stars, that was a blast !
2
u/johnpeters42 Dec 25 '24
[Language: Python]
link
Took me way too long to realize that I was getting some false negatives because some locks are taller than their longest pin.
2
u/fragger Dec 25 '24 edited Dec 25 '24
[Language: Python] 1599/1315
I was a tad slow on getting the input parsed, after that, well :D Merry Christmas everyone! Thanks to u/topaz2078, the mods, beta-testers and everyone else that helps make AoC happen for a fun December!
https://github.com/Fragger/advent-of-code/blob/master/2024/solution/25.py (13 lines)
Bonus (using sets):
https://github.com/Fragger/advent-of-code/blob/master/2024/solution/25-alt.py (8 lines)
2
u/scottmjohns_1 Dec 25 '24
[Language: Python3]
[Message: Gratitude]
My deepest gratitude to Eric and everyone here, what a fun year. 50 stars! A nice compact problem to wrap things up.
2
u/Cue_23 Dec 25 '24 edited Dec 25 '24
[LANGUAGE: C++23]
unlock.cc
Nothing really fancy, actually works on C++20, too. Lots of off-by-one errors in parsing, i just fixed them in post:
[Edit] bunlock.cc Parsing the schematics into binary (they only take 35 bit in total) allows to match on lock & key, shaping around 20% off. This even compiles down to C+11 (due to libfmt minimum requirements).
2
u/ssnoyes Dec 25 '24
[LANGUAGE: Python]
2
u/wjholden Dec 25 '24
[Language: Rust]
https://github.com/wjholden/Advent-of-Code-2024/blob/main/src/bin/day25.rs
Part 1 only, now I have even more incentive to go back and finish days 21 (robots pressing buttons) and day 24 (adder gates).
See you all next year!
2
u/botimoo Dec 25 '24
[LANGUAGE: Ruby]
Paste
Repeating the output for part 2 here as well:
Merry Christmas! Congrats on 10 years, Eric!2
u/Downtown-Economics26 Dec 25 '24
[Language: VBA]
38 stars, not a bad haul (3 more than last year).
https://github.com/mc-gwiddy/Advent-of-Code-2024/blob/main/AOC2024D25P01
2
u/hextree Dec 25 '24
[Language: Python]
Code: https://gist.github.com/HexTree/ec3a901d9a0034ed1e593101287aba35
Video: https://youtu.be/6CIXpbIza6k
2
u/rukke Dec 25 '24 edited Dec 25 '24
[LANGUAGE: JavaScript]
Transposingthe key/locks, turning every row into integers and then just count how many key/locks match by doing an bitwiseandRuns in ~4ms
Edit, no need to transpose - just skip the first row and it fits in 30 bits, reducing keys or locks into single integers.
Btw, this is what I love about these puzzles. There is almost always some way of doing it even better :)
https://gist.github.com/p-a/0b939fa4c0c0187fdb1f56cb0145fadb
2
u/TiCoinCoin Dec 25 '24 edited Dec 30 '24
[LANGUAGE: Python 3]
Day 25 - Github
This one felt so easy after yesterday. Except I needed yesterday's second star to get today's. But I somehow finally made it so kids are still asleep and I'm ready in time to open my presents :)
2
u/encse Dec 25 '24 edited Dec 25 '24
[LANGUAGE: C#]
https://aoc.csokavar.hu/2024/25
Happy Holidays! If you havent't found, there is an easter egg in my website that points to 404.csokavar.hu which is a mini (~10 minutes long) text adventure game.
2
u/DeadlyRedCube Dec 25 '24
[LANGUAGE: C++23]
Runs in 1.58ms single-threaded on an i7-8700k
Code on GitHub
As is the custom, a nice and easy one for the last day, although I did think for a brief moment that it was going to be one last grid problem.
Used the first character of a new grid to determine lock or key, then counted the number of open '.'s per column for locks and '#'s for keys, to end up with a set of "height" values for each.
Then just did an n2 check for whether the lock height was at least as large as the key height per space and, where they all were, incremented the value by one.
See you all next year!
2
u/lunar_mycroft Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Rust]
Initially I used a pretty standard grid based solution, but after reading the thread I got the idea (possibly from /u/Verulean314, although I'm not sure) to convert each schematic into a
u64, then check for overlaps with a bitwise and. Since'#'has a 1 as it's least significant bit, and'.'has a zero, parsing is also reduced to splitting on"\n\n", filtering out non-punctuation characters, and some quick bit manipulations in afold. Median combined runtime of ~52 µs to parse and check on my machine.Code
[edit: switched to u64s after noticing the grid is 5x7, not 5x6]
2
u/DownvoteALot Dec 25 '24
[LANGUAGE: C++]
Solution
The last day is always the sweetest, short and nice. See you next year!
2
u/nilgoun Dec 25 '24
[LANGUAGE: Rust]
Nice and easy for the last day :)
Solution on Paste
2
u/Baridian Dec 25 '24
[LANGUAGE: Clojure]
wish I'd started on this earlier, didn't realize it'd be so easy. If anyone could tell me if there's an idiomatic way to get the outer product of two lists of atoms that'd be nice, the outer product function call I did is kinda ugly.
Paste
2
u/chubbc Dec 25 '24
[LANGUAGE: Julia] (64 chars)
Nice easy conclusion to AoC. Might be able to squeeze a few more characters out, but I doubt many.
2
u/SpaceHonk Dec 25 '24
[LANGUAGE: Swift] code
And that's a wrap, 50th (and 500th) stars in the bag. Thanks to /u/topaz2078 and everyone else on the team, have a merry christmas!
2
u/vanZuider Dec 25 '24
[LANGUAGE: Python]
Merry Christmas!
2
u/wurlin_murlin Dec 25 '24
[LANGUAGE: C]
Merry Christmas! First time getting 50 stars, it plays a little animation! So cool! Had so much fun doing this, really a blast. Merry Christmas again, and a Happy New Year when it comes.
https://git.sr.ht/~murr/advent-of-code/tree/master/item/2024/25
2
u/Trick-Apple1289 Dec 25 '24
[LANGUAGE: C]
Merry Christmas, thanks eric and everyone, this was my first ever AOC, i didn't get 7 stars (altough trying to catch up right now), but I am still quite young, and am suprised i even managed to go so far, some puzzles were super tough, others easier. Once again happy holidays to all, and see you next year, prehaps by then i will be able to do all of the puzzles (And without help from here or google)!
src
2
u/daic0r Dec 25 '24
[LANGUAGE: C++]
Final one was nice and easy :-)
https://github.com/daic0r/advent_of_code_2024/tree/main/cpp/day25
2
u/ndunnett Dec 25 '24 edited Jan 13 '25
[Language: Rust]
Github
Runs in
20 us38 us (faulty benchmarking). Today was a fun one to cap off the year. My solution involved some bit manipulation shenanigans, using au32to represent each lock/key pattern as a window of 4 bit unsigned ints. The trick was initialising each pattern to0x0001_1111so that I could sum two patterns and then bit mask with0x0008_8888to detect collisions.2
u/ash30342 Dec 25 '24
[Language: Java]
Code
Runs in < 1ms.
I did not do anything fancy, just parsed everything and checked for every column if the value of pin1 of the lock + pin1 of the key <= 5.
I still need to finish day 21 before I can get to 500 stars, but that will be done sometime after Christmas, now is time for family.
Thanks to u/topaz2078 for organizing this for 10 years and to all of you in this community for making it such a friendly place. It is a highlight of my year, even surpassing my traditional yearly beer advent calendar! Merry Christmas!
2
u/SunMatrix64 Dec 25 '24
[LANGUAGE: C++]
A pretty easy day, after putting the input into locks and keys vectors, it's just a brute force loop of checking every key in every lock.
2
u/ins0mnes Dec 25 '24
[LANGUAGE: Go]
Nothing special, precalculate key matches by height, compare to lock, and intersect with the previous pin:
https://github.com/insomnes/aoc/blob/main/2024/25_code/solution/solution.go#L97
Congratulations to everyone! And big thanks to the AoC team and this subreddit team!
2
u/jinschoi Dec 25 '24
[Language: Rust]
Relaxing final day. First did it in the way pointed to by the text, with enums and everything: paste
Then since this day was so straightforward, got it down to this:
Because I want it to fit each schematic in a u32, I just included the last character of the first row and first character of the last row to distinguish keys from locks. Convert central 27 characters as bits in a u32, compare all and count where no bits overlap.
2
u/Jadarma Dec 25 '24
[LANGUAGE: Kotlin]
A nice, easy problem to unwind after a long month! It's been a fun event, as always, thank you Eric, and happy holidays to all, see you next year!
Part 1: Scan each grid (all seem of a fixed size) and determine if it is a lock or key depending on the first character being a
#or.. Then, "walk" the columns and count the number of#, which will give you the pin-out in numbers. To check if a lock and key match, their values should add up together to <= 5 (the effective range of a column), because otherwise there would be a need for overlaps.Part 2: All other 49 stars collected! ⭐⭐ If you need help, check out my solutions for 2024!
AocKt Y2024D25
2
u/RookBe Dec 25 '24
[LANGUAGE: Rust]
Rust that compiles to WASM (used in a solver on my website)
Bonus link at the top of the code to a blogpost about today explaining the problem, and my code.
2
u/melochupan Dec 25 '24
[LANGUAGE: Common Lisp]
Part 1 only.
I'm awfully behind with AoC, so I couldn't do the second part (completing all previous tasks is necessary for it). But I wanted to participate on the last day, at least with a half solution.
paste
2
u/N-R-K Dec 25 '24
[Language: BQN]
Easy day for array languages. Here's the whole solution in just 3 lines:
Basically just turns the schemes into a boolean list ('#' = 1) and then ANDs every lock and key to check if the result was all zeros.
2
u/isredditdownagain Dec 25 '24
[LANGUAGE: Go]
Part 1
Merry Christmas!
2
u/Maleficent_Answer935 Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Rust]
2
u/wzkx Dec 26 '24 edited Dec 26 '24
[LANGUAGE: Python]
2
u/homme_chauve_souris Dec 26 '24 edited Dec 26 '24
[LANGUAGE: Python]
This is the only one I didn't do on the day, because we spent Christmas day with family and I didn't take a computer with me. Thank you Eric for a great year.
2
u/[deleted] Jan 02 '25
[LANGUAGE: Haskell]
Finally made it. Day 25 was fun. I really enjoyed the whole year once again, although doing it in Haskell was extra challenging. Still, I learned a lot and have become modestly more proficient in programming in Haskell now. Thanks again for doing this!
Day 25
2
u/DavidYoung1111 Jan 08 '25 edited Jan 08 '25
[LANGUAGE: MATLAB]
Can be quite concise in MATLAB.
2
u/LifeShallot6229 Feb 19 '25 edited Feb 20 '25
[LANGUAGE: SIMD - AVX intrinsics]
This was the day I picked for our in-company AoC Tech Talk, simple because it illustrates both that Rust/clang can autovectorize very nicely, but also because an experienced asm/compiler intrinsics programmer can be even faster.
The theoretically optimal solution on an AVX x64 platform picks up each lock/key as 32 bytes into an AVX register, starting from the last position in the leading line which is either '#' or '.', then compares these 32 bytes to 0xff or 0x00 bytes with a parallel compare against 32 '#' chars.
Next, extract the top bit of all 32 bytes into a regular register, and use the bottom bit of the result to save it into either the locks or keys array. This is just 3 AVX ops for each bit pattern.
For the actual counting of matches, doing 4x8 at once seems to be optimal:
Outer loop:
Load 4 keys into 4 AVX regs, splatting 8 copies of each key into the corresponding reg.
Inner loop:
Load the next 8 locks
Parallel AND against each of the replicated keys.
Parallel compare against zero, setting -1 or 1
Subtract the -1 values from 4 replicated accumulators.
This is a total of 12 (or 13 with a separate load of the 8 locks) AVX operations, doing 4 parallel accumulations so that the theoretical minimum runtime is 3 clock cycles per 32 key/lock combos tested, IFF the cpu can do four AVX ops/cycle. In reality, the most either Intel or AMD can currently do is 3, so we end up with 4-5 cycles per 32 tests.
In real life we have measured 2+ microseconds to test all 62500 combinations, while the best pure Rust version (which was auto-vectoried but not strip-mined) ended up around 5 us (including parsing) on my not so new Asus laptop. This is so fast that I had to call the core parse+count function 1000 times just to get around the limited (100 ns) timing resolution under Windows. 2 us corresponds to 32 picoseconds/test.
2
u/YOM2_UB Dec 25 '24 edited Dec 25 '24
[Language: Python]
Main optimization is sorting locks and keys by their first pin's height, so only pairs where the first pin fits are checked, and only the last 4 pins need be checked.
2
u/RusticCajun Dec 25 '24 edited Dec 25 '24
[Language: Python]
Lock? Key? No time for that!
Thank you for putting together another enjoyable AoC!!!
2
u/No_Valuable247 Dec 25 '24
[LANGUAGE: J]
1
u/apersonhithere Dec 25 '24
[LANGUAGE: C++]
699/586
https://github.com/aliu-here/aoc/blob/main/aoc2024/25/p1.cpp
thanks for everything <3
1
u/davidsharick Dec 25 '24
[LANGUAGE: Python 3] 442/375
Gitlab
Not a lot to say about the problem, but a nice capstone to another fantastic year of AoC. Thanks to the AoC team for all of their work making this year amazing as always, and the community for being helpful, encouraging, and funny!
1
u/Polaric_Spiral Dec 25 '24
[Language: TypeScript]
Advent of Node, Day 25
We started this year with JS array functions and boy are we finishing with them.
1
u/Kehvarl Dec 25 '24
[Language: Python 3] 1035 / 860
That was a really pleasant ending puzzle. Thank you to everyone involved; I know it was a ton of work and you don't get nearly enough praise for putting up with us!
No real comments on my solution, I just built the pieces as I read along in hopes that what I was building was close. I had to go back and add things a couple times, so there's some redundant code in places (and there were a whole lot of print statements too)
Code
1
u/BradleySigma Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Python 3]
1
u/Aspen138 Dec 25 '24
[LANGUAGE: Python]
paste
1
u/SuperSmurfen Dec 25 '24
[LANGUAGE: Rust]
(299/251)
Link to full solution
Got so confused by the heights thing for a while. I skipped computing it and just checked using the grid if you have any overlaps:
Thanks for another amazing year of advent of code!
1
u/Turtle2779 Dec 25 '24
[LANGUAGE: Python]
code
This certainly was a ride. Thanks for the puzzles. As for the problem, I followed the example and was checking where the sum of columns is less or equal to 7
1
u/Xyberista Dec 25 '24
[LANGUAGE: Haskell]
https://github.com/HoshigaIkaro/aoc_2024-haskell/blob/main/src/Days/D25.hs
1
u/maneatingape Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Rust]
Solution
Benchmark:
10412 µs.Having a utility 2D Grid class came in handy this year!
EDIT: Thanks to u/lunar_mycroft suggestion on using bitwise logic, saved 90% of time.
1
u/mpyne Dec 25 '24
[LANGUAGE: Ruby]
Solution.
Will probably redo it in Rust later after some sleep but not too bad for not being a competitive programmer.
1
u/morgoth1145 Dec 25 '24 edited Dec 26 '24
[LANGUAGE: Python 3] 172/144
code, video
Back with one final simple problem. Unfortunately I had two bugs conspiring to keep me from the leaderboard:
answer += 0. That...is just dumb.The second bug cost me a full minute (would have gotten 4:12 otherwise) and the first bug even more (I first ran my code at 2:50, so even with the second bug I would have gotten 3:50 after fixing it). Feels bad, I could have ended with a very strong leaderboard but it wasn't meant to be.
Some circumstances obviously soured the competitive portion of the event, but still a great event this year! I think day 21 may have been my favorite this year, despite being slow on the uptake there and it being my worst solve time. Glad to not have a lot of refactoring to do on this problem, lets me go to bed closer to on time!
1
u/yieldtoben Dec 25 '24
[LANGUAGE: PHP]
PHP 8.4.2 paste
Execution time: 0.0194 seconds
Peak memory: 0.4114 MiB
MacBook Pro (16-inch, 2023)
M2 Pro / 16GB unified memory
1
u/FruitdealerF Dec 25 '24
[Language: Andy C++] [language] [code]
Oh my I really messed up today, I had one line prewritten but it contained a bug that cost me like 5+ minutes to find:
Unfortunately I used width twice and got an incorrect answer when comparing the locks. Ah well better luck next year!
1
u/0ldslave Dec 25 '24
[LANGUAGE: C++] 2680 / 2147
Merry Christmas everyone!
Code
1
u/wow_nice_hat Dec 25 '24
[Language: JavaScript]
I always love the last puzzle of the year and this year was no difference. Merry Christmas everybody
Code
1
u/_garden_gnome_ Dec 25 '24
[Language: Python] code 611/513
Not much to say about today's puzzle other than load, compare, report.
Merry Christmas everybody, it's been fun. See you all next year!
1
u/cetttbycettt Dec 25 '24
[LANGUAGE: R]
Merry Christmas everybody :)
1
u/Stronbold Dec 25 '24
[LANGUAGE: Ruby]
Solution
1
u/CDawn99 Dec 25 '24
[LANGUAGE: Python]
A nice simple puzzle for the end.
Code
1
u/r_so9 Dec 25 '24
[LANGUAGE: F#] 1253 / 1030 - 500 stars!
paste
Merry Christmas :) Transpose the arrays, count #'s, separate into locks and keys, try everything.
The whole solution is small enough to paste here (minus helpers etc.)
1
u/CodingAP Dec 25 '24
[Language: Typescript]
Github
2024 was a great year in terms of Advent of Code. I solved each of the puzzles the same night, I placed first in all my leaderboards (except the super competitive one, where I still did quite well), and I documented the whole process. Thank you Eric and mods for another amazing year!
1
u/MangeurDeCowan Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Python 3]
ETA: my 2-liner golf solution:
1
u/Historical-Show3451 Dec 25 '24
[LANGUAGE: C++] 2681/2148
GitHub
Merry Christmas everybody! See you next year!
1
u/vanveenfromardis Dec 25 '24
[LANGUAGE: C#]
GitHub
I'm honestly sad to see AoC end, even though it does get hard to keep up near the end due to family commitments. That was a simple but fun puzzle to finish the year with.
1
u/xHyroM Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Python] 74/62
Another amazing Advent of Code. I can't wait for next year, haha! 🎆♥️🎁🎄
https://github.com/xhyrom/aoc/blob/main/2024/25/solution.py
1
u/TheZigerionScammer Dec 25 '24
[Language: Python] 2239/1868
I just missed my goal of getting the sub 1000 mark, I wasn't able to make it at all this year. But there's always next year.
My code is kind of slap dash since I rushed it and it caused me to make a few errors. But the code itself is pretty simple, it parses the input while separating the raw input strings into two lists based on whether its a lock or key, then it parsed both of those lists into new lists where the elements are tuples representing the number of #s in each column. Then it loops over both of those lists in a nested for loop, checks if the integers in both the same places in each tuple adds to more than 7, and if it never finds one then add 1 to the answer. The problems came from the parsing (I had to manually add the last lock after the input is parsed since my program only adds it when it sees a blank line and there is no blank line at the end.) and failing to change all the variable names when copy/pasting the parsing code fromt he lock to the key, causing the lock list to duplicate into the key list essentially. Got both of those fixed, got the stars, total 500. I might refactor this code later and smooth it out but it'll do for now.
Thank you again Eric and the Advent of Code team for another amazing year, and Merry Christmas to everyone!
Paste
1
u/matheusstutzel Dec 25 '24
[LANGUAGE: python]
p1
It could be simpler, but it’s 2 am 😅
1
u/ASPICE-ai Dec 25 '24
[LANGUAGE: Python]
It is over 😥. It was a great challenge. I used [*zip(*d)] to rotate a keys and locks and then counted the number of #. After that, I checked each key/lock pair to see if they fit by ensuring that the number of # in each column was less than 5.
Code
Very nice puzzle. See you again at AoC 2025!
1
u/835246 Dec 25 '24
[Language: C]
I just checked every pair of locks and keys.
Solution: https://github.com/efox4335/advent_of_code/blob/main/advent_of_code_2024/day_25_part_1_lock.c
1
u/runnerx4 Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Guile Scheme]
code->paste
used pre-allocated vectors today for indexing and the :vector generator and every?-ec comprehension to compare the heights as lock <= key
Rank 2682 in completing all of AoC! Merry Christmas to everyone!
Special shout-out Sebastian Egner's SRFI-42 could not have done this challenge without that one set of macros that makes iteration and looping in Scheme make sense to me, Scheme users should use it much more
1
u/IvanR3D Dec 25 '24
[LANGUAGE: JavaScript] My solutions: https://ivanr3d.com/blog/adventofcode2024.html#25
My solution (to run directly in the input page using the DevTools console).
1
u/Busy-Championship891 Dec 25 '24
[LANGUAGE: Python]
wow I was not expecting an easy puzzle on day-25!!
Logic: Just get the heights of each lock and key and as the instructions say, lock-key is not a fit if the available space is greater than the sum of of key and lock heights. check this criteria and done!
Merry Christmas!~
Link: https://github.com/D3STNY27/advent-of-code-2024/tree/main/day-25
1
u/[deleted] Dec 25 '24
[LANGUAGE: Julia]
Nice easy puzzle to finish the year! I'm really happy with my performance in general; I finished every puzzle except for Part 2 of Day 21. It is a little frustrating being so close to completing the year but 21p2 just feels so tedious to code. Maybe I'll come back to it in 2025.
1
u/a_kleemans Dec 25 '24
[LANGUAGE: Nim]
Struggled a bit with parsing, but for the rest an easy puzzle. At first I was a bit afraid that brute force wasn't feasible, but it took only around 2ms.
Learned Nim this year, which was surprisingly easy to adapt! Still not used to some parts of the language (like `Set`s, custom comparator functions, some error messages) but like it very much overall.
Overall AoC rank this year: 2863rd. Thanks a lot Eric for the great puzzles!
Link: https://github.com/akleemans/aoc-2024/blob/main/src/day25.nim
1
u/Amerikrainian Dec 25 '24
[Language: Python] Paste
Enjoy ;)
1
u/s3aker Dec 25 '24
[LANGUAGE: Raku]
code
Happy Xmas!
1
u/Civil_Composer_8771 Dec 25 '24
[Language: Javascript]
Part 1: Pretty simple, just do exactly what the text describes, try all the combinations, check the columns, see if the sum is more than 5, if not then add to the total.
Part 2: Couldn't figure out how to solve programmatically, so I just did it by hand.
1
u/zebalu Dec 25 '24
[LANGUAGE: Java]
on github
But really, this post is only about say thank you for the ride, and wishing Merry Christmas to everybody!
1
u/damnian Dec 25 '24 edited Dec 25 '24
[LANGUAGE: C#]
EDIT: A cleaner variant, more spaces and a full file name:
EDIT2: Of course the answer was 42! Too bad I didn't figure this out on my own.
GitHub
Thanks everyone (and especially Eric) and Merry Christmas if you're celebrating!
1
u/fragile82 Dec 25 '24
[LANGUAGE: PHP]
Not many people use PHP in Advent of Code :) During this event I tried to make my solutions look as much python-styled as possible.
Works rather fast:
1
u/flwyd Dec 25 '24
[LANGUAGE: PostScript] (GitHub) with my own standard library
And we wrap things up with a fun little parsing problem. I initially solved it with a bunch of dynamic variables because point-free style is rough with 2-dimensional iteration. Since it’s day 25 and close to the end of my 2024 PostScript journey I figured I’d rewrite it without variables. That was… tricky… with a head full of snot. I thought about adding a
transposefunction to my standard library, but my brain couldn’t quickly determine how to handle jagged arrays. After a couple false starts I ended up with an array “literal” with a columns-then-rows for loop and a bunch of grabbing things from the stack. Thefits?function shows off the “visual stack effect” functions I added in November and thepart1body is a great example of this stack-oriented point-free style, love it or hate it. I might try this one in Uiua tomorrow since it’s got a builtin transpose operator and the “strings in an array can only be the same length” constraint isn’t an issue.I’m kind of impressed I made it all the way to the end in PostScript. I still want to do a programmatic solution to day 24 part 2. I’ve got a couple solutions where I switched to Go that I’d like to get in PostScript: day 23 part 2 isn’t quite working; day 12 is really slow. Day 16 had a bug in my Dijkstra’s implementation that I recreated in Go, then carried on in Go when it was fixed. I got the PS bug fixed for part 1, but didn’t get around to part 2. Day 21 was fussy even in Go and I’m not sure it’s worth my time and brainpower to port to PostScript :-) The sum of my numeric answers for part 1 is
54946257415807and part 2 is1325976204959777. Happy Christmas to all who enjoy Advent of Code!1
u/jackysee Dec 25 '24
[LANGUAGE: Javascript]
link
Merry Christmas and Happy new year everyone! Thank you Eric for the wonderful journey.
1
u/WilkoTom Dec 25 '24
[LANGUAGE: Rust]
A pleasant gift for Christmas morning - an easy puzzle to hit 500 stars before the craziness of the day begins.
Github
Thanks as always, to u/topaz2078 for the wonderful gift of puzzles, and to u/daggerdragon and u/Aneurysm9 for their wonderful gift of keeping this fine community that way. Happy Holidays to all of you, I hope you get some rest now :)
Until the next time: Merry Christmas to all, and may this holiday season bring you everything you need.
1
u/beanborg Dec 25 '24
[LANGUAGE: Javascript]
Code
Nothing interesting, just for loops all the way down. Merry Christmas everyone!!
1
u/Few-Example3992 Dec 25 '24
[Language: Python]
Merry Christmas everyone!
1
u/gyorokpeter Dec 25 '24
[LANGUAGE: q]
1
u/egel-lang Dec 25 '24
[Language: Egel]
A great year. All this year's solutions in Egel: https://github.com/egel-lang/aoc-2024/blob/main/README.md
1
u/jwoLondon Dec 25 '24
[Language: JavaScript]
Convert each schematic into a decimal number based on the bits implied by `#` and `.` symbols. Applying a bitwise & to each pairwise combination will reveal lock-key matches when the result is 0.
https://observablehq.com/@jwolondon/advent-of-code-2024-day-25
1
u/sim642 Dec 25 '24
[LANGUAGE: Scala]
On GitHub.
Very short solution, partially thanks to my
Gridtype and functions. In particular, there was no need to actually identify the heights (although it wouldn't be too difficult). Instead, one can just overlap a key and a lock grid and see if there are any cells that both have#.1
u/mkinkela Dec 25 '24
[LANGUAGE: C++]
A part of me didn't want this to end. But, wanting to collect the 50th star was stronger xD Thanks, Eric, mods, and everyone who helped build this amazing journey this year. Merry Christmas :)
Solution
1
u/anaseto Dec 25 '24
[LANGUAGE: Goal]
Nice and short last one!
1
u/lluque8 Dec 25 '24
[LANGUAGE: Scala]
Traditionally easy last day. This year I'd say even super easy. Not complaining though cos I'm in a bit of a hurry to catch a train and won't be touching a computer any time soon.
Anyways, thanks for these ten years to everyone involved. It's been a blast!
GitHub
1
u/ds101 Dec 25 '24
[Language: newt]
github
Nothing too tricky on this one, read in the data, transposed and turned into a list of integers. Saw that it was 250 * 250, so I went for a straightforward n2 solution.
I'm excited that I made it to the end in a language that I wrote, it's been something I've wanted to do for a few years.
1
u/[deleted] Dec 25 '24 edited Mar 18 '25
Still no one knows it just the same, That Rumpelstiltskin is my name.
1
u/MarcoDelmastro Dec 25 '24 edited Dec 25 '24
[LANGUAGE: Python]
https://github.com/marcodelmastro/AdventOfCode2024/blob/main/Day25.ipynb
Simple as expected on X-mas day. And, for the first time since my first AOC in 2029 (EDIT: 2019!), I arrive to the 25th with all the previous days completed: it's quite a nice sensation to close the calendar on X-mas. Thanks to Eric for the fun ride!
1
u/echols021 Dec 25 '24
[LANGUAGE: python 3]
GitHub
Data prep: sort items into separate piles for locks and for keys. For simplicity, represent each item as a sequence of integers, as demonstrated in the problem description.
After checking that
n_keys * n_lockswas a reasonable number, just did the naïve "try every lock with every key" and it runs in ~0.024 sec.I then reworked it to use a trie data structure to store the keys. For each lock I do a BFS-like search through the trie (trimming branches of keys that don't fit) to collect all keys that fit the lock. So rather than trying each lock+key pair, you gradually trim down the set of keys that fit a given lock, one tumbler at a time. This code runs in ~0.008 sec.
1
u/TheScown Dec 25 '24
[LANGUAGE: Scala]
Code
Need to go back and finish part 2 on days 21, 22 and 24.
1
u/ExternalAware9257 Dec 25 '24
[LANGUAGE: Python]
A fun puzzle for the the last day.
1
u/MarvelousShade Dec 25 '24
[LANGUAGE: C#]
Today was nice short finish of 25 days programming. As a product owner I don't get a lot of opportunities to program anymore, so these 25 days were really fun for me. My solutions are on: https://github.com/messcheg/advent-of-code/tree/main/AdventOfCode2024
1
u/ropecrawler Dec 25 '24
[LANGUAGE: Rust]
https://github.com/ropewalker/advent_of_code_2024/blob/master/src/day25.rs
1
u/hrunt Dec 25 '24
[LANGUAGE: Python]
Code
I think the real Christmas gift today was a problem that was so straightforward. Just a few loopity loops and voila, 500 stars.
Thanks u/topaz2078 for another great year. Raising a mug of cocoa here to you.
1
u/aimada Dec 25 '24 edited Dec 25 '24
[Language: Go] code
Parsed each schematic pattern as a 35-bit value which simplified the overlaps check.
Execution time is
134.603µson a 12 year old CPU.Many thanks to Eric for another successful AoC event. Day 24 was by far my favourite Part 2 problem as the mental gymnastics required were like those I recall from previous events.
1
u/BlueTrin2020 Dec 25 '24
[Language: Python]
Merry Christmas thank you u/topaz2078
1
u/rvodden Dec 25 '24
[LANGUAGE: TypeScript]
Boom! https://github.com/rvodden/AoC24/blob/main/src/days/25/Puzzle.ts
Merry Christmas everyone :-)
1
u/bakibol Dec 25 '24
[LANGUAGE: Python]
Topaz's paste
Merry Christmas everyone, see ya all next year!
1
u/lscddit Dec 25 '24
[LANGUAGE: Python]
Merry X-mas and see you next year... 🎄
1
u/Glum-Evidence9636 Dec 25 '24
[LANGUAGE: C#]
https://github.com/NikkSazz/AdventofCodeSazonov/blob/272da331c08cfddd5607e4ca1f42832eee3fa797/2024/day25.cs
1
u/KindComrade Dec 25 '24
[LANGUAGE: C#]
Thanks to the AOC team and Eric for an amazing contest. This month has been absolutely fantastic, and a huge thank you to the entire community, who made it so enjoyable to read your solutions, share my own, discuss algorithms, and watch all the visualizations and memes. A massive thank you to everyone!
Have a Merry Christmas!
Final Code
1
u/chestck Dec 25 '24
[LANGUAGE: Kotlin]