peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
input = sys.stdin.readline
from operator import itemgetter

N = int(input())
LR = []
for _ in range(N):
    a, b = map(int, input().split())
    LR.append((a-b, a+b))

LR.sort(key=itemgetter(1))
now_max = -10**15
ans = N
for l,r in LR:
    if l < now_max:
        ans -= 1
    else:
        now_max = r

print(ans)
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
    xl[i].append(xl[i][0]+xl[i][1])
    if xl[i][0]-xl[i][1]>0: xl[i].append(xl[i][0]-xl[i][1])
    else: xl[i].append(0)
xl = sorted(xl, key=lambda x:x[2])
res = xl[0][2]
count = 1
for i in range(1, n):
    if res <= xl[i][3]:
        count += 1
        res = xl[i][2]
print(count)
n=int(input())
rng = [[] for _ in range(n)]
for i in range(n):
  x,l=map(int,input().split())
  rng[i] = [x-l,x+l]
rng.sort(key=lambda y:y[1])
cnt=0
t_mx=-(10**10)
for i in range(n):
  if t_mx > rng[i][0]:
    cnt += 1
  else:
    t_mx = rng[i][1]
print(n-cnt)
N=int(input())
numbers=[]
for _ in range(N):
    X,L=map(int,input().split())
    left=X-L
    right=X+L
    numbers.append([right,left])
numbers=sorted(numbers)
answer=1
large=numbers[0][0]
for  _ in range(len(numbers)-1):
    if numbers[answer][0]>large and numbers[answer][1]>=large:
        large=numbers[answer][0]
        answer+=1
    else:
        del numbers[answer]
print(answer)
##貪欲法(greedy)
#区間スケジューリング
#B - Robot Arms

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

lst.sort(key=lambda x: x[3])
ans = []
ans.append(lst[0])

for i in range(1,n):
    if ans[-1][3] <= lst[i][2]:
        ans.append(lst[i])

print(len(ans))
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial

sys.setrecursionlimit(10**7)
N = int(input())
XL = [list(map(int, input().split())) for _ in range(N)]

itv = []
for xl in XL:
    itv.append([xl[0]-xl[1], xl[0]+xl[1]])
itv.sort(key=lambda x: x[1])

ans = 0
tt = -1 * (10**9 + 10)
for itvi in itv:
    if tt <= itvi[0]:
        ans += 1
        tt = itvi[1] 

print(ans)
N=int(input()) 
XL = [[int(i) for i in input().split()] for i in range(N)] 
rl = [[x[0]+x[1],x[0]-x[1]] for x in XL]
rl = sorted(rl)

p = rl[0][0]
cnt = 1
for x in rl:
  if x[1] >=p:
    cnt += 1
    p = x[0]
    
print(cnt)
N = int(input())
xl = [list(map(int,input().split())) for x in range(N)]
r_list = []

for i in range(N):
    a = max(0, xl[i][0] - xl[i][1])
    b = xl[i][0] + xl[i][1]
    r_list.append([b, a])
r_list.sort()

count = 0
tail = 0

for j in range(N):
    if r_list[j][1] >= tail:
        count += 1
        tail = r_list[j][0]
print(count)
import heapq
N = int(input())

hq = []
heapq.heapify(hq)  # リストhqのheap化
for i in range(N):
    X, L = map(int, input().split())
    heapq.heappush(hq, (X+L, X-L))  # heap化されたリストhqに要素xを追加

T = -10**10
ans = 0
for i in range(N):
    t, s = heapq.heappop(hq)  # heap化されたリストhqから最小値を削除＆その最小値を出力
    # print(t, s, T)
    if s >= T:
        ans += 1
        T = t
print(ans)
N = int(input())
Lpos = []
INF = 10 ** 9 + 7
for i in range(N):
    Lpos.append(list(map(int, input().split())))
Lpos.sort(key=lambda x: x[0])
Lpos.sort(key=lambda x: x[1] + x[0])

endpos = -INF
cnt = 0
for i in range(N):
    if Lpos[i][0] - Lpos[i][1] >= endpos:
        cnt += 1
        endpos = Lpos[i][0] + Lpos[i][1]
