Solution (source code)

= Solution

Interchanging the order of the finite sums gives
$$
\begin{aligned}
\sum_{i=1}^n\widehat M_i
&=\sum_{i=1}^nv_i
-\sum_{i=1}^n\sum_{j=1}^i\frac{v_j}{n-j+1}\\
&=\sum_{j=1}^nv_j
-\sum_{j=1}^n\frac{v_j}{n-j+1}
\sum_{i=j}^n1\\
&=\sum_{j=1}^nv_j-\sum_{j=1}^nv_j=0.
\end{aligned}
$$
Each hazard increment is counted once for every individual exposed to it, exactly reproducing its event count.