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

#include<bits/stdc++.h>
using namespace std;
#define MM 1e9
#define Pair pair<int,int>

int H,W;
char a[1001][1001];
int dist[1001][1001];
queue<Pair> que;

void init(){
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			dist[i][j] = MM; // initialize
		}
	}
}

void bfs(){
	while(que.size()){
		Pair p = que.front();
		que.pop();
		int h = p.first;
		int w = p.second;
		if(h+1 < H && dist[h+1][w] == MM){
			dist[h+1][w] = dist[h][w]+1;
			que.push(Pair(h+1,w));
		}
		if(w+1 < W && dist[h][w+1] == MM){
			dist[h][w+1] = dist[h][w]+1;
			que.push(Pair(h,w+1));
		}
		if(h >= 1 && dist[h-1][w] == MM){
			dist[h-1][w] = dist[h][w]+1;
			que.push(Pair(h-1,w));
		}
		if(w >= 1 && dist[h][w+1] == MM){
			dist[h][w-1] = dist[h][w]+1;
			que.push(Pair(h,w-1));
		}
	}
}

void input(){
	cin >> H >> W; 
	init();
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> a[i][j];
			if(a[i][j] == '#' && dist[i][j] == MM){
				dist[i][j] = 0;
				que.push(Pair(i,j));
			}
		}
	}
}

void check(){
	int mx = 0;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			mx = max(mx,dist[i][j];
		}
	}
	cout << mx << endl;
}

int main(){
	input();
	bfs();
	check();
}


Compiler output:
a.cc: In function 'void check()':
a.cc:62:47: error: expected ')' before ';' token
   62 |                         mx = max(mx,dist[i][j];
      |                                 ~             ^
      |                                               )
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <utility>
using namespace std;
int check(vector<string> v,int n,int m);
int main(){
	int n,m,count;
	cin>>n>>m;
	count=0;
	vector<string> v;
	vector<string> v_next;
	vector<pair<int,int> > point;
	pair<int,int> tmp_pair;
	for(int i=0;i<n; i++){
	  string tmp;
	  cin>>tmp;
	  v.push_back(tmp);
	}
	for(int i=0;i<n;i++){
  	  for(int j=0;j<m;j++){
        if(v.at(i)[j]=='#'){
          tmp_pair.first=i;
          tmp_pair.second=j;
          point.push_back(tmp_pair);
        }
  	  }
    }
	while(1){
	  v_next=v;
	  if(check(v_next,n,m)==0){
	  	break;
	  }
	  int tmp_size=point.size();
	  for(int k=0;k<tmp_size;k++){
	  	int num1,num2;
	  	num1=point.at(k).first;
	  	num2=point.at(k).second;
	  	point.erase(point.begin());
	  	point.
	  	if(0<num1){
	  	  v_next.at(num1-1)[num2]='#';
	  	  tmp_pair.first=num1-1;
	  	  tmp_pair.second=num2;
	  	  point.push_back(tmp_pair);
	  	}
	  	if(num1<n-1){
	  	  v_next.at(num1+1)[num2]='#';
	  	  tmp_pair.first=num1+1;
	  	  tmp_pair.second=num2;
	  	  point.push_back(tmp_pair);
	  	}
	  	if(num2<m-1){
	  	  v_next.at(num1)[num2+1]='#';
	  	  tmp_pair.first=num1;
	  	  tmp_pair.second=num2+1;
	  	  point.push_back(tmp_pair);
	  	}
	  	if(0<num2){
	  	  v_next.at(num1)[num2-1]='#';
	  	  tmp_pair.first=num1;
	  	  tmp_pair.second=num2-1;
	  	  point.push_back(tmp_pair);
	  	}
	  }
	  count++;
	  if(check(v_next,n,m)==0){
	  	break;
	  }
	  v=v_next;
    }
    cout <<count<<endl;
}


int check(vector<string> v,int n,int m){
  for(int i=0;i<n;i++){
  	for(int j=0;j<m;j++){
      if(v.at(i)[j]=='.'){
       return -1;
      }
  	}
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:17: error: expected unqualified-id before 'if'
   41 |                 if(0<num1){
      |                 ^~
Language: C++

#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;

int n,m,a[1005][1005],b[1005][1005],ans=0;
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
char c;

bool check(){
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
		if(a[i][j]==0)return 0;
	}
	return 1;
}

int main(void){
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++){
		cin>>c;
		if(c=='#')a[i][j]=1;
		else a[i][j]=0;
	}
	while(!check()){
		for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		b[i][j]=a[i][j];
		for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++){
			if(a[i][j]==1){
				int x,y;
				for(int k=0;k<4;k++){
					x=i+dx[k];
					y=j+dy[k];
					if(x>0&&y>0&&x<=n&&y<=m)
					b[x][y]=1;
				}
			}
		} 
		ans++;
	}
	printf("%d\n",ans);
}

Compiler output:
a.cc: In function 'bool check()':
a.cc:19:15: error: a function-definition is not allowed here before '{' token
   19 | int main(void){
      |               ^
a.cc:46:2: error: expected '}' at end of input
   46 | }
      |  ^
a.cc:11:13: note: to match this '{'
   11 | bool check(){
      |             ^
a.cc:46:2: warning: control reaches end of non-void function [-Wreturn-type]
   46 | }
      |  ^
