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

#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;
const ll LMAX=1000000000000001;

int h,w;
int m=0;
vector<string> s;

solv(int x,int y){
  vector<int> dx={-1,0,1,0};
  vector<int> dy={0,1,0,-1};
  queue<int> X;
  queue<int> Y;
  vector<vector<bool>> memo(h,vector<bool>(w,0));
  vector<vector<int>> a(h,vector<int>(w,0));
  X.push(x);Y.push(y);
  memo[x][y]=1;
  while(!(X.empty())){
    int Xz=X.front();
    int Yz=Y.front();
    rep(i,4){
      int xz=Xz+dx[i];int yz=Yz+dy[i];
      if(xz<0||xz>=h||yz<0||yz>=w) continue;
      if(s[xz][yz]=='#'||memo[xz][yz]) continue;
      a[xz][yz]=a[Xz][Yz]+1;
      X.push(xz);Y.push(yz);
      memo[xz][yz]=1;
    }
    X.pop();Y.pop();
  }
  rep(k,h){
    rep(l,w){
      m=max(m,a[k][l]);
    }
  }
}

int main(){
  cin>>h>>w;
  rep(i,h){
    string S; cin>>S;
    s.pb(S);
  }

  rep(i,h){
    rep(j,w){
      if(s[i][j]=='#') continue;
      solv(i,j);
    }
  }
  cout<<m<<endl;


  return 0;
}


