peterverebics/CodeNet_Python_118 huggingface dataset:
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):
  if d<t[i][0]:
    ans+=1
    d=t[i][1]
print(ans)
import numpy as np
n = int(input())
X = []
L = []
for _ in range(n):
    x,l = map(int,input().split())
    X.append(x)
    L.append(l)
add = np.array(X)+np.array(L)
sub = np.array(X)-np.array(L)

cnt = 0
for i in range(n-1):
    if add[i]>sub[i+1]:
        cnt+=1
        add[i+1]=add[i]
        sub[i+1]=sub[i]
print(n-cnt)
n = int(input())
right = []
scope = {}
for _ in range(n):
    x, l = map(int, input().split())
    right.append(x+l)
    scope[x+l] = [x-l, x+l]
    
right.sort()
ans = 0
border = 10**9 * (-1)
for i, r in enumerate(right):
    if border <= scope[r][0]:
        ans += 1
        border = scope[r][1]
print(ans)
N = int(input())
point = []
arm = {}
for n in range(N):
    i, L = map(int, input().split())
    point.append(i)
    arm[i] = L
sorted_point = sorted(point)
count = 1
pre_point = sorted_point[0]
for n in range(1, len(sorted_point), 1):
    if arm[sorted_point[n]] + arm[pre_point] <= sorted_point[n]-pre_point :
        count += 1
        pre_point = sorted_point[n]
print(count)
n = int(input())
lis = []
for _ in range(n):
  x, l= list(input().split(" "))
  p_d = int(x) + int(l)
  m_d = int(x) - int(l)
  lis.append([m_d, p_d])

lis.sort()
a = -10 ** 10
x = 0

for b in range(n):
  if lis[b][0] >= a:
    x += 1
    a = lis[b][1]

print(x)
import sys
input = sys.stdin.readline


N = int(input())
start = []
end = []
itv = []
for i in range(N):
    X, L = (int(i) for i in input().split())
    itv.append([X+L-1, X-L+1])
    #start.append(X-L)
    #end.append(X+L)

#XL = [[int(i) for i in input().split()] for i in range(N)] 

#line = [0] * (2*(10**9) +1)

itv.sort()

#print(itv)

ass = 0
tt = 0-10**9
for i in range(N):
    if tt < itv[i][1]:
        ass += 1
        tt = itv[i][0]
print(ass)
num = int(input())
lista=[]
ans = 0
for i in range(num):
  j= list(map(int, input().split()))
  a=j[0]-j[1]
  b=j[0]+j[1]
  lista.append([a,b])
lista.sort(key=lambda x: x[1])
print(lista)

def list_func(x):
  global ans
  xa=[i for i in x if i[0]>=x[0][1]]
  ans+=1
  return xa
while(len(lista)):
  lista=list_func(lista)
print(ans)
n = int(input())
dic = {}
lim = -10*9
for _ in range(n):
  x,l = map(int,input().split())
  dic[l+x] = x
dic = sorted(dic.items())
a = 0
lim = -10*9
for i in dic:
  if lim>i[1]:
    continue
  else:
    a += 1
    lim = i[0]
print(a)
N = int(input())
x_l = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    x_l.append(array)

x_l.sort()
if N<3:
  for i in range(1,N):
    if (x_l[i-1][0] + x_l[i-1][1]) > (x_l[i][0] - x_l[i][1]):
      del x_l[i]
    print(len(x_l))
#else:
#  for i in range(1,N-1):
#    if (x_l[i-1][0] + x_l[i-1][1]) > (x_l[i][0] - x_l[i][1]):
#      del x_l[i]

#  print(len(x_l))
n = int(input())
l = []
for _ in range(n):
  A = list(map(int, input().split()))
  l.append(A)
  
l = sorted(l)

x0,l0 = l[0][0],l[0][1]
y = x0 + l0
count = 1
for i in range(n-1):
  x,d = l[i+1][0],l[i+1][1]
  z = x - d
  
  if z >= y:
    y = x + d
    count = count + 1
  else:
    continue
print(count)
n = int(input())
d = []
left = []
right = []
for i in range(n):
    x,l = map(int, input().split())
    # num , left , right
    d.append([x-l+1,x+l-1])

