Time Limit: 2 Seconds
Memory Limit: 65536 KB
Bob had been taking part in a summer training. Members of this training were
required to sign in every day and they can earn points from that. No points were
earned when Bob did not sign in. Points earned from each signing in is the
points earned the day before plus one.
Unfortunately, Bob was absent at some days for various reasons. In order to get
more points, he found some special cards. One card can turn one absent day
signed in. Additionally, cards can only be used on days earlier than the last
day that he signed in.
Bob hopes you can help him find a way to get points as many as possible.
The first line contains an integer T — the number of test cases.
In each test case, two integers n and k are given in the first line. n is the number of periods of time (1 ≤ n ≤ 400), and k is the number of cards (1 ≤ k ≤ 50).
Each of the following n lines contains two numbers li and ri (1 ≤ li < r