There is an undirected graph with N vertices, numbered 0 through N−1. The graph is simple, so it has no loops, and at most one edge joins any two vertices.
A graph is an Euler graph if it is connected and it has a closed walk that uses every edge exactly once. A closed walk is a walk whose first and last vertices are the same. Connected here means that all N vertices sit in one piece.
A graph is an almost Euler graph if adding one edge to it or removing one edge from it produces an Euler graph. When you add an edge, you may not create a loop and you may not add an edge that is already present. Every Euler graph is also an almost Euler graph.
Given N, write a program that counts the distinct almost Euler graphs on N vertices. Two graphs are distinct if some edge (i,j) with 0≤i<j≤N−1 is present in one graph and absent from the other.