Language: C++

#include <string>
#include <iostream>
using namespace std;
string s[5][5]; char t[5][5][8]; int tc, n, m1, m2, a[27], b[27];
int main() {
	while (cin >> n, n) {
		for (int i = 0; i < 5; i++) {
			for (int j = 0; j < 5; j++) {
				cin >> s[i][j];
			}
		}
		cin >> m1; for (int i = 0; i < m1; i++) cin >> a[i];
		cin >> m2; for (int i = 0; i < m2; i++) cin >> b[i];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 5; j++) {
				for (int k = 0; k < 5; k++) {
					for (int l = 0; l < 5; l++) {
						int cnt = 0;
						for (int v1 = -1; v1 <= 1; v1++) {
							for (int v2 = -1; v2 <= 1; v2++) {
								for (int v3 = -1; v3 <= 1; v3++) {
									int r1 = j + v1, r2 = k + v2, r3 = l + v3;
									if (!v1 && !v2 && !v3) continue;
									if (0 <= r1 && r1 < 5 && 0 <= r2 && r2 < 5 && 0 <= r3 && r3 < 5) {
										if (s[r1][r2][r3] == '1') cnt++;
									}
								}
							}
						}
						if (s[j][k][l] == '0') {
							if (find(a, a + m1, cnt) != a + m1) t[j][k][l] = '1';
							else t[j][k][l] = '0';
						}
						else {
							if (find(b, b + m2, cnt) != b + m2) t[j][k][l] = '1';
							else t[j][k][l] = '0';
						}
					}
				}
			}
			for (int j = 0; j < 5; j++) {
				for (int k = 0; k < 5; k++) {
					s[j][k] = t[j][k];
				}
			}
		}
		if (tc++) cout << endl;
		cout << "Case " << tc << ":" << endl;
		for (int i = 0; i < 5; i++) {
			if (i) cout << endl;
			for (int j = 0; j < 5; j++) {
				cout << s[i][j] << endl;
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:65: error: no matching function for call to 'find(int [27], int*, int&)'
   31 |                                                         if (find(a, a + m1, cnt) != a + m1) t[j][k][l] = '1';
      |                                                             ~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:31:65: note:   mismatched types 'std::istreambuf_iterator<_CharT>' and 'int*'
   31 |                                                         if (find(a, a + m1, cnt) != a + m1) t[j][k][l] = '1';
      |                                                             ~~~~^~~~~~~~~~~~~~~~
a.cc:35:65: error: no matching function for call to 'find(int [27], int*, int&)'
   35 |                                                         if (find(b, b + m2, cnt) != b + m2) t[j][k][l] = '1';
      |                                                             ~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:35:65: note:   mismatched types 'std::istreambuf_iterator<_CharT>' and 'int*'
   35 |                                                         if (find(b, b + m2, cnt) != b + m2) t[j][k][l] = '1';
      |                                                             ~~~~^~~~~~~~~~~~~~~~