Problem C
Balancing the Council
The Piltover city council is having an emergency meeting. Despite the gravity of the situation, the council’s bureaucracy compels them to prioritize balancing the seating over actually discussing the situation. In the city town hall, there are $N$ seats and $M$ senators. $N$ is guaranteed to be an even integer. The $N$ seats are spaced evenly in a circle, and each senator will occupy exactly one unique seat. A seating arrangement is called “balanced” if the average of the arrangement is located at the center of the circle.
Suppose the $M$ senators are seated at points $(x_1, y_1), (x_2, y_2), \ldots , (x_M, y_M)$. The average of the arrangement is the point $(A_x, A_y)$, where:
\[ A_x = \frac{x_1 + x_2 + \ldots + x_M}{M} \]\[ A_y = \frac{y_1 + y_2 + \ldots + y_M}{M} \]The center of the circle is the unique point equidistant from all seats. Given the number of seats and senators, is there a balanced arrangement?
Input
The only line of input contains two space-separated integers, $N (4 \le N \le 2 \cdot 10^9), M (1 \le M \le N)$, where $N$ is the number of seats, and $M$ is the number of senators. $N$ is guaranteed to be an even integer.
Output
Output $\texttt{Yes}$ if there exists a balanced arrangement and $\texttt{No}$ otherwise.
Sample Input 1 | Sample Output 1 |
---|---|
6 4 |
Yes |
Sample Input 2 | Sample Output 2 |
---|---|
8 7 |
No |