print(cnt)
n = int(input())
robotList=[]
for i in range(n):
  x,l = map(int,input().split())
  s = max(x-l,0)
  t = min(10**9,x+l)  
  robotList.append([t,s])
  
robotList.sort()

count = 0
tmp = 0
for robot in robotList:
  if robot[1] >= tmp:
    count += 1
    tmp = robot[0]

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

m_list = sorted(m_list,key= lambda x:x[1])

result = 0
cur_pos = -1000000000

for min,max in m_list:
    if cur_pos <= min:
        result += 1
        cur_pos = max
print(result)
import math
N = int(input())
arms = [list(map(int,input().split(" "))) for _ in range(N)]
robots = [((x-l),(x + l)) for x,l in arms]
robots = sorted(robots,key=lambda x:(x[0],x[1]))
ans = N
l,r = robots[0] # r→ limit 現状のlimit
for robot in robots[1:]:
    newl,newr = robot
    if r > newl: # 被っていたら除去
        if  r > newr: #前にあったやつを除去する場合
            r = newr

        ans -= 1
    else:
        l = newl
        r = newr

print(ans)
n=int(input())
R=[]
for _ in range(n):
  x,l=map(int,input().split())
  R.append([x-l,x+l])

R=sorted(R,key=lambda x:x[1])
ans=n
for i in range(1,n):
  if R[i][0]<R[i-1][1]:
    ans-=1
    R[i][1]=R[i-1][1]
  
print(ans)
import sys
input = sys.stdin.readline
n = int(input())
X = []
for i in range(n):
  x, l = map(int, input().split())
  X.append([x-l, x+l])
X.sort()
temp = X[0][1]
count = n
for i in range(1,n):
  if temp>X[i][0]:
    count -= 1
    temp = min(temp, X[i][1])
  else:
    temp = X[i][1]
print(count)
n = int(input())

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

cur = -1000000000
ans = 0
for i in range(n):
   if (cur <= r[i][1]):
      ans += 1
      cur = r[i][0]

print(ans)
N = int(input())
A = []
for i in range(N):
    x,l = map(int,input().split())
    A.append([x,l])
A.sort()

t = -10**10
p = 0
for i,a in enumerate(A):
    if a[0]-a[1]>=t:
        t = a[0]+a[1]
        p += 1
    elif a[0]+a[1]<t:
        t = a[0]+a[1]

print(p)
N = int(input())

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

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

count = 0
i = arm[0][0]
for start, end in arm:
    if start < i:
        continue
    i = end
    count += 1

print(count)
# お尻から見ていってはやく終わるを数え上げれば良い
N = int(input())
data = []
for _ in range(N):
    X, L = map(int, input().split())
    data.append((X-L, X+L))
data = sorted(data, key=lambda x: x[1])
count = 1
j = 0
for i in range(1, N):
    if data[i][0] >= data[j][1]:
        j = i
        count += 1
print(count)
n = int(input())
x = [[0,0] for i in range(n)]
for i in range(n):
    x[i][0] , x[i][1] = map(int,input().split())

x.sort()
cnt = 0
i = 0
while i < len(x)-1:
    if x[i][0] + x[i][1] > x[i+1][0] - x[i+1][1]:
        if x[i][0] + x[i][1] > x[i+1][0] + x[i+1][1]:
            del x[i]
        else:
            del x[i+1]
    else:
        i += 1

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

#print(A)
#now = A[0][0] + A[0][1]
cnt = 0
now = -(1<<60)
for i in range(n):
    f,s = A[i]
    if now > f:
        continue
    cnt += 1
    now = s
print(cnt)
n=int(input())
xl_=[list(map(int,input().split())) for _ in range(n)]
xl=[[x[0]-x[1],x[0]+x[1]] for x in xl_]
xl.sort(key=lambda x:x[0])
r=xl[0][1]
ans=1
for i in range(1,n):#i-1番目のロボットまでは腕が重ならないことが保証されている。
    if r<=xl[i][0]:
        ans+=1
        r=xl[i][1]
    else:
        r=min(r,xl[i][1])
