func_code_string: #include <bits/stdc++.h>   using namespace std;   const long double eps = 1e-10;   int n, q, t;   double plc[500005], ans[500005];   struct Point {     long double x, y;     Point() {}     Point(long double _x, long double _y) { x = _x, y = _y; }     Point operator+(Point p) { return Point(x + p.x, y + p.y); }   } P[500005], Q[500005];   struct Node {     long double x, m, c;     int d;     Node() {}     Node(long double _x, long double _m, long double _c, int _d) {       x = _x, m = _m, c = _c, d = _d;     }     bool operator<(const Node &p) const { return x < p.x; }   } V[500005];   void Add(Point a, Point b, int v) {     if (abs(b.x - a.x) < eps) return;     if (a.x > b.x) {       swap(a, b);       v *= -1;     }     long double m = (b.y - a.y) / (b.x - a.x), c = a.y - a.x * m;     V[++t] = Node(a.x, v * m, v * c, 0);     V[++t] = Node(b.x, -v * m, -v * c, 0);     return;   }   Point Calc(Point a, Point b, Point p) {     return Point((b.x - a.x) * (p.y - a.y) / (b.y - a.y) + a.x, p.y);   }   int main() {     scanf( %d%d , &n, &q);     int p = 0;     for (int i = 0; i < n; i++) {       int x, y;       scanf( %d%d , &x, &y);       P[i] = Point(x, y);       if (P[i].y < P[p].y) p = i;     }     for (int i = 1; i <= q; i++) {       double x;       scanf( %lf , &x);       plc[i] = x;       V[i] = Node(x, -1, -1, i);     }     t = q;     long double all = 0;     for (int i = 0; i < n; i++) {       all += P[i].x * P[(i + 1) % n].y - P[(i + 1) % n].x * P[i].y;       if (P[i].y < P[(i + 1) % n].y)         Add(P[i], P[(i + 1) % n], -1);       else         Add(P[(i + 1) % n], P[i], -1);     }     all = abs(all / 2);     int s = 0;     for (int i = p; i < n; i++) Q[s++] = P[i];     for (int i = 0; i < p; i++) Q[s++] = P[i];     for (int i = 0; i < n; i++) P[i] = Q[i];     int lf = 0, rg = 0;     Point lst = P[0];     for (int i = 0; i < n - 1; i++) {       int L = (lf + 1) % n, R = (rg + n - 1) % n;       Point now;       if (P[L].y < P[R].y) {         Point tmp = Calc(P[rg], P[R], P[L]) + P[L];         now.x = tmp.x * 0.5, now.y = tmp.y * 0.5;         lf = L;       } else {         Point tmp = Calc(P[lf], P[L], P[R]) + P[R];         now.x = tmp.x * 0.5;         now.y = tmp.y * 0.5;         rg = R;       }       Add(lst, now, 2);       lst = now;     }     sort(V + 1, V + t + 1);     long double a = 0.0, b = 0.0;     for (int i = 1; i <= t; i++) {       long double x = V[i].x, m = V[i].m, c = V[i].c;       if (V[i].d > 0)         ans[V[i].d] = all + (0.5 * a * x * x + b * x);       else {         all -= 0.5 * m * x * x + c * x;         a += m, b += c;       }     }     for (int i = 1; i <= q; i++) printf( %.10lf n , (double)ans[i]);   }   