Can't understand the output

Can someone explain me how this output

1 50
KA01MQ9999 7
2
KA01MP9000 5 10
KA01MR0005 5 7

The correct output will be 2

No person can be accomodated in the first car as the difference is more than k(50). Only 2 vacant position is there in second car. So 2 passengers can be accomodated and that is the reason output is 2.

But the difference between 9999 and 0005 is also greater than k(50). then how can we accomodated the passengers

Look into the description of the problem. Following statements can help you to understand it clearly.

KA01AA0001 is the number of the first vehicle registered.
KA01AA0002 is the number of the second vehicle registered.
KA01AB0001 is the number of the 10,000th vehicle registered
KA01BA0001 is the number of the 2,59,975th vehicle registered.
KA02AA0001 is the number of the 67,59,325th vehicle registered.

We can’t assume that k is the difference of last four digits only. But it is the differe difference of whole number plate.

Closing this topic as your issue has been resolved by the community. If not Kindly un-mark the accepted solution to re-open the topic or feel free to create a new topic and post a link to this topic as a reference.