Hints: Remove at the lowest cost
Answer to Hint 7: Along the recursion, a cheaper removal cost can appear on an ancestor’s block. Whenever the “effective” per-step charge is driven by the cheapest $c$ seen on the path from the root down to $v$, define
$$ C(v) = \min_{u \text{ on path root} \to v} \mathrm{mn}(u)\,. $$That is exactly the quantity you propagate from parent to child when you take pointwise mins down the tree.
Answer to Hint 10: As soon as some ancestor’s block has a zeroed index, the propagated minimum $C(\cdot)$ along that path can drop earlier than the first zero inside $v$ itself. So define
$$ T^*(v) = \min_{u \text{ on path root} \to v} R(u)\,, $$and propagate this minimum downward exactly like $C(v)$.
The model program model_sol_2.cpp encodes the same cost object as the tree decomposition, but builds it by scanning indices in increasing removal cost and painting an interval for each index. Hints below follow that file.
For a fixed index $x$, consider the closed index range
$$ [L, R] = [l[x] + 1,\, r[x] - 1]\,. $$(If $l[x] = -1$ and $r[x] = n$, this is the whole array.) Why is it exactly the set of positions that “see” $x$ as the relevant maximum in the stack picture before you think about costs?