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(void) { int n, i, l; long a[5000], ans, s; for (i = 0; i < 5000; i++) a[i] = NULL; while (scanf("%d", &n)) { if (n == 0) break; ans = -100000; for (i = 0; i < n; i++) { scanf("%ld", &a[i]); } for (i = 0; i < n; i++) { s = -100000; f...
#include <stdio.h> int main(void) { int n, i, l; long a[5000], ans, s; for (i = 0; i < 5000; i++) a[i] = NULL; while (scanf("%d", &n)) { if (n == 0) break; ans = -100000; for (i = 0; i < n; i++) { scanf("%ld", &a[i]); } for (i = 0; i < n; i++) { s = 0; for (l ...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13]]
0
164
2
#include <stdio.h> int main() { long int n, s, t, sum, max, d[5000]; while (scanf("%d", &n) && n) { max = 0; for (s = 0; s < n; s++) scanf("%d", &d[s]); for (s = 0; s < n; s++) { sum = 0; for (t = s; t < n; t++) { sum += d[t]; if (sum > max) max = sum; }...
#include <stdio.h> int main() { long int n, s, t, sum, max, d[5000]; while (scanf("%d", &n) && n) { max = -100000; for (s = 0; s < n; s++) scanf("%ld", &d[s]); for (s = 0; s < n; s++) { sum = 0; for (t = s; t < n; t++) { sum += d[t]; if (sum > max) max = sum; ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
135
4
a[9999]; main(n, i, j, m, s) { for (; scanf("%d", &n), n; printf("%d\n", m)) { for (i = 0; i < n; i++) scanf("%d", a + i); for (m = -999999, i = 0; i < n; i++) for (s = 0, j = i; j < n; m = m < s ? m : s, j++) s += a[j]; } exit(0); }
a[9999]; main(n, i, j, m, s) { for (; scanf("%d", &n), n; printf("%d\n", m)) { for (i = 0; i < n; i++) scanf("%d", a + i); for (m = -999999, i = 0; i < n; i++) for (s = 0, j = i; j<n; m = m> s ? m : s, j++) s += a[j]; } exit(0); }
[["-", 26, 34, 31, 11, 12, 41, 15, 16, 17, 18], ["+", 26, 34, 31, 11, 12, 41, 15, 16, 17, 47]]
0
127
2
#include <stdio.h> int main() { int n; int a[5000]; long temp; long max; int i, j; scanf("%d", &n); while (n) { max = -100000; for (i = 0; i < n; i++) scanf("%d", &a[i]); for (i = 0; i < n; i++) { temp = 0; for (j = i; j < n - i; j++) { temp += a[j]; if ...
#include <stdio.h> int main() { int n; int a[5000]; long temp; long max; int i, j; scanf("%d", &n); while (n) { max = -100000; for (i = 0; i < n; i++) scanf("%d", &a[i]); for (i = 0; i < n; i++) { temp = 0; for (j = i; j < n; j++) { temp += a[j]; if (tem...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22]]
0
150
2
#include <stdio.h> int n, x, s, ans; int main(void) { while (scanf("%d", &n) * n) { s = 0; ans = -999999; for (; n > 0; n--) { scanf("%d", &x); s += x; if (x > ans) ans = x; if (s < 0) s = 0; } printf("%d\n", ans); } }
#include <stdio.h> int n, x, s, ans; int main(void) { while (scanf("%d", &n) * n) { s = 0; ans = -999999; for (; n > 0; n--) { scanf("%d", &x); s += x; if (s > ans) ans = s; if (s < 0) s = 0; } printf("%d\n", ans); } return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
0
98
7
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n, i, j, k; int tmp, max; int *a; while (1) { scanf("%d", &n); if (n == 0) break; a = malloc(sizeof(int) * n); for (i = 0; i < n; i++) scanf("%d", &a[i]); // for(i=0;i<n;i++) // printf("a[%d]=%l...
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n, i, j, k; int tmp, max; int *a; while (1) { scanf("%d", &n); if (n == 0) break; a = malloc(sizeof(int) * n); for (i = 0; i < n; i++) scanf("%d", &a[i]); // for(i=0;i<n;i++) // printf("a[%d]=%l...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
177
3
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
273
2
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n; cin >> n; while (n != 0) { vector<ll> vec(n); for (ll i = 0; i < n; i++) { cin >> vec.at(i); } vector<ll> rsw(n + 1); rsw.at(0) = 0; for (int i = 1; i < n + 1; i++) { rsw.at(i) = rsw.at(i - 1)...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n; cin >> n; while (n != 0) { vector<ll> vec(n); for (ll i = 0; i < n; i++) { cin >> vec.at(i); } vector<ll> rsw(n + 1); rsw.at(0) = 0; for (int i = 1; i < n + 1; i++) { rsw.at(i) = rsw.at(i - 1)...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
219
2
#include <iostream> using namespace std; int main() { int n; long int a[5000], sum, ans; while (1) { cin >> n; if (n == 0) break; sum = 0; ans = -1000000; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { sum = 0; for (int j = 0; j < n...
#include <iostream> using namespace std; int main() { int n; long int a[5000], sum, ans; while (1) { cin >> n; if (n == 0) break; sum = 0; ans = -1000000; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { sum = 0; for (int j = 0; i + j...
[["+", 8, 9, 0, 7, 15, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 72]]
1
138
2
#include <iostream> #include <vector> using std::cin; int main() { int n; while (cin >> n) { if (n == 0) { break; } std::vector<int> line(n); for (auto i = 0; i < n; i++) { int in; cin >> in; line.push_back(in); } int max = -100000; for (auto i = 0; i < n; i+...
#include <iostream> #include <vector> using std::cin; int main() { int n; while (cin >> n) { if (n == 0) { break; } std::vector<int> line(n); for (auto i = 0; i < n; i++) { int in; cin >> in; line.at(i) = in; } int max = -100000; for (auto i = 0; i < n; i++) ...
[["-", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 0, 1, 0, 11, 31, 2, 63, 118, 119, 120], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22]]
1
179
6
#include <cstdio> #include <stack> using namespace std; int main() { int a, b, n, i, j, x[10]; scanf("%d", &n); for (j = 0; j < n; j++) { for (i = 0; i < 10; i++) { scanf("%d", &x[i]); } stack<int> B; stack<int> C; B.push(x[0]); for (i = 1; i <= 9; i++) { if (x[i - 1] > x[i]) {...
#include <cstdio> #include <stack> using namespace std; int main() { int k, n, i, j, x[10]; scanf("%d", &n); for (k = 0; k < n; k++) { for (i = 0; i < 10; i++) { scanf("%d", &x[i]); } stack<int> B; stack<int> C; B.push(x[0]); for (i = 1; i <= 9; i++) { if (x[i - 1] > x[i]) { ...
[["-", 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, 14, 8, 9, 0, 7, 10, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 2...
1
272
10
#include <stdio.h> main() { int x[10], y[10], z[10], i, j, n, cz, cy, tmp; scanf("%d", &n); for (i = 0; i < n; i++) { tmp = 0; cy = 0; cz = 0; for (j = 0; j < 10; j++) { scanf("%d", &x[j]); z[j] = 0; y[j] = 0; } for (j = 0; j < 10; j++) { if (x[j] >= y[cy - 1 * cy >...
#include <stdio.h> main() { int x[10], y[10], z[10], i, j, n, cz, cy, tmp; scanf("%d", &n); for (i = 0; i < n; i++) { tmp = 0; cy = 0; cz = 0; for (j = 0; j < 10; j++) { scanf("%d", &x[j]); z[j] = 0; y[j] = 0; } for (j = 0; j < 10; j++) { if (x[j] >= y[cy - 1 * (cy ...
[["+", 341, 342, 0, 16, 12, 16, 12, 23, 0, 24], ["+", 341, 342, 0, 16, 12, 16, 12, 23, 0, 25]]
1
216
4
#include <cstdio> #define N 10 int D, Ball[N]; int R, L; bool solve(int i) { if (i == N) return true; if (R < Ball[i]) { R = Ball[i]; if (solve(i + 1)) return true; } if (L < Ball[i]) { L = Ball[i]; if (solve(i + 1)) return true; } return false; } int main() { scanf("%d...
#include <cstdio> #define N 10 int D, Ball[N]; int R, L; bool solve(int i) { if (i == N) return true; if (R < Ball[i]) { R = Ball[i]; if (solve(i + 1)) return true; } if (L < Ball[i]) { L = Ball[i]; if (solve(i + 1)) return true; } return false; } int main() { scanf("%d...
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
1
196
1
#include <algorithm> // sort などのアルゴリズム #include <ctype.h> // C の文字種用 #include <iostream> // C++の入出力 #include <math.h> #include <sstream> #include <stdio.h> // C の入出力 #include <string.h> // C の文字列用 #include <string> // C++の文字列 using namespace std; int ball[10]; bool dfs(int i, int b, int c); int main(void) { int...
#include <algorithm> // sort などのアルゴリズム #include <ctype.h> // C の文字種用 #include <iostream> // C++の入出力 #include <math.h> #include <sstream> #include <stdio.h> // C の入出力 #include <string.h> // C の文字列用 #include <string> // C++の文字列 using namespace std; int ball[10]; bool dfs(int i, int b, int c); int main(void) { int...
[["-", 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
215
4
#include <iostream> #include <string.h> using namespace std; int ball_list[10]; int right_list[10]; int left_list[10]; bool flag; void dfs(int right, int left) { int count = right + left; if (count == 10) { flag = true; } else { if (right == 0 || right_list[right - 1] < ball_list[count]) { if (...
#include <iostream> #include <string.h> using namespace std; int ball_list[10]; int right_list[10]; int left_list[10]; bool flag; void dfs(int right, int left) { int count = right + left; if (count == 10) { flag = true; } else { if (right == 0 || right_list[right - 1] < ball_list[count]) { if (...
[["-", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 15, 339, 51, 16, 12, 16, 12, 69, 28, 22], ["+", 15, 339, 51, 16, 12, 16, 12, 69, 28, 22], ["-", 51, 16, 12, 16, 12, 69, 341, 342, 0, 22], ["+", 51, 16, 12, 16, 12, 69, 341, 342, 0, 22]]
1
301
8
#include <iostream> using namespace std; const int kBalln = 10; int ball[kBalln]; bool ExistAsceOrder(int i, int a, int b) { // 終了条件 if (i == kBalln) return true; // ボールiを筒Bに入れる場合 if (a < ball[i] && ExistAsceOrder(i + 1, ball[i], b)) return true; // ボールiを筒Cに入れる場合 if (b < ball[i] && ExistAsceOrde...
#include <iostream> using namespace std; const int kBalln = 10; int ball[kBalln]; bool ExistAsceOrder(int i, int a, int b) { // 終了条件 if (i == kBalln) return true; // ボールiを筒Bに入れる場合 if (a < ball[i] && ExistAsceOrder(i + 1, ball[i], b)) return true; // ボールiを筒Cに入れる場合 if (b < ball[i] && ExistAsceOrde...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
187
33
#include <iostream> using namespace std; const int kBalln = 10; int main() { int n; int ball; int b, c; bool ans; cin >> n; for (int j = 0; j < n; ++j) { b = 0; c = 0; ans = true; for (int i = 0; i < kBalln; ++i) { cin >> ball; if (b < ball) { b = ball; } else if (...
#include <iostream> using namespace std; const int kBalln = 10; int main() { int n; int ball; int b, c; bool ans; cin >> n; for (int j = 0; j < n; ++j) { b = 0; c = 0; ans = true; for (int i = 0; i < kBalln; ++i) { cin >> ball; if (b < ball) { b = ball; } else if (...
[["-", 0, 57, 75, 76, 0, 9, 0, 93, 0, 94], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 147]]
1
134
4
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int n; const int m = 10; int *data; int *lp; int *rp; // return...fail:0, success:1 bool dfs(int i, int l, int r) { if (i == m) return true; if (i < m && l < m && lp[l - 1] < data[i]) { lp[l] = data[i]; if (dfs(i + 1, l +...
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int n; const int m = 10; int *data; int *lp; int *rp; // return...fail:0, success:1 bool dfs(int i, int l, int r) { if (i == m) return true; if (i < m && l < m && lp[l - 1] < data[i]) { lp[l] = data[i]; if (dfs(i + 1, l +...
[["-", 12, 16, 31, 69, 341, 342, 0, 16, 31, 22], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 31, 22]]
1
351
2
#include <iostream> using namespace std; int main(void) { int n; cin >> n; for (int i = 0; i < n; i++) { int a[10] = {0}; for (int j = 0; j < 10; j++) { int x; cin >> x; a[j] = x; } int b = a[0], c = a[0], k; for (k = 1; k < 10; k++) { if (b < a[k]) b = a[k]; ...
#include <iostream> using namespace std; int main(void) { int n; cin >> n; for (int i = 0; i < n; i++) { int a[10] = {0}; for (int j = 0; j < 10; j++) { int x; cin >> x; a[j] = x; } int b = 0, c = 0, k; for (k = 1; k < 10; k++) { if (b < a[k]) b = a[k]; e...
[["-", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73]]
1
172
6
#include <iostream> using namespace std; int main() { int a[10], b[11], c[11]; int n; cin >> n; for (int jjj = 1; jjj <= n; jjj++) { for (int kk = 0; kk < 10; kk++) cin >> a[kk]; int bb = 0, cc = 0; b[0] = 0; c[0] = 0; for (int k = 0; k < 10; k++) { if (a[k] > b[bb] && b[bb] >= ...
#include <iostream> using namespace std; int main() { int a[10], b[11], c[11]; int n; cin >> n; for (int jjj = 1; jjj <= n; jjj++) { for (int kk = 0; kk < 10; kk++) cin >> a[kk]; int bb = 0, cc = 0; b[0] = 0; c[0] = 0; for (int k = 0; k < 10; k++) { if (a[k] > b[bb] && b[bb] >= ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
291
4
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; int N, acnt, bcnt; int x[10], A[10], B[10]; boo...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; int N, acnt, bcnt; int x[10], A[10], B[10]; boo...
[["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22]]
1
257
2
n=gets.to_i n.times do ab,ac=[],[] balls=split(/\s/).map(&:to_i) balls.each do |inb| if ab.size==0||ab.last<inb ab << inb else (ac.size>0&&ac.last>inb) ? break : ac << inb end end puts ((ab.size+ac.size)==10) ? 'YES' : 'NO' end
n=gets.to_i n.times do ab,ac=[],[] balls=gets.split(/\s/).map(&:to_i) balls.each do |inb| if ab.size==0||ab.last<inb ab << inb else (ac.size>0&&ac.last>inb) ? break : ac << inb end end puts ((ab.size+ac.size)==10) ? 'YES' : 'NO' end
[["+", 8, 736, 0, 662, 12, 652, 486, 652, 486, 22], ["+", 8, 736, 0, 662, 12, 652, 486, 652, 17, 131]]
4
99
2
n = readline.chomp.to_i n.times{ v = readline.chomp.split.map{|c| c.to_i} stack1 = [0] stack2 = [0] v.each{|c| if stack1[-1] > stack2[-1] if stack1[-1] < c stack1.push(c) elsif stack2[-1] < c stack2.push(c) else puts "NO" break end else if ...
n = readline.chomp.to_i n.times{ v = readline.chomp.split.map{|c| c.to_i} # (1..10).to_a.permutation{|v| # p v stack1 = [0] stack2 = [0] v.each{|c| # if stack1[-1] < c # stack1.push(c) # elsif stack2[-1] < c # stack2.push(c) # else # puts "NO" # break # end if sta...
[["-", 0, 652, 196, 196, 8, 734, 0, 652, 735, 22], ["-", 196, 196, 8, 734, 0, 652, 3, 4, 0, 22]]
4
150
4
n = gets.chomp.to_i n.times do balls = gets.chomp.split.map(&:to_i) a,b = 0,0 10.times do |i| if balls[i] > a || balls[i] > b if balls[i] < a b = balls[i] elsif balls[i] < b a = balls[i] elsif balls[i] > a && balls[i] > b if a > b a = balls[i] else ...
n = gets.chomp.to_i n.times do balls = gets.chomp.split.map(&:to_i) a,b = 0,0 10.times do |i| if balls[i] > a || balls[i] > b if balls[i] < a b = balls[i] elsif balls[i] < b a = balls[i] elsif balls[i] > a && balls[i] > b if a > b a = balls[i] else ...
[["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["-", 196, 737, 8, 736, 0, 652, 3, 4, 0, 22], ["-", 196, 737, 8, 736, 0, 652, 3, 4, 0, 21], ["-", 8, 736, 0, 652, 3, 4, 0, 557, 0, 62], ["-", 196, 737, 8, 736, 0, 751, 8, 652, 735, 22]]
4
135
7
n=int(input()) for i in range(n): a=list(map(int,input().aplit())) b,c=0,0 yes = True for j in range(10): if a[j]>b:b=a[j] elif a[j]>c:c=a[j] else:yes=False print("YES" if yes else "NO")
n=int(input()) for i in range(n): a=list(map(int,input().split())) b,c=0,0 yes = True for j in range(10): if a[j]>b:b=a[j] elif a[j]>c:c=a[j] else:yes=False print("YES" if yes else "NO")
[["-", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22]]
5
96
2
def s(a): for i in a: if i > b: b = i elif i > c: c = i else: return False return True for n in range(int(input())): print("YES" if s(list(map(int,input().split()))) else "NO")
def s(a): b = c = 0 for i in a: if i > b: b = i elif i > c: c = i else: return False return True for n in range(int(input())): print("YES" if s(list(map(int,input().split()))) else "NO")
[["+", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 662, 31, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 662, 12, 612]]
5
75
9
def check(x): a, b = 0, 0 for ball in x: if a > ball: a = ball elif b > ball: b = ball else: return False return True n = int(input()) for i in range(n): all = list(map(int, input().split())) print("YES" if check(all) else "NO")
def check(x): a, b = 0, 0 for ball in x: if a < ball: a = ball elif b < ball: b = ball else: return False return True n = int(input()) for i in range(n): all = list(map(int, input().split())) print("YES" if check(all) else "NO")
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 47], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18]]
5
88
4
# -*- coding: utf-8 -*- n = int(input()) for i in range(n): A, B, C = [], [0], [0] A = list(map(int, input().split())) for i in range(10): if A[i] > B[0]: B.insert(0, num[i]) elif A[i] > C[0]: C.insert(0, num[i]) else: break if len(A) + len(B)...
# -*- coding: utf-8 -*- n = int(input()) for i in range(n): A, B, C = [], [0], [0] A = list(map(int, input().split())) for i in range(10): if A[i] > B[0]: B.insert(0, A[i]) elif A[i] > C[0]: C.insert(0, A[i]) else: break if len(B) + len(C) == ...
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["-", 15, 666, 0, 657, 31, 652, 3, 4, 0, 22], ["+", 15, 666, 0, 657, 31, 652, 3, 4, 0, 22], ["-", 15, 666, 0, 657, 12, 652, 3, 4, 0, 22], ["+", 15, 666, 0, 657, 12, 652, 3, 4, 0, 22]]
5
132
8
def solve(n,left,right): if n==10: return 1 if a[n]>left: return solve(n+1,a[n],right) if a[n]>right: return solve(n+1,left,a[n]) return 0 n=int(input()) for _ in range(n): a=[int(i) for i in input().split()] print("YES" if solve(10,0,0) else "NO")
def solve(n,left,right): if n==10: return 1 if a[n]>left: return solve(n+1,a[n],right) if a[n]>right: return solve(n+1,left,a[n]) return 0 n=int(input()) for _ in range(n): a=[int(i) for i in input().split()] print("YES" if solve(0,0,0) else "NO")
[["-", 3, 4, 0, 41, 0, 652, 3, 4, 0, 612], ["+", 3, 4, 0, 41, 0, 652, 3, 4, 0, 612]]
5
116
2
def main(): n = int(input()) for i in range(n): Ball = map(int,input().split()) l = r = 0 for value in Ball: if value > r: r = value elif value > l: l = value else: print("NO") r = -777 ...
def main(): n = int(input()) for i in range(n): Ball = map(int,input().split()) l = r = 0 for value in Ball: if value > r: r = value elif value > l: l = value else: print("NO") r = -777 ...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
111
2
x=int(input()) for _ in range(x): num=list(map(int,input().split())) b,c=0,0 flag=True for i in num: if b<i: b=i elif c<i: c=i else: print("No") flag=False break if flag: print("YES")
x=int(input()) for _ in range(x): num=list(map(int,input().split())) b,c=0,0 flag=True for i in num: if b<i: b=i elif c<i: c=i else: print("NO") flag=False break if flag: print("YES")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
85
2
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #inclu...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #inclu...
[["+", 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
281
4
#include <cstdio> using namespace std; int main(void) { int ku[11], i, ans = 0; float v1, v2, zen = 0, hit; while ((scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%f,%f", &ku[1], &ku[2], &ku[3], &ku[4], &ku[5], &ku[6], &ku[7], &ku[8], &ku[9], &ku[10], &v1, &v2)) != EOF) { for (i = 1; ...
#include <cstdio> using namespace std; int main(void) { int ku[11], i, ans = 0; float v1, v2, zen = 0, hit; while ((scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%f,%f", &ku[1], &ku[2], &ku[3], &ku[4], &ku[5], &ku[6], &ku[7], &ku[8], &ku[9], &ku[10], &v1, &v2)) != EOF) { for (i = 1; ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
202
4
#include <cstdio> #include <iostream> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { double v1, v2; int l[10]; while (~scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%lf,%lf", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v1, &v2)) { double sum ...
#include <cstdio> #include <iostream> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { double v1, v2; int l[10]; while (~scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%lf,%lf", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v1, &v2)) { double sum ...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
186
4
#include <cstdio> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int l[10]; int v1, v2; int L; 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) != EOF) { for (int i...
#include <cstdio> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int l[10]; int v1, v2; int L; 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) != EOF) { L = 0; ...
[["+", 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], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
1
208
6
#include <iostream> #include <vector> using namespace std; #define loop(i, a, b) for (int i = (a); i < int(b); i++) #define rep(i, b) loop(i, 0, b) int main() { vector<int> l(10); vector<int> v(2); char c; while (cin >> l[0]) { rep(i, 9) cin >> c >> l[i + 1]; rep(i, 2) cin >> c >> v[i]; double su...
#include <iostream> #include <vector> using namespace std; #define loop(i, a, b) for (int i = (a); i < int(b); i++) #define rep(i, b) loop(i, 0, b) int main() { vector<double> l(10); vector<double> v(2); char c; while (cin >> l[0]) { rep(i, 9) cin >> c >> l[i + 1]; rep(i, 2) cin >> c >> v[i]; dou...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
188
6
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #...
[["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 24], ["+", 15, 339, 51, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 57, 15, 339, 51, 16, 31, 74, 0, 25], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
385
5
while line=gets line=line.chomp.split(",").map{|s| s.to_i} length=(0..9).map{|i| line[0..i].inject{|sum,j| sum+j}} v1=line[10] v2=line[11] p=length[9]*v1/(v1+v2).to_f p p 10.times{|i| if p<=length[i] then puts i+1 break end } end
while line=gets line=line.chomp.split(",").map{|s| s.to_i} length=(0..9).map{|i| line[0..i].inject{|sum,j| sum+j}} v1=line[10] v2=line[11] p=length[9]*v1/(v1+v2).to_f 10.times{|i| if p<=length[i] then puts i+1 break end } end
[["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22], ["-", 0, 89, 8, 170, 0, 652, 3, 4, 0, 22]]
4
111
2
line = $stdin lines = line.readlines line.close lines.each do |l| arr = l.split(",") arr_int = arr[0..9].map{|s| s.to_i} dist_sum = arr_int.reduce(:+) v1, v2 = arr[10].to_i, arr[11].to_i meet_t = dist_sum.to_f / (v1.to_f + v2.to_f) meet_l = meet_t * v1 ans = 0 for i in 0..9 do ans += arr_int[i] if ans >...
line = $stdin lines = line.readlines line.close lines.each do |l| arr = l.split(",") arr_int = arr[0..9].map{|s| s.to_i} dist_sum = arr_int.reduce(:+) v1, v2 = arr[10].to_i, arr[11].to_i meet_t = dist_sum.to_f / (v1.to_f + v2.to_f) meet_l = meet_t * v1 ans = 0 for i in 0..9 do ans += arr_int[i] if ans >= ...
[["-", 0, 121, 64, 749, 0, 652, 3, 4, 0, 22], ["+", 64, 749, 0, 652, 3, 4, 0, 738, 31, 22], ["+", 64, 749, 0, 652, 3, 4, 0, 738, 17, 72], ["+", 64, 749, 0, 652, 3, 4, 0, 738, 12, 612]]
4
118
4
while (list=gets)!=nil sum=0 list=list.split(",").map{|i|i.to_i} v1,v2=list[10,11] for i in 0..9 sum+=list[i] end r=v1*sum.quo(v1+v2) for i in 0..9 r-=list[i] if r<0 puts i+1 break end end end
while (list=gets)!=nil sum=0 list=list.split(",").map{|i|i.to_i} v1,v2=list[10,2] for i in 0..9 sum+=list[i] end r=v1*sum.quo(v1+v2) for i in 0..9 r-=list[i] if r<=0.0 puts i+1 break end end end
[["-", 0, 89, 8, 170, 0, 662, 12, 742, 0, 612], ["+", 0, 89, 8, 170, 0, 662, 12, 742, 0, 612], ["-", 0, 88, 8, 170, 0, 121, 15, 738, 17, 18], ["-", 0, 88, 8, 170, 0, 121, 15, 738, 12, 612], ["+", 0, 88, 8, 170, 0, 121, 15, 738, 17, 19], ["+", 0, 88, 8, 170, 0, 121, 15, 738, 12, 531]]
4
90
6
while (st=gets) != nil do st = st.split(',').map! {|x| x=x.to_i} b = st.pop.to_f a = st.pop.to_f sum = 0 i = 0 st.each {|x| sum += x} a = sum*a/(a+b) p a while a>0 do a -= st.shift i += 1 end p i end
while (st=gets) != nil do st = st.split(',').map! {|x| x=x.to_i} b = st.pop.to_f a = st.pop.to_f sum = 0 i = 0 st.each {|x| sum += x} a = sum*a/(a+b) while a>0 do a -= st.shift i += 1 end p i end
[["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22], ["-", 0, 89, 8, 170, 0, 652, 3, 4, 0, 22]]
4
92
2
loop { t = gets if t == nil break end t = t.split(",") dist = [] dist[0] = 0.0 10.times do |i| dist[i+1] = dist[i] + t[i].to_f end v1 = t[10].to_f v2 = t[11].to_f v = v1 + v2 d = v1.to_f * dist[10].to_f / v.to_f 10.times do |i| if dist[i].to_f >= d puts i break end end }
loop { t = gets if t == nil break end t = t.split(",") dist = [] dist[0] = 0.0 10.times do |i| dist[i+1] = dist[i] + t[i].to_f end v1 = t[10].to_f v2 = t[11].to_f v = v1 + v2 d = v1.to_f * dist[10].to_f / v.to_f 11.times do |i| if dist[i].to_f >= d puts i break end end }
[["-", 0, 652, 196, 196, 8, 734, 0, 652, 486, 612], ["+", 0, 652, 196, 196, 8, 734, 0, 652, 486, 612]]
4
116
2
while True: try: l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,v1,v2=map(int,input().split(",")) kyo=0 for i in l1,l2,l3,l4,l5,l6,l7,l8,l9,l10: kyo +=i v=v1+v2 x=kyo/v ans=v1*x flag=0 for j in l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,0: if ans>0: ...
while True: try: l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,v1,v2=map(int,input().split(",")) kyo=0 for i in l1,l2,l3,l4,l5,l6,l7,l8,l9,l10: kyo +=i v=v1+v2 x=kyo/v ans=v1*x flag=0 for j in l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,0: if ans>0: ...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
141
4
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys for s in sys.stdin: print() d = list(map(float, s.split(","))) dl,v1,v2 = d[:-2],d[-2],d[-1] L = sum(dl) x = L/(1+v2/v1) m = 0 for i in range(len(dl)): m += dl[i] if m >= x: print(i+1); break
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys for s in sys.stdin: d = list(map(float, s.split(","))) dl,v1,v2 = d[:-2],d[-2],d[-1] L = sum(dl) x = L/(1+v2/v1) m = 0 for i in range(len(dl)): m += dl[i] if m >= x: print(i+1); break
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
106
3
while True: try: l = list(map(int, input().split(','))) except: break d = sum(l[:10]) * l[10] / (l[10] + l[11]) for i in range(10): if sum(l[:i]) >= d: break print(i)
while True: try: l = list(map(int, input().split(','))) except: break d = sum(l[:10]) * l[10] / (l[10] + l[11]) for i in range(1,11): if sum(l[:i]) >= d: break print(i)
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
80
4
while True: try: A = list(map(int,input().split(','))) except EOFError: break V1 = A [-2] V2 = A [-1] del A [-1] del A [-1] for i in range(len(A)): A [i] *= V1 + V2 point = sum(A) // (V1 + V2) * V1 print(point) for i in range(len(A)): if sum(A [0...
while True: try: A = list(map(int,input().split(','))) except EOFError: break V1 = A [-2] V2 = A [-1] del A [-1] del A [-1] for i in range(len(A)): A [i] *= V1 + V2 point = sum(A) // (V1 + V2) * V1 for i in range(len(A)): if sum(A [0:i + 1]) >= point...
[["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
125
4
import sys for line in sys.stdin: v = list(map(int, line.split(","))) k = [sum(v[:i]) for i,j in enumerate(v[:-1])] l = v[-2]/(v[-1]+v[-2]) * k[-1] n = [a-l if a-l >= 0 else 1e10 for a in k] print(n) print(n.index(min(n)))
import sys for line in sys.stdin: v = list(map(int, line.split(","))) k = [sum(v[:i]) for i,j in enumerate(v[:-1])] l = v[-2]/(v[-1]+v[-2]) * k[-1] n = [a-l if a-l >= 0 else 1e10 for a in k] print(n.index(min(n)))
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 63, 319, 500, 22]]
5
115
4
while True: try: inp = list(map(int, input().split(","))) l = inp[0:10] l_all = sum(l) v1 = inp[10] v2 = inp[11] l_pass = l_all*v1/(v1 + v2) for i in range(10): if sum(l[:i]) >= l_pass: print(i) break except: ...
while True: try: inp = list(map(int, input().split(","))) l = inp[0:10] l_all = sum(l) v1 = inp[10] v2 = inp[11] l_pass = l_all*v1/(v1 + v2) for i in range(11): if sum(l[:i]) >= l_pass: print(i) break except: ...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
90
2
import sys for line in sys.stdin.readlines(): line=list(map(int,line.strip().split(","))) l,v1,v2=line[0:10],line[10],line[11] dist=(sum(l)+0.0)/(v1+v2+0.0)*v1 for i in range(10): if sum(l[:i])>=dist: print(i) break
import sys for line in sys.stdin.readlines(): line=list(map(int,line.strip().split(","))) l,v1,v2=line[0:10],line[10],line[11] dist=(sum(l)+0.0)/(v1+v2+0.0)*v1 for i in range(11): if sum(l[:i])>=dist: print(i) break
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
102
2
import sys def solve(l,v1,v2): dist=sum(l)/(v1+v2)*v1 for i in range(10): if sum(l[:i])>=dist: return i return 0 for line in sys.stdin.readlines(): line=list(map(float,line.strip().split(","))) l,v1,v2=line[0:10],line[10],line[11] print(solve(l,v1,v2))
import sys def solve(l,v1,v2): dist=sum(l)/(v1+v2)*v1 for i in range(11): if sum(l[:i])>=dist: return i return 0 for line in sys.stdin.readlines(): line=list(map(float,line.strip().split(","))) l,v1,v2=line[:10],line[10],line[11] print(solve(l,v1,v2))
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 662, 12, 432, 0, 206, 206, 663, 0, 612]]
5
116
3
import java.io.*; import java.math.*; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; class Main { public static double calc_convex(double l1x, double l1y, double l2x, double l2y, double p1x, double p1y, double...
import java.io.*; import java.math.*; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; class Main { public static double calc_convex(double l1x, double l1y, double l2x, double l2y, double p1x, double p1y, double...
[["-", 49, 200, 51, 492, 3, 4, 0, 5, 0, 491], ["+", 49, 200, 51, 492, 3, 4, 0, 5, 0, 491]]
3
566
2
#include <stdio.h> #include <stdlib.h> int main(void) { double x0, y0, x1, y1, x2, y2, x3, y3; while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &x0, &y0, &x1, &y1, &x2, &y2, &x3, &y3) != EOF) { if ((x1 - x0) * (y3 - y0) - (x3 - x0) * (y1 - y0) > 0) { if ((x2 - x1) * (y0 - y1) - (x0 - x1) * (...
#include <stdio.h> #include <stdlib.h> int main(void) { double x0, y0, x1, y1, x2, y2, x3, y3; while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &x0, &y0, &x1, &y1, &x2, &y2, &x3, &y3) != EOF) { if ((x1 - x0) * (y3 - y0) - (x3 - x0) * (y1 - y0) > 0) { if ((x2 - x1) * (y0 - y1) - (x0 - x1) * (...
[["-", 64, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 64, 9, 0, 57, 15, 23, 0, 16, 17, 47]]
0
394
2
#include <math.h> int main() { double xa, ya, xb, yb, xc, yc, xd, yd; while (0 <= scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &xa, &ya, &xb, &yb, &xc, &yb, &xd, &yd)) { if (xc == xa) { if ((xd - xc) * (xb - xc) > 0 || (ya - (yd - yb) / (xd - xb) * (xa - xb) - yb) * ...
#include <math.h> int main() { double xa, ya, xb, yb, xc, yc, xd, yd; while (0 <= scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &xa, &ya, &xb, &yb, &xc, &yc, &xd, &yd)) { if (xc == xa) { if ((xd - xc) * (xb - xc) > 0 || (ya - (yd - yb) / (xd - xb) * (xa - xb) - yb) * ...
[["-", 0, 16, 12, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 16, 12, 2, 3, 4, 0, 66, 28, 22]]
0
386
2
#include <math.h> #include <stdio.h> #include <stdlib.h> #define PI 3.14159265358979323 // int calc1(float a,float b,float c,float d,float e,float f,float *x,float *y); // void quick(int *,long long,long long); // int comp(char *a,char *b); int main() { float xa, ya, xb, yb, xc, yc, xd, yd; int flag; while (s...
#include <math.h> #include <stdio.h> #include <stdlib.h> #define PI 3.14159265358979323 // int calc1(float a,float b,float c,float d,float e,float f,float *x,float *y); // void quick(int *,long long,long long); // int comp(char *a,char *b); int main() { float xa, ya, xb, yb, xc, yc, xd, yd; int flag; while (s...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
246
6
#include <algorithm> #include <cctype> #include <cmath> #include <cstring> #include <iostream> #include <string> #include <utility> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for ...
#include <algorithm> #include <cctype> #include <cmath> #include <cstring> #include <iostream> #include <string> #include <utility> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
464
4
#include <algorithm> #include <complex> #include <cstdio> #include <iostream> #define EPS 1e-10 #define EQ(a, b) (abs(a - b) < EPS) #define EQV(a, b) (EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag())) using namespace std; typedef complex<double> P; double cross(P a, P b) { return (a.real() * b.imag() - a.imag...
#include <algorithm> #include <complex> #include <cstdio> #include <iostream> #define EPS 1e-10 #define EQ(a, b) (abs(a - b) < EPS) #define EQV(a, b) (EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag())) using namespace std; typedef complex<double> P; double cross(P a, P b) { return (a.real() * b.imag() - a.imag...
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22]]
1
284
2
#include <cstdio> #include <iostream> using namespace std; double isConvex(double xa, double ya, double xb, double yb, double x, double y) { double ret; ret = (xa - xb) * (y - ya) + (ya - yb) * (xa - x); return ret; } int main() { double xa, ya, xb, yb, xc, yc, xd, yd; while (scanf("%lf,%lf...
#include <cstdio> #include <iostream> using namespace std; double isConvex(double xa, double ya, double xb, double yb, double x, double y) { double ret; ret = (xa - xb) * (y - ya) + (ya - yb) * (xa - x); return ret; } int main() { double xa, ya, xb, yb, xc, yc, xd, yd; while (scanf("%lf,%lf...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
226
2
#include <iostream> #include <stdlib.h> #include <string> #include <vector> using namespace std; struct Point { Point(double _x, double _y) : x(_x), y(_y) {} double x; double y; }; typedef Point Vector; bool isConvex(Point &P1, Point &P2, Point &P3) { Vector V1(P1.x - P2.x, P1.y - P2.y); Vector V2(P3.x - P2.x...
#include <iostream> #include <stdlib.h> #include <string> #include <vector> using namespace std; struct Point { Point(double _x, double _y) : x(_x), y(_y) {} double x; double y; }; typedef Point Vector; bool isConvex(Point &P1, Point &P2, Point &P3) { Vector V1(P1.x - P2.x, P1.y - P2.y); Vector V2(P3.x - P2.x...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13]]
1
629
2
#include <bits/stdc++.h> using namespace std; #define FOR(i, s, n) for (int i = s; i < (int)n; i++) #define per(i, n) for (int i = n; i >= 0; i--) #define ROF(i, s, n) for (int i = s; i >= (int)n; i--) #define FORIT(i, A) for (auto i : A) #define PRINT(x) cout << (x) << "\n" #define ALL(a) (a).begin(), (a).end() #defin...
#include <bits/stdc++.h> using namespace std; #define FOR(i, s, n) for (int i = s; i < (int)n; i++) #define per(i, n) for (int i = n; i >= 0; i--) #define ROF(i, s, n) for (int i = s; i >= (int)n; i--) #define FORIT(i, A) for (auto i : A) #define PRINT(x) cout << (x) << "\n" #define ALL(a) (a).begin(), (a).end() #defin...
[["-", 0, 2, 3, 4, 0, 41, 15, 91, 17, 111]]
1
665
1
#include <cstdio> #include <iostream> using namespace std; int main() { double x[4], y[4]; char c; while (cin >> x[0] >> c >> y[0] >> c >> x[1] >> c >> y[1] >> c >> x[2] >> c >> y[2] >> c >> x[3] >> c >> y[3]) { double a[4], b[4]; for (int i = 0; i < 4; i++) { a[i] = x[(i + 1) % 4] - x[i];...
#include <cstdio> #include <iostream> using namespace std; int main() { double x[4], y[4]; char c; while (cin >> x[0] >> c >> y[0] >> c >> x[1] >> c >> y[1] >> c >> x[2] >> c >> y[2] >> c >> x[3] >> c >> y[3]) { double a[4], b[4]; for (int i = 0; i < 4; i++) { a[i] = x[(i + 1) % 4] - x[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
272
4
#include <algorithm> #include <complex> #include <cstdio> #include <iostream> #include <vector> #define P complex<double> using namespace std; bool cmp_p(const P &a, const P &b) { return a.real() == b.real() ? a.imag() < b.imag() : a.real() < b.real(); } double det(P a, P b) { return a.real() * b.imag() - b.real() ...
#include <algorithm> #include <complex> #include <cstdio> #include <iostream> #include <vector> #define P complex<double> using namespace std; bool cmp_p(const P &a, const P &b) { return a.real() == b.real() ? a.imag() < b.imag() : a.real() < b.real(); } double det(P a, P b) { return a.real() * b.imag() - b.real() ...
[["-", 0, 14, 8, 9, 0, 37, 0, 16, 17, 72], ["+", 8, 9, 0, 37, 0, 16, 12, 16, 17, 48]]
1
440
2
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <typeinfo> #include <vector> #define PI 3.14159265359 #define INF 99999999 #define rep(i, n...
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <typeinfo> #include <vector> #define PI 3.14159265359 #define INF 99999999 #define rep(i, n...
[["-", 15, 339, 51, 16, 31, 16, 31, 16, 17, 47], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 18], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 17, 47], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 18], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18]]
1
586
6
#include <iostream> using namespace std; struct Vector { double x; double y; }; bool is_c_inner(double xa, double ya, double xb, double yb, double xc, double yc, double xd, double yd) { Vector ab = Vector{xb - xa, yb - ya}; Vector bc = Vector{xc - xb, yc - yb}; Vector bd = Vector{xd - xb, ...
#include <iostream> using namespace std; struct Vector { double x; double y; }; bool is_c_inner(double xa, double ya, double xb, double yb, double xc, double yc, double xd, double yd) { Vector ab = Vector{xb - xa, yb - ya}; Vector bc = Vector{xc - xb, yc - yb}; Vector bd = Vector{xd - xb, ...
[["-", 0, 37, 0, 16, 12, 23, 0, 16, 17, 106], ["+", 0, 16, 12, 23, 0, 16, 31, 16, 17, 98], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 79], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
385
6
#include <stdio.h> int main(void) { int in[5] = {0}; while (scanf("%d,", &in[0]) != EOF) { scanf("%d,%d,%d,%d", &in[1], &in[2], &in[3], &in[4]); int sort[5] = {0}; int i, j; int datesu = 0; for (i = 0; i < 5; i++) { for (j = datesu - 1; j >= 0; j--) { if (in[i] > sort[j]) ...
#include <stdio.h> int main(void) { int in[5] = {0}; while (scanf("%d,", &in[0]) != EOF) { scanf("%d,%d,%d,%d", &in[1], &in[2], &in[3], &in[4]); int sort[5] = {0}; int i, j; int datesu = 0; for (i = 0; i < 5; i++) { for (j = datesu - 1; j >= 0; j--) { if (in[i] > sort[j]) ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
509
2
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include <utility> #include <vector> using namespace std; #define ll long long #de...
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdlib.h> #include <string.h> #include <string> #include <utility> #include <vector> using namespace std; #define ll long long #de...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
430
2
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main() { int a, b, c, d, e; char x; while (cin >> a >> x >> b >> x >> c ...
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main() { int a, b, c, d, e; char x; while (cin >> a >> x >> b >> x >> c ...
[["-", 0, 57, 64, 1, 0, 11, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 11, 12, 5, 0, 6]]
1
367
2
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { vector<int> c(5); while (~scanf("%d", &c[0])) { int p = 0; int tc = 0; for (int i = 1; i < 5; i++) scanf(",%d", &c[i]); sort(c.begin(), c.end()); for (int i = 0; i < 5; i++) { ...
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { vector<int> c(5); while (~scanf("%d", &c[0])) { int p = 0; int tc = 0; for (int i = 1; i < 5; i++) scanf(",%d", &c[i]); sort(c.begin(), c.end()); for (int i = 0; i < 5; i++) { ...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
286
2
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int check(vector<int> v) { sort(v.begin(), v.end()); // for (int i = 0; i < v.size(); i++)cout << v[i] << " "; if ((v[0] == v[1] && v[1] == v[2] && v[2] == v[3]) || (v[1] == v[2] && v[2] == v[3] && v[3] == v...
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int check(vector<int> v) { sort(v.begin(), v.end()); // for (int i = 0; i < v.size(); i++)cout << v[i] << " "; if ((v[0] == v[1] && v[1] == v[2] && v[2] == v[3]) || (v[1] == v[2] && v[2] == v[3] && v[3] == v[...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
717
2
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <complex> #include <list> #include <map> #include <queue> #include <stack> #include <vector> using namespace std; typedef complex<double> P; #define X real() #define Y imag() int main() { int mod = 1000000007; int ax, ay; char f[12][12]; ...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <complex> #include <list> #include <map> #include <queue> #include <stack> #include <vector> using namespace std; typedef complex<double> P; #define X real() #define Y imag() int main() { int mod = 1000000007; int ax, ay; char f[12][12]; ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 98], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
580
4
#include <bits/stdc++.h> using namespace std; int main() { int a[6] = {}; while (scanf("%d", &a[0]) != EOF) { for (int i = 1; i < 5; i++) scanf(",%d", &a[i]); int cnt = 0, flag = true, card[13] = {}, max = 4; sort(a, a + 5); for (int i = 0; i < 4; i++) for (int j = i + 1; j < 5; j++) ...
#include <bits/stdc++.h> using namespace std; int main() { int a[6] = {}; while (scanf("%d", &a[0]) != EOF) { for (int i = 1; i < 5; i++) scanf(",%d", &a[i]); int cnt = 0, flag = true, card[13] = {}, max = 4; sort(a, a + 5); for (int i = 0; i < 4; i++) for (int j = i + 1; j < 5; j++) ...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
308
2
#include <algorithm> #include <cstdio> using namespace std; int n[5]; int main() { while (scanf("%d,%d,%d,%d,%d", &n[0], &n[1], &n[2], &n[3], &n[4]) != EOF) { sort(n, n + 5); if ((n[0] == n[1] && n[1] == n[2] && n[2] == n[3]) || (n[1] == n[2] && n[2] == n[3] && n[3] == n[4])) printf("four card...
#include <algorithm> #include <cstdio> using namespace std; int n[5]; int main() { while (scanf("%d,%d,%d,%d,%d", &n[0], &n[1], &n[2], &n[3], &n[4]) != EOF) { sort(n, n + 5); if ((n[0] == n[1] && n[1] == n[2] && n[2] == n[3]) || (n[1] == n[2] && n[2] == n[3] && n[3] == n[4])) printf("four card...
[["-", 31, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["-", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["-", 0, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["-", 12, 23, 0, 16, 31, 16, 12, 16, 12...
1
536
10
#include <iostream> #include <stdio.h> using namespace std; int main() { int c[5]; while (scanf("%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4]) != EOF) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (c[j] > c[j + 1]) { int tmp = c[j]; c[j] = c[j + 1]; ...
#include <iostream> #include <stdio.h> using namespace std; int main() { int c[5]; while (scanf("%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4]) != EOF) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (c[j] > c[j + 1]) { int tmp = c[j]; c[j] = c[j + 1]; ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
609
4
#include <algorithm> #include <iostream> using namespace std; int main(void) { int a[5]; char c; while (cin >> a[0] >> c >> a[1] >> c >> a[2] >> c >> a[3] >> c >> a[4]) { int b[13] = {}; for (int i = 0; i < 5; ++i) ++b[a[i]]; sort(a, a + 5); sort(b, b + 13, greater<int>()); if (b[0] ==...
#include <algorithm> #include <iostream> using namespace std; int main(void) { int a[5]; char c; while (cin >> a[0] >> c >> a[1] >> c >> a[2] >> c >> a[3] >> c >> a[4]) { int b[14] = {}; for (int i = 0; i < 5; ++i) ++b[a[i]]; sort(a, a + 5); sort(b, b + 14, greater<int>()); if (b[0] ==...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
348
4
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include ...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include ...
[["-", 0, 57, 64, 1, 0, 11, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 11, 12, 5, 0, 6]]
1
557
2
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int straight(int[]); int main() { int ans, h[5]; while (scanf("%d,%d,%d,%d,%d", &h[0], &h[1], &h[2], &h[3], &h[4]) != EOF) { ans = 0; for (int i = 0; i < 4; i++) { for (int j = i + 1; j < 5; j++) { if (h[i] ==...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int straight(int[]); int main() { int ans, h[5]; while (scanf("%d,%d,%d,%d,%d", &h[0], &h[1], &h[2], &h[3], &h[4]) != EOF) { ans = 0; for (int i = 0; i < 4; i++) { for (int j = i + 1; j < 5; j++) { if (h[i] ==...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
350
4
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { vector<int> c(5); while (scanf("%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4]) != EOF) { int ans = 0; sort(c.begin(), c.end()); for (int i = 0; i < 5; i++) { if (i < 2) { if ...
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { vector<int> c(5); while (scanf("%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4]) != EOF) { int ans = 0; sort(c.begin(), c.end()); for (int i = 0; i < 5; i++) { if (i < 2) { if ...
[["-", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13]]
1
434
2
#include <cstdio> #include <iostream> #include <map> #include <string> using namespace std; int main() { int hand[5]; while (~scanf("%d", &hand[0])) { for (int i = 1; i < 5; i++) { scanf(",%d", &hand[i]); } int num[15] = {0}; for (int i = 0; i < 5; i++) { if (hand[i] == 1) nu...
#include <cstdio> #include <iostream> #include <map> #include <string> using namespace std; int main() { int hand[5]; while (~scanf("%d", &hand[0])) { for (int i = 1; i < 5; i++) { scanf(",%d", &hand[i]); } int num[15] = {0}; for (int i = 0; i < 5; i++) { if (hand[i] == 1) nu...
[["+", 8, 9, 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, 13]]
1
355
4
#include <cstdio> #include <iostream> using namespace std; int main() { int a, b, c, d, e; while (scanf("%d,%d,%d,%d,%d", &a, &b, &c, &d, &e) != EOF) { int cards[13] = {0}; int dbl = 0, thr = 0, four = 0, straight = 0, tmp = 0; cards[a - 1]++; cards[b - 1]++; cards[c - 1]++; cards[d - 1]++; ...
#include <cstdio> #include <iostream> using namespace std; int main() { int a, b, c, d, e; while (scanf("%d,%d,%d,%d,%d", &a, &b, &c, &d, &e) != EOF) { int cards[13] = {0}; int dbl = 0, thr = 0, four = 0, straight = 0, tmp = 0; cards[a - 1]++; cards[b - 1]++; cards[c - 1]++; cards[d - 1]++; ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
342
6
#include <algorithm> #include <cstdio> #include <iostream> #include <map> void check_multiplicity(const int *sorted_cards, std::map<int, int> &multiplicities) { multiplicities.clear(); const int *current = sorted_cards; const int *end = sorted_cards + 5; while (current != end) { co...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> void check_multiplicity(const int *sorted_cards, std::map<int, int> &multiplicities) { multiplicities.clear(); const int *current = sorted_cards; const int *end = sorted_cards + 5; while (current != end) { co...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
455
2
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { vector<int> a(5); while (~scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4])) { sort(a.begin(), a.end()); if (count(a.begin(), a.end(), a[3]) == 4) { cout << "four card" << endl; ...
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { vector<int> a(5); while (~scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4])) { sort(a.begin(), a.end()); if (count(a.begin(), a.end(), a[3]) == 4) { cout << "four card" << endl; ...
[["-", 31, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 31, 2, 3, 4, 0, 69, 341, 342, 0, 13]]
1
431
2
#include <algorithm> #include <iostream> using namespace std; int main(void) { int card[5]; char ten; while (cin >> card[0]) { cin >> ten >> card[1] >> ten >> card[2] >> ten >> card[3] >> ten >> card[4]; sort(card, card + 5); if (card[4] == card[1] || card[3] == card[0]) { // four card cou...
#include <algorithm> #include <iostream> using namespace std; int main(void) { int card[5]; char ten; while (cin >> card[0]) { cin >> ten >> card[1] >> ten >> card[2] >> ten >> card[3] >> ten >> card[4]; sort(card, card + 5); if (card[4] == card[1] || card[3] == card[0]) { // four card cou...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
516
2
#include <algorithm> #include <cstdio> using namespace std; int main() { int card[5]; while (scanf("%d", &card[0]) != EOF) { for (int i = 1; i < 5; i++) { scanf(",%d", &card[i]); } int cnt = 0; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { if (card[i] == card[j] ...
#include <algorithm> #include <cstdio> using namespace std; int main() { int card[5]; while (scanf("%d", &card[0]) != EOF) { for (int i = 1; i < 5; i++) { scanf(",%d", &card[i]); } int cnt = 0; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { if (card[i] == card[j] ...
[["+", 0, 99, 8, 9, 0, 100, 0, 93, 0, 94], ["+", 0, 99, 8, 9, 0, 100, 0, 93, 0, 35]]
1
359
2
#include <iostream> #include <stdio.h> using namespace std; int main() { int a[5]; int kari; char d; while (cin >> a[0] >> d >> a[1] >> d >> a[2] >> d >> a[3] >> d >> a[4]) { for (int i = 4; i > 0; i--) { for (int j = 0; j < i; j++) { if (a[j] > a[j + 1]) { kari = a[j]; ...
#include <iostream> #include <stdio.h> using namespace std; int main() { int a[5]; int kari; char d; while (cin >> a[0] >> d >> a[1] >> d >> a[2] >> d >> a[3] >> d >> a[4]) { for (int i = 4; i > 0; i--) { for (int j = 0; j < i; j++) { if (a[j] > a[j + 1]) { kari = a[j]; ...
[["+", 0, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 0, 16, 12, 16, 31, 69, 341, 342, 0, 73], ["+", 51, 16, 31, 23, 0, 16, 12, 16, 17, 60], ["+", 31, 23, 0, 16, 12, 16, 12, 69, 28, 22], ["+", 0, 16, 12, 16, 12, 69, 341, 342, 0, 70]]
1
720
5
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <ctype.h> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <ctype.h> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #includ...
[["-", 15, 339, 51, 16, 31, 16, 12, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 106]]
1
790
2
while gets do a = Array.new(13,0) $_.split(",").map(&:to_i).each do |i| a[i-1]+=1 end if a.member?(4) then puts "for card" elsif a.member?(2) then if a.member?(3) then puts "full house" elsif a.index(2) == a.rindex(2) then puts "one pair" else puts "two pair" end el...
while gets do a = Array.new(13,0) $_.split(",").map(&:to_i).each do |i| a[i-1]+=1 end if a.member?(4) then puts "four card" elsif a.member?(2) then if a.member?(3) then puts "full house" elsif a.index(2) == a.rindex(2) then puts "one pair" else puts "two pair" end e...
[["-", 64, 749, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 64, 749, 0, 652, 3, 4, 0, 557, 0, 6]]
4
139
2
while query = gets hand = query.chomp.split(",").map(&:to_i) cnt_max = hand.max_by{|x| hand.count(x)} same = hand.count(cnt_max) case same when 4 puts "four card" when 3 cnt_min = hand.min_by{|x| hand.count(x)} p cnt_min if hand.count(cnt_min) == 2 puts "full house" else puts "th...
while query = gets hand = query.chomp.split(",").map(&:to_i) cnt_max = hand.max_by{|x| hand.count(x)} same = hand.count(cnt_max) case same when 4 puts "four card" when 3 cnt_min = hand.min_by{|x| hand.count(x)} if hand.count(cnt_min) == 2 puts "full house" else puts "three card" ...
[["-", 0, 173, 0, 763, 8, 749, 0, 652, 735, 22], ["-", 0, 763, 8, 749, 0, 652, 3, 4, 0, 22]]
4
179
2
def q*a;a.delete a[0];a.empty?end $<.map{|x| a,b,c,d,e=x.chop.split(",").map(&:to_i).sort; puts case when q(a,b,c,d)||q(b,c,d,e);"four card" when a==b&&q(c,d,e)||q(a,b,c)&&d==e;"full house" when (s=[a,b,c,d,e])==(a..e).to_a||s==[10,11,12,13,1];"straight" when q(a,b,c)||q(b,c,d)||q(c,d,e);"three card" when...
def q*a;a.delete a[0];a.empty?end $<.map{|x| a,b,c,d,e=x.chop.split(",").map(&:to_i).sort; puts case when q(a,b,c,d)||q(b,c,d,e);"four card" when a==b&&q(c,d,e)||q(a,b,c)&&d==e;"full house" when (s=[a,b,c,d,e])==(a..e).to_a||s==[1,10,11,12,13];"straight" when q(a,b,c)||q(b,c,d)||q(c,d,e);"three card" when...
[["+", 374, 374, 0, 738, 12, 738, 12, 516, 0, 612], ["+", 374, 374, 0, 738, 12, 738, 12, 516, 0, 21], ["-", 374, 374, 0, 738, 12, 738, 12, 516, 0, 21], ["-", 374, 374, 0, 738, 12, 738, 12, 516, 0, 612]]
4
236
4
#encoding=utf-8 import sys def inp(): word = [] for line in sys.stdin: word = list(map(int, line.split(","))) syori(sorted(word)) def syori(word): flag = [0,0] if sum(word[1:5]) == 46: word.append(int(word[0])) del word[0] if word == [10,11,12,13,1]: print...
import sys def inp(): word = [] for line in sys.stdin: word = list(map(int, line.split(","))) syori(sorted(word)) def syori(word): flag = [0,0] if sum(word[1:5]) == 46: word.append(int(word[0])) del word[0] if word == [10,11,12,13,1]: print("straight") ...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
316
2
from collections import Counter import sys for t in sys.stdin: l=sorted(map(int,t[:-1].split(","))) s=False p1=Counter(l) p2=Counter(p1.values()) if 3 in p2 and 2 in p2: print("full house") elif 2 in p2: if p2[2]==1: print("one pair") elif p2[2]==2: ...
from collections import Counter import sys for t in sys.stdin: l=sorted(map(int,t[:-1].split(","))) s=False p1=Counter(l) p2=Counter(p1.values()) if 3 in p2 and 2 in p2: print("full house") elif 2 in p2: if p2[2]==1: print("one pair") elif p2[2]==2: ...
[["-", 75, 76, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 22]]
5
196
2
while True: try: nums = [0 for x in range(13)] hands = list(map(int,input().split(','))) for val in hands: nums[val-1] += 1 if 4 in nums: print('four card') else: if 3 in nums: if 2 in nums: print('full house') else: print('four card') else: if nums.count(2) == 2: print('two pair') elif...
while True: try: nums = [0 for x in range(13)] hands = list(map(int,input().split(','))) for val in hands: nums[val-1] += 1 if 4 in nums: print('four card') else: if 3 in nums: if 2 in nums: print('full house') else: print('three card') else: if nums.count(2) == 2: print('two pair') eli...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
170
2
while True: try: hand = list(map(int, input().split(","))) kind = list(set(hand)) rank =[] for card in kind: rank.append(hand.count(card)) rank.sort() rank.reverse() if rank[0] == 4: print("four card") elif rank[0] == 3:...
while True: try: hand = list(map(int, input().split(","))) kind = list(set(hand)) rank =[] for card in kind: rank.append(hand.count(card)) rank.sort() rank.reverse() if rank[0] == 4: print("four card") elif rank[0] == 3:...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
191
2
for (r = {I : 1, V : 5, X : 10, L : 50, C : 100, D : 500, M : 1000}, k = n = s = 0, j = require("fs").readFileSync("/dev/stdin", "utf8"); p = n, i = j[k]; k++) n = r[i] ? (s += n, n > p ? s -= p * 2 : 0) : (console.log(s), n = s = 0)
for (r = {I : 1, V : 5, X : 10, L : 50, C : 100, D : 500, M : 1000}, k = n = s = 0, j = require("fs").readFileSync("/dev/stdin", "utf8"); p = n, i = j[k]; k++) (n = r[i]) ? (s += n, n > p ? s -= p * 2 : 0) : (console.log(s), n = s = 0)
[["+", 0, 7, 8, 1, 0, 510, 15, 23, 0, 24], ["+", 0, 7, 8, 1, 0, 510, 15, 23, 0, 25]]
2
115
2
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) // CCW??¨/////////////////////////////////// static const int COUNTER_CLOCKWISE = 1; static const int CLOCKWISE = -1; static const int ONLINE_BACK = 2; static const...
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) // CCW??¨/////////////////////////////////// static const int COUNTER_CLOCKWISE = 1; static const int CLOCKWISE = -1; static const int ONLINE_BACK = 2; static const...
[["-", 31, 2, 3, 4, 0, 66, 28, 118, 28, 22], ["+", 31, 2, 3, 4, 0, 66, 28, 118, 28, 22]]
1
1,644
4
#include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cctype> // require tolower, toupper #include <cfloat> #include <climits> #include <cmath> // require fabs #include <cstdio> // require scanf printf #include <cstdlib> // require abs exit atof atoi #include <cstring> // requir...
#include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cctype> // require tolower, toupper #include <cfloat> #include <climits> #include <cmath> // require fabs #include <cstdio> // require scanf printf #include <cstdlib> // require abs exit atof atoi #include <cstring> // requir...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
2,937
2
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; class Point ...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; class Point ...
[["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
319
8
#include <algorithm> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define REP(n) rep(i, n) #define all(n) n.begin(), n.end() // vector(geometric) definition typedef complex<double> cdo...
#include <algorithm> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define REP(n) rep(i, n) #define all(n) n.begin(), n.end() // vector(geometric) definition typedef complex<double> cdo...
[["+", 12, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["+", 12, 2, 3, 4, 0, 16, 12, 23, 0, 25], ["-", 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
338
6
#include <complex> #include <cstdio> #include <iostream> bool read_data(std::complex<double> *points) { double coords[8]; for (int i = 0; i < 8; ++i) { if (scanf((i == 0) ? "%lf" : ",%lf", &coords[i]) != 1) { return false; } } for (int i = 0; i < 4; ++i) { points[i] = std::complex<double>(coo...
#include <complex> #include <cstdio> #include <iostream> bool read_data(std::complex<double> *points) { double coords[8]; for (int i = 0; i < 8; ++i) { if (scanf((i == 0) ? "%lf" : ",%lf", &coords[i]) != 1) { return false; } } for (int i = 0; i < 4; ++i) { points[i] = std::complex<double>(coo...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40]]
1
316
2
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
[["-", 0, 16, 12, 16, 12, 2, 63, 118, 119, 120], ["+", 0, 16, 12, 16, 12, 2, 63, 118, 119, 120]]
1
748
2
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <ctype.h> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <ctype.h> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #includ...
[["-", 51, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 51, 16, 12, 16, 12, 23, 0, 16, 12, 22]]
1
360
2
#include <algorithm> #include <iostream> using namespace std; int main() { char trash; double x[4], y[4]; while (cin >> x[0] >> trash >> y[0]) { double a, b, c, d, e, f, t, r; for (int i = 1; i < 4; i++) { cin >> trash >> x[i] >> trash >> y[i]; } a = y[2] - y[0]; b = -x[2] + x[0]; e...
#include <algorithm> #include <iostream> using namespace std; int main() { char trash; double x[4], y[4]; while (cin >> x[0] >> trash >> y[0]) { double a, b, c, d, e, f, t, r; for (int i = 1; i < 4; i++) { cin >> trash >> x[i] >> trash >> y[i]; } a = y[2] - y[0]; b = -x[2] + x[0]; e...
[["-", 31, 16, 12, 23, 0, 16, 12, 16, 17, 18], ["+", 31, 16, 12, 23, 0, 16, 12, 16, 17, 19], ["-", 51, 16, 12, 23, 0, 16, 12, 16, 17, 18], ["+", 51, 16, 12, 23, 0, 16, 12, 16, 17, 19]]
1
464
4