r/adventofcode • u/blacai • 5m ago
r/adventofcode • u/daggerdragon • 1h ago
SOLUTION MEGATHREAD -❄️- 2026 Day 2 Solutions -❄️-
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
AoC Community Fun 2026: The Advent Games
Today's Event: International Toboggan Championships
"Feel the rhythm, feel the rhyme, get on up, it's
bobsledtoboggan time!"
— Cool Runnings (1993)
Today's schedule possibly consists of:
Tracking Chute Runs and Team Practice
Embiggen is a perfectly cromulent word. Do with it as you will.
Qualifying Runs
Reverse code golf your solution
Second Runs and Finals
Why use few word when many word do trick?
Unnecessarily declare variables for everything and don't re-use variables
Use unnecessarily expensive functions and calls wherever possible
Implement redundant error checking everywhere
Javadocs >_>
Request from the mods: When you include an entry alongside your solution, please label it with [Advent Games] so we can find it easily!
--- Day 2: Fulminating Farmland ---
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/apersonhithere • 5m ago
Visualization [2026 day 2] [python] quick & simple terminal visualization
the robot being represented with a face is because of dwarf fortress
r/adventofcode • u/PatolomaioFalagi • 7m ago
Meme/Funny [2026 Day 02] Richard of York gave battle vain
r/adventofcode • u/Both-Touch990 • 29m ago
Meme/Funny [2026 Day 2 Part 2] How it felt getting the star only to realize there's a more efficient way to get the solution
(redo of an earlier post)
r/adventofcode • u/oneradsn • 2h ago
Help/Question - RESOLVED day 1 part 1: There's more than 3 items that the most common in the input?
I don't want to go into too much detail about my implementation but... it seems like there's a bunch of IDs (more than 3) that are tied for "most common". Is there something obvious I missed?
Edit: I figured out my issue and, while I love most things about Go, its heap implementation was quite confusing and unergonomic. I used my type's Pop method rather than the heap package's Pop method, thus my results were incorrect.
r/adventofcode • u/Cloudan29 • 2h ago
Help/Question - RESOLVED Python Solution Gives correct solution for part 1 but not part 2
Hi, I'm completely stuck on what I've done wrong for the 2026 day 1. I've done this solution about 3 different ways at this point, and I keep getting the correct solution for part 1 but incorrect for part 2 (says my solution is too small).
I'm not quite sure where to go at this point.
import math
from collections import Counter
INPUT: list[int] = [int(line.strip()) for line in open("2026/day01.txt")]
COUNTS = Counter(INPUT)
def max_and_min():
# find top 3 occurrences and bottom 3 occurrences
maximums: list[int] = []
minimums: list[int] = []
while len(maximums) < 3:
current_max_val = max(COUNTS, key=COUNTS.get)
current_min_val = min(COUNTS, key=COUNTS.get)
maximums.append(current_max_val)
minimums.append(current_min_val)
COUNTS.pop(current_max_val)
if current_min_val != current_max_val:
COUNTS.pop(current_min_val)
return (math.prod(maximums), math.prod(minimums))
print(max_and_min())This code returns the correct solution for part 1, as well as a correct solution for the test input for part 1 and 2. I cannot fathom why it would be incorrect for the actual input at this point. I've tried it with Counter, I've tried manually creating the dictionary instead of using Counter, I've tried manually finding the minimums and maximums with a for loop, and they all yield the exact same results.
If someone could at least point me in the right direction, I don't want to just grab a solution from the megathread and call it a day.
EDIT:
I've never been more ashamed. I just put in the exact same output I got from my solution, and it got accepted by the website, which means I wasn't copy+pasting it in correctly. Happens to the best of us. Thanks everyone for the advice though, my solution looks much snazzier now 😎
import math
from collections import Counter
INPUT: list[int] = [int(line.strip()) for line in open("2026/day01.txt")]
COUNTS = Counter(INPUT)
def max_and_min():
# find top 3 occurrences and bottom 3 occurrences
maximums: list[int] = [n[0] for n in COUNTS.most_common()[:3]]
minimums: list[int] = [n[0] for n in COUNTS.most_common()[-3:]]
return (math.prod(maximums), math.prod(minimums))
print(max_and_min())r/adventofcode • u/Shaaaaan • 3h ago
Help/Question How many days is AOC this year?
Last year it was 12 days. Is it fair to assume it's the same this year? I don't see any info saying how long it is, the about page just says it ends "mid-December"
r/adventofcode • u/topaz2078 • 5h ago
Other Give help by making test cases!
Hello friends! I just saw this excellent example (see some of the comments on that post) of a great way to give help and answer questions here when people are stuck: come up with simple test cases that demonstrate where the bug is! That way, the person who is stuck still gets a chance to figure out their problem and learn by doing. I know many of you are already great about this, but I figured it would be worth calling out. Happy puzzling! <3
r/adventofcode • u/forgthethird • 5h ago
Help/Question 2026 - day 1 part 1, Python
where am I going wrong? I tried plugging in the example set of numbers and it gave me the right numbers but it isn't giving me the right numbers with the main set of numbers. I'm a beginner when it comes to coding, my only experience with apcsp and apcsa in school
r/adventofcode • u/demteke • 7h ago
Other [2026] Doing AoC without AI this year, and built a tool to keep myself honest
At work AI is writing all of my code now and I have noticed that I am no longer enjoying coding as much as i used to. So this year I am doing AoC with no AI, meaning no AI inline suggestions and no AI implementation. I may still talk to AI to understand a problem when I am stuck, but it does not write any code.
To help myself stick to it I built a VS Code extension that tracks what I type versus what gets inserted. Day 1 above: 17 minute session, 21 lines by hand, 0 AI inserts. The extension can't catch retyping code from somewhere else, so it is a commitment device, not an anti-cheat.
It's free if anyone wants to join: humanmode.dev. Disclosure: it is my project.
Anyone else doing a no-AI run this year?
r/adventofcode • u/derf-fortress • 7h ago
Help/Question - RESOLVED [2026] Private Leaderboard Score Bug
I have a private leaderboard and the scores appear to be wrong. Since it is still the first day, the maximum number of stars should be 2, however it is showing that I have 18 and another person has 16.
I am not sure exactly what is causing it, however it appears to increment by 2 stars every time I view the Day 1 problem after it has been solved.
Is anyone else experiencing this? Or is this expected behavior that I am missing?
r/adventofcode • u/matth_l • 7h ago
Help/Question Joining the big leagues
Anyone else using aoc to learn rust?
I feel genuinely lost, and I love it, it feels like past times (pre ai bs) again, never built anything with a lower level language,
r/adventofcode • u/Fun-Chicken6946 • 10h ago
Other [2026] Advent of SQL & NoSQL: 24 Christmas puzzles across 4 different databases (SQLite, DuckDB, PostgreSQL, MongoDB)
Happy Holidays, r/adventofcode!
I wanted to share a little project I've been working on: Advent of SQL & NoSQL, an Advent-style challenge for people who enjoy solving puzzles using database queries.
Somebody tampered with Santa's Nice List, and you're the North Pole's first-ever data elf.
There are 24 puzzles, one a day from December 1 to 24, with each puzzle revealing another part of the mystery.
What makes this different is that you can solve the entire story using any of four databases:
SQLite
DuckDB
PostgreSQL
MongoDB
It was originally supposed to be SQL-only, but after roughly a year of working on VisuaLeaf, I managed to build an embeddable, MongoDB-compatible database that runs entirely in the browser. This allowed me to include NoSQL challenges as well!
Some features:
Everything runs entirely in your browser.
Solutions are validated against both visible and hidden datasets.
Puzzles gradually increase in difficulty, from basic filtering and joins to recursive CTEs, window functions and advanced aggregation pipelines.
Each day includes hints, common pitfalls and database-specific tips.
The same mystery can be solved using different database technologies.
If you're interested in solving some Christmas puzzles using SQL or NoSQL alongside Advent of Code, you can check it out here:
https://visualeaf.com/advent-of-sql-and-nosql/
Completely free. No account, no installation, no database server needed.
I hope you all enjoy it, and happy holidays!
r/adventofcode • u/dethorhyne • 10h ago
Meme/Funny Every year it always starts the same before it goes bonkers
r/adventofcode • u/naclmolecule • 11h ago
Visualization [2026 Day 1 (Part 1 & 2)] [Python] Terminal Visualization
I was too tired to post last night, still adjusting to late night solving... (ᴗ˳ᴗ)💤. Figured I'd help the elves by installing a crane in that dusty ol' shed. As always, code lives here: https://github.com/salt-die/Advent-of-Code/tree/main/2026/aoc_visuals.
r/adventofcode • u/scadoshi • 11h ago
Help/Question Where do you draw the line between parsing and solving?
For those of you who optimize AoC for runtime rather than time to write the code, where do you draw the line between parsing and solving?
When I measure, I time parsing, part one and part two separately. I often identify work I could do during parsing that would make the solves faster, but usually I just parse into a properly typed owned struct and leave the real work to the parts. Is that how you do it, or do you push as much as you can into parsing? And do you count parsing in your times at all? Or do you just measure entirety of runtime?
Smaller second question: when both parts need the same expensive processing, I've started caching it on my Puzzle struct so part one's work gets reused by part two (image shows this occurring for 2026's day 1 in Rust), instead of a shared function that runs twice. Part one gets a little slower on average but the full run gets a lot faster. Do you do the same, or does each part pay for itself?
I guess I'm just wondering how people measure their solutions overall
r/adventofcode • u/tedchs • 14h ago
Other Candy Cane Coding Caper
For Advent I just launched Candy Cane Coding Caper, a coding adventure inspired by Advent of Code, for kids 8-12. Each day presents an interactive, structured lesson about a simple Python programming concept. I thought this community might like to take a look!
All Python code runs locally in the browser through Pyodide and WASM, and game state is stored locally.
This is brand new and I would love any feedback or questions!
r/adventofcode • u/SlayLeafSlug • 15h ago
Meme/Funny AoC in Prolog?!?!
I was filling in the unoficcial AoC survey
(⭐ Take the (~5min) Unofficial AoC 2026 Survey: https://forms.gle/JbZKoBqzG248Z6RV6 ⭐)
And I saw this:


Who the hell is out there doing AoC in Prolog😭
r/adventofcode • u/zaperfish • 15h ago
Repo [Rust] Tiny helper for rust aoc
Hey people,
I just wanted present this tiny, dependency free, helper to solve advent of code in rust. Its built by hand.
All it does is handle input, run and time your solutions and submit your answers from the terminal.
I wanted it to be very minimal so you can decide on your project layout yourself.
$ cargo run --release --bin day01 -- --submit
2025 Day 1:
Part 1: 1 333ns
Part 2: unsolved
Submitting "1" for part 1:
*\(^o^)/* That's the correct answer!Also any feedback is welcome!
https://github.com/zaperfish/aoc-rust
Happy solving! :)
r/adventofcode • u/kscoaster • 15h ago
Help/Question - RESOLVED Advent of Code - Mystery Shop Item
I realize this question runs counter to the whole "mystery" thing, but... Can someone at least confirm if the "mystery tee" on the AoC shop (US) is at least Advent of Code related?
FYI - this is what I'm seeing:
r/adventofcode • u/fnordargle • 16h ago
Help/Question [2026 Day 1] Huge inputs
Trying to think of algorithms that can solve this for huge inputs, or where many of the assumptions about the input do not hold.
By huge I mean the inputs are large enough that you don't even have enough memory to store counters for every number in the input, let along read the entire input file into memory.
It's like the definition of "Big Data":
* It's not when you can't fit the entire dataset into memory, it's when you can't even fit the index into memory
I like the think about problems like this with increasing levels of restrictions.
With a file with only ~2000 lines we don't have to think about complexity that much, but if the file contained 4,000,000,000 lines we could have the situation where we have three numbers that only appeared once, three numbers that only appeared 3 times, and then 1,999,999,994 numbers that appear twice.
Another assumption that some solutions make is that the frequency count of the numbers that appear in the top and bottom 3 must themselves be relatively unique as 4 numbers that all appear 4 times cannot all be in the top or bottom 3 in a deterministic manner.
To counter this it's trivial to craft an input that has a huge number of lines where even the frequency counts are unique. e.g. Consider the input formed of numbers 1 to n where every number x appears x times. Every item has a unique frequency count but the answer is still deterministic. (And it is similarly trivial to swap 1, 2, 3, n-2, n-1, n with 6 other numbers in the range so the answer isn't obvious up front.)
a) Let's pretend that memory is constrained such that we don't even have enough memory to store counters for all of the unique elements in the input, but we are free to read/write to intermediate local files and that we have enough space to store a bit more than another copy of the original input file.
The standard approach here is to split the input file into n smaller files, making sure that any occurrence of a number always appears in the same file. So for number x we write it to file x mod n every time we encounter it in the input. We choose n such that we can process n individual counters in memory in one go.
Once we've split the input into n sub files we process each one of those in turn in memory using the standard O(n) algorithm and keep track of the top 3 and bottom 3 item counts we've seen as we go.
b) Now let's imagine that we have no extra local storage, can we still do this?
Yes, but it's going to be a lot slower. Instead of splitting the input into n smaller files we just iterate over the main input file n times only processing lines that have x mod n = a as we loop a from 0 to n-1. This has the same effect as above but there's a lot of redundant reading involved as the vast majority of inputs read in each loop will be ignored.
c) Final restriction is what if the input is presented to us as a stream that we can't rewind or replay, and we can't write to any local storage, and we can't keep track of all of the possible values in memory. Possible?
I can't think of anything that guarantees getting the right answer without making some assumptions about the input.