The only difference is in line no 109 .
can u give me the reason please …!!!
@l_returns can u help plz …!!!
In WA soln: let’s assume (fac[n]%mod) = 1e9, (inverse[n-r]%mod) = 1e9, (inverse[r]%mod) = 1e9 and multiply of them near 1e27 and you didn’t use mod in between them, so int (long long) overfolow
This is an example of incorrect assumption of operator precedence in C++. This is how the code snippet actually works:
val = ( ( ( ( ( fac[n] % mod ) * inverse[n - r] ) % mod ) * inverse[r] ) % mod ) % mod;
Here is the code with the upper snippet in action (in lines
Thanx @ souradeep1999