peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())
xl = sorted([tuple(map(int, input().split())) for _ in range(n)])

tmp = sum(xl[0])

res = 0
for i in range(1, n):
    x, l = xl[i]
    if tmp >= x-l:
        res += 1
    else:
        tmp = x+l

print(n-res)
n=int(input())
l=[]
for i in range(n):
    a,b=map(int,input().split())
    l.append([a-b+1,a+b])
l.sort(key=lambda x: x[1])
ans=1
nl=l[0][0]
nr=l[0][1]
for i in range(1,n):
    if l[i][0]<nr:
        continue
    else:
        nr=l[i][1]
        ans+=1
print(ans)
import sys

input = lambda: sys.stdin.readline().rstrip()

n = int(input())
X_L = []
X_L_append = X_L.append
for _ in range(n):
    x, l = map(int, input().split())
    X_L_append((x-l, x, x+l))
X_L.sort(reverse=True)

ans = n
for i in range(n-1):
  if X_L[i][0] <= X_L[i+1][1] and X_L[i+1][2] >= X_L[i][1]:
    ans -= 1
print(ans)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
xl = [list(map(int, readline().split())) for i in range(n)]
pm = [[0] * 2 for _ in range(n)]
for i in range(n):
    pm[i][0] = xl[i][0] + xl[i][1]
    pm[i][1] = xl[i][0] - xl[i][1]
pm.sort(key=lambda x: x[1])
ans = 1
check = pm[0][0]
for i in range(1, n):
    if check <= pm[i][1]:
        check = pm[i][0]
        ans += 1
print(ans)
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)
print(new_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+1]

ans = n - cnt

print(ans)
N = int(input())
xl = [list(map(int, input().split())) for _ in range(N)]
rl = []
for i in range(N):
    rl.append((xl[i][0] - xl[i][1], xl[i][0] + xl[i][1]))
rl.sort(key=lambda x: x[1])
cnt = 0
tmp = -10 ** 18
print(rl)
for i, j in rl:
    if tmp <= i:
        cnt += 1
        tmp = j
print(cnt)
n = int(input())
L = []
for _ in range(n):
    x, l = map(int, input().split())
    left = x - l
    right = x + l
    L.append((left, right))
L = sorted(L, key=lambda x: x[0])
ans = 0
prev = -float('inf')
for r in L:
    if r[0] >= prev:
        ans += 1
        prev = r[1]
print(ans)
N = int(input())
y = [[None] * N for _ in range(N)]
L = [0]*N
d = {}
max = 0
del_count = 0
first = 0
for i in range(N):
  y[i]= list(map(int,list(input().split())))
count = 0
x = sorted(y)
for z in x:
  if count == 0:
    max = z[0] + z[1]
  elif max > z[0] - z[1]:
    del_count +=1
  else:
    max = z[0] + z[1]
print(N-del_count)
N = int(input())
left = [] 
right = []
for i in range(N):
    x, dis = map(int, input().split(" "))
    left.append(x-dis)
    right.append(x+dis)
    
cnt = 1
for i in range(N-1):
    if right[i] <= left[i+1]:
        cnt += 1

print(cnt)
import numpy as np
N = int(input())
X = []
for i in range(N):
  X.append(list(map(int,input().split())))

X = np.array(X)
X = X[X[:,1].argsort(),:]
D = []
j = 0
for i in range(1,N):
    if (X[j,0] - X[j,1] +1 <= X[i,0] - X[i,1] +1) and (
        X[j,0] + X[j,1] -1  >= X[i,0] + X[i,1] -1):
      D.append(i)
      j -= 1
    j += 1

  
print(N - len(D))
n=int(input())
xl=[list(map(int,input().split())) for _ in range(n)]
xl.sort(key=lambda x: x[0])
cnt=0
nx,nl=xl[0]
for i in range(1,n):
  x,l=xl[i]
  if nx+nl<=x-l:
    nx=x
    nl=l
  else:
    cnt+=1
print(n-cnt)
N = int(input())

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,N):
    if check <= Q[i][0] :
        check = Q[i][1]
    else:
        a += 1

print(N-a)
n = int(input())
min_list = []
max_list = []
middle_list = []
for i in range(n):
    a,b = map(int,input().split(" "))
    min_list.append(a - b)
    max_list.append(a + b)
    middle_list.append(a)

