December 1st, 2024

Advent of Code 2024

Advent of Code is an annual event with daily programming puzzles for all skill levels, promoting community engagement, user privacy through OAuth, and guidelines on AI use and content redistribution.

Read original articleLink Icon
ExcitementFrustrationNostalgia
Advent of Code 2024

Advent of Code is an annual event featuring a series of programming puzzles designed for various skill levels, which can be solved using any programming language. Created by Eric Wastl, the event serves as a platform for interview preparation, training, and friendly competition. Participants do not need a computer science background; basic programming knowledge and problem-solving skills are sufficient. The puzzles are designed to run efficiently on older hardware, ensuring accessibility for all users. The event encourages sharing and community engagement, with resources available for those who may need assistance. Authentication is handled through OAuth, ensuring user privacy. The puzzles unlock daily at midnight EST, and while participants can compete on a global leaderboard, they are encouraged to focus on personal learning and enjoyment. The event has specific guidelines regarding the use of AI in solving puzzles and prohibits the redistribution of its content. Advent of Code is trademarked and its content is protected under copyright law, although users are free to discuss and reference the puzzles in various contexts.

- Advent of Code features daily programming puzzles for various skill levels.

- Participants can use any programming language and do not need a computer science background.

- The event promotes community engagement and offers resources for assistance.

- Authentication is managed through OAuth to protect user privacy.

- The event has guidelines regarding AI use and prohibits content redistribution.

AI: What people are saying
The comments reflect a diverse range of experiences and perspectives on participating in Advent of Code (AoC).
  • Many participants enjoy using AoC as a way to learn new programming languages or improve their skills, often experimenting with languages like Rust, Go, and F#.
  • Some users express frustration with the time commitment required, especially during the busy month of December, leading to mixed feelings about participation.
  • There is a notable interest in using AI tools and LLMs to assist with solving puzzles, raising questions about the impact of AI on traditional coding challenges.
  • Participants appreciate the community aspect of AoC, sharing tips, resources, and personal challenges, while also acknowledging the fun and festive spirit of the event.
  • Several comments highlight the challenges of the puzzles, with some users feeling overwhelmed or anxious about their performance compared to others.
Link Icon 97 comments
By @zaptheimpaler - 4 months
I love AoC! Did it the last 2-3 years in Rust, hanging out in a discord where we all try to make the absolute fastest solutions. Learnt all kinds of crazy performance hacks and some advanced algorithms & SIMD that way.

This time I'm trying to do them in Rust and Golang in an effort to either learn to like/tolerate Golang (because we use it at work) or prove my hypothesis that it sucks and never use it unless I have to.

By @the_duke - 4 months
This years challenge for me: write it in C without the standard library or an allocator. Has to be runnable on an STM32 with 32kb of SRAM.

I tried doing it in Assembly two years ago, ended up spending hours and hours writing an Assembly standard library, then gave up and switched to Rust...

By @codr7 - 4 months
I usually do AoC in Common Lisp, but this year I'm giving Swift a chance.

It's not half bad at this kind of twiddling for being a statically typed mainstream language.

https://github.com/codr7/aoc24/tree/main/swift/Sources/aoc

This year is a tiny bit weird, I was just getting ramped up organizing the event at a new job; because I think it's very useful for devs to learn some real problem solving, as opposed to stitching frameworks.

And then I had to leave because my new boss turned out to be someone I couldn't imagine working with.

Guess it'll be just me and Emacs as usual.

By @bargainbin - 4 months
Ah here it is again, 25 days of writing increasingly complex input parsers.
By @mattbillenstein - 4 months
Aiming to get all the stars this year to round it out with 500 total - all the years, all the problems.

As of last week there were something around 1024 people who had all 450 stars.

Only started on like day 6 of 2022, but became hooked and had some time early in 2023 to go through the previous years. Once you have a few algorithms canned, it's not too difficult and some themes repeat across years.