Language: Java

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt(), W = sc.nextInt();
		int[][] A = new int[H][W];
		Queue Q = new Queue();
		for (int h = 0; h < H; h++) {
			String s = sc.next();
			for (int w = 0; w < W; w++) {
				int b = A[h][w] = s.charAt(w) == '#' ? 1 : 0;
				if (b == 1) Q.add(0, h, w);
			}
		}
		int ans = 0;
		while (!Q.isEmpty()) {
			Que q = Q.poll();
			ans = q.n;
			if (q.y > 0 && A[q.y - 1][q.x] == 0) A[q.y - 1][q.x] = Q.add(q.n+1,  q.y -1,  q.x);
			if (q.y < H - 1 && A[q.y + 1][q.x] == 0) A[q.y + 1][q.x] = Q.add(q.n + 1, q.y + 1, q.x);
            if (q.x > 0 &&     A[q.y][q.x - 1] == 0) A[q.y][q.x - 1] = Q.add(q.n + 1, q.y, q.x - 1);
            if (q.x < W - 1 && A[q.y][q.x + 1] == 0) A[q.y][q.x + 1] = Q.add(q.n + 1, q.y, q.x + 1);
		}
		System.out.println(ans);
		sc.close();
	}
}

class Que {
	int n, x, y;
	Que(int n, int y, int x) {
		this.n= n;
		this.x = x;
		this.y = y;
	}
}
class Queue {
	Deque<Que> Q;
	Queue() {
		Q = new ArrayDeque<>();
	}
	int add(int n, int y, int x) {
		Q.add(new Que(n, y, x));
		return n;
	}
	boolean isEmpty() { return Q.isEmpty(); }
	Que poll() { return Q.poll(); } // キューの先頭を取得および削除
}
understand

Compiler output:
Main.java:52: error: reached end of file while parsing
understand
^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;

int dist[1001][1001];

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

int main(){
  memset(dist, 2001, sizeof(dist));
  int H, W;cin>>H>>W;
  char A[H][W];
  queue<ii> que;

  for (int i=0;i<H;++i){
    for (int j=0;j<W;++j){
      cin>>A[i][j];
      if (A[i][j]=='#') {que.push({i,j});dist[i][j]=0;}
    }
  }

  while(!que.empty()){
    ii q=que.front();que.pop();
    int y=q.first, x=q.second;
    for (int k=0;k<4;++k){
      int ny=y+dy[k], nx=x+dx[k];
      if(nx>=0&&nx<W&&ny>=0&&ny<H){
        if (A[ny][nx]!='#'){qeu.push({ny, nx}); A[ny][nx]='#';}
        dist[ny][nx]=min(dist[ny][nx], dist[y][x]+1);
      }
    }
  }

  int ans=0;

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:28:29: error: 'qeu' was not declared in this scope; did you mean 'que'?
   28 |         if (A[ny][nx]!='#'){qeu.push({ny, nx}); A[ny][nx]='#';}
      |                             ^~~
      |                             que
Language: C++

#include <stdio.h>
#include <memory.h>
#include <malloc.h>
int main(int argc, char *argv[])
{
    int H, W;
    scanf("%d%d\n", &H, &W);
    //printf("%d, %d", H, W);

    int dp[H][W];
    char line[W + 3];
    for (int i = 0; i < H; i++)
    {
        fgets(line, sizeof(line), stdin);

        for (int j = 0; j < W; j++)
        {

            if (line[j] == '#')
            {
                dp[i][j] = 1;
            }
            else
            {
                dp[i][j] = 0;
            }
        }
    }

    int tt = 1;
    int cnt = 0;
    int(*sc)[W] = (int(*)[W])malloc(H * W * sizeof(int));
    while (1)
    {
        tt = 0;
        const int *dp_ptr = (int*)sc;
        const int *dpis_ptr = sc[-1];
        const int *dpie_ptr = sc[1];
        const int *dpjs_ptr = &sc[0][-1];
        const int *dpje_ptr = &sc[0][1];
        memcpy(sc, dp, H * W * sizeof(int));
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                const int v = *dp_ptr;
                if (!v && (i > 0 && *dpis_ptr || i < H - 1 && *dpie_ptr || j > 0 && *dpjs_ptr || j < W - 1 && *dpje_ptr))
                {
                    tt = 1;
                    *dp_ptr = 1;
                }
                dp_ptr++;
                dpis_ptr++;
                dpie_ptr++;
                dpjs_ptr++;
                dpje_ptr++;
            }
        }
        if (!tt)
        {
            break;
        }
        cnt++;
    }
    free(sc);
    printf("%d\n", cnt);
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:50:29: error: assignment of read-only location '* dp_ptr'
   50 |                     *dp_ptr = 1;
      |                     ~~~~~~~~^~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int GCD(int x,int y){
    return y ? GCD(y,x%y) : x;
}
int H,W;
int g[1001][1001];
int main(){
    int H,W; cin >> H >> W;
    fill(g[0],g[1001],MM);
    queue<Pair> que;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            char c;
            cin >> c;
            if(c == '#'){
                que.push(Pair(i,j));
                g[i][j] = 0;
            }
        }
    }
    while(!que.empty()){
        Pair p = que.front;
        que.pop();
        int h = p.first, w = p.second;
        if(h >= 1 && g[h-1][w] == MM){
            g[h-1][w] = g[h][w]+1;
            que.push(Pair(h-1,w));
        }
        if(w >= 1 && g[h][w-1] == MM){
            g[h][w-1] = g[h][w]+1;
            que.push(Pair(h,w-1));
        }
        if(h+1 < H && g[h+1][w] == MM){
            g[h+1][w] = g[h][w]+1;
            que.push(Pair(h+1,w));
        }
        if(w+1 < W && g[h][w+1] == MM){
            g[h][w+1] = g[h][w]+1;
            que.push(Pair(h,w+1));
        }
    }
    int ans = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            ans = max(ans,g[i][j]);
        }
    }
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:58:22: error: conversion from '<unresolved overloaded function type>' to non-scalar type 'std::pair<int, int>' requested
   58 |         Pair p = que.front;
      |                  ~~~~^~~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int GCD(int x,int y){
    return y ? GCD(y,x%y) : x;
}
int H,W;
int g[1001][1001];
int main(){
    int H,W; cin >> H >> W;
    fill(g[0],g[1001],MM);
    queue<Pair> que;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            char c;
            cin >> c;
            if(c == '#'){
                que.push(Pair(i,j));
                g[i][j] = 0;
            }
        }
    }
    while(!que.empty()){
        Pair p = que.front;
        q.pop();
        int h = p.first, w = p.second;
        if(h >= 1 && g[h-1][w] == MM){
            g[h-1][w] = g[h][w]+1;
            que.push(Pair(h-1,w));
        }
        if(w >= 1 && g[h][w-1] == MM){
            g[h][w-1] = g[h][w]+1;
            que.push(Pair(h,w-1));
        }
        if(h+1 < H && g[h+1][w] == MM){
            g[h+1][w] = g[h][w]+1;
            que.push(Pair(h+1,w));
        }
        if(w+1 < W && g[h][w+1] == MM){
            g[h][w+1] = g[h][w]+1;
            que.push(Pair(h,w+1));
        }
    }
    int ans = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            ans = max(ans,g[i][j]);
        }
    }
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:58:22: error: conversion from '<unresolved overloaded function type>' to non-scalar type 'std::pair<int, int>' requested
   58 |         Pair p = que.front;
      |                  ~~~~^~~~~
