Figuring out Wrong test case

iam not being able to figure out the wrong test case in my code for the problem PPTEST Problem - CodeChef can anyone help? my code goes out like this

#include<stdio.h>
#include <stdlib.h>
int max(int a ,int b)

{

if(a>b)

return a;

else

return b;

}

int main()

{

int t,n,w,testcase,i,j;
int g[101][101];
int a[101][101];
int b[101][101];

scanf(“%d”,&t);

for(testcase=1;testcase<=t;testcase++)

{

scanf(“%d %d”,&n,&w);

for(i=1;i<=n;i++)

{

for(j=1;j<=3;j++)

{

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

}

}

for(i=1;i<=n;i++)

{

for(j=1;j<=w;j++)

{

if(i==1)

{

if(j>=g[i][3])

{

a[i][j]=g[i][1]*g[i][2];

b[i][j]=g[i][3];

}

else

{

a[i][j]=0;

b[i][j]=0;

                 }

}

else if(j>=g[i][3])

{

if(g[i][3]+b[i-1][j]<=w)

{

a[i][j]=max(((g[i][1]*g[i][2])+a[i-1][j]),g[i][1]*g[i][2]);

b[i][j]=g[i][3]+b[i-1][j];

}

else

{

a[i][j]=a[i-1][j];

b[i][j]=b[i-1][j];

}

}

else

{

a[i][j]=a[i-1][j];

b[i][j]=b[i-1][j];

}

}

}

printf(“%d\n”,a[n][w]);

}

return 0;

}