Buggy python submission (verdict: Runtime Error):
def main():
    import sys
    from collections import deque
    from operator import itemgetter
    b=sys.stdin.buffer
    n,d,a=map(int,b.readline().split())
    m=map(int,b.read().split())
    p,q=deque(),deque()
    pl,ql=p.popleft,q.popleft
    pa,qa=p.append,q.append
    s=b=0
    for x,h in sorted(zip(m,m),key=itemgetter(0)):
        while p and p[0]<x:
            f()
            b-=g()
        h-=b
        t=0--h//a
        if t>0:
            s+=t
            b+=t*a
            pa(x+d+d)
            qa(t*a)
    print(s)
main()

Fixed submission:
from bisect import*
def _add(data, k, x):
    while k <= N:
        data[k] += x
        k += k & -k
def add(l, r, x):
    _add(data0, l, -x*(l-1))
    _add(data0, r, x*(r-1))
    _add(data1, l, x)
    _add(data1, r, -x)

def _get(data, k):
    s = 0
    while k:
        s += data[k]
        k -= k & -k
    return s
def query(l, r):
    return _get(data1, r-1) * (r-1) + _get(data0, r-1) - _get(data1, l-1) * (l-1) - _get(data0, l-1)
N,d,a,*t=map(int,open(0).read().split())
N+=1
z=sorted(zip(*[iter(t)]*2))
data0=[0]*(N+1)
data1=[0]*(N+1)
y=[x for x,_ in z]
c=0
for i,(x,h)in enumerate(z,1):
    h-=query(i,i+1)
    t=0--max(0,h)//a
    j=bisect(y,x+d+d)
    add(1,j+1,t*a)
    c+=t
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from bisect import bisect
    def _add(data,k,x):
        while k<=N:
            data[k]+=x
            k+=k&-k
    def add(l,r,x):
        _add(data0,l,-x*(l-1))
        _add(data0,r,x*(r-1))
        _add(data1,l,x)
        _add(data1,r,-x)
    def _get(data,k):
        s=0
        while k:
            s+=data[k]
            k-=k&-k
        return s
    def query(l,r):
        return _get(data1,r-1)*(r-1)+_get(data0,r-1)-_get(data1,l-1)*(l-1)-_get(data0,l-1)
    N,d,a,*t=map(int,open(0).read().split())
    data0=[0]*(N+1)
    data1=[0]*(N+1)
    z=sorted(zip(*[iter(t)]*2))
    y=[x for x,_ in z]
    c=0
    for i,(x,h)in enumerate(z,1):
        h-=query(i,i+1)
        t=0--max(0,h)//a
        j=bisect(y,x+d+d)
        add(1,j+1,t*a)
        c+=t
    print(c)
main()

Fixed submission:
from bisect import*
def _add(data, k, x):
    while k <= N:
        data[k] += x
        k += k & -k
def add(l, r, x):
    _add(data0, l, -x*(l-1))
    _add(data0, r, x*(r-1))
    _add(data1, l, x)
    _add(data1, r, -x)

def _get(data, k):
    s = 0
    while k:
        s += data[k]
        k -= k & -k
    return s
def query(l, r):
    return _get(data1, r-1) * (r-1) + _get(data0, r-1) - _get(data1, l-1) * (l-1) - _get(data0, l-1)
N,d,a,*t=map(int,open(0).read().split())
N+=1
z=sorted(zip(*[iter(t)]*2))
data0=[0]*(N+1)
data1=[0]*(N+1)
y=[x for x,_ in z]
c=0
for i,(x,h)in enumerate(z,1):
    h-=query(i,i+1)
    t=0--max(0,h)//a
    j=bisect(y,x+d+d)
    add(1,j+1,t*a)
    c+=t
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import*
def _add(data,k,x):
    while k<=N:
        data[k]+=x
        k+=k&-k
def add(l,r,x):
    _add(data0,l,-x*(l-1))
    _add(data0,r,x*(r-1))
    _add(data1,l,x)
    _add(data1,r,-x)
def _get(data,k):
    s=0
    while k:
        s+=data[k]
        k-=k&-k
    return s
def query(l,r):
    return _get(data1,r-1)*(r-1)+_get(data0,r-1)-_get(data1,l-1)*(l-1)-_get(data0,l-1)
N,d,a,*t=map(int,open(0).read().split())
data0=[0]*(N+1)
data1=[0]*(N+1)
z=sorted(zip(*[iter(t)]*2))
y=[x for x,_ in z]
c=0
for i,(x,h)in enumerate(z,1):
    h-=query(i,i+1)
    t=0--max(0,h)//a
    j=bisect(y,x+d+d)
    add(1,j+1,t*a)
    c+=t
print(c)

Fixed submission:
from bisect import*
def _add(data, k, x):
    while k <= N:
        data[k] += x
        k += k & -k
def add(l, r, x):
    _add(data0, l, -x*(l-1))
    _add(data0, r, x*(r-1))
    _add(data1, l, x)
    _add(data1, r, -x)

def _get(data, k):
    s = 0
    while k:
        s += data[k]
        k -= k & -k
    return s
def query(l, r):
    return _get(data1, r-1) * (r-1) + _get(data0, r-1) - _get(data1, l-1) * (l-1) - _get(data0, l-1)
N,d,a,*t=map(int,open(0).read().split())
N+=1
z=sorted(zip(*[iter(t)]*2))
data0=[0]*(N+1)
data1=[0]*(N+1)
y=[x for x,_ in z]
c=0
for i,(x,h)in enumerate(z,1):
    h-=query(i,i+1)
    t=0--max(0,h)//a
    j=bisect(y,x+d+d)
    add(1,j+1,t*a)
    c+=t
print(c)