peterverebics/CodeNet_Python_118 huggingface dataset:
def acinput():
    return list(map(int, input().split(" ")))

N=int(input())
bars=[]
for i in range(N):
    tmp = acinput()
    tmp.extend([tmp[0]-tmp[1],tmp[0]+tmp[1]])
    bars.append(tmp)

bars=sorted(bars,key=lambda x:x[3])

print(bars)

count=0
R=-10000000000
for i in range(0,N):

    if R<=bars[i][2]:
        R=bars[i][3]
        count+=1


print(count)
n = int(input())
ls = []
for i in range(n):
    x,l = map(int,input().split())
    ls.append([x-l,l+x])
    
r = n
ls = sorted(ls)
for i in range(1,n):
    if ls[i][0] < ls[i-1][1]:
      ls[i][1] = ls[i-1][1]
      r -=1
        
print(r)
N = int(input())
XL = []
for i in range(N):
    XL.append(list(map(int,input().split())))
XL.sort(key=lambda x:x[0])
ans = 0
left = XL[0][0]-XL[0][1]
right = XL[0][0]+XL[0][1]
for i in range(1,N):
    new_left = XL[i][0]-XL[i][1]
    new_right = XL[i][0]+XL[i][1]
    #if no overlap
    if new_left >= right:
        left = new_left
        right = new_right
    else:
        ans += 1
print(N-ans)
N = int(input())
p = []
for _ in range(N):
    x, n = [int(i) for i in input().split()]
    p.append((x-n, x+n))
p.sort()
i = 0
j = 1
c=0
while i<N and j<N:
    # print(i, j)
    if p[i][0]<=p[j][0]<p[i][1]:
        j+=1
        c+=1
    else:
        i=j
        j+=1
print(N-c)
n = int(input())
d = []
for i in range(n):
    x,l = map(int, input().split())
    # num , left , right
    d.append([i,x-l+1,x+l-1])

d.sort(key=lambda x:x[1],reverse=False)

p = 10**9 + 1
ans = 0
while len(d) > 0:
    i,l,r = d.pop(-1)
    #print(i,l,r,p)
    if r >= p:
        ans += 1
    p = l
    #print(d)

print(n-ans)
N = int(input())
X = [0]*N
L = [0]*N
d = {}
max = 0
del_count = 0
first = 0
for i in range(N):

  x,l= map(int,list(input().split()))
  if i == 0:
    first = x
  d[x] = l
s = sorted(d.items(), key=lambda x:x[0])
new_list = sorted(X)
for x,l in s:
  if first == x:
    max = x + l
  elif max > x - l:
    del_count +=1
  else:
    max = x + l
print(N-del_count)
N = int(input())
X_L = [list(map(int, input().split())) for _ in range(N)]

d = []

for xl in X_L:
  d.append([xl[0] - xl[1], 1])
  d.append([xl[0] + xl[1] - 1, -1])

d.sort(key=lambda x: x[0])
#print(d)
ans = 0
tmp = 0
kasanari =[]
for d in d:

  tmp += d[1]
  kasanari.append(tmp)
  if tmp > 1:
    ans += tmp - 1
#print(kasanari)
print(N - ans)
INF = float("inf") #const

def main():
    n = int(input())
    ls = [list(map(int,input().split())) for _ in range(n)]
    #start ls[i][0] - ls[i][1]. goal ls[i][0] + ls[i][1]
    ls = sorted(ls,key = lambda x:x[0])
    print(ls)

    ans = 0; t = -INF
    for i in range(n):
        if t <= ls[i][0] - ls[i][1]:
            ans += 1
            t = ls[i][0] + ls[i][1]
    print(ans)


if __name__ == "__main__":
    main()
N=int(input())
X=[]
x={}
for i in range(N):
    a,b=map(int,list(input().split(" ")))
    X.append(a+b)
    x[a+b]=a-b