Compiler output:
a.cc:22:1: error: ISO C++ forbids declaration of 'solv' with no type [-fpermissive]
   22 | solv(int x,int y){
      | ^~~~
a.cc: In function 'int solv(int, int)':
a.cc:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
   49 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long int lli;
const int inf = 1e9;
const lli mod = 1e9 +7;
typedef pair<lli, lli> pll;
typedef pair<int, int> pii;

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

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<char>> s(h+2, vector<char>(w+2, '#'));
    for(int i=1; i<=h; i++){
        for(int j=1; j<=w; j++){
            cin >> s[i][j];
        }
    }

    vector<vector<int>> adj(h*w, vector<int>(h*w, inf));
    for(int i=0; i<h*w; i++){
        adj[i][j] = 0;
    }
    for(int i=1; i<=h; i++){
        for(int j=1; j<=w; j++){
            if(s[i][j] == '#') continue;
            int a = (i-1)*w +(j-1);
            for(int d=0; d<4; d++){
                int ni=i+dx[d], nj=j+dy[d];
                int b = (ni-1)*w +(nj-1);
                if(s[ni][nj] == '.'){
                    adj[a][b] = adj[b][a] = 1;
                }
            }
        }
    }
    for(int k=0; k<h*w; k++){
        for(int i=0; i<h*w; i++){
            for(int j=0; j<h*w; j++){
                adj[i][j] = min(adj[i][j], adj[i][k]+adj[k][j]);
            }
        }
    }

    int ans = 0;
    for(int i=0; i<h*w; i++){
        for(int j=0; j<h*w; j++){
            if(adj[i][j] != inf){
                ans = max(ans, adj[i][j]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: 'j' was not declared in this scope
   27 |         adj[i][j] = 0;
      |                ^
Language: C++

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

#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define sl1(a)  scanf("%lld",&a)
#define sl2(a,b)  scanf("%lld %lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld %lld %lld",&a,&b,&c)
#define PI 3.1415926535897932

int main(){
    int mod=1000000007;
    int h,w,ans=1;
    sc2(h,w);
    int d[h][w];
    rep(i,h) rep(j,w) d[i][j]=0; // (0,".")  (1,"#")
    rep(i,h) rep(j,w) {
        char s[w];
        scanf("%s",s);
        rep(k,w) if (s[k]=='#') d[i][k]=1;
    }
    int p[h*w][h*w];
    rep(i,h*w) rep(j,w*h) p[i][j]=1000;

    rep(i,h*w) rep(j,h*w) rep(k,h*w) {
        int ih=i/w,iw=i%w, jh=j/w,jw=j%w, kh=k/w,kw=k%w;
            if ("."==d[ih][iw]==d[jh][jw] && ih==jh && abs(iw-jw)==1) p[i][j]=1; p[j][i]=1;
            if ("."==d[ih][iw]==d[jh][jw] && iw==jw && abs(ih-jh)==1) p[i][j]=1; p[j][i]=1;
            if ("."==d[ih][iw]==d[kh][kw] && ih==kh && abs(iw-kw)==1) p[i][k]=1; p[k][i]=1;
            if ("."==d[ih][iw]==d[kh][kw] && iw==kw && abs(ih-kh)==1) p[i][k]=1; p[k][i]=1;
            if ("."==d[jh][jw]==d[kh][kw] && jh==kh && abs(jw-kw)==1) p[j][k]=1; p[k][j]=1;
            if ("."==d[jh][jw]==d[kh][kw] && jw==kw && abs(jh-kh)==1) p[j][k]=1; p[k][j]=1;
            p[j][k]=min(p[j][k],p[j][i]+p[i][k]);
    }
    rep(i,h*w) rep(j,w*h) if (p[i][h]!=1000) ans=max(ans,p[i][h]);

    printf("%d\n",ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   30 |             if ("."==d[ih][iw]==d[jh][jw] && ih==jh && abs(iw-jw)==1) p[i][j]=1; p[j][i]=1;
      |                 ~~~^~~~~~~~~~~
a.cc:31:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   31 |             if ("."==d[ih][iw]==d[jh][jw] && iw==jw && abs(ih-jh)==1) p[i][j]=1; p[j][i]=1;
      |                 ~~~^~~~~~~~~~~
a.cc:32:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   32 |             if ("."==d[ih][iw]==d[kh][kw] && ih==kh && abs(iw-kw)==1) p[i][k]=1; p[k][i]=1;
      |                 ~~~^~~~~~~~~~~
a.cc:33:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   33 |             if ("."==d[ih][iw]==d[kh][kw] && iw==kw && abs(ih-kh)==1) p[i][k]=1; p[k][i]=1;
      |                 ~~~^~~~~~~~~~~
a.cc:34:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |             if ("."==d[jh][jw]==d[kh][kw] && jh==kh && abs(jw-kw)==1) p[j][k]=1; p[k][j]=1;
      |                 ~~~^~~~~~~~~~~
a.cc:35:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   35 |             if ("."==d[jh][jw]==d[kh][kw] && jw==kw && abs(jh-kh)==1) p[j][k]=1; p[k][j]=1;
      |                 ~~~^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    ll n,m;
    ll ma=0,x,y;
    cin>>n>>m;
    vector<vector<bool>> v(n,vector<bool>(m,false));
    vector<vector<bool>> u2(n,vector<bool>(m,false));
    rep(i,n){
        string c;cin>>c;
        rep(j,m)if(c[j]=='.')v[i][j]=true;
    }
    rep(i,n){
        rep(j,m){
    queue<PP> q;
    vector<vector<bool>> u(n,vector<bool>(m,false));
        q.push(PP(i,j,0));
        while(!q.empty()){
        auto p=q.front();q.pop();
        ll i=get<0>(p),j=get<1>(p),d=get<2>(p);
        u[i][j]=true;
        chmax(ma,d);
        if(i+1<n)if(!u[i+1][j]&&v[i+1][j]){
            u[i+1][j]=true;
            q.push(PP(i+1,j,d+1));
        }
        if(i-1>=0)if(!u[i-1][j]&&v[i-1][j]){
            u[i-1][j]=true;
            q.push(PP(i-1,j,d+1));
        }
        if(j+1<m)if(!u[i][j+1]&&v[i][j+1]){
            u[i][j+1]=true;
            q.push(PP(i,j+1,d+1));
        }
        if(j-1>=0)if(!u[i][j-1]&&v[i][j-1]){
            u[i][j-1]=true;
            q.push(PP(i,j-1,d+1));
        }
    }
        }
    out(ma);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:2: error: expected '}' at end of input
   71 | }
      |  ^
a.cc:32:11: note: to match this '{'
   32 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;
const ll LMAX=1000000000000001;

int h,w;
vector<string> s;

solv(int x,int y,vector<vector<int>>& a){
  vector<int> dx={-1,0,1,0};
  vector<int> dy={0,1,0,-1};
  queue<int> X;
  queue<int> Y;
  vector<vector<bool>> memo(h,vector<bool>(w,0));
  X.push(x);Y.push(y);
  memo[x][y]=1;
  while(!(X.empty())){
    int Xz=X.front();
    int Yz=Y.front();
    rep(i,4){
      int xz=Xz+dx[i];int yz=Yz+dy[i];
      if(xz<0||xz>=h||yz<0||yz>=w) continue;
      if(s[xz][yz]=='#'||memo[xz][yz]) continue;
      a[xz][yz]=a[Xz][Yz]+1;
      X.push(xz);Y.push(yz);
      memo[xz][yz]=1;
    }
    X.pop();Y.pop();
  }
}

int main(){
  cin>>h>>w;
  rep(i,h){
    string S; cin>>S;
    s.pb(S);
  }

  int m=0;
  rep(i,h){
    rep(j,w){
      if(s[i][j]=='#') continue;
      vector<vector<int>> a(h,vector<int>(w,0));
      solv(i,j,a);
      rep(k,h){
        rep(l,w){
          m=max(m,a[k][l]);
        }
      }
    }
  }
  cout<<m<<endl;


  return 0;
}


Compiler output:
a.cc:21:1: error: ISO C++ forbids declaration of 'solv' with no type [-fpermissive]
   21 | solv(int x,int y,vector<vector<int>>& a){
      | ^~~~
a.cc: In function 'int solv(int, int, std::vector<std::vector<int> >&)':
a.cc:42:1: warning: no return statement in function returning non-void [-Wreturn-type]
   42 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    ll n,m;
    ll ma=0,x,y;
    cin>>n>>m;
    vector<vector<bool>> v(n,vector<bool>(m,false));
    vector<vector<bool>> u(n,vector<bool>(m,false));
    vector<vector<bool>> u2(n,vector<bool>(m,false));
    rep(i,n){
        string c;cin>>c;
        rep(j,m)if(c[j]=='.')v[i][j]=true;
    }
    rep(i,n){
        rep(j,m){
    queue<PP> q;
        q.push(PP(i,j,0));
        while(!q.empty()){
        auto p=q.front();q.pop();
        ll i=get<0>(p),j=get<1>(p),d=get<2>(p);
        u[i][j]=true;
        chmax(ma,d);
        if(i+1<n)if(!u[i+1][j]&&v[i+1][j]){
            u[i+1][j]=true;
            q.push(PP(i+1,j,d+1));
        }
        if(i-1>=0)if(!u[i-1][j]&&v[i-1][j]){
            u[i-1][j]=true;
            q.push(PP(i-1,j,d+1));
        }
        if(j+1<m)if(!u[i][j+1]&&v[i][j+1]){
            u[i][j+1]=true;
            q.push(PP(i,j+1,d+1));
        }
        if(j-1>=0)if(!u[i][j-1]&&v[i][j-1]){
            u[i][j-1]=true;
            q.push(PP(i,j-1,d+1));
        }
    }
        }
    out(ma);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:2: error: expected '}' at end of input
   71 | }
      |  ^
a.cc:32:11: note: to match this '{'
   32 | int main(){
      |           ^
Language: C++

package main

import "fmt"

var h, w int
var s []string

func main() {
	fmt.Scan(&h, &w)

	s = make([]string, h)

	for i := 0; i < h; i++ {
		fmt.Scan(&s[i])
	}

	ans := 0
	for si := 0; si < h; si++ {
		for sj := 0; sj < w; sj++ {
			for gi := 0; gi < h; gi++ {
				for gj := 0; gj < w; gj++ {
					if si == gi && sj == gj {
						continue
					}
					c := rec(si, sj, gi, gj, s)
					if c == 999999999 {
						continue
					}
					// fmt.Println(si, sj, gi, gj, c)
					if ans < c {
						ans = c
					}
				}
			}
		}
	}
	fmt.Println(ans)
}

func rec(si, sj, gi, gj int, s []string) int {
	m := [20][20]int{}

	for i := 0; i < 20; i++ {
		for j := 0; j < 20; j++ {
			m[i][j] = -1
		}
	}

	cnt := 999999999
	var dfs func(c, i, j int)
	dfs = func(c, i, j int) {
		if i == gi && j == gj {
			if c < cnt {
				cnt = c
			}
			return
		}

		if s[i][j] != '.' || m[i][j] != -1 {
			return
		}
		m[i][j] = c

		dd := [][]int{{-1, 0}, {1, 0}, {0, -1}, {0, 1}}
		for _, d := range dd {
			ni, nj := i+d[0], j+d[1]
			if 0 <= ni && ni < h && 0 <= nj && nj < w {
				dfs(c+1, ni, nj)
			}
		}

		return
	}

	dfs(0, si, sj)

	return cnt
}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:40:1: error: 'func' does not name a type
   40 | func rec(si, sj, gi, gj int, s []string) int {
      | ^~~~
Language: C++

/*  Author:  Hariom_Pandey
    Created: 1/12/2020 6:10:04 PM
*/
#include "bits/stdc++.h"
using namespace std;
#define Hariom_Pandey  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define All(a)          (a).begin(), (a).end()
#define Sort(x)         sort(All(x))
#define Unique(v)       Sort(v); (v).resize(unique(All(v)) - (v).begin())
const int N = 1e6 + 5;
const int wx[4]={0,0,1,-1},wy[4]={1,-1,0,0};
int n,m;
bool map[21][21];
bool walk[21][21];
int max(int a,int b)
{
    if(a>b) return a;
    return b;
}
struct Node {
    int x,y,deep;
}q[100000];
int bfs(int x,int y)
{
    memset(walk,0,sizeof(walk));
    q[1].x=x,q[1].y=y,q[1].deep=0;
    walk[x][y]=1;
    int l=1,r=1;
    while(l<=r)
    {
        for(int i=0;i<4;++i)
        {
            int tx=q[l].x+wx[i],ty=q[l].y+wy[i];
            if(map[tx][ty]==1||walk[tx][ty]==1||tx<=0||ty<=0||tx>n||ty>m) continue;
            q[++r].x=tx,q[r].y=ty;
            q[r].deep=q[l].deep+1;
            walk[tx][ty]=1;
        }
        ++l;
    }
   
    return q[r].deep;
}
int main()
{
    scanf("%d%d",&n,&m);
    char ch;
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=m;++j)
        {
            cin>>ch;
            if(ch=='#') map[i][j]=1;
        }
    }
    int ans=0;
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=m;++j)
        {
            if(map[i][j]==0) ans=max(ans,bfs(i,j));
        }
    }
    printf("%d",ans);
}

Compiler output:
a.cc: In function 'int bfs(int, int)':
a.cc:34:16: error: reference to 'map' is ambiguous
   34 |             if(map[tx][ty]==1||walk[tx][ty]==1||tx<=0||ty<=0||tx>n||ty>m) continue;
      |                ^~~
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:13:6: note:                 'bool map [21][21]'
   13 | bool map[21][21];
      |      ^~~
a.cc: In function 'int main()':
a.cc:53:25: error: reference to 'map' is ambiguous
   53 |             if(ch=='#') map[i][j]=1;
      |                         ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:13:6: note:                 'bool map [21][21]'
   13 | bool map[21][21];
      |      ^~~
a.cc:61:16: error: reference to 'map' is ambiguous
   61 |             if(map[i][j]==0) ans=max(ans,bfs(i,j));
      |                ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:13:6: note:                 'bool map [21][21]'
   13 | bool map[21][21];
      |      ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define N 100005
constexpr ll inf = 100000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
int h,w;
vector<string> s;
vector<vector<int>> maze;
bool check(int mid){

  return false;
}

ll serch(ll ok,ll ng) {
	while (abs(ok-ng) > 1) {
		ll mid = (ok + ng) / 2;
		if (check(mid))ok = mid;
		else ng = mid;
	}
	return ok;
}
int bfs(int x,int y){
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      maze[i][j]=0;
    }
  }
  int ma;
  s[x][y]='#';
  queue<P> q;
  q.push(make_pair(x,y));
  while(!q.empty()){
  for(int i=0;i<4;i++){
    auto nq=q.front();q.pop;
    int nx=x+di[i];
    int ny=y+dj[i];
    if(0<=nx&&nx<h&&0<=ny&&ny<w&&s[nx][ny]=='.'){
      q.push(make_pair(nx,ny));
      maze[nx][ny]=maze[x][y]+1;
    }
  }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      ma=max(ma,maze[i][j]);
    }
  }
  return ma;
}

int main(){
  cin>>h>>w;
  s.resize(h);
  maze.resize(h);
  for (int i = 0; i < h; i++){
      cin>>s[i];
      maze[i].resize(w);
      for(int j=0;j<w;j++){
         maze[i][j]=0;
      }
  }
  int ans=0;
  for (int i = 0; i < h; i++){
      for(int j=0;j<w;j++){
         if(s[i][j]!='#'){
           ans=max(ans,bfs(i,j));
         }
      }
  }
  cout<<ans<<endl;
}



Compiler output:
a.cc: In function 'int bfs(int, int)':
a.cc:42:25: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >]'
   42 |     auto nq=q.front();q.pop;
      |                       ~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:316:7: note: declared here
  316 |       pop()
      |       ^~~
Language: C++

// bfs

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

vector<string> field;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

// int true_max = 0;
int tmp_max = 0;

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

  field.resize(h);
  for(int i = 0; i < h; ++i)cin >> field[i];

  int is_wall[h][w];
  for(int i = 0; i < h; ++i){
    for(int j = 0; j < w; ++j){
      is_wall[h][w] = 0;
    }
  }

  for(int i = 0; i < h; ++i){
    for(int j = 0; j < w; ++j){
      if(field[i][j] == '#')is_wall[i][j] = 1
    }
  }

  for(int i = 1; i <= h; ++i){
    for(int j = 1; j <= w; ++j){
      if(is_wall[i][j])continue;

      int sy, sx;
      sy = i;
      sx = j;

      vector<vector<int>> dist(h, vector<int>(w, -1)); // init
      queue<pair<int, int>> que;

      dist[sy - 1][sx - 1] = 0;
      que.push(make_pair(sx - 1, sy - 1));

      while(!que.empty()){
        pair<int, int> v = que.front();
        que.pop();

        for(int i = 0; i < 4; ++i){
          int nx = v.first + dx[i];
          int ny = v.second + dy[i];

          if(ny < 0 || ny >= h || nx < 0 || nx >= w)continue;
          if(field[ny][nx] == '#')continue;

          if(dist[ny][nx] != -1)continue;

          dist[ny][nx] = dist[v.second][v.first] + 1;
          que.push(make_pair(nx, ny));
        }
      }

      for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
          tmp_max = max(tmp_max, dist[i][j]);
        }
      }
    }
  }

  cout << tmp_max << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:46: error: expected ';' before '}' token
   31 |       if(field[i][j] == '#')is_wall[i][j] = 1
      |                                              ^
      |                                              ;
   32 |     }
      |     ~
