@Override public int compareTo(Pair p) {
            long diff = (to - from) - (p.to - p.from);
            if (diff > 0)
                return -1;
            else if (diff < 0)
                return 1;
            return (p.from - from) < 0 ? 1 : -1;
        }
Why Did you create this class? what does it do?
src/codejam2018/Practice4.java