LogiQuest

147. Sum of Two Squares

MediumTwo PointersMath

Print YES if n = a² + b² for some non-negative integers a and b, else NO.

Input format

A single integer n.

Output format

YES or NO

Example 1

Input

5

Output

YES

Example 2

Input

3

Output

NO

Constraints

0 ≤ n ≤ 10¹²

Read input from standard input and print the answer to standard output. Your code is judged against 6 test cases, most of them hidden.

Loading the MyLoginn IDE…