Language: C++

#include <iostream>
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(c) (c), (c)+5
#define Contains(c, x) (find(all(c), (x)) != (c)+5)
using namespace std;
int main()
{
    int a[5], b[5];
    while (true) {
        cin >> a[0]; if (a[0] == 0) break;
        REP(i, 1, 5) cin >> a[i];
        if (Contains(a, 1) && Contains(a, 2) && Contains(a, 3)) {
            rep(i, 5) b[i] = 3;
        }
        else if (count(all(a), a[0]) == 5) {
            rep(i, 5) b[i] = 3;
        }
        else {
            if (!Contains(a, 1))
                rep(i, 5) b[i] = (a[i] == 2) ? 1 : 2;
            else if (!Contains(a, 2))
                rep(i, 5) b[i] = (a[i] == 3) ? 1 : 2;
            else
                rep(i, 5) b[i] = (a[i] == 1) ? 1 : 2;
        }
        rep(i, 5) cout << b[i] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:29: error: no matching function for call to 'find(int [5], int*, int)'
    5 | #define Contains(c, x) (find(all(c), (x)) != (c)+5)
      |                         ~~~~^~~~~~~~~~~~~
a.cc:13:13: note: in expansion of macro 'Contains'
   13 |         if (Contains(a, 1) && Contains(a, 2) && Contains(a, 3)) {
      |             ^~~~~~~~
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: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:5:29: note:   mismatched types 'std::istreambuf_iterator<_CharT>' and 'int*'
    5 | #define Contains(c, x) (find(all(c), (x)) != (c)+5)
      |                         ~~~~^~~~~~~~~~~~~
a.cc:13:13: note: in expansion of macro 'Contains'
   13 |         if (Contains(a, 1) && Contains(a, 2) && Contains(a, 3)) {
      |             ^~~~~~~~
a.cc:5:29: error: no matching function for call to 'find(int [5], int*, int)'
    5 | #define Contains(c, x) (find(all(c), (x)) != (c)+5)
      |                         ~~~~^~~~~~~~~~~~~
a.cc:13:31: note: in expansion of macro 'Contains'
   13 |         if (Contains(a, 1) && Contains(a, 2) && Contains(a, 3)) {
      |                               ^~~~~~~~
/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:5:29: note:   mismatched types 'std::istreambuf_iterator<_CharT>' and 'int*'
    5 | #define Contains(c, x) (find(all(c), (x)) != (c)+5)
      |                         ~~~~^~~~~~~~~~~~~
a.cc:13:31: note: in expansion of macro 'Contains'
   13 |         if (Contains(a, 1) && Contains(a, 2) && Contains(a, 3)) {
      |                               ^~~~~~~~
a.cc:5:29: error: no matching function for call to 'find(int [5], int*, int)'
    5 | #define Contains(c, x) (find(all(c), (x)) != (c)+5)
      |                         ~~~~^~~~~~~~~~~~~
a.cc:13:49: note: in expansion of macro 'Contains'
   13 |         if (Contains(a, 1) && Contains(a, 2) && Contains(a, 3)) {
      |                                                 ^~~~~~~~
/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:5:29: note:   mismatched types 'std::istreambuf_iterator<_CharT>' and 'int*'
    5 | #define Contains(c, x) (find(all(c), (x)) != (c)+5)
      |                         ~~~~^~~~~~~~~~~~~
a.cc:13:49: note: in expansion of macro 'Contains'
   13 |         if (Contains(a, 1) && Contains(a, 2) && Contains(a, 3)) {
      |                                                 ^~~~~~~~
a.cc:16:18: error: 'count' was not declared in this scope
   16 |         else if (count(all(a), a[0]) == 5) {
      |                  ^~~~~
a.cc:5:29: error: no matching function for call to 'find(int [5], int*, int)'
    5 | #define Contains(c, x) (find(all(c), (x)) != (c)+5)
      |                         ~~~~^~~~~~~~~~~~~
a.cc:20:18: note: in expansion of macro 'Contains'
   20 |             if (!Contains(a, 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:5:29: note:   mismatched types 'std::istreambuf_iterator<_CharT>' and 'int*'
    5 | #define Contains(c, x) (find(all(c), (x)) != (c)+5)
      |                         ~~~~^~~~~~~~~~~~~
a.cc:20:18: note: in expansion of macro 'Contains'
   20 |             if (!Contains(a, 1))
      |                  ^~~~~~~~
a.cc:5:29: error: no matching function for call to 'find(int [5], int*, int)'
    5 | #define Contains(c, x) (find(all(c), (x)) != (c)+5)
      |                         ~~~~^~~~~~~~~~~~~
a.cc:22:23: note: in expansion of macro 'Contains'
   22 |             else if (!Contains(a, 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:5:29: note:   mismatched types 'std::istreambuf_iterator<_CharT>' and 'int*'
    5 | #define Contains(c, x) (find(all(c), (x)) != (c)+5)
      |                         ~~~~^~~~~~~~~~~~~
a.cc:22:23: note: in expansion of macro 'Contains'
   22 |             else if (!Contains(a, 2))
      |                       ^~~~~~~~