Problems > Two Piles, Diagonal Moves

Two Piles, Diagonal Moves

Difficulty: 2100 4000 ms 128 MB

math games

Two piles of sizes A and B. A move either removes any positive number from ONE pile, or removes the SAME positive number from BOTH piles. Last to move wins. Determine the winner.

Input: one line with two integers A and B.

Output: FIRST or SECOND.

Constraints:

  • 0 ≤ A, B ≤ 109

Sample Tests

Input 1
1 2
Output 1
SECOND
Input 2
0 0
Output 2
SECOND
Input 3
3 5
Output 3
SECOND

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.