I think problem is `nCr`

function. May be overflow

You may try this

## nCr

```
void nCr(int n, int r)
{
long long p = 1, k = 1;
if (n - r < r)
r = n - r;
if (r != 0) {
while (r) {
p *= n;
k *= r;
long long m = __gcd(p, k);
p /= m;
k /= m;
n--;
r--;
}
}
else
p = 1;
cout << p << endl;
}
```

1 Like

Sir out of 7 tasks only the 4th task is wrong task of 5th 6th and 7th are correct are you sure it is overflow issue

can you please give me a test case for that ?

if you can give me a test case it will be very helpful

n=40 and k=25

arr[]=1,1,1…

1 Like

Thanks a lot