X.sort()
D={}
D[0]=1
exe=[0]
for i in range(1,N):
    k=X[i]
    if x[k]<X[exe[-1]]:
        D[i]=D[exe[-1]]
    else:
        D[i]=D[exe[-1]]+1
        exe.append(i)
print(len(exe))
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import defaultdict
from bisect import *
mod = 10**9+7

N = int(input())
XL = [list(map(int, input().split())) for i in range(N)]
XL.sort()
cnt, last = 0, XL[0]
for x, l in XL[1:]:
    if x-l < last[0]+last[1]:
        cnt += 1
    else:
        last = [x, l]
print(N-cnt)
def solve():
    N = int(input())
    C = []
    for _ in range(N):
        a, b = list(map(int, input().split()))
        C.append((a-b, a+b))

    C.sort()
    
    c = 0
    cur = -float('inf')
    for i in range(N):
        if cur <= C[i][0]:
            c += 1
            cur = C[i][1]

    return c

print(solve())
N = int(input())
L = []

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

S = []
for i in range(len(L)):
    S.append(sorted([L[i][0] - L[i][1],L[i][0] + L[i][1]]))
    #L[i][0] = L[i][0] - L[i][1]
    #L[i][1] = L[i][0] + L[i][1]
Q =sorted(S)
print(Q)
a = 0
check = Q[0][1]
for i in range(1,len(Q)):
    if check <= Q[i][0] :
        check = Q[i][1]
    else:
        a += 1

print(N-a)
N = int(input())
table = []
for i in range(N):
    X,L = map(int,input().split())
    table.append((X-L,X+L))
table = sorted(table, key=lambda x:x[1])

cur = 0
l_cur, r_cur = table[0]
ans = N
for i in range(1,N):
    l,r = table[i]
    if r_cur > l:
        ans -= 1
        if r_cur >= r:
            l_cur, r_cur = l, r
print(ans)
N = int(input())
se = [()] * N
for i in range(N):
	x, l = map(int, input().split())
	se[i] = (x-l, x+l)
se = sorted(se, key=lambda x: x[1])
ans = N
for i in range(1, N):
	if se[i-1][1] > se[i][0]:
		ans -= 1
print(ans)
import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
N = int(input())
a = []
p = []
res = 0
for _ in range(N):
  x, l = map(int, input().split())
  a.append((x - l + 1, x + l - 1))
  p.append(x - l + 1)
p.sort()
a.sort(key = lambda x: (x[0], -x[1]))
#print(a)
#print(p)
for i in range(N):
  r = bl(p, a[i][1])
  #print(a[i], r, i)
  res += max(r - i - 1, 0)
print(N - res)
N = int(input())
ranges = []
for _ in range(N):
    x, l = map(int, input().split())
    ranges.append([x - l + 1, x + l -1])
ranges.sort()

idx = 0
removed_num = 0
while idx < N-1:
    if ranges[idx+1][0] <= ranges[idx][1]:
        removed_num += 1
        idx += 2
    else:
        idx += 1
print(N - removed_num)
n =int(input())
x =[]
l =[]

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

min = []
max = []
for i in range(n):
    min1, max1 = (x[i]-l[i],x[i]+l[i])
    min.append(min1)
    max.append(max1)

min_sort = sorted(min)
max_sort = sorted(max)
ans = 0
T =-100000000
for i in range(n):
    if T<=min_sort[i]:
        ans +=1
        T = max_sort[i]
print(ans)
n=int(input())
a=[]
for i in range(n):
  x,l=map(int,input().split())
  a.append([max(0,x-l),x+l])
a.sort()
r=0
c=0
for i in range(n):
  if a[i][0]>=r:
    r=a[i][1]
    c+=1
print(c)
N = int(input())

p = []
for i in range(N):
  a,b = map(int,input().split())
  p.append([max(0,a - b),a + b])
  
q = sorted(p,key=lambda x:x[0])  