d.sort(key=lambda x:x[0],reverse=False)
p = d[0][1]
ans = n
for i in range(1,n):
    if d[i][0] <= p:
        ans -= 1
        p = d[i][1]
    else:
        p = min(p,d[i][1])
print(ans)
from operator import itemgetter

n = int(input())
xl = []

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

xl = sorted(xl, key=itemgetter(0))

ans = 0
m = -float("inf")
for left, x, right in xl:
    if left < m:
        ans += 1
    else:
        m = max(m, right)

print(n - ans)
n = int(input())
LR = [None] * n
for i in range(n):
    x, l = map(int, input().split())
    LR[i] = (x - l, x + l)
LR.sort(key=lambda lr: -lr[1])
count = 0
cur = LR[0][0]
for l, r in LR[1:]:
    if cur < r:
        count += 1
    else:
        cur = l
print(n - count)
def solve():
    N = int(input())
    C = []
    for _ in range(N):
        a, b = list(map(int, input().split()))
        C.append((a-b+1, a+b-1))

    C.sort()

    for i in range(N-1):
        for j in range(len(C)-1):
            if C[j][1] >= C[j+1][0]: 
                C.pop(j+1)
                break

    return len(C)

print(solve())
def solve(XL, N):
    XL.sort(key=lambda x:x[0])
    count = N
    for i in range(1, N):
        if XL[i][0] < XL[i-1][1]:
            XL[i][1] = XL[i-1][1]
            count -= 1
    return count
N = int(input())
XL = []
for i in range(N):
    x, l = map(int, input().split(' '))
    XL.append([x-l, x+l])
print(solve(XL, N))
import numpy as np
n = int(input())

sg = []

for i in range(n):
    x, l = map(int, input().split())
    sg.append([max(x - l + 1, 0), x + l - 1])

sg.sort()

prev = sg[0]

ans = 0
for i in range(1, n):
    if prev[1] >= sg[i][0]:
        ans += 1
    if prev[1] < sg[i][1]:
        prev = sg[i]

print(n - ans)
length = int(input())
target = []
for i in range(length):
    s, e = map(int, input().split(" "))
    target.append([s, s + e])
target.sort(key = lambda x: x[0], reverse =  True)
target.sort(key = lambda x: x[1])
answer = 0
before_s, before_e = -1, -1
# print(target)
for s, e in target:
    if before_s <= s <= before_e or before_s <= e <= before_e:
        answer += 1
    else:
        before_s = s
        before_e = e
print(length - answer)
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
A.sort(key=lambda x:x[0])
X = []
L = []
for l in A:
    X.append(l[0])
    L.append(l[1])

pl = X[0] + L[0]
k = 0
for i in range(1, N):
    pr = X[i] - L[i]
    if pl > pr:
        k += 1
    else:
        pl = min(pl, X[i] + L[i])


