Let us suppose a stone of $4$kg mass falls from $5$ meter above upon an iron rod of the same mass which was entering the ground. Consequently the rod entered $10$ cm more deep into the ground.
Now considering the head of the iron rod as reference level total energy initially is that of the stone which is $m_{1}gh_{1}=4\times10\times 5=200$. Now after the rod has hit the ground $0.1$ meter deep, both the stone and rod's velocity becomes $0$ and so final energy of the system is $m_{2}g(-h_{2})=4\times 10 \times (-0.1)$. As we can see the energy has not been conserved. Where did i go wrong in this problem?