Problem in finding the wrong test case

For the problem SUMTRIAN Problem - CodeChef iam not been able to figure out the wrong test case can anyone help? here’s my code

#include <stdio.h>
#include <stdlib.h>

int main()

{

int t,num,a[101][101],test,i,j,max=-1,profit[101][101],maxp;

scanf(“%d”,&t);

for(test=1;test<=t;test++)
{

scanf(“%d”,&num);

for(i=1;i<=num;i++)
{

for(j=1;j<=i;j++)
{

scanf(“%d”,&a[i][j]);
}

        }
        profit[1][1]=a[1][1];
        for(i=2;i<=num;i++)
        {
            for(j=1;j<=i;j++)
            {
                if(j==1)
                    maxp=profit[i-1][j]+a[i][j];
                else if(j==i)
                    maxp=profit[i-1][j-1]+a[i][j];
                else
                {
                    if(profit[i-1][j]+a[i][j]>=profit[i-1][j-1]+a[i][j])
                        maxp=profit[i-1][j]+a[i][j];
                    else
                        maxp=profit[i-1][j-1]+a[i][j];
                }

                profit[i][j]=maxp;

            }
        }
          for(i=1;i<=num;i++)
          {
              if(profit[num][i]>max)
                max=profit[num][i];
          }
            printf("%d\n",max);

}

return 0;

}

Can you explain what you trying to do ?

Start from the second last row.
then fill the table.
You will automatically end up with answer in a[1][1].

for(i=n-1;i>=1;i--)
for(j=1;j<=i;j++)
{
 k=max(a[i+1][j],a[i+1][j+1])
 a[i][j]=a[i][j]+k;

}

ans=a[1][1];

am just filling the table in a bottom up way and then printing the maximum element from the last row

found my mistake am not updating max=-1 in every test case

Actually i have found my mistake i was not updating max=-1 in every test case now it is accepted by the way thanks for ur precious time