Polyhedra
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given a sphere, you can slice through the surface of the sphere to make different convex polyhedra. All of these convex polyhedra have the Euler characteristic which can be defined as follows:
where represents the number of vertices, the number of edges and the number of faces on a convex polyhedron.
Input
Begins with the number of test cases . Each test case consists of a single line with two space-separated integers and , representing the number of vertices and edges respectively of the convex polyhedron.
Output
For each test case, print on a single line the number of faces in the defined polyhedron.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 57%