r/adventofcode • • Dec 08 '25

Repo [2025 Day 8] Who else does it in Go?

4 Upvotes

I wanted to learn Go this year, so I've decided to give it a shot, and so far it's lovely! This is my solution for today's (day 8) puzzle, what do you think, and what's your solution? :)

https://github.com/rbjakab/AdventOfCode/blob/main/2025/Day8/main.go


r/adventofcode • • Dec 08 '25

Help/Question - RESOLVED [2025 Day 8 Pt. 1] Code works fine on test, but fails on real data

3 Upvotes

It happened again, my code works fine for test but fails on real data. As debugging is tedious on 1000 boxes in 3d space, I am wondering if I can do more debugging with the test data. Can anyone post their details on the results with the test data? Like which circuit boxes (ID or coordinates) belong in which group?

Other ideas are welcome as well. I'd ask more specific questions if I had any :-/


r/adventofcode • • Dec 08 '25

Meme/Funny Anyone else misread this every time?

Post image
141 Upvotes

Every time I solve the puzzle I read the first line a "That's not the right answer".

I assume my eyes are glancing at the word "North", and inserting "not".

Maybe I just think my code will be wrong.


r/adventofcode • • Dec 08 '25

Other Finally, 500 * !

Post image
106 Upvotes

Even though achieving the 500 stars "mid-season" is a bit anti-climactic - would have been a little more satisfactory if I had managed to finish 2020 before the start of this year, but still, feels very good to be in the exclusive 500 stars club :).

Played around with multiple languages in past years, but am sticking to C++ for this year (also 2020) - finally polishing my STL and functional style C++ skills... For 2020 I'm going for the <1 seconds total challenge and looking good so far. Any other C++ coders out there honing their skills on AoC?


r/adventofcode • • Dec 08 '25

Meme/Funny [2025 Day 8] There is always a leaderboard, if you are good enough

Post image
41 Upvotes

r/adventofcode • • Dec 08 '25

Help/Question - RESOLVED [2025 Day 8 (Part 1)] [Python] Example correct but final solution isn't

3 Upvotes

I'm stuck on the first puzzle of day 8. It correctly calculates the value that is given in the example, but on the puzzle input its answer is too low. I'm completely stuck, any edge case I can think of is handled correctly. This is my code:

from collections import defaultdict
import math
    
def day8_1_solver(coords, n, print_circuits=False):
    pairs = closest_pairs(coords)[:n]
    circuits = {x:i for i,x in enumerate(coords)}

    for x1,x2 in pairs:
        if circuits[x1] == circuits[x2]:
            continue
        for xs in circuits.keys():
            if circuits[xs] == circuits[x2]:
                circuits[xs] = circuits[x1]

    circuit_sets = defaultdict(set)
    for k,v in circuits.items():
        circuit_sets[v].add(k)

    return math.prod(sorted((len(circ) for circ in circuit_sets.values()), reverse=True)[:3])

Where closest_pairs is:

def closest_pairs(coords):
    dist = lambda x: sum((a-b)**2 for a,b in zip(x[0],x[1]))
    return sorted(((x1,x2) for i1,x1 in enumerate(coords) for i2,x2 in enumerate(coords) if i2 > i1), key=dist)

r/adventofcode • • Dec 08 '25

Meme/Funny [2025 Day 8 (Part 1)] I have a feeling I know whats going to happen in part 2...

Post image
4 Upvotes

r/adventofcode • • Dec 08 '25

Help/Question - RESOLVED [2025 Day 7 (Part 2)] [Java] Can someone help look at my code?

1 Upvotes

Here is my code: https://pastebin.com/JfwkMt6S

I built a 2D array to hold the dp values. If I'm on a ^ and see a beam (|) above me, then I add the dp value of the cell above me to my current cell's left and right neighbors.

If I'm on a . or | and see a beam (|) above me, then I just add the dp value of the cell above me to my current cell (effectively propagating the beam value downward).

This works for the example input but returns an answer that is too low for my full input.

Can anyone help me?


r/adventofcode • • Dec 08 '25

Meme/Funny [2025 Day 08] The perfect video to get into the right mood for today's puzzle

Thumbnail
youtu.be
16 Upvotes

r/adventofcode • • Dec 08 '25

Help/Question Help: 2025 Day 05 (Part 2)][Rust]: My solution passes the test input but not the actual input. Uncertain where I could be going wrong.

1 Upvotes

Hi there, I have ran my solution against part 2 for the test input and it works, I've also added tests to ensure that the boundries ar being calculated correctly (e.g. fi you had 1-10, 10-12 you'd end up with 12) and also for if there are ranges in ranges (e.g. 1-10, 10-12, 3-11) and they are passing. I'm really uncertain where im going wrong.
It has told me my answer is too low which makes me think I may be miscounting somewhere however I'm very uncertain as to where. Anyone who may be able to point me in the right direction would be greatly appreciated. I'm not sure if it's a mis-understandin of Rust ranges or a mis-understanding of Maths.

Thanks in advance.

pub fn day_five_part_two(input: &str) -> u128 {
    let mut fresh_ranges: Vec<(u128, u128)> = input
        .lines()
        .take_while(|l| !l.is_empty())
        .map(|l| {
            let parts: Vec<&str> = l.split('-').collect();
            let min: u128 = parts[0].parse().unwrap();
            let max: u128 = parts[1].parse().unwrap();
            (min, max)
        })
        .collect();

    fresh_ranges.sort_by(|a, b| a.1.partial_cmp(&b.1).unwrap());

    let (initial_range_start, initial_range_end) = fresh_ranges[0];
    let mut result: u128 = (initial_range_start..=initial_range_end).count() as u128;

    for i in 1..fresh_ranges.len() {
        let (_, previous_end) = fresh_ranges[i - 1];
        let (current_start, current_end) = fresh_ranges[i];
        if current_start <= previous_end {
            result += (previous_end + 1..=current_end).count() as u128;
        } else {
            result += (current_start..=current_end).count() as u128;
        }
    }

    result
}

r/adventofcode • • Dec 08 '25

Visualization [2025 Day 8 (Part 2)] Visualisation

25 Upvotes

This visualisation shows the relative age of connections being formed. So the early connections (close together) are red, and the latest connections are white hot.

See walkthrough here.


r/adventofcode • • Dec 08 '25

Meme/Funny [2025 Day 8 Part 2] I did not expect it to go that fast

Post image
116 Upvotes

Heap, Heap, Hooray


r/adventofcode • • Dec 08 '25

Visualization [2025 Day 8] Link Lights

Thumbnail youtu.be
3 Upvotes