Problems > Coprime or Not

Coprime or Not

Difficulty: 900 2000 ms 128 MB

math

Are A and B coprime (gcd = 1)?

Input: one line with two integers A and B.

Output: YES or NO.

Constraints:

  • 1 ≤ A, B ≤ 1018

Sample Tests

Input 1
8 15
Output 1
YES
Input 2
12 18
Output 2
NO

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.