count = 0    
for i in range(n):
    if min_list[i] <= middle_list[0] <= max_list[i]:
        count += 1
       
res = n - (count - 1)
    
print(res)
#区間スケジューリング問題

N = int(input())

robots = {}

for _ in range(N):
    X, L = list(map(int, input().split()))

    robots[X] = (X-L, X+L)

#終端が早い順にソートして、取れるものから貪欲法でとっていく

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

ans = 1
current_robot = robots_sorted[0]

for i in range(0, N):
    if current_robot[1][1] >= robots_sorted[i][0]:
        continue

    ans += 1
    current_robot = robots_sorted[i]


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

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)
N = int(input())
robots = []
for _ in range(N):
    X , L = map(int,input().split())
    robots.append([X - L, X + L])
robots.sort()
now = robots[0][1]
ans = 1
for i in range(1, N):
    if robots[i][0] >= now:
        now = robots[i][1]
        ans += 1
print(ans)
n=int(input())
l=sorted([list(map(int,input().split())) for i in range(n)],key=sum,reverse=1)
now=float("INF")
ans=0
for i in l:
    if sum(i)<=now:
        now=i[0]-i[1]
        ans+=1
print(ans)
n = int(input())
xl = sorted([list(map(int, input().split())) for _ in range(n)])
now = 0
ans = 0
for x,l in xl:
    if now < x:
        now += l
        ans += 1
print(ans)
n=int(input())
l=[]
for i in range(n):
    a,b=map(int,input().split())
    l.append([a-b+1,i])
    l.append([a+b,i])
l.sort()
re=0
c=[0]*n
f=0
di=set([])
for i in range(n*2):
    p=l[i][0]
    j=l[i][1]
    if c[j]==0:
        c[j]+=1
        f+=1
        #di.add(j)
    else:
        f-=1
        re+=f
print(n-re)
n = int(input())
robots = [list(map(int,input().split())) for _ in range(n)]
robots.sort()
current = -float('inf')
ans = n
for x,l in robots:
    if x - l < current:
        ans -= 1
    else:
        current = x + l - 1
print(ans)
n=int(input())
xl=[list(map(int,input().split())) for _ in range(n)]
xl.sort(key=lambda x: x[0])
ans=1
for i in range(n-1):
  if sum(xl[i])<xl[i+1][0]:
    ans+=1
print(ans)
n=int(input())
li=[]
for i in range(n):
  tmpli=list(map(int, input().split()))
  li.append(tmpli)
li.sort()
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] = li[i][0]
    li[i+1][1] = li[i][1]
    n -= 1
print(n)
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[0], reverse =  True)
target.sort(key = lambda x: x[1])
answer = 0
before_s, before_e = -float("inf"), -float("inf")
# print(target)
for s, e in target:
    # print(before_s, before_e, s, e)
    if before_s <= s < before_e or before_s < e <= before_e or s <= before_e <= e:
        # print(1, before_s, before_e, s, e)
        answer += 1
    else:
        before_s = s
        before_e = e
print(length - answer)
n = int(input())
prev_x = 0
prev_l = 0
sum = n
d = {}
for i in range(n):
  x,l = map(int, input().split())
  d[x] = l
d_sorted = sorted(d.items(), key=lambda x:x[0])

count = 0
for x,l in d_sorted:
    if count == 0:
      count = count + 1
      prev_x, prev_l = x, l
      continue
    if x - l < prev_x + prev_l:
      sum = sum -1
      i = i + 1
    else:
      prev_x, prev_l = x, l
    count = count + 1
