Language: C++

#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
struct node {
    int to,next;
}E[MAXN * 2];
int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
bool vis[MAXN];
int c[MAXN],tot;
int sta[MAXN],top,num[MAXN];
void add(int u,int v) {
    E[++sumE].to = v;
    E[sumE].next = head[u];
    head[u] = sumE;
}
void dfs(int u) {
    dp[u][0] = 1;
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(v != fa[u]) {
	    fa[v] = u;
	    dfs(v);
	    ans += dp[v][0] + dp[v][1];
	    dp[u][0] += dp[v][1];
	    dp[u][1] += dp[v][0];
	}
    }
    int t = min(dp[u][0],dp[u][1]);
    dp[u][0] -= t;dp[u][1] -= t;
}
void find_circle(int u) {
    dep[u] = dep[fa[u]] + 1;
    vis[u] = 1;
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(!vis[v]) {
	    fa[v] = u;
	    find_circle(v);
	}
	else if(dep[v] < dep[u]) {
	    st = u;ed = v;
	}
    }
}
void Calc(int u) {
    dp[u][0] = 1;
    vis[u] = 1;
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(!vis[v]) {
	    Calc(v);
	    ans += dp[v][0] + dp[v][1];
	    dp[u][0] += dp[v][1];
	    dp[u][1] += dp[v][0];
	}
    }
    int t = min(dp[u][0],dp[u][1]);
    dp[u][0] -= t;
    dp[u][1] -= t;
}
void Solve() {
    read(N);read(M);
    int a,b;
    for(int i = 1 ; i <= M ; ++i) {
	read(a);read(b);
	add(a,b);add(b,a);
    }
    if(N & 1) {puts("-1");return;}
    if(M == N - 1) {
	dfs(1);
	if(dp[1][0] || dp[1][1]) {puts("-1");return;}
	out(ans);enter;
    }
    else {
	find_circle(1);
	int p = st;
	while(1) {
	    c[++tot] = p;
	    if(p == ed) break;
	    p = fa[p];
	}
	memset(vis,0,sizeof(vis));
	for(int i = 1 ; i <= tot ; ++i) vis[c[i]] = 1;
	for(int i = 1 ; i <= tot ; ++i) {
	    Calc(c[i]);
	}
	top = 0;
	for(int i = 1 ; i <= tot ; ++i) {
	    int u = c[i];
	    pre[i] = pre[i - 1];
	    if(dp[u][0] || dp[u][1]) {
		pre[i] += (i - 1) * (dp[u][0]+dp[u][1]);
	    }
	    for(int k = 0 ; k <= 1 ; ++k) {
		int t = k ^ ((i - 1) & 1);
		int cnt = dp[u][k];
		while(cnt && top && num[top] == t ^ 1) {
		    pre[i] -= sta[top] * 2;
		    --top;--cnt;
		}
		if(cnt) {
		    for(int j = 1 ; j <= cnt ; ++j) {
			sta[++top] = i - 1;num[top] = t;
		    }
		}
	    }
	    if(top) prez[i][num[top]] = top; 
	}
	top = 0;
	for(int i = tot ; i >= 1 ; --i) {
	    int u = c[i];
	    suf[i] = suf[i + 1];
	    if(dp[u][0] || dp[u][1]) {
		suf[i] += (tot - i) * (dp[u][0] + dp[u][1]);
	    }
	    for(int k = 0 ; k <= 1 ; ++k) {#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
struct node {
    int to,next;
}E[MAXN * 2];
int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
bool vis[MAXN];
int c[MAXN],tot;
int sta[MAXN],top,num[MAXN];
void add(int u,int v) {
    E[++sumE].to = v;
    E[sumE].next = head[u];
    head[u] = sumE;
}
void dfs(int u) {
    dp[u][0] = 1;
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(v != fa[u]) {
	    fa[v] = u;
	    dfs(v);
	    ans += dp[v][0] + dp[v][1];
	    dp[u][0] += dp[v][1];
	    dp[u][1] += dp[v][0];
	}
    }
    int t = min(dp[u][0],dp[u][1]);
    dp[u][0] -= t;dp[u][1] -= t;
}
void find_circle(int u) {
    dep[u] = dep[fa[u]] + 1;
    vis[u] = 1;
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(!vis[v]) {
	    fa[v] = u;
	    find_circle(v);
	}
	else if(dep[v] < dep[u]) {
	    st = u;ed = v;
	}
    }
}
void Calc(int u) {
    dp[u][0] = 1;
    vis[u] = 1;
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(!vis[v]) {
	    Calc(v);
	    ans += dp[v][0] + dp[v][1];
	    dp[u][0] += dp[v][1];
	    dp[u][1] += dp[v][0];
	}
    }
    int t = min(dp[u][0],dp[u][1]);
    dp[u][0] -= t;
    dp[u][1] -= t;
}
void Solve() {
    read(N);read(M);
    int a,b;
    for(int i = 1 ; i <= M ; ++i) {
	read(a);read(b);
	add(a,b);add(b,a);
    }
    if(N & 1) {puts("-1");return;}
    if(M == N - 1) {
	dfs(1);
	if(dp[1][0] || dp[1][1]) {puts("-1");return;}
	out(ans);enter;
    }
    else {
	find_circle(1);
	int p = st;
	while(1) {
	    c[++tot] = p;
	    if(p == ed) break;
	    p = fa[p];
	}
	memset(vis,0,sizeof(vis));
	for(int i = 1 ; i <= tot ; ++i) vis[c[i]] = 1;
	for(int i = 1 ; i <= tot ; ++i) {
	    Calc(c[i]);
	}
	top = 0;
	for(int i = 1 ; i <= tot ; ++i) {
	    int u = c[i];
	    pre[i] = pre[i - 1];
	    if(dp[u][0] || dp[u][1]) {
		pre[i] += (i - 1) * (dp[u][0]+dp[u][1]);
	    }
	    for(int k = 0 ; k <= 1 ; ++k) {
		int t = k ^ ((i - 1) & 1);
		int cnt = dp[u][k];
		while(cnt && top && num[top] == t ^ 1) {
		    pre[i] -= sta[top] * 2;
		    --top;--cnt;
		}
		if(cnt) {
		    for(int j = 1 ; j <= cnt ; ++j) {
			sta[++top] = i - 1;num[top] = t;
		    }
		}
	    }
	    if(top) prez[i][num[top]] = top; 
	}
	top = 0;
	for(int i = tot ; i >= 1 ; --i) {
	    int u = c[i];
	    suf[i] = suf[i + 1];
	    if(dp[u][0] || dp[u][1]) {
		suf[i] += (tot - i) * (dp[u][0] + dp[u][1]);
	    }
	    for(int k = 0 ; k <= 1 ; ++k) {
		int t = k ^ ((tot - i) & 1);
		int cnt = dp[u][k];
		while(cnt && top && num[top] == t ^ 1) {
		    suf[i] -= sta[top] * 2;
		    --top;--cnt;
		}
		if(cnt) {
		    for(int j = 1 ; j <= cnt ; ++j) {sta[++top] = tot - i;num[top] = t;}
		}
	    }
	    if(top) sufz[i][num[top]] = top;
	}
	if(tot % 2 == 0) {
	    int64 res = 1e18;
	    for(int i = 1 ; i <= tot ; ++i) {
		if(prez[i][0] == sufz[i + 1][0] && prez[i][1] == sufz[i + 1][1]) {
		    res = min(res,pre[i] + suf[i + 1] + prez[i][0] + prez[i][1]);
		}
	    }
	    if(res >= 1e18) {
		puts("-1");
	    }
	    else {out(ans + res);enter;}
	}
	else {
	    int64 a = 1;
	    for(int64 i = 1 ; i <= 1e18 ; ++i) a <<= 1LL;
	    out(a);enter;
	}
    }
}#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
struct node {
    int to,next;
}E[MAXN * 2];
int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
bool vis[MAXN];
int c[MAXN],tot;
int sta[MAXN],top,num[MAXN];
void add(int u,int v) {
    E[++sumE].to = v;
    E[sumE].next = head[u];
    head[u] = sumE;
}
void dfs(int u) {
    dp[u][0] = 1;
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(v != fa[u]) {
	    fa[v] = u;
	    dfs(v);
	    ans += dp[v][0] + dp[v][1];
	    dp[u][0] += dp[v][1];
	    dp[u][1] += dp[v][0];
	}
    }
    int t = min(dp[u][0],dp[u][1]);
    dp[u][0] -= t;dp[u][1] -= t;
}
void find_circle(int u) {
    dep[u] = dep[fa[u]] + 1;
    vis[u] = 1;
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(!vis[v]) {
	    fa[v] = u;
	    find_circle(v);
	}
	else if(dep[v] < dep[u]) {
	    st = u;ed = v;
	}
    }
}
void Calc(int u) {
    dp[u][0] = 1;
    vis[u] = 1;
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(!vis[v]) {
	    Calc(v);
	    ans += dp[v][0] + dp[v][1];
	    dp[u][0] += dp[v][1];
	    dp[u][1] += dp[v][0];
	}
    }
    int t = min(dp[u][0],dp[u][1]);
    dp[u][0] -= t;
    dp[u][1] -= t;
}
void Solve() {
    read(N);read(M);
    int a,b;
    for(int i = 1 ; i <= M ; ++i) {
	read(a);read(b);
	add(a,b);add(b,a);
    }
    if(N & 1) {puts("-1");return;}
    if(M == N - 1) {
	dfs(1);
	if(dp[1][0] || dp[1][1]) {puts("-1");return;}
	out(ans);enter;
    }
    else {
	find_circle(1);
	int p = st;
	while(1) {
	    c[++tot] = p;
	    if(p == ed) break;
	    p = fa[p];
	}
	memset(vis,0,sizeof(vis));
	for(int i = 1 ; i <= tot ; ++i) vis[c[i]] = 1;
	for(int i = 1 ; i <= tot ; ++i) {
	    Calc(c[i]);
	}
	top = 0;
	for(int i = 1 ; i <= tot ; ++i) {
	    int u = c[i];
	    pre[i] = pre[i - 1];
	    if(dp[u][0] || dp[u][1]) {
		pre[i] += (i - 1) * (dp[u][0]+dp[u][1]);
	    }
	    for(int k = 0 ; k <= 1 ; ++k) {
		int t = k ^ ((i - 1) & 1);
		int cnt = dp[u][k];
		while(cnt && top && num[top] == t ^ 1) {
		    pre[i] -= sta[top] * 2;
		    --top;--cnt;
		}
		if(cnt) {
		    for(int j = 1 ; j <= cnt ; ++j) {
			sta[++top] = i - 1;num[top] = t;
		    }
		}
	    }
	    if(top) prez[i][num[top]] = top; 
	}
	top = 0;
	for(int i = tot ; i >= 1 ; --i) {
	    int u = c[i];
	    suf[i] = suf[i + 1];
	    if(dp[u][0] || dp[u][1]) {
		suf[i] += (tot - i) * (dp[u][0] + dp[u][1]);
	    }
	    for(int k = 0 ; k <= 1 ; ++k) {
		int t = k ^ ((tot - i) & 1);
		int cnt = dp[u][k];
		while(cnt && top && num[top] == t ^ 1) {
		    suf[i] -= sta[top] * 2;
		    --top;--cnt;
		}
		if(cnt) {
		    for(int j = 1 ; j <= cnt ; ++j) {sta[++top] = tot - i;num[top] = t;}
		}
	    }
	    if(top) sufz[i][num[top]] = top;
	}
	if(tot % 2 == 0) {
	    int64 res = 1e18;
	    for(int i = 1 ; i <= tot ; ++i) {
		if(prez[i][0] == sufz[i + 1][0] && prez[i][1] == sufz[i + 1][1]) {
		    res = min(res,pre[i] + suf[i + 1] + prez[i][0] + prez[i][1]);
		}
	    }
	    if(res >= 1e18) {
		puts("-1");
	    }
	    else {out(ans + res);enter;}
	}
	else {
	    int64 a = 1;
	    for(int64 i = 1 ; i <= 1e18 ; ++i) a <<= 1LL;
	    out(a);enter;
	}
    }
}

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}

		int t = k ^ ((tot - i) & 1);
		int cnt = dp[u][k];
		while(cnt && top && num[top] == t ^ 1) {
		    suf[i] -= sta[top] * 2;
		    --top;--cnt;
		}
		if(cnt) {
		    for(int j = 1 ; j <= cnt ; ++j) {sta[++top] = tot - i;num[top] = t;}
		}
	    }
	    if(top) sufz[i][num[top]] = top;
	}
	if(tot % 2 == 0) {
	    int64 res = 1e18;
	    for(int i = 1 ; i <= tot ; ++i) {
		if(prez[i][0] == sufz[i + 1][0] && prez[i][1] == sufz[i + 1][1]) {
		    res = min(res,pre[i] + suf[i + 1] + prez[i][0] + prez[i][1]);
		}
	    }
	    if(res >= 1e18) {
		puts("-1");
	    }
	    else {out(ans + res);enter;}
	}
	else {
	    int64 a = 1;
	    for(int64 i = 1 ; i <= 1e18 ; ++i) a <<= 1LL;
	    out(a);enter;
	}
    }
}

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Compiler output:
a.cc:150:44: error: stray '#' in program
  150 |             for(int k = 0 ; k <= 1 ; ++k) {#include <bits/stdc++.h>
      |                                            ^
a.cc:330:2: error: stray '#' in program
  330 | }#include <bits/stdc++.h>
      |  ^
