SP14542 PYTRIP2 - Pythagorean triples (medium)

Description

Pythagoras is credited, by tradition, for the first proof of the relation **_a_ $ ^{2} $ + _b_ $ ^{2} $ = _c_ $ ^{2} $** in any right angled triangle where **_c_** is hypotenuse and **_a_** and **_b_** are the [catheti](http://en.wikipedia.org/wiki/Cathetus). We define a Pythagorean triple as a set of three positive integers **_a_**, **_b_**, and **_c_** which satisfy the above equation , ie , **_a_ $ ^{2} $ + _b_ $ ^{2} $ = _c_ $ ^{2} $** . {3,4,5} is the most common example of such triples.

Input Format

The first line of input contains an integer **_T_**, the number of test cases. Each of the next **_T_** lines contains two integers **_N_**, **_M_**.

Output Format

For each test case, print on a single line the number of Pythagorean triplet **_{a,b,c}_** such that **_N_** .