Our system includes the two balls. The columb free between the two balls is an internal force for the system. Internal forces do not affect the motion of the center of mass. The motion of center of mass takes place only under the influence of gravity. The center of mass moves along a parabolic trajectory. Since the initial velocity of the two balls is horizontal, the time taken to travel distance x is x/v and the vertical height fallen by the center of mass in this time is
y=12g(xv)2
Position of center of mass at this moment from the ground is
h=h1+h22−12g(xv)2
When the first ball touches and ground at a distance x=R, the height of the center of mass from the ground is
h=h1+h22−12g(Rv)2
As the masses of the balls are equal, the second ball will be at a height h2=2h at this instant. Therefore,
h2=h1+h2−g(Rv)2