It's fun to brush up on stuff you don't touch all the time - actual algorithms and stuff.

Hats off to the volunteers and Eric - I aim to donate every year now - it's a great event.

By @ctur - 4 months
Woohoo, one of the highlights of this time of year. I had to do mine from an eastbound flight over the pacific. This has become a fun tradition not just for me personally but for many friends, colleagues, and fellow HNers. Big props once again to wastl and his helper elves for making this!

I encourage anyone who gets value from this to donate to support it if they can. It is a passion project but nonetheless comes with real costs.

By @ducdetronquito - 4 months
I will try to do it with F# and Gleam this year, but like every year I won’t have time (and brain) to do more than 10/12 days ^^

For the pythonists around here, give F# a try: it can feels very close to scripting and it has a wonderful REPL too :)

By @atribecalledqst - 4 months
Last year I got stuck on Day 12 for a full week, and thinking about how to solve it consumed my every waking moment. I think this year, I'm going to be kind to myself and not participate so I can really enjoy the winter break from work.
By @matsemann - 4 months
I love AoC. You don't have to care about the AI bots solving it or people waking up earlier than you, just solve it for your own fun. Either because you like the challenges, or to try it in a new language etc.

I like to do them in a functional style in Kotlin as far as possible, as that's different from what I do at work.

Edit: Here's mine from today, with my utils it's not exactly plain kotlin, but part of the fun is building a library of sorts with cool functions https://github.com/Matsemann/algorithm-problems/blob/main/ad...

By @int0x29 - 4 months
Solved the whole thing. It's a business problem. Just replace the Chief Historian.
By @tmtvl - 4 months
I still haven't made my way through all of the 2015 problems yet. But I don't play the game correctly any way: instead of trying to solve the problems as fast as I can, I try to write well-documented easily maintained code which runs fast. Balancing 'easily maintained' and 'runs fast' takes a little more time than 'just solve it' _and_ I'm planning on working my way through the problems chronologically, so I doubt I'll get to the 2024 problems any time this decade.
By @neonsunset - 4 months
I can't explain why but doing AoC is always interesting, and doing LeetCode which is supposed to be similar is always very depressing.

Wishing everyone a fun challenge. This year I will be practicing F# and hope some of you will give it a try too :) https://github.com/neon-sunset/AOC24/blob/master/day1.fsx

By @wodenokoto - 4 months
People here are doing it in Common Lisp and C standard library, meanwhile I’m just sitting here trying to get a curl call to download the data file.
By @NoelJacob - 4 months
Other challenges (in advent and not in advent) like advent of code:

https://github.com/NoelJacob/advent-and-other-calandars Compiled by myself.

By @tgv - 4 months
Going to use it to learn a bit of Ada. I've always been curious about it. It's not a popular language, and it has some serious documentation problems. Sure, there are guides for "hello, world" and other basics, but how to use a generic integer vector or even how to read lines with two numbers from stdin or a file? That was a bit of a puzzle. I saw a solution that allocates an array of 99999 elements, just to track the number of occurrences of each number in the input.

Ada took me somewhere between 90-120 minutes, whereas I had the first problem done in JavaScript in about 30s-60s, just for verification.

By @SleepyMyroslav - 4 months
Am I alone in thinking that measuring time to get answer is the worst possible metric? I have not participated because of that (yet).

If there is a community for those who use other rules to compare actual solutions instead of answers I would be interested to hear about it.

I am coming from low level C++ gamedev side so I understand that most people here use different tools to solve different problems.

By @runeks - 4 months
This year I will run my AoC solutions on my toaster and write them in ALGOL 58 using only my feet.
By @paulb73 - 4 months
I can hear the elves calling me...

But no, last year I lost all momentum on my side projects and my gf thought she'd lost me to the elves.

Completing it on time was rewarding but I can't go back.

But I can hear those elven bells a jingling...

