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>
using namespace std;
using ll = long long;
ll n, k;
vector<pair<ll, ll> > sor;
set<pair<ll, ll> > ck;
vector<ll> mo;
vector<ll> calc(int r){
    ck.clear();
    vector<ll> res;
    int ind = 0;
    for (int i = 0; i < n; i++){
        // cout << sor[i].first << " " << sor[i].second << ": " << endl;
        while (ind < i && sor[i].first - sor[ind].first > r) {
            ck.erase(make_pair(sor[ind].second, sor[ind].first));
            ind++;
        }
        // for (auto x : ck){
        //     cout << x.first << " " << x.second << endl;
        // }
        auto it = ck.lower_bound(make_pair(sor[i].second - r, -4000000001));
        while (res.size() < k && it != ck.end() && it -> first <= sor[i].second + r){
            // cout << it -> first << " " << it -> second << endl;
            ll x1 = (sor[i].first + sor[i].second) / 2, y1 = (sor[i].first - sor[i].second) / 2;
            ll x2 = (it -> first + it -> second) / 2, y2 = (it -> second - it -> first) / 2;
            // cout << x1 << " " << y1 << " " << x2 << " " << y2 << ": " << abs(x1 - x2) + abs(y1 - y2) << endl;
            res.push_back(abs(x1 - x2) + abs(y1 - y2));
            it++;
        }
        ck.insert(make_pair(sor[i].second, sor[i].first));
    }
    return res;
}
int main(){
    cin >> n >> k;
    sor.resize(n);
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        sor[i] = make_pair(a + b, a - b);
    }
    sort (sor.begin(), sor.end());
    ll l = 0, r = 4000000001;
    while (l != r){
        ll mid = (l + r) / 2;
        if (calc(mid).size() >=k) r = mid;
        else l = mid + 1;
    }
    mo = calc(l - 1);
    sort(mo.begin(), mo.end());
    for (int i = 0; i < k; i++){
        if (i < mo.size()) cout << mo[i] << '\n';
        else cout << l << '\n';
    }
    return 0;
}
Compilation message (stderr)
road_construction.cpp: In function 'std::vector<long long int> calc(int)':
road_construction.cpp:25:27: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   25 |         while (res.size() < k && it != ck.end() && it -> first <= sor[i].second + r){
      |                ~~~~~~~~~~~^~~
road_construction.cpp: In function 'int main()':
road_construction.cpp:53:30: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   53 |         if (calc(mid).size() >=k) r = mid;
      |             ~~~~~~~~~~~~~~~~~^~~
road_construction.cpp:61:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |         if (i < mo.size()) cout << mo[i] << '\n';
      |             ~~^~~~~~~~~~~| # | 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... |