peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
N = int(sys.stdin.readline().rstrip())
sec = []

for _ in range(N):
    x, l = map(int, sys.stdin.readline().rstrip().split())
    sec.append((x - l + 1, x + l - 1))

sec = sorted(sec, key=lambda x: x[1])
r = -float("inf")
ans = 0
for s, t in sec:
    if r < s:
        ans += 1
        r = t
print(ans)
n = int(input())
x = []
l = []
xl = []
for i in range(n):
    x1, l1 = map(int, input().split())
    xl.append([x1, x1 + l1, 2 * l])
xl.sort()
ans = n
for i in range(n - 1):
    if xl[i][1] > xl[i + 1][0]:
        if xl[i][2] >= xl[i + 1][2]:
            ans -= 1
        else:
            ans -= 1
            xl[i + 1] = [i]
print(ans)
N = int(input())
XL = [list(map(int, input().split())) for _ in range(N)]

XL.sort()

i = 0
result = 0
while i < N - 1:
    x1, l1 = XL[i]
    x2, l2 = XL[i + 1]
    if x1 + l1 > x2 - l2:
        result += 1
        i += 1
    i += 1
print(N - result)
N = int(input())
L = []

L = [[int(x) for x in input().split()] for x in range(N)]


for i in range(len(L)):
    L[i][0] = L[i][0] - L[i][1]
    L[i][1] = L[i][0] + L[i][1]
S =[]
Q = sorted(L)
a = 1
check = 0

for i in range(0,len(Q)-1):
    check = Q[i][1]
    if Q[i+1][0] >=check :
        check = Q[i+1][0]
        a+=1
print(a)
n = int(input())
xl = [list(map(int, input().split())) for i in range(n)]
xl = sorted([[x-l+1,x+l-1] for x,l in xl], key = lambda x: x[1])
print(xl)
now = - 10 ** 10
ans = 0
for s,e in xl:
  if s > now:
    ans += 1
    now = e
print(ans)
s=int(input())
t=[]
for i in range(s):
    u,l=map(int,input().split())
    t.append((u-l,u+l-1))
t.sort(key=lambda x: x[1])
d=-10*10
ans=0
for i in range(s):
  a=t[i][0]
  if d<a:
    ans+=1
    d=t[i][1]
print(ans)
import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.buffer.read


N = int(readline())
XL = map(int, read().split())

LR = sorted(
    [(x - l, x + l) for x, l in zip(XL, XL)],
    key=lambda x: x[1])
LR += [(3 * 10 ** 9, 3 * 10 ** 9)]
i = 1
while True:
    if len(LR) - 1 <= i:
        break

    _, pr = LR[i - 1]
    cl, cr = LR[i]
    nl, _ = LR[i + 1]

    if pr <= cl and cr <= nl:
        i += 1
    else:
        del LR[i]

print(len(LR) - 1)
n = int(input())

xl = []

for i in range(n):
    x,l = map(int,input().split())
    xl.append([x-l,x+l])
xl.sort()
ans = -10**10
count = 0
for j in range(n):
    if xl[i][1] > ans:
        count +=1
        ans = xl[i][0]
print(count)
n = int(input())
r = []
for _ in range(n):
    r.append(list(map(int,input().split())))
r.sort()
i = 0
while i <= len(r)-2:
    if r[i][0] + r[i][1] > r[i+1][0] - r[i+1][1]:
        r.pop(i+1)
    else:
        i += 1
print(len(r))
n = int(input())
robot = []
for i in range(n):
    x, l = map(int,input().split())
    robot.append([x - l, x + l]) #left, right
robot.sort()
preright = robot[0][0]
ans = 0
for i in range(n):
    left = robot[i][0]
    #print(preright, left)
    if preright <= left:
        ans += 1
        preright = robot[i][1]
print(ans)
import numpy as np
n = int(input())
robot = [
    list(map(int, input().split())) for i in range(n)
]
robot.sort(key=lambda x: x[1], reverse=True)
ans = []
now = np.zeros(n, dtype="float32")

for i in range(n):
    robot_i = robot.pop()
    x, l = robot_i
    if sum(now[x-l:x+l]) == 0:
        now[x-l:x+l] = 1
        ans.append(robot_i)