print(sum)
'''

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

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())
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[1])
#print(R)
for i in range(1,N):
  if R[i][0]>R[i-1][1]:
    cnt+=1
print(cnt)
N = int(input())
robots = [tuple(map(int,input().split())) for _ in range(N)]

print(robots)
# 最大値と最小値を計算する
robots = [(x+l,x-l) for x,l in robots]
print(robots)
# ソートする
robots.sort()
print(robots)

cnt = 0
last = -float('inf')
for r,l in robots:
    print(last, l, r)
    # 1個前の最大値を、今回の最小値が上回っていたらOK
    if last <= l:
        cnt += 1
        # 次の最大値を更新する
        last = r

print(cnt)
a = int(input())
fanwei = []

for i in range(a):
    one = input().split()
    one = [int(i) for i in one]
    fanwei.append(one)

fanwei = sorted(fanwei, key=lambda student: 1000000000 * student[0] + student[1])


now = -1000000000
ans = 0
for i in fanwei:
    down = i[0] - i[1]
    if down >= now:
        ans += 1
        now = i[0] + i[1]

print(ans)
import numpy as np

stdin = np.fromstring(open(0).read(), np.int64, sep=' ')
N = stdin[0]
XL = stdin[1:].reshape(-1, 2).T
x = XL[0]
l = XL[1]
arg = np.argsort(x)
x = x[arg]
l = l[arg]

count = 0
i = 0
while i < N - 1:
    for j in range(i + 1, N):
        if x[i] + l[i] > x[j] - l[j]:
            count += 1
            j = j + 1
        else:
            i = j
            break
    else:
        break
print(N - count)
N = int(input())

robot = [[0 for i in range(3)] for j in range(N)]

for k in range(N):
    x, l = [int(l) for l in input().split()]
    robot[k][0] = x
    robot[k][1] = x - l
    robot[k][2] = x + l

robot = sorted(robot)

#print(robot)

count = 0

for m in range(N-1):
    try:
        if (robot[m][2] > robot[m+1][1]):
            del robot[m+1]
            N = N-1
        else:
            continue
    except:
        break

print(len(robot))
n = int(input())
arr = []
for i in range(n):
    x,y= map(int,input().split())
    res = [x-y+1+100000000000,x+y-1+100000000000]
    arr.append(res)
arr.sort()
if n==1:
    print(n)
else:
    end = arr[0][1]
    mini = 0
    for i in range(1,n):
        if arr[i][0] < end:
            end = min(end,arr[i][1])
            mini+=1
        else:
            end =arr[i][1]
    print(n-mini)
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 = 1; t = ls[0][0] + ls[0][1]
    for i in range(1,n):
        if t <= ls[i][0] - ls[i][1]:
            ans += 1
            t = ls[i][0] + ls[i][1]
    print(ans)


if __name__ == "__main__":
    main()
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())
XL = [list(map(int, input().split())) for x in range(N)]

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

cnt = 0
prev_right = -100000000000
for x, l in XL:
    left = x - l + 1
    right = x + l - 1
    if left <= prev_right:
        cnt += 1
    else:
        prev_right = right

print(N-cnt)
n = int(input())
xl = sorted([list(map(int, input().split())) for _ in range(n)])
x, l = zip(*xl)
cnt = 1
now = 0
right = 0
for right in range(n):
  if x[now]+l[now] <= x[right]-l[right]:
    cnt += 1
    now = right
print(cnt)
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[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)
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)]

remove = [0] * N
count = 1
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:
        count += 1
        i += 1
    else:
        del LR[i]

print(count)
N = int(input())

#改行入力 X,Y
L = [[0,0,0,0] for i in range(N)]
t=-1*(10**9)
s=0
for i in range(N):
    L[i][0],L[i][1] = map(int,input().split())
    L[i][2]=L[i][0]+L[i][1]
    L[i][3]=L[i][0]-L[i][1]

L=sorted(L)

for i in range(N):
    if(t>L[i][3]):
        continue
    else:
        s+=1
        t=L[i][2]


print(s)
n=int(input())
data=[]
for i in range(n):
    x,l=map(int,input().split())
    data.append([x,l])
data.sort()
ans=1
arm=data[0][0]+data[0][1]
for i in range(n):
    if arm<=data[i][0]-data[i][1]:
        ans+=1
        arm=data[i][0]+data[i][1]
print(ans)
n = int(input())
dic = {}

for i in range(n):
    inp = list(map(int, input().split()))
    dic[inp[0]] = inp[1]

dic = sorted(dic.items())
pre = dic[0][0]+dic[0][1]
ans = 1

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

print(ans)
from operator import itemgetter
N = int(input())
arms = []
finishtime = float('-inf')
for i in range(N):
    x,l = map(int,input().split())
    arms.append((x-l,x+l))
arms.sort(key=itemgetter(1))
cnt=0
for L,R in arms:
    if R >= finishtime:
        cnt+=1
        finishtime = R
print(cnt)
def resolve():
	n = int(input())
	robots = [list(map(int, input().split())) for _ in range(n)]
	robots.sort(key=lambda x: x[0])
	t = robots[0][0] + robots[0][1] - 1
	a = n
	for i in range(1, n):
		if t < robots[i][0] - robots[i][1]:
			t = robots[i][0] + robots[i][1] - 1
		else:
			a -= 1
	print(a)
resolve()
a = int(input())
fanwei = []

for i in range(a):
    one = input().split()
    one = [int(i) for i in one]
    two = [one[0] - one[1], one[0] + one[1]]
    fanwei.append(two)

fanwei = sorted(fanwei, key=lambda student: 10000000000 * student[0] + student[1])


now = -100000000000
ans = 0
for i in fanwei:
    down = i[0] - i[1]
    if down >= now:
        ans += 1
        now = i[0] + 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 = 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
    else:
        l0, r0 = l, r
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[0])
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)
import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
N = int(input())
a = []
x = -float("inf")
res = 0
for _ in range(N):
  x, l = map(int, input().split())
  a.append((x - l + 1, x + l))
a.sort(key = lambda x: x[0])
x = -float("inf")
#print(a)
for i in range(N):
  if x < a[i][0]:
    x = a[i][1]
    res += 1
print(res)
#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
X.sort()
Y = []
Y.append(X[0])

sum = 1
worm = X[0] + L[0]
while worm <= X[-1]:
    worm = bi.bisect_left(X, worm)
    worm = X[worm] + 2*L[i]
    sum += 1

print(sum)
N = int(input())
R = [list(map(int, input().split())) for _ in range(N)]
R.sort()
X,L = [],[]
for _ in range(N):
	tx,tl = R.pop(0)
	X.append(tx)
	L.append(tl)

cnt = 0
p = 0
for i in range(N):
	if i == 0:
		p += L[i]
		continue
	tmp = X[i]-L[i]
	if tmp < p:
		cnt += 1
		continue
	else:
		p = X[i] + L[i]
		
print(N-cnt)
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 = 1
t = XL[0][1]
for i in range(1,N):
    if t < XL[i][1]:
        ans += 1
        t = XL[i][1]
print(ans)
N = int(input())
X = []
for i in range(N):
    X.append(list(map(int, input().split())))
X.sort()

count = N
temp = X[0][0] + X[0][1]
for i in range(N - 1):
    if X[i + 1][0] - X[i + 1][1] < temp:
        count -= 1
    else:
        temp = X[i + 1][0] + X[i + 1][1]

print(count)
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
if n==1:
  print(1)
elif n==2:
  for i in range(n-1):
    if l[i][0]+l[i][1]>l[i+1][0]-l[i+1][1]:
      print(1)
    else:
      print(2)
else:
  ans=0
  for i in range(1,n-1):
    if l[i][0]+l[i][1]>l[i+1][0]-l[i+1][1]:
      ans+=1
      if l[i-1][0]+l[i-1][1]>l[i+1][0]-l[i+1][1]:
        ans+=1
  print(n-ans)
N = int(input())
robots = {}
for _ in range(N):
    pos,armlen = map(int,input().split())
    robots[pos] = armlen

robots = sorted(robots.items(),key=lambda x:x[0])
range_min = robots[0][0] + robots[0][1]
ans = 1
for robot in robots[1:]:
    pos,armlen = robot
    if 0 <= (pos-armlen) <= range_min:
        ans += 1
        range_min = pos+armlen

print(ans)
N = int(input())
XL = []
for n in range(N):
    XL.append([int(x) for x in input().split()])
XL = sorted(XL, key=lambda x:(x[0],x[0]+x[1]))
m = -float("inf")
ans = 0
for n in range(N):
    if max(XL[n][0]-XL[n][1],-1)+1 >= m:
        ans += 1
        m = XL[n][0]+XL[n][1]
print(ans)
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)
def main():
    import sys

    readline = sys.stdin.readline

    N = int(readline())
    XL = [list(map(int, readline().split())) for _ in [0] * N]
    arm = [(x + length, x - length) for x, length in XL]
    arm.sort()
    time, ans = 0, 0
    for i in range(N):
        end, start = arm[i]
        if time < start:
            ans += 1
            time = end
    print(ans)


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

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

mlist.sort()

cur = -10*10
ans=0
for i in range(N):
    if mlist[i][1] >= cur:
        ans+=1
        cur = mlist[i][0]
print(ans)
def main():
    import sys

    readline = sys.stdin.readline

    N = int(readline())
    XL = [list(map(int, readline().split())) for _ in [0] * N]
    arm = [(x + length, x + length) for x, length in XL]
    arm.sort()
    time, ans = 0, 0
    for i in range(N):
        end, start = arm[i]
        if time <= start:
            ans += 1
            time = end
    print(ans)


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

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

for i in range(1,n):
    if ls[i][0] >= ls[i-1][1]:
        ans += 1
        
print(ans)
n = int(input())

robot_list = []

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

delete_robot = 0
robot_list.sort()
temp_robot = robot_list[0]

for i in range(n-1):
    if temp_robot[0] < robot_list[i+1][1]:
        delete_robot += 1
    else:
        temp_robot = robot_list[i+1]

print(n - delete_robot)
from operator import itemgetter

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

print(ans - cnt)
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
    if now[0]>i[0]:
        out+=1
        continue
    now[0]=i[0]+i[1]
print(len(a)-out)
# coding: utf-8

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

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

for i in range(N):
    if robots[i][-1]:
        continue
    if i != N-1:
        if robots[i][0] + robots[i][1] - 1 >= robots[i+1][0] - robots[i+1][1] + 1:
            robots[i+1][-1] = True

ans = 0
for robot in robots:
    if not robot[-1]:
        ans += 1

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] and XL[i]:
        ans += 1
        t = XL[i][1]
print(ans)
N = int(input())
MAX_list = []
ans = 0
A = -10**9

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 = sorted(list(map(int, input().split())) for _ in range(N))

i, j = 0, 1
count = N
while i < count - 1:
  if XL[i][0] + XL[i][1] > XL[j][0] - XL[j][1]:
    if XL[i][0] + XL[i][1] < XL[j][0] + XL[j][1]:
      j += 1
    else:
      i, j = j, j + 1
    count -= 1
  else:
    i, j = j, j + 1
print(count)
n = int(input())
xl = sorted([tuple(map(int, input().split())) for _ in range(n)])

tmp = sum(xl[0])

res = 0
for i in range(1, n):
    x, l = xl[i]
    if tmp > x-l:
        res += 1
    tmp = min(tmp, x+l)

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


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

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

pre = 0
cnt1 = 0
xl = xl[::-1]
for x, l in xl:
    if pre == 0:
        pre = x + l
        continue

    if x - l > pre:
        cnt += 1
    else:
        pre = x + l

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

ans = 0
last = -1e10
for r, l in R:
    if last < l:
        ans += 1
        last = r
print(ans)
n = int(input())
lis = []
for i in range(n):
    a,b =map(int,input().split())
    lis.append([a-b,a+b])
lis.sort()
dp = {(-2 * 10 ** 9,0)}
for aa,bb in lis:
    now = set()
    for nowa,ans in dp:
        if nowa <= aa:
            now.add((bb,ans+1))
    dp = now
an = 0
for aaa,ans in dp:
    an = max(an,ans)
print(an)
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 = 0
now = np.zeros(n, dtype="float32")

for i in range(n):
    robot_i = robot[i]
    a, l = robot_i
    if sum(now[a-l:a+l]) == 0:
        now[a-l:a+l] += 1
        ans += 1
print(ans)
N = int(input())
robot = []

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

count = 0
pos = -10000000000

for elem in robot:
    if elem[0] >= pos + elem[1]:
        count += 1
        pos = elem[0] + elem[1]

print(count)
n=int(input())
lo=[]
sh=[]

result=0

MAX = -10000000000

for i  in range(n):
    xx,ll=map(int, input().split())
    lo.append(xx+ll)
    sh.append(xx-ll)
    

c=zip(sh,lo)
d=sorted(c)

for i in range(n):
    if d[i][0] >= MAX:
        result+=1
        MAX=d[i][1]

print(result)
import sys
input = sys.stdin.readline
N = int(input())
XL = []
for _ in range(N):
    XL.append([int(x) for x in input().split()])
ans = N
XL = sorted(XL, key=lambda x:x[0])
for i in range(N-1):
    X, L = XL[i]
    X_, L_ = XL[i+1]
    if X + L > X_ - L_:
        ans -= 1
        XL[i+1] = [-10 ** 10, -10 ** 10]
print(ans)