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

#include<iostream>
using namespace std;
typedef long long ll;

ll MOD = 1000000007;
ll A[1048576];
ll C[1048576];
ll arr[1048576][2];
int zero_update[1048576];

ll power_mod(a,n){
	if(n == 0){
		return 1;
	}
	ll x = power_mod(a,n/2);
	x = x*x;
	x %= MOD;
	return (n%2 == 0 ? x : (a*x)%MOD);
}

int main(){
	int zero_cnt = 0;
	int U = 1048576;
	int N;
	cin >> N;
	for(i=0;i<N;i++){
		cin >> A[i];
		if(i == 0){
			C[i] = A[i];
		} else {
			C[i] = C[i-1] + A[i];
		}
	}
	for(i=0;i<U;i++){
		arr[i][0] = 1;
	}
	
	for(i=0;i<N;i++){
		int c = C[i];
		if(c == 0){
			zero_cnt++;
			continue;
		}
		n = zero_cnt - zero_update[c];
		int a = arr[c][0];
		int b = arr[c][1];
		int x = a + n*b;
		int y = b;
		a = x;
		b = a+b;
		a %= MOD;
		b %= MOD;
		arr[c][0] = a;
		arr[c][1] = b;
	}
	ll answer = 0;
	int final = C[N-1];
	if(final != 0){
		answer = arr[final][0];
	} else {
		answer = 0;
		for(i=1;i<U;i++){
			answer += arr[i,1];
			answer %= MOD;
		}
		answer += power_mod(2,zero_cnt-1);
	}
	cout << answer << endl;
}


