Language: C++

#include <iostream>
#include <vector>
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(c) (c).begin(), (c).end()
#define Contains(c, x) (find(all(c), (x)) != (c).end())
using namespace std;
int main()
{
    vector<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:6:29: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int)'
    6 | #define Contains(c, x) (find(all(c), (x)) != (c).end())
      |                         ~~~~^~~~~~~~~~~~~
a.cc:14:13: note: in expansion of macro 'Contains'
   14 |         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:6:29: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
    6 | #define Contains(c, x) (find(all(c), (x)) != (c).end())
      |                         ~~~~^~~~~~~~~~~~~
a.cc:14:13: note: in expansion of macro 'Contains'
   14 |         if (Contains(a, 1) && Contains(a, 2) && Contains(a, 3)) {
      |             ^~~~~~~~
a.cc:6:29: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int)'
    6 | #define Contains(c, x) (find(all(c), (x)) != (c).end())
      |                         ~~~~^~~~~~~~~~~~~
a.cc:14:31: note: in expansion of macro 'Contains'
   14 |         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:6:29: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
    6 | #define Contains(c, x) (find(all(c), (x)) != (c).end())
      |                         ~~~~^~~~~~~~~~~~~
a.cc:14:31: note: in expansion of macro 'Contains'
   14 |         if (Contains(a, 1) && Contains(a, 2) && Contains(a, 3)) {
      |                               ^~~~~~~~
a.cc:6:29: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int)'
    6 | #define Contains(c, x) (find(all(c), (x)) != (c).end())
      |                         ~~~~^~~~~~~~~~~~~
a.cc:14:49: note: in expansion of macro 'Contains'
   14 |         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:6:29: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
    6 | #define Contains(c, x) (find(all(c), (x)) != (c).end())
      |                         ~~~~^~~~~~~~~~~~~
a.cc:14:49: note: in expansion of macro 'Contains'
   14 |         if (Contains(a, 1) && Contains(a, 2) && Contains(a, 3)) {
      |                                                 ^~~~~~~~
a.cc:17:18: error: 'count' was not declared in this scope
   17 |         else if (count(all(a), a[0]) == 5) {
      |                  ^~~~~
a.cc:6:29: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int)'
    6 | #define Contains(c, x) (find(all(c), (x)) != (c).end())
      |                         ~~~~^~~~~~~~~~~~~
a.cc:21:18: note: in expansion of macro 'Contains'
   21 |             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:6:29: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
    6 | #define Contains(c, x) (find(all(c), (x)) != (c).end())
      |                         ~~~~^~~~~~~~~~~~~
a.cc:21:18: note: in expansion of macro 'Contains'
   21 |             if (!Contains(a, 1))
      |                  ^~~~~~~~
a.cc:6:29: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int)'
    6 | #define Contains(c, x) (find(all(c), (x)) != (c).end())
      |                         ~~~~^~~~~~~~~~~~~
a.cc:23:23: note: in expansion of macro 'Contains'
   23 |             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:6:29: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
    6 | #define Contains(c, x) (find(all(c), (x)) != (c).end())
      |                         ~~~~^~~~~~~~~~~~~
a.cc:23:23: note: in expansion of macro 'Contains'
   23 |             else if (!Contains(a, 2))
      |                       ^~~~~~~~