Language: C++

//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
using namespace std;
const int size=21;
const int inf=1e9;
int h,w;
string grid[size];

int r[]={0,0,1,-1};
int c[]={1,-1,0,0};

int dijkstra(int x1,int y1){
	vector<vector<int> > dist(h,vector<int>(w,-1));
	queue<pii> q;
	q.push(mkp(x1,y1));
	dist[x1][y1]=0;
	int mx=0;
	while(!q.empty()){
		int ui=q.front().first;
		int uj=q.front().second;
		q.pop();
		mx=max(mx,dist[ui][uj]);
		if(ui+1>=0 && ui+1<h && grid[ui+1][uj]!='#' && dist[ui+1][uj]==-1){
			dist[ui+1][uj]=dist[ui][uj]+1;
			q.push(mkp(ui+1,uj));
		}
		if(ui-1>=0 && ui-1<h && grid[ui-1][uj]!='#' && dist[ui-1][uj]==-1){
			dist[ui-1][uj]=dist[ui][uj]+1;
			q.push(mkp(ui-1,uj));
		}
		if(uj+1>=0 && uj+1<w && grid[ui][uj+1]!='#' && dist[ui][uj+1]==-1){
			dist[ui][uj+1]=dist[ui][uj]+1;
			q.push(mkp(ui,uj+1));
		}
		if(uj-1>=0 && uj-1<w && grid[ui][uj-1]!='#' && dist[ui][uj-1]==-1){
			dist[ui][uj-1]=dist[ui][uj]+1;
			q.push(mkp(ui,uj-1));
		}
	}
	return mx;
	
}

int solve()
{
	cin>>h>>w;	
	for(int i=0;i<h;i++){
		cin>>grid[i];
	}
	int mx=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(grid[i][j]!='#'){
				int x=dijkstra(i,j);
				mx=max(mx,x);
			}
		}
	}
	cout<<mx<<endl;
	return 0;
	
}
signed main()
{
	fastio;
//	test
		solve();
}

Compiler output:
a.cc:27:13: error: reference to 'size' is ambiguous
   27 | string grid[size];
      |             ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:2:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:24:11: note:                 'const long long int size'
   24 | const int size=21;
      |           ^~~~
a.cc: In function 'long long int dijkstra(long long int, long long int)':
a.cc:43:41: error: 'grid' was not declared in this scope
   43 |                 if(ui+1>=0 && ui+1<h && grid[ui+1][uj]!='#' && dist[ui+1][uj]==-1){
      |                                         ^~~~
a.cc:47:41: error: 'grid' was not declared in this scope
   47 |                 if(ui-1>=0 && ui-1<h && grid[ui-1][uj]!='#' && dist[ui-1][uj]==-1){
      |                                         ^~~~
a.cc:51:41: error: 'grid' was not declared in this scope
   51 |                 if(uj+1>=0 && uj+1<w && grid[ui][uj+1]!='#' && dist[ui][uj+1]==-1){
      |                                         ^~~~
a.cc:55:41: error: 'grid' was not declared in this scope
   55 |                 if(uj-1>=0 && uj-1<w && grid[ui][uj-1]!='#' && dist[ui][uj-1]==-1){
      |                                         ^~~~
a.cc: In function 'long long int solve()':
a.cc:68:22: error: 'grid' was not declared in this scope
   68 |                 cin>>grid[i];
      |                      ^~~~
a.cc:73:28: error: 'grid' was not declared in this scope
   73 |                         if(grid[i][j]!='#'){
      |                            ^~~~