please help me in finding reason of WA
In power((fac[arr[i]-arr2[i]]*fac[arr2[i]]),M-2)), you are passing no = product of factorials directly, and you will end up squaring this value in power() which will lead to overflow and might give -ve result.
Just pass product \mod 998244353 instead of directly passing the product. Rest of the code seems to be fine.
When are the certificates getting distributed?