#include<iostream> #include<vector> #include<stack> using namespace std; int main(){ int N,M; cin>>N>>M; int rec[N][M]; int dir[4][2]={-1,0,1,0...