If a spring extends by x on loading, then energy stored by the spring is (if T is the tension in the spring and K is the spring constant)
T22x
T22K
2KT2
2T2K
U=12Kx2 but T=KxSo energy stored =12(Kx)2K=12T2K