criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.Scanner;

public class Main_A {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = Integer.parseInt(sc.next());
		int w = Integer.parseInt(sc.next());
		char[][] c = new char[h][w];
		// 白(.)か黒(#)かの文字列を出力し、char型の2次元配列に格納
		for(int i = 0; i < h; i++) {
			String s = sc.next();
			for(int j = 0; j < w; j++) {
				c[i][j] = s.charAt(j);
			}
		}
		int[][] dp = new int[h+1][w+1]; // 行数と列数の+1の配列を宣言
		int init = (c[0][0] == '.') ? 0 : 1; // 左上が白(.)の時に0を格納
		dp[1][1] = init; // ????
		for(int i = 1; i <= h; i++) {
			for(int j = 1; j <= w; j++) {
				int temp = (c[i-1][j-1] == '.') ? 0 : 1;
				int cw;
				int ch;
				if(i == 1 && j == 1) {
					continue;
				}
				if(i == 1) {
					cw = c[i-1][j-2] == '.' ? 0 : 1;
					if(cw == 0) {
						dp[i][j] = dp[i][j-1] + temp;
					} else {
						dp[i][j] = dp[i][j-1];
					}
				} else if(j == 1) {
					ch = c[i-2][j-1] == '.' ? 0 : 1;
					if(ch == 0) {
						dp[i][j] = dp[i-1][j] + temp;
					} else {
						dp[i][j] = dp[i-1][j];
					}
				} else {
					ch = c[i-2][j-1] == '.' ? 0 : 1;
					cw = c[i-1][j-2] == '.' ? 0 : 1;
					int temp2 = (cw == 0) ? temp : 0;
					int temp3 = (ch == 0) ? temp : 0;
					if(dp[i][j] > dp[i][j-1]) {
						dp[i][j] = dp[i-1][j] + temp;
					} else {
						dp[i][j] = Math.min(dp[i-1][j], dp[i][j-1]) + Math.min(temp2, temp3);
					}
				}
			}
		}
		System.out.println(dp[h][w]);
	}
}


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

#include <algorithm>
#include <cstdio>
#include <cstring>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

#define N 101

char grid[N][N];

int dp[N][N];

int main() {
	int h, w;
	scanf("%d%d", &h, &w);
	for(int i=0; i<h; i++)
		scanf("%s", grid[i]);
	memset(dp, 0, sizeof(dp));
	for(int i=0; i<h; i++)
		for(int j=0; j<w; j++) {
			if(i==0 and j==0) {
				dp[i][j] = (grid[i][j] == '#');
				continue;
			}
			dp[i][j] = w*h;
			if(i>0)
				dp[i][j] = min(dp[i][j], dp[i-1][j]+(grid[i][j] == '#' and grid[i-1][j] == '.'));
			if(j>0)
				dp[i][j] = min(dp[i][j], dp[i][j-1]+(grid[i][j] == '#' and grid[i][j-1] == '.'));
		}
	printf("%d\n", dp[h-1][w-1]);
	return 0;
}


Compiler output:
a.cc:18:9: error: 'vector' does not name a type
   18 | typedef vector<int> VI;
      |         ^~~~~~
Language: C++

#include <algorithm>
#include <cstdio>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

#define N 101

char grid[N][N];

int dp[N][N];

int main() {
	int h, w;
	scanf("%d%d", &h, &w);
	for(int i=0; i<h; i++)
		scanf("%s", grid[i]);
	memset(dp, 0, sizeof(dp));
	for(int i=0; i<h; i++)
		for(int j=0; j<w; j++) {
			if(i==0 and j==0) {
				dp[i][j] = (grid[i][j] == '#');
				continue;
			}
			dp[i][j] = w*h;
			if(i>0)
				dp[i][j] = min(dp[i][j], dp[i-1][j]+(grid[i][j] == '#' and grid[i-1][j] == '.'));
			if(j>0)
				dp[i][j] = min(dp[i][j], dp[i][j-1]+(grid[i][j] == '#' and grid[i][j-1] == '.'));
		}
	printf("%d\n", dp[h-1][w-1]);
	return 0;
}


Compiler output:
a.cc:17:9: error: 'vector' does not name a type
   17 | typedef vector<int> VI;
      |         ^~~~~~
a.cc: In function 'int main()':
a.cc:30:9: error: 'memset' was not declared in this scope
   30 |         memset(dp, 0, sizeof(dp));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdio>
  +++ |+#include <cstring>
    3 | #define PB push_back
Language: Java


#####

import numpy as np
# from numpy import int32, int8
# from collections import deque

#####

def getIntList(inp):
	return [int(_) for _ in inp]


from sys import stdin
import sys
sys.setrecursionlimit(10**8)

def getInputs():
	inputs=[]
	for line in stdin:
		line=line.split()
		inputs.append(line)
	return inputs



def main(inputs):
	h,w=getIntList(inputs[0])
	colors=np.empty((h,w),np.bool)
	for hi in range(h):
		for wi in range(w):
			colors[hi,wi]=inputs[1+hi][0][wi]=="."

# 	h=20
# 	w=20
# 	np.random.seed(0)
# 	colors=np.random.randint(0,2,(h,w))

# 	from matplotlib import pyplot as plt
# 	for hi in range(h):
# 		for wi in range(w):
# 			plt.annotate(str((hi,wi)), (wi-0.5,hi), color="g")
# 	plt.imshow(colors)
# 	plt.show()
			
# 	print(colors.astype(np.int32))
	
	flipSize=np.empty((h,w), np.int32)
	
	if colors[0,0]: flipSize[0,0]=0
	else: flipSize[0,0]=1
	
	for hi in range(h):
		for wi in range(w):
			if hi==0 and wi==0: continue
			c=colors[hi,wi]
			fs=[]
			if hi>0:
				d=int(colors[hi-1,wi] and (not c))
				s=flipSize[hi-1, wi]+d
				fs.append(s)
				
			if wi>0:
				d=int(colors[hi,wi-1] and (not c))
				s=flipSize[hi, wi-1]+d
				fs.append(s)
			
			fs=min(fs)
			flipSize[hi,wi]=fs
	
	print(flipSize[h-1,w-1])
	

if __name__=="__main__":
	inputs=getInputs()