a.cc:59:9: error: 'q' was not declared in this scope
   59 |         q.pop();
      |         ^
Language: C++

#include <stdio.h>
#include <memory.h>
#include <malloc.h>
int main(int argc, char *argv[])
{
    int H, W;
    scanf("%d%d\n", &H, &W);
    //printf("%d, %d", H, W);

    int dp[H][W];
    char line[W + 3];
    for (int i = 0; i < H; i++)
    {
        fgets(line, sizeof(line), stdin);

        for (int j = 0; j < W; j++)
        {

            if (line[j] == '#')
            {
                dp[i][j] = 1;
            }
            else
            {
                dp[i][j] = 0;
            }
        }
    }

    int tt = 1;
    int cnt = 0;
    int(*sc)[W] = malloc(H * W * sizeof(int));
    while (1)
    {
        tt = 0;
        memcpy(sc, dp, H * W * sizeof(int));
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                int v = dp[i][j];
                int t = 0;
                if (!v && (i > 0 && sc[i - 1][j] || i < H - 1 && sc[i + 1][j] || j > 0 && sc[i][j - 1] || j < W - 1 && sc[i][j + 1]))
                {
                    tt = 1;
                    dp[i][j] = 1;
                }
            }
        }
        if (!tt)
        {
            break;
        }
        cnt++;
    }
    free(sc);
    printf("%d\n", cnt);
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:32:25: error: invalid conversion from 'void*' to 'int (*)[W]' [-fpermissive]
   32 |     int(*sc)[W] = malloc(H * W * sizeof(int));
      |                   ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                         |
      |                         void*
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
int n, m, dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
bool arr[1000][1000];
int dist[1000][1000];
queue<pair<int, int> > q;
int main()
{
  cin >> n >> m;
  for(int i = 0; i < n; i++) for(int j = 0; j < m; j++)
  {
    dist[i][j] = 0;
  	char c;
    cin >> c;
    if(c=='#')
    {
      arr[i][j] = 0;
      dist[i][j] = 0;
      q.push(make_pair(i, j));
    }
    else arr[i][j] = 1;
  }
  while(!q.empty())
  {
    // do bfs
    pair<int, int> p = q.top();
    q.pop();
    for(int i = 0; i < 4; i++)
    {
      int nx = p.first + dx[i], ny = p.second + dy[i];
      if(0 <= nx && nx < n && 0 <= ny && ny < m)
      {
      	if(arr[nx][ny])
        {
          arr[nx][ny]=0;
          dist[nx][ny] = dist[p.first][p.second] + 1;
          q.push(make_pair(nx, ny));
        }
      }
    }
  }
  int md = 0;
  for(int i = 0; i < n; i++) for(int j = 0; j < m; j++)
  {
    md = max(dist[i][j], md);
  }
  cout << md << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:26: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'?
   28 |     pair<int, int> p = q.top();
      |                          ^~~
      |                          pop
Language: C++

#include <bits/stdc++.h>

using namespace std;

int n, m, dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
bool arr[1000][1000];
int dist[1000][1000];
queue<pair<int, int> > q;
int main()
{
  cin >> n >> m;
  for(int i = 0; i < n; i++) for(int j = 0; j < m; j++)
  {
    dist[i][j] = 0;
  	char c;
    cin >> c;
    if(c=='#')
    {
      arr[i][j] = 0;
      dist[i][j] = 0;
      q.push(make_pair(i, j));
    }
    else arr[i][j] = 1;
  }
  while(!q.empty())
  {
    // do bfs
    pair<int, int> p = q.top();
    q.pop();
    for(int i = 0; i < 4; i++)
    {
      int nx = p.first + dx[i], ny = p.second + dy[i];
      if(0 <= nx && nx < n && 0 <= ny && ny < m)
      {
      	if(arr[nx][ny])
        {
          arr[nx][ny]=0;
          dist[nx][ny] = dist[x][y] + 1;
          q.push(make_pair(nx, ny));
        }
      }
    }
  }
  int md = 0;
  for(int i = 0; i < n; i++) for(int j = 0; j < m; j++)
  {
    md = max(dist[i][j], md);
  }
  cout << md << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:26: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'?
   28 |     pair<int, int> p = q.top();
      |                          ^~~
      |                          pop
a.cc:38:31: error: 'x' was not declared in this scope; did you mean 'nx'?
   38 |           dist[nx][ny] = dist[x][y] + 1;
      |                               ^
      |                               nx
a.cc:38:34: error: 'y' was not declared in this scope; did you mean 'ny'?
   38 |           dist[nx][ny] = dist[x][y] + 1;
      |                                  ^
      |                                  ny
Language: Java

import java.util.*;
public class AGC033_c {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt(), W = sc.nextInt();
        int[][] A = new int[H][W];
        Queue Q = new Queue();
        for (int h = 0; h < H; h++) {
            String s = sc.next();
            for (int w = 0; w < W; w++) {
                int b = A[h][w] = s.charAt(w) == '#' ? 1 : 0;
                if (b == 1) Q.add(0, h, w);
            }
        }
        int ans = 0;
        while (!Q.isEmpty()) {
            Que q = Q.poll();
            ans = q.n;
            if (q.y > 0 &&     A[q.y - 1][q.x] == 0) A[q.y - 1][q.x] = Q.add(q.n + 1, q.y - 1, q.x);
            if (q.y < H - 1 && A[q.y + 1][q.x] == 0) A[q.y + 1][q.x] = Q.add(q.n + 1, q.y + 1, q.x);
            if (q.x > 0 &&     A[q.y][q.x - 1] == 0) A[q.y][q.x - 1] = Q.add(q.n + 1, q.y, q.x - 1);
            if (q.x < W - 1 && A[q.y][q.x + 1] == 0) A[q.y][q.x + 1] = Q.add(q.n + 1, q.y, q.x + 1);
        }
        System.out.println(ans);
        sc.close();
    }
}
class Que {
    int n, x, y;
    Que(int n, int x, int y) {
        this.n = n;
        this.x = x;
        this.y = y;
    }
}
class Queue {
    Deque<Que> Q;
    Queue() {
        Q = new ArrayDeque<>();
    }
    int add(int n, int y, int x) {
        Q.add(new Que(n, y, x));
        return n;
    }
    boolean isEmpty() { return Q.isEmpty(); }
    Que poll() { return Q.poll(); }
}


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

from collections import deque

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int, ss_raw()))

