alexjercan/bugnet huggingface dataset:
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#define scanf_s scanf
// #define gets_s gets
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
#define MAX 10
#define MIN -100001
#define _MAX 10
int main(void) {
  int a, b, c, s = 0, h = 0;
  while (scanf_s("%d,%d,%d", &a, &b, &c) != EOF) {
    if (a == b)
      ++h;
    else if (c * c == a * a + b * b) {
      ++s;
    }
  }
  printf("%d\\n%d\\n", s, h);
}

Error: TLE

Fixed submission:

#define scanf_s scanf
// #define gets_s gets
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
#define MAX 10
#define MIN -100001
#define _MAX 10
int main(void) {
  int a, b, c, s = 0, h = 0;
  while (scanf_s("%d,%d,%d", &a, &b, &c)) {
    if (a == b)
      ++h;
    else if (c * c == a * a + b * b) {
      ++s;
    }
  }
  printf("%d\\n%d\\n", s, h);
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;

int main() {
  int n, m, d, r = 0, l = 0;
  char c;
  while (cin >> n >> c >> m >> c >> d) {
    if (n == m)
      l++;
    if (n * n + m * m == d * d)
      r++;
  }
  cout << r << endl << l << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;

int main() {
  int n, m, d, r = 0, l = 0;
  char c;
  while (cin >> n >> c >> m >> c >> d, n) {
    if (n == m)
      l++;
    if (n * n + m * m == d * d)
      r++;
  }
  cout << r << endl << l << endl;
  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int, int> pii;
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define REPR(i, n) for (ll i = 1; i < n; ++i)
#define FOR(i, a, b) for (ll i = a; i < b; ++i)

#define DEBUG(x) cout << #x << ": " << x << endl
#define DEBUG_VEC(v)                                                           \\
  cout << #v << ":";                                                           \\
  REP(i, v.size()) cout << " " << v[i];                                        \\
  cout << endl
#define ALL(a) (a).begin(), (a).end()

#define MOD (ll)(1e9 + 7)
#define ADD(a, b) a = ((a) + (b)) % MOD
#define FIX(a) ((a) % MOD + MOD) % MOD

int main() {
  int a, b, c;
  int x = 0, y = 0;
  while (~scanf("%d,%d,%d", &a, &b, &c)) {
    if (a * a + b * b == c * c)
      ++x;
    if (a == b)
      ++y;
  }
  cout << x << endl;
  cout << y << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int, int> pii;
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define REPR(i, n) for (ll i = 1; i < n; ++i)
#define FOR(i, a, b) for (ll i = a; i < b; ++i)

#define DEBUG(x) cout << #x << ": " << x << endl
#define DEBUG_VEC(v)                                                           \\
  cout << #v << ":";                                                           \\
  REP(i, v.size()) cout << " " << v[i];                                        \\
  cout << endl
#define ALL(a) (a).begin(), (a).end()

#define MOD (ll)(1e9 + 7)
#define ADD(a, b) a = ((a) + (b)) % MOD
#define FIX(a) ((a) % MOD + MOD) % MOD

int main() {
  int a, b, c;
  int x = 0, y = 0;
  while (~scanf("%d%d%d", &a, &b, &c)) {
    if (a * a + b * b == c * c)
      ++x;
    if (a == b)
      ++y;
  }
  cout << x << endl;
  cout << y << endl;
  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  int ans_a = 0, ans_b = 0;
  for (;;) {
    int a, b, c;
    if (scanf("%d,%d,%d", &a, &b, &c) == EOF) {
      break;
    }
    if (a * a + b * b == c * c) {
      ans_a++;
    }
    if (a == b) {
      ans_b++;
    }
  }
  cout << ans_a << endl << ans_b << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  int ans_a = 0, ans_b = 0;
  for (;;) {
    int a, b, c;
    scanf("%d,%d,%d", &a, &b, &c);
    if (a * a + b * b == c * c) {
      ans_a++;
    }
    if (a == b) {
      ans_b++;
    }
  }
  cout << ans_a << endl << ans_b << endl;
  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
  int rectangle = 0;
  int lozenge = 0;
  int x, y, z;
  vector<int> edge;

  while (cin >> x) {
    cin.ignore();
    cin >> y;
    cin.ignore();
    cin >> z;
    if (x == y)
      lozenge++;
    if (x * x + y * y == z * z)
      rectangle++;
  }
  cout << rectangle << endl;
  cout << lozenge << endl;

  return 0;
}

Error: 0
1:added3 4 5 
2:added5 5 8 
3:added4 4 4 


Fixed submission:

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
  int rectangle = 0;
  int lozenge = 0;
  int x, y, z;
  int i, n = 0;
  pair<int, pair<int, int>> tri[10000];
  bool isok = true;

  while (cin >> x) {
    cin.ignore();
    cin >> y;
    cin.ignore();
    cin >> z;
    vector<int> edge;
    pair<int, int> tmp1;
    edge.push_back(x);
    edge.push_back(y);
    edge.push_back(z);

    sort(edge.begin(), edge.end());
    tmp1 = pair<int, int>(edge[1], edge[2]);

    for (i = 0; i < n; i++) {
      if (tri[i] == pair<int, pair<int, int>>(edge[0], tmp1)) {
        isok = false;
      }
    }

    if (isok) {
      tri[n++] = pair<int, pair<int, int>>(edge[0], tmp1);
      cerr << n << ":added" << edge[0] << " " << edge[1] << " " << edge[2]
           << " " << endl;
      if (edge[0] * edge[0] + edge[1] * edge[1] == edge[2] * edge[2]) {
        rectangle++;
      } else {
        lozenge++;
      }
    }
    isok = true;
  }

  cout << rectangle << endl;
  cout << lozenge << endl;

  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int t = 0, h = 0;
  int a, b, c;
  string buf;
  while (cin >> buf) {
    sscanf(buf.c_str(), "%d,%d,%d", &a, &b, &c);
    if (a == b)
      h++;
    if (a * a + b * b == c * c)
      t++;
  }
  cout << t << endl << h << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int t = 0, h = 0;
  int a, b, c;
  while (scanf("%d,%d,%d", &a, &b, &c)) {
    vector<int> all;
    all.push_back(a);
    all.push_back(b);
    all.push_back(c);
    sort(all.begin(), all.end());
    if (all[0] == all[1])
      h++;
    if (all[0] * all[0] + all[1] * all[1] == all[2] * all[2])
      t++;
  }
  cout << t << endl << h << endl;
  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main() {
  int a, b, c, t = 0, h = 0;
  while (scanf("%d,%d,%d", &a, &b, &c) != EOF) {
    if (a * a + b * b == c * c) {
      t++;
    } else if (a == b) {
      h++;
    }
  }
  cout << t << endl << h << endl;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main() {
  int a, b, c, t = 0, h = 0;
  while (scanf("%d,%d,%d", &a, &b, &c)) {
    if (a * a + b * b == c * c) {
      t++;
    } else if (a == b) {
      h++;
    }
  }
  cout << t << endl << h << endl;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
#include <iostream>

int main() {
  int a, b, c;
  int rec = 0, dia = 0;

  while (scanf("%d,%d,%d", &a, &b, &c) != EOF) {
    if (a * a + b * b == c * c)
      rec++;
    else if (a == b)
      dia++;
  }

  std::cout << rec << std::endl << dia << std::endl;

  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
#include <iostream>

int main() {
  int a, b, c;
  int rec = 0, dia = 0;

  while (scanf("%d,%d,%d", &a, &b, &c)) {
    if (a * a + b * b == c * c)
      rec++;
    else if (a * a + b * b > c * c)
      dia++;
  }

  std::cout << rec << std::endl << dia << std::endl;

  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
  int a, b, c;
  int ans1 = 0, ans2 = 0;

  while (scanf("%d,%d,%d", &a, &b, &c) != EOF) {

    // if(a == 0 && b == 0 && c == 0) break;
    if (a != b && a != c) {
      ans2++;
    }
    if (a == b && a != c && b != c) {
      ans1++;
    }
  }

  cout << ans1 << endl;
  cout << ans2 << endl;

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
  int a, b, c;
  int ans1 = 0, ans2 = 0;

  while (scanf("%d,%d,%d", &a, &b, &c)) {

    if (a == 0 && b == 0 && c == 0)
      break;
    if (a != b && a != c && b != c) {
      ans1++;
    }
    if (a == b && a != c && c != b) {
      ans2++;
    }
  }

  cout << ans2 << endl;
  cout << ans1 << endl;

  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main(void) {
  int a, b, c;
  int rec = 0;
  int loz = 0;
  while (scanf("%d,%d,%d", &a, &b, &c) != EOF) {
    if (a == b)
      loz++;
    if (a * a + b * b == c * c)
      rec++;
  }
  cout << rec << endl;
  cout << loz << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {
  int a, b, c;
  int rec = 0;
  int loz = 0;
  while (scanf("%d,%d,%d", &a, &b, &c)) {
    if (a == b)
      rec++;
    if (a * a + b * b == c * c)
      loz++;
  }
  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main() {
  int l1, l2, dia, rc, lc;
  rc = lc = 0;
  while (scanf("%d,%d,%d", &l1, &l2, &dia) != EOF) {
    if (l1 * l1 + l2 * l2 == dia * dia) {
      rc++;
    }
    if (l1 == l2) {
      lc++;
    }
  }
  printf("%d\\n%d\\n", rc, lc);
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main() {
  int l1, l2, dia, rc, lc;
  rc = lc = 0;
  while (scanf("%d %d %d", &l1, &l2, &dia) != EOF) {
    if (l1 * l1 + l2 * l2 == dia * dia) {
      rc++;
    }
    if (l1 == l2) {
      lc++;
    }
  }
  printf("%d\\n%d\\n", rc, lc);
  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {

  int x = 0, y = 0;
  int a, b, c;
  char comma;
  while (scanf("%d,%d,%d", &a, &b, &c) != EOF) {
    if (pow(a, 2) + pow(b, 2) == pow(c, 2))
      x++;
    if (pow(a, 2) - pow(double(c) / 2, 2) == pow(b, 2) - pow(double(c) / 2, 2))
      y++;
  }

  cout << x << endl;
  cout << y << endl;
}

Error: TLE

Fixed submission:

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {

  int x = 0, y = 0;
  int a, b, c;
  char comma;
  while (cin >> a >> comma >> b >> comma >> c, a != 0) {
    if (pow(a, 2) + pow(b, 2) == pow(c, 2))
      x++;
    if (pow(a, 2) - pow(double(c) / 2, 2) == pow(b, 2) - pow(double(c) / 2, 2))
      y++;
  }

  cout << x << endl;
  cout << y << endl;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int a, b, c;
  int cnt1 = 0, cnt2 = 0;
  while (scanf("%d,%d,%d", &a, &b, &c) != EOF) {
    if (a * a + b * b == c * c)
      cnt1++;
    if (a == b)
      cnt2++;
  }
  cout << cnt1 << endl << cnt2 << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int cnt1 = 0, cnt2 = 0;
  int a, b, c;
  while (scanf("%d,%d,%d", &a, &b, &c)) {
    if (a == b)
      cnt2++;
    else if (a * a + b * b == c * c)
      cnt1++;
  }
  cout << cnt1 << endl << cnt2 << endl;
  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main() {
  int x, y, z;
  int N = 0, W = 0;
  while (scanf("%d,%d,%d", &x, &y, &z) != EOF) {
    if (z * z == x * x + y * y)
      N++;
    else if (x == y)
      W++;
  }
  printf("%d\\n%d\\n", N, W);
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main() {

  int x, y, z;
  int N = 0, W = 0;
  while (scanf("%d %d %d", &x, &y, &z) != EOF) {
    if (x == y)
      N++;
    else if (x != y)
      W++;
  }
  printf("%d\\n", N);
  printf("%d\\n", W);

  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
using namespace std;

int a, b, c, r = 0, d = 0;

int main() {
  while (scanf("%d,%d,%d", &a, &b, &c) != EOF) {
    if (a * a + b * b == c * c) {
      r++;
    }
    if (a == b) {
      d++;
    }
  }
  printf("%d\\n%d\\n", r, d);

  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
#include <string>
using namespace std;

int a, b, c;
int rec, loz;

int main() {
  rec = loz = 0;
  while (scanf("%d,%d,%d\\n", &a, &b, &c)) {
    if (a == b) {
      loz++;
    }
    if (a * a + b * b == c * c) {
      rec++;
    }
  }
  printf("%d\\n%d\\n", rec, loz);

  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;

/*-------------------------------*/
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/

int main(void) {
  int a[3];
  char b[2];
  int rect = 0, rhom = 0;

  while (cin >> a[0] >> b[0] >> a[1] >> b[1] >> a[2]) {
    if (a[0] == a[1])
      rhom++;
    else if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2])
      rect++;
  }
  cout << rect << "\\n" << rhom << endl;

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

/*-------------------------------*/
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/

int main(void) {
  int a[3];
  int rect = 0, rhom = 0;
  while (scanf("%d", &a[0]) != EOF) {
    scanf("%d,%d", &a[1], a[2]);
    sort(a, a + 3);
    if (a[0] = a[1])
      rhom++;
    else
      rect++;
  }
  cout << rect << "\\n" << rhom << endl;

  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define PI acos(-1.0)
#define ALL(A) ((A).begin(), (A).end())
#define vsort(v) sort(v.begin(), v.end())
#define FOR(I, A, B) for (int I = (A); I < (B); ++I)

int main() {
  int a, b, c;
  int sq = 0, hishi = 0;
  while (scanf("%d,%d,%d", &a, &b, &c) == 3) {
    if (a * a + b * b == c * c)
      sq++;
    if (a == b)
      hishi++;
  }
  cout << sq << endl;
  cout << hishi << endl;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define PI acos(-1.0)
#define ALL(A) ((A).begin(), (A).end())
#define vsort(v) sort(v.begin(), v.end())
#define FOR(I, A, B) for (int I = (A); I < (B); ++I)

int main() {
  int a, b, c;
  int sq = 0, hishi = 0;
  while (scanf("%d,%d,%d\\n", &a, &b, &c)) {
    if (a * a + b * b == c * c)
      sq++;
    else if (a == b)
      hishi++;
  }
  cout << sq << endl;
  cout << hishi << endl;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>

using namespace std;

int main() {
  int side[3];
  int iso = 0, cho = 0;
  while (scanf("%d,%d,%d", &side[0], &side[1], &side[2]) != EOF) {
    if (side[0] == side[1])
      iso++;
    else if ((side[0] * side[0]) + (side[1] * side[1]) == (side[2] * side[2]))
      cho++;
  }
  printf("%d\\n", cho);
  printf("%d\\n", iso);
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>

using namespace std;

int main() {
  int side[3];
  int iso = 0, cho = 0;
  while (scanf("%d,%d,%d", &side[0], &side[1], &side[2])) {
    if (side[0] == side[1])
      iso++;
    else if ((side[0] * side[0]) + (side[1] * side[1]) == (side[2] * side[2]))
      cho++;
  }
  printf("%d\\n", cho);
  printf("%d\\n", iso);
  return 0;
}
Problem p00032 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int r = 0;
  int d = 0;
  int a, b, c;
  char t;
  while (cin >> a >> t >> b >> t >> c) {
    if (a * a + b * b == c * c)
      r++;
    if (a == b)
      d++;
  }
  cout << r << endl;
  cout << d << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

int BT(int N, int S, int d, int p, int s) {
  if (d == N)
    return s == S ? 1 : 0;
  int ans = 0;
  for (int i = p; i <= S; i++)
    ans += BT(N, S, d + 1, i + 1, s + i);
  return ans;
}

int main() {
  while (true) {
    int n, s;
    cin >> n >> s;
    if (n == 0 && s == 0)
      break;

    cout << BT(n, s, 0, 0, 0) << endl;
  }

  return 0;
}
Problem p00033 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
int a, l1, l2, n;
bool f;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    f = 0;
    l1 = 0;
    l2 = -1;
    for (int j = 1; j <= 10; j++) {
      scanf("%d", &a);
      if (!f && a < l2 && a < l1) {
        printf("NO\\n");
        f = 1;
        continue;
      }
      if (!f && l1 > l2) {
        if (l1 < a)
          l1 = a;
        else
          l2 = a;
      }
      if (!f && l2 > l1) {
        if (l2 < a)
          l2 = a;
        else
          l1 = a;
      }
    }
    if (!f)
      printf("YES\\n");
  }
}

Error: TLE

Fixed submission:

#include <cstdio>
int n, j, lj, F;
int a[15], f[15];
int main() {
  scanf("%d", &n);
  while (1) {
    j = 0;
    F = 0;
    lj = 0;
    for (int i = 1; i <= 10; i++)
      f[i] = 0, a[i] = 0;
    for (int i = 1; i <= 10; i++)
      scanf("%d", &a[i]);
    lj = 1;
    for (int i = 1; i <= 10; i++)
      if (a[i + 1] > a[lj])
        f[lj] = 1, lj = i + 1;
    lj = 0;
    for (int i = 1; i <= 10; i++)
      if (!f[i]) {
        if (a[i] > a[lj])
          lj = i;
        else {
          printf("NO\\n");
          F = 1;
          break;
        }
      }
    if (F)
      continue;
    printf("YES\\n");
  }
}
/*
#include <iostream>

using namespace std;

const int N = 10;

int main()
{
    int n;

    cin >> n;
    while(n--) {
        bool ans = true;
        int a, b=-1, c=-1;
        for(int i=1; i<=N; i++) {
            cin >> a;
            if(ans) {
                if(a > b)
                    b = a;
                else if(a > c)
                    c = a;
                else
                    ans = false;
            }
        }

        cout << (ans ? "YES" : "NO") << endl;
    }

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

#include <iostream>
#include <string>
using namespace std;
bool a[15];
int d[15];
string b, c;
int judge = 0;
void dfs(int n) {
  if (n == 10) {
    for (int i = 0; i < 10; i++) {
      if (a[i] == false) { // 进c
        c.push_back('0' + d[i]);
      } else {
        b.push_back('0' + d[i]);
      }
    }
    int ok = 1;
    for (int j = 0; j < b.size() - 1; j++) {
      if (b[j] > b[j + 1]) {
        ok = 0;
        break;
      }
    }
    for (int j = 0; j < c.size() - 1; j++) {
      if (c[j] > c[j + 1]) {
        ok = 0;
        break;
      }
    }
    if (ok)
      judge = 1;
    b.clear();
    c.clear();
    return;
  } else {
    a[n] = true;
    dfs(n + 1);
    a[n] = false;
    dfs(n + 1);
    return;
  }
}
/*void ddfs(int n){
        cout<<n<<endl;
        if(n==10){
                judge=0;
                dfs(0);
                for(int i=0;i<n;i++){
                        cout<<d[i]<<' ';
                }
                cout<<endl;
                if(judge){
                        cout<<"YES"<<endl;
                }
                else{
                        cout<<"NO"<<endl;
                }
                return;
        }
        for(int i=1;i<=10;i++){
                int ok=1;
                for(int j=0;j<n;j++){
                        if(d[j]==i){
                                ok=0;break;
                        }
                }
                if(ok){
                        d[n]=i;
                        ddfs(n+1);
                }
        }
}*/
int main() {
  int n;
  cin >> n;
  while (n--) {
    b.clear();
    c.clear();
    judge = 0;
    for (int i = 0; i < 10; i++) {
      cin >> d[i];
    }
    dfs(0);
    if (judge) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}


Error: -11

Fixed submission:

#include <iostream>
#include <vector>
using namespace std;
bool a[15];
int d[15];
vector<int> b, c;
int judge;
void dfs(int n) {
  if (n == 10) {
    for (int i = 0; i < 10; i++) {
      if (a[i] == false) { // 进c
        c.push_back(d[i]);
      } else {
        b.push_back(d[i]);
      }
    }
    int ok = 1;
    for (int j = 0; j < b.size() - 1; j++) {
      if (b[j] > b[j + 1]) {
        ok = 0;
        break;
      }
    }
    for (int j = 0; j < c.size() - 1; j++) {
      if (c[j] > c[j + 1]) {
        ok = 0;
        break;
      }
    }
    if (ok)
      judge = 1;
  } else {
    a[n] = true;
    dfs(n + 1);
    a[n] = false;
    dfs(n + 1);
  }
}
int main() {
  int n;
  cin >> n;
  while (n--) {
    b.clear();
    c.clear();
    judge = 0;
    for (int i = 0; i < 10; i++) {
      cin >> d[i];
    }
    dfs(0);
    if (judge) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}