Language: C++

/* Simplicity and Goodness */
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 2e5+2;

int h, w, cnt;
string s[102];
int visit[102][102];

int dx[] = {1, 0};
int dy[] = {0, 1};

bool in_range(int, int);

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;

    rep(k, 0, 2) {
        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] == '#';
}

void solve()
{
    scn(h); scn(w);

    rep(i, 0, h)
    cin >> s[i];

    cnt = inf; dfs(0, 0, 0);

    prin(cnt);
}

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

int main()
{
    int t = 1;
    // scn(t);

    while(t --) {
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:57:5: error: reference to 'visit' is ambiguous
   57 |     visit[i][j] = 1;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:3:
/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:40:5: note:                 'int visit [102][102]'
   40 | int visit[102][102];
      |     ^~~~~
a.cc:61:51: error: reference to 'visit' is ambiguous
   61 |         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:40:5: note:                 'int visit [102][102]'
   40 | int visit[102][102];
      |     ^~~~~
a.cc:65:5: error: reference to 'visit' is ambiguous
   65 |     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:40:5: note:                 'int visit [102][102]'
   40 | int visit[102][102];
      |     ^~~~~