Problem: Kefa and Park (Codeforces 580C). Kefa wants to visit a restaurant at a leaf of a tree. Some vertices have cats. Kefa cannot walk through more than consecutive vertices with cats. Count how many restaurants (leaves) he can reach from vertex (the root).
This requires carrying state: track the current streak of consecutive cats. If the streak exceeds , stop exploring that path. If you reach a leaf with a valid streak, increment the answer. This is DFS with state tracking.