## Adding Squares Codechef October Long challenge Problem Code-

### problem Statement-

There are different vertical lines on the plane, -th of which is defined by the equation () and different horizontal lines, -th of which is defined by the equation (). You must add one line of the form (, for every ) to the plane. What is the maximum possible number of squares with different areas you can obtain on the plane? (Squares can have other lines passing through them)

### Input:

- First line will contain integers , , ,
- Second line will contain different integers
- Third line will contain different integers

### Output:

Output the maximal possible number of squares with different area on the plane after adding a new line.

### Constraints

- for every
- for every

### Subtasks

- 50 points :
- 50 points : Original constraints

### Sample Input:

```
10 10 3 3
3 6 8
1 6 10
```

### Sample Output:

```
3
```

### Explanation:

You can get different squares if you add a line . The three squares are:

- Square with top-left corner at (6, 6) and bottom-right corner at (8, 4) with an area of 4.
- Square with top-left corner at (3, 4) and bottom-right corner at (6, 1) with an area of 9.
- Square with top-left corner at (3, 6) and bottom-right corner at (8, 1) with an area of 25.

## Comments

## Post a Comment