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;


double width(vector<pair<int,int> > polygon,double 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);
    vector<double>::iterator maxs=max_element(w.begin(),w.end());
    vector<double>::iterator mins=min_element(w.begin(),w.end());
    return (maxs-mins);
}

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;
        }
        double m=(a+b)/2.0;
        double va = width(Pxy, a)*width(Pxz, a);
        double vb = width(Pxy, b)*width(Pxz, b);
        double vm = 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> >, double)':
a.cc:13:27: error: 'class std::vector<std::pair<int, int> >' has no member named 'len'
   13 |     for(int i=0;i<polygon.len();i++){
      |                           ^~~
a.cc:15:47: error: 'class std::vector<std::pair<int, int> >' has no member named 'len'
   15 |         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:27:14: error: 'class std::vector<double>' has no member named 'len'
   27 |     assert(w.len()>0);
      |              ^~~
a.cc: In function 'int volume(std::vector<std::pair<int, int> >, std::vector<std::pair<int, int> >, std::vector<int>)':
a.cc:35:34: error: 'pxy' was not declared in this scope; did you mean 'Pxy'?
   35 |     int xmin = max((*min_element(pxy.begin(), pxy.end())).first,
      |                                  ^~~
      |                                  Pxy
a.cc:36:34: error: 'pxz' was not declared in this scope; did you mean 'Pxz'?
   36 |                    (*min_element(pxz.begin(), pxz.end())).first);
      |                                  ^~~
      |                                  Pxz
a.cc:40:21: error: 'class std::vector<int>' has no member named 'len'
   40 |     for(int i=0;i<X.len()-1;i++){
      |                     ^~~
a.cc: In function 'int main()':
a.cc:60:25: error: 'x' was not declared in this scope
   60 |             X.push_back(x);
      |                         ^
a.cc:64:13: error: 'Pxz' was not declared in this scope; did you mean 'Pyz'?
   64 |             Pxz.push_back(tem);
      |             ^~~
      |             Pyz
a.cc:65:25: error: 'x' was not declared in this scope
   65 |             X.push_back(x);
      |                         ^
a.cc:67:33: error: 'PXY' was not declared in this scope; did you mean 'Pxy'?
   67 |         cout << fixed << volume(PXY, PXZ, X) << endl;
      |                                 ^~~
      |                                 Pxy
a.cc:67:38: error: 'PXZ' was not declared in this scope
   67 |         cout << fixed << volume(PXY, PXZ, X) << endl;
      |                                      ^~~