This is a widely reported scam on Discord, Minecraft... etc. where they ask you for that code to join their server or realm, that code you provided the scammers with gave them full access to your account and they immediately change the recovery details like the associated Email to block you from accessing the account, that is why you are now seeing that your account no longer exists.
I wish I had better news, but when a Microsoft account is hacked, if the hackers change the associated Email, then that account is usually no longer recoverable, this forum is just a user to user account and no-one here has any account access, try using the process they provide on this link to recover a hacked account, if this process is not successful, sadly, that account cannot be recovered.