#include #include #include #include using namespace std; using namespace atcoder; using ll=long long; ll op(ll a,ll b) {return a+b;} ll e() {return 0LL;} ll mapping(ll F,ll x) {return F+x;} ll composition(ll F,ll G) {return F+G;} ll id(){ return 0LL;} int main(){ ll n,dx=2001001,ans=0; cin>>n; vector a(n),b(n); lazy_segtree s(3001002); for(int i=0;i>a[i];a[i]+=dx;} for(int i=0;i>b[i]; for(int i=0;i csum={s.get(0)}; ll fmin=2001001001001001001; ll minx; for(ll i=0;i<3001001;i++){ csum.push_back(csum[i]+s.get(i+1)); ll f=csum[i+1]; if(f