#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int x[n];
int t[n];
for (int i = 0;i < n;i++)
cin >> x[i];
for (int i = 0;i < n;i++)
cin >> t[i];
int cnt = 0;
cnt = max(t[n-1],x[n-1]);
for (int i = n-2;i >= 0;i--) {
cout << cnt << " ";
cnt = max(x[i+1]-x[i] + cnt,t[i]);
}
cnt += x[0];
cout << cnt;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: