Make sure you check the mouse sensor is not blocked and is clean.
Check the surface you are using the mouse on, ensure it is flat and not transparent.
Make sure that the keyboard is clean.
Check keyboard/mouse is plugged in.
Change port if needed.
Restart PC
Press windows button> Search Device manager. Expand the Universal serial bus controllers. Right click on USB Host Controller> Click Uninstall. Repeat for all USB Host Controllers> Restart PC
Press windows + R and type “powercfg.cpl” and press enter. Click change plan settings> click advanced power settings. Expand USB settings> Disable USB selective suspend setting. Restart PC.