Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int h,w;
string s[500];
/*
class Kuro_siro{
public:
	int kuro;
	int siro;
	Kuro_siro(int _kuro,int _siro){
		kuro=_kuro;
		siro=_siro;
	}
};
vector<Kuro_siro> kuro_siro;
*/
int kuro;
int siro;

void tansaku_kuro(int x,int y){
	if(s[x-1][y]=='.'){
		s[x-1][y]='0';
		siro++;
		tansaku_siro(int x-1,int y);
	}
	if(s[x+1][y]=='.'){
		s[x+1][y]='0';
		siro++;
		tansaku_siro(int x+1,int y);
	}
	if(s[x][y-1]=='.'){
		s[x][y-1]='0';
		siro++;
		tansaku_siro(int x,int y-1);
	}
	if(s[x][y+1]=='.'){
		s[x][y+1]='0';
		siro++;
		tansaku_siro(int x,int y+1);
	}
}
void tansaku_siro(int x,int y){
	if(s[x-1][y]=='#'){
		s[x-1][y]='1';
		kuro++;
		tansaku_kuro(int x-1,int y);
	}
	if(s[x+1][y]=='#'){
		s[x+1][y]='1';
		kuro++;
		tansaku_kuro(int x+1,int y);
	}
	if(s[x][y-1]=='#'){
		s[x][y-1]='1';
		kuro++;
		tansaku_kuro(int x,int y-1);
	}
	if(s[x][y+1]=='#'){
		s[x][y+1]='1';
		kuro++;
		tansaku_kuro(int x,int y+1);
	}
}


main(){
	cin >> h >> w;
	for(int i=0;i<h;i++){
		cin >> s[i];
	}
	long long int ans=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){

			if(s[i][j]=='#'){
				kuro=0;
				siro=0;
				kuro++;
				tansaku_kuro(i,j);
				ans+=kuro*siro;
			}
		}
	}
	cout << ans <<endl;
}


Compiler output:
a.cc: In function 'void tansaku_kuro(int, int)':
a.cc:27:30: error: expected primary-expression before 'int'
   27 |                 tansaku_siro(int x-1,int y);
      |                              ^~~
a.cc:27:38: error: expected primary-expression before 'int'
   27 |                 tansaku_siro(int x-1,int y);
      |                                      ^~~
a.cc:27:17: error: 'tansaku_siro' was not declared in this scope; did you mean 'tansaku_kuro'?
   27 |                 tansaku_siro(int x-1,int y);
      |                 ^~~~~~~~~~~~
      |                 tansaku_kuro
a.cc:32:30: error: expected primary-expression before 'int'
   32 |                 tansaku_siro(int x+1,int y);
      |                              ^~~
a.cc:32:38: error: expected primary-expression before 'int'
   32 |                 tansaku_siro(int x+1,int y);
      |                                      ^~~
a.cc:32:17: error: 'tansaku_siro' was not declared in this scope; did you mean 'tansaku_kuro'?
   32 |                 tansaku_siro(int x+1,int y);
      |                 ^~~~~~~~~~~~
      |                 tansaku_kuro
a.cc:37:30: error: expected primary-expression before 'int'
   37 |                 tansaku_siro(int x,int y-1);
      |                              ^~~
a.cc:37:36: error: expected primary-expression before 'int'
   37 |                 tansaku_siro(int x,int y-1);
      |                                    ^~~
a.cc:37:17: error: 'tansaku_siro' was not declared in this scope; did you mean 'tansaku_kuro'?
   37 |                 tansaku_siro(int x,int y-1);
      |                 ^~~~~~~~~~~~
      |                 tansaku_kuro
a.cc:42:30: error: expected primary-expression before 'int'
   42 |                 tansaku_siro(int x,int y+1);
      |                              ^~~
a.cc:42:36: error: expected primary-expression before 'int'
   42 |                 tansaku_siro(int x,int y+1);
      |                                    ^~~
a.cc:42:17: error: 'tansaku_siro' was not declared in this scope; did you mean 'tansaku_kuro'?
   42 |                 tansaku_siro(int x,int y+1);
      |                 ^~~~~~~~~~~~
      |                 tansaku_kuro
a.cc: In function 'void tansaku_siro(int, int)':
a.cc:49:30: error: expected primary-expression before 'int'
   49 |                 tansaku_kuro(int x-1,int y);
      |                              ^~~
a.cc:49:38: error: expected primary-expression before 'int'
   49 |                 tansaku_kuro(int x-1,int y);
      |                                      ^~~
a.cc:54:30: error: expected primary-expression before 'int'
   54 |                 tansaku_kuro(int x+1,int y);
      |                              ^~~
a.cc:54:38: error: expected primary-expression before 'int'
   54 |                 tansaku_kuro(int x+1,int y);
      |                                      ^~~
a.cc:59:30: error: expected primary-expression before 'int'
   59 |                 tansaku_kuro(int x,int y-1);
      |                              ^~~
a.cc:59:36: error: expected primary-expression before 'int'
   59 |                 tansaku_kuro(int x,int y-1);
      |                                    ^~~
a.cc:64:30: error: expected primary-expression before 'int'
   64 |                 tansaku_kuro(int x,int y+1);
      |                              ^~~
a.cc:64:36: error: expected primary-expression before 'int'
   64 |                 tansaku_kuro(int x,int y+1);
      |                                    ^~~
a.cc: At global scope:
a.cc:69:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   69 | main(){
      | ^~~~