alexjercan/bugnet huggingface dataset:
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <vector>

static const int MAX = 100000;
static const int INFTY = (1 << 20);
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<vector<int>> d(N, vector<int>(2));
  for (int i = 0; i < N; i++) {
    cin >> d[i][0];
    cin >> d[i][1];
  }

  int count = 0;
  for (int i = 0; i < N; i++) {
    if (d[i][0] == d[i][1])
      count++;
    else
      count = 0;
    if (count >= 3) {
      printf("Yes");
      return 0;
    }
  }
  printf("No");
  return 0;
}

Error: -11

Fixed submission:

#include <algorithm>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <vector>

static const int MAX = 100000;
static const int INFTY = (1 << 20);
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<vector<int>> d(N);
  for (int i = 0; i < N; i++) {
    cin >> d[i][0];
    cin >> d[i][1];
  }

  int count = 0;
  for (int i = 0; i < N; i++) {
    if (d[i][0] == d[i][1])
      count++;
    else
      count = 0;
    if (count >= 3) {
      printf("Yes");
      return 0;
    }
  }
  printf("No");
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>

using namespace std;

int main(void) {

  int total = 0;
  int n = 0;
  int d1[101] = {0};
  int d2[101] = {1};

  cin >> n;

  for (int i = 0; i < n; i++) {

    cin >> d1[i] >> d2[i];

    if (d1[i] == d2[i] && total == 0) {

      if (d1[i - 1] == d2[i - 1] && total == 0) {

        if (d1[i - 2] == d2[i - 2] && total == 0) {

          cout << "Yes";

          total++;
        }
      }
    }
  }

  if (total == 0) {

    cout << "No";
  }

  return 0;
}

Error: -8

Fixed submission:

#include <iostream>

using namespace std;

