Help Distributing Apples CSES problem set

problem link:distributing Apples
submission link: https://cses.fi/paste/8dd075f80cfd540b1a760b/
I tried to solve above problem but my code is giving runtime error for 3 test cases…
can anyone explain whats wrong with my code?

n+m-1 can take the value 2*10^6 -1 but fact array is declared only till 10^6 -1.
Just increase the array size.

2 Likes

thank you