In the scenario you described, where a spring is connected horizontally with a string and a pulley, the potential energy associated with the spring is given by the equation:
Potential energy = 1/2kx^2
Here, k represents the spring constant, and x represents the displacement of the spring from its equilibrium position. The factor of 1/2 arises from the mathematical derivation of the potential energy of a spring, which involves integrating the force exerted by the spring over the displacement.
Therefore, when the person pulls the pulley to its maximum position, the potential energy of the spring is given by 1/2kx^2, where x is the maximum displacement of the spring from its equilibrium position.