Whats is wrong in the code only two testcase passed

https://hack.codingblocks.com/app/practice/1/737/problem

@thakur0_0 please save your code on ide.codingblocks.com and share the link.

@thakur0_0 range of numbers can be upto 1000, the factorial can be quite big. So take it as long long int at least. One thing you can do for optimisation is use a dp array to store the values of previously calculated values.
This is the link of my code that passed all the cases, you can refer to this https://ide.codingblocks.com/s/260652

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.