01

Advent of Code

2026/1

Dusty Shed

in C#

by encse

"So, you know how we've been having such bad weather?" The Elf's hat is almost blown off her head as she leads you further into the outskirts of the North Pole complex. "The planes haven't been able to fly for a while, which means we're getting quite low on supplies. If we don't get new parts soon, we won't have time to make all the presents for Christmas!"

She leads you around a corner and toward a building you've never been inside. "Of course, we haven't always used planes." You almost trip over a long piece of metal as she slowly pushes open a rusty door on the side of the building. It takes your vision a few moments to adjust to the darkness; at first, all you can make out is dust and cobwebs.

Visit the website for the full story and full puzzle description.

namespace AdventOfCode.Y2026.Day01;

using System.Linq;

[ProblemName("Dusty Shed")]
class Solution : Solver {

    public object PartOne(string input) => Solve(input, -1);
    public object PartTwo(string input) => Solve(input, 1);

    long Solve(string input, int dir) =>
        input
            .Split("\n")
            .Select(long.Parse)
            .CountBy(x => x)
            .OrderBy(x => dir * x.Value)
            .Take(3)
            .Aggregate(1L, (acc,item) => acc * item.Key);
}

Please ☆ my repo if you like it!

© 2026 | Advent of Code is a registered trademark in the US | Images provided by Bing and Nano Banana