Language: C++

#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(x, a, y) for (int (x) = (a);(x) <= (y);++(x))
#define _rep2(x, y) for (int (x) = 0;(x) < (y);++(x))
#define rep(...) _overload(__va_args__, _rep1, _rep2)(__va_args__)
#define rrep(x,y) for (int (x) = y-1;(x) >= 0;--(x))
#define all(x) (x).begin(),(x).end()
#define _size(x) (int)((x).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int infint = 1 << 30;                          // 1.07x10^ 9
const ll infll = 1ll << 60;                          // 1.15x10^18
const double eps = 1e-10;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int max_n = 100000;
int n, m;
int a[max_n], b[max_n];

vector<int> g[max_n];

void add_edge(int v, int u) {
    g[v].push_back(u); g[u].push_back(v);
}


bool rec(int a, int b, int par, int v) {
    if (v == b) return false;
    if (v == a) return true;

    for (int i = 0; i < g[v].size(); ++i) {
        if (g[v][i] != par) {
            return rec(a, b, v, g[v][i]);
        }
    }
}

int main() {
  std::ios::sync_with_stdio(false);std::cin.tie(0);

  cin >> n >> m;
  rep(i, m) cin >> a[i] >> b[i];
  rep(i, m) {--a[i]; --b[i];}

  rep(i, m) add_edge(a[i], b[i]);

  int c6 = 0, c4 = 0;
  vector<int> vc4;
  for (int v = 0; v < n; ++v) {
      if (g[v].size()%2 == 1) {
          cout << "no" << endl;
          return 0;
      }
      if (g[v].size() >= 6) {
          ++c6;
      } else if (g[v].size() >= 4) {
          ++c4;
          vc4.push_back(v);
      }
  }

  if (c6 > 0) {
      cout << "yes" << endl;
      return 0;
  }

  if (c4 > 2) {
      cout << "yes" << endl;
      return 0;
  }

  
  if (c4 == 2) {
      int a = vc4[0], b = vc4[1];
      for (int i = 0; i < g[a].size(); ++i) {
          if (rec(a, b, a, g[a][i])) {
              cout << "yes" << endl;
              return 0;
          }
      }
  }

  cout << "no" << endl;

  return 0;
}



Compiler output:
a.cc:70:11: error: macro "_overload" requires 5 arguments, but only 3 given
   70 |   rep(i, m) cin >> a[i] >> b[i];
      |           ^
a.cc:23:9: note: macro "_overload" defined here
   23 | #define _overload(a, b, c, d, ...) d
      |         ^~~~~~~~~
a.cc:71:11: error: macro "_overload" requires 5 arguments, but only 3 given
   71 |   rep(i, m) {--a[i]; --b[i];}
      |           ^
a.cc:23:9: note: macro "_overload" defined here
   23 | #define _overload(a, b, c, d, ...) d
      |         ^~~~~~~~~
a.cc:73:11: error: macro "_overload" requires 5 arguments, but only 3 given
   73 |   rep(i, m) add_edge(a[i], b[i]);
      |           ^
a.cc:23:9: note: macro "_overload" defined here
   23 | #define _overload(a, b, c, d, ...) d
      |         ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:26:55: error: '__va_args__' was not declared in this scope
   26 | #define rep(...) _overload(__va_args__, _rep1, _rep2)(__va_args__)
      |                                                       ^~~~~~~~~~~
a.cc:70:3: note: in expansion of macro 'rep'
   70 |   rep(i, m) cin >> a[i] >> b[i];
      |   ^~~
a.cc:26:18: error: '_overload' was not declared in this scope
   26 | #define rep(...) _overload(__va_args__, _rep1, _rep2)(__va_args__)
      |                  ^~~~~~~~~
a.cc:70:3: note: in expansion of macro 'rep'
   70 |   rep(i, m) cin >> a[i] >> b[i];
      |   ^~~
a.cc: In function 'bool rec(int, int, int, int)':
a.cc:64:1: warning: control reaches end of non-void function [-Wreturn-type]
   64 | }
      | ^