#include<bits/stdc++.h> using namespace std; using ll=long long; const ll N=2e3+5; vector<vector<char>>g; vector<vector<bool>>vis; using PII=pair<ll,ll>; ll n,m; ll cnt_r,cnt_l; ll dx[]={0,0,1,-1}; ll dy[]={1,-1,0,0}; ll bfs(ll i,ll j){ queue<PII>q; q.push({...