Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
#define rep(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,a) rep((i),0,(a))
using namespace std;
//global

struct Data{
	int x, y,r;
	int c;
};
Data data[24];
bool dp[1024 * 1024 * 16];
int min_num;
int N;
bool double_check(int i, int j){
	int dx, dy, dr;
	dx = data[j].x - data[i].x;
	dy = data[j].y - data[i].y;
	dr = data[j].r + data[i].r;
	//printf("[%d,%d]%d,%d,%d\n", i, j, dx, dy, dr);
	if ((dx*dx + dy*dy)<(dr*dr))return(true);
	else return(false);
}

void printbit(int x){
	REP(i, N){
		if ((x >> (N - i-1)) & 1)cout << 1;
		else cout<<0;
	}
	cout << endl;


}
void solve(int num, int rest){
	//cout << rest<<endl;
	//printbit(rest);
	if (min_num > num)min_num = num;
	if (num <= 1)return;
	if (dp[rest])return;

	int color[4] = { 0 }, index[4] = { 0 };
	REP(i, N){
		int bit = (1 << i);
		if ((rest&bit) > 0){
			bool f = true;
			rep(j,0,i)if((rest&(1<<j))>0)
			if (double_check(i, j)){
				f = false; continue;
			}
			if (f){
				color[data[i].c] += bit;
				index[data[i].c]++;
			}
		}
	}
	//rep(i, 0, 4){printf("%d,",index[i]);printbit(color[i]);}
	rep(i, 0, 4)
	if (index[i]>=2)
	if (!(index[i] & 1)){
		solve(num - index[i], rest - color[i]);
	}
	else{
		int p = 1;
		rep(j, 0, index[j]){
			while (!(p & 1))p <<= 1;
			solve(num - index[i] + 1, rest - color[i] + p);

		}



	}


}



int main(void){
	while (true){
		cin >> N;
		if (N == 0)return(0);
		min_num = N;
		memset(dp, 0, sizeof(dp));
		REP(i, N){
			cin >> data[i].x >> data[i].y >> data[i].r>>data[i].c;
			data[i].c--;
		}
		solve(N, (1 << N) - 1);
		cout << N - min_num << endl;
	}}

Compiler output:
a.cc: In function 'bool double_check(int, int)':
a.cc:19:14: error: reference to 'data' is ambiguous
   19 |         dx = data[j].x - data[i].x;
      |              ^~~~
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:2:
/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:13:6: note:                 'Data data [24]'
   13 | Data data[24];
      |      ^~~~
a.cc:19:26: error: reference to 'data' is ambiguous
   19 |         dx = data[j].x - data[i].x;
      |                          ^~~~
/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:13:6: note:                 'Data data [24]'
   13 | Data data[24];
      |      ^~~~
a.cc:20:14: error: reference to 'data' is ambiguous
   20 |         dy = data[j].y - data[i].y;
      |              ^~~~
/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:13:6: note:                 'Data data [24]'
   13 | Data data[24];
      |      ^~~~
a.cc:20:26: error: reference to 'data' is ambiguous
   20 |         dy = data[j].y - data[i].y;
      |                          ^~~~
/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:13:6: note:                 'Data data [24]'
   13 | Data data[24];
      |      ^~~~
a.cc:21:14: error: reference to 'data' is ambiguous
   21 |         dr = data[j].r + data[i].r;
      |              ^~~~
/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:13:6: note:                 'Data data [24]'
   13 | Data data[24];
      |      ^~~~
a.cc:21:26: error: reference to 'data' is ambiguous
   21 |         dr = data[j].r + data[i].r;
      |                          ^~~~
/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:13:6: note:                 'Data data [24]'
   13 | Data data[24];
      |      ^~~~
a.cc: In function 'void solve(int, int)':
a.cc:53:39: error: reference to 'data' is ambiguous
   53 |                                 color[data[i].c] += bit;
      |                                       ^~~~
/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:13:6: note:                 'Data data [24]'
   13 | Data data[24];
      |      ^~~~
a.cc:54:39: error: reference to 'data' is ambiguous
   54 |                                 index[data[i].c]++;
      |                                       ^~~~
/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:13:6: note:                 'Data data [24]'
   13 | Data data[24];
      |      ^~~~
a.cc: In function 'int main()':
a.cc:86:17: error: 'memset' was not declared in this scope
   86 |                 memset(dp, 0, sizeof(dp));
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<algorithm>
  +++ |+#include <cstring>
    4 | #define rep(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
a.cc:88:32: error: reference to 'data' is ambiguous
   88 |                         ci