Connect keyboard and mouse to other computer to make sure issue isnt with them but the pc
additionally try to change USB ports from usb2 to usb3 this fixes some issues for people
if its the computer and the rest is working reinstall windows and hope its fixed. if its not its your motherboard taking a massive dump