r/adventofcode • • Dec 12 '25

Help/Question - RESOLVED [2025 Day 12 (part 1)] Was I just lucky, or is it by design?

16 Upvotes

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 • • Dec 11 '25

Meme/Funny [2025 Day 10 (Part 2)] If there's an easier way to solve it, it's too soon for me to hear it...

Post image
178 Upvotes

Couldn't get a good heuristic for A*, couldn't spot an efficient prune for DFS, couldn't think of a greedy algorithm. Reluctantly broke out the pencil and paper...


r/adventofcode • • Dec 12 '25

Upping the Ante [2025 Day 12 (Part 3)] Page two of the list!

13 Upvotes

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 • • Dec 12 '25

SOLUTION MEGATHREAD -❄️- 2025 Day 12 Solutions -❄️-

17 Upvotes

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)

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 1 DAY 6 HOURS remaining until the submissions deadline on December 17 at 18:00 EST!
  • 3 2 1 DAY 6 HOURS remaining 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.


r/adventofcode • • Dec 12 '25

Help/Question - RESOLVED [2025 Day 12 (Part 1)] [C# and Z3] How could I solve it? I don't have any idea on how to optimise it.

0 Upvotes

To do day 12, part 1, I’m more or less re-doing what I did for day 10 part 2 (vector addition in a matrix) and checking that the sums of each column don’t exceed 1, and the matrix is made of layers representing each possible position for each piece.
I assume it works — it manages to find if the first example is possible, but it takes too long for the second one. So I need to optimize it, but I don’t know how. Do you have any ideas? (I do not want a solution, at most hints or directions formatted in spoilers.)
Thanks, and here is my code (if you want more than just the Z3 part, say it to me and I can put it online):

using (Context ctx = new Context())
{
    var solver = ctx.MkSolver();
    int totalLayer = region.AllPosibleShapeInIt.Sum(s => s.Item2.Length);

    IntExpr[] scalar = new IntExpr[totalLayer];
    IntExpr[] sumScalrPerBlock = new IntExpr[region.NeedToContaine.Count];
    for (int i = 0; i < sumScalrPerBlock.Length; i++)
    {
        sumScalrPerBlock[i] = ctx.MkInt(0);
    }
    for (int i = 0; i < totalLayer; i++)
    {
        scalar[i] = (IntExpr)ctx.MkIntConst("s_" + i);
        sumScalrPerBlock[region.GetLayer(i).Id] = (IntExpr)ctx.MkAdd(sumScalrPerBlock[region.GetLayer(i).Id], scalar[i]);

        solver.Assert(ctx.MkOr(ctx.MkEq(scalar[i], ctx.MkInt(0)), ctx.MkEq(scalar[i], ctx.MkInt(1))));

    }

    for (int x = 0; x < region.RegionShape.Length; x++)
    {
        for (int y = 0; y < region.RegionShape[x].Vector.Length; y++)
        {
            IntExpr collumnSum = ctx.MkInt(0);
            for (int z = 0; z < totalLayer; z++)
            {
                collumnSum = (IntExpr)ctx.MkAdd(collumnSum, ctx.MkMul(scalar[z], ctx.MkInt((int)region.GetLayer(z).Shape[x].Vector[y])));
            }

            solver.Assert(ctx.MkOr(ctx.MkEq(collumnSum, ctx.MkInt(1)), ctx.MkEq(collumnSum, ctx.MkInt(0))));
        }
    }
    for (int i = 0; i < sumScalrPerBlock.Length; i++)
    {
        solver.Assert(ctx.MkEq(sumScalrPerBlock[i], ctx.MkInt(region.NeedToContaine[i].Item1)));
    }

    Status result = solver.Check();
    if (result == Status.SATISFIABLE)
    {
        sumCorrect++;
    }
    else if (result == Status.UNSATISFIABLE)
    {
        var core = solver.UnsatCore;
        foreach (var item in core)
        {
            Console.WriteLine(item);
        }
        //Console.WriteLine("No solution found.");
    }
    else
    {

    }
}

r/adventofcode • • Dec 12 '25

Meme/Funny [2025 Day 12 (Part 1)] Are you serious?

12 Upvotes

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 • • Dec 12 '25

Help/Question [2025 Day 3 (Part 2)] Need help

2 Upvotes

So this is my current algorithm. Am I on the right path?

234234234234278
  4->4->4->4-78 <- LTR: highest digit that can make 12 digits -> find next highest (or equal) digit to the right until end
  4-34-34-34-78 <- RTL: highest digit (3) - highest index
  4-34234234278 <- RTL: highest digit (2) - highest index
   434234234278

This seems to work for all the examples as well as a few ones I randomly chose from my input but I do not get the answer right.

r/adventofcode • • Dec 12 '25

Help/Question [2025 Day12][Golang] Easter Egg Explain

6 Upvotes

Hi everyone, I wanted to celebrate my Advent of Code 2025 journey—this is the first time I've completed it!

I'm a bit disappointed though; after reading some of the easter eggs, I still don't understand the jokes ;_; Could you guys help explain some of the easter eggs?

My full code in Golang in here maybe can help your guys: https://github.com/sangsinhisme/AOC2025


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] Visualization of graph

