## A. Mathematical Addition

### Solution:

Obviously, when $x=u^2,\ y=-v^2$, the conditions are met.

### Code:

Java

C++

## B. Coloring Rectangles

### Solution:

Divide the total area by 3 is the answer. If it is not divisible by 3, add one. Because if the remainder is 2, a blue block is naturally needed. If the remainder is 1, then it needs to be joined with the area of 3 to form a block of area 4, and a blue block needs to be added.

### Code:

Java

C++

## C. Two Arrays

### Solution:

Obviously, consider the number of occurrences of each number from small to large, and then increase by 1 as less as possible.

### Code:

Java

C++

## D. Guess the Permutation

It is a nice problem for binary search. The cleverness is that for a certain query result, if the x of $\frac {x \cdot (x-1)} 2=result$ has an integer solution, then it's high possiblity that the query interval will not cross j.

## E. Game with Stones

The segment tree + binary search I used here. Seems official tutorial have a more clever solution. But I can also get AC, but it is easier to TLE.