Language: C++

#include<bits/stdc++.h>
#define A puts("Yes"),exit(0)
#define B puts("No"),exit(0)
using namespace std;
const int maxn = 100000 + 10;
const int maxm = 100000 + 10;

int n, m, h[maxn], ecnt, deg[maxn], S1, S2;
struct enode{
	int v, n;
	enode() {}
	enode(int _v, int _n):v(_v), n(_n) {}
}e[maxm << 1];

inline void addedge(int u, int v) { ecnt ++; e[ecnt] = enode(v,h[u]); h[u] = ecnt; }

int vis[maxn];
void dfs(int u) {
	vis[u] = 1;
	for(int i = h[u];~ i;i = e[i].n) {
		int v = e[i].v;
		if(v == S1) A;
		if(vis[v] || v == S2) continue;
		dfs(v);
	}
}

int main() 
	freopen("data.in","r",stdin);
	scanf("%d%d", &n, &m); ecnt = 0;
	memset(h,-1,sizeof(h));
	for(int i = 1;i <= m;i ++) {
    int u, v;
		scanf("%d%d", &u, &v);
		addedge(u,v);
		addedge(v,u);
		deg[u] ++; deg[v] ++;
	}
	int cnt4 = 0, flag = 0; S1 = -1, S2 = -1;
	for(int i = 1;i <= n;i ++) {
		if(deg[i] < 4) continue;
		if(deg[i] >= 6) flag = 1;
		if(deg[i] == 4) {
			cnt4 ++;
			if(~ S1) S2 = i;
			else S1 = i;
		}
	}
	if(flag || cnt4 > 2) A;
	if(cnt4 < 2) B;
	dfs(S1);
	B;
	return 0;
}


Compiler output:
a.cc:29:9: error: expected initializer before 'freopen'
   29 |         freopen("data.in","r",stdin);
      |         ^~~~~~~
a.cc:30:14: error: expected constructor, destructor, or type conversion before '(' token
   30 |         scanf("%d%d", &n, &m); ecnt = 0;
      |              ^
a.cc:30:32: error: 'ecnt' does not name a type
   30 |         scanf("%d%d", &n, &m); ecnt = 0;
      |                                ^~~~
a.cc:31:15: error: expected constructor, destructor, or type conversion before '(' token
   31 |         memset(h,-1,sizeof(h));
      |               ^
a.cc:32:9: error: expected unqualified-id before 'for'
   32 |         for(int i = 1;i <= m;i ++) {
      |         ^~~
a.cc:32:23: error: 'i' does not name a type
   32 |         for(int i = 1;i <= m;i ++) {
      |                       ^
a.cc:32:30: error: 'i' does not name a type
   32 |         for(int i = 1;i <= m;i ++) {
      |                              ^
a.cc:39:33: error: 'S1' does not name a type
   39 |         int cnt4 = 0, flag = 0; S1 = -1, S2 = -1;
      |                                 ^~
a.cc:40:9: error: expected unqualified-id before 'for'
   40 |         for(int i = 1;i <= n;i ++) {
      |         ^~~
a.cc:40:23: error: 'i' does not name a type
   40 |         for(int i = 1;i <= n;i ++) {
      |                       ^
a.cc:40:30: error: 'i' does not name a type
   40 |         for(int i = 1;i <= n;i ++) {
      |                              ^
a.cc:49:9: error: expected unqualified-id before 'if'
   49 |         if(flag || cnt4 > 2) A;
      |         ^~
a.cc:50:9: error: expected unqualified-id before 'if'
   50 |         if(cnt4 < 2) B;
      |         ^~
a.cc:51:12: error: expected constructor, destructor, or type conversion before '(' token
   51 |         dfs(S1);
      |            ^
a.cc:3:15: error: expected constructor, destructor, or type conversion before '(' token
    3 | #define B puts("No"),exit(0)
      |               ^
a.cc:52:9: note: in expansion of macro 'B'
   52 |         B;
      |         ^
a.cc:53:9: error: expected unqualified-id before 'return'
   53 |         return 0;
      |         ^~~~~~
a.cc:54:1: error: expected declaration before '}' token
   54 | }
      | ^