This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
pll p[250005];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll n, k; cin >> n >> k;
    for (ll i=1; i<=n; i++)
    {
        ll x, y; cin >> x >> y;
        p[i]={x+y, x-y};
    }
    sort(p+1, p+n+1);
    vector <ll> ans;
    auto calc=[&](ll mid, bool trace)
    {
        set <pll> s;
        for (ll i=1, ptr=1, cnt=0; i<=n; i++)
        {
            while (ptr<i && p[ptr].fi<p[i].fi-mid)
                s.erase(mp(p[ptr].se, ptr)), ptr++;
            auto it=s.lower_bound(mp(p[i].se-mid, 0));
            while (it!=s.end() && (*it).fi<=p[i].se+mid)
            {
                if (++cnt>k) return 0;
                if (trace) ans.pb(max(abs(p[i].fi-p[(*it).se].fi), abs(p[i].se-p[(*it).se].se)));
                it++;
            }
            s.insert(mp(p[i].se, i));
        }
        return 1;
    };
    ll lo=0, hi=4e9;
    while (lo<hi)
    {
        ll mid=(lo+hi+1)/2;
        if (calc(mid, 0))
            lo=mid;
        else hi=mid-1;
    }
    calc(lo, 1);
    sort(ans.begin(), ans.end());
    while (ans.size()<k) ans.pb(lo+1);
    for (ll i:ans) cout << i << "\n";
}
Compilation message (stderr)
road_construction.cpp: In function 'int main()':
road_construction.cpp:53:22: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   53 |     while (ans.size()<k) ans.pb(lo+1);
      |            ~~~~~~~~~~^~| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |