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

import queue
import copy
 
def ngoin(bo,now):
    return 0 <= now[0] and now[0] < len(bo) and 0 <= now[1] and now[1] < len(bo[0])
 
def minido(bo,si,sj,ei,ej):
    tb = [[False for i in range(len(bo[0]))] for j in range(len(bo))]
    q = queue.Queue()
    q.put([si,sj,0])
    while not q.empty():
        now = q.get()
        if now[0] == ei and now[1] == ej:
            return now[2]
        if tb[now[0]][now[1]]:
            continue
        tb[now[0]][now[1]] = True
        if ngoin(bo,[now[0]-1,now[1]]):
            if bo[now[0]-1][now[1]]:
                q.put([now[0]-1,now[1],now[2]+1])
        if ngoin(bo,[now[0],now[1]+1]):
            if bo[now[0]][now[1]+1]:
                q.put([now[0],now[1]+1,now[2]+1])
        if ngoin(bo,[now[0]+1,now[1]]):
            if bo[now[0]+1][now[1]]:
                q.put([now[0]+1,now[1],now[2]+1])
        if ngoin(bo,[now[0],now[1]-1]):
            if bo[now[0]][now[1]-1]:
                q.put([now[0],now[1]-1,now[2]+1])
            
            
 
h,w = map(int,input().split())
bo = [[True if x == '.' else False for x in input()] for i in range(h)]
grap = [[float('inf') for i in range(h*w)] for j in range(h*w)]
ans = 0
for i in range(h*w):
    grap[i][i] = 0
for si in range(h):
    for sj in range(w):
        if not bo[si][sj]:
            continue
        now = [si,sj]
        if ngoin(bo,[now[0]-1,now[1]]):
            if bo[now[0]-1][now[1]]:
                grap[now[0]*w+now[1]][(now[0]-1)*w+now[1]] = 1
        if ngoin(bo,[now[0],now[1]+1]):
            if bo[now[0]][now[1]+1]:
                grap[now[0]*w+now[1]][1+now[0]*w+now[1]] = 1
        if ngoin(bo,[now[0]+1,now[1]]):
            if bo[now[0]+1][now[1]]:
                grap[now[0]*w+now[1]][(now[0]+1)*w+now[1]] = 1
        if ngoin(bo,[now[0],now[1]-1]):
            if bo[now[0]][now[1]-1]:
                grap[now[0]*w+now[1]][now[0]*w-1+now[1]] = 1
                
for k in range(w*h):
    for i in range(w*h):
        for j in range(w*h):
            if grap[i][j] > grap[i][k] + grap[k][j]:
                grap[i][j] = grap[i][k] + grap[k][j]

ans = 0
for i in range(w*h):
    for j in range(w*h):
        if grap[i][j] == float('inf'):
            continue
        ans = max(grap[i][j],ans)

print(ans)


Compiler output:
a.cc:35:16: warning: multi-character character constant [-Wmultichar]
   35 | grap = [[float('inf') for i in range(h*w)] for j in range(h*w)]
      |                ^~~~~
a.cc:66:32: warning: multi-character character constant [-Wmultichar]
   66 |         if grap[i][j] == float('inf'):
      |                                ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import queue
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>
using namespace std;
int ans;
int H,W;
bool is_valid_move(vector<string> &board, vector<vector<bool>> &checked, int x, int y) {
  
 
  // 移動先がマス目の外である場合
  if (x <= -1 || x >= W || y <= -1 || y >= H) {
    return false;
  }
  // 移動先が壁マス
  if (board.at(y).at(x) == '#') {
    return false;
  }
  // 既に調べているマスへの移動は調べないのでfalseを返す
  if (checked.at(y).at(x)) {
    return false;
  }
 
  // それ以外なら正しい移動
  return true;
}
int reachable(vector<string> &board, vector<vector<bool>> &checked,int sx,int sy,int gx,int gy) {
 int x; 
 int y;
  x=sx;
  y=sy;
  // ベースケース
  if (x == gx && y == gy) {
    // ゴールにいる状態
    return 0;
  }
 
  // 再帰ステップ
 
  checked.at(y).at(x) = true;  // 既に調べているという状態に変えておく
 
  // 「上」「右」「下」「左」のいずれかの移動でゴールに到達できるか？
 
 
  // 上へ移動したマスからゴールに到達できるか？
  if (is_valid_move(board, checked, x, y - 1)) {
    ans++;
    x=x;
    y=y-1;
  }
  // 右へ移動したマスからゴールに到達できるか？
  if (is_valid_move(board, checked, x + 1, y) ) {
    ans++;
    x++;
  }
  // 下へ移動したマスからゴールに到達できるか？
  if (is_valid_move(board, checked, x, y + 1) ) {
    ans++;
    y++;
  }
  // 左へ移動したマスからゴールに到達できるか？
  if (is_valid_move(board, checked, x - 1, y) ) {
    ans++;
    x--;
  }
 
  return ans;
}
 

          
          
int main(){

  cin>>H>>W;
 vector<string> board(N);
  for (int i = 0; i < N; i++) {
    cin >> board.at(i);
  }
  vector<vector<bool>> checked(H, vector<bool>(W, false));
  int A=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      for(int k=i;k<H;k++){
        for(int l=0;l<W;l++){
          int a=reachble(board,checked,i,j,k,l);
          A=max(A,a);
        }
      }
    }
  }
  cout<<A<<endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:73:23: error: 'N' was not declared in this scope
   73 |  vector<string> board(N);
      |                       ^