print(N - k)
N = int(input())
XL = [list(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x: (x[0]-x[1],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())
l = []
for _ in range(n):
  x,y = map(int, input().split())
  l.append([x+y,x-y])
l.sort()

temp = l[0][1]
count = n
i = 1
for i in range(1,n):
  if temp <= l[i][1]:
    pass
  else:
    temp = min(temp,l[i][1])
    count -= 1
print(count)
n = int(input())
x = []
for i in range(n):
    tmpx, tmpl = map(int,input().split())
    x.append((tmpx,tmpl))
x = sorted(x)
#print(x)
ans = n

flag = 1
for i in range(n-1):
    if x[i][0]+x[i][1]>x[i+1][0] and flag == 1:
        ans -= 1
        flag = 0
    elif x[i][0]+x[i][1]<=x[i+1][0] and flag == 0:
        flag = 1
print(ans)
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
  else:
    bf = i+1
  if ans == 0:
    break
  
print(ans)
if __name__ == '__main__':
    n = int(input())
    robots = []
    for i in range(n):
        x, l = map(int, input().split())
        robots.append((x, l, x - l, x + l))
    robots = sorted(robots, key=lambda x: x[2])
    ans = []
    for i in range(n):
        if i == 0:
            ans.append(robots[i][3])
        else:
            if robots[i][2] >= ans[-1]:
                ans.append(robots[i][3])
    print(len(ans))
N = int(input())
r = [list(map(int, input().split())) for _ in range(N)]
a = []
for i in r:
    a.append((i[0]-i[1],i[0]+i[1]))
a.sort(key=lambda x:x[1])
ans = 0
cur = -float('inf')
for i in a:
    if i[0] < cur:
        continue
    ans += 1
    cur = i[1]
print(a)
print(ans)
N=int(input())
XL=sorted(tuple(map(int,input().split())) for i in range(N))
count=0
left=-10**9
for x,l in XL:
    if left<=x-l:
        count+=1
        left=x+l
print(count)
N = int(input())

list_ = list()

for i in range(N):
  X,L = map(int,input().split())
  max_ = min(10**9,X+L)
  min_ = max(0,X-L+1)
  list_.append((X,min_,max_))
list_.sort()

d = 0
nowmax = -1
nowmin = -1

for x, min_, max_ in list_:
  if nowmax >= min_:
    d += 1
    if nowmin >= min_:
      pass
    elif nowmax <= max_:
      pass
    else:
      nowmin = min_
      nowmax = max_
  else:
    nowmin = min_
    nowmax = max_
  
print(N-d)
n = int(input())

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

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

now = xl[0][0] + xl[0][1]
count = 1

if(n == 1):
    print(1)
else:
    for i in range(1, n):
        if(now <= xl[i][0] - xl[i][1]):
            count += 1
            now = xl[i][0] + xl[i][1]

    print(count)
n = int(input())

x = []
for i in range(n):
    x1,y1=[int(i) for i in input().split()]
    x.append([x1,y1])

x.sort()

remove = 0
flag = True

while(1):
    flag = True
    
    for k in range(n-1):
      if (x[k+1][0] - x[k][0]) < x[k][1] + x[k+1][1] and x[k+1][0]>0 and x[k][0]>0:
        remove +=1
        x[k+1][0] = -1
       	flag =False
        k -=1

    if flag == True:
        break
    
print (n -remove)
N = int(input())
XL = [tuple(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x: x[0])
right = -float('inf')
ans = 0
for x,l in XL:
    s,t = x-l+1, x+l-1
    if s > right:
        right = t
        ans += 1
print(ans)
n = int(input())

xl = [tuple(map(int, input().split())) for _ in range(n)]
xl = sorted(xl)


def run(xl):
    res = 1
    x, l = xl[0]
    cur = x + l
    for (x, l) in xl:
        if x - l >= cur:
            cur = x + l
            res += 1
    return res


res = max(run(xl), run(list(reversed([(-x, l) for x, l in xl]))))

print(res)
from operator import itemgetter
N = int(input())
robot_list = []

for i in range(N):
    robot_list.append(list(map(int, input().split())))
    robot_list[i] = (robot_list[i][0] - robot_list[i][1] + 1, robot_list[i][0] + robot_list[i][1] - 1, robot_list[i][0], robot_list[i][1])

sort_robot_list = sorted(robot_list, key=itemgetter(2))

minus_count = 0
for before_value, after_value in zip(sort_robot_list, sort_robot_list[1:]):
    if before_value[1] > after_value[0]:
        minus_count += 1

print(len(sort_robot_list) - minus_count)
n = int(input())
robos = []
for i in range(n):
    x,l = map(int,input().split())
    robos.append([x-l+1,x+l-1])

robos.sort(key= lambda x:x[1])
# print(robos)
edge = -10000000000
out = 0
for i in range(n):
    if robos[i][0] > edge:
        out += 1
        edge = robos[i][1]
    else:
        continue

print(out)
N = int(input())
row = []
for n in range(N):
  x, l = [int(i) for i in input().split()]
  row.append((x,l))
orders = sorted(row, key=lambda x:x[0]) 

remain = N 
edge = -1000000000000000
Redge = 1000000000000000
for n in range(N):
  x0 = orders[n][0]
  l0 = orders[n][1]
  if n == N -1:
    re = Redge
  else:
    re = orders[n+1][0] + orders[n+1][1]
  if x0 - l0 < edge:
    remain -= 1
  elif x0 + l0 > re:
  	remain -= 1
  else:
    edge = x0 + l0

print(remain)
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, x+l])
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)
print(ans)
N = int(input())
A = [list(map(int,input().split())) for i in list(range(N))]
B = [[i[0]-i[1], i[0]+i[1]] for i in A]
B.sort()
prev=B[0]
cnt=N
for i in range(1,N):
  if prev[1]>B[i][0]:
    cnt-=1
  else:
    prev=B[i]
