February 13, 2026

Solution for Advent of Code 2018 - Day 20: A Regular Map

Link to the puzzle text

Part 1

In this puzzle, we have a string showing possible ways through a grid. The ways are encoded similar to a regular expression, where each character either shows a transition between cells in the grid ("NEWS" for the 4 directions) or a branch between possibilities starting with "(" and seperated by "|". We should find the longest shortest path to a reachable cell.

We start by saving the shortest possible path to each cell in a dictionary and have a current position starting in the top left. We parse the input string character by character. Directions are handled by updating the current position and shortest path dictionary. For the branches we keep a stack of previous positions. Whenever we start a branch, we push the current position onto the stack. For branch ends or seperators, we just restore the position before taking the branch.

The answer is then the largest distance we found over all cells. 

Part 2

In part 2, we should find the number of cells reachable in over than 1000 steps.

We can reuse the previous dictionary and count the number of elements with value more than 1000.

Link to my solutions

February 10, 2026

Solution for Codyssi 2025 - Absurd Arithmetic

Link to the puzzle text

Part 1

In this puzzle, we are given three operations and a list of room prices. We should first find the median price of the input and apply the operations in reverse. 

The median price is found by first sorting the prices and then taking the element in the middle. For applying the operations, we can parse them via regex, since only a few templates are used

Part 2

In part 2, we should first sum all the even prices. Afterwards, we should apply the same operations again.

We can find the sum of the even numbers easily. The applying of the operations was done in the same manner as in part 1.

Part 3

In part 3, we should find the highest price, which after applying the operations, is still under a limit. We use a function for reversing the operations starting with the upper limit. For example a power operations turns into a root operations. After each step, we round down to an integer. Once we have the upper limit for the price, we choose the highest price still under this limit.

Link to my solutions

February 06, 2026

Solution for Advent of Code 2018 - Day 19: Go With The Flow

Link to the puzzle text

Part 1

In this puzzle we have a program consisting of multiple opcodes. The opcodes are executed by a virtual computer with 6 registers, one of which is the instruction pointer saving the current instruction. We should execute the program and return the content of register 0.

The opcodes are the same as in day 16, so we could reuse a lot of the code. The first line of the program contained metadata about which register is the instruction pointer, so after parsing it we deleted it from the rest of the program. 

Part 2

In part 2, we have the same program but we should initialize one register with a different value instead. We should still execute the program and return the content of register 0.

After letting the previous solution run for a while it still did not finish so a different solution was needed. We converted the opcodes manually into a more readable form and analyzed its function. The program is calculating the sum of all divisors for a given input number determined by the value of register 0 at the start.

We changed the previous solution to run until it finished initialization. Then we stop the execution and calculate the divisor sum in python instead. This was checked against the previous solution and can be turned off via a flag.  

Link to my solutions