a.cc:83:17: error: 'reachble' was not declared in this scope; did you mean 'reachable'?
   83 |           int a=reachble(board,checked,i,j,k,l);
      |                 ^~~~~~~~
      |                 reachable
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 200030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
int h,w;
string s[25];
bool valid(int x,int y)
{
	if(x>=0&&x<h&&y>=0&&y<w)
	return true;
	return false;
}
int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>h>>w;
rep(i,0,h)
cin>>s[i];
int mx=0;
for(int i=0;i<h;i++)
{
	for(int j=0;j<w;j++)
	{
		if(s[i][j]=='.')
		{
			bool bo[30][30];
			memset(bo,false,sizeof(bo));
			queue<pair<int,int> > q;
			q.push({i,j});
			q.push({-1,-1});
			int cnt=0;
			while(!q.empty())
			{

				pair<int,int> p;
				p=q.front();
					q.pop();
					
				if(p.fi==-1){

				cnt++;

				if(!q.front())
				break;
				q.push({-1,-1});}
				else
				{

				bo[p.fi][p.se]=true;

				int a[4]={-1,0,1,0};
				int b[4]={0,-1,0,1};
				bool g=false;

				for(int k=0;k<4;k++)
				{
					if(valid(p.fi+a[k],p.se+b[k])&&s[p.fi+a[k]][p.se+b[k]]!='#')
					if(bo[p.fi+a[k]][p.se+b[k]]==false){
					 g=true;
					q.push({p.fi+a[k],p.se+b[k]});
					}
				}
}
			}
   mx=max(mx,cnt-1);
			cnt=0;
		}
	}
}
cout<<mx;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:36: error: no match for 'operator!' (operand type is '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'})
   49 |                                 if(!q.front())
      |                                    ^~~~~~~~~~
a.cc:49:36: note: candidate: 'operator!(bool)' (built-in)
a.cc:49:36: 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 'bool'
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
int main(){
    int H, W; cin >> H >> W;
    int M[H][W];
    for(int i = 0; i < H; i++){
        string S; cin >> S;
        for(int j = 0; j < W; j++){
            if(S[j] == '.') M[i][j] = 1;
            else M[i][j] = 0;
            //cout << M[i][j];
        }
        //cout << endl;
    }
    int sh[4] = {1, 0, -1, 0};
    int sw[4] = {0, 1, 0, -1};
    int max = 0;

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(M[i][j] == 0) continue;
            //cout << i << " " << j << endl;
            queue<int> qh, qw;
            int maze[H][W];
            int map[H][W];
            memset(maze, 0, sizeof(maze));
            memset(map, 0, sizeof(map));
            int sth = i; int stw = j;
            qh.push(sth); qw.push(stw); 
            map[i][j] = 1;
            while(!qh.empty()){
                
                int h = qh.front(); int w = qw.front();
                //cout << "  " << h << " " << w << endl;
                qh.pop(); qw.pop();
                for(int i = 0; i < 4; i++){
                    int nx_h = h + sh[i];
                    int nx_w = w + sw[i];
                    if(0 <= nx_h && nx_h < W && 0 <= nx_w && nx_w < W){ //範囲内なら
                      
                        if(M[nx_h][nx_w] == 1){ //障害物がないなら
                            
                             if(map[nx_h][nx_w] == 0){ //未探索か最小でいける
                                //cout << "    " << nx_h << " " << nx_w <<" " <<  maze[nx_h][nx_w] << endl;
                                qh.push(nx_h);
                                qw.push(nx_w);
                                maze[nx_h][nx_w] = maze[h][w] + 1;
                                map[nx_h][nx_w] = 1;
                                if(max < maze[nx_h][nx_w]) max = maze[nx_h][nx_w];
                             }
                        }
                    }
                }
            }
            //cout << "max   " << max << endl;
        }
    }
    //if(max >= 38) cout << 38 << endl;
    else cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:5: error: 'else' without a previous 'if'
   62 |     else cout << max << endl;
      |     ^~~~
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>
 
using namespace std;
#define LOCAL  1
#define UPLOAD 2
#define ll long long
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';
#define debugBit(x,n) cerr << #x<< ": " << std::bitset<n>(x) << '\n';
 
struct Vec2{
  Vec2(int x, int y){
    this->x = x;
    this->y = y;
  }
  int x;
  int y;
  Vec2 operator +(Vec2 other){
    return Vec2(this->x + other.x, this->y+other.y);
  }
};
 
void showMaze(vector<vector<int>> course){
  for(auto iter:course){
    for(auto iter2:iter){
      cout << iter2 << "    ";
    }
    cout << endl;
  }
  cout << endl;
}
 
vector<vector<int>> course;
long saitankyori(Vec2 start){
  for(auto iter:{Vec2(-1,0),Vec2(1,0), Vec2(0,-1), Vec2(0,1)}){
    Vec2 targetVec = start + iter;
    if(targetVec.x >= 0 && targetVec.x < course.size() && targetVec.y >= 0 && targetVec.y < course[0].size()){
      course[targetVec.x][targetVec.y] = min(course[start.x][start.y] + 1, course[targetVec.x][targetVec.y]);
      if(course[targetVec.x][targetVec.y] > course[start.x][start.y] && course[targetVec.x][targetVec.y] > 0){
        saitankyori(targetVec);
      }
    }
  }
 
  return 0;
}
int getMax(vector<vector<int>> c){
  int ret = 0;
  for(auto iter:c){
    for(auto iter2:iter){
      ret = max(ret, iter2);
    }
  }
  return ret;
}
 
int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
 
  int H = input(); 
  int W = input(); 
 
  vector<vector<int>> course_temp;
  for(int i=0;i<H;i++){
    vector<int> temp;
    string s = input<string>();
    for(int j=0;j<W;j++){
      if(s.substr(j,1) == "."){
        temp.push_back(100);
      }
      else{
        temp.push_back(-1);
      }
    } 
    course_temp.push_back(temp);
  }
 
  int answer = 0;
  for(int xs=0;xs<H;xs++){
    for(int ys=0;ys<W;ys++){  
      if(course_temp[xs][ys] == -1)continue;
 
      course = course_temp;
      course[xs][ys] = 0;
      saitankyori(Vec2(xs,ys));
 
      answer = max(answer, getMax(course));
    }
  }
 
  output(answer);
 
  return 0;
}z

Compiler output:
a.cc:106:2: error: 'z' does not name a type
  106 | }z
      |  ^
Language: C++

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

