The pop-ups, etc are due to malware on your computer. Run Malwarebytes Anti-Malware to get rid of them. (If you've not already got Malwarebytes on your computer, download and install the free version from here:
https://www.malwarebytes.org/antimalware/ Take care to deselect the pre-ticked option to take a free trial of the Premium version).
Getting rid of the malware might fix your other problems. If not, the freezing problem is most likely related to something associated with Windows automatically going into either 'Sleep' or 'Hibernation' mode after a certain period of inactivity (and then being unable to recover from there). It's a common problem across most versions of Windows, which is overcome simply by cancelling the setting that automatically invokes sleep/hibernation.
Reformatting your hard drive and reinstalling Windows should definitely be avoided for the time being. There are plenty of other options that should be tried first, including using the built-in repair facility within Windows itself: