Language: C++

// --------------
// Tejas Pandey  |
// 12 - 01 - 20  |
// ABC #151      |
// --------------

#include <bits/stdc++.h>
using namespace std;

#define mod 1000000007
#define vi vector<int>
typedef long long int ll;

ll solve(char a[20][20],int h,int w,int x,int y){
	int vis[20][20];
	memset(vis,0,sizeof(vis));
	queue<tuple<int,int,ll>> pt;
	pt.push(make_tuple(x,y,0));
	ll ans = 0;
	while(!pt.empty()){
		tuple<int,int,int> t = pt.front();
		pt.pop();
		pair<int,int> p = make_pair(get<0>(t),get<1>(t));
		if(!vis[p.first][p.second] && a[p.first][p.second] == '.'){
			ll f =get<2>(t);
			ans = max(ans,f);
			vis[p.first][p.second] = 1;
			if(p.first + 1 < h){
				pt.push(make_pair(p.first+1,p.second,get<2>(t) + 1));
			}
			if(p.first - 1 > -1){
				pt.push(make_pair(p.first-1,p.second,get<2>(t) + 1));
			}
			if(p.second + 1 < w){
				pt.push(make_pair(p.first,p.second+1,get<2>(t) + 1));
			}
			if(p.second - 1 > -1){
				pt.push(make_pair(p.first,p.second-1,get<2>(t) + 1));
			}
		}
	}
	return ans;
}

int main (void)
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t = 1;
	//cin >> t;
	while(t--)
	{
		//cout << "Case #" << c-t << ": ";
		int h,w;
		cin >> h >> w;
		char a[20][20];
		for(int i = 0;i < h;i++)
			for(int j = 0;j < w;j++)
				cin >> a[i][j];
		ll ans = 0;
		for(int i = 0;i < h;i++)
			for(int j = 0;j < h;j++)
				if(a[i][j] == '.')
					ans = max(ans,solve(a,h,w,i,j));
		cout << ans << "\n";
	}
	return 0;
}

Compiler output:
a.cc: In function 'll solve(char (*)[20], int, int, int, int)':
a.cc:29:50: error: no matching function for call to 'make_pair(int, int&, std::__tuple_element_t<2, std::tuple<int, int, int> >)'
   29 |                                 pt.push(make_pair(p.first+1,p.second,get<2>(t) + 1));
      |                                         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: candidate: 'template<class _T1, class _T2> constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&)'
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note:   candidate expects 2 arguments, 3 provided
a.cc:32:50: error: no matching function for call to 'make_pair(int, int&, std::__tuple_element_t<2, std::tuple<int, int, int> >)'
   32 |                                 pt.push(make_pair(p.first-1,p.second,get<2>(t) + 1));
      |                                         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: candidate: 'template<class _T1, class _T2> constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&)'
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note:   candidate expects 2 arguments, 3 provided
a.cc:35:50: error: no matching function for call to 'make_pair(int&, int, std::__tuple_element_t<2, std::tuple<int, int, int> >)'
   35 |                                 pt.push(make_pair(p.first,p.second+1,get<2>(t) + 1));
      |                                         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: candidate: 'template<class _T1, class _T2> constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&)'
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note:   candidate expects 2 arguments, 3 provided
a.cc:38:50: error: no matching function for call to 'make_pair(int&, int, std::__tuple_element_t<2, std::tuple<int, int, int> >)'
   38 |                                 pt.push(make_pair(p.first,p.second-1,get<2>(t) + 1));
      |                                         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: candidate: 'template<class _T1, class _T2> constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&)'
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note:   candidate expects 2 arguments, 3 provided