print(ans)
N=int(input())
xl=[]
for i in range(N):
  x,l=map(int,input().split())
  xl.append([x-l,x+l])

XL=sorted(xl,key=lambda x:x[1])

w=1
robot=XL[0]
for i in XL:
  if robot[1] <= i[0]:
    w+=1
    robot=i
print(w)
N = int(input())
ts = []
for _ in range(N):
    x, l = map(int,input().split())
    t = min(x+l,10**9)
    s = max(x-l,0)
    ts.append([t,s])

ts.sort()

tmp = 0
count = 0
for n in ts:
    if tmp<=n[1]:
        count += 1
        tmp = n[0]

print(count)
n = int(input())
robot = []
for _ in range(n):
    x, l = map(int, input().split())
    robot.append([x - l, x + l])

# startが被らないendが小さいもの

ans = 0
robot.sort(key=lambda x: x[1])
last = - float('inf')
for start, end in robot:
    if start >= last:
        ans += 1
        last = end

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

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

last = -10**10
count = 0
for e, s in t:
    if s >= last:
        last = e
        count += 1

print(count)
n = int(input())
dat = []
for _ in range(n):
    x, l =map(int, input().split())
    dat.append([x-l, x+l])
dat.sort(key=lambda x: x[1])
#print(dat)
prevr = -99999999999999999
res = 0
for i in range(n):
    if dat[i][0] >= prevr:
        prevr = dat[i][1]
        res += 1
print(res)
N = int(input())
A = [list(map(int,  input().split())) for i in range(N)]
A.sort(key=lambda x: x[0]+x[1])
now = -1e10
ans = 0
for i in range(N):
    [X, L] = A[i]
    if X-L >= now:
        now = X+L
        ans += 1
print(ans)
N, *XL = map(int, open(0).read().split())

A = sorted((x + l, x - l) for x, l in zip(*[iter(XL)] * 2))

ans = 0
cur = -10 ** 9
for t, s in A:
    if cur <= s:
        cur = t
        ans += 1

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

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

ans = 0
tmp = -10**9

for l in ll:
  if l[0] >= tmp:
    ans += 1
    tmp = l[1]

print(ans)
n=int(input())
k=[[0,0] for i in range(n)]
for i in range(n):
    a,l=map(int,input().split())
    left=a-l
    right=a+l
    k[i][0]=left
    k[i][1]=right
k.sort(key=lambda x:x[1])
tmp=k[0][1]
ans=1
for i in range(n):
    if k[i][0]>=tmp:
        tmp=k[i][1]
        ans+=1
print(ans)
n = int(input())
width = []
for _ in range(n):
  x,l = map(int,input().split())
  width.append([x+l,x-l])
width.sort()
ans = 0
wall = - 10 ** 10
for i in range(n):
  if wall <= width[i][1]:
    ans += 1
    wall = width[i][0]
print(ans)
#print(width)
from operator import itemgetter

n = int(input())
data = [()]*n
for i in range(n):
    x, l = map(int, input().split())
    data[i] = (x-l,x+l)
data.sort(key = itemgetter(1))
ans = 0
prev_r = -10**18
for l, r in data:
    if prev_r >  l:
      continue
    ans += 1
    prev_r = r

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

ls = sorted([[i-j, i+j] for i, j in xl], key=lambda x: x[1])

i, dr = 0, 0
while True:
    if (len(ls)<=1) | (i+1 >= len(ls)):
        break
    a, b = ls[i], ls[i+1]
    if a[1]>b[0]:
        dr += 1
        ls.pop(i+1)
    else:
        i += 1

print(len(ls))
import sys
from operator import itemgetter

read = sys.stdin.read

N, *XL = map(int, read().split())
seq = []

for X, L in zip(*[iter(XL)] * 2):
    seq.append((X - L, X + L))

seq.sort(key=itemgetter(1))
answer = 0
left = -10 ** 10
for i, j in seq:
    if left <= i:
        answer += 1
        left = j

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

