The potential energy will be equal to kinetic energy so,
mgh=12mv2
So, v=√2gh
As both the bodies combine together and move, their momentum will remain conserve
According to principle of conservation of momentum will be,
m(√2gh)+m(0)=2m(v′)
v′=√gh2