A rectangle can be split up into a grid of 1x1 squares, the amount of which being equal to the product of the two dimensions of the rectangle. Depending on the size of the rectangle, that grid of 1x1 squares can also be split up into larger squares, for example a 3x2 rectangle has a total of 8 squares, as there are 6 distinct 1x1 squares, and two possible 2x2 squares. A 4x3 rectangle contains 20 squares.
Your task is to write a function `findSquares` that returns the total number of squares for any given rectangle, the dimensions of which being given as two integers with the first always being equal to or greater than the second.

Difficulty: introductory

Starter code:

def findSquares(x,y):
	

Solutions:
def findSquares(x,y):
    return sum( (x-i) * (y-i) for i in range(y) )

def findSquares(x,y):
    if x > y:
        x, y  = y, x
    return x*(x+1)*(2*x+1)/6 + (y-x)*x*(x+1)/2

def findSquares(x,y):
    return sum((x-i)*(y-i) for i in range(min(x,y)))

def findSquares(x,y):
    squares = 0
    while y > 0:  
        squares = squares + x*y
        x = x-1
        y = y-1
    return squares


findSquares=lambda n,m:m*-~m*(3*n-m+1)//6

def findSquares(x,y):
    S = 0 
    for i in range(y):
        S += (x-i)*(y-i)
        
    return S

def find_squares(x, y):
    return sum((x - k) * (y - k) for k in range(min(x, y)))


findSquares = find_squares

findSquares=lambda m,n:sum((m-i)*(n-i) for i in range(min(m,n)))


def findSquares(x,y):
    return sum((x-i+1)*(y-i+1) for i in range(1,min(x,y)+1))

def findSquares(x,y):
    return sum([(x-i)*(y-i) for i in range(min(x,y))])