criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int H,W;
char S[20][20];
int dx[4] = { -1, 1, 0, 0 };
int dy[4] = { 0, 0, 1, -1 };
struct ichi {
    int y;
    int x;
    int depth;
};

queue<ichi> q;

int bfs(int s, int t, int h) {
    struct ichi start;
        start.x = t;
        start.y = s;
        start.depth = h;
    q.push(start);
        while(!q.empty()) {
            ichi now = q.front(); q.pop();

            if(now.x == gx && now.y == gy) return now.depth;
        for(int i = 0; i < 4; i++) {
            ichi next = { now.y + dy[i], now.x + dx[i], now.depth + 1};
        
        if(nx < 0 || next.x >= H || next.y < 0 || next.y >= W) continue;
        if(S[next.y][next.x] == '#') continue;
        if(next.y >= 0 && next.y < H && next.x >= 0 && next.x < W && S[next.y][next.y] == '.') {
            q.push(next);
        }
        }
        }
}
int main() {
    cin >> H >> W;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cin >> S[i][j];
        }
    }
    int ans = 0;
    for(int a = 0; a < H; a++) {
        for(int b = 0; b < W; b++) {
           if(S[a][b] == '#') continue;

           ans = max(ans, bfs(b, a, 0));
        }
    }

    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int bfs(int, int, int)':
a.cc:25:25: error: 'gx' was not declared in this scope; did you mean 'dx'?
   25 |             if(now.x == gx && now.y == gy) return now.depth;
      |                         ^~
      |                         dx
a.cc:25:40: error: 'gy' was not declared in this scope; did you mean 'dy'?
   25 |             if(now.x == gx && now.y == gy) return now.depth;
      |                                        ^~
      |                                        dy
a.cc:29:12: error: 'nx' was not declared in this scope; did you mean 'dx'?
   29 |         if(nx < 0 || next.x >= H || next.y < 0 || next.y >= W) continue;
      |            ^~
      |            dx
a.cc:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int x_1,y_1,H,W,s_x,s_y,g_y,g_x,sum1;
int ans;
char S[20][20];


struct Object {
    int  x;
    int  y;
    int sum;
};

const int yvec[4] = {0, 0, -1, 1};
const int xvec[4] = {-1, 1, 0, 0};

int bfs(Object st) {
    ans = 0;
     vector<vector<int>> hantei(20, vector<int>(20, 0));
    queue<Object> q;
    q.push(st);
    hantei[now.y][now.x] = 1;
    while(!q.empty()) {
        
        Object now = q.front(); q.pop();
        x_1 = now.x;
        y_1 = now.y;
        sum1 = now.sum;
       
        for(int i = 0; i < 4; i++) {
            Object next = { x_1 + xvec[i], y_1 + yvec[i], sum1 + 1};
            if(0 <= next.y && next.y <= H - 1 && 0 <= next.x && next.y <= W - 1 && S[next.y][next.x] == '.' && hantei[next.y][next.x] == 0) {
                hantei[next.y][next.x] = 1;
                q.push(next);
            }
        }
        ans = max(ans, sum1);
    }
    return ans;
} 
int main() {
    
    cin >> H >> W;
    int ans1 = 0;      
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cin >> S[i][j];
           
        }
    }
    
   

     for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
           if(S[i][j] == '.' ){
            Object start = { i, j, 0 }; 
            ans1 = max(ans1, bfs(start)); }
        }
    }

   
   
    cout << ans1 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int bfs(Object)':
a.cc:24:12: error: 'now' was not declared in this scope; did you mean 'pow'?
   24 |     hantei[now.y][now.x] = 1;
      |            ^~~
      |            pow
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int x_1,y_1,H,W,s_x,s_y,g_y,g_x,sum1;
int ans;
char S[20][20];


struct Object {
    int  x;
    int  y;
    int sum;
};

const int yvec[4] = {0, 0, -1, 1};
const int xvec[4] = {-1, 1, 0, 0};

int bfs(Object st) {
    ans = 0;
     vector<vector<int>> hantei(20, vector<int>(20, 0));
    queue<Object> q;
    q.push(st);
    while(!q.empty()) {

        Object now = q.front(); q.pop();
        x_1 = now.x;
        y_1 = now.y;
        sum1 = now.sum;
       
        for(int i = 0; i < 4; i++) {
            Object next = { x_1 + xvec[i], y_1 + yvec[i], sum1 + 1};
            if(0 <= next.y && next.y <= H - 1 && 0 <= next.x && next.y <= W - 1 && S[next.y][next.x] == '.' && hantei[next.y][next.x] == false) {
                hantei[next.y][next.x] = 1;
                q.push(next);
            }
        }
        ans = max(ans, sum1);
    }
    return __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2;
} 
int main() {
    
    cin >> H >> W;
       
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cin >> S[i][j];
           
        }
    }
    
   

     for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
           if(S[i][j] == '.' ){
            Object start = { i, j, 0 }; 
            ans1 = max(ans1, bfs(start)); }
        }
    }

   
   
    cout << ans1 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:13: error: 'ans1' was not declared in this scope; did you mean 'ans'?
   59 |             ans1 = max(ans1, bfs(start)); }
      |             ^~~~
      |             ans
a.cc:65:13: error: 'ans1' was not declared in this scope; did you mean 'ans'?
   65 |     cout << ans1 << endl;
      |             ^~~~
      |             ans
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int x_1,y_1,H,W,s_x,s_y,g_y,g_x,sum1;
char S[20][20];


struct Object {
    int  x;
    int  y;
    int sum;
};

const int yvec[4] = {0, 0, -1, 1};
const int xvec[4] = {-1, 1, 0, 0};

