Help me in solving SUMTRIAN problem

My issue

My code

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner read=new Scanner(System.in);
		int T=read.nextInt();
		while(T-->0){
		    int n = read.nextInt();
		    int[][] a = new int[n][n];
		    for(int j=0; j<n; j++){
		        for(int k=0; k<=j; k++){
		            int ele = read.nextInt();
		            a[j][k] = ele;
		        }
		    }
		    for(int j=n-2; j>=0; j--){
		        for(int k=0; k<=j; k++){
		            a[j][k] = a[j][k] + Math.max(a[j+1][k], a[j+1][k+1]);
		        }
		    }
		    System.out.println(a[0][0]);
		}
	}
}

Problem Link: SUMTRIAN Problem - CodeChef