Solution (source code)

= Solution

The retained <mass> at time $t$ is $M(t)=M_0+kt$. Incoming rain has zero horizontal <momentum> in the ground <reference frame>. During $dt$, horizontal <momentum conservation> for the carriage and the rain about to enter gives
$$
M(t)u(t)=[M(t)+k\,dt][u(t)+du]+O(dt^2),
$$
so
$$
M\dot u+ku=0,\qquad
\boxed{u(t)=\frac{M_0u_0}{M_0+kt}.}
$$
This is a <variable-mass system>: the entering <mass> must be accelerated horizontally, even though no external horizontal <force> acts on the carriage-plus-rain system. Integrating the <velocity>,
$$
\boxed{x(t)-x(0)=\int_0^t\frac{M_0u_0}{M_0+ks}\,ds
=\frac{M_0u_0}{k}\ln\left(1+\frac{kt}{M_0}\right).}
$$
For $u_0\ge0$ this is also the distance travelled. Its $k\to0$ limit is $u_0t$. Vertical impact can dissipate <kinetic energy>; horizontal <momentum conservation> does not require <kinetic energy> conservation.