eolymp
bolt
Try our new interface for solving problems
Problems

Gergs cake

Gergs cake

Gerg is having a party, and he has invited his friends. \textbf{p} of them have arrived already, but \textbf{a} are running late. To occupy his guests, he tried playing some team games with them, but he found that it was impossible to divide the p guests into any number of equal-sized groups of more than one person. Luckily, he has a backup plan - a cake that he would like to share between his friends. The cake is in the shape of a square, and Gerg insists on cutting it up into equal-sized square pieces. He wants to reserve one slice for each of the a missing friends, and the rest of the slices have to be divided evenly between the p remaining guests. He does not want any cake himself. Can he do it? \InputFile The input will consist of several test cases. Each test case will be given as a non-negative integer \textbf{a} and a positive integer \textbf{p} as specified above, on a line. Both \textbf{a} and \textbf{p} will fit into a \textbf{32}-bit signed integer. The last line will contain "\textbf{-1 -1}" and should not be processed. \OutputFile For each test case, output "\textbf{Yes}" if the cake can be fairly divided and "\textbf{No}" otherwise.
Time limit 1 second
Memory limit 64 MiB
Input example #1
1 3
1024 17
2 101
0 1
-1 -1
Output example #1
Yes
Yes
No
Yes