Language: C

#include<algorithm>
#include<cstdio>
#include<cmath>
#include<iostream>
#define op operator
#define db double
#define cp const P &
#define rt return
#define cn const
#define eps 1e-10
using namespace std;

const double PI=acos(-1.0);

int sig(db x){rt (x>eps)-(x<-eps);}

struct P
{
    db x,y;
    P(db a=0.,db b=0.):x(a),y(b){}
    bool op < (cp a)cn{rt sig(x-a.x)!=0 ? sig(x-a.x)<0 : sig(y-a.y)<0; }
    P op + (cp a)cn{rt P(x+a.x,y+a.y);}
    P op - (cp a)cn{rt P(x-a.x,y-a.y);}
    db op *(cp a)cn{rt x*a.x + y*a.y;}
    db op ^(cp a)cn{rt x*a.y-y*a.x;}
    P op * (cn db& a)cn{rt P(x*a,y*a);}
    void in(){scanf("%lf%lf",&x,&y);}
    void out(){printf("%lf  %lf --\n",x,y);}
    P T(){rt P(-y,x);}
    db dis2(){rt x*x + y* y;}
    db dis(P a){rt sqrt((x-a.x)*(x-a.x) + (y-a.y)*(y-a.y));}
    db dis2(P a){rt (x-a.x)*(x-a.x) + (y-a.y)*(y-a.y);}
};

struct CCL
{
    P o;
    double r;
    CCL(){}
    CCL(P  a,db v):o(a),r(v){}
    bool op < (cn CCL & a)cn{rt sig(r-a.r)<0;}
    void input(){ scanf("%lf%lf%lf",&o.x,&o.y,&r);}
    void print(){printf("%lf %lf %lf\n",o.x,o.y,r);}
     P  getP(double e)
    {
        return o+P (r*cos(e),r*sin(e));
    }
    int cp_L(P  a,P  b,P  p[]) {
        db A = (a-b).dis2() , B = -2.*((o-a)*(b-a)), C = (a-o).dis2()-r*r ,
          D = B*B - 4.*A*C;
        if(sig(D) < 0) rt 0; D=fabs(D);
        db u1 = (-B-sqrt(D)) / (2.*A) , u2 = (-B+sqrt(D)) / (2.*A);
        p[0] = a + (b-a)*u1; p[1] = a + (b-a)*u2;
        rt sig(D) + 1;
    }
    int cp_ccl(CCL c,P p[])
    {
        db d=(o-c.o).dis2();
        if(sig( sqrt( fabs(d) )+min(r,c.r)-max(r,c.r))<0 || sig(d)==0) rt 0;
        db u=(r*r - c.r*c.r)/(d+d)+0.5;
        P a=o+(c.o-o)*u, b=a+(c.o-o).T();
        rt cp_L(a,b,p);
    }
     int cp_qie(P  a,P  p[])
   {
       //if(sig(r-o.dis(a))>0) rt 0;
       CCL b=CCL((a+o)*0.5,o.dis(a)*0.5);
       rt cp_ccl(b,p);
   }
};

int qie(CCL A,CCL B,P * a,P * b )
   {
       int cnt=0;
       if(sig(A.r-B.r)<0) swap(A,B),swap(a,b);
       double d2=A.o.dis2(B.o);
       double rdiff=A.r-B.r;
       double rsum=A.r+B.r;
       if(sig(d2-rdiff*rdiff)<0) return 0;

       double base=atan2(B.o.y-A.o.y,B.o.x-A.o.x);
       if(sig(d2)==0 && sig(A.r-B.r)==0) return -1;
       if(sig(d2-rdiff*rdiff)==0)
       {
           a[cnt]=A.getP(base);b[cnt]=B.getP(base);cnt++;
           return 1;
       }

       double ang=acos(rdiff/sqrt(d2));
       a[cnt]=A.getP(base+ang);b[cnt]=B.getP(base+ang);cnt++;
       a[cnt]=A.getP(base-ang);b[cnt]=B.getP(base-ang);cnt++;

       if(sig(d2-rsum*rsum)==0)
       {
           a[cnt]=A.getP(base);b[cnt]=B.getP(base+PI);cnt++;
       }
       else if(sig(d2-rsum*rsum)>0)
       {
           ang=acos(rsum/sqrt(d2));
           a[cnt]=A.getP(base+ang);b[cnt]=B.getP(PI+base+ang);cnt++;
           a[cnt]=A.getP(base-ang);b[cnt]=B.getP(PI+base-ang);cnt++;
       }
       return cnt;
   }

int cnt;
P p[200];
CCL c[60];

struct node
{
    P f;
    db d,r;
    bool op < (cn node& a)cn{ rt f<a.f;}
    void up(P a,P o,db R)
    {
        f=a;
        r=R;
        d=atan2((a-o).y,(a-o).x);
    }
} s[2000];

int init(int m)
{
     int k=0;
     for(int i=0;i<cnt;i++)
     {    p[i].out();
         for(int j=0;j<m;++j)
         {
             P b[5];
             c[j].cp_qie(p[i],b);
            s[k++].up(b[0],c[j].o,c[j].r);
            s[k++].up(b[1],c[j].o,c[j].r);
            b[0].out();
            b[1].out();
            puts("*****");
         }
     }

     for(int i=0;i<m;i++)
     {
         for(int j=i+1;j<m;j++)
         {
             P a[4],b[4];
             qie(c[i],c[j],a,b);

             s[k++].up(a[0],c[i].o,c[i].r);
             s[k++].up(a[1],c[i].o,c[i].r);
             s[k++].up(b[0],c[j].o,c[j].r);
             s[k++].up(b[1],c[j].o,c[j].r);
         }
     }

     for(int i=0;i<cnt;i++)
     {
         s[k].f=p[i];
         s[k].r=-1.;
         k++;
     }
    return k;
}


node q[2000];

double Graham(node *s,int n)
{
	sort(s,s+n);
	q[0]=s[0];
    q[1]=s[1];

    int t=1;
	for(int i=2;i<n;i++){
			while( t>0 && sig( (q[t].f-q[t-1].f)^(s[i].f-q[t-1].f) )<0) t--;
			 q[++t]=s[i];
	  }
	int k=t;
	for(int i=n-2;i>=0;i--){
			while( t>k && sig( (q[t].f-q[t-1].f)^(s[i].f-q[t-1].f) )<0)t--;
			 q[++t]=s[i];
	  }
	  t++;
    printf("%d ** %d\n",t,n);
//    for(int i=0;i<n;i++)
//       s[i].f.out();
//       puts("*********");

     double ans=0;
     for(int i=0;i<t-1;i++)
     {
         if( sig(q[i].r-q[i+1].r)==0 && sig(q[i].r) > 0)
                {
                    double w=q[i+1].d-q[i].d;
                    if(sig(w)<0) w+= 2*PI;
                    ans+= w*q[i].r;
                }
         else
             ans+= q[i].f.dis(q[i+1].f);
     }
	  return ans;
}


int main()
{
    int n,m;
    while(scanf("%d%d",&m,&n)!=EOF)
    {
        cnt=0;
        for(int i=0;i<m;++i) c[i].input();
        for(int i=0;i<n;i++)
        {
            p[cnt++].in();
            p[cnt++].in();
            p[cnt++].in();
        }

        int k=init(m);
        double ans=Graham(s,k);
        printf("%.5lf\n",ans);
    }
    return 0;
}

Compiler output:
main.c:1:9: fatal error: algorithm: No such file or directory
    1 | #include<algorithm>
      |         ^~~~~~~~~~~
compilation terminated.