structEdge { int to, next; bool ext; } e[maxm]; int c1, head[maxn], du[maxn]; inlinevoidadd_edge(int u, int v){ e[c1].to = v; e[c1].ext = 0; e[c1].next = head[u]; head[u] = c1++; }
vector<pair<int, int>> ans; voiddfs(int u){ for (int &i = head[u]; ~i; i = e[i].next) { int v = e[i].to; bool &ext = e[i].ext, &Ext = e[i ^ 1].ext; if (ext) continue; ext = Ext = 1; dfs(v); ans.emplace_back(v, u); } }
voidinit(){ fill(head, head + maxn, -1); fill(du, du + maxn, 0); c1 = 0; ans.clear(); }
voidwork(){ init(); cin >> n >> m; for (int i = 1; i <= m; ++i) { int x, y; cin >> x >> y; ++du[x]; ++du[y]; add_edge(x, y); add_edge(y, x); } int Ans = 0; for (int i = 1; i <= n; ++i) if (du[i] & 1) add_edge(i, n + 1), add_edge(n + 1, i); else ++Ans; for (int i = 1; i <= n; ++i) dfs(i); cout << Ans << "\n"; for (auto u : ans) if (u.first <= n && u.second <= n) cout << u.first << " " << u.second << "\n"; }