By @JoshMandel - 4 months
My personal challenge last year was to solve everything on my mobile phone, using LLMs (mostly ChatGPT4 with code interpreter; I didn't paste in the problems, but rather described the code I wanted.)

This year I'm declaring "Advent of Claude"!

Challenge: Write a Claude custom style to solve Advent of Code puzzles within Claude's UI.

Score: # adventofcode.com stars earned in 2 daily conversation turns.

Fine print: web app artifacts are allowed, including paste of your custom input into the artifact UI; one click only.

Per https://adventofcode.com/2024/about, wait until the daily http://adventofcode.com leaderboard is full before submitting LLM-generated solutions!

Of course, feel free to use ChatGPT custom instructions, static prompts, etc.

Day 1: two stars, https://claude.site/artifacts/d16e6bdb-f697-45fe-930c-7f58b2...

By @matejn - 4 months
I completed last year's in Scryer Prolog and it was a joy. Some problems were almost impossible due to the lack of mutation (Karger's algorithm comes to mind), but file parsing was a breeze and I find Prolog programs generally beautiful. My favourite syntactical feature is the full stop at the end of clauses.
By @NamTaf - 4 months
I've never done AoC but I've done other programming-related challenges before. I come from a non-IT background (mech eng), and I'm currently away for work for the first several days with only their locked-down laptop.

Normally I'd break out Python for this, but given the constraints maybe I should try to see how far I can get through this in Excel. It'd be a fun little challenge :)