int main(void) {

  int n = 0;
  int d1[100];
  int d2[100];

  cin >> n;

  for (int i = 0; i < n; i++) {

    if (i %= 2 == 0) {

      cin >> d1[i];

    } else {

      cin >> d2[i];
    }

    if (d1[i] == d2[i]) {

      if (d1[i - 1] == d2[i - 1]) {

        if (d1[i - 2] == d2[i - 2]) {

          cout << "Yes";
        }
      }
    }
  }

  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> ds(n);
  for (auto &p : ds)
    cin >> p.first >> p.second;
  bool ok = false;
  for (int i = 0; i < n - 2; ++i) {
    if (ds[i].first == ds[i].second && ds[i + 1].first == ds[i + 1].second &&
        ds[i + 2].first == ds[i + 2].second) {
      ok |= 1;
    }
  }
  cout << (ok ? "Yes\\n" : "No\\n");
  return 0;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> ds;
  for (auto &p : ds)
    cin >> p.first >> p.second;
  bool ok = false;
  for (int i = 0; i < n - 2; ++i) {
    if (ds[i].first == ds[i].second && ds[i + 1].first == ds[i + 1].second &&
        ds[i + 2].first == ds[i + 2].second) {
      ok |= 1;
    }
  }
  cout << (ok ? "Yes\\n" : "No\\n");
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int i;
  int t = 0;
  cin >> i;
  vector<int> d1(i);
  vector<int> d2(i);
  for (int a = 0; a < i; ++a) {
    cin >> d1[a];
    cin >> d2[a];
  }
  for (int a = 0; a < i; ++a) {
    if (d1[a] == d2[a]) {
      ++t;
      if (t >= 3) {
        break;
      }
    } else {
      t = 0;
    }
  }
  if (t >= 3) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Error: 0

Fixed submission:

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int i;
  vector<int> d1(i), d2(i);
  int t = 0;
  cin >> i;
  for (int a = 0; a < i; ++a) {
    cin >> d1[a];
    cin >> d2[a];
  }
  for (int a = 0; a < i; ++a) {
    if (d1[a] == d2[a]) {
      ++t;
      if (t >= 3) {
        break;
      }
    } else {
      t = 0;
    }
  }
  if (t >= 3) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>

int main() {
  int N, d1, d2;
  std::cin >> N;
  int count = 0;
  bool flag = true;

  for (int i = 0; i < N; i++) {
    std::cin >> d1 >> d2;

    if (d1 == d2)
      count++;
    else
      count = 0;

    if (count >= 3) {
      std::cout << "Yes" << std::endl;
      flag = false;
      break;
    }
  }

  if (flag)
    std::cout << "No" << std::endl;
}

Error: 1

Fixed submission:

#include <iostream>

int main() {
  int N, d1, d2;
  std::cin >> N;
  int count = 0;

  for (int i = 0; i < N; i++) {
    std::cin >> d1 >> d2;

    if (d1 == d2)
      count++;
    else
      count = 0;

    if (count >= 3) {
      std::cout << "Yes" << std::endl;
      exit(1);
    }
  }

  std::cout << "No" << std::endl;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

#define int long long
#define fastio                                                                 \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);

using namespace std;

void solve() {
  deque<pair<int, int>> v;
  int n, cnt = 0;
  cin >> n;
  bool ok = false;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    v.emplace_back(x, y);
    if (x == y)
      cnt++;
    if (i >= 3) {
      if (v[0].first == v[0].second)
        cnt--;
      v.pop_front();
    }
    if (cnt == 3) {
      ok = true;
    }
  }
  cout << (ok ? "Yes\\n" : "No\\n");
}

signed main() {
  fastio int t = 1;
  // cin >> t;
  while (t--)
    solve();
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>

#define int long long
#define fastio                                                                 \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);

using namespace std;

void solve() {
  deque<pair<int, int>> v;
  int n, cnt = 0;
  cin >> n;
  bool ok = false;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    if (x == y)
      cnt++;
    if (i >= 3) {
      if (v[0].first == v[0].second)
        cnt--;
      v.pop_front();
    }
    if (cnt == 3) {
      ok = true;
    }
  }
  cout << (ok ? "Yes\\n" : "No\\n");
}

signed main() {
  fastio int t = 1;
  // cin >> t;
  while (t--)
    solve();
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  int d1, d2;
  cin >> n;

  int count = 0;
  for (int i = 0; i < n; i++) {
    cin >> d1 >> d2;
    if (d1 == d2) {
      count++;
      if (count == 3) {
        break;
      }
    } else {
      count = 0;
    }
  }

  if (count == 3) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  int d1[n], d2[n];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> d1[i] >> d2[i];
  }

  int count = 0;
  for (int i = 0; i < n; i++) {
    if (d1[i] == d2[i]) {
      count++;
      if (count == 3) {
        break;
      }
    } else {
      count = 0;
    }
  }

  if (count == 3) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<vector<int>> data(N, vector<int>(2));

  for (int i = 0; i < N; i++) {
    cin >> data.at(i).at(0) >> data.at(i).at(1);
  }

  for (int i = 0; i < N - 2; i++) {
    if (data.at(i).at(0) == data.at(i).at(1) &&
        data.at(i + 1).at(0) == data.at(i + 1).at(1) &&
        data.at(i + 2).at(0) == data.at(i + 2).at(1)) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;

  vector<tuple<int, int>> data(N);
  for (int i = 0; i < N; i++) {
    cin >> get<0>(data.at(i)) >> get<1>(data.at(i));
  }

  int f = 0;
  for (int i = 0; i < N; i++) {
    if (get<0>(data.at(i)) == get<1>(data.at(i))) {
      if (get<0>(data.at(i + 1)) == get<1>(data.at(i + 1))) {
        if (get<0>(data.at(i + 1)) == get<1>(data.at(i + 1))) {
          f = 1;
          break;
        }
      }
    }
  }

  if (f == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\\n"

void solve() {
  ll n;
  cin >> n;
  ll x, y, ans = 0, mx = 0;
  vector<ll> v;
  for (ll i = 0; i < n; ++i) {
    cin >> x >> y;
    if (x == y)
      v.push_back(i + 1);
  }
  for (ll i = 0; i < v.size(); ++i) {
    if (v[i] + 1 == v[i + 1] && v[i + 1] + 1 == v[i + 2]) {
      cout << "Yes\\n";
      return;
    }
  }
  cout << "No\\n";
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\\n"

void solve() {
  ll n;
  cin >> n;
  ll x, y, ans = 0, mx = 0;
  vector<ll> v;
  for (ll i = 0; i < n; ++i) {
    cin >> x >> y;
    if (x == y)
      v.push_back(i + 1);
  }
  for (ll i = 0; i < n - 2; ++i) {
    if (v[i] + v[i + 2] == (v[i + 1]) << 1) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int>
#define vll vector<ll>
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vint D1(n), D2(n);
  int check = 0;
  int is_yes = 0;
  REP(i, n) {
    cin >> D1[i] >> D2[i];
    if (D1[i] == D2[i]) {
      check++;
    } else {
      check = 0;
    }
    if (check == 3) {
      is_yes = 1;
    }
  }
  if (is_yes) {
    cout << "Yes\\n";
  } else {
    cout << "No\\n";
  }
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int>
#define vll vector<ll>
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vint D1(n), D2(n);
  int check = 0;
  int is_yes = 0;
  REP(i, n) {
    cin >> D1[n] >> D2[n];
    if (D1[n] == D2[n]) {
      check++;
    } else {
      check = 0;
    }
    if (check == 3) {
      is_yes = 1;
    }
  }
  if (is_yes) {
    cout << "Yes\\n";
  } else {
    cout << "No\\n";
  }
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;

  cin >> n;

  int data[n + 1][2];

  for (int i = 0; i < n; ++i)
    cin >> data[i][0] >> data[i][1];
  data[n][0] = 10, data[n][1] = 11;

  for (int i = 0; i < n + 1; ++i) {
    if (i >= 2) {
      if (data[i][0] == data[i][1]) {
        if ((data[i - 1][0] == data[i - 1][1]) &&
            (data[i - 2][0] == data[i - 2][1])) {
          cout << "Yes" << endl;
          break;
        }
      }
    }
    if (data[i][0] == 10)
      cout << "No" << endl;
  }
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  int data[n][2];
  bool N[n];
  int count = 0;

  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> data[i][0] >> data[i][1];
  }

  for (int i = 0; i < n; ++i) {
    if (data[i][0] == data[i][1]) {
      N[i] = true;
    } else
      N[i] = false;
  }
  for (int i = 0; i < n; ++i) {
    if (N[i]) {
      count++;
      if (i == 0)
        continue;
      else if (N[i - 1])
        count++;
      else
        count = 0;
    }
    if (count >= 3)
      break;
  }
  if (count >= 3)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02547 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  int d11, d12, d21, d22, d31, d32;
  string s = "No";
  cin >> d11 >> d12 >> d21 >> d22;
  for (int i = 0; i < n - 2; i++) {
    int a, b;
    cin >> a >> b;
    if (i > 0) {
      d11 = d21;
      d12 = d22;
      d21 = d31;
      d22 = d32;
      d31 = a;
      d32 = b;
    } else {
      d31 = a;
      d32 = b;
    }
    if (d11 == d12 && d21 == d22 && d31 == d32) {
      s = "Yes";
    }
  }
  cout << s << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  int d11, d12, d21, d22, d31, d32;
  string s = "No";
  cin >> d11 >> d12 >> d21 >> d22;
  for (int i = 0; n - 2; i++) {
    int a, b;
    cin >> a >> b;
    if (i > 0) {
      d11 = d21;
      d12 = d22;
      d21 = d31;
      d22 = d32;
      d31 = a;
      d32 = b;
    } else {
      d31 = a;
      d32 = b;
    }
    if (d11 == d12 && d21 == d22 && d31 == d32) {
      s = "Yes";
    }
  }
  cout << s << endl;
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, cnt = 0;
  vector<int> d1(100);
  vector<int> d2(100);
  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> d1.at(i) >> d2.at(i);
  }

  for (int i = 0; i < n - 2; i++) {
    if (d1.at(i) == d2.at(i) && d1.at(i + 1) == d2.at(i + 1) &&
        d1.at(i + 2) == d2.at(i + 2)) {
      cnt = 1;
      break;
    }
  }

  if (cnt) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, cnt = 0;
  vector<int> d1(n);
  vector<int> d2(n);
  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> d1[i] >> d2[i];
  }

  for (int i = 0; i < n; i++) {
    if (d1.at(i) == d2.at(i)) {
      cnt++;
    }
  }

  if (cnt >= 3) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, val = 0;
  std::vector<int> v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == b)
      val += 1;
    else {
      v.push_back(val);
      val = 0;
    }
  }
  v.push_back(val);
  sort(v.begin(), v.end());
  int x = v[v.size() - 1];
  if (x >= 3)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, val = 0;
  std::vector<int> v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == b)
      val += 1;
    else {
      v.push_back(val);
      val = 0;
    }
  }
  int x = *max_element(v.begin(), v.end());
  if (x >= 3)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

