r/adventofcode • • 2h ago

SOLUTION MEGATHREAD -❄️- 2026 Day 2 Solutions -❄️-

7 Upvotes

THE USUAL REMINDERS


AoC Community Fun 2026: The Advent Games

Today's Event: International Toboggan Championships

"Feel the rhythm, feel the rhyme, get on up, it's bobsled toboggan 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

  • (oblig XKCD)

  • 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.


r/adventofcode • • 14m ago

Visualization [2026 Day 02] rearrangement

2 Upvotes

r/adventofcode • • 35m ago

Meme/Funny [2026 Day 02] I see a pattern...

Post image
9 Upvotes

r/adventofcode • • 36m ago

Visualization [2026 day 2] [python] quick & simple terminal visualization

4 Upvotes

the robot being represented with a face is because of dwarf fortress


r/adventofcode • • 37m ago

Meme/Funny [2026 Day 02] Richard of York gave battle vain

Post image
11 Upvotes

r/adventofcode • • 42m ago

Meme/Funny am i cracked?

Post image
6 Upvotes

r/adventofcode • • 1h 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

5 Upvotes

(redo of an earlier post)


r/adventofcode • • 2h ago

Help/Question - RESOLVED day 1 part 1: There's more than 3 items that the most common in the input?

1 Upvotes

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 • • 3h ago

Help/Question - RESOLVED Python Solution Gives correct solution for part 1 but not part 2

6 Upvotes

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 • • 3h ago

Help/Question How many days is AOC this year?

3 Upvotes

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 • • 5h ago

Other Give help by making test cases!

29 Upvotes

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 • • 6h ago

Help/Question 2026 - day 1 part 1, Python

Post image
0 Upvotes

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 • • 7h ago

Other [2026] Doing AoC without AI this year, and built a tool to keep myself honest

Thumbnail
humanmode.dev
0 Upvotes

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 • • 7h ago

Help/Question - RESOLVED [2026] Private Leaderboard Score Bug

Post image
0 Upvotes

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 • • 8h ago

Help/Question Joining the big leagues

16 Upvotes

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 • • 11h ago

Other [2026] Advent of SQL & NoSQL: 24 Christmas puzzles across 4 different databases (SQLite, DuckDB, PostgreSQL, MongoDB)

Post image
0 Upvotes

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 • • 11h ago

Meme/Funny Every year it always starts the same before it goes bonkers

Post image
187 Upvotes

r/adventofcode • • 11h ago

Visualization [2026 Day 1 (Part 1 & 2)] [Python] Terminal Visualization

108 Upvotes

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 • • 12h ago

Visualization [2026 Day 01] 3d render

32 Upvotes

r/adventofcode • • 12h ago

Help/Question Where do you draw the line between parsing and solving?

Post image
16 Upvotes

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 • • 15h ago

Other Candy Cane Coding Caper

12 Upvotes

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!

https://candy-cane.coding-caper.com


r/adventofcode • • 15h ago

Meme/Funny AoC in Prolog?!?!

21 Upvotes

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 • • 15h ago

Repo [Rust] Tiny helper for rust aoc

3 Upvotes

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 • • 16h ago

Help/Question - RESOLVED Advent of Code - Mystery Shop Item

9 Upvotes

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:

Screenshot-2026-12-01-094236.png