For this Question: Given a matrix of N * M. Find the maximum path sum in matrix. The maximum path sum is sum of path elements from first row to last row where you are allowed to move only down(from (i,j) to (i+1,j)) or diagonally to left(from (i,j) to (i+1,j-1)) or right(from (i,j) to (i+1,j+1)). You can start from any element in first row. You can finish on any element of the last row.First line contains T, the number of test case.
For each test case you will be given two integers, N and M, denoting dimensions of the matrix
Each of the next N lines contains M integers, A[i][j] denoting the value of element at cell (i, j) of the matrix.
1 <= T <= 100
1 <= N, M <= 100
1 <= A[i][j] <= 1000For each test case, print a single line containing the maximum path sum as described in the problem statementSample input 1:
2
1 2
4 8 
4 3
1 8 5 
5 3 4 
6 2 3 
4 1 7 

Sample Output 1:
8
23

Explanation:
For 2nd test case, max path sum is of the following path: (1, 2) -> (2, 1) -> (3, 1) -> (4, 1), I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException {

        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());
        int[][] dp = new int[102][102];
        while(t-- > 0) {
            String[] s = br.readLine().split(" ");
            int n = Integer.parseInt(s[0]);
            int m = Integer.parseInt(s[1]);
            int ans = 0;
            int k = 0;




            for(int i = 1; i <= n; i++) {
                String[] temp = br.readLine().split(" ");
                for(int j = 1; j <= m; j++) {
                    int val = Integer.parseInt(temp[j-1]);
                    dp[i][j] = val + Math.max(
                        Math.max(
                            dp[i-1][j-1],
                            dp[i-1][j]
                        ),
                        dp[i-1][j+1]
                    );
                    if(i == n) {
                        ans = Math.max(ans, dp[i][j]);
                    }
                }
                k = k^1;
            }
            System.out.println(ans);
        }
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?