Run-Error on "Maximum subarray sum"

My code of maximum subarray sum is run correctly but when i submit the code it shows run-error code . Please tell how can i remove it run error from my code.

Plz send your code by saving on ide only.


This is the link of my code .

Take int a[n ] instead of a[1000], and also solve this question using kadane’s algo . You are not following tht as well.