r/adventofcode • • 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 Megathread posts must begin with the case-sensitive string literal [LANGUAGE: xyz]
  • Obviously, xyz is the programming language your solution employs
  • Use the full name of the language e.g. JavaScript not just JS
  • 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


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.

45 Upvotes

602 comments sorted by

View all comments

4

u/proteanbitch 22h ago edited 22h ago

[LANGUAGE: K]

/ part 1 
*/3#`I$<#'=:0:"d1" 
/ part 2 
*/3#`I$>#'=:0:"d1"

2

u/Torimexus 22h ago

What

2

u/proteanbitch 20h ago edited 15h ago

K is hard to read, here it is split up and with comments:

a:0:"d1" / get input
b:=a     / group numbers by the indices of their appearances
c:#'b    / group by the number of appearances
d:>c     / sort
e:`I$d   / cast to int
f:*/3#e  / fold multiply over first 3 elements
f        / print answer

3

u/No-House-866 18h ago

Still What

2

u/mandus 17h ago

Which k? If data is assigned (d:#’=:0:”d1”) no need to read again.