For this Question: Given a boolean 2D matrix (0-based index), find whether there is path from (0,0) to (x,y) and if there is one path, print the minimum no of steps needed to reach it, else print -1 if the destination is not reachable. You may move in only four direction ie up, down, left and right. The path can only be created out of a cell if its value is 1. The first line  contains two integers n and m denoting the size of the matrix. Then in the next line are n*m space-separated values of the matrix. The following line after it contains two integers x and y denoting the index of the destination.

Constraints:
1<=n,m<=1000For each test case print in a new line the min no of steps needed to reach the destination.Input:
3 4
1 0 0 0 1 1 0 1 0 1 1 1
2 3

Output
5

Input
3 4
1 1 1 1 0 0 0 1 0 0 0 1
0 3

Output:
3, I have written this Solution Code: #include<bits/stdc++.h>
using namespace std;

#define pu push_back
#define fi first
#define se second
#define mp make_pair
#define int long long
#define pii pair<int,int>
#define mm (s+e)/2
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(int i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define sz 200000
#define qw1 freopen("input1.txt", "r", stdin); freopen("output1.txt", "w", stdout);
#define qw2 freopen("input2.txt", "r", stdin); freopen("output2.txt", "w", stdout);
#define qw3 freopen("input3.txt", "r", stdin); freopen("output3.txt", "w", stdout);
#define qw4 freopen("input4.txt", "r", stdin); freopen("output4.txt", "w", stdout);
#define qw5 freopen("input5.txt", "r", stdin); freopen("output5.txt", "w", stdout);
#define qw6 freopen("input6.txt", "r", stdin); freopen("output6.txt", "w", stdout);
#define qw freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
int xa[4]={1,-1,0,0};
int ya[4]={0,0,1,-1};
int n,m;
int check(int x,int y)
{
	if(x>=0 && x<n && y>=0 && y<m)
	{

		return 1;
	}else return 0;
}
int vis[1005][1005];
int dist[1005][1005];
int A[1005][1005];
signed main()
{
	



		
			cin>>n>>m;
			
			for(int i=0;i<n;i++)
			{  for(int j=0;j<m;j++)
				{cin>>A[i][j];
				dist[i][j]=100000000;
				vis[i][j]=0;
				}
			}
			multimap<int,pii> ss;
			ss.insert(mp(0,mp(0,0)));
			dist[0][0]=0;
			while(ss.size()>0)
			{
				auto it=ss.begin()->se;
				int a=it.fi,b=it.se;
				ss.erase(ss.begin());
				if(vis[a][b]==1) continue;
				vis[a][b]=1;
				 

				for(int i=0;i<4;i++)
				{
					int x=a+xa[i];
					int y=b+ya[i];
					
					if(check(x,y)==1 && dist[x][y]>dist[a][b]+1 && A[x][y]==1)
					{
						dist[x][y]=dist[a][b]+1;
						ss.insert(mp(dist[x][y],mp(x,y)));
					}
				}
			}
			int d1,d2;
			cin>>d1>>d2;
			if(dist[d1][d2]>=10000000) cout<<-1<<endl;
			else cout<<dist[d1][d2]<<endl;

		}

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