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

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

public class TaskA {
    public static InputReader in;
    public static PrintWriter out;
    static int n;
    static int m;
    static char[][] a;
    static int[][] dp;

    public static void main(String[] args) {
        in = new InputReader(System.in);
        out = new PrintWriter(System.out);
        n = in.nextInt();
        m = in.nextInt();
        a = new char[n + 5][m + 5];
        dp = new int[n + 5][m + 5];
        for (int i = 0; i < n; i++) {
            a[i] = in.next().toCharArray();
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                dp[i][j] = 100000000;
            }
        }
        dp[0][0] = (a[0][0] == '#') ? 1 : 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (dp[i][j] != 100000000) continue;
                if (a[i][j] == '#') {
                    if (i - 1 >= 0 && a[i - 1][j] == '#') dp[i][j] = Math.min(dp[i][j], dp[i - 1][j]);
                    if (i - 1 >= 0 && a[i - 1][j] == '.') dp[i][j] = Math.min(dp[i][j], dp[i - 1][j] + 1);
                    if (j - 1 >= 0 && a[i][j - 1] == '#') dp[i][j] = Math.min(dp[i][j], dp[i][j - 1]);
                    if (j - 1 >= 0 && a[i][j - 1] == '.') dp[i][j] = Math.min(dp[i][j], dp[i][j - 1] + 1);
                } else {
                    if (i - 1 >= 0 && a[i - 1][j] == '#') dp[i][j] = Math.min(dp[i][j], dp[i - 1][j]);
                    if (i - 1 >= 0 && a[i - 1][j] == '.') dp[i][j] = Math.min(dp[i][j], dp[i - 1][j]);
                    if (j - 1 >= 0 && a[i][j - 1] == '#') dp[i][j] = Math.min(dp[i][j], dp[i][j - 1]);
                    if (j - 1 >= 0 && a[i][j - 1] == '.') dp[i][j] = Math.min(dp[i][j], dp[i][j - 1]);
                }
            }
        }
        out.println(dp[n - 1][m - 1]);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public Long nextLong() {
            return Long.parseLong(next());
        }
        public Double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}



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

#include<iostream>
using namespace std;
int main()
{
  long long r,c,i,j;
  cin>>r>>c;
  vector<string> v;
  for(i=0;i<r;i++)
  {
    string str;
    cin>>str;
    v.push_back(str);
  }
  vector< vector<int> > dp(r,vector<int>(c,0));
  if(v[0][0]=='#')
     dp[0][0]=1;
  
  
  for(i=1;i<r;i++)
  {
    if(v[0][i]=='#')
      dp[0][i]=1+dp[0][i-1];
    else
      dp[0][i]=dp[0][i-1];
  }
  for(i=1;i<c;i++)
  {
    if(v[i][0]=='#')
      dp[i][0]=1+dp[i-1][0];
    else
      dp[i][0]=dp[i-1][0];
  }
  for(i=1;i<r;i++)
  {
    for(j=1;j<c;j++)
    {
      if(v[i][j]=='#')
      dp[i][j]=1+min(dp[i-1][j],dp[i][j-1]);
      else
        dp[i][j]=min(dp[i-1][j],dp[i][j-1]);
    }
      
  }
  cout<<dp[r-1][c-1]<<endl;
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<string> v;
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:7:16: error: expected primary-expression before '>' token
    7 |   vector<string> v;
      |                ^
a.cc:7:18: error: 'v' was not declared in this scope
    7 |   vector<string> v;
      |                  ^
a.cc:14:18: error: expected primary-expression before 'int'
   14 |   vector< vector<int> > dp(r,vector<int>(c,0));
      |                  ^~~
a.cc:16:6: error: 'dp' was not declared in this scope
   16 |      dp[0][0]=1;
      |      ^~
a.cc:22:7: error: 'dp' was not declared in this scope
   22 |       dp[0][i]=1+dp[0][i-1];
      |       ^~
a.cc:24:7: error: 'dp' was not declared in this scope
   24 |       dp[0][i]=dp[0][i-1];
      |       ^~
a.cc:29:7: error: 'dp' was not declared in this scope
   29 |       dp[i][0]=1+dp[i-1][0];
      |       ^~
a.cc:31:7: error: 'dp' was not declared in this scope
   31 |       dp[i][0]=dp[i-1][0];
      |       ^~
a.cc:38:7: error: 'dp' was not declared in this scope
   38 |       dp[i][j]=1+min(dp[i-1][j],dp[i][j-1]);
      |       ^~
a.cc:40:9: error: 'dp' was not declared in this scope
   40 |         dp[i][j]=min(dp[i-1][j],dp[i][j-1]);
      |         ^~
a.cc:44:9: error: 'dp' was not declared in this scope
   44 |   cout<<dp[r-1][c-1]<<endl;
      |         ^~
Language: C++

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



int routeSearch( int startR,int startC,int goalR,int goalC){
	
	if(goalR - 1 <= startR && goalC - 1 <= startC)return 0;
	int downLength = -1;
	int rightLength = -1;
	if(startR < goalR - 1){
		downLength = routeSearch(startR + 1,startC,goalR,goalC);
		if(mapData[startR + 1][startC] == '#'){
			downLength++;
		}
	}
	if(startC < goalC - 1){
		rightLength = routeSearch(startR,startC + 1,goalR,goalC);
		if(mapData[startR][startC + 1] == '#'){
			rightLength++;
		}
	}
	if(downLength == -1)return rightLength;
	if(rightLength == -1)return downLength;
	return min(downLength,rightLength);
}
	vector<string> mapData;
int main() {
	int h,w;
	cin >> h >> w;
	//vector<string> mapData;
	for(int i = 0;i < h;i++){
		string s;
		cin >> s;
		mapData.push_back(s);
	}
	int defVal = 0;
	//両端のカウント
	if(mapData[0][0] == '#')defVal++;
	cout <<routeSearch(0,0,h,w) + defVal << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int routeSearch(int, int, int, int)':
a.cc:16:20: error: 'mapData' was not declared in this scope
   16 |                 if(mapData[startR + 1][startC] == '#'){
      |                    ^~~~~~~
a.cc:22:20: error: 'mapData' was not declared in this scope
   22 |                 if(mapData[startR][startC + 1] == '#'){
      |                    ^~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <array>

using namespace std;

int solve(array<array<char, 100>, 100> &g, int r = 0, int c = 0, int H, int W)
{
	int change = g[r][c] == '#' ? 1 : 0;
	if (r == g.size() - 1 && c == g[0].size() - 1)
	{
		return change;
	}

	int newmin = 99999;

	if (r < g.size() - 1)
	{
		int newchange = solve(g, r + 1, c, H, W) + change;
		if (newchange < newmin)
		{
			newmin = newchange;
		}
	}

	if (c < g[0].size() - 1)
	{
		int newchange = solve(g, r, c + 1, H, W) + change;
		if (newchange < newmin)
		{
			newmin = newchange;
		}
	}

	return newmin;
}

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

	cout << solve(g, 0, 0, H, W);

	return 0;
}


Compiler output:
a.cc:6:70: error: default argument missing for parameter 4 of 'int solve(std::array<std::array<char, 100>, 100>&, int, int, int, int)'
    6 | int solve(array<array<char, 100>, 100> &g, int r = 0, int c = 0, int H, int W)
      |                                                                  ~~~~^
a.cc:6:48: note: ...following parameter 2 which has a default argument
    6 | int solve(array<array<char, 100>, 100> &g, int r = 0, int c = 0, int H, int W)
      |                                            ~~~~^~~~~
a.cc:6:77: error: default argument missing for parameter 5 of 'int solve(std::array<std::array<char, 100>, 100>&, int, int, int, int)'
    6 | int solve(array<array<char, 100>, 100> &g, int r = 0, int c = 0, int H, int W)
      |                                                                         ~~~~^
Language: C++

#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const long long INF = 1LL<<60;
int H, W;
vector<string> fi;
 
int main(){
  cin >> H >> W;
  vector<vector<long long>> dp(H, vector<long long>(W, INF));
  fi.resize(H);
  for(int i=0; i<H; i++) cin >> fi[i];
  if(fi[0][0] == '#') dp[0][0] = 1;
  else dp[0][0] = 0;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      for(int dir=0; dir<2; dir++){
        int nx = i + dx[dir];
        int ny = j + dx[dir];
        if(nx>=H || ny>=W) continue;
        int add = 0;
        if (fi[nx][ny] == '#' && fi[i][j] == '.') add = 1;
        chmin(dp[nx][ny], dp[i][j] + add);
      }
    }
  }
  cout << dp[H-1][W-1]-1 << endl;
}
}

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

