Language: C++

#include<bits/stdc++.h>
#define inf 1<<29
#define linf 1e18
#define eps (1e-10)
#define mod 1000000007
#define pi M_PI
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

class Point{
public:
  double x,y;
  Point(double x=0,double y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ return (x!=p.x ? x<p.x : y<p.y);}
  bool operator==(Point p)const{ return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

class Segment{
public:
  Point p1,p2;
  Segment(Point p1=Point(),Point p2=Point()):p1(p1),p2(p2){}
};
typedef Segment Line;

class Circle{
public:
  Point c;
  double r;
  Circle(Point c=Point(),double r=0.0):c(c),r(r){}
};

double norm(Vector a){ return (a.x*a.x+a.y*a.y);}
double abs(Vector a){ return sqrt(norm(a));}
double dot(Vector a,Vector b){ return (a.x*b.x+a.y*b.y);}
double cross(Vector a,Vector b){ return (a.x*b.y-a.y*b.x);}
double arg(Vector p){ return atan2(p.y,p.x);}
Vector polar(double a,double r){ return Point(cos(r)*a,sin(r)*a);}

bool in(Circle c,Point p){
  if(abs(c.c-p)-c.r<-eps)return true;
  return false;
}

bool in(Circle a,Circle b){
  if(b.r-a.r<-eps)return false;
  if(abs(a.c-b.c)+a.r-b.r<eps)return true;
  return false;
}

int intersect(Circle a,Circle b){
  double dis=abs(a.c-b.c),sumr=a.r+b.r,minr=min(a.r,b.r),maxr=max(a.r,b.r);
  if((sumr-dis)<-eps)return 4;
  if(equals(sumr,dis))return 3;
  if((maxr-(dis+minr))<-eps)return 2;
  if(equals(dis+minr,maxr))return 1;
  return 0;
}

pair<Point,Point> getCrossPoints(Circle c1,Circle c2){
  double d=abs(c1.c-c2.c);
  double a=acos((c1.r*c1.r+d*d-c2.r*c2.r)/(2*c1.r*d));
  double t=arg(c2.c-c1.c);
  return mp(c1.c+polar(c1.r,t+a),c1.c+polar(c1.r,t-a));
}

Point rotate(Point base,Point a,double r){
  Point b=a-base;
  a.x=b.x*cos((r/180)*M_PI)-b.y*sin((r/180)*M_PI);
  a.y=b.x*sin((r/180)*M_PI)+b.y*cos((r/180)*M_PI);
  a=a+base;
  return a;
}

vector<Point> arg_sort(vector<Point> vp,Point base){
  vector<pair<double,Point> > tmp;
  vector<Point> res;
  FOR(i,0,vp.size()){
    double targ=arg(vp[i]-base);
    if(targ<0.0)targ+=2*pi;
    tmp.push_back(mp(targ,vp[i]));
  }
  sort(tmp.begin(),tmp.end());
  FOR(i,0,tmp.size())res.push_back(tmp[i].s);
  return res;
}

double getAngle(Vector a,Vector b){
  double tmp=dot(a,b)/(abs(a)*abs(b));
  if(tmp<-1.0)tmp=-1.0;
  if(1.0<tmp)tmp=1.0;
  double r=acos(tmp)*180.0/pi;
  if(cross(a,b)<-eps)r=360.0-r;
  return r;
}

int n;
vector<Circle> vc;

double solve(){
  double res=0.0;
  FOR(i,0,n){
    bool bo=false;
    FOR(j,0,n){
      if(i==j)continue;
      if(in(vc[i],vc[j]))bo=true;
    }
    if(bo)continue;
    vector<Point> vp;
    FOR(j,0,n){
      if(i==j)continue;
      if(intersect(vc[i],vc[j])!=2)continue;
      pair<Point,Point> pp=getCrossPoints(vc[i],vc[j]);
      vp.pb(pp.f);
      vp.pb(pp.s);
    }
    vp=arg_sort(vp,vc[i].c);
    double sum=2*vc[i].r*pi;
    FOR(j,0,vp.size()){
      Point a=vp[j],b=vp[(j+1)%vp.size()];
      double r=getAngle(a-vc[i].c,b-vc[i].c);
      Point c=rotate(vc[i].c,a,r/2.0);
      bool flag=true;
      FOR(k,0,n)if(in(vc[k],c))flag=false;
      if(!flag)sum-=2*vc[i].r*pi*(r/360);
    }
    res+=sum;
  }
  return res;
}

int main()
{
  while(cin>>n && n){
    c.clear();
    FOR(i,0,n){
      int x,y,r;
      cin>>x>>y>>r;
      vc.pb(Circle(Point(x,y),r));
    }
    pd(solve());
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:156:5: error: 'c' was not declared in this scope; did you mean 'vc'?
  156 |     c.clear();
      |     ^
      |     vc