Wrong answer in output everywhere else gets accepted

hello @shibangi

a) you are passing m-1 , since its size u need to pass m

b) check the output format u are asked to take modulo with 10^9+7

c) analyse the space complexity of ur solution , it quadratic becuase of with u may get run error or mle becuase of high memory usage try to solve it in O(SUM) space complexity

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.