If you want to solve Advent of Code problems, sign up for an account at adventofcode.com. Advent of Code was founded in 2015. Advent of Code has a challenge for every day from XXXX-12-01 to XXXX-12-25. Each challenge has 2 parts. When you solve the first part you get a silver star and unlock the second part. The second part will usually be a variation of the first part. After you solve the second part you get a gold star. Each challenge gives 2 stars. If you solve all the challenges for a year, you get 50 stars. I have not managed to get all 50 stars for any year. There will usually be an example. When I use the singular, I also mean the plural so when I say example I also mean examples, unless otherwise specified. The example will usually include a text file and then you will have some input where you can click get your puzzle input and the puzzle input can be saved as input.txt. The input file is same for part 1 and part 2. Sometimes there will be data in the input that is not used when you solve part 1 that is used when you solve part 2. There will be a story for each problem. There are also themes for the years. I understand that Christmas was a while ago. If you read this post, please be warned there are solutions to the problems here.
The theme for 2015 related to repairing Santa’s weather machine and includes various Christmas aspects like Santa, elves, reindeer, Santa’s sleigh, cookies, etc.
This is what Advent of Code 2015 looks like for me.
As you solve challenges the artwork is colored in. Each year has a different artwork.
The theme for 2016 was Easter Bunny HQ and involved breaking into to various rooms to find things for Santa.
This is my view of 2017:
This is my view of 2018:
The theme for 2019 was space:
The theme for 2020 was getting on a plane to fly somewhere.
The theme for 2021 was going underwater in a submarine.
The theme for 2022 was the jungle, rainforest, and mountains.
The theme for 2023--the most recent--was the desert.
There are at least two ways you can go about solving the problems. You can solve all the day challenges--2015-12-01, 2016-12-01, and so on, then solve 2015-12-02, 2016-02, .... The advantage of this is the difficulty level ramps up gradually.
Or you could solve all the problems for one year and then go on to another year. The advantage of this is you focus more on the theme. The disadvantage of this is the difficulty level ramps up much more quickly.
This is my current view of all years.
I will have a link to the challenge and some setup for importing the files.
variables without a number are for the problem. variables with a number are for examples. For example data, line, lines are for the actual input. data1, line1, lines1 would be for example1.
I am using the ISO 8601 convention for dates used in databases--2015-12-01 neither 12/1/15 nor 1/12/15 nor 2015-12-1 nor 12/1/2015 nor 1/12/2015.
I have a sample of solutions here.
Note on the setup: I have filepath and filepath1 and file and file1. I sometimes don’t use filepath1 and file1. These were generated with a template notebook programmatically.
I am putting content from 2016-12-06 here because it has some important information and functions.
I am going to add a new way to update these variables.
Right now its for 2016-12-04.
we run the update:
Now the filepath has been updated:
I am also going to stop posting the links.
Sometimes a computation runs a long time. In that case I will post the code but I will not run it again.

2015

2015-12-01

Here we see what’s in the files. file1 is for the example.

Part 1

This is the answer for part1:

Part 2

2015-12-02

Part 1

This matches the example of

Part 2

This matches the example of

2015-12-03

https://adventofcode.com/2015/day/3

part 1

part 2

2015-12-04

https://adventofcode.com/2015/day/4
This one took a really long time to solve by brute force with MD5 hashes.
In this case the input for me was a string so I manually created a file for it with Notepad++ as input.txt so I could import it. Sometimes I would also manually create the example files. My naming convention for the example files is example-1.txt, example-2.txt, example-3.txt, example-4.txt, ....
I would like to mention that MD5 and SHA-1 are cryptographically insecure and it is better to use SHA-256 than the other. You can make a hash collision with a lot of work which results in a complete breakdown in the assumption that if the hashes match the things are identical when in fact because you have a hash collision the two things have the same hash but they’re different. Wolfram U has a good course on cryptography that delves into this some.
I could have also done this to get the input:

part 1

This is the answer for part 1:

part 2

This took ~3431 s for me to complete to solve the challenge originally.
I evaluated this in a separate front end instance of Mathematica to avoid blocking the kernel while I worked on this computational essay.
If you want to see how much time has elapsed with a long-running computation, you can do something like this:
I like the simplicity of this challenge. On the other hand, I don’t like that finding the answer takes a really long time. There might be a way to do this better with parallel computing or with multiple kernels. However, I’m not sure about that. A lot of the options for that are under the Evaluation menu where you can control the kernels.

2015-12-05

https://adventofcode.com/2015/day/5

part 1

I am using Comap which is new in 14.0 of the Wolfram Language. I could have also used Through.
This matches the example where ‘ugknbfddgicrmopn’ and ‘aaa’ are nice:

part 2

2015-12-06

https://adventofcode.com/2015/day/6

part 1

This simple function goes from zero-based indexing 0...n-1 to 1 to n, which the Wolfram Language uses.
This also took a while to run.
Here is what MonitorProgress looks like:
Here’s another picture when it was almost done:
To find out how many light-bulbs are lit I add the flattened numbers up.
I could also use a level specification.

part 2

2015-12-07

https://adventofcode.com/2015/day/7

part 1

Since there are multiple uses of output for different cases, I am going to start to try to distinguish them by adding a number at the end like output1, output2, output3, output4, etc.:
For some reason EchoPerformance does not give what AbsoluteTiming gives, 71.1372 s.
The value of a is the answer to the problem:
Here are the values of all the variables:

part 2

I created a new file for part 2 where I made “b” have the value 3176.
This is the answer:

2015-12-08

https://adventofcode.com/2015/day/8

part 1

part 2

2015-12-09

