You know that when the displacement is equal to the amplitude (A), the velocity is zero, which implies that the kinetic energy (KE) is zeero, so the total mechanical energy (ME) is the potential energy (PE).
And you know that the potential energy, PE, is [ 1/2 ] k (x^2)
Then, use x = A, to calculate the PE in the point where ME = PE.
ME = PE = [1/2] k (A)^2.
At half of the amplitude, x = A/2 => PE = [ 1/2] k (A/2)^2