The second picture shows the textbook solution which I don't find convincing and the third picture shows my work.
I don't understand why will the block fall 40 cm toward the bottom of the vessel as given in the solution. According to me, buoyant force will act upon the block and it should fall to a height lesser than 40cm. If that is so, then we cannot write
$mgh = loss in energy$ The loss in energy will be less.
Where am I wrong? Why did the solution did not take buoyant force into consideration?
Also, when the spring is attached to the block, the block has $0.5 kx^2$ elastic potential energy. After the support of the spring has been broken, the block no longer possesses this energy.
Where does this elastic potential energy go?