#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const long long INF = 1LL<<60;
int H, W;
vector<string> fi;
 
int main(){
  cin >> H >> W;
  for(int i=0; i<H; i++) cin >> fi[i];
  if(fi[0][0] == '#') dp[0][0] == 1;
  else dp[0][0] = 0;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      for(int dir=0; dir<2; dir++){
        int nx = i + dx[dir];
        int ny = j + dx[dir];
        if(nx>=H || ny>=W) continue;
        if(fi[nx][ny] == '#'){
          dp[nx][ny]++;
        }
      }
    }
  }
  cout << dp[H-1][W-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: 'dp' was not declared in this scope; did you mean 'dy'?
   15 |   if(fi[0][0] == '#') dp[0][0] == 1;
      |                       ^~
      |                       dy
a.cc:16:8: error: 'dp' was not declared in this scope; did you mean 'dy'?
   16 |   else dp[0][0] = 0;
      |        ^~
      |        dy
a.cc:24:11: error: 'dp' was not declared in this scope; did you mean 'dy'?
   24 |           dp[nx][ny]++;
      |           ^~
      |           dy
a.cc:29:11: error: 'dp' was not declared in this scope; did you mean 'dy'?
   29 |   cout << dp[H-1][W-1] << endl;
      |           ^~
      |           dy
Language: C++

#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const long long INF = 1LL<<60;
int H, W;
vector<string> fi;
 
int main(){
  cin >> H >> W;
  for(int i=0; i<H; i++) cin >> fi[i];
  if(fi[0][0] == '#') dp[0][0] == 1;
  else dp[0][0] = 0;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      for(int dir=0; dir<2; dir++){
        int nx = i + dx[dir];
        int ny = j + dx[dir];
        if(nx>=H || ny>=W) continue;
        if(fi[nx][ny] == '#'){
          dp[nx][ny]++;
        }
      }
    }
  }
   cout << dp[H-1][W-1] << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: 'dp' was not declared in this scope; did you mean 'dy'?
   15 |   if(fi[0][0] == '#') dp[0][0] == 1;
      |                       ^~
      |                       dy
a.cc:16:8: error: 'dp' was not declared in this scope; did you mean 'dy'?
   16 |   else dp[0][0] = 0;
      |        ^~
      |        dy
a.cc:24:11: error: 'dp' was not declared in this scope; did you mean 'dy'?
   24 |           dp[nx][ny]++;
      |           ^~
      |           dy
