In your last submission, initially max should be equal to p.

For the example N=3 and X=5

a=[-1.-1.-1] answer should be 5

Hi! actually it would be of great help if you could mention the code line. Actually I’m new to coding and your suggestion will help he grow. Looking forward for your response!

```
#include <stdio.h>
int main()
{
int n,l,p,max;
scanf("%d",&n);
int a[n+1],b[n+1];
for(int i=0; i<n; i++)
{
scanf("%d %d", &l, &p);
max = p;
for(int j=0; j<l; j++)
{
scanf("%d",&a[j]);
max = max + a[j];
b[j]=max;
}
max=p; // Only here you need to change
for(int k=0; k<l; k++)
{
if(b[k]>max)
{
max=b[k];
}
}
printf("%d \n",max);
}
}
```