#include using namespace std ; #define fast_input_output ios::sync_with_stdio(false); cin.tie(nullptr); typedef long long ll ; typedef long double ld ; typedef pair P ; typedef tuple TP ; #define chmin(a,b) a = min(a,b) #define chmax(a,b) a = max(a,b) #define bit_count(x) __builtin_popcountll(x) #define gcd(a,b) __gcd(a,b) #define lcm(a,b) a / gcd(a,b) * b #define rep(i,n) for(int i = 0 ; i < n ; i++) #define rrep(i,a,b) for(int i = a ; i < b ; i++) #define endl "\n" int n ; vector X , A ; ll dp1[202020] , dp2[202020] ; ll rec1(int v){ if(dp1[v] != -1) return dp1[v] ; ll res = X[v] + A[v] ; auto it = lower_bound(X.begin(),X.end(),X[v]+A[v]) ; if(*it == X[v]+A[v]){ int u = it - X.begin() ; chmax(res,rec1(u)) ; } return dp1[v] = res ; } ll rec2(int v){ if(dp2[v] != -1) return dp2[v] ; ll res = dp1[v] ; auto jt = lower_bound(X.begin(),X.end(),X[v]-A[v]) ; if(*jt == X[v]-A[v]){ int u = jt - X.begin() ; chmax(res,rec2(u)) ; } return dp2[v] = res ; } int main(){ fast_input_output cin >> n ; X.resize(n+1) ; A.resize(n+1) ; rep(i,n) cin >> X[i] ; rep(i,n) cin >> A[i] ; X[n] = 1e16 ; rep(i,n) dp1[i] = -1 ; rep(i,n) dp2[i] = -1 ; rep(i,n) rec1(i) ; rep(i,n) cout << rec2(i) - X[i] << endl ; }