Language: C++

include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i < n;i++)
const int iINF = 1e9;
int main(){
    int maze[25][25],cost[25][25],h,w,ans = 0,mh[4] = {1,0,-1,0},mw[4] = {0,1,0,-1};
    cin>>h>>w;
    rep(i,h)rep(j,w)cin>>maze[i][j];

    queue<pair<int,int>>que;
    rep(i,h)rep(j,w){
        rep(a,25)rep(b,25)cost[a][b] = -1;
        cost[i][j] = 0;
        que.push(make_pair(i,j));
        while(!que.empty()){
            pair<int,int>now = que.front();
            que.pop();
            rep(k,4){
                int nh = mh[k] + now.first,nw = mw[k] + now.second;
                if(uint(nh) <= h && uint(nw) <= w && maze[nh][nw] == '.'){
                    if(cost[nh][nw] == -1){
                        cost[nh][nw] = cost[now.first][now.second] + 1;
                        que.push(make_pair(nh,nw));
                    }
                }
            }
        }
        int maxCost = -1;
        rep(a,25)rep(b,25)maxCost = max(maxCost,cost[a][b]);
        ans = max(ans,maxCost);
    }

    cout<<ans<<endl;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin>>h>>w;
      |     ^~~
a.cc:11:5: error: 'queue' was not declared in this scope
   11 |     queue<pair<int,int>>que;
      |     ^~~~~
a.cc:11:11: error: 'pair' was not declared in this scope
   11 |     queue<pair<int,int>>que;
      |           ^~~~
a.cc:11:16: error: expected primary-expression before 'int'
   11 |     queue<pair<int,int>>que;
      |                ^~~
a.cc:15:9: error: 'que' was not declared in this scope
   15 |         que.push(make_pair(i,j));
      |         ^~~
a.cc:15:18: error: 'make_pair' was not declared in this scope
   15 |         que.push(make_pair(i,j));
      |                  ^~~~~~~~~
a.cc:17:18: error: expected primary-expression before 'int'
   17 |             pair<int,int>now = que.front();
      |                  ^~~
a.cc:20:34: error: 'now' was not declared in this scope
   20 |                 int nh = mh[k] + now.first,nw = mw[k] + now.second;
      |                                  ^~~
a.cc:21:20: error: 'uint' was not declared in this scope; did you mean 'int'?
   21 |                 if(uint(nh) <= h && uint(nw) <= w && maze[nh][nw] == '.'){
      |                    ^~~~
      |                    int
a.cc:21:42: error: 'nw' was not declared in this scope; did you mean 'nh'?
   21 |                 if(uint(nh) <= h && uint(nw) <= w && maze[nh][nw] == '.'){
      |                                          ^~
      |                                          nh
a.cc:30:37: error: 'max' was not declared in this scope
   30 |         rep(a,25)rep(b,25)maxCost = max(maxCost,cost[a][b]);
      |                                     ^~~
a.cc:31:15: error: 'max' was not declared in this scope
   31 |         ans = max(ans,maxCost);
      |               ^~~
a.cc:34:5: error: 'cout' was not declared in this scope; did you mean 'cost'?
   34 |     cout<<ans<<endl;
      |     ^~~~
      |     cost
a.cc:34:16: error: 'endl' was not declared in this scope
   34 |     cout<<ans<<endl;
      |                ^~~~