a.cc:29:12: error: 'dp' was not declared in this scope; did you mean 'dy'?
   29 |    cout << dp[H-1][W-1] << endl;
      |            ^~
      |            dy
Language: C++

#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const long long INF = 1LL<<60;
int H, W;
vector<string> fi;

int main(){
  cin >> H >> W;
  for(int i=0; i<H; i++) cin >> fi[i];
  if(fi[0][0] == '#') dp[0][0] == 1;
  else dp[0][0] = 0;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      for(int dir=0; dir<2; dir++){
        int nx = i + dx[dir];
        int ny = j + dx[dir];
        if(nx>=H || ny>=W) continue;
        if(fi[nx][ny] == '#'){
          dp[nx][ny]++;
        }
      }
    }
    cout << dp[H-1][W-1] << endl;
  }
        

Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: 'dp' was not declared in this scope; did you mean 'dy'?
   15 |   if(fi[0][0] == '#') dp[0][0] == 1;
      |                       ^~
      |                       dy
a.cc:16:8: error: 'dp' was not declared in this scope; did you mean 'dy'?
   16 |   else dp[0][0] = 0;
      |        ^~
      |        dy
a.cc:24:11: error: 'dp' was not declared in this scope; did you mean 'dy'?
   24 |           dp[nx][ny]++;
      |           ^~
      |           dy
a.cc:28:13: error: 'dp' was not declared in this scope; did you mean 'dy'?
   28 |     cout << dp[H-1][W-1] << endl;
      |             ^~
      |             dy
a.cc:29:4: error: expected '}' at end of input
   29 |   }
      |    ^
a.cc:12:11: note: to match this '{'
   12 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int h, w;
    cin >> h >> w;
    string s[h+2];
    rep(i,h+2){
        if(i == 0 || i == h + 1){
            rep(j,w+2)s[i] += 'x';
        }else{
            string ss;
            cin >> ss;
            s[i] = 'x' + ss + 'x';
        }
    }

    int a[h+2][w+2];
    rep(i,h+2){
        rep(j,w+2){
            if(s[i][j] == 'x')a[i][j] = -1;
            else a[i][j] = 1001001001;
        }
    }

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

    priority_queue<pair<int,P>, vector<pair<int,P>, greater<pair<int,P>> que;
    pair<int,P> p;

    if(s[1][1] == '#')a[1][1] = 1;
    else a[1][1] = 0;
    p.first = a[1][1];
    p.second.first = 1;
    p.second.second = 1;
    que.push(p);

    while(que.size() > 0){
        p = que.top();
        que.pop();
        int t = p.first;
        int x = p.second.first;
        int y = p.second.second;
        if(t > a[x][y])continue;
        rep(i,4){
            if(s[x+dx[i]][y+dy[i]] == 'x')continue;
            if(s[x][y] == '.' && s[x+dx[i]][y+dy[i]] == '#'){
                if(a[x][y] + 1 < a[x+dx[i]][y+dy[i]]){
                    a[x+dx[i]][y+dy[i]] = a[x][y] + 1;
                    p.first = a[x][y] + 1;
                    p.second.first = x + dx[i];
                    p.second.second = y + dy[i];
                    que.push(p);
                }
            }else{
                if(a[x][y] < a[x+dx[i]][y+dy[i]]){
                    a[x+dx[i]][y+dy[i]] = a[x][y];
                    p.first = a[x][y];
                    p.second.first = x + dx[i];
                    p.second.second = y + dy[i];
                    que.push(p);
                }
            }
        }
    }

    int ans = a[h][w];

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


Compiler output:
a.cc: In function 'int main()':
a.cc:36:74: error: template argument 2 is invalid
   36 |     priority_queue<pair<int,P>, vector<pair<int,P>, greater<pair<int,P>> que;
      |                                                                          ^~~
a.cc:36:33: error: template argument 2 is invalid
   36 |     priority_queue<pair<int,P>, vector<pair<int,P>, greater<pair<int,P>> que;
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:36:33: error: template argument 3 is invalid
a.cc:44:5: error: 'que' was not declared in this scope
   44 |     que.push(p);
      |     ^~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<unordered_set>
#include<cmath>
#include<tuple>
#include<numeric>
#include<iterator>
#include<set>
#include<unordered_map>
#include<map>


#define fastio                      ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define lp(i , aa , bb)             for(auto i = aa ; i < bb ; i++)
#define dbg(a)                      cout << "here is " << a << "\n";
#define ain(a , n)                  for(auto i = 0 ; i < n ; i++) cin >> a[i]
#define aout(a , n)                 for(auto i = 0 ; i < n ; i++) cout << a[i] << " "
#define dist(a , b , x , y)         abs(x - a)*abs(x - a) + abs(y - b)*abs(y - b)
#define M                           998244353
#define mp                          make_pair
#define mt                          make_tuple
#define cend                        cout << "\n"

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <char> vch;
typedef vector <string> vs;

/*----------------------------- # --- MATH ALGORITHMS --- # -----------------------------*/

template <class T> T gcd(T a , T b){ while(a != 0){T temp = a; a = b % a; b = temp;}return b;}
template <class T> T egcd(T a , T b , T &x , T &y){T gcd , xt , yt;if(a == 0){gcd = b;x = 0 , y = 1;}else {gcd = egcd(b % a , a , xt , yt);x = yt - (b/a)*xt; y = xt;}return gcd;}
template <class T> T expo(T base , T exp , T mod){T res = 1;base = base % mod;while (exp > 0){if (exp & 1)res = (res*base) % mod;exp = exp>>1;base = (base*base) % mod;}return res;}
template <class T> T modinv(T a , T mod){T x , y; egcd<T>(a , mod , x , y);while(x < 0) x += mod; while(x >= mod) x -= mod; return x;}
template <class T> T modinvfermat(T a , T mod){return expo<T>(a , mod - 2 , mod);}
template <class T> bool rev(T a , T b){return a > b;}
template <class T> int maxpower(T a , T b){int ans = 0;while(a > 0 && a % b == 0){ans++;a /= b;}return ans;}


