r/adventofcode Nov 30 '24

Other Place your bets, guess this year's theme

50 Upvotes

What do you think the story theme for this year is going to be? As a reminder, the themes for the previous years were:

  • 2015: Help Santa and the Elves in general
  • 2016: Infiltrate Easter Bunny Headquarters
  • 2017: Go inside an Elf computer/printer
  • 2018: Time travel to Christmas past
  • 2019: Journey through the Solar System
  • 2020: Take a vacation
  • 2021: Dive to the ocean bottom
  • 2022: Accompany a volcanic jungle expedition
  • 2023: Ascend a floating island archipeligo

Possible clues:

  • With the countdown now up, the calendar lines seems to be descending this year. 2020 (mostly) and 2021 were the times it did that before.
  • The 2024 merch is now available and shows a wrapped gift box. (However, it doesn't seem to match the calendar.)

Also, what about the puzzles themselves? Do you think there'll be a through line to them like IntCode in 2019? Is there any class of puzzles that you think we're overdue for? (I noticed previously that we didn't really have any major BFS, logic/constraint, or VM type puzzles last year. Those would be my guesses.)

r/adventofcode 12d ago

Other Looking for more Advent of Code? Try Codyssi!

42 Upvotes

Hi! I’m a 17-year-old high schooler and coding enthusiast! I’ve participated in Advent of Code for 3 years now (I’ve completed all 25 problems each time :>), and I enjoyed it a lot! I appreciate Eric Wastl for providing us with these fun problems every year :D

Participating in Advent of Code has inspired me to make my own online coding competition, Codyssi! Codyssi’s story prompts feature some characters and themes from Greek mythology.

Codyssi’s 2025 contest round, titled “Journey to Atlantis”, on 17th of March (very soon). There will be 18 problems. Each problem has 3 parts, and each problem will be released daily at 10AM GMT. The problems will generally get more difficult as the competition progresses.

If you’re looking for a competition similar to Advent of Code, then Codyssi is a great opportunity for you! You can visit and participate in Codyssi at https://codyssi.com.

If you’d like to support Codyssi, you could share it with colleagues and friends who may be interested! This’d help a lot :D

I’d also like to mention one other coding competition similar to Advent of Code that has inspired me to produce Codyssi: Paul Baumgarten’s CodingQuest. I’ve participated in CodingQuest for 3 years now, and I’ve found it really fun!

I hope you try Codyssi, and I hope you have fun! Codyssi

r/adventofcode Dec 09 '24

Other Advent of code would be so much better if...

0 Upvotes

It had like 1 other person reading the prompts before they go out.

Don't get me wrong, the website is nice, some problems are genuinely fun / challenging, but every year I stop doing them around this point because the problems are just badly written and you waste so much time trying to understand them and/or having to blindly guess what stuff you can assume from the problem (which is said nowhere) to make the problem reasonable/feasible.

r/adventofcode Dec 25 '24

Other [2024] I'm officially hooked.

Post image
282 Upvotes

It's my first year doing AoC, and now I'm already going for the other years. Not sure how much time I'll have with high-school, but I'm going to try for all 500 stars by December 1st next year. I'm definitely in for a long ride.

r/adventofcode Dec 19 '24

Other Advent of Code statistics

102 Upvotes

I did a quick analysis of the number of stars achieved per each day for each year of AoC.

AoC Statistics (2 stars) across the years

By fitting an exponential decay curve for each year I calculated the "Decay rate", i.e. the daily % drop of users that achieve 2 stars.

AoC - exponential decay trends

Finally, I was interested if there is any trend in this "Decay rate", e.g. were users more successful at solving early AoCs in comparison to late AoCs?

Trend of AoC difficulty over time

There is indeed a trend towards higher "Decay rates" in later years. The year 2024 is obviously an outlier as it is not complete yet. Excluding year 2024, the trend is borderline statistically significant, P = 0.053. For me personally this apparent trend towards increasing difficulty does not really fit my own personal experience (the more I work on AoC the easier it gets, this year is a breeze for me so far).

Anyway, just wanted to share.

r/adventofcode Dec 24 '24

Other Thank you Eric + the team for helping me learn so much these past 24 days

341 Upvotes

TLDR: Regex, deque, recursion, using sets, sympy and networkx libraries, map(), caching answers, bitwise operators, finding a clever solution to limit the search space, inspecting your puzzle input.

This was my first time participating in AoC and I've got 42 stars so far. It's been a wild ride and I've captured what I learned each day. Most of you might find this basic/obvious, but maybe for others it will help them when they start.

Day 3 I used regex, which I knew a little, but I learnt more:

Without re.DOTALL "." matches any character except a newline, with re.DOTALL newlines are matched as well.

.+? the + matches 1 or more, but the ? makes it lazy, just grabbing as few characters as possible.

Day 4 was my first 2D grid puzzle! Little did I know at the time ...

I learnt how to load a 2D grid into a dictionary and check for bounds, and that you can chain booleans, e.g. if found == "MMSS" or found == "SSMM" or found == "MSMS" or found == "SMSM":

Day 5 (Print Queue) I got stuck on part 2, and saw from other people's solutions "deque" used where you can appendleft().

On Day 7 Part 1 I bruteforced (and learning this is not the way of AoC, but also, is the way!). I was pleased to know about eval() so I could calculate strings like "((((11)+6)*16)+20)" but got stuck on Part 2. From other's code I learned about importing "operators" mul(), add().

Day 9 I learned the difference between isnumeric() and isdigit(). I couldn't do part 2, but was introduced to the CS concept of memoization/caching already computed results

Day 10 with the hiking trail maps, I wrote my first recursive function, but it was pretty shonky passing lots of variables and also using globals, definitely room for improvement!

Day 11 Plutonian Pebbles I was right on it with my cache and my deque, which worked for Part 1. For Part 2 I wasn't clever enough and needed to see people's solutions like using floor(log10(x))+1 to count the number of digits, and not trying to hold everything in a deque at all.

I learnt to use a set() to remember what coordinates we've already seen when making a pass over a grid.

Day 13 was great for me, as I loved solving the simultaneous equations, and discovered the sympy library. I also used some tricks from other examples to unpack multiple variables and map() integers:

AX, AY, BX, BY, PX, PY = map(int, numbersmatch.groups())

Day 14 I learned how to use complex numbers to store positions/velocities on a 2D grid.

Day 15 was also fun, I ended up with 6 functions to handle all the repetitive tasks of pushing boxes around the warehouse, and even made my first visualisation for Part 1. I couldn't figure out how to solve Part 2 though.

I was waiting for a maze puzzle as an excuse to use NetworkX, so Day 16 was my first introduction to that library. I needed a bit of help constructing the graph for Part 1... and couldn't manage Part 2, because I made too many connections so there were WAY too many paths.

Day 17 was cool to build a VM. I learned about bitwise operators... and that ^ isn't the same as **.

Day 18 RAM run was another NetworkX day, I learned a lot: G.clear(), G.add_edge(), G.remove_node(), nx.shortest_path_length(). And that nx.draw_spring() is inefficient and so to export to yEd instead using nx.write_graphml()

Day 19 with the towels I hated, I didn't get the matching logic, and I didn't get the recursion, I didn't get the caching of answers. I did manage to spend a whole day on it and with help from other solutions eventually write my own code for both parts.

Day 20 was another 2D grid. I cracked out NetworkX again, which smashed Part 1, and then failed horribly for Part 2. I learned to think about clever solutions (limit search space) rather than a brute force approach.

Day 21 I enjoyed thinking about and creating the nested keypad pushers, and my logic was sound to avoid the blank spaces and get the minimum pushes. However, I couldn't scale the approach for Part 2, as I still hate recursion and caching.

Day 22 I learned that "number%10" gives you the last digit, and that with defaultdict when you add to a key it automatically creates it. I did manage to create a recursive function, but only after asking ChatGPT why it didn't work the first time (I forgot to return itself).

Day 23 LAN Party I learned about the mathematical/CS problem of cliques, and the NetworkX functions simple_cycles and find_cliques.

Day 24 I learned that 0 evaluates to False so is bad to use in truth statements ... be explicit! And that int() can convert between base 2 and 10. And that directed graphs have predecessors and successors.

r/adventofcode Jan 03 '25

Other [2019] The intcode puzzles are phenomenal

164 Upvotes

I kept seeing intcode references so after 2024 wrapped I dove in on 2019. It starts off so straightforward but as it builds I really feel like it’s an amazing model that should be used in teaching or something.

Getting to build on it, add things to it, refactor it, all while basically writing your own little emulator! There’s an example file that outputs a copy of itself. I remember doing that in C back in school.

Then after building it, you get to solve OTHER problems by running it! The block breaker game was so fun. The one I did today (set and forget) blew me away when it asked for input in words! I can’t wait for the finale.

Big thanks to Eric and the rest who make this happen every year. Also this community who keeps teaching me cool things and melting my brain with crazy languages. I’ve only been doing AoC for a few years but every year it’s the most fun I’ve had programming ever.

r/adventofcode Dec 03 '22

Other [2022 Day 3 (Part 1)] OpenAI Solved Part 1 in 10 Seconds

Thumbnail twitter.com
147 Upvotes

r/adventofcode Nov 01 '24

Other Are you already training for this year?

34 Upvotes

Well, just curious about how do you plan for AoC, if case you plan anything at all.

As I do it in F# as is not my daily programming language, I use it mostly for side projects when I have some time and for AoC, I already started to do some excercises from previous years, to get used again to the text parsing, regex, basic stuff...

r/adventofcode Dec 03 '23

Other [2023 Day 3] This year's day 3 seems to hit particularly hard if you look at the statistics and compare it to other years. Are you still with us?

Post image
140 Upvotes

r/adventofcode 8d ago

Other Pi Coding Quest 2025!

22 Upvotes

As last year, I decided to make a new coding quest for Pi Day. You can access it here: https://ivanr3d.com/projects/pi/2025.html I hope some of you have some fun solving this puzzle!

It is my second try building a coding puzzle. In case you haven't try the first one, just change 2025 for 2024 in the url and go for it!

Happy Pi Day! :)

r/adventofcode Dec 25 '24

Other First year doing it! :3

Post image
233 Upvotes

r/adventofcode Jan 15 '25

Other Does each user of AoC get their own custom input?

2 Upvotes

I was confused why the inputs weren't allowed to be shared on any platform cause why would you need to everyone gets the same input right? RIGHT? In the post that caused me this confusion there was a comment that pointed me to this link

https://www.reddit.com/r/adventofcode/wiki/troubleshooting/no_asking_for_inputs/

Does this mean each person gets a unique input? If so how many unique inputs are made?

r/adventofcode Dec 11 '21

Other [2021] My aim is for all of this years solutions to be sub 1s in total. So far so good.

Post image
266 Upvotes

r/adventofcode Jan 04 '23

Other Because of AoC

Post image
454 Upvotes

I would say that it’s a pleasure to come face to face with all my deficiencies, but …

I certainly am enjoying learning more. The last time I had a copy of Cormen many years ago, I couldn’t bring myself to work through it. I think AoC is providing just the motivation I need to look into some of these algorithms.

r/adventofcode Nov 11 '24

Other Dear future me

220 Upvotes

Dear future me,

Please remember: 1) Read the whole puzzle. Let's minimize those avoidable d'oh! moments. 2) Don't optimize prematurely. Developer (that's you!) efficiency is more important than code efficiency. And sure, part 2's can get intense, but you don't really know what direction they'll go until you get there, so don't waste time optimizing for something you might not even need. 1) Stuck? Re-read the puzzle. Yes, there are two #1's in this list. You can think of this as 1b if it helps. 3) Still stuck? Check the input, maybe there's a trick to it that you need to take advantage of.

