AoC '21, Day 11


Imagine an n x m matrix of octopuses. Each octopus has an integral amount of energy, and all octopuses increase their energy by one uniformly and regularly. When an octopus's energy reaches a threshold, it flashes, which reduces its energy to zero, and adds an extra unit of energy to all its neighbors (usually eight, although fewer for the edge-case octopuses). The first problem is to report the total number of flashes during the first 100 increase-flash cycles. The second problem is to determine the number of cycles it takes until all octopuses are flashing at the same time.