/*----------------------------- # --- MAIN CODE --- # -----------------------------*/
int dp[101][101];
int h , w;
char c[101][101];
int f(int i , int j){
    if(i == h - 1 && j == w - 1) return c[i][j] == '#';
    if(i >= h || j >= w) return 1000000000;
    if(dp[i + 1][j] == -1) dp[i + 1][j] = f(i + 1 , j);
    if(dp[i][j + 1] == -1) dp[i][j + 1] = f(i , j + 1);
    int ans = 0; if(c[i][j] == '#') ans++;
    dp[i][j] = min(dp[i + 1][j] , dp[i][j + 1]) + ans;
    return dp[i][j];
}

int main(){
    cin >> h >> w;
    lp(i , 0 , h){
        lp(j , 0 , w){
            cin >> c[i][j];
        }
    }
    memset(dp , -1 , sizeof(dp));
    cout << f(0 , 0);
}

















Compiler output:
a.cc: In function 'int main()':
a.cc:67:5: error: 'memset' was not declared in this scope
   67 |     memset(dp , -1 , sizeof(dp));
      |     ^~~~~~
a.cc:14:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   13 | #include<map>
  +++ |+#include <cstring>
   14 |
Language: C++

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

int main() {
	
	int h,w;
	cin>>h>>w;
	
	char a[h][w];
	char x;
	for(int i=0;i<h;i++)
		for(int j=0;j<w;j++)
			cin>>a[i][j];
		
	int dp[h][w] {0};	
	if(a[0][0]=='#')
		dp[0][0]=1;
		
	for(int j=1;j<w;j++)
	{
		if(a[0][j]==a[0][j-1])
			dp[0][j]=dp[0][j-1];
		else
			dp[0][j]=dp[0][j-1]+1;
	}
	for(int i=1;i<h;i++)
	{
		if(a[i][0]==a[i-1][0])
			dp[i][0]=dp[i-1][0];
		else
			dp[i][0]=dp[i-1][0]+1;
	}
	
	for(int i=1;i<h;i++)
		for(int j=1;j<w;j++)
			{
				dp[i][j]=min((a[i][j]==a[i-1][j])?dp[i-1][j]:dp[i-1][j]+1, (a[i][j]==a[i][j-1])?dp[i][j-1]:dp[i][j-1]+1);
			}
			
	cout<<(dp[h-1][w-1]+1)/2<<endl;
	/*for(int i=0;i<h;i++)
	{for(int j=0;j<w;j++)
	cout<<dp[i][j];*/
	cout<<endl;}
	
	// your code goes here
	return 0;
}


Compiler output:
a.cc:47:9: error: expected unqualified-id before 'return'
   47 |         return 0;
      |         ^~~~~~
a.cc:48:1: error: expected declaration before '}' token
   48 | }
      | ^
Language: C++

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

int main() {
  	int n, m;
  	cin >> n >> m;
  	char c[h + 1][w + 1];
  	for(int i = 1; i <= n; i++) {
      	string s;
      	cin >> s;
      	for(int j = 1; j <= m; j++) {
          	c[i][j] = s[j - 1];
        }
    }
  	int dp[n + 1][m + 1];
  	for(int i = 0; i <= n; i++) {
      	for(int j = 0; j <= m; j++) {
          	dp[i][j] = 0;
        }
    }
  	dp[0][0] = 0;
  	dp[1][1] = (c[1][1] == '.') ? 0 : 1;
  	for(int i = 2; i <= n; i++) {
      	dp[i][1] = dp[i - 1][1];
      	if(c[i][1] == '#')
          	dp[i][1]++;
    }
  	for(int i = 2; i <= m; i++) {
      	dp[1][i] = dp[1][i];
      	if(c[1][i] == '#')
          	dp[1][i]++;
    }
  	for(int i = 2; i <= n; i++) {
      	for(int j = 2; j <= m; j++) {
          	dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]);
          	if(c[i][j] == '#')
              	dp[i][j]++;
        }
    }
  	cout << dp[n][m] << endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:16: error: 'h' was not declared in this scope
    7 |         char c[h + 1][w + 1];
      |                ^
a.cc:7:23: error: 'w' was not declared in this scope
    7 |         char c[h + 1][w + 1];
      |                       ^
a.cc:12:17: error: 'c' was not declared in this scope
   12 |                 c[i][j] = s[j - 1];
      |                 ^
a.cc:22:21: error: 'c' was not declared in this scope
   22 |         dp[1][1] = (c[1][1] == '.') ? 0 : 1;
      |                     ^
Language: C++

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

int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> vec(H+1,vector<char>(W+1));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> vec[i+1][j+1];
    }
  }
  vector<vector<int>> dp(H+1,vector<int>(W+1,0));
  if(vec[1][1]=='.')
    dp[1][1]=0;
  else
    dp[1][1]=1;
  for(int i=1;i<H+1;i++){
    for(int j=1;j<W+1;j++){
      int k=0;
      int t=0;
      if(vec[i-1][j]=='.'&&vec.at[i][j]=='#')
        k=1;
      if(vec[i][j-1]=='.'&&vec.at[i][j]=='#')
        t=1;
      dp[i][j]=min(dp[i-1][j]+k,dp[i][j-1]+t);
    }
  }
  
  cout << dp[H][W] << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:34: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   22 |       if(vec[i-1][j]=='.'&&vec.at[i][j]=='#')
      |                                  ^