Language: C++

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

#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define sl1(a)  scanf("%lld",&a)
#define sl2(a,b)  scanf("%lld %lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld %lld %lld",&a,&b,&c)
#define PI 3.1415926535897932

int main(){
    int mod=1000000007;
    int h,w,ans=1;
    sc2(h,w);
    int d[h][w];
    rep(i,h) rep(j,w) d[i][j]=0; // (0,".")  (1,"#")
    rep(i,h) rep(j,w) {
        char s[w];
        scanf("%s",s);
        rep(k,w) if (s[k]=='#') d[i][k]=1;
    }
    int p[h*w][h*w];
    rep(i,h*w) rep(j,w*h) p[i][j]=1000; 

    rep(i,h*w) rep(j,h*w) rep(k,h*w) {
        int ih=i/w,iw=i%w, jh=j/w,jw=j%w, kh=k/w,kw=k%w;
            if ("."==d[ih][iw]==d[jh][jw] and ih==jh and abs(iw-jw)==1) p[i][j]=1; p[j][i]=1;
            if ("."==d[ih][iw]==d[jh][jw] and iw==jw and abs(ih-jh)==1) p[i][j]=1; p[j][i]=1;
            if ("."==d[ih][iw]==d[kh][kw] and ih==kh and abs(iw-kw)==1) p[i][k]=1; p[k][i]=1;
            if ("."==d[ih][iw]==d[kh][kw] and iw==kw and abs(ih-kh)==1) p[i][k]=1; p[k][i]=1;
            if ("."==d[jh][jw]==d[kh][kw] and jh==kh and abs(jw-kw)==1) p[j][k]=1; p[k][j]=1;
            if ("."==d[jh][jw]==d[kh][kw] and jw==kw and abs(jh-kh)==1) p[j][k]=1; p[k][j]=1;
            p[j][k]=min(p[j][k],p[j][i]+p[i][k]);
    }
    rep(i,h*w) rep(j,w*h) if (p[i][h]!=1000) ans=max(ans,p[i][h]);

    printf("%d\n",ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   30 |             if ("."==d[ih][iw]==d[jh][jw] and ih==jh and abs(iw-jw)==1) p[i][j]=1; p[j][i]=1;
      |                 ~~~^~~~~~~~~~~
a.cc:31:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   31 |             if ("."==d[ih][iw]==d[jh][jw] and iw==jw and abs(ih-jh)==1) p[i][j]=1; p[j][i]=1;
      |                 ~~~^~~~~~~~~~~
a.cc:32:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   32 |             if ("."==d[ih][iw]==d[kh][kw] and ih==kh and abs(iw-kw)==1) p[i][k]=1; p[k][i]=1;
      |                 ~~~^~~~~~~~~~~
a.cc:33:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   33 |             if ("."==d[ih][iw]==d[kh][kw] and iw==kw and abs(ih-kh)==1) p[i][k]=1; p[k][i]=1;
      |                 ~~~^~~~~~~~~~~
a.cc:34:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |             if ("."==d[jh][jw]==d[kh][kw] and jh==kh and abs(jw-kw)==1) p[j][k]=1; p[k][j]=1;
      |                 ~~~^~~~~~~~~~~
a.cc:35:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   35 |             if ("."==d[jh][jw]==d[kh][kw] and jw==kw and abs(jh-kh)==1) p[j][k]=1; p[k][j]=1;
      |                 ~~~^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;
const ll LMAX=1000000000000001;

int h,w;
vector<string> s;

solv(int x,int y,vector<vector<int>> &a){
  vector<int> dx={-1,0,1,0};
  vector<int> dy={0,1,0,-1};
  queue<int> X;
  queue<int> Y;
  vector<vector<bool>> memo(h,vector<bool>(w,0));
  X.push(x);Y.push(y);
  memo[x][y]=1;
  while(!(X.empty())){
    int Xz=X.front();
    int Yz=Y.front();
    rep(i,4){
      int xz=Xz+dx[i];int yz=Yz+dy[i];
      if(xz<0||xz>=h||yz<0||yz>=w) continue;
      if(s[xz][yz]=='#'||memo[xz][yz]) continue;
      a[xz][yz]=a[Xz][Yz]+1;
      X.push(xz);Y.push(yz);
      memo[xz][yz]=1;
    }
    X.pop();Y.pop();
  }
}

int main(){
  cin>>h>>w;
  rep(i,h){
    string S; cin>>S;
    s.pb(S);
  }

  int m=0;
  rep(i,h){
    rep(j,w){
      if(s[i][j]=='#') continue;
      vector<vector<int>> a(h,vector<int>(w,0));
      solv(i,j,a);
      rep(k,h){
        rep(l,w){
          m=max(m,a[k][l]);
        }
      }
    }
  }
  cout<<m<<endl;


  return 0;
}


Compiler output:
a.cc:21:1: error: ISO C++ forbids declaration of 'solv' with no type [-fpermissive]
   21 | solv(int x,int y,vector<vector<int>> &a){
      | ^~~~
a.cc: In function 'int solv(int, int, std::vector<std::vector<int> >&)':
a.cc:42:1: warning: no return statement in function returning non-void [-Wreturn-type]
   42 | }
      | ^
Language: C++

#include <queue>
#include <bits/stdc++.h>
using namespace std;
char map[25][25];
int mov[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
int vis[25][25] = {0}, d[25][25];
int n, m;
struct node
{
	int x, y;
}now, tmp;
int solve(int x, int y)
{
	queue <struct node> q;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		{
			vis[i][j] = 0; d[i][j] = 1e9;
		}
	d[x][y] = 0;
	vis[x][y] = 1;
	now.x = x; now.y = y;
	q.push(now);
	while(!q.empty())
	{
		now = q.front(); q.pop();
		for(int i = 0; i < 4; i++)
		{
			tmp.x = now.x + mov[i][0];
			tmp.y = now.y + mov[i][1];
			if(tmp.x<=0||tmp.x>n||tmp.y<=0||tmp.y>m) continue;
			if(map[tmp.x][tmp.y]=='#') continue;
			if(vis[tmp.x][tmp.y]) continue;
			d[tmp.x][tmp.y] = 1 + d[now.x][now.y];
			vis[tmp.x][tmp.y] = 1;
			q.push(tmp);
		}
	}
	int res = 0;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		{
			if(vis[i][j] && res < d[i][j]) res = d[i][j];
		}
	return res;
}
int main()
{
	int res = 0;
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++)
		scanf("%s", map[i]+1);
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++)
		if(map[i][j]=='.')
		{
			res = max(res, solve(i, j));
		}
	printf("%d\n", res);
}

Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:32:28: error: reference to 'map' is ambiguous
   32 |                         if(map[tmp.x][tmp.y]=='#') continue;
      |                            ^~~
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:4:6: note:                 'char map [25][25]'
    4 | char map[25][25];
      |      ^~~
a.cc: In function 'int main()':
a.cc:52:29: error: reference to 'map' is ambiguous
   52 |                 scanf("%s", map[i]+1);
      |                             ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:4:6: note:                 'char map [25][25]'
    4 | char map[25][25];
      |      ^~~
a.cc:55:20: error: reference to 'map' is ambiguous
   55 |                 if(map[i][j]=='.')
      |                    ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:4:6: note:                 'char map [25][25]'
    4 | char map[25][25];
      |      ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    ll n,m;
    ll ma=0,x,y;
    cin>>n>>m;
    vector<vector<bool>> v(n,vector<bool>(m,false));
    vector<vector<bool>> u(n,vector<bool>(m,false));
    vector<vector<bool>> u2(n,vector<bool>(m,false));
    rep(i,n){
        string c;cin>>c;
        rep(j,m)if(c[j]=='.')v[i][j]=true;
    }
    queue<PP> q;
    rep(i,n)rep(j,m){
        q.push(PP(i,j,0));
        while(!q.empty()){
        auto p=q.front();q.pop();
        ll i=get<0>(p),j=get<1>(p),d=get<2>(p);
        u[i][j]=true;
        chmax(ma,d);
        if(i+1<n)if(!u[i+1][j]&&v[i+1][j]){
            u[i+1][j]=true;
            q.push(PP(i+1,j,d+1));
        }
        if(i-1>=0)if(!u[i-1][j]&&v[i-1][j]){
            u[i-1][j]=true;
            q.push(PP(i-1,j,d+1));
        }
        if(j+1<m)if(!u[i][j+1]&&v[i][j+1]){
            u[i][j+1]=true;
            q.push(PP(i,j+1,d+1));
        }
        if(j-1>=0)if(!u[i][j-1]&&v[i][j-1]){
            u[i][j-1]=true;
            q.push(PP(i,j-1,d+1));
        }
    }
    out(ma);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:2: error: expected '}' at end of input
   69 | }
      |  ^
a.cc:32:11: note: to match this '{'
   32 | int main(){
      |           ^
Language: C++

#include <queue>
using namespace std;
char map[25][25];
int mov[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
int vis[25][25] = {0}, d[25][25];
int n, m;
struct node
{
	int x, y;
}now, tmp;
int solve(int x, int y)
{
	queue <struct node> q;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		{
			vis[i][j] = 0; d[i][j] = 1e9;
		}
	d[x][y] = 0;
	vis[x][y] = 1;
	now.x = x; now.y = y;
	q.push(now);
	while(!q.empty())
	{
		now = q.front(); q.pop();
		for(int i = 0; i < 4; i++)
		{
			tmp.x = now.x + mov[i][0];
			tmp.y = now.y + mov[i][1];
			if(tmp.x<=0||tmp.x>n||tmp.y<=0||tmp.y>m) continue;
			if(map[tmp.x][tmp.y]=='#') continue;
			if(vis[tmp.x][tmp.y]) continue;
			d[tmp.x][tmp.y] = 1 + d[now.x][now.y];
			vis[tmp.x][tmp.y] = 1;
			q.push(tmp);
		}
	}
	int res = 0;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		{
			if(vis[i][j] && res < d[i][j]) res = d[i][j];
		}
	return res;
}
int main()
{
	int res = 0;
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++)
		scanf("%s", map[i]+1);
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++)
		if(map[i][j]=='.')
		{
			res = max(res, solve(i, j));
		}
	printf("%d\n", res);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:9: error: 'scanf' was not declared in this scope
   49 |         scanf("%d %d", &n, &m);
      |         ^~~~~
a.cc:58:9: error: 'printf' was not declared in this scope
   58 |         printf("%d\n", res);
      |         ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include <queue>
  +++ |+#include <cstdio>
    2 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }

int R, C;
char c[21][21];
int ans[21][21];

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

int main(){
	cin >> R >> C;
	for(int i = 0; i < R; ++i){
		for(int j = 0; j < C; ++j){
			cin >> c[i][j];
		}
	}
  int tmp=-1;
	rep(sx,C){
    int ans[21][21];
    queue< pair<int, int> > q;
    memset(ans,0,sizeof(ans));
    rep(sy,R){
      rep(gx,C){
        rep(gy,R){
          q.push(make_pair(sy, sx));
        	ans[sy][sx] = 0;
        	while(!q.empty()){
        		pair<int, int> pos = q.front();
        		q.pop();
        		for(int i = 0; i < 4; ++i){
        			int nowy = pos.first + dy[i], nowx = pos.second + dx[i];
        			if(ans[nowy][nowx] != 0) continue;
        			if(0 <= nowx && nowx < C && 0 <= nowy && nowy < R){
        				if(c[nowy][nowx] == '.'){
        					ans[nowy][nowx] = ans[pos.first][pos.second] + 1;
        					q.push(make_pair(nowy, nowx));
        				}
        			}
        		}
        	}
        	
        }
        chmax(tmp,ans[gy][gx]);
      }
    }
  }
  cout << tmp << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:23: error: 'gy' was not declared in this scope; did you mean 'gx'?
   56 |         chmax(tmp,ans[gy][gx]);
      |                       ^~
      |                       gx
Language: C++

#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

int convert(int i, int j, int w) {
	return i*w+j;
}

std::pair<int,int> deconv(int i, int w) {
	std::pair<int,int> ret;
	ret.first=i/w;
	ret.second=i%w;
	return ret;
}

signed main() {
	int h,w;
	std::cin >> h >> w;
	std::vector<std::string> g(h);
	rep(i,h) std::cin >> g[i];
	std::vector<std::vector<int> > dist(h*w,std::vector<int>(h*w,INF));
	int max = 0;

	rep(i,h) {
		rep(j,w) {
			if(g[i][j]=='.') {
				// bfs
				std::queue<std::pair<int,int> > que; // i, dist
				std::vector<int> went(h*w,false);
				que.emplace(convert(i,j,w),0);
				went[convert(i,j,w)]=true;
				while(!que.empty()) {
					auto tp = que.front(); que.pop();
					int xx = tp.first;
					int x = deconv(xx,w).first;
					int y = deconv(xx,w).second;
					int d = tp.second;
					max = std::max(d,max);
					for(int dx=-1;dx<=1;dx++) {
						for(int dy=-1;dy<=1;dy++) {
							if(dx*dy==0) {
								if(dx==0 && dy==0) continue;
								if(x+dx<0 || x+dx>=h) continue;
								if(y+dy<0 || y+dy>=w) continue;
								if(g[x+dx][y+dy]=='#') continue;
								if(went[convert(x+dx,y+dy,w)]) continue;
								went[convert(x+dx,y+dy,w)]=true;
								que.emplace(convert(x+dx,y+dy,w),d+1);
							}
						}
					}
				}
			}
		}
	}
	print(max);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:70: error: 'INF' was not declared in this scope
   44 |         std::vector<std::vector<int> > dist(h*w,std::vector<int>(h*w,INF));
      |                                                                      ^~~
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define req(i, j, n) for(int i = j; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int h,w;
  char grid[25][25];
 int b[405][25][25];
int sx,sy;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int bfs(int t){
  queue<P> que;
  que.push_back(P(sx, sy));
  b[t][sx][sy]=0;
  while(que.size()){
    P p=que.front();
    que.pop();
    int nx=p.first;
    int ny=p.second;
for(int i=0;i<=3;i++){
  int nex=dx[i];
  int ney=dy[i];
  if(b[t][nx+nex][ny+ney]==-1 && grid[t][nx+nex][ny+ney]!='#'){
    que.push(P(nx+nex, ny+ney));
    b[t][nx+nex][ny+ney]=b[t][nx][ny]+1;
  }
}
  }
  return 0;}


int main() {

  cin>>h>>w;

  
    for(int i=0;i<=h+1;i++){
    for(int j=0;j<=w+1;j++){
      grid[i][j]='#';
    }
  }
  
  
  
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      cin>>grid[i][j];
    }
  }
  
 
  for(int i=1;i<=h*w;i++){
    for(int j=0;j<=h+1;j++){
      for(int k=0;k<=w+1;k++){
        b[i][j][k]=-1;
      }
    }
  }
  
  int ans=0;
  int time=0;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      time++;
      bfs(time)();
  for(int k=1;k<=h;k++){
    for(int l=1;l<=w;l++){
         ans=max(ans,b[t][k][l]);
    }
  }
    }
  }
  
  cout<<ans<<endl;
  
  
  

}


