For this Question: Given a binary NxN matrix A. Return A raised to the power p.
Print each element of the matrix modulo 10^9+7.First line contains two numbers, N and P, denoting the size of the matrix A and the power it is raised to respectively
Next N lines contain N numbers each representing the elements of the matrix A.

Contraints
1 <= N <= 100
1 <= p <= 10^9
Aij is either 0 or 1Print matrix A raised to the power p, each element modulo (10^9+7) Input
3 4
1 0 0
1 1 1
0 1 0

Output
1 0 0 
7 5 3 
4 3 2, 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));
		String str[] = br.readLine().split(" ");
		int N = Integer.parseInt(str[0]);
		int P = Integer.parseInt(str[1]);
		int a[][] = new int[N][N];
		for(int i=0;i<N;i++){
			str = br.readLine().split(" ");
			for(int j=0;j<N;j++){
				a[i][j] = Integer.parseInt(str[j]);
			}
		}
		a = power(a,P);
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				System.out.print(a[i][j]+" ");
			}
			System.out.println();
		}
	}
	static int[][] power(int a[][],int p){
		if(p==1){
			return a;
		}
		if((p&1)==1){
			int b[][] = a.clone();
			a = power(a,p-1);
			return multiply(a,b);
		}else{
			a = power(a,p>>1);
			int b[][] = a.clone();
			return multiply(a,b);
		}
	}
	static int[][] multiply(int a[][],int b[][]){
			int N = a.length;
			long sum =0;
			int c[][] = new int[N][N];
			for(int i=0;i<N;i++){
				for(int j=0;j<N;j++){
					sum = 0;
					for(int k=0;k<N;k++){
						sum += ((long)a[i][k]*b[k][j])%1000000007;
					}
					c[i][j] = (int)(sum%1000000007);
				}
			}
			return c;

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