a.cc:24:34: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   24 |       if(vec[i][j-1]=='.'&&vec.at[i][j]=='#')
      |                                  ^
Language: C++

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

int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> vec(H+1,vector<char>(W+1));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> vec[i+1][j+1];
    }
  }
  vector<vector<int>> dp(H+1,vector<int>(W+1,0));
  if(vec[1][1]==".")
    dp[1][1]=0;
  else
    dp[1][1]=1;
  for(int i=1;i<H+1;i++){
    for(int j=1;j<W+1;j++){
      int k=0;
      int t=0;
      if(vec[i-1][j]=='.'&&vec.at[i][j]='#')
        k=1;
      if(vec[i][j-1]=='.'&&vec.at[i][j]='#')
        t=1;
      dp[i][j]=min(dp[i-1][j]+k,dp[i][j-1]+t);
    }
  }
  
  cout << dp[H][W] << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |   if(vec[1][1]==".")
a.cc:22:34: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   22 |       if(vec[i-1][j]=='.'&&vec.at[i][j]='#')
      |                                  ^
a.cc:24:34: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   24 |       if(vec[i][j-1]=='.'&&vec.at[i][j]='#')
      |                                  ^
Language: C++

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

int main(){
  //type
  int h,w;
  cin >> h >> w;
  vector<string>s(h);
  for(int a = 0; a < h; a++)
      cin >> s[a];

  //processing
  vector<vector<int>>cnt(h,vector<int>(w,1000000));
  cnt[0][0]=0;
  
  for(int i = 0; i < h; i++)
    for(int j = 0; j < w; j++){
      if(i == 0 && j == 0) if(s[0][0]=="#") cnt[0][0]=1;
      else{
        if(s[i][j]=="#"){
          if(i>0) cnt[i][j] = min(cnt[i-1][j]+1,cnt[i][j]);
          if(j>0) cnt[i][j] = min(cnt[i][j-1]+1,cnt[i][j]);
        }
        else{
          if(i>0) cnt[i][j] = min(cnt[i-1][j],cnt[i][j]);
          if(j>0) cnt[i][j] = min(cnt[i][j-1],cnt[i][j]);
        }
      } 
    }
  
  cout << cnt[h-1][w-1];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   18 |       if(i == 0 && j == 0) if(s[0][0]=="#") cnt[0][0]=1;
a.cc:20:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |         if(s[i][j]=="#"){
Language: C++

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

int main(){
  //type
  int h,w;
  cin >> h >> w;
  vector<string>s(h);
  for(int a = 0; a < h; a++)
      cin >> s[a];

  //processing
  vector<vector<int>>cnt(h,vector<int>(w,1000000));
  cnt[0][0]=0;
  
  for(int i = 0; i < h; i++)
    for(int j = 0; j < w; j++){
      if(i == 0 && j == 0) if(s[0][0]=='#') cnt[0][0]=1;
      else{
        if(s[i][j]=="#"){
          if(i>0) cnt[i][j] = min(cnt[i-1][j]+1,cnt[i][j]);
          if(j>0) cnt[i][j] = min(cnt[i][j-1]+1,cnt[i][j]);
        }
        else{
          if(i>0) cnt[i][j] = min(cnt[i-1][j],cnt[i][j]);
          if(j>0) cnt[i][j] = min(cnt[i][j-1],cnt[i][j]);
        }
      } 
    }
  
  cout << cnt[h-1][w-1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |         if(s[i][j]=="#"){
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) {
 if (a < b) { a = b; return true; } return false; 
 }
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
 }
ll dx[4]={0,1};
ll dy[4]={1,0};
int main(){
  ll h,w;
  cin>>h>>w;
  vvc s(h,vc(w));
  rep(i,h){
    rep(j,w){
      cin>>s[i][j];
    }
  }
  vvll dp(h,vvl(w,INF));
  if(s[0][0]=='#'){
    dp[0][0]=1;
  }
  else{
    dp[0][0]=0;
  }
  rep(i,h){
    rep(j,w){
      for(u,4){
        ll nx=dx[u]+i;
        ll ny=dy[u]+j;
        if(nx<h&&ny<w){
          if(s[i][j]=='.'&&s[nx][ny]=='#'){
            dp[nx][ny]=min(dp[nx][ny],dp[i][j]+1);
          }
          else{
            dp[nx][ny]=min(dp[nx][ny],dp[i][j]);
          }
        }
      }
    }
  }
  COUT(dp[h-1][w-1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:13: error: 'vvl' was not declared in this scope; did you mean 'vvll'?
   58 |   vvll dp(h,vvl(w,INF));
      |             ^~~
      |             vvll
a.cc:67:11: error: 'u' was not declared in this scope
   67 |       for(u,4){
      |           ^
a.cc:79:5: error: expected primary-expression before '}' token
   79 |     }
      |     ^
a.cc:78:8: error: expected ';' before '}' token
   78 |       }
      |        ^
      |        ;
   79 |     }
      |     ~   
a.cc:79:5: error: expected primary-expression before '}' token
   79 |     }
      |     ^
a.cc:78:8: error: expected ')' before '}' token
   78 |       }
      |        ^
      |        )
   79 |     }
      |     ~   
a.cc:67:10: note: to match this '('
   67 |       for(u,4){
      |          ^
a.cc:79:5: error: expected primary-expression before '}' token
   79 |     }
      |     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=1e9;