cnt = 0
d = q[0][1]
for j,k in q[1:]:
  if j < d:
    cnt += 1
  else:
    d = k

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

X = sorted(X, key=lambda x:x[1])
a = -2**10
ans = 0
for i in range(N):
    if X[i][0] >= a:
        a =X[i][1]
        ans +=1
    else:
        continue
print(ans)
n = int(input())
data = [[]]*n
for i in range(n):
    x, l = map(int, input().split())
    data[i] = [x-l,x+l]
data.sort()
ans = 0
prev_r = -10**18
for i in range(n):
    if prev_r >  data[i][0]:
      continue
    ans += 1
    prev_r = data[i][1]

print(ans)
n=int(input())
a=[list(map(int,input().split())) for i in range(n)]
b=[]
for i in a:
	ma=i[0] + i[1]
	mi=i[0] - i[1]
	c=[mi,ma]
	b.append(c)


while True:
	count=[]
	for i in range(n):
		count.append(0)
	p=0
	for i in b:
		p+=1
		for j in b[p-1:]:
			if i==j:
				continue
			if i[0]<j[0]<i[1] or i[0]<j[1]<i[1]:
				count[p-1]+=1
	del b[count.index(max(count))]
	n-=1
	if sum(count)==0:
		break

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

xl = [tuple(map(int, input().split())) for _ in range(n)]
xl = sorted(xl)
res = 1
x, l = xl[0]
cur = x + l
for (x, l) in xl:
    if x - l >= cur:
        cur = x + l
        res += 1
print(res)
n = int(input())
robots = []
for _ in range(n):
    x, l = map(int, input().split())
    robots.append((x, l))
robots.sort()



ok = [True for _ in range(n)]
p = 0
q = 1
while p < n and q < n:
    x1, l1 = robots[p]
    x2, l2 = robots[q]
    if ok[p] and not x1 + l1 <= x2 - l2:
        ok[q] = False
    
    p = q
    q = p + 1

# print(ok)
c = 0
for v in ok:
    if v:
        c += 1
print(c)
INF = float("inf") #const

def main():
    n = int(input())
    ls = [list(map(int,input().split())) for _ in range(n)]
    #start ls[i][0] - ls[i][1]. goal ls[i][0] + ls[i][1]
    ls = sorted(ls,key = lambda x:x[0])

    ans = 0; t = -INF
    for i in range(n):
        if t <= ls[i][0] - ls[i][1]:
            ans += 1
            t = ls[i][0] + ls[i][1]
    print(ans)


if __name__ == "__main__":
    main()
import copy
n = int(input())
x_org = []
for i in range(n):
    x_org.append(input().split())

x = sorted(x_org, key=lambda z: int(z[0]))

removed = 0
for i in range(1, n):
    if (int(x[i][0]) - int(x[i][1])) < (int(x[i-1][0]) + int(x[i-1][1])):
        removed += 1
        x[i] = x[i-1]

print(n - removed)
length = int(input())
target = []
for i in range(length):
    s, e = map(int, input().split(" "))
    target.append([s - e, s + e])
target.sort(key = lambda x: x[1])
answer = 0
before_e = -1
for s, e in target:
    # print(before_e, s, e)
    if s < before_e:
        answer += 1
    else:
        before_e = e
print(length - answer)
#2
n=int(input())
XL=dict()
ans=n
last=0
for i in range(n):
    x,l=map(int,input().split())
    if last<x:
        last=x
    XL[x]=l
XL=sorted(XL.items())
s=list(XL)
for i in range(n-1):
    if (s[i+1][0]-s[i][0])<(s[i+1][1]+s[i][1]):
        ans-=1

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

robots = sorted(robots, key=lambda x: x[0])
# print(robots)
rightest_point = robots[0][0] + robots[0][1] - 1

