For this Question: Given a 2-D array of binary integers of size NXM. The cell at i<sup>th</sup> row and j<sup>th</sup> column is denoted by (i, j).

The array is called Balanced if every cell of the array having 4 elements has a balanced neighborhood. A neighborhood is balanced if 4 neighbors can be divided into 2 groups with equal size and equal sum.

A cell at (i, j) has 4 neighbors (i-1, j), (i+1, j), (i, j-1), (i, j+1).The first line contains N and M.
Next N lines contain M integers each.

<b>Constraints</b> 
2 &le; N, M &le; 1000
0 &le; arr[i][j] &le; 1Print "YES" if the given array is balanced, otherwise print "NO".Input:
3 4
0 1 0 0
1 1 0 1
0 0 1 1 

Output:
NO

Explanation:
neighbors of (1, 1) => {1, 1, 0, 0} => 1+0 = 0+1 => balanced neighborhood
neighbors of (1, 2) => {0, 1, 1, 1} => no way to divide into two groups with equal sum and equal size => unbalanced

No other cell has 4 neighbors., I have written this Solution Code: import java.io.*;
import java.util.*;



public class Main {
     
   
    public static void main(String[] args) {
        
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        
        int n=Integer.parseInt(in.next());
        int m=Integer.parseInt(in.next());
       
        int a[][] = new int[n][m];
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++){
                a[i][j] = Integer.parseInt(in.next());
            }
        }
        
        int f=1;
        for(int i=1;i+1<n;i++){
            for(int j=1;j+1<m;j++){
                int sum=a[i+1][j] + a[i-1][j] + a[i][j+1] + a[i][j-1];
                if(sum%2 != 0){
                    f=-1;
                    break;
                }
            }
            if(f==-1)break;
        }
        
        if(f==1)out.print("YES");
        else out.print("NO");
        
        out.close();
    }

    
    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}
, In this Programming Language: Java, Now tell me if this Code is compilable or not?