Help me in solving TACHSTCK1 problem

My issue

here D is 10 right? since the atmost difference allowed is 10, we should be able to take both of them as a pair right since 30-20 = 10

Learning course: Greedy Algorithms
Problem Link: CodeChef: Practical coding for everyone