XL.sort(key=lambda x: sum(x))
f = -99999999999
ans = 0
for x, l in XL:
    if x - l >= f:
        ans += 1
        f = x + l

print(ans)
INF = float("inf")

def interval_scheduling(A):
    A.sort(key=lambda x: x[1])

    res = []
    cur = -INF
    for s, t in A:
        if cur <= s:
            cur = t
            res.append((s, t))

    return res

N, *XL = map(int, open(0).read().split())

A = [(x - l, x + l) for x, l in zip(*[iter(XL)] * 2)]
print(len(interval_scheduling(A)))
N = int(input())
S = [tuple(map(int, input().split())) for i in range(N)]
T = list(map(lambda j:(j[0]-j[1], j[0]+j[1]), S))

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

for i, t in enumerate(T):
  if i>0:
    if end <= t[0]:
      res += 1
      start = t[0]
      end = t[1]
  else:
    start = t[0]
    end = t[1]
    res = 1

print(res)
from operator import itemgetter
N = int(input())
arms = []
finishtime = float('-inf')
ans=[]
for i in range(N):
    x,l = map(int,input().split())
    arms.append((x-l,x+l))
arms.sort(key=itemgetter(1))
for i in range(N):
    if arms[i][0]>=finishtime:
        ans.append(i)
        finishtime = arms[i][1]
print(len(ans))
N, *XL = map(int, open(0).read().split())

A = sorted(((x - l, x + l) for x, l in zip(*[iter(XL)] * 2)), key=lambda x: x[1])

ans = 0
cur = -10 ** 9
for s, t in A:
    if cur <= s:
        ans += 1
        cur = t

print(ans)
N = int(input())
A = []
for _ in range(N):
    x, l = map(int, input().split())
    A.append((x+l, x-l+1))
A.sort()
now = A[0][0]
ans = 1
for r, l in A:
    if now<l:
        ans+=1
        now = r
print(ans)
import sys
n = int(input())
INF = 10**18
ls = []
for i in range(n):
    x, l = [int(i) for i in sys.stdin.readline().split()]
    ls.append([x - l, x + l])
ls.sort(key=lambda x:x[1])
cnt = 0
_min = -INF
for l in ls:
    if l[0] >= _min:
        cnt += 1
        _min = l[1]
print(cnt)
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]

s = []
f = []
res = 1

for i in range(n):
    s.append(l[i][0]-l[i][1])
    f.append([l[i][0]+l[i][1], i])
    
f = sorted(f)
#print(f)

m = f[0][0]
for i in range(1, n):
    if s[f[i][1]] >= m:
        res += 1
        m = f[i][0]
    
print(res)
n = int(input())
List = [[0 for i in range(3)] for j in range(n)]
for i in range(n):
    robot, arm = map(int, input().split())
    List[i][0] = robot - arm # LeftEnd
    List[i][1] = robot # Center
    List[i][2] = robot + arm # RightEnd

sorted_List = sorted(List, key=lambda x: x[2])

now_rightend = sorted_List[0][2]
counter = 1

for i in range(n):
    if sorted_List[i][0] >= now_rightend:
        now_rightend = sorted_List[i][2]
        counter += 1

print(counter)
# -*- coding: utf-8 -*-
N = int(input())

x_l_pairs = []
for _ in range(N):
    x, l = map(int, input().split(' '))
    x_l_pairs.append([x-l, x+l])

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

ret = 1
cur = x_l_pairs[0][1]
for left, right in x_l_pairs:
    # print(left, right)
    if cur <= left:
        ret += 1
        cur = right

print(ret)
def resolve():
    '''
    code here
    '''
    N = int(input())
    robots = [[int(item) for item in input().split()] for _ in range(N)]


    arm_body_arm = []

    for body, arm in robots:
        arm_body_arm.append([body - arm, body + arm])
    
    arm_body_arm = sorted(arm_body_arm, key=lambda x:x[1])

    res = 1
    prev = arm_body_arm[0][1]
    for start, end in arm_body_arm:
        if prev <= start:
            res += 1
            prev = end

    print(res)

