Modular exponentiation question?

pls check if the editorials code is correct ?

@mehulbhandari358
Can you please send me the code? Would be of great help.