int H, W; string S[101];
int dp[101][101];
int _main() {
    cin >> H >> W;
    for(ll y=0;y<H;y++) 
    cin >> S[y];

    for(ll y=0;y<H;y++) 
    {for(ll x=0;y<W;y++) dp[y][x]=INF;
    }
    dp[0][0] = 0;
    if (S[0][0] == '#') dp[0][0] = 1;

    for(ll y=0;y<H;y++) 
    {for(ll x=0;y<W;y++)
    {
        if (y + 1 < H) {
            if (S[y][x] == '.' && S[y + 1][x] == '#') dp[y+1][x]=min(dp[y + 1][x], dp[y][x] + 1);
            else dp[y+1][x]=min(dp[y + 1][x], dp[y][x]);
        }
        if (x + 1 < W) {
            if (S[y][x] == '.' && S[y][x + 1] == '#') 
            dp[y][x+1]=min(dp[y][x + 1], dp[y][x] + 1);
            else 
            dp[y][x+1]=min(dp[y][x + 1], dp[y][x]);
        }
    }
    }


    cout << dp[H - 1][W - 1] << endl;
    return 0;
}

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>
using namespace std;
typedef long long ll;
const int INF=1e9;
int H, W; string S[101];
int dp[101][101];
int _main() {
    cin >> H >> W;
    for(ll y=0;y<H;y++) 
    cin >> S[y];

    for(ll y=0;y<H;y++) 
    {for(ll x=0;y<W;y++) dp[y][x]=INF;
    }
    dp[0][0] = 0;
    if (S[0][0] == '#') dp[0][0] = 1;

    for(ll y=0;y<H;y++) 
    {for(ll x=0;y<W;y++)
    {
        if (y + 1 < H) {
            if (S[y][x] == '.' && S[y + 1][x] == '#') min(dp[y + 1][x], dp[y][x] + 1);
            else min(dp[y + 1][x], dp[y][x]);
        }
        if (x + 1 < W) {
            if (S[y][x] == '.' && S[y][x + 1] == '#') min(dp[y][x + 1], dp[y][x] + 1);
            else min(dp[y][x + 1], dp[y][x]);
        }
    }
    }


    cout << dp[H - 1][W - 1] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int _main()':
a.cc:22:58: warning: ignoring return value of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]', declared with attribute 'nodiscard' [-Wunused-result]
   22 |             if (S[y][x] == '.' && S[y + 1][x] == '#') min(dp[y + 1][x], dp[y][x] + 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:233:5: note: declared here
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:23:21: warning: ignoring return value of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]', declared with attribute 'nodiscard' [-Wunused-result]
   23 |             else min(dp[y + 1][x], dp[y][x]);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: declared here
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:26:58: warning: ignoring return value of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]', declared with attribute 'nodiscard' [-Wunused-result]
   26 |             if (S[y][x] == '.' && S[y][x + 1] == '#') min(dp[y][x + 1], dp[y][x] + 1);
      |                                                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: declared here
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:27:21: warning: ignoring return value of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]', declared with attribute 'nodiscard' [-Wunused-result]
   27 |             else min(dp[y][x + 1], dp[y][x]);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: declared here
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/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"


using namespace std;


typedef struct Node{
	int x;
	int y;
} node;



int ca(vector<vector<char>> ma , int h,int w){
	int x,y;
	char now;
	int changes=0;
	bool fin = false;
	vector<int> route;
	vector<node> finding,branch;
	vector<vector<bool>> done;

	done.resize(w,vector<bool>(h));

	for (auto& x : done){
		for (auto& y : x){
//			y = false;
		}
	}

	node nd = {0,0};
	finding.push_back(nd);
	now = ma[0][0];

	while (1){
		while(!finding.empty()){
			node n = finding.back();
			finding.pop_back();
			done[n.x][n.y] = true;

			if (n.x == w-1 && n.y == h-1) {
				fin = true;
				break;
			}

			if (n.x == w - 1){
				if (ma[n.y + 1][n.x] != now)  branch.push_back(n); //限界節点
				else {
					nd = {n.x , n.y+1};
					if (ma[n.y + 1][n.x] == now && !(done[n.x][n.y+1])) finding.push_back(nd);
				}
			}
			else if (n.y == h - 1){
				if (ma[n.y][n.x+1] != now)  branch.push_back(n); //限界節点
				else {
					nd = {n.x+1 , n.y};
					if (ma[n.y][n.x+1] == now && !(done[n.x+1][n.y])) finding.push_back(nd);
				}
			}
			else {
				if (ma[n.y][n.x + 1] != now  &&  ma[n.y + 1][n.x] != now)  branch.push_back(n); //限界節点
				else {
					nd = {n.x+1 , n.y};
					if (ma[n.y][n.x + 1] == now && !(done[n.x+1][n.y])) finding.push_back(nd);
					nd = {n.x , n.y+1};
					if (ma[n.y + 1][n.x] == now && !(done[n.x][n.y+1])) finding.push_back(nd);
				}
			}
		}
		if (fin) break;
		if (branch.empty()) break; //error

		for (auto n : branch){
			finding.push_back(n);
		}
		branch.clear();

		changes++;
		now = (now=='.' ? '#' : '.');
	}
	if (ma[0][0] == '#' || ma[w-1][h-1] == '#') return changes/2+1;
	else return changes/2;
}





