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

#include "algorithm"
#include "cstdio"
#include "cstring"
using namespace std;
int main() {
  // freopen("input.txt","r",stdin);
  int t;
  scanf("%d", &t);
  while (t--) {
    int a[3];
    scanf("%d%d%d", &a[0], &a[1], &a[2]);
    sort(a, a + 3);
    if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2])
      printf("YES\\n");
    else
      printf("NO\\n");
  }

  return 0;
};

Error: TLE

Fixed submission:

#include <stdio.h>
int main() {
  int a, b, c, n, i;
  while (scanf("%d", &n)) {
    for (i = 1; i <= n; i++) {
      scanf("%d%d%d", &a, &b, &c);
      if (a * a + b * b == c * c)
        printf("YES\\n");
      else
        printf("NO\\n");
    }
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {

  int N = 0, a = 0, b = 0, c = 0, i;

  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d %d %d", &a, &b, &c);

    if (a * a + b * b == c * c) {
      printf("YES\\n");
    } else if (a * a + c * c == b * b) {
      printf("YES\\n");
    } else if (b * b + c * c == a * a) {
      printf("YES\\n");
    } else {
      printf("NO\\n");
    }
  }
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>

int main() {

  int N = 0, a = 0, b = 0, c = 0, i;

  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d %d %d", a, b, c);
    if (a * a + b * b == c * c) {
      printf("YES\\n");
    } else if (a * a + c * c == b * b) {
      printf("YES\\n");
    } else if (b * b + c * c == a * a) {
      printf("YES\\n");
    } else {
      printf("NO\\n");
    }
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

bool judgement(int a, int b, int c) {
  if (a * a == b * b + c * c) {
    return true;
  } else {
    return false;
  }
}

int main() {
  int x;
  int y;
  int z;
  bool flag[3];
  int n;
  std::cin >> n;
  while (n > 0) {
    std::cin >> x >> y >> z;
    flag[0] = judgement(x, y, z);
    flag[1] = judgement(y, z, x);
    flag[2] = judgement(z, x, y);
    if (flag[0] || flag[1] || flag[2]) {
      std::cout << "YES" << std::endl;
    } else {
      std::cout << "NO" << std::endl;
    }
    n--;
  }
}


Error: TLE

Fixed submission:

#include <iostream>

bool judgement(int a, int b, int c) {
  if (a * a == b * b + c * c) {
    return true;
  } else {
    return false;
  }
}

int main() {
  int x;
  int y;
  int z;
  bool flag[3];
  while (true) {
    std::cin >> x >> y >> z;
    flag[0] = judgement(x, y, z);
    flag[1] = judgement(y, z, x);
    flag[2] = judgement(z, x, y);
    if (flag[0] || flag[1] || flag[2]) {
      std::cout << "YES" << std::endl;
    } else {
      std::cout << "NO" << std::endl;
    }
  }
}
Problem p00003 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main(void) {
  int x[3];
  cin >> x[1];
  string n = "NO", y = "YES";
  while (cin >> x[0] >> x[1] >> x[2]) {
    sort(x, x + 3);
    if (x[2] * x[2] == x[1] * x[1] + x[0] * x[0])
      cout << y << endl;
    else
      cout << n << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main(void) {
  int x[3];
  int d, i = 0;
  cin >> d;
  string n = "NO", y = "YES";
  while (i < d) {
    sort(x, x + 3);
    if (x[2] <= x[1] + x[0])
      cout << y << endl;
    else
      cout << n << endl;
    d++;
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int i, n;
  cin >> n;
  for (i = 0; i < n; i++) {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    if (a[2] * a[2] == a[0] * a[0] + a[1] * a[1]) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int i, n;
  cin >> n;
  for (i = 0; i = n; i++) {
    int a, b, c;
    while (cin >> a >> b >> c) {
      int tmp1, tmp2;
      if (b < a) {
        tmp1 = a;
        a = b;
        b = tmp1;
      }
      if (c < b) {
        tmp2 = b;
        b = c;
        c = tmp2;
      }
      if ((c ^ 2) == (a ^ 2) + (b ^ 2)) {
        cout << "YES" << endl;
      } else
        cout << "NO" << endl;
    }
  }

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

#include <stdio.h>
int main(void) {
  int n, i, w, a, s, d, x, j, z;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d %d", &a, &s, &d);
    if (a > s && d < a) {
      if (a * a == d * d + s * s) {
        printf("YES\\n");
      } else {
        printf("NO\\n");
      }
    } else if (a < d && d > s) {
      if (d * d == a * a + s * s) {
        printf("YES\\n");
      } else {
        printf("NO\\n");
      }
    } else if (a < s && s > d) {
      if (s * s == a * a + d * d) {
        printf("YES\\n");
      } else {
        printf("NO\\n");
      }
    } else if (a == s && s == d && d == a || a == s || s == d || d == a) {
      printf("NO\\n");
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>
int main(void) {
  int n, i, w, a, s, d, x, j, z;
  scanf("%\\n", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d %d", &a, &s, &d);
    if (a > s && d < a) {
      w = (d * d) + (s * s);
      x = a * a;
      if (w == x) {
        printf("YES\\n");
      } else {
        printf("NO\\n");
      }
    }
    if (a < d && d > s) {
      w = (a * a) + (s * s);
      x = d * d;
      if (w == x) {
        printf("YES\\n");
      } else {
        printf("NO\\n");
      }
    }
    if (a < s && s > d) {
      w = (d * d) + (s * s);
      x = s * s;
      if (w == x) {
        printf("YES\\n");
      } else {
        printf("NO\\n");
      }
    }
    if (a == s && s == d && d == a) {
      printf("NO\\n");
    }
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Runtime Error

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

#define eN 1000

using namespace std;

bool check(int e1, int e2, int e3) {
  if (((e1 * e1) + (e2 * e2)) == (e3 * e3)) {
    return true;
  } else {
    return false;
  }
}

int main(void) {
  int N;
  cin >> N;
  vector<bool> result;

  for (int i = 0; i < N; ++i) {
    int e1, e2, e3;
    vector<int> len;
    cin >> e1 >> e2 >> e3;
    len.push_back(e1);
    len.push_back(e2);
    len.push_back(e3);
    sort(len.begin(), len.end());
    result.push_back(check(len[0], len[1], len[2]));
  }
  vector<bool>::iterator res = result.begin();

  while (res != result.end()) {
    if (*res == true) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    ++res;
  }
  return 0;
}

Error: WA

Fixed submission:

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

#define upper 1000
#define lower 1
#define eN 1000

using namespace std;

bool check(int e1, int e2, int e3) {
  if (((e1 * e1) + (e2 * e2)) == (e3 * e3)) {
    return true;
  } else {
    false;
  }
}

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

  vector<bool> result;

  for (int i = 0; i < N; ++i) {
    if (N == eN) {
      break;
    }
    int e1, e2, e3;
    vector<int> len;
    cin >> e1 >> e2 >> e3;
    len.push_back(e1);
    len.push_back(e2);
    len.push_back(e3);
    sort(len.begin(), len.end());
    result.push_back(check(len[0], len[1], len[2]));
  }
  for (int i = 0; i < N; ++i) {
    if (result[i] == true) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <vector>
using namespace std;
int main() {
  int a, b, c, N;
  cin >> N;
  // vector<int> v;
  // while (cin >> a >> b >> c){
  // v.push_back(a,b,c);
  //   }
  // int x = a + b;
  // int y = b + c;
  // int z = c + a;
  // if (x => c || y => a || z => b){
  // cout << "NO" << endl;
  // } else if(x < c || y < a || z < b){
  // cout << "YES" << endl;
  // }
  while (N > 0) {
    cin >> a;
    cin >> b;
    cin >> c;
    // int x = a + b;
    // int y = b + c;
    // int z = c + a;
    if ( // x <= c || y <= a || z <= b
        a * a + b * b == c * c || b * b + c * c == a * a ||
        c * c + a * a == b * b) {
      cout << "YES" << endl;
      N = N - 1;
    } else if ( // x > c || y > a || z > b
        a * a + b * b != c * c || b * b + c * c != a * a ||
        c * c + a * a != b * b) {
      cout << "NO" << endl;
      N = N - 1;
    }
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
#include <vector>
using namespace std;
int main() {
  int a, b, c;
  // vector<int> v;
  // while (cin >> a >> b >> c){
  // v.push_back(a,b,c);
  //   }
  // int x = a + b;
  // int y = b + c;
  // int z = c + a;
  // if (x => c || y => a || z => b){
  // cout << "NO" << endl;
  // } else if(x < c || y < a || z < b){
  // cout << "YES" << endl;
  // }
  while (1) {
    cin >> a;
    cin >> b;
    cin >> c;
    int x = a + b;
    int y = b + c;
    int z = c + a;
    if (a == 0, b == 0, c == 0)
      break;
    if (x <= c || y <= a || z <= b) {
      cout << "NO" << endl;
    } else if (x > c || y > a || z > b) {
      cout << "YES" << endl;
    }
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Time Limit Exceeded



#include <algorithm>
#include <cstdio>
#include <iostream>

using namespace std;

#define COMPARE(left, right) (left == right ? "YES" : "NO")
#define SQUARE(value) (value * value)
#define SIZE 3

int main(void) {
  int ansArray[SIZE] = {0};
  int n;

  cin >> n;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < SIZE; j++) {
      cin >> ansArray[j];
    }

    sort(ansArray, ansArray + SIZE);

    cout << COMPARE(SQUARE(ansArray[0]) + SQUARE(ansArray[1]),
                    SQUARE(ansArray[2]))
         << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>
int main(void) {
  int n = 1;
  int i = 0;
  int a, b, c;
  int irekae = 0;
  while (n != 0) {
    scanf("%d", &n);
    if (n == 0) {

    } else {
      for (i = 0; i < n; i++) {
        scanf("%d", &a);
        scanf("%d", &b);
        if (a < b) {
          irekae = a;
          a = b;
          b = irekae;
        }
        scanf("%d", &c);
        if (a > c) {
          irekae = a;
          a = c;
          c = irekae;
        }
        if (c * c == a * a + b * b) {
          printf("Yes\\n");
        } else {
          printf("No\\n");
        }
      }
    }
  }
}
Problem p00003 (C++) — buggy submission, verdict: Time Limit Exceeded

/*
???????????£?????´??°?????\\?????????????????????????????????????????¨??????????§???¢???
??´?§?????§???¢??§????????´????????? YES ??????
????????´????????? NO ??¨????????????????????°?????????????????????????????????
*/

#include <iostream>

using namespace std;

int main() {

  int a, b, c, d1, d2, d3, i, N = 0;

  cin >> N;

  for (i = 0; i < N; i++) {

    cin >> a >> b >> c;

    d1 = a * a;
    d2 = b * b;
    d3 = c * c;

    if (d1 == (b * b) + (c * c)) {
      cout << "YES" << endl;
    } else if (d2 == (a * a) + (c * c)) {
      cout << "YES" << endl;
    } else if (d3 == (a * a) + (b * b)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {

  int a, b, c, d1, d2, d3;

  while (1) {
    cin >> a >> b >> c;

    d1 = a * a;
    d2 = b * b;
    d3 = c * c;

    if (d1 == (b * b) + (c * c)) {
      cout << "YES" << endl;
    } else if (d2 == (a * a) + (c * c)) {
      cout << "YES" << endl;
    } else if (d3 == (a * a) + (c * c)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>

using namespace std;

int main() {
  int a;
  int b;
  int c;
  int d;
  cin >> d;
  for (int i = 0; i < d; i++) {
    cin >> a >> b >> c;
    int e = a * a;
    int f = b * b;
    int g = c * c;
    if (e + f == g || e + g == f || f + g == e) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  for (int x = 0; x < 82;) {
    int a = 0;
    int b = 0;
    int c = 0;
    int d = a * a;
    int e = b * b;
    int f = c * c;
    cin >> a >> b >> c;
    if (d + e == f) {
      cout << "YES" << endl;
    } else if (d + f == e) {
      cout << "YES" << endl;
    } else if (e + f == d) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }

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

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    vector<string> ans;
    for (int i = 0; i < n; ++i) {
      int x, y, z;
      cin >> x >> y >> z;
      if (x * x == y * y + z * z || y * y == z * z + x * x ||
          z * z == x * x + y * y) {
        ans.push_back("YES");
      } else {
        ans.push_back("NO");
      }
    }
    for (int i = 0; i < n; ++i) {
      cout << ans[i] << endl;
    }
  }
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    vector<string> ans;
    for (int i = 0; i < n; ++i) {
      int x, y, z;
      cin >> x >> y >> z;
      if (x < y + z && y < z + x && z < x + y) {
        if (x * x == y * y + z * z || y * y == z * z + x * x ||
            z * z == x * x + y * y) {
          ans.push_back("YES");
        }
      } else {
        ans.push_back("NO");
      }
    }
    for (int i = 0; i < n; ++i) {
      cout << ans[i] << endl;
    }
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
int main(void) {
  int a, b, c, n, i;
  std::cin >> n;
  for (i = 0; i < n; i++) {
    std::cin >> a >> b >> c;
    if (a * a == b * b + c * c)
      std::cout << "YES" << std::endl;
    else if (b * b == a * a + c * c)
      std::cout << "YES" << std::endl;
    else if (c * c == a * a + b * b)
      std::cout << "YES" << std::endl;
    else
      std::cout << "NO" << std::endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
int main(void) {
  while (true) {
    int a, b, c;
    std::cin >> a;
    std::cin >> b;
    std::cin >> c;
    if (a * a == b * b + c * c)
      std::cout << "YES" << std::endl;
    else if (b * b == a * a + c * c)
      std::cout << "YES" << std::endl;
    else if (c * c == a * a + b * b)
      std::cout << "YES" << std::endl;
    else
      std::cout << "NO" << std::endl;
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

long int l[1000][3];

void swap(int a, int b, int c) {
  int buf = l[c][a];
  l[c][a] = l[c][b];
  l[c][b] = buf;
}

// bubble
void sort(int c) {
  for (int i = 0; i < 2; i++) {
    for (int j = i; j < 2; j++) {
      if (l[c][j] > l[c][j + 1])
        swap(j, j + 1, c);
    }
  }
}

int main() {
  int buf;

  cin >> buf;

  for (int i = 0; i < buf; i++) {
    cin >> l[i][0] >> l[i][1] >> l[i][2];
    sort(i);
  }

  for (int j = 0; j < buf; j++) {
    if (l[j][2] * l[j][2] == l[j][0] * l[j][0] + l[j][1] * l[j][1]) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }

  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;

long int l[3][3];

void swap(int a, int b, int c) {
  int buf = l[c][a];
  l[c][a] = l[c][b];
  l[c][b] = buf;
}

// bubble
void sort(int c) {
  for (int i = 0; i < 2; i++) {
    for (int j = i; j < 2; j++) {
      if (l[c][j] > l[c][j + 1])
        swap(j, j + 1, c);
    }
  }
}

int main() {
  int buf;

  cin >> buf;

  for (int i = 0; i < buf; i++) {
    cin >> l[i][0] >> l[i][1] >> l[i][2];
    sort(i);
  }

  for (int j = 0; j < buf; j++) {
    if (l[j][2] * l[j][2] == l[j][0] * l[j][0] + l[j][1] * l[j][1]) {
      cout << "YES";
    } else {
      cout << "NO";
    }

    if (j != buf - 1)
      cout << endl;
  }

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

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

int main() {
  int N;
  cin >> N;
  int A[3];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A[j];
    }
    sort(A, A + 3);
    if ((A[0] * A[0] + A[1] * A[1]) == (A[2] * A[2])) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  int A[3];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cin >> A[j];
    }
    sort(A, A + 3);
    if ((A[0] * A[0] + A[1] * A[1]) == (A[2] * A[2]))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int triangle(int a, int b, int c) {
  a = a * a;
  b = b * b;
  c = c * c;

  if (a == (b + c))
    return 0;
  else if (b == (a + c))
    return 0;
  else if (c == (a + b))
    return 0;
  else
    return 1;
}

int main() {
  int n;
  int a, b, c;
  int i = 0;

  scanf("%d", &n);

  while (i < n) {
    scanf("%d %d %d", &a, &b, &c);

    if (triangle(a, b, c) == 0) {
      cout << "YES\\n";
    } else {
      cout << "NO\\n";
    }
    i++;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int triangle(int a, int b, int c) {
  a = a * a;
  b = b * b;
  c = c * c;

  if (a == (b + c))
    return 0;
  else if (b == (a + c))
    return 0;
  else if (c == (a + b))
    return 0;
  else
    return 1;
}

int main() {
  int n;
  int a, b, c;
  int i = 0;

  scanf("%d", &n);

  while (i < n) {
    scanf("%d %d %d", &a, &b, &c);

    if (triangle(a, b, c) == 0) {
      cout << "YES\\n";
    } else {
      cout << "NO\\n";
    }
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
void swap(int idx1, int idx2, int *node) {
  int f = node[idx1];
  node[idx1] = node[idx2];
  node[idx2] = f;
}
// nlogn
void quickSort(int left, int right, int *node) {
  int pl = left;
  int pr = right;
  int pivot_f = node[(pl + pr) / 2];
  do {
    while (node[pl] < pivot_f) {
      pl++;
    }
    while (node[pr] > pivot_f) {
      pr--;
    }
    if (pl <= pr) {
      swap(pl++, pr--, node);
    }
  } while (pl <= pr);
  if (left < pr)
    quickSort(left, pr, node);
  if (pl <= right)
    quickSort(pl, right, node);
}

bool compare(int a, int b) {
  if (a == b) {
    return true;
  } else {
    return false;
  }
}
int main() {
  string max;
  getline(cin, max);
  string ans[1000];
  int count = 0;
  for (int num = 0; num < stoi(max); num++) {
    string str;
    string item;
    vector<string> list;
    getline(cin, str);
    int edge[3];
    stringstream ss(str);
    while (getline(ss, item, ' ') && !item.empty()) {
      list.push_back(item);
    }

    edge[0] = stoi(list[0].c_str());
    edge[1] = stoi(list[1].c_str());
    edge[2] = stoi(list[2].c_str());
    quickSort(0, 2, edge);

    int edge1 = edge[2] * edge[2];
    int edge2 = edge[0] * edge[0] + edge[1] * edge[1];
    if (compare(edge1, edge2)) {
      ans[count] = "YES";
      count++;
    } else {
      ans[count] = "NO";
      count++;
    }
  }
  for (int i = 0; i < count; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
void swap(int idx1, int idx2, int *node) {
  int f = node[idx1];
  node[idx1] = node[idx2];
  node[idx2] = f;
}
// nlogn
void quickSort(int left, int right, int *node) {
  int pl = left;
  int pr = right;
  int pivot_f = node[(pl + pr) / 2];
  do {
    while (node[pl] < pivot_f) {
      pl++;
    }
    while (node[pr] > pivot_f) {
      pr--;
    }
    if (pl <= pr) {
      swap(pl++, pr--, node);
    }
  } while (pl <= pr);
  if (left < pr)
    quickSort(left, pr, node);
  if (pl <= right)
    quickSort(pl, right, node);
}

bool compare(int a, int b) {
  if (a == b) {
    return true;
  } else {
    return false;
  }
}
int main() {
  string max;
  getline(cin, max);
  for (int num = 0; num <= stoi(max); num++) {
    string str;
    string item;
    vector<string> list;
    getline(cin, str);
    int edge[3];
    stringstream ss(str);
    while (getline(ss, item, ' ') && !item.empty()) {
      list.push_back(item);
    }

    edge[0] = stoi(list[0].c_str());
    edge[1] = stoi(list[1].c_str());
    edge[2] = stoi(list[2].c_str());
    quickSort(0, 2, edge);

    int edge1 = edge[2] * edge[2];
    int edge2 = edge[0] * edge[0] + edge[1] * edge[1];
    if (compare(edge1, edge2)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main(void) {
  int a, b, c;
  int i;
  int times;

  scanf("%d", &times);

  for (i = 0; i < times; i++) {
    scanf("%d %d %d", &a, &b, &c);

    if (0.0 == (double)(a * a + b * b - c * c) / (2 * a * b)) {
      printf("YES\\n");
    } else if (0.0 == (double)(b * b + c * c - a * a) / (2 * b * c)) {
      printf("YES\\n");
    } else if (0.0 == (double)(c * c + a * a - b * b) / (2 * c * a)) {
      printf("YES\\n");
    } else {
      printf("NO\\n");
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main(void) {
  int a, b, c;
  int i;

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

    if (0.0 == (double)(a * a + b * b - c * c) / (2 * a * b)) {
      printf("YES\\n");
    } else if (0.0 == (double)(b * b + c * c - a * a) / (2 * b * c)) {
      printf("YES\\n");
    } else if (0.0 == (double)(c * c + a * a - b * b) / (2 * c * a)) {
      printf("YES\\n");
    } else {
      printf("NO\\n");
    }
  }
  return 0;
}
Problem p00003 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  int n[1000][3];
  int len = 0, m;
  cin >> m;
  while (cin >> n[len][0] >> n[len][1] >> n[len][2]) {
    n[len][0] *= n[len][0];
    n[len][1] *= n[len][1];
    n[len][2] *= n[len][2];
    len++;
  }
  for (int i = 0; i < len; i++) {
    if (n[i][0] == (n[i][1] + n[i][2]))
      cout << "YES" << endl;
    else if (n[i][1] == (n[i][2] + n[i][0]))
      cout << "YES" << endl;
    else if (n[i][2] == (n[i][0] + n[i][1]))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <iostream>

using namespace std;

int main() {
  int n[200][3];
  int len = 0, m;
  cin >> m;
  while (cin >> n[len][0] >> n[len][1] >> n[len][2]) {
    n[len][0] *= n[len][0];
    n[len][1] *= n[len][1];
    n[len][2] *= n[len][2];
    len++;
  }
  for (int i = 0; i < len; i++) {
    if (n[i][0] == (n[i][1] + n[i][2]))
      cout << "YES" << endl;
    else if (n[i][1] == (n[i][2] + n[i][0]))
      cout << "YES" << endl;
    else if (n[i][2] == (n[i][0] + n[i][1]))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}