print(len(ans))
n = int(input())
XL = [[int(x) for x in input().split()] for _ in range(n)]
XL.sort(key=lambda xl: xl[0] - xl[1])
count = 0
while len(XL) > 0:
    count += 1
    limit = XL[0][0] + XL[0][1]
    while len(XL) > 0 and XL[0][0] - XL[0][1] < limit:
        XL.pop(0)
print(count)
N=int(input())

a=[]
k=[]

for i in range(N):
    m=input().split()
    k=[int(m[0]),int(m[1])]
    a.append(k)

a=sorted(a)
#print(a)
counter=0
now=[]
out=0
for i in a:
    if counter==0:
        now=[i[0]+i[1]]
        counter+=1
        continue
    if now[0]>(i[0]-i[1]):
        out+=1
        continue
    now[0]=i[0]+i[1]
print(len(a)-out)
import sys
input = sys.stdin.readline

n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]
xl2 = sorted([[x - l + 1, x + l - 1] for x, l in xl])

ans = n
mr = xl2[0][0] - 1
for l, r in xl2:
    if l <= mr:
        ans -= 1
    else:
        mr = r

print(ans)
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
XL=[]
for i in range(n):
    x,l=map(int,input().split())
    XL.append((x,l))

XL.sort()
now=XL[0][0]+XL[0][1]
for i in range(1,n):
    x,l=XL[i]
    if x-l<now:
        count+=1
        now=min(now,x+l)
print(n-count)
n = int(input())
data = [[]]*(n+2)
data[0] = [-10**10, -10**10]
for i in range(1, n+1):
    x, l = map(int, input().split())
    data[i] = [x-l, x+l]
data[n+1] = [10**10, 10**10]
data.sort()
ans = n
if n == 2:
  if data[1][1] > data[2][0]:
    ans -= 1
else:
  for i in range(1, n):
    if data[i][1] > data[i+1][0] and data[i-1][1] > data[i][0]:
        ans -= 1
        data[i][0] = 0
        data[i][1] = 0
    
print(ans)
n=int(input())

L=[]
for i in range(n):
    x,l=map(int,input().split())
    L.append([x,l])
L.sort(key=lambda x:x[0])

LL=[]
LL.append(L[0])
bef=sum(L[0])
for i in range(1,n):
    if bef<=L[i][0]-L[i][1]:
        LL.append(L[i])
        bef=sum(L[i])
print(len(LL))
n=int(input())
xl=[list(map(int,input().split())) for _ in range(n)]
lr=[[xl[i][0]-xl[i][1],xl[i][0]+xl[i][1]] for i in range(n)]
lr.sort(key=lambda x:x[1])
ans=n
r=lr[0][1]
for i in range(1,n):
  if lr[i][0]<r:
    ans-=1
    r=lr[0][1]
  else:
    r=lr[i-1][1]
print(ans)
import math
def main():
    N = int(input())
    robo = []

    for _ in range(N):
        x, l = map(int, input().split())
        l = l-1
        robo.append((x+l, x-l))

    robo = sorted(robo, key=lambda x: x[0])
    #print(robo)
    ans = 0
    t = -100000000000000000000000000000000000000000000000000000000
    for i in range(N):
        if t <= robo[i][1]:
            ans += 1
            t = robo[i][0]

    print(ans)




    return 0

if __name__ == '__main__':
    main()
N = int(input())

xl = []

for i in range(N):
    xl.append(list(map(int,input().split())))

itv = []

for i in range(N):
    right = xl[i][0] + xl[i][1]  ##right
    left = xl[i][0] - xl[i][1]  ##left   
    itv.append([right,left])
itv.sort()

ass = 0
tt = -1e10
for i in range(N):
    if tt < itv[i][1]:
        ass += 1
        tt = itv[i][0]
print(ass)
N = int(input())

dic = {}
for n in range(N):
    x, l = map(int, input().split())
    d = {x:l}
    dic.update(d)

ran = []
re = dic
for d in list(dic):
    if ran != []:
        if (ran[0]<d-dic[d]<ran[1]) or (ran[0]<d+dic[d]<ran[1]):
            dic.pop(d)
            ran = []
    else:
        ran.append(d-dic[d])
        ran.append(d+dic[d])

print(len(dic))
n=int(input())
xl=[list(map(int,input().split())) for _ in range(n)]
xl.sort(key=lambda x: x[0])
ans=0
for i in range(n-1):
  if sum(xl[i])>=xl[i+1][0]:
    ans+=1
