Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
def main():
  n = int(input())
  xl = []
  ans = 0
  for i in range(n):
    xl.append(list(map(int, input().split())))
    xl.sort(key = lambda x:x[1])
    road = set()
  for i in range(n):
    sub = {}
    location = xl[i][0]
    arm = xl[i][1]
    sub = {j for j in range(location-arm+1, location+arm)}
    num_sub = len(sub)
    num_road = len(road)
    Z = road|sub
    if len(Z) ==num_sub + num_road:
      road = Z
      ans += 1

  print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
def main():
  n = int(input())
  xl = []
  ans = 0
  for i in range(n):
    xl.append(list(map(int, input().split())))
    xl.sort(key = lambda x:x[1])
    road = set()
  for i in range(n):
    sub = {}
    location = xl[i][0]
    arm = xl[i][1]
    sub = {j for j in range(max(0, location-arm+1), location+arm)}
    num_sub = len(sub)
    num_road = len(road)
    Z = road|sub
    if len(Z) ==num_sub + num_road:
      road = Z
      ans += 1

  print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
def main():
  n = int(input())
  xl = []
  ans = 0
  for i in range(n):
    xl.append(list(map(int, input().split())))
    xl.sort(key = lambda x:x[1])
    road = set()
  for i in range(n):
    sub = {}
    location = xl[i][0]
    arm = xl[i][1]
    sub = {j for j in range(max(0, location-arm+1), location+arm)}
    num_sub = len(sub)
    num_road = len(road)
    Z = road|sub
    if len(Z) ==num_sub + num_road:
      road = Z
      ans += 1

  print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
xl = []
ans = 0
for i in range(n):
  xl.append(list(map(int, input().split())))
xl.sort(key = lambda x:x[1])
road = set()
for i in range(n):
  sub = {}
  location = xl[i][0]
  arm = xl[i][1]
  sub = {j for j in range(max(0, location-arm+1), location+arm)}
  num_sub = len(sub)
  num_road = len(road)
  Z = road|sub
  if len(Z) ==num_sub + num_road:
    road = Z
    ans += 1

print(ans)

Fixed submission:
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)