INF = 1<<29

def main():
    H,W = ints_raw()
    DFST = [[-1 for i in range(W)]for i in range(H)]
    qu = deque()
    dirs = [[1,0,1],[0,1,1],[-1,0,1],[0,-1,1]]
    ans = 0
    for h in range(H):
        S = input()
        for w in range(W):
            if S[w]=="#":
                DFST[h][w]=0
                qu.append([h,w,0])
    while len(qu)!=0:
        cpos = qu.popleft()
        for dir in dirs:
            
            ny,nx,nt = [cpos[0]+dir[0],cpos[1]+dir[1],cpos[2]+dir[2]]
            if ny<0 or ny>=H or nx<0 or nx>=W:
                continue
            if DFST[ny][nx]!=-1:
                continue
            DFST[ny][nx]=nt
            ans = max(ans,nt)
            qu.append([ny,nx,nt])
    return ans

print(main())


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import deque
      | ^~~~
Language: C++

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

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)




int main(){
    int h,w;
    scanf("%d %d",&h,&w);
    int a[h][w];
    queue<pair<int,int>> Q;
    rep(i,h){
        char s[w+1];
        scanf("%s",s);
        rep(j,w){
            if(s[j]=='#'){
                a[i][j]=1;
                Q.push(make_pair(i,j));
            }
            else a[i][j]=0;
        }
    }
    int ctr=0;
    

    while(!Q.empty()){
        vector<pair<int,int> blist;
        while(!Q.empty()){
            blist.push_back(Q.front());
            Q.pop();
        }
        for(auto au:blist){
            if(au.first+1<h&&a[au.first+1][au.second]==0){
                a[au.first+1][au.second]=1;
                Q.push(make_pair(au.first+1,au.second));
            }
            if(au.first-1>=0&&a[au.first-1][au.second]==0){
                a[au.first-1][au.second]=1;
                Q.push(make_pair(au.first-1,au.second));
            }
            if(au.second+1<w&&a[au.first][au.second+1]==0){
                a[au.first][au.second+1]=1;
                Q.push(make_pair(au.first,au.second+1));
            }
            if(au.second-1>=0&&a[au.first][au.second-1]==0){
                a[au.first][au.second-1]=1;
                Q.push(make_pair(au.first,au.second-1));
            }
        }
        ctr++;
    }
    cout<<ctr<<endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:35:30: error: template argument 1 is invalid
   35 |         vector<pair<int,int> blist;
      |                              ^~~~~
a.cc:35:30: error: template argument 2 is invalid
a.cc:37:13: error: 'blist' was not declared in this scope; did you mean 'va_list'?
   37 |             blist.push_back(Q.front());
      |             ^~~~~
      |             va_list
a.cc:40:21: error: 'blist' was not declared in this scope; did you mean 'va_list'?
   40 |         for(auto au:blist){
      |                     ^~~~~
      |                     va_list
Language: C++

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

int dr[] = {1,0,-1,0};
int dc[] = {0,1,0,-1};
queue<pii> q;
int h, w;
char grid[1005][1005];
int dist[1005][1005];
inline bool inside(int r, int c){
  return 1 <= r && r <= h && 1 <= c && c <= w;
}
int main(){
  memset(dist, 0x3f,sizeof(dist));
  cin >> h >> w;
  for (int i = 1; i <= h; i++){
    cin >> (grid[i] + 1);
    for (int j = 1; j <= w; j++)
      if (grid[i][j] == '#'){
        q.push(make_pair(i, j));
        dist[i][j] = 0;
      }
  }
  while (!q.empty()){
    pii u = q.front(); q.pop();
    for (int i = 0, x, y; i < 4; i++){
      tie(x, y) = u;
      x += dr[i], y += dc[i];
      if (inside(x, y) && dist[x][y] > dist[u.first][u.second] + 1){
        dist[x][y] = dist[u.first][u.second] + 1;
        q.emplace(x, y);
      }
    }
  }
  int mx = 0;
  for (int i = 1; i <= h; i++)
    for (int j = 1; j <= w; j++)
      mx = max(mx, dist[i][j]);
  cout << mx << '\n';
  return 0;
}

Compiler output:
a.cc:8:7: error: 'pii' was not declared in this scope
    8 | queue<pii> q;
      |       ^~~
a.cc:8:10: error: template argument 1 is invalid
    8 | queue<pii> q;
      |          ^
a.cc:8:10: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:22:11: error: request for member 'push' in 'q', which is of non-class type 'int'
   22 |         q.push(make_pair(i, j));
      |           ^~~~
a.cc:26:13: error: request for member 'empty' in 'q', which is of non-class type 'int'
   26 |   while (!q.empty()){
      |             ^~~~~
a.cc:27:5: error: 'pii' was not declared in this scope
   27 |     pii u = q.front(); q.pop();
      |     ^~~
a.cc:27:26: error: request for member 'pop' in 'q', which is of non-class type 'int'
   27 |     pii u = q.front(); q.pop();
      |                          ^~~
a.cc:29:19: error: 'u' was not declared in this scope
   29 |       tie(x, y) = u;
      |                   ^
a.cc:33:11: error: request for member 'emplace' in 'q', which is of non-class type 'int'
   33 |         q.emplace(x, y);
      |           ^~~~~~~
Language: C

#include <stdio.h>

int h,w;
int mas[1000][1000];

int main(){
	int i,j;
	int c;
	int cont=0;
	char yoko[1002]="";
	int last;
	
	scanf("%d %d ",&h,&w);
	for(i=0;i<h;i++){
		scanf("%s",yoko);
		for(j=0;j<w;j++){
			if(yoko[j]=='#'){
				mas[i][j]=0;
			}else{
				mas[i][j]=-1;
			}
		}
	}
	
	while(true){
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				if(mas[i][j]==cont){
					if(i-1>-1)if(mas[i-1][j]==-1)last=mas[i-1][j]=cont+1;
					if(i+1<h)if(mas[i+1][j]==-1)last=mas[i+1][j]=cont+1;
					if(j-1>-1)if(mas[i][j-1]==-1)last=mas[i][j-1]=cont+1;
					if(j+1<w)if(mas[i][j+1]==-1)last=mas[i][j+1]=cont+1;
				}
			}
		}
		cont++;
		if(last!=cont){
			break;
		}
		
	}
	
	printf("%d\n",last);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:25:15: error: 'true' undeclared (first use in this function)
   25 |         while(true){
      |               ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:25:15: note: each undeclared identifier is reported only once for each function it appears in
   25 |         while(true){
      |               ^~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const int MOD = 1e9 +7;
int dx[4] ={1,0,-1,0},dy[4] ={0,1,0,-1};

ll h,w;
char field[1010][1010];
ll cnt[1010][1010];
ll ans=0;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>h>>w;
    queue<pll> que;
    memset(cnt,-1,sizeof(cnt));
    rep(i,h){
        rep(j,w){
            cin>>field[i][j];
            if(field[i][j]=='#'){
                que.push(make_pair(i,j));
                cnt[i][j]=0;
            }
        }
    }
    while(!que.empty()){
        pll p=que.front();
        que.pop();
        rep(i,4){
            ll nx=p.first+dx[i],ny=p.second+dy[i];
            if(nx>=0 && nx <h && ny >=0 && ny <w &&cnt[nx][ny]==-1&& field[nx][ny]=='.'){
                cnt[nx][ny]=cnt[p.first][p.second]+1;
                que.push(pll(nx,ny));

            }
        }
    }
    rep(i,h){
        rep(j,w){
            ans=max(ans,cnt[i][j]);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: 'memset' was not declared in this scope
   33 |     memset(cnt,-1,sizeof(cnt));
      |     ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include<queue>
  +++ |+#include <cstring>
   11 | #define ll long long
Language: C++

#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
ll cx[4]={0,0,1,-1};
ll cy[4]={1,-1,0,0};
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n,m;
	cin>>n>>m;

	char ar[n][m+1];
	for(i=0;i<n;i++){
		cin>>ar[i];
	}
	ll dt[n][m];
	queue< pair<ll,ll> qe;
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			dt[i][j]=100000000000000;
			if(ar[i][j]=='#'){
				dt[i][j]=0;
				qe.ps({i,j});
			}
		}
	}

	while(qe.size()>0){
		pair<ll,ll> p=qe.front();
		qe.pop();
		ll x,y;
		for(k=0;k<4;k++){
			x=p.fs+cx[k];
			y=p.sc+cy[k];
			if(x>=0&&y>=0&&x<n&&y<m&&dt[x][y]>dt[p.fs][p.sc]+1){
				dt[x][y]=dt[p.fs][p.sc]+1;
				qe.ps({x,y});
			}
		}
	}
	ll mx=0;
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			mx=max(mx,dt[i][j]);
		}
	}
	cout<<mx;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:28: error: template argument 1 is invalid
   31 |         queue< pair<ll,ll> qe;
      |                            ^~
a.cc:31:28: error: template argument 2 is invalid
a.cc:37:33: error: 'qe' was not declared in this scope
   37 |                                 qe.ps({i,j});
      |                                 ^~
a.cc:42:15: error: 'qe' was not declared in this scope
   42 |         while(qe.size()>0){
      |               ^~
Language: C++

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

signed main()
{
    ll h, w;
    char a[1000][1000];
    cin >> h >> w;
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            cin >> a[i][j];

    // vector<pair<ll, ll>> v;
    queue<pair<ll, ll>> q;
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            if (a[i][j] == '#')
            {
                // v.push_back(make_pair(i, j));
                q.push(make_pair(i, j));
            }

    int cnt = 0;
    // cout << ":" << endl;
    while (!q.empty())
    {
        // int sz = v.size();
        for (int i = 0; i < sz; i++)
        {
            // int x = v[i].second;
            // int y = v[i].first;
            int x = q.front().second;
            int y = q.front().first;
            q.pop();
            for (int k = -1; k <= 1; k++)
            {
                for (int l = -1; l <= 1; l++)
                {
                    if (abs(k) != abs(l) && x + k >= 0 && x + k < w && y + l >= 0 && y + l < h && a[y + l][x + k] == '.')
                    {
                        q.push(make_pair(y + l, x + k));
                        // v.push_back(make_pair(y + l, x + k));
                        a[y + l][x + k] = '#';
                    }
                }
            }
        }
        cnt++;
    }
    cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:29: error: 'sz' was not declared in this scope
   33 |         for (int i = 0; i < sz; i++)
      |                             ^~
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<queue>

using namespace std;

#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef string S;
typedef queue<int> qi;
typedef pair<int,int> P;

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

int main(){
    int h,w;
    cin >> h >> w;
    char a[1002][1002];
    int dist[1002][1002];
    queue<P> que;
    for(int i = 0;i<h;i++){
        for(int j = 0;j<w;j++){
            dist[i][j] = -1;
            cin >> a[i][j];
            if(a[i][j]=='#'){
                dist[i][j] = 0;
                que.push(P(i, j));
            }
        }
    }
    int ans = 0;
    while(que.size()> 0){
        P now = que.front();
        que.pop();
        for(int i = 0;i < 4;i++){
            P next = P(now.first+x[i], now.second+y[i]);
            if (0<=next.first<h && 0<=next.second<w && dist[next.first][next.second] == -1){
                que.push(next);
                dist[next.first][next.second] = dist[now.first][now.second] + 1;
                ans = dist[next.first][next.second];

            }
        }
    }
    cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:59:25: error: expected '}' at end of input
   59 |     cout << ans << endl;
      |                         ^
a.cc:29:11: note: to match this '{'
   29 | int main(){
      |           ^
Language: C++

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

int sousa(int i,int j,char c[][],int cnt){
  if(c[i][j]=='.'){
    if(i>0){
      if(j>0){
        return max({sousa(c,i-1,j,cnt+1),sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i-1,j,cnt+1)});
      }
    }else{
      if(j>0){
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)});
      }
    }
  }else{
    return cnt;
  }
}
  
        

int main(){
  int h, w;
  cin >> h >> w;
  char c[h][w];
  int i,j;
  for(i=0;i<h;i++) for(j=0;j<w;j++) cin >> c[i][j];
  int ans = 0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      ans = max(ans,sousa(i,j,c,0));
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc:5:28: error: declaration of 'c' as multidimensional array must have bounds for all dimensions except the first
    5 | int sousa(int i,int j,char c[][],int cnt){
      |                            ^
a.cc:5:33: error: expected ')' before ',' token
    5 | int sousa(int i,int j,char c[][],int cnt){
      |          ~                      ^
      |                                 )
a.cc:5:34: error: expected unqualified-id before 'int'
    5 | int sousa(int i,int j,char c[][],int cnt){
      |                                  ^~~
Language: C++

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

int sousa(int i,int j,char c[i][j],int cnt){
  if(c[i][j]=='.'){
    if(i>0){
      if(j>0){
        return max({sousa(c,i-1,j,cnt+1),sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i-1,j,cnt+1)});
      }
    }else{
      if(j>0){
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)});
      }
    }
  }else{
    return cnt;
  }
}
  
        

int main(){
  int h, w;
  cin >> h >> w;
  char c[h][w];
  int i,j;
  for(i=0;i<h;i++) for(j=0;j<w;j++) cin >> c[i][j];
  int ans = 0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      ans = max(ans,sousa(i,j,c,0));
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:5:31: error: use of parameter outside function body before ']' token
    5 | int sousa(int i,int j,char c[i][j],int cnt){
      |                               ^
a.cc:5:34: error: use of parameter outside function body before ']' token
    5 | int sousa(int i,int j,char c[i][j],int cnt){
      |                                  ^
a.cc:5:35: error: expected ')' before ',' token
    5 | int sousa(int i,int j,char c[i][j],int cnt){
      |          ~                        ^
      |                                   )
a.cc:5:36: error: expected unqualified-id before 'int'
    5 | int sousa(int i,int j,char c[i][j],int cnt){
      |                                    ^~~
Language: C++

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

bool ColorCheck(const vector<vector<int>>& mass)
{
	for(size_t i = 0; i < mass.size(); ++ i)
      for(size_t j = 0; j < mass[i].size(); ++ j)
      {
        if(!mass[i][j])
          return false;
      }
  
  	return true;
}

void PaintMass(vector<vector<int>>& Mass)
{
	vector<vector<bool>> PrevMass = Mass;
	for(size_t i = 0; i < PrevMass.size(); ++ i)
    {
    	for(size_t j = 0; j < PrevMass[i].size(); ++ j)
        {
        	if(!PrevMass[i][j]){
              continue;
            }
          
        	// 上下左右を塗る
          	if( i > 0)
              Mass[i-1][j] = true;
          
          	if( j > 0)
              Mass[i][j-1] = true;
          
          	if( i < PrevMass.size() - 1)
              Mass[i+1][j] = true;
          
          	if( j < PrevMass[i].size() - 1)
              Mass[i][j+1] = true;
        }
    }
}

int main()
{
 	size_t h,w;
 	cin >> h >> w;
	vector<vector<int>> Mass(h, vector<int>(w, false));

	for(size_t i = 0; i < h; ++ i){
    	for(size_t j = 0; j < w; ++ j)
    	{
        	char col;
        	cin >> col;
      		Mass[i][j] = (col == '#')? true : false;
     	}
    }

  	int Paint = 0;
  	while(!ColorCheck(Mass))
    {
    	PaintMass(Mass);      	
      	++ Paint;
    }
  
  	cout << Paint;
	return 0; 
}


Compiler output:
a.cc: In function 'void PaintMass(std::vector<std::vector<int> >&)':
a.cc:19:41: error: conversion from 'vector<vector<int>>' to non-scalar type 'vector<vector<bool>>' requested
   19 |         vector<vector<bool>> PrevMass = Mass;
      |                                         ^~~~
Language: C++

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

int sousa(char *c,int i,int j,int cnt){
  if(c[i][j]=='.'){
    if(i>0){
      if(j>0){
        return max({sousa(c,i-1,j,cnt+1),sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i-1,j,cnt+1)});
      }
    }else{
      if(j>0){
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)});
      }
    }
  }else{
    return cnt;
  }
}
  
        

int main(){
  int h, w;
  cin >> h >> w;
  char c[h][w];
  int i,j;
  for(i=0;i<h;i++) for(j=0;j<w;j++) cin >> c[i][j];
  int ans = 0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      ans = max(ans,sousa(c,i,j,0));
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int sousa(char*, int, int, int)':
a.cc:6:10: error: invalid types 'char[int]' for array subscript
    6 |   if(c[i][j]=='.'){
      |          ^
a.cc: In function 'int main()':
a.cc:36:27: error: cannot convert 'char (*)[w]' to 'char*'
   36 |       ans = max(ans,sousa(c,i,j,0));
      |                           ^
      |                           |
      |                           char (*)[w]
a.cc:5:17: note:   initializing argument 1 of 'int sousa(char*, int, int, int)'
    5 | int sousa(char *c,int i,int j,int cnt){
      |           ~~~~~~^
a.cc: In function 'int sousa(char*, int, int, int)':
a.cc:23:1: warning: control reaches end of non-void function [-Wreturn-type]
   23 | }
      | ^
Language: C++

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

int sousa(char *c,int i,int j,int cnt){
  if(c[i,j]=='.'){
    if(i>0){
      if(j>0){
        return max({sousa(c,i-1,j,cnt+1),sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i-1,j,cnt+1)});
      }
    }else{
      if(j>0){
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)});
      }
    }
  }else{
    return cnt;
  }
}
  
        

