Language: C++

// fest
#include <bits/stdc++.h>	

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define __ fflush(stdout)
#define FILENAME ""

typedef long long ll;
typedef long double ld;    

using namespace std;

void FREOPEN() {
	#ifdef LOCAL
		freopen(".in", "r", stdin);
		freopen("1.out", "w", stdout);
	#else
		//freopen(FILENAME".in", "r", stdin);
		//freopen(FILENAME".out", "w", stdout);
	#endif
}

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

const int N = 200500, inf = 1e9 * 2;

const ll MOD = 1e9 + 7ll, INF = 1e18;

const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};

bool was[N];

vector<int> g[N];

void dfs(int v) {
	was[v] = 1;
	for (auto u : g[v]) {
		if (!was[u]) dfs(u);
	}
}

void no() {
	puts("No");
	exit(0);
}

void yes() {
	puts("Yes");
	exit(0);
}

int main() {
	FREOPEN();
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		g[x].pb(y);
		g[y].pb(x);
	}
	for (int i = 1; i <= n; i++) {
		if (SZ(g[i]) & 1) no();
	}
	int components = 0;
	for (int i = 1; i <= n; i++) {
		if (!was[i]) {
			components++;
			dfs(i);
		}
	}
	if (components > 3) no();
	if (components == 3) yes();
	if (components == 2) {
		for (int i = 1; i <= n; i++) if (SZ(g[i]) > 2) yes();
	}
	int cnt = 0;
	for (int i = 1; i <= n; i++) {
		if (SZ(g[i]) >= 6) yes();
		if (SZ(g[i]) > 3) cnt++;
	}
	if (cnt > 1) yes();
	no(); 
	return 0;
}
// fest
#include <bits/stdc++.h>	

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define __ fflush(stdout)
#define FILENAME ""

typedef long long ll;
typedef long double ld;    

using namespace std;

void FREOPEN() {
	#ifdef LOCAL
		freopen(".in", "r", stdin);
		freopen("1.out", "w", stdout);
	#else
		//freopen(FILENAME".in", "r", stdin);
		//freopen(FILENAME".out", "w", stdout);
	#endif
}

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

const int N = 200500, inf = 1e9 * 2;

const ll MOD = 1e9 + 7ll, INF = 1e18;

const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};

bool was[N];

vector<int> g[N];

void dfs(int v) {
	was[v] = 1;
	for (auto u : g[v]) {
		if (!was[u]) dfs(u);
	}
}

void no() {
	puts("No");
	exit(0);
}

void yes() {
	puts("Yes");
	exit(0);
}

int main() {
	FREOPEN();
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		g[x].pb(y);
		g[y].pb(x);
	}
	for (int i = 1; i <= n; i++) {
		if (SZ(g[i]) & 1) no();
	}
	int components = 0;
	for (int i = 1; i <= n; i++) {
		if (!was[i]) {
			components++;
			dfs(i);
		}
	}
	if (components > 3) no();
	if (components == 3) yes();
	if (components == 2) {
		for (int i = 1; i <= n; i++) if (SZ(g[i]) > 2) yes();
		no();
    }
	int cnt = 0;
	for (int i = 1; i <= n; i++) {
		if (SZ(g[i]) >= 6) yes();
		if (SZ(g[i]) > 3) cnt++;
	}
	if (cnt > 1) yes();
	no(); 
	return 0;
}


Compiler output:
a.cc:113:6: error: redefinition of 'void FREOPEN()'
  113 | void FREOPEN() {
      |      ^~~~~~~
a.cc:20:6: note: 'void FREOPEN()' previously defined here
   20 | void FREOPEN() {
      |      ^~~~~~~
a.cc:123:15: error: redefinition of 'double Time()'
  123 | inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }
      |               ^~~~
a.cc:30:15: note: 'double Time()' previously defined here
   30 | inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }
      |               ^~~~
a.cc:125:11: error: redefinition of 'const int N'
  125 | const int N = 200500, inf = 1e9 * 2;
      |           ^
a.cc:32:11: note: 'const int N' previously defined here
   32 | const int N = 200500, inf = 1e9 * 2;
      |           ^
a.cc:125:23: error: redefinition of 'const int inf'
  125 | const int N = 200500, inf = 1e9 * 2;
      |                       ^~~
a.cc:32:23: note: 'const int inf' previously defined here
   32 | const int N = 200500, inf = 1e9 * 2;
      |                       ^~~
a.cc:127:10: error: redefinition of 'const ll MOD'
  127 | const ll MOD = 1e9 + 7ll, INF = 1e18;
      |          ^~~
a.cc:34:10: note: 'const ll MOD' previously defined here
   34 | const ll MOD = 1e9 + 7ll, INF = 1e18;
      |          ^~~
a.cc:127:27: error: redefinition of 'const ll INF'
  127 | const ll MOD = 1e9 + 7ll, INF = 1e18;
      |                           ^~~
a.cc:34:27: note: 'const ll INF' previously defined here
   34 | const ll MOD = 1e9 + 7ll, INF = 1e18;
      |                           ^~~
a.cc:129:11: error: redefinition of 'const int dx []'
  129 | const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
      |           ^~
a.cc:36:11: note: 'const int dx [8]' previously defined here
   36 | const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
      |           ^~
a.cc:130:11: error: redefinition of 'const int dy []'
  130 | const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};
      |           ^~
a.cc:37:11: note: 'const int dy [8]' previously defined here
   37 | const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};
      |           ^~
a.cc:132:6: error: redefinition of 'bool was [200500]'
  132 | bool was[N];
      |      ^~~
a.cc:39:6: note: 'bool was [200500]' previously declared here
   39 | bool was[N];
      |      ^~~
a.cc:134:13: error: redefinition of 'std::vector<int> g [200500]'
  134 | vector<int> g[N];
      |             ^
a.cc:41:13: note: 'std::vector<int> g [200500]' previously declared here
   41 | vector<int> g[N];
      |             ^
a.cc:136:6: error: redefinition of 'void dfs(int)'
  136 | void dfs(int v) {
      |      ^~~
a.cc:43:6: note: 'void dfs(int)' previously defined here
   43 | void dfs(int v) {
      |      ^~~
a.cc:143:6: error: redefinition of 'void no()'
  143 | void no() {
      |      ^~
a.cc:50:6: note: 'void no()' previously defined here
   50 | void no() {
      |      ^~
a.cc:148:6: error: redefinition of 'void yes()'
  148 | void yes() {
      |      ^~~
a.cc:55:6: note: 'void yes()' previously defined here
   55 | void yes() {
      |      ^~~
a.cc:153:5: error: redefinition of 'int main()'
  153 | int main() {
      |     ^~~~
a.cc:60:5: note: 'int main()' previously defined here
   60 | int main() {
      |     ^~~~