if __name__ == "__main__":
    resolve()
n=int(input())
cnt=0
Arm=[]
for i in range(n):
    x,l=map(int,input().split())
    Arm.append([x+l,x-l])
Arm.sort()

dis=-float('inf')
for i in range(n):
    if dis<=Arm[i][1]:
        cnt+=1
        dis=Arm[i][0]
print(cnt)
N = int(input())
P = [list(map(int, input().split())) for _ in range(N)]

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

leave = [P[0]]
for i in range(1, N):
    # leaveの最大を取得
    leave_max = leave[-1][0] + leave[-1][1]
    p_min = P[i][0] - P[i][1]
    if leave_max <= p_min:
        leave.append(P[i])
    else:
        continue
        
print(len(leave))
n=int(input())
d=[]
for i in range(n):
    x,l=map(int,input().split())
    d.append((x-l,x+l))
d.sort()
ans=1
chk=d[0][1]
for i in d:
    if i[0]>=chk:
        ans+=1
        chk=i[1]
    else:
        chk=min(chk,i[1])
print(ans)
n = int(input().strip())
xl = [list(map(int, input().split())) for i in range(n)]
lst=[[0]*2 for _ in range(n)]

for i in range(n):
    lst[i][0]=xl[i][0]-xl[i][1]
    lst[i][1]=xl[i][0]+xl[i][1]

lst.sort(key=lambda x: x[1])
ans=0
last=-10**10
for i in range(n):
    if last <= lst[i][0]:
        ans+=1
        last=lst[i][1]
print(ans)
N = int(input())
S = []
for i in range(N):
    a, b = map(int, input().split())
    S.append((a-b, a+b))

S = sorted(S, key=lambda x: x[1])
res = 0
cur = -1e9
for i in range(N):
    if cur <= S[i][0]:
        res += 1
        cur = S[i][1]

print(res)
n = int(input())
inter = []
for i in range(n):
    a, b = map(int, input().split())
    inter.append([a-b, a+b])
inter = sorted(inter, key=lambda x: x[1])
ans = 1
rmost = inter[0][1]
for i in range(1, n):
    if inter[i][0] >= rmost:
        rmost = inter[i][1]
        ans+=1
print(ans)
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
es = []
for _ in range(N):
    x, l = mapint()
    es.append((x+l, x-l))

es.sort()
now = -10**18
idx = 0
ans = 0
while 1:
    if idx==N:
        break
    end, start = es[idx]
    if start>=now:
        now = end
        ans += 1
    idx += 1

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

value = []
for _ in range(N):
    tmp1, tmp2 = map(int, input().split())
    
    a = max(0, tmp1-tmp2)
    b = tmp1+tmp2
    value.append([a,b])

value = sorted(value, key=lambda x: x[1])

pre_right = value[0][1]

count = 1
for i in range(1, N):
    left = value[i][0]
    right = value[i][1]
    
    if left >= pre_right:
        count+=1
        pre_right = right      

print(count)
n = int(input())
l = [[int(i) for i in input().split()] for _ in range(n)]
l2 = []
for i in l:
    l2.append([i[0] - i[1],i[0] + i[1]])
    
l2 = sorted(l2,key = lambda x : x[1])

prev = []
ans = 0
for i in range(n):
    if not prev:
        ans += 1
        prev = l2[i]
    elif l2[i][0] >= prev[1]:
        ans += 1
        prev = l2[i]
    else:
        pass

print(ans)
N = int(input())
robots = [list(map(int, input().split())) for i in range(N)]

robots.sort()
robots_arms = [[r[0] - r[1],r[0], r[0] + r[1]] for r in robots ]#leftarm, x, right arm
left_robot = [-float('inf')]*3
ans = 0
for robot in robots_arms:
    if left_robot[2] <= robot[0]:
        ans += 1
        left_robot = robot
    elif left_robot[2] > robot[2]:
            left_robot = robot
    else:
        left_robot = left_robot
print(ans)
N = int(input())
XL = [tuple(map(int, input().split())) for i in range(N)]