print(n-ans)
N = int(input())
R = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x:x[0])

remain = list(range(N))
ans = N
left = 0
i = 1
while i < N:
  x_l, length_l = R[left]
  x, length = R[i]
  if x-x_l < length_l+length:
    ans -= 1
  else:
    left = i
  i += 1
print(ans)
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    robo = []
    for i in range(N):
        x, l = [int(x) for x in input().split()]
        robo.append((x, l))
    robo.sort()

    ans = N
    x0, l0 = robo[0]
    for i in range(1, N):
        x, l = robo[i]
        if x - l < x0 + l0:
            ans -= 1
        else:
            x0, l0 = x, l

    print(ans)

if __name__ == '__main__':
    main()
N = int(input())
arms = [list(map(int, input().split())) for _ in range(N)]

arms.sort()

ans = 1
left = arms[0][0] + arms[0][1]
for i in range(1, N):
  if left < arms[i][0] - arms[i][1]:
    ans += 1
    left = arms[i][0] + arms[i][1]

print(ans)
import sys
inputs = sys.stdin.readlines()

n = int(inputs[0])
Y = []
for s in inputs[1:]:
    x, l = map(int, s.split())
    Y.append((x-l+1, x+l-1))
Y.sort(key=lambda x: x[0])

cnt = 1
_, r0 = Y[0]
for i in range(1, n):
    l, r = Y[i]
    if r0 < l:
        cnt += 1
        r0 = r
print(cnt)
n = int(input())

dist = []
for i in range(n):
    l = list(map(int,input().split()))
    dist.append(l)

sorted_data = sorted(dist,key=lambda x:(x[0],x[1]))
#print(sorted_data)

remove = 0
temp = sorted_data[0]
for i in range(1,n):
    d = sorted_data[i][0]-temp[0]
    if d < temp[1]:
        temp = sorted_data[i]
        remove += 1
        #print("rv:", sorted_data[i][0], sorted_data[i][1])

print(n-remove)
N = int(input())
left = [] 
right = []
for i in range(N):
    x, dis = map(int, input().split(" "))
    left.append(x-dis)
    right.append(x+dis)

left.sort()
right.sort()

cnt = 1
now = -float("inf")
for i in range(N):
    if now <= left[i]:
        cnt += 1
        now = right[i]

print(cnt)
from operator import itemgetter
n = int(input())
ans = n
A = []
for i in range(n):
    x, l = [int(i) for i in input().split()]
    A.append([x-l+1, x+l-1])
A = sorted(A, key = itemgetter(0))
cur_end = A[0][1]
for i in range(n-1):
    if cur_end >= A[i+1][0]:
        ans -= 1
        cur_end = min(A[i+1][1], cur_end)
    else:
        cur_end = A[i+1][1]
print(ans)
N = int(input())
robot = []
for _ in range(N):
  r = []
  x, l = map(int, input().split())
  a = x + l - 1
  b = x - l + 1
  r += [a, b]
  robot.append(r)
Robot = sorted(robot)
 
robot_count = [Robot[0]]
for i in range(1, N):
  if Robot[i][1] > robot_count[-1][0]:
    robot_count.append(Robot[i])
 
print(len(robot_count))
n = int(input())
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append([a-b,a+b])
L.sort()

cnt = 0
for i in range(n-1):
    if L[i][1] > L[i+1][0]:
        cnt +=1
        L[i+1] = L[i]
        #L.appendleft([-10**10,-10**10])
print(n-cnt)
INF = 2 * (10 ** 9) - 1

n = int(input())
xl = [[0] * 2 for i in range(n)]
for i in range(n) :
    x, l = map(int, input().split())
    xl[i][0] = x-l+1
    xl[i][1] = x+l-1

xl.sort(key=lambda x:x[1])

cnt = 0
#print(xl)
cur = -10 ** 10
ans = 0

for i in range(n) :
    if cur <= xl[i][0] :
        #print(i)
        ans += 1
        cur = xl[i][1]
        #prinst(xl[i])


print(ans)
n = int(input())
r = []
for i in range(n):
    x, l = map(int, input().split())
    r.append((x, l))
