Code:
#include<bits/stdc++.h> #define setIO(s) freopen(s".in","r",stdin) using namespace std; int main() { // setIO("input"); int n; long long ans=0; scanf("%d",&n); for(int i=1;i<=n;++i) { int a,b; scanf("%d%d",&a,&b); //x2 y2 ans += b - a; } for(int i=1;i<=n;++i) { int a,b; scanf("%d%d",&a,&b); ans += a-b; } printf("%lld",ans); return 0; }