Classy Numbers
HardRating 1900CodeforcesAdvanced DP (Bitmask, Digit, Interval)
Approach hintTry it first, then revealHide
Compute f(R) - f(L - 1) with a digit DP over the position, the number of non-zero digits used so far (at most 3) and a tight flag. Remember that the bounds reach 10^18.