Algorithms and Data Structures

• Status
• 1
Implementation
• 2
Bitwise operations
• 3
Prefix Sums
• 4
Sliding window / Two pointers
• 5
Modular Arithmetic
• 6
Number Theory
• 7
Binary Search
• 8
Basic Sorting
• 9
Greedy Algorithms

• # Best matcher

You’ve decided to implement the simplest version of a dating app. For that, you’ve decided to collect the heights of boys as and the heights of girls . You’ve decided to match as many pairs as possible (one person can only be matched once). And you think that couples will be okay if the girl’s height is not shorter than the boy’s by `x` and the girl is not taller than the boy by more than `y`.
You’d like to match as many pairs as possible.

#### Input

The first line of the input contains a 4 integers `n`, `m` (1 ≤ n, m ≤ ), `x`, and `y` (0 ≤ x, y ≤ ) - the number of boys, the number of girls, and the bounds for acceptable heights. The next line contains n integers representing the heights of the boys (1 ≤ ). The line after that contains m integers representing the heights of the girls (1 ≤ ).

#### Output

The program should print the maximum number of pairs matched.

#### Examples

 Input Output 6 2 0 0 1 2 3 4 5 6 6 7 1 3 3 1 1 4 5 6 3 4 7 3