#include <bits/stdc++.h>
#include <bits/extc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
using namespace std;
//limit definitions
#define N 200050
int b[N], p[N], s[N], ans[N];
pair<int, int> a[N];
int main(){
int n; cin >> n;
for(int i = 1; i < n + 2; i++) cin >> a[i].ff, a[i].ss = i;
for(int i = 1; i < n + 1; i++) cin >> b[i];
sort(a, a + n + 2), sort(b, b + n + 1);
for(int i = 1; i < n + 1; i++) p[i] = max(p[i - 1], a[i].ff - b[i]);
for(int i = n; i > 0; i--) s[i] = max(s[i + 1], a[i + 1].ff - b[i]);
for(int i = 0; i < n + 1; i++) ans[a[i + 1].ss] = max(p[i], s[i + 1]);
for(int i = 1; i < n + 2; i++) cout << ans[i] << '\n';
}
Compilation message
cc1plus: error: '::main' must return 'int'