Advent of Code 2025 - December 11th
Source: Dev.to

In this series, I’ll share my progress with the 2025 version of Advent of Code.
Check the first post for a short intro to this series.
You can also follow my progress on GitHub.
December 11th
The puzzle of day 11 was fun and not as hard as the days before. I completed this day before part two of December 9 and both parts of December 10.
My pitfall for this puzzle
I was stuck on the second part with some complex bookkeeping code. A small hint on Reddit was needed to successfully complete part two.
#include
#include
#include
#include
#include
#include
struct Edge {
const std::string from, to;
};
struct Graph {
std::vector nodes;
std::vector edges;
};
Graph loadInput(const std::string &filename) {
Graph result;
std::ifstream file(filename);
std::string line;
while (std::getline(file, line)) {
auto colonIndex = line.find(':');
std::string fromName = line.substr(0, colonIndex);
result.nodes.push_back(fromName);
for (unsigned int i = colonIndex + 2; i visited, std::map &lookupMap) {
std::vector next;
for (const auto &[from, to] : g.edges) {
if (from == startNode) {
next.push_back(to);
}
}
visited.insert(startNode);
long result = 0;
for (const auto &nextNode : next) {
if (nextNode == endNode) {
return 1;
}
if (visited.find(nextNode) == visited.end()) {
if (lookupMap.find(nextNode) != lookupMap.end()) {
result += lookupMap.at(nextNode);
} else {
auto count = walk(g, nextNode, endNode, visited, lookupMap);
lookupMap.insert({nextNode, count});
result += count;
}
}
}
return result;
}
long traces(const Graph &g, const std::string &startNode, const std::string &endNode) {
std::map lookupMap;
return walk(g, startNode, endNode, std::set(), lookupMap);
}
void partOne() {
const auto graph = loadInput("/Users/rob/projects/robvanderleek/adventofcode/2025/11/input.txt");
auto result = traces(graph, "you", "out");
std::cout lookupMap;
long a1 = traces(graph, "svr", "dac");
long a2 = traces(graph, "dac", "fft");
long a3 = traces(graph, "fft", "out");
long b1 = traces(graph, "svr", "fft");
long b2 = traces(graph, "fft", "dac");
long b3 = traces(graph, "dac", "out");
long result = a1 * a2 * a3 + b1 * b2 * b3;
std::cout << result << std::endl;
assert(result == 662);
}
int main() {
partOne();
partTwo();
return 0;
}
That’s it! See you again tomorrow!