Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
int search(int &A ,int h,int w,int i,int j){
  	int l,r;
	if(i+1<h){l = search(A,h,w,i+1,j);}
  	else{l=0;}
  	if(j+1<w){r = search(A,h,w,i,j+1);}
  	else{r=0;}
  	return A[i][j]+max(l,r);
}
  	

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  
  	int h,w;
   	cin >> h ;
  	cin >> w ;
  	int A[h][w];
  	char x;
  int ans;
  	rep(i,h){rep(j,w){cin >> x;
                     	if(x=='.'){A[i][j]=1;}
                     	else{A[i][j]=0;}}}
  	ans =search(A,h,w,0,0);
  	ans = h+w-1 -ans;
  	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int search(int&, int, int, int, int)':
a.cc:51:17: error: invalid types 'int[int]' for array subscript
   51 |         return A[i][j]+max(l,r);
      |                 ^
a.cc: In function 'int main()':
a.cc:68:20: error: no matching function for call to 'search(int [h][w], int&, int&, int, int)'
   68 |         ans =search(A,h,w,0,0);
      |              ~~~~~~^~~~~~~~~~~
a.cc:45:5: note: candidate: 'int search(int&, int, int, int, int)' (near match)
   45 | int search(int &A ,int h,int w,int i,int j){
      |     ^~~~~~
a.cc:45:5: note:   conversion of argument 1 would be ill-formed:
a.cc:68:21: error: invalid conversion from 'int (*)[w]' to 'int' [-fpermissive]
   68 |         ans =search(A,h,w,0,0);
      |                     ^
      |                     |
      |                     int (*)[w]
a.cc:68:21: error: cannot bind rvalue '(int)((int (*)[w])(& A))' to 'int&'
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:2332:5: note: candidate: 'template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> _ForwardIterator1 std::search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
 2332 |     search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note:   template argument deduction/substitution failed:
a.cc:68:20: note:   variable-sized array type 'int (*)[w]' is not a valid template argument
   68 |         ans =search(A,h,w,0,0);
      |              ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: candidate: 'template<class _FIter1, class _FIter2> _FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2)'
 4090 |     search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4090:5: note:   candidate expects 4 arguments, 5 provided
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: candidate: 'template<class _ForwardIterator, class _Searcher> _ForwardIterator std::search(_ForwardIterator, _ForwardIterator, const _Searcher&)'
 4184 |     search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4184:5: note:   candidate expects 3 arguments, 5 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
  112 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note:   candidate expects 6 arguments, 5 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)'
  117 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note:   template argument deduction/substitution failed:
a.cc:68:20: note:   variable-sized array type 'int (&)[h][w]' is not a valid template argument
   68 |         ans =search(A,h,w,0,0);
      |              ~~~~~~^~~~~~~~~~~