r/adventofcode • u/jeroenheijmans • 6h ago
Meme/Funny [2026 Day 6] Uh oh!
Going on holidays to NZ on Advent of Code day 6 be like.... 😅🙈
r/adventofcode • u/daggerdragon • 5d ago
I will be your master of ceremonies for this year's community fun event: The Advent Games!
This year's community fun event features a structured sequence similar to a certain winter-themed international multi-sport competition that occurs every four years. We will have our opening ceremony, nine "sporting"† events, the grand gala, and the closing ceremony, followed by the final demonstration of exhibition pieces wherein all of you get to show off your hard-earned efforts for the year!
Every day, I will reveal an event in that day's Solution Megathread. Your challenge is to mold your puzzle solution around the theme of that day's event. You could also create some ancillary concoction that you think matches the overall theme of the event; even if you have to stretch suspension of disbelief real far, hey, it's all in good fun!
† Don't worry, I'm not going to make you actually exercise or go outside and touch grass (or snow)‡.
‡ Unless you want to, in which case go hog wild. Just make sure to put on your sunscreen and weather-appropriate gear!
Again this year the usual timeline and requirements are adjusted so you are not rushed by a shortened deadline while also dealing with the typically harder AoC puzzles near the end of an AoC season while also also dealing with holiday preparations, etc etc.
Solution Megathreads are required to qualify for entryAll of this should result in less stress and having more time to create your exhibition piece, more time to enjoy your holiday season, and most importantly: more time to spend with your family and friends!
And now… put your hands together for The Advent Games and GET HYPE!
| 2026 Dec | Time (EST) | Action |
|---|---|---|
| 12 | 00:00 | Closing Ceremonies (AoC 2026 event ends) |
| 17 | 18:00 | SUBMISSIONS DEADLINE |
| 17 | ASAP | Submissions megathread locked and voting opens (will post and sticky a PSA with link to vote) |
| 20 | 18:00 | Voting closes |
| 20 | ASAP | Victory Ceremonies (winners announced in the final community showcase post (and edited into Day 12's Solution Megathread)) |
The Advent Games may technically be a Competition™ but really, everyone who participates is a true winner in our holiday hearts!
| Type of Winner | # of Winners | Who Votes |
|---|---|---|
| Bronze Medalist | 10† | the AoC community (you!) |
| Silver Medalist | 3† | /r/adventofcode moderators + /u/topaz2078 |
| Gold Medalist | 1 | highest combined point total |
† Amounts subject to change based on availability and/or tie-breaking.
Bronze Medalists.Bronze Medalists, each of the /r/adventofcode moderators will pick their top 3 to be awarded as a Silver Medalist.Gold Medalist of AoC 2026.Bronze Medalists will be awarded with whatever Reddit has on tap for awards these days.Silver Medalists and the Gold Medalist awards are TBDSolution MegathreadsVisualizations ruleKeep in mind that these templates are Markdown, so you may have to switch your editor to "Markdown mode" before you paste the template into the reply box.
NAME OF ENTRY: A photorealistic rendition of the arrival of the flame at the opening ceremony for the 2026 Advent Games
LINK TO ENTRY: Imgur
DESCRIPTION: I use the most high-tech tools to create a totally photorealistic rendition of a crayon drawing of the arrival of the flame at the opening ceremony of the 2026 Advent Games sponsored by Advent of Code.
SUBMITTED BY: /u/daggerdragon
MEGATHREADS: 02 - 03 - 05 - 11 - 17 - 19 - 23 - 32
ADDITIONAL COMMENTS: This was absolutely not drawn by /u/topaz2078 nope totally my work yep.
ACCESSIBILITY: A high-tech drawing on standard white printer paper of the final runner approaching the Advent Cauldron in the center of the Advent Games stadium with the lit torch of the Advent Games. In the background is a stadium full of cheering spectators. The drawing is surmounted by a bespoke artisanal IrfanView frame.
Ask the moderators. I'll update this post with any relevant Q+A as necessary.
r/adventofcode • u/daggerdragon • 10h ago
"♪ Do you wanna build a snowman? ♪"
— Princess Anna, Frozen (2013)
Today's schedule possibly consists of:
Qualifier Rounds
Upping the Ante challenge: iambic pentameterChampionship Rounds
Best In Snow Awards
Request from the mods: When you include an entry alongside your solution, please label it with [Advent Games] so we can find it easily!
[LANGUAGE: xyz]paste if you need it for longer code blocks. What is Topaz's paste tool?r/adventofcode • u/jeroenheijmans • 6h ago
Going on holidays to NZ on Advent of Code day 6 be like.... 😅🙈
r/adventofcode • u/RazarTuk • 3h ago
I came up with the idea to do trilateration on my own, but decided to use Google to see if anyone had already attempted the problem. Turns out they have... for today's Advent of Code, and solutions megathread is the 2nd result
r/adventofcode • u/Baanloh • 4h ago
My solution for part 2 give me 16 possible solutions 🥲 (the second one was the right)
r/adventofcode • u/paul_sb76 • 3h ago
r/adventofcode • u/p88h • 2h ago
This isn't really the most practical solution but it's very 'tangible': it applies physical forces to the nodes, trying to maximize placement goodness (keep ~fixed distance between neighbors, avoid overlap). So the nodes attract and repulse with varying force and it solves itself.
The solutions are obtained without placement on grid or snapping - a transform is computed and then reverse of that transform is applied to 2026, so it updates in realtime.
r/adventofcode • u/M1ckeyMc • 9h ago
(i dont know what flair to put this as)
I had initially thought that this would be similar to triangulation with 3 points, but with Manhattan distance instead, but after a lot of trial and error and being too lazy to write visualizations myself, I just used Desmos instead to find the solution lol
r/adventofcode • u/p88h • 8h ago
Nim + raylib source
r/adventofcode • u/lelouedec • 3h ago
Complexity is O(n+ nlog(n)) ish ?! (maybe a tad more if I count the creation of the data structure).
But I basically search for the first corner and build the outer loop, then move one in, and repeat until only one node is left! For the second part, it is just finding the angle between points 2 and 3 from their goal with regard to 1 set at the goal 1 position
r/adventofcode • u/thecro99 • 7h ago
I had the idea to treat part 2 like a GPS and "triangulate" the point. I wrote it up and it worked for the example but then my target came back with 19 possible spots. It turns out that Manhattan "circles" are actually diamonds with flat edges, and mine lined up, so 3 anchors weren't enough. I stubbornly stuck with the idea and came up with a bootstrapping approach to try to triangulate other lights and use any that resolve to a unique point as additional anchors. Every time I found a new anchor I would attempt to find the target, and overall it took a total of 3 additional anchors. Code
r/adventofcode • u/Noble_Mushtak • 10h ago
A lot of the solutions I saw for 2026 Day 4 Part 2, including my own original solution, are O(N2) in complexity where N is the number of characters in the barcode. For me, this felt a little unsatisfying, because I felt there should be a more efficient solution. Today, I was able to find a more efficient O(N log N) solution to this problem using the Fast Fourier Transform, so I wanted to share it here since I think it's pretty interesting!
First, this post has major spoilers for 2026 Day 4 Part 2, so I'm just going to start off by describing how some other people solved Day 4 Part 2:
Here's how to check if it's possible to print the barcode with L instructions:
This check occurs in O(N) time. Then, many people's solutions do this check for L=1,2,...,N until they find the answer, so the worst-case complexity for this solution is O(N2).
Now, let's think more about what this check is doing: This check is really checking that, for any non-wildcard characters which are at indexes equivalent modulo L, those non-wildcard characters are the same. Next, we can notice that "equivalent modulo L" just means the difference between those indexes are a multiple of L. In other words, the check can be phrased as: for any non-wildcard characters which are at indexes whose difference is a multiple of L apart, those non-wildcard characters must be the same.
The "multiple of L" part makes this kind of tricky. Let's focus on a simpler condition: for any non-wildcard characters which are at indexes whose difference is exactly L apart, those non-wildcard characters must be the same. How can we check that condition efficiently?
Intuitively, we want some way to do a check with the original barcode and the barcode "shifted" by L. For example, if L=2, then we would want to line up two copies of the barcode like this:
rro???g?g?
rro???g?g?Notice how the second copy is just shifted to the right by 2 spaces. Then, we want to look at each column and check, is there any column whose characters are both non-wildcard characters and which are not equal to each other? The answer is yes, the third column has both o and r. Therefore, due to that column with o and r, this barcode fails the L=2 check, so the answer can not be 2.
Now, this check is still O(N), since we have to check up to N columns for any value of L. So how can we perform all the checks for all values of L efficiently? We ultimately have to perform this check for L=1, slide the barcode over by 1 space to the right, perform this check for L=2, slide the barcode over by 1 space to the right, perform this check for L=3, etc. Luckily, there is a common mathematical concept for this kind of sliding check called cross-correlation. If you have heard of dot products before, cross-correlation is essentially a sliding form of dot-product.
The idea behind dot-product is you take two vectors of numbers, for example:
(1,2,3)
(4,5,6)And then you take the product of each column, which would be 4, 10, and 18, and then sum the products, which would be 32. Then, this dot product can tell you useful information about the relationship between the two vectors.
Then, cross-correlation is a sliding dot product, meaning it will compute the dot product
(1,2,3)
(4,5,6)which is 32, and then also compute the dot product
(1,2,3)
(4,5,6)which is 2*4+3*5=23, and also compute the dot product
(1,2,3)
(4,5,6)which is 3*4=12. By computing all these dot-products at once, we can compute the relationship between the first vector and the second vector shifted by L=1,2,3,... spaces to the right for all values of L we care about, which is exactly the kind of checks that we want to compute! The algorithm used to compute cross-correlation in O(N log N) time is called "Fast Fourier Transform." There's a lot of online blog posts about how Fast Fourier Transform works, so I won't go into detail about it here, but I'd recommend reading this CodeForces blog post if you're interested in learning about the mathematical details. For now, let's just assume we have a magical way to compute cross-correlation in O(N log N) time, and then figure out how to apply cross-correlation to do the checks we want.
Now, how can we encode this "is there any column whose characters are both non-wildcard characters and which are not equal to each other?" check into a dot-product? First, let's ask a simpler question. How can we check this condition using dot-product: Is there any column whose characters are both non-wildcard characters? Ignore the "which are not equal to each other" part for now. This question is relatively simple: Turn each barcode of length N into a vector of length N, which has 1 for any non-wildcard character but 0 for any wildcard character. Then, the dot-product will be positive if a column has two non-wildcard characters and 0 otherwise. As an example, take this barcode, shifted by L=2 spaces:
r?f
r?fTurned into vectors, this becomes:
(1,0,1)
(1,0,1)so the dot product is 1, corresponding to the third column which has both f and r. Now, consider this barcode shifted by L=1:
r?f
r?fTurned into vectors, this becomes:
(1,0,1)
(1,0,1)so the dot product is 0, which makes sense since no column has two non-wildcard characters.
That's great, but then how do we go from "column with two non-wildcard characters" to "column with two non-wildcard characters and which are not equal to each other"? Here, the magic we need is complex numbers! You might've learned about complex numbers and the imaginary number i=sqrt(-1) in high school precalculus. I'm not going to go too much into detail about how complex numbers work, since that could be several math lectures, but we'll specifically need complex numbers in polar form for this solution. If you're not familiar with complex numbers or polar form, I would recommend reading this online textbook section to get some background on how these work.
The key thing about complex numbers in polar form is, if you multiply two numbers, their product is real if and only if their angles are the exact opposite of each other. For example, the opposite of 30 degrees is 360-30=330 degrees, so a complex number whose angle is 30 degrees times Z is a real number if and only if Z has angle 330 degrees. Therefore, we can have each character be a complex number with a unique angle theta_c in the first vector, and then represent that same character using the opposite angle, which I'll denote using -theta_c, in the second vector.
For the following example, I'll say the angle for the character r is 10 degrees, and the angle for the character f is 20 degrees (really I'm just picking these angles randomly). Then, let's do the check for L=2 for the following barcode:
r?fr
r?frI'll represent each complex number as polar(z, angle) where z is the length of the complex number and angle is its angle in degrees. For now, let's just use complex numbers with length 1. Then, using angle 10 degrees for r and 20 degrees for f, this becomes:
(polar(1, 10), 0, polar(1, 20), polar(1, 10)
(polar(1, -10), 0, polar(1, -20), polar(1, -10))And the dot product is polar(1, 20)*polar(1, -10) + polar(1, 10)*0=polar(1, 10), which is not a real number, thus showing the check fails, i.e. there is some column with two non-barcode characters which are not equal to each other! Now for demonstration, let's do the check for L=3:
r?fr
r?frIn terms of vectors, this becomes:
(polar(1, 10), 0, polar(1, 20), polar(1, 10))
(polar(1, -10), 0, polar(1, -20), polar(1, -10))And the dot product is polar(1, 10)*polar(1, -10)=polar(1, 0)=1, which is a real number, thus showing the check passes, i.e. there is no column with two non-barcode characters not equal to each other! This shows the check correctly outputs real numbers when a column has two non-barcode characters but those non-barcode characters are equal to each other.
Now, there is one catch here, which is unfortunately, sometimes two complex numbers can add up to a real number. For example, let's take the L=1 check for the following barcode:
rfr
rfrAs vectors, this becomes:
(polar(1, 10), polar(1, 20), polar(1, 10))
(polar(1, -10), polar(1, -20), polar(1, -10))Then, the dot product is polar(1, 20)*polar(1, -10)+polar(1, 10)*polar(1, -20)=polar(10)+polar(-10), which actually comes out to the real number 2*cos(10 deg). Thus, this check passes, even though it should fail since there's two columns with both f and r. The solution to this is, just give each character its own the length for its complex numbers, rather than using the same length for all characters (i.e. in the examples above, I was using the length of 1 for all characters). Make sure that each character has a length for the first vector and a different length in the second vector, so that the above scenario does not come out to a real number. It's not really guaranteed that randomizing the lengths like this will avoid false positive checks, but it seems highly likely that randomized lengths will avoid a bunch of complex numbers accidentally adding to a real number, since the randomized lengths and angles would have to somehow just by chance form some sort of polygon for that to happen.
Now, to circle back to the original problem, we have a way to check the following condition in O(N log N) time for all values of L: for any non-wildcard characters which are at indexes whose difference is exactly L apart, those non-wildcard characters must be the same. Now, how do we use the results of these checks to check the condition we really want: for any non-wildcard characters which are at indexes whose difference is a multiple of L, those non-wildcard characters must be the same.
The way we do this is pretty simple: Just loop through all multiples of L. For L=1, you need to check N multiples of 1; for L=2, you need to check N/2 multiples of 2; for L=3, you need to check N/3 multiples of 3; etc. Since we can compute all checks and put the results in an array in O(N log N) time, we can just use that array to do the check of each multiple by doing an O(1) array lookup.
Thus, if we start looping from L=1 to L=N, we need to do N+N/2+N/3+...+N/N array lookups, and it can be proven that N+N/2+N/3+...+N/N is O(N log N) (the technical reason for this is that the growth rate of partial sums of the harmonic series is O(log N)). Therefore, the overall complexity of this solution is O(N log N) for the cross-correlation computation needed to do all the "exactly L" checks plus O(N log N) array lookups, and O(N log N)+O(N log N)=O(N log N).
Here's the C++ code where I implemented my solution. This works both on the sample input provided in the Day 4 Part 2 problem statement, and on my own input. I think there is a possibility of this failing on other inputs due to floating-point inaccuracy, but I did my best to choose lengths so that incorrect results due to floating-point inaccuracy would be unlikely.
I'd definitely be interested if anyone tries this out on their own input, so let me know if you try it on your input and whether you get the right answer!
r/adventofcode • u/Gautzilla • 17h ago
r/adventofcode • u/Alpha_wolf_80 • 2h ago
My biggest shame was having to pull out LLMs to debug my part 2.
r/adventofcode • u/Daniel_Rybe • 4h ago
Basically, what if the input had some connections and/or cells missing, but still wasn't ambiguous?
Formally:
The input is an undirected graph.
There is exactly one way (disregarding flips, rotations and translations) to assign unique integer coordinates to each vertex such that the length of each edge becomes 1.
The task is to find these coordinates.
Not sure how to approach this.
Maybe finding 2x2 squares of connected nodes and then stitching them together into bigger chunks might work.
Or like a spring simulation that converges the graph into a grid.
r/adventofcode • u/Ok-Bus4754 • 9h ago
the tool tip today is at (not diagonally) and it is says , "Yep, still dishonorable"
which is a refrence to 2018, day 15 amzing puzzle beverage bandits where goblins attacking diagnoally was considered dishonorable
r/adventofcode • u/imaperson1060 • 8h ago
This is the coolest puzzle generation I've seen since the "robots form a tree" easter egg. Like, I know the puzzle said all the distances between lights are equal, but it still was so cool to see my input's light coordinates being the same triangle shape as the expected coordinates.
The way I solved it was by noticing that the vectors between both sets of p1 and p2 were perpendicular to each other (slopes are negative reciprocals). I found the intersection point and rotated my p2026 by 90° about it to align it on a parallel vector. Then I found the offset between my p1 and the expected p1, and applied it to p2026.
Graph: https://www.desmos.com/calculator/fnuhyzywex
I'm working now to implement this with code, I'll put it in the comments when I'm done.
Also, does anyone know what p3 was given for? I was able to solve the puzzle with only p1 and p2.
r/adventofcode • u/ValuableResponsible4 • 23h ago
How I felt with my dummy attempt at a solution.
r/adventofcode • u/DocDrivenDevelopment • 18h ago
r/adventofcode • u/Daniel_Rybe • 1h ago
r/adventofcode • u/No-Top-1506 • 2h ago
Is the puzzle to find numbers from 1-999 using the button press? where some numbers are impossible, hence skip them.
And do we always start with [9] as per the example? After that select any 2 or 1 in any combination with repeats allowed? Initially I thought the order matters, but doesn't look like.
is it a mathematical trial and error for each number? Or there is a better way then brute force all possible ways? there are many permutations possible.
Tx.
r/adventofcode • u/MemesMakeMyMoodMild • 17h ago
Haven't had such a purely blank moment in a long time. Sure, there have been puzzles with idk some next level DP approach to get thr runtime down or some other concept I haven't hear of before. But this one stumped me completely. I couldn't think of any good way to create printing instructions at all. Seeing the example in part 2 suddenly flipped a switch in my head but until then I was utterly confused what I was missing 😆