ans = 0
for i in range(1, N):
    # print("rightest_point: ", rightest_point)
    if robots[i][0]-robots[i][1] + 1 < rightest_point:
        ans += 1
        continue
    else:
        rightest_point = robots[i][0]+robots[i][1] - 1
# print("rightest_point: ", rightest_point)
print(N-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 i!=n-2:
        if l[i][0]+l[i][1]>l[i+2][0]-l[i+1][1]:
            count+=1
            continue
    if l_range>x_range:
        count+=1
        l[i+1]=l[i]

print(n-count)
n=int(input())
xl=[list(map(int,input().split())) for _ in range(n)]
l=[]
for i in range(n):
    t=[]
    t.append(xl[i][0]+xl[i][1]-1)
    t.append(xl[i][0]-xl[i][1]+1)
    l.append(t)
l=sorted(l)
ans=0
c=-10*10
for t,s in l:
    if c<s:
        c=t
        ans+=1
print(ans)
num = int(input())
robots = []
for i in range(num):
  a, b = map(int, input().split())
  robots.append([a-b, a+b])
robots.sort()

now = robots[0][1]
cnt = 1
for i in range(1, len(robots)):
  if now <= robots[i][0]:
    cnt += 1
    now = robots[i][1]
print(cnt)
import sys


def input():
    return sys.stdin.readline()[:-1]


N = int(input())

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

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

ans = 0
cur = -100_000
for i in range(N):
    if cur <= XL[i][0]:
        ans += 1
        cur = XL[i][1]
print(ans)
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][1] >= a:
    x += 1
    a = lis[b][0]

print(x)
#!/usr/bin/env python3
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]
xl.sort()
x = [0] * n
l = [0] * n
for i in range(n):
    x[i], l[i] = xl[i]
ans = [False] * n
ans[0] = True
p = 0
for i in range(1, n):
    if ans[p] and x[p] + l[p] <= x[i] - l[i]:
        ans[i] = True
        p = i
print(sum(ans))
def m():
    N = int(input())
    XL = [list(map(int, input().split())) for _ in range(N)]
    ST = [[max(xl[0] - (xl[1] - 1), 0), xl[0] + (xl[1] - 1)] for xl in XL]
    ST.sort(key=lambda x: x[1])
    ans = 1
    right = ST[0][1]
    for i in range(1, N):
        if right < ST[i][0]:
            right = ST[i][1]
            ans += 1
    return ans


print(m())
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 = 0
pre = -(10 ** 10)
for i in range(n):
    if data[i][0] - data[i][1] >= pre:
        ans += 1
        pre = data[i][0] + data[i][1]

print(ans)
n = int(input())
robot = []
for a in range(n):
    x,l = [int(i) for i in input().split()]
    for i in robot:
        if x-l < i[0]-i[1] < x+l or x-l < i[0] < x+l or x-l < i[0]+i[1] < x+l:
            break
    else:
        robot.append([x,l])
print(len(robot))
n = int(input())

start = []
is_left = [True for i in range(n)]
length = []

for _ in range(n):
    x, l = map(int,input().split())
    start.append(x+l)
    length.append(l)

sorted_length = []
start_i = [i for i in range(n)]
start_i.sort(key=lambda x:start[x])
start.sort()
for i in start_i:
    sorted_length.append(length[i])


for i in range(1,n):
    if start[i] - (2*sorted_length[i]) < start[i-1]:
        if is_left[i-1] == True:
            is_left[i] = False

print(sum(is_left))
N = int(input())
XL = [list(map(int, input().split())) for _ in range(N)]
X, L = [list(i) for i in zip(*XL)]

robot_range = list(map(lambda xl: (xl[0]-xl[1], xl[0]+xl[1]), XL))
robot_range.sort()

now_r = -10*100
cnt = 0
for v in robot_range:
    l, r = v
    if now_r <= l:
        cnt += 1
        now_r = r

print(cnt)
N = int(input())
robots = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])

