Language: Java

import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;

import javafx.util.Pair;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sn = new Scanner(System.in);
        Input inputN = InputParser.perse(sn, 1);
        int n = inputN.getInt(1, 1);

        Input input = InputParser.perse(sn, n);
        sn.close();

        List<Integer> x = input.getIntVerticalLine(1, 1, n);
        List<Integer> l = input.getIntVerticalLine(2, 1, n);

        List<Pair<Integer, Integer>> list = new ArrayList<>();

        for (int i = 0; i < x.size(); i++) {
            Pair<Integer, Integer> p = new Pair<>(x.get(i), l.get(i));
            list.add(p);
        }
        list = list.stream().sorted(Comparator.comparing(Pair::getKey)).collect(Collectors.toList());

        int max = 0;
        List<Integer> chain = new ArrayList<>();
        boolean isChain = false;
        for (int i = 0; i < list.size(); i++) {
            if (i == list.size() - 1) {
                if (isChain) {
                    chain.set(chain.size() - 1, chain.get(chain.size() - 1) + 1);
                } else {
                    max++;
                }
            } else if (list.get(i + 1).getKey() - list.get(i + 1).getValue() < list.get(i).getKey() + list.get(i).getValue()) {
                if (isChain) {
                    chain.set(chain.size() - 1, chain.get(chain.size() - 1) + 1);
                } else {
                    chain.add(1);
                }
                isChain = true;
            } else {
                max++;
            }
        }
        for (int i = 0; i < chain.size(); i++) {
            max += Math.ceil(1.0 * chain.get(i) / 2);
        }
        System.out.println(max);
    }

    private static class InputParser {
        static Input perse(Scanner sn, int loop) {
            Input result = new Input();
            while (loop-- > 0) {
                String[] args = sn.nextLine().split(" ");
                result.addAll(args);
            }
            return result;
        }
    }

    private static class Input {
        private Map<Integer, Map<Integer, String>> inputs;
        private int now = 1;
        private int innerNext = 1;

        Input() {
            inputs = new HashMap<>();
            inputs.put(now, new HashMap<>());
        }

        void addAll(String[] args) {
            for (String str : args) {
                add(str);
            }
            next();
        }

        void add(String str) {
            inputs.get(now).put(innerNext++, str);
        }

        void next() {
            inputs.put(++now, new HashMap<>());
            innerNext = 1;
        }

        String getString(int i, int j) {
            return inputs.get(i).get(j);
        }

        int getInt(int i, int j) {
            return Integer.parseInt(getString(i, j));
        }

        double getDouble(int i, int j) {
            return Double.parseDouble(getString(i, j));
        }

        List<Integer> getIntLine(int i) {
            return inputs.get(i).entrySet().stream().map(e -> Integer.parseInt(e.getValue()))
                    .collect(Collectors.toList());
        }

        List<Integer> getIntVerticalLine(int line, int start, int size) {
            List<Integer> list = new ArrayList<>();
            for (int i = start; i < start + size; i++) {
                list.add(getInt(i, line));
            }
            return list;
        }
    }
}


Compiler output:
Main.java:9: error: package javafx.util does not exist
import javafx.util.Pair;
                  ^
Main.java:24: error: cannot find symbol
        List<Pair<Integer, Integer>> list = new ArrayList<>();
             ^
  symbol:   class Pair
  location: class Main
Main.java:27: error: cannot find symbol
            Pair<Integer, Integer> p = new Pair<>(x.get(i), l.get(i));
            ^
  symbol:   class Pair
  location: class Main
Main.java:27: error: cannot find symbol
            Pair<Integer, Integer> p = new Pair<>(x.get(i), l.get(i));
                                           ^
  symbol:   class Pair
  location: class Main
Main.java:30: error: cannot find symbol
        list = list.stream().sorted(Comparator.comparing(Pair::getKey)).collect(Collectors.toList());
                                                         ^
  symbol:   variable Pair
  location: class Main
5 errors