P5596 [XR-4] Problem

Background

**Reminder during the contest: $0$ is a natural number, and natural numbers are non-negative integers.**

Description

X encountered a problem: Given natural numbers $a, b$, find the number of pairs of natural numbers $(x, y)$ that satisfy: $$y^2 - x^2 = ax + b$$ He cannot solve it, so he asks you, who are good at math, for help. If there are infinitely many pairs of natural numbers that satisfy the condition, you only need to output `inf`.

Input Format

One line with two integers $a, b$.

Output Format

If the number is finite, output one integer in one line, representing the count. If the number is infinite, output one string `inf` in one line.

Explanation/Hint

#### Sample #1 Explanation $$(x,y) = (6,9)$$ --- #### Constraints **This problem uses bundled testdata.** - Subtask 1 (3 points): $a = b = 0$. - Subtask 2 (6 points): $0 \le a,b \le 2$, there is no case with an infinite number of solutions. - Subtask 3 (9 points): $0 \le a,b \le 100$, there is no case with an infinite number of solutions. - Subtask 4 (13 points): $0 \le a,b \le 10^3$, there is no case with an infinite number of solutions. - Subtask 5 (14 points): $0 \le a \le 10^4$, $0 \le b \le 10^7$. - Subtask 6 (14 points): $a = 0$. - Subtask 7 (14 points): $b = 0$. - Subtask 8 (27 points): no special constraints. For $100\%$ of the testdata, $0 \le a \le 10^8$, $0 \le b \le 10^{15}$. Translated by ChatGPT 5