int bfs(Object st) {
    queue<Object> q;
    q.push(st);
    sum1 = 0;
    while(!q.empty()) {
        Object now = q.front(); q.pop();
        x_1 = now.x;
        y_1 = now.y;
        sum1 = now.sum;
        
        
        for(int i = 0; i < 4; i++) {
            Object next = { x_1 + xvec[i], y_1 + yvec[i], sum1 + 1};
            if(0 <= next.y && next.y <= H - 1 && 0 <= next.x && next.y <= W - 1 && vec[next.y][next.x] == '.') {
                S[next.y][next.x] = 'x';
                q.push(next);
            }
        }
    
    }
    return sum1;
} 
int main() {
    
    cin >> H >> W;
    
    int ans = 0;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cin >> S[i][j];
        }
    }

     for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
           if(S[i][j] == '.' ){
            Object start = { i, j, 0 }; 
            ans = max(ans, bfs(start)); }
        }
    }

   
   
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int bfs(Object)':
a.cc:31:84: error: 'vec' was not declared in this scope; did you mean 'yvec'?
   31 |             if(0 <= next.y && next.y <= H - 1 && 0 <= next.x && next.y <= W - 1 && vec[next.y][next.x] == '.') {
      |                                                                                    ^~~
      |                                                                                    yvec
Language: C++

3 5
...#.
.#.#.
.#...

Compiler output:
a.cc:2:4: error: stray '#' in program
    2 | ...#.
      |    ^
a.cc:3:2: error: stray '#' in program
    3 | .#.#.
      |  ^
a.cc:3:4: error: stray '#' in program
    3 | .#.#.
      |    ^
a.cc:4:2: error: stray '#' in program
    4 | .#...
      |  ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 3 5
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int mv[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};

int main(){
    int H,W,answer=0;
    cin >> H >> W;
    vector<string> S(H);
    for(int i=0;i<H;i++){
        cin >> S[i];
    }

    for(int sy=0;sy<H;sy++){
        for(int sx=0;sx<W;sx++){
            if(S[sy][sx]=='#'){
                continue;
            }

            int ans[H][W] = {0};

            memset(ans,-1,sizeof(ans));

            ans[sy][sx] = 0;

            queue<pair<int,int>> Q;
            pair<int,int> P;
            P.first = sy;
            P.second = sx;
            Q.push(P);

            while(!Q.empty()){
                P = Q.front();
                Q.pop();
                for(int i=0;i<4;i++){
                    if(&& P.first+mv[i][0]<H && 0<=P.first+mv[i][0] && P.second+mv[i][1]<W && 0<=P.second+mv[i][1] && ans[P.first+mv[i][0]][P.second+mv[i][1]]==-1 && S[P.first+mv[i][0]][P.second+mv[i][1]]!='#'){
                        ans[P.first+mv[i][0]][P.second+mv[i][1]] = ans[P.first][P.second]+1;
                        Q.emplace(P.first+mv[i][0],P.second+mv[i][1]);
                    }
                }
            }

            for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                    answer = max(answer,ans[i][j]);
                }
            }
        }
    }

    cout << answer << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:28: error: expected ')' before '.' token
   37 |                     if(&& P.first+mv[i][0]<H && 0<=P.first+mv[i][0] && P.second+mv[i][1]<W && 0<=P.second+mv[i][1] && ans[P.first+mv[i][0]][P.second+mv[i][1]]==-1 && S[P.first+mv[i][0]][P.second+mv[i][1]]!='#'){
      |                       ~    ^
      |                            )