By @heelix - 4 months
Woohoo! This is my favorite time of the year. As the year rolls into vacation'ish days and on call rotations, this is where I hunker down and use this to code something other than power point. Last year, solved via my primary language (Java), then ported to Rust. This year, I'm starting with Rust. I had not realized it was the first.
By @setopt - 4 months
The tiny thin gray font on black background is impossible to read on a mobile device :(
By @signa11 - 4 months
if you want to use Zig, here are some tips : https://kristoff.it/blog/advent-of-code-zig/
By @a_cardboard_box - 4 months
I'm gonna try doing this on the NES (Nintendo Entertainment System) this year.

Probably some problems will be impossible with limited RAM (2KiB, plus an optional 8KiB on the cartridge, maybe more if a fancy cartridge is used). But I'll try to solve as many as possible.

Today's was possible, in under 4 seconds, using 4KiB extra RAM on the cartridge.

By @HeavyStorm - 4 months
I believe that this page should be mobile friendly. I won't be coding on mobile, but reading about it on my portable device would be great.
By @azhenley - 4 months
I’m attempting to make my own language for solving the puzzles as I go along.
By @gavinhoward - 4 months
This is the first year that I will do AoC. I have never wanted to, but I have a working language of my own now.

https://gavinhoward.com/2024/11/advent-of-code-2024-getting-...

By @genericspammer - 4 months
Lots of people seem to be doing hardcore things like using C without libraries, limiting memory etc.

And here I am doing it in Ruby instead of Java this year thinking I was giving myself a challenge.

By @orra - 4 months
I would love it if the first star of the day was required, but the second was a bonus. I love Advent of Code, but I don't have the time to get 50 stars.
By @ksymph - 4 months
This is the first time I've seen Firefox's alternate stylesheets mentioned in the wild. Interesting.
By @lyxell - 4 months
I’m using sqlite this year. Hoping that there won’t be any computational geometry or trie problems. Kind of hoping for a graph problem solvable with recursive CTEs, that would be cool.
By @criddell - 4 months
> You don't need a computer science background to participate - just a little programming knowledge and some problem solving skills will get you pretty far.

The use of “pretty far” gives them a bit of an out, but I think this statement is a little disingenuous. Last year, at least, a bunch of the problems needed fairly sophisticated algorithms to find the solution in a reasonable amount of time.

To me, a little programming knowledge is what somebody who is six weeks into their introduction to programming class has. They know variables, loops, lists, and maybe associative arrays.

By @middayc - 4 months
I love looking at AoC solution megathreads on reddit. So many languages and so many different approaches are hard to find and observe anywhere.
By @fleeno - 4 months
I usually get stuck about halfway through and give up.

Doing it in a Lisp I’ve been writing in Ruby will have me giving up even sooner, but it will be fun!

By @calini - 4 months
I have seen a couple of snarky comments about how AoC is just a competition for who can write an input parser the fastest for 25 days in a row, I'll just share the following:

Just write that once, put it in a template /day0 folder that has /day0/part1, /day0/part2, and /day0/input.txt, and then just copy it and focus on the actual problem. It's all about having fun!

By @ruuda - 4 months
This has been a good driver for me to add features to https://rcl-lang.org/. I just added List.sort for today’s problem.
By @audiodude - 4 months
I know a lot of people use AoC to try out/learn a new language. I tried that with Go in like 2018. However, I found it too frustrating (especially since AoC requires a lot of string parsing/regex which are difficult/verbose in Go).

The past few years I've decided to stick to the same principle I've used in all of my side projects recently. Either I do something in a new language, or I get it done correctly before I get bored. I've found I can't have both.

By @ArcHound - 4 months
I love AoC. I made a CLI client in python for me (and a lib for common tasks, especially the 2d grid maps).

Repo: https://github.com/ArcHound/advent_of_code Writeup: https://blog.miloslavhomer.cz/p/advent-of-code-cli-client-an...

Good luck to y'all in 2024 and enjoy!

By @prophesi - 4 months
For anyone interested in using this to learn Elixir or improve your skills with it, I saw this video[0] a while back and their AoC starter repo[1] is super slick.

[0] https://www.youtube.com/watch?v=gpaV4bgEG-g

[1] https://github.com/ChristianAlexander/advent-generator

By @anonzzzies - 4 months
One of the things I look forward to. It is a lot of fun.
By @thepaulmcbride - 4 months
I usually get to around day 10 in AoC before they get so time consuming that I give up. I still really enjoy the first week or so though!
By @tmountain - 4 months
It feels like AI will shape a lot of the submissions for these types of coding “traditions”. But, I guess that’s just the world we live in.
By @runeks - 4 months
If LLMs are really as good at writing code as some people say, they should write a script that fetches each challenge, as soon as it's released, and feeds it to an LLM, to produce a solution. Then run this code and submit the answer it outputs.
By @barkingcat - 4 months
I use it to learn new languages - this year it's Ada -

https://blog.adacore.com/announcing-advent-of-ada-2024-codin...

By @struanr - 4 months
Excited to try this. I was aiming to be done by Christmas, but this is my first AoC and reading other replies makes this seem a bit unrealistic. Decided to do it in elisp to try and improve my emacs-fu and lisp knowledge.
By @pclmulqdq - 4 months
I am a bit late to the trend, but I am planning to do Advent of CUDA this year. It's been a while since I have written a lot of parallel code, and thinking about concurrent algorithms is fun.
By @xavdid - 4 months
I'm excited about this! I'll be sticking to Python so I can practice writing maintainable code. I'm also looking forward to keeping up with my explanations of each puzzle, which helps me (and others!) learn a lot.

Everything is here: https://advent-of-code.xavd.id/

I'm unlikely to finish it all in December (the puzzles get hard and I get busy) but I _do_ love the event.

By @jlengrand - 4 months
Remarkable. Bought, sold within 2 weeks. Really underwhelmed
By @mvdtnz - 4 months
I haven't completed one before and I have a question for those who have. Can I treat the entire month as one code based which evolves over time, with an evolving set of unit and integration tests? Or do some days require starting from scratch? Lots of people here are talking about completing it in exotic languages but I'm more interested in using it to sharpen enterprise coding techniques.
By @benmccann - 4 months
Svelte is doing its own Advent of Code challenge with a twist this year. Instead of challenging users, the maintainers will be challenging themselves to launch one feature a day. Today's feature is error boundaries!

https://bsky.app/profile/svelte.dev/post/3lcavobxn7c2k

By @cod1r - 4 months
This year I'm going to try to do this in Haskell.
By @rubyfan - 4 months
I don’t code for a living anymore so this looks fun.
By @wizrrd - 4 months
Yup. Advent of Code is a fun, yearly alternative to LeetCode with a Christmas theme, and it's approachable for novice developers.
By @1a527dd5 - 4 months
The first year was the best year for me. It was really fun and I think I got 22/24 days done. After that my participation rate has been shocking, I really want to do it but I get this weird anxiety that I'm not quick enough.

Which is weird because that is not a thought that entered my mind when I did it for the first time. It was pure fun!

By @sgarland - 4 months
Last year, I spent more time coming up with a reusable framework than the challenges themselves, proven by the fact that I only solved two days.

This year, I shook my head at my framework and rewrote it, but at least that only took me a day (so far). Day one was easy, which also helps. IIRC, last year’s first few days were non-trivial.

By @jebarker - 4 months
I always get too ambitious with AoC, e.g. trying to do it in a new to me language or abstract everything into a new library. Subsequently I never finish. So this year I'm using whatever language or tool is easiest for me and the only goal is to finish!
By @kazinator - 4 months
I did some of it in TXR Lisp a bunch of years ago.

https://www.kylheku.com/cgit/advent/tree/2021

Give it a try. The structure and recurring themes in these solutions could be used as a source of ideas for how to get started.

By @cjauvin - 4 months
Because we can assume that these problems necessarily cannot be in the training set of any current LLM (and are hard enough, i.e. they should be more than mere variations on existing problems), I'm wondering if they can be a good benchmark to get a better sense of how good they really are at problem solving?
By @walis85300 - 4 months
This year I will solve AoC using Gleam. My challenge is to finally learn functional programming and learn Gleam at the same time.

I already solved the first problem and it was hard to get things ready, read the file, handle the data, etc. But once I had the first steps done it was easy to solve the problem

By @bas - 4 months
Day 1 led me to a deep(ish) dive into the CPython implementation of the abs(...) builtin. Good times!
By @markus_zhang - 4 months
Does anyone know what is the theme of this year? If it's VM or anything low level then it's fun.
By @cactusfrog - 4 months
I just did this in a few lines of python with numpy. I don’t understand why the input isn’t a csv.
By @nikolay - 4 months
This is my fourth year. I'm using Go while being surprised how inadequate it is for this kind of problem. Standard libraries lack basic data structures and often Go is too slow for a compiled language!
By @tonymet - 4 months
AOC follows "Tony's Law of Comprehending Things on the Internet": Reading the content from bottom to top is the most efficient way to grok the content.
By @LelouBil - 4 months
I'm trying Haskell this time.

For this one, I learned how to write a basic parser with Text.Parsec and manipulate the tuples with bimap !

It's a very fun occasion to learn a new programming language.

By @b5n - 4 months
I've generally chosen a new (to me) or spartan lang to challenge myself, but this year I'm going easy mode with python and just focusing on meeting the requirement.
By @declan_roberts - 4 months
AoC is fun for learning a new language but I feel like all of us have that one "project" that we rewrite every few years in this language or that to learn it.
By @bradley13 - 4 months
I never have made it to the end of a season, just due to lack of time. It's great fun, though - already solved today's "warm up" puzzles...
By @zanderwohl - 4 months
I think I'm going to be using MicroSoft QuickBasic for System 7 this year. I might regret this pretty quickly.
By @dchuk - 4 months
While I agree that just dumping the puzzle instructions into an llm and getting the right answer at least doesn’t align with the spirit of Advent of Code (though it does show how crazy good LLMs are getting), I’m using this as an opportunity to try out the new Windsurf AI IDE and am driving the AI code editing in it to help me write the code to solve each puzzle (I’m using Ruby).

My goal is to develop the muscle memory for the tool so I can write code quickly. I’m still generally thinking through the puzzles, but being able to just write out plain English logic, get code generated, ask for it to be well documented, quickly refactor things to be generally reusable, etc, is just fantastic and how all software development should be done in this day and age frankly. Such an accelerator to problem solving.

By @dwayne_dibley - 4 months
Is this any good for beginners/kids?
By @calrain - 4 months
I'm doing the challenges in PowerShell to see how it goes.

I want to use it as a test to see how human programming can be improved by an AI, so I wrote the solution for day 1, got the right answer, and then gave my code to ChatGPT 4o to ask it to make the code faster.

My version ran in ~3500 ms ChatGPT's version ran in 140 ms

both worked

A great example of how a common DevOps language program can be improved on by ChatGPT.

By @johanneskanybal - 4 months
co-pilot solved day 2 in a second, kind of makes me sad. I’ll try some of the others myself though they’re kond of fun. Would be fun to use as many languages as possible or maybe some convoluted micro services architecture.
By @lowbloodsugar - 4 months
New factorio dropped. Probably be doing that with every spare minute of the day.
By @tslater2006 - 4 months
I maintain a joke domain which I've found sadly applicable through the years. https://adventofrealizingicantread.com. I try to keep it updated pointing to the current day throughout the month

I've found especially as the month progresses it's just as much Advent of Reading Comprehension as it is coding :)

