int ans=max(cnt-1,(t-1)/2);
t i guess is the count of the nodes with odd number of vertices and cnt is the number of components in the editorial
(t-1)/2 can unite the vertices with odd degree.
and -1 mayb because in EULER PATH, there can be 2 vetrices of odd degree
but where did the cnt-1 come from…
EDIT: i am doing it without cnt-1 as mentioned in the editorial and getting RE in only one case…i downloaded the test case and its working on my laptop
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PB push_back
#define FI first
#define SE second
#define MP make_pair
#define ALL(cont) cont.begin(), cont.end()
#define MOD 1000000007ll
#define SIZE 105000
vector<ll>adj[SIZE];
bool visited[SIZE];
ll dfs(ll nd)
{
visited[nd] = true;
ll val = (adj[nd].size())%2;
for(auto it:adj[nd])
{
if(!visited[it])
val+=dfs(it);
}
return val;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
for(ll i=0;i<SIZE;i++)
{
visited[i] = false;
adj[i].clear();
}
ll m,a,b,c,d;
map<pair<ll,ll>,ll>um;
ll idx = 0;
cin>>m;
for(ll i=0;i<m;i++)
{
cin>>a>>b>>c>>d;
pair<ll,ll>q = MP(a,b);
pair<ll,ll>r = MP(c,d);
if(um.find(q)==um.end())
um[q] = idx++;
if(um.find(r)==um.end())
um[r] = idx++;
adj[um[q]].PB(um[r]);
adj[um[r]].PB(um[q]);
}
ll ans = 0;
for(ll i=0;i<idx;i++)
{
if(!visited[i])
ans += max(2ll,dfs(i));
}
cout<<(ans/2-1);
return 0;
}