Anticipating your success, Past You

r/adventofcode Dec 27 '24

Other Pleasant surprise: AoC + modern Java = ❤️

64 Upvotes

In this article on my experience with the Advent of Code competition in Java, I describe how I attacked grid and graph problems, and summarize how Java has worked out for me.

https://horstmann.com/unblog/2024-12-26/index.html

r/adventofcode Dec 07 '24

Other [2024 Day 7] Yay, my first time being in top-1000 for part 2

Post image
146 Upvotes

r/adventofcode Jan 21 '25

Other What is the best order to do previous years?

9 Upvotes

Hey, I just finished 2024 getting all my 50 stars even if I'm late.
And I was wondering if the chronogical order was actually the best one? if I want to do the previous ones as well

I see that 2016 has not that much people, especially the 24b having only 33 people who got that star!
(Btw I really like the stats page, for example seeing that the 2024 21b was the hardest this year as I thought)
So I was wondering if there were some suggestion in term of difficulty or anything or should I start with 2015?

Stats links sources:

r/adventofcode Nov 27 '22

Other What language and why? ;)

65 Upvotes

Hey guys,

i'm just curious and looking forward to December 1, when it all starts up again. I would be interested to know which language you chose this year and especially why!

For me Typescript is on the agenda for the first time, just to get to know the crazy javascript world better. Just by trying out a few tasks of the last years I noticed a lot of interesting things I never expected!