XL.sort(key=lambda x: x[0] + x[1])
ans = 0
prev = - 10**9
for x, l in XL:
    if prev <= x - l:
        ans += 1
        prev = x + l

print(ans)
if __name__ == "__main__":
    N=int(input())
    robot=[]
    cnt=0
    last = -1e9
    for _ in range(N):
        x, l = map(int,input().split())
        robot.append((x - l, x+l))
    robot.sort(key=lambda x: x[1])
    for i in range(N):
        if last <=robot[i][0]:
            cnt+=1
            last = robot[i][1]
    print(cnt)
from collections import deque
N = int(input())
lis = []
ans = []
lis_append=lis.append
for i in range(N):
    x,l = map(int, input().split(" "))
    lis_append((x+l,x-l))
lis.sort()
lis = deque(lis)
ans.append(lis.popleft())
while lis:
    a = lis.popleft()
    if a[1] >= ans[-1][0]:
        ans.append(a)
print(len(ans))
N = int(input())

mylist = []
for n in range(N):
    x, l = map(int, input().split())
    mylist += [[x+l, x-l]]
#print(mylist)
mylist.sort()
#print(mylist)

mymin = -9999999999
myans = 0
for n in range(N):
    #print(mymin, mylist[n][1], mylist[n][0])
    if mymin <= mylist[n][1]:
        myans += 1
        mymin = mylist[n][0]
        
print(myans)
n = int(input())
l = []
for _ in range(n):
  x,y = map(int, input().split())
  l.append([x+y,x-y])
l=sorted(l)
 
tmp = l[0][0]
count = n
for p in l[1:]:
  if tmp <= p[1]:
    tmp = p[0]
  else:
    tmp = min(tmp,p[0])
    count -= 1
print(count)
N = int(input())
XL = [list(map(int, input().split())) for _ in range(N)]

rXL = []
for i, j in XL:
    rXL.append([i - j, i + j])
rXL = sorted(rXL, key = lambda x: x[1])
TF = [True for _ in range(N)]

maxr = rXL[0][1]
for i in range(1, N):
    if maxr <= rXL[i][0]:
        maxr = rXL[i][1]
    else:
        TF[i] = False

print(sum(TF))
n=int(input())
R=[]
for i in range(n) :
    x,l=map(int,input().split())
    R.append([x+l,x-l])          #[右,左]
R.sort()                         #右側で小さい順からソート

def solve() :
    t,ans=-1000000000,0
    for i in range(n) :
        if R[i][1]>=t :
            ans+=1
            t=R[i][0]
    return ans

print(solve())
n = int(input())

robots = []

for _ in range(n):
    x, l = map(int, input().split())
    left, right = x-l, x+l
    robots.append([left, right])

robots.sort()

count = 0
now = -float('INF')

for left, right in robots:
    if left >= now:
        count += 1
        now = right

    else:
        if right < now:
            now = right
        else:
            continue

print(count)
n = int(input())
xl = [list(map(int, input().split())) for i in range(n)]
lr = list(map(lambda x:[x[0]-x[1], x[0]+x[1]], xl))
lr.sort(key=lambda x:x[1])
#print(lr)
limit = lr[0][1]
ans=n
for i in range(1, n):
  if lr[i][0]<limit:
    ans-=1
  else:
    limit=lr[i][1]
print(ans)
N, *L = map(int, open(0).read().split())

ls = [0]*N
i = 0
for i,(x,l) in enumerate(zip(*[iter(L)]*2)):
  ls[i] = (x+l,x-l)
ls.sort()
cur = -10**20
ans = 0
for c in ls:
  if c[1]>=cur:
    ans += 1
    cur = c[0]
print(ans)
import sys
input = sys.stdin.readline
n = int(input())
pre = -float('inf')
ans = 0
x = [0] * n
for i in range(n):
    x[i] = tuple([int(x) for x in input().strip().split()])

x.sort()
for xx in x:
    if pre > xx[0] - xx[1]:
        continue
    ans += 1
    pre = xx[0] + xx[1]
print(ans)
n = int(input())
ls = []
for i in range(n):
    x, l = map(int, input().split())
    ls.append([x-l, x+l])