print(cnt)
n = int(input())
data = []
for i in range(n):
    x, l = map(int, input().split())
    data.append([x, l])
data = sorted(data, key = lambda x: x[0])
ans = 1
pre = data[0][0] + data[0][1]
for i in range(1, n):
    if data[i][0] - data[i][1] >= pre:
        ans += 1
        pre = data[i][0] + data[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, x+l))
    robo.sort()
    robo.sort(key=lambda x: x[1])

    ans = N
    l, r = robo[0]
    for i in range(1, N):
        if robo[i][0] < r:
            ans -= 1
        else:
            l, r = robo[1]
    print(ans)


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

wk =[]
for i in range(n):
    wk.append(list(map(int,input().split())))
xl = sorted(wk, key=lambda x:x[0])

xx = []
ll = []
cnt = 0

for i in range(n):
    x,l = xl[i][0],xl[i][1]

    if i == 0 or xx[cnt-1] + ll[cnt-1] -1 <  x - l +1:
        xx.append(x)
        ll.append(l)
        cnt +=1

print(len(xx))
N = int(input())
List = dict()
for i in range(N):
    X,L = map(int,input().split())
    List.update({X:L})
keys= sorted(List,reverse=True)
if len(List)<=1:
    print(len(List))
elif len(List)<3:
    if keys[0]-List[keys[0]]<=keys[1] or keys[1]+List[keys[1]]<=keys[0]:
        del List[keys[i]]
    print(len(List))
else:
    for i in range(1, len(keys)-1):
        if keys[i]-List[keys[i]]<=keys[i+1] or keys[i]+List[keys[i]]>=keys[i-1]:
            del List[keys[i]]
    print(len(List))
import numpy as np
import sys
input = sys.stdin.readline
n = int(input().rstrip())
s = 0
d = 0
e = min(n-2,3)
hanni = sorted([[int(x) for x in input().rstrip().split()] for _ in range(n)], key=lambda x: (x[1], x[0]))
for _ in range(n):
  if s != len(hanni)-1 and hanni[s][1] > hanni[s+1][0]:
    d += 1
    if d>=e:
      del hanni[s]
      d = 0
    else:
      s+=1
  else:
    s+=1
    d = 0
    
print(len(hanni))
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)
N = int(input())
robo = []
for _ in range(N):
    robo.append(list(map(int, input().split())))
robo.sort()
ans = 0
flg = False
for i in range(N-1):
    if flg:
        flg = False
        continue
    if robo[i][0] + robo[i][1] <= robo[i+1][0] - robo[i+1][1]:
        continue
    else:
        ans += 1
        flg = True
print(N-ans)
N = int(input())
XL = [tuple(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x: x[0]+x[1])
right = -float('inf')
ans = 0
s = -1e9
for x,l in XL:
    t = x+l-1
    if s <= right:
        right = t
        ans += 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, x+l))
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)
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 = 0
_, 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())
list = []
for i in range(n):
  x, l = input().split()
  list.append((int(x), int(l)))

new = sorted(list)
i = 0
d = 0
while i < n-1:
  if new[i][0] + new[i][1] > new[i+1][0] - new[i+1][1]:
    if i + 2 > n-1:
      d = d + 1
    else:
      if new[i][0] + new[i][1] > new[i+2][0] - new[i+2][1]:
        d = d +1
      else:
        new[i+1] = new[i]
        d = d + 1
    i = i + 1
  else:
    i = i + 1  

print(n - d)
n = int(input())
x = [list(map(int, list(input().split()))) for i in range(n)]

x.sort()

ans = n
cp = ans
maxs = 0
for i in range(n - 1):
    if cp == ans:
        maxs = max(maxs, x[i][0] + x[i][1])
    ming = x[i + 1][0] - x[i + 1][1]
    if ming < maxs:
        ans -= 1
    else:
        cp = ans

print(ans)
n = int(input())
r = [list(map(int,input().split())) for _ in range(n)]
for i in range(n):
  r[i] = [r[i][0] - r[i][1], r[i][0] + r[i][1]]