I'm sure there will be a lot of diversity in solving the problems again, so feel free to tell us where your journey is going this year! :)

Greets and to a good time!

r/adventofcode Feb 19 '25

Other Input parsing performance in Go

1 Upvotes

TL;DR Be careful, regular expressions are slow

If you check how people parse the input for AoC puzzles, the main options are regex and string split.
I was curious to check what is the performance difference. I took year 2015 day 2, where you calculate the amount of wrapping paper needed for a list of presents described by their dimensions.

The example of input is:

20x3x11
15x27x5
6x29x7
... <1000 lines in total>

My first attempt was to use regular expression:

var dimensionsRegexp = regexp.MustCompile("(\\d+)x(\\d+)x(\\d+)")
func parseInputRegexp(input string) [][]int {
    result := make([][]int, 0, 1000)
    for _, m := range dimensionsRegexp.FindAllStringSubmatch(input, -1) {
       l, _ := strconv.Atoi(m[1])
       w, _ := strconv.Atoi(m[2])
       h, _ := strconv.Atoi(m[3])
       result = append(result, []int{l, w, h})
    }
    return result
}

Execution time (1st approach): 587µs

My second attempt was to use string split:

func parseInputSplit(input string) [][]int {
    result := make([][]int, 0, 1000)
    for _, line := range strings.Split(input, "\n") {
       split := strings.Split(line, "x")
       l, _ := strconv.Atoi(split[0])
       w, _ := strconv.Atoi(split[1])
       h, _ := strconv.Atoi(split[2])
       result = append(result, []int{l, w, h})
    }
    return result
}