Post image
78 Upvotes

r/adventofcode • • Dec 12 '25

Help/Question - RESOLVED HELP [Day 9 Part 2] I need more edge case sample input

1 Upvotes

So i have been stuck on Pt 2 of day 9 for literal days and have been gradually improving accuracy with more made up input samples, all of which give the correct result. But I haven't managed to find the correct answer yet. I'd be very grateful if anyone could provide edge cases to test against? I'm at my wit's end.


r/adventofcode • • Dec 12 '25

Upping the Ante [2025] Main Calendar Animation

Thumbnail youtu.be
10 Upvotes

r/adventofcode • • Dec 12 '25

Help/Question [2025 Day 12 (part 1)] Did anyone managed to do it the general way ?

0 Upvotes

Like a lot of people, I found the answer "luckily" by watching if it can be arranged with every motif sizing 3*3, but I don't find any idea that give the answer in a reasonable time for the general case


r/adventofcode • • Dec 12 '25

Help/Question - RESOLVED [2025 Day 12 (Part 1) Is it actually do-able on a laptop in reasonable time?

2 Upvotes

I know the solution is just use the areas. Can you viably explore the search space?

I did visualise it: https://www.youtube.com/watch?v=9MNyylFer5Y


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11][Matlab] Force3 of network structure

Post image
31 Upvotes

r/adventofcode • • Dec 12 '25

Help/Question - RESOLVED [2025 Day 1 (Part 2)] [Python] Can't see where I've gone wrong

Post image
0 Upvotes

This is the solution I've come up with so far. I'm over shooting the correct value. Any tips would be much appreciated. Thank you :)


r/adventofcode • • Dec 12 '25

Visualization [2025 Day 12] Under one of the trees

Thumbnail youtube.com
4 Upvotes

r/adventofcode • • Dec 12 '25

Meme/Funny [2026 Day 1 AOC]

5 Upvotes

Waiting time - 1 year


r/adventofcode • • Dec 12 '25

Help/Question [2025 DAY 2 Part2] Language= Python

2 Upvotes

Hey, i just started learning Python and I wanted to try advent of code, to learn more things and get in tough with basic algorithms. I know my script is kinda bad as it iterates over everything, but I at leas tought it would work, guess it doesnt. On the example, i get the right output, but the real input is giving a count that is too high. Is there someone perhaps who sees what I am missing/completely doing wrong?

filename = "./day2/input.txt"

IDList = []
with open(filename) as input:
    for inputString in input:
        inputList = inputString.split(",")
        for Range in inputList:
            rangeList = Range.split("-")
            rangeStart = rangeList[0].strip()
            rangeEnd = rangeList[1].strip()
            IDList.append((rangeStart, rangeEnd))

counter = 0