int main(){
	int h,w;
	vector<vector<char>> m,rm;
	string c;

	cin >> h >> w;
	m.resize(h, vector<char>(0));
	rm.resize(h, vector<char>(0));

	for (int i = 0; i < h; i++){
		cin >> c;
		for (auto s : c){
			m[i].push_back(s);
			rm[h-i-1].push_back(s);
		}
		reverse(rm[h-i-1].begin(),rm[h-i-1].end());
	}

//	cout << min(ca(m,h,w),ca(rm,h,w)) << endl;
	cout << min(ca(m,h,w),ca(rm,h,w));
	cin >> h;
	return 0;

	
}




Compiler output:
a.cc: In function 'int ca(std::vector<std::vector<char> >, int, int)':
a.cc:26:32: error: cannot bind non-const lvalue reference of type 'std::_Bit_reference&' to an rvalue of type 'std::_Bit_iterator::reference'
   26 |                 for (auto& y : x){
      |                                ^
Language: Java



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

public class A {

    Scanner sc = new Scanner(System.in);

    PrintWriter out = new PrintWriter(System.out);

    int h = sc.nextInt();
    int w = sc.nextInt();
    char[][] arr = new char[h][w];
    int[][] dp = new int[h][w];

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

    public static void main(String[] args) {
        new A().run();
    }

    void run() {
        for (int i=0; i<h; i++) {
            arr[i] = sc.next().toCharArray();
        }

        for (int i=0; i<h; i++) {
            for (int j=0; j<w; j++) {
                for (int k=0; k<2; k++) {
                    int ny = i + dy[k];
                    int nx = j + dx[k];
                    if (0<=ny && ny<h && 0<=nx && nx<w) {
                        if (arr[ny][nx]=='.') {
                            int up = Integer.MAX_VALUE;
                            int left = Integer.MAX_VALUE;
                            if (0<=ny-1) {
                                up = dp[ny-1][nx];
                            }
                            if (0<=nx-1) {
                                left = dp[ny][nx-1];
                            }
                            dp[ny][nx] = Math.min(up, left);
                        } else if (arr[ny][nx]=='#') {
                            int up = Integer.MAX_VALUE;
                            int left = Integer.MAX_VALUE;
                            if (0<=ny-1) {
                                up = dp[ny-1][nx];
                            }
                            if (0<=nx-1) {
                                left = dp[ny][nx-1];
                            }
                            if (0<=ny-1) {
                                if (arr[ny-1][nx]=='.') {
                                    up = dp[ny-1][nx]+1;
                                } else {
                                    up = dp[ny-1][nx];
                                }
                            }
                            if (0<=nx-1) {
                                if (arr[ny][nx-1]=='.') {
                                    left = dp[ny][nx-1]+1;
                                } else {
                                    left = dp[ny][nx-1];
                                }
                            }
                            dp[ny][nx] = Math.min(up, left);
                        }
                    }
                }
            }
        }
//        for (int i=0; i<h; i++) {
//            for (int j=0; j<w-1; j++) {
//                out.print(dp[i][j]);
//            }
//            out.println(dp[i][w-1]);
//        }
        if (arr[0][0]=='#') out.println(dp[h-1][w-1]+1);
        else out.println(dp[h-1][w-1]);
        out.flush();
    }
}


Compiler output:
Main.java:6: 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 int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
struct edge{int from,to,cost;};
signed main(){
  int a,b;
  cin>>a>>b;
  char c[a][b];
  rep(i,a)rep(i,b)
    cin>>c[i][j];
  int dp[a+1][b+1];
  rep1(i,a)rep1(j,b){
    if(c[i-1][j-1]=='.')
   dp[i][j]=min(dp[i-1][j],dp[i][j-1]);
    else
      dp[i][j]=min(dp[i-1][j],dp[i][j-1])+1;
  }
  cout<<dp[a+1][b+1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:15: error: 'j' was not declared in this scope
   23 |     cin>>c[i][j];
      |               ^
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <cmath>

using namespace std;
const long long INF = (long long) (1e18)+1;

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

  vector<string> t(h);

  for (int i=0; i < h; ++i) {
    cin >> t[i];
  }
  vector<vector<int>> dp(h, vector<int>(w));

  // dp[0][0] = 0;
  // cout << "here1" << endl;
  for (int i=0; i<h; ++i) {
    for(int j=0; j<w; ++j) {
      if (i==0 && j==0) { // very first cell.
        if (t[i][j] == '.') {
          dp[i][j] = 0;
        } else {
          dp[i][j] = 1;
        }
      } else if (i==0) { // first row except first cell
        if (t[i][j-1] == '.' && t[i][j] == '#') {
          dp[i][j] = dp[i][j-1] + 1;
        } else {
          dp[i][j] = dp[i][j-1];
        }
      } else { // from second row
        if (j==0) { // most left side. so only need to check vertically
          if (t[i-1][j] == '.' && t[i][j] == '#') {
            dp[i][j] = dp[i-1][j] + 1;
          } else {
            dp[i][j] = dp[i-1][j];
          }
        } else { // inside matrix
          if (t[i][j] == '.') {
            dp[i][j] = min(dp[i-1][j], dp[i][j-1]);
          } else {
            dp[i][j] = INT_MAX;
            if ( t[i-1][j] == '#' ) {//vertical
              dp[i][j] = min(dp[i][j], dp[i-1][j]);
            } else {
              dp[i][j] = min(dp[i][j], dp[i-1][j] + 1);
            }
            if ( t[i][j-1] == '#' ) { // row
              dp[i][j] = min(dp[i][j], dp[i][j-1]);
            } else {
              dp[i][j] = min(dp[i][j], dp[i][j-1] + 1);
            }
          }
          // if ( t[i-1][j] == '#' && t[i][j] == '#' ) {//vertical
          //   dp[i][j] = dp[i-1][j];
          // } else if ( t[i][j-1] == '#' && t[i][j] == '#' ){ // row
          //   dp[i][j] = dp[i][j-1]; 
          // } else { // .# pair vertically or horizontally
          //   dp[i][j] = min(dp[i-1][j] + 1, dp[i][j-1] + 1);
          // }
        }
      }   
    }
    // for(auto& n : dp[i]) {
    //   cout << n << " ";
    // }
    // cout << "" << endl;
  }
  cout << dp[h-1][w-1] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:24: error: 'INT_MAX' was not declared in this scope
   49 |             dp[i][j] = INT_MAX;
      |                        ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <cmath>
  +++ |+#include <climits>
    6 |
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    REP(i, h) cin >> s[i];

    vector<vector<int>> f(h , vector<int>(w));
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            if (i+j == 0) {
                f[0][0] = (s[0][0] == '#');
            }
            else {
                f[i][j] = inf;
                if (i > 0) chmin(f[i][j], f[i-1][j] + (s[i-1][j] == '.' && s[i][j] == '#'));
                if (j > 0) chmin(f[i][j], f[i][j-1] + (s[i][j-1] == '.' && s[i][j] == '#'));
            }
        }
    }

    cout << f[i-1][j-1] << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:15: error: 'i' was not declared in this scope
   37 |     cout << f[i-1][j-1] << endl;
      |               ^
a.cc:37:20: error: 'j' was not declared in this scope
   37 |     cout << f[i-1][j-1] << endl;
      |                    ^
Language: C++

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

using namespace std;

int i,j,k;

int main(){
    int h,w,ans;
    ans=0;
    cin >>h>>w;
    char s[h][w];
    int dp[h+1][w+1];
    REP(i,h)REP(j,w){
        cin>>s[i][j];
        dp[i][j]=INT_MAX;
    }
    dp[0][1]=dp[1][0]=0;
    for(i=1;i<=h;i++){
        for(j=1;j<=w;j++){
            if(s[i-1][j-1]=='.'){
                dp[i][j]=min(dp[i-1][j],dp[i][j-1]);
            }
            else if(i>1 && j>1){
                if(s[i-2][j-1]=='#' && s[i-1][j-2]=='#'){
                    dp[i][j]=min(dp[i-1][j],dp[i][j-1]);
                }
                else{
                    dp[i][j]=min(dp[i-1][j],dp[i][j-1])+1;
                }
            }
            else if(i>1 && j<2){
                if(s[i-2][j-1]=='#'){
                    dp[i][j]=min(dp[i-1][j],dp[i][j-1]);
                }
                else{
                    dp[i][j]=min(dp[i-1][j],dp[i][j-1])+1;
                }
            }
            else if(i<2 && j>1){
                if(s[i-1][j-2]=='#'){
                    dp[i][j]=min(dp[i-1][j],dp[i][j-1]);
                }
                else{
                    dp[i][j]=min(dp[i-1][j],dp[i][j-1])+1;
                }
            }
            else{
                dp[i][j]=min(dp[i-1][j],dp[i][j-1])+1;
            }
        }
    }
    
    cout<< dp[h][w] << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:54:29: error: expected '}' at end of input
   54 |     cout<< dp[h][w] << endl;
      |                             ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int h = scan.nextInt();
        int w = scan.nextInt();
        char[][] chars = new char[h][w];
        int[][] dp = new int[h][w];
        for (int i = 0; i < dp.length; i++) {
            Arrays.fill(dp[i],-1);
        }
        for (int i = 0; i < h; i++) {
            String p = scan.next();
            for (int j = 0; j < p.length(); j++) {
                chars[i][j] = p.charAt(j);
            }
        }
        System.out.println(dfs(chars,0,0,h,w,dp));
    }

    private static int dfs(char[][] chars, int i, int j, int h, int w,int[][] dp) {
        if(i == h-1 && j == w-1) return chars[i][j] == '#'?1:0;
        if(i >= h || j >= w) return h+w;
        if(dp[i][j] != -1) return dp[i][j];
        dp[i][j] = (chars[i][j] == '#' ? 1 : 0) + Math.min(dfs(chars, i + 1, j, h, w, dp), dfs(chars, i, j + 1, h, w, dp));
        return dp[i][j];
    }
}

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

