No output for large permutations

Kindly help why this code does not produce any output for large value input like (1000,2).
I have used the modulo property as well.
Please help me debug the program.
Code File: https://ide.codingblocks.com/s/176358

@prat98
Hello Pratyush your code is not producing output for large input because u are using recursion and your solution time complexity is roughly exponential.
Hint - to reduce time complexity try dynamic programming

@prat98,
Hello pratyush let me know if you are still facing any issue.

Thanks for the hint.I’ve

But still test cases are nit passed can you explain the error in this program https://ide.codingblocks.com/s/177020

@prat98
hello pratyush line no - 37 (check value of modulo)

@prat98
do u still have any doubt ,pls let me know

Awesome! Thanks for the help