P1636 Einstein Learns to Draw

Description

Einstein has started learning to draw. He is rather lazy, and he hopes to draw a picture using as few strokes as possible. Given an undirected graph with $n$ vertices (numbered $1 \sim n$) and $m$ edges, find the minimum number of strokes needed to draw all the edges in the graph.

Input Format

The first line contains two integers $n, m$. Each of the next $m$ lines contains two integers $a, b$ ($a \ne b$), indicating that there is an edge between vertices $a$ and $b$. No edge is described more than once.

Output Format

A single integer, i.e., the answer.

Explanation/Hint

For $50\%$ of the testdata, $n \le 50$, $m \le 100$. For $100\%$ of the testdata, $1 \le n \le 1000$, $1 \le m \le {10}^5$. Translated by ChatGPT 5