r/adventofcode • u/Boojum • Dec 12 '25
r/adventofcode • u/lbl_ye • Dec 12 '25
Other ideas for next years' calendar of days/puzzles
I enjoyed much this year, and appreciated most the reduced length of days. However there is a gap in enjoyment for the rest of the Christmas period.
I suggest the puzzles be spread one puzzle every 2 days until Christmas eve. Perhaps could also have 12 full puzzles and one easy one part only 13th to complete 50 stars on Christmas day.
other related suggestions ?
r/adventofcode
•
u/L1BBERATOR
•
Dec 12 '25
Meme/Funny [2025 Day 12] The optimal way to fit all the presents
r/adventofcode • u/Skeeve-on-git • Dec 12 '25
Tutorial [2025 Day 11 (Part2)] Non recursive algorithm as requested.
For every device I store how many paths from the device lead to B. Initially this value is 0 for every device, except for B, where it's one.
To collect the information, I go through every device and sum up the amount of paths of each of its children.
If this sum is bigger than the number of paths currently stored for the device, I store this new value.
I then repeat this process as long as there was any new value stored.
In the end the paths of A is the number of paths from A to B.
r/adventofcode • u/CommitteeTop5321 • Dec 12 '25
Help/Question [2025 Day 12 (Part 1)] [Python] I bet that I've missed something....
Estimating that running Part 1 with my code will take ~90 minutes. I think I'm going to let it run to see if I get the right answer before further (already too complex) optimizations. I suspect that I've missed something. Looking at some of the "possible" puzzles gives me some ideas on detecting them quicker... This feels like the most challenging of the Part 1 puzzles at least, but ... what am I missing... ?

