P17147 [ICPC 2017 Xi'an R] Lovers

Description

One day $n$ girls and $n$ boys come to Xi’an to look for a mate. Each girl has a value $a[i]$, each boy has a value $b[i]$. Girl $i$ and boy $j$ will fall in love only if $a[i] + b[j] \ge k$. Please help them make pairs as many as possible.

Input Format

Several test cases. First line an integer $T$ ($1 \le T \le 10$). Indicates the number of test cases. Then $T$ test cases follow. Each test case begins with two integers $N$, $K$ ($1 \le N \le 200000,\ 0 \le K \le 10^9$). The next line has $N$ integers indicating $a[1]$ to $a[N]$ ($0 \le a[i] \le 10^9$). The next line has $N$ integers indicating $b[1]$ to $b[N]$ ($0 \le b[i] \le 10^9$).

Output Format

For each test case, print the answer in a single line.