int main() {
	int h,w;
	int dx[4] = {1, -1, 0, 0};
	int dy[4] = {0, 0, 1, -1};
	cin >> h >> w;
	char grid[20][20];
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cin >> grid[i][j];
		}
	}
	long long ans = 0;
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(grid[i][j] == '#'){
				continue;
			}else{
				long long board[20][20];
				for(int ii=0; ii<h; ii++){
					for(int jj=0; jj<w; jj++){
						board[ii][jj] = -1;
					}
				}

				board[i][j] = 0;
				queue<int> queueX;
				queue<int> queueY;
				queueX.push(j);
				queueY.push(i);

				while(queueX.size() > 0){
					int x = queueX.front();
					int y = queueY.front();
					queueX.pop();
					queueY.pop();
					for(int ii=0; ii<4; ii++){
						int nextX =x + dx[ii];
						int nextY =y + dy[ii];

						if(0<=nextX && nextX<=w && 0<=nextY && nextY<=h && board[nextY][nextX] == -1 && grid[nextY][nextX] == '.'){
							board[nextY][nextX] = board[y][x] + 1;
							queueX.push(nextX);
							queueY.push(nextY);
						}
					}
				}
				long long tmp = 0;
				for(int ii=0; ii<h; ii++){
					for(int jj=0; jj<w; jj++){
						tmp = max(tmp, board[ii][jj]);
					}
				}
				ans = max(ans, tmp)
			}
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:52: error: expected ';' before '}' token
   56 |                                 ans = max(ans, tmp)
      |                                                    ^
      |                                                    ;
   57 |                         }
      |                         ~
Language: C++

#include <bits/stdc++.h>
#define MAXN int(10e5+3)
#define f first
#define s second
#define int long long
using namespace std;
typedef pair<int, pair<int, int> > piii;
typedef pair<int, int> pii;

char m[23][23];
int dist[23][23], processado[23][23];
int iv = 0, jv = 0, av = 0, l, c;

int x[] = {1, -1, 0, 0};
int y[] = {0, 0, 1, -1};

priority_queue<piii, vector<piii>, greater<piii> > fila;

void solve(int i, int j, int tam) {

    dist[i][j] = tam;
    for(int z = 0; z < 4; z++) {
        if(i+x[z] >= 0 && i+x[z] < l && j+y[z] >= 0 && j+y[z] < c && m[i+x[z]][j+y[z]] == '.') {
            pair<int, pii> xd;
            xd.first = tam+1;
            xd.second = pii(i+x[z], j+y[z]);
            fila.push(xd);
        }
    }

    while(!fila.empty()) {

        if(processado[fila.top().second.first][fila.top().second.second] == 1) {
            fila.pop();
            continue;
        }

        if(fila.top().first > av)
            av = fila.top().first;

        processado[fila.top().second.first][fila.top().second.second] = 1;
        solve(fila.top().second.first, fila.top().second.second, fila.top().first);
    }
    return;
}

int main() {
    cin >> l >> c;

    for(int i = 0; i < l; i++)
        for(int j = 0; j < c; j++)
            cin >> m[i][j];

    for(int i = 0; i < l; i++)
        for(int j = 0; j < c; j++) {
            if(m[i][j] == '.') solve(i, j, 0);
            memset(dist, 0, sizeof dist);
            memset(processado, 0, sizeof processado);
        }
    cout << av << endl;
}


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



#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <vector>
#include <list>
using namespace std;
#include <stdio.h>
#include <map> 
#include <algorithm>
#include <functional>
#include <algorithm>
#include <functional>
#include <array>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>


int  H, W;
std::vector<int> len;

int maze[20][20] = {};
struct pos {
	int x = 0;
	int y = 0;
};

std::vector<pos> tail[400];

int mazelen[20][20] = {};

bool update(pos pp) {

	pos p = pp;
	pos offset[] = {
		0, 1,
		0, -1,
		1, 0,
		-1, 0,
	};

	for (int i = 0; i < 4; ++i) {
		offset[i].x += p.x;
		offset[i].y += p.y;

		offset[i].x = std::min(W-1, offset[i].x);
		offset[i].x = std::max(0, offset[i].x);

		offset[i].y = std::min(H-1, offset[i].y);
		offset[i].y = std::max(0, offset[i].y);
	}

	int n = mazelen[pp.x][pp.y];
	bool find = false;

	for (int i = 0; i < 4; ++i) {
		auto c = offset[i];
		if ((mazelen[c.x][c.y] == 0) && (maze[c.x][c.y] == 0)) {
			mazelen[c.x][c.y] = n + 1;

			tail[n + 1].push_back(c);
			find = true;
		}
	}
	return find;
}

int maze_len() {
	
	bool find = false;

	int currentLen = 0;
	for (int i = 0; i < tail[currentLen].size(); ++i) {
		const auto p = tail[currentLen][i];
	}



	return 0;
}

