Solution (source code)

= Solution

Under the <null hypothesis> of equal event-time distributions, every member of the combined <risk set> has the same instantaneous chance of being the next event. Conditional on one event at $a_j$ and on the two risk-set sizes,
$$
U_j\sim\operatorname{Bernoulli}\!\left(
\frac{r_j^{(1)}}{r_j^{(0)}+r_j^{(1)}}
\right),
$$
so
$$
\mathbb E_0(U_j\mid r_j^{(0)},r_j^{(1)})
=\frac{r_j^{(1)}}{r_j^{(0)}+r_j^{(1)}}.
$$