IMO 1971 LL AUT1

The points S(i, j) with integer Cartesian coordinates 0 < i \leqn,

IMO 1971 LL AUT1

Origin: AUT

Problem

The points S(i, j) with integer Cartesian coordinates 0 < i \leqn, 0 < j \leqm, m \leqn, form a lattice. Find the number of: (a) rectangles with vertices on the lattice and sides parallel to the coor- dinate axes; (b) squares with vertices on the lattice and sides parallel to the coordinate axes; (c) squares in total, with vertices on the lattice.