int x1,y1,x2,y2,x3,y3,x4,y4; cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4; int X1, Y1, X2, Y2, X3, Y3, X4, Y4; X1=min(x1,x2); X2=max(x1,x2); Y1=min(y1,y2); Y2=max(y1,y2); X3=min(x3,x4); X4=max(x3,x4); Y3=min(y3,y4); Y4=max(y3,y4); int left=max(X1,X3); int right=min(X2,X4); int bottom=max(Y1,Y3); int top=min(Y2,Y4); if(right>left && top>bottom) cout<<(right-left)*(top-bottom)<<endl; else cout<<0<<endl; return 0; }