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

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fir first
#define sec second
#define MOD 1000000007
#define vvi vector<vector<int>>
#define vvs vector<vector<string>>
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define pb push_back
#define vi vector<int>
#define test(t)                                                                \\
  int t;                                                                       \\
  cin >> t;                                                                    \\
  while (t--)
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define vvl vector<vl>
#define loopin(i, n) for (int i = 0; i < (n); i++)
#define loopdec(i, n) for (int i = n - 1; i >= 0; i--)
const int mod = 1e9 + 7;

void solve() {
  int n;
  cin >> n;
  int a[n + 1][10];
  for (int i = 0; i < n; i++) {
    cin >> a[i][0];
    cin >> a[i][1];
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i][0] == a[i][1]) {
      count++;
    } else {
      count = 0;
    }
    if (count >= 3) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  solve();

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fir first
#define sec second
#define MOD 1000000007
#define vvi vector<vector<int>>
#define vvs vector<vector<string>>
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define pb push_back
#define vi vector<int>
#define test(t)                                                                \\
  int t;                                                                       \\
  cin >> t;                                                                    \\
  while (t--)
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define vvl vector<vl>
#define loopin(i, n) for (int i = 0; i < (n); i++)
#define loopdec(i, n) for (int i = n - 1; i >= 0; i--)
const int mod = 1e9 + 7;

void solve() {
  int n;
  cin >> n;
  int a[10][10];
  for (int i = 0; i < n; i++) {
    cin >> a[i][0];
    cin >> a[i][1];
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i][0] == a[i][1]) {
      count++;
    } else {
      count = 0;
    }
    if (count >= 3) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  solve();

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

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

