Tests fails just one accepted

just look at the code and tell me what is the problem

The issue is that MAX_W should be larger to accommodate maxW values up to 1000. Update MAX_W to 1001 to fix out-of-bounds errors.

You can refer my code as well

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.