a.cc:37:27: error: label 'P' used but not defined
   37 |                     if(&& P.first+mv[i][0]<H && 0<=P.first+mv[i][0] && P.second+mv[i][1]<W && 0<=P.second+mv[i][1] && ans[P.first+mv[i][0]][P.second+mv[i][1]]==-1 && S[P.first+mv[i][0]][P.second+mv[i][1]]!='#'){
      |                           ^
Language: C++

//coded by: pranonrahman-------------------------------------
//-----------------------------------------------------------
//-----------------------------------------------------------
#include<bits/stdc++.h>
using namespace std;
#define O_o ios_base::sync_with_stdio(0)
#define O_O ios_base::sync_with_stdio(0); cin.tie(NULL)
#define o_O ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
#define fixedprecision(n) cout<<fixed<<setprecision(n)
#define endl '\n'
#define CASE(n) cout << "Case " << n << ": "
#define pi acos(-1.0)
#define _____(n) cout << "Dhukse " << n << endl

long long w,h;
char arr[25][25];
long long vis[25][25];
long long xx[]={+1,0,-1,0};
long long yy[]={0,+1,0,-1};
long long check(long long i,long long j)
{
    if(i<0 or i>=h or j<0 or j>=w or arr[i][j]=='#')  return 0;
    return 1;
}

long long bfs(long long i,long long j)
{
    long long mx =-1;
    deque<pair<long long,long long>>dq;
    memset(vis,-1,sizeof(vis));
    dq.push_back({i,j});
    vis[i][j]=0;
    while(dq.size())
    {

        long long px = dq.front().first;
        long long py = dq.front().second;
        dq.pop_front();
        for(long long i=0;i<4;i++)
        {
           long long nx=px+xx[i];
           long long ny=py+yy[i];
           if(check(nx,ny)!=0 and vis[nx][ny]==-1 and arr[i][j]!='#')
           {
               vis[nx][ny]=vis[px][py]+1;
               mx = max(vis[nx][ny],mx);
               dq.push_back({nx,ny});
           }
        }
    }
   // for(long long i=0;i<h;i++)
   // {
  //      for(long long j=0;j<w;j++)    cout << vis[i][j] << ' ' ;
  //      cout<< endl;
 //   }
  //  cout << endl;
    return mx;
}

long long main()
{
    O_o;
    long long t=1;
    //cin >> t;
    long long T=t;
    while(t--)
    {
        cin >> h >> w;
        for(long long i=0;i<h;i++)
        {
            for(long long j=0;j<w;j++)
            {
                cin >> arr[i][j];
            }
        }
        long long mx = 0;
       for(long long i=0;i<h;i++)
        {
            for(long long j=0;j<w;j++)
            {
                if(arr[i][j]!='#')
                {
                    mx = max(mx,bfs(i,j));
                }
            }
        }
        cout << mx << endl;

    }


    return 0;
}



Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
#define ll long long
using namespace std;
using Graph=vector<vector<int>>;

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
bool seen[30][30];
string vec[25];
int ans[30][30];
int h,w;
void dfs(int a,int b){
  seen[a][b]=true;
  for(int dir=0;dir<4;dir++){
    int nh=a+dx[dir];
    int nw=b+dy[dir];
    if(nh<0||nh>=h||nw<0||nw>=w) continue;
    if(vec[nh][nw]=='#')continue;
    if(seen[nh][nw]==true) continue;
    ans[nh][nw]=min(ans[nh][nw],ans[a][b]+1);
    dfs(nh,nw);
  }
}
 
ll gcd(ll a, ll b){
  if(b == 0){
    return a;
  }
  else{
    return gcd(b,(a%b));
  }
}
ll lcm(ll a,ll b){
  return a/gcd(a,b)*b;
}
ll mpower(ll a,ll b,ll c){
  int z;
  if(b==0){
    z=1;
    z%=c;
    return z;
  }
  if(b==1){
    z=a;
    z%=c;
    return z;
  }
  else{
    return (((mpower(a,b/2,c))*(mpower(a,b/2,c))%c)*mpower(a,b%2,c)%c);
  }
}

int main(){
  cin>>h>>w;
  for(int i=0;i<h;i++){
    cin>>vec[i];
  }
  int a,b;
  int answer=0,p=0;
  for(int i=0;i<h*w;i++){
    a=i/w,b=i%w;
    if(vec[a][b]=='.'){
      memset(seen,0,sizeof(seen));// seen 配列全体を false に初期化
      fill(ans,ans+h*w,10000000);// ans 配列全体を 0 に初期化
      dfs(a,b);
      for(int j=0;j<h;j++){
        for(int k=0;k<w;k++){
          if(vec[j][k]=='.'){
            answer=max(answer,ans[j][k]);
          }
        }
      }
    }
  }
  cout<<answer<<endl;
}


Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int (*)[30]; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21:   required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = int (*)[30]; _Tp = int]'
  998 |     { std::__fill_a1(__first, __last, __value); }
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1029:20:   required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int (*)[30]; _Tp = int]'
 1029 |       std::__fill_a(__first, __last, __value);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:64:11:   required from here
   64 |       fill(ans,ans+h*w,10000000);// ans 配列全体を 0 に初期化
      |       ~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:18: error: incompatible types in assignment of 'const int' to 'int [30]'
  952 |         *__first = __tmp;
      |         ~~~~~~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n, m;
char a[25][25];
int X[25], Y[25]; //所有.的坐标
bool vis[25][25];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct PP {
	int x, y;
	int res;
} s, q;
queue <PP> qua;
int cnt, ans;

void Init() {
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) scanf(" %c", &a[i][j]);
	}
}

bool Chk(int x, int y) {
	if(int vis[x][y] || x < 1 || x > n || y < 1 || y > m || a[x][y] == '#') return false;
	return true;
}

int Bfs(int x, int y) {
	int res = 0;
	s.x = x, s.y = y, s.res = 0;
	vis[x][y] = 1;
	qua.push(s);
	while(!qua.empty()) {
		s = qua.front();
		qua.pop();
		if(s.x == ex && s.y == ey) return s.res;
		for(int i = 0; i < 4; i++) {
			q.x = s.x + dx[i], q.y = s.y + dy[i];
			if(!Chk(q.x, q.y)) continue;
			q.res = s.res + 1;
			vis[q.x][q.y] = 1;
			qua.push(q);
		}
	}
}