I like this one because it’s a graph problem.
https://adventofcode.com/2015/day/9
Here we do use file1.

part 1

Here’s the example:

part 2

This is the answer to part 2:
This is for the example for part 2:

2015-12-10

https://adventofcode.com/2015/day/10
I had experience with this because I had seen something similar with this with this Wolfram Challenge:
https://challenges.wolframcloud.com/challenge/look-and-say-sequence

part 1

part 2

2015-12-11

https://adventofcode.com/2015/day/11
When I wasn’t sure what to name a function, I called it function1, function2, function3, function4, etc.
Here I am caching/memoization/dynamic programming/storing/using memory/remembering computed values to speed up the program with function1[input_] := function1[input] =...

part 1

I have stored the ResourceFunction EchoPerformance locally. If you would like to run this, you can do
EchoPerformance is like EchoTiming but it also adds memory usage information.
The answer is “next-password”  “hepxxyzz”.

part 2

2015-12-12

https://adventofcode.com/2015/day/12

part 1

part 2

2015-12-13

https://adventofcode.com/2015/day/13

part 1

part 2

I realize its better to use Sow and Reap than AppendTo.

2015-12-14

https://adventofcode.com/2015/day/14

part 1

part 2

2015-12-15

https://adventofcode.com/2015/day/15

part 1

The answer is 18965440.

part 2

The answer is 15862900.

2015-12-16

I thought this one was kind of weird.
https://adventofcode.com/2015/day/16

part 1

part 2

The answer is 323.

2015-12-17

https://adventofcode.com/2015/day/17

part 1

part 2

2015-12-18

https://adventofcode.com/2015/day/18

part 1

part 2

2015-12-19

https://adventofcode.com/2015/day/19
I have not been able to solve part 2. If you have an idea on how to solve part 2, please reply to this post.

part 1

part 2

2015-12-20

https://adventofcode.com/2015/day/20

part 1

part 2

This is the answer:

2015-12-21

https://adventofcode.com/2015/day/21
Here are the entities:

part 1

This is the answer:

part 2

This is the answer:

2015-12-22

I have not been able to solve part 1.

part 1

part 2

2015-12-23

I have not been able to solve part 1.

part 1

part 2

2015-12-24

part 1

part 2

2015-12-25

https://adventofcode.com/2015/day/25

part 1

part 2

To solve part 2, you need more stars for 2015. I don’t have enough stars to solve part 2 for 2015-12-25.

2016

2016-12-01

Part 1

Part 2

2016-12-02

https://adventofcode.com/2016/day/2

part 1

part 2

This is for the example:

2016-12-03

https://adventofcode.com/2016/day/3

part 1

part 2

2016-12-04

https://adventofcode.com/2016/day/4

part 1

part 2

2016-12-05

This one took a really long time to compute with MD5 hashes. For the moment, I will leave this out because this took a really long time to compute.

2016-12-06

I am going to add a new way to update these variables.
Right now its for 2016-12-04.
we run the update:
Now the filepath has been updated:
I am also going to stop posting the links.

part 1

part 2

Thanks for Arnoud Buzing for Rarest.

2016-12-07

part 1

part 2

2016-12-08

part 1

part 2

The answer is “UPOJFLBCEZ”.
This didn’t work as expected.

2016-12-13

part 1

Here’s some visualizations of the path:

part 2

2016-12-16

part 1

part 2

This takes a while the first time. The second time its much faster because the result is cached.

2016-12-18

part 1

part 2

2016-12-20

part 1

part 2

2017

2017-12-01

Part 1

Part 2

2017-12-02

part 1

part 2

2017-12-03

part 1

part 2

I downloaded the values for this OEIS sequence.

2017-12-04

part 1

part 2

2017-12-07

part 1

part 2

I was not able to solve part 2.

2017-12-12

part 1

part 2

2018

2018-12-01

https://adventofcode.com/2018/day/1

part 1

part 2

2018-12-02

part 1

part 2

This is for the example:

2018-12-03

part 1

part 2

This took a very long time to run. I am going to focus on other problems that do not take as long to run. The answer for me for part 2 was 412.
Here is a screenshot of the Wolfram Cloud notebook for reference.
One thing I would like to fix is to return 412 instead of 412*Null. Be prepared to wait.

2018-12-04

I liked this challenge.

part 1

part 2

2018-12-05

part 1

part 2

This takes a long time:

2019

2019-12-01

https://adventofcode.com/2019/day/1

part 1

part 2

2019-12-02

part 1

part 2

2019-12-03

part 1

part 2

2019-12-04

part 1

part 2

2019-12-06

part 1

part 2

2019-12-22

part 1

part 2

2020

2020-12-01

https://adventofcode.com/2020/day/1

part 1

part 2

2020-12-02

part 1

part 2

2020-12-03

part 1

part 2

2020-12-04

part 1

part 2

2020-12-05

part 1

part 2

2020-12-06

part 1

part 2

2020-12-07

part 1

part 2

2021

2021-12-01

https://adventofcode.com/2021/day/1

part 1

part 2

2021-12-02

part 1

part 2

2021-12-03

part 1

part 2

2021-12-04

part 1

part 2

2021-12-06

part 1

The answer is 345793 lanternfish.

part 2

2021-12-09

part 1

part 2

2022

2022-12-01

https://adventofcode.com/2022/day/1

part 1

part 2

2022-12-02

part 1

part 2

2022-12-03

part 1

part 2

2022-12-04

part 1

part 2

2022-12-06

part 1

part 2

CITE THIS NOTEBOOK

Solving Advent of Code problems​
by Peter Burbery​
Wolfram Community, STAFF PICKS, January 16, 2024
​https://community.wolfram.com/groups/-/m/t/3103495