i guess this mostly comes up because you are solving both parts in one pass, because of how AOC is structured (you have to solve part 1 to see part 2), I think most people wrote a separate function for each, in which case you typically just use
count