AT_abc412_d [ABC412D] Make 2-Regular Graph

Description

There is a simple undirected graph $ G $ with $ N $ vertices and $ M $ edges. The vertices are numbered $ 1, 2, \ldots, N $ , and the $ i $ -th edge is an undirected edge connecting vertices $ A_i $ and $ B_i $ . You can repeat the following two operations in any order and any number of times: - Add one undirected edge to $ G $ - Remove one undirected edge from $ G $ Find the minimum number of operations to make $ G $ a simple undirected graph where all vertices have degree $ 2 $ . What is a simple undirected graph?A simple undirected graph refers to an undirected graph that has no self-loops and no multi-edges.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ M $ $ A_1 $ $ B_1 $ $ \vdots $ $ A_M $ $ B_M $

Output Format

Output the answer.

Explanation/Hint

### Sample Explanation 1 For example, the following three operations make $ G $ a simple undirected graph where all vertices have degree $ 2 $ . - Add an edge connecting vertices $ 2 $ and $ 3 $ . - Remove the edge connecting vertices $ 2 $ and $ 4 $ . - Add an edge connecting vertices $ 3 $ and $ 4 $ . ### Constraints - $ 3 \leq N \leq 8 $ - $ 0 \leq M \leq \frac{N(N-1)}{2} $ - The graph $ G $ given in the input is a simple undirected graph. - All input values are integers.