Language: C

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>

using namespace std;

#define MP(x, y) make_pair(x, y)
#define F first
#define S second
#define PII pair<int,int>
const double eps = 1e-8;
int sgn(double x) {return x < -eps ? -1 : x > eps;}
struct Point
{
    double x, y;
    Point(double x=0, double y = 0):x(x), y(y){}
};
struct Data
{
    double x, h, b;
    void input()
    {
        scanf("%lf%lf%lf", &x, &h, &b);
    }
}d[110];
int n;
PII p[1001010];
int cnt;

double det(Point a, Point b, Point c)
{
    double x1 = b.x - a.x, y1 = b.y - a.y;
    double x2 = c.x - a.x, y2 = c.y - a.y;
    return x1 * y2 - x2 * y1;
}

char inter(Point a, Point b, Point c, Point d)
{
    int t1 = sgn(det(a, c, d)) , t2 = sgn(det(b, c, d));
    int t3 = sgn(det(c, a, b)) , t4 = sgn(det(d, a, b));

    return (t1 * t2 <= 0 && t3 * t4 <= 0 && (t1 || t2 || t3 || t4));
}

Point cross(Point a, Point b, Point c, Point d)
{
    int d1, d2, d3, d4;
    double s1, s2, s3, s4;

    d1 = sgn(s1 = det(a, b, c));
    d2 = sgn(s2 = det(a, b, d));
    d3 = sgn(s3 = det(c, d, a));
    d4 = sgn(s4 = det(c, d, b));

    Point p;
    if((d1 ^ d2) == -2 && (d3 ^ d4) == -2)
    {
        p.x = (c.x * s2 - d.x * s1) / (s2 - s1);
        p.y = (c.y * s2 - d.y * s1) / (s2 - s1);
    }
    else
        while(1);
        
    return p;
}

double dist(PII a, PII b)
{
    double x = a.F - b.F, y = a.S - b.S;
    return sqrt(x * x + y * y);
}

void cal(Point a, Point b, Point c, Point d)
{
    if(!inter(a, b, c, d))  return;

    Point tp = cross(a, b, c, d);
    p[cnt++] = MP(tp.x, tp.y);
}

char check(Point a)
{
    for(int i = 0; i < n; i++)
    {
        int x1 = d[i].x, h1 = d[i].h, bb1 = d[i].b;
        Point a1, b1, c1, a2, b2, c2;
        a1 = Point(x1 - bb1/2, 0);
        b1 = Point(x1, h1);
        c1 = Point(x1 + bb1/2, 0);  
        double t1 = det(a, a1, b1), t2 = det(a, b1, c1), t3 = det(a, c1, a1);
        double t = fabs(t1 + t2 + t3);
        if(sgn(t - h1 * bb1) == 0 && sgn(t1) && sgn(t2) && sgn(t3))
            return 0;
    }

    return 1;
}

int main()
{
    int cas = 1;
    while(scanf("%d", &n), n)
    {   
        for(int i = 0; i < n; i++)
            d[i].input();

        cnt = 0;
        for(int i = 0; i < n; i++)
        {
                        int x1 = d[i].x, h1 = d[i].h, bb1 = d[i].b;
            Point a1, b1, c1, a2, b2, c2;
            a1 = Point(x1 - bb1/2, 0);
            b1 = Point(x1, h1);
            c1 = Point(x1 + bb1/2, 0);
                
             p[cnt++] = MP(a1.x, a1.y);
             p[cnt++] = MP(b1.x, b1.y);
             p[cnt++] = MP(c1.x, c1.y);
            for(int j = i + 1; j < n; j++)
            {
                int x2 = d[j].x, h2 = d[j].h, bb2 = d[j].b;

                a2 = Point(x2 - bb2/2, 0);
                b2 = Point(x2, h2);
                c2 = Point(x2 + bb2/2, 0);
                cal(a1, b1, a2, b2);
                cal(a1, b1, c2, b2);
                cal(c1, b1, a2, b2);
                cal(c1, b1, c2, b2);
            } 
        }

         int tcnt = 0;
         for(int i = 0; i < cnt; i++)
            if(check(Point(p[i].F, p[i].S)))
                p[tcnt++] = p[i];

         cnt = tcnt;
         sort(p, p + cnt);
         double ans = 0;
         for(int i = 1; i < cnt; i++)
            ans += dist(p[i - 1], p[i]);
         printf("cnt=%d\n", cnt);
         printf("Case %d: %.0lf\n\n", cas++, ans);
    }
    return 0;
}

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