1) 4.9 cm
The initial mechanical energy of the spring+mass system is sum of gravitational potential energy and elastic potential energy of the spring:

where:
m = 2 kg is the mass
g = 9.8 m/s^2
h = 20 m is the height of the roof top
k = 40,000 N/m is the spring constant
x is the compression of the spring
When the mass hits the ground, its mechanical energy is just kinetic energy:

where v = 21 m/s is the speed. Since energy is conserved, we can equalize the two expressions, and solving for x we find the compression of the spring:

2) 79 J
The initial mechanical energy of the spring-mass system is

While the final mechanical energy of the mass is

So, the energy lost due to air resistance is