r.sort(key = lambda x:x[1])
print(r)
cur = -1001001001
ans = 0
for i in range(n):
  if cur <= r[i][0]:
    ans += 1
    cur = r[i][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**10
for r,l in list:
 if min<r:
  cnt+=1
  min=l
print(cnt)
N = int(input())
robot = [input().split() for i in range(N)]

le = [[int(i[0])-int(i[1]), int(i[0])+int(i[1])] for i in robot]
le.sort(key = lambda x:x[1])

ans = 0
floor = -10**5
for i in range(N):
    if floor <= le[i][0]:
        ans += 1
        floor = le[i][1]

print(ans)
N = int(input())

arms_range_list =[]
for _ in range(N):
    X, L = map(int, input().split())
    arms_range_list.append((X-L, X+L))

arms_range_list = sorted(arms_range_list)


count = 0
max_arm_position_now = -float('inf')
for i in range(N):
    min_arm_position_next = arms_range_list[i][0]
    if min_arm_position_next >= max_arm_position_now:
        max_arm_position_now = arms_range_list[i][1]
        count += 1


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

grid = [list([0,0]) for i in range(n)]

for i in range(n):
    grid[i][0] = x[i][0] - x[i][1]
    grid[i][1] = x[i][0] + x[i][1]

new_grid = sorted(grid)
cnt = 0
for i in range(n-1):
    if i + 1 >= len(new_grid):
        break;
    if new_grid[i][1] > new_grid[i+1][0]:
        cnt += 1
        del new_grid[i]

ans = n - cnt

print(ans)
n = int(input())
A = [list(map(int,input().split())) for _ in range(n)]
#print(A)
A = sorted(A, key = lambda x:x[0])
#print(A)
now = 0
cnt = 0
for i in range(n):
    if now < A[i][0]:
        now = A[i][0] + A[i][1]
        cnt += 1
print(cnt)
import numpy as np

N=int(input())
#A=[int(x) for x in input().split()]
XL=[]
for i in range(N):
    XL.append(list(map(int,list(input().split()))))
XL=np.asarray(XL)
XLs=XL[np.argsort(XL[:,0])]
right=XLs[0][0]+XLs[0][1]
ans=1
for i in range(N-1):
    if XLs[i+1][0]-XLs[i+1][1]-right>=0:
        ans+=1
        right=XLs[i+1][0]-XLs[i+1][1]
        
#ans=XLs
print(ans)
n = int(input())
x = [list(map(int, list(input().split()))) for i in range(n)]

x.sort()

ans = n
i = 0
while i != len(x) - 1:
    maxs = x[i][0] + x[i][1]
    ming = x[i + 1][0] - x[i + 1][1]
    if maxs > ming:
        del x[i + 1]
        ans -= 1
        i -= 1
    i += 1

print(ans)
n = int(input())

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

xl.sort()

now = xl[0][0] + xl[0][1]
count = 1

if(n == 1):
    print(1)
else:
    for i in range(1, n):
        if(now <= xl[i][0] - xl[i][1]):
            count += 1
            now <= xl[i][0] - xl[i][1]

    print(count)
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 = 0
l0, r0 = Y[0]
for i in range(1, n):
    l, r = Y[i]
    if r0 >= l:
        cnt += 1
        if r0 > r:
            l0, r0 = l, r
print(n-cnt)
N = int(input())
MAX_list = []
ans = 0
A = -10**9-2

for _ in range(N):
    X, L = map(int, input().split())
    MAX_list.append(((X + L - 1), (X - L + 1)))
MAX_list = sorted(MAX_list)

for m, l in MAX_list:
    if l > A:
        ans += 1
        A = m

print(ans)
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]
xl.sort(key=lambda x: x[0])
prev = 0
cnt = 0
for i in range(1, n):
    if xl[prev][0]+xl[prev][1] > xl[i][0] - xl[i][1]:
        cnt += 1
    else:
        prev = 1
print(n-cnt)
n = int(input())
robots = []
for i in range(n):
    l = input().split()
    x = int(l[0])
    length = int(l[1])
    robots.append((x - length + 1, x + length - 1))

    
robots = sorted(robots, key=lambda x:x[1])
covered_x = robots.pop(0)[1]
robots_num = 1
try:
    while True:
        robots = filter(lambda r: r[0] > covered_x, robots)
        covered_x = next(robots)[1]
        robots_num += 1
except StopIteration:
    pass
