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 <iostream> #include <string> using namespace std; int main() { int a, b, c, h = 0, w = 0; char d; while (cin >> a >> d >> b >> d >> c) { if (a == b) h++; if (a * a + b * b == c * c) w++; } cout << w << " " << h << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main() { int a, b, c, h = 0, w = 0; char d; while (cin >> a >> d >> b >> d >> c) { if (a == b) h++; if (a * a + b * b == c * c) w++; } cout << w << endl; cout << h << endl; return 0; }
[["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22]]
1
89
6
#include <cstdio> int main() { int a, b, c, c1, c2; c1 = c2 = 0; while (scanf("%d,%d,%d", &a, &b, &c) != EOF) { if (c * c - a * a - b * b == 0) { c1++; } if (a == b) { c2++; } } printf("%d %d\n", c1, c2); return 0; }
#include <cstdio> int main() { int a, b, c, c1, c2; c1 = c2 = 0; while (scanf("%d,%d,%d", &a, &b, &c) != EOF) { if (c * c - (a * a + b * b) == 0) { c1++; } if (a == b) { c2++; } } printf("%d\n%d\n", c1, c2); return 0; }
[["+", 15, 339, 51, 16, 31, 16, 12, 23, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 51, 16, 31, 16, 12, 23, 0, 16, 17, 72], ["+", 15, 339, 51, 16, 31, 16, 12, 23, 0, 25], ["-", 0, 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, 44]]
1
94
8
// aoj 0033 #include <algorithm> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vi vector<int> #define A...
#include <algorithm> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vi vector<int> #define All(X) X.begin...
[["-", 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
290
4
#include <iostream> #include <stack> #include <vector> int main() { int k; std::cin >> k; while (k > 0) { std::vector<int> v(10, 0); std::stack<int> s; std::stack<int> s2; int a; for (int i = 0; i < 10; i++) { std::cin >> v[i]; } s.push(v[0]); s2.push(0); for (int i = 1;...
#include <iostream> #include <stack> #include <vector> int main() { int k; std::cin >> k; while (k > 0) { std::vector<int> v(10, 0); std::stack<int> s; std::stack<int> s2; int a; for (int i = 0; i < 10; i++) { std::cin >> v[i]; } s.push(v[0]); s2.push(0); for (int i = 1;...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
276
4
#include <iostream> using namespace std; int tama[10], n; bool Haireruka(int i, int left, int right) { if (i == 10) return true; if (tama[i] > left) { if (Haireruka(i + 1, tama[i], right)) return true; } if (tama[i] > right) { if (Haireruka(i + 1, left, tama[i])) return true; } re...
#include <iostream> using namespace std; int tama[10], n; bool Haireruka(int i, int left, int right) { if (i == 10) return true; if (tama[i] > left) { if (Haireruka(i + 1, tama[i], right)) return true; } if (tama[i] > right) { if (Haireruka(i + 1, left, tama[i])) return true; } re...
[["-", 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
180
4
#include <algorithm> #include <iostream> #include <stack> #include <vector> using namespace std; bool saiki(vector<int> ball, stack<int> B, stack<int> C) { if (ball.size() == 0) return true; int temp = ball.front(); bool flag1 = false, flag2 = false; ball.erase(ball.begin()); if (temp > B.top()) { ...
#include <algorithm> #include <iostream> #include <stack> #include <vector> using namespace std; bool saiki(vector<int> ball, stack<int> B, stack<int> C) { if (ball.size() == 0) return true; int temp = ball.front(); bool flag1 = false, flag2 = false; ball.erase(ball.begin()); if (temp > B.top()) { ...
[["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
271
2
#include <iostream> int r = 0, l = 0; int main() { int n; std::cin >> n; for (int i = 0; i < n; ++i) { bool f = true; for (int j = 0; j < 10; ++j) { int a; std::cin >> a; if (r < a && l < a) { if (r <= l) l = a; else r = a; } else if (r < a) ...
#include <iostream> int r = 0, l = 0; int main() { int n; std::cin >> n; for (int i = 0; i < n; ++i) { bool f = true; for (int j = 0; j < 10; ++j) { int a; std::cin >> a; if (r < a && l < a) { if (r <= l) l = a; else r = a; } else if (r < a) ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
167
2
#include <fstream> #include <iostream> #include <vector> using namespace std; int a[10]; vector<int> b, c; bool dfs(int i) { if (i == 10) { // 判定 for (int j = 1; j < b.size() - 1; j++) { if (b[j] < b[j - 1]) return false; } for (int j = 1; j < c.size() - 1; j++) { if (c[j] < c[j ...
#include <fstream> #include <iostream> #include <vector> using namespace std; int a[10]; vector<int> b, c; bool dfs(int i) { if (i == 10) { // 判定 for (int j = 1; j < b.size(); j++) { if (b[j] < b[j - 1]) return false; } for (int j = 1; j < c.size(); j++) { if (c[j] < c[j - 1]) ...
[["-", 64, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 64, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
278
4
#include <iostream> #include <stack> using namespace std; int func(int *ball, int n, int cur, stack<int> b, stack<int> c) { int ball_cur = ball[cur]; int count = 0; if (cur == n) { return 1; } if (b.empty() || b.top() < ball_cur) { b.push(ball_cur); count += func(ball, n, cur + 1, b, c); b.p...
#include <iostream> #include <stack> using namespace std; int func(int *ball, int n, int cur, stack<int> b, stack<int> c) { int ball_cur = ball[cur]; int count = 0; if (cur == n) { return 1; } if (b.empty() || b.top() < ball_cur) { b.push(ball_cur); count += func(ball, n, cur + 1, b, c); b.p...
[["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
254
4
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { bool flag = false; int prev; int in[10]; int used[10]; for (int j = 0; j < 10; j++) { cin >> in[i]; } prev = in[0]; vector<int> B; vector<int> C; fo...
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { bool flag = false; int prev; int in[10]; int used[10]; for (int j = 0; j < 10; j++) { cin >> in[j]; } prev = in[0]; vector<int> B; vector<int> C; fo...
[["-", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
248
4
#include <algorithm> #include <cstdio> using namespace std; int N; int l[15]; int b, c; // int res[1000000000000]; void solve(int k) { for (int i = 0; i < 10; i++) { if (b < l[i] && c < l[i]) { if (l[i] - b < l[i] - c) b = l[i]; else c = l[i]; } else if (b < l[i] && c > l[i]) ...
#include <algorithm> #include <cstdio> using namespace std; int N; int l[15]; int b, c; // int res[1000000000000]; void solve(int k) { for (int i = 0; i < 10; i++) { if (b < l[i] && c < l[i]) { if (l[i] - b < l[i] - c) b = l[i]; else c = l[i]; } else if (b < l[i] && c > l[i]) ...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
282
2
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; const int MAX_M = 15; int N, H[10]; double dp[2][(1 << MAX_M) + 1]; int solve() { int big = 0, small = 0; for (int i = 0; i < 10; i++) { if (big < small) swap(big, small); if (H[i] < small) { printf("No\n"); ...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; const int MAX_M = 15; int N, H[10]; double dp[2][(1 << MAX_M) + 1]; int solve() { int big = 0, small = 0; for (int i = 0; i < 10; i++) { if (big < small) swap(big, small); if (H[i] < small) { printf("NO\n"); ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
207
29
#include <algorithm> #include <iostream> using namespace std; int ball[10]; bool solve(int i, int a, int b) { if (i == 10) return true; bool ans = false; if (a < ball[i]) ans = solve(i + i, ball[i], b); if (b < ball[i]) ans = solve(i + i, a, ball[i]); return ans; } int main() { int n; cin >...
#include <algorithm> #include <iostream> using namespace std; int ball[10]; bool solve(int i, int a, int b) { if (i == 10) return true; bool ans = false; if (a < ball[i]) ans = solve(i + 1, ball[i], b); if (b < ball[i]) ans = solve(i + 1, a, ball[i]); return ans; } int main() { int n; cin >...
[["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
179
4
// C++14 (Clang 3.8.0) #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #includ...
// C++14 (Clang 3.8.0) #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #includ...
[["-", 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
206
4
// C++14 (Clang 3.8.0) #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #includ...
// C++14 (Clang 3.8.0) #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #includ...
[["-", 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
292
4
#include <stdio.h> int ball[10]; bool can(int n, int left, int right) { bool flag; if (n == 10) return true; if (ball[n] > right && can(n + 1, left, ball[n])) return true; if (ball[n] > left && can(n + 1, ball[n], right)) return true; return false; } int main() { int N; scanf("%d", &N);...
#include <stdio.h> int ball[10]; bool can(int n, int left, int right) { bool flag; if (n == 10) return true; if (ball[n] > right && can(n + 1, left, ball[n])) return true; if (ball[n] > left && can(n + 1, ball[n], right)) return true; return false; } int main() { int N; scanf("%d", &N);...
[["+", 0, 2, 3, 4, 0, 41, 64, 5, 0, 44], ["+", 0, 2, 3, 4, 0, 41, 75, 5, 0, 44]]
1
173
2
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <utility> #include <...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <utility> #include <...
[["-", 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
306
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <vector> #define MAXN 2555 #define INF 0x3f3f3f3f #define v first #define b second using namespace std; queue<int> q; queue<int> p; int s[15]; bool f...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <vector> #define MAXN 2555 #define INF 0x3f3f3f3f #define v first #define b second using namespace std; stack<int> q; stack<int> p; int s[15]; bool f...
[["-", 36, 36, 0, 30, 0, 43, 39, 344, 141, 78], ["+", 36, 36, 0, 30, 0, 43, 39, 344, 141, 78], ["-", 15, 339, 51, 16, 12, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 12, 2, 63, 118, 119, 120]]
1
257
8
#include <cstdio> using namespace std; int n; int a[11]; int main() { scanf("%d", &n); for (int t = 0; t < n; ++t) { int l = 0, r = 0; for (int i = 0; i < 10; ++i) scanf("%d", &a[i]); bool flag = false; for (int i = 0; i < 10; ++i) { if (r > l) { if (a[i] > r) r = a[i];...
#include <cstdio> using namespace std; int n; int a[11]; int main() { scanf("%d", &n); for (int t = 0; t < n; ++t) { int l = 0, r = 0; for (int i = 0; i < 10; ++i) scanf("%d", &a[i]); bool flag = false; for (int i = 0; i < 10; ++i) { if (r > l) { if (a[i] > r) r = a[i];...
[["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
213
2
#include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int res = 0; int saiki(int ball[], int ttB, int ttC, int res) { if (res == 10) return res; if (ball[res] > ttB) { return saiki(ball, ball[res], ttC, res + 1); } if (ball[res] > ttC) { return saiki(ball, ...
#include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int res = 0; int saiki(int ball[], int ttB, int ttC, int res) { if (res == 10) return res; if (ball[res] > ttB) { return saiki(ball, ball[res], ttC, res + 1); } if (ball[res] > ttC) { return saiki(ball, ...
[["-", 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
265
4
<?php fscanf(STDIN,"%d",$n); print "$n\n"; for($i=0;$i<$n;$i++){ $a=0; $b=0; $f=0; fscanf(STDIN,"%d %d %d %d %d %d %d %d %d %d",$ar[0],$ar[1],$ar[2],$ar[3],$ar[4],$ar[5],$ar[6],$ar[7],$ar[8],$ar[9]); for($j=0;$j<10;$j++){ if($ar[$j]>$a&&$ar[$j]>$b){ if($a>$b)$a=$ar[$j]; else $b=$ar[$j]; } else if($ar[$...
<?php fscanf(STDIN,"%d",$n); for($i=0;$i<$n;$i++){ $a=0; $b=0; $f=0; fscanf(STDIN,"%d %d %d %d %d %d %d %d %d %d",$ar[0],$ar[1],$ar[2],$ar[3],$ar[4],$ar[5],$ar[6],$ar[7],$ar[8],$ar[9]); for($j=0;$j<10;$j++){ if($ar[$j]>$a&&$ar[$j]>$b){ if($a>$b)$a=$ar[$j]; else $b=$ar[$j]; } else if($ar[$j]>$a)$a=$ar[$...
[["-", 36, 36, 0, 493, 0, 1, 0, 619, 0, 620], ["-", 0, 493, 0, 1, 0, 619, 0, 609, 0, 62], ["-", 0, 1, 0, 619, 0, 609, 0, 606, 0, 607], ["-", 0, 1, 0, 619, 0, 609, 0, 606, 0, 141], ["-", 0, 493, 0, 1, 0, 619, 0, 609, 0, 44], ["-", 36, 36, 36, 36, 0, 493, 0, 1, 0, 35]]
6
267
7
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; public class Main { public static void main(String args[]) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { String line; ...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; public class Main { public static void main(String args[]) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { String line; ...
[["-", 0, 492, 3, 4, 0, 510, 64, 5, 0, 491], ["+", 0, 492, 3, 4, 0, 510, 64, 5, 0, 491], ["-", 0, 492, 3, 4, 0, 510, 75, 5, 0, 491], ["+", 0, 492, 3, 4, 0, 510, 75, 5, 0, 491]]
3
330
4
import java.io.IOException; import java.util.*; /** */ class Main { final static int N = 10; public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); int N = in.nextInt(); in.nextLine(); while (in.hasNext()) { String[] dataset_str = in.nextLine().spli...
import java.io.IOException; import java.util.*; /** */ class Main { final static int N = 10; public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); int N = in.nextInt(); in.nextLine(); while (in.hasNext()) { String[] dataset_str = in.nextLine().spli...
[["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]]
3
286
4
import java.io.BufferedInputStream; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(new BufferedInputStream(System.in)); int n; while (cin.hasNext()) { n = cin.nextInt(); int a[] = new int[10]; while (n > 0) { f...
import java.io.BufferedInputStream; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(new BufferedInputStream(System.in)); int n; while (cin.hasNext()) { n = cin.nextInt(); int a[] = new int[10]; while (n > 0) { f...
[["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44]]
3
215
1
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while (n-- != 0) { int[] ball = new int[11]; for (int i = 0; i < 10; i++) { ball[i] = sc.nextInt(); } boolean can = true; ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while (n-- != 0) { int[] ball = new int[11]; for (int i = 0; i < 10; i++) { ball[i] = sc.nextInt(); } boolean can = true; ...
[["+", 0, 7, 8, 196, 0, 7, 8, 196, 0, 46], ["-", 0, 7, 8, 196, 0, 7, 8, 196, 0, 46]]
3
246
2
import java.lang.*; import java.math.*; import java.util.*; public class Main { Scanner sc = new Scanner(System.in); void run() { // greedy int n = sc.nextInt(); for (int i = 0; i < n; i++) { int val = 0; int val2 = 0; boolean ans = true; for (int j = 0; j < 10; j++) { ...
import java.lang.*; import java.math.*; import java.util.*; public class Main { Scanner sc = new Scanner(System.in); void run() { // greedy int n = sc.nextInt(); for (int i = 0; i < n; i++) { int val = 0; int val2 = 0; boolean ans = true; for (int j = 0; j < 10; j++) { ...
[["-", 75, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["-", 0, 57, 75, 57, 64, 196, 0, 1, 0, 35], ["-", 75, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["-", 75, 57, 64, 196, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 75, 57, 75, 196, 0, 1, 0, 35], ["-", 0, 57, 75, 57, 75, 196, 0, 93, 0, 94]]
3
190
6
import java.util.ArrayList; import java.util.Scanner; public class Main { private static final int LEFT = 0; private static final int RIGHT = 1; private static final int EndOfDirection = 2; private static ArrayList<Integer> a = new ArrayList<Integer>(10); private static ArrayList<Integer> left = new ArrayL...
import java.util.ArrayList; import java.util.Scanner; public class Main { private static final int LEFT = 0; private static final int RIGHT = 1; private static final int EndOfDirection = 2; private static ArrayList<Integer> a = new ArrayList<Integer>(10); private static ArrayList<Integer> left = new ArrayL...
[["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
684
2
#include <stdio.h> #include <string.h> int ball[11], r[11], l[11], flag; void senten(int x, int y, int k) { if (x >= 10) { flag = 1; return; } if (flag) { return; } if (ball[x] > r[y - 1]) { r[y] = ball[x]; senten(x + 1, y + 1, k); } if (ball[x] > l[k - 1]) { l[k] = ball[x]; se...
#include <stdio.h> #include <string.h> int ball[11], r[11], l[11], flag; void senten(int x, int y, int k) { if (x == 10) { flag = 1; return; } if (flag) { return; } if (ball[x] > r[y - 1]) { r[y] = ball[x]; senten(x + 1, y + 1, k); } if (ball[x] > l[k - 1]) { l[k] = ball[x]; se...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
256
4
#include <stdio.h> int main(void) { int i, j, n, ball, b[10], k, c[10], l, NO; scanf("%d", &n); for (i = 0; i < n; i++) { for (j = 0; j < 10; j++) { b[j] = 0; c[j] = 0; } k = 0; l = 0; NO = 0; for (j = 0; j < 10; j++) { scanf("%d", &ball); if (k == 0) { ...
#include <stdio.h> int main(void) { int i, j, n, ball, b[10], k, c[10], l, NO; scanf("%d", &n); for (i = 0; i < n; i++) { for (j = 0; j < 10; j++) { b[j] = 0; c[j] = 0; } k = 0; l = 0; NO = 0; for (j = 0; j < 10; j++) { scanf("%d", &ball); if (k == 0) { ...
[["-", 15, 23, 0, 16, 31, 69, 71, 16, 31, 22], ["+", 15, 23, 0, 16, 31, 69, 71, 16, 31, 22]]
0
249
2
a[10]; int dfs(int l, int r, int i) { if (i > 9) return 1; if (a[i] > l && dfs(a[i], r, i + 1)) return 1; if (a[i] > r && dfs(l, a[i], i + 1)) return 1; return 0; } main(n) { scanf("%d", &n); for (; n; n--) scanf("%d%d%d%d%d%d%d%d%d%d", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5], &a[...
a[10]; int dfs(int l, int r, int i) { if (i > 9) return 1; if (a[i] > l && dfs(a[i], r, i + 1)) return 1; if (a[i] > r && dfs(l, a[i], i + 1)) return 1; return 0; } main(n) { scanf("%d", &n); for (; n; n--) scanf("%d%d%d%d%d%d%d%d%d%d", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5], &a[...
[["-", 12, 41, 64, 2, 3, 4, 0, 5, 0, 44], ["-", 12, 41, 75, 2, 3, 4, 0, 5, 0, 44]]
0
202
2
#include <stdio.h> int func(int *a, int *b1, int *b2, int c, int c1, int c2) { int ret = 0; if (c < 10) { if ((ret == 0) && (*(a + c) > *(b1 + c1))) { *(b1 + c1 + 1) = *(a + c); ret = func(a, b1, b2, c + 1, c1 + 1, c2); } if ((ret == 0) && (*(a + c) > *(b2 + c2))) { *(b2 + c2 + 1) = ...
#include <stdio.h> int func(int *a, int *b1, int *b2, int c, int c1, int c2) { int ret = 0; if (c < 10) { if ((ret == 0) && (*(a + c) > *(b1 + c1))) { *(b1 + c1 + 1) = *(a + c); ret = func(a, b1, b2, c + 1, c1 + 1, c2); } if ((ret == 0) && (*(a + c) > *(b2 + c2))) { *(b2 + c2 + 1) = *...
[["-", 12, 66, 28, 23, 0, 16, 12, 16, 17, 48], ["-", 12, 66, 28, 23, 0, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13]]
0
320
6
#include <algorithm> #include <cstdio> #include <stack> using namespace std; stack<int> B, C; int A[10]; bool dfs(int index) { bool ret = false; char s[11]; if (index >= 10) { return true; } for (int i = 0; i < 11; i++) { if (i < index) s[i] = '>'; else s[i] = 0; } if (B.empty...
#include <algorithm> #include <cstdio> #include <stack> using namespace std; stack<int> B, C; int A[10]; bool dfs(int index) { bool ret = false; char s[11]; if (index >= 10) { return true; } for (int i = 0; i < 11; i++) { if (i < index) s[i] = '>'; else s[i] = 0; } if (B.empty...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
354
4
/* * AOJ 0033: Ball * 题意:序号为1-10的10个球,按一定排列顺序进入2个队列之一,最终每队入队球的序号都为增序的方案是否存在。 * 类型:贪心 * 算法:对于每个球,若大于队列顶端元素,则可以记录该情况并继续递归。每次优先加入左边,可保证左边的顶端元素大于右边。 */ #include <iostream> using namespace std; int balls[10]; int main() { //每次就先看左边能不能放,能放就放入,否则再看右边,右边也不能放,则不存在方案 int n; cin >> n; while (n--) { for (int i...
/* * AOJ 0033: Ball * 题意:序号为1-10的10个球,按一定排列顺序进入2个队列之一,最终每队入队球的序号都为增序的方案是否存在。 * 类型:贪心 * 算法:对于每个球,若大于队列顶端元素,则可以记录该情况并继续递归。每次优先加入左边,可保证左边的顶端元素大于右边。 */ #include <iostream> using namespace std; int balls[10]; int main() { //每次就先看左边能不能放,能放就放入,否则再看右边,右边也不能放,则不存在方案 int n; cin >> n; while (n--) { for (int i...
[["-", 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
177
4
#include <algorithm> #include <cstdio> #define HEIGHT 10 using namespace std; int a[HEIGHT]; /* void solve(){ bool f=true; int right,left; right = left = 0; for(int i=0;i<HEIGHT;i++){ if(right<a[i] && left<a[i]){ if(right<left){ ...
#include <algorithm> #include <cstdio> #define HEIGHT 10 using namespace std; int a[HEIGHT]; /* void solve(){ bool f=true; int right,left; right = left = 0; for(int i=0;i<HEIGHT;i++){ if(right<a[i] && left<a[i]){ if(right<left){ ...
[["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
206
2
#include <algorithm> #include <cstdio> #define HEIGHT 10 using namespace std; int a[HEIGHT]; void solve() { bool f = true; int right, left; right = left = 0; for (int i = 0; i < HEIGHT; i++) { if (right < a[i] && left < a[i]) { if (right < left) { left = a[i]; } else { right =...
#include <algorithm> #include <cstdio> #define HEIGHT 10 using namespace std; int a[HEIGHT]; void solve() { bool f = true; int right, left; right = left = 0; for (int i = 0; i < HEIGHT; i++) { if (right < a[i] && left < a[i]) { if (right < left) { left = a[i]; } else { right =...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 14, 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
235
10
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; int main() { int n, b, B = 0, C = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { B = 0; C = 0; for (int j = 0...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; int main() { int n, b, B = 0, C = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { B = 0; C = 0; for (int j = 0...
[["+", 0, 57, 15, 339, 51, 16, 31, 23, 0, 24], ["+", 51, 16, 31, 23, 0, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 23, 0, 25], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47]]
1
172
6
#include <iostream> #include <string.h> using namespace std; int N; int balls[10]; bool dfs(int n, int a, int b) { if (n == 10) return true; if (balls[n] > a) return dfs(n + 1, balls[n], b); if (balls[n] > b) return dfs(n + 1, a, balls[n]); return false; } int main() { cin >> N; for (int i = 0...
#include <iostream> #include <string.h> using namespace std; int N; int balls[10]; bool dfs(int n, int a, int b) { if (n == 10) return true; if (balls[n] > a) return dfs(n + 1, balls[n], b); if (balls[n] > b) return dfs(n + 1, a, balls[n]); return false; } int main() { cin >> N; for (int i = 0...
[["-", 15, 339, 51, 2, 3, 4, 0, 69, 28, 22], ["-", 51, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["-", 51, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
171
3
#include <iostream> using namespace std; int main() { int a, b, c; int ca = 0, cb = 0; while (scanf("%d, %d, %d", &a, &b, &c) + 1) { if ((a * a) + (b * b) == c * c) { ca++; } if (a == b) { cb++; } } printf("%d\n%d/n", ca, cb); return 0; }
#include <iostream> using namespace std; int main() { int a, b, c; int ca = 0, cb = 0; while (scanf("%d, %d, %d", &a, &b, &c) + 1) { if ((a * a) + (b * b) == c * c) { ca++; } if (a == b) { cb++; } } printf("%d\n%d\n", ca, cb); return 0; }
[["-", 0, 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, 44]]
1
100
3
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; #define pb push_back #define mp make_pair #define ll long long #...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; #define pb push_back #define mp make_pair #define ll long long #...
[["-", 51, 16, 31, 2, 3, 4, 0, 5, 0, 44], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
147
3
#include "bits/stdc++.h" #define ALL(a) (a).begin(), (a).end() #define SORT(c) sort((c).begin(), (c).end()) #define DESCSORT(c) sort(c.begin(), c.end(), greater<int>()) using namespace std; using LL = long long int; using LD = long double; using pii = pair<int, int>; using pll = pair<LL, LL>; using pdd = pair<doubl...
#include "bits/stdc++.h" #define ALL(a) (a).begin(), (a).end() #define SORT(c) sort((c).begin(), (c).end()) #define DESCSORT(c) sort(c.begin(), c.end(), greater<int>()) using namespace std; using LL = long long int; using LD = long double; using pii = pair<int, int>; using pll = pair<LL, LL>; using pdd = pair<doubl...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
375
4
#include <cstdio> //#include<algorithm> using namespace std; int a, b, c, tyo, hi; int main() { while (scanf("%d,%d,%d", &a, &b, &c) != EOF) { if (c * c == a * a + b * b) tyo++; if (a == b) hi++; } printf("%d %d", tyo, hi); return 0; }
#include <cstdio> //#include<algorithm> using namespace std; int a, b, c, tyo, hi; int main() { while (scanf("%d,%d,%d", &a, &b, &c) != EOF) { if (c * c == a * a + b * b) tyo++; if (a == b) hi++; } printf("%d\n%d\n", tyo, hi); return 0; }
[["-", 0, 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, 44]]
1
86
5
#include <algorithm> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <utility> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define LOOP(i, x, n) for (int i = x; i < n; i++) #define ALL(v) (v).begi...
#include <algorithm> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <utility> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define LOOP(i, x, n) for (int i = x; i < n; i++) #define ALL(v) (v).begi...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
186
4
#include <cstdio> using namespace std; int main() { int a, b, c, x = 0, y = 0; while (scanf("%d,%d,%d", &a, &b, &c) != EOF) { if (a == b) x++; if (a * a + b * b == c * c) y++; } printf("%d?\n%d?\n", y, x); return 0; }
#include <cstdio> int main() { int a, b, c, x = 0, y = 0; while (scanf("%d,%d,%d", &a, &b, &c) != EOF) { if (a == b) x++; if (a * a + b * b == c * c) y++; } printf("%d\n%d\n", y, x); return 0; }
[["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 233], ["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 256], ["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 340, 0, 35], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
92
8
#include <iostream> #include <stdio.h> using namespace std; int main() { int sides[3]; int square = 0, para = 0; while (scanf("%d,%d,%d", &sides[0], &sides[1], &sides[2]) != EOF) { //??£?????¢???check if (sides[0] * sides[0] + sides[1] * sides[1] == sides[2] * sides[2]) { square++; } //????...
#include <iostream> #include <stdio.h> using namespace std; int main() { int sides[3]; int tyoho = 0, para = 0; while (scanf("%d,%d,%d", &sides[0], &sides[1], &sides[2]) != EOF) { //????????¢???check if (sides[0] * sides[0] + sides[1] * sides[1] == sides[2] * sides[2]) { tyoho++; } //??????...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 46], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 14, 8...
1
127
8
#include <cstdio> using namespace std; int main() { int x, y, r, hisi = 0, tyou = 0; while (scanf("%d,%d,%d ", &x, &y, &r) == 3) { if (x == y) { hisi++; } if (x * x + y * y == r * r) { tyou++; } } printf("%d\n%d\n", hisi, tyou); }
#include <cstdio> using namespace std; int main() { int x, y, r, hisi = 0, tyou = 0; while (scanf("%d,%d,%d ", &x, &y, &r) == 3) { if (x == y) { hisi++; } if (x * x + y * y == r * r) { tyou++; } } printf("%d\n%d\n", tyou, hisi); }
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
93
4
#include <iostream> using namespace std; int main() { int a, b, d; char c; int ans[2] = {0}; while (cin >> a >> c >> b >> c >> d) { if (a == b) ans[0]++; else if (a * a + b * b == c * c) ans[1]++; } cout << ans[1] << endl; cout << ans[0] << endl; }
#include <iostream> using namespace std; int main() { int a, b, d; char c; int ans[2] = {0}; while (cin >> a >> c >> b >> c >> d) { if (a == b) ans[0]++; else if (a * a + b * b == d * d) ans[1]++; } cout << ans[1] << endl; cout << ans[0] << endl; }
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
99
4
c1,c2 = 0,0 while arr = gets a,b,c = arr.chomp.split(";").map(&:to_i) unless (c**2 == a**2 + b**2) && (a == b) c1 = c1 + 1 if c**2 == a**2 + b**2 c2 = c2 + 1 if a == b end end puts c1; puts c2
c1,c2 = 0,0 while arr = gets a,b,c = arr.chomp.split(",").map(&:to_i) unless (c**2 == a**2 + b**2) && (a == b) c1 = c1 + 1 if c**2 == a**2 + b**2 c2 = c2 + 1 if a == b end end puts c1; puts c2
[["-", 12, 652, 486, 652, 3, 4, 0, 557, 0, 6], ["+", 12, 652, 486, 652, 3, 4, 0, 557, 0, 6]]
4
86
2
cho_n = 0 hishi_n = 0 while str = gets do a, b, c = str.chomp.split(" ").map(&:to_i) if a == b hishi_n += 1 end if a * a + b * b == c * c cho_n += 1 end end puts cho_n puts hishi_n
cho_n = 0 hishi_n = 0 while str = gets do a, b, c = str.chomp.split(",").map(&:to_i) if a == b hishi_n += 1 end if a * a + b * b == c * c cho_n += 1 end end puts cho_n puts hishi_n
[["-", 12, 652, 486, 652, 3, 4, 0, 557, 0, 6], ["+", 12, 652, 486, 652, 3, 4, 0, 557, 0, 6]]
4
62
2
hishi = 0 tyou = 0 while input = gets do a,b,c = input.chop.split(",").map{|n| n.to_i} if a == b then hishi += 1 elsif a**2 + b**2 == c**2 then tyou += 1 end end puts hishi,tyou
hishi = 0 tyou = 0 while input = gets do a,b,c = input.chop.split(",").map{|n| n.to_i} if a == b then hishi += 1 elsif a**2 + b**2 == c**2 then tyou += 1 end end puts tyou,hishi
[["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 21], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 21], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]]
4
67
4
#!/usr/local/bin/ruby rec,dia=0,0 while line=gets arr=line.split(",").map(&:to_i) a=arr[0].to_i b=arr[1].to_i c=arr[2].to_i if a==b elsif a**2+b**2==c**2 dia+=1 end end puts "#{rec}" puts "#{dia}"
#!/usr/local/bin/ruby rec,dia=0,0 while line=gets arr=line.split(",").map(&:to_i) a=arr[0].to_i b=arr[1].to_i c=arr[2].to_i if a==b dia+=1 elsif a**2+b**2==c**2 rec+=1 end end puts "#{rec}" puts "#{dia}"
[["+", 8, 170, 0, 121, 64, 749, 0, 755, 31, 22], ["+", 8, 170, 0, 121, 64, 749, 0, 755, 17, 107], ["+", 8, 170, 0, 121, 64, 749, 0, 755, 12, 612], ["-", 0, 121, 75, 759, 64, 749, 0, 755, 31, 22], ["+", 0, 121, 75, 759, 64, 749, 0, 755, 31, 22]]
4
85
5
s=0 n=0 while True: try: a,b,c = map(int, input().split()) except: break if a == b: n+=1 elif c**2 == a**2 + b**2: s+=1 print(str(s) + "\n" + str(n))
s=0 n=0 while True: try: a,b,c = map(int, input().split(",")) except: break if a == b: n+=1 elif c**2 == a**2 + b**2: s+=1 print(str(s) + "\n" + str(n))
[["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655]]
5
72
3
r, l = 0, 0 while True: try: a, b, c = list(map(int, input().split(','))) if a == b: l += 1 elif (a ** 2) + (b ** 2) == c **2: r += 1 except: break print("%d %d" % (r, l))
r, l = 0, 0 while True: try: a, b, c = list(map(int, input().split(','))) if a == b: l += 1 elif (a ** 2) + (b ** 2) == c **2: r += 1 except: break print("%d\n%d" % (r, l))
[["-", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 3, 4, 0, 657, 31, 557, 0, 6, 0, 44]]
5
79
4
n1 = n2 = 0 while True: try: a, b, c = map(int, line.split(',')) if a**2 + b**2 == c**2: n1 += 1 elif a == b: n2 += 1 except EOFError: break print(n1) print(n2)
# 0032 n1 = n2 = 0 while True: try: a, b, c = map(int, input().split(',')) if a**2 + b**2 == c**2: n1 += 1 elif a == b: n2 += 1 except EOFError: break print(n1) print(n2)
[["-", 12, 652, 3, 4, 0, 652, 63, 319, 500, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25]]
5
65
4
import sys rect = 0 hisi = 0 for line in sys.stdin.readlines(): x,y,z = list(map(int,line.split(','))) if x**2 + y**2 == z**2:rect += 1 elif x == y : hisi +=1 print(rect,hisi)
import sys rect = 0 hisi = 0 for line in sys.stdin.readlines(): x,y,z = list(map(int,line.split(','))) if x**2 + y**2 == z**2:rect += 1 elif x == y : hisi +=1 print(rect) print(hisi)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
71
4
rectangles = 0 ; lozenges = 0 while True: try: a,b,c, = list(map(int,input().split(','))) if a*a + b*b == c*c: rectangle += 1 else: if a == b: lozenges += 1 except: break print(rectangles) ; print(lozenges)
rectangles = 0 ; lozenges = 0 while True: try: a,b,c, = list(map(int,input().split(','))) if a*a + b*b == c*c: rectangles += 1 else: if a == b: lozenges += 1 else: pass except: break print(rectangles) ; print(lozenges)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 76, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 75, 76, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 0, 57, 75, 76, 8, 196, 0, 674, 0, 675]]
5
75
5
import sys c1 = c2 = 0 for line in sys.stdin: a, b, c = map(int, line.split(',')) if a**2 + b**2 == c**2: c1 += 1 elif a == b: c2 += 1 print(c1, c2)
import sys c1 = c2 = 0 for line in sys.stdin: a, b, c = map(int, line.split(',')) if a**2 + b**2 == c**2: c1 += 1 elif a == b: c2 += 1 print(c1) print(c2)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
63
4
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; public class Main { public static void main(String args[]) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { String line; ...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; public class Main { public static void main(String args[]) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { String line; ...
[["+", 0, 503, 49, 200, 51, 16, 31, 23, 0, 24], ["+", 0, 503, 49, 200, 51, 16, 31, 23, 0, 25], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20]]
3
296
4
import java.io.*; import java.lang.Math.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { try { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readL...
import java.io.*; import java.lang.Math.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { try { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readL...
[["-", 0, 57, 15, 15, 0, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 17, 19]]
3
289
2
import java.util.*; public class Main { private static final Scanner scan = new Scanner(System.in).useDelimiter("[,\\s]+"); public static void main(String[] args) { int[] l = new int[10]; int sum1 = 0, sum2 = 0; double time = 0, tX = 0; while (scan.hasNext()) { for (int i = 0; i < 10; ...
import java.util.*; public class Main { private static final Scanner scan = new Scanner(System.in).useDelimiter("[,\\s]+"); public static void main(String[] args) { int[] l = new int[10]; int sum1 = 0, sum2 = 0; double time = 0, tX = 0; while (scan.hasNext()) { for (int i = 0; i < 10; ...
[["-", 0, 1, 0, 11, 12, 74, 51, 23, 0, 24], ["+", 0, 11, 12, 16, 12, 74, 39, 511, 0, 512], ["+", 0, 1, 0, 11, 12, 16, 12, 74, 0, 25], ["+", 0, 11, 12, 16, 12, 74, 51, 23, 0, 24], ["-", 12, 74, 51, 23, 0, 16, 12, 23, 0, 25]]
3
235
5
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String str = sc.next(); String[] strArr = str.split(","); int[] l = new int[10]; int d = 0; for (int i = 0; i < 10; i++) { l[i] = Integer....
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String str = sc.next(); String[] strArr = str.split(","); int[] l = new int[10]; int d = 0; for (int i = 0; i < 10; i++) { l[i] = Integer....
[["-", 0, 52, 8, 196, 0, 7, 15, 16, 12, 499], ["+", 0, 52, 8, 196, 0, 7, 15, 16, 12, 499]]
3
222
2
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { String input = scanner.nextLine(); String[] dataset = input.split(","); int[] sectionLen = new int[10]; double totalLen = 0; ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { String input = scanner.nextLine(); String[] dataset = input.split(","); int[] sectionLen = new int[10]; double totalLen = 0; ...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 35]]
3
215
2
#include <stdio.h> int main() { int i, j; float x, l[10] = {0}, v1, v2, lsum, lsum2, sure; while (scanf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\n", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v1, &v2) != EOF) { lsum = 0; x = 0; for (i = 0; i < 10...
#include <stdio.h> int main() { int i, j; float x, l[10] = {0}, v1, v2, lsum, lsum2, sure; while (scanf("%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\n", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v1, &v2) != EOF) { lsum = 0; x = 0; for (i = 0; i < 10...
[["+", 0, 52, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
0
212
2
#include <stdio.h> int main() { double L[10]; double V1, V2; double meet_pos; double railway_lenth; int cnt1, cnt2; int output[50]; cnt2 = 0; while (1) { if (scanf("%lf,", &L[0]) == EOF) { break; } for (cnt1 = 1; cnt1 < 10; cnt1++) { scanf("%lf,", &L[cnt1]); } scanf("%l...
#include <stdio.h> int main() { double L[10]; double V1, V2; double meet_pos; double railway_lenth; int cnt1, cnt2; int output[50]; cnt2 = 0; while (1) { if (scanf("%lf,", &L[0]) == EOF) { break; } for (cnt1 = 1; cnt1 < 10; cnt1++) { scanf("%lf,", &L[cnt1]); } scanf("%l...
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 18]]
0
213
38
main() { int a[11], b, c, i; a[0] = 0; for (;;) { for (i = 0; i < 10; i++) if (scanf("%d,", &a[i + 1]) == -1) break; else a[i + 1] += a[i]; if (i != 10) break; if (scanf("%d,%d", &b, &c) == -1) break; for (i = 1; i < 10; i++) if (a[i] >= (double)a[10] ...
main() { int a[11], b, c, i; a[0] = 0; for (;;) { for (i = 0; i < 10; i++) if (scanf("%d,", &a[i + 1]) == -1) break; else a[i + 1] += a[i]; if (i != 10) break; if (scanf("%d,%d", &b, &c) == -1) break; for (i = 1; i < 11; i++) if (a[i] >= (double)a[10] ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
0
158
2
/* AOJ 0034 * * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0034 */ #include <stdio.h> #define DEBUG 1 #define true 1 #define false 0 int meetat(int *input, int v1, int v2) { int total; int i; float fat; int d; total = 0; for (i = 0; i < 10; i++) total += input[i]; fat = total * ...
/* AOJ 0034 * * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0034 */ #include <stdio.h> #define DEBUG 0 #define true 1 #define false 0 int meetat(int *input, int v1, int v2) { int total; int i; float fat; int d; total = 0; for (i = 0; i < 10; i++) total += input[i]; fat = total * ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
0
272
2
#include <stdio.h> main() { int b[15], v, v1, v2, i, c, j, p; float s; while (scanf("%d,", &b[1]) != EOF) { s = b[1]; c = 0; for (i = 2; i <= 10; i++) { scanf("%d,", &b[i]); s += b[i]; } scanf("%d,%d", &v1, &v2); if (v1 < v2) { v = v1; j = 1; } else { v = ...
#include <stdio.h> main() { int b[15], v, v1, v2, i, c, j, p; float s; while (scanf("%d,", &b[1]) != EOF) { s = b[1]; c = 0; for (i = 2; i <= 10; i++) { scanf("%d,", &b[i]); s += b[i]; } scanf("%d,%d", &v1, &v2); if (v1 < v2) { v = v1; j = 1; } else { v = ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47]]
0
244
2
#include <stdio.h> int main() { int sum = 0, l[10], v1, v2, i; double t, r; while (scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", l, l + 1, l + 2, l + 3, l + 4, l + 5, l + 6, l + 7, l + 8, l + 9, &v1, &v2) != EOF) { for (i = 0; i < 10; i++) sum += l[i]; t = (double)sum / (v1 + v2); ...
#include <stdio.h> int main() { int sum = 0, l[10], v1, v2, i; double t, r; while (scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", l, l + 1, l + 2, l + 3, l + 4, l + 5, l + 6, l + 7, l + 8, l + 9, &v1, &v2) != EOF) { for (i = 0; i < 10; i++) sum += l[i]; t = (double)sum / (v1 + v2); ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
0
172
6
#include <cstdio> #include <iostream> using namespace std; int main() { int len[10]; int v1, v2; while (scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &len[0], &len[1], &len[2], &len[3], &len[4], &len[5], &len[6], &len[7], &len[8], &len[9], &v1, &v2) != EOF) { int accum[10] = {0};...
#include <cstdio> #include <iostream> using namespace std; int main() { int len[10]; int v1, v2; while (scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &len[0], &len[1], &len[2], &len[3], &len[4], &len[5], &len[6], &len[7], &len[8], &len[9], &v1, &v2) != EOF) { int accum[10] = {0};...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
225
2
#include <iostream> #include <string> using namespace std; int main() { int l[10], v1, v2, n, cnt; double d, t; char ch; while (cin >> l[0] >> ch) { n = l[0]; for (int i = 1; i < 10; i++) { cin >> l[i] >> ch; n += l[i]; } cin >> v1 >> ch >> v2; t = n / (v1 + v2); d = v1 * t;...
#include <iostream> #include <string> using namespace std; int main() { int l[10], v1, v2, cnt; double n, d, t; char ch; while (cin >> l[0] >> ch) { n = l[0]; for (int i = 1; i < 10; i++) { cin >> l[i] >> ch; n += l[i]; } cin >> v1 >> ch >> v2; t = n / (v1 + v2); d = v1 * t;...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21]]
1
144
4
#include <iostream> using namespace std; double l[11], a, b, sum, dis; char d; int main() { while (cin >> l[1] >> d >> l[2] >> d >> l[3] >> d >> l[4] >> d >> l[5] >> d >> l[6] >> d >> l[7] >> d >> l[8] >> d >> l[9] >> d >> l[10] >> d >> a >> d >> b) { sum = 0; for (int i = 1; i <= 10; i++) {...
#include <iostream> using namespace std; double l[11], a, b, sum, dis; char d; int main() { while (cin >> l[1] >> d >> l[2] >> d >> l[3] >> d >> l[4] >> d >> l[5] >> d >> l[6] >> d >> l[7] >> d >> l[8] >> d >> l[9] >> d >> l[10] >> d >> a >> d >> b) { sum = 0; for (int i = 1; i <= 10; i++) {...
[["-", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 73]]
1
193
6
#include <bits/stdc++.h> using namespace std; double a[15], b; char ch; signed main(void) { while (scanf("%d,", &a[1]) != EOF) { for (int i = 2; i < 12; i++) scanf("%d,", &a[i]); scanf("%d", &a[12]); b = 0; for (int i = 1; i <= 10; i++) b += a[i]; b = (b * a[11]) / (a[11] + a[12]); ...
#include <bits/stdc++.h> using namespace std; double a[15], b; signed main(void) { while (scanf("%lf,", &a[1]) != EOF) { for (int i = 2; i < 12; i++) scanf("%lf,", &a[i]); scanf("%lf", &a[12]); b = 0; for (int i = 1; i <= 10; i++) b += a[i]; b = (b * a[11]) / (a[11] + a[12]); for (...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 51, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 51, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0...
1
174
9
#include <iostream> using namespace std; int main() { double l[10]; double v[2]; char c; while (cin >> l[0] >> c >> l[1] >> c >> l[2] >> c >> l[3] >> c >> l[4] >> c >> l[5] >> c >> l[6] >> c >> l[7] >> c >> l[8] >> c >> l[9] >> c >> v[0] >> c >> v[1]) { double a = 0; for (int i = 0; i ...
#include <iostream> using namespace std; int main() { double l[10]; double v[2]; char c; while (cin >> l[0] >> c >> l[1] >> c >> l[2] >> c >> l[3] >> c >> l[4] >> c >> l[5] >> c >> l[6] >> c >> l[7] >> c >> l[8] >> c >> l[9] >> c >> v[0] >> c >> v[1]) { double a = 0; for (int i = 0; i ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 126, 0, 127], ["+", 8, 9, 0, 57, 64, 9, 0, 126, 128, 129]]
1
227
5
#include <bits/stdc++.h> using namespace std; int main() { int w[10], a, b, i; double t, d; while (cin >> w[0]) { for (i = 1; i < 10; i++) scanf(",%d", &w[i]); int sum[10] = {0}; sum[0] = w[0]; for (i = 1; i < 10; i++) sum[i] += sum[i - 1] + w[i]; scanf("%d,%d", &a, &b); t = (d...
#include <bits/stdc++.h> using namespace std; int main() { int w[10], a, b, i; double t, d; while (cin >> w[0]) { for (i = 1; i < 10; i++) scanf(",%d", &w[i]); int sum[10] = {0}; sum[0] = w[0]; for (i = 1; i < 10; i++) sum[i] += sum[i - 1] + w[i]; scanf(",%d,%d", &a, &b); t = (...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
188
2
#include <iostream> #include <numeric> int main() { int lengthes[10]; char tmp; while (std::cin >> lengthes[0] >> tmp >> lengthes[1] >> tmp >> lengthes[2] >> tmp >> lengthes[3] >> tmp >> lengthes[4] >> tmp >> lengthes[5] >> tmp >> lengthes[6] >> tmp >> lengthes[7] >> tmp >> lengthes[8] >> ...
#include <iostream> #include <numeric> int main() { int lengthes[10]; char tmp; while (std::cin >> lengthes[0] >> tmp >> lengthes[1] >> tmp >> lengthes[2] >> tmp >> lengthes[3] >> tmp >> lengthes[4] >> tmp >> lengthes[5] >> tmp >> lengthes[6] >> tmp >> lengthes[7] >> tmp >> lengthes[8] >> ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 48], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
206
4
#include <stdio.h> int main(void) { int l[10]; while (scanf("%d", &l[0]) != EOF) { int sum, v1, v2, vs, now = 0, i, j; sum = l[0]; for (i = 1; i < 10; ++i) { scanf(",%d", &l[i]); sum += l[i]; } scanf(",%d,%d", &v1, &v2); vs = v1 + v2; double t = (double)sum / (double)vs; ...
#include <stdio.h> int main(void) { int l[10]; while (scanf("%d", &l[0]) != EOF) { int sum, v1, v2, vs, now = 0, i, j; sum = l[0]; for (i = 1; i < 10; ++i) { scanf(",%d", &l[i]); sum += l[i]; } scanf(",%d,%d", &v1, &v2); vs = v1 + v2; double t = (double)sum / (double)vs; ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
173
2
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <set> #include <s...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <set> #include <s...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
240
4
#include <cstdio> #include <iostream> using namespace std; const double EPS = 1.0e-6; int main() { int l[10]; int v1, v2; while (scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v1, &v2) > 0) { int suml = 0; for (int i = 0;...
#include <cstdio> #include <iostream> using namespace std; const double EPS = 1.0e-6; int main() { int l[10]; int v1, v2; while (scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v1, &v2) > 0) { int suml = 0; for (int i = 0;...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
215
2
for i in range(int(input())): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) det = (y1-y2) * (x3-x4) - (x1-x2) * (y3-y4) if det<1e-12 : print("YES") else: print("NO")
for i in range(int(input())): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) det = abs((y1-y2) * (x3-x4) - (x1-x2) * (y3-y4)) if det<1e-12 : print("YES") else: print("NO")
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 12, 657, 12, 23, 0, 25]]
5
85
3
n=eval(input()) for i in range(n): a,b,c,d,e,f,g,h=list(map(float,input().split())) # if a==c and g==e:print "YES" # if a==c and g!=e:print "NO" # if a!=c and g==e:print "NO" # if a!=c and g!=e: # if (d-b)/(c-a)==(h-f)/(g-e):print "YES" # else:print "NO" if (d-b)*(g-e)-(c-a)*(h-f)<1e-10: print("YES") else: pri...
n=eval(input()) for i in range(n): a,b,c,d,e,f,g,h=list(map(float,input().split())) if -1e-10<(d-b)*(g-e)-(c-a)*(h-f)<1e-10: print("YES") else: print("NO")
[["+", 8, 196, 0, 57, 15, 666, 0, 664, 17, 33], ["+", 8, 196, 0, 57, 15, 666, 0, 664, 28, 531], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
94
3
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) if x1 == x2 and x3 == x4: print("YES") elif x1 == x2 or x3 == x4: print("NO") elif (y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3) < 1e-10: print("YES") else: print("NO")
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) if x1 == x2 and x3 == x4: print("YES") elif x1 == x2 or x3 == x4: print("NO") elif abs((y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3)) < 1e-10: print("YES") else: print("NO...
[["+", 0, 57, 75, 665, 15, 666, 0, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 12, 657, 12, 23, 0, 25]]
5
115
3
for i in range(int(input())): a,b,c,d,e,f,g,h = map(float,input().split()) if a == c: print("YES" if e == g else "NO") elif e == g: print("NO") else: print("YES" if (b-d)/(a-c) - (f-h)/(e-g) < 1e-10 else "NO")
for i in range(int(input())): a,b,c,d,e,f,g,h = map(float,input().split()) if a == c: print("YES" if e == g else "NO") elif e == g: print("NO") else: print("YES" if abs((b-d)/(a-c) - (f-h)/(e-g)) < 1e-10 else "NO")
[["+", 3, 4, 0, 41, 0, 666, 0, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 12, 657, 12, 23, 0, 25]]
5
109
3
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) print('YES' if abs(x2 - x1)*(y4 - y3) - (x4 - x3)*(y2 - y1) < 1e-10 else 'NO')
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) print('YES' if abs((x2 - x1)*(y4 - y3) - (x4 - x3)*(y2 - y1)) < 1e-10 else 'NO')
[["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 12, 657, 12, 23, 0, 25]]
5
81
2
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int n; while ((n = scn.nextInt()) != 0) { long min = 0, max = -1000, buf = 0; for (int i = 0; i < n; i++) { buf += scn.nextLong(); max = Math.max(max, b...
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int n; while ((n = scn.nextInt()) != 0) { long min = 0, max = -100000, buf = 0; for (int i = 0; i < n; i++) { buf += scn.nextLong(); max = Math.max(max,...
[["-", 8, 196, 0, 503, 49, 200, 51, 91, 439, 499], ["+", 8, 196, 0, 503, 49, 200, 51, 91, 439, 499], ["+", 0, 11, 12, 492, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 492, 3, 4, 0, 16, 12, 22], ["-", 0, 1, 0, 492, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 492, 3, 4, 0, 16, 12, 22]]
3
131
6
import java.util.*; class Main { static int INF = 1 >> 32; public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); while (true) { int n = stdIn.nextInt(); if (n == 0) break; int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = stdIn.next...
import java.util.*; class Main { static int INF = -10000000; public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); while (true) { int n = stdIn.nextInt(); if (n == 0) break; int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = stdIn.ne...
[["-", 8, 498, 0, 124, 49, 200, 51, 16, 31, 499], ["-", 8, 498, 0, 124, 49, 200, 51, 16, 17, 152], ["-", 8, 498, 0, 124, 49, 200, 51, 16, 12, 499], ["+", 8, 498, 0, 124, 49, 200, 51, 91, 17, 33], ["+", 8, 498, 0, 124, 49, 200, 51, 91, 439, 499]]
3
173
5
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while (true)...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while (true)...
[["+", 0, 57, 15, 15, 0, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 15, 0, 16, 31, 16, 12, 22]]
3
441
2
import java.io.*; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; while ((str = br.readLine()) != "0") { int n = Integer.parseInt(str); long max = -1000000; int[] s = new int[n...
import java.io.*; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; while (!(str = br.readLine()).equals("0")) { int n = Integer.parseInt(str); long max = -1000000; int[] s = new...
[["+", 8, 196, 0, 52, 15, 15, 0, 91, 17, 111], ["-", 8, 196, 0, 52, 15, 15, 0, 16, 17, 79], ["+", 0, 52, 15, 15, 0, 91, 439, 492, 0, 131], ["+", 0, 52, 15, 15, 0, 91, 439, 492, 141, 22], ["+", 15, 15, 0, 91, 439, 492, 3, 4, 0, 24], ["+", 15, 15, 0, 91, 439, 492, 3, 4, 0, 25]]
3
203
6
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] in; while (true) { int n = sc.nextInt(); if (n == 0) break; in = new int[n]; for (int i = 0; i < n; i++) { in[i] = sc.nextInt(); ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] in; while (true) { int n = sc.nextInt(); if (n == 0) break; in = new int[n]; for (int i = 0; i < n; i++) { in[i] = sc.nextInt(); ...
[["+", 8, 196, 0, 503, 49, 200, 51, 504, 516, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 504, 0, 70], ["+", 8, 196, 0, 503, 49, 200, 51, 504, 0, 73], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
245
5
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int num = sc.nextInt(); if (num == 0) break; int sum = sc.nextInt(); int max = sum; for (int i = 0; i < num; i++) { in...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int num = sc.nextInt(); if (num == 0) break; int sum = sc.nextInt(); int max = sum; for (int i = 1; i < num; i++) { in...
[["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499]]
3
142
2
import java.util.Scanner; public class Main { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int num = sc.nextInt(); if (num == 0) { break; } int sum = sc.nextInt(); int max = sum; ...
import java.util.Scanner; public class Main { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int num = sc.nextInt(); if (num == 0) { break; } int sum = sc.nextInt(); int max = sum; ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 22]]
3
153
2
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = Integer.parseInt(sc.next()); int i, j, max = 0, tmp = 0; int[] num = new int[5001]; if (n == 0) { break; } ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = Integer.parseInt(sc.next()); int i, j, max = 0, tmp = 0; int[] num = new int[5001]; if (n == 0) { break; } ...
[["-", 0, 7, 8, 196, 0, 7, 502, 11, 12, 499], ["+", 0, 7, 8, 196, 0, 7, 502, 11, 12, 22]]
3
199
2
import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); static int n, max; static int a[], best[]; public static void main(String[] args) { while (read()) { solve(); } } public static boolean read() { n = sc.nextInt(); if (n == 0) return f...
import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); static int n, max; static int a[], best[]; public static void main(String[] args) { while (read()) { solve(); } } public static boolean read() { n = sc.nextInt(); if (n == 0) return f...
[["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
221
2
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { while (true) { int n = sc.nextInt(); if (n == 0) break; System.out.println(run(n)); } } static long run(int n) { long ans = -100000; int[] a = n...
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { while (true) { int n = sc.nextInt(); if (n == 0) break; System.out.println(run(n)); } } static long run(int n) { long ans = -100000; int[] a = n...
[["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499], ["-", 0, 7, 502, 503, 49, 200, 51, 16, 17, 72], ["-", 0, 7, 502, 503, 49, 200, 51, 16, 12, 499]]
3
201
4
#include <stdio.h> #include <string.h> #define INF 1000000000 int n, a[5010], dp[5010]; int max(int a, int b) { return a > b ? a : b; } int main(void) { int x; while (scanf("%d", &n) && n) { for (x = 0; x < n; x++) { scanf("%d", a + x); } memset(dp, -INF, sizeof(dp)); dp[0] = a[0]; int...
#include <stdio.h> #include <string.h> #define INF 1000000000 int n, a[5010], dp[5010]; int max(int a, int b) { return a > b ? a : b; } int main(void) { int x; while (scanf("%d", &n) && n) { for (x = 0; x < n; x++) { scanf("%d", a + x); } memset(dp, -INF, sizeof(dp)); dp[0] = a[0]; int...
[["-", 8, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 91, 28, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 69, 0, 70], ["+", 8, 9, 0, 43, 49, 50, 51, 69, 71, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 69, 0, 73]]
0
186
6
#include <stdio.h> int main(void) { int n, a[5000], i, j, k; while (1) { scanf("%d", &n); if (n == 0) { break; } for (i = 0; i < n; i++) { scanf("%d", &a[i]); } int ans = -100000, sum; for (i = 1; i <= n; i++) { for (j = 0; j <= n - i; j++) { sum = 0; ...
#include <stdio.h> int main(void) { int n, a[5000], i, j, k; while (1) { scanf("%d", &n); if (n == 0) { break; } for (i = 0; i < n; i++) { scanf("%d", &a[i]); } int ans = -100000, sum; for (i = 1; i <= n; i++) { for (j = 0; j <= n - i; j++) { sum = 0; ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
179
2
#include <stdio.h> int main(void) { int n, sum, max, i, j, data[5005]; while (1) { scanf("%d", &n); if (n == 0) { break; } for (i = 0; i < n; i++) { scanf("%d", &data[i]); } max = data[0] + data[1]; for (i = 0; i < n - 1; i++) { sum = 0; for (j = i; j < n; j++) {...
#include <stdio.h> int main(void) { int n, sum, max, i, j, data[5005]; while (1) { scanf("%d", &n); if (n == 0) { break; } for (i = 0; i < n; i++) { scanf("%d", &data[i]); } max = data[0] + data[1]; for (i = 0; i < n; i++) { sum = 0; for (j = i; j < n; j++) { ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
161
2
#include <stdio.h> #define MAX 5000 int max(int a, int b) { if (a > b) return a; return b; } int f(int a[], int n) { int t = a[0]; int s = a[0]; for (int k = 1; k < n; k++) t = max(t + a[k], a[k]); s = max(s, t); return s; } int main() { int n, i, j; int A[MAX]; int ans; while (1) { ...
#include <stdio.h> #define MAX 5000 int max(int a, int b) { if (a > b) return a; return b; } int f(int a[], int n) { int t = a[0]; int s = a[0]; for (int k = 1; k < n; k++) { t = max(t + a[k], a[k]); s = max(s, t); } return s; } int main() { int n, i, j; int A[MAX]; int ans; while ...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
0
196
34
#include <limits.h> #include <stdio.h> int main(void) { int i, j, k; int n, pre, max; while (1) { scanf("%d", &n); if (n == 0) break; int x[n]; for (i = 0; i < n; i++) scanf("%d", &x[i]); max = INT_MIN; for (k = 1; k <= n; k++) { for (i = 0, pre = 0; i < k; i++) ...
#include <limits.h> #include <stdio.h> int main(void) { int i, j, k; int n, pre, max; while (1) { scanf("%d", &n); if (n == 0) break; int x[n]; for (i = 0; i < n; i++) scanf("%d", &x[i]); max = INT_MIN; for (k = 1; k <= n; k++) { for (i = 0, pre = 0; i < k; i++) ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
0
191
2
// AOJ Volume 0 Problem 0022 #include <stdio.h> int aoj0022(int n) { int i; int a[5000]; int sum_all; int sum_rear; int max_front; int max_rear; int index_max_front; int index_max_rear; scanf("%d", &a[0]); sum_all = max_front = a[0]; index_max_front = 0; for (i = 1; i < n; i++) { scanf("...
// AOJ Volume 0 Problem 0022 #include <stdio.h> int aoj0022(int n) { int i; int a[5000]; int sum_all; int sum_rear; int max_front; int max_rear; int index_max_front; int index_max_rear; scanf("%d", &a[0]); sum_all = max_front = a[0]; index_max_front = 0; for (i = 1; i < n; i++) { scanf("...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
263
2
#include <stdio.h> int main() { int si, i, j, n, sq[5000], m, prev, sum, max, k; do { scanf("%d", &n); if (!n) break; for (si = 0, i = 0, prev = 2, sq[0] = 0, j = 0; i < n; i++) { scanf("%d", &m); if (prev * m >= 0) { if (prev == 2) prev = 1; sq[si] += m; ...
#include <stdio.h> int main() { int si, i, j, n, sq[5000], m, prev, sum, max, k; do { scanf("%d", &n); if (!n) break; for (si = 0, i = 0, prev = 2, sq[0] = 0, j = 0; i < n; i++) { scanf("%d", &m); if (prev * m >= 0) { if (prev == 2) prev = 1; sq[si] += m; ...
[["-", 0, 7, 8, 9, 0, 7, 26, 11, 17, 107], ["-", 0, 7, 8, 9, 0, 7, 26, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 11, 12, 69, 71, 16, 12, 16, 17, 48], ["+", 0, 11, 12, 69, 71, 16, 12, 16, 12, 13]]
0
340
5
#include <limits.h> #include <stdio.h> #define DEBUG 0 int buf[5001]; /* 100kx5k= 500M 2^20 = 1M */ int find_max_sum(int count) { int i, j; int max, s; int sum; max = INT_MIN; for (i = 0; i < count; i++) { s = 0; for (j = i; j <= count; j++) { s += buf[j]; if (s >= max) ma...
#include <limits.h> #include <stdio.h> #define DEBUG 0 int buf[5001]; /* 100kx5k= 500M 2^20 = 1M */ int find_max_sum(int count) { int i, j; int max, s; int sum; max = INT_MIN; for (i = 0; i < count; i++) { s = 0; for (j = i; j < count; j++) { s += buf[j]; if (s >= max) max...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18]]
0
200
2