int main(){
  int h, w;
  cin >> h >> w;
  char c[h,w];
  int i,j;
  for(i=0;i<h;i++) for(j=0;j<w;j++) cin >> c[i,j];
  int ans = 0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      ans = max(ans,sousa(c,i,j,0));
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:11: error: expected ']' before ',' token
   30 |   char c[h,w];
      |           ^
      |           ]
a.cc:30:13: error: expected initializer before ']' token
   30 |   char c[h,w];
      |             ^
a.cc:32:44: error: 'c' was not declared in this scope
   32 |   for(i=0;i<h;i++) for(j=0;j<w;j++) cin >> c[i,j];
      |                                            ^
a.cc:36:27: error: 'c' was not declared in this scope
   36 |       ans = max(ans,sousa(c,i,j,0));
      |                           ^
Language: C++

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

int sousa(char *c,int i,int j,int cnt){
  if(c[i,j]=='.'){
    if(i>0){
      if(j>0){
        return max({sousa(c,i-1,j,cnt+1),sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1),sousa(c,i-1,j,cnt+1)});
      }
    }else{
      if(j>0){
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      }else{
        return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)});
      }
    }
  }else{
    return cnt;
  }
}
  
        

int main(){
  int h, w;
  cin >> h >> w;
  char c[h,w];
  int i,j;
  for(i=0;i<h;i++) for(j=0;j<w;j++) cin >> c[i,j];
  int ans = 0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      ans = max(ans,sousa(c,i,j,0));
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int sousa(char*, int, int, int)':
a.cc:15:62: error: expected '}' before 'sousa'
   15 |         return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                    ~                                         ^~~~~
a.cc:15:62: error: expected ')' before 'sousa'
   15 |         return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                   ~                                          ^~~~~
      |                                                              )
