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

#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cstring>

#define MOD 998244353

using namespace std;

int main()
{
	int n;
	long long s;

	scanf("%d %lld", &n, &s);

	vector<long long> arr(3001);

	for (int i = 0; i < n; i++)
	{
		scanf("%lld", &arr[i]);
	}

	long long sol = 0;
	long long dp[2][5001] = { 0, };

	for (int i = 0; i < n; i++)
	{
		for (int j = 1; j <= s; j++)
		{
			dp[i % 2][j] = dp[!(i % 2)][j];
		}

		if (arr[i] == s)
		{
			sol = (sol + (long long)(i + 1) * (long long)(n - i) % MOD) % MOD;
		}

		else if (arr[i] < s)
		{
			dp[i % 2][arr[i]] = (dp[i % 2][arr[i]] + long long(i + 1)) % MOD;

			for (int j = 1; j < s - arr[i]; j++)
			{
				dp[i % 2][j + arr[i]] = (dp[i % 2][j + arr[i]] + dp[!(i % 2)][j]) % MOD;
			}

			if (s - arr[i] > 0)
			{
				sol = (sol + dp[!(i % 2)][s - arr[i]] * (long long)(n - i) % MOD) % MOD;
			}
		}
	}

	printf("%lld\n", sol);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:66: error: expected primary-expression before 'long'
   47 |                         dp[i % 2][arr[i]] = (dp[i % 2][arr[i]] + long long(i + 1)) % MOD;
      |                                                                  ^~~~
a.cc:47:65: error: expected ')' before 'long'
   47 |                         dp[i % 2][arr[i]] = (dp[i % 2][arr[i]] + long long(i + 1)) % MOD;
      |                                             ~                   ^~~~~
      |                                                                 )
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>
 
#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif
 
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define PER(i, N) for(int (i) = (N)-1; (i) >= 0; (i)--)
#define REP(i, N) for(int (i) = 0; (i) < (int)(N); (i)++)
 
using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

long long n,m;

const int MOD = 998244353;
ll ways[3333];

void solve(istream& cin, ostream& cout) {
	int S;
	cin >> n >> S;
	vector<int> A(n);
	vector<ll> B;
	cin >> A;
	ll ans = 0;
	for(int L = 0; L < n; L++) {
		memset(ways, 0, sizeof(ways));
		ways[0] = 1;
		for(int i = L; i < n; i++) {
			for(int csum = S-A[i]; csum >= 0; csum--) {
				(ways[csum+A[i]] += ways[csum]) %= MOD;
			}
			(ans += ways[S]) %= MOD;
		}
	}
	cout << ans << endl;
}


int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	solve(cin, cout);
	/*
	{
		istringstream instr("2\n2\n14");
		solve(instr, cout);
	}
 */
	return 0;
}


Compiler output:
a.cc:51:19: error: extended character   is not valid in an identifier
   51 |         vector<ll> B;
      |                   ^
