question :KC01 Problem - CodeChef
my solution:CodeChef: Practical coding for everyone
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 : CodeChef: Practical coding for everyone