The springs stored energy is transferred to the cube as kinetic energy and then by the slop the KE is converted to height energy.
0.5 . k . x^2 = 0.5 . m . v^2 = m . g . ∆h
0.5 . 50 . (0.1^2) = 0.05 . 9.8 . ∆h
∆h = 0.51 m = 51 cm
This is the height gained
Distance along the slope = ∆h / sin 60 = 0.589 = 59 cm
In the second case, the stored spring energy is converted into height energy AND frictional heat energy.
The height energy is m . g . d sin 60 where d is the distance the cube moves along the slope.
The Frictional energy converted is F . d
F ( the frictional force ) = µ . N
N ( the reaction to the component of the gravity force perpendicular to the surface of the slope ) = m . g . cos60
Total energy converted
0.5 . k . x^2 = (m . g . dsin60) + (µ . m . g . cos60 . d )
Solve for d
d = 0.528 = 53 cm