a.cc:57:31: error: extended character   is not valid in an identifier
   57 |                 for(int i = L; i < n; i++) {
      |                               ^
a.cc: In function 'void solve(std::istream&, std::ostream&)':
a.cc:57:31: error: '\U000000a0i' was not declared in this scope; did you mean ' B'?
   57 |                 for(int i = L; i < n; i++) {
      |                               ^~
      |                                B
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define el(a) (a).end()-(a).begin()
#define mod 1000000007
int x[2]={0,1};
int y[2]={1,0};
int main(){
	deque<pair<int,int>> q;
	int h,w;
	cin>>h>>w;
	q.push_back(make_pair(0,0));
	char s[h][w];
	int cost[h][w];
	rep(i,h)rep(j,w)cin>>s[i][j];
	rep(i,h)rep(j,w)cost[i][j]=-1;
	if(s[0][0]=='.')cost[0][0]=0;
	else cost[0][0]=1;
	pair<int,int> now;
	int newx,newy;
	while(1){
		now=q.front();
		q.pop_front();
		rep(i,2){
			newy=now.first+y[i];
			newx=now.second+x[i];
			if(0<=newy&&newy<h&&0<=newx&&newx<w){
				if(cost[newy][newx]==-1){
					if(s[now][now]=='#'||s[newy][newx]=='.'){
						cost[newy][newx]=cost[now.first][now.second];
						q.push_front(make_pair(newy,newx));
					}
					else{
						cost[newy][newx]=cost[now.first][now.second]+1;
						q.push_back(make_pair(newy,newx));
					}
				}
				if(newy==h-1&&newx==w-1){
					cout<<cost[newy][newx];
					return 0;
				}
			}
		}
	}		
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:45: error: no match for 'operator[]' (operand types are 'char [h][w]' and 'std::pair<int, int>')
   34 |                                         if(s[now][now]=='#'||s[newy][newx]=='.'){
      |                                             ^
Language: C++

#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}
int main() {
    int h, w; cin >> h >> w;
    vector<string> v;
    REP(i, h) {
        string tmp; cin >> tmp;
        v.push_back(tmp);
    }
    int dp[110][110];
    memset(dp, 0, sizeof(dp));

    REP(i, h) {
        REP(j, w) {
            if (i == 0 && j == 0) {
                continue;
            }
            if (i == 0) {
                if (v[i][j] == v[i][j-1]) {
                    dp[i][j] = dp[i][j-1];
                } else {
                    dp[i][j] = dp[i][j-1] + 1;
                }
            } else if (j == 0) {
                if (v[i][j] == v[i-1][j]) {
                    dp[i][j] = dp[i-1][j];
                } else {
                    dp[i][j] = dp[i-1][j] + 1;
                }
            } else {
                if ((v[i][j] == v[i][j-1]) && (v[i][j] == v[i-1][j])) {
                    dp[i][j] = min(dp[i][j-1], dp[i-1][j]);
                } else if ((v[i][j] == v[i][j-1]) && (v[i][j] != v[i-1][j])) {
                    dp[i][j] = min(dp[i][j-1], dp[i-1][j]+1);
                } else if ((v[i][j] != v[i][j-1]) && (v[i][j] == v[i-1][j])) {
                    dp[i][j] = min(dp[i][j-1]+1, dp[i-1][j]);
                } else {
                    dp[i][j] = min(dp[i][j-1]+1, dp[i-1][j]+1);
                }
            }
        }
    }
    if (v[0][0] == '.' && v[h-1][w-1] == '.') {
        cout << dp[h-1][w-1] / 2 << endl;
    } else {
        cout << dp[h-1][w-1] / 2 + 1 << endl;
    }
    return 0;
}

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

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;

#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define all(x) x.begin(), x.end()

const int n, k, m = 1e9 + 7;

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

    int h, w;
    cin >> h >> w;

    vvc a(h, vc(w));
    rep(i, h) rep(j, w) cin >> a[i][j];

    vvi dp(h, vi(w, m));
    if(a[0][0] == '.') dp[0][0] = 0;
    else dp[0][0] = 1;

    int dx[] = {1, 0}, dy[] = {0, 1};
    rep(i, h) {
        rep(j, w) {
            rep(k, 2) {
                int nx = j + dx[k];
                int ny = i + dy[k];

                if(ny >= h || nx >= w) continue;
                if(a[i][j] == '.' && a[ny][nx] == '#') {
                    dp[ny][nx] = min(dp[ny][nx], dp[i][j] + 1);
                } else {
                    dp[ny][nx] = min(dp[ny][nx], dp[i][j]);
                }
            }
        }
    }

    cout << dp[h - 1][w - 1] << endl;
}

Compiler output:
a.cc:15:11: error: uninitialized 'const n' [-fpermissive]
   15 | const int n, k, m = 1e9 + 7;
      |           ^
a.cc:15:14: error: uninitialized 'const k' [-fpermissive]
   15 | const int n, k, m = 1e9 + 7;
      |              ^
Language: C++

#include<iostream>
#include<cstring>

using namespace std;

int H, W;
int grid[105][105], memo[105][105];

int findRoute(int row, int col){
    if(memo[i][j] != -1) return memo[row][col];
    if(row == H && col == W) return grid[row][col];
    if(row == H) return memo[row][col] = findRoute(row, col+1) + grid[row][col];
    if(col == W) return memo[row][col] = findRoute(row+1, col) + grid[row][col];
    return memo[row][col] = min(findRoute(row+1, col), findRoute(row, col+1)) + grid[row][col];
}

int main(){
    memset(grid, 0, sizeof(grid));
    memset(memo, -1, sizeof(memo));
    cin >> H >> W;
    for(int i=1; i<=H; i++){
        for(int j=1; j<=W; j++){
            char c;
            cin >> c;
            if(c == '#'){
                grid[i][j] = 1;
            }
        }
    }

    cout << findRoute(1, 1) << endl;
}

Compiler output:
a.cc: In function 'int findRoute(int, int)':
a.cc:10:13: error: 'i' was not declared in this scope
   10 |     if(memo[i][j] != -1) return memo[row][col];
      |             ^
a.cc:10:16: error: 'j' was not declared in this scope
   10 |     if(memo[i][j] != -1) return memo[row][col];
      |                ^
Language: C++

#include<iostream>
#include<cstring>

using namespace std;

int H, W;
int grid[105][105], memo[105][105];

int findRoute(int row, int col){
    if(memo[i][j] != -1) return memo[i][j];
    if(row == H && col == W) return grid[row][col];
    if(row == H) return memo[row][col] = findRoute(row, col+1) + grid[row][col];
    if(col == W) return memo[row][col] = findRoute(row+1, col) + grid[row][col];
    return memo[row][col] = min(findRoute(row+1, col), findRoute(row, col+1)) + grid[row][col];
}

int main(){
    memset(grid, 0, sizeof(grid));
    memset(memo, -1, sizeof(memo));
    cin >> H >> W;
    for(int i=1; i<=H; i++){
        for(int j=1; j<=W; j++){
            char c;
            cin >> c;
            if(c == '#'){
                grid[i][j] = 1;
            }
        }
    }

    cout << findRoute(1, 1) << endl;
}

Compiler output:
a.cc: In function 'int findRoute(int, int)':
a.cc:10:13: error: 'i' was not declared in this scope
   10 |     if(memo[i][j] != -1) return memo[i][j];
      |             ^
a.cc:10:16: error: 'j' was not declared in this scope
   10 |     if(memo[i][j] != -1) return memo[i][j];
      |                ^
Language: C++

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

int flip=0, h, w, mp[105][105];
char board[105][105];

bool inside(int r, int c){
    return r<=h && c<=w;
}
int dp(int r, int c){
    int sum =0;
    if(r==h && c==w){
        if(board[h][w]=='#'){
            sum=1;
        }
        return sum;
    }
    else if(mp[r][c]!=-1){
        return mp[r][c];
    }
    int result = INT_MAX;
    int dx[] ={0, 1};
    int dy[] ={1, 0};
    for(int i=0; i<2; i++){
        int nextRow = r + dx[i];
        int nextCol = c + dy[i];
        if(!inside(nextRow, nextCol))continue;
        else if(board[r][c]=='.')flip = dp(nextRow, nextCol);
        else if(board[r][c]=='#' && board[nextRow][nextCol]=='#')flip = dp(nextRow, nextCol);
        else if(board[r][c]=='#' && board[nextRow][nextCol]=='.')flip = dp(nextRow, nextCol) + 1;
        result = min(result, flip);
        mp[r][c]=result;
    }
    return result;
}

int main(){
memset(mp, -1, sizeof(mp));
    
    cin >> h >> w;
    for(int i=1; i<=h; i++){
        for(int j=1; j<=w; j++){
            cin >> board[i][j];
        }
    }
    
    cout << dp(1, 1) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:1: error: 'memset' was not declared in this scope
   40 | memset(mp, -1, sizeof(mp));
      | ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <climits>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

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

int flip=0, h, w;
char board[105][105];
bool inside(int r, int c){
    return r<=h && c<=w;
}

int dp(int r, int c){
    int sum =0;
    if(r==h && c==w){
        if(board[h][w]=='#'){
            sum=1;
        }
        return sum;
    }
    int result = INT_MAX;
    int dx[] ={0, 1};
    int dy[] ={1, 0};
    for(int i=0; i<2; i++){
        int nextRow = r + dx[i];
        int nextCol = c + dy[i];
        if(!inside(nextRow, nextCol))continue;
        else if(board[r][c]=='.')flip = dp(nextRow, nextCol);
        else if(board[r][c]=='#' && board[nextRow][nextCol]=='#')flip = dp(nextRow, nextCol);
        else if(board[r][c]=='#' && board[nextRow][nextCol]=='.')flip = dp(nextRow, nextCol) + 1;
        result = min(result, flip);
    }
    return result;
}

int main(){
    
    cin >> h >> w;
    for(int i=1; i<=h; i++){
        for(int j=1; j<=w; j++){
            cin >> board[i][j];
        }
    }
    
    cout << dp(1, 1) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int dp(int, int)':
a.cc:19:18: error: 'INT_MAX' was not declared in this scope
   19 |     int result = INT_MAX;
      |                  ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

def bfs():
    que = deque()
    que.append([0, 0])
    if s[0][0] == '#':
        d[0][0] = 1
    else:
        d[0][0] = 0

    while que:
        p = que.popleft()
        if p[0] == h-1 and p[1] == w-1:
            break

        for i in range(2):
            ny = p[0] + dy[i]
            nx = p[1] + dx[i]
            if 0 <= ny < h and 0 <= nx < w:
                que.append([ny, nx])
                if s[p[0]][p[1]] == '.' and  s[ny][nx] == '#':
                    if d[ny][nx] > d[p[0]][p[1]]+1:
                        d[ny][nx] = d[p[0]][p[1]]+1
                        que.append([ny, nx])
                else:
                    if d[ny][nx] > d[p[0]][p[1]]:
                        d[ny][nx] = d[p[0]][p[1]]
                        que.append([ny, nx])

    return d[h-1][w-1]

h, w = MAP()
s = [input() for i in range(h)]
d = [[inf]*w for i in range(h)]

dy = [1, 0]
dx = [0, 1]

print(bfs())

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define PI          acos(-1)
#define INF         100000000
#define sc(n)       scanf("%d",&n);
#define ssc(n)      scanf("%s",n);
#define lsc(n)      scanf("%lld",&n);
#define dsc(n)      scanf("%lf",&n);
#define csc(n)       scanf("%c",&n);
#define LL          long long int
#define UI          unsigned int
#define ULL         unsigned long long int
#define DB          double
#define pii         pair<int,int>
#define VI          vector<int>
#define MII         map<int,int>
#define PB          push_back
#define MP          make_pair
#define M(mx,a)     mx=max(mx,a)
#define IT          ::iterator
#define all(a)      a.begin(),a.end()
#define mems(a,b)   memset(a,b,sizeof(a))
#define F(i,a,b)    for(i=a;i<b;i++)
#define IN(n,aa)    for(i=0;i<n;i++)scanf("%d",&aa[i]);
#define PNT(n,aa)   for(i=0;i<n;i++)printf("%lld ",aa[i]);
#define mod         1000000007
#define NUM         109
#define NUM2        1000000000
int n,m;
char ch[NUM][NUM];
int vis[NUM][NUM];
int dist[NUM][NUM];
int px[]={0,1};
int py[]={1,0};

bool ck(int x,int y)
{
    if(x<n&&y<m)return 1;
    return 0;
}
bool ulala(int xx,int yy,int x,int y)
{
    return 1;
}
void bfs(int x,int y)
{
    for(int i=0;i<NUM;i++)
        for(int j=0;j<NUM;j++)
        {
            dist[i][j]=2000;
        }
    if(ch[x][y]=='.')dist[x][y]=0;
    else dist[x][y]=1;
    queue<pii>qq;
    qq.push({x,y});
    while(!qq.empty())
    {
        x=qq.front().first,y=qq.front().second;
        qq.pop();
        for(int i=0;i<2;i++)
        {
            int xx=x+px[i],yy=y+py[i];
            if(!vis[xx][yy])
            {
                qq.push({xx,yy});
                vis[xx][yy]=1;
            }
            if(ck(xx,yy) )
            {
                qq.push({xx,yy});
                vis[x][y][xx][yy]++;
                if(ch[xx][yy]=='.')dist[xx][yy]=min(dist[xx][yy],dist[x][y]);
                else dist[xx][yy]=min(dist[xx][yy],dist[x][y]+1);
            }
        }
    }
}

int main()
{
    int T=1,QQ=0;
    //cin >> T ;
    while(T--)
    {
        int i,j;
        cin >> n >> m ;
        for(i=0;i<n;i++)
        {
            cin >> ch[i] ;
        }
        bfs(0,0);
        cout << dist[n-1][m-1] ;
    }
}

//printf("Case %d: ",++QQ);


Compiler output:
a.cc: In function 'void bfs(int, int)':
a.cc:71:26: error: invalid types 'int[int]' for array subscript
   71 |                 vis[x][y][xx][yy]++;
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  rep(i,0,h) cin>>s[i];
  int dp[h][w];
  rep(i,0,h){
   rep(j,0,w)dp[h][w]=0; 
  }
  dp[h-1][w-1]=0;
  for(int i=h-1;h>=0;h--){
    for(int j=w-1;w>=0;w--;){
      むじーーーーー
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:27: error: expected ')' before ';' token
   28 |     for(int j=w-1;w>=0;w--;){
      |        ~                  ^
      |                           )
a.cc:28:28: error: expected primary-expression before ')' token
   28 |     for(int j=w-1;w>=0;w--;){
      |                            ^
Language: C++

# include <iostream>
# include <climits>
using namespace std;
int dp[105][105];
char grid[105][105];
int R, C;
int dx[] = {1,0};
int dy[] = {0,1};
bool inside(int r, int c){
  return 1<=r && r<=R && 1<=c && c<=C;
}

int solve(int r,int c){
  if(r == R && c == C) return grid[r][c] == '#';
  if(dp[r][c] != -1) return dp[r][c];

  int ans = INT_MAX;
  for(int d=0; d<2; d++){
    int nxr = r+dx[d];
    int nxc = c+dy[d];
    if(!inside(nxr, nxc)) continue;
    ans = min(ans, solve(nxr, nxc) + (grid[r][c] == '#'));
  }
  return dp[r][c] = ans;
}

int main(){
  memset(dp, -1, sizeof(dp));
  cin >> R >> C;
  for(int i=1; i<=R; i++){
    for(int j=1; j<=C; j++)
      cin >> grid[i][j];
  }

  cout << solve(1,1) << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:3: error: 'memset' was not declared in this scope
   28 |   memset(dp, -1, sizeof(dp));
      |   ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | # include <climits>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <bits/stdc++.h>

using namespace std;

bool vis[102][102];
string s[102];
int h, w, cnt;
int dx[] = {1, 0};
int dy[] = {0, 1};

bool in_range(int x, int n)
{
    return x >= 0 and x <= n-1;
}

void dfs(int i, int j, int c)
{
    if(s[i][j] == '#')
        c ++;

    if(i == h-1 and j == w-1) {
        cnt = min(cnt, c);
        return;
    }

    vis[i][j] = 1;

    for(int k=0; k<2; k++) {
        int x = i + dx[k], y = j + dy[k];

        if(in_range(x, h) and in_range(y, w) and !visit[x][y]) {
            dfs(x, y, c);
        }
    }

    vis[i][j] = 0; c -= s[i][j] == '#';
}

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

    for(int i=0; i<h; i++)
        cin >> s[i];

    cnt = 1e9; dfs(0, 0, 0);

    cout << cnt;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:31:56: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   31 |         if(in_range(x, h) and in_range(y, w) and !visit[x][y]) {
      |                                                        ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

bool visit[102][102];
string s[102];
int h, w, cnt;
int dx[] = {1, 0};
int dy[] = {0, 1};

bool in_range(int x, int n)
{
    return x >= 0 and x <= n-1;
}

void dfs(int i, int j, int c)
{
    if(s[i][j] == '#')
        c ++;

    if(i == h-1 and j == w-1) {
        cnt = min(cnt, c);
        return;
    }

    visit[i][j] = 1;

    for(int k=0; k<2; k++) {
        int x = i + dx[k], y = j + dy[k];

        if(in_range(x, h) and in_range(y, w) and !visit[x][y]) {
            dfs(x, y, c);
        }
    }

    visit[i][j] = 0; c -= s[i][j] == '#';
}

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

    for(int i=0; i<h; i++)
        cin >> s[i];

    cnt = 1e9; dfs(0, 0, 0);

    cout << cnt;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:26:5: error: reference to 'visit' is ambiguous
   26 |     visit[i][j] = 1;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:5:6: note:                 'bool visit [102][102]'
    5 | bool visit[102][102];
      |      ^~~~~
a.cc:31:51: error: reference to 'visit' is ambiguous
   31 |         if(in_range(x, h) and in_range(y, w) and !visit[x][y]) {
      |                                                   ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:5:6: note:                 'bool visit [102][102]'
    5 | bool visit[102][102];
      |      ^~~~~
a.cc:36:5: error: reference to 'visit' is ambiguous
   36 |     visit[i][j] = 0; c -= s[i][j] == '#';
      |     ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:5:6: note:                 'bool visit [102][102]'
    5 | bool visit[102][102];
      |      ^~~~~
Language: C++

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

vector<vector<char>> a(100,vector<char>(100));

int dp(int x, int y) {
  if(x==h-1&&y==w-1) {
    if(a[x][y]=='#') {
      return 1;
    } else return 0;
  }
  int xx=300, yy=300;
  if(x>0) xx=dp(x-1,y);
  if(y>0) yy=dp(x,y-1);
  if(a[x][y]='#') {
    if(a[x-1][y]=='.') xx++;
    if(a[x][y-1]=='.') yy++;
  }
  return min(xx,yy);
}

int main() {
  int h, w;
  cin >> h >> w;
  rep(i,h) {
    rep(j,w) {
      cin >> a[i][j];
    }
  }
  
  cout << dp(0,0) << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int dp(int, int)':
a.cc:11:9: error: 'h' was not declared in this scope
   11 |   if(x==h-1&&y==w-1) {
      |         ^
a.cc:11:17: error: 'w' was not declared in this scope
   11 |   if(x==h-1&&y==w-1) {
      |                 ^
Language: C++

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;
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;
}
ll dp[110][110];
ll row[2] = {1,0};
ll column[2] = {0,1};

constexpr ll INF = 1145141919810;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll h,w;
cin >> h >> w;
vector<string> grid(h);
rep(i,h)
cin >> grid[i];
rep(i,h){
    rep(j,w){
        dp[i][j] = INF;
    }
}
dp[0][0] = 0;

if(grid[0][0] == '#') {
    dp[0][0] = 1;
}
rep(i,h) {
    rep(j, w) {
        rep(k,2){
            if(i + row[k] >= h || j + column[k] >= w)
                continue;
            ll tmp = 0;
            if(grid[i + row[k]][j + column[k]] == '#' && grid[i][j] = '#')
                tmp = 1;
            chmin(dp[i + row[k]][j + column[k]],dp[i][j]);
        }
    }
}
cout << dp[h - 1][w - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:55: error: lvalue required as left operand of assignment
   44 |             if(grid[i + row[k]][j + column[k]] == '#' && grid[i][j] = '#')
Language: C

#include <stdio.h>

int main(void){
    int h,w;   
    scanf("%d %d",&h,&w);
    int cnt[h][w] = {0};
    char s[h][w];
    for(int i = 0;i < h;i++)    scanf("%s",s[i]);
 
    if(s[0][0] == '#') cnt[0][0] = 1;
    for(int i = 1;i < h;i ++) cnt[i][0] = cnt[i-1][0] + ((s[i][0] != s[i-1][0])?1:0);
    for(int i = 1;i < w;i ++) cnt[0][i] = cnt[0][i-1] + ((s[0][i] != s[0][i-1])?1:0);
    
    int from_up,from_side;
    for(int i = 1;i<h;i++)
        for(int j = 1; j < w;j++){
            from_up = cnt[i][j-1] + ((s[i][j] != s[i][j-1])?1:0);
            from_side = cnt[i-1][j] + ((s[i][j] != s[i-1][j])?1:0);
            cnt[i][j] = (from_side < from_up)?from_side:from_up;
        } 
    printf("%d\n",(cnt[h-1][w-1]+1)/2);
}

Compiler output:
main.c: In function 'main':
main.c:6:21: error: variable-sized object may not be initialized except with an empty initializer
    6 |     int cnt[h][w] = {0};
      |                     ^
Language: C++

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

struct DJK
{
	int i, j, w;
	bool operator < (const DJK & o) const{
		return w > o.w;
	}
};

priority_queue<DJK> djk;
int dis[111][111];
bool visit[111][111];
char str[111][111];

int main()
{
	int n, m;
	scanf(" %d %d",&n,&m);
	for(int i=1 ; i<=n ; i++)
		for(int j=1 ; j<=m ; j++)
		{
			scanf(" %c",&str[i][j]);
			dis[i][j] = 1e9;
		}
	dis[1][1] = (str[1][1] == '#');
	djk.push({1, 1, dis[1][1]});
	while(!djk.empty())
	{
		int i = djk.top().i;
		int j = djk.top().j;
		int w = djk.top().w;
		djk.pop();
		if(visit[i][j]) continue ;
		visit[i][j] = true;
		if(i == n && j == m)
		{
			printf("%d\n",w);
			return 0;
		}
		if(i < n && dis[i+1][j] > w + (arr[i+1][j] == '#'))
		{
			dis[i+1][j] = w + (arr[i+1][j] == '#');
			djk.push({i+1, j, dis[i+1][j]});
		}
		if(j < m && dis[i][j+1] > w + (arr[i][j+1] == '#'))
		{
			dis[i][j+1] = w + (arr[i][j+1] == '#');
			djk.push({i, j+1, dis[i][j+1]});
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:20: error: reference to 'visit' is ambiguous
   35 |                 if(visit[i][j]) continue ;
      |                    ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:14:6: note:                 'bool visit [111][111]'
   14 | bool visit[111][111];
      |      ^~~~~
a.cc:36:17: error: reference to 'visit' is ambiguous
   36 |                 visit[i][j] = true;
      |                 ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:14:6: note:                 'bool visit [111][111]'
   14 | bool visit[111][111];
      |      ^~~~~
a.cc:42:48: error: 'arr' was not declared in this scope
   42 |                 if(i < n && dis[i+1][j] > w + (arr[i+1][j] == '#'))
      |                                                ^~~
a.cc:47:48: error: 'arr' was not declared in this scope
   47 |                 if(j < m && dis[i][j+1] > w + (arr[i][j+1] == '#'))
      |                                                ^~~
Language: C++

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

int r,c;
int mat[1000][1000];
string c[1000];

int main(){
  cin>>r>>c;
  for(int i=0;i<r;i++){
    cin>>c[i];  
  }
  if(c[0][0]=='#')mat[0][0]=1;
  for(int j=1;j<c;j++){
   if(c[0][j]=='#'&&c[0][j-1]=='.')mat[0][j]=1+mat[0][j-1];
   else mat[0][j]=mat[0][j-1];
  }
  for(int i=1;i<r;i++){
   if(c[i][0]=='#'&&c[i-1][0]=='.')mat[i][0]=1+mat[i-1][0];
   else mat[i][0]=mat[i-1][0];
   for(int j=1;j<c;j++){
     int a,b;
     if(c[i][j]=='#'&&c[i][j-1]=='.')a=1+mat[i][j-1];
   	 else a=mat[i][j-1];
     if(c[i][j]=='#'&&c[i-1][j]=='.')b=1+mat[i-1][j];
   	 else b=mat[i-1][j];
     mat[i][j]=min(a,b);
   }
  }
  cout<<mat[r-1][c-1];
}


Compiler output:
a.cc:6:8: error: conflicting declaration 'std::string c [1000]'
    6 | string c[1000];
      |        ^
a.cc:4:7: note: previous declaration as 'int c'
    4 | int r,c;
      |       ^
a.cc: In function 'int main()':
a.cc:11:11: error: invalid types 'int[int]' for array subscript
   11 |     cin>>c[i];
      |           ^
a.cc:13:7: error: invalid types 'int[int]' for array subscript
   13 |   if(c[0][0]=='#')mat[0][0]=1;
      |       ^
a.cc:15:8: error: invalid types 'int[int]' for array subscript
   15 |    if(c[0][j]=='#'&&c[0][j-1]=='.')mat[0][j]=1+mat[0][j-1];
      |        ^
a.cc:15:22: error: invalid types 'int[int]' for array subscript
   15 |    if(c[0][j]=='#'&&c[0][j-1]=='.')mat[0][j]=1+mat[0][j-1];
      |                      ^
a.cc:19:8: error: invalid types 'int[int]' for array subscript
   19 |    if(c[i][0]=='#'&&c[i-1][0]=='.')mat[i][0]=1+mat[i-1][0];
      |        ^
a.cc:19:22: error: invalid types 'int[int]' for array subscript
   19 |    if(c[i][0]=='#'&&c[i-1][0]=='.')mat[i][0]=1+mat[i-1][0];
      |                      ^
a.cc:23:10: error: invalid types 'int[int]' for array subscript
   23 |      if(c[i][j]=='#'&&c[i][j-1]=='.')a=1+mat[i][j-1];
      |          ^
a.cc:23:24: error: invalid types 'int[int]' for array subscript
   23 |      if(c[i][j]=='#'&&c[i][j-1]=='.')a=1+mat[i][j-1];
      |                        ^
a.cc:25:10: error: invalid types 'int[int]' for array subscript
   25 |      if(c[i][j]=='#'&&c[i-1][j]=='.')b=1+mat[i-1][j];
      |          ^
a.cc:25:24: error: invalid types 'int[int]' for array subscript
   25 |      if(c[i][j]=='#'&&c[i-1][j]=='.')b=1+mat[i-1][j];
      |                        ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include<bits/stdc++.h>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
using namespace std;
#include <map>
#define rep(i,N) for (ll i = 0; i < (N); i++)
using ll = long long;

ll dp[1000][1000];
int main() {
  ll H,W;
  cin >> H >> W;
  char GRID[H][W];
  rep(i,H){
    string S; cin >> S;
    rep(j,W){
      GRID[i][j] = s[j];
      dp[i][j] = 0;
    }
  }
  if(GRID[0][0] == '#')dp[0][0]++;
  rep(i,H){
    rep(j,W){
      if(i==0&&j==0)continue;
      else if(i==0){
        if(GRID[i][j] == '.' && GRID[i][j-1] == '#')dp[i][j] = dp[i][j-1]+1;
        else dp[i][j] = dp[i][j-1];
      }
      else if(j==0){
        if(GRID[i][j] == '.' && GRID[i-1][j] == '#')dp[i][j] = dp[i-1][j]+1;
        else dp[i][j] = dp[i-1][j];
      }
      else {
        ll P = 0,Q = 0; //P:☝からくる場合,Q:←からくる場合
        if(GRID[i][j] == '.' && GRID[i-1][j] == '#')P++;
        if(GRID[i][j] == '.' && GRID[i][j-1] == '#')Q++;
        P += dp[i-1][j];
        Q += dp[i][j-1];
        dp[i][j] = min(P,Q);
      }
    }
  }
  cout << dp[H-1][W-1] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:20: error: 's' was not declared in this scope
   24 |       GRID[i][j] = s[j];
      |                    ^
Language: C++

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

static const ll INF = 1e9+7;
ll dx[] = {1,0};
ll dy[] = {0,1};

typedef long long ll;

ll main(){
    ll H,W;
    cin>>H>>W;
    char s[100+10][100+10];

    for(ll i=0; i<H; i++){
        for(ll j=0; j<W; j++){
            cin>>s[i][j];
        }
    }

    vector<vector<ll>> dp(H+10,vector<ll>(W+10,INF));

    dp[0][0] = 0;
    if(s[0][0] == '#') dp[0][0]++;

    for(ll i=0; i<H; i++){
        for(ll j=0; j<W; j++){
            for(ll k=0; k<2; k++){
                ll nx = j + dx[k];
                ll ny = i + dy[k];
                if(nx >= H || ny >= W) continue;
                if(s[i][j] == '#' && s[ny][nx] == '.') dp[ny][nx] = min(dp[ny][nx],dp[i][j]+1);
                else dp[ny][nx] = min(dp[ny][nx],dp[i][j]);
            }
        }
    }

    cout<<dp[H-1][W-1]<<endl;

    return 0;
}

Compiler output:
a.cc:4:14: error: 'll' does not name a type
    4 | static const ll INF = 1e9+7;
      |              ^~
a.cc:5:1: error: 'll' does not name a type
    5 | ll dx[] = {1,0};
      | ^~
a.cc:6:1: error: 'll' does not name a type
    6 | ll dy[] = {0,1};
      | ^~
a.cc:10:1: error: '::main' must return 'int'
   10 | ll main(){
      | ^~
a.cc: In function 'int main()':
a.cc:21:48: error: 'INF' was not declared in this scope
   21 |     vector<vector<ll>> dp(H+10,vector<ll>(W+10,INF));
      |                                                ^~~
a.cc:29:29: error: 'dx' was not declared in this scope; did you mean 'nx'?
   29 |                 ll nx = j + dx[k];
      |                             ^~
      |                             nx
a.cc:30:29: error: 'dy' was not declared in this scope; did you mean 'ny'?
   30 |                 ll ny = i + dy[k];
      |                             ^~
      |                             ny
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
int main(){
	int h,w;
	char a[100][100];
	int d[100][100];
	cin>>h>>w;
	int ans=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>a[i][j];
		}
	}
	d[0][0]=0;
	for(int i=1;i<w;i++){
		if(a[0][i]!=a[0][i-1]){
			d[0][i]=d[0][i-1]+1;
		}else{
			d[0][i]=d[0][i-1];
		}
	}
	for(int i=1;i<h;i++){
		if(a[i][0]!=a[i-1][0]){
			d[i][0]=d[i-1][0]+1;
		}else{
			d[i][0]=d[i-1][0];
		}
	}
	for(int i=1;i<h;i++){
		for(int j=1;j<w;j++){
			if(a[i][j]!=a[i-1][j]){
				d[i][j]=d[i-1][j]+1;
			}else{
				d[i][j]=d[i-1][j];
			}
			if(a[i][j]!=a[i][j-1]){
				d[i][j]=min(d[i][j],d[i][j-1]+1);
			}else{
				d[i][j]=min(d[i][j],d[i][j-1]);
			}
		}
	}
	int ans=d[h-1][w-1]/2;
	if(ans==0){
		if(d[0][0]=='.'){
			cout<<0<<endl;
		}else{
			cout<<1<<endl;
		}
	}else{
		cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:13: error: redeclaration of 'int ans'
   56 |         int ans=d[h-1][w-1]/2;
      |             ^~~
a.cc:21:13: note: 'int ans' previously declared here
   21 |         int ans=0;
      |             ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,i,j;
	scanf("%d %d",&n,&m);
	char grid[n][m];
	for(i=0;i<n;++i)
	{
		for(j=0;j<m;++j)
		{
			scanf(" %c",&grid[i][j]);
		}
	}
	int dp[n][m];
	for(i=0;i<n;++i)
	{
		for(j=0;j<m;++j)
		{
			dp[i][j] = 100000;
			if(i==0&&j==0)			{};
			else if(i==0)			dp[i][j] = dp[i][j-1];
			else if(j==0)			dp[i][j] = dp[i-1][j];	
			else					dp[i][j] = min(dp[i-1][j],dp[i][j-1]);
			if(grid[i][j]=='#')		dp[i][j]++;
		}
	}
	printf("%d",dp[n-1][m-1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: 'else' without a previous 'if'
   22 |                         else if(i==0)                   dp[i][j] = dp[i][j-1];
      |                         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,i,j;
	scanf("%d %d",&n,&m);
	char grid[n][m];
	for(i=0;i<n;++i)
	{
		for(j=0;j<m;++j)
		{
			scanf(" %c",&grid[i][j]);
		}
	}
	int dp[n][m];
	for(i=0;i<n;++i)
	{
		for(j=0;j<m;++j)
		{
			dp[i][j] = 0;
			if(i==0&&j==0)			{};
			else if(i==0)			dp[i][j] = dp[i][j-1];
			else if(j==0)			dp[i][j] = dp[i-1][j];	
			else					dp[i][j] = min(dp[i-1][j],dp[i][j-1]);
			if(grid[i][j]=='#')		dp[i][j]++;
		}
	}
	printf("%d",dp[n-1][m-1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: 'else' without a previous 'if'
   22 |                         else if(i==0)                   dp[i][j] = dp[i][j-1];
      |                         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

ll h,w,costs=1e9;
vector<vector<char>> G(h);

void dfs(P s,P g,ll z) {
  if(G[s.first][s.second]=='.'&&G[g.first][g.second]=='#') z++;
  if(g.first==h-1&&g.second==w-1) cost=min(cost,z);
  else {
    if(g.first+1<h) dfs(g,P(g.first+1,g.second),z);
    if(g.second+1<w) dfs(g,P(g.first,g.second+1),z);
  }
  return;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>h>>w;G.resize(h);
  string s;
  rep(i,h) {cin>>s;rep(j,w) G[i].emplace_back(s[j]);}
  ll z=(G[0][0]=='#')?1:0;
  dfs(P(0,0),P(0,0),z);
  print(cost);
  return 0;
}

Compiler output:
a.cc: In function 'void dfs(std::pair<long long int, long long int>, std::pair<long long int, long long int>, long long int)':
a.cc:18:35: error: 'cost' was not declared in this scope; did you mean 'costs'?
   18 |   if(g.first==h-1&&g.second==w-1) cost=min(cost,z);
      |                                   ^~~~
      |                                   costs
a.cc: In function 'int main()':
a.cc:34:9: error: 'cost' was not declared in this scope; did you mean 'costs'?
   34 |   print(cost);
      |         ^~~~
a.cc:11:27: note: in definition of macro 'print'
   11 | #define print(a) cout << (a) << endl
      |                           ^
Language: C++

#include <bits/stdc++.h>

using namespace std ;
typedef long long ll;
typedef string str;
typedef vector<int> vint;
typedef vector<double> vdou ;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<str> vstr;
typedef pair<int, int> pii;
typedef vector<pii> vpii ;

#define REP(i, n) for (ll (i) = 0; (i) < (ll)(n); i++) 
#define FOR(i, a, b) for(ll (i) = a; (i) < (ll)b; i++)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define CHI 1000000000000000003
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (ll)x.size()
#define SP(x)  setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w ;
  cin >> h >> w ;
  vtsr grid(h) ;
  REP(i,n){
    cin >> grid[i] ;
  }
  vvint num(h,vint(w,0)) ;
  if(grid[0][0]=='#'){
    num[0][0] = 1 ;
  }
  FOR(i,1,w){
    if(grid[0][i]=='#'){
      num[0][i] = num[0][i-1] + 1 ;
    }
    else{
      num[0][i] = num[0][i-1] ;
    }
  }
  FOR(i,1,h){
    if(grid[i][0]=='#'){
      num[i][0] = num[i-1][0] + 1 ;
    }
    else{
      num[i][0] = num[i-1][0] ;
    }
  }
  FOR(i,1,h){
    FOR(j,1,w){
      if(grid[i][j]=='#'){
        num[i][j] = min(num[i][j-1],num[i-1][j]) + 1  ;
      }
      else{
        num[i][j] = min(num[i][j-1],num[i-1][j]) ;
      }
    }
  }
  
  cout << num[h-1][w-1] <<endl ;
  
  
  
      
  
  
  
  return 0 ;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:65:3: error: 'vtsr' was not declared in this scope; did you mean 'vstr'?
   65 |   vtsr grid(h) ;
      |   ^~~~
      |   vstr
a.cc:66:9: error: 'n' was not declared in this scope
   66 |   REP(i,n){
      |         ^
a.cc:14:47: note: in definition of macro 'REP'
   14 | #define REP(i, n) for (ll (i) = 0; (i) < (ll)(n); i++)
      |                                               ^
a.cc:67:12: error: 'grid' was not declared in this scope
   67 |     cin >> grid[i] ;
      |            ^~~~
a.cc:70:6: error: 'grid' was not declared in this scope
   70 |   if(grid[0][0]=='#'){
      |      ^~~~
a.cc:74:8: error: 'grid' was not declared in this scope
   74 |     if(grid[0][i]=='#'){
      |        ^~~~
a.cc:82:8: error: 'grid' was not declared in this scope
   82 |     if(grid[i][0]=='#'){
      |        ^~~~
a.cc:91:10: error: 'grid' was not declared in this scope
   91 |       if(grid[i][j]=='#'){
      |          ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std ;
typedef long long ll;
typedef string str;
typedef vector<int> vint;
typedef vector<double> vdou ;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<str> vstr;
typedef pair<int, int> pii;
typedef vector<pii> vpii ;

#define REP(i, n) for (ll (i) = 0; (i) < (ll)(n); i++) 
#define FOR(i, a, b) for(ll (i) = a; (i) < (ll)b; i++)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define CHI 1000000000000000003
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (ll)x.size()
#define SP(x)  setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w ;
  cin >> h >> w ;
  vtsr grid(h) ;
  REP(i,n){
    cin >> grid[i] ;
  }
  vvint num(h,vint(w,0)) ;
  if(grid[0][0]=='#'){
    num[0][0] = 1 ;
  }
  FOR(i,1,w){
    if(grod[0][i]=='#'){
      num[0][i] = num[0][i-1] + 1 ;
    }
    else{
      num[0][i] = num[0][i-1] ;
    }
  }
  FOR(i,1,h){
    if(grod[i][0]=='#'){
      num[i][0] = num[i-1][0] + 1 ;
    }
    else{
      num[i][0] = num[i-1][0] ;
    }
  }
  FOR(i,1,h){
    FOR(j,1,w){
      if(grid[i][j]=='#'){
        num[i][j] = min(num[i][j-1],num[i-1][j]) + 1  ;
      }
      else{
        num[i][j] = min(num[i][j-1],num[i-1][j]) ;
      }
    }
  }
  
  cout << num[h-1][w-1] <<endl ;
  
  
  
      
  
  
  
  return 0 ;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:65:3: error: 'vtsr' was not declared in this scope; did you mean 'vstr'?
   65 |   vtsr grid(h) ;
      |   ^~~~
      |   vstr
a.cc:66:9: error: 'n' was not declared in this scope
   66 |   REP(i,n){
      |         ^
a.cc:14:47: note: in definition of macro 'REP'
   14 | #define REP(i, n) for (ll (i) = 0; (i) < (ll)(n); i++)
      |                                               ^
a.cc:67:12: error: 'grid' was not declared in this scope
   67 |     cin >> grid[i] ;
      |            ^~~~
a.cc:70:6: error: 'grid' was not declared in this scope
   70 |   if(grid[0][0]=='#'){
      |      ^~~~
a.cc:74:8: error: 'grod' was not declared in this scope
   74 |     if(grod[0][i]=='#'){
      |        ^~~~
a.cc:82:8: error: 'grod' was not declared in this scope
   82 |     if(grod[i][0]=='#'){
      |        ^~~~
a.cc:91:10: error: 'grid' was not declared in this scope
   91 |       if(grid[i][j]=='#'){
      |          ^~~~
Language: Java

import java.util.*;

class Main{
	public static void main(String[] $){
		final Scanner s=new Scanner(System.in);
		int h=s.nextInt();
		int w=s.nextInt();
		int[][] a=new int[h+1][w+1];
		int[][] c=new char[h+1][w+1];

		Arrays.fill(a[0], 99999);
		for(int i=2;i<=h;++i)
			a[i][0]=99999;
		c[1][0]='.';

		for(int i=1;i<=h;++i){
			String t=s.next();
			for(int j=1;j<=w;++j){
				c[i][j]=t.charAt(j-1);

				int u=(c[i][j]!=c[i-1][j]?1:0)+a[i-1][j];
				int l=(c[i][j]!=c[i][j-1]?1:0)+a[i][j-1];
				a[i][j]=Math.min(u,l);
			}
		}
		System.out.println((a[h][w]+1)/2);
	}
}


Compiler output:
Main.java:9: error: incompatible types: char[][] cannot be converted to int[][]
		int[][] c=new char[h+1][w+1];
		          ^
1 error