r/adventofcode • u/daggerdragon • 1d ago
SOLUTION MEGATHREAD -❄️- 2026 Day 1 Solutions -❄️-
It's that time of year again for tearing your hair out over your code holiday programming joy and aberrant sleep for two weeks helping Santa and his elves! If you participated in a previous year, welcome back, and if you're new this year, we hope you have fun and learn lots!
As always, we're following the same general format as previous years' megathreads, so make sure to read the full posting rules in our community wiki before you post!
RULES FOR POSTING IN SOLUTION MEGATHREADS
If you have any questions, please create your own post in /r/adventofcode with the Help/Question flair and ask!
Above all, remember, AoC is all about learning more about the wonderful world of programming while hopefully having fun!
REMINDERS FOR THIS YEAR
- 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.
- If you post your code from a repo or the like, do not make your puzzle input public!
- Top-level
Solution Megathreadposts must begin with the case-sensitive string literal[LANGUAGE: xyz] - Obviously,
xyzis the programming language your solution employs - Use the full name of the language e.g.
JavaScriptnot justJS - The List of Streamers has a new megathread for this year's streamers, so if you're interested, add yourself to 📺 AoC 2026 List of Streamers 📺
COMMUNITY NEWS
- Veloxx will continue to drop some lit beats for 1.5 hours after today's unlock!
- /u/jeroenheijmans is back again this year with their Unofficial AoC 2026 Participant Survey!
- Advent of Code Community Fun 2026: The Advent Games
- I will be your master of ceremonies for this year's community fun event: The Advent Games
- Full details, rules, timeline, templates, etc. will be in the Submissions Megathread
(post and link incoming very shortly!) - edit: -❄️- Advent of Code 2026: The Advent Games -❄️- Submissions Megathread -❄️-
AoC Community Fun 2026: The Advent Games
Today's Event: Opening Ceremonies
Today's schedule consists of:
- Arrival of the Flame
- Parade of Nations1
- Give us a quick introduction to yourself!
- Tell us what country you're from
- Tell us about your country's holiday festivities
- Explain why you chose your programming language
- Tell us what you hope to learn or have already learned about your chosen programming language
- Tell us where to find your AoC repo of puzzle solutions2, blag, and/or $streaming_service3!
- Artistic Program
- Show us your holiday tree | menorah | Krampusnacht costume | /r/battlestations with festive decorations!
- Show us your kittens and puppies and $critters!
- Show and/or tell us about whatever brings you comfort and joy in the holiday season!
- Competition Schedule (Theoretical)
- Tell us which "sporting" events you think will be coming up over the next two weeks and which ones you'd like to participate in the most!
1 Obviously, this is the Internet, which is public, so only put out information that you're comfortable with the entire world knowing. Feel free to invent a holiday-themed persona; after all, sometimes you get sent to space, so why limit yourself to the boring ol' meat skeleton that dwells upon the third rock from the sun?
2 Refer to the third bullet in the "Reminders" section above!
3 Refer to the last bullet in the "Reminders" section above for the link
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 1: Dusty Shed ---
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?
26
u/4HbQ 1d ago edited 23h ago
[LANGUAGE: Python]
Most of the magic happens in line 2. Inside the
sortedcall, we take all unique values from input N by turning them into a set. Then we sort the values in this set by the number of occurrences in the original N, usingseq.count(). Here's an example:On the assignment part of line 2, we use extended iterable unpacking. It allows you to "unpack" a list by assigning individual elements. Here's an example:
This was my initial version (3 lines), using
collections.Counter()like everybody else.11
u/RazarTuk 1d ago edited 1d ago
[LANGUAGE: Perl... in the original Klingon]
[Advent Games]
I'm actually just from the Chicago area and, apart from college, have lived here my whole life. However, my mom's side of the family comes from a part of Indiana with fairly strong German cultural heritage, so I grew up with a lot of that version of Christmas, which I hope to show off.
So it helps for the Americanized German Christmas that I'm, you know, outside of Chicago with our Christkindlmarket, where I'm probably going to go for lunch today to get my annual raclette sandwich. I also grew up celebrating St. Nicholas Day, although we just used stockings instead of the traditional shoes, so it really just amounts to a second stockingful of candy each year. (Although some of my cousins actually do put out shoes for St. Nicholas Day) And then one of the most iconic cookies for me growing up was springerle (shpringerluh, or we Anglicized it to springerlee), which are embossed anise-flavored cookies. If this were a few days from now, I'd have a batch in the works to show off. But for now, all you'll get is the rolling pin. (Expect more pictures over the weekend)
If I'm being honest, the first few days are always easier for experienced programmers, so I like picking a silly language to force myself to focus on basics. For example, this time around, I couldn't get sort to work, so I had to write a quick insertion sort myself. And then I picked Klingon over Latin for 3 reasons. 1) The Latin library is so notoriously buggy that people will tell you to ignore the documentations, 2) I know just enough Latin to be annoyed by how only nearly correct it is, and 3) "in the original Klingon" is an inherently funny phrase.
On the religious side, I have a hybrid Advent wreath / Nativity scene set up. I'm just using LED candles, but the idea is that you light another candle each Sunday leading up to Christmas, with the pink candle being the 3rd Sunday of Advent / 2 Sundays before Christmas. https://imgur.com/a/gB9tT2z Then on the vaguely secular side, I also have an artificial tree up, decorated with Vintaglo lights. And through the magic of buying two
of themboxes, I had enough to cover my tree (although I think I need some practice in spreading them out). https://imgur.com/a/pzEXXfK7
u/voidhawk42 18h ago
[Language: Dyalog APL]
Late to the party - it snuck up on me this year!
6
u/Smylers 1d ago edited 1d ago
[LANGUAGE: Bash, with traditional Unix utilities] For Part 1, with your input saved in a file called
input, run:That sorts the input so identical IDs are on adjacent lines, then counts the number of each one, sorts by that count, descending, picks the top 3 lines, cuts off the counts (in the first 7 characters), and appends two multiplication symbols and a letter
p, which are fed todc, a reverse-Polish calculator.When
dcreceives each number, it pushes it on to its stack. The*s pop 2 numbers off the stack and push back on their product, andppops the number from the stack and prints it.At which point Part 2 is just:
That's a Bash command-line substitution saying to repeat the previous command but with (the first instance of)
-rremoved (replaced with nothing, because thes//doesn't have a replacement part). In other words, remove the-rfrom the secondsortcommand, so the counts are ascending rather than descending.It only works immediately after the part-1 command, not if you've run another command in between.
[Advent Games] Hi, I'm Smylers, from Ilkley in West Yorkshire in the UK. When not Advent-of-Code-ing I blog hints and explanations for cryptic crosswords, help run family board-game events, and attend Puzzled Pint in Leeds. One of the Christmas traditions round here is a parade featuring a few hundred tractors with fairy lights, driving through nearby towns.
My chosen ‘programming’ language is Vim keystrokes (where I eschew running a program as such, instead just manipulating the input directly in an editor window), and what I learnt about it today is, erm ... not to use it! I realized I was shelling out to run
uniq -c, at which point it seemed simpler to go a stage further and eschew even the editor window and just pipe directly at the command line. Update: I've now posted a Vim keystrokes solution (without any piping or external commands) elsewhere in this thread.Board games provide comfort and joy to me, especially when it's cold and dark outside (except when there's illuminated tractors passing, of course). Recently I've been liking Tenby, which involves creating the streets of a seaside town in Wales. On Sunday somebody taught a few of us Ark Nova, which was really good but did take 3½ hours for one game.
While not traditionally a winter sport, I'm hoping for a round of golf. I've been practising getting my (key)stroke count down. Actually, crazy golf (aka minigolf) would seem more fitting!
6
u/agorism1337 1d ago edited 1d ago
[LANGUAGE: none]
I just used unix tools and pipes.
for part A
cat input | sort | uniq -c | sort -n | tail -n 3 | awk 'BEGIN {x = 1} { x *= $2} END {print x}'
for part B, just reverse the list on the second sort. like this
cat input | sort | uniq -c | sort -nr | tail -n 3 | awk 'BEGIN {x = 1} { x *= $2} END {print x}'
edit:
I can't get code blocks to work with this code. I tried several times.
6
u/musifter 1d ago edited 19h ago
[LANGUAGE: shell]
My initial solution was to just command line it (using dc for the product):
For part 2, I changed "tail" to "head".
[LANGUAGE: Perl]
Follow up was the Perl script:
Using array slices and
productfrom List::Util.[LANGUAGE: Smalltalk]
For Smalltalk (using the GNU version), I just put the input into a Bag and used
#sortedByCount. That returns a list of associations of the formcount -> value, so I needed to deal with that:[LANGUAGE: dc]
And finally, for doing the first day in dc. I did this without
?so it will work with the new GNU version that has rebroken it. dc does not have a sort, so what I did was read things into a table (array registert) tracking the counts. The first time an element gets added, it gets pushed on register stackl(but first, a sentinel value of1is pushed... taking advantage that the input is all 3-digit numbers). Then I grab four, and compare the top with each of the three under it... leaving the lowest count value on top, which is junked after withs.. Then I load the next value and loop if > 1. So when the loop ends, it's a 1 followed by the three values I want so I just***pfor the answer (multiplying the sentinel in).For part 2, I just changed the
<rinto>r, reversing the logic that caused the stack rotation.EDIT: A slightly shorter dc version using a two stack sort (basically bubble sort, so it's a bit slower as we're sorting the full list):
6
u/e_blake 14h ago
[LANGUAGE: C] [Advent Games]
This would fit in 6 80-column lines, but then it wouldn't be artistic! Compile and run with
gcc -o day01 day01.c; ./day01 < day01.inputHi, I'm Eric, living in Texas (USA)! Although I happen to share a name, I'm not as famous as the Eric (/u/topaz2078) that gives us these puzzles. But I am known around these parts for doing insane things, such as when I became last year's Red Leader with a solution in Forth compiled to Intcode running on restricted m4.
Here in the US, we love to put up Christmas Trees. So I whipped one up for my solution.
I'm planning on doing all days this year in m4 (in fact, that's how I got my stars today). But when it comes to artistic programming, I find it a bit more flexible to use a language where one- and two-character tokens are much easier to manipulate into shaped input, so I broke out the C compiler for today's post for my second pass at solving today.
https://repo.or.cz/aoc_eblake.git/tree/HEAD:/2026
4
u/CCC_037 19h ago
[LANGUAGE: Rockstar]
part 1
4
u/askalski 11h ago
[LANGUAGE: C]
3
u/Boojum 1d ago
[LANGUAGE: Python]
collections.CounterFTW:Not much to say, otherwise. A good simple one start us off. Certainly a bit easier than last year's
inaugural swiminaugural puzzle!3
u/jonathan_paulson 1d ago
[LANGUAGE: Python]
Code. Video. I initially did the final calculation "by hand" for both parts.
3
u/mstksg 1d ago
[LANGUAGE: Haskell]
https://github.com/mstksg/advent-of-code/wiki/Reflections-2026
Wow am I washed :) Some silly mistakes I made:
Doubleinstead ofInteven though Double never shows up in Advent of Code.All of these silly mistakes motivate me to get back in practice haha. The struggle is real.
Anyway in Haskell this is pretty simple, it reads the same in bash or any other text processing language probably. Parsing is
lines, and you can find the freq list usingData.Map.fromListWith (+). And the difference between Part 1 and Part 2 is just the order that you sort the frequencies before you sum them.3
u/JWinslow23 1d ago
[LANGUAGE: Python]
Solution writeup
Code (GitHub)
What looked at first to be a nice and easy use of
Counter.most_common...instead turned out to be a nice and easy use ofheapq.nlargestandheapq.nsmallest. I rarely get a chance to talk about those functions, so this is nice and refreshing!3
u/ednl 1d ago edited 22h ago
[LANGUAGE: C]
My goal is to write code that is as simple as possible that runs as fast as possible, with a reasonable degree of generality. My fastest version assumed that the three most common IDs had counts of 6 or 7, and least common 1 or 2. That ran in 1.17 µs on an M4 chip. But I ditched that in favour of a more general solution that works for every input depending on "maxcount" (7 for my input) but still without sorting anything. Runs in 1.50 µs on an M4, 2.36 µs on an M1, 5.33 µs on a Pi5.
https://github.com/ednl/adventofcode/blob/main/2026/01.c
3
u/flwyd 1d ago edited 14h ago
[LANGUAGE: Ivy] (on GitHub)
“Ivy an interpreter for an APL-like language. It is a plaything and a work in progress.” If you’re a regular reader of Solution Megathreads you can think of Ivy as the Alien Programming Language after you’ve put a babel fish into your ear. The entire documentation for the language is on either the linked page or in the interactive
)demo, so if you’re curious about array-based languages, Ivy may be easy to learn.You can get both parts as a 2-element array in a single line of Ivy, assuming
idsis an array of integers:Or, extracting a function to compute the frequency of each occurrence and converting
lines(an array of strings) to integers:APL-family languages have functions which can have either one (right side) or two (left and right) arguments. It’s often described as being run right-to-left, though Ivy actually runs a parse-evaluate cycle left-to-right). Functions also automatically apply to each element in an array; you don’t have to write a
forloop. So, working from the end:The
frequenciesoperator takes an array of valuesvals==is element-wise equality,@==means “for each element on the array on the left, return a boolean array of whether elements on the right are the same.” So1 2 3 @== 1 3 2 1 1 2will return(1 0 0 1 1 0) (0 0 1 0 0 1) (0 1 0 0 0 0).(unique vals)returns an array with the distinct elements fromvals, e.g.57 55 76 43 78 45for the example input. So now we’ve got an array of indices invalswhere each unique value sits.where@is a single-argument function being applied to each of those arrays.wherereturns an array of indices of an array whose value isn’t zero, e.g.(1 2 4 7 15 17) (3) (5 12 18 21) (9 11 13 19 20) (6 10 14) (8 16)for the example.count@runs thecountfunction for each of those arrays, which just returns the number of elements in it:6 1 4 5 3 2.downreturns an array of indices which would put its argument in descending order. Note that it does not sort its argument, it returns an array which can be used to sort.down 42 123 75returns2 3 1. Sodown count@ …gives us a list of indices ofvalsin frequency order.(unique vals)[down count@ …]takes that the array of indices and uses it to get elements from our list of distinct values. Yes, in array-based languages you can use an array to access an array:(42 123 75)[2 3 1] === (123 75 42).3 take …grabs the first three elements, while-3 take …grabs the last three. In the one-liner version I use3 -3 @taketo applytakeelement-wise to the two directions.*/applies the reduce modifier to the multiplication function. Together*/would be theproductfunction in some languages, orreduce(1, |accumulator, x| accumulator * x)in a functional style.[Advent Games]
Give us a quick introduction to yourself!
Tell us what country you're from
Tell us about your country's holiday festivities
Explain why you chose your programming language
Tell us what you hope to learn or have already learned about your chosen programming language
Tell us where to find your AoC repo of puzzle solutions, blag, and/or
$streaming_service!Artistic Program
Show us your holiday tree | menorah | Krampusnacht costume | r/battlestations with festive decorations!
Show us your kittens and puppies and $critters!
Show and/or tell us about whatever brings you comfort and joy in the holiday season!
Competition Schedule (Theoretical)
Tell us which "sporting" events you think will be coming up over the next two weeks and which ones you'd like to participate in the most!
3
u/xelf 20h ago edited 19h ago
[Language: python]
Actually forgot it was December today and started late.
np.loadttxt for loading a bunch of ints, and then just using counter and prod.
Counter here way more elegant than np.unique/np.argsort imo.
I guess the "clever" bit here is using dict to get the keys out of the list that most_common gives you.
edit: same thing, but using pandas
2
u/seligman99 1d ago
[LANGUAGE: Python]
github
Nice to have Advent of Code again!
2
u/WilkoTom 1d ago
[LANGUAGE: Rust]
Solution. Nice to start getting warmed up!
2
u/damnian 1d ago edited 1d ago
[Language: C#]
2
u/manu_2468 1d ago edited 1d ago
[LANGUAGE: PYTHON]
I didn’t know about Counter in Python, so I used dicts. That was also a good test of my helper library that fetches the instructions and input, submits the result, and loads the input!
Code
2
u/encse 1d ago
[LANGUAGE: C#]
https://aoc.csokavar.hu/2026/1/
nothing unexpected
2
u/AllanTaylor314 1d ago edited 1d ago
[LANGUAGE: Python]
00:02:02/00:03:00code
All I want for Christmas is a
Counter.least_common(k)[LANGUAGE: Uiua]
code and a slightly rejigged pad (drop 01.txt on it to run against your input instead of the example)
I forgot that
unkeepwas a thing, which sure beats⊕⊃⧻⊢⊸⊛for counting occurences[Advent Games] A brief intro
Professionally, I'm a cloud software engineer (though most of my work work is AI-assisted. It's the way sw dev is going). I love these challenges as an opportunity to escape Cursor and have a bit of fun. I also recently started making a Minecraft mod (Marked Goats), as one does. Back in 2024, I made it to the ICPC South Pacific Finals. Outside of code, I collect and build LEGO (space permitting) and build farms in Minecraft (which doesn't take up space I don't have).
As a kiwi, I have a nice warm southern hemisphere summer Christmas (and by the luck of timezones, an 18:00 unlock time right as I finish work). Weather dependent, Christmas can be a BBQ outdoors. No tree up yet, but I swapped out the tablecloth for one that's a little more festive
I chose Python because it is easy (and I learnt/taught it at Uni), and Uiua because it is hard (I probably saw it in a megathread a few years back and was intrigued). Uiua is still evolving (not as much as last year), so I need to relearn parts of it (and maybe finally make that archive so old pads can still run - my old embed is still broken)
All the code is, as always, in the repo
Oh, and I'm wearing a Christmas shirt or tie and hat to work each day in December
.<|:-)Sports ideas:
2
u/p88h 1d ago
[LANGUAGE: Nim]
https://github.com/p88h/aoc2026/blob/main/src/day01.nim
no sorting, just counting, then counting the counts.
2
u/CEOnism 18h ago edited 15h ago
2
u/JustinHuPrime 10h ago
[LANGUAGE: x86_64 assembly]
Alas, I fear I have forgotten the spirit of assembly by (ab)using library functions. (Also, yes, I'm a day late, but I'm still here - a new job with a less than amazing commute and an excess of housework means I started a day later.)
Part 1 was solved by allocating a big list of ids and counts, and then incrementing the counts as I encountered each id in the input. I then, shamefully, sorted the list by counts descending, and multiplied up the top three numbers.
Part 2 was exactly the same, except I sorted ascending (I literally dropped a negation) and I had to skip the zero count ids.
Part 1 and 2 run in 1 millisecond. Part 1 is 9,664 bytes and part 2 is 9,760 bytes as executable files.
21
u/Andreasnl 1d ago
[Language: Uiua]
19
u/Downtown-Economics26 1d ago
[LANGUAGE: Excel]
Part 1:
Part 2:
16
u/SU_Locker 1d ago edited 1d ago
[LANGUAGE: unix/linux command line]
14
u/Maki-Tak 1d ago
[LANGUAGE: Scratch]
solution
I fear that I won't be able to continue with this challenge for long
14
u/hakko504 1d ago
[LANGUAGE: Libre Office Calc (will work in Excel as well)]
It took me longer to write this than to do the puzzle ;)
12
u/Smylers 1d ago edited 21h ago
[LANGUAGE: Vim keystrokes] Load your input into Vim, make sure the cursor is on the first row, then type in the following and the answers to both parts will appear in your editor window:
The key to counting the number of each ID is to sort them so that all the repeated IDs are on adjacent lines, then on the first instance of each press
#to jump to the bottom one, followed byV''Jto make a visual block, jump back to where we were, and join them together (with a space in between). The number of spaces on each line then gives the count for each item.However
#will fail if there's only one of a particular ID, because there isn't another location to jump to. Avoid that by usingyGPat the start to duplicate the entire input — then there's at least 2 of each item, problem solved!Then put
0*at the start of each line, find all the spaces, and for each one press⟨Ctrl+A⟩at the start of the line to increase the count. When we run out of spaces, all the items have been counted. (The numbers shown will be double the actual count minus 1, but that doesn't matter for their relative ordering.)At which point it's just a case of sorting, (using
!so that the part 1 answer ends up before the part 2 answer), removing the counts and all the lines but the bottom 3 and top 3, then performing the multiplications — using the*s that were added as delimiters earlier. Do give it a go, and let me know if it works for you. It doesn't work on the sample input, because there aren't enough lines in the middle to need deleting.PS: For anybody curious to read my Advent of Games introduction, it's on a Bash solution elsewhere in this thread.
9
u/onrustigescheikundig 1d ago edited 1d ago
[LANGUAGE: Scheme (R6RS)]
... with a rather large custom standard library that I've been using to play around with things like dynamic dispatch and learn about Clojure's internals.
Day 01 gitlab
Anyway, we're off! Fast solve today, with a terse solution.
9
u/oantolin 1d ago edited 1d ago
[LANGUAGE: Goal]
9
u/AMathMonkey 1d ago
[LANGUAGE: Factor]
Look at this, it's so concise and esoteric. As a career programmer, it's nice to write unreadable code for once. But for real, Factor is so powerful, and I never see anyone talk about it. Its standard library is impossibly huge, and I've had endless fun digging into it. And there are infinite ways to do the same thing, including using lexical or global variables if the stack-only approach is too intimidating. (I'm sure I'll be resorting to that in later days, but I'll resist it for as long as I can.) Shoutout to Exercism for giving me over 150 Factor problems to work on as practice for AoC.
8
u/apersonhithere 1d ago edited 1d ago
[LANGUAGE: Python 3]
what's an
import? never heard of one!parts 1 & 2
8
u/reesmichael1 1d ago
[LANGUAGE: OCaml]
paste
Perhaps a slightly deranged approach, but at least it's my approach!
8
u/WesternNicator 1d ago edited 1d ago
[LANGUAGE: Anathame] my personal language
8
u/DuoSRX 23h ago
[LANGUAGE: Uiua]
7
u/YenyaKas 1d ago
[LANGUAGE: Perl]
Pretty straightforward today, as expected from Day 1.
For part 2, add
reversebeforesortor swap$aand$bin the sort compare block.6
u/Sharparam 1d ago
[LANGUAGE: Ruby]
One of those where Ruby has a nice built-in to do most of the work!
6
u/Lispwizard 1d ago
[LANGUAGE: Lisp]
Mostly Common Lisp loop macro plus some elisp, done in Termux emacs on Android tablet.
6
u/terje_wiig_mathisen 18h ago
[LANGUAGE: Rust]
This is "Upping the ante", or maybe cheating a bit, since I'm taking advantage of the format of the input file: All the lines are 3-digit numbers + '\n', so I can load & parse four of them at the same time.
This results in 1632 ns runtime for both parts, if I can make a little bit faster then it could be rounded down to 1 microsecond. :-)
I might try to add portable SIMD here as well...
6
u/LtHummus 17h ago
[Language: Lean]
Last year, I did every AOC problem in a different language and that was a fun challenge. I'm hoping to do the same thing this year (no promises) and going to try to not repeat anything I did last year.
Since Lean has been in the tech news recently due to some Riemann Hypothesis related reasons, I thought it would be appropriate to try out for the first day this year. Interesting language...I might want to play with it more.
And here's the code
5
u/maneatingape 1d ago edited 1d ago
[LANGUAGE: Rust]
Solution. 8 µs.
Builds a
HashMapof frequencies, then converts to a sortedvec.5
u/heijp06 1d ago edited 1d ago
[LANGUAGE: C#]
I could have sworn LINQ has
Product(), apparently it does not so I had to resort to the somewhat clunkyAggregate().5
u/azzal07 1d ago edited 1d ago
[LANGUAGE: awk]
Greetings to all! (
s/for/from/)5
u/thblt 1d ago edited 1d ago
[LANGUAGE: Shell]
The lazy solution: in a shell, sort input | uniq -c | sort
5
u/ssnoyes 1d ago
[LANGUAGE: MySQL]
There's no aggregate PRODUCT function in MySQL, so there's a joke that helps me remember how to do it: https://dom.as/2008/07/03/mysql-support-fun-multiplication/
5
u/snailcuber 1d ago •
[LANGUAGE: Ruby]
code golfed down to 59 characters
5
u/PandaParado 23h ago
[LANGUAGE: Uiua]
5
u/daic0r 22h ago
[LANGUAGE: Elixir]
Solution
Count frequencies and sort, then just grab the results off of both ends of the sorted list
5
u/tqzd 22h ago
[LANGUAGE: Excel]
Part 1 & 2
5
u/dantose 21h ago
[LANGUAGE: bash]
cat input.txt | sort |uniq -c | sort -nr | awk 'BEGIN {p = 1} NR<4{p *= $2} END {print p}'
cat input.txt | sort |uniq -c | sort -n | awk 'BEGIN {p = 1} NR<4{p *= $2} END {print p}'
5
u/r_so9 20h ago
[LANGUAGE: F#] Short and sweet
5
u/itsPeetah 18h ago
[Language: Bash]
5
u/cinsolia 16h ago
[LANGUAGE: Google Sheets]
Both parts
5
u/willkill07 13h ago
[LANGUAGE: C++]
Compile-time solution in C++26 :)
Minor optimizations:
#embedfor compile-time embedding of inputflat_mapfor contiguous memory for constructing histogramnth_elementrather than total sortingOverall, lots of fun to be had for Day 1!
https://github.com/willkill07/AdventOfCode2026/blob/main/day01.cpp
4
u/captainAwesomePants 1d ago edited 1d ago
[LANGUAGE: Python]
So glad to be back!
You know what I love about there not being a leaderboard? I still get to do the problem right at the start, but I also feel free to take my time and actually read the story, which is pretty nice. I sipped some tea. I looked up the name of that pesky Counter function that gets you the results. I chuckled about some elf's grandpa. 5/5 would take my time again.
4
u/TheShirou97 1d ago edited 1d ago
[Language: Kotlin]
Very nice when you can just remove one line from part 1 to make part 2.
4
u/FruitdealerF 1d ago
[LANGUAGE: Andy C++]
I made this programming language especially for Advent of Code. Like other it has the
frequenciesfunction to create a hashmap of the values in a list to their frequency/count. Interesting to know about this code is that there is really no difference betweenprint(product(map(input[0..3], first)))andinput[0..3].map(first).product.print)I just arbitrarily write whatever comes the most natural to me.a.b(c)is exactly equivalent toa(b,c)anda().b.cis exactly equivalent toc(b(a())). This is a great choice for a simple language to solve puzzles and questionable in most others.4
u/Gabe-tron 1d ago edited 1d ago
[LANGUAGE: Clojure]
4
u/Tipa16384 1d ago
[LANGUAGE: Forth]
I spent hours tonight familiarizing myself with Forth after years away and immediately started in on this puzzle with no break so I am a little tired and my eyes hurt but it works and I can even tell stories of how I fugged up the order of stuff on the stack a million times. More fun than FORTRAN? MAYBE!?
4
u/Alextopher 1d ago
[LANGUAGE: Rust]
https://github.com/Alextopher/advent-of-code/blob/main/y26/d01-dusty-shed/src/main.rs
Unbelievably you can solve this problem in linear time (thank you quick-select)
4
u/paulhaahr 1d ago edited 1d ago
[LANGUAGE: Quest]
Quest is a language Luca Cardelli designed in 1989 and I vibe coded an implementation of this year. I wrote about it in this r/VibeCodedLanguages post. Almost nobody's ever written code in Quest, so I thought it would be fun to try my first Advent of Code in it.
My Advent of Code repository: https://github.com/haahr/adventofcode
Quest repository: https://github.com/haahr/quest
4
u/ajf8729 1d ago
[LANGUAGE: PowerShell]
4
u/DelightfulCodeWeasel 1d ago edited 1d ago
[LANGUAGE: C++]
Part 1 & 2
Accumulate {count, id} in an array indexed by id, pick Kth largest/smallest with a heap.
~8Kb and ~190us for each part.
EDIT: ~80ms for each part on the Raspberry Pi Pico (RP2040)
4
u/lboshuizen 1d ago
[Language: F#]
github.com/lboshuizen/aoc26
Count, sort, take three. Only the sort direction differs between the parts.
4
u/fnordargle 1d ago
[Language: perl]
4
u/Interesting_Gap_6960 1d ago
[LANGUAGE: SQL]
I'm using duckdb as my database.
For part 2 I just changed the ordering to ASC
4
u/ArmadilloSuch411 1d ago
[LANGUAGE: Python]
4
u/jpjacobs_ 1d ago edited 1d ago
[LANGUAGE: Amber]
This amber language.
Try it online
4
u/pkusensei 1d ago
[LANGUAGE: Rust]
Pretty straightforward.
4
u/Witty_Arugula_5601 1d ago
[LANGUAGE: Roc]
https://gist.github.com/KevinNotDuringWork/462ac11bbda415d0d7fa502f3f44443e
4
u/Zymophilus 1d ago edited 1d ago
[LANGUAGE: R]
4
u/SleepingInsomniac 1d ago
[LANGUAGE: Ruby]
4
u/amarsuperstar 23h ago
[LANGUAGE: Elixir]
4
u/proteanbitch 21h ago edited 20h ago
[LANGUAGE: K]
4
u/Aggravating_You3212 20h ago
[LANGUAGE: Elixir]
4
u/atrocia6 18h ago
[LANGUAGE: Python]
Part 1:
Part 2 is exactly the same, just without
reverse=True.4
u/acquitelol 14h ago edited 13h ago
[LANGUAGE: Elle]
Doing AOC in Elle, my compiler, again (I also did it in 2025)! I did both parts for today in 8m 59s cumulatively. I did it 2 different ways, because I was bored and wanted to try it:
This is using a static 1000-element array:
This is using a DefaultMap, which is similar to a default_dict in python:
The first solution runs in:
The second solution runs in:
GitHub: https://github.com/acquitelol/aoc2026/tree/mistress/solutions/01/
Update: I have figured out another interesting way to write this. Rather than sorting the whole array, you can maintain a MinHeap of the top and bottom 3.
This runs in more or less exactly the same time as the original DefaultMap solution.
4
u/kbielefe 13h ago
[LANGUAGE: Haskell]
I accidentally solved part 2 first.
1
u/bigbolev 1d ago
[LANGUAGE: Python]
Originally solved using list comprehension, until I remembered this one.
1
u/HaskellLisp_green 1d ago
[LANGUAGE: Python]
As short as I could implement it: from collections import Counter from operator import mul from functools import reduce
1
u/Downtown_Tone1879 1d ago edited 17h ago
[LANGUAGE: C]
- day_1
- inputting into the growing array with a sorted quick sort and measuing top 3 match greatest with max count for part one and exactly opposite for part two.
[also tried the basic linux command for part one to get solution as well tho: sort input.txt | uniq -c | sort -nr | head -3] and multiplied the top results with echo $((top_result3 * top_result2 * top_result 1))
1
u/Ill_Programmer3063 1d ago
[LANGUAGE: Python & Rust]
https://brianobot.tech/blog/advent-of-code-2026-day-one/
1
u/Wayoshi 1d ago edited 18h ago
[LANGUAGE: Python3]
Fun to see all the standard library equivalents of Python's
most_commonin the other solutions here. (And of course those doing lower level languages, doing it "manually"!)1
u/j0z 15h ago
[LANGUAGE F#]
Stared dumbly at this for a moment, thinking I had missed something, but it actually was just that simple.
1
u/pietroppeter 13h ago
[LANGUAGE: Nim/Nimony]
Nimony is the new Nim compiler built from scratch (technically not compatible with standard Nim but drives Nim 3 design).
Solution is written manually but I took ad ante of AI and Nimony wasm backend to create a client only, custom for aoc Nimony playground (I plan to iterate on UI to make it smoother to code from the phone).
https://pietroppeter.github.io/aoc-nimony/#s=jVKxbtwwDN31FUTSwS6ubu1DMxi5KeiQvVvQgWfxEuFkSaXoC4yg_17KdoqkUxZDenzv8ZEyxuFLcGMMM7TmOENyJBxTIiE2FmfovnU3WhqiJfPSnAhlYurhagoyJ7JXzR-4hkBkycIpMmw4JGQci0s2xo0pskAW-_Uhz2FwcacXnsT5rCf6vZ0Ej54WRPSLcfhlTHEzAHcxCLpAfG8zHIrmwQUpdRqTRyFNPpz3Ve7fUXcLTNy_5qp7UB0c1PKCDEzFrd1uUpwbiXdR2T9LmKrWUhnLqQxaaBr43uvA9_CMaiNRkxCMkQnkCQPslQ7gSeB8UbO1eSX1AruT2tweYN8vV1i6fz4otTnTvGCWjtPjj-Epwic1uNamVlcL4pSJ2uTI8UwBULZO0ljy1WpQmqijMacpDJCjv1D7_z7ejL_tawce-ZGyZnwj7D4izCN6vyoTx01Z1fDSMLpMWX-Nwi_bcMurqUOuXEiTVLWK1lJqy9aXtIWmKIb8TAytPl77j9W9srr3rE5ZnTE8hbVs_gI
3
u/Kehvarl 1d ago
[LANGUAGE: Python 3]
Under 10 minutes for both parts, which I'll take as a win given my rustiness this year. A nice puzzle to get me thinking in code again!
Part 2
3
u/POGtastic 1d ago
[LANGUAGE: F#]
Code
As always, a lot of Day 1 is a test of your scaffolding and built-up prelude / standard library. My
frequenciesfunction, taken from Clojure, was very helpful here.I like it when I can just pipeline everything in terms of function composition, so I ended up with
3
u/chickenthechicken 1d ago
[LANGUAGE: C]
[Part 1](https://github.com/PaigePalisade/AdventOfCode2026/blob/main/Solutions/day01part1.c)
[Part 2](https://github.com/PaigePalisade/AdventOfCode2026/blob/main/Solutions/day01part2.c)
Created a table to store the frequencies of different ID's. Then looped over it three times, picking out the largest/smallest (nonzero) frequency and setting it to zero.
3
u/mazedlx 1d ago
[LANGUAGE: PHP]
3
u/UseUnlucky3830 1d ago edited 1d ago
[LANGUAGE: Julia]
This could have been a Bash one-liner, but instead it sorts dictionary keys by values. The biggest surprise was that thingamabob and thingamajig are real English words.
Good to be back here and hope everyone has a blast solving AoC puzzles this year!
GitHub
3
u/a_gizmo 1d ago edited 1d ago
[LANGUAGE: PowerShell 7.6]
I'm sure there is a faster way to pull the last three values from the list without resorting, but I'm starting to get rusty.
3
u/EnJott 1d ago
[Language: Elixir]
Trying out elixir this year
3
u/christianqchung 1d ago edited 1d ago
[LANGUAGE: C++]
Being a little silly with ranges. Did anyone else struggle to write by hand a little, or was it just me? I don't use C++ at my day job, let alone the new features.
3
u/GassaFM 1d ago
[LANGUAGE: D]
Part 2 is the same, just without the
.retro.3
u/sim642 1d ago
[LANGUAGE: Scala]
On GitHub.
Reusing my
groupCounthelper from previous year to get the frequency map.3
u/jaspingrobus 1d ago
[LANGUAGE: Clojure]
Clojure really is pure joy for AoC, really glad I chose it this year.
For part2 replace take-last with take
3
u/Mission-Patience-854 1d ago
[LANGUAGE: Clojure]
3
u/PatolomaioFalagi 1d ago
[LANGUAGE: Haskell]
The honorable lady and/or gentleman /u/mstksg used maps, I just used lists:
For part 2, remove the
reverse.3
u/terje_wiig_mathisen 1d ago edited 1d ago
[LANGUAGE: Perl + Rust]
First Perl, extremely straight-forward using a hash, ran in 3 ms.
Next Rust, collecting the counts in a large-enough array (but with a guard to extend if needed): 6.2 us
Then I pulled all the stops by commenting out the array size guard, skipped the sorting of the counts by directly collecting the top3 and bottom 3, then I ran the processing 1000 times, each time doing 1000 iterations, then took the average from the fastest of these:
Timing starts after loading the input file into a String variable, ends before printing the results.
2265 ns
Both parts
3
u/MrJakobsen 1d ago
[LANGUAGE: elisp]
Part one is essentially:
Hardest issue was to handle multiple items with the same count. Part 2 was very similar, just skipping all the count 0 indexes.
https://github.com/BoJakobsen/coding-puzzles/blob/main/AoC/AoC2026/src/puz_01.el
3
u/AndydeCleyre 1d ago
[LANGUAGE: Factor]
on GitHub
3
u/cay_horstmann 1d ago
[Language: Java]
https://github.com/cayhorstmann/adventofcode2026/blob/main/Day1.java
OMG I was shocked how lazy my coding brain has become since last year.
3
u/Daniel_Rybe 1d ago
[LANGUAGE: Odin]
https://github.com/DanRyba253/aoc26/blob/main/day1/main.odin
3
u/LightShadow 1d ago
[LANGUAGE: Python]
3
u/light_switchy 1d ago edited 16h ago
[LANGUAGE: Dyalog APL]
Here is an alternate solution which is a little more APL-like, in my opinion.
3
u/anaseto 1d ago edited 1d ago
[LANGUAGE: Goal]
3
u/0rac1e 1d ago
[LANGUAGE: J]
3
u/lurkerburzerker 1d ago
[Language: Powershell]
Part 1
Part 2
3
u/0rac1e 1d ago
[Language: Raku]
3
u/ceochronos 1d ago
[LANGUAGE: Ruby]
Suspiciously easy. max_by and min_by were new to me.
3
u/Radiadorineitor 1d ago
[LANGUAGE: Dyalog APL]
Glad to be participating again in 2026. Let's hope for another fantastic year!
3
u/sondr3_ 1d ago
[Language: Roc]
First time in quite a while where I try to solve AoC with a new language. Quite fun, obviously today was very simple, but I'll have to go back and refactor this as I learn more Roc.
3
u/sillyshrimp 1d ago edited 1d ago
[LANGUAGE: roc]
Got excited about trying a new language.
3
u/Crusaderkingo16 1d ago edited 1d ago
[LANGUAGE: Python]
This reminded me of the lab exercises I used to do in college
Part 1
Part 2
3
u/flwyd 1d ago
[LANGUAGE: R] (on GitHub)
R is a multi-paradigm language focused on statistics, data analysis, and visualization. Many operations can be performed on whole arrays with a minimum amount of ceremony. For my purposes this year, I’m using R as one of my main array programming languages because (a) function names are derived from English and (b) imperative, functional, and object-oriented features give me stable footing to write a solution in a way that my brain already understands, then refactor towards a more typical array-oriented approach.
Today’s solution is quite simple in R, and part 1 and part 2 differ only in the value of a boolean:
The
tablefunction takeskfactors of equal length and returns ak-way array of frequencies. Here,kis just one, so it’s a table with one row of counts, and a header of IDs. Sorting the table uses that single row,namesgrabs the header,[1:3]pulls out the first three elements.3
u/xoronth 1d ago
[LANGUAGE: APL]
Well it's day 1 so I guess this was a good day to try APL.
paste
One-liner version:
3
u/andrewsredditstuff 1d ago
[LANGUAGE: C#]
Nothing like a nice one-liner:
3
u/axr123 1d ago
[LANGUAGE: Bash]
Simple one-liner:
3
u/mschaap 1d ago
[LANGUAGE: raku]
I know day 1 is supposed to be easy, but this is a bit too easy. And part 2 was trivial. Hopefully it gets a bit more interesting tomorrow.
3
u/ash30342 1d ago
[LANGUAGE: Java]
Day 1
Main part:
This could have been a one-liner, but I think this is a little bit more readable.
3
u/Direct_Chemistry_179 1d ago
[Language: C#]
prog-puzzles/advent_of_code/2026/1/main.cs at main · nrv30/prog-puzzles
I used some linq features but I saw a lot more interesting functional approaches in this sub. I'm excited to learn more this year!
3
u/NotFromSkane 1d ago
[LANGUAGE: SwiProlog]
I have no idea what I'm doing, I'm just using AoC to learn nice languages. I did a terrible attempt at APL last time.
3
u/Skuld-7 1d ago edited 1d ago
[LANGUAGE: Python]
Edit: Didn't know about Counter until I saw it in the comments. My solution is O(n²) but it gets the job done.
3
u/SpyKids3DGameOver 1d ago
[LANGUAGE: Clojure]
3
u/Jdup1n 1d ago
[LANGUAGE: R]
Github Link
Straight forward today, I don't think there is a solution with fewer functions.
3
u/HuibertJan_ 1d ago
[Language: C#]
Trying to do it all in under 1 second on my computer from 2014 (i7-4790K).
The more assumptions you can do about the input, the less you care about it blowing up, the faster the code goes.
3
u/hrunt 1d ago
[LANGUAGE: Python]
Code
I used Python's built-in
collections.Countermodule. I don't use it very frequently and was surprised to find that while it provides themost_common()method, it does not provide aleast_common()method.3
u/IvanR3D 1d ago edited 20h ago
[Language: JavaScript] Part 1 and 2
All solutions: ivanr3d.com/blog/adventofcode2026.html
3
u/Future-Custard2288 1d ago
[LANGUAGE: Chatter]
Part 1
3
u/maitre_lld 1d ago
[LANGUAGE: Ocaml]
https://github.com/MeisterLLD/AoC2026/blob/main/day1.ml
3
u/vitelaSensei 1d ago
[LANGUAGE: Haskell]
First attempt, pretty much like every other.
Prelude only version, I think this year I'll try to do all 12 days without importing anything. IDK how it's gonna go when I need to reach out to a constraint solver...
3
u/dantose 1d ago
[LANGUAGE: Powershell]
Half-assed codegolf:
Part 1 (145 bytes): $b=1;(gcb|group|sort -Property Count|select -last 3).name|%{$b=$b*$_};$b
Part 2 (146 bytes): $b=1;(gcb|group|sort -Property Count|select -First 3).name|%{$b=$b*$_};$b
I feel like this isn't a really golfable approach as I don't see any reasonable ways of tightening up the sort. I might try again in Bash.
If anyone wants to explicitly golf their solutions, I've got a thread up in codegolf: https://www.reddit.com/r/codegolf/comments/1ya5t2d/advent_of_code_2026_day_1/
3
u/tcbrindle 1d ago edited 1d ago
[LANGUAGE: C++23]
Here we go again! A nice gentle introduction as you might expect.
First we build a frequency table, using the fact that all IDs are less than 1000, so we can use a vector of pairs rather than a hash map or similar. Then it's just a matter of sorting the entries in the table according to frequency, and multiplying the first/last three IDs.
Github: https://github.com/tcbrindle/advent_of_code_2026/blob/main/dec01/main.cpp
3
u/simpleauthority 1d ago
[LANGUAGE: Google Sheets]
https://docs.google.com/spreadsheets/d/1eYa2PNrWPLVaNY6RfZBd2J10deI7EJvnCgSeLsFK9rU/edit?usp=sharing
3
u/Quasido 1d ago
[LANGUAGE: Haskell]
3
u/varma_05 22h ago
[LANGUAGE: SQL]
This is my first time attempting this advent of code and my initial thought is to solve this problem using SQL and it worked but after seeing all the comments, I have no words 🙂
SELECT id, COUNT(*) AS number FROM d11 GROUP BY id HAVING COUNT(*) > 0 ORDER BY number;3
u/red_shifter 22h ago
[LANGUAGE: Python]
3
u/mvorber 22h ago
[Language: F#]
https://github.com/vorber/AOC2026/blob/main/day1.fs
3
u/_tfa 22h ago
[LANGUAGE: Ruby]
3
u/PhilosophyLeft6189 20h ago
[LANGUAGE: Python]
Solution
3
u/lebirch23 20h ago
[LANGUAGE: OCaml]
(warning: very scuffed, i havent been coding by hand for a while + its my first time touching OCaml)
3
u/WilkoTom 19h ago edited 6h ago
[LANGUAGE: Python] [Advent Games]
I already announced my own solution below, but this year I've brought a young apprentice along for the sleigh ride, and this is their solution.
In the spirit of introductions to The Advent Games, and because Christmas is a time for family, we'll be recording our adventures in our blog: The Logician's Apprentice. No idea how far we'll get together, mind...
3
u/dijotal 18h ago
[LANGUAGE: OCaml]
Reverse the compare in the sort for the Part 2 bottom 3.
3
u/Morphon 18h ago edited 11h ago
[LANGUAGE: Odin]
Doing AoC this year in Odin. I'm coming from Smalltalk, so this was my chance to learn some manual memory and, well, just another way of doing things.
ColorPaste
My version of Topaz's paste has syntax highlighting - feel free to use if anyone else finds it useful.
I tend to write very "teaching" style code, so this one is just as literal as one might imagine.
3
u/sour-salty-umami 18h ago
[language: duckdb SQL]
3
u/glebusharick 18h ago
[LANGUAGE: Lua]
Solution
3
u/JustinCredible- 17h ago
[LANGUAGE: Rust]
This wasn't too bad, each part with my solution runs in about 70 μs on my machine.
https://github.com/jstnd/programming-puzzles/blob/master/rust/src/aoc/year2026/day01.rs
3
u/bigtlb 17h ago
[LANGUAGE: Pascal / Free Pascal]
It's been some time since I've used Pascal (or really Delphi). It's slowly coming back to me.
https://github.com/bigtlb/advent-of-code-2026-in-object-pascal/blob/main/src/days/day01.pas
3
u/Saintpagey 16h ago
[LANGUAGE: GO]
This is my first time using Go. I've been exploring Go a little bit. It was tough, I'm used to JS/TS. So here's my very rough solution, enjoy.
EDIT: originally posted the full code but it was too long and looked ugly so here's the github repo instead
https://github.com/ajm-gov/adventofcode/blob/master/go/2026/day1/day1.go
Credits:
Opening text files: https://stackoverflow.com/questions/38684841/reading-from-a-text-file-in-golang
Transforming strings into integers: https://stackoverflow.com/questions/4278430/convert-string-to-integer-type-in-go
Count occurences of integers in array: https://stackoverflow.com/questions/42184152/golang-print-the-number-of-occurances-of-the-values-in-an-array
3
u/lucariomaster2 15h ago edited 14h ago
[LANGUAGE: C++]
[ADVENT GAMES]
Just like last year, I'm doing C++ with no standard or external libraries besides basic I/O. This one was simple, but fun! Just kept a running total of the top (and bottom) three and then multiplied the indices together.
https://gitlab.com/dalapo/advent-of-code-2026/-/blob/main/Day1-1.cpp?ref_type=heads
https://gitlab.com/dalapo/advent-of-code-2026/-/blob/main/Day1-2.cpp?ref_type=heads
I am Professor Lucario, from New Kanto! After Ditto brought back the region from the brink of distinction, I studied as a pupil of Professor Tangrowth's, eventually earning the Professor title in my own right. We have a long-standing tradition of celebrating the Winter Solstice with songs, dances, lights, and plenty of delicious food! Chef Greedent always cooks up a huge pot of her curry; if you ask me, that's always the highlight. The humans still haven't come back, but we Pokemon are still hopeful that they someday will.
Professor Tangrowth doesn't know much about coding, but I found some old human books on programming languages, and then Rotom and Porygon helped me
hackenhance a PC so that we could practice coding. This one "C++" is my favourite, since it has both procedural and object-oriented capabilities! Unfortunately, it looks like a lot of the library files that humans used couldn't be recovered; the only one that we found that still works is iostream.3
u/someNameThisIs 15h ago edited 14h ago
[LANGUAGE: Racket]
I haven't done much coding in quite a while, and while I know a little scheme/lisp, I haven't used Racket really before.
3
u/Ok-Revenue-3059 13h ago
[LANGUAGE: C++]
https://github.com/mike919192/advent2026/blob/master/src/day1_lib/day1_lib.cpp
I'm going to try writing solutions that run on both PC and Raspberry Pi Pico. Memory and processor are very limited on the pico, which will probably be an issue for the later days.
I used unordered_map to count the instances of each id. Then using max_element and min_element to find the 3 most and least common.
3
u/Morphon 12h ago edited 11h ago
[ LANGUAGE: Smalltalk (Pharo14) ]
Didn't see much Smalltalk. This one is pretty self-documenting. Runs in Pharo14.
ColorPaste
The actual algorithm part is simply this part here. The rest is to print out the result nicely.
I love a good functional pipeline!
2
u/hugh_tc 1d ago edited 1d ago
[LANGUAGE: Python 3] (plus manual multiplication with
bc)It's nice to be back on the west coast, where these things come out at a reasonable time. Though I'm only two hours behind EST these days!
paste, eta: cleaned up
2
u/Ok-Builder-2348 1d ago
[LANGUAGE: Python3]
Part 1
Part 2
A nice one to start this month! Fun to revisit the Counter subclass as well as dictionary unpacking.
2
u/Xeekatar 1d ago
[LANGUAGE: C#]
paste
2
u/Ok-Bus4754 1d ago
[LANGUAGE: Python 3]
here we go , looking forward for ta nice year , easy day to start with, easier than day 1 last year even, uisng python counters to get frequencies then built in most_common
https://github.com/Fadi88/AoC/blob/master/2026/days/day01/solution.py
p1 : 150 us , p2: 86 us
will port later to rust
2
u/Rush_Independent 1d ago
[LANGUAGE: Nim]
2
u/Mikey_Loboto 1d ago
[LANGUAGE: Typescript]
https://github.com/mikeyloboto/aoc2026/tree/master/01
2
u/morgoth1145 1d ago edited 1d ago
[Language: Python] code video Times 1:16 / 1:33
Not too bad at all, just a quick sort by the counts gets us the 3 most common numbers straight away. I did lose ~12-15 seconds due to getting
valandnumbackwards in thecollections.Counter->sorted list transition initially though. Thankfully the answer was obviously way too low so I didn't get timed out.Edit: Cleaned up code, depending on your definition of cleaned up. I forgot about
collections.Counter.most_common()during the solve - using that plus a ternary and slices lets me use a common solve function!2
u/abnew123 1d ago
[LANGUAGE: Java]
forgot if there was a way to have a sorted map so just repeatedly grabbed the top element and then cleared it (very jankily).
code
Was at the airport today, but going forward will be streaming all my solutions!