Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

bool inrange(int x,int y){
	if(x<0||y<0||x>11||y>11) return false;
	else return true;
}

int data[20][20];
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};

void search(int x,int y){
	REP(i,4){
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(!inrange(nx,ny)) continue;
		if(data[nx][ny]==1) {
			data[nx][ny] = 0;
			search(nx,ny);
		}
	}
}

int main(){
	while(1){
		string str;
		REP(i,12){
			if(!cin >> str) return 0;
			REP(j,12){
				data[i][j] = str[j] - '0';
			}
		}
		ll int cnt = 0;
		REP(i,12){
			REP(j,12){
				if(data[i][j]==1){
					search(i,j);
					cnt++;
				}
			}
		}
		cout << cnt << endl;
		REP(i,12)
		//if(cin.eof()) break;
	}
}

Compiler output:
a.cc: In function 'void search(int, int)':
a.cc:37:20: error: reference to 'data' is ambiguous
   37 |                 if(data[nx][ny]==1) {
      |                    ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:28:5: note:                 'int data [20][20]'
   28 | int data[20][20];
      |     ^~~~
a.cc:38:25: error: reference to 'data' is ambiguous
   38 |                         data[nx][ny] = 0;
      |                         ^~~~
/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:28:5: note:                 'int data [20][20]'
   28 | int data[20][20];
      |     ^~~~
a.cc: In function 'int main()':
a.cc:48:33: error: no match for 'operator>>' (operand types are 'bool' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   48 |                         if(!cin >> str) return 0;
      |                            ~~~~ ^~ ~~~
      |                            |       |
      |                            bool    std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/string:55:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
  835 |     operator>>(basic_istream<_CharT, _Traits>& __in,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note:   template argument deduction/substitution failed:
a.cc:48:36: note:   mismatched types 'std::basic_istream<_CharT, _Traits>' and 'bool'
   48 |                         if(!cin >> str) return 0;
      |                                    ^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
                 from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
  131 |     operator>>(byte __b, _IntegerType __shift) noexcept
      |     ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note:   template argument deduction/substitution failed:
a.cc:48:28: note:   cannot convert 'std::cin.std::basic_istream<char>::std::basic_ios<char>.std::basic_ios<char>::operator!()' (type 'bool') to type 'std::byte'
   48 |                         if(!cin >> str) return 0;
      |                            ^~~~
In file included from /usr/include/c++/14/istream:1109,
                 from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
  978 |     operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
      |     ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note:   template argument deduction/substitution failed:
a.cc:48:36: note:   mismatched types 'std::basic_istream<_CharT, _Traits>' and 'bool'
   48 |                         if(!cin >> str) return 0;
      |                                    ^~~
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
  849 |     operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
      |     ^~~~~~~~
/usr/include/c++/14/istream:849:5: note:   template argument deduction/substitution failed:
a.cc:48:36: note:   mismatched types 'std::basic_istream<char, _Traits>' and 'bool'
   48 |                         if(!cin >> str) return 0;
      |                                    ^~~
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
  854 |     operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
      |     ^~~~~~~~
/usr/include/c++/14/istream:854:5: note:   template argument deduction/substitution failed:
a.cc:48:36: note:   mismatched types 'std::basic_istream<char, _Traits>' and 'bool'
   48 |                         if(!cin >> str) return 0;
      |                                    ^~~
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
  896 |     operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
      |     ^~~~~~~~
/usr/include/c++/14/istream:896:5: note:   template argument deduction/substitution failed:
a.cc:48:36: note:   mismatched types 'std::basic_istream<_CharT, _Traits>' and 'bool'
   48 |                         if(!cin >> str) return 0;
      |                                    ^~~
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
  939 |     operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
      |     ^~~~~~~~
/usr/include/c++/14/istream:939:5: note:   template argument deduction/substitution failed:
a.cc:48:36: note:   mismatched types 'std::basic_istream<char, _Traits>' and 'bool'
   48 |                         if(!cin >> str) return 0;
      |                                    ^~~
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
  945 |     operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
      |     ^~~~~~~~
/usr/include/c++/14/istream:945:5: note:   template argument deduction/substitution failed:
a.cc:48:36: note:   mismatched types 'std::basic_istream<char, _Traits>' and 'bool'
   48 |                         if(!cin >> str) return 0;
      |                                    ^~~
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
 1099 |     operator>>(_Istream&& __is, _Tp&& __x)
      |     ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = bool; _Tp = std::__cxx11::basic_string<char>&]':
a.cc:48:15:   required from here
   48 |                         if(!cin >> str) return 0;
      |                                    ^~~
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
 1099 |     operator>>(_Istream&& __is, _Tp&& __x)
      |     ^~~~~~~~
In file included from a.cc:10:
/usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)'
   76 |     operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
      |     ^~~~~~~~
/usr/include/c++/14/iomanip:76:5: note:   template argument deduction/substitution failed:
a.cc:48:36: note:   mismatched types 'std::basic_istream<_CharT, _Traits>' and 'bool'
   48 |                         if(!cin >> str) return 0;
      |                                    ^~~
/usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)'
  106 |     operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
      |     ^~~~~~~~
/usr/include/c++/14/iomanip:106:5: note:   template argument deduction/substitution failed:
a.cc:48:36: note:   mismatched types 'std::basic_istream<_CharT, _Traits>' and 'bool'
   48 |                         if(!cin >> str) return 0;
      |                                    ^~~
/usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)'
  137 |     operator