int main() {
  int n;
  cin >> n;
  vector<int> d1(n);
  vector<int> d2(n);
  bool flag = true;

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

  for (int i = 0; i < n - 2; i++) {
    if (d1[i] == d2[i])
      if (d1[i + 1] == d2[i + 1])
        if (d1[i + 2] == d2[i + 2] && flag) {
          cout << "Yes" << endl;
          flag = false;
        }
  }

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

Error: 1

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  vector<int> d1(n);
  vector<int> d2(n);

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

  for (int i = 0; i < n - 2; i++) {
    if (d1[i] == d2[i])
      if (d1[i + 1] == d2[i + 1])
        if (d1[i + 2] == d2[i + 2]) {
          cout << "Yes" << endl;
          return 1;
        }
  }

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

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

#define ll long long int

static const auto _____ = []() {
  // fast IO code : this I understand
  ios::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(0);
  return 0;
}();

int main() {
  int n;
  cin >> n;
  int a[n][2];
  int cnt = 0;
  int flag = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    if (a[i][0] == a[i][1]) {
      cnt++;
      if (cnt == 3)
        flag = 1;
    } else
      cnt = 0;
  }
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Error: 0

Fixed submission:

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

#define ll long long int

static const auto _____ = []() {
  // fast IO code : this I understand
  ios::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(0);
  return 0;
}();

int main() {
  int n;
  cin >> n;
  int a[2][n];
  int cnt = 0;
  int flag = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    if (a[i][0] == a[i][1]) {
      cnt++;
      if (cnt == 3)
        flag = 1;
    } else
      cnt = 0;
  }
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define FAST                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(nullptr);
#define ll long long int
#define f(i, a, b) for (int i = a; i < b; i++)
#define fr(i, a, b) for (int i = a; i >= b; i--)
#define l long int
#define endl '\\n'
#define pb push_back
#define pf pop.front()
using namespace std;

void solve() {
  int n;
  cin >> n;

  int d[n][2];

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

  for (int i = 0; i < n; i++) {
    int j = 2, y = 0;
    if (d[i][0] == d[i][1]) {
      while (j) {
        if (i + j >= n) {
          y = 0;
          break;
        }

        if (d[i + j][0] == d[i + j][1]) {
          y = 1;
        } else {
          y = 0;
          break;
        }
        j--;
      }
    }
    if (y) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int32_t main() {
  FAST l T = 1;
  // cin>>T;
  while (T--) {
    solve();
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define FAST                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(nullptr);
#define ll long long int
#define f(i, a, b) for (int i = a; i < b; i++)
#define fr(i, a, b) for (int i = a; i >= b; i--)
#define l long int
#define endl '\\n'
#define pb push_back
#define pf pop.front()
using namespace std;

void solve() {
  int n;
  cin >> n;

  int d[n][2];

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

  for (int i = 0; i < n; i++) {
    int j = 2, y = 0;
    if (d[i][0] == d[i][1]) {
      while (j) {
        if (i + j >= n) {
          y = 0;
          break;
        }

        if (d[i + j][0] == d[i + j][1]) {
          y = 1;
        } else {
          y = 0;
          break;
        }
      }
    }
    if (y) {
      cout << "Yes" << endl;
      return;
    }
    j--;
  }
  cout << "No" << endl;
}

int32_t main() {
  FAST l T = 1;
  // cin>>T;
  while (T--) {
    solve();
  }
}
Problem p02547 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

void solve() {
  int n;
  cin >> n;
  int c = 0;
  while (n--) {
    int x, y;
    cin >> x >> y;
    if (x == y) {
      ++c;
      if (c == 3) {
        cout << "Yes\\n";
        return;
      }
    } else
      c = 0;
  }
  cout << "No\\n";
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

void solve() {
  int n;
  cin >> n;
  int c = 0;
  while (n--) {
    int x, y;
    cin >> x >> y;
    if (x == y) {
      ++c;
      if (c == 3) {
        cout << "Yes\\n";
        return;
      }
    }
    c = 0;
  }
  cout << "No\\n";
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;
using ll = long long;
using namespace std;

int main() {
  unsigned int N;
  bool flag = false;
  vector<unsigned int> id;
  cin >> N;
  vector<pair<unsigned int, unsigned int>> vec(N);
  for (unsigned int i = 0; i < N; i++) {
    cin >> vec[i].first >> vec[i].second;
    if (vec[i].first == vec[i].second) {
      id.push_back(i);
    }
  }

  if (id.size() > 2) {
    for (unsigned int j = 0; j < (id.size() - 2); j++) {
      if (id[j] + 2 == id[j + 2] && id[j] + 2 == id[j + 1] + 1) {
        flag = true;
        break;
      }
    }
    if (flag == true) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    cout << "No" << endl;
  }
}


Error: 0

Fixed submission:

#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;
using ll = long long;
using namespace std;

int main() {
  unsigned int N;
  bool flag = false;
  vector<unsigned int> id;
  cin >> N;
  vector<pair<unsigned int, unsigned int>> vec(N);
  for (unsigned int i = 0; i < N; i++) {
    cin >> vec[i].first >> vec[i].second;
    if (vec[i].first == vec[i].second) {
      id.push_back(i);
    }
  }
  for (unsigned int j = 0; j < (id.size() - 2); j++) {
    if ((id[j] + id[j + 1] + id[j + 2]) % 3 == 0) {
      flag = true;
      break;
    }
  }
  if (flag == true) {
    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, J = 0;
  cin >> N;
  int L = N * 2;

  vector<int> D(N * 2);

  for (int i = 0; i < L; i = i + 2) {
    cin >> D.at(i);
    cin >> D.at(i + 1);

    if (D.at(i) == D.at(i + 1)) {
      J++;
    }

    else {
      J = 0;
    }

    if (J == 3) {
      break;
    }
  }

  if (J >= 3) {
    cout << "Yes" << endl;
  }

  else if (J <= 2) {
    cout << "No" << endl;
  }
}

Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 5) >= this->size() (which is 5)


Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, J = 1;
  cin >> N;

  vector<int> D(N);

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

    if (D.at(i) == D.at(i + 1)) {
      J++;
    }

    else {
      J = 0;
    }

    if (J == 3) {
      break;
    }
  }

  if (J == 3) {
    cout << "Yes" << endl;
  }

  else if (J <= 2) {
    cout << "No" << endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
#define very_slow                                                              \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define int long long int
int32_t main() {
  very_slow
  //	no_of_test(x)
  {
    int k;
    cin >> k;
    vector<pair<int, int>> v;
    for (int w = 0; w < k; w++) {
      int x, y;
      cin >> x >> y;
      v.push_back(make_pair(x, y));
    }
    int cnt = 0;
    bool flag = false;
    for (auto itr = v.begin(); itr != v.end(); itr++) {
      if (itr->first == itr->second) {
        cnt++;
        if (cnt >= 3) {
          flag = true;
        }
      } else {
        cnt = 0;
      }
    }
    if (flag == true) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define very_slow                                                              \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define int long long int
int32_t main() {
  very_slow
  //	no_of_test(x)
  {
    int k;
    cin >> k;
    vector<pair<int, int>> v;
    for (int w = 0; w < k; w++) {
      int x, y;
      cin >> x >> y;
      v.push_back(make_pair(x, y));
    }

    bool flag = false;
    for (auto itr = v.begin(); itr != v.end();) {
      int cnt = 0;
      if (itr->first == itr->second) {
        while (itr->first == itr->second) {
          cnt++;
          itr++;
        }
        if (cnt >= 3) {
          flag = true;
        }
      } else {
        itr++;
      }
    }
    if (flag == true) {
      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() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  int flag = 0;
  int c = 0;
  int max = 0;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (!flag && a == b) {
      flag = 1;
    }
    if (flag && a == b)
      c++;
    if (flag && a != b) {
      flag = 0;
      if (c > max) {
        max = c;
      }
      c = 0;
    }
  }
  if (c >= max)
    max = c;
  if (max >= 3)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  int flag = 0;
  int c = 0;
  vector<int> arr;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (!flag && a == b) {
      flag = 1;
    }
    if (flag && a == b)
      c++;
    if (flag && a != b) {
      flag = 0;
      arr.push_back(c);
    }
  }
  int max = *max_element(arr.begin(), arr.end());
  if (max >= 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, a, b;
  cin >> n;
  int c = 0;
  string ans = "No";
  while (n--) {
    cin >> a >> b;
    if (a == b)
      c++;
    else
      c = 0;
    if (c >= 3) {
      ans = "Yes";
    }
  }
  cout << ans;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[6], b[6];
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i] >> b[i];
  int c = 0;
  for (int i = 0; i < n - 2; i++) {
    if (a[i] == b[i] && a[i + 1] == b[i + 1] && a[i + 2] == b[i + 2]) {
      c = 1;
      break;
    }
  }
  if (c)
    cout << "YES";
  if (!c)
    cout << "NO";
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

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

typedef long long int ll;
typedef long long unsigned int ull;
typedef long double ld;
typedef vector<int> vr;
typedef pair<int, int> pr;
#define pb push_back
#define ff first
#define ss second
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433
#define endl "\\n"
// cout << fixed << setprecision(2);

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int cnt = 0;
  vector<int> ans;
  vector<int>::iterator it;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a == b) {
      cnt++;
      ans.push_back(cnt);
      // cout << cnt << endl;
    } else {
      // cout <<  cnt << endl;
      cnt = 0;
    }
  }
  int fi = 0;
  // it = find(ans.begin(), ans.end())
  /*
  for(auto i: ans){
      cout << i << " ";
  }
  cout << endl;
  */
  for (int i = 0; i < ans.size(); i++) {
    if (ans[i] >= 3 && ans[i] % 3 == 0) {
      fi++;
    }
  }
  // cout << fi << endl;
  if (fi >= 1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

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

typedef long long int ll;
typedef long long unsigned int ull;
typedef long double ld;
typedef vector<int> vr;
typedef pair<int, int> pr;
#define pb push_back
#define ff first
#define ss second
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433
#define endl "\\n"
// cout << fixed << setprecision(2);

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int cnt = 0;
  vector<int> ans;
  vector<int>::iterator it;
  for (int i = 1; i <= n; i++) {
    int a, b;
    cin >> a >> b;
    if (a == b) {
      cnt++;
    } else {
      ans.push_back(cnt);
      cnt = 0;
    }
  }
  int fi = 3;
  it = find(ans.begin(), ans.end(), fi);
  if (*it == 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;
typedef long long ll;
const int maxn = 1e5 + 13;

int a[maxn];
int b[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &b[i]);
  }
  for (int i = 1; i <= n - 2; i++) {
    int cnt = 0;
    for (int j = 0; j < 3; j++) {
      if (a[i + j] == b[i + j]) {
        cnt++;
      }
    }
    if (cnt == 3) {
      return printf("Yes"), 0;
    }
  }
  printf("No");
}

Error: 3

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 13;

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

#include <iostream>
using namespace std;
int main() {
  int n, sum = 0;
  cin >> n;
  int a[n][2];
  cin >> a[0][0] >> a[0][1] >> a[1][0] >> a[1][1];
  for (int i = 2; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    if (a[i - 2][1] == a[i - 2][0] && a[i - 1][1] == a[i - 1][0] &&
        a[i][1] == a[i][0]) {
      sum++;
      cout << "Yes";
      break;
    }
  }

  if (sum == 0)
    cout << "No";

  return 0;
}


Error: WA

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, sum = 0;
  cin >> n;
  int a[2][n];
  cin >> a[0][0] >> a[0][1] >> a[1][0] >> a[1][1];
  for (int i = 2; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    if (a[i - 2][1] == a[i - 2][0] && a[i - 1][1] == a[i - 1][0] &&
        a[i][1] == a[i][0]) {
      sum++;
      cout << "Yes";
      break;
    }
  }

  if (sum == 0)
    cout << "No";

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d[110][3];
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> d[i][j];
    }
  }
  bool flag = 0;
  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 = 1;
      break;
    }
  }
  if (flag == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d[10][3];
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> d[i][j];
    }
  }
  bool flag = 0;
  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 = 1;
      break;
    }
  }
  if (flag == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
  // your code goes here
  int n, c = 0;
  cin >> n;
  while (n--) {
    int a, b;
    cin >> a >> b;
    if (a == b)
      c++;
    else
      c = 0;
    if (c == 3) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
  // your code goes here
  int n;
  cin >> n;
  vector<int> v1;
  vector<int> v2;
  while (n--) {
    int a, b;
    cin >> a >> b;
    v1.push_back(a);
    v2.push_back(b);
  }
  vector<int> v;
  int c = 0;
  for (int i = 0; i < v1.size(); i++) {
    if (v1[i] == v2[i]) {
      c++;
    } else {
      v.push_back(c);
      c = 0;
    }
  }
  if (*max_element(v.begin(), v.end()) >= 3)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
Problem p02547 (C++) — buggy submission, verdict: Runtime Error

#include "bits/stdc++.h"
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n][2];
  for (int i = 0; i < n; i++)
    cin >> arr[i][0] >> arr[i][1];
  bool f[n];
  for (int i = 0; i < n; i++)
    f[i] = arr[i][0] == arr[i][1];
  for (int i = 0; i < n - 2; i++)
    if (f[i] && f[i + 1] && f[i + 2]) {
      cout << "Yes" << endl;
      return 0;
    }
  cout << "No" << endl;
}

Error: 4

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n][2];
  for (int i = 0; i < n; i++)
    cin >> arr[i][0] >> arr[i][1];
  bool f[n];
  for (int i = 0; i < n; i++)
    f[i] = arr[i][0] == arr[i][1];
  for (int i = 0; i < n - 2; i++)
    if (f[i])
      return puts("Yes");
  cout << "No" << endl;
}
Problem p02550 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  ll n, x, m;
  cin >> n >> x >> m;
  vector<bool> check(m + 1, false);
  vector<ll> a;
  ll rs;
  check[x] = true;
  a.push_back(x);

  while (1) {
    ll f = (x * x) % m;
    if (check[f] == true) {
      rep(i, a.size()) {
        if (a[i] == f)
          rs = i;
      }
      break;
    } else {
      check[f] = true;
    }
    x = f;
    a.push_back(x);
  }
  ll roop = a.size() - rs;
  ll ans = 0;
  vector<ll> asum(a.size());

  rep(i, a.size()) {
    if (i == 0)
      asum[i] = a[i];
    else
      asum[i] = asum[i - 1] + a[i];
  }

  if (n < rs) {
    ans = asum[n];
  } else {
    ans = asum[rs] - a[rs];
    n = n - rs;
    ans += (n / roop) * (asum[asum.size() - 1] - (asum[rs] - a[rs])) +
           ((asum[n % roop + rs] - a[n % roop + rs]) - (asum[rs] - a[rs]));
  }

  cout << ans << endl;

  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  ll n, x, m;
  cin >> n >> x >> m;
  vector<bool> check(m + 1, false);
  vector<ll> a;
  ll rs;
  check[x] = true;
  a.push_back(x);

  while (1) {
    ll f = (x * x) % m;
    if (check[f] == true) {
      rep(i, a.size()) {
        if (a[i] == f)
          rs = i;
      }
      break;
    } else {
      check[f] = true;
    }
    x = f;
    a.push_back(x);
  }
  ll roop = a.size() - rs;
  ll ans = 0;
  vector<ll> asum(a.size());

  rep(i, a.size() + 1) {
    if (i == 0)
      asum[i] = a[i];
    else
      asum[i] = asum[i - 1] + a[i];
  }

  if (n < rs) {
    ans = asum[n];
  } else {
    ans = asum[rs] - a[rs];
    n = n - rs;
    ans += (n / roop) * (asum[asum.size() - 1] - (asum[rs] - a[rs])) +
           ((asum[n % roop + rs] - a[n % roop + rs]) - (asum[rs] - a[rs]));
  }

  cout << ans << endl;

  return 0;
}