#if __INCLUDE_LEVEL__ void solve() { auto [n, m] = input(); int S = n + n; int T = S + 1; atcoder::mf_graph g(T + 1); while (m--) { auto [u, v] = input(); --u; --v; assert(u < v); g.add_edge(u, n + v, 1); g.add_edge(v, n + u, 1); } for (v : iota(0, n)) { g.add_edge(S, v, 1); g.add_edge(n + v, T, 1); } int x = g.flow(S, T); show(x); x -= x == n - 1; print(x * 2 - n); } #else // __INCLUDE_LEVEL__ #include #include namespace std { template auto operator>>(istream& is, T&& t) -> decltype(tuple_cat(t), is) { return apply([&is](auto&... xs) -> istream& { return (is >> ... >> xs); }, t); } template auto operator<<(ostream& os, T&& t) -> decltype(tuple_cat(t), os) { auto f = [&os](auto&... xs) -> ostream& { [[maybe_unused]] auto sep = ""; ((os << exchange(sep, " ") << xs), ...); return os; }; return apply(f, t); } template istream& operator>>(istream& is, vector& v) { for (auto&& e : v) { is >> e; } return is; } template ostream& operator<<(ostream& os, const vector& v) { static constexpr auto SEP = is_convertible_v ? " " : "\n"; for (auto sep = ""; const auto& e : v) { os << exchange(sep, SEP) << e; } return os; } } // namespace std template auto input(Args&&... args) { if constexpr (sizeof...(Ts) == 0) { static_assert(sizeof...(Args) == 0); return input(); } else if constexpr (1 < sizeof...(Ts)) { static_assert(sizeof...(Args) == 0); return input>(); } else { using T = std::tuple_element_t<0, std::tuple>; if constexpr (sizeof...(args)) { T x(std::forward(args)...); std::cin >> x; return x; } else { T x; std::cin >> x; return x; } } } template std::array input() { return input>(); } template void print(Ts&&... xs) { std::cout << std::tie(xs...) << '\n'; } using namespace std; #define show(...) static_cast(0) #define for(...) for ([[maybe_unused]] auto&& __VA_ARGS__) #define lambda(...) [&](auto&&... args) { return __VA_ARGS__; } #define $1 get<0>(tie(args...)) #define $2 get<1>(tie(args...)) #define ALL(f, r, ...) lambda(f(begin($1), end($1), ##__VA_ARGS__))(r) namespace std::ranges::views { #include __BASE_FILE__ } // namespace std::ranges::views int main() { ios::sync_with_stdio(false); cin.tie(nullptr); views::solve(); } #endif // __INCLUDE_LEVEL__