#P9783. [ROIR 2020] 平方 (Day1)

[ROIR 2020] 平方 (Day1)

Problem Description

Translated from ROIR 2020 Day1 T1. Разность квадратов, 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 nn, the module under development needs to find two positive integers xx and yy such that x2y2=nx^2-y^2=n, where x,yx,y do not exceed 26212^{62}-1.

You need to write a program that, for a given non-negative integer nn, finds two natural numbers xx and yy such that both of them do not exceed 26212^{62}-1 and their difference of squares is nn.

Input Format

One line with one integer nn.

Output Format

If such x,yx,y exist, print two lines. The first line should be the single string Yes. The second line should print any one pair x,yx,y.

If no such pair exists, output No.

3
Yes
2 1
2
No

Hint

For 100%100\% of the testdata, 0n2600\le n\le 2^{60}.

Constraints

Task ID nn Score
11 0n2100 \leq n \leq 2^{10} 1010
22 0n2200 \leq n \leq 2^{20} 2020
33 0n2300 \leq n \leq 2^{30} 3030
44 0n2600 \leq n \leq 2^{60} 4040

Translated by ChatGPT 5