1 5 1 2 -1 3 -2
5
#includeint main() { int N; scanf("%d",&N); while(N--) { int max,n,i,sum; scanf("%d",&n); scanf("%d",&sum); max=sum; n=n-1; while(n--) { scanf("%d",&i); if(sum>=0) sum+=i; else sum=i; if(sum>max) max=sum; } printf("%d\n",sum); } return 0; }