Hello Mohamed,
Can you confirm the make and model of the Keyboard and mouse you are experiencing the issue with?
One of the most common reasons this can happen is it needing a battery if it is wireless.
Another is that there can be dirt or grime under your keys in the keyboard.
I use this keyboard (Corsair K65) for gaming and this tutorial gives great step by step instructions on how to clean it. https://www.youtube.com/watch?v=_M42Ri3dqoc
Another option to use is open your Device Manager (can be searched in the start menu) or Press Windows Key + R and type devmgmt.msc
select View > Show hidden Devices
Expand your keyboards.
Right click on the keyboards, and select uninstall
Confirm and then restart your computer
Once it has turned off, disconnect your keyboard if it is an external one or power off if it is wireless (if no dongle) and login to your computer.
Once you have logged in reconnect the keyboard.
If you have any questions or concerns, please let me know!