x_max = -10**10
ans = 0
for x, l in robots:
    if x - l >= x_max:
        ans += 1
        x_max = x + l
print(ans)
N = int(input())
L = []

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

S = []
for i in range(len(L)):
    S.append(sorted([L[i][0] - L[i][1],L[i][0] + L[i][1]]))
    #L[i][0] = L[i][0] - L[i][1]
    #L[i][1] = L[i][0] + L[i][1]
Q =sorted(S)

a = 0
check = Q[0][1]
for i in range(1,len(Q)):
    if check <= Q[i][0] :
        check = Q[i][1]
    else:
        a += 1

print(N-a)
n = int(input())
XL = []
for _ in range(n):
    x, l = map(int, input().split())
    XL.append([x-l, x+l])
XL.sort()
INF = 10**18
cur = -INF
ans = 0
for i in range(n):
    if cur <= XL[i][0]:
        ans += 1
        cur = XL[i][1]
print(ans)
#input
N = int(input())
X = []
L = []
for i in range(N):
    X_temp, L_temp = map(int, input().split())
    X.append(X_temp)
    L.append(L_temp)

#output
import bisect as bi
import numpy as np

M = np.array((X, L))

M = np.sort(M, axis = 1)

sum = 1
worm = M[0, 0] + M[1, 0]
while worm < M[0, N-1]:
    worm = bi.bisect_left(M[0], worm)
    worm = M[0, worm] + M[1, worm]
    sum += 1

print(sum)
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
for x,l in XL:
    s,t = x-l, x+l
    if s > right:
        right = t
        ans += 1
print(ans)
# Keyence B

N = int(input())
robot_list = []
robot_count = 1

for _ in range(N):
    robot_list.append(list(map(int, input().split())))

if N == 1:
    print(N)
else:
    robot_list.sort()
    r = robot_list[0][0] + robot_list[0][1]
    
    for i in range(1, N):
        if r <= robot_list[i][0] - robot_list[i][1]:
            robot_count += 1
            r = robot_list[i][0] + robot_list[i][1]
    
    print(robot_count)
import numpy as np

N=int(input())
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]
    elif right-(XLs[i+1][0]+XLs[i+1][1])>0:
        right=XLs[i+1][0]+XLs[i+1][1]
print(ans)
N=int(input())
X_L = sorted([list(map(int,input().split())) for _ in range(N)])
flag = 0
count = 0

for i in range(N-1):
    if flag == 0:
        if X_L[i][0]+X_L[i][1] > X_L[i+1][0]-X_L[i+1][1]:
            flag = 1
            count += 1
print(N-count)
N = int(input())
S = []
for _ in range(N):
    X,L = map(int, input().split())
    S.append([X,L])

min_list=[]
for i in range(N):
    min_list.append((S[i][0] + S[i][1], S[i][0] - S[i][1]))

min_list.sort()

ans=0
current_min = -10*10
for i in range(N):
    if min_list[i][1] >= current_min:
        ans+=1
        current_min = min_list[i][0]
print(ans)
n=int(input())
li=[]
for i in range(n):
  tmpli=list(map(int, input().split()))
  li.append(tmpli)
li.sort()
# print(li)
for i in range(len(li)-1):
  if li[i][0]+li[i][1] > li[i+1][0]-li[i+1][1]:
    li[i+1][0] = 0
    a=li[i]
    li[i]=li[i+1]
    li[i+1]=a
    n -= 1
print(n)
n=int(input())
lists=[]
for i  in range(n):
    x,y=map(int,input().split())
    lists.append((x-y,x+y))
lists=sorted(lists,key=lambda x:(x[0],x[1]))
A=1
P=lists[0]
#貪欲法
for i in range(1,len(lists)):
    if lists[i][0]>=P[1]:
        A+=1
        P=lists[i]
print(A)
n=int(input())
xl=[]
l=[]
for i in range(n):
    a,b=map(int,input().split())
    xl.append((a,b))
    l.append((a-b,i,0))
    l.append((a+b-0.1,i,1))