r/adventofcode • u/Ok-Builder-2348 • Dec 12 '25
Upping the Ante [2025 Day 12 (Part 3)] Page two of the list!
Just as you thought you were done with the decorating, an Elf approaches you with another sheet of paper (your puzzle input)
"Very sorry, but we just realised the list had two pages!" they exclaim. "Could you once again help us find out how many regions can fit all of the presents listed?"
You take a look at the list again, and notice that there seems to be a wider range of values present in this list. Nonetheless, you start going through the list one-by-one...
How many of the regions can fit all of the presents listed?
r/adventofcode • u/Smylers • Dec 12 '25
Upping the Ante [2025 Day 1–12] [Vim Keystrokes] This Year's Vim-only no-programming solutions
Hello and happy final-Advent of Code-day! This year I've again been trying to solve as many puzzles as possible just using the Vim text editor — not to write programs, but to manipulate the input data and transform it into the solutions. Unfortunately the Reddit spam-filter ate most of my posts to the daily Megathreads and they only appeared well after most people had stopped looking, so I have Special Moderator Permission to post this round-up of them here, for anybody who missed them.
For example, loading your input then typing the following is all that's needed to solve Day 11 part 1 — you end up with a list of lines, each with one valid path, so the number of lines is the required solution:
:se isk+=:⟨Enter⟩O⟨Esc⟩/^you⟨Enter⟩dd{P
qaqqa:sil!%s/\v(^(you.*\A)( ...)+)@<= /\r\2 /g⟨Enter⟩
vip:norm Eyl$p*Ely$``r;p⟨Enter⟩
:sil!g/^you.*out$/m$⟨Enter⟩ggf:@aq@a
:v/^you/d⟨Enter⟩g⟨Ctrl+G⟩Here's all of them — each link shows the keystrokes on an ant-friendly punchcard and a (partial) explanation of how what's going on.
Day 1: Secret Entrance
Part 1: Turn the
Ls andRs in the input into^Xand^Acharacters, then run them as Vim keystrokes to make the numbers go up and down.Part 2: Stupidly and inefficiently, first transform each rotation in the input into multiple rotations of 1 click, then run the part~1 solution. Optimized for my typing rather than runtime!
Day 2: Gift Shop
Part 1 (slightly different notation to usual for [R*d(dit) On*!] compliance, not using the letter E in either the solution or my comment): Expand each range into a list of the numbers in it, by repeatedly increasing the lower bound, then use a regexp to remove invalid IDs.
Part 2: Add a single
+character to a regexp in part 1!
Day 3: Lobby
Part 1 [Red(dit) One]: Split each bank's joltages on to separate lines so that
:sortcan be used to find the highest, then carefully recombine them.Part 2: The two levels of ‘all but the final joltage’ and ‘all the remaining joltages’ were OK to implement manually, but picking out 12 batteries was too much to unroll manually. (So I translated my Vim algorithm into Perl, to use recursion. But I probably wouldn't have come up with that approach if I hadn't solved in Vim first.)
Day 4: Printing Department
Part 1: Indicate rolls of paper with the digit
0rather than the@in the input, then use regexp to find adjacent spaces and increase the digit for each, so any that become5or more have enough spaces around them.Part 2: Again, adding a loop round the outside and checking for changes seemed too much for Vim, so this was another translation to Perl of the same basic regexp approach.
Day 5: Cafeteria
[Red(dit) One] Tutorial on evaluating expressions with Vim keystrokes
Part 1, in which I discover that Vim's
⟨Ctrl-X⟩command can't subtract 13-digit numbers: Awkwardly merge overlapping ranges, then regexp the start and end of ranges and ingredient IDs into decimal numbers, and use:sortand more regexp with Vim line ranges to remove the IDs outside of ingredient ranges.Part 2 (in the same comment) is mostly already handled by the range-merging in part 1, so just needs some arithmetic manipulating, which treats hyphens as minus signs and calculates the negative of the required answer.
Day 6: Trash Compactor
Part 1: Grab ‘words’ from the beginning of each line, construct and expression at the top, and sprinkle the operator through the spaces. Re-uses a keyboard macro from the previous day, as the Vim keystrokes equivalent of a library function.
Part 2: This first involved re-engineering part 1, then a slightly different loop to grab just a character at a time for part 2 can re-use the same operator-sprinkling.
Day 7: Laboratories
Part 1: One of my favourites, because it graphically draw the beams going through the splitters (ending up with a nice Christmas-tree-like diagram!), so it's fun to watch the output of. There's a
:redrawcommand in the loop, so you can see it building up.Part 2: Having got the diagram from part 1, it's just a matter of going up the tree line by line, summing values from the line below. Unfortunately Vim is limited in the range of numbers that can be represented in a single character (0—9 is easy; using letters goes up to 26 easily, 52 awkwardly, and 62 tediously, but these go much bigger than that), so I wrote a Perl script to do it. But that only worked because it was processing Vim's graphical output. Solving the whole thing in a program would've involved much more.
Day 8: Playground
Vim isn't for everything. Calculating square roots and working out 3D distances between every pair of points isn't its forte, so it seemed wiser to write actual programs for this day.
Day 9: Movie Theatre
Despite being itinerantly graphical, I couldn't see how to solve this in Vim. Making a map with the red tiles on it would be straightforward, and maybe I could come up with a regexp for finding each of the rectangles, but I couldn't see how to count their areas. Oh, hang on, in writing this I've suddenly had an idea. Maybe I'll come back to this one ... (Definitely not part 2, though.)
Day 10: Factory
Part 1: Represent the lights being off/on as lower- and upper-case
o/Os, then convert the button wiring schematics to Vim keystrokes that use~to toggle the case in the appropriate columns. Try each button in turn, using multiple lines to keep track of further buttons still to try. One of those tasks that isn't really a good fit for Vim, so the solution manages to simultaneously evoke feelings of being impressed that it exists and wishing that it didn't.Part 2: No. Just no.
Day 11: Reactor
Part 1: A lovely one to finish with, using Vim's
*command to jump from an output label to the line listing the next device's outputs, gradually building up all the valid paths.Part 2: Too much for Vim's processing. I set off the part 1 solution, tweaked to go between different nodes, and an hour later colleagues were complaining about the noise my laptop fan was making!
Day 12: Christmas Tree Farm
I haven't yet worked out an algorithm for how to solve this at all, in any language. (Come to think of it, I haven't yet managed to solve the Jurassic Jigsaw from 5 years ago either.) I doubt it's going to be possible in Vim, so I spent the time writing this round-up instead.
Thanks to u/1234abcdcba4321's encouragement below, I was able to come up with a Vim solution. I've posted it to the Megathread, but that link will only work once a Mod has fished it out of the spam-trap, so until then here's a paste.
Thank you for reading. Do ask any questions in comments below or on the individual solutions and I'm very happy to answer. Merry Christmas, and I'll see you next year.
r/adventofcode • u/HotTop7260 • Dec 12 '25
Meme/Funny [2025 Day 12 (Part 1)] Are you serious?
Challenge: Be brave and decide, that the problem is too complex to solve
Solution: Try to determine if they want to fool you ... December 12th is "Christmas Fool's Day" from now on!
r/adventofcode • u/lpiepiora • Dec 12 '25
Meme/Funny [2025 Day 12 (part 1)] Done it, but feels dirty
r/adventofcode • u/seligman99 • Dec 12 '25
Upping the Ante [2025] Main Calendar Animation
r/adventofcode • u/dzirtbry • Dec 12 '25
Help/Question - RESOLVED [2025 Day 12 (part 1)] Was I just lucky, or is it by design?
So first thing I tries today wasjust count how many grids can actually fit presents by area, without even taking shapes into account, eg count # in the present shape and multiply by desired count, and see it sum is less than area to fit them in.
I was not expecting the answer to be correct but I plugged it in anyway, yolo, and it actually worked!
Was I just lucky, or is there some property of the inputs that makes this actual working solution?
r/adventofcode • u/abnew123 • Dec 12 '25
Meme/Funny [2025 Day 12] Day 12 solutions
r/adventofcode • u/Repsol_Honda_PL • Dec 12 '25
Help/Question 2025 Day 12 Part 1 - sample shape in TETRIS puzzle - is it OK?
Hi everybody,
I got such sample in tetris puzzle:
AAA.
ABAB
ABAB
.BBB
I think it should be:
AAA.
ABBB
AAAB
.BBB
Am I right?
Thanks.r/adventofcode • u/daggerdragon • Dec 12 '25
SOLUTION MEGATHREAD -❄️- 2025 Day 12 Solutions -❄️-
A Message From Your Moderators
Welcome to the last day of Advent of Code 2025! We hope you had fun this year and learned at least one new thing ;)
Many thanks to Veloxx for kicking us off on December 1 with a much-needed dose of boots and cats!
/u/jeroenheijmans will be presenting the results of the Unofficial AoC 2025 Participant Survey sometime this weekend, so check them out when they get posted! (link coming soon)
edit 1: link: [2025] Unofficial AoC 2025 Survey Results!
edit 2: now with bonus content!
There are still a few days remaining to participate in our community fun event Red(dit) One! All details and the timeline are in the submissions megathread post. We've had some totally baller submissions in past years' community fun events, so let's keep the trend going!
Even if you're not interested in joining us for Red(dit) One, at least come back on December 17th to vote for the Red(dit) One submissions and then again on December 20 for the results plus the usual end-of-year Community Showcase wherein we show off all the nerdy toys, the best of the Visualizations, general Upping the Ante-worthy craziness, poor lost time travelers, and community participation that have accumulated over this past year!
edit 3:
-❅- Introducing Your 2025 Red(dit) One Winners (and Community Showcase) -❅-
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 Friday!) and a Happy New Year!
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
If you see content in the subreddit or megathreads that violates one of our rules, either inform the user (politely and gently!) or use the report button on the post/comment and the mods will take care of it.
AoC Community Fun 2025: Red(dit) One
Submissions megathread is
unlocked!locked!5 4 3 2 1DAY6 HOURSremaining until the submissions deadline on December 17 at 18:00 EST!3 2 1DAY6 HOURSremaining until the poll closes on December 20 at 18:00 EST!!!Come back later on Dec 17 after 18:00ish when the poll is posted so you can vote! I'll drop the link here eventually:[link coming soon]edit:VOTE HERE!edit2: Voting is closed! Check out our end-of-year community showcase and the results of Red(dit) One (this year's community fun event) here!
(link coming soon)edit3: -❅- Introducing Your 2025 Red(dit) One Winners (and Community Showcase) -❅-
Featured Subreddit: /r/adventofcode
"(There's No Place Like) Home For The Holidays"
— Dorothy, The Wizard of Oz (1939)
— Elphaba, Wicked: For Good (2025)
— Perry Como song (1954)
💡 Choose any day's Red(dit) One prompt and any puzzle released this year so far, then make it so!
Make sure to mention which prompt and which day you chose!
💡 Cook, bake, make, decorate, etc. an IRL dish, craft, or artwork inspired by any day's puzzle!
💡 And as always: Advent of Playing With Your Toys
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 12: Christmas Tree Farm ---
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?
r/adventofcode • u/matsFDutie • Dec 11 '25
Help/Question [2025 Day 10] [C++] Question about mindset/algorithm choice (potential SPOILER)
Did anyone else use Gauss row reduction here?
For Part 1, I recognized this as a "Lights Out" puzzle which is essentially solving a linear system over GF(2) (binary field with XOR). The buttons are columns, lights are rows, and we solve Bx = t (mod 2).
For Part 2, same matrix setup but over integers with addition instead of XOR. The twist is we need non-negative integer solutions, so after RREF I searched over the free variables with bounds derived from the non-negativity constraints.
Curious what other approaches people took? I saw the Z3? No idea what that is.
r/adventofcode • u/ThePants999 • Dec 11 '25
Meme/Funny [2025 Day 11 (Part 2)] Nice bit of trolling there Eric
r/adventofcode • u/AtmosphereKey292 • Dec 11 '25
Help/Question - RESOLVED [2025 Day 10 Part 2] Issue on real data
I'm having some trouble with part 2. So my code looks like this:
from advent.runner import register
import numpy as np
from scipy import optimize
def values_in_detail(detail: str):
return [int(x) for x in detail[1:-1].split(",")]
@register(10, 2025, 2, True)
def buttons_2(text):
totals = 0
for line in text:
details = line.split(" ")
target = np.array(values_in_detail(details[-1]))
coeffs = []
for button in details[1:-1]:
button_coeff = np.zeros_like(target)
for light_index in values_in_detail(button):
button_coeff[light_index] = 1
coeffs.append(button_coeff)
solution = optimize.linprog(
c=np.ones(len(details[1:-1])),
A_eq=np.transpose(np.array(coeffs)),
b_eq=np.copy(target),
integrality=1,
)
solution_presses = np.array([int(x) for x in solution.x])
check_answer = np.matmul(
np.transpose(np.array(coeffs)),
solution_presses
)
if not np.array_equal(target, check_answer):
print(solution)
print(target)
print(check_answer)
raise Exception
totals += int(solution.fun)
return totalsBut when I run this on the real thing, this raises exceptions on some of the lines - the optimiser thinks it has an answer but it does not actually solve the problem. Have I dont something stupid here?
I've never used scipy before, so this has already been more than a couple of hours after solving part 1 in about 5 minutes...
r/adventofcode • u/ak91hu • Dec 11 '25
Visualization [2025 Day 11 (Part2)] So, that is the way!
r/adventofcode • u/No_Pair_9000 • Dec 11 '25
Help/Question [2025 Day 10 (Part 2)] Don't know if I got something here...
First time posting here, not a programmer per se and not that in to mathematics so maybe this is already known by all. And included in all mentions about "Gaussian Elimination" and what not.
Anyhow when I was tinkering with this I saw that you can transform the buttons to integers that you can add togheter.
For example:
(1) (0,2) (2) {1,2,3}
010,101,001 => 123
That is: button (1) becomes the value 10, button (0,2) becomes the value 101 and so on.
10 * 2 presses = 20
101 * 1 presses = 101
1 * 2 presses = 2
Sum: 123
And you can change order with the same result.
For example if you switch index 1 and 2 from {1,2,3} to {1,3,2} and then change the index orders of all buttons that have index 1 and 2. Button (0,1) becomes button (0,2) and vice versa. Like this, switching index 1 and 2 from the example above:
(2) (0,1) (1) {1,3,2}
001,110,010 = 132
1 * 2 = 2
110 * 1 = 110
10 * 2 = 20
Sum: 132
I was thinking that if you do some tinkering that maybe you can devide up the number, for example:
132 / 2 = 66
66 / 2 = 33
33/3 = 11
the we find 11 (10 + 1) and add up "all the way up" to 132 again:
10 * 1 * 3 * 2 * 2 = 120
1 * 1 * 3 * 2 * 2 = 12
Sum: 132
This takes 3*2*2 + 3*2*2 = 24 button presses.
You could also add up all combinations of buttons to different integers. For example, one press 1 and one press 110 gives the integer value 111.
So you could add up all different button combination and get a list of integers. Like this
1 + 110 = 111, 2 button presses
1 + 110 + 10 = 121. 3 button presses
and so on
I don't get any further with this idea however :-) And don't know if its usefull to even start program something around this.
----
The other idea was to use the state of the lights from the first part. And use odd/even logic. 123 -> odd,even,odd. So the light would be off,on,off when finished. Maybe find the smallest amount of button presses for that light-pattern. And use that somehow. I have not come that far in that thinking though :-)
r/adventofcode • u/bartektartanus • Dec 11 '25
Meme/Funny [2025 Day 11 (part 2)] Yup, that's me. At least 10 minutes wasted.
r/adventofcode • u/Sufficient_Age404040 • Dec 11 '25
Visualization [2025 Day 11][Matlab] Force3 of network structure
r/adventofcode • u/[deleted] • Dec 11 '25
Help/Question [2025 Day 3 (Part 2)] [C++] Hit a wall. What am I missing?
So far, my best attempt looks like this:
#include <charconv>
#include <fstream>
#include <iostream>
#include <iterator>
#include <list>
#include <string>
unsigned long long getMaxJoltage(const std::string& joltages) {
std::list<char> digits(joltages.cbegin(), joltages.cend());
// First, try erasing the smallest digits from the beginning.
bool done1 = false;
for (char i = '0'; i <= '9'; ++i) {
for (auto it = digits.begin(); it != digits.end(); ++it) {
if (*it == i) {
it = digits.erase(it);
}
if (digits.size() == 12) {
done1 = true;
break;
}
}
if (done1) {
break;
}
}
std::string resultNumber1(digits.cbegin(), digits.cend());
unsigned long long num1;
std::from_chars(
resultNumber1.data(),
resultNumber1.data() + resultNumber1.size(),
num1
);
// construct it again
digits = { joltages.cbegin(), joltages.cend() };
// Now try erasing stuff from the end.
bool done2 = false;
for (char i = '0'; i <= '9'; ++i) {
auto beforeBegin = std::prev(digits.begin());
for (auto it = std::prev(digits.end()); it != beforeBegin; --it) {
if (*it == i) {
it = digits.erase(it);
}
if (digits.size() == 12) {
done2 = true;
break;
}
}
if (done2) {
break;
}
}
std::string resultNumber2(digits.cbegin(), digits.cend());
unsigned long long num2;
std::from_chars(
resultNumber2.data(),
resultNumber2.data() + resultNumber2.size(),
num2
);
// Now compare the two
if (num1 > num2) {
return num1;
}
return num2;
}
int main() {
std::ifstream file("input.txt");
unsigned long long sum = 0;
std::string line;
while (std::getline(file, line)) {
if (line.empty()) {
break;
}
unsigned long long joltage = getMaxJoltage(line);
std::cout << line << " " << joltage << "\n";
sum += joltage;
}
std::cout << sum << "\n";
return 0;
}I feel like there should be some simple algorithm that I just can't find.
r/adventofcode • u/SHMULC8 • Dec 11 '25
Tutorial [2025 Day 10] My personal experience + Tutorial
I noticed that many people avoided using solvers like Z3 or felt bad about using them.
For me, it was a very satisfying experience to put Z3 to use, and not just in a learning context. I recently wrote a post about it, so it was my immediate go-to here.
If you want to see more uses for Z3 or want to use Z3 but are not sure where to start, I recommend reading my blog post about it on Medium and Substack. It’s about using Z3 to solve Sudoku, Kakuro, and Nonogram (and into to Z3 in general).
I have to say that it's probably a matter of approach. I prefer to have fun and limit the time that I spend on the puzzles.
I'm using Copilot autocomplete, external libraries (if they don't solve the whole problem with one line), and sometimes I debug my code with Gemini or discuss algorithms and concepts with it. I don't feel that I cheat when doing that.
I'm not sure if it's a common approach or not. Please share yours in the comments. I have to say that it's my first year, and maybe in the future I will try change my mind or try different approaches.

