The code below is working fine on my offline compiler while cb's coding box is giving runtime error

#include
using namespace std;

int main() {
int m, n;
int a[30][30] = {0};
cin>> n>>m;

for( int i= 0 ; i< n ; i++){
	for ( int j = 0; j< m; j++){
		cin>>a[i][j];
	}
}
int search;
cin>> search;

int i = 0, j = m-1;

while( i < n && j< m && i>=0 && j>=0){

	if ( search > a[i][j]){
		i++;
	}

	else if ( search < a[i][j]){
		j--;
	}
	else{
		cout<< 1;
		return 1;
	}
}
cout<< 0;

return 0;

}

@snatchit This problem has been seen in a few more number of students. Please write it to [email protected] until then keep coding.