I have done using hint tell the inputs for which coming wrong
hey Sparsh!, if you want the inputs to this problem then you may download same in editorial/solution section but remember doing so will not award you points on submitting correct solution for this problem.
your implementaion for pre_ and suf_ is bit incorrect. initialize ans with zero and store in ans maximum sum of all prefix/suffix without breaking when a[i]<0