#include #include using namespace std; using namespace atcoder; using ll = long long; // -2^63 ~ 2^63-1 (9.2*10^18) using ull = unsigned long long; // 0 ~ 2^64-1 (1.8*10^19) using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, m, n) for (int i = (m); (i) < int (n); i++) #define all(v) v.begin(), v.end() #define bit(n) (1ll<<(n)) // 2^n #define sz(x) ((int)(x).size()) #define fi first #define se second template using maxpq = priority_queue; template using minpq = priority_queue, greater>; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b auto make_vec(const ll (&d)[n], T&& init) noexcept { if constexpr (idx < n) return std::vector(d[idx], make_vec(d, std::forward(init))); else return init; } template auto make_vec(const ll (&d)[n], const T& init = {}) noexcept { if constexpr (idx < n) return std::vector(d[idx], make_vec(d, init)); else return init; } // auto 変数名 = make_vec<型>({a, b, ...}, 初期値); int main(){ int N, X; cin >> N >> X; vector A(N), B(N); rep(i, N){ cin >> A[i] >> B[i]; A[i]--; } vector ans(X, 0); rep(i, N){ rep2(j, max(0, A[i]-B[i]), min(X-1, A[i]+B[i])+1){ chmax(ans[j], B[i]-abs(j-A[i])); } } rep(i, X){ cout << ans[i] << " "; } cout << endl; }