why it's ahowing wrong answer?

question :https://www.codechef.com/problems/KC01

my solution:https://www.codechef.com/viewsolution/16395950

hi @pandey_96

see you are creating an array a[r+1] so, consider the pair (2000000007, 2000000006). Here your code will fail!
so, you can try other approach to calculate the nCr.

have a look : https://www.codechef.com/viewsolution/16397885