Language: C++

#include<bits/stdc++.h>
using namespace std;
int data[105][105];
int f[105][105];
signed main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(register int i=1;i<=n;++i)
		for(register int j=1;j<=m;++j){
			char c;
			while((c=getchar())!='.'&&c!='#');
			data[i][j]=(c=='#');
		}
	f[1][1]=data[1][1];
	for(register int i=2;i<=n;i++){
		f[i][1]=f[i-1][1]+(data[i][1]&&!data[i-1][1]);
	}
	for(register int j=2;j<=m;j++){
		f[1][j]=f[1][j-1]+(data[1][j]&&!data[1][j-1]);
	}
	for(register int i=2;i<=n;i++)
		for(register int j=2;j<=m;j++){
			f[i][j]=min(f[i-1][j]+(data[i][j]&&!data[i-1][j]),f[i][j-1]+(data[i][j]&&!data[i][j-1]));
		}
	printf("%d\n",f[n][m]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    8 |         for(register int i=1;i<=n;++i)
      |                          ^
a.cc:9:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    9 |                 for(register int j=1;j<=m;++j){
      |                                  ^
a.cc:12:25: error: reference to 'data' is ambiguous
   12 |                         data[i][j]=(c=='#');
      |                         ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 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:3:5: note:                 'int data [105][105]'
    3 | int data[105][105];
      |     ^~~~
a.cc:14:17: error: reference to 'data' is ambiguous
   14 |         f[1][1]=data[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:3:5: note:                 'int data [105][105]'
    3 | int data[105][105];
      |     ^~~~
a.cc:15:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |         for(register int i=2;i<=n;i++){
      |                          ^
a.cc:16:36: error: reference to 'data' is ambiguous
   16 |                 f[i][1]=f[i-1][1]+(data[i][1]&&!data[i-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:3:5: note:                 'int data [105][105]'
    3 | int data[105][105];
      |     ^~~~
a.cc:16:49: error: reference to 'data' is ambiguous
   16 |                 f[i][1]=f[i-1][1]+(data[i][1]&&!data[i-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:3:5: note:                 'int data [105][105]'
    3 | int data[105][105];
      |     ^~~~
a.cc:18:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   18 |         for(register int j=2;j<=m;j++){
      |                          ^
a.cc:19:36: error: reference to 'data' is ambiguous
   19 |                 f[1][j]=f[1][j-1]+(data[1][j]&&!data[1][j-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:3:5: note:                 'int data [105][105]'
    3 | int data[105][105];
      |     ^~~~
a.cc:19:49: error: reference to 'data' is ambiguous
   19 |                 f[1][j]=f[1][j-1]+(data[1][j]&&!data[1][j-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:3:5: note:                 'int data [105][105]'
    3 | int data[105][105];
      |     ^~~~
a.cc:21:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |         for(register int i=2;i<=n;i++)
      |                          ^
a.cc:22:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |                 for(register int j=2;j<=m;j++){
      |                                  ^
a.cc:23:48: error: reference to 'data' is ambiguous
   23 |                         f[i][j]=min(f[i-1][j]+(data[i][j]&&!data[i-1][j]),f[i][j-1]+(data[i][j]&&!data[i][j-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:3:5: note:                 'int data [105][105]'
    3 | int data[105][105];
      |     ^~~~
a.cc:23:61: error: reference to 'data' is ambiguous
   23 |                         f[i][j]=min(f[i-1][j]+(data[i][j]&&!data[i-1][j]),f[i][j-1]+(data[i][j]&&!data[i][j-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++