a.cc: In function 'void Solve()':
a.cc:150:45: error: 'include' was not declared in this scope
  150 |             for(int k = 0 ; k <= 1 ; ++k) {#include <bits/stdc++.h>
      |                                             ^~~~~~~
a.cc:150:54: error: 'bits' was not declared in this scope
  150 |             for(int k = 0 ; k <= 1 ; ++k) {#include <bits/stdc++.h>
      |                                                      ^~~~
a.cc:150:59: error: 'stdc' was not declared in this scope; did you mean 'std'?
  150 |             for(int k = 0 ; k <= 1 ; ++k) {#include <bits/stdc++.h>
      |                                                           ^~~~
      |                                                           std
a.cc:161:1: error: expected primary-expression before 'using'
  161 | using namespace std;
      | ^~~~~
a.cc:165:1: error: a template declaration cannot appear at block scope
  165 | template<class T>
      | ^~~~~~~~
a.cc:194:23: error: a function-definition is not allowed here before '{' token
  194 | void add(int u,int v) {
      |                       ^
a.cc:199:17: error: a function-definition is not allowed here before '{' token
  199 | void dfs(int u) {
      |                 ^
a.cc:214:25: error: a function-definition is not allowed here before '{' token
  214 | void find_circle(int u) {
      |                         ^
a.cc:228:18: error: a function-definition is not allowed here before '{' token
  228 | void Calc(int u) {
      |                  ^
a.cc:244:14: error: a function-definition is not allowed here before '{' token
  244 | void Solve() {
      |              ^
a.cc:341:1: error: expected primary-expression before 'using'
  341 | using namespace std;
      | ^~~~~
a.cc:345:1: error: a template declaration cannot appear at block scope
  345 | template<class T>
      | ^~~~~~~~
a.cc:366:8: error: redefinition of 'struct Solve()::node'
  366 | struct node {
      |        ^~~~
a.cc:186:8: note: previous definition of 'struct Solve()::node'
  186 | struct node {
      |        ^~~~
a.cc:368:2: error: conflicting declaration 'int E [200010]'
  368 | }E[MAXN * 2];
      |  ^
a.cc:188:2: note: previous declaration as 'Solve()::node E [200010]'
  188 | }E[MAXN * 2];
      |  ^
a.cc:369:5: error: redeclaration of 'int N'
  369 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |     ^
a.cc:189:5: note: 'int N' previously declared here
  189 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |     ^
a.cc:369:7: error: redeclaration of 'int head [100005]'
  369 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |       ^~~~
a.cc:189:7: note: 'int head [100005]' previously declared here
  189 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |       ^~~~
a.cc:369:18: error: redeclaration of 'int sumE'
  369 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                  ^~~~
a.cc:189:18: note: 'int sumE' previously declared here
  189 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                  ^~~~
a.cc:369:23: error: redeclaration of 'int M'
  369 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                       ^
a.cc:189:23: note: 'int M' previously declared here
  189 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                       ^
a.cc:369:25: error: redeclaration of 'int fa [100005]'
  369 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                         ^~
a.cc:189:25: note: 'int fa [100005]' previously declared here
  189 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                         ^~
a.cc:369:34: error: redeclaration of 'int dep [100005]'
  369 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                                  ^~~
a.cc:189:34: note: 'int dep [100005]' previously declared here
  189 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                                  ^~~
a.cc:369:44: error: redeclaration of 'int st'
  369 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                                            ^~
a.cc:189:44: note: 'int st' previously declared here
  189 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                                            ^~
a.cc:369:47: error: redeclaration of 'int ed'
  369 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                                               ^~
a.cc:189:47: note: 'int ed' previously declared here
  189 | int N,head[MAXN],sumE,M,fa[MAXN],dep[MAXN],st,ed;
      |                                               ^~
a.cc:370:7: error: redeclaration of 'int64 dp [100005][2]'
  370 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |       ^~
a.cc:190:7: note: 'int64 dp [100005][2]' previously declared here
  190 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |       ^~
a.cc:370:19: error: redeclaration of 'int64 ans'
  370 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |                   ^~~
a.cc:190:19: note: 'int64 ans' previously declared here
  190 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |                   ^~~
a.cc:370:23: error: redeclaration of 'int64 pre [100005]'
  370 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |                       ^~~
a.cc:190:23: note: 'int64 pre [100005]' previously declared here
  190 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |                       ^~~
a.cc:370:33: error: redeclaration of 'int64 suf [100005]'
  370 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |                                 ^~~
a.cc:190:33: note: 'int64 suf [100005]' previously declared here
  190 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |                                 ^~~
a.cc:370:43: error: redeclaration of 'int64 prez [100005][2]'
  370 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |                                           ^~~~
a.cc:190:43: note: 'int64 prez [100005][2]' previously declared here
  190 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |                                           ^~~~
a.cc:370:57: error: redeclaration of 'int64 sufz [100005][2]'
  370 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |                                                         ^~~~
a.cc:190:57: note: 'int64 sufz [100005][2]' previously declared here
  190 | int64 dp[MAXN][2],ans,pre[MAXN],suf[MAXN],prez[MAXN][2],sufz[MAXN][2];
      |                                                         ^~~~
a.cc:371:6: error: redeclaration of 'bool vis [100005]'
  371 | bool vis[MAXN];
      |      ^~~
a.cc:191:6: note: 'bool vis [100005]' previously declared here
  191 | bool vis[MAXN];
      |      ^~~
a.cc:372:5: error: redeclaration of 'int c [100005]'
  372 | int c[MAXN],tot;
      |     ^
a.cc:192:5: note: 'int c [100005]' previously declared here
  192 | int c[MAXN],tot;
      |     ^
a.cc:372:13: error: redeclaration of 'int tot'
  372 | int c[MAXN],tot;
      |             ^~~
a.cc:192:13: note: 'int tot' previously declared here
  192 | int c[MAXN],tot;
      |             ^~~
a.cc:373:5: error: redeclaration of 'int sta [100005]'
  373 | int sta[MAXN],top,num[MAXN];
      |     ^~~
a.cc:193:5: note: 'int sta [100005]' previously declared here
  193 | int sta[MAXN],top,num[MAXN];
      |     ^~~
a.cc:373:15: error: redeclaration of 'int top'
  373 | int sta[MAXN],top,num[MAXN];
      |               ^~~
a.cc:193:15: note: 'int top' previously declared here
  193 | int sta[MAXN],top,num[MAXN];
      |               ^~~
a.cc:373:19: error: redeclaration of 'int num [100005]'
  373 | int sta[MAXN],top,num[MAXN];
      |                   ^~~
a.cc:193:19: note: 'int num [100005]' previously declared here
  193 | int sta[MAXN],top,num[MAXN];
      |                   ^~~
a.cc:374:23: error: a function-definition is not allowed here before '{' token
  374 | void add(int u,int v) {
      |                       ^
a.cc:379:17: error: a function-definition is not allowed here before '{' token
  379 | void dfs(int u) {
      |                 ^
a.cc:394:25: error: a function-definition is not allowed here before '{' token
  394 | void find_circle(int u) {
      |                         ^
a.cc:408:18: error: a function-definition is not allowed here before '{' token
  408 | void Calc(int u) {
      |                  ^
a.cc:424:14: error: a function-definition is not allowed here before '{' token
  424 | void Solve() {
      |              ^
a.cc:512:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  512 | int main() {
      |         ^~
a.cc:512:9: note: remove parentheses to default-initialize a variable
  512 | int main() {
      |         ^~
      |         --
a.cc:512:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:512:12: error: a function-definition is not allowed here before '{' token
  512 | int main() {
      |            ^
a.cc:521:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  521 | int main() {
      |         ^~
a.cc:521:9: note: remove parentheses to default-initialize a variable
  521 | int main() {
      |         ^~
      |         --
a.cc:521:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:521:12: error: a function-definition is not allowed here before '{' token
  521 | int main() {
      |            ^