Language: C++

#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC return 0;
using namespace std;
char mat[22][22];
int n, m, res, in, jn, iv, jv;
const int di[] {0, 0, 1, -1};
const int dj[] {1, -1, 0, 0};
int main() {
    DAU
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        cin >> (mat[i] + 1);
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j) {
            vector<vector<int>> d(n + 1, vector<int>(m + 1, 0));
            d[i][j] = 0;
            queue<pair<int, int>> q;
            q.emplace(i, j);
            while (!q.empty()) {
                tie(in, jn) = q.front();
                q.pop();
                for (int dir = 0; dir < 4; ++dir) {
                    iv = in + di[dir];
                    jv = jn + dj[dir];
                    if (iv > 0 && jv > 0 && iv < n + 1 && jv < m + 1 && !d[iv][jv] && mat[iv][jv] == '.')
                        d[iv][jv] = d[in][jn] + 1, res = max(res, d[iv][jv]), q.emplace(iv, jv);
                }
            }
        }
    cout << res;
    PLEC
}


Compiler output:
a.cc:6:20: error: 'int jn' redeclared as different kind of entity
    6 | int n, m, res, in, jn, iv, jv;
      |                    ^~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:255:1: note: previous declaration 'double jn(int, double)'
  255 | __MATHCALL (jn,, (int, _Mdouble_));
      | ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:21:39: error: no match for 'operator=' (operand types are 'std::tuple<int&, double (&)(int, double) noexcept>' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'})
   21 |                 tie(in, jn) = q.front();
      |                                       ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/tuple:2355:9: note: candidate: 'template<class _U1, class _U2> std::__enable_if_t<((bool)__assignable<const _U1&, const _U2&>()), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(const std::tuple<_U1, _U2>&) [with _U2 = _U1; _T1 = int&; _T2 = double (&)(int, double) noexcept]'
 2355 |         operator=(const tuple<_U1, _U2>& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:2355:9: note:   template argument deduction/substitution failed:
a.cc:21:39: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::tuple<_T1, _T2>'
   21 |                 tie(in, jn) = q.front();
      |                                       ^
/usr/include/c++/14/tuple:2365:9: note: candidate: 'template<class _U1, class _U2> std::__enable_if_t<((bool)__assignable<_U1, _U2>()), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(std::tuple<_U1, _U2>&&) [with _U2 = _U1; _T1 = int&; _T2 = double (&)(int, double) noexcept]'
 2365 |         operator=(tuple<_U1, _U2>&& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:2365:9: note:   template argument deduction/substitution failed:
a.cc:21:39: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'std::tuple<_T1, _T2>'
   21 |                 tie(in, jn) = q.front();
      |                                       ^
/usr/include/c++/14/tuple:2375:9: note: candidate: 'template<class _U1, class _U2> std::__enable_if_t<((bool)__assignable<const _U1&, const _U2&>()), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U2 = _U1; _T1 = int&; _T2 = double (&)(int, double) noexcept]'
 2375 |         operator=(const pair<_U1, _U2>& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:2375:9: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 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:
/usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::__enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::tuple<int&, double (&)(int, double) noexcept>&]':
/usr/include/c++/14/tuple:2375:2:   required by substitution of 'template<class _U1, class _U2> std::__enable_if_t<((bool)__assignable<const _U1&, const _U2&>()), std::tuple<int&, double (&)(int, double) noexcept>&> std::tuple<int&, double (&)(int, double) noexcept>::operator=(const std::pair<_T1, _T2>&) [with _U1 = int; _U2 = int]'
a.cc:21:39:   required from here
   21 |                 tie(in, jn) = q.front();
      |                                       ^
/usr/include/c++/14/type_traits:138:11: error: no type named 'type' in 'struct std::enable_if<false, std::tuple<int&, double (&)(int, double) noexcept>&>'
  138 |     using __enable_if_t = typename enable_if<_Cond, _Tp>::type;
      |           ^~~~~~~~~~~~~
/usr/include/c++/14/tuple:2386:9: note: candidate: 'template<class _U1, class _U2> std::__enable_if_t<((bool)__assignable<_U1, _U2>()), std::tuple<_T1, _T2>&> std::tuple<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U2 = _U1; _T1 = int&; _T2 = double (&)(int, double) noexcept]'
 2386 |         operator=(pair<_U1, _U2>&& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:2386:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/tuple:2332:7: note: candidate: 'std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(std::__conditional_t<((bool)__assignable<const _T1&, const _T2&>()), const std::tuple<_T1, _T2>&, const std::__nonesuch&>) [with _T1 = int&; _T2 = double (&)(int, double) noexcept; std::__conditional_t<((bool)__assignable<const _T1&, const _T2&>()), const std::tuple<_T1, _T2>&, const std::__nonesuch&> = const std::__nonesuch&]'
 2332 |       operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
      |       ^~~~~~~~
/usr/include/c++/14/tuple:2334:52: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'std::__conditional_t<false, const std::tuple<int&, double (&)(int, double) noexcept>&, const std::__nonesuch&>' {aka 'const std::__nonesuch&'}
 2332 |       operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2333 |                                 const tuple&,
      |                                 ~~~~~~~~~~~~~       
 2334 |                                 const __nonesuch&> __in)
      |                                 ~~~~~~~~~~~~~~~~~~~^~~~
/usr/include/c++/14/tuple:2343:7: note: candidate: 'std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(std::__conditional_t<((bool)__assignable<_T1, _T2>()), std::tuple<_T1, _T2>&&, std::__nonesuch&&>) [with _T1 = int&; _T2 = double (&)(int, double) noexcept; std::__conditional_t<((bool)__assignable<_T1, _T2>()), std::tuple<_T1, _T2>&&, std::__nonesuch&&> = std::__nonesuch&&]'
 2343 |       operator=(__conditional_t<__assignable<_T1, _T2>(),
      |       ^~~~~~~~
/usr/include/c++/14/tuple:2345:47: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'std::__conditional_t<false, std::tuple<int&, double (&)(int, double) noexcept>&&, std::__nonesuch&&>' {aka 'std::__nonesuch&&'}
 2343 |       operator=(__conditional_t<__assignable<_T1, _T2>(),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2344 |                                 tuple&&,
      |                                 ~~~~~~~~       
 2345 |                                 __nonesuch&&> __in)
      |                                 ~~~~~~~~~~~~~~^~~~
a.cc:25:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |                     jv = jn + dj[dir];
      |                          ~~~^~~~~~~~~
a.cc:25:29: error: invalid conversion from 'double (*)(int, double) noexcept' to 'int' [-fpermissive]
   25 |                     jv = jn + dj[dir];
      |                          ~~~^~~~~~~~~
      |                             |
      |                             double (*)(int, double) noexcept
a.cc:27:43: error: invalid conversion from 'double (*)(int, double) noexcept' to 'std::vector<int>::size_type' {aka 'long unsigned int'} [-fpermissive]
   27 |                         d[iv][jv] = d[in][jn] + 1, res = max(res, d[iv][jv]), q.emplace(iv, jv);
      |                                           ^~
      |                                           |
      |                                           double (*)(int, double) noexcept
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   initializing argument 1 of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~