You are given an undirected graph . Let us define a square as any cycle of length exactly four in . Can you count the number of squares in ?
Input consists of several cases. Every case begins with two natural numbers and , which are respectively the number of vertices and the number of edges of . Follow pairs to indicate that there is an edge connecting vertices and . Assume and . Vertices are numbered starting at 0. There are no edges of the kind , nor repeated edges.
For every given , print its number of squares.
Author: Salvador Roura
Generation: 2026-01-25T12:23:07.685Z
© Jutge.org, 2006–2026.
https://jutge.org