Company: Intuit_8feb
Difficulty: medium
Louie and Pairs Problem Description Louie wants to determine the number of ordered pairs (x, y) such that 1 ≤ x ≤ bound_x and 1 ≤ y ≤ bound_y, and the following equation has an integer value: (√x + √y) 2 . Note: pairs (1, 2) and (2, 1) are different, so they should be considered twice in the final answer. Input The first line of input contains an integer bound_x . The second line of input contains an integer bound_y . Output The number of ordered pairs (x, y) such that the following equation - (√x + √y) 2 - has an integer value. Constraints 1 ≤ bound_x, bound_y ≤ 7 * 10 5 Examples Example 1: Input: 1 5 Output: 2 Explanation: Two pairs give an integer value when inserted in the equation: (√1 + √1) 2 = √1 2 + 2*√1*√1 + √1 2 = 1 + 2 + 1 = 4 (√1 + √4) 2 = √1 2 + 2*√1*√4 + √4 2 = 1 + 4 + 4 = 9 Example 2: Input: 2 2 Output: 2 Explanation: There are two pairs out of four possible