# 	inputs=simInputs()
	main(inputs)



Compiler output:
Main.java:2: error: illegal character: '#'
#####
^
Main.java:2: error: illegal character: '#'
#####
 ^
Main.java:2: error: illegal character: '#'
#####
  ^
Main.java:2: error: illegal character: '#'
#####
   ^
Main.java:2: error: illegal character: '#'
#####
    ^
Main.java:4: error: class, interface, enum, or record expected
import numpy as np
       ^
Main.java:5: error: illegal character: '#'
# from numpy import int32, int8
^
Main.java:6: error: illegal character: '#'
# from collections import deque
^
Main.java:8: error: illegal character: '#'
#####
^
Main.java:8: error: illegal character: '#'
#####
 ^
Main.java:8: error: illegal character: '#'
#####
  ^
Main.java:8: error: illegal character: '#'
#####
   ^
Main.java:8: error: illegal character: '#'
#####
    ^
Main.java:34: error: illegal character: '#'
# 	h=20
^
Main.java:35: error: illegal character: '#'
# 	w=20
^
Main.java:36: error: illegal character: '#'
# 	np.random.seed(0)
^
Main.java:37: error: illegal character: '#'
# 	colors=np.random.randint(0,2,(h,w))
^
Main.java:39: error: illegal character: '#'
# 	from matplotlib import pyplot as plt
^
Main.java:40: error: illegal character: '#'
# 	for hi in range(h):
^
Main.java:41: error: illegal character: '#'
# 		for wi in range(w):
^
Main.java:42: error: illegal character: '#'
# 			plt.annotate(str((hi,wi)), (wi-0.5,hi), color="g")
^
Main.java:43: error: illegal character: '#'
# 	plt.imshow(colors)
^
Main.java:44: error: illegal character: '#'
# 	plt.show()
^
Main.java:46: error: illegal character: '#'
# 	print(colors.astype(np.int32))
^
Main.java:76: error: illegal character: '#'
# 	inputs=simInputs()
^
25 errors
Language: C++

using namespace std;
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) cin >> S[i];
  vector<vector<int> > ans(H, vector<int>(W, inf));
  ans[0][0] = S[0][0] == '#';
  rep(i, H) rep(j, W) {
    int tmp = S[i][j] == '#';
    if(i && j) {
      ans[i][j] = min(ans[i-1][j]+tmp, min(ans[i][j-1]+tmp, ans[i][j]));
    } else if(i) {
      ans[i][j] = min(ans[i-1][j]+tmp, ans[i][j]);
    } else if(j) {
      ans[i][j] = min(ans[i][j-1]+tmp, ans[i][j]);
    }
  }
  cout << ans[H-1][W-1] << endl;
  return 0;
}


Compiler output:
a.cc:3:7: error: 'll' does not name a type
    3 | const ll longinf = 1LL<<60;
      |       ^~
a.cc:4:7: error: 'll' does not name a type
    4 | const ll mod = 1e9+7;
      |       ^~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> H >> W;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<string> S(H);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:8:10: error: 'string' was not declared in this scope
    8 |   vector<string> S(H);
      |          ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:8:18: error: 'S' was not declared in this scope
    8 |   vector<string> S(H);
      |                  ^
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   rep(i, H) cin >> S[i];
      |       ^
a.cc:9:3: error: 'rep' was not declared in this scope
    9 |   rep(i, H) cin >> S[i];
      |   ^~~
a.cc:10:17: error: expected primary-expression before 'int'
   10 |   vector<vector<int> > ans(H, vector<int>(W, inf));
      |                 ^~~
a.cc:11:3: error: 'ans' was not declared in this scope
   11 |   ans[0][0] = S[0][0] == '#';
      |   ^~~
a.cc:22:3: error: 'cout' was not declared in this scope
   22 |   cout << ans[H-1][W-1] << endl;
      |   ^~~~
a.cc:22:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:22:28: error: 'endl' was not declared in this scope
   22 |   cout << ans[H-1][W-1] << endl;
      |                            ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