ls.sort()

now = ls[0]

ans = n

for i in range(1,n):
    if now[1] > ls[i][0]:
        ans -= 1
    else:
        now = ls[i]

print(ans)
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:
        xx.append(x)
        ll.append(l)
        cnt +=1

print(len(xx))
N = int(input())
ST = []
for i in range(N):
    x, l = list(map(int, input().split()))
    ST.append([x-l+1, x+l-1])
ST.sort(key = lambda x :x[1])
startT = ST[0][1]
ans = 1
for i in range(1,N):
    if startT >= ST[i][0]:
        continue
    else:
        startT = ST[i][1]
        ans += 1
print(ans)
N = int(input())
# X, L = [], []
A = []
for i in range(N):
    x, l = map(int, input().split())
    # X.append(x)
    # L.append(l)
    A.append((x - l, x + l))

A.sort()
ans = 0
x = -10e50
for i in range(N):
    l, r = A[i]
    if x <= l:
        ans += 1
        x = r-1

print(ans)


# 選べるロボットの中で最もX+Lが小さいもの
N = int(input())
D = []
for i in range(N):
    x, l = map(int, input().split())
    D.append([x-l, x+l])
from operator import itemgetter
D = sorted(D, key = itemgetter(0))
u = -10**10 #最小値:x = 0, l = 10**10の時
cnt = 0
for a, b in D:
    if u < a:
       cnt += 1
       u = b #つぎのロボットの範囲の下限に置きかえる
print(cnt)
N = int(input())
ppair = [[0,0]]*N
for i in range(N):
    ppair[i] = list(map(int,input().split()))

ppair.sort()
ans = 0
pf = False
for i in range(N-1):
    if (pf):
        pf = False
        continue
    else:
        if (sum(ppair[i]) > ppair[i+1][0] - ppair[i+1][1]):
            ans += 1
            pf = True

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

ans = n
r = ll.pop(0)[1]

while ll:
  while ll and ll[0][0] < r:
    ans -= 1
    ll.pop(0)
  if ll:
    r = ll.pop(0)[1]

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

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

robos.sort()

kosuu = 0
maenomigi = -100000000000000000000000
for x, l in robos:
    # ok
    if maenomigi <= x - l:
        maenomigi = x + l
        kosuu += 1

print(kosuu)
#%%
n = int(input())
x = [0] * n
l = [0] * n
a = [[0, 0] for _ in range(n)]
for i in range(n):
    x[i], l[i] = map(int, input().split())
    a[i] = [x[i]-l[i], x[i]+l[i]]

a.sort()
#print(a)

ans = 0
t = -(10**10)
for i in range(n):
    if a[i][0] >= t:
        ans += 1
        t = a[i][1]
print(ans)
import sys
input = sys.stdin.readline
def main():
    N = int( input())
    X = []
    for _ in range(N):
        x, l = map( int, input().split())
        X.append((x-l+1, x+l-1))
    X.sort(reverse=True)
    ans = 0
    now = 10**10
    for i in range( N):
        a, b = X[i]
        if b <= now:
            now = a
            ans += 1
    print(ans)
    
if __name__ == '__main__':
    main()
N = int(input())
X = [list(map(int, input().split())) for i in range(N)]

s = 0

for i in range(0, len(X)-1, 1):
  a = X[i]
  min = a[0] - a[1]
  max = a[0] + a[1]
  for j in range(i+1, len(X), 1):
    b = X[j]
    b_min = b[0] - b[1]
    b_max = b[0] + b[1]
    if min <= b_max and max >= b_min:
      s += 1
    

print(s)
n = int(input())
a = [[0,0] for _ in range(n)]
#print(a)
for i in range(n):
    a[i][0],a[i][1]=map(int,input().split())
a.sort()
for i in range(n):
    a[i][0],a[i][1]=(a[i][0]-a[i][1]),(a[i][0]+a[i][1])

now = 0
for i in range(n-1):
    if a[now][1]>a[now+1][0]:
        a.pop(now+1)
    else:
        now+=1
print(len(a))