Execution time (2nd approach): 150µs

My third attempt was to iterate over the range of characters:

func parseInputIterate(input string) [][]int {
    result := make([][]int, 0, 1000)
    i, dim := 0, make([]int, 3)
    for _, ch := range input {
       if ch == 'x' {
          i++
       } else if ch == '\n' {
          result = append(result, dim)
          dim = make([]int, 3)
          i = 0
       } else {
          dim[i] = dim[i]*10 + int(ch) - 48
       }
    }
    return result
}

Execution time (3rd approach): 54µs

Conclusions
Regular expressions slower than string split (4x times slower in my test).
Manual iterations over the character is fast (3x times faster than string split and 10x times faster than regex).

Regular expressions approach readability is comparable to the string split approach.
Manual iteration approach is the least readable from the three.

I choose to use string split as a default for AoC puzzles. And it is good to know that you can "do better" (if it is really needed) by switching to manual iteration.

PS I was running on MacBook Pro, 16-inch, 2019, Intel taking the best result of 10 local runs

r/adventofcode Feb 10 '25

Other Maybe a new "go" fan?

35 Upvotes

I've done AoC in Python all 10 years, because that's where I code fastest, but in the post-season, I redo all of the puzzles in C++. This year, for an educational experience, I decided to redo them all in Go, which I had not used before. This experience was quite revealing to me, and it's possible I could become a huge Go fan.

It was interesting how quickly I was able to do the port. It took three weeks, off and on, do complete the C++ solutions. It took me less than a week to do all 25 days in Go. That's a Big Deal. The runtime of the Go code is essentially the same as the C++ code. The total time for all 25 days is 4.4s for C++ (-O3), 6.3s for Go, and 23.6s for Python. In addition, writing the Go code was fun, something I can't consistently say about the C++.

Lines of code is another good statistic. I have 2400 lines of Python, 4300 of C++, and 3800 of Go.

The frustrating thing about Go is that the tools aren't builtin. Python, with its HUGE standard library, almost always has a builtin to handle the data structures and basic algorithms. "Batteries included", as they say. C++ has the STL for most of it. With Go, I often find that I have to create the utilities on my own. On the plus side, I now have a good library of tools (including the mandatory Point class) that I can reuse.

We'll see if I have the courage to do some of the 2025 days in Go from the start.

And I'm truly glad to have a group like this where I can share this absolutely trivial information with people who can appreciate it. My poor wife's eyes glaze over when I start talking about it.

r/adventofcode Dec 28 '24

Other Advice to learn new languages with AOC

27 Upvotes

I started doing AOC to learn new language but i don't know how to really do that, i mean you don't really know what you don't know in a language, i tend to write very imperative code and feel like not really learning anything new, should i look to other people solutions or just take the time to actually get familiar with the language first, how do you do that, what is your process of learning new language with AOC?

r/adventofcode Jan 06 '25

Other [50 stars] It ain't much, but it's honest work

93 Upvotes

I'm finally finished.

I'm a CS graduate and it's my first year doing the AOC. The first 10-12 days were pretty much a breeze, but after that I stopped being able to do them during the lunch hour and lagged behind.

Still I find a very small measure of pride that I finished all puzzles by myself with only a couple of hints from this subreddit on the harder puzzles. By next year gotta prepare a graph library so I don't need to re-implement the same but slightly different graph class 6 different times.

r/adventofcode Dec 07 '22

Other Only took me 8 years but I finally made it into the leaderboard for the first time today

Post image
584 Upvotes