buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
#include <stdio.h> int main() { int a, b, c, f = 0, N, i; scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%d %d %d", &a, &b, &c); if (a * a == c * c + b * b) { f = 1; } if (b * b == c * c + a * a) { f = 1; } if (c * c == a * a + b * b) { f = 1; } if (f == 1) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
#include <stdio.h> int main() { int a, b, c, f, N, i; scanf("%d", &N); for (i = 0; i < N; i++) { f = 0; scanf("%d %d %d", &a, &b, &c); if (a * a == c * c + b * b) { f = 1; } if (b * b == c * c + a * a) { f = 1; } if (c * c == a * a + b * b) { f = 1; } if (f == 1) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
0
154
6
#include <math.h> #include <stdio.h> int main() { long long n, a, b, c, i = 0; scanf("%lld", &n); for (i = 0; i < n; i++) { scanf("%lld %lld %lld", &a, &b, &c); if (pow(a, 2) + pow(b, 2) == pow(c, 2)) { printf("yes\n"); } else if ((pow(a, 2) + pow(c, 2)) == pow(b, 2)) { printf("yes\n"); } else if ((pow(b, 2) + pow(c, 2)) == pow(a, 2)) { printf("yes\n"); } else { printf("no\n"); } } return (0); }
#include <math.h> #include <stdio.h> int main() { long long n, a, b, c, i = 0; scanf("%lld", &n); for (i = 0; i < n; i++) { scanf("%lld %lld %lld", &a, &b, &c); if (pow(a, 2) + pow(b, 2) == pow(c, 2)) { printf("YES\n"); } else if ((pow(a, 2) + pow(c, 2)) == pow(b, 2)) { printf("YES\n"); } else if ((pow(b, 2) + pow(c, 2)) == pow(a, 2)) { printf("YES\n"); } else { printf("NO\n"); } } return (0); }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
186
8
#include <stdio.h> int main(void) { int input[3]; int n, cnt, cnt2, flag, tmp; scanf("%d", &n); for (cnt = 0; cnt < n; ++cnt) { scanf("%d %d %d", &input[0], &input[1], &input[2]); do { flag = 0; for (cnt2 = 0; cnt2 < 1; ++cnt2) { tmp = 0; if (input[cnt2] < input[cnt2 + 1]) { tmp = input[cnt2]; input[cnt2] = input[cnt2 + 1]; input[cnt2 + 1] = tmp; flag = 1; } } } while (flag != 0); if (((input[0] * input[0]) + (input[1] * input[1])) == (input[2] * input[2])) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
#include <stdio.h> int main(void) { int input[3]; int n, cnt, cnt2, flag, tmp; scanf("%d", &n); for (cnt = 0; cnt < n; ++cnt) { scanf("%d %d %d", &input[0], &input[1], &input[2]); do { flag = 0; for (cnt2 = 0; cnt2 < 2; ++cnt2) { tmp = 0; if (input[cnt2] < input[cnt2 + 1]) { tmp = input[cnt2]; input[cnt2] = input[cnt2 + 1]; input[cnt2 + 1] = tmp; flag = 1; } } } while (flag != 0); if (((input[2] * input[2]) + (input[1] * input[1])) == (input[0] * input[0])) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
[["-", 0, 82, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 82, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 16, 31, 23, 0, 16, 31, 69, 71, 13], ["+", 0, 16, 31, 23, 0, 16, 31, 69, 71, 13], ["-", 0, 16, 31, 23, 0, 16, 12, 69, 71, 13], ["+", 0, 16, 31, 23, 0, 16, 12, 69, 71, 13], ["-", 0, 16, 12, 23, 0, 16, 31, 69, 71, 13], ["+", 0, 16, 12, 23, 0, 16, 31, 69, 71, 13], ["-", 0, 16, 12, 23, 0, 16, 12, 69, 71, 13], ["+", 0, 16, 12, 23, 0, 16, 12, 69, 71, 13]]
0
221
10
#include <stdio.h> int main() { int i, j, values[3]; scanf("%d\n", &i); for (j = 0; j < i; j++) { scanf("%d %d %d", &values[0], &values[1], &values[2]); sort_aoj_volume0003(values); if (values[0] * values[1] + values[1] * values[1] == values[2] * values[2]) { printf("YES\n"); } else { printf("NO\n"); } } return 0; } void sort_aoj_volume0003(int values[]) { int i, count = 10; while (count > 1) { for (i = 1; i < count; i++) { if (values[i] < values[i - 1]) { int value_2 = values[i - 1]; values[i - 1] = values[i]; values[i] = value_2; } } count--; } return; }
#include <stdio.h> int main() { int i, j, values[3]; scanf("%d\n", &i); for (j = 0; j < i; j++) { scanf("%d %d %d", &values[0], &values[1], &values[2]); sort_aoj_volume0003(values); if (values[0] * values[0] + values[1] * values[1] == values[2] * values[2]) { printf("YES\n"); } else { printf("NO\n"); } } return 0; } void sort_aoj_volume0003(int values[]) { int i, count = 3; while (count > 1) { for (i = 1; i < count; i++) { if (values[i] < values[i - 1]) { int value_2 = values[i - 1]; values[i - 1] = values[i]; values[i] = value_2; } } count--; } return; }
[["-", 0, 16, 31, 16, 31, 16, 12, 69, 71, 13], ["+", 0, 16, 31, 16, 31, 16, 12, 69, 71, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
0
220
4
#include <stdio.h> int main() { int i, n; int a, b, c; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d %d", &a, &b, &c); a *= a; b *= b; c *= c; if (a + b == c || b + c == a || c + a == b) puts("YES"); else puts("No"); } return 0; }
#include <stdio.h> int main() { int i, n; int a, b, c; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d %d", &a, &b, &c); a *= a; b *= b; c *= c; if (a + b == c || b + c == a || c + a == b) puts("YES"); else puts("NO"); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
111
2
#include <iostream> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b, c; cin >> a >> b >> c; if (a * a + b * b == c * c || b * b + c * c == a * a || a * a + c * c == b * b) { cout << "YES" << endl; } else { cout << "No" << endl; } } return 0; }
#include <iostream> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b, c; cin >> a >> b >> c; if (a * a + b * b == c * c || b * b + c * c == a * a || a * a + c * c == b * b) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
103
2
#include <algorithm> #include <iostream> #include <limits> #include <math.h> #include <numeric> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define in(x) cin >> x #define out(str) cout << str << endl template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } int N, a, b, c, A, B, C; int main() { cin >> N; rep(i, N) { cin >> a >> b >> c; A = a * a; B = b * b; C = c * c; if (A + B == C || B + C == A || C + A == B) { out("Yes"); } else { out("No"); } } }
#include <algorithm> #include <iostream> #include <limits> #include <math.h> #include <numeric> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define in(x) cin >> x #define out(str) cout << str << endl template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } int N, a, b, c, A, B, C; int main() { cin >> N; rep(i, N) { cin >> a >> b >> c; A = a * a; B = b * b; C = c * c; if (A + B == C || B + C == A || C + A == B) { out("YES"); } else { out("NO"); } } }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
214
4
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int ignore; cin >> ignore; int fi; int se; int th; vector<int> v; while (cin >> fi >> se >> th) { v.push_back(fi); v.push_back(se); v.push_back(th); sort(v.begin(), v.end(), greater<int>()); if (v[0] * v[0] == v[1] * v[1] + v[2] * v[2]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int ignore; cin >> ignore; int fi; int se; int th; vector<int> v; while (cin >> fi >> se >> th) { v.push_back(fi); v.push_back(se); v.push_back(th); sort(v.begin(), v.end(), greater<int>()); if (v[0] * v[0] == v[1] * v[1] + v[2] * v[2]) { cout << "YES" << endl; } else { cout << "NO" << endl; } v.clear(); } }
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
146
6
#include <algorithm> #include <iostream> #include <math.h> int listen_dataCount(); class triangle { private: int longestLine; int line[2]; public: triangle(); void is_rightTriangle(); }; triangle::triangle() { using namespace std; int inputs[3]; cin >> inputs[0] >> inputs[1] >> inputs[2]; sort(inputs, inputs + 2); this->longestLine = inputs[2]; for (int roop = 0; roop < 2; roop++) { this->line[roop] = inputs[roop]; } } void triangle::is_rightTriangle() { using namespace std; if (pow(this->longestLine, 2) == pow(this->line[0], 2) + pow(this->line[1], 2)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } int main() { int datacount = listen_dataCount(); for (int roop = 0; roop < datacount; roop++) { triangle tr = triangle(); tr.is_rightTriangle(); } return 0; } int listen_dataCount() { using namespace std; int count; cin >> count; return count; }
#include <algorithm> #include <iostream> #include <math.h> int listen_dataCount(); class triangle { private: int longestLine; int line[2]; public: triangle(); void is_rightTriangle(); }; triangle::triangle() { using namespace std; int inputs[3]; cin >> inputs[0] >> inputs[1] >> inputs[2]; sort(inputs, inputs + 3); this->longestLine = inputs[2]; for (int roop = 0; roop < 2; roop++) { this->line[roop] = inputs[roop]; } } void triangle::is_rightTriangle() { using namespace std; if (pow(this->longestLine, 2) == pow(this->line[0], 2) + pow(this->line[1], 2)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } int main() { int datacount = listen_dataCount(); for (int roop = 0; roop < datacount; roop++) { triangle tr = triangle(); tr.is_rightTriangle(); } return 0; } int listen_dataCount() { using namespace std; int count; cin >> count; return count; }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
251
2
#include <cmath> #include <iostream> using namespace std; int main() { int n, i; float a, b, c; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (hypot(a, b) == c || hypot(b, c) == a || hypot(a, c) == b) cout << "YES" << endl; else cout << " NO" << endl; } }
#include <cmath> #include <iostream> using namespace std; int main() { int n, i; float a, b, c; cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (hypot(a, b) == c || hypot(b, c) == a || hypot(a, c) == b) cout << "YES" << endl; else cout << "NO" << endl; } }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
95
6
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { int n, m[3]; cin >> n; for (int i = 0; i < n; i++) { cin >> m[0] >> m[1] >> m[2]; sort(m, m + 3); if (pow(m[0], 2) + pow(m[1], 2) == pow(m[2], 2)) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { int n, m[3]; cin >> n; for (int i = 0; i < n; i++) { cin >> m[0] >> m[1] >> m[2]; sort(m, m + 3); if (pow(m[0], 2) + pow(m[1], 2) == pow(m[2], 2)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
122
4
#include <algorithm> #include <iostream> using namespace std; int main() { int n, a[3]; cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { cin >> a[j]; } 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; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n, a[3]; cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { cin >> a[j]; } 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; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
128
4
#include <algorithm> #include <iostream> using namespace std; int main() { int t[1000][3], cnttri, dataset_num, i; cin >> dataset_num; for (cnttri = 0; cnttri < dataset_num; cnttri++) { cin >> t[cnttri][0] >> t[cnttri][1] >> t[cnttri][2]; sort(t[cnttri], t[cnttri] + 2); } for (i = 0; i < cnttri; i++) { if (t[i][2] * t[i][2] == t[i][1] * t[i][1] + t[i][0] * t[i][0]) { cout << "YES\n"; } else { cout << "NO\n"; } } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int t[1000][3], cnttri, dataset_num, i; cin >> dataset_num; for (cnttri = 0; cnttri < dataset_num; cnttri++) { cin >> t[cnttri][0] >> t[cnttri][1] >> t[cnttri][2]; sort(t[cnttri], t[cnttri] + 3); } for (i = 0; i < dataset_num; i++) { if (t[i][2] * t[i][2] == t[i][1] * t[i][1] + t[i][0] * t[i][0]) { cout << "YES\n"; } else { cout << "NO\n"; } } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
176
4
#include <algorithm> #include <array> #include <cmath> #include <functional> #include <iostream> #include <vector> using namespace std; int main(void) { int n; cin >> n; vector<bool> result(n); array<int, 3> triangle; for (int i = 0; i < n; i++) { cin >> triangle[0] >> triangle[1] >> triangle[2]; sort(begin(triangle), end(triangle), less<int>()); const auto square = bind(pow<int, int>, placeholders::_1, 2); result[i] = square(triangle[0]) == square(triangle[1]) + square(triangle[2]); } for (const bool &b : result) { cout << (b ? "YES" : "NO") << endl; ; } return 0; }
#include <algorithm> #include <array> #include <cmath> #include <functional> #include <iostream> #include <vector> using namespace std; int main(void) { int n; cin >> n; vector<bool> result(n); array<int, 3> triangle; for (int i = 0; i < n; i++) { cin >> triangle[0] >> triangle[1] >> triangle[2]; sort(begin(triangle), end(triangle), greater<int>()); const auto square = bind(pow<int, int>, placeholders::_1, 2); result[i] = square(triangle[0]) == square(triangle[1]) + square(triangle[2]); } for (const bool &b : result) { cout << (b ? "YES" : "NO") << endl; ; } return 0; }
[["-", 0, 2, 3, 4, 0, 2, 63, 346, 141, 22], ["+", 0, 2, 3, 4, 0, 2, 63, 346, 141, 22]]
1
180
2
#include <cmath> #include <cstdlib> #include <algorithm> #include <iostream> #include <vector> int main() { long N; long length[3]; std::cin >> N; for (int i = 0; i < N; ++i) { std::cin >> length[0] >> length[1] >> length[2]; std::sort(length, length + 3); if (length[0] * length[0] + length[1] * length[1] == length[2] * length[2]) { std::cout << "Yes" << std::endl; } else { std::cout << "No" << std::endl; } } return 0; }
#include <cmath> #include <cstdlib> #include <algorithm> #include <iostream> #include <vector> int main() { long N; long length[3]; std::cin >> N; for (int i = 0; i < N; ++i) { std::cin >> length[0] >> length[1] >> length[2]; std::sort(length, length + 3); if (length[0] * length[0] + length[1] * length[1] == length[2] * length[2]) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
141
4
#include <math.h> #include <stdio.h> int main() { int N; scanf("%d", &N); int i, a[1000], b[1000], c[1000]; for (i = 0; i < N; i++) { scanf("%d %d %d", &a[i], &b[i], &c[i]); } for (i = 0; i < N; i++) { float A = a[i], B = b[i], C = c[i]; float d = fmax(A, B), sm1 = fmin(A, B); float biggest = fmax(d, C), sm2 = fmin(d, C); if (pow(biggest, 2) == (pow(sm1, 2) + pow(sm2, 2))) printf("Yes\n"); else printf("No\n"); } return 0; }
#include <math.h> #include <stdio.h> int main() { int N; scanf("%d", &N); int i, a[1000], b[1000], c[1000]; for (i = 0; i < N; i++) { scanf("%d %d %d", &a[i], &b[i], &c[i]); } for (i = 0; i < N; i++) { float A = a[i], B = b[i], C = c[i]; float d = fmax(A, B), sm1 = fmin(A, B); float biggest = fmax(d, C), sm2 = fmin(d, C); if (pow(biggest, 2) == (pow(sm1, 2) + pow(sm2, 2))) printf("YES\n"); else printf("NO\n"); } return 0; }
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
201
4
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main() { int n; int a[3]; cin >> n; for (int i = 0; i < n; i++) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); if ((a[2] * a[2]) == (a[1] * a[1]) * (a[0] * a[0])) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main() { int n; int a[3]; cin >> n; for (int i = 0; i < n; i++) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); if ((a[2] * a[2]) == (a[1] * a[1]) + (a[0] * a[0])) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72]]
1
129
2
#include <iostream> int main() { int a, b, c, i, n; 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; } if (b * b == a * a + c * c) { std::cout << "YES" << std::endl; } if (c * c == b * b + a * a) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } return 0; }
#include <iostream> int main() { int a, b, c, i, n; 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 == b * b + a * a) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } return 0; }
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
152
2
#include <iostream> #include <stdio.h> using namespace std; int main() { int a, b, c, n, i; cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a == b * b + c * c) { cout << "Yes" << endl; } else if (b * b == c * c + a * a) { cout << "Yes" << endl; } else if (c * c == a * a + b * b) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
#include <iostream> #include <stdio.h> using namespace std; int main() { int a, b, c, n, i; cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a == b * b + c * c) { cout << "YES" << endl; } else if (b * b == c * c + a * a) { cout << "YES" << endl; } else if (c * c == a * a + b * b) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
140
8
#include <algorithm> #include <iostream> #include <math.h> #include <vector> using namespace std; int main() { int N; vector<int> a(3); cin >> N; while (N > 0) { for (int i = 0; i < 3; i++) cin >> a[i]; sort(a.begin(), a.end()); if (pow(a[2], 2.0) == pow(a[1], 2.0) + pow(a[0], 2.0)) cout << "Yes" << endl; else cout << "No" << endl; N--; } }
#include <algorithm> #include <iostream> #include <math.h> #include <vector> using namespace std; int main() { int N; vector<int> a(3); cin >> N; while (N > 0) { for (int i = 0; i < 3; i++) cin >> a[i]; sort(a.begin(), a.end()); if (pow(a[2], 2.0) == pow(a[1], 2.0) + pow(a[0], 2.0)) cout << "YES" << endl; else cout << "NO" << endl; N--; } }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
130
4
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <vector> using namespace std; int main() { vector<int> a; int n; cin >> n; while (n--) { int t; for (int i = 0; i < 3; i++) { cin >> t; a.push_back(t); } sort(a.begin(), a.end()); if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) cout << "YES" << endl; else cout << "NO" << endl; } }
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <vector> using namespace std; int main() { vector<int> a; int n; cin >> n; while (n--) { int t; for (int i = 0; i < 3; i++) { cin >> t; a.push_back(t); } sort(a.begin(), a.end()); if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) cout << "YES" << endl; else cout << "NO" << endl; a.clear(); } }
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
134
6
#include <iostream> using namespace std; int main() { int a, b, c, n; bool _bool = false; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; _bool = false; if (a * a == (b * b + c * c) || b * b == a * a + b * b || c * c == a * a + b * b) { _bool = true; } if (_bool) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, n; bool _bool = false; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; _bool = false; if (a * a == (b * b + c * c) || b * b == a * a + c * c || c * c == a * a + b * b) { _bool = true; } if (_bool) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 31, 16, 12, 16, 12, 16, 12, 16, 31, 22], ["+", 31, 16, 12, 16, 12, 16, 12, 16, 31, 22], ["-", 31, 16, 12, 16, 12, 16, 12, 16, 12, 22], ["+", 31, 16, 12, 16, 12, 16, 12, 16, 12, 22]]
1
132
4
#include <stdbool.h> #include <stdio.h> bool judge(int x, int y, int z) { static bool flag = false; if (x * x + y * y == z * z) { flag = true; } else if (y * y + z * z == x * x) { flag = true; } else if (z * z + x * x == y * y) { flag = true; } return flag; } int main(void) { int repeat, a, b, c; scanf("%d", &repeat); for (int i = 0; i < repeat; ++i) { scanf("%d %d %d", &a, &b, &c); bool flag = judge(a, b, c); if (flag == true) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
#include <stdbool.h> #include <stdio.h> bool judge(int x, int y, int z) { bool flag = false; if (x * x + y * y == z * z) { flag = true; } else if (y * y + z * z == x * x) { flag = true; } else if (z * z + x * x == y * y) { flag = true; } return flag; } int main(void) { int repeat, a, b, c; scanf("%d", &repeat); for (int i = 0; i < repeat; ++i) { scanf("%d %d %d", &a, &b, &c); bool flag = judge(a, b, c); if (flag == true) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 0, 114, 0, 115]]
1
189
1
#include <algorithm> #include <iostream> bool judge_triangle(int j_edge[]) { std::sort(j_edge, j_edge + 2); return j_edge[2] * j_edge[2] == j_edge[0] * j_edge[0] + j_edge[1] * j_edge[1]; } int main() { int num; std::cin >> num; for (int i = 0; i < num; i++) { int edge[3]; std::cin >> edge[0] >> edge[1] >> edge[2]; if (judge_triangle(edge)) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } return 0; }
#include <algorithm> #include <iostream> bool judge_triangle(int j_edge[]) { std::sort(j_edge, j_edge + 3); return j_edge[2] * j_edge[2] == j_edge[0] * j_edge[0] + j_edge[1] * j_edge[1]; } int main() { int num; std::cin >> num; for (int i = 0; i < num; i++) { int edge[3]; std::cin >> edge[0] >> edge[1] >> edge[2]; if (judge_triangle(edge)) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
151
2
#include <stdio.h> int right(int x, int y, int z); int main(void) { int n, x, y, z; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d %d %d", &x, &y, &z); if (right(x, y, z) == 1) { printf("YES\n"); } else { printf("NO\n"); break; } } return 0; } int right(int x, int y, int z) { if (x * x == y * y + z * z) { return 1; } else if (y * y == x * x + z * z) { return 1; } else if (z * z == x * x + y * y) { return 1; } else { return 0; } }
#include <stdio.h> int right(int x, int y, int z); int main(void) { int n, x, y, z; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d %d %d", &x, &y, &z); if (right(x, y, z) == 1) { printf("YES\n"); } else { printf("NO\n"); } } return 0; } int right(int x, int y, int z) { if (x * x == y * y + z * z) { return 1; } else if (y * y == x * x + z * z) { return 1; } else if (z * z == x * x + y * y) { return 1; } else { return 0; } }
[["-", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94], ["-", 0, 57, 75, 76, 0, 9, 0, 93, 0, 35]]
1
191
2
#include <iostream> using namespace std; int main() { int n; int a, b, c; int tmp; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; } if (a > c) { tmp = a; a = c; c = tmp; } if (b > c) { tmp = b; b = c; c = tmp; } if (a * a + b * b == c * c) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
#include <iostream> using namespace std; int main() { int n; int a, b, c; int tmp; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a > c) { tmp = a; a = c; c = tmp; } if (b > c) { tmp = b; b = c; c = tmp; } if (a * a + b * b == c * c) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
127
2
#include <iostream> using namespace std; int main() { int a, b, c, d; cin >> d; for (int i = 0; i < d; i++) { cin >> a >> b >> c; if (a * a + b * b == c * c or b * b + c * c == a * a or c * c + a * a == b * b) { cout << "YES" << endl; } else { cout << "NO"; } } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, d; cin >> d; for (int i = 0; i < d; i++) { cin >> a >> b >> c; if (a * a + b * b == c * c or b * b + c * c == a * a or c * c + a * a == b * b) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["+", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22]]
1
109
2
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a, b, c; cin >> a >> b >> c; if (a < c) { swap(a, c); } if (b < c) { swap(b, c); } if (a * a + b * b == c * c) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a, b, c; cin >> a >> b >> c; if (a > c) { swap(a, c); } if (b > c) { swap(b, c); } if (a * a + b * b == c * c) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
116
8
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int tate, yoko, naname; cin >> tate >> yoko >> naname; if (tate > naname) { swap(tate, naname); } if (yoko > naname) { swap(yoko, naname); } if (naname * naname == tate * tate + yoko * yoko) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int tate, yoko, naname; cin >> tate >> yoko >> naname; if (tate > naname) { swap(tate, naname); } if (yoko > naname) { swap(yoko, naname); } if (naname * naname == tate * tate + yoko * yoko) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
116
4
#include <iostream> using namespace std; int main() { int n, a, b, c; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a == b * b + c * c) { cout << "YES" << endl; } if (b * b == a * a + c * c) { cout << "YES" << endl; } if (c * c == b * b + a * a) { cout << "YES" << endl; } else { cout << "NO" << endl; } } }
#include <iostream> using namespace std; int main() { int n, a, b, c; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a == b * b + c * c) { cout << "YES" << endl; } else if (b * b == a * a + c * c) { cout << "YES" << endl; } else if (c * c == b * b + a * a) { cout << "YES" << endl; } else { cout << "NO" << endl; } } }
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
132
2
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; int henA, henB, henC; for (int i = 0; i < n; i++) { cin >> henA >> henB >> henC; if (henA, henC) { swap(henA, henC); } if (henB > henC) { swap(henB, henC); } if (henA * henA + henB * henB == henC * henC) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; int henA, henB, henC; for (int i = 0; i < n; i++) { cin >> henA >> henB >> henC; if (henA > henC) { swap(henA, henC); } if (henB > henC) { swap(henB, henC); } if (henA * henA + henB * henB == henC * henC) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
116
2
#include <stdio.h> int main(void) { int a, b, c1, c2, c3, i; scanf("%d", &a); for (i = 0; i < a; i++) { scanf("%d %d %d", &c1, &c2, &c3); } if (c1 * c1 + c2 * c2 == c3 * c3) { printf("YES\n"); } else if (c1 * c1 + c3 * c3 == c2 * c2) { printf("YES\n"); } else if (c2 * c2 + c3 * c3 == c1 * c1) { printf("YES\n"); } else { printf("NO\n"); } return 0; }
#include <stdio.h> int main(void) { int a, b, c1, c2, c3, i; scanf("%d", &a); for (i = 0; i < a; i++) { scanf("%d %d %d", &c1, &c2, &c3); if (c1 * c1 + c2 * c2 == c3 * c3) { printf("YES\n"); } else if (c1 * c1 + c3 * c3 == c2 * c2) { printf("YES\n"); } else if (c2 * c2 + c3 * c3 == c1 * c1) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 46]]
1
151
2
#include <stdio.h> int main() { int n, a[1000], b[1000], c[1000], i; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d %d", &a[i], &b[i], &c[i]); } for (i = 0; i < n; i++) { if (a[i] * a[i] + b[i] * b[i] == c[i] * c[i] || c[i] * c[i] + b[i] * b[i] == a[i] * a[i] || a[i] * a[i] + c[i] + c[i] == b[i] * b[i]) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
#include <stdio.h> int main() { int n, a[1000], b[1000], c[1000], i; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d %d", &a[i], &b[i], &c[i]); } for (i = 0; i < n; i++) { if (a[i] * a[i] + b[i] * b[i] == c[i] * c[i] || c[i] * c[i] + b[i] * b[i] == a[i] * a[i] || a[i] * a[i] + c[i] * c[i] == b[i] * b[i]) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
[["-", 15, 339, 51, 16, 12, 16, 31, 16, 17, 72], ["+", 51, 16, 12, 16, 31, 16, 12, 16, 17, 48]]
1
209
2
#include <algorithm> #include <iostream> using namespace std; int main() { int N, n[3]; cin >> N; for (int i = 0; i < N; i++) { for (int m = 0; m < 3; m++) { cin >> n[m]; } sort(n, n + 3); if (n[2] * n[2] == n[1] * n[1] + n[0] * n[0]) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int N, n[3]; cin >> N; for (int i = 0; i < N; i++) { for (int m = 0; m < 3; m++) { cin >> n[m]; } sort(n, n + 3); if (n[2] * n[2] == n[1] * n[1] + n[0] * n[0]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
130
4
#include <iostream> using namespace std; int main() { int n, a, b, c; cin >> n; while (n--) { cin >> a >> b >> c; a = a * a; b = b * b; c = c * c; if (a + b == c || b + c == a || c + a == b) { cout << "Yes"; } else { cout << "NO"; } cout << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n, a, b, c; cin >> n; while (n--) { cin >> a >> b >> c; a = a * a; b = b * b; c = c * c; if (a + b == c || b + c == a || c + a == b) { cout << "YES"; } else { cout << "NO"; } cout << endl; } return 0; }
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
102
2
#include <algorithm> #include <iostream> #include <string> #include <vector> int main() { int n; std::cin >> n; std::vector<std::string> v; for (int i = 0; i < n; ++i) { int a, b, c; std::cin >> a >> b >> c; int max = std::max(a, std::max(b, c)); if (a * a + b * b + c * c == max * max * 2) { v.push_back("YES"); } else { v.push_back("NO"); } } for (int i = 0; n < i; ++i) { std::cout << v[i] << std::endl; } return 0; }
#include <algorithm> #include <iostream> #include <string> #include <vector> int main() { int n; std::cin >> n; std::vector<std::string> v; for (int i = 0; i < n; ++i) { int a, b, c; std::cin >> a >> b >> c; int max = std::max(a, std::max(b, c)); if (a * a + b * b + c * c == max * max * 2) { v.push_back("YES"); } else { v.push_back("NO"); } } for (int i = 0; n > i; ++i) { std::cout << v[i] << std::endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47]]
1
160
2
#include <iostream> using namespace std; int main() { int a, b, c, d, s, t, n, i; cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (a < b) { d = b; b = a; a = d; } if (b < c) { d = c; c = b; b = d; } if (a < b) { d = b; b = a; a = d; } s = a * a; t = (b * b) + (c * c); if (s == t) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, d, s, t, n, i; cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (a < b) { d = b; b = a; a = d; } if (b < c) { d = c; c = b; b = d; } if (a < b) { d = b; b = a; a = d; } s = a * a; t = (b * b) + (c * c); if (s == t) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
166
4
#include <iostream> using namespace std; int main() { int n; cin >> n; int a, b, c; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a == b * b + c * c || b * b == a * a + c * c || c * c == a * a + b * b) { cout << "YES\n"; } else { cout << "NO\n"; } cout << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n; cin >> n; int a, b, c; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a == b * b + c * c || b * b == a * a + c * c || c * c == a * a + b * b) { cout << "YES\n"; } else { cout << "NO\n"; } } return 0; }
[["-", 0, 7, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
114
4
#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 n; while (n--) { int a, b, c; cin >> a >> b >> c; if (a > b) swap(a, b); if (b > c) swap(b, c); if (a * a + b * b == c * c) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
#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 n; cin >> n; while (n--) { int a, b, c; cin >> a >> b >> c; if (a > b) swap(a, b); if (b > c) swap(b, c); if (a * a + b * b == c * c) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
198
4
#include <iostream> using namespace std; int main() { int n; int side[3]; cin >> n; for (int i = 1; i <= n; i++) { for (int j = 0; j <= 2; j++) { cin >> side[j]; } for (int j = 0; j < 2; j++) { if (side[j] >= side[j + 1]) { int s = side[j + 1]; side[j + 1] = side[j]; side[j] = s; } } if ((side[2] * side[2]) == ((side[0] * side[0]) + (side[1] * side[1]))) { cout << "Yes\n"; } else { cout << "No\n"; } } return 0; }
#include <iostream> using namespace std; int main() { int n; int side[3]; cin >> n; for (int i = 1; i <= n; i++) { for (int j = 0; j <= 2; j++) { cin >> side[j]; } for (int j = 0; j < 2; j++) { if (side[j] >= side[j + 1]) { int s = side[j + 1]; side[j + 1] = side[j]; side[j] = s; } } if ((side[2] * side[2]) == ((side[0] * side[0]) + (side[1] * side[1]))) { cout << "YES\n"; } else { cout << "NO\n"; } } return 0; }
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
187
4
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main(void) { int n, array[3], i; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d %d", &array[0], &array[1], &array[2]); sort(array, array + 3); if (array[0] * array[0] + array[1] * array[1] == array[2] * array[2]) printf("Yes\n"); else printf("No\n"); } return 0; }
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main(void) { int n, array[3], i; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d %d", &array[0], &array[1], &array[2]); sort(array, array + 3); if (array[0] * array[0] + array[1] * array[1] == array[2] * array[2]) printf("YES\n"); else printf("NO\n"); } return 0; }
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
138
4
//#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS //#include <cstdio> //#include <cstdlib> //#include <cmath> #include <algorithm> #include <iostream> //#include <cstring> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main(void) { int N; cin >> N; for (int i = 0; i < 3; i++) { int a, b, c; cin >> a >> b >> c; if (a > b) swap(a, b); if (a > c) swap(a, c); if (b > c) swap(b, c); if (a * a + b * b == c * c) cout << "Yes" << endl; else cout << "No" << endl; } return 0; } /* for(i=0;i<N;i++){ cin >> X[i]; } for(i=0;i<N;i++){ for(j=0;j<N;j++){ cin >> X[i][j]; } } */
//#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS //#include <cstdio> //#include <cstdlib> //#include <cmath> #include <algorithm> #include <iostream> //#include <cstring> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main(void) { int N; cin >> N; for (int i = 0; i < N; i++) { int a, b, c; cin >> a >> b >> c; if (a > b) swap(a, b); if (a > c) swap(a, c); if (b > c) swap(b, c); if (a * a + b * b == c * c) cout << "YES" << endl; else cout << "NO" << endl; } return 0; } /* for(i=0;i<N;i++){ cin >> X[i]; } for(i=0;i<N;i++){ for(j=0;j<N;j++){ cin >> X[i][j]; } } */
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
146
6
#include <iostream> using namespace std; int main() { int a = 0; int kazu = 0; int b = 0; int c = 0; for (int i = 0; i < kazu; i++) { cin >> a; cin >> b; cin >> c; if (a * a + b * b == c * c) { cout << "YES" << endl; } else if (a * a + c * c == b * b) { cout << "YES" << endl; } else if (c * c + b * b == a * a) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
#include <iostream> using namespace std; int main() { int a = 0; int kazu = 0; int b = 0; int c = 0; cin >> kazu; for (int i = 0; i < kazu; i++) { cin >> a; cin >> b; cin >> c; if (a * a + b * b == c * c) { cout << "YES" << endl; } else if (a * a + c * c == b * b) { cout << "YES" << endl; } else if (c * c + b * b == a * a) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
148
4
#include <iostream> #include <math.h> using namespace std; int main() { int times; cin >> times; for (int i = 0; i <= times; i++) { int a, b, c; cin >> a >> b >> c; double a2, b2, c2; a2 = pow(a, 2); b2 = pow(b, 2); c2 = pow(c, 2); if (a2 == b2 + c2 || b2 == a2 + c2 || c2 == a2 + b2) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
#include <iostream> #include <math.h> using namespace std; int main() { int times; cin >> times; for (int i = 0; i < times; i++) { int a, b, c; cin >> a >> b >> c; double a2, b2, c2; a2 = pow(a, 2); b2 = pow(b, 2); c2 = pow(c, 2); if (a2 == b2 + c2 || b2 == a2 + c2 || c2 == a2 + b2) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
130
2
#include <iostream> using namespace std; int main() { int a, b, c, i; cin >> i; for (int n = 0; n < i; n++) { cin >> a >> b >> c; if (a * a == b * b + c * c) { cout << "Yes" << endl; } else if (b * b == a * a + c * c) { cout << "Yes" << endl; } else if (c * c == a * a + b * b) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, i; cin >> i; for (int n = 0; n < i; n++) { cin >> a >> b >> c; if (a * a == b * b + c * c) { cout << "YES" << endl; } else if (b * b == a * a + c * c) { cout << "YES" << endl; } else if (c * c == a * a + b * b) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
137
8
#include <iostream> #include <stdio.h> #define _USE_MATH_DEFINES #include <algorithm> #include <cmath> using namespace std; int main() { int a, b, c, n, i; cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a == b * b + c * c || b * b == a * a + c * c || c * c == b * b + a * a) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
#include <iostream> #include <stdio.h> #define _USE_MATH_DEFINES #include <algorithm> #include <cmath> using namespace std; int main() { int a, b, c, n, i; cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a == b * b + c * c || b * b == a * a + c * c || c * c == b * b + a * a) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
116
4
#include <iostream> #include <stdio.h> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <algorithm> #include <cmath> using namespace std; int main() { int x, a[3]; cin >> x; for (int i = 1; i < x + 1; i++) { cin >> a[0] >> a[1] >> a[2]; 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; }
#include <iostream> #include <stdio.h> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <algorithm> #include <cmath> using namespace std; int main() { int x, a[3]; cin >> x; for (int i = 1; i < x + 1; i++) { cin >> a[0] >> a[1] >> a[2]; 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; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
132
4
#include <iostream> bool checkTriangle(int a, int b, int c) { if ((a >= b) && (a >= c)) { return (a * a == (b * b + c * c)); } else if ((b >= a) && (b >= c)) { return (b * b == (a * a + c * c)); } else { return (c * c == (a * a + b * b)); } } int showResult(int a, int b, int c) { if (checkTriangle(a, b, c)) { std::cout << "Yes" << std::endl; } else { std::cout << "No" << std::endl; } return 0; } int main() { int N, a, b, c = 0; std::cin >> N; if (N == 0) { return 0; } for (int i = 0; i < N; i++) { std::cin >> a >> b >> c; showResult(a, b, c); } return 0; }
#include <iostream> bool checkTriangle(int a, int b, int c) { if ((a >= b) && (a >= c)) { return (a * a == (b * b + c * c)); } else if ((b >= a) && (b >= c)) { return (b * b == (a * a + c * c)); } else { return (c * c == (a * a + b * b)); } } int showResult(int a, int b, int c) { if (checkTriangle(a, b, c)) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } return 0; } int main() { int N, a, b, c = 0; std::cin >> N; if (N == 0) { return 0; } for (int i = 0; i < N; i++) { std::cin >> a >> b >> c; showResult(a, b, c); } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
232
4
#include <iostream> void printN(int N); int main() { int N; std::cin >> N; printN(N); return 0; } void printN(int N) { for (int i = 0; i < N; ++i) { int x, y, z; std::cin >> x >> y >> z; if (x * x + y * y == z * z) { std::cout << "yes" << std::endl; } else if (y * y + z * z == x * x) { std::cout << "yes" << std::endl; } else if (z * z + x * x == y * y) { std::cout << "yes" << std::endl; } else { std::cout << "no" << std::endl; } } }
#include <iostream> void printN(int N); int main() { int N; std::cin >> N; printN(N); return 0; } void printN(int N) { for (int i = 0; i < N; ++i) { int x, y, z; std::cin >> x >> y >> z; if (x * x + y * y == z * z) { std::cout << "YES" << std::endl; } else if (y * y + z * z == x * x) { std::cout << "YES" << std::endl; } else if (z * z + x * x == y * y) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
174
8
#include <iostream> using namespace std; int check(int a, int b, int c) { if (a * a + b * b == c * c) return 1; else return 0; } int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a, b, c; int aa, bb, cc; cin >> a >> b >> c; aa = a < b ? a : b; bb = a < b ? b : a; cc = b < c ? c : b; bb = b < c ? b : c; int ans = check(aa, bb, cc); if (ans) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <iostream> using namespace std; int check(int a, int b, int c) { if (a * a + b * b == c * c) return 1; else return 0; } int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a, b, c; int aa, bb, cc; cin >> a >> b >> c; aa = a < b ? a : b; bb = a < b ? b : a; cc = bb < c ? c : bb; bb = bb < c ? bb : c; int ans = check(aa, bb, cc); if (ans) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 0, 1, 0, 11, 12, 41, 15, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 41, 15, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 41, 75, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 41, 75, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 41, 64, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 41, 64, 22]]
1
168
8
#include <iostream> using namespace std; // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0003&lang=jp int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a, b, c; cin >> a >> b >> c; if (b < a) { int t = b; b = a; a = t; } if (c < b) { int t = c; c = b; b = c; } cout << (a * a + b * b == c * c ? "YES" : "NO") << endl; } return 0; }
#include <iostream> using namespace std; // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0003&lang=jp int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a, b, c; cin >> a >> b >> c; if (b < a) { int t = b; b = a; a = t; } if (c < b) { int t = c; c = b; b = t; } cout << (a * a + b * b == c * c ? "YES" : "NO") << endl; } return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
122
2
#include <iostream> void checkTringle(int a, int b, int c) { if (a * a == b * b + c * c) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } int main(int argc, char *argv[]) { int dataSize; std::cin >> dataSize; int side[3]; for (int i = 0; i < dataSize; i++) { for (int a = 0; a < 3; a++) { std::cin >> side[a]; } for (int b = 0; b < 3; b++) { for (int j = i + 1; j < 3; j++) { if (side[i] > side[j]) { int tmp = side[i]; side[i] = side[j]; side[j] = tmp; } } } checkTringle(side[2], side[1], side[0]); } }
#include <iostream> void checkTringle(int a, int b, int c) { if (a * a == b * b + c * c) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } int main(int argc, char *argv[]) { int dataSize; std::cin >> dataSize; int side[3]; for (int i = 0; i < dataSize; i++) { for (int a = 0; a < 3; a++) { std::cin >> side[a]; } for (int b = 0; b < 3; b++) { for (int j = b + 1; j < 3; j++) { if (side[b] > side[j]) { int tmp = side[b]; side[b] = side[j]; side[j] = tmp; } } } checkTringle(side[2], side[1], side[0]); } }
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
220
8
#include <iostream> using namespace std; int main() { int a, b, c, n; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a == c * c + b * b || b * b == c * c + a * a || c * c == a * a + b * b) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, n; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a == c * c + b * b || b * b == c * c + a * a || c * c == a * a + b * b) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
107
4
#include <bits/stdc++.h> using namespace std; /*-------------------------------*/ #define FOR(i, a, b) for (int i = (a); i < (b); i++) // a~(b - 1)?????§ #define print(i) cout << i << endl //?°??????????Python????????? typedef long long ll; typedef vector<int> vi; typedef vector<vector<int>> vii; /*-------------------------------*/ int main(void) { int a; int da[3]; cin >> a; FOR(i, 0, a) { cin >> da[0] >> da[1] >> da[2]; sort(da, da + 3); if (da[0] * da[0] + da[1] * da[1] == da[2] * da[2]) print("Yes"); else print("No"); } return 0; }
#include <bits/stdc++.h> using namespace std; /*-------------------------------*/ #define FOR(i, a, b) for (int i = (a); i < (b); i++) // a~(b - 1)?????§ #define print(i) cout << i << endl //?°??????????Python????????? typedef long long ll; typedef vector<int> vi; typedef vector<vector<int>> vii; /*-------------------------------*/ int main(void) { int a; int da[3]; cin >> a; FOR(i, 0, a) { cin >> da[0] >> da[1] >> da[2]; sort(da, da + 3); if (da[0] * da[0] + da[1] * da[1] == da[2] * da[2]) print("YES"); else print("NO"); } return 0; }
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
153
4
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int l[3]; cin >> l[0] >> l[1] >> l[2]; sort(l, l + 3); if (l[2] * l[2] == l[1] * l[1] + l[0] * l[0]) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int l[3]; cin >> l[0] >> l[1] >> l[2]; sort(l, l + 3); if (l[2] * l[2] == l[1] * l[1] + l[0] * l[0]) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
121
4
#include <cmath> #include <iostream> using namespace std; int main() { int i, j, n, a, b, c; cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (a == double(sqrt(pow(b, 2) + pow(c, 2)))) { cout << "Yes" << endl; } else if (b == double(sqrt(pow(a, 2) + pow(c, 2)))) { cout << "Yes" << endl; } else if (c == double(sqrt(pow(a, 2) + pow(b, 2)))) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
#include <cmath> #include <iostream> using namespace std; int main() { int i, n, a, b, c; cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (a == double(sqrt(pow(b, 2) + pow(c, 2)))) { cout << "YES" << endl; } else if (b == double(sqrt(pow(a, 2) + pow(c, 2)))) { cout << "YES" << endl; } else if (c == double(sqrt(pow(a, 2) + pow(b, 2)))) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
172
10
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; for (int b = 0; b < a; b++) { vector<int> c(3); for (int d = 0; d < 3; d++) cin >> c[d]; sort(c.begin(), c.end()); if (c[0] * c[0] + c[1] * c[1] == c[2] * c[2]) cout << "Yes" << endl; else cout << "No" << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; for (int b = 0; b < a; b++) { vector<int> c(3); for (int d = 0; d < 3; d++) cin >> c[d]; sort(c.begin(), c.end()); if (c[0] * c[0] + c[1] * c[1] == c[2] * c[2]) cout << "YES" << endl; else cout << "NO" << endl; } }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
129
4
#include <algorithm> #include <cmath> #include <iostream> #include <vector> 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(a) (a).begin(), (a).end() int main() { int n; cin >> n; REP(i, n) { vector<int> v(3); REP(j, 3) { cin >> v[i]; } sort(ALL(v)); if (pow(v[0], 2) + pow(v[1], 2) == pow(v[2], 2)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <vector> 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(a) (a).begin(), (a).end() int main() { int n; cin >> n; REP(i, n) { vector<int> v(3); REP(j, 3) { cin >> v[j]; } sort(ALL(v)); if (pow(v[0], 2) + pow(v[1], 2) == pow(v[2], 2)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22]]
1
160
2
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int a; scanf("%d", &a); vector<int> b(3); for (int c = 0; c < a; c++) { scanf("%d%d%d", &b[0], &b[1], &b[2]); sort(b.begin(), b.end()); if (b[0] * b[0] + b[1] * b[1] == b[2] * b[2]) printf("YES\n"); else printf("No\n"); } }
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int a; scanf("%d", &a); vector<int> b(3); for (int c = 0; c < a; c++) { scanf("%d%d%d", &b[0], &b[1], &b[2]); sort(b.begin(), b.end()); if (b[0] * b[0] + b[1] * b[1] == b[2] * b[2]) printf("YES\n"); else printf("NO\n"); } }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
147
2
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { int a[3], b; cin >> b; for (int i = 0; i < b; i++) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); b = pow(a[1], 2) + pow(a[0], 2); if (pow(a[2], 2) == b) { cout << "YES"; } else { cout << "NO"; } cout << endl; } return 0; }
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { int a[3], b, n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); b = pow(a[1], 2) + pow(a[0], 2); if (pow(a[2], 2) == b) { cout << "YES"; } else { cout << "NO"; } cout << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
130
6
#include <bits/stdc++.h> using namespace std; int main() { int n, j = 0; int a[3]; cin >> n; while (j < n) { for (int i = 0; i < 3; i++) { cin >> a[i]; } sort(a, a + 3); if (a[2] * a[2] == a[1] * a[1] + a[0] * a[0]) { cout << "Yes" << endl; } else { cout << "No" << endl; } j++; } }
#include <bits/stdc++.h> using namespace std; int main() { int n, j = 0; int a[3]; cin >> n; while (j < n) { for (int i = 0; i < 3; i++) { cin >> a[i]; } sort(a, a + 3); if (a[2] * a[2] == a[1] * a[1] + a[0] * a[0]) { cout << "YES" << endl; } else { cout << "NO" << endl; } j++; } }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
125
4
#include <iostream> #include <string> using namespace std; bool IsRightTriangle(const int a, const int b, const int c) { if (a <= b) { if (b <= c) { if (c * c == a * a + b * b) { return true; } else { return false; } } else { if (b * b == c * c + a * a) { return true; } else { return false; } } } else { if (a <= c) { if (c * c == a * a + b * b) { return true; } else { return false; } } else { if (a * a == b * b + c * c) { return true; } else { return false; } } } } int main() { int N; for (int i = 0; i < N; i++) { int a, b, c; cin >> a >> b >> c; if (IsRightTriangle(a, b, c)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
#include <iostream> #include <string> using namespace std; bool IsRightTriangle(const int a, const int b, const int c) { if (a <= b) { if (b <= c) { if (c * c == a * a + b * b) { return true; } else { return false; } } else { if (b * b == c * c + a * a) { return true; } else { return false; } } } else { if (a <= c) { if (c * c == a * a + b * b) { return true; } else { return false; } } else { if (a * a == b * b + c * c) { return true; } else { return false; } } } } int main() { int N; cin >> N; for (int i = 0; i < N; i++) { int a, b, c; cin >> a >> b >> c; if (IsRightTriangle(a, b, c)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
233
4
#include <cstdio> #include <iostream> using namespace std; int main() { int n, s = 0; cin >> n; while (n >= s) { int i = 0, k = 0, j = 0, l = 0; cin >> i >> k >> j; if (i < k) { l = i; i = k; k = l; } if (i < j) { l = i; i = j; j = l; } i = i * i; j = j * j; k = k * k; if (i == (j + k)) cout << "YES" << "\n"; else cout << "NO" << "\n"; s++; } }
#include <cstdio> #include <iostream> using namespace std; int main() { int n, s = 1; cin >> n; while (n >= s) { int i = 0, k = 0, j = 0, l = 0; cin >> i >> k >> j; if (i < k) { l = i; i = k; k = l; } if (i < j) { l = i; i = j; j = l; } i = i * i; j = j * j; k = k * k; if (i == (j + k)) cout << "YES" << "\n"; else cout << "NO" << "\n"; s++; } }
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
150
2
#include <algorithm> #include <functional> #include <iostream> #include <math.h> #include <string> #include <vector> #define L(_i, _N) for (int _i = 0; _i < _N; _i++) typedef long long int lli; using namespace std; int main() { int N, Line[3]; cin >> N; L(i, N) { L(j, 3) cin >> Line[j]; sort(Line, Line + 3); if (pow(Line[0], 2) + pow(Line[1], 2) == pow(Line[2], 2)) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
#include <algorithm> #include <functional> #include <iostream> #include <math.h> #include <string> #include <vector> #define L(_i, _N) for (int _i = 0; _i < _N; _i++) typedef long long int lli; using namespace std; int main() { int N, Line[3]; cin >> N; L(i, N) { L(j, 3) cin >> Line[j]; sort(Line, Line + 3); if (pow(Line[0], 2) + pow(Line[1], 2) == pow(Line[2], 2)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
130
4
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string str; int n; cin >> n; vector<int> vx, vy, vz; for (int i = 0; i < n; i++) { int x, y, z; cin >> x >> y >> z; vx.push_back(x); vy.push_back(y); vz.push_back(z); } for (int i = 0; i < n; i++) { vector<int> v; v.push_back(vx[i]); v.push_back(vy[i]); v.push_back(vz[i]); sort(v.begin(), v.end()); if (pow(v[2], 2.0) == pow(v[0], 2.0) + pow(v[1], 2.0)) { str = "Yes"; } else { str = "No"; } cout << str << endl; } }
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string str; int n; cin >> n; vector<int> vx, vy, vz; for (int i = 0; i < n; i++) { int x, y, z; cin >> x >> y >> z; vx.push_back(x); vy.push_back(y); vz.push_back(z); } for (int i = 0; i < n; i++) { vector<int> v; v.push_back(vx[i]); v.push_back(vy[i]); v.push_back(vz[i]); sort(v.begin(), v.end()); if (pow(v[2], 2.0) == pow(v[0], 2.0) + pow(v[1], 2.0)) { str = "YES"; } else { str = "NO"; } cout << str << endl; } }
[["-", 64, 9, 0, 1, 0, 11, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 11, 12, 5, 0, 6], ["-", 0, 9, 0, 1, 0, 11, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 11, 12, 5, 0, 6]]
1
214
4
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> // cin.sync_with_stdio(false); // streambuf using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; using vi = vector<int>; using vll = vector<ll>; using vpii = vector<pii>; using vpll = vector<pll>; using ti3 = tuple<int, int, int>; using vti3 = vector<ti3>; template <class T, int s> using va = vector<array<T, s>>; template <class T, class T2> using umap = unordered_map<T, T2>; template <class T> using uset = unordered_set<T>; template <class T, class S> void cmin(T &a, const S &b) { if (a > b) a = b; } template <class T, class S> void cmax(T &a, const S &b) { if (a < b) a = b; } #define ALL(a) a.begin(), a.end() #define rep(i, a) for (int i = 0; i < a; i++) #define rep1(i, a) for (int i = 1; i <= a; i++) #define rrep(i, a) for (int i = (a)-1; i >= 0; i--) #define rrep1(i, a) for (int i = a; i; i--) const ll mod = 1000000007; #define REP rep template <class T> using heap = priority_queue<T, vector<T>, greater<T>>; template <class T> using pque = priority_queue<T, vector<T>, function<T(T, T)>>; template <class T> inline void hash_combine(size_t &seed, const T &v) { hash<T> hasher; seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2); } namespace std { template <typename S, typename T> struct hash<pair<S, T>> { inline size_t operator()(const pair<S, T> &v) const { size_t seed = 0; hash_combine(seed, v.first); hash_combine(seed, v.second); return seed; } }; // Recursive template code derived from Matthieu M. template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1> struct HashValueImpl { static void apply(size_t &seed, Tuple const &tuple) { HashValueImpl<Tuple, Index - 1>::apply(seed, tuple); hash_combine(seed, std::get<Index>(tuple)); } }; template <class Tuple> struct HashValueImpl<Tuple, 0> { static void apply(size_t &seed, Tuple const &tuple) { hash_combine(seed, std::get<0>(tuple)); } }; template <typename... TT> struct hash<std::tuple<TT...>> { size_t operator()(std::tuple<TT...> const &tt) const { size_t seed = 0; HashValueImpl<std::tuple<TT...>>::apply(seed, tt); return seed; } }; } // namespace std template <class T> int id(vector<T> &a, T b) { return lower_bound(ALL(a), b) - a.begin(); } ll pow(ll base, ll i, ll mod) { ll a = 1; while (i) { if (i & 1) { a *= base; a %= mod; } base *= base; base %= mod; i /= 2; } return a; } ll gcd(ll a, ll b) { while (b) { ll c = a % b; a = b; b = c; } return a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int popcnt(unsigned long long a) { a = (a & 0x5555555555555555) + (a >> 1 & 0x5555555555555555); a = (a & 0x3333333333333333) + (a >> 2 & 0x3333333333333333); a = (a & 0x0f0f0f0f0f0f0f0f) + (a >> 4 & 0x0f0f0f0f0f0f0f0f); a = (a & 0x00ff00ff00ff00ff) + (a >> 8 & 0x00ff00ff00ff00ff); a = (a & 0x0000ffff0000ffff) + (a >> 16 & 0x0000ffff0000ffff); return (a & 0xffffffff) + (a >> 32); } class unionfind { vector<int> par, rank, size_; //????????§??????????????¢???????????????????????????rank???????????????size????????? public: unionfind(int n) : par(n), rank(n), size_(n, 1) { iota(ALL(par), 0); } int find(int x) { if (par[x] == x) return x; return par[x] = find(par[x]); } void unite(int x, int y) { x = find(x), y = find(y); if (x == y) return; if (rank[x] < rank[y]) swap(x, y); par[y] = x; size_[x] += size_[y]; if (rank[x] == rank[y]) rank[x]++; } bool same(int x, int y) { return find(x) == find(y); } int size(int x) { return size_[find(x)]; } }; template <class T, class Func = function<T(T, T)>> class segtree { vector<T> obj; int offset; Func updater; T e; int bufsize(int num) { int i = 1; for (; num > i; i <<= 1) ; offset = i - 1; return (i << 1) - 1; } T query(int a, int b, int k, int l, int r) { if (r <= a || b <= l) return e; if (a <= l && r <= b) return obj[k]; else return updater(query(a, b, k * 2 + 1, l, (l + r) / 2), query(a, b, k * 2 + 2, (l + r) / 2, r)); } /* template<class QF = function<T(T, T)>> auto query(int a, int b, int k, int l, int r,QF qf) { if (r <= a || b <= l)return e; if (a <= l && r <= b)return obj[k]; else return qf(query(a, b, k * 2 + 1, l, (l + r) / 2, qf), query(a, b, k * 2 + 2, (l + r) / 2, r, qf)); }*/ public: T query(int a, int b) { //[a,b) return query(a, b, 0, 0, offset + 1); } /* template<class QF = function<T(T, T)>> auto query(int a, int b,QF &&qf) {//[a,b) return query(a, b, 0, 0, offset + 1,qf); }*/ void updateall(int l = 0, int r = -1) { if (r < 0) r = offset + 1; l += offset, r += offset; do { l = l - 1 >> 1, r = r - 1 >> 1; for (int i = l; i < r; i++) obj[i] = updater(obj[i * 2 + 1], obj[i * 2 + 2]); } while (l); } void update(int k, T &a) { k += offset; obj[k] = a; while (k) { k = k - 1 >> 1; obj[k] = updater(obj[k * 2 + 1], obj[k * 2 + 2]); } } segtree(int n, T e, const Func &updater = Func()) : obj(bufsize(n), e), e(e), updater(updater) {} segtree(vector<T> &vec, T e, const Func &updater = Func()) : obj(bufsize(vec.size()), e), e(e), updater(updater) { copy(vec.begin(), vec.end(), obj.begin() + offset); updateall(); } typename vector<T>::reference operator[](int n) { return obj[n + offset]; } }; template <class T = int> class BIT { //????¬????BIT????????????????????????????????°?????????????????? vector<T> bit; int n; public: BIT(int n) : bit(n + 1, 0) {} void add(int i, T x) { i++; while (i <= n) { bit[i] += x; i += i & -i; } } T sum(int i) { T s = 0; i++; while (i) { s += bit[i]; i &= i - 1; } return s; } }; template <class T = int> class rangeadd { BIT<T> b0, b1; public: rangeadd(int n) : b0(n), b1(n){}; void add(int l, int r, T x) { //[l,r) b0.add(l, -x * (l - 1)); b1.add(l, x); b0.add(r, x * r); b1.add(r, -x); } T sum(int i) { if (i < 0) return 0; return b0.sum(i) + b1.sum(i) * i; } T sum(int l, int r) { return sum(r - 1) - sum(l - 1); } }; typedef complex<ld> P; typedef vector<P> VP; const ld eps = 1e-11, pi = acos(-1.0); ld dot(P a, P b) { return real(conj(a) * b); } ld cross(P a, P b) { return imag(conj(a) * b); } namespace std { bool operator<(const P &a, const P &b) { return abs(a.real() - b.real()) < eps ? a.imag() < b.imag() : a.real() < b.real(); } } // namespace std struct L { P a, b; }; // line->l,segment->s struct C { P p; ld r; }; int ccw(P a, P b, P c) { b -= a; c -= a; if (cross(b, c) > eps) return 1; // counter clockwise if (cross(b, c) < -eps) return -1; // clockwise if (dot(b, c) < 0) return 2; // c--a--b on line if (norm(b) < norm(c)) return -2; // a--b--c on line return 0; // a--c--b on line } bool isis_ll(L l, L m) { // is intersect return abs(cross(l.b - l.a, m.b - m.a)) > eps; } bool isis_ls(L l, L s) { ld a = cross(l.b - l.a, s.a - l.a); ld b = cross(l.b - l.a, s.b - l.a); return (a * b < eps); } bool isis_lp(L l, P p) { return abs(cross(l.b - p, l.a - p)) < eps; } bool isis_ss(L s, L t) { return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0; } P is_ll(L s, L t) { // intersect P sv = s.b - s.a, tv = t.b - t.a; return s.a + sv * cross(tv, t.a - s.a) / cross(tv, sv); } bool isis_sp(L s, P p) { return abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a) < eps; } P proj(L l, P p) { ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b); return l.a + t * (l.a - l.b); } ld dist_lp(L l, P p) { return abs(p - proj(l, p)); } ld dist_ll(L l, L m) { return isis_ll(l, m) ? 0 : dist_lp(l, m.a); } ld dist_ls(L l, L s) { if (isis_ls(l, s)) return 0; return min(dist_lp(l, s.a), dist_lp(l, s.b)); } ld dist_sp(L s, P p) { P r = proj(s, p); if (isis_sp(s, r)) return abs(r - p); return min(abs(s.a - p), abs(s.b - p)); } ld dist_ss(L s, L t) { if (isis_ss(s, t)) return 0; ld a = min(dist_sp(s, t.a), dist_sp(t, s.a)); ld b = min(dist_sp(s, t.b), dist_sp(t, s.b)); return min(a, b); } VP is_cc(C c1, C c2) { VP res; ld d = abs(c1.p - c2.p); ld rc = (d * d + c1.r * c1.r - c2.r * c2.r) / (2 * d); ld dfr = c1.r * c1.r - rc * rc; if (abs(dfr) < eps) dfr = 0.0; else if (dfr < 0.0) return res; // no intersection ld rs = sqrt(dfr); P diff = (c2.p - c1.p) / d; res.push_back(c1.p + diff * P(rc, rs)); if (dfr != 0.0) res.push_back(c1.p + diff * P(rc, -rs)); return res; } bool isis_vc(vector<C> vc) { VP crs; int n = vc.size(); rep(i, n) rep(j, i) for (P p : is_cc(vc[i], vc[j])) crs.push_back(p); rep(i, n) crs.push_back(vc[i].p); for (P p : crs) { bool valid = true; rep(i, n) if (abs(p - vc[i].p) > vc[i].r + eps) valid = false; if (valid) return true; } return false; } VP is_lc(C c, L l) { VP res; ld d = dist_lp(l, c.p); if (d < c.r + eps) { ld len = (d > c.r) ? 0.0 : sqrt(c.r * c.r - d * d); // safety; P nor = (l.a - l.b) / abs(l.a - l.b); res.push_back(proj(l, c.p) + len * nor); res.push_back(proj(l, c.p) - len * nor); } return res; } VP is_sc(C c, L l) { VP v = is_lc(c, l), res; for (P p : v) if (isis_sp(l, p)) res.push_back(p); return res; } vector<L> tangent_cp(C c, P p) { //????????\???? vector<L> ret; P v = c.p - p; ld d = abs(v); ld l = sqrt(norm(v) - c.r * c.r); if (isnan(l)) { return ret; } P v1 = v * P(l / d, c.r / d); P v2 = v * P(l / d, -c.r / d); ret.push_back(L{p, p + v1}); if (l < eps) return ret; ret.push_back(L{p, p + v2}); return ret; } vector<L> tangent_cc(C c1, C c2) { vector<L> ret; if (abs(c1.p - c2.p) - (c1.r + c2.r) > -eps) { P center = (c1.p * c2.r + c2.p * c1.r) / (c1.r + c2.r); ret = tangent_cp(c1, center); } if (abs(c1.r - c2.r) > eps) { P out = (-c1.p * c2.r + c2.p * c1.r) / (c1.r - c2.r); vector<L> nret = tangent_cp(c1, out); ret.insert(ret.end(), ALL(nret)); } else { P v = c2.p - c1.p; v /= abs(v); P q1 = c1.p + v * P(0, 1) * c1.r; P q2 = c1.p + v * P(0, -1) * c1.r; ret.push_back(L{q1, q1 + v}); ret.push_back(L{q2, q2 + v}); } return ret; } ld area(const VP &p) { //??¢????? ld res = 0; int n = p.size(); rep(j, n) res += cross(p[j], p[(j + 1) % n]); return res / 2; } bool is_polygon(L l, VP &g) { int n = g.size(); for (int i = 0; i < n; i++) { P a = g[i]; P b = g[(i + 1) % n]; if (isis_ss(l, L{a, b})) return true; } return false; } int is_in_Polygon(const VP &g, P p) { bool in = false; int n = g.size(); for (int i = 0; i < n; i++) { P a = g[i] - p, b = g[(i + 1) % n] - p; if (imag(a) > imag(b)) swap(a, b); if (imag(a) <= 0 && 0 < imag(b)) if (cross(a, b) < 0) in = !in; if (abs(cross(a, b)) < eps && dot(a, b) < eps) return 0; // on } if (in) return 1; // in return -1; // out } VP ConvexHull(VP ps) { int n = ps.size(); int k = 0; sort(ps.begin(), ps.end()); VP ch(2 * n); for (int i = 0; i < n; ch[k++] = ps[i++]) while (k >= 2 && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k; for (int i = n - 2, t = k + 1; i >= 0; ch[k++] = ps[i--]) while (k >= t && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k; ch.resize(k - 1); return ch; } VP ConvexCut(const VP &ps, L l) { VP Q; for (int i = 0; i < (int)ps.size(); i++) { P A = ps[i], B = ps[(i + 1) % ps.size()]; if (ccw(l.a, l.b, A) != -1) Q.push_back(A); if (ccw(l.a, l.b, A) * ccw(l.a, l.b, B) < 0) Q.push_back(is_ll(L{A, B}, l)); } return Q; } // end of lib // template<class S=void,int ptr_num, class T = char>class trie { // umap<T, trie<S, ptr_num, T> next; // public: // S key; // trie<S, ptr_num, T>* ptr[ptr_num] = {}; // trie(S &&data) :key(data) {} // trie(const S &data) :key(data) {} // void add(T x,S data) { // if (!next.find(x))next.insert(x, data); // } // trie& operator[](T x) { // return next[x]; // } // bool find(T x) { // retun next.find(x); // } //}; // template<class T=char>class AhoCorasick { // trie<pair<bool,int>, 2, T> tree; // AhoCorasick(vector<string> p) { // int num = 0; // vector<decltype(&tree)> que(p.size(),&tree); // for (int i = 0;; i++) { // bool end = 1; // int i = 0; // for (auto a : p) { // if (i >= a.size())break; // end = ;0 // que[i] = (*que[i])[a[i]]; // i++; // } // if (end)break; // } // } //}; double dp[10001][20][20]; bool ac[20][20][20]; double d[20][20]; ll x[170]; int main() { int n; rep(i, n) { int a, b, c; cin >> a >> b >> c; cout << (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a ? "YES" : "NO") << endl; } }
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> // cin.sync_with_stdio(false); // streambuf using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; using vi = vector<int>; using vll = vector<ll>; using vpii = vector<pii>; using vpll = vector<pll>; using ti3 = tuple<int, int, int>; using vti3 = vector<ti3>; template <class T, int s> using va = vector<array<T, s>>; template <class T, class T2> using umap = unordered_map<T, T2>; template <class T> using uset = unordered_set<T>; template <class T, class S> void cmin(T &a, const S &b) { if (a > b) a = b; } template <class T, class S> void cmax(T &a, const S &b) { if (a < b) a = b; } #define ALL(a) a.begin(), a.end() #define rep(i, a) for (int i = 0; i < a; i++) #define rep1(i, a) for (int i = 1; i <= a; i++) #define rrep(i, a) for (int i = (a)-1; i >= 0; i--) #define rrep1(i, a) for (int i = a; i; i--) const ll mod = 1000000007; #define REP rep template <class T> using heap = priority_queue<T, vector<T>, greater<T>>; template <class T> using pque = priority_queue<T, vector<T>, function<T(T, T)>>; template <class T> inline void hash_combine(size_t &seed, const T &v) { hash<T> hasher; seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2); } namespace std { template <typename S, typename T> struct hash<pair<S, T>> { inline size_t operator()(const pair<S, T> &v) const { size_t seed = 0; hash_combine(seed, v.first); hash_combine(seed, v.second); return seed; } }; // Recursive template code derived from Matthieu M. template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1> struct HashValueImpl { static void apply(size_t &seed, Tuple const &tuple) { HashValueImpl<Tuple, Index - 1>::apply(seed, tuple); hash_combine(seed, std::get<Index>(tuple)); } }; template <class Tuple> struct HashValueImpl<Tuple, 0> { static void apply(size_t &seed, Tuple const &tuple) { hash_combine(seed, std::get<0>(tuple)); } }; template <typename... TT> struct hash<std::tuple<TT...>> { size_t operator()(std::tuple<TT...> const &tt) const { size_t seed = 0; HashValueImpl<std::tuple<TT...>>::apply(seed, tt); return seed; } }; } // namespace std template <class T> int id(vector<T> &a, T b) { return lower_bound(ALL(a), b) - a.begin(); } ll pow(ll base, ll i, ll mod) { ll a = 1; while (i) { if (i & 1) { a *= base; a %= mod; } base *= base; base %= mod; i /= 2; } return a; } ll gcd(ll a, ll b) { while (b) { ll c = a % b; a = b; b = c; } return a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int popcnt(unsigned long long a) { a = (a & 0x5555555555555555) + (a >> 1 & 0x5555555555555555); a = (a & 0x3333333333333333) + (a >> 2 & 0x3333333333333333); a = (a & 0x0f0f0f0f0f0f0f0f) + (a >> 4 & 0x0f0f0f0f0f0f0f0f); a = (a & 0x00ff00ff00ff00ff) + (a >> 8 & 0x00ff00ff00ff00ff); a = (a & 0x0000ffff0000ffff) + (a >> 16 & 0x0000ffff0000ffff); return (a & 0xffffffff) + (a >> 32); } class unionfind { vector<int> par, rank, size_; //テゥツ?淌・ツコツヲテ」ツ?ァテ」ツ?ッテ」ツ?ェテ」ツ?湘」ツδ。テ」ツδ「テ」ツδェテ・ツ環ケテァツ篠?」ツつ津ィツ?ε」ツ?暗」ツつ凝」ツ?ェテ」ツつ詠ankテ」ツ?ョテ」ツ?凝」ツつ湘」ツつ甘」ツ?ォsizeテ」ツつ津、ツスツソテ」ツ?? public: unionfind(int n) : par(n), rank(n), size_(n, 1) { iota(ALL(par), 0); } int find(int x) { if (par[x] == x) return x; return par[x] = find(par[x]); } void unite(int x, int y) { x = find(x), y = find(y); if (x == y) return; if (rank[x] < rank[y]) swap(x, y); par[y] = x; size_[x] += size_[y]; if (rank[x] == rank[y]) rank[x]++; } bool same(int x, int y) { return find(x) == find(y); } int size(int x) { return size_[find(x)]; } }; template <class T, class Func = function<T(T, T)>> class segtree { vector<T> obj; int offset; Func updater; T e; int bufsize(int num) { int i = 1; for (; num > i; i <<= 1) ; offset = i - 1; return (i << 1) - 1; } T query(int a, int b, int k, int l, int r) { if (r <= a || b <= l) return e; if (a <= l && r <= b) return obj[k]; else return updater(query(a, b, k * 2 + 1, l, (l + r) / 2), query(a, b, k * 2 + 2, (l + r) / 2, r)); } /* template<class QF = function<T(T, T)>> auto query(int a, int b, int k, int l, int r,QF qf) { if (r <= a || b <= l)return e; if (a <= l && r <= b)return obj[k]; else return qf(query(a, b, k * 2 + 1, l, (l + r) / 2, qf), query(a, b, k * 2 + 2, (l + r) / 2, r, qf)); }*/ public: T query(int a, int b) { //[a,b) return query(a, b, 0, 0, offset + 1); } /* template<class QF = function<T(T, T)>> auto query(int a, int b,QF &&qf) {//[a,b) return query(a, b, 0, 0, offset + 1,qf); }*/ void updateall(int l = 0, int r = -1) { if (r < 0) r = offset + 1; l += offset, r += offset; do { l = l - 1 >> 1, r = r - 1 >> 1; for (int i = l; i < r; i++) obj[i] = updater(obj[i * 2 + 1], obj[i * 2 + 2]); } while (l); } void update(int k, T &a) { k += offset; obj[k] = a; while (k) { k = k - 1 >> 1; obj[k] = updater(obj[k * 2 + 1], obj[k * 2 + 2]); } } segtree(int n, T e, const Func &updater = Func()) : obj(bufsize(n), e), e(e), updater(updater) {} segtree(vector<T> &vec, T e, const Func &updater = Func()) : obj(bufsize(vec.size()), e), e(e), updater(updater) { copy(vec.begin(), vec.end(), obj.begin() + offset); updateall(); } typename vector<T>::reference operator[](int n) { return obj[n + offset]; } }; template <class T = int> class BIT { //テ・ツ、ツ堙ヲツャツ。テ・ツ?ィITテ」ツ?ッテ」ツδォテ」ツδシテ」ツδ療」ツつ津」ツδ催」ツつケテ」ツδ暗」ツ?凖」ツつ古」ツ?ーテ」ツ??」ツ??」ツつ嘉」ツ?療」ツ??」ツ?? vector<T> bit; int n; public: BIT(int n) : bit(n + 1, 0) {} void add(int i, T x) { i++; while (i <= n) { bit[i] += x; i += i & -i; } } T sum(int i) { T s = 0; i++; while (i) { s += bit[i]; i &= i - 1; } return s; } }; template <class T = int> class rangeadd { BIT<T> b0, b1; public: rangeadd(int n) : b0(n), b1(n){}; void add(int l, int r, T x) { //[l,r) b0.add(l, -x * (l - 1)); b1.add(l, x); b0.add(r, x * r); b1.add(r, -x); } T sum(int i) { if (i < 0) return 0; return b0.sum(i) + b1.sum(i) * i; } T sum(int l, int r) { return sum(r - 1) - sum(l - 1); } }; typedef complex<ld> P; typedef vector<P> VP; const ld eps = 1e-11, pi = acos(-1.0); ld dot(P a, P b) { return real(conj(a) * b); } ld cross(P a, P b) { return imag(conj(a) * b); } namespace std { bool operator<(const P &a, const P &b) { return abs(a.real() - b.real()) < eps ? a.imag() < b.imag() : a.real() < b.real(); } } // namespace std struct L { P a, b; }; // line->l,segment->s struct C { P p; ld r; }; int ccw(P a, P b, P c) { b -= a; c -= a; if (cross(b, c) > eps) return 1; // counter clockwise if (cross(b, c) < -eps) return -1; // clockwise if (dot(b, c) < 0) return 2; // c--a--b on line if (norm(b) < norm(c)) return -2; // a--b--c on line return 0; // a--c--b on line } bool isis_ll(L l, L m) { // is intersect return abs(cross(l.b - l.a, m.b - m.a)) > eps; } bool isis_ls(L l, L s) { ld a = cross(l.b - l.a, s.a - l.a); ld b = cross(l.b - l.a, s.b - l.a); return (a * b < eps); } bool isis_lp(L l, P p) { return abs(cross(l.b - p, l.a - p)) < eps; } bool isis_ss(L s, L t) { return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0; } P is_ll(L s, L t) { // intersect P sv = s.b - s.a, tv = t.b - t.a; return s.a + sv * cross(tv, t.a - s.a) / cross(tv, sv); } bool isis_sp(L s, P p) { return abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a) < eps; } P proj(L l, P p) { ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b); return l.a + t * (l.a - l.b); } ld dist_lp(L l, P p) { return abs(p - proj(l, p)); } ld dist_ll(L l, L m) { return isis_ll(l, m) ? 0 : dist_lp(l, m.a); } ld dist_ls(L l, L s) { if (isis_ls(l, s)) return 0; return min(dist_lp(l, s.a), dist_lp(l, s.b)); } ld dist_sp(L s, P p) { P r = proj(s, p); if (isis_sp(s, r)) return abs(r - p); return min(abs(s.a - p), abs(s.b - p)); } ld dist_ss(L s, L t) { if (isis_ss(s, t)) return 0; ld a = min(dist_sp(s, t.a), dist_sp(t, s.a)); ld b = min(dist_sp(s, t.b), dist_sp(t, s.b)); return min(a, b); } VP is_cc(C c1, C c2) { VP res; ld d = abs(c1.p - c2.p); ld rc = (d * d + c1.r * c1.r - c2.r * c2.r) / (2 * d); ld dfr = c1.r * c1.r - rc * rc; if (abs(dfr) < eps) dfr = 0.0; else if (dfr < 0.0) return res; // no intersection ld rs = sqrt(dfr); P diff = (c2.p - c1.p) / d; res.push_back(c1.p + diff * P(rc, rs)); if (dfr != 0.0) res.push_back(c1.p + diff * P(rc, -rs)); return res; } bool isis_vc(vector<C> vc) { VP crs; int n = vc.size(); rep(i, n) rep(j, i) for (P p : is_cc(vc[i], vc[j])) crs.push_back(p); rep(i, n) crs.push_back(vc[i].p); for (P p : crs) { bool valid = true; rep(i, n) if (abs(p - vc[i].p) > vc[i].r + eps) valid = false; if (valid) return true; } return false; } VP is_lc(C c, L l) { VP res; ld d = dist_lp(l, c.p); if (d < c.r + eps) { ld len = (d > c.r) ? 0.0 : sqrt(c.r * c.r - d * d); // safety; P nor = (l.a - l.b) / abs(l.a - l.b); res.push_back(proj(l, c.p) + len * nor); res.push_back(proj(l, c.p) - len * nor); } return res; } VP is_sc(C c, L l) { VP v = is_lc(c, l), res; for (P p : v) if (isis_sp(l, p)) res.push_back(p); return res; } vector<L> tangent_cp(C c, P p) { //テ・ツ??」ツ?ョテヲツ篠・テァツキツ? vector<L> ret; P v = c.p - p; ld d = abs(v); ld l = sqrt(norm(v) - c.r * c.r); if (isnan(l)) { return ret; } P v1 = v * P(l / d, c.r / d); P v2 = v * P(l / d, -c.r / d); ret.push_back(L{p, p + v1}); if (l < eps) return ret; ret.push_back(L{p, p + v2}); return ret; } vector<L> tangent_cc(C c1, C c2) { vector<L> ret; if (abs(c1.p - c2.p) - (c1.r + c2.r) > -eps) { P center = (c1.p * c2.r + c2.p * c1.r) / (c1.r + c2.r); ret = tangent_cp(c1, center); } if (abs(c1.r - c2.r) > eps) { P out = (-c1.p * c2.r + c2.p * c1.r) / (c1.r - c2.r); vector<L> nret = tangent_cp(c1, out); ret.insert(ret.end(), ALL(nret)); } else { P v = c2.p - c1.p; v /= abs(v); P q1 = c1.p + v * P(0, 1) * c1.r; P q2 = c1.p + v * P(0, -1) * c1.r; ret.push_back(L{q1, q1 + v}); ret.push_back(L{q2, q2 + v}); } return ret; } ld area(const VP &p) { //テゥツ敖「テァツゥツ?? ld res = 0; int n = p.size(); rep(j, n) res += cross(p[j], p[(j + 1) % n]); return res / 2; } bool is_polygon(L l, VP &g) { int n = g.size(); for (int i = 0; i < n; i++) { P a = g[i]; P b = g[(i + 1) % n]; if (isis_ss(l, L{a, b})) return true; } return false; } int is_in_Polygon(const VP &g, P p) { bool in = false; int n = g.size(); for (int i = 0; i < n; i++) { P a = g[i] - p, b = g[(i + 1) % n] - p; if (imag(a) > imag(b)) swap(a, b); if (imag(a) <= 0 && 0 < imag(b)) if (cross(a, b) < 0) in = !in; if (abs(cross(a, b)) < eps && dot(a, b) < eps) return 0; // on } if (in) return 1; // in return -1; // out } VP ConvexHull(VP ps) { int n = ps.size(); int k = 0; sort(ps.begin(), ps.end()); VP ch(2 * n); for (int i = 0; i < n; ch[k++] = ps[i++]) while (k >= 2 && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k; for (int i = n - 2, t = k + 1; i >= 0; ch[k++] = ps[i--]) while (k >= t && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k; ch.resize(k - 1); return ch; } VP ConvexCut(const VP &ps, L l) { VP Q; for (int i = 0; i < (int)ps.size(); i++) { P A = ps[i], B = ps[(i + 1) % ps.size()]; if (ccw(l.a, l.b, A) != -1) Q.push_back(A); if (ccw(l.a, l.b, A) * ccw(l.a, l.b, B) < 0) Q.push_back(is_ll(L{A, B}, l)); } return Q; } // end of lib // template<class S=void,int ptr_num, class T = char>class trie { // umap<T, trie<S, ptr_num, T> next; // public: // S key; // trie<S, ptr_num, T>* ptr[ptr_num] = {}; // trie(S &&data) :key(data) {} // trie(const S &data) :key(data) {} // void add(T x,S data) { // if (!next.find(x))next.insert(x, data); // } // trie& operator[](T x) { // return next[x]; // } // bool find(T x) { // retun next.find(x); // } //}; // template<class T=char>class AhoCorasick { // trie<pair<bool,int>, 2, T> tree; // AhoCorasick(vector<string> p) { // int num = 0; // vector<decltype(&tree)> que(p.size(),&tree); // for (int i = 0;; i++) { // bool end = 1; // int i = 0; // for (auto a : p) { // if (i >= a.size())break; // end = ;0 // que[i] = (*que[i])[a[i]]; // i++; // } // if (end)break; // } // } //}; double dp[10001][20][20]; bool ac[20][20][20]; double d[20][20]; ll x[170]; int main() { int n; cin >> n; rep(i, n) { int a, b, c; cin >> a >> b >> c; cout << (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a ? "YES" : "NO") << endl; } }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
4,405
4
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; int a[3]; while (cin >> a[0] >> a[1] >> a[2]) { 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; }
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; int a[3]; while (cin >> a[0] >> a[1] >> a[2]) { 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; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
115
4
#include <iostream> using namespace std; void triangle_check(int max, int x, int y); int main() { int n, a, b, c; cin >> n; while (n-- > 0) { cin >> a >> b >> c; if (a > b) { if (a > c) { triangle_check(a, b, c); } else { triangle_check(c, a, b); } } else { if (b > c) { triangle_check(b, a, c); } else { triangle_check(c, a, b); } } } return 0; } void triangle_check(int max, int x, int y) { if (max * max == x * x + y * y) cout << "yes" << endl; else cout << "no" << endl; }
#include <iostream> using namespace std; void triangle_check(int max, int x, int y); int main() { int n, a, b, c; cin >> n; while (n-- > 0) { cin >> a >> b >> c; if (a > b) { if (a > c) { triangle_check(a, b, c); } else { triangle_check(c, a, b); } } else { if (b > c) { triangle_check(b, a, c); } else { triangle_check(c, a, b); } } } return 0; } void triangle_check(int max, int x, int y) { if (max * max == x * x + y * y) cout << "YES" << endl; else cout << "NO" << endl; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
172
4
#include <bits/stdc++.h> using namespace std; int N; int a[3]; int b, c, d; int main() { for (int i = 0; i < N; ++i) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); b = a[0] * a[0]; c = a[1] * a[1]; d = a[2] * a[2]; if (b + c == d) { cout << "YES" << endl; } else { cout << "NO" << endl; } } }
#include <bits/stdc++.h> using namespace std; int N; int a[3]; int b, c, d; int main() { cin >> N; for (int i = 0; i < N; ++i) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); b = a[0] * a[0]; c = a[1] * a[1]; d = a[2] * a[2]; if (b + c == d) { cout << "YES" << endl; } else { cout << "NO" << endl; } } }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
135
4
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> using namespace std; int main() { int n, a, b, c; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> using namespace std; int main() { int n, a, b, c; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
119
4
#include <iostream> using namespace std; int main() { int N = 0, a, b, c, d = 0; cin >> N; for (int i = 0; i < N; i++) { cin >> a >> b >> c; if (a < b) { d = a; a = b; b = d; d = 0; } if (a < c) { d = a; a = c; c = d; d = 0; } if (a * a == b * b + c * c) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
#include <iostream> using namespace std; int main() { int N = 0, a, b, c, d = 0; cin >> N; for (int i = 0; i < N; i++) { cin >> a >> b >> c; if (a < b) { d = a; a = b; b = d; d = 0; } if (a < c) { d = a; a = c; c = d; d = 0; } if (a * a == b * b + c * c) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
141
4
#include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { int a, b, c; cin >> a >> b >> c; a *= a; b *= b; c *= c; if (a == b + c || b == a + c || c == a + b) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
#include <iostream> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { int a, b, c; cin >> a >> b >> c; a *= a; b *= b; c *= c; if (a == b + c || b == a + c || c == a + b) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
106
4
//------------- // include //------------- #include <algorithm> #include <cctype> #include <cmath> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <string> #include <vector> using namespace std; //------------- // typedef //------------- typedef long long LL; typedef vector<int> VI; typedef vector<double> VD; typedef string STR; typedef pair<int, int> PII; typedef vector<int, int> VII; typedef map<string, int> MSI; //------------- // utillty //------------- #define ALL(a) (a).begin(), (a).end() #define MK make_pair #define PB push_back #define SZ(a) int((a).size()) #define EACH(i, c) \ for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define SORT(c) sort((c).begin(), (c).end()) #define COUT(a) cout << a << endl #define POW2(a) pow(a, 2.0) //------------- // repetition //------------- #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) //------------- // debug //------------- #define dump(x) cerr << #x << " = " << (x) << endl; #define dumpl(c) REP(i, SZ(c)) cerr << #c << i << "=" << (c[i]) << endl; #define debug(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << __FILE__ << endl; const int MOD = 1000000007; int main() { int x; cin >> x; REP(i, x) { VD tri; REP(i, 3) { double temp; tri.push_back(temp); } SORT(tri); if (tri[2] == sqrt(POW2(tri[0]) + POW2(tri[1]))) { COUT("YES"); } else { COUT("NO"); } } #ifdef _DEBUG while (1) ; #endif // _DEBUG return 0; }
//------------- // include //------------- #include <algorithm> #include <cctype> #include <cmath> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <string> #include <vector> using namespace std; //------------- // typedef //------------- typedef long long LL; typedef vector<int> VI; typedef vector<double> VD; typedef string STR; typedef pair<int, int> PII; typedef vector<int, int> VII; typedef map<string, int> MSI; //------------- // utillty //------------- #define ALL(a) (a).begin(), (a).end() #define MK make_pair #define PB push_back #define SZ(a) int((a).size()) #define EACH(i, c) \ for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define SORT(c) sort((c).begin(), (c).end()) #define COUT(a) cout << a << endl #define POW2(a) pow(a, 2.0) //------------- // repetition //------------- #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) //------------- // debug //------------- #define dump(x) cerr << #x << " = " << (x) << endl; #define dumpl(c) REP(i, SZ(c)) cerr << #c << i << "=" << (c[i]) << endl; #define debug(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << __FILE__ << endl; const int MOD = 1000000007; int main() { int x; cin >> x; REP(i, x) { VD tri; REP(i, 3) { double temp; cin >> temp; tri.push_back(temp); } SORT(tri); if (tri[2] == sqrt(POW2(tri[0]) + POW2(tri[1]))) { COUT("YES"); } else { COUT("NO"); } } #ifdef _DEBUG while (1) ; #endif // _DEBUG return 0; }
[["+", 8, 9, 0, 9, 0, 1, 0, 16, 31, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 16, 17, 152], ["+", 8, 9, 0, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35]]
1
288
4
#include <algorithm> #include <stdio.h> using namespace std; int main() { int a[3], n; scanf("%d", &n); for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { scanf("%d", &a[j]); } sort(a, a + 3); if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) printf("Yes\n"); else printf("No\n"); } }
#include <algorithm> #include <stdio.h> using namespace std; int main() { int a[3], n; scanf("%d", &n); for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { scanf("%d", &a[j]); } sort(a, a + 3); if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) printf("YES\n"); else printf("NO\n"); } }
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
135
4
#include <stdio.h> int main() { int a, b, c, N, t, A, B, C; scanf("%d", &N); for (t = 0; t < N; t++) { scanf("%d %d %d", &a, &b, &c); A = a * a - b * b - c * c; B = b * b - c * c - b * b; C = c * c - a * a - b * b; if (A == 0 || B == 0 || C == 0) { printf("YES\n"); } else printf("NO\n"); } return 0; }
#include <stdio.h> int main() { int a, b, c, N, t, A, B, C; scanf("%d", &N); for (t = 0; t < N; t++) { scanf("%d %d %d", &a, &b, &c); A = a * a - b * b - c * c; B = b * b - c * c - a * a; C = c * c - a * a - b * b; if (A == 0 || B == 0 || C == 0) { printf("YES\n"); } else printf("NO\n"); } return 0; }
[["-", 0, 1, 0, 11, 12, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 12, 22]]
1
144
4
#include <algorithm> #include <iostream> #include <vector> int main() { std::vector<int> on, tw, th; int n; std::cin >> n; for (int i = 0; i < n; i++) { int a, b, c; std::cin >> a >> b >> c; on.emplace_back(a); tw.emplace_back(b); th.emplace_back(c); } for (int i = 0; i < n; i++) { int x[3]; x[0] = on[i]; x[1] = tw[i]; x[2] = th[i]; std::sort(x, x + 3); if (x[0] * x[0] + x[1] * x[1] == x[2] * x[2]) { std::cout << "Yes" << std::endl; } else { std::cout << "No" << std::endl; } } }
#include <algorithm> #include <iostream> #include <vector> int main() { std::vector<int> on, tw, th; int n; std::cin >> n; for (int i = 0; i < n; i++) { int a, b, c; std::cin >> a >> b >> c; on.emplace_back(a); tw.emplace_back(b); th.emplace_back(c); } for (int i = 0; i < n; i++) { int x[3]; x[0] = on[i]; x[1] = tw[i]; x[2] = th[i]; std::sort(x, x + 3); if (x[0] * x[0] + x[1] * x[1] == x[2] * x[2]) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
211
4
#include <iostream> using namespace std; int main() { int a, b, c; int N; for (int i = 0; i < N; i++) { cin >> a >> b >> c; a = a * a; b = b * b; c = c * c; if ((a == b + c) || (b == a + c) || (c == a + b)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c; int N; cin >> N; for (int i = 0; i < N; i++) { cin >> a >> b >> c; a = a * a; b = b * b; c = c * c; if ((a == b + c) || (b == a + c) || (c == a + b)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
114
4
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int N; cin >> N; int a, b, c; while (N--) { cin >> a >> b >> c; int l = max(a, max(b, c)); int x, y; if (a == l) { x = b; y = c; } else if (b == l) { x = a; y = c; } else if (c == l) { x = a; y = b; } if (l == sqrt(pow(x, 2) + pow(y, 2))) { printf("Yes\n"); } else { printf("No\n"); } } return 0; }
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int N; cin >> N; int a, b, c; while (N--) { cin >> a >> b >> c; int l = max(a, max(b, c)); int x, y; if (a == l) { x = b; y = c; } else if (b == l) { x = a; y = c; } else if (c == l) { x = a; y = b; } if (l == sqrt(pow(x, 2) + pow(y, 2))) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
160
4
#include <algorithm> #include <iostream> using namespace std; int main() { static long long a, b[3] = {0}; cin >> a; for (int A = 0; A < a; A++) { cin >> b[0] >> b[1] >> b[2]; sort(b, b + 3); b[0] *= b[0]; b[1] *= b[1]; b[2] *= b[2]; if (b[2] != b[0] + b[1]) cout << "No" << endl; else cout << "Yes" << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { static long long a, b[3] = {0}; cin >> a; for (int A = 0; A < a; A++) { cin >> b[0] >> b[1] >> b[2]; sort(b, b + 3); b[0] *= b[0]; b[1] *= b[1]; b[2] *= b[2]; if (b[2] != b[0] + b[1]) cout << "NO" << endl; else cout << "YES" << endl; } return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
141
4
#include <iostream> int main(int argc, char **argv) { int num, i, a, b, c; std::cin >> num; for (i = 0; i < num; i++) { std::cin >> a >> b >> c; if (a * a + b * b == c * c && b * b + c * c == a * a && c * c + a * a == b * b) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } }
#include <iostream> int main(int argc, char **argv) { int num, i, a, b, c; std::cin >> num; for (i = 0; i < num; i++) { std::cin >> a >> b >> c; if (a * a + b * b == c * c || b * b + c * c == a * a || c * c + a * a == b * b) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 106], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
124
4
#include <cmath> #include <iostream> using namespace std; int main() { int n; cin >> n; int a, b, c; for (int i = 0; i < n; i++) { cin >> a >> b >> c; int d = a * a; int e = b * b; int f = c * c; if ((d = e + f) || (e = d + f) || (f = d + e)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <cmath> #include <iostream> using namespace std; int main() { int n; cin >> n; int a, b, c; for (int i = 0; i < n; i++) { cin >> a >> b >> c; int d = a * a; int e = b * b; int f = c * c; if ((d == e + f) || (e == d + f) || (f == d + e)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 51, 16, 31, 16, 31, 23, 0, 42, 0, 32], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 17, 60], ["-", 51, 16, 31, 16, 12, 23, 0, 42, 0, 32], ["+", 51, 16, 31, 16, 12, 23, 0, 16, 17, 60], ["-", 15, 339, 51, 16, 12, 23, 0, 42, 0, 32], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 60]]
1
119
6
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T--) { int a, b, c; cin >> a >> b >> c; if (a > b) swap(a, b); if (b > c) swap(b, c); if (a > b) swap(a, b); if (a * a + b * b == c) { cout << "YES" << endl; } else { cout << "NO" << endl; } } }
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T--) { int a, b, c; cin >> a >> b >> c; if (a > b) swap(a, b); if (b > c) swap(b, c); if (a > b) swap(a, b); if (a * a + b * b == c * c) { cout << "YES" << endl; } else { cout << "NO" << endl; } } }
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
113
2
#include <algorithm> #include <iostream> using namespace std; int main() { int nNum = 0; cin >> nNum; int nIn[3] = {0}; while (nNum--) { cin >> nIn[0] >> nIn[1] >> nIn[2]; int nMax = max(max(nIn[0], nIn[1]), nIn[2]); if (nMax * nMax * 2 == nIn[0] * nIn[0] + nIn[1] * nIn[2] + nIn[2] * nIn[2]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int nNum = 0; cin >> nNum; int nIn[3] = {0}; while (nNum--) { cin >> nIn[0] >> nIn[1] >> nIn[2]; int nMax = max(max(nIn[0], nIn[1]), nIn[2]); if (nMax * nMax * 2 == nIn[0] * nIn[0] + nIn[1] * nIn[1] + nIn[2] * nIn[2]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 31, 16, 12, 16, 12, 69, 341, 342, 0, 13], ["+", 31, 16, 12, 16, 12, 69, 341, 342, 0, 13]]
1
143
2
#include <algorithm> #include <iostream> using namespace std; int main() { int nNum = 0; cin >> nNum; int nIn[3] = {0}; while (nNum--) { cin >> nIn[0] >> nIn[1] >> nIn[2]; int nMax = max(max(nIn[0], nIn[1]), nIn[2]); if (nMax == nIn[2]) { swap(nIn[2], nIn[0]); } else if (nMax == nIn[1]) { swap(nIn[1], nIn[2]); } if (nIn[0] * nIn[0] == nIn[1] * nIn[1] + nIn[2] * nIn[2]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int nNum = 0; cin >> nNum; int nIn[3] = {0}; while (nNum--) { cin >> nIn[0] >> nIn[1] >> nIn[2]; int nMax = max(max(nIn[0], nIn[1]), nIn[2]); if (nMax == nIn[2]) { swap(nIn[2], nIn[0]); } else if (nMax == nIn[1]) { swap(nIn[1], nIn[0]); } if (nIn[0] * nIn[0] == nIn[1] * nIn[1] + nIn[2] * nIn[2]) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13]]
1
186
2
#include <algorithm> #include <cmath> #include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; int a, b, c; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a > b) swap(a, b); if (b > c) swap(b, c); if (a > b) swap(a, b); if (a * a + b * b == c * c) { cout << "Yes" << endl; } else cout << "No" << endl; } return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; int a, b, c; for (int i = 0; i < n; i++) { cin >> a >> b >> c; if (a > b) swap(a, b); if (b > c) swap(b, c); if (a > b) swap(a, b); if (a * a + b * b == c * c) { cout << "YES" << endl; } else cout << "NO" << endl; } return 0; }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
131
4
#define _USE_MATH_DEFINES #include <algorithm> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; for (int i = 0; i < N; i++) { int a, b, c; cin >> a >> b >> c; if (a * a + b * b == c * c || a * a + c * c <= b * b || b * b + c * c <= a * a) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
#define _USE_MATH_DEFINES #include <algorithm> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; for (int i = 0; i < N; i++) { int a, b, c; cin >> a >> b >> c; if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
[["-", 15, 339, 51, 16, 31, 16, 12, 16, 17, 19], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 60], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60]]
1
124
4
#include <bits/stdc++.h> using namespace std; int a, b, c, n, i; int main() { cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (a > b) { swap(a, b); } if (a > c) { swap(a, c); } if (b > c) { swap(b, c); } if (c * c == a * a + b * b) { cout << "Yes" << endl; } else { cout << "No" << endl; } } }
#include <bits/stdc++.h> using namespace std; int a, b, c, n, i; int main() { cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (a > b) { swap(a, b); } if (a > c) { swap(a, c); } if (b > c) { swap(b, c); } if (c * c == a * a + b * b) { cout << "YES" << endl; } else { cout << "NO" << endl; } } }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
130
4
#include <bits/stdc++.h> using namespace std; int main() { int caso; int lado_1, lado_2, lado_3; vector<int> triangle; cin >> caso; for (int index = 0; index < caso; ++index) { cin >> lado_1 >> lado_2 >> lado_3; triangle.push_back(lado_1); triangle.push_back(lado_2); triangle.push_back(lado_3); sort(triangle.begin(), triangle.end()); if (pow(triangle[0], 2) + pow(triangle[1], 2) == pow(triangle[2], 2)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int caso; int lado_1, lado_2, lado_3; vector<int> triangle; cin >> caso; for (int index = 0; index < caso; ++index) { triangle.clear(); cin >> lado_1 >> lado_2 >> lado_3; triangle.push_back(lado_1); triangle.push_back(lado_2); triangle.push_back(lado_3); sort(triangle.begin(), triangle.end()); if (pow(triangle[0], 2) + pow(triangle[1], 2) == pow(triangle[2], 2)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
144
6
#include <algorithm> #include <iostream> using namespace std; int main() { int n, a[3]; cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) cin >> a[i]; sort(a, a + 3); if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) cout << "YES" << endl; else cout << "NO" << endl; } }
#include <algorithm> #include <iostream> using namespace std; int main() { int n, a[3]; cin >> n; 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; } }
[["-", 8, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 8, 1, 0, 16, 12, 69, 341, 342, 0, 22]]
1
121
2
#include <stdio.h> main() { int x, i, j, k; int a[3]; scanf("%d", &i); for (; i > 0; i--) { for (j = 0; j < 3; j++) { scanf("%d", &a[j]); } for (j = 0; j <= 2; j++) { for (k = j + 1; k <= 3; k++) { if (a[j] < a[k]) { x = a[j]; a[j] = a[k]; a[k] = x; } } } if (a[0] * a[0] == a[1] * a[1] + a[2] * a[2]) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
#include <stdio.h> main() { int x, i, j, k; int a[3]; scanf("%d", &i); for (; i > 0; i--) { for (j = 0; j < 3; j++) { scanf("%d", &a[j]); } for (j = 0; j < 2; j++) { for (k = j + 1; k < 3; k++) { if (a[j] < a[k]) { x = a[j]; a[j] = a[k]; a[k] = x; } } } if (a[0] * a[0] == a[1] * a[1] + a[2] * a[2]) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18]]
1
198
4
#include <iostream> using namespace std; void solve() { int t; cin >> t; while (t--) { int Data[3]; for (int i = 0; i < 3; ++i) { cin >> Data[i]; } if ((Data[0] * Data[0] + Data[1] * Data[1] == Data[2] * Data[2]) || (Data[1] * Data[1] + Data[2] * Data[2] == Data[1] * Data[1]) || (Data[0] * Data[0] + Data[2] * Data[2] == Data[1] * Data[1])) { cout << "YES" << endl; } else { cout << "NO" << endl; } } } int main() { solve(); return (0); }
#include <iostream> using namespace std; void solve() { int t; cin >> t; while (t--) { int Data[3]; for (int i = 0; i < 3; ++i) { cin >> Data[i]; } if ((Data[0] * Data[0] + Data[1] * Data[1] == Data[2] * Data[2]) || (Data[1] * Data[1] + Data[2] * Data[2] == Data[0] * Data[0]) || (Data[0] * Data[0] + Data[2] * Data[2] == Data[1] * Data[1])) { cout << "YES" << endl; } else { cout << "NO" << endl; } } } int main() { solve(); return (0); }
[["-", 0, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 0, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["-", 0, 16, 12, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 16, 12, 16, 12, 69, 341, 342, 0, 13]]
1
189
4
#include <iostream> #include <string> using namespace std; int main() { int N = 0; int a, b, c; string y = "YES"; string n = "NO"; cin >> N; for (int i = 0; i < N; i++) { cin >> a >> b >> c; if (a * a + b * b == c * c || a * a - b * b == c * c || b * b - a * a) { cout << y << endl; } else { cout << n << endl; } } }
#include <iostream> #include <string> using namespace std; int main() { int N = 0; int a, b, c; string y = "YES"; string n = "NO"; cin >> N; for (int i = 0; i < N; i++) { cin >> a >> b >> c; if (a * a + b * b == c * c || a * a - b * b == c * c || b * b - a * a == c * c) { cout << y << endl; } else { cout << n << endl; } } }
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 15, 339, 51, 16, 12, 16, 12, 16, 31, 22], ["+", 15, 339, 51, 16, 12, 16, 12, 16, 17, 48], ["+", 15, 339, 51, 16, 12, 16, 12, 16, 12, 22]]
1
119
4
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main() { int T; scanf("%d", &T); for (int t = 0; t < T; t++) { int edge[3]; printf("%d %d %d", edge, edge + 1, edge + 2); sort(edge, edge + 3, greater<int>()); if (edge[0] * edge[0] == edge[1] * edge[1] + edge[2] * edge[2]) { printf("%s\n", "YES"); } else { printf("%s\n", "NO"); } } return 0; }
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main() { int T; scanf("%d", &T); for (int t = 0; t < T; t++) { int edge[3]; scanf("%d %d %d", edge, edge + 1, edge + 2); sort(edge, edge + 3, greater<int>()); if (edge[0] * edge[0] == edge[1] * edge[1] + edge[2] * edge[2]) { printf("%s\n", "YES"); } else { printf("%s\n", "NO"); } } return 0; }
[["-", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22]]
1
148
2
#include <algorithm> #include <iostream> using namespace std; int main() { int d; cin >> d; while (d > 0) { int num[3]; for (int i = 0; i < 3; i++) { cin >> num[i]; } for (int i = 0; i < 3; i++) { for (int j = i + 1; j < 3; j++) { if (num[i] > num[j]) { int q = num[i]; num[i] = num[j]; num[j] = q; } } } if (num[2] * num[2] - num[1] * num[1] == num[0] * num[0]) { cout << "OK" << endl; } else { cout << "NG" << endl; } d--; } }
#include <algorithm> #include <iostream> using namespace std; int main() { int d; cin >> d; while (d > 0) { int num[3]; for (int i = 0; i < 3; i++) { cin >> num[i]; } for (int i = 0; i < 3; i++) { for (int j = i + 1; j < 3; j++) { if (num[i] > num[j]) { int q = num[i]; num[i] = num[j]; num[j] = q; } } } if (num[2] * num[2] - num[1] * num[1] == num[0] * num[0]) { cout << "YES" << endl; } else { cout << "NO" << endl; } d--; } }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
187
4
#include <algorithm> #include <iostream> using namespace std; int main(void) { int n; cin >> n; for (int i = 0; i < n; i++) { int a[3]; cin >> a[0] >> a[1] >> a[2]; sort(a, a + 2); if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main(void) { int n; cin >> n; for (int i = 0; i < n; i++) { int a[3]; cin >> a[0] >> a[1] >> a[2]; 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; }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
122
2
#include <algorithm> #include <cstdio> using namespace std; int N; int Side[3]; int main() { scanf("%d", &N); for (int i = 0; i < N; i++) { for (int j = 0; j < 3; j++) { scanf("%d", &Side[j]); } sort(Side, Side + 3); if (Side[0] * Side[0] == Side[1] * Side[1] + Side[2] * Side[2]) printf("YES\n"); else printf("NO\n"); } return 0; }
#include <algorithm> #include <cstdio> using namespace std; int N; int Side[3]; int main() { scanf("%d", &N); for (int i = 0; i < N; i++) { for (int j = 0; j < 3; j++) { scanf("%d", &Side[j]); } sort(Side, Side + 3); if (Side[2] * Side[2] == Side[1] * Side[1] + Side[0] * Side[0]) printf("YES\n"); else printf("NO\n"); } return 0; }
[["-", 51, 16, 31, 16, 31, 69, 341, 342, 0, 13], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 13], ["-", 51, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["+", 51, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["-", 12, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 12, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["-", 12, 16, 12, 16, 12, 69, 341, 342, 0, 13], ["+", 12, 16, 12, 16, 12, 69, 341, 342, 0, 13]]
1
139
8
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef vector<int> vint; typedef pair<int, int> pint; #define MOD 1000000007 // 10^9+7 #define INF 1000000000 // 10^9 int main() { int n; vector<int> l; cin >> n; for (int i = 0; i < n; i++) { for (int i = 0; i < 3; i++) { int d; cin >> d; l.push_back(d); } sort(l.begin(), l.end()); if (l[0] * l[0] + l[1] * l[1] == l[2] * l[2]) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef vector<int> vint; typedef pair<int, int> pint; #define MOD 1000000007 // 10^9+7 #define INF 1000000000 // 10^9 int main() { int n; vector<int> l; cin >> n; for (int i = 0; i < n; i++) { l.clear(); for (int i = 0; i < 3; i++) { int d; cin >> d; l.push_back(d); } sort(l.begin(), l.end()); if (l[0] * l[0] + l[1] * l[1] == l[2] * l[2]) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
199
6
#include <iostream> using namespace std; int main() { int a, b, c, x, y, z, n; // read in n cin >> n; // for n set of data, read into 3 sides for (int i = 1; i <= n; i++) { cin >> a >> b >> c; x = a * a; y = b * b; z = c * c; // check if they are triangle if (x + y == z || x + z == y || y + z == x) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c, x, y, z, n; // read in n cin >> n; // for n set of data, read into 3 sides for (int i = 1; i <= n; i++) { cin >> a >> b >> c; x = a * a; y = b * b; z = c * c; // check if they are triangle if (x + y == z || x + z == y || y + z == x) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
116
4
#include <iostream> using namespace std; int main() { int n, a, b, c; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; int max = a, k = b, l = c; if (max < b) { max = b; k = a; } else if (max < c) { max = c; l = a; } if (max * max == k * k + l * l) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n, a, b, c; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b >> c; int max = a, k = b, l = c; if (max < b) { max = b; k = a; } if (max < c) { max = c; k = b; l = a; } if (max * max == k * k + l * l) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
129
5
#include <algorithm> #include <iostream> using namespace std; int main() { int a[5]; int t; cin >> t; while (t--) { for (int i = 0; i < 3; ++i) { cin >> a[i]; } sort(a, a + 2); int t1, t2, t3; t1 = a[2]; t2 = a[1]; t3 = a[0]; if (t1 * t1 == t2 * t2 + t3 * t3) { cout << "YES" << endl; } else cout << "NO" << endl; } return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a[5]; int t; cin >> t; while (t--) { for (int i = 0; i < 3; ++i) { cin >> a[i]; } sort(a, a + 3); int t1, t2, t3; t1 = a[2]; t2 = a[1]; t3 = a[0]; if (t1 * t1 == t2 * t2 + t3 * t3) { cout << "YES" << endl; } else cout << "NO" << endl; } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
130
2