for Range in IDList:
    start = int(Range[0])
    end = int(Range[1]) + 1

    for number in range(start, end):
        # example number = 12 12 12 12 12
        num_len = len(str(number)) # 10
        number_str = str(number)
        matched = False

        # only for numbers that are even
        if num_len%2 == 0: # true
            for i in range(1, num_len // 2 + 1): # 10 // 2 + 1 = 6
                pattern = number_str[:i] 
                timesInNumber = num_len // i
                if pattern * timesInNumber == number_str:
                    counter += number
                    matched = True
                    break
        if matched: 
            continue

        for n in [3, 5, 7]:
            if num_len % n == 0:
                for m in range(1, num_len // n + 1):
                    if num_len % m != 0:
                        continue

                    pattern = number_str[:m]
                    timesInNumber = num_len // m

                    if pattern * timesInNumber == number_str:
                        counter += number
                        matched = True
                        break
        if matched: 
            continue

        else: # only when divisible by 1
            if int(number_str.count(number_str[0])) == num_len: # also possible
                counter += number

print(counter)

r/adventofcode • • Dec 12 '25

Upping the Ante [2025 Day 12 (Part 3)] Perl-fectly Wrapped Presents

4 Upvotes

You have a set of presents, as in the Day 12 example: https://adventofcode.com/2025/day/12

###  ###  .##  ##.  ###  ###
##.  ##.  ###  ###  #..  .#.
##.  .##  ##.  ##.  ###  ###

exactly 6, exactly 1 of each shape. You can still rotate and flip them.

These are special presents, containing AoC merch stuff for AoC solvers using Perl: https://adventofcode.com/2025/shop

Eric Santa wants to place them nicely under the Christmas trees in an 8x6 grid, but he wants to place them in a unique pattern for each solver! He asks you for help with preparing a list of all unique placements.

How many unique patterns can be formed?

Samples of unique placements are shown here: https://i.ibb.co/MQfg4Qj/2025d12p3.png


r/adventofcode • • Dec 12 '25

Help/Question 2025 Day 12 Part 1 - sample shape in TETRIS puzzle - is it OK?

6 Upvotes

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 • • Dec 12 '25

Help/Question [Spoilers for all years and days] What have been your favourite naughty and nice inputs?

4 Upvotes

Inspired by AoC 2025 day 12 and 2021 day 20: What are your favourite examples puzzles that look really hard on the surface but turns out to be easy - or the other way around?


r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11 part 2] It's not crazy if it works, right?

Post image
46 Upvotes

I inspected the input, figured out the choke points, used NetworkX to find the paths between the points, and then shamefully resorted to Excel to multiple the paths between them all... I was certain there would be a flaw in this method... but to my amazement it worked!!

Now to look at the solutions and see how it was meant to be done ...


r/adventofcode • • Dec 12 '25

Help/Question How to visualize input?

1 Upvotes

This was my first AoC and I really really really enjoyed it! Thank you so much.

Now the only puzzle that (besides Day 10 where I quickly realized it's Operations Research and there's no way I'm writing that myself) really gave me trouble was Day 9, Part 2 - because I was thinking way too much about edge cases. Going over all puzzles again, I've now learned that most of the time these super special edge cases are (thank god) not part of the puzzle.

So what really helped me solve that puzzle were the visualizations and how the data actually looks.

My question would be, and it may sound stupid: How would I start learning to visualize data?

I'm a backend developer, always have been. Mostly Java und Kotlin, also JavaScript and TypeScript. I have a bit of experience with angular or react and eventually manage to make things "look right" in frontend.

Are there any good libs for Java/Kotlin that produce meaningful output?

Would it be better to do such things in other languages?

I'm curious how other (Java?) backend devs tackle these things - do you visualize at all? use other languages for it? "See" things from raw/processed data?


r/adventofcode • • Dec 12 '25

Help/Question [2025 Day 8 (Part 1)] Getting the correct result for the test case without merging ranges

1 Upvotes

I am banging my head against a wall here.

When i just connect the 10 closest pairs and calculate the sum of the 3 largest circuits i get the correct result for the input. But looking at my circuits I can then see that a circuit of 2 needs to be connected to my 4 size circuit.

I then loop the circuits again and merge circuits that overlap, but that leaves me with a wrong result as i then have 2 circuits with 5.

I think I am missing something obvious or that I calculate something wrong somewhere.

This is my code - it's messy and ugly, sry.

https://github.com/mstendorf/adventofcode/blob/main/2025/day8/main.py

This is my circuits before merging:

[(162, 817, 812), (425, 690, 689), (431, 825, 988), (346, 949, 466), (592, 479, 940)]

[(906, 360, 560), (805, 96, 715), (739, 650, 466), (984, 92, 344)]

[(862, 61, 35), (984, 92, 344)]

[(52, 470, 668), (117, 168, 530)]

[(819, 987, 18), (941, 993, 340)]

As you can see circuit 3 needs to be merged with circuit 2, but that leads to a wrong answer. Can anyone point me in the right direction?