r.sort(key=lambda _x: _x[1])
# print(r)
used = set()
cnt = 0
for ri in r:
    arm = set(range(ri[0] - ri[1] + 1, ri[0] + ri[1]))
    # print(ri, used, arm, arm & used)
    if len(arm & used) > 0 and len(used) != 0:
        continue
    used |= arm
    cnt += 1
print(cnt)
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
l=sorted(l)
count=0
for i in range(n-1):
    l_range=l[i][1]+l[i+1][1]
    x_range=l[i+1][0]-l[i][0]
    if i!=n-2:
        if l[i][0]+l[i][1]>l[i+2][0]-l[i+2][1]:
            count+=1
            continue
    if l_range>x_range:
        count+=1
        l[i+1]=l[i]

print(n-count)
n = int(input())
x = sorted([list(map(int, input().split())) for _ in range(n)])

if n == 1:
    print(1)
    exit()

cnt = n
l = 0
r = 1
for i in range(n):
    if x[l][0] + x[l][1] > x[r][0] - x[r][1]:
        cnt -= 1
        r += 1
    else:
        l = r
        r = l + 1
    if r > n - 1:
        break
print(cnt)
#python3
import operator as op
n = int(input())
a = []
for _ in range(n):
    x, l = map(int, input().split())
    a.append((x,l))

a.sort(key=op.itemgetter(0))

MAX = -1001001001
cnt = 0
for i in range(n):
    x, l = a[i]
    MIN = x - l
    if MAX > MIN:
        pass
    else:
        cnt +=1
        MAX = x+l

print(cnt)
N = int(input())
XLlist = [tuple(map(int, input().split())) for _ in range(N)]
XLlist.sort(key=lambda x: x[0])
ans = 1
tikan = -1
x, l = XLlist[0]
rl = x + (l - 1)
for x, l in XLlist:
    ll = x - l
    if ll < rl:
        tikan += 1
        rl = min(rl, x + l - 1)
    else:
        ans += 1
        rl = x + l - 1

print(ans)
n = int(input())
X = [list(map(int,input().split())) for _ in range(n)]
X.sort()
i = 0
ans = 0

while i < n:
    s = X[i][0]
    while i < n and X[i][0] < s + X[i][1]:
        i += 1
    p = X[i-1][0]
    while i < n and X[i][0] < p + X[i][1]:
        i += 1

    ans += 1

print(ans)
n = int(input())
XL = []
for i in range(n):
  XL.append(list(map(int, input().split())))
XL.sort()
r = 0
cnt = 0
for i in range(n):
  xl = XL[i]
  tmp = xl[0]+xl[1]
  if xl[0]> r:
    r = tmp
    cnt += 1
    
print(cnt)
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]
le = [[p[0]-p[1], p[0]+p[1]] for p in xl]
le.sort(key= lambda x: x[1])

ans = 0
right = -1
for i in range(n):
    if right <= le[i][0]:
        ans += 1
        right = le[i][1]

print(ans)
n=int(input())
w=[]
for i in range(n):
    x,l=map(int,input().split())
    w.append([x-l,x+l])
w=sorted(w)
max=w[0][1]
ans=0
for i in range(1,n):
    if w[i][0]<max:
        ans+=1
    else:
        max=w[i][1]
print(n-ans)
n = int(input())
s = [list(map(int, input().split())) for _ in [0] * n]

s = sorted(s, key=lambda x: x[0])

c = 0
i = 0
for i in range(10):
    while (i != len(s)-1 and i < len(s)):
        if s[i][1] >= abs(s[i][0] - s[i+1][0]):
            c += 1
            s.pop(i)
        i += 1


print(n-c)
import sys
input = sys.stdin.readline

n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]
xl2 = sorted([[x - l + 1, x + l - 1] for x, l in xl])

ans = 0
mr = xl2[0][0] - 1
for l, r in xl2:
    if l > mr:
        ans += 1
        mr = r
print(ans)
N = int(input())
XLlist = [tuple(map(int, input().split())) for _ in range(N)]
XLlist.sort()
ans = 1
x, l = XLlist[0]
rl = x + l - 1
for x, l in XLlist[1:]:
    l -= 1
    ll = x - l
    if ll <= rl:
        rl = min(rl, x + l)
    else:
        ans += 1
        rl = x + l
    # print(ll, rl, ans)
print(ans)
n = int(input())
r = []
for i in range(n):
    x, l = map(int, input().split())
    r.append((x - l + 1, x + l - 1))
