#t1146. 点到原点的距离平方

点到原点的距离平方

Squared Distance to the Origin

Problem Description

The second lesson on structs: members take part in expressions.

Define a struct that represents a point in the plane:

struct Point {
    int x;
    int y;
};

Read the coordinates of nn points into structs, and for every point print the square of its distance to the origin (0,0)(0,0). By the Pythagorean theorem the squared distance is simply x2+y2x^2 + y^2 — an integer, which neatly avoids the precision trouble of taking square roots.

Input Format

The first line contains a positive integer nn; the next nn lines each contain two integers x,yx, y, the coordinates of one point.

Output Format

nn lines; line ii holds the squared distance from the ii-th point to the origin.

Sample Input

3
3 4
-1 0
0 0

Sample Output

25
1
0

Constraints

For 100% of the test data, 1≤n≤10001 \le n \le 1000 and ∣x∣,∣y∣≤1000|x|, |y| \le 1000.

Hint: print the square of the distance — no square root is needed. The maximum of x * x + y * y is about 2×1062 \times 10^6, which fits comfortably in an int.