Solution (source code)

= Solution

If B arrives during the remaining pass phase, then $r<t+\tau_0<R$, or $r-t<\tau_0<R-t$. It passes immediately, so
$$
\tau_1=(t+\tau_0)-r=\tau_0-(r-t).
$$
Because $r-t>0$, this is strictly between zero and $\tau_0$. The phase interval has length $(R-t)-(r-t)=R-r$, giving
$$
\boxed{\mathbb P(0<\tau_1<\tau_0\mid t)=\frac{R-r}{R}.}
$$