print(robots_num)
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    y = list()

    for i in range(n):
        xi, li = map(int, input().split())
        y.append((xi - li + 1, xi + li - 1))

    count = 1
    sorted_y = sorted(y, key=lambda x: x[1])
    end_point = sorted_y[0][1]

    for left, right in sorted_y[1:]:
        if left > end_point:
            end_point = right
            count += 1

    print(count)


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

robots = []

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

robots.sort()
new = []
for robot in robots:

    if len(new) == 0:
        new.append(robot)
    
    if (new[-1][0] + new[-1][1]) <= (robot[0] - robot[1]):
        new.append(robot)
        continue

print(len(new))
N = int(input())
l = list()
for i in range(N):
  X, L = map(int, input().split())
  left = X - L
  right = X + L
  l.append([left, right])
l.sort()
cnt = 0
n = 0
t = 1
while t < N:
  if l[n][1] > l[t][0]:
    cnt += 1
  else:
    n = t
  t += 1
print(N - cnt)
N = int(input())

X = []
d = {}

for _ in range(N):
    x,l = map(int, input().split())
    X.append(x)
    d[x] = l
X.sort()
count = 0
for i in range(len(X)-1):

    I = (X[i]+d[X[i]]-1)
    J = (X[i+1]-d[X[i+1]]+1)
    if I>=J:
        count = count + 1
        i = i + 1
        if i>=N:
            break
        continue
print(N-count)
n = int(input())
robots = []
for _ in range(n):
  x,l = map(int,input().split())
  a,b = x-l,x+l
  robots.append((a,b))
robots.sort(key = lambda x:x[1])

ex_a = ex_b = -1
count = 0

for a,b in robots:
  if a >= ex_b:
    ex_b = b
    count += 1
  else:
    continue
print(count)
# お尻から見ていってはやく始まる方を数え上げれば良い
N = int(input())
data = []
for _ in range(N):
    X, L = map(int, input().split())
    data.append((X-L+1, X+L-1))
data.sort()

count = 1
j = N-1
for i in range(N-2, -1, -1):
    if data[i][1] <= data[j][0]:
        j = i
        count += 1
print(count)
def main():
    N, *XL = map(int, open(0).read().split())
    # print(N, XL)
    robots = [0]*N
    for i in range(N):
        X, L = XL[2 * i + 0], XL[2 * i + 1]
        robots[i] = (X - L, X + L)
    robots.sort(key=lambda x: x[1])
    # print(robots)
    ans = 0
    last = robots[0][0] - 1
    for robot in robots:
        if last <= robot[1]:
            last = robot[1]
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()
N = int(input())
R = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x:x[0])

remain = list(range(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:
    remain.pop(remain.index(i))
  else:
    left = i
  i += 1
print(len(remain))
def main():
    N = int(input())
    L = [list(map(int, input().split())) for _ in range(N)]
    tmp = []
    for a, b in L:
        tmp.append([a-b, a+b])
    tmp.sort()
    t = tmp[0][0]- 1
    c = 0

    for i in range(N):

        if t > tmp[i][0]:
            c += 1
        else:
            t = tmp[i][1]
    print(N-c)

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

_list = []

for i in range(H):
  set = input().split(" ")
  _list.append([int(set[0]), int(set[1])])

new_list = sorted(_list)

ans_list = [new_list[0]]
for i in new_list:
  arm_long = ans_list[-1][0] + ans_list[-1][1] -1
  arm_short = i[0] - i[1] +1
  if arm_long < arm_short:    
    ans_list.append(i)
  else:
    arm_long_new = i[0] + i[1] - 1
    if arm_long >= arm_long_new:
      ans_list[-1] = i
print(ans_list)

print(len(ans_list))
N = int(input())
S = []
for i in range(N):
    xi, li = map(int, input().split())
    S.append([xi - li, xi + li])

S.sort()

ans = 0
last = -1*float('Inf')
for si in S:
    if si[0] >= last:
        ans += 1
        last = si[1]

print(ans)
#!/usr/bin/env python3

n = int(input())
X = []
L = []
T = []
for i in range(n):
    a, b = map(int, input().split())
    T.append( (a-b, a+b) )
    X.append(a)
    L.append(b)

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

ans = 1
cur = T[0][0]
for k, v in enumerate(T):
    if k == 0: continue
    if v[1] <= cur:
        ans += 1
        cur = T[k][0]

print(ans)
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 l_range>x_range:
        count+=1
        l[i+1]=l[i]

print(n-count)