maximizing sub array problem

i praticing my programming with this problem. yet for some reason i didn’t know my program always error when i give the input. i already debuuging it. and got right answer when i input it one by one . the detail of the problem is in this link

here my code from that problem

#include<stdio.h>
#include<algorithm>

using namespace std;
int middle(int abal[],int low,int mid,int high)
{
    int left=0;
    int sum(0);
    for(int x=mid;x>=low;x--){sum+=abal[x];if(left<sum)left=sum;}
    
    int right=0;
    sum=0;
    for(int x=mid+1;x<=high;x++){sum+=abal[x];if(right<sum)right=sum;}
    return left+right;
    
}
int maxsubarray(int abal[],int low,int high)
{
    if(low==high)return abal[low];
    int mid =high>>1;
    
    return max(max(maxsubarray(abal,low,mid),maxsubarray(abal,mid+1,high)),middle(abal,low,mid,high));       
}

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
              int a,b,c;
              scanf("%d",&a);
              int abal[a-1];
              scanf("%d",&b);
              for(int x=1;x<a;x++)
              {
                      scanf("%d",&c);
                      abal[x-1]=c-b;
                      b=c;    
              }
              for(int x=0;x<a-1;x++)printf("%d ",abal[x]);printf("\n");
              int hasil=maxsubarray(abal,0,a-2);
              printf("%d\n",hasil);
    }   
}