Compiler output:
a.cc: In function 'int bfs(int)':
a.cc:20:7: error: 'class std::queue<std::pair<int, int> >' has no member named 'push_back'
   20 |   que.push_back(P(sx, sy));
      |       ^~~~~~~~~
a.cc:30:49: error: invalid types 'char[int]' for array subscript
   30 |   if(b[t][nx+nex][ny+ney]==-1 && grid[t][nx+nex][ny+ney]!='#'){
      |                                                 ^
a.cc: In function 'int main()':
a.cc:72:16: error: expression cannot be used as a function
   72 |       bfs(time)();
      |       ~~~~~~~~~^~
a.cc:75:24: error: 't' was not declared in this scope
   75 |          ans=max(ans,b[t][k][l]);
      |                        ^
Language: C++

#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;

int dp[20][20][20][20];
int main(void) {
  auto start = chrono::system_clock::now();
  int  h, w;
  cin >> h >> w;
  vector<vector<bool>> s(h, vector<bool>(w));
  rep (i, h) {
    rep (j, w) {
      char c;
      cin >> c;
      s[i][j] = c == '.';
    }
  }
  rep (a, h) rep (b, w) rep (c, h) rep (d, w) dp[a][b][c][d] = -1;
  struct Point { int x, y, cnt; };
  vector<pair<int, int>> dv{{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
  int maxi = 0;
  rep (i, h) {
    rep (j, w) {
      if (!s[i][j]) continue;
      queue<Point> que;
      que.push({j, i, 0});
      while (!que.empty()) {
        int x = que.front().x, y = que.front().y, cnt = que.front().cnt;
        que.pop();
        dp[i][j][y][x] = cnt;
        maxi = max(maxi, cnt);
        allrep (d, dv) {
          int nx = x + d.first, ny = y + d.second;
          if (nx < 0 || nx >= w || ny < 0 || ny >= h) continue;
          if (!s[ny][nx]) continue;
          if (dp[i][j][ny][nx] == -1) que.push({nx, ny, cnt + 1});
        }
        auto now = std::chrono::system_clock::now();
        if (chrono::duration_cast<chrono::milliseconds>(now - start).count() > 1000) {
          cout << 38 << endl;
          return;
        }
      }
    }
  }
  cout << maxi << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:11: error: return-statement with no value, in function returning 'int' [-fpermissive]
   58 |           return;
      |           ^~~~~~
Language: C++

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

int N, M;

typedef vector<vector<char>> Map;
Map map;

struct Point{
    int i, j;
};

int bfs(Point& s, Point& t) {
    queue<pair<Point, int>> que;

    vector<vector<bool>> visited(N+2, vector<bool>(M+2));
    que.push(make_pair(s, 0));
    visited[s.i][s.j] = true; 

    while(!que.empty()) {
        auto item = que.front();
        que.pop();
        Point& p = item.first;
        for (int dir = 0 ; dir < 4; dir++) {
            int x = p.i+"0211"[dir]-'1';
            int y = p.j+"1120"[dir]-'1';
            if (x == t.i && y == t.j)
                return item.second+1;
            else if (map[x][y] == '.' && !visited[x][y]){
                visited[x][y] = true;
                que.push(make_pair(Point{x,y}, item.second+1));
            }

        }
    }
    return INT_MAX;
}

int main(){

    cin >> N >> M;

    map = Map(N+2, vector<char>(M+2, '#'));

    for (int i = 1; i <= N; i++)
        for (int j = 1; j <= M; j++) {
            cin >> map[i][j];
        }

    int maximum = INT_MIN;
    for (int i = 1; i <= N; i++)
        for (int j = 1; j <= M; j++)
            for (int i2 = 1; i2 <= N; i2++)
                for (int j2 = 1; j2 <= M; j2++) {
                    
                    if ((i != i2 || j != j2) && map[i][j] == '.' && map[i2][j2] == '.'){
                        Point s{i, j};
                        Point t{i2, j2};
                        
                        maximum = max(maximum, bfs(s, t));
                    }
                }

    cout << maximum << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int bfs(Point&, Point&)':
a.cc:38:12: error: 'INT_MAX' was not declared in this scope
   38 |     return INT_MAX;
      |            ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <queue>
  +++ |+#include <climits>
    4 | using namespace std;
a.cc: In function 'int main()':
a.cc:52:19: error: 'INT_MIN' was not declared in this scope
   52 |     int maximum = INT_MIN;
      |                   ^~~~~~~
a.cc:52:19: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <string>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>

using namespace std;

int main()
{
    int H, W;
    cin >> H >> W;
    
    vector<vector<char>> maze(H+2, vector<char>(W+2, '#'));
    
    
    for(int y = 1; y <= H; ++y){
        for(int x = 1; x <= W; ++x){
            cin >> maze[y][x];            
        }
    }
    /*
    for(const auto& row : maze){
        for(char c : row){
            cout << c;
        }
        cout << '\n';
    }
    */
    
    vector<vector<vector<vector<int>>>> graph(H, vector<vector<vector<int>>>(W, vector<vector<int>>(H, vector<int>(W, INT_MAX/4))));
    
    auto connect = [&](int x, int y, int x2, int y2)
    {
        graph[y2-1][x2-1][y-1][x-1] = 1;
        graph[y-1][x-1][y2-1][x2-1] = 1;
    };
    
    for(int y = 1; y <= H; ++y){
        for(int x = 1; x <= W; ++x){
            graph[y-1][x-1][y-1][x-1] = 0;
            if(maze[y][x] == '.'){
                if(maze[y][x-1] == '.') connect(x, y, x-1, y);
                if(maze[y][x+1] == '.') connect(x, y, x+1, y);
                if(maze[y-1][x] == '.') connect(x, y, x, y-1);
                if(maze[y+1][x] == '.') connect(x, y, x, y+1);
            }
        }
    }
    
    for(int y = 0; y < H; ++y){
        for(int x = 0; x < W; ++x){
            for(int y2 = 0; y2 < H; ++y2){
                for(int x2 = 0; x2 < W; ++x2){
                    for(int y3 = 0; y3 < H; ++y3){
                        for(int x3 = 0; x3 < W; ++x3){
                            graph[y][x][y3][x3] = graph[y3][x3][y][x] = min(graph[y][x][y3][x3], graph[y][x][y2][x2] + graph[y2][x2][y3][x3]);
                        }
                    }
                }
            }
        }
    }
    
    int maxpath = 0;
    for(int y = 0; y < H; ++y){
        for(int x = 0; x < W; ++x){
            for(int y2 = 0; y2 < H; ++y2){
                for(int x2 = 0; x2 < W; ++x2){
                    int p = graph[y][x][y2][x2];
                    //cout << p << '\n';
                    if(p != INT_MAX/4)
                        maxpath = max(p, maxpath);
                }
            }
        }
    }
    cout << maxpath << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:119: error: 'INT_MAX' was not declared in this scope
   32 |     vector<vector<vector<vector<int>>>> graph(H, vector<vector<vector<int>>>(W, vector<vector<int>>(H, vector<int>(W, INT_MAX/4))));
      |                                                                                                                       ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <map>
  +++ |+#include <climits>
    7 |
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};

int dist[21][21];
int H, W;
char S[21][21];
int res;

void clean(){
  rep(i,H){
    rep(j,W){
      dist[i][j]=INF;
    }
  }
  return;
}

int bfs(int xs,int ys, int xg, int yg){
  queue<P> que;
  clean();
  que.push(P(ys,xs));
  dist[ys][xs]=0;

  while(que.size()){
    P p = que.front(); que.pop();
    int x0 = p.second; int y0 = p.first;
    if(y0==yg && x0==xg) break;

    rep(i,4){
      int x = x0 + dx[i]; int y = y0 + dy[i];
      if(0<=x && x <= W-1 && 0<=y && y<=H-1){
        if(S[y][x]=='.' && dist[y][x]==INF) {
          que.push(P(y,x));
          dist[y][x] = dist[y0][x0]+1;
        }
      }
    }
  }
  return dist[yg][xg];
}

int main()
{
  cin >> H >> W;

  rep(i,H) cin >> S[i];

  res=0;
  rep(sy,H){
    rep(sx,W){
      if(S[sy][sx] == "#") continue;
      rep(gy, H){
        rep(gx, W){
          if(S[gy][gx] == "#") continue;
          clean();
          int num = bfs(sx,sy,gx,gy);
          if(num < INF) res = max(res, num);
          //printf("s(%d, %d) g(%d, %d): %d\n", sx, sy, gx, gy, num);           
          //print();                                                            
        }
      }
    }
  }

  cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   58 |       if(S[sy][sx] == "#") continue;
      |          ~~~~~~~~~~^~~~~~
a.cc:61:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   61 |           if(S[gy][gx] == "#") continue;
      |              ~~~~~~~~~~^~~~~~