Why this is showing run time error although working properly on custom input tell please

Hello @Namanjain123,

This is because you are not satisfying the test cases:

  1. 1 <= N <= 100000
    Your array can hold only 2000 elements

  2. -100000000 <= A[i] <= 100000000
    The sum can be greater than the range of int.
    Return type and datatype of ms and cs are int.

I have modified your code.

Hope, this would help.
Give a like, if you are satisfied.

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.