int main() {
	Init();
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			if(a[i][j] == '.') {
				for(int k = 1; k <= cnt; k++) {
					memset(vis, 0, sizeof(vis));
					while(!qua.empty()) qua.pop();
					int tmp = Bfs(i, j);
					ans = max(ans, tmp);
				}
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'bool Chk(int, int)':
a.cc:24:16: error: condition declares an array
   24 |         if(int vis[x][y] || x < 1 || x > n || y < 1 || y > m || a[x][y] == '#') return false;
      |                ^~~
a.cc: In function 'int Bfs(int, int)':
a.cc:36:27: error: 'ex' was not declared in this scope; did you mean 'x'?
   36 |                 if(s.x == ex && s.y == ey) return s.res;
      |                           ^~
      |                           x
a.cc:36:40: error: 'ey' was not declared in this scope; did you mean 'y'?
   36 |                 if(s.x == ex && s.y == ey) return s.res;
      |                                        ^~
      |                                        y
a.cc:45:1: warning: control reaches end of non-void function [-Wreturn-type]
   45 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n, m;
char a[25][25];
int X[25], Y[25]; //所有.的坐标
bool vis[25][25];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct PP {
	int x, y;
	int res;
} s, q;
queue <PP> qua;
int cnt, ans;

void Init() {
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++) {
		scanf("%s", a[i] + 1);
		for(int j = 1; j <= m; j++) {
			if(a[i][j] == '.') {
				X[++cnt] = i;
				Y[cnt] = j;
			}
		}
	}
}

int Bfs(int x, int y, int ex, int ey) {
	int x, y0, res;
	s.x = x, s.y = y, s.res = 0;
	qua.push(s);
	while(!qua.empty()) {
		s = qua.front();
		qua.pop();
		if(s.x == ex && s.y == ey) return s.res;
		for(int i = 0; i < 4; i++) {
			x0 = s.x + dx[i], y0 = s.y + dy[i];
			res = s.res + 1;
			if(vis[x0][y0] || x0 < 1 || x0 > n || y0 < 1 || y0 > m || a[x0][y0] == '#') continue;
			vis[x0][y0] = 1;
			q.x = x0, q.y = y0, q.res = res;
			qua.push(q);
		}
	}
}

int main() {
	Init();
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			if(a[i][j] == '.') {
				for(int k = 1; k <= cnt; k++) {
					memset(vis, 0, sizeof(vis));
					while(!qua.empty()) qua.pop();
					int tmp = Bfs(i, j, X[k], Y[k]); // (i, j) -> (X[k], Y[k])的最短路径
					//printf("%d %d -> %d %d: %d\n", i, j, X[k], Y[k], tmp);
					ans = max(ans, tmp);
				}
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int Bfs(int, int, int, int)':
a.cc:30:13: error: declaration of 'int x' shadows a parameter
   30 |         int x, y0, res;
      |             ^
a.cc:29:13: note: 'int x' previously declared here
   29 | int Bfs(int x, int y, int ex, int ey) {
      |         ~~~~^
a.cc:38:25: error: 'x0' was not declared in this scope; did you mean 'y0'?
   38 |                         x0 = s.x + dx[i], y0 = s.y + dy[i];
      |                         ^~
      |                         y0
a.cc:46:1: warning: control reaches end of non-void function [-Wreturn-type]
   46 | }
      | ^
Language: Java

import java.util.*;

public class ABC151D_Maze_Master {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int H = scan.nextInt();
		int W = scan.nextInt();

		char[][] c = new char[H][W];
		int ans=0;
		for (int h = 0; h < H; h++) {
			String s = scan.next();
			for (int w = 0; w < W; w++) {
				c[h][w] = s.charAt(w);
			}
		}


		boolean[][] flag = new boolean[H][W];
		Queue<int[]> queue = new ArrayDeque<int[]>();
		for(int sh = 0; sh < H; sh++){
			for(int sw = 0; sw < W; sw++){
				if(c[sh][sw] != '#'){
					
					for(int i = 0; i < H; i++){
						Arrays.fill(flag[i], false);
					}
					
					int[] a = {sh, sw, 0};
					queue.add(a);
					flag[sh][sw] = true;
					int[] dx={1,0,-1,0,};
					int[] dy={0,-1,0,1,};
					while (!queue.isEmpty()) {
						int[] rem = queue.remove();
						int y = rem[0];
						int x = rem[1];
						int depth=rem[2];
						for (int i=0;i<4;i++) {
							if(0 <= y+dy[i] && y+dy[i] < H && 0 <= x+dx[i] && x+dx[i] < W){
								if (c[y+dy[i]][x+dx[i]]=='#' || flag[y+dy[i]][x+dx[i]] == true) {
								} else {
									int[] ad = {y+dy[i],x+dx[i],depth+1};
									queue.add(ad);
									flag[y+dy[i]][x+dx[i]] = true;
									ans = Math.max(depth + 1, ans);
								}
							}
						}
					}
				}
			}
		}

		System.out.println(ans);
	}
}

Compiler output:
Main.java:3: error: class ABC151D_Maze_Master is public, should be declared in a file named ABC151D_Maze_Master.java
public class ABC151D_Maze_Master {
       ^
1 error
Language: C++

#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
template<typename T>
void output(const T& val) {
    cout << val << endl;
}
template<typename T>
void output(const vector<T>& vec, const bool newline = false) {
    for (const T& val : vec)cout << val << (newline ? '\n' : ' '); cout << endl;
}
template<typename T>
void output(const vector<vector<T>>& mat) {
    for (const auto& row : vec)output(row);
}
// ============ template finished ============

int solve(const vector<string>& maze, const int sh, const int sw) {
    const int H = maze.size(), W = maze.front().size();
    vector<vector<int>> d(H, vector<int>(W, INF));
    priority_queue<tp3, vector<tp3>, greater<tp3>> pq;
    d[sh][sw] = 0;
    pq.push(make_tuple(0, sh, sw));
    while (!pq.empty()) {
        int score, h, w;
        tie(score, h, w) = pq.top(); pq.pop();
        rep(dir, 4) {
            int nh = h + dh[dir], nw = w + dw[dir];
            if (!isin(H, W, nh, nw) || maze[nh][nw] == '#' || d[nh][nw] <= score + 1)continue;
            d[nh][nw] = score + 1;
            pq.push(make_tuple(score + 1, nh, nw));
        }
    }
    int res = 0;
    for (const auto& row : d)for (const auto& col : row)if (col != INF)res = max(res, col);
    return res;
}

int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> maze(H);
    rep(h, H)cin >> maze[h];

    int res = 0;
    rep(h, H)rep(w, W)if (maze[h][w] != '#')res = max(res, solve(maze, h, w));
    output(res);
    return 0;
}


Compiler output:
a.cc: In function 'void output(const std::vector<std::vector<_Tp> >&)':
a.cc:27:28: error: 'vec' was not declared in this scope
   27 |     for (const auto& row : vec)output(row);
      |                            ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int h, w;
bool a[50][50];
bool ok(int x, int y){
  return 0<=x and x < h and 0<= y and y < w and a[x][y];
}
int dx[] = {-1,0,0,1};
int dy[] = {0,-1,1,0};
int main(){
  cin >> h >> w;
  for(int i = 0; i < h; i++){
    string s;
    cin >> s;
    for(int j = 0; j < w; j++){
      a[x][y] = (s[j] == '.');
    }
  }
  int ans = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(!ok(i,j))continue;
      queue<pair<int,int>> q;
      q.emplace(i, j);
      int dist[50][50] = {};
      memset(dist, -1, sizeof(dist));
      int ma = -1;
      dist[i][j] = 0;
      while(!q.empty()){
        auto p = q.front();q.pop();
        ma = max(ma, dist[p.first][p.second]);
        for(int k = 0; k < 4; k++){
          int x = p.first + dx[k];
          int y = p.second + dy[k];
          if(!ok(x,y))continue;
          if(dist[x][y]==-1){
            dist[x][y] = dist[p.first][p.second] + 1;
            q.emplace(x, y);
          }
        }
      }
      ans = max(ma, ans);
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'x' was not declared in this scope
   16 |       a[x][y] = (s[j] == '.');
      |         ^
a.cc:16:12: error: 'y' was not declared in this scope
   16 |       a[x][y] = (s[j] == '.');
      |            ^
Language: C++

#include <iostream>
#include <queue>
using namespace std;

int64_t H,W;
int64_t x,y,depth;
const int64_t H_max = 30;
const int64_t W_max = 30;
char maze[H_max][W_max];
char maze_sub[H_max][W_max];
const int64_t dx[4] = {1,0,-1,0};
const int64_t dy[4] = {0,1,0,-1};

struct Corr{
    int64_t x;
    int64_t y;
    int64_t depth;
};

queue<Corr> que;

int64_t bfs ( int64_t gx, int64_t gy ) {
    while ( !que.empty() ){
        Corr now = que.front(); que.pop();
        x = now.x; y = now.y; depth = now.depth;
        for ( int64_t i = 0; i < 4; ++i){
            Corr next = { x + dx[i], y + dy[i], depth + 1};
            if ( next.x == gx and next.y == gy ){
                return next.depth;
            }
            if ( 0 <= next.x and next.x < H and 0 <= next.y and next.y < W
                and maze[next.x][next.y] == '.') {
                maze[next.x][next.y] = 'x';
                que.push(next);
            }
        }
    }
    return 0;
}

int64_t bfs_main ( int64_t sx, int64_t sy, int64_t gx, int64_t gy){
    while ( !que.empty() ){
        que.pop();
    }
    Corr start = {sx,sy,0};
    que.emplace(start);
    return bfs(gx,gy);
}

int main(){
    cin >> H >> W;
    for ( int i = 0; i < H; ++i ){
        for ( int j = 0; j < W; ++j ){
            cin >> maze_sub[i][j];
        }
    }
    
    int64_t length = 0;
    int64_t ans = 0;
    for ( int64_t sx = 0; sx < H; ++sx){
        for ( int64_t sy = 0; sy < W; ++sy ){
            for ( int64_t gx = 0; gx < H; ++gx ){
                for ( int64_t gy = 0; gy < W; ++gy ){
                    for ( int i = 0; i < H; ++i){
                        for ( int j = 0; j < W; ++j){
                            maze[i][j] = maze_sub[i][j];
                        }
                    }
                    if ( sx == gx and sy == gy ){
                        length = 0;
                    } else if ( maze[gx][gy] == '#' or maze[sx][sy] = '#' ) {
                        length = 0;
                    }
                    else {
                        length = bfs_main(sx,sy,gx,gy);
                    }
                    // cout << sx << sy << gx << gy << length << endl;
                    ans = max(ans,length);
                }
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:53: error: lvalue required as left operand of assignment
   71 |                     } else if ( maze[gx][gy] == '#' or maze[sx][sy] = '#' ) {
      |                                 ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <climits>

#define P pair
#define X first
#define Y second

using namespace std;

int dist[21][21] = {};
char OK = '.', NG = '#';

void display_vec(vector<string> v)
{
    for (int i = 0; i < v.size(); i++)
    {
        cout << v[i] << endl;
    }
    cout << endl;
}

int bfs(vector<string> v, P<int, int> s_p)
{
    // 上下左右
    int dx[4] = {0, 0, 1, -1};
    int dy[4] = {1, -1, 0, 0};
    int h = v.size(), w = v[0].size();
    vector<vector<int>> dist(h, vector<int>(w, -1));

    queue<P<int, int>> q;
    // cur_p: 現在地
    // next_p: 移動予定地
    P<int, int> cur_p, next_p;

    // set start point
    q.push(s_p);
    dist[s_p.Y][s_p.X] = 0;

    int res = -1;

    while (q.size())
    {

        // display_vec(v);
        // display_dis();

        cur_p = q.front();
        v[cur_p.Y][cur_p.X] = NG;
        q.pop();

        for (int i = 0; i < 4; i++)
        {
            next_p.Y = cur_p.Y + dy[i];
            next_p.X = cur_p.X + dx[i];

            if (next_p.Y >= 0 && next_p.Y < h && next_p.X >= 0 && next_p.X < w)
            {
                if (v[next_p.Y][next_p.X] == OK && dist[next_p.Y][next_p.X] == -1)
                {
                    dist[next_p.Y][next_p.X] = dist[cur_p.Y][cur_p.X] + 1;
                    q.push(next_p);
                    res = max(res, dist[x][y]);
                }
            }
        }
    }
    return res;
}

int main(int argc, const char *argv[])
{
    int h, w;
    cin >> h >> w;

    vector<string> v;
    string s;
    for (int i = 0; i < h; i++)
    {
        cin >> s;
        v.push_back(s);
    }

    int x, ans = 0;
    P<int, int> s_p;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            s_p.Y = i;
            s_p.X = j;
            if (v[i][j] == OK)
            {
                ans = max(ans, bfs(v, s_p));
            }
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int bfs(std::vector<std::__cxx11::basic_string<char> >, std::pair<int, int>)':
a.cc:64:41: error: 'x' was not declared in this scope
   64 |                     res = max(res, dist[x][y]);
      |                                         ^
a.cc:64:44: error: 'y' was not declared in this scope
   64 |                     res = max(res, dist[x][y]);
      |                                            ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
constexpr int inf = 1e4 mv[4][2] = {{-1, 0}, {0, -1}, {0, 1}, {1, 0}};
int s[22][22];
int main()
{
	int h, w, pos[22][22][22][22], mx = 0;
	scanf("%d%d", &h, &w);
	for(int i = 1; i <= h; ++i)
	{
		scanf("\n");
		for(int j = 1; j <= w; ++j)
		{
			char k;
			scanf("%c", &k);
			s[i][j] = k == '.';
		}
	}
	for(int i = 0; i <= h + 1; ++i)
	{
		for(int j = 0; j <= w + 1; ++j)
		{
			for(int k = 0; k <= h + 1; ++k)
			{
				for(int l = 0; l <= w + 1; ++l)
				{
					pos[i][j][k][l] = inf;
				}
			}
		}
	}
	for(int i = 1; i <= h; ++i)
	{
		for(int j = 1; j <= w; ++j)
		{
			pos[i][j][i][j] = 0;
			for(int k = 0; k < 4; ++k)
			{
				if(s[i + mv[k][0]][j + mv[k][1]])
				{
					pos[i][j][i + mv[k][0]][j + mv[k][1]] = 1;
				}
			}
		}
	}
	for(int i = 1; i <= h; ++i)
	{
		for(int j = 1; j <= w; ++j)
		{
			for(int k = 1; k <= h; ++k)
			{
				for(int l = 1; l <= w; ++l)
				{
					for(int m = 1; m <= h; ++m)
					{
						for(int n = 1; n <= w; ++n)
						{
							pos[k][l][m][n] = min(pos[k][l][m][n], pos[k][l][i][j] + pos[i][j][m][n]);
						}
					}
				}
			}
		}
	}
	for(int i = 1; i <= h; ++i)
	{
		for(int j = 1; j <= w; ++j)
		{
			for(int k = 1; k <= h; ++k)
			{
				for(int l = 1; l <= w; ++l)
				{
					if(pos[i][j][k][l] < inf)
					{
						mx = max(mx, pos[i][j][k][l]);
					}
				}
			}
		}
	}
	printf("%d\n", mx);
}

Compiler output:
a.cc:5:25: error: expected ',' or ';' before 'mv'
    5 | constexpr int inf = 1e4 mv[4][2] = {{-1, 0}, {0, -1}, {0, 1}, {1, 0}};
      |                         ^~
a.cc: In function 'int main()':
a.cc:41:42: error: 'mv' was not declared in this scope; did you mean 'mx'?
   41 |                                 if(s[i + mv[k][0]][j + mv[k][1]])
      |                                          ^~
      |                                          mx
Language: C++

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

typedef long long ll;

int main()
{
    int i,j,k;
    int h,w;
    cin >> h >> w;
    vector<string> maze(h);
    for(i = 0;i < h;++i){
        cin >> maze.at(i);
    }
    vector<int> ans;
    for(i = 0;i < h;++i){
        for(j = 0;j < w;++j){
            if(maze.at(i).at(j) == '#'){
                continue;
            }
            int temp_max = 0;
            int temp_num = 0;
            vector<vector<int>> num(h,vector<int>(w,-1));
            queue<pair<int,int>> que;
            que.emplace(i,j);
            num.at(i).at(j) = 0;
            int tate[4] = {0,1,0,-1};
            int yoko[4] = {1,0,-1,0};
            while(!que.empty()){
                int temp_i = que.front().first;
                int temp_j = que.front().second;
                que.pop();
                temp_num = num.at(temp_i).at(temp_j);
                if(temp_num > temp_max){
                    temp_max = temp_num;
                }
                visit.at(temp_i).at(temp_j) = true;

                for(k = 0;k < 4;++k){
                    int temp_t = temp_i + tate[k];
                    int temp_y = temp_j + yoko[k];
                    if(temp_t < 0 || temp_t >= h){
                        continue;
                    }else if(temp_y < 0 || temp_y >= w){
                        continue;
                    }else if(maze.at(temp_t).at(temp_y) == '#'){
                        continue;
                    }
                    if(num.at(temp_t).at(temp_y) == -1){
                        que.emplace(temp_t,temp_y);
                        num.at(temp_t).at(temp_y) = temp_num+1;
                    }
                }
            }
            ans.push_back(temp_max);
        }
    }
    sort(ans.begin(),ans.end());
    cout << ans.back() << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:23: error: overloaded function with no contextual type information
   37 |                 visit.at(temp_i).at(temp_j) = true;
      |                       ^~
Language: C++

#include <iostream>
#include <queue>

using namespace std;
typedef pair<int, int> P;

const int MAXW = 20;
const int MAXH = 20;
const int INF = 40000;

int h, w;
char maze[MAXW][MAXH];
bool visited[MAXW][MAXH];
int dist[MAXW][MAXH];
int dx[4] = {0, 0, -1, 1};
int dy[4] = {1, -1, 0, 0};

void fill() {
  for (int x=0;x<w;x++) {
    for (int y=0;y<h;y++) {
      if (maze[x][y] == '.') {
        dist[x][y] = INF;
      } else {
        dist[x][y] = 0;
      }
    }
  }
}

int bfs(int x, int y) {
  fill();
  dist[x][y] = 0;
  queue<P> que;
  que.push(P(x, y));
  while (!que.empty()) {
    P p = que.front();
    que.pop();
    visited[p.first][p.second]= true;
    for (int i=0;i<4;i++) {
      int nx = p.first + dx[i], ny = p.second + dy[i];
      if (0 <= nx && nx < w && 0 <= ny && ny < h && maze[nx][ny] == '.' && !visited[nx][ny]) {
        dist[nx][ny] = dist[p.first][p.second] + 1;
        que.push(P(nx, ny));
      }
    }
  }
  int ans = 0;
  for (int i=0;i<w;i++) {
    for (int j=0;j<h;j++) {
      ans = max(ans, dist[i][j]);
    }
  }
  return ans;
}

void solve() {
  int ans = 0;
  for (int x=0;x<w;x++) {
    for (int y=0;y<h;y++) {
      if (maze[x][y] == '.') {
        memset(visited, 0, sizeof(visited));
        ans = max(ans, bfs(x, y));
      }
    }
  }
  cout << ans << endl;
}

int main() {
  cin >> h >> w;
  for (int i=0;i<h;i++) {
    for (int j=0;j<w;j++) {
      cin >> maze[j][i];
    }
  }
  solve();
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:61:9: error: 'memset' was not declared in this scope
   61 |         memset(visited, 0, sizeof(visited));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <queue>
  +++ |+#include <cstring>
    3 |
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

bool in_field(int y, int x, int H, int W) {
  return 0 <= y && y < H && 0 <= x && x < W;
}

int get_max_distance(vector<string> const& F, int H, int W, int si, int sj) {
  queue<pair<int, int>> q;
  q.emplace(si, sj);
  vector<vector<int>> dist(H, vector<int>(W, inf));
  dist[si][sj] = 0;
  int ans = 0;
  while (!q.empty()) {
    const auto p = q.front(); q.pop();
    const auto y = p.first;
    const auto x = p.second;
    rep(k, 4) {
      const auto ny = y + dy[k];
      const auto nx = x + dx[k];
      if (!in_field(ny, nx, H, W)) { continue; }
      if (F[ny][nx] == '#') { continue; }
      if (dist[ny][nx] < inf) { continue; }
      dist[ny][nx] = dist[y][x] + 1;
      ans = max(ans, dist[ny][nx]);
      q.emplace(ny, nx);
    }
  }
  return ans;
}

int main() {
  int H, W; cin >> H >> W;
  vector<string> F(H);
  rep(i, H) cin >> F[i];
  int ans = 0;
  rep(i, H) rep(j, W) {
    if (F[si][sj] == '#') { continue; }
    ans = max(ans, get_max_distance(F, H, W, i, j));
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:57:11: error: 'si' was not declared in this scope; did you mean 'i'?
   57 |     if (F[si][sj] == '#') { continue; }
      |           ^~
      |           i
a.cc:57:15: error: 'sj' was not declared in this scope; did you mean 'j'?
   57 |     if (F[si][sj] == '#') { continue; }
      |               ^~
      |               j
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define RREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const long long INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
int bfs(Graph &G,int sx, int sy){
  vector<int>dist(10000,-1);
  queue<int>que;
  int n = (sy * w) + sx;
  dist[n] = 0;
  que.push(n);
  while(!que.empty()){
    int v = que.front();
    que.pop();
    for(auto nv : G[v]){
      if(dist[nv] != -1)continue;
      dist[nv] = v + 1;
      que.push(nv);
    }
  }
  int res = 0;
  rep(i,1000)res = max(res,dist[i]);
  return res;
}
int h,w;
int solve(){
  cin >> h >> w;
  Graph G(h * w);
  vector<string>s(h + 1);
  rep(i,h){
    string tmp;
    cin >> tmp;
    tmp.push_back('#');
    s[i] = tmp;
  }
  string tmp;
  rep(i,w)tmp.push_back('#');
  s[h] = tmp;
  rep(i,h)rep(j,w){
    if(s[i][j] == '#')continue;
    int now = (i * w) + j;
    if(s[i + 1][j] != '#'){
      G[now].push_back(now + w);
      G[now + w].push_back(now);
    }
    if(s[i][j + 1] != '#'){
      G[now + 1].push_back(now);
      G[now].push_back(now + 1);
    }
  }
  int ans = 0;
  rep(i,h)rep(j,w){
    if(s[i][j] == '#')continue;
    ans = max(ans,bfs(G,i,j));
  }
  cout << ans << endl;
  return 0;
}
int main(){
  ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'int bfs(Graph&, int, int)':
a.cc:39:17: error: 'w' was not declared in this scope
   39 |   int n = (sy * w) + sx;
      |                 ^
Language: C++

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
char a[30][30]= {0};
long long int q[]= {1,-1,0,0};
long long int w[]= {0,0,-1,1};
long long int l;
long long int h;
long long int max1=0;
struct node
{
    long long int x;
    long long int y;
};
int main()
{
    cin>>h;
    cin>>l;
    for(long long int i=1; i<=h; i++)
    {
        for(long long int j=1;j<=l;j++)
            cin>>a[i][j];
    }
    for(long long int i=1; i<=h; i++)
    {
        for(long long int j=1; j<=l; j++)
        {
            if(a[i][j]=='#')
                continue;
            long long int vis[30][30]= {0};
            long long int sum1[30][30]= {0};
            queue<node>p;
            node r;
            r.x=i;
            r.y=j;
            p.push(r);
            while(!p.empty())
            {
                node t=p.front();
                p.pop();
                for(long long int h1=0; h1<4; h1++)
                {
                    long long  z=t.x+q[h1];
                    long long int x=t.y+w[h1];
                    if(vis[z][x])
                        continue;
                    if(z<=h&&z>0&&x<=l&&x>0&&a[z][x]=='.')
                    {
                        sum1[z][x]=sum1[t.x][t.y]+1;
                        node u;
                        u.x=z;
                        u.y=x;
                        vis[z][x]=1;
                        p.push(u);
                    }
                }
            }
            for(long long int i2=1;i2<=h;i2++)
            {
                for(long long int j2=1;j2<=l;j2++)
                {
                    if(vis[i2][j2])
                    {
                        max1=max(max1,sum1[i2][j2]);
                    }
                }
            }
        }
    }
    if(max1==1)
cout<<"0"<<endl;
esle
    cout<<max1<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:1: error: 'esle' was not declared in this scope
   72 | esle
      | ^~~~
Language: C++

#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;

using route = pair<P, int>;

int main() {
  int H, W;
  cin >> H >> W;
  char S[H][W];
  rep(i,H)rep(j,W) cin >> S[i][j];

  int ans = 0;
  rep(i,H)rep(j,W) {
    if (S[i][j] == '#') continue;
    P sp = P(i,j);
    rep(k,H)rep(l,W) {
      if (S[k][l] == '#') continue;
      P gp = P(k,l);
      if (sp == gp) continue;
      queue<route> q;
      q.push(route(sp, 0));
      vector<P> visited;
      int steps = INF;
      while (!q.empty()) {
        route r = q.front();
        q.pop();
        P p = r.first;
        if (p.first < 0 || p.first >= H || p.second < 0 || p.second >= W) continue;
        if (p == gp) {
          steps = min(steps, r.second);
          continue;
        }
        if (S[p.first][p.second] == '#' || find(visited.begin(), visited.end(), p) != visited.end()) continue;
        visited.push_back(p);
        q.push(route(P(p.first+1, p.second), r.second+1));
        q.push(route(P(p.first-1, p.second), r.second+1));
        q.push(route(P(p.first, p.second+1), r.second+1));
        q.push(route(P(p.first, p.second-1), r.second+1));
      }
      ans = max(ans, steps);
    }
  }

  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:48: error: no matching function for call to 'find(std::vector<std::pair<int, int> >::iterator, std::vector<std::pair<int, int> >::iterator, P&)'
   42 |         if (S[p.first][p.second] == '#' || find(visited.begin(), visited.end(), p) != visited.end()) continue;
      |                                            ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:42:48: note:   '__gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   42 |         if (S[p.first][p.second] == '#' || find(visited.begin(), visited.end(), p) != visited.end()) continue;
      |                                            ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
#define vec2(a,y,x) vector<vector<int>> a(y,vector<int>(x,0))
#define vec1(a,n) vector<int> a(n);rep(i,n)cin>>a[i]
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int h,w,x,y,nx,ny;
  cin>>h>>w;
  vector<vector<char>> a(h,vector<char>(w));
  rep(i,h)rep(j,w) cin>>a[i][j];
  
  int ans=0;
  rep(i,h)rep(j,w){//strart:(i,j)
     if(a[i][j]=='#') continue;
    queue<P> q;
    vec2(seen,h,w);
    q.push(P(i,j));
    while(q.size()){
    	x=q.front().second;y=q.front.first;
      rep(k,4){
        nx=x+dx[k];ny=y+dy[k];
      	if(nx<0 || ny<0 || nx>=w || ny>=h || a[ny][nx]=='#') continue;
        seen[ny][nx]=seen[x][y]+1;
      }
    }
    ans =max(ans,seen[ny][nx]);
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:32: error: invalid use of member function 'std::queue<std::pair<int, int> >::front' (did you forget the '()' ?)
   31 |         x=q.front().second;y=q.front.first;
      |                              ~~^~~~~
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
#define vec2(a,y,x) vector<vector<int>> a(y,vector<int>(x,0))
#define vec1(a,n) vector<int> a(n);rep(i,n)cin>>a[i]
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int h,w,x,y,nx,ny;
  cin>>h>>w;
  vwctor<vector<char>> a(h,vector<char>(w));
  rep(i,h)rep(j,w) cin>>a[i][j];
  
  int ans=0;
  rep(i,h)rep(j,w){//strart:(i,j)
     if(a[i][j]=='#') continue;
    queue<P> q;
    vec2(seen,h,w);
    q.push(P(i,j));
    while(q.size()){
    	x=q.front().second;y=q.front.first;
      rep(k,4){
        nx=x+dx[k];ny=y+dy[k];
      	if(nx<0 || ny<0 || nx>=w || ny>=h || a[ny][nx]=='#') continue;
        seen[ny][nx]=seen[x][y]+1;
      }
    }
    ans =max(ans,seen[ny][nx]);
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: 'vwctor' was not declared in this scope; did you mean 'wctob'?
   21 |   vwctor<vector<char>> a(h,vector<char>(w));
      |   ^~~~~~
      |   wctob
a.cc:21:21: error: expected primary-expression before '>' token
   21 |   vwctor<vector<char>> a(h,vector<char>(w));
      |                     ^~
a.cc:21:24: error: 'a' was not declared in this scope
   21 |   vwctor<vector<char>> a(h,vector<char>(w));
      |                        ^
a.cc:31:32: error: invalid use of member function 'std::queue<std::pair<int, int> >::front' (did you forget the '()' ?)
   31 |         x=q.front().second;y=q.front.first;
      |                              ~~^~~~~