Power down the Mac, reinstall the removed RAM stick, and reassemble the casing.
Believe it or not, some manufacturers provide "backdoor" ways to circumvent lost passwords, either through generic master passwords or specific key combinations. unlock efi password top
Restart your Mac and hold down to boot into macOS Recovery. Power down the Mac, reinstall the removed RAM
Boot the Mac while holding to reset the PRAM (repeat 3 times). Power down the Mac