xl.sort()
l.sort()
buf=0
count=0
for i in range(2*n):
    if l[i][2]==0:
        buf+=1
    elif l[i][2]==1 and buf==1:
        buf=0
    elif buf>1:
        count+=buf-1
        buf=0
    #print(l[i],buf,count)
print(n-count)
N = int(input())
s = [list(map(int,input().split())) for i in range(N)]

removal_count = 0
for index, arm in enumerate(s):
  if arm[0]+arm[1]>= s[index][0]+s[index][1]:
    removal_count += 1
print(removal_count)
N = int(input())
XL = sorted([list(map(int, input().split())) for _ in range(N)])

remove = 0
reach = 0

for i in range(N):
    r = XL[i]
    right = r[0] + r[1]
    left = r[0] - r[1]

    if i == 0:
        reach = right
        continue

    if reach > left:
        reach = max(reach, right)
        remove += 1
    else:
        reach = right

print(N - remove)
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)]
for i in range(n):
    for j in range(i + 1, n):
        if r[i][1] < r[j][0]:
            break
N = int(input())
XL = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    XL.append(array)
XL = sorted(XL)
Y = 0
cnt = 0
for i in range(N):
    if XL[i][0]>=Y:
        cnt += 1
        Y = XL[i][0]+XL[i][1]
    else:
        Y = min(Y,XL[i][0]+XL[i][1])
print(cnt)
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()
ans = 0
cur = a[0][0]
for i in a:
    if i[1] < cur:
        continue
    ans += 1
    cur = i[0]
print(ans)
n = int(input())
X = [[] for _ in range(n)]
for i in range(n):
    x,l = list(map(int, input().split()))
    X[i] = [x-l,x+l]

X.sort(key = lambda x: x[1])
cnt = 0
rIdx = 1
for lIdx in range(n):
    while (lIdx<rIdx<n and X[rIdx][0]<X[lIdx][1]):
        X[rIdx][1] = -1
        rIdx += 1
        cnt += 1
    if rIdx == lIdx:
        rIdx += 1
print(n-cnt)
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
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())
itv = []
for i in range(n):
    x,l = map(int, input().split())
    start = x - l
    end = x + l
    itv.append([end, start])

itv.sort()

ans, t = 0, 0
for [x, l] in itv:
    if t <= l:
        ans += 1
        t = x

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

list = []

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:
      list.append(a)
    

print(int(len(list)))
n=int(input())
arr=[]
for i in range(n):
	x,y=map(int,input().split())
	arr.append([x,y])
arr=sorted(arr,key=lambda item:item[1])
cc=1
r1=arr[0][1]
for i in range(1,len(arr)):
	l1=arr[i][0]
	r2=arr[i][1]
	if l1>r1:
		cc+=1
		r1=r2
print(cc)
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 = 0
for i in range(1,N):
    if M >= XL[i][0]-XL[i][1]:
        ans += 1
    else:
        M = XL[i][0]+XL[i][1]-1
print(N-ans)
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())

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

xl = sorted(xl)
max_cover=0
num_remove = 0
for i,t in enumerate(xl[1:]):
    if xl[i-1][1]>t[0] or max_cover > t[0]:
        num_remove +=1
        if xl[i-1][1]>max_cover:
            max_cover = t[1]

print(N-int(num_remove/2))
import math
def main():
    N = int(input())
    robo = []

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

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


    #print(robo)

    ans = 1
    t = robo[0][1]
    for i in range(1, N):
        if t < robo[i][0]:
            ans += 1
            t = robo[i][1]

    print(ans)




    return 0

if __name__ == '__main__':
    main()
N=int(input())
cnt=1
R=[[0]*2 for _ in range(N)]
for i in range(N):
  x,l=map(int,input().split())
  R[i][0]=(x-l+1)
  R[i][1]=(x+l-1)
