Language: C++

#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

struct Solver
{
	const int N;
	VI xs, ys, rs, cs;

	int res;

	Solver( int n ) : N( n ), xs( N ), ys( N ), rs( N ), cs( N ), res( 0 )
	{
		REP( i, 0, N )
		{
			cin >> xs[i] >> ys[i] >> rs[i] >> cs[i];
		}
		return;
	}

	operator int()
	{
		dfs( vector<bool>( N, true ) );
		return res;
	}

	void dfs( vector<bool> exists )
	{
		res = max( res, count( ALL( exists ), false ) );

		REP( i, 0, N )
		{
			REP( j, 0, i )
			{
				if ( !exists[i] || !exists[j] || cs[i] != cs[j] )
				{
					continue;
				}

				if ( !overlapped( exists, i ) && !overlapped( exists, j ) )
				{
					exists[i] = exists[j] = false;
					dfs( exists );
					exists[i] = exists[j] = true;
				}

			}
		}

		return;
	}

	bool overlapped( const vector<bool> &exists, const int p )
	{
		REP( i, 0, p )
		{
			if ( !exists[i] )
			{
				continue;
			}

			if ( ( xs[p] - xs[i] ) * ( xs[p] - xs[i] ) + ( ys[p] - ys[i] ) * ( ys[p] - ys[i] ) < ( rs[i] + rs[p] ) * ( rs[i] + rs[p] ) )
			{
				return true;
			}
		}

		return false;
	}
};

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

	for ( int n; cin >> n, n; )
	{
		cout << Solver( n ) << endl;
	}

	return 0;
}

Compiler output:
a.cc: In member function 'void Solver::dfs(std::vector<bool>)':
a.cc:74:26: error: no matching function for call to 'max(int&, std::__iterator_traits<std::_Bit_iterator, void>::difference_type)'
   74 |                 res = max( res, count( ALL( exists ), false ) );
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 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/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:74:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__iterator_traits<std::_Bit_iterator, void>::difference_type' {aka 'long int'})
   74 |                 res = max( res, count( ALL( exists ), false ) );
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:16:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:74:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   74 |                 res = max( res, count( ALL( exists ), false ) );
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~