Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<int M, bool IsPrime = false>
class Modulo {
    int n;

    static typename std::enable_if<IsPrime, ll>::type inv(ll a, ll p) {
        return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
    }

public:
    Modulo() : n(0) { ; }

    Modulo(int m) : n(m) {
        if (n >= M)
            n %= M;
        else if (n < 0)
            n = (n % M + M) % M;
    }

    Modulo(ll m) {
        if (m >= M)
            m %= M;
        else if (m < 0)
            m = (m % M + M) % M;
        n = m;
    }

    explicit operator int() const { return n; }

    explicit operator ll() const { return n; }

    bool operator==(const Modulo &a) const { return n == a.n; }

    Modulo &operator+=(const Modulo &a) {
        n += a.n;
        if (n >= M) n -= M;
        return *this;
    }

    Modulo &operator-=(const Modulo &a) {
        n -= a.n;
        if (n < 0) n += M;
        return *this;
    }

    Modulo &operator*=(const Modulo &a) {
        n = (ll(n) * a.n) % M;
        return *this;
    }

    Modulo operator+(const Modulo &a) const {
        Modulo res = *this;
        return res += a;
    }

    Modulo operator-(const Modulo &a) const {
        Modulo res = *this;
        return res -= a;
    }

    Modulo operator-() const { return Modulo(0) - *this; }

    Modulo operator*(const Modulo &a) const {
        Modulo res = *this;
        return res *= a;
    }

    Modulo operator^(ll m) const {
        if (m == 0) return Modulo(1);
        const Modulo a = *this;
        Modulo res = (a * a) ^(m / 2);
        return m % 2 ? res * a : res;
    }

    typename std::enable_if<IsPrime, Modulo>::type
    operator/(const Modulo &a) const {
        return *this * inv(ll(a), M);
    }

    typename std::enable_if<IsPrime, Modulo>::type operator/=(const Modulo &a) {
        return *this *= inv(ll(a), M);
    }

    friend bool is_zero(const Modulo &x) { return int(x) == 0; }

    friend int abs(const Modulo &x) { return int(x); }

    static Modulo fact(int n, bool sw = true) {
        static std::vector<Modulo> v1 = {1}, v2 = {1};
        if (n >= (int) v1.size()) {
            const int from = v1.size(), to = n + 1024;
            v1.reserve(to);
            v2.reserve(to);
            for (int i = from; i < to; ++i) {
                v1.push_back(v1.back() * Modulo<M, true>(i));
                v2.push_back(v2.back() / Modulo<M, true>(i));
            }
        }
        return sw ? v1[n] : v2[n];
    }

    static Modulo comb(int a, int b) {
        if (b < 0 || b > a) return 0;
        return Modulo::fact(a, true) * Modulo::fact(b, false) *
               Modulo::fact(a - b, false);
    }
};

typedef Modulo<998244353, true> mInt;


int log2ceil(int n) {
    --n;
    n |= n >> 16;
    n |= n >> 8;
    n |= n >> 4;
    n |= n >> 2;
    n |= n >> 1;
    return n + 1;
}

template<class Monoid>
class SegmentTree {
public:
    using value_type = typename Monoid::value_type;
    using update_type = typename Monoid::value_type;
    int size_, n;
    std::vector<value_type> data;

public:
    SegmentTree() {}

    SegmentTree(const std::vector<value_type> &vec) :
            size_(vec.size()), n(log2ceil(size_)), data(n * 2, Monoid::id()) {
        std::copy(begin(vec), end(vec), begin(data) + n);
        for (int i = n - 1; i >= 0; --i) {
            data[i] = Monoid::op(data[i * 2 + 0], data[i * 2 + 1]);
        }
    }

    SegmentTree(const int count, const value_type &value = Monoid::id()) :
            SegmentTree(std::vector<value_type>(count, value)) {}

    int size() const { return size_; }

