Question name: SPP topic : Mathematics Matrix Expo

This is my code link: https://ide.codingblocks.com/s/229271

I tried to solve this question but only 3 of 5 test cases were passing. I tried the hint given by Sir but still I am unable to solve the question. Please guide.

Hey @LP18Aug0068
Your code seems perfect
I could not find the issue myself
Iā€™m sending you my code to cross verify your solution and debug it