Language: C++

#include <bits/stdc++.h>
#define maxn 500
char str[maxn][maxn];
int n,m,i,j,ans=0,s1,s2;
int move[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
bool mark[maxn][maxn];
using namespace std;
void dfs(int x,int y)
{
	int i,px,py;
	mark[x][y]=false;
	if (str[x][y]=='.') s2++;
		else s1++;
	for (i=0;i<4;i++)
	{
		px=x+move[i][0];
		py=y+move[i][1];
		if (px && py && (px<=n) && (py<=m) && mark[px][py] && (str[x][y]!=str[px][py])) dfs(px,py);
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for (i=1;i<=n;i++)
		scanf("%s",str[i]+1);
	memset(mark,true,sizeof(mark));
	for (i=1;i<=n;i++)
		for (j=1;j<=m;j++)
			if (mark[i][j])
			{
				s1=s2=0;
				dfs(i,j);
				ans+=s1*s2;
			}
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:16:22: error: reference to 'move' is ambiguous
   16 |                 px=x+move[i][0];
      |                      ^~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:353:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::move(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2)'
  353 | move(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __d_first);
      | ^~~~
In file included from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_algobase.h:675:5: note:                 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
                 from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:5:5: note:                 'int move [4][2]'
    5 | int move[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
      |     ^~~~
a.cc:17:22: error: reference to 'move' is ambiguous
   17 |                 py=y+move[i][1];
      |                      ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:353:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::move(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2)'
  353 | move(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __d_first);
      | ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note:                 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:5:5: note:                 'int move [4][2]'
    5 | int move[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
      |     ^~~~