Matrix Decomposition | April Cook Off 2020

Can anyone help me where i went wrong ?

My Solutions : CodeChef: Practical coding for everyone
CodeChef: Practical coding for everyone (Improved Version)

Line 19
pow() function will give overflow
for n=100 a=1000000000

Use modular exponentiation