Language: C++

#include<bits/stdc++.h>
using namespace std;
#define INF 1e9

int main(){

    while(1){
        int n; cin >> n;
        if(!n) break;
        vector<int> x(n);
        vector<int> y(n);
        vector<int> r(n);
        vector<int> c(n);        

        for(int i = 0; i < n; i++) cin >> x[i] >> y[i] >> r[i] >> c[i];

        vector<vector<bool> > canTake(n, vector<bool> (n, false));
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
                int d = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
                if(d < (r[i] + r[j]) * (r[i] + r[j])) canTake[j][i] = true;
            }
        }

        /*for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                cout << canTake[i][j] << " ";
            }
            cout << endl;
        }
        cout << endl;*/

        //ワーシャルフロイド
        for(int k = 0; k < n; k++){
            for(int i = 0; i < n; i++){
                for(int j = 0; j < n; j++){
                    canTake[i][j] = canTake[i][j] || canTake[i][k] && canTake[k][j];
                }
            }
        }

        /*for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                cout << canTake[i][j] << " ";
            }
            cout << endl;
        }
        cout << endl;
        /*
        //幅優先探索
        vector<bool> visited((1<<n), false);
        queue<pair<int, int> > q;
        q.push({0, (1<<n) - 1});
        visited[(1<<n) - 1] = true;

        int ans = 0;

        while(!q.empty()){

            int now_bit = q.front().second;
            int now_cost = q.front().first;
            ans = max(ans, now_cost);
            q.pop();

            for(int i = 0; i < n; i++){
                for(int j = i + 1; j < n; j++){

                    //i番目 と j番目が取り出せるか
                    if(!((1<<i) & now_bit)) continue;
                    if(!((1<<j) & now_bit)) continue;                    
                    //色が違うならダメ
                    if(c[i] != c[j]) continue;
                
                    //iの上に何かあればダメ
                    bool flagi = true;
                    for(int k = 0; k < n; k++){
                        if(canTake[i][k] && (now_bit & (1<<k))){
                            flagi = false;
                            break;
                        }
                    }


                    if(!flagi) continue;
                
                    bool flagj = true;
                    for(int k = 0; k < n; k++){
                        if(canTake[j][k] && (now_bit & (1<<k))){
                            flagj = false;
                            break;
                        }
                    }

                    if(!flagj) continue;

                    int next_bit = now_bit & (~((1<<i) | (1<<j)));
                    if(!visited[next_bit]){
                        visited[next_bit] = true;
                        q.push({now_cost + 1, next_bit});
                    }
                }
            }
        }

        cout << 2 * ans << endl;
    }
    return 0;

}


Compiler output:
a.cc:42:9: error: unterminated comment
   42 |         /*for(int i = 0; i < n; i++){
      |         ^
a.cc: In function 'int main()':
a.cc:40:10: error: expected '}' at end of input
   40 |         }
      |          ^
a.cc:7:13: note: to match this '{'
    7 |     while(1){
      |             ^
a.cc:40:10: error: expected '}' at end of input
   40 |         }
      |          ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^