Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
#include <queue>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;


int main(){

    int h,w;
    cin>>h>>w;
    vector<string> grid(h);
    REP(i,h){
        cin>>grid[i];
    }
    vector<vector<long long int> > resultgrid(h,vector<long long int>(w,linf));
    struct Section{
        long long int y;
        long long int x;
        long long int cost;
    };
    queue<Section> q;
    Section sectmp = {0, 0, 0};
    {
        resultgrid[0][0] = 0;
        Section sectmp = {0, 0, 0};
        if(grid[0][0]=='#'){
            sectmp.cost++;
            resultgrid[0][0]++;
        }
        q.push(sectmp);
    }
    while(!q.empty()){
        if(q.front().cost>resultgrid[q.front().y][q.front().x]){
            goto END;
        }
        if(q.front().x<w-1){
            if(resultgrid[q.front().y][q.front().x+1]>q.front().cost){
                resultgrid[q.front().y][q.front().x + 1] = q.front().cost + (grid[q.front().y][q.front().x + 1] == '#' ? 1 : 0);
                sectmp = {q.front().y, q.front().x+1, resultgrid[q.front().y][q.front().x + 1]};
                q.push(sectmp);
            }
        }
        if(q.front().y<h-1){
            if(resultgrid[q.front().y+1][q.front().x]>q.front().cost){
                resultgrid[q.front().y+1][q.front().x ] = q.front().cost + (grid[q.front().y+1][q.front().x] == '#' ? 1 : 0);
                sectmp = {q.front().y+1, q.front().x, resultgrid[q.front().y+1][q.front().x ] };
                q.push(sectmp);
            }
        }

        END:;
            q.pop();
    }
    cout << resultgrid[h - 1][w - 1] << endl;
    return 0;
}
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
#include <queue>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;


int main(){

    int h,w;
    cin>>h>>w;
    vector<string> grid(h);
    REP(i,h){
        cin>>grid[i];
    }
    vector<vector<long long int> > resultgrid(h,vector<long long int>(w,linf));
    struct Section{
        long long int y;
        long long int x;
        long long int cost;
    };
    queue<Section> q;
    Section sectmp = {0, 0, 0};
    {
        resultgrid[0][0] = 0;
        Section sectmp = {0, 0, 0};
        if(grid[0][0]=='#'){
            sectmp.cost++;
            resultgrid[0][0]++;
        }
        q.push(sectmp);
    }
    while(!q.empty()){
        if(q.front().cost>resultgrid[q.front().y][q.front().x]){
            goto END;
        }
        if(q.front().x<w-1){
            if(resultgrid[q.front().y][q.front().x+1]>q.front().cost){
                resultgrid[q.front().y][q.front().x + 1] = q.front().cost + (grid[q.front().y][q.front().x + 1] == '#' ? 1 : 0);
                sectmp = {q.front().y, q.front().x+1, resultgrid[q.front().y][q.front().x + 1]};
                q.push(sectmp);
            }
        }
        if(q.front().y<h-1){
            if(resultgrid[q.front().y+1][q.front().x]>q.front().cost){
                resultgrid[q.front().y+1][q.front().x ] = q.front().cost + (grid[q.front().y+1][q.front().x] == '#' ? 1 : 0);
                sectmp = {q.front().y+1, q.front().x, resultgrid[q.front().y+1][q.front().x ] };
                q.push(sectmp);
            }
        }

        END:;
            q.pop();
    }
    cout << resultgrid[h - 1][w - 1] << endl;
    return 0;
}


Compiler output:
a.cc:94:25: error: redefinition of 'constexpr const long long int linf'
   94 | constexpr long long int linf = numeric_limits<long long int>::max()-5;
      |                         ^~~~
a.cc:20:25: note: 'constexpr const long long int linf' previously defined here
   20 | constexpr long long int linf = numeric_limits<long long int>::max()-5;
      |                         ^~~~
a.cc:95:15: error: redefinition of 'constexpr const int inf'
   95 | constexpr int inf= numeric_limits<int>::max()-5;
      |               ^~~
a.cc:21:15: note: 'constexpr const int inf' previously defined here
   21 | constexpr int inf= numeric_limits<int>::max()-5;
      |               ^~~
a.cc:96:25: error: redefinition of 'constexpr const long long int mod'
   96 | constexpr long long int mod = 1000000007;
      |                         ^~~
a.cc:22:25: note: 'constexpr const long long int mod' previously defined here
   22 | constexpr long long int mod = 1000000007;
      |                         ^~~
a.cc:99:5: error: redefinition of 'int main()'
   99 | int main(){
      |     ^~~~
a.cc:25:5: note: 'int main()' previously defined here
   25 | int main(){
      |     ^~~~