r.sort()
am = [[] for _ in range(n)]
n = int(input())
d = [[0, 0] for _ in range(n)]
for i in range(n):
    d[i] = list(map(int, input().split()))
d = [[dd[0], dd[1], dd[0]+dd[1]] for dd in d]
d.sort(key=lambda x: x[2])
ans = 0
target = 0
for dd in d:
    if target == 0:
        ans += 1
        target = dd[1]
    else:
        if dd[0] - dd[1] < target < dd[0] + dd[1]:
            ans += 1
        else:
            target = dd[1]
print(n-ans+1)
N = int(input())
robots = [[int(x) for x in input().split()] for _ in range(N)]
robots.sort(key=lambda x: x[0])
cur = float('-inf')
res = 0
for x, l in robots:
    left = x - l
    right = x + l
    if cur <= left:
        cur = right
    else:
        res += 1
print(N - res)
n=int(input())
x=[]
l=[]
for i in range(n):
  x1,l1=map(int,input().split())
  x.append(x1-l1)
  l.append(l1)
x.sort()
s=1
m=x[0]+2*l[0]
for i in range(n):
  if m<=x[i]:
    s+=1
    m=x[i]+2*l[i]
print(s)
n = int(input())
x_l=[]

for i in range(n):
	x, l = map(int, input().split())
	a = x - l
	b = x + l
	is_kaburi=False
	for y in range(int(len(x_l)/2)):
		a_2 = x_l[(y*2)]
		b_2 = x_l[(y*2)+1]
		if a_2 < a and b_2 > a:
			is_kaburi=True
			break
		if a_2 < b and b_2 > b:
			is_kaburi=True
			break
	if is_kaburi == False:
		x_l.append(a)
		x_l.append(b)

if len(x_l)!=0:
	print(int(len(x_l)/2))
else:
	print(0)
from operator import itemgetter

n = int(input())
XL = sorted([list(map(int, input().split())) for _ in range(n)], key=itemgetter(0))
i = 1
while i != len(XL):
    if XL[i][0] - XL[i-1][0] > XL[i][1] + XL[i][1]:
        XL.pop(i)
    else:
        i += 1

print(len(XL))
n=int(input())
ab = []
for _ in range(n):
    a, b = (int(x) for x in input().split())
    ab.append([a, b])
ab = sorted(ab, key=lambda x: x[0])

right_reach = ab[0][0]+ab[0][1]

count = 0

for i in range(1,n):
    if ab[i][0]-ab[i][1] < right_reach:
        count += 1
        right_reach = min(right_reach, ab[i][0]-ab[i][1])
print(n-count)
n = int(input())


l = [list(map(int,input().split())) for i in range(n)]
l.sort()

count = 1
right = l[0][0]+l[0][1]
for i in range(1,n):
    if l[i][0]-l[i][1] >= right:
        count += 1
        right = l[i][0]+l[i][1]
    else:
        continue
print(count)
N = int(input())
xs = []
r = 1
for i in range(N):
    x, l = map(int, input().split())
    a,b = x-l, x+l
    xs.append((a,b))
xs.sort()
for i, (a, b) in enumerate(xs):
    if i == 0:
        ba, bb= a, b
        continue
    if a<bb:
        continue
    else:
         ba, bb = a, b
         r += 1
print(r)
n = int(input())
X = []
for _ in range(n):
    x, l = map(int, input().split())
    X.append((x, x + l))

count = 0
current = -1 * float('inf')
for x in sorted(X, key=lambda x: x[1]):
    if x[0] >= current:
        count += 1
        current = x[1]
print(count)
n = int(input())
a = [[0,0] for _ in range(n)]

for i in range(n):
    a[i][0],a[i][1]=map(int,input().split())
a.sort()
cnt=0
temp=1
for i in range(n-1):
    if a[i+temp-cnt][0]-a[i+temp-cnt][1]<a[i-cnt][0]+a[i-cnt][1]:
        cnt+=1
        temp+=1
    else:
        temp=1
print(n-cnt)
N = int(input())
A = []
for i in range(N):
    x,l = map(int,input().split())
    A.append([x-l+1,x+l-1])
B=sorted(A,key=lambda x: x[1])
s = B[0][1]
n = 1
for i in range(1,N):
    a = B[i][0]
    b = B[i][1]
    if a >= s:
        n += 1
        s = b