//
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y, i, count = 0;
  cin >> n;
  vector<pair<int, int>> v;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    v.emplace_back(x, y);
  }
  for (i = 0; i <= n - 3; i++) {
    if (v[i].first == v[i].second) {
      if ((v[i + 1].first == v[i + 1].second) &&
          (v[i + 2].first == v[i + 2].second)) {
        count = 1;
        break;
      }
    }
  }
  if (count == 1) {
    cout << "Yes " << endl;
  } else {
    cout << "No " << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

//
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int tt;
  tt = 1;
  while (tt--) {
    int n, x, y, i, count = 0;
    cin >> n;
    vector<pair<int, int>> v;
    vector<int> v1;
    for (i = 0; i < n; i++) {
      cin >> x >> y;
      v.emplace_back(x, y);
    }
    for (i = 0; i < n; i++) {
      if (v[i].first == v[i].second) {
        count = 0;
        while (v[i].first == v[i].second) {
          count++;
          i++;
        }
        i--;
        v1.push_back(count);
      }
    }
    sort(v1.begin(), v1.end());
    if (v1[v1.size() - 1] >= 3) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

bool flag = 0;

int main() {
  int N;

  int num[110][5];

  cin >> N;

  for (int i = 0; i < N; i++)
    for (int j = 0; j < 2; j++) {
      cin >> num[i][j];
    }
  for (int i = 0; i < N - 2; i++) {
    if (num[i][0] == num[i][1] && num[i + 1][0] == num[i + 1][1] &&
        num[i + 2][0] == num[i + 2][1])
      flag = 1;
  }
  if (flag == 1)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {
  int N, k;

  int num[110][5];

  cin >> N;

  for (int i = 0; i < N; i++)
    for (int j = 0; j < 2; j++) {
      cin >> num[i][j];
    }
  for (int i = 0; i < N; i++) {
    if (num[i][0] == num[i][1]) {
      k = i;
      break;
    }
  }
  if (k <= N - 3 && num[k + 1][0] == num[k + 1][1] &&
      num[k + 2][0] == num[k + 2][1])
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 100005
#define pb push_back
#define vit vector<int>::iterator
typedef pair<lint, lint> pii;
lint A[MAX], B[MAX];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  lint n;
  cin >> n;
  for (lint i = 1; i <= n; i++)
    cin >> A[i] >> B[i];
  for (lint i = 2; i < n; i++) {
    if (A[i - 1] == B[i - 1] && A[i] == B[i] && A[i + 1] == B[i + 1]) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}


Error: -6
terminate called after throwing an instance of 'std::length_error'
  what():  cannot create std::vector larger than max_size()


Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 100005
#define pb push_back
#define vit vector<int>::iterator
typedef pair<lint, lint> pii;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  lint n;
  vector<lint> A(n), B(n);
  cin >> n;
  for (lint i = 0; i < n; i++)
    cin >> A[i] >> B[i];
  for (lint i = 1; i < n - 1; i++) {
    if (A[i - 1] == B[i - 1] && A[i] == B[i] && A[i + 1] == B[i + 1]) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main(void) {

  int n, d[100][2];
  int i, k;

  scanf("%d", &n);
  for (k = 0; k <= n - 1; k++) {
    scanf("%d %d", &d[k][0], &d[k][1]);
  }

  for (i = 0; i <= n - 3; i++) {
    if (d[i][0] == d[i][1] && d[i + 1][0] == d[i + 1][1] &&
        d[i + 2][0] == d[i + 2][1]) {
      printf("Yes");
      return 0;
    }
  }
  printf("No");
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>

int main(void) {

  int n, d[99][2];
  int i, k;

  scanf("%d", &n);
  for (k = 0; k <= n - 1; k++) {
    scanf("%d %d", d[k][0], d[k][1]);
  }

  for (i = 0; i <= n - 3; i++) {
    if (d[i][0] == d[i][1] && d[i + 1][0] == d[i + 1][1] &&
        d[i + 2][0] == d[i + 2][1]) {
      printf("Yes");
      return 0;
    }
  }
  printf("No");
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using P = pair<ll, ll>;
string char_to_string(char val) { return string(1, val); }
int char_to_int(char val) { return val - '0'; }
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
struct edge {
  ll to, cost;
};

int main() {
  int n;
  cin >> n;
  vector<vector<int>> d(n, vector<int>(2));
  for (int i = 0; i < n; i++) {
    cin >> d[i][0] >> d[i][1];
  }
  bool flag = false;
  for (int i = 0; i <= n - 3; i++) {
    if (d[i][0] == d[i][1] && d[i + 1][0] == d[i + 1][1] &&
        d[i + 2][0] == d[i + 2][1]) {
      flag = true;
      break;
    }
  }
  if (flag == true)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using P = pair<ll, ll>;
string char_to_string(char val) { return string(1, val); }
int char_to_int(char val) { return val - '0'; }
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
struct edge {
  ll to, cost;
};

int main() {
  int n;
  cin >> n;
  vector<vector<int>> d(n, vector<int>(2));
  for (int i = 0; i < n; i++) {
    cin >> d[i][0] >> d[i][1];
  }
  bool flag = false;
  for (int i = 0; i <= n - 2; i++) {
    if (d[i][0] == d[i][1] && d[i + 1][0] == d[i + 1][1] &&
        d[i + 2][0] == d[i + 2][1]) {
      flag = true;
      break;
    }
  }
  if (flag == true)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}