Squares in a Matrix
Basic Accuracy: 42.57% Submissions: 9588 Points: 1

Given a MxN matrix, count the number of squares in the matrix.squaresinREct

Input:

The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains two space seperated integers M and N, denoting the size of the Matrix.
Output:

For each test output a single integer denoting the total number of squares.
Constraints:

1 <= T <= 102
1 <= M,N <= 104

Example:

Input:

2
2 2
4 3

Output:

5
20

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.