A tree has N nodes, each containing some apples. Starting from node 1, you can take at most K steps along edges. At each node you visit, you eat all the apples there.
Return the maximum number of apples you can eat.
**Input:** `n` (number of nodes), `k` (max steps), `apples` (list of apple counts per node, 1-indexed), `edges` (list of [u, v] pairs).
**Constraints:** 1 ≤ N ≤ 100, 0 ≤ K ≤ 200
*Classic tree DP problem (POJ 2486, authored by magicpig@ZSU)*
def apple_tree(n: int, k: int, apples: list[int], edges: list[list[int]]) -> int:
A tree has N nodes, each containing some apples. Starting from node 1, you can take at most K steps along edges. At each node you visit, you eat all the apples there.
Return the maximum number of apples you can eat.
**Input:** `n` (number of nodes), `k` (max steps), `apples` (list of apple counts per node, 1-indexed), `edges` (list of [u, v] pairs).
**Constraints:** 1 ≤ N ≤ 100, 0 ≤ K ≤ 200
*Classic tree DP problem (POJ 2486, authored by magicpig@ZSU)*
def apple_tree(n: int, k: int, apples: list[int], edges: list[list[int]]) -> int: