Help in a problem

There’s this problem on atcoder and this is my solution.

I’m unable to get AC only in 1 test-case rest all are passing. Can anyone help?

One + mod at the end is not enough, you might be getting -ve answers in some testcases

1 Like

Thanks, problem solved. But I’m curious, how can 2^n is smaller than nCr(r<=n)?

2^n\ mod\ p, not 2^n.

1 Like