#print(R)
R.sort(key=lambda x: x[0])
#print(R)
for i in range(1,N):
  if R[i][0]>R[i-1][1]:
    cnt+=1
print(cnt)
n = int(input())
xl = [list(map(int,input().split())) for i in range(n)]
xl = sorted(xl)

pre = 0
cnt = 0
for x, l in xl:
    if pre == 0:
        pre = x + l
        continue

    if x - l < pre and pre < x + l:
        cnt += 1
    elif x + l < pre:
        cnt += 1
        pre = x + l
    else:
        pre = x + l

print(n - cnt)
n = int(input())
xs = []
scope = {}
for _ in range(n):
    x, l = map(int, input().split())
    xs.append(x)
    scope[x] = [x-l, x+l]
    
xs.sort()
ans = 1
end = scope[xs[0]][1]
for ii, i in enumerate(xs[1:]):
    start = scope[i][0]
    if end <= start:
        ans += 1
        end = start
    else:
        if scope[i][1] <= scope[xs[ii+1]][0] and ii+1 <= n:
            ans += 1
            end = scope[xs[ii+1]][1]
print(ans)
n = int(input())
xs = []
scope = {}
for _ in range(n):
    x, l = map(int, input().split())
    xs.append(x)
    scope[x] = [x-l, x+l]
    
xs.sort()
ans = 1
end = scope[xs[0]][1]
for i in xs:
    start = scope[i][0]
    if end <= start:
        ans += 1
        end = start
print(ans)
import sys,bisect

input=sys.stdin.readline

N=int(input())
robot=[]
for i in range(N):
    robot.append(tuple(map(int,input().split())))

robot.sort()
pos=[robot[i][0] for i in range(N)]
arm=[-1]*N
for i in range(0,N):
    index=bisect.bisect_right(pos,robot[i][0]-robot[i][1])
    arm[i]=index-1

dp=[0]*N
dp[0]=1
for i in range(1,N):
    if arm[i]==-1:
        dp[i]=1
    else:
        dp[i]=1+dp[arm[i]]

print(max(dp))
N = int(input())
robots = []
for _ in range(N):
    x, l = map(int, input().split())
    robots.append((x-l, x+l))

robots.sort(key=lambda x: [x[1], x[0]])  # 終端を昇順ソート
# print(robots)
rm = 0
rightest_point = robots[0][1] - 1
for i in range(1, N):
    if robots[i][0] + 1 > rightest_point:  # 被っていないから残せる
        rightest_point = robots[i][1] - 1
    else:
        rm += 1
print(N-rm)
import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
print(-1)
n=int(input())
x=[]
l=[]
for i in range(n):
    a,b=map(int,input().split())
    x.append(a)
    l.append(b)

ans = [[0 for i in range(2)] for j in range(n)]
for i in range(n):
    ans[i][1]=(x[i]+l[i])
    ans[i][0]=max(0,x[i]-l[i])
ans.sort()
count=1
j=0
for i in range(n-1):
    
    if ans[j][1]<=ans[i+1][0] and ans[i][1]>ans[i+1][1]:
        count+=1
        j=i+1
print(count)
import sys; readline = sys.stdin.readline

N = int(readline())
X, L = zip(*[map(int, readline().split()) for i in range(N)])

rm = -10000000
dropc = 0
for i in range(N):
    if X[i] - L[i] < rm:
        if rm > X[i] + L[i]:
            rm = X[i] + L[i]
        dropc += 1
    else:
        rm = X[i] + L[i]

print(N - dropc)
n = int(input())
a = []
count = 0
for i in range(n):
    x_l = list(map(int,input().split()))
    a.append(x_l)
    
for j in range(n-1):
    if (a[j][0] + a[j][1]) > (a[j+1][0] - a[j+1][1]):
        count += 1
        a[j+1][0] = a[j][0]
        a[j+1][1] = a[j][1]

print(count)