Language: C++

#define errOut(s) \
  { std::cerr << __LINE__ << ":" << #s << ":" << (s) << std::endl; }

#include <bits/stdc++.h>

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
//#include <boost/multi_array.hpp>
//#include <boost/optional.hpp>
//#include <boost/range/adaptors.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;
#define errOut(s) \
  { std::cerr << __LINE__ << ":" << #s << ":" << (s) << std::endl; }

#include <bits/stdc++.h>

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
//#include <boost/multi_array.hpp>
//#include <boost/optional.hpp>
//#include <boost/range/adaptors.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

static std::string const YES = "Yes";
static std::string const NO = "No";

bool solve(int64_t  /*n*/, std::vector<std::vector<int64_t>> dss) {
  int cnt = 0;
  for (auto const& ds : dss) {
    if (ds[0] == ds[1]) {
      cnt++;
      if (cnt >= 3) {
        return true;
      }
    } else {
      cnt = 0;
    }
  }
  return false;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t n;
  std::cin >> n;
  std::vector<std::vector<int64_t>> dss(n, std::vector<int64_t>(2));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      std::cin >> dss[i][j];
    }
  }
  auto const res = solve(n, std::move(dss));
  std::cout << (res ? YES : NO) << std::endl;
  return 0;
}

static std::string const YES = "Yes";
static std::string const NO = "No";

bool solve(int64_t  /*n*/, std::vector<std::vector<int64_t>> dss) {
  int cnt = 0;
  for (auto const& ds : dss) {
    if (ds[0] == ds[1]) {
      cnt++;
      if (cnt >= 3) {
        return true;
      }
    } else {
      cnt = 0;
    }
  }
  return false;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t n;
  std::cin >> n;
  std::vector<std::vector<int64_t>> dss(n, std::vector<int64_t>(2));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      std::cin >> dss[i][j];
    }
  }
  auto const res = solve(n, std::move(dss));
  std::cout << (res ? YES : NO) << std::endl;
  return 0;
}


Compiler output:
a.cc:66:26: error: redefinition of 'const std::string YES'
   66 | static std::string const YES = "Yes";
      |                          ^~~
a.cc:32:26: note: 'const std::string YES' previously declared here
   32 | static std::string const YES = "Yes";
      |                          ^~~
a.cc:67:26: error: redefinition of 'const std::string NO'
   67 | static std::string const NO = "No";
      |                          ^~
a.cc:33:26: note: 'const std::string NO' previously declared here
   33 | static std::string const NO = "No";
      |                          ^~
a.cc:69:6: error: redefinition of 'bool solve(int64_t, std::vector<std::vector<long int> >)'
   69 | bool solve(int64_t  /*n*/, std::vector<std::vector<int64_t>> dss) {
      |      ^~~~~
a.cc:35:6: note: 'bool solve(int64_t, std::vector<std::vector<long int> >)' previously defined here
   35 | bool solve(int64_t  /*n*/, std::vector<std::vector<int64_t>> dss) {
      |      ^~~~~
a.cc:84:5: error: redefinition of 'int main()'
   84 | int main() {
      |     ^~~~
a.cc:50:5: note: 'int main()' previously defined here
   50 | int main() {
      |     ^~~~