print(n)
n = int(input())
xl = [list(map(int, input().split())) for i in range(n)]
xl = sorted([[x-l+1,x+l-1] for x,l in xl], key = lambda x: x[1])
now = - 10 ** 10
ans = 0
for s,e in xl:
  if s > now:
    ans += 1
    now = e
print(ans)
N = input()
X = [0]*N
L = [0]*N
for i in range(N):
  X[i], L[i] = map(int, raw_input().split())

XL = [(X[i], L[i]) for i in range(N)]
XL.sort()
for i in range(N):
  X[i], L[i] = XL[i]

ans = N
m = -10**20
for i in range(N):
  if X[i]-L[i]<m:
    ans -= 1
  else:
    m = max(m, X[i]+L[i])
print ans
N = int(input())
pos_list = []
for _ in range(N):
    X, L = map(int, input().split())
    pos_list.append([X - L, X + L])
sorted_data = sorted(pos_list, key=lambda x: (x[0], -x[1]))
# print(pos_list)
ans = 0
current = -(10 ** 9)
for val in sorted_data:
    if current <= val[0]:
        ans += 1
        current = val[1]
print(ans)
n=int(input())

list=[]
for i in range(n):
 x,l=map(int,input().split())
 list.append([x-l+1,x+l-1])
list=sorted(list,key=lambda x:x[1])

cnt=0
min=-10**18
for r,l in list:
 if min<r:
  cnt+=1
  min=l
print(cnt)
n = int(input())
XL = []
for i in range(n):
  x, l = map(int, input().split())
  XL.append([x, l])
  
XL.sort(key=lambda x: x[0]+x[1])

seen = -10**10
ans = 0
for i in range(n):
  rob = XL[i]
  if seen <= rob[0]+rob[1]:
    seen = rob[0]+rob[1]
    ans += 1

print(ans)
from collections import defaultdict
N = int(input())
d = defaultdict(list)
for i in [0]*N:
    X,L = map(int, input().split(' '))
    d[X-L].append(X+L)
ps = sorted(list(d.items()))
ans = 0
now = -10**10
for p, e in ps:
    if now <= p:
        now = min(e)
        ans += 1
print(ans)
import sys
import math
sys.setrecursionlimit(1000000000)

def solve(robots):
    total = len(robots)
    prev = None
    for current in robots:
        if prev and prev[0] + prev[1] > current[0] - current[1]:
            total -= 1
        else:
            prev = current
            
    return total

N, = map(int, input().split())
ROBOTS = [list(map(int, input().split())) for _ in range(N)]
ROBOTS = sorted(ROBOTS, key=lambda x: x[0])
print(solve(ROBOTS))
N = int(input())
R=[list(map(int,input().split())) for i in range(N)]
bf = 0
ans = N
R = sorted(R)
for i in range(N-1):
  
  if R[bf][0] + R[bf][1] - 1 >= R[i+1][0] - R[i+1][1] + 1:
    bf = i
    ans -= 1
    for j in range(i)[::-1]:
      if R[j][0] + R[j][1] - 1 >= R[i+1][0] - R[i+1][1] + 1:
        ans -= 1
      else:
        break
  else:
    bf = i+1
  if ans == 0:
    break
  
print(ans)
N = int(input())

arm = {}
for i in range(N):
    X, L = map(int, input().split())
    arm[X - L] = X + L

arm = sorted(arm.items(), key=lambda x: x[1])

count = 1
i = arm[0][1]
for item in arm:
    if item[0] < i:
        continue
    else:
        i = item[1]
        count += 1

print(count)
N = int(input())
XL =[list(map(int, input().split())) for _ in range(N)]

XL.sort()

cp = XL[0][0] + XL[0][1]

ans = 1
for i in range(1,N):
	if XL[i][0] - XL[i][1] < cp:
		continue
	else:
		ans += 1
		cp = XL[i][0] +XL[i][1]

print(ans)
n = int(input())
xl = [[int(i) for i in input().split()] for j in range(n)]

#print(xl)
xl.sort()
#print(xl)
#exit()

#kazu = 2*10**9

plus = []
minus = []

for i in range(n):
    plus.append(xl[i][0]-xl[i][1]+1)
    minus.append(xl[i][0]+xl[i][1]-1)

#plus.sort()
#minus.sort()

