func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   T abs(T x) {     return x > 0 ? x : (-x);   }   template <class T>   T sqr(T x) {     return x * x;   }   const double eps = 1E-8;   struct P {     double x, y;     P(double x = 0.0, double y = 0.0) : x(x), y(y) {}     P operator+(P a) { return P(x + a.x, y + a.y); }     P operator-(P a) { return P(x - a.x, y - a.y); }     P operator*(double k) { return P(x * k, y * k); }     double operator*(P a) { return x * a.y - y * a.x; }     double operator^(P a) { return x * a.x + y * a.y; }     double len() { return sqrt(x * x + y * y); }     P perp() { return P(y, -x); }     P norm() {       double l = len();       return abs(l) < eps ? P(x, y) : P(x / l, y / l);     }     bool operator==(P a) { return abs(x - a.x) < eps && abs(y - a.y) < eps; }     void load() { cin >> x >> y; }   };   int sgn(double x) {     if (x > eps) return 1;     if (x < -eps) return -1;     return 0;   }   bool pointOnSegment(P p, P a, P b) {     if (abs((a - p) * (b - p)) > eps) return false;     return ((a - p) ^ (b - p)) < eps;   }   bool crossSegments1d(double a, double aa, double b, double bb) {     return min(a, aa) < max(b, bb) + eps && min(b, bb) < max(a, aa) + eps;   }   bool crossSegments(P a, P aa, P b, P bb) {     if (sgn((b - a) * (aa - a)) * sgn((aa - a) * (bb - a)) < 0) return false;     if (sgn((a - b) * (bb - b)) * sgn((bb - b) * (aa - b)) < 0) return false;     return crossSegments1d(a.x, aa.x, b.x, bb.x) &&            crossSegments1d(a.y, aa.y, b.y, bb.y);   }   struct L {     double a, b, c;     L(double a = 0.0, double b = 0.0, double c = 0.0) : a(a), b(b), c(c) {}     bool operator||(L l) { return abs(a * l.b - b * l.a) < eps; }   };   L getLine(P p1, P p2) {     double x0 = p1.x, y0 = p1.y;     double al = (p2 - p1).x, be = (p2 - p1).y;     return L(be, -al, al * y0 - be * x0);   }   P getPoint(L l1, L l2) {     double det = l1.a * l2.b - l1.b * l2.a;     double det1 = -(l1.c * l2.b - l1.b * l2.c);     double det2 = -(l1.a * l2.c - l1.c * l2.a);     return P(det1 / det, det2 / det);   }   double h, f;   pair<double, double> calc1(double y, double x1, double x2) {     double l = x1 * (f - y) / (f - h);     double r = x2 * (f - y) / (f - h);     return make_pair(l, r);   }   pair<double, double> calc2(double y, double x1, double x2) {     double l = x1 * (y + f) / (f - h);     double r = x2 * (y + f) / (f - h);     return make_pair(l, r);   }   int main() {     int n;     cin >> n;     cin >> h >> f;     vector<pair<int, int> > v(n);     double res = 0.0;     for (int i = 0; i < n; ++i) {       scanf( %d%d , &v[i].first, &v[i].second);       double l = abs(v[i].second - v[i].first);       res += 2. * h * (l + l * (f + h) / (f - h));     }     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) {         vector<P> V;         L l11 = getLine(P(0, f), P(v[i].first, h));         L l12 = getLine(P(0, f), P(v[i].second, h));         L l21 = getLine(P(0, -f), P(v[j].first, -h));         L l22 = getLine(P(0, -f), P(v[j].second, -h));         if (!(l11 || l21)) V.push_back(getPoint(l11, l21));         if (!(l11 || l22)) V.push_back(getPoint(l11, l22));         if (!(l12 || l21)) V.push_back(getPoint(l12, l21));         if (!(l12 || l22)) V.push_back(getPoint(l12, l22));         vector<double> ev;         ev.push_back(-h);         ev.push_back(-h);         ev.push_back(h);         ev.push_back(h);         for (int k = 0; k < ((int)(V).size()); ++k) {           if (abs(V[k].y) < h + eps) ev.push_back(V[k].y);         }         sort((ev).begin(), (ev).end());         double cur = 0;         double st = 0.0;         for (int k = 1; k < ((int)(ev).size()); ++k) {           pair<double, double> p = calc1(ev[k], v[i].first, v[i].second);           pair<double, double> q = calc2(ev[k], v[j].first, v[j].second);           double l = max(p.first, q.first);           double r = min(p.second, q.second);           double t = max(0.0, r - l);           cur += (t + st) * 0.5 * (ev[k] - ev[k - 1]);           st = t;         }         res -= abs(cur);       }     }     printf( %.10lf n , res);     return 0;   }   