Canonicalized Input Description:

An integer N (6 ≤ N ≤ 6000), representing some quantity.
An integer M (0 ≤ M ≤ N), representing some quantity.
An integer X (0 ≤ X ≤ 6), representing some quantity.
An integer Y (0 ≤ Y ≤ 12), representing some quantity. The relation 2X + Y = 12 always holds.
N integers a_i (1 ≤ a_i ≤ 6000), representing some values.
M integers b_i (1 ≤ b_i ≤ 3000), representing some values, with the relation 1 ≤ a_i - b_i ≤ 3000 holding for corresponding values of a_i.

### Example Input:
```
18 8 3 6
4
3
3
3
3
2
2
2
1
1
1
1
1
2
2
3
3
3
1
1
1
1
1
1
1
1
```

### Function Signature:
Write a function f(N, M, X, Y, lengths, bends) that takes in the input.
```python
def f(N: int, M: int, X: int, Y: int, lengths: List[int], bends: List[int]):
    '''
    Args:
    N (int): An integer between 6 and 6000
    M (int): An integer between 0 and N
    X (int): An integer between 0 and 6
    Y (int): An integer between 0 and 12, where 2X + Y = 12
    lengths (List[int]): A list of N integers between 1 and 6000
    bends (List[int]): A list of M integers between 1 and 3000, where for each i,
                        1 ≤ lengths[i] - bends[i] ≤ 3000
    '''
```