Hamster and Equation
题号:NC221649
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

To proof himself is no longer a pupil, Hamster is going to solve a math problem from his brother in junior high school.

His brother is learning the quadradic equation recently, and his teacher give him a problem like this:

Find all the solution of the following equation: 

where  are all integers in range  and  is a given consistant.

Hamster doesn't know how to solve this equation due to his poor math skills, so now he turns to your help.

Can you tell him the number of valid solutions for this equation?

Note: Two Solutions are considered different if there exists an integer  such that  is different for two solutions.

输入描述:

The test files contain one or more test cases, the first line contains a integer , representing the number of test cases in this file.

For the following  lines, each line contains two integers , the constant of this equations. Here .

It is guaranteed that  for all the test cases.

输出描述:

For each test case, output one integer  in a single line, representing the number of solutions for each given .
示例1

输入

复制
3
1 1
1 2
1 3

输出

复制
33
20
16