num = 0
ima = n
mi_num = 0

for i in range(n-1):
    if minus[i+mi_num]  > plus[i+1]:
        ima -= 1
        mi_num -= 1
        
print(ima)
# B - Robot Arms
N = int(input())
a =[list(map(int, input().split())) for i in range(N)]
#print(a)
count  = 0

a.sort()
#print(a)
for i in range(N-1):
    right = a[i][0] + a[i][1]
    left = a[i+1][0] - a[i+1][1]
    if right <= left:
        pass
    else:
        count += 1
        a[i+1][0] = a[i][0]
        a[i+1][1] = a[i][1]
print(N -count)
n = int(input())


effect = 0
count = 0
armsize = 0

d = {}
for i in range(1, n+1):
  x, l = map(int, input().split())
  d[x] = l
  
d = {p[0]:p[1] for p in sorted(d.items())}

for x, l in d.items():

  if x - l < armsize:
    effect += 1
    if effect > 1:
      count += 1
      effect = 0
    else:
      pass
  else:
    effect = 0
    
  armsize = x + l

print(n - count)
n = int(input())
a = []
b = []
for i in range(n):
  x,l = map(int,input().split())
  a.append(x-l)
  b.append(x+l)
  for j in range(len(a)):
    if a[j]<x-l<b[j] or a[j]<x+l<b[j]:
      a.pop()
      b.pop()
      break
print(len(a))
import sys
input = sys.stdin.readline

n = int(input())
list = [list(map(int, input().split())) for i in range(n)]
ans = []
list.sort(key=lambda x: x[0])


for i in range(n-1):
    if list[i][0] + list[i][1] > list[i+1][0] - list[i+1][1]:
        if not(list[i][0] in ans):
            ans.append(list[i+1][0])
        elif list[i-1][0] + list[i-1][1] > list[i+1][0] - list[i+1][1]:
            ans.append(list[i+1][0])
print(n - len(ans))
lis = [list(map(int, input().split())) for _ in range(int(input()))]
lis = sorted(lis)

X = 0
N = 0
co = 0
ans = 0


for i in range(len(lis)):
    h = []
    h = lis[i]
    X = h[0]
    N = h[1]
    if i == 0:
        co = X+N
        ans += 1
    else:
        if co - X <= 0:
            co = X+N
            ans += 1
        else:
            co = X+N

print(ans)
N = int(input())
XL = []
for i in range(N):
    x,l = map(int,input().split())
    XL.append((x-l+1,x+l-1))

XL.sort(key=lambda x:x[1])

ans = 0
t = -10**9
for i in range(N):
    if t < XL[i][0]:
        ans += 1
        t = XL[i][1]
print(ans)
N = int(input())
XL = [list(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x: x[0]+x[1])
M = XL[0][0]+XL[0][1]-1
ans = N
for i in range(1,N):
    if M >= XL[i][0]-XL[i][1]+1:
        ans -= 1
    else:
        M = XL[i][0]+XL[i][1]-1
print(ans)
n=int(input())
A=[list(map(int,input().split())) for i in range(n)]
B=[]
for i in range(n):
    B.append([A[i][0]-A[i][1],A[i][0]+A[i][1]])
B.sort()
point=B[0][1]
ans=1
for i in range(1,n):
    if B[i][0]>=point:
        point=B[i][1]
        ans +=1

print(ans)
N = int(input())
XLlist = [tuple(map(int, input().split())) for _ in range(N)]
XLlist.sort(key=lambda x: x[0])
ans = 1
tikan = -1
x, l = XLlist[0]
rl = x + (l - 1)
for x, l in XLlist:
    l -= 1
    ll = x - l
    if ll <= rl:
        tikan += 1
        rl = min(rl, x + l)
    else:
        ans += 1
        rl = x + l
if ans != N - tikan:
    raise ValueError
print(N - tikan)
from operator import itemgetter
N=int(input())
xl=[list(map(int, input().split())) for i in range(N)]
xl=sorted(xl, key=itemgetter(0))
a=[xl[i][0]+xl[i][1] for i in range(N)]
b=[xl[i][0]-xl[i][1] for i in range(N)]
hiku=0
tmp=a[0]
for i in range(1, N):
  if b[i]<tmp:
    hiku+=1
  else:
    if a[i]>tmp:
      tmp=a[i]
      
print(N-hiku)