Language: C

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
const double EPS = 1e-6;
const double PI = acos(-1.0);
const int MAXN = 55;

int dcmp(double x)
{
	if(dcmp(x)<EPS) return 0;
	return x<0? -1:1;
}
double sqr(double x)
{
	return x*x;
}
struct Point{
	double x,y;
	bool tp;
	int id;
	Point(){}
	Point(double a,double b):x(a),y(b){}
	Point operator +(const Point &a)const{return Point(x+a.x,y+a.y);}
	Point operator -(const Point &a)const{return Point(x-a.x,y-a.y);}
	Point operator *(double k) const{return Point(x*k,y*k);}
	bool operator <(const Point &a)const
	{
		return dcmp(x-a.x)<0||(dcmp(x-a.x)==0&&dcmp(y-a.y)<0);
	}
	bool operator ==(const Point &a)const
	{
		return dcmp(x-a.x)==0&&dcmp(y-a.y)==0;
	}
	Point trunc(double d)
	{
		double dist(Point ,Point);
		double len = dist(*this,Point(0,0));
		return Point(x*d/len,y*d/len);
	}
	Point rotate(double a)
	{
		return Point(x*cos(a)-y*sin(a),y*cos(a)+x*sin(a));
	}
	void input(){scanf("%lf%lf",&x,&y);}
};
struct Circle{
	Point o;
	double r;
	Circle(){}
	Circle(Point a,double b):o(a),r(b){}
	double area(){return sqr(r)*PI;}
	double len(double ang){return r*ang;}
};
struct Tri{
	Point p[3];
};
typedef Point Vector;
double cross(Vector a,Vector b)
{
	return a.x*b.y-a.y*b.x;
}
double cross(Point a,Point b,Point s)
{
	double x1 = a.x-s.x,y1 = a.y-s.y;
	double x2 = b.x-s.x,y2 = b.y-s.y;
	return x1*y2-x2*y1;
}
double dot(Vector a,Vector b)
{
	return a.x*b.x+a.y*b.y;
}
double length(Vector a)
{
	return sqrt(dot(a,a));
}
double dist(Point a,Point b)
{
	return length(a-b);
}
double v_angle(Vector a,Vector b)
{
	return acos(dot(a,b)/length(a)/length(b));
}

int ConvexHull(Point *p,int n,Point *ch)
{
	sort(p,p+n);
	n = unique(p,p+n)-p;
	int m = 0;
	for(int i = 0; i < n; i++)
	{
		while(m>1&&dcmp(cross(ch[m-1]-ch[m-2],p[i]-ch[m-2]))<=0) --m;
		ch[m++] = p[i];
	}
	int k = m;
	for(int i = n-1; i>=0;i--)
	{
		while(m>k&&dcmp(cross(ch[m-1]-ch[m-2],p[i]-ch[m-2]))<=0) --m;
		ch[m++] = p[i];
	}
	if(n>1) m--;
	return m;
}

void get_ocmt(Circle c1,Circle c2,Point &s1, Point &e1,Point &s2,Point &e2)
{
	double l = dist(c1.o,c2.o);
	double d = fabs(c1.r-c2.r);
	double theta = acos(d/l);
	if(dcmp(c1.r-c2.r)>0) swap(c1,c2);
	Vector vec = c1.o-c2.o;
	vec = vec.trunc(c1.r);
	s1 = c1.o+vec.rotate(theta);
	s2 = c1.o+vec.rotate(-theta);
	vec = vec.trunc(c2.r);
	e1 = c2.o+vec.rotate(theta);
	e2 = c2.o+vec.rotate(-theta);
}
void get_pc(Circle c, Point p,Point &s1,Point &s2)
{
	Vector u = c.o-p;
	double dist = length(u);
	double ang = asin(c.r/dist);
	s1 = u.rotate(-ang);
	s2 = u.rotate(ang);
}
int main()
{
	int n,m,pn,chn;
	Circle c[MAXN];
	Tri tri[MAXN];
	Point p[55*55*55],ch[55*55*55];
	while(scanf("%d%d",&n,&m)!=EOF)
	{
		for(int i = 0; i < n;i++)
		{
			c[i].o.input();
			scanf("%lf",&c[i].r);
		}
		for(int i = 0; i < m; i++)
			for(int j = 0; j < 3; j++)
				tri[i].p[j].input();
		pn = 0;
		for(int i = 0; i < n; i++)
			for(int j = i+1; j < n; j++)
			{
				get_ocmt(c[i],c[j],p[pn],p[pn+1],p[pn+2],p[pn+3]);
				p[pn].tp = 0,p[pn].id = i;
				p[pn+1].tp = 0,p[pn+1].id = i;
				p[pn+2].tp = 0,p[pn+2].id = j;
				p[pn+3].tp = 0,p[pn+3].id = j;
				pn+=4;
			}
		for(int i = 0; i < n; i++)
			for(int j = 0; j < m; j++)
				for(int k = 0; k <3; k++)
				{
					p[pn] = tri[j].p[k];
					p[pn].tp = 1, p[pn].id = j;
					get_pc(c[i],tri[j].p[k],p[pn+1],p[pn+2]);
					p[pn+1].tp = 0,p[pn+1].id = i;
					p[pn+2].tp = 0,p[pn+2].id = i;
					pn+=3;
				}
		chn = ConvexHull(p,pn,ch);
		Point sta[10];
		int top=0;
		double ans = 0;
		for(int i = 0; i < chn; i++)
		{
			sta[top++] = ch[i];
			if(top>1)
			{
				ans+=length(sta[top-1]-sta[top-2]);
				if(sta[top-1].tp==sta[top-2].tp&&sta[top-1].id==sta[top-2].id)
				{
					if(sta[top-1].tp==0)
					{
						int tmp=sta[top-1].id;
						ans=ans+c[tmp].len(v_angle(sta[top-1]-c[tmp].o,sta[top-2]-c[tmp].o));
					}
					top-=2;
				}
			}
		}
		printf("%.6f\n",ans);
	}
	return 0;
}

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