a.cc:15:82: error: expected ';' before '}' token
   15 |         return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                                                                                  ^
      |                                                                                  ;
a.cc:15:83: error: expected primary-expression before ')' token
   15 |         return max({sousa(c,i+1,j,cnt+1),sousa(c,i,j+1,cnt+1)sousa(c,i,j-1,cnt+1)});
      |                                                                                   ^
a.cc:16:8: error: expected '}' before 'else'
   16 |       }else{
      |        ^~~~
a.cc:6:18: note: to match this '{'
    6 |   if(c[i,j]=='.'){
      |                  ^
a.cc: At global scope:
a.cc:20:3: error: expected declaration before '}' token
   20 |   }else{
      |   ^
a.cc:20:4: error: expected unqualified-id before 'else'
   20 |   }else{
      |    ^~~~
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
a.cc: In function 'int main()':
a.cc:30:11: error: expected ']' before ',' token
   30 |   char c[h,w];
      |           ^
      |           ]
a.cc:30:13: error: expected initializer before ']' token
   30 |   char c[h,w];
      |             ^
a.cc:32:44: error: 'c' was not declared in this scope
   32 |   for(i=0;i<h;i++) for(j=0;j<w;j++) cin >> c[i,j];
      |                                            ^
a.cc:36:27: error: 'c' was not declared in this scope
   36 |       ans = max(ans,sousa(c,i,j,0));
      |                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int W,H;
  cin >> H,W;
  int Wmax=0;
  int Hmax=0;
  int cntw=0;
  int cnth=0;
  
  	for(int i=0;i<H;i++){
      for(int n=0;n<W;n++){
        string str;
        cin >> str;
        if(str.at(n)="."){
          cntw++;
        }
        else if(cntw==w){
          cnth++;
        }
        else{
          cnth =0;
      }
        if(cntw>=Wmax){
          Wmax = cntw;
          cntw = 0;
        }
        }
       if(cnth>=Hmax){
         Hmax = cnth;
         cnth = 0;
    }
    }
  int Hmax2 = hmax/2;
     cout << Hmax2 + Wmax << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   15 |         if(str.at(n)="."){
      |                      ^~~
      |                      |
      |                      const char*
a.cc:18:23: error: 'w' was not declared in this scope
   18 |         else if(cntw==w){
      |                       ^
a.cc:34:15: error: 'hmax' was not declared in this scope; did you mean 'Hmax'?
   34 |   int Hmax2 = hmax/2;
      |               ^~~~
      |               Hmax
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int W,H;
  cin >> W,H;
  int Wmax=0;
  int Hmax=0;
  int cntw=0;
  int cnth=0;
  
  	for(int i=0;i<H;i++){
      for(int n=0;n<W;n++){
        string str;
        cin >> str;
        if(str.at(n)="."){
          cntw++;
        }
        else if(cntw==w){
          cnth++;
        }
        else{
          cnth =0;
      }
        if(cntw>=Wmax){
          Wmax = cntw;
          cntw = 0;
        }
        }
       if(cnth>=Hmax){
         Hmax = cnth;
         cnth = 0;
    }
    }
  int Hmax2 = hmax/2;
     cout << Hmax2 + Wmax << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   15 |         if(str.at(n)="."){
      |                      ^~~
      |                      |
      |                      const char*
a.cc:18:23: error: 'w' was not declared in this scope
   18 |         else if(cntw==w){
      |                       ^
a.cc:34:15: error: 'hmax' was not declared in this scope; did you mean 'Hmax'?
   34 |   int Hmax2 = hmax/2;
      |               ^~~~
      |               Hmax
Language: C++

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

char field[1001][1001];

int ans = 0;

void dfs(int x,int y,int H, int W){
    

    for(int dx = -1; dx <= -1; dx++){
        
            int nx  = x+dx;

            if(0<=nx<H&&field[nx][y] == '#'){
                field[x][y] = '#';
                ans++;
                return;
            }
        }
        
        
    }

    for(int dy = -1; dy <= -1; dy++){
        
            int ny  = y+dy;

            if(0<=ny<H&&field[x][ny] == '#'){
                field[x][y] = '#';
                ans++;
                return;
            }
        
        
        
    }
}

int main(){
    int H,W;
    cin>>H>>W;
    
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> field[i][j];
        }
    }

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(field[i][j] == '.'){
                dfs(i,j,H,W);
            }
        }
    }

    cout << ans << endl;

}

