Language: C++

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <algorithm>

using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};


template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
using Graph =vector<vector<int>>;
//xor ^

int data[100][100];
int high=0;
int width=0;

int main(){
  cin>>high>>width;
  int ans[high][width];
  REP(i,high){
    REP(j,width){
      char tmp;cin>>tmp;
      if(tmp=='#'){
        data[i][j]=1;
      }else{
        data[i][j]=0;
      }
      ans[i][j]=999;
    }
  }
  ans[0][0]=0;
  ans[1][0]=0;
  ans[0][1]=0;
  if(data[0][0]==1){
    ans[0][0]=1;
    ans[1][0]=1;
    ans[0][1]=1;
  }
  if(data[0][0]==0&&data[1][0]==1){
    ans[1][0]=1;
  }
  if(data[0][0]==0&&data[0][1]==1){
    ans[0][1]=1;
  }
  for(int i=1;i<width;i++){
    for(int j=1;j<high;j++){
      if(data[i][j]==1&&data[i-1][j]==0){
        if(ans[i][j]<ans[i-1][j]){

        }else{
          ans[i][j]=ans[i-1][j]+1;
          continue;
        }
      }
      if(data[i][j]==1&&data[i][j-1]==0){
        if(ans[i][j]<ans[i][j-1]){

        }else{
          ans[i][j]=ans[i][j-1]+1;
          continue;
        }
      }
      if(ans[i][j]>ans[i][j-1]){
        ans[i][j]=ans[i][j-1];
      }
      if(ans[i][j]>ans[i-1][j]){
        ans[i][j]=ans[i-1][j];
      }
    }
  }
  cout<<ans[width-1][high-1]<<endl;
}

Compiler output:
a.cc:14:9: error: 'vector' does not name a type
   14 | typedef vector<int> VI;
      |         ^~~~~~
a.cc:15:9: error: 'vector' does not name a type
   15 | typedef vector<ll> VL;
      |         ^~~~~~
a.cc:16:9: error: 'vector' does not name a type
   16 | typedef vector<double> VD;
      |         ^~~~~~
a.cc:17:9: error: 'vector' does not name a type
   17 | typedef vector<VI> VVI;
      |         ^~~~~~
a.cc:18:9: error: 'vector' does not name a type
   18 | typedef vector<VL> VVL;
      |         ^~~~~~
a.cc:19:9: error: 'vector' does not name a type
   19 | typedef vector<VD> VVD;
      |         ^~~~~~
a.cc:22:13: error: 'vector' does not name a type
   22 | using Graph=vector<vector<int>>;
      |             ^~~~~~
a.cc:28:14: error: 'vector' does not name a type
   28 | using Graph =vector<vector<int>>;
      |              ^~~~~~
a.cc: In function 'int main()':
a.cc:42:9: error: reference to 'data' is ambiguous
   42 |         data[i][j]=1;
      |         ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:31:5: note:                 'int data [100][100]'
   31 | int data[100][100];
      |     ^~~~
a.cc:44:9: error: reference to 'data' is ambiguous
   44 |         data[i][j]=0;
      |         ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:31:5: note:                 'int data [100][100]'
   31 | int data[100][100];
      |     ^~~~
a.cc:52:6: error: reference to 'data' is ambiguous
   52 |   if(data[0][0]==1){
      |      ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:31:5: note:                 'int data [100][100]'
   31 | int data[100][100];
      |     ^~~~
a.cc:57:6: error: reference to 'data' is ambiguous
   57 |   if(data[0][0]==0&&data[1][0]==1){
      |      ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:31:5: note:                 'int data [100][100]'
   31 | int data[100][100];
      |     ^~~~
a.cc:57:21: error: reference to 'data' is ambiguous
   57 |   if(data[0][0]==0&&data[1][0]==1){
      |                     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:31:5: note:                 'int data [100][100]'
   31 | int data[100][100];
      |     ^~~~
a.cc:60:6: error: reference to 'data' is ambiguous
   60 |   if(data[0][0]==0&&data[0][1]==1){
      |      ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:31:5: note:                 'int data [100][100]'
   31 | int data[100][100];
      |     ^~~~
a.cc:60:21: error: reference to 'data' is ambiguous
   60 |   if(data[0][0]==0&&data[0][1]==1){
      |                     ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:31:5: note:                 'int data [100][100]'
   31 | int data[100][100];
      |     ^~~~
a.cc:65:10: error: reference to 'data' is ambiguous
   65 |       if(data[i][j]==1&&data[i-1][j]==0){
      |          ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Containe