Since it's both, my suspect is the power supply or motherboard. If it's new, make it a warranty issue.
There are KEYBOARD LOGGERS that also can be suspect, but you can download a trial of EWIDO from google.com to rule out that.
Hi, I use regular mouse & keyboard (not UBS) and they work perfectly, but about 1/5 restarts Windows XP boots perfectly, but mouse and keyboard don't work.. Mouse is frozen and keyboard doesn't work either [even NumLock light won't light up when you press the button]..