int main()
{
	std::string S;
	cin >> H >> W;

//	int maze[20][20] = {};

	for (int h = 0; h < H; ++h) {
		for (int w = 0; w < W; ++w) {
			char a;
			cin >> a;
			if (a == '.') {
				maze[w][h] = 0;
			} else {
				maze[w][h] = 1;
			}
		}
	}

	int mm = 0;


	for (int y = 0; y < H; ++y) {
		for (int x = 0; x < W; ++x) {
			if (maze[x][y]) {
				continue;
			}

			pos c;
			c.x = x; c.y = y;

			for (int i = 0; i < 400; ++i) {
				tail[i].clear();
			}
			std::memset(mazelen, 0, sizeof(mazelen));

			tail[1].push_back(c);
			mazelen[x][y] = 1;

			for (int i = 1; i < 400; ++i) {
				bool b = false;
				for (int j = 0; j < tail[i].size(); ++j) {
					b |= update(tail[i][j]);
				}
				if (b == false) {
					mm = std::max(i - 1, mm);
					break;
				}
			}
		}
	}


	printf("%d\n", mm);


	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:121:30: error: 'memset' is not a member of 'std'; did you mean 'wmemset'?
  121 |                         std::memset(mazelen, 0, sizeof(mazelen));
      |                              ^~~~~~
      |                              wmemset
Language: C++

#include"bits/stdc++.h"
using namespace std;
int main(void){
  int H,W;
  char s[20][20];
  bool t[20][20];
  cin>>H>>W;
  for(int i=0;i<H;++i){
    for(int j=0;j<W;++j){
      cin>>s[i][j];
      t[i][j]=false;
    }
  }
  for(int h=0;h<H;++h){
    for(int w=0;w<W;++w){
      if(!t[h][w]&&s[h][w]==".")
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:16:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |       if(!t[h][w]&&s[h][w]==".")
      |                    ~~~~~~~^~~~~
a.cc:17:5: error: expected primary-expression before '}' token
   17 |     }
      |     ^
a.cc:18:4: error: expected '}' at end of input
   18 |   }
      |    ^
a.cc:3:15: note: to match this '{'
    3 | int main(void){
      |               ^
Language: C++

#include <bits/stdc++.h>
#define    ll long long
using namespace std;
const int maxn  = 2000005;
int mp[405][405];
int vis[405][405];
int dis[405][405];
char a[30][30];
int main()
{
   int n,m;
   cin>>n>>m;
   for(int i=0;i<n;i++)
        cin>>a[i];
   for(int i=0;i<n*m;i++){
        for(int j=0;j<n*m;j++)
            dis[i][j] = maxn;
        dis[i][i] = 0;
   }

   //cout<<1111<<endl;
   for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            if(a[i][j]=='.'){
                if(i>0&&a[i-1][j]=='.')     dis[(i-1)*m+j][i*m+j] = 1,dis[(i)*m+j][(i-1)*m+j] = 1;
                if((i+1)<n&&a[i+1][j]=='.') dis[(i+1)*m+j][i*m+j] = 1,dis[(i)*m+j][(i+1)*m+j] = 1;
                if(j>0&&a[i][j-1]=='.')     dis[i*m+j][(i)*m+j-1] = 1,dis[(i)*m+j-1][(i)*m+j] = 1;
                if((j+1)<m&&a[i][j+1]=='.') dis[i*m+j][(i)*m+j+1] = 1,dis[(i)*m+j+1][(i)*m+j] = 1;
            }

    for(int i=0;i<(n*m);i++){
        if(a[i/m][i%m]=='#') continue;
        for(int j=0;j<(n*m);j++){// cout<<222<<endl;
            if(a[j/m][j%m]=='#') continue;
            for(int l=0;l<(n*m);l++){
                if(a[l/m][l%m]=='#') continue;
                if(dis[i][j]>dis[i][l]+dis[l][j]){
                    dis[i][j]=dis[i][l]+dis[l][j];
                    dis[j][i] = dp[i][j];
                }
            }
        }

    }
     for(int i=0;i<(n*m);i++){
        if(a[i/m][i%m]=='#') continue;
        for(int j=0;j<(n*m);j++){// cout<<222<<endl;
            if(a[j/m][j%m]=='#') continue;
            for(int l=0;l<(n*m);l++){
                if(a[l/m][l%m]=='#') continue;
                if(dis[i][j]>dis[i][l]+dis[l][j]){
                    dis[i][j]=dis[i][l]+dis[l][j];
                     dis[j][i] = dp[i][j];
                }
            }
        }

    }
    int minn = 0;
    for(int i=0;i<(n*m);i++){
        if(a[i/m][i%m]=='#') continue;
        for(int j=0;j<(n*m);j++){
            if(a[j/m][j%m]=='#') continue;
           // cout<<i/m<<" "<<i%m<<endl;
           //  cout<<j/m<<" "<<j%m<<":  ";
           // cout<<dis[i][j]<<endl;
            if(dis[i][j]<10000)
                minn = max(minn,dis[i][j]);
        }
    }
    cout<<minn<<endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:33: error: 'dp' was not declared in this scope; did you mean 'mp'?
   39 |                     dis[j][i] = dp[i][j];
      |                                 ^~
      |                                 mp
a.cc:53:34: error: 'dp' was not declared in this scope; did you mean 'mp'?
   53 |                      dis[j][i] = dp[i][j];
      |                                  ^~
      |                                  mp
Language: C++

/**
 * @author: Mackenzie
**/
#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
int n, m;
const ll INF = 1e9;
const int MAX = 500;
ll g[MAX][MAX];
char mat[n][m];
void floydWarshall() {
    for (int k = 0; k <= max(n * n, m * m); k++)
        for (int i = 0; i <= max(n * n, m * m); i++)
            for (int j = 0; j <= max(n * n, m * m); j++)
                g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
}

void init() {
    for (int i = 0; i <= max(n * n, m * m); i++) {
        for (int j = 0; j <= max(n * n, m * m); j++) {
            g[i][j] = (i == j ? 0 : INF);
        }
    }
}
bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    cin >> n >> m;
    forn(i, n) {
        string s;
        cin >> s;
        forn(j, m) {
            mat[i][j] = s[j];
        }
    }
    init();
    forn(i, n) {
        forn(j, m) {
            if (mat[i][j] != '#') {
                int cur = i * n + j;
                if (ok(i, j + 1) && mat[i][j + 1] == '.') {
                    g[cur][cur + 1] = 1;
                }
                if (ok(i, j - 1) && mat[i][j - 1] == '.') {
                    g[cur][cur - 1] = 1;
                }
                if (ok(i + 1, j) && mat[i + 1][j] == '.') {
                    g[cur][cur + n] = 1;
                }
                if (ok(i - 1, j) && mat[i - 1][j] == '.') {
                    g[cur][cur - n] = 1;
                }
            }
        }
    }
    floydWarshall();
    ll mx = 0;
    forn(i, n) {
        forn(j, m) {
            if (mat[i][j] != '#') {
                forn(a, n) {
                    forn(b, m) {
                        if (mat[a][b] != '#') {
                            ll dis = g[i * n + j][a * n + b];
                            //cout << "[" << i * n + j << ", " << a * n + b << " ] = " << dis << endl;
                            if (dis != INF) mx = max(mx, dis);
                        }
                    }
                }
            }
        }
    }
    cout << mx << endl;
    return 0;
}

Compiler output:
a.cc:22:13: error: size of array 'mat' is not an integral constant-expression
   22 | char mat[n][m];
      |             ^
a.cc:22:10: error: size of array 'mat' is not an integral constant-expression
   22 | char mat[n][m];
      |          ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    int h, w;
    cin >> h >> w;

    char way[21 + 3][21 + 3] = {};
    int route[21 + 3][21 + 3] = {};

    int x0 = -1;
    int y0 = -1;

    for (int y = 1; y <= h; ++y) {
        for (int x = 1; x <= w; ++x) {
            char c;
            cin >> c;
            way[y][x] = (c == '.');
            if (way[y][x] && x0 < 0 && y0 < 0) {
                x0 = x;
                y0 = y;
            }
        }
    }

    auto open = vector<int>();
    open.reserve(20 * 20);

    struct XY {
        int x, y;
    };
    const XY dir[4] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
    struct XYR {
        int x, y, max_r;
    };

    const auto &fill_route = [&](int x_start, int y_start) {
        open.clear();
        open.push_back(x_start + y_start * 256);
        memset(route, 0, sizeof(route));
        route[y_start][x_start] = 1;

        while (!open.empty()) {
            int xy = open.front();
            open.erase(open.begin()); // !! pop_front
            int x = xy % 256;
            int y = xy / 256;
            int K = route[y][x];

            for (auto d : dir) {
                int nx = x + d.x;
                int ny = y + d.y;
                if (!way[ny][nx])
                    continue;
                if (route[ny][nx])
                    continue;

                route[ny][nx] = K + 1;
                open.push_back(nx + ny * 256);
            }
        }
    };

    const auto &find_max = [&]() {
        int max_r = 0;
        int sx, sy;
        for (int y = 1; y <= h; ++y) {
            for (int x = 1; x <= w; ++x) {
                if (route[y][x] > max_r) {
                    sx = x;
                    sy = y;
                    max_r = route[y][x];
                }
            }
        }
        return XYR{sx, sy, max_r};
    };

    cerr << x0 << ", " << y0 << "\n";
    fill_route(x0, y0);
    auto xyr = find_max();
    cerr << xyr.x << ", " << xyr.y << ": " << xyr.max_r << "\n";
    fill_route(xyr.x, xyr.y);
    xyr = find_max();

    cout << (xyr.max_r - 1);
    return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:42:9: error: 'memset' was not declared in this scope
   42 |         memset(route, 0, sizeof(route));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll INF=4e18;
ll nodeno[30][30];
vector<ll> adj_list[maxn*maxn];
bool visited[30*30];
ll level[30*30];
void assign_nodeno(ll h,ll w)
{
	ll k=1;
	for(ll i=0;i<h;i++)
	{
		for(ll j=0;j<w;j++)
		{
			nodeno[i][j]=k;
			k++;
		}
	}
}
void bfs(ll s)
{
	visited[s]=true;
	queue<ll> q;
	q.push(s);
	level[s]=0;
	while(!q.empty())
	{
		ll x=q.front();
		q.pop();
		for(auto it:adj_list[x])
		{
			if(!visited[it])
			{
				level[it]=level[x]+1;
				visited[it]=true;
				q.push(it);
			}
		}
	}
}
void solve()
{
	ll h,w;
	cin>>h>>w;
	assign_nodeno(h,w);
	memset(visited,false,sizeof(visited));
	memset(visited,0,sizeof(level));
	char g[30][30]; 
	for(ll i=0;i<h;i++)
	{
		for(ll j=0;j<w;j++)
		{
			cin>>g[i][j];
		}
	}
	for(ll i=0;i<h;i++)
	{
		for(ll j=0;j<w;j++)
		{
			if(i!=0)
			{
				if(g[i-1][j]!='#')
					adj_list[nodeno[i][j]].push_back(nodeno[i-1][j]);
			}
			if(i!=h-1)
			{
				if(g[i+1][j]!='#')
					adj_list[nodeno[i][j]].push_back(nodeno[i+1][j]);
			}
			if(j!=0)
			{
				if(g[i][j-1]!='#')
					adj_list[nodeno[i][j]].push_back(nodeno[i][j-1]);
			}
			if(j!=w-1)
			{
				if(g[i][j+1]!='#')
					adj_list[nodeno[i][j]].push_back(nodeno[i][j+1]);
			}
		}
	}
	ll ans=0;
	for(ll p=0;p<h;p++)
	{
		for(ll q=0;q<w;q++)
		{	
			if(g[p][q]!='#')
			{
				bfs(nodeno[p][q]);
				for(ll j=1;j<=h*w;j++)
				{
					ans=max(ans,level[j]);
				}
				memset(level,0,sizeof(level));
				memset(visited,0,sizeof(visited));
			}
		}
	}
	cout<<ans<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T=1,p=0;
	//cin>>T;
	do
	{
		solve();
		p++;
	}while(p<T);
	return 0;
}



Compiler output:
a.cc:6:21: error: 'maxn' was not declared in this scope
    6 | vector<ll> adj_list[maxn*maxn];
      |                     ^~~~
a.cc:6:26: error: 'maxn' was not declared in this scope
    6 | vector<ll> adj_list[maxn*maxn];
      |                          ^~~~
a.cc: In function 'void bfs(ll)':
a.cc:31:29: error: 'adj_list' was not declared in this scope
   31 |                 for(auto it:adj_list[x])
      |                             ^~~~~~~~
a.cc: In function 'void solve()':
a.cc:64:41: error: 'adj_list' was not declared in this scope
   64 |                                         adj_list[nodeno[i][j]].push_back(nodeno[i-1][j]);
      |                                         ^~~~~~~~
a.cc:69:41: error: 'adj_list' was not declared in this scope
   69 |                                         adj_list[nodeno[i][j]].push_back(nodeno[i+1][j]);
      |                                         ^~~~~~~~
a.cc:74:41: error: 'adj_list' was not declared in this scope
   74 |                                         adj_list[nodeno[i][j]].push_back(nodeno[i][j-1]);
      |                                         ^~~~~~~~
a.cc:79:41: error: 'adj_list' was not declared in this scope
   79 |                                         adj_list[nodeno[i][j]].push_back(nodeno[i][j+1]);
      |                                         ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MAX=1e12;
ll mod=1e9+7;
#define pb push_back
#define se second
#define fi first
#define maxe max_element
#define mine min_element
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
vector<int> graph[205];
int color[205];
int nCk[100][100];
bool bipartite_jugding(int v, int c){
    color[v] = c;
    for(int i = 0; i < graph[v].size(); ++i){
        if(color[graph[v][i]] == c) return false;
        if(color[graph[v][i]] == 0 && !bipartite_jugding(graph[v][i], -c)){
            return false;
        }
    }
    return true;
}

 void combi() {
	for (int i = 0; i <= 99; ++i) nCk[i][0] = 1;
	for (int i = 1; i <= 99; ++i) for (int j = 1; j <= i; ++j) {
		nCk[i][j] = (nCk[i-1][j] + nCk[i-1][j-1]) % mod;
	}
}

long long expo(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*expo((x*x)%M,(n-1)/2,M))%M;

}
int h,w;
 vector<vector<char> > mat(20,vector<char> (20));
int X[]={0,1,0,-1};
int Y[]={-1,0,1,0};
bool valid(int x,int y){
    if(x>=0 && x<h && y>=0 && y<w && mat[x][y]!='#')return true;
    return false;}
vector<vector<int> > visi(21,vector<int> (21));
int moves(int x1,int y1,int x2,int y2)
{
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
        visi[i][j]=0;
    queue<pair<int,int> > q;
    q.push({x1,y1});int level=1;int ans=0;
    while(q.size())
    {
    x1=q.front().fi;y1=q.front().se;level--;q.pop();
    if(x1==x2 && y1== y2)return ans;
    visi[x1][y1]=1;
    for(int i=0;i<4;i++)
    {
            if(valid(x1+X[i],y1+Y[i]) && !visi[x1+X[i]][y1+Y[i]])
            q.push({x1+X[i],y1+Y[i]});

    }
    if(level==0)
    {
        ans++;
        level=q.size();
    }
    }
    return -1;
}

void solve(){
    boost;
  cin>>h>>w;
  for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
        cin>>mat[i][j];
    int ans=0;
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
             for(int i1=0;i1<h;i1++)
    for(int j1=0;j1<w;j1++){ int k=-1;
    if(mat[i][j]=='.' && mat[i1][j1]=='.')
        k=moves(i,j,i1,j1);
        if(k!=-1)ans=max(ans,k);}
  cout<<ans<<endl;
}

int main(){
    boost;
  solve();v
}
v

Compiler output:
a.cc: In function 'int main()':
a.cc:104:11: error: 'v' was not declared in this scope
  104 |   solve();v
      |           ^
a.cc: At global scope:
a.cc:106:1: error: 'v' does not name a type
  106 | v
      | ^
Language: C++

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

void dfs(vector<string > &vec,vector< vector<ll> > &visited,ll a,ll b,ll count,ll h,ll w){
	if(a>=h||b>=w||a<0||b<0){
		return;
	}
	if(vec[a][b]=='#') return;
	if(visited[a][b]>0) return;
	visited[a][b]=count;
	dfs(vec,visited,a+1,b,count+1,h,w);
	dfs(vec,visited,a-1,b,count+1,h,w);
	dfs(vec,visited,a,b+1,count+1,h,w);
	dfs(vec,visited,a,b-1,count+1,h,w);
}

int main()
{
	ll h,w;
	cin>>h>>w;
	vector<string > vec;
	for(ll i=1;i<=h;i++){
		string s;
		cin>>s;
		vec.push_back(s);
	}
	
	
	ll ans=0;
	for(ll i=0;i<h;i++){
		for(ll j=0;j<w;j++){
			if(vec[i][j]=='.'){
				vector< vector<ll> > visited(h,vector<ll> (w,0));
				ll count=1;
				dfs(vec,visited,i,j,count,h,w);
//				cout<<i<<" "<<j<<"   pp"<<endl;
				for(ll k=0;k<h;k++){
					for(ll l=0;l<w;l++){
						count=max(count,visited[k][l]-1);
//						cout<<visited[k][l]-1<<" ";
					}
//					cout<<endl;
				}//cout<<endl;
				ans=max(ans,count);
			}
		}
	}
	cout<<min(ans,m+n-2)<<endl;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:23: error: 'm' was not declared in this scope
   49 |         cout<<min(ans,m+n-2)<<endl;
      |                       ^
a.cc:49:25: error: 'n' was not declared in this scope
   49 |         cout<<min(ans,m+n-2)<<endl;
      |                         ^
Language: C++

#include <bits/stdc++.H>
using namespace std;
#define rep(i, a, b) for(int i  = a; i < b; i++)
typedef long long ll;

//static const int MAX_V = 400 * 400 + 10;
const int INF = 1e9;
int V;
using namespace std;
static const int N = 100;
static const int INFTY = (1 << 21);
static const int white = 0;
static const int gray = 1;
static const int black = 2;

int H , W;
int ans = 0;
int sy, sx, gy, gx;
int M[N][N];
int d[N][N];
int color[N][N];
vector<string> S;

void bfs(int sy, int sx){
    queue<pair<int, int> > Q;
    color[sy][sx] = gray;
    d[sy][sx] = 0;
    Q.push(make_pair(sy, sx));//全てはスタート地点をqueueに突っ込んでからは閉まる
    while(!Q.empty()){
        pair<int,int> u = Q.front();Q.pop();
        color[u.first][u.second] = black;//動いたら黒に
        if(u.first + 1 < H){//配列の参照範囲内であることを確認したら
            if(color[u.first + 1][u.second] == white){//まだ踏んでいないor可動範囲であることを確認して
                Q.push(make_pair(u.first+1,u.second));//queueに突っ込む
                color[u.first + 1][u.second] = gray;//突っ込んだらgray色にすることを忘れない
                d[u.first + 1][u.second] = d[u.first][u.second] + 1;//距離は元の場所から1足す
            }
        }//以下同様,今回は2次元迷路なので4方向確認している。
        if(u.first - 1 >= 0){
            if(color[u.first - 1][u.second] == white){
                Q.push(make_pair(u.first-1,u.second));
                color[u.first - 1][u.second] = gray;
                d[u.first - 1][u.second] = d[u.first][u.second] + 1;
            }
        }
        if(u.second + 1 < W){
            if(color[u.first][u.second+1] == white){
                Q.push(make_pair(u.first,u.second+1));
                color[u.first][u.second+1] = gray;
                d[u.first][u.second+1] = d[u.first][u.second] + 1;
            }
        }
        if(u.second - 1 >= 0){
            if(color[u.first][u.second-1] == white){
                Q.push(make_pair(u.first,u.second-1));
                color[u.first][u.second-1] = gray;
                d[u.first][u.second-1] = d[u.first][u.second] + 1;
            }
        }
        
    }
    rep(i, 0, H) rep(j, 0, W) if(d[i][j] != INF) ans = max(ans, d[i][j]);

}
int main(){
    cin >> H >> W;
    S.resize(H);
    rep(i, 0, H) cin >> S[i];
    //rep(i, 0, H * W) rep(j, 0, H * W) d[i][j] = INF;
    rep(i, 0, H) rep(j, 0, W){
        rep(k, 0, H) rep(l, 0, W){
            d[k][l] = INF;
            if(S[k][l] == '.') color[k][l] = white;
            else color[k][l] = black;
        }
        bfs(i,j);
    }
    cout << ans << endl;

}

Compiler output:
a.cc:1:10: fatal error: bits/stdc++.H: No such file or directory
    1 | #include <bits/stdc++.H>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>
#include<functional>
#include<stack>
#include<set>
typedef long long ll;

using namespace std;

vector<int> xd{-1,1,0,0};
vector<int> yd{0,0,-1,1};
int X, Y;

int bfs(vector<string>& b, int x, int y){
    vector<vector<int>> ds(Y, vector<int>(X, 50000));
    queue<pair<int,int>> st;
    int maxD = 0;
    st.push(make_pair(x,y));
    ds[y][x]=0;
    while(!st.empty()){
        auto now = st.front();
        st.pop();
        int nx=now.first;
        int ny=now.second;
//        cout << now.first << now.second << ds[now.second][now.first] << endl;
        for(int d=0;d<4;d++){
            int tx = now.first+xd[d];
            int ty = now.second+yd[d];
            if(tx < 0 || tx >= X || ty < 0 || ty >= Y || b[ty][tx]=='#'){continue;}
            if(ds[ty][tx] <= ds[ny][nx]+1){continue;}
            ds[ty][tx] = ds[ny][nx]+1;
            st.push(make_pair(tx,ty));
        }
    }

    for(int y=0;y<Y;y++){
        for(int x=0;x<X;x++){
            if(b[y][x] == '#' || ds[y][x] == INT_MAX){continue;}
            maxD = max(maxD, ds[y][x]);
        }
    }
    return maxD;    
}



int main(){
    cin >> Y >> X;
    vector<string> b(Y);
    for(int y=0;y<Y;y++){
        cin >> b[y];
    }
    int maxD = 0;
    for(int y=0;y<Y;y++){
        for(int x=0;x<X;x++){
            maxD = max(maxD, bfs(b ,x, y));
        }
    }

    cout << maxD;
    return 0;
}


Compiler output:
a.cc: In function 'int bfs(std::vector<std::__cxx11::basic_string<char> >&, int, int)':
a.cc:42:46: error: 'INT_MAX' was not declared in this scope
   42 |             if(b[y][x] == '#' || ds[y][x] == INT_MAX){continue;}
      |                                              ^~~~~~~
a.cc:10:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    9 | #include<set>
  +++ |+#include <climits>
   10 | typedef long long ll;
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>
#include<functional>
#include<stack>
#include<set>
typedef long long ll;

using namespace std;

vector<int> xd{-1,1,0,0};
vector<int> yd{0,0,-1,1};
int X, Y;

int bfs(vector<string>& b, int x, int y){
    vector<vector<int>> ds(Y, vector<int>(X, INT_MAX));
    queue<pair<int,int>> st;
    int maxD = 0;
    st.push(make_pair(x,y));
    ds[y][x]=0;
    while(!st.empty()){
        auto now = st.front();
        st.pop();
        int nx=now.first;
        int ny=now.second;
//        cout << now.first << now.second << ds[now.second][now.first] << endl;
        for(int d=0;d<4;d++){
            int tx = now.first+xd[d];
            int ty = now.second+yd[d];
            if(tx < 0 || tx >= X || ty < 0 || ty >= Y || b[ty][tx]=='#'){continue;}
            if(ds[ty][tx] <= ds[ny][nx]+1){continue;}
            ds[ty][tx] = ds[ny][nx]+1;
            st.push(make_pair(tx,ty));
        }
    }

    for(int y=0;y<Y;y++){
        for(int x=0;x<X;x++){
            if(b[y][x] == '#' || ds[y][x] == INT_MAX){continue;}
            maxD = max(maxD, ds[y][x]);
        }
    }
    return maxD;    
}



int main(){
    cin >> Y >> X;
    vector<string> b(Y);
    for(int y=0;y<Y;y++){
        cin >> b[y];
    }
    int maxD = 0;
    for(int y=0;y<Y;y++){
        for(int x=0;x<X;x++){
            maxD = max(maxD, bfs(b ,x, y));
        }
    }

    cout << maxD;
    return 0;
}


Compiler output:
a.cc: In function 'int bfs(std::vector<std::__cxx11::basic_string<char> >&, int, int)':
a.cc:19:46: error: 'INT_MAX' was not declared in this scope
   19 |     vector<vector<int>> ds(Y, vector<int>(X, INT_MAX));
      |                                              ^~~~~~~
a.cc:10:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    9 | #include<set>
  +++ |+#include <climits>
   10 | typedef long long ll;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define F first  
#define S second
#define ll long long
#define pb push_back
#define pr pair<ll,ll>

const ll N=1e5+9,mod=1e9+7,inf=1e18;

int r,c,vis[22][22];
string s[22];



int bfs(int i,int j)
{
	queue< pair<pair<int,int>,int> > q;
	q.push({ {i,j},0});
	int mx=0;
	vis[i][j]=true;
	while(!q.empty())
	{
		auto p=q.front();
		q.pop();
        if(s[p.F.F][p.F.S]=='#')continue;
        mx=max(mx,p.S);
        if( !vis[p.F.F][p.F.S+1])  
        	{
        		vis[p.F.F][p.F.S+1]=true;
        		q.push(  {  {p.F.F,p.F.S+1} ,p.S+1} )
        	}
        if( !vis[p.F.F][p.F.S-1]) 
        {
        	vis[p.F.F][p.F.S-1]=true;
          q.push(  {  {p.F.F,p.F.S-1} ,p.S+1} )
        } 
         if( !vis[p.F.F+1][p.F.S])
         {
         	vis[p.F.F+1][p.F.S]=true;
         	 q.push(  {  {p.F.F+1,p.F.S} ,p.S+1} )
         } 
         if( !vis[p.F.F-1][p.F.S]) 
         	{
         		vis[p.F.F-1][p.F.S]=true;
         		 q.push(  {  {p.F.F-1,p.F.S} ,p.S+1} )
         	}

	}
	return mx;
}

int main()
{
	cin>>r>>c;
	for(int i=0;i<=c+1;i++)
	{
		s[0].pb('#');
		s[r+1].pb('#')
	}
    for(int i=1;i<=r;i++)
    {
    	cin>>s[i];
    	s[i]="#"+s[i]+"#";
    }
    int mx=0;

    for(int i=1;i<=r;i++)
    {
    	for(int j=1;j<=c;j++)
    	{
    		
    		memset(vis,0,sizeof vis);
    		mx=max(mx,bfs(i,j));
    	}
    }

    cout<<mx<<"\n";
	
	
	return 0;
}


Compiler output:
a.cc: In function 'int bfs(int, int)':
a.cc:31:62: error: expected ';' before '}' token
   31 |                         q.push(  {  {p.F.F,p.F.S+1} ,p.S+1} )
      |                                                              ^
      |                                                              ;
   32 |                 }
      |                 ~                                             
a.cc:36:48: error: expected ';' before '}' token
   36 |           q.push(  {  {p.F.F,p.F.S-1} ,p.S+1} )
      |                                                ^
      |                                                ;
   37 |         }
      |         ~                                       
a.cc:41:55: error: expected ';' before '}' token
   41 |                  q.push(  {  {p.F.F+1,p.F.S} ,p.S+1} )
      |                                                       ^
      |                                                       ;
   42 |          }
      |          ~                                             
