Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
#define P pair<int,int>
int dir[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int INF = 1001001001;
 
int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    int ans = 0;
    for(int si=0;si<h;si++)
    {
        for(int sj=0;sj<w;sj++)
        {
            if (s[si][sj] == '#') 
            continue;
            vector<vector<int>> dist(h, vector<int>(w, INF));
            queue<P> q;
            dist[si][sj] = 0;
            q.push(si,sj);
            while (!q.empty()) 
            {
                int x = q.front().first, y = q.front().second;
                q.pop();
                for(int k=0;k<4;k++)
                {
                    int ni = x+dir[k][0], nj = y+dir[k][1];
                    if (ni<0||ni>=h||nj<0||nj>=w || s[ni][nj] == '#' || dist[ni][nj] != INF) 
                    continue;
                    dist[ni][nj] = dist[i][j] + 1;
                    q.push(ni,nj);
                }
            } 
        for(int i=0;i<h;i++)
        {
            for(int j=0;j<w;j++)
            {
            if (dist[i][j] == INF) continue;
            ans = max(ans, dist[i][j]);
            }
        }
    } 
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:19: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(int&, int&)'
   24 |             q.push(si,sj);
      |             ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note:   candidate expects 1 argument, 2 provided
a.cc:34:41: error: 'i' was not declared in this scope; did you mean 'ni'?
   34 |                     dist[ni][nj] = dist[i][j] + 1;
      |                                         ^
      |                                         ni
a.cc:34:44: error: 'j' was not declared in this scope; did you mean 'nj'?
   34 |                     dist[ni][nj] = dist[i][j] + 1;
      |                                            ^
      |                                            nj
a.cc:35:27: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(int&, int&)'
   35 |                     q.push(ni,nj);
      |                     ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note:   candidate expects 1 argument, 2 provided
a.cc:49:2: error: expected '}' at end of input
   49 | }
      |  ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^