    void update(int pos, const value_type &value) {
        assert(0 <= pos && pos < size_);  // assertion
        data[pos += n] = value;
        while (pos /= 2) {
            data[pos] = Monoid::op(data[pos * 2], data[pos * 2 + 1]);
        }
    }

    // セグメント木の区間 [l, r) を演算 Monoid::op (⋅⋅) で畳み込んだ値を返す． すなわち，al⋅al+1⋅…⋅ar−1al⋅al+1⋅…⋅ar−1 を返す． l=rl=r の場合は Monoid::id() を返す．
    value_type query(int l, int r) const {
        assert(0 <= l && l <= r && r <= size_);  // assertion
        l += n;
        r += n;
        value_type res1 = Monoid::id(), res2 = Monoid::id();
        while (l < r) {
            if (l & 1) res1 = Monoid::op(res1, data[l++]);
            if (r & 1) res2 = Monoid::op(data[--r], res2);
            l >>= 1;
            r >>= 1;
        }
        return Monoid::op(res1, res2);
    }
};

// RMQ
struct RMQ {
    using value_type = pair<int, int>;

    static value_type id() { return {-2000000000, -1}; }

    static value_type op(const value_type &l, const value_type &r) {
        return std::max(l, r);
    }
};


template<class T>
class Compress {
private:
    vector<T> data;

public:
    Compress() {

    }

    Compress(const vector<T> &vec) : data(vec) {
        sort(data.begin(), data.end());
        data.erase(unique(data.begin(), data.end()), data.end());
    }

    T get(int k) {
        assert(k >= 0 && k < data.size());
        return data[k];
    }

    typename vector<T>::iterator lower_bound(const T &t) {
        return ::lower_bound(data.begin(), data.end(), t);
    }

    typename vector<T>::iterator upper_bound(const T &t) {
        return ::upper_bound(data.begin(), data.end(), t);
    }

    int lb_index(const T &t) {
        return lower_bound(t) - data.begin();
    }

    int ub_index(const T &t) {
        return upper_bound(t) - data.begin();
    }

    size_t size() {
        return data.size();
    }
};


mInt dp[200050];
bool memo[200050];
int X[200050];
int D[200050];

Compress<int> cmp;
SegmentTree<RMQ> seg;
int nn;

int address[200050];

int jump(int p) {
    if( address[p] != -1 )
        return address[p];
    int ri = X[p] + D[p];
    auto val = seg.query(cmp.lb_index(X[p]), cmp.ub_index(ri));
    int v = val.first;
    int idx = val.second;
    if (v == ri) {
        return address[p] = upper_bound(X, X + nn, v) - X;
    }
    return address[p] = jump(idx);
}

mInt dfs(int pos) {
    if (pos == nn) return 1;

    if (memo[pos]) {
        return dp[pos];
    }
    mInt ans = dfs(pos + 1);
    ans += dfs(jump(pos));
    return dp[pos] = ans;
}

void solve() {
    memset(address, -1, sizeof(address));
    vector<pair<int, int>> PP;
    vector<int> u;
    for (int i = 0; i < nn; i++) {
        D[i]--;
        u.push_back(X[i]);
        u.push_back(X[i] - 1);
        u.push_back(X[i] + D[i]);
        u.push_back(X[i] + D[i] + 1);
        PP.push_back({X[i], D[i]});
    }
    sort(PP.begin(), PP.end());
    for (int i = 0; i < nn; i++) {
        X[i] = PP[i].first;
        D[i] = PP[i].second;
    }
    cmp = Compress<int>(u);
    seg = SegmentTree<RMQ>(u.size());
    for (int i = 0; i < nn; i++) {
        seg.update(cmp.lb_index(X[i]), make_pair(X[i] + D[i], i));
    }cc

    cout << (int) dfs(0) << endl;
}

int main() {
    scanf("%d", &nn);
    for (int i = 0; i < nn; i++) {
        scanf("%d", &X[i]);
        scanf("%d", &D[i]);
    }
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:287:6: error: 'cc' was not declared in this scope
  287 |     }cc
      |      ^~