Can you please explain where is the error in my code bcoz only 66 cases are passed

#include
using namespace std;
void stair(int a[30][30],int n,int m)
{
int x;
cin>>x;

bool iskeypresent=false;
int i=0;

int j=m-1;
while(i<j and j>=0)
{
	if(a[i][j]==x)
	{
		cout<<"1";
		iskeypresent=true;
		break;
	}

else if(a[i][j]>x)
{
	j--;
}
else{
	i++;
}

}

if(iskeypresent==false)
{
cout<<“0”<<endl;
}

}
int main() {
int N;
int M;
cin>>N>>M;
if(N<0 || N>30 || M<0 || M>30)
{
return 1;
}
int a[30][30];

//user input
for(int i=0;i<N;i++)
{
	for(int j=0;j<M;j++)
	{
		cin>>a[i][j];
	}
	
}

if(a[i][j]<0||a[i][j]>100)
{
	return 1;
}

stair(a,N,M);
return 0;

}

sir i tried the test case which u said and my output is coming 1 only, i m attaching the screen shot of output as well

.So can you pls resolve my issue