By @seba_dos1 - 4 months
AoC is in this weird place where it's too easy to be fulfilling on its own, but too bothersome to just do it for leisure. I did it once (using Python with no imports for some mild challenge), waking up super early to actually start on time, then golfing my answers if I felt like it. It was a fun thing to do... once. I don't feel the need to repeat that and I don't find it engaging enough to do without time pressure, so I don't.

Perhaps if you aimed at global leaderboards it would be different, but that's neither my league nor I see any fun in that - getting there requires serious effort and preparation in things that aren't directly related to solving intelectual puzzles.

By @ucefkh - 4 months
Getting the vibe of Google code jam

Pretty good tbh

By @ranger_danger - 4 months
I read the entire page and I don't see anywhere that it actually lists what the puzzles are, I'm so confused.
By @izietto - 4 months
What I hate about AoC is the tons of bullshit about Christmas elves I have to tolerate before getting to the damn point. I mean, I understand they want to make the context entertaining, but sometimes it's like reading a Jira card written by a junior product owner!

BTW I love AoC for all else

By @guiambros - 4 months
Here's to another year of being sleep deprived for the entire month of December.
By @ucefkh - 4 months
Getting the vibe of Google code jam, pretty good
By @n0id34 - 4 months
Mkay, day 3 part 2 is making me want to step in front of a bus and never touch a computer again.
By @arjvik - 4 months
9 seconds to get both stars is absolutely insane - there had to be some AI assistance here.

Come to think of it, a pipeline that feeds the problem text into an LLM to generate a solution and automatically runs it on the input and attempts to submit the solution, doing this N times in parallel, could certainly solve the first few days' problem in 9 seconds.

By @bernds74 - 4 months
Nice to see that traditions are upheld, such as the unreadable font and colors.
By @peanut-walrus - 4 months
I love AoC, but I hate the timing. December is always the busiest month of the year, so I really almost never find the time for it :(
By @delta_p_delta_x - 4 months
Is there a way to override the CSS (on Chromium)? The body font and weight, Source Code Pro is far too thin and far too wide and gives me a headache (and has regularly turned me off AoC). I'd like to change it to `sans-serif`.
By @hshshshshsh - 4 months
Work on a side project this December instead of doing this. Solving advent of code just keeps you in your comfort zone. Creates a false sense of accomplishment. Redirect all the positive energy to something that will make you proud when you are old or help with an earlier retirement. This won't.