#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define ss st.st
#define sn st.nd 
/****************************/
using namespace std;
int h,w;
char ch[110][110];
int dp[110][110];
int main()
{
	ios::sync_with_stdio(0);
	cin>>h>>w;
	rep(i,h)
	{
		rep(j,w)
		{
			cin>>ch[i][j];
		}
	}
	rep(i,110)
	{
		rep(j,110)
		{
			dp[i][j]=1e9;
		}
	}
	if(c[0][0]=='#')
	{
		dp[0][0]=1;
	}
	rep(i,h)
	{
		rep(j,w)
		{
			if(c[i][j]=='#')
			{
				if(i) dp[i][j]=min(dp[i][j],dp[i-1][j]+1);
				if(j) dp[i][j]=min(dp[i][j],dp[i][j-1]+1);
			}
			else
			{
				if(i) dp[i][j]=min(dp[i][j],dp[i-1][j]);
				if(j) dp[i][j]=min(dp[i][j],dp[i][j-1]);
			}
		}
	}
	cout<<dp[h-1][w-1];
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:12: error: 'c' was not declared in this scope
   64 |         if(c[0][0]=='#')
      |            ^
a.cc:72:28: error: 'c' was not declared in this scope
   72 |                         if(c[i][j]=='#')
      |                            ^