The energy you start with Espr = 1/2 kx2 where x is the compression and k the spring constant
The energy you end with is all gravitational potential energy EP = mgh (you don't care that the energy was in the form of kinetic energy between the initial and final states as total energy is conserved (no dissipative force)
h = kx2/(2mg) All t he units are in SI, so you can plug in.
I tacked the following on to show that there may be more to this problem...
Unfortunately, many books and standardized tests get this analysis wrong (the one I just gave you is only valid if the compression is much smaller than the height calculated. This is usually valid, but not completely. If you were actually launching something, you would care about the height above the point where the spring is uncompressed. Because potential energy is linear, the height above the unstretched spring is h-x. This can be incorporated in the energy balance as having negative potential to start with from the height of the mass of the compressed spring