Thank you Adam from St Alban's School and Andrei from Tudor Vianu National College, Bucharest, Romania for your solutions to this problem.

Ball A moves down a frictionless inclined plane. Its velocity $v_A$ at the base of the plane is determined from the law of conservation of energy: $$m_Ag.4h ={1\over 2}m_Av_A^2\;.$$ The gravitational potential energy (given on the left side) is transformed into kinetic energy at the base of the plane. Here the zero level for the potential gravitational energy is fixed to be the horizontal at the
base of the plane, and the gravitational field of the Earth is supposed to be uniform.

From the previous equation, $v_A$ is determined as: $v_A=2\sqrt{2gh}$.

After that, ball $A$ collides with ball $B$ at rest. We assume ball $A$ is moving horizontally with velocity $v_A$ when it collides with ball $B$. After the collision the horizontal velocities of balls $A$ and $B$ are $u_A$ and $u_B$ respectively. The collision is characterised by the coefficient of restitution k: $$k = {{u_B - u_A}\over {v_B - v_A}}$$ and by the law of conservation of momentum:
$$m_Av_A + m_Bv_B = m_Au_A + m_Bu_B\;.$$ In this particular case, $m_A = 2m,\ m_B = m,\ v_B = 0,\ k = 0.5.$ Solving the system of $2$ equations for the unknowns, $u_A$ and $u_B$: $u_B = v_A$ and $u_A = 0.5v_A$, i.e. after collision both balls move in the same horizontal direction as the direction of ball $A$ before collision, ball $B$ quicker than ball $A$. Ball $B$ is then projected horizontally
with velocity $v_B$. Associating to the movement a system of cartesian axes and measuring time from $t=0$ when ball $B$ is at height $h$ then when the ball hits the ground: $$x = u_Bt$$ and $$y = {1\over 2}gt^2 = h\;.$$ The horizontal distance traveled by ball $B$ is $$x = u_B\sqrt{{2h\over g}}= v_A\sqrt{{2h\over g}}=2\sqrt{2gh}\sqrt{{2h\over g}}=4h\,.$$