Compiler output:
a.cc:25:5: error: expected unqualified-id before 'for'
   25 |     for(int dy = -1; dy <= -1; dy++){
      |     ^~~
a.cc:25:22: error: 'dy' does not name a type
   25 |     for(int dy = -1; dy <= -1; dy++){
      |                      ^~
a.cc:25:32: error: 'dy' does not name a type
   25 |     for(int dy = -1; dy <= -1; dy++){
      |                                ^~
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int W,H;
  int Wmax=0;
  int Hmax=0;
  int cntw=0;
  int cnth=0;
  
  	for(int i=0;i<H;i++){
      for(int n=0;n<W;n++){
        string str;
        cin >> str;
        if(str.at(n)="."){
          cntw++;
        }
        else if(cntw==w){
          cnth++;
        }
        else{
          cnth =0;
      }
        if(cntw>=Wmax){
          Wmax = cntw;
          cntw = 0;
        }
        }
       if(cnth>=Hmax){
         Hmax = cnth;
         cnth = 0;
    }
    }
  int Hmax2 = hmax/2;
     cout << Hmax2 + Wmax << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   14 |         if(str.at(n)="."){
      |                      ^~~
      |                      |
      |                      const char*
a.cc:17:23: error: 'w' was not declared in this scope
   17 |         else if(cntw==w){
      |                       ^
a.cc:33:15: error: 'hmax' was not declared in this scope; did you mean 'Hmax'?
   33 |   int Hmax2 = hmax/2;
      |               ^~~~
      |               Hmax