CF924F Minimal Subset Difference
Description
We call a positive integer $ x $ a $ k $ -beautiful integer if and only if it is possible to split the multiset of its digits in the decimal representation into two subsets such that the difference between the sum of digits in one subset and the sum of digits in the other subset is less than or equal to $ k $ . Each digit should belong to exactly one subset after the split.
There are $ n $ queries for you. Each query is described with three integers $ l $ , $ r $ and $ k $ , which mean that you are asked how many integers $ x $ between $ l $ and $ r $ (inclusive) are $ k $ -beautiful.
Input Format
N/A
Output Format
N/A
Explanation/Hint
If $ 1