#define rep(i,s,t) for(ll i=s ; i<t ; i++)
typedef pair<ll,ll> P;
const int max_n = 1e5;
const ll mod = 1e9+7;
map<ll,ll> prime_factor(ll n){
  map<ll,ll> ma;
  rep(i,2,n+1){
    while(n%i == 0){
      ma[i]++;
      n /= i;
    }
  }
  if(n != 1) ma[n]=1;
  return ma;
}
int main(){
  #include <bits/stdc++.h>
  using namespace std;
  #define fi first
  #define se second
  typedef long long ll;
  typedef long double ld;
  #define rep(i,s,t) for(ll i=s ; i<t ; i++)
  typedef pair<int,int> P;
  typedef pair<int,P> pp;
  const int INF = 1e5;
  const ll mod = 1e9+7;
  map<ll,ll> prime_factor(ll n){
    map<ll,ll> ma;
    rep(i,2,n+1){
      while(n%i == 0){
        ma[i]++;
        n /= i;
      }
    }
    if(n != 1) ma[n]=1;
    return ma;
  }
  int dx[2] = {0,1};
  int dy[2] = {1,0};
  int main(){
    int h,w;
    cin >> h >> w;
    char s[h][w];
    rep(i,0,h)rep(j,0,w){
      cin >> s[i][j];
    }

    priority_queue<pp,vector<pp>,greater<pp> > que;
    int cnt[h][w];
    rep(i,0,h)rep(j,0,w){
      cnt[i][j] = INF;
    }
    cnt[0][0] = 0;
    if(s[0][0]=='#'){
      cnt[0][0]++;
      s[0][0] = '.';
    }
    rep(i,1,w){
      if(s[0][i]=='.') cnt[0][i] = cnt[0][i-1];
      else cnt[0][i] = cnt[0][i-1] + 1;
    }
    rep(i,1,h){
      cnt[i][0] = cnt[i-1][0];
      if(s[i][0]=='#') cnt[i][0]++;
    }

    int i=1, j=1;
    while(i<h && j<w){
      rep(jj,i,w){
        cnt[i][jj] = min(cnt[i-1][jj], cnt[i][jj-1]);
        if(s[i][jj]=='#') cnt[i][jj]++;
      }
      rep(jj,j,h){
        cnt[jj][j] = min(cnt[jj-1][j], cnt[jj][j-1]);
        if(s[jj][j]=='#') cnt[jj][j]++;
      }
      i++;  j++;
    }
    cout << cnt[h-1][w-1] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:32: error: a function-definition is not allowed here before '{' token
   33 |   map<ll,ll> prime_factor(ll n){
      |                                ^
a.cc:46:11: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   46 |   int main(){
      |           ^~
a.cc:46:11: note: remove parentheses to default-initialize a variable
   46 |   int main(){
      |           ^~
      |           --
a.cc:46:11: note: or replace parentheses with braces to value-initialize a variable
a.cc:46:13: error: a function-definition is not allowed here before '{' token
   46 |   int main(){
      |             ^
a.cc:87:2: error: expected '}' at end of input
   87 | }
      |  ^
a.cc:21:11: note: to match this '{'
   21 | int main(){
      |           ^
Language: C++

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

const int M = 998244353;
const int N = 1e5+7;
const long long B = 1000000000000000000;
typedef long long LL;

LL pb[N];
void pre() {
    pb[0] = 1;
    LL b = B%M;
    for (int i=1; i<N; i++)
        pb[i] = (pb[i-1]*b)%M;
}

vector<int> bfs(vector<vector<int>>adj) {
    int n = adj.size()-1;
    vector<int> col(n+1, N);

    vector<bool> vis(n);
    for (int i=n; i>0; i--) {
        for (int v: adj[i]) {
            if (v > i)    vis[col[v]] = 1;
        }

        for (int ii=0; ii<=n; ii++)
            if (!vis[ii]) {
                col[i] = ii;
                break;
            }

        for (int v: adj[i]) {
            if (v > i)    vis[col[v]] = 0;
        }
    }
    return col;
}

int m[3];
vector<vector<int>> adj[3];
vector<int> dis[3];
vector<LL> con[3];

LL power(LL a, LL p) {
    if (p == 0) return 1;
    LL ans = power(a, p/2);
    ans = (ans * ans)%M;
    if (p%2)    ans = (ans * a)%M;
    return ans;
}

void FWHT(vector< LL >&p, bool inverse) {
    int n = p.size();
    assert((n&(n-1))==0);

    for (int len = 1; 2*len <= n; len <<= 1) {
        for (int i = 0; i < n; i += len+len) {
            for (int j = 0; j < len; j++) {
                LL u = p[i+j];
                LL v = p[i+len+j];
                p[i+j] = u+v;
                if (p[i+j] >= M)    p[i+j] -= M;
                p[i+len+j] = u-v;
                of (p[i+len+j] < 0) p[i+len+j] += M;
            }
        }
    }
    if (inverse) {
        LL inv = power(n, M-2);
        for (int i = 0; i < n; i++) {
            p[i] = (p[i] * inv)%M;
        }
    }
}

int main() {
    pre();

    int n;
    cin>>n;
    const int MX = 1<<17;

    for (int g=0; g<3; g++) {
        cin>>m[g];
        adj[g].resize(n+1);
        for (int i=0; i<m[g]; i++) {
            int u, v;
            cin>>u>>v;
            adj[g][u].push_back(v);
            adj[g][v].push_back(u);
        }
        dis[g] = bfs(adj[g]);

        con[g].resize(MX);
        for (int i=1; i<=n; i++) {
            con[g][dis[g][i]] = (con[g][dis[g][i]] + pb[i])%M;
        }
    }

    vector<LL> ans(MX,1);
    for (int g=0; g<3; g++) {
        FWHT(con[g], false);
        for (int i=0; i<MX; i++)
            ans[i] = (ans[i] * con[g][i])%M;
    }

    FWHT(ans, true);
    cout<<ans[0]<<endl;
}


Compiler output:
a.cc: In function 'void FWHT(std::vector<long long int>&, bool)':
a.cc:65:17: error: 'of' was not declared in this scope
   65 |                 of (p[i+len+j] < 0) p[i+len+j] += M;
      |                 ^~
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//order_of_key(x) : number of items less than x
//find_by_order(x) : iterator to x

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi                  3.14159265359
ll INF=1e18+10;
ll MOD=998244353;
ll mod=1e9+7;

const int N=105;
char a[N][N];

int main()
{
    fastio;
    int n,m;cin>>n>>m;
    ll dp[N][N];

    rep(i,0,N)rep(j,0,N)a[i][j]='#';
    a[0][1]=a[1][0]='.';
    rep(i,1,n+1)rep(j,1,m+1)cin>>a[i][j];

    rep(i,0,N)rep(j,0,N)dp[i][j]=dp[i][j]=1e9;
    dp[1][0]=dp[0][1]=0;

    rep(i,1,n+1)
    {
        rep(j,1,m+1)
        {
            if(a[i][j]=='#')
                dp[i][j]=min(dp[i][j-1] (a[i][j-1]=='.'),dp[i-1][j] + (a[i-1][j]=='.'));
            else
                dp[i][j]=min(dp[i-1][j],dp[i][j-1]);
        }
    }
    cout<<dp[n][m];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:41: error: expression cannot be used as a function
   45 |                 dp[i][j]=min(dp[i][j-1] (a[i][j-1]=='.'),dp[i-1][j] + (a[i-1][j]=='.'));
      |                              ~~~~~~~~~~~^~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>

#define _fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pi acos(-1)
#define MAXS 100000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back

using namespace std;
typedef long long ll;

ll tc,ro,co,dp[105][105][10005],ans;
string grid[105];

ll fun(ll x, ll y, ll cnt){

    if(x==(ro-1) && y==(co-1)){
        if(grid[x][y]=='#')cnt++;
        return cnt;
    }
    if(x==ro || y==co) return LONG_MAX;

    if(dp[x][y][cnt]!=-1)return dp[x][y][cnt];


    ll f=LONG_MAX;

    if(grid[x][y]=='.'){
        f = min(f,fun(x, y+1, cnt), fun(x+1, y, cnt));
    }
    else{
        f = min(f,(fun(x, y+1, cnt+1),fun(x+1, y, cnt+1));
    }
    return dp[x][y][cnt]=f;
}

void solve(){

    cin>>ro>>co;
    for(int i=0; i<ro; i++)cin>>grid[i];

    memset(dp,-1,sizeof(dp));
    ans=fun(0,0,0);
    cout<<ans<<endl;

    return;

}

int main()
{

    _fastIO;

    //cin>>tc; while(tc--)
    solve();

    return 0;
}


Compiler output:
a.cc: In function 'll fun(ll, ll, ll)':
a.cc:33:58: error: expected ')' before ';' token
   33 |         f = min(f,(fun(x, y+1, cnt+1),fun(x+1, y, cnt+1));
      |                ~                                         ^
      |                                                          )
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:30:16:   required from here
   30 |         f = min(f,fun(x, y+1, cnt), fun(x+1, y, cnt));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

import copy
n,m=map(int,input().split())
l=[]
for i in range(n):
    s=list(input())
    l.append(s)
flag=0
s=copy.deepcopy(l)
#print(l)
if(l[0][0]=="#"):
    l[0][0]=1 
else:
    l[0][0]=0;
for i in range(1,n):
    if(l[i][0]=="#"):
        if s[i-1][0]=="#":
            l[i][0]=l[i-1][0]
        else:
            l[i][0]=l[i-1][0]+1
            
    else:
        l[i][0]=l[i-1][0]
for i in range(1,m):
    if( l[0][i]=="#"):
        if s[0][i-1]=="#":
            l[0][i]=l[0][i-1]
        else:
            l[0][i]=l[0][i-1]+1
    else:
        l[0][i]=l[0][i-1]

for i in range(1,n):
    for j in range(1,m):
        if(l[i][j]=="#"):
            a1=s[i][j-1]
            a2=s[i-1][j]
            if a1==".":
                l[i][j-1]+=1
            if a2==".":
                l[i-1][j]+=1 
            l[i][j]=min(l[i-1][j],l[i][j-1])
        else:
            l[i][j]=min(l[i-1][j],l[i][j-1])
#print(l)
print(l[n-1][m-1])
            
    
            
            
            

Compiler output:
a.cc:9:2: error: invalid preprocessing directive #print
    9 | #print(l)
      |  ^~~~~
a.cc:44:2: error: invalid preprocessing directive #print
   44 | #print(l)
      |  ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import copy
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:14:1: error: expected unqualified-id before 'for'
   14 | for i in range(1,n):
      | ^~~
Language: Java

import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int h = sc.nextInt();
      int w = sc.nextInt();
      char[][] grid = new char[h][w];
      for(int i = 0; i < h; i++)
        grid[i] = sc.next().toCharArray();
      
      int[][] cnt = new int[h][w];
      if(grid[0][0] == '#')
        cnt[0][0] = 1;
      
      for(int i = 1; i < w; i++) {
        if(grid[0][i] == '.')
          cnt[0][i] = cnt[0][i-1];
        else {
          if(grid[0][i-1] == '#')
            cnt[0][i] = cnt[0][i-1];
          else
            cnt[0][i] = cnt[0][i-1] + 1;
        }
      }

      for(int i = 1; i < h; i++) {
        grid[i][0] = grid[i-1][0];
        if (cnt[i-1][j] == '.' && cnt[i][j] == '#')
        	grid[i][0]++;
      }

      for(int i = 1; i < h; i++) {
        for(int j = 1; j < w; j++) {
          if(grid[i][j] == '.') {
            cnt[i][j] = Math.min(cnt[i-1][j], cnt[i][j-1]);
          } else {
            int up = cnt[i-1][j];
            if(grid[i-1][j] == '.')
              up++;
            int left = cnt[i][j-1];
            if(grid[i][j-1] == '.')
              left++;
            cnt[i][j] = Math.min(up, left);
          }
        }
      }

      System.out.println(cnt[h-1][w-1]);
  }
}

Compiler output:
Main.java:29: error: cannot find symbol
        if (cnt[i-1][j] == '.' && cnt[i][j] == '#')
                     ^
  symbol:   variable j
  location: class Main
Main.java:29: error: cannot find symbol
        if (cnt[i-1][j] == '.' && cnt[i][j] == '#')
                                         ^
  symbol:   variable j
  location: class Main
2 errors
Language: Java


// Problem : A - Range Flip Find Route
// Contest : AtCoder Grand Contest 043
// URL : https://atcoder.jp/contests/agc043/tasks/agc043_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

import java.io.*;
import java.util.*;

public class a {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		Task solver = new Task();
		//int t = scan.nextInt();
		int t = 1;
		for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
		out.close();
	}

	static class Task {

		public void solve(int testNumber, FastReader sc, PrintWriter pw) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			int[][] grid = new int[n][m];
			for(int i=0;i<n;i++){
				String str = sc.nextLine();
				for(int j=0;j<m;j++){
					grid[i][j]=str.charAt(j)=='.'?0:1;
				}
			}
			int[][] bfs = new int[n][m];
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					bfs[i][j]=100000;
				}
			}
			bfs[0][0]=0;
			if(grid[0][0]==1)bfs[0][0]++;
			
			int[] q = new int[1000000];
			int qpt = 1;
			int qpo = 0;
			while(qpo<qpt){
				int pop = q[qpo++];
				int x = pop/1000;
				int y = pop%1000;
				//pw.println(x+" "+y);
				if(y<m-1&&bfs[x][y]+(grid[x][y+1]*(1-grid[x][y]))<bfs[x][y+1]){
					q[qpt++]=pop+1;
					bfs[x][y+1]=bfs[x][y]+(grid[x][y+1]*(1-grid[x][y]));
					//pw.println(1+" "+x+" "+y+" " +(grid[x][y+1]*(1-grid[x][y])));
				}
				if(x<n-1&&bfs[x][y]+(grid[x+1][y]*(1-grid[x][y]))<bfs[x+1][y]){
					q[qpt++]=pop+1000;
					bfs[x+1][y]=bfs[x][y]+(grid[x+1][y]*(1-grid[x][y]));
					//pw.println(2+" "+x+" "+y+" "+(grid[x+1][y]*(1-grid[x][y])));
				}
				
			}
			for(int[] x : bfs){
				//pw.println(Arrays.toString(x));
			}
			pw.println(bfs[n-1][m-1]);
		}
	}

	static void shuffle(int[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			int temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static void shuffle(long[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			long temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastReader(String s) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(new File(s)));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}

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

#include <bits/stdc++.h>
using namespace std;
// define #Asukaminato is cute
#define ll long long
#define rep(i, m) for (int i = 0; i < (int)(m); i++)
const int inf = 1000000000; // 10^9 Ten to the power of nine.


int main(){
	int H,W,M[102][102]={0};
	bool A[102][102]={0};
	char s;
	cin>>H>>W;
	for(size_t i=0;i<=H+1;i++)for(size_t j=0;j<=W+1;j++){
		if(i==0||i==H+1||j==0||j==W+1)M[i][j]=H*W;
		else{
			cin>>s;
			A[i][j]= (s!='#');
			if(i==1&&j==1){M[i][j]=!A[i][j];}
			else M[i][j]=min(M[i-1][j]+(A[i-1][j]&&!A[i][j]),M[i][j-1]+(A[i][j-1]&&!A[i][j]));
		}
	}
	cout<<M[H][W]<<endl;
	return 0;
}

}

Compiler output:
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
Language: C++

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

#define DEBUG (0)
char t_array[100][100] = {'x'};
int getmin(int tmph,int tmpw, int H, int W);

int main(void)
{
  int H,W = 0;
  cin >> H >> W;
  int result = 0;
  
//  char array[H][W] = {"x"};
  for(int i = 0; i < H;i++){
    for(int j = 0; j < W; j++){
      cin >> t_array[i][j];
    }
  }
  
#if 0
  for(int i = 0; i < H;i++){
    for(int j = 0; j < W; j++){
      printf("array[%d][%d]:%c  ",i,j,t_array[i][j]);
    }
    printf("\n");
  }
  
#endif
  result = getmin(H,W,H,W);
  
  cout << result << endl;
}

/* #の最小数を取得 */
int getmin(int tmph, int tmpw, int H, int W){
  int ret = 0;
  
  /* 最下行の＃の数 */
  if(tmph == 1){
    for(int i = tmpw - 1; i < W; i++){
      if(t_array[tmph][i]=='#'){
        ret++;
      }
    }
#if DEBUG
    cout << "tmph:" << tmph << " tmpw:" << tmpw << " ret:" <<ret << endl;
    cout << "test1" << endl;
#endif
    return ret;
  }
  
  /* 最右列の#の数 */
  if(tmpw == 1){
    for(int i = tmph - 1; i < H; i++){
      if(t_array[i][tmpw]=='#'){
        ret++;
      }
    }
#if DEBUG
    cout << "tmph:" << tmph << " tmpw:" << tmpw << " ret:" <<ret << endl;
    cout << "test2" << endl;
#endif
    return ret;
  }

  /* 2*2以上の場合は再起呼び出し */
  if(getmin(tmph - 1,tmpw, H, W) > getmin(tmph, tmpw - 1, H, W)){
#if DEBUG
    cout << "tmph:" << tmph << " tmpw:" << tmpw << " ret:" <<ret << endl;
    cout << "test3" << endl;
#endif
    if(t_array[tmph][tmpw] = '#'){
      ret1 += getmin(tmph - 1, tmpw, H, W) + 1;
    }else{
      ret1 += getmin(tmph - 1, tmpw, H, W);
    }
  }else{
#if DEBUG
    cout << "tmph:" << tmph << " tmpw:" << tmpw << " ret:" <<ret << endl;
    cout << "test4" << endl;
#endif
    if(t_array[tmph][tmpw] = '#'){
      ret2 += getmin(tmph, tmpw - 1, H, W) + 1;
    }else{
      ret2 += getmin(tmph, tmpw - 1, H, W);
    }
  }

  if(ret1 > ret2){
    ret = ret2;
  }else{
    ret = ret1;
  }
  return ret;
}

Compiler output:
a.cc: In function 'int getmin(int, int, int, int)':
a.cc:74:7: error: 'ret1' was not declared in this scope; did you mean 'ret'?
   74 |       ret1 += getmin(tmph - 1, tmpw, H, W) + 1;
      |       ^~~~
      |       ret
a.cc:76:7: error: 'ret1' was not declared in this scope; did you mean 'ret'?
   76 |       ret1 += getmin(tmph - 1, tmpw, H, W);
      |       ^~~~
      |       ret
a.cc:84:7: error: 'ret2' was not declared in this scope; did you mean 'ret'?
   84 |       ret2 += getmin(tmph, tmpw - 1, H, W) + 1;
      |       ^~~~
      |       ret
a.cc:86:7: error: 'ret2' was not declared in this scope; did you mean 'ret'?
   86 |       ret2 += getmin(tmph, tmpw - 1, H, W);
      |       ^~~~
      |       ret
a.cc:90:6: error: 'ret1' was not declared in this scope; did you mean 'ret'?
   90 |   if(ret1 > ret2){
      |      ^~~~
      |      ret
a.cc:90:13: error: 'ret2' was not declared in this scope; did you mean 'ret'?
   90 |   if(ret1 > ret2){
      |             ^~~~
      |             ret
Language: C++

#include <bits/stdc++.h>
using namespace std;
int d(int n,int d){
    return (n/(int)pow(10,d-1))%10;
}
int main(){
    int H,W;
    cin>>H>>W;
    
    // 入力の受け取り
    vector<string> grid(H);
    for(int i=0;i<H;++i)cin>>grid[i];
    
    // 移動コストの計算
    vector<vector<int>> node(H,vector<int>(W));
    node[0][0]=0;
    
    // 横方向一列コスト
    {
        for(int j=1;j<W;++j){
            node[0][j]=node[0][j-1]+(grid[0][j-1]!=grid[0][j]);
        }
    }
    // 縦方向一列コスト
    {
        for(int i=1;i<H;++i){
            node[i][0]=node[i-1][0]+(grid[i-1][0]!=grid[i][0]);
        }
    }
    
    for(int i=1;i<H;++i){
        for(int j=1;j<W;++j){
            node[i][j]=min(
                node[i][j-1]+(grid[i][j-1]!=grid[i][j]),
                node[i-1][j]+(grid[i-1][j]!=grid[i][j])
            );
        }
    }
    
    int goalcost=node[H-1][W-1];
    if(grid[0][0]=="#")++goalcost;
    if(grid[0][1]=="#")++goalcost;
    goalcost/=2;
    cout<<goalcost<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   41 |     if(grid[0][0]=="#")++goalcost;
a.cc:42:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   42 |     if(grid[0][1]=="#")++goalcost;
Language: C++

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

int s[100][100];
char c;

int main(){
    int H,W;
    cin>>H>>W;
    rep(i,H)rep(j,W){
        cin>>c;
        s[i][j]=(c=='#')1:0;  
    }
    int count=0;
    rep(i,H)rep(j,W){
        if(s[i][j]==1)count++;
    }
    cout<<H+W-1<<endl;



    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: expected ';' before numeric constant
   16 |         s[i][j]=(c=='#')1:0;
      |                         ^
      |                         ;
Language: C++

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

int main(){
    int h,w,ans(0),m(0),a(0),b(0),c,d;
    bool t(false);

    cin >> h >> w;

    char s[h][w];
    rep(i,h){
        rep(j,w){
            cin >> s[i][j];
            if(s[i][j]=='.')
                m++;
        }
    }

    if(s[0][0]=='#'){
        ans++;
    }
    if(s[h][w]=='.'){
        ans++;
    }

    if(m<(h-1+w-1)){

    }

    while(true){
        if(s[a+1][b]=='.'&&s[a][b+1]=='.'){
            c = a;  d = b+1;
            t = true;
            a++;
        }
        if(s[a+1][b]=='#'&&s[a][b+1]=='#'){
            if(t==true){
                a = c;  b = d;
                t = false;
            }else{
                
            }
        }
        if()
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:12: error: expected primary-expression before ')' token
   45 |         if()
      |            ^
a.cc:46:5: error: expected primary-expression before '}' token
   46 |     }
      |     ^
Language: C++

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

int minCost(int cost[R][C], int m, int n) 
{ 
   if (n < 0 || m < 0) 
      return INT_MAX; 
   else if (m == 0 && n == 0) 
      return cost[m][n]; 
   else
      return cost[m][n] + min( minCost(cost, m-1, n-1), 
                               minCost(cost, m-1, n),  
                               minCost(cost, m, n-1) ); 
} 

int main(){
	int n,m;
  cin>>n>>m;
  char arr[n][m];
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++)	cin>>arr[i][j];
  }
  int ar[n][m];
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
    	if(arr[i][j] == '#')	ar[i][j] = 1;
      	else ar[i][j] = 0;
    }
  }
  cout<<minCost(ar,m,n);
  return 0;
}

Compiler output:
a.cc:4:22: error: 'R' was not declared in this scope
    4 | int minCost(int cost[R][C], int m, int n)
      |                      ^
a.cc:4:25: error: 'C' was not declared in this scope
    4 | int minCost(int cost[R][C], int m, int n)
      |                         ^
a.cc:4:27: error: expected ')' before ',' token
    4 | int minCost(int cost[R][C], int m, int n)
      |            ~              ^
      |                           )
a.cc:4:29: error: expected unqualified-id before 'int'
    4 | int minCost(int cost[R][C], int m, int n)
      |                             ^~~
Language: C++

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

int a[100][100];
std::vector<int> result;
int H, W;
int save_min;

void dfs(int x, int y, int touch)
{
        if (a[y][x] == 1) {
                touch++;
                if (save_min != -1 && touch >= save_min) return;
        }
        else if (a[y][x] == -1) return;
        if (y == H -1 && x == W - 1) {
                result.push_back(touch);
                if (save_min == -1) {
                        save_min = touch;
                else if (save_min > touch) save_min = touch;
                if (touch == 0) {
                        cout << 0 << endl;
                        exit(0);
                }
                return;
        }
        for (int i = 0; i < 2; ++i) {
                if (i == 0) { // right
                        if (a[y][x+1] == -1) continue;
                        if (a[y][x+1] == 1 && a[y+1][x] == 0) continue;
                        dfs(x+1, y, touch);
                }
                else { // down
                        if (a[y+1][x] == -1) continue;
                        dfs(x, y+1, touch);
                }
        }
}
int main()
{
        cin >> H >> W;
        for (int i = 0; i < 100; ++i) {
                for (int j = 0; j < 100; ++j) {
                        a[i][j] = -1;
                }
        }
        for (int i = 0; i < H; ++i) {
                std::string s;
                cin >> s;
                for (int j = 0; j < W; ++j) {
                        a[i][j] = s[j] == '.' ? 0 : 1;
                }
        }
        save_min = -1;
        dfs(0, 0, 0);
        int cnt = result.size();
        int min = -1;
        for (int i = 0; i < cnt; ++i) {
                if (min == -1) {
                        min = result[i];
                }
                else if (min > result[i]) {
                        min = result[i];
                }
        }
        cout << min << endl;
}


Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:20:17: error: expected '}' before 'else'
   20 |                 else if (save_min > touch) save_min = touch;
      |                 ^~~~
a.cc:18:37: note: to match this '{'
   18 |                 if (save_min == -1) {
      |                                     ^
Language: C++

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> data(H, vector<char>(W));
  vector<vector<int>> data = {
  };

  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:23: error: conflicting declaration 'std::vector<std::vector<int> > data'
    8 |   vector<vector<int>> data = {
      |                       ^~~~
a.cc:7:24: note: previous declaration as 'std::vector<std::vector<char> > data'
    7 |   vector<vector<char>> data(H, vector<char>(W));
      |                        ^~~~
Language: Java

import javafx.scene.layout.Priority;

import java.util.*;

public class Main {
    static int[][] mp;
    static int H, W;
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        H = sc.nextInt();
        W = sc.nextInt();
        mp = new int[H][];
        Set<Integer> visited = new HashSet<>();
        for(int i=0;i<H;i++){
            String s = sc.next();
            mp[i] = new int[W];
            char[] sca = s.toCharArray();
            for(int j=0;j<W;j++)
                mp[i][j] = sca[j] == '#' ? 1 : 0;
        }
        PriorityQueue<State> pq = new PriorityQueue<>(Comparator.comparingInt(obj->obj.fc));
        pq.add(new State(0,0,0, mp[0][0]));
        int first = mp[0][0];
        while(!pq.isEmpty()){
            State st = pq.poll();
            if(st.y==H-1 && st.x==W-1){
                System.out.println(st.fc + first);
                return;
            }
            if(st.y+1 < H){
                int add=0;
                if(st.isBlk==0 && mp[st.y+1][st.x]==1)
                    add=1;
                pq.add(new State(st.x, st.y + 1, st.fc+add, mp[st.y + 1][st.x]));
            }
            if(st.x+1 < W){
                int add=0;
                if(st.isBlk == 0 && mp[st.y][st.x+1] == 1)
                    add=1;
                pq.add(new State(st.x+1, st.y, st.fc + add, mp[st.y][st.x+1]));
            }
        }

    }
    private static int key(int h, int w){
        return h*100+w;
    }

    private static class State{
        int x,y;
        int fc;
        int isBlk;
        State(int x, int y, int fc, int isBlk){
            this.x = x;
            this.y = y;
            this.fc = fc;
            this.isBlk = isBlk;
        }
    }
}


Compiler output:
Main.java:1: error: package javafx.scene.layout does not exist
import javafx.scene.layout.Priority;
                          ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
#define rep(i,s,t) for(ll i=s ; i<t ; i++)
typedef pair<int,int> P;
const int INF = 1e5;
const ll mod = 1e9+7;
map<ll,ll> prime_factor(ll n){
  map<ll,ll> ma;
  rep(i,2,n+1){
    while(n%i == 0){
      ma[i]++;
      n /= i;
    }
  }
  if(n != 1) ma[n]=1;
  return ma;
}
int dx[2] = {0,1};
int dy[2] = {1,0};
int main(){
  int h,w;
  cin >> h >> w;
  char s[h][w];
  rep(i,0,h)rep(j,0,w){
    cin >> s[i][j];
  }
  queue<P> que;
  que.push(P(0,0));
  d[0][0] = 0;
  int cnt[h][w];
  rep(i,0,h)rep(j,0,w){
    cnt[i][j] = INF;
  }
  cnt[0][0] = 0;
  if(s[0][0]=='#'){
    cnt[0][0]++;
    s[0][0] = '.';
  }
  int i =0;
  map<pair<P,P>,int> ma;
  while(que.size()){
    P p = que.front();  que.pop();
    //if(p.fi==h-1 && p.se == w-1);
    rep(i,0,2){
      int nx = p.fi + dx[i];
      int ny = p.se + dy[i];
      P ss = P(p.fi,p.se);
      P t = P(nx,ny);
      if(nx>=0 && ny>=0 && nx<h && ny<w){

        if(s[nx][ny]=='.'){
          //if(cnt[nx][ny]!=0)
            //cnt[nx][ny] = min(cnt[nx][ny],cnt[p.fi][p.se]);
          //else cnt[nx][ny] = min(cnt[p.fi][p.se],cnt[p.fi][p.se]);
          cnt[nx][ny] = min(cnt[nx][ny], cnt[p.fi][p.se]);
        }else{
          /*if(cnt[nx][ny]!=0 && cnt[p.fi][p.se]!=0){
            cnt[nx][ny] = min(cnt[nx][ny],cnt[p.fi][p.se]+1);
          }else{
            cnt[nx][ny] = cnt[p.fi][p.se] + 1;
          }*/
          cnt[nx][ny] = min(cnt[nx][ny], cnt[p.fi][p.se]+1);
        }
        que.push(P(nx,ny));
      }
    }
    }
    cout << cnt[h-1][w-1] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:3: error: 'd' was not declared in this scope
   33 |   d[0][0] = 0;
      |   ^
Language: C++

#include <stdio.h>
 
//深さ優先探索
void deep_ser(int, int,int [10000][100],int ,int,int);
 
int ans=10000;
 
int main() {
	int H, W;
	int i,j;
	char c;
	int a[10000][100];
	scanf("%d %d", &H, &W);
	getchar();
	for (i = 0; i < H; i++) {
		for (j = 0; j < W; j++) {
			scanf("%c", &c);
			if (c == '#')a[i][j] = 1;
			else a[i][j] = 0;
		}
		getchar();
	}
	deep_ser(0, 0, a, H, W, 0);
	printf("%d", ans);
	return 0;
}
 
void deep_ser(int x, int y,int a[10000][100],int H,int W,int count) {
	int ser;
	int ser_count = count;
	if (a[y][x] == 1)ser_count++;
	if (x == W - 1 && y == H - 1) {
		if (ser_count < ans)ans = ser_count;
	}
    else if(count>ans){
	else if (x == W - 1)deep_ser(x, y + 1, a, H, W, ser_count);
	else if(y==H-1)deep_ser(x+1, y, a, H, W, ser_count);
	else {
		deep_ser(x, y + 1, a, H, W, ser_count);
		deep_ser(x + 1, y, a, H, W, ser_count);
	}
    }
}

Compiler output:
a.cc: In function 'void deep_ser(int, int, int (*)[100], int, int, int)':
a.cc:36:9: error: expected '}' before 'else'
   36 |         else if (x == W - 1)deep_ser(x, y + 1, a, H, W, ser_count);
      |         ^~~~
a.cc:35:23: note: to match this '{'
   35 |     else if(count>ans){
      |                       ^
a.cc: At global scope:
a.cc:43:1: error: expected declaration before '}' token
   43 | }
      | ^
Language: C++

#include <stdio.h>
 
//深さ優先探索
void deep_ser(int, int,int [10000][100],int ,int,int);
 
int ans=10000;
 
int main() {
	int H, W;
	int i,j;
	char c;
	int a[10000][100];
	scanf("%d %d", &H, &W);
	getchar();
	for (i = 0; i < H; i++) {
		for (j = 0; j < W; j++) {
			scanf("%c", &c);
			if (c == '#')a[i][j] = 1;
			else a[i][j] = 0;
		}
		getchar();
	}
	deep_ser(0, 0, a, H, W, 0);
	printf("%d", ans);
	return 0;
}
 
void deep_ser(int x, int y,int a[10000][100],int H,int W,int count) {
	int ser;
	int ser_count = count;
	if (a[y][x] == 1)ser_count++;
	if (x == W - 1 && y == H - 1) {
		if (ser_count < ans)ans = ser_count;
	}
  else if(count>ans)
	else if (x == W - 1)deep_ser(x, y + 1, a, H, W, ser_count);
	else if(y==H-1)deep_ser(x+1, y, a, H, W, ser_count);
	else {
		deep_ser(x, y + 1, a, H, W, ser_count);
		deep_ser(x + 1, y, a, H, W, ser_count);
	}
}

Compiler output:
a.cc: In function 'void deep_ser(int, int, int (*)[100], int, int, int)':
a.cc:36:9: error: expected primary-expression before 'else'
   36 |         else if (x == W - 1)deep_ser(x, y + 1, a, H, W, ser_count);
      |         ^~~~
Language: C++

#include <stdio.h>
 
//深さ優先探索
void deep_ser(int, int,int [10000][100],int ,int,int);
 
int ans=10000;
 
int main() {
	int H, W;
	int i,j;
	char c;
	int a[10000][100];
	scanf("%d %d", &H, &W);
	getchar();
	for (i = 0; i < H; i++) {
		for (j = 0; j < W; j++) {
			scanf("%c", &c);
			if (c == '#')a[i][j] = 1;
			else a[i][j] = 0;
		}
		getchar();
	}
	deep_ser(0, 0, a, H, W, 0);
	printf("%d", ans);
	return 0;
}
 
void deep_ser(int x, int y,int a[10000][100],int H,int W,int count) {
	int ser;
	int ser_count = count;
	if (a[y][x] == 1)ser_count++;
	if (x == W - 1 && y == H - 1) {
		if (ser_count < ans)ans = ser_count;
	}
  else if(count>ans)break;
	else if (x == W - 1)deep_ser(x, y + 1, a, H, W, ser_count);
	else if(y==H-1)deep_ser(x+1, y, a, H, W, ser_count);
	else {
		deep_ser(x, y + 1, a, H, W, ser_count);
		deep_ser(x + 1, y, a, H, W, ser_count);
	}
}

Compiler output:
a.cc: In function 'void deep_ser(int, int, int (*)[100], int, int, int)':
a.cc:35:21: error: break statement not within loop or switch
   35 |   else if(count>ans)break;
      |                     ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

bool endFlag = false;
int H, W;
void searchArea(vector<vector<char>>&, vector<int>&, int, int, int, int&);

int main()
{
	char input;
	int sx = 0, sy = 0;
	int count = 0, min = 500;
	vector<int> counter;
	cin >> H >> W;
	vector<vector<char>> board(H,vector<char>(W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> input;
			board[i][j] = input;
		}
	}
	searchArea(board, counter, sx, sy, count, min);
	sort(counter.begin(), counter.end());
	cout << counter[0] << endl;
}

void searchArea(const vector<vector<char>>& board, vector<int>& counter, int sx, int sy, int count, int& min) {
	int dx[2] = { 1,0 };
	int dy[2] = { 0,1 };
	if (min <= count) {
		return;
	}
	if (sx == W - 1 && sy == H - 1) {	
		if (board[sy][sx] == '#') {
			count++;
		}
		if (min > count) {
			min = count;
		}
		counter.emplace_back(count);
		return;
	}
	if (sx == W || sy == H) {
		return;
	}
	for (int i = 0; i < 2; i++) {
		if (board[sy][sx] == '.') {
			searchArea(board, counter, sx + dx[i], sy + dy[i], count, min);
		}
		else {
			count++;
			searchArea(board, counter, sx + dx[i], sy + dy[i], count, min);
		}
	}
}

Compiler output:
/usr/bin/ld: /tmp/ccbfVkOo.o: in function `main':
a.cc:(.text+0x171): undefined reference to `searchArea(std::vector<std::vector<char, std::allocator<char> >, std::allocator<std::vector<char, std::allocator<char> > > >&, std::vector<int, std::allocator<int> >&, int, int, int, int&)'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W,count = 0,count2 = 0;
  char coror;
  cin >> H >> W;
  vector<vector<char>> board(H+2, vector<char>(W+2));
  vector<vector<char>> board2(H+2, vector<char>(W+2));
  for (int i = 1; i < H+1; i++) {
    for (int j = 1; j < W+1; j++) {
      cin >> board.at(i).at(j);
      board2.at(i).at(j)=board.at(i).at(j);
     }
  }
  int i=1,j=1;
   while(1){
   if(j==W && i==H){
     if(board.at(i).at(j)=='#'){
       count++;
     }
     break;
     } 
   if(i!=H && board.at(i).at(j) == board.at(i+1).at(j)){
       i++;
       continue;
     }
   if(j != W && board.at(i).at(j) == board.at(i).at(j+1)){
       j++;
       continue;
     }
   if(board.at(i).at(j)=='#'){
       count++;
  	   board.at(i).at(j)='.';
       continue;
     }
   if(board.at(i).at(j)=='.'){
  	   board.at(i).at(j)='#';
       continue;
     }
 }
  for (int i = 1; i < H+1; i++) {
    for (int j = 1; j < W+1; j++) {
      board.at(i).at(j)=board2.at(i).at(j);
     }
  }
  int i=1,j=1;
  while(1){
   if(j==W && i==H){
     if(board.at(i).at(j)=='#'){
       count2++;
     }
     break;
     } 
   if(j != W && board.at(i).at(j) == board.at(i).at(j+1)){
       j++;
       continue;
     }
   if(i!=H && board.at(i).at(j) == board.at(i+1).at(j)){
       i++;
       continue;
     }
   if(board.at(i).at(j)=='#'){
       count2++;
  	   board.at(i).at(j)='.';
       continue;
     }
   if(board.at(i).at(j)=='.'){
  	   board.at(i).at(j)='#';
       continue;
     }
 }
  if(count<count2)
  cout << count << endl;
  if(count2<=count)
  cout << count2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:7: error: redeclaration of 'int i'
   47 |   int i=1,j=1;
      |       ^
a.cc:16:7: note: 'int i' previously declared here
   16 |   int i=1,j=1;
      |       ^
a.cc:47:11: error: redeclaration of 'int j'
   47 |   int i=1,j=1;
      |           ^
a.cc:16:11: note: 'int j' previously declared here
   16 |   int i=1,j=1;
      |           ^