a.cc:46:63: error: expected ';' before '}' token
   46 |                          q.push(  {  {p.F.F-1,p.F.S} ,p.S+1} )
      |                                                               ^
      |                                                               ;
   47 |                 }
      |                 ~                                              
a.cc: In function 'int main()':
a.cc:59:31: error: expected ';' before '}' token
   59 |                 s[r+1].pb('#')
      |                               ^
      |                               ;
   60 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int h, w;
  cin>>h>>w;
  vector<string> s(h);
  REP(i,h){
    cin>>s[i];
  }
  vector<vector<long long>> dist(h*w, vector<long long>(h*w, INF));
  REP(i, h*w){
    dist[i][i] = 0;
  }
  auto conv = [&](int i, int j){
    int res;
    res = w*i + j;
    return res;
  }
  int dx[] = {1, 0, -1, 0};
  int dy[] = {0, 1, 0, -1};
  REP(i,h){
    REP(j,w){
      if(s[i][j] == '#')continue;
      REP(k,4){
        int ni = i + dx[k];
        int nj = j + dy[k];
        if(ni < 0 || ni >= h || nj < 0 || nj >= w){
          continue;
        }
        if(s[ni][nj] == '#')continue;
        int f = conv(i, j);
        int t = conv(ni, nj);
        dist[f][t] = dist[t][f] = 1;
      }
    }
  }
  REP(k,h*w){
    REP(i,h*w){
      REP(j,h*w){
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
  long long ans = 0;
  REP(i,h*w){
    REP(j,h*w){
      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:86:3: error: expected ',' or ';' before 'int'
   86 |   int dx[] = {1, 0, -1, 0};
      |   ^~~
a.cc:92:22: error: 'dx' was not declared in this scope; did you mean 'dy'?
   92 |         int ni = i + dx[k];
      |                      ^~
      |                      dy
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i  = a; i < b; i++)
typedef long long ll;

static const int MAX_V = 400 * 400 + 10;
const int INF = 1e9;

int d[MAX_V][MAX_V];
int V;

void warshall_floyde(){
    for(int k = 0; k < V; k++){
        for(int i = 0; i < V; i++){
            for(int j = 0; j < V; j++) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
    }
}


int main(){
    int H, W; cin >> H >> W;
    vector<string> S(H);
    rep(i, 0, H) cin >> S[i];
    V = H * W;
    rep(i, 0, H * W) rep(j, 0, H * W) d[i][j] = INF;

    rep(i, 0, H){
        rep(j, 0, W){
            if(S[i][j] == '.') {
                if(i - 1 >= 0 && S[i-1][j] == '.') d[W*i+j][W*(i-1)+j] = 1;
                if(i + 1 < H && S[i+1][j] == '.') d[W*i+j][W*(i+1)+j] = 1;
                if(j - 1 >= 0 && S[i][j-1] == '.') d[W*i+j][W*i+j-1] = 1;
                if(j + 1 < W && S[i][j+1] == '.') d[W*i+j][W*i+j+1] = 1;
            }
        }
    }

    warshall_floyde();

    int ans = 0;

    rep(i, 0, H * W) rep(j, 0, H * W){
        if(d[i][j] != INF) ans = max(ans, d[i][j]);
    }
    cout << ans << endl;
}

Compiler output:
/tmp/ccGc9rPp.o: in function `warshall_floyde()':
a.cc:(.text+0xe5): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccGc9rPp.o
a.cc:(.text+0xf8): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccGc9rPp.o
a.cc:(.text+0x10b): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccGc9rPp.o
/tmp/ccGc9rPp.o: in function `main':
a.cc:(.text+0x1c4): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccGc9rPp.o
collect2: error: ld returned 1 exit status