Compiler output:
a.cc:11:14: error: 'a' was not declared in this scope
   11 | ll power_mod(a,n){
      |              ^
a.cc:11:16: error: 'n' was not declared in this scope
   11 | ll power_mod(a,n){
      |                ^
a.cc:11:17: error: expression list treated as compound expression in initializer [-fpermissive]
   11 | ll power_mod(a,n){
      |                 ^
a.cc: In function 'int main()':
a.cc:26:13: error: 'i' was not declared in this scope
   26 |         for(i=0;i<N;i++){
      |             ^
a.cc:34:13: error: 'i' was not declared in this scope
   34 |         for(i=0;i<U;i++){
      |             ^
a.cc:38:13: error: 'i' was not declared in this scope
   38 |         for(i=0;i<N;i++){
      |             ^
a.cc:44:17: error: 'n' was not declared in this scope
   44 |                 n = zero_cnt - zero_update[c];
      |                 ^
a.cc:62:21: error: 'i' was not declared in this scope
   62 |                 for(i=1;i<U;i++){
      |                     ^
a.cc:66:36: error: 'power_mod' cannot be used as a function
   66 |                 answer += power_mod(2,zero_cnt-1);
      |                           ~~~~~~~~~^~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <assert.h>
#include <map>
#define mod 1000000007
//#include <bits/stdc++.h>

#define ll long long

using namespace std;


int ar[500001];
int xr[500010];
vector< int > pos[1 << 21];
int msk;
map< pair< int, int>, int > my;

int go(int idx, int n){
    if(idx == n + 1)
        return 1;
    if(my.find({msk, idx}) != my.end()) return my[{msk, idx}];
    int rt = 0;
    int fnd = xr[idx] ^ msk;
    int id  = upper_bound(pos[fnd].begin(), pos[fnd].end(), idx) - pos[fnd].begin();
    for(int j = id; j < pos[fnd].size(); ++j){
        rt = (rt +  go(pos[fnd][j], n)) % mod;
    }
    return my[{msk, idx}] = rt;
}

int main(){
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> ar[i];
    }
    
    xr[n + 1] = 0;
    pos[0].push_back(n+1);
    for(int i = n; i >= 1; --i){
        xr[i] = xr[i  + 1] ^ ar[i];
        pos[xr[i]].push_back(i);
    }
    for(int i = 0; i < 1 << 21; ++i){
        sort(pos[i].begin(), pos[i].end());
    }
    int x = 0;
    int ans = 0;
    for(int i = 1; i <= n; ++i){
        x ^= ar[i];
        msk = x;
        ans = (ans + go(i + 1,n)) % mod;
    }
    cout << ans;
    
}


Compiler output:
a.cc: In function 'int go(int, int)':
a.cc:27:15: error: 'upper_bound' was not declared in this scope
   27 |     int id  = upper_bound(pos[fnd].begin(), pos[fnd].end(), idx) - pos[fnd].begin();
      |               ^~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:49:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   49 |         sort(pos[i].begin(), pos[i].end());
      |         ^~~~
      |         short
Language: C++

// template version 1.9

// varibable settings {{{
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

#define int long long
const int INF=1e18;
const int MOD=1e9+7;
#define infile "../test/sample-1.in"
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}

// define basic macro {{{
#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__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;
// }}}

int p[500001];

int solve(){
  int n;cin>>n;

  p[0] = 1;
  rep(i, 1, 500002){
    p[i] = p[i-1]*2;
    p[i] %= MOD;
  }
  dump_1d(p, n+1);

  vi x(n+1, 0);
  rep(i, 1, n+1){
    int a;cin>>a;
    x[i] = x[i-1]^a;
  }
  dump(x);

  vi cumz(n+1, 0);
  rep(i, 1, n+1){
    cumz[i] = cumz[i-1];
    if (x[i]==0) cumz[i]++;
  }
  dump(cumz);

  if (x[n]!=0) {
    cout << 1 << endl;
    return 0;
  }

  int res=1;  //
  rep(i, 1, n){
    int znum = cumz[n] - cumz[i];
    dump(i, znum);
    res += p[znum-1];
    dump(i, res)
    res %= MOD;
  }
  cout << res << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Compiler output:
a.cc: In function 'long long int solve()':
a.cc:92:5: error: expected ';' before 'res'
   92 |     res %= MOD;
      |     ^~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <assert.h>
#include <map>
#define mod 1000000007
//#include <bits/stdc++.h>

#define ll long long

using namespace std;


int ar[500001];
int xr[500010];
vector< int > pos[1 << 21];
int msk;
map< pair< int, int>, int > my;

int go(int idx, int n){
    if(idx == n + 1)
        return 1;
    if(my.find({msk, idx}) != my.end()) return my[{msk, idx}];
    int rt = 0;
    int fnd = xr[idx] ^ msk;
    int id  = upper_bound(pos[fnd].begin(), pos[fnd].end(), idx) - pos[fnd].begin();
    for(int j = id; j < pos[fnd].size(); ++j){
        rt = (rt +  go(pos[fnd][j], n)) % mod;
    }
    return my[{msk, id}] = rt;
}

int main(){
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> ar[i];
    }
    
    xr[n + 1] = 0;
    pos[0].push_back(n+1);
    for(int i = n; i >= 1; --i){
        xr[i] = xr[i  + 1] ^ ar[i];
        pos[xr[i]].push_back(i);
    }
    for(int i = 0; i < 1 << 21; ++i){
        sort(pos[i].begin(), pos[i].end());
    }
    int x = 0;
    int ans = 0;
    for(int i = 1; i <= n; ++i){
        x ^= ar[i];
        msk = x;
        ans = (ans + go(i + 1,n)) % mod;
    }
    cout << ans;
    
}


Compiler output:
a.cc: In function 'int go(int, int)':
a.cc:27:15: error: 'upper_bound' was not declared in this scope
   27 |     int id  = upper_bound(pos[fnd].begin(), pos[fnd].end(), idx) - pos[fnd].begin();
      |               ^~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:49:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   49 |         sort(pos[i].begin(), pos[i].end());
      |         ^~~~
      |         short
Language: C++

#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N =  20;
const int MOD = 1000000007;
const int LOG = 20;
const int INF = 1000000010;
const int delta = 11353;

int n, m, CNT[1 << N][(N + 1)* (N + 1) / 2], DP[1 << N][(N + 1) * (N + 1) / 2], F[(1 << N)][N], Nie[(N + 1) * (N + 1) / 2], inv[1 << N];
pii par[N + 10][N + 10];
vector<pii> E;
vector<pii> G[N + 10];

void DFS(int jad, int v, int p){
	//cout << jad << ' '<< v << ' ' << p << '\n';
	for (auto u:G[v]){
		if (u.F == p) continue;
		par[jad][u.F] = {v, u.S};
		DFS(jad, u.F, v);
	}
}

inline int add(int a, int b){
	a += b;
	if (a >= MOD) a -= MOD;
	return a;
}

inline int mul(int a, int b){
	return a * 1ll * b % MOD;
}

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	int res = 1;
	int x = 0;
	inv[1] = 0;
	for (int i = 1; i < N; i++){
		res *= 2;
		inv[res] = i;
	}
	for (int i = 0; i < m; i++){
		int v, u;
		cin >> v >> u;
		E.pb({v, u});
		if (i < n - 1) G[v].pb({u, i}), G[u].pb({v, i});
	}
//	cout << "YES" << endl;
	for (int i = 1; i <= n; i++){
		DFS(i, i, 0);
	}
	//cout << "YES" << endl;
	for (int i = n - 1; i < m; i++){
		int v = E[i].F, u = E[i].S;
		while (u != v){
			Nie[i] |= (1 << (par[v][u].S));
			u = par[v][u].F;
		}
		//cout << i << ' ' << Nie[i] << '\n';
	}
	n--;
	//cout << "YES" << endl;
	for (int mask = 0; mask < (1 << n); mask++){
		for (int i = n - 1; i < m; i++){
			int res = mask & Nie[i];
			if (__builtin_popcount(res) == 1){
				//cout << "Fuck " << mask << ' ' << (res & (-res)) << ' ' << inv[res & (-res)] << '\n';
				F[mask][inv[res & (-res)]] ++;
			}
		}	
	}
	/*
	CNT[0][0] = 1;
	for (int mask = 0; mask < (1 << n); mask++) for (int j = 0; j <= m - n; j++){
		if (mask + j == 0) continue;
		if (j != 0) CNT[mask][j] = CNT[mask][j - 1] * 1ll * j % MOD;
		for (int u = 0; u < n; u++) if(mask & (1 << u)) CNT[mask][j] = add(CNT[mask][j], CNT[mask ^ (1 << u)][j + F[mask][u]]);
		//cout << mask << ' ' << j << ' ' << CNT[mask][j] << '\n';
	}
	DP[0][0] = 0;
	
	for (int mask = 0; mask < (1 << n); mask ++) for (int i = 0; i <= m - n; i++){
		if (mask + i == 0) continue;
		if (i != 0) DP[mask][i] = mul(i, add(DP[mask][i - 1], mul(__builtin_popcount(mask), CNT[mask][i - 1])));
		for (int u = 0; u < n; u++)if(mask & (1 << u)){
			DP[mask][i] = add(DP[mask][i], add(add(DP[mask ^ (1 << u)][i + F[mask][u]], mul(__builtin_popcount(mask ^ (1 << u)), CNT[mask ^ (1 << u)][i + F[mask][u]])), CNT[mask ^ (1 << u)][i + F[mask][u]]));
		}
	}
	cout << DP[(1 << n) - 1][0];
	
	return 0;
}


Compiler output:
a.cc:85:9: error: unterminated comment
   85 |         /*
      |         ^
a.cc: In function 'int32_t main()':
a.cc:84:10: error: expected '}' at end of input
   84 |         }
      |          ^
a.cc:45:15: note: to match this '{'
   45 | int32_t main(){
      |               ^
Language: C++

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
//#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 500;
const int K = 19;
int mod = 1e9 + 7;
int dp[192][1 << K];
int w[192][1 << K];
int bad[1 << K];

vector < pair < int, int > > g[N];
pair < int, int > p[N];
int a[N], b[N], d[N];
map < int, int > m;
void dfs(int v, int par = -1, int en = -1){
    p[v] = {par, en};
    for (auto u: g[v]){
        if (u.F != par){
            dfs(u.F, v, u.S);
        }
    }
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n, m;
    cin >> n >> m;
    int pp = 0;
    for (int i = 1; i <= n; i++){
        for (int j = i + 1; j <= n; j++)
        a[i]
        if (i < n){
            g[a[i]].pb({b[i], i});
            g[b[i]].pb({a[i], i});
        }
    }
    for (int i = n; i <= m; i++){
        dfs(a[i]);
        int v = b[i];
        while (v != a[i]){
            d[i] |= (1 << (p[v].S - 1));
            v = p[v].F;
        }
    }
    for (int i = 0; i < (1 << (n - 1)); i++){
        for (int j = n; j <= m; j++){
            if ((d[j] & i) == d[j]) bad[i]++;
        }
    }
    dp[0][0] = 1;
    for (int i = 1; i <= m; i++){
        for (int j = 0; j < (1 << (n - 1)); j++){
            int bb = 0;
            for (int l = 0; l < 1; l++){
                if ((1 << l) & j){
                    bb++;
                    dp[i][j] = (dp[i - 1][j ^ (1 << l)] + dp[i][j]) % mod;
                    w[i][j] = (1LL * dp[i - 1][j ^ (1 << l)] * i + w[i - 1][j ^ (1 << l)] + w[i][j]) % mod;
                }
            }
            int e = i - bb;
            if (bad[j] < e){
                w[i][j] = 0;
                dp[i][j] = 0;
            } else
            if (e != 0){
                dp[i][j] = (dp[i][j] + 1LL *(bad[j] - e + 1) * dp[i - 1][j]) % mod;
                w[i][j] = (w[i][j] + w[i - 1][j] * 1LL *(bad[j] - e + 1) ) % mod;
            }
        }
    }
    cout << w[m][(1 << (n - 1)) - 1];
}


Compiler output:
a.cc:35:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   35 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:44:13: error: expected ';' before 'if'
   44 |         a[i]
      |             ^
      |             ;
   45 |         if (i < n){
      |         ~~
Language: C++

#include<iostream>
using nanespace std;
int main()
{
  int m,n;
  cin>>m>>n;
  int a[m], b[m]
  for( int i=0;i=m;i++)
  {cin>>a[i]>>b[i];}
  cout<<"I'm tourist"
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'nanespace'
    2 | using nanespace std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin>>m>>n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:3: error: expected initializer before 'for'
    8 |   for( int i=0;i=m;i++)
      |   ^~~
a.cc:8:16: error: 'i' was not declared in this scope
    8 |   for( int i=0;i=m;i++)
      |                ^
a.cc:10:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |   cout<<"I'm tourist"
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

//g++ main.cpp -I /usr/local/include/ac-library
#include<cmath>
//#include <atcoder/all>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
//using namespace atcoder;
stack<int> st;
queue<int> qu;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
#define ALL(a) a.begin(), a.end()
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define pb push_back
#define sz(x) (int)(x).size()
#define mod 1000000007
//#define mint=modint1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
typedef vector<ll> vec;
typedef vector<vec> mat;

int node[1000005];

int main(){
    int h,w;
    cin >> h>> w;
    vector<string> A(h);
    rep(i,h){
        cin >> A[i];
    }
    rep(i,h*w){
        node[i]=INF;
    }
    vector<int> to[h*w];
    vector<int> du={-1,0,1,0};
    vector<int> dw={0,-1,0,1};
    vector<int> b;
    rep(i,h){
        rep(j,w){
            int u=i*h+j;
            if(A[i][j]=='#'){
                b.push_back(i*h+j);
            }
            rep(k,4){
                int y=i+du[k];
                int x=j+dw[k];
                if(0<=x&&x<w&&0<=y&&y<h){
                    int v=y*h+x;
                    to[u].push_back(v);
                    //to[v].push_back(u);
                }
            }
        }
    }
    //cerr<<1<<endl;
    rep(i,sz(b)){
        // BFS
        qu.push(b[i]);
        node[b[i]]=0;
    }
        
    while(!qu.empty()){
        int u=qu.front();
        qu.pop();
        for(int v:to[u.fi]){
            if(node[v]>node[u]+1){
                node[v]=node[u]+1;
                qu.push(v);
            }
        }
        //cerr<<2<<endl;
    }
    int ans=0;
    rep(i,h){
        rep(j,w){
            ans=max(ans,node[i*h+j]);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:12: error: request for member 'first' in 'u', which is of non-class type 'int'
   30 | #define fi first
      |            ^~~~~
a.cc:81:24: note: in expansion of macro 'fi'
   81 |         for(int v:to[u.fi]){
      |                        ^~
Language: C++

//g++ main.cpp -I /usr/local/include/ac-library
#include<cmath>
//#include <atcoder/all>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
//using namespace atcoder;
stack<int> st;
queue<int> qu;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
#define ALL(a) a.begin(), a.end()
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define pb push_back
#define sz(x) (int)(x).size()
#define mod 1000000007
//#define mint=modint1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
typedef vector<ll> vec;
typedef vector<vec> mat;

int node[1000005];

int main(){
    int h,w;
    cin >> h>> w;
    vector<string> A(h);
    rep(i,h){
        cin >> A[i];
    }
    rep(i,h*w){
        node[i]=INF;
    }
    vector<int> to[h*w];
    vector<int> du={-1,0,1,0};
    vector<int> dw={0,-1,0,1};
    vector<int> b;
    rep(i,h){
        rep(j,w){
            int u=i*h+j;
            if(A[i][j]=='#'){
                b.push_back(i*h+j);
            }
            rep(k,4){
                int y=i+du[k];
                int x=j+dw[k];
                if(0<=x&&x<w&&0<=y&&y<h){
                    int v=y*h+x;
                    to[u].push_back(v);
                    //to[v].push_back(u);
                }
            }
        }
    }
    //cerr<<1<<endl;
    rep(i,sz(b)){
        // BFS
        qu.push(b[i]);
        node[b[i]]=0;
        while(!qu.empty()){
            int u=qu.front();
            qu.pop();
            for(int v:to[u.fi]){
                if(node[v]>node[u]+1){
                    node[v]=node[u]+1;
                    qu.push(v);
                }
            }
        }
        //cerr<<2<<endl;
    }
    int ans=0;
    rep(i,h){
        rep(j,w){
            ans=max(ans,node[i*h+j]);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:12: error: request for member 'first' in 'u', which is of non-class type 'int'
   30 | #define fi first
      |            ^~~~~
a.cc:79:28: note: in expansion of macro 'fi'
   79 |             for(int v:to[u.fi]){
      |                            ^~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLL = vector<PLL>;
using VPLD = vector<PLD>;

const int INF = numeric_limits<int>::max();
const unsigned long long int ULLINF = numeric_limits<unsigned long long int>::max();

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

	int h, w;
    cin >> h >> w;
    vector<string> v(h);
    for (int i=0; i<h; i++) cin >> v[i];

    // 多点スタート
    vector<vector<int>> dist(H, vector<int>(w, -1));
    using pint = pair<int, int>;
    queue<pint> que;
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            if (v[i][j]=='#') {
                dist[i][j] = 0;
                queue.push(pint(i,j));
            }
        }
    }

    // bfs
    while (!que.empty()) {
        auto cur = que.front();
        que.pop();
        for (int dir=0; dir<4; dir++) {
            int nx = cur.first + dx[dr];
            int ny = cur.second + dy[dr];
            if (nx < 0 || nx >=H || dy < 0 || dy >=w) continue;
            if (dsit[nx][ny] == -1) {
                dist[nx][ny] = dist[cur.first][cur.second] + 1;
                que.push(pint(nx,ny));
            }
        }
    }

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

    cout << res << endl;


	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:30: error: 'H' was not declared in this scope
   28 |     vector<vector<int>> dist(H, vector<int>(w, -1));
      |                              ^
a.cc:35:22: error: expected unqualified-id before '.' token
   35 |                 queue.push(pint(i,j));
      |                      ^
a.cc:45:37: error: 'dr' was not declared in this scope; did you mean 'dir'?
   45 |             int nx = cur.first + dx[dr];
      |                                     ^~
      |                                     dir
a.cc:47:40: error: ordered comparison of pointer with integer zero ('int*' and 'int')
   47 |             if (nx < 0 || nx >=H || dy < 0 || dy >=w) continue;
      |                                     ~~~^~~
a.cc:47:50: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   47 |             if (nx < 0 || nx >=H || dy < 0 || dy >=w) continue;
      |                                               ~~~^~~
a.cc:48:17: error: 'dsit' was not declared in this scope; did you mean 'dist'?
   48 |             if (dsit[nx][ny] == -1) {
      |                 ^~~~
      |                 dist
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD=1000000007;
const long long INF = 1LL<<60;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main() {
  int H,W,ans=0; cin>>H>>W;
  vector<vector<char>> S(H,vector<char>(W));
  queue<pair<int,int>> Q;
  vector<vector<bool>> seen(H,vector<bool>(W,false)); 
  rep(i,H){
    rep(j,W){
      cin>>S.at(i).at(j);
      if(S.at(i).at(j)=='#'){
        Q.push(make_pair(i,j));
        seen[i][j]=true;
      }
    }
  }
  Q.push(make_pair(-1,-1));
  while(!Q.empty()){
    int x=Q.front().first,y=Q.front().second;
    Q.pop();
    if(x==-1&&y==-1){
      if(Q.empty())continue;
      ans++;
      Q.push(make_pair(-1,-1));
      continue;  
    }
    rep(j,4){
      int nx=x+dx[j],ny=y+dy[j];
      if(nx<0 || nx>= H || ny<0 || ny>=W) continue;
      if(dist[nx][ny]==false){
      Q.push(make_pair(nx,ny));
      seen[nx][ny]=true;
      }
    }
  }
  cout<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:10: error: 'dist' was not declared in this scope
   36 |       if(dist[nx][ny]==false){
      |          ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <climits>
#include <cmath>
#include <string>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep01(i, n) for(int i = 0; i < (n) + 1; i++)
#define rep10(i, n) for(int i = 1; i < (n); i++)
#define rep11(i, n) for(int i = 1; i < (n) + 1; i++)
#define all(a) (a).begin(), (a).end()
typedef long long int ll;
typedef struct { int x; int y; } Pos;
using namespace std;

const int dx[] = { 1,-1,0,0 }, dy[] = { 0,0,1,-1 };
int time = 0;
int H, W;
bool cont = false;
vector<vector<char>> a;
queue<Pos> remq;
queue<Pos> nxtq;
int main() {
    cin >> H >> W;
    a = vector<vector<char>>(W + 1, vector<char>(H + 1));
    rep11(y, H) rep11(x, W) {
        cin >> a[x][y];
        if (a[x][y] == '#') nxtq.push(Pos{ x, y });
    }
    while (0 < nxtq.size()) {
        remq = queue<Pos>(nxtq);
        nxtq = queue<Pos>();
        cont = false;
        while (0 < remq.size()) {
            Pos ref = remq.front();
            remq.pop();
            rep(i, 4) {
                Pos chk = Pos{ ref.x + dx[i], ref.y + dy[i] };
                if (chk.x <= 0 || chk.x > W || chk.y <= 0 || chk.y > H) continue;
                if (a[chk.x][chk.y] == '.') {
                    a[chk.x][chk.y] = '#';
                    nxtq.push(Pos{ chk.x, chk.y });
                    cont = true;
                }
            }
        }
        if (cont) time++;
    }  
    cout << time << endl;
    return 0;
}

Compiler output:
a.cc:21:5: error: 'int time' redeclared as different kind of entity
   21 | int time = 0;
      |     ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:51:19: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   51 |         if (cont) time++;
      |                   ^~~~
a.cc:51:23: error: lvalue required as increment operand
   51 |         if (cont) time++;
      |                       ^~
Language: C++

#include <iostream> 
#include <queue>
#include <cstring>
char board[1005][1005];
#define pii pair<int, int>
using namespace std;

int ShortestPath[1005][1005];
int R, C;
int dx[]={-1, 0, 1, 0};
int dy[]={0, -1, 0, 1};

void bfs(int StartRow, int StartCol){
    queue<pii> a;
    memset(ShortestPath, -1, sizeof(ShortestPath));
    
    for(int i=0; i<R; i++){
        for(int j=0; j<C; j++){
            if(board[i][j]=='#'){
                ShortestPath[i][j]=0;
                a.push(make_pair(i, j));
            }
        }
    }

    while(!a.empty()){
        pii now = a.front(); a.pop();
        int row = now.first;
        int col = now.second;
        
        for(int x=0; x<4; x++){
            int vr = row+dx[x];
            int vc = col+dy[x];
            if(!inside(vr, vc))continue;
            if(ShortestPath[vr][vc]!=-1)continue;
            ShortestPath[vr][vc] = ShortestPath[row][col] + 1;
            a.push(make_pair(vr, vc));
        }
    }
}

int main(){
    cin >> R >> C;
    for(int i=0; i<R; i++){
        for(int j=0; j<C; j++){
            cin >> board[i][j];
        }
    }
    cout << bfs() << endl;
}

Compiler output:
a.cc: In function 'void bfs(int, int)':
a.cc:34:17: error: 'inside' was not declared in this scope; did you mean 'inline'?
   34 |             if(!inside(vr, vc))continue;
      |                 ^~~~~~
      |                 inline
a.cc: In function 'int main()':
a.cc:49:16: error: too few arguments to function 'void bfs(int, int)'
   49 |     cout << bfs() << endl;
      |             ~~~^~
a.cc:13:6: note: declared here
   13 | void bfs(int StartRow, int StartCol){
      |      ^~~
Language: C++

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

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

int H, W;
vector<string> field;

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

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

    // for bfs
    vector<vector<int>> dist(H, vector<int>(W, -1)); // all node has not been visited
    using pint = pair<int, int>;
    queue<pint> que;

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

    while(!que.empty()){
        auto cur = que.front();
        que.pop();

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

            if(nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
            if(dist[nx][ny] == -1){
                dist[nx][ny] = dist[cur.first][cur.second] + 1;
                que.push(pint(nx, ny));
            }
        }
    }

    int res = 0;

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

    cout << res << endl;

}

Compiler output:
a.cc:3:15: error: two or more data types in declaration of 'type name'
    3 | using Graph = vector<vector<int>>
      |               ^~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:39:34: error: 'dx' was not declared in this scope; did you mean 'nx'?
   39 |             int nx = cur.first + dx[i];
      |                                  ^~
      |                                  nx
Language: C++

from collections import deque
h,w = list(map(int,input().split()))
f = []
q = deque()
for i in range(h):
    a = list(input())
    for j in range(w):
        if a[j] == '#':
            q.append([0,i,j])
    f.append(a)

ans =0
dxy = [0,1,0,-1,0]
while(len(q)):
    c,y,x = q.popleft()
    for i in range(4):
        ny = y+dxy[i]
        nx = x+dxy[i+1]
        if nx >= w or ny >= h or nx <0 or ny <0:
            continue
        if f[ny][nx] == '.':
            f[ny][nx] = c+1
            q.append([c+1,ny,nx])
        elif f[ny][nx] != '#' and f[ny][nx] > c+1:
            f[ny][nx] = c+1
            q.append([c+1,ny,nx])

for i in range(h):
    for j in range(w):
        if f[i][j] != '#':
            ans = max(ans,f[i][j])
print(ans)


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

#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#include <bitset>
#define INF 100000000000
#define N 1002
using namespace std;

char field[N][N];
vector<int> p[4];
int h,w;

int bfs(int u,int v){
    queue<pair<int,int>> que;

    p[0]={-1,0};
    p[1]={1,0};
    p[2]={0,1};
    p[3]={0,-1};
    que.push(make_pair(u,v));
    d[u][v]=0;
    while (true){
        pair<int,int> a=que.front();
        que.pop();
        int s=a.first;
        int t=a.second;
        if (field[s][t]=='#') return d[s][t];
        
        for (int i=0; i<4; i++){
            int x=s+p[i][0];
            int y=t+p[i][1];
            if (x<1 || y<1 || x>h || y>w ) continue;

            
            d[x][y]=d[s][t]+1;
            que.push(make_pair(x,y));
        }
    }
    
    
}

int main(void){
    cin>>h>>w;
    for (int i=1; i<=h; i++){
        for (int j=1; j<=w; j++){
            cin>>field[i][j];
        }
    }
    
    int ans=0;
    
    for (int i=1; i<=h; i++){
        for (int j=1; j<=w; j++){
            int g=bfs(i,j);
            ans=max(ans,g);
        }
    }
    
    cout<<ans<<endl;
    
}

Compiler output:
a.cc: In function 'int bfs(int, int)':
a.cc:23:5: error: 'd' was not declared in this scope
   23 |     d[u][v]=0;
      |     ^
Language: C++

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

int H,W;
char A[1007][1007];

//
// BFS(幅優先探索)
//
int D[1007][1007];
int vx[4] = {0,-1,0,1};
int vy[4] = {1,0,-1,0};

int bfs(){
    int ans = 0;
    queue<pair <int,int> > Q;

    // 初回で黒の場合はQに突っ込む
    for(int y = 1; y< H+1;y++){
        for(int x = 1;x < W+1;x++){
            if(A[x][y] == '#'){
                D[x][y] = 0;
                Q.push(make_pair(x,y));
            }
        }
    }

    pair <int,int> p;

    while(!Q.empty()){
        p = Q.front(); Q.pop();

        for(int i = 0;i < 4;i++){
            int nx = p.first  + vy[i];
            int ny = p.second + vx[i];

            if(nx >= 1 && nx <= W && ny >= 1 && ny <= H && A[nx][ny] == '.'){
                Q.push(make_pair(nx,ny));
                D[nx][ny] = D[p.first][p.second] + 1;
                A[nx][ny] = '#';
                if(D[p.first][p.second] + 1 > ans){
                    ans = D[p.first][p.second] + 1;
                }
            }
        }

    }

    return ans;
}


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int INF = 1e9;
 
int main(void){
    int h, w;
    cin>>h>>w;
    vector<string> v(h);
    rep(i, h) cin>>v[i];
    queue<pair<int, int> > que;
    queue<pair<int, int> > nextque;
    rep(i, h)rep(j, w)if(v[i][j] == '#') que.push(make_pair(i, j));
    int ans = 0;
    bool ok = true;
    vector<int>dx = {0, -1, 0, 1};
    vector<int>dy = {-1, 0, 1, 0};
    while(ok){
        nextque = queue<pair<int, int> >();
        while(!que.empty()){
            auto p = que.front();que.pop();
            rep(i, 4){
                if(p.first+dx[i]>=0 && p.first+dx[i]<=h-1 && p.second+dy[i]>=0 && p.second+dy[i]<=w-1 && v[p.first+dx[i]][p.second+dy[i]] == '.'){
                    change = true;
                    v[p.first+dx[i]][p.second+dy[i]] = '#';
                    nextque.push(make_pair(p.first+dx[i], p.second+dy[i]));
                }
            }
        }
        ok = !nextque.empty();
        que = nextque;
        if(ok) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: 'change' was not declared in this scope
   26 |                     change = true;
      |                     ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int H,W,b; cin>>H>>W;
int counter=0;
int counter1=0;
int a[H][W];
char b;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>b;
if(b=='#')
a[i][j]=1;
else
a[i][j]=0;}}
for(int k=0;k>0;k++){
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(a[i][j]==1){
counter1++;
if(i>=1){
a[i-1][j]=1;}
if(i<H){
a[i+1][j]=1;}
if(j>=1){
a[i][j-1]=1;}
if(i<W){
a[i][j+1]=1;}}
else
continue;}}
if(counter1==H*W){
break;}
counter++;}
cout<<counter<<endl;}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:6: error: conflicting declaration 'char b'
    8 | char b;
      |      ^
a.cc:4:9: note: previous declaration as 'int b'
    4 | int H,W,b; cin>>H>>W;
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int H,W,a,b; cin>>H>>W;
int counter=0;
int counter1=0;
int a[H][W];
char b;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>b;
if(b=='#')
a[i][j]=1;
else
a[i][j]=0;}}
for(int k=0;k>0;k++){
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(a[i][j]==1){
counter1++;
if(i>=1){
a[i-1][j]=1;}
if(i<H){
a[i+1][j]=1;}
if(j>=1){
a[i][j-1]=1;}
if(i<W){
a[i][j+1]=1;}}
else
continue;}}
if(counter1==H*W){
break;}
counter++;}
cout<<counter<<endl;}



Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: conflicting declaration 'int a [H][W]'
    7 | int a[H][W];
      |     ^
a.cc:4:9: note: previous declaration as 'int a'
    4 | int H,W,a,b; cin>>H>>W;
      |         ^
a.cc:8:6: error: conflicting declaration 'char b'
    8 | char b;
      |      ^
a.cc:4:11: note: previous declaration as 'int b'
    4 | int H,W,a,b; cin>>H>>W;
      |           ^
a.cc:13:2: error: invalid types 'int[int]' for array subscript
   13 | a[i][j]=1;
      |  ^
a.cc:15:2: error: invalid types 'int[int]' for array subscript
   15 | a[i][j]=0;}}
      |  ^
a.cc:19:5: error: invalid types 'int[int]' for array subscript
   19 | if(a[i][j]==1){
      |     ^
a.cc:22:2: error: invalid types 'int[int]' for array subscript
   22 | a[i-1][j]=1;}
      |  ^
a.cc:24:2: error: invalid types 'int[int]' for array subscript
   24 | a[i+1][j]=1;}
      |  ^
a.cc:26:2: error: invalid types 'int[int]' for array subscript
   26 | a[i][j-1]=1;}
      |  ^
a.cc:28:2: error: invalid types 'int[int]' for array subscript
   28 | a[i][j+1]=1;}}
      |  ^
Language: C++

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

int main() {
  int h,w;
  cin >> h >> w;
  vector<vector<char>> c(h,vector<char>(w));
  rep(i,h)rep(j,w){
    cin >> c[i][j]
  }
  int now=h+w;
  int ans=0;
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  now=h+w;
  reverse(c.begin(),c.end());
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  now=h+w;
  rep(i,h){
    reverse(c[i].begin(),c[i].end());
  }
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  now=h+w;
  reverse(c.begin(),c.end());
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  
  cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: expected ';' before '}' token
   11 |     cin >> c[i][j]
      |                   ^
      |                   ;
   12 |   }
      |   ~
Language: C++

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

int main() {
  int h,w;
  cin >> h >> w;
  vector<vector<char>> c(h,vector<char>(w));
  rep(i,h)rep(j,w){
    cin >> c[i][j]
  }
  int now=h+w;
  int ans=0;
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  now=h+w;
  reverse(c.begin(),c.end());
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  now=h+w;
  rep(i,h){
    reverse(c[i].begin(),c[i].end());
  }
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  now=h+w;
  reverse(c.begin(),c.end());
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  
  cout << ans << endl;

}


Compiler output:
a.cc:4:9: warning: "rep" redefined
    4 | #define rep(j, n) for (int j = 0; j < (int)(n); j++)
      |         ^~~
a.cc:3:9: note: this is the location of the previous definition
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:12:19: error: expected ';' before '}' token
   12 |     cin >> c[i][j]
      |                   ^
      |                   ;
   13 |   }
      |   ~
Language: C++

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

int main() {
  int h,w;
  cin >> h >> w;
  char c[h][w]
  rep(i,h)rep(j,w){
    cin >> c[i][j]
  }
  int now=h+w;
  int ans=0;
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  now=h+w;
  reverse(c.begin(),c.end());
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  now=h+w;
  rep(i,h){
    reverse(c[i].begin(),c[i].end());
  }
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  now=h+w;
  reverse(c.begin(),c.end());
  rep(i,h+w-1)rep(j,h){
    if(i-j<0||i-j>h-1) continue;
    if(c[i][i-j]=='#') now = min(now,i);
    else if(now!=h+w) ans=max(ans,i-now);
  }
  
  cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:19: error: expected initializer before 'for'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                   ^~~
a.cc:10:3: note: in expansion of macro 'rep'
   10 |   rep(i,h)rep(j,w){
      |   ^~~
a.cc:10:7: error: 'i' was not declared in this scope
   10 |   rep(i,h)rep(j,w){
      |       ^
a.cc:3:35: note: in definition of macro 'rep'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
a.cc:10:15: error: 'j' was not declared in this scope
   10 |   rep(i,h)rep(j,w){
      |               ^
a.cc:3:35: note: in definition of macro 'rep'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
a.cc:17:8: error: 'c' was not declared in this scope
   17 |     if(c[i][i-j]=='#') now = min(now,i);
      |        ^
a.cc:21:11: error: 'c' was not declared in this scope
   21 |   reverse(c.begin(),c.end());
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;

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



signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int H,W;
    cin>>H>>W;
    string S[H];
    rep(i,H){
        cin>>S[i];
    }

    vector<vector<int>> dist(H,vector<int>(W,-1));
    queue<pair<int,int>> q;
    rep(i,H){
        rep(j,W){
            if(S[i][j]=='#') {
                q.push(make_pair(i,j));
                dist[i][j]=0;
        }
    }
    int ans=0;
    while ((!q.empty())){
        pair<int,int> v=q.front();
        int h=v.first;
        int w=v.second;
        q.pop();
        rep(j,4){
            int nh=h+dx[j];
            int nw=w+dy[j];
            if(nh<0||nw<0||nh>=H||nw>=W) continue;
            if(S[nh][nw]=='#') continue;
            if(dist[nh][nw]==-1){
                q.push(make_pair(nh,nw));
                dist[nh][nw]=dist[h][w]+1;
            }
        }
    }
    rep(i,H){
        rep(j,W){
            ans=max(ans,dist[i][j]);
        }
    }
    cout << ans << endl;




}


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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int h, w;
int blacks = 0;
vector<string> a;
vector<pair<int, int>> rec;
vector<pair<int, int>> st;
int dx[4] = {0, -1, 0, 1};
int dy[4] = {1, 0, -1, 0};
void bfs(int y, int x)
{
    for (ll i = 0; i < 4; i++)
    {
        int nx = x + dx[i];
        int ny = y + dy[i];
        if (nx < 0 || ny < 0 || ny >= h || nx >= w || a[ny][nx] == '#')
            continue;
        else
        {
            a[ny][nx] = '#';
            blacks++;
            rec.emplace_back(make_pair(ny, nx));
            //st.insert(make_pair(ny, nx));
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cin >> h >> w;
    for (int i = 0; i < h; i++)
    {
        string c;
        cin >> c;
        a.emplace_back(c);
    }

    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if (a[i][j] == '#')
            {
                blacks++;
                st.emplace_back(make_pair(i, j));
            }
        }
    }
    int cnt = 0;
    while (blacks != h * w)
    {
        rec.resize(0);
        for (auto v : st)
        {
            bfs(v[i].first, v[i].second);
        }
        cnt++;
        st.resize(0);
        for (int i = 0; i < rec.size(); i++)
            st.emplace_back(make_pair(rec[i].first, rec[i].second));
    }
    cout << cnt << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:19: error: 'i' was not declared in this scope
   60 |             bfs(v[i].first, v[i].second);
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  using pii = pair<int,int>;
  int H, W;
  cin >> H >> W;
  char A[H][W];
  queue<pii> que;
  int d[H][W];
  rep(i, H) {
    rep(j, W) {
      cin >> A[i][j];
      if(A[i][j]=='#') que.push(pii(i,j));
      d[i][j]=0;
    }
  }
  int dy[4]={-1,0,1,0},dy[4]={0,1,0,-1};
  int ans=0;
  while(que.size()) {
    pii p=que.front();
    que.pop();
    rep(i,4) {
      int ny=p.first+dy[i], nx=p.second+dx[i];
      if(0<=ny&&ny<H&&0<=nx&&nx<W&&A[ny][nx]=='.'&&d[ny][nx]==0) {
        que.push(pii(ny,nx));
        d[ny][nx]=d[p.first][p.second]+1;
        ans=max(ans, d[ny][nx]);
      }
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: redeclaration of 'int dy [4]'
   19 |   int dy[4]={-1,0,1,0},dy[4]={0,1,0,-1};
      |                        ^~
a.cc:19:7: note: 'int dy [4]' previously declared here
   19 |   int dy[4]={-1,0,1,0},dy[4]={0,1,0,-1};
      |       ^~
a.cc:25:41: error: 'dx' was not declared in this scope; did you mean 'nx'?
   25 |       int ny=p.first+dy[i], nx=p.second+dx[i];
      |                                         ^~
      |                                         nx
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  using pii = pair<int,int>;
  int H, W;
  cin >> H >> W;
  char A[H][W];
  queue<pii> que;
  int d[H][W];
  rep(i, H) {
    rep(j, W) {
      cin >> A[i][j];
      if(A[i][j]=='#') que.push(pii(i,j));
      d[i][j]=0;
    }
  }
  int dy[4]={-1,0,1,0],dy[4]={0,1,0,-1];
  int ans=0;
  while(que.size()) {
    pii p=que.front();
    que.pop();
    rep(i,4) {
      int ny=p.first+dy[i], nx=p.second+dx[i];
      if(0<=ny&&ny<H&&0<=nx&&nx<W&&A[ny][nx]=='.'&&d[ny][nx]==0) {
        que.push(pii(ny,nx));
        d[ny][nx]=d[p.first][p.second]+1;
        ans=max(ans, d[ny][nx]);
      }
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:22: error: expected '}' before ']' token
   19 |   int dy[4]={-1,0,1,0],dy[4]={0,1,0,-1];
      |             ~        ^
a.cc:19:22: error: expected ',' or ';' before ']' token
a.cc:34:2: error: expected '}' at end of input
   34 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll h,w;
ll blacks = 0;
vector<string> a;
ll dx[4] = {0,-1,0,1};
ll dy[4] = {1,0,-1,0};
void bfs(ll y,ll x){
    for(ll i = 0; i < 4; i++){
        ll nx = x + dx[i];
        ll ny = y + dy[i];
        if(nx < 0 || ny < 0 || nx >= h || ny >= w || a[ny][nx] == '#')
        return ;
        a[ny][nx] = "#";
        blacks++;
    }
}
int main(){
    cin >> h >> w;
    for(int i = 0; i < h; i++)
    {
        string b;
        cin >> b;
        a.emplace_back(b);
    }
    for(ll i = 0; i < h; i++){
        for(ll j = 0; j < w; j++){
            if(a[i][j] == '#')
            blacks++;
        }
    }
    ll cnt = 0;
    while(blacks < h * w){
        for(ll i = 0; i < h; i++){
            for(ll j = 0; j < w; j++){
                if(a[i][j] == '#')
                bfs(i,j);
            }
        }
        cnt++;
    }
    cout << cnt << endl;
}

Compiler output:
a.cc: In function 'void bfs(ll, ll)':
a.cc:15:21: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   15 |         a[ny][nx] = "#";
      |                     ^~~
      |                     |
      |                     const char*