P9783 [ROIR 2020] Squares (Day1)

Description

**Translated from [ROIR 2020](http://neerc.ifmo.ru/school/archive/2019-2020.html) Day1 T1.** ***[Разность квадратов](http://neerc.ifmo.ru/school/archive/2019-2020/ru-olymp-regional-2020-day1.pdf), translator ShineEternal*** You are involved in developing a module for a symbolic computation system. It will be used to solve a special type of Diophantine equation, described as follows: Given a non-negative integer $n$, the module under development needs to find two positive integers $x$ and $y$ such that $x^2-y^2=n$, where $x,y$ do not exceed $2^{62}-1$. You need to write a program that, for a given non-negative integer $n$, finds two natural numbers $x$ and $y$ such that both of them do not exceed $2^{62}-1$ and their difference of squares is $n$.

Input Format

One line with one integer $n$.

Output Format

If such $x,y$ exist, print two lines. The first line should be the single string `Yes`. The second line should print any one pair $x,y$. If no such pair exists, output `No`.

Explanation/Hint

For $100\%$ of the testdata, $0\le n\le 2^{60}$. # Constraints | Task ID | $n$ | Score | | :-----: | :--------------------: | :---: | | $1$ | $0 \leq n \leq 2^{10}$ | $10$ | | $2$ | $0 \leq n \leq 2^{20}$ | $20$ | | $3$ | $0 \leq n \leq 2^{30}$ | $30$ | | $4$ | $0 \leq n \leq 2^{60}$ | $40$ | Translated by ChatGPT 5