Language: C++

#include <bits/stdc++.h>

using namespace std;
int m,n;
const double EPS = 1e-11;
vector<pair<int,int> > Pxy,Pyz;
pair<int,int> tem;
vector<int> X;

int findMax(vector<int> vec) {
    int maxs = -999;
    for (auto v : vec) {
        if (maxs < v) maxs = v;
    }
    return maxs;
}

int findMin(vector<int> vec) {
    int mins = 999;
    for (auto v : vec) {
        if (mins > v) mins = v;
    }
    return mins;
}

double width(vector<pair<int,int> > polygon,int x){
    vector<double> w;
    for(int i=0;i<polygon.len();i++){
        pair<int,int> p=polygon[i];
        pair<int,int> q=polygon[(i+1)%polygon.len()];
        if((p.first-x)<EPS){
            w.push_back(1.0*p.second);
        }
        else if(p.first<x && x<q.first|| p.first>0 && x>q.first){
            int x0=p.first;
            int y0=p.second;
            int x1=q.first;
            int y1=q.second;
            w.push_back(y0+1.0*(y1-y0)*(x-x0)/(x1-x0));
        }
    }
    assert(w.len()>0);
    return (findMax(w)-findMin(w));
}

int volume(vector<pair<int,int> >Pxy,vector<pair<int,int> >Pxz,vector<int> X){
    double total=0.0;
    int xmin = max((*min_element(pxy.begin(), pxy.end())).first,
                   (*min_element(pxz.begin(), pxz.end())).first);
    int xmax = min((*max_element(pxy.begin(), pxy.end())).first,
                   (*max_element(pxz.begin(), pxz.end())).first);
    sort(X.begin(), X.end());
    for(int i=0;i<X.len()-1;i++){
        int a=X[i];
        int b=X[i+1];
        if(!(xmin <= a && a <= xmax &&xmin <= b && b<< xmax) ){
            continue;
        }
        int m=(a+b)/2.0;
        va = width(Pxy, a)*width(Pxz, a);
        vb = width(Pxy, b)*width(Pxz, b);
        m = width(Pxy, m)*width(Pxz, m);
        double area=((b-a)/6.0)*(va + 4.0*vm + vb);
        total+=area;
    }
    return total;
}
int main(){
    while(cin>>m>>n&&n!=0){
        for(int i=1;i<=m;i++){
            cin>>tem.first>>tem.second;
            Pxy.push_back(tem);
            X.push_back(x);
        }
        for(int j=1;j<=n;j++){
            cin>>tem.first>>tem.second;
            Pxz.push_back(tem);
            X.push_back(x);
        }
        cout << fixed << volume(PXY, PXZ, X) << endl;
    }
}



Compiler output:
a.cc: In function 'double width(std::vector<std::pair<int, int> >, int)':
a.cc:28:27: error: 'class std::vector<std::pair<int, int> >' has no member named 'len'
   28 |     for(int i=0;i<polygon.len();i++){
      |                           ^~~
a.cc:30:47: error: 'class std::vector<std::pair<int, int> >' has no member named 'len'
   30 |         pair<int,int> q=polygon[(i+1)%polygon.len()];
      |                                               ^~~
In file included from /usr/include/c++/14/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:106,
                 from a.cc:1:
a.cc:42:14: error: 'class std::vector<double>' has no member named 'len'
   42 |     assert(w.len()>0);
      |              ^~~
a.cc:43:21: error: could not convert 'w' from 'vector<double>' to 'vector<int>'
   43 |     return (findMax(w)-findMin(w));
      |                     ^
      |                     |
      |                     vector<double>
a.cc:43:32: error: could not convert 'w' from 'vector<double>' to 'vector<int>'
   43 |     return (findMax(w)-findMin(w));
      |                                ^
      |                                |
      |                                vector<double>
a.cc: In function 'int volume(std::vector<std::pair<int, int> >, std::vector<std::pair<int, int> >, std::vector<int>)':
a.cc:48:34: error: 'pxy' was not declared in this scope; did you mean 'Pxy'?
   48 |     int xmin = max((*min_element(pxy.begin(), pxy.end())).first,
      |                                  ^~~
      |                                  Pxy
a.cc:49:34: error: 'pxz' was not declared in this scope; did you mean 'Pxz'?
   49 |                    (*min_element(pxz.begin(), pxz.end())).first);
      |                                  ^~~
      |                                  Pxz
a.cc:53:21: error: 'class std::vector<int>' has no member named 'len'
   53 |     for(int i=0;i<X.len()-1;i++){
      |                     ^~~
a.cc:60:9: error: 'va' was not declared in this scope; did you mean 'a'?
   60 |         va = width(Pxy, a)*width(Pxz, a);
      |         ^~
      |         a
a.cc:61:9: error: 'vb' was not declared in this scope; did you mean 'b'?
   61 |         vb = width(Pxy, b)*width(Pxz, b);
      |         ^~
      |         b
a.cc:63:43: error: 'vm' was not declared in this scope; did you mean 'm'?
   63 |         double area=((b-a)/6.0)*(va + 4.0*vm + vb);
      |                                           ^~
      |                                           m
a.cc: In function 'int main()':
a.cc:73:25: error: 'x' was not declared in this scope
   73 |             X.push_back(x);
      |                         ^
a.cc:77:13: error: 'Pxz' was not declared in this scope; did you mean 'Pyz'?
   77 |             Pxz.push_back(tem);
      |             ^~~
      |             Pyz
a.cc:78:25: error: 'x' was not declared in this scope
   78 |             X.push_back(x);
      |                         ^
a.cc:80:33: error: 'PXY' was not declared in this scope; did you mean 'Pxy'?
   80 |         cout << fixed << volume(PXY, PXZ, X) << endl;
      |                                 ^~~
      |                                 Pxy
a.cc:80:38: error: 'PXZ' was not declared in this scope
   80 |         cout << fixed << volume(PXY, PXZ, X) << endl;
      |                                      ^~~