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
def check_bingo(board) board.each do |l| stone = l.first return stone if l.all?{ |x| x == stone } && stone != '+' end return false end def choose_winner(board) diagonal_board = [[0,1,2].map{|x| board[x][x]}, [0,1,2].map{|x| board[x][2-x]}] [board, board.transpose, diagonal_board].each do |b| sto...
def check_bingo(board) board.each do |l| stone = l.first return stone if l.all?{ |x| x == stone } && stone != '+' end return false end def choose_winner(board) diagonal_board = [[0,1,2].map{|x| board[x][x]}, [0,1,2].map{|x| board[x][2-x]}] [board, board.transpose, diagonal_board].each do |b| sto...
[["-", 0, 652, 196, 737, 8, 736, 0, 745, 0, 747], ["+", 0, 652, 196, 737, 8, 736, 0, 751, 0, 121]]
4
176
2
while True: try: f = [list(input()) for _ in range(3)] except EOFError: break g = ["".join(x) for x in f+list(zip(*f))+[f[0][0],f[1][1],f[2][2]]+[f[2][0]+f[1][1]+f[0][2]]] print("b" if "b"*3 in g else "w" if "w"*3 in g else "NA")
while True: try: f = [list(input()) for _ in range(3)] except EOFError: break g = ["".join(x) for x in f+list(zip(*f))+[(f[0][0],f[1][1],f[2][2])]+[(f[2][0],f[1][1],f[0][2])]] print("b" if "b"*3 in g else "w" if "w"*3 in g else "NA")
[["+", 12, 657, 31, 657, 12, 634, 0, 660, 0, 24], ["+", 12, 657, 31, 657, 12, 634, 0, 660, 0, 25], ["+", 0, 659, 12, 657, 12, 634, 0, 660, 0, 24], ["-", 12, 657, 12, 634, 0, 657, 31, 657, 17, 72], ["+", 0, 659, 12, 657, 12, 634, 0, 660, 0, 21], ["-", 0, 659, 12, 657, 12, 634, 0, 657, 17, 72], ["+", 0, 659, 12, 657, 12,...
5
132
8
#include <stdio.h> int main(void) { int all, peo, i, zero = 0, one = 0, two = 0, thr = 0, fou = 0, fiv = 0, six = 0; scanf("%d", &all); while (all != 0) { zero = 0; one = 0; two = 0; thr = 0; fou = 0; fiv = 0; six = 0; for (i = 0; i < all; i++) { scanf("%d...
#include <stdio.h> int main(void) { int all, peo, i, zero = 0, one = 0, two = 0, thr = 0, fou = 0, fiv = 0, six = 0; scanf("%d", &all); while (all != 0) { zero = 0; one = 0; two = 0; thr = 0; fou = 0; fiv = 0; six = 0; for (i = 0; i < all; i++) { scanf("%d...
[["-", 75, 76, 0, 57, 75, 76, 0, 57, 0, 121], ["-", 0, 57, 75, 76, 0, 57, 15, 23, 0, 24], ["-", 75, 76, 0, 57, 15, 23, 0, 16, 31, 22], ["-", 75, 76, 0, 57, 15, 23, 0, 16, 17, 18], ["-", 75, 76, 0, 57, 15, 23, 0, 16, 12, 13], ["-", 0, 57, 75, 76, 0, 57, 15, 23, 0, 25]]
0
269
6
#include <stdio.h> int main(void) { int n; int i; int age; int than_ten, ten, twen, thir, four, fif, six; while (1) { scanf("%d", &n); if (n == 0) { break; } than_ten = ten = twen = thir = four = fif = six = 0; for (i = 0; i < n; i++) { scanf("%d", &age); if (age >= ...
#include <stdio.h> int main(void) { int n; int i; int age; int than_ten, ten, twen, thir, four, fif, six; while (1) { scanf("%d", &n); if (n == 0) { break; } than_ten = ten = twen = thir = four = fif = six = 0; for (i = 0; i < n; i++) { scanf("%d", &age); if (age >= ...
[["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 19], ["-", 75, 76, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 23, 0, 16, 17, 19]]
0
226
12
#include <stdio.h> int main(void) { int n; int i; int age; int than_ten, ten, twen, thir, four, fif, six; while (1) { scanf("%d", &n); if (n == 0) { break; } than_ten = ten = twen = thir = four = fif = six = 0; for (i = 0; i < n; i++) { scanf("%d", &age); if (age >= ...
#include <stdio.h> int main(void) { int n; int i; int age; int than_ten, ten, twen, thir, four, fif, six; while (1) { scanf("%d", &n); if (n == 0) { break; } than_ten = ten = twen = thir = four = fif = six = 0; for (i = 0; i < n; i++) { scanf("%d", &age); if (age >= ...
[["-", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13], ["-", 75, 76, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 75, 76, 0, 57, 15, 23, 0, 16, 12, 13]]
0
226
12
#include <stdio.h> int main(void) { while (1) { int n; scanf("%d", &n); if (n == 0) break; int i, a[n]; for (i = 0; i < n; i++) { scanf("%d", &a[i]); } int p = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0; for (i = 0; i < n; i++) { if (a[i] < 10) { p++; }...
#include <stdio.h> int main(void) { while (1) { int n; scanf("%d", &n); if (n == 0) break; int i, a[n]; for (i = 0; i < n; i++) { scanf("%d", &a[i]); } int p = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0; for (i = 0; i < n; i++) { if (a[i] < 10) { p++; }...
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 19], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 20]]
0
319
10
a[7], n; main(b) { for (; scanf("%d", &n) && n; memset(a, 0, 28)) { for (; n--; b /= 10, a[b > 6 ? 6 : b]) scanf("%d", &b); for (; ++n < 7; printf("%d\n", a[n])) ; } }
a[7], n; main(b) { for (; scanf("%d", &n) && n; memset(a, 0, 28)) { for (; n--; b /= 10, a[b > 6 ? 6 : b]++) scanf("%d", &b); for (; ++n < 7; printf("%d\n", a[n])) ; } }
[["+", 8, 9, 0, 7, 26, 34, 12, 27, 17, 29]]
0
92
1
#include <stdio.h> int main(void) { int x[7], n, a, i; while (scanf("%d", &n) != EOF) { for (i = 0; i < 7; i++) x[i] = 0; for (i = 0; i < n; i++) { scanf("%d", &a); if (a < 10) x[0]++; else if (10 <= a && a < 20) x[1]++; else if (20 <= a && a < 30) x...
#include <stdio.h> int main(void) { int x[7], n, a, i; while (scanf("%d", &n), n) { for (i = 0; i < 7; i++) x[i] = 0; for (i = 0; i < n; i++) { scanf("%d", &a); if (a < 10) x[0]++; else if (10 <= a && a < 20) x[1]++; else if (20 <= a && a < 30) x[2]+...
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 79], ["-", 8, 9, 0, 52, 15, 23, 0, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 23, 0, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 23, 0, 34, 12, 22]]
0
221
4
a[7]; main(x, n) { for (; scanf("%d", &n), n;) { for (memset(a, 0, 28); n--;) scanf("%d", &x), x > 60 ? a[6]++ : a[x / 10]++; for (x = 0; x < 8; x++) printf("%d\n", a[x]); } exit(0); }
a[7]; main(x, n) { for (; scanf("%d", &n), n;) { for (memset(a, 0, 28); n--;) scanf("%d", &x), x > 60 ? a[6]++ : a[x / 10]++; for (x = 0; x < 7; x++) printf("%d\n", a[x]); } exit(0); }
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
0
106
2
#include <iostream> using namespace std; int main() { int n, in; int i; while (cin >> n && n != '0') { int k[7] = {0}; for (i = 0; i < n; i++) { cin >> in; if (in > 60) in = 60; (k[in / 10])++; } for (i = 0; i < 7; i++) { cout << k[i] << endl; } } return 0;...
#include <iostream> using namespace std; int main() { int n, in; int i; while (cin >> n && n != 0) { int k[7] = {0}; for (i = 0; i < n; i++) { cin >> in; if (in > 60) in = 60; (k[in / 10])++; } for (i = 0; i < 7; i++) { cout << k[i] << endl; } } return 0; }
[["-", 15, 339, 51, 16, 12, 16, 12, 103, 0, 104]]
1
110
2
#include <iostream> using namespace std; int judge(int); int main() { int n, age; for (;;) { int cnt[7] = {0}; cin >> n; if (n == 0) break; for (int i = 0; i < n; i++) { cin >> age; cnt[judge(age)]++; } for (int i = 0; i < 7; i++) cout << cnt[i] << endl; } r...
#include <iostream> using namespace std; int judge(int); int main() { int n, age; for (;;) { int cnt[7] = {0}; cin >> n; if (n == 0) break; for (int i = 0; i < n; i++) { cin >> age; cnt[judge(age)]++; } for (int i = 0; i < 7; i++) cout << cnt[i] << endl; } r...
[["+", 0, 14, 8, 9, 0, 37, 0, 2, 63, 22], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 25]]
1
120
5
// aoj0184 #include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { int agenum[7] = {}; for (int i = 0; i < n; i++) { int a; cin >> a; if (a < 10) { agenum[0] += 1; } else if (a < 20) { agenum[1] += 1; } else if (a < 30) { agen...
// aoj0184 #include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { int agenum[7] = {}; for (int i = 0; i < n; i++) { int a; cin >> a; if (a < 10) { agenum[0] += 1; } else if (a < 20) { agenum[1] += 1; } else if (a < 30) { agen...
[["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
191
2
#include <algorithm> #include <complex> #include <cstdio> #include <functional> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; typedef pair<int, int> P; int cnt[7]; int main() { int i, n, p; while (cin >> n && n) { for (i = 0; i < 7; i++) cnt[7] = 0; for...
#include <algorithm> #include <complex> #include <cstdio> #include <functional> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; typedef pair<int, int> P; int cnt[7]; int main() { int i, n, p; while (cin >> n && n) { for (i = 0; i < 7; i++) cnt[i] = 0; for...
[["-", 8, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 8, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
206
2
#include <iostream> using namespace std; int m, n; int p[7]; int main() { cin >> n; if (!n) return 0; for (int i = 0; i < 7; i++) p[i] = 0; for (int i = 0; i < n; i++) { cin >> m; if (m >= 70) m = 60; p[m / 10]++; } for (int i = 0; i < 7; i++) cout << p[i] << endl; }
#include <iostream> using namespace std; int m, n; int p[7]; int main() { while (true) { cin >> n; if (!n) return 0; for (int i = 0; i < 7; i++) p[i] = 0; for (int i = 0; i < n; i++) { cin >> m; if (m >= 70) m = 60; p[m / 10]++; } for (int i = 0; i < 7; ...
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 51, 146], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
117
6
import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().run(); } private void run() { Scanner scanner = new Scanner(System.in); int N = 1000000; boolean[] primes = new boolean[N + 1]; primes[0] = true; primes[1] = true; for (int i = 2; i <= Math.s...
import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().run(); } private void run() { Scanner scanner = new Scanner(System.in); int N = 1000000; boolean[] primes = new boolean[N + 1]; primes[0] = true; primes[1] = true; for (int i = 2; i <= Math.s...
[["+", 0, 7, 502, 503, 49, 200, 51, 16, 17, 33], ["+", 0, 7, 502, 503, 49, 200, 51, 16, 12, 499], ["-", 0, 16, 31, 91, 439, 504, 71, 16, 17, 33], ["-", 0, 16, 31, 91, 439, 504, 71, 16, 12, 499], ["-", 0, 16, 12, 91, 439, 504, 71, 16, 17, 72], ["-", 0, 16, 12, 91, 439, 504, 71, 16, 12, 499]]
3
221
6
def f(n, ans): for k, c in list(dic.items()): a, b = k if a == n: if not b in cost or c < cost[b]: cost[b] = c elif b == n: if not a in cost or c < cost[a]: cost[a] = c for k, c in sorted(list(cost.items()), key=lambda x: x[1]): ...
def f(n, ans): for k, c in list(dic.items()): a, b = k if a == n: if not b in cost or c < cost[b]: cost[b] = c elif b == n: if not a in cost or c < cost[a]: cost[a] = c for k, c in sorted(list(cost.items()), key=lambda x: x[1]): ...
[["-", 0, 57, 64, 196, 0, 688, 0, 206, 51, 22], ["+", 0, 57, 64, 196, 0, 688, 0, 206, 51, 22]]
5
255
2
def f(s, cost, route, ans): route.append(s) ans += cost[s] del cost[s] for k, c in list(data.items()): if s in k: a, b = k b = b if s == a else a if not b in route: if not b in cost or c < cost[b]: cost[b] = c if cost: s = s...
def f(s, cost, route, ans): route.append(s) ans += cost[s] del cost[s] for k, c in list(data.items()): if s in k: a, b = k b = b if s == a else a if not b in route: if not b in cost or c < cost[b]: cost[b] = c if cost: ...
[["-", 0, 14, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 14, 8, 196, 0, 57, 75, 76, 0, 102], ["-", 0, 52, 8, 196, 0, 7, 75, 76, 0, 95], ["-", 0, 52, 8, 196, 0, 7, 75, 76, 0, 102]]
5
227
4
#include <stdio.h> int n, m, d[110]; int f(int l, int r) { // printf("%d %d ",l,r); if (r - l < 1) return l; int mid = (l + r) / 2, c = 1, i, s = 0; for (i = 0; i < n; i++) { if (s + d[i] > mid) { s = 0; c++; } s += d[i]; if (mid < d[i]) { c = 100; break; } } // p...
#include <stdio.h> int n, m, d[110]; int f(int l, int r) { // printf("%d %d ",l,r); if (r - l < 1) return l; int mid = (l + r) / 2, c = 1, i, s = 0; for (i = 0; i < n; i++) { if (s + d[i] > mid) { s = 0; c++; } s += d[i]; if (mid < d[i]) { c = 1000; break; } } // ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13]]
0
211
4
#include <iostream> using namespace std; int main() { int n, m; while (1) { cin >> n >> m; if (n == 0 && m == 0) { break; } int hon[150]; for (int i = 0; i < m; i++) { cin >> hon[i]; } int right, left; right = left = 0; for (int i = 0; i < m; i++) { left += ...
#include <iostream> using namespace std; int main() { int n, m; while (1) { cin >> n >> m; if (n == 0 && m == 0) { break; } int hon[150]; for (int i = 0; i < m; i++) { cin >> hon[i]; } int right, left; right = left = 0; for (int i = 0; i < m; i++) { left += ...
[["-", 0, 1, 0, 2, 3, 4, 0, 74, 0, 24], ["-", 0, 2, 3, 4, 0, 74, 39, 77, 39, 40], ["-", 0, 1, 0, 2, 3, 4, 0, 74, 0, 25], ["-", 0, 1, 0, 2, 3, 4, 0, 74, 51, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
269
5
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); i++) #define reps(i, n) for (int i = 1; i <= int(n); i++) #define f first #define s second int main() { while (1) { int n, m; cin ...
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); i++) #define reps(i, n) for (int i = 1; i <= int(n); i++) #define f first #define s second int main() { while (1) { int n, m; cin ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
224
2
#include <stdio.h> int m, n, a[100]; bool check(int x) { int pos = 0, r = 0; for (int i = 0; i < m; i++) { while (pos != n && r + a[pos] <= x) r += a[pos++]; if (pos == n) return true; r = 0; } return false; } int main() { while (scanf("%d%d", &m, &n), n) { for (int i = 0; i < n; i...
#include <stdio.h> int m, n, a[100]; bool check(int x) { int pos = 0, r = 0; for (int i = 0; i < m; i++) { while (pos != n && r + a[pos] <= x) r += a[pos++]; if (pos == n) return true; r = 0; } return false; } int main() { while (scanf("%d%d", &m, &n), n) { for (int i = 0; i < n; i...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["-", 0, 57, 75, 76, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 31, 22]]
1
192
4
#include <iostream> using namespace std; int m, n; int a[1000]; bool check(int v) { int cnt = 0, s = 0; for (int i = 0; i < n; i++) { if (a[i] > v) return false; } for (int i = 0; i < n; i++) { if (s + a[i] > v) { cnt++; s = a[i]; } else { s += a[i]; } } if (cnt > m) ...
#include <iostream> using namespace std; int m, n; int a[1000]; bool check(int v) { int cnt = 0, s = 1000000000; for (int i = 0; i < n; i++) { if (a[i] > v) return false; } for (int i = 0; i < n; i++) { if (s + a[i] > v) { cnt++; s = a[i]; } else { s += a[i]; } } if (...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
264
2
#include <algorithm> #include <iostream> using namespace std; int main() { int m, n; while (cin >> m >> n, m, n) { int w[110]; int f = 0; for (int i = 0; i < n; i++) { cin >> w[i]; f = max(w[i], f); } while (1) { int p = 1, q = f; for (int i = 0; i < n; i++) { if ...
#include <algorithm> #include <iostream> using namespace std; int main() { int m, n; while (cin >> m >> n, m, n) { int w[110]; int f = 0; for (int i = 0; i < n; i++) { cin >> w[i]; f = max(w[i], f); } while (1) { int p = 1, q = f; for (int i = 0; i < n; i++) { if ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 107], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29]]
1
159
3
#include <cstdio> #include <cstring> // require memset #include <fstream> // require freopen #include <iostream> using namespace std; const int MaxW = 1500000; int m, n; // –{’I‚Ì’i” 1 … m … 20, –{‚ÌŠª” 1 … n … 100 int w[100]; bool calc_m(int curr_w) { int l[20]; memset(l, 0, sizeof(l)); int j = 0; ...
#include <cstdio> #include <cstring> // require memset #include <fstream> // require freopen #include <iostream> using namespace std; const int MaxW = 1500000; int m, n; // –{’I‚Ì’i” 1 … m … 20, –{‚ÌŠª” 1 … n … 100 int w[100]; bool calc_m(int curr_w) { int l[20]; memset(l, 0, sizeof(l)); int j = 0; ...
[["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 7, 8, 9, 0, 52, 0, 89], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98]]
1
281
6
#include <cstdio> #include <iostream> #include <vector> using namespace std; vector<int> books; int m, n; bool judge(int obs) { int sum = 0; int cont = 1; for (int i = 0; i < books.size(); i++) { if (books[i] > obs) return false; if (sum + books[i] > obs) { cont++; sum = 0; } ...
#include <cstdio> #include <iostream> #include <vector> using namespace std; vector<int> books; int m, n; bool judge(int obs) { int sum = 0; int cont = 1; for (int i = 0; i < books.size(); i++) { if (books[i] > obs) return false; if (sum + books[i] > obs) { cont++; sum = 0; } ...
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
225
6
#include <iostream> #include <vector> using namespace std; int n, m; vector<int> v; bool f(int sz) { int temp = sz; int ret = 1; for (int i = 0; i < m; i++) { if (sz - v[i] >= 0) { sz -= v[i]; } else { ret++; sz = temp - v[i]; } } return ret <= n; } int main() { while (cin >> ...
#include <iostream> #include <vector> using namespace std; int n, m; vector<int> v; bool f(int sz) { int temp = sz; int ret = 1; for (int i = 0; i < m; i++) { if (sz - v[i] >= 0) { sz -= v[i]; } else { ret++; sz = temp - v[i]; } } return ret <= n; } int main() { while (cin >> n...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
224
4
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ...
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 15, 339, 51, 16, 12, 16, 31, 69, 28, 22], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 22], ["+", 51, 16, 12, 16, 31, 69, 341,...
1
459
9
#include <bits/stdc++.h> using namespace std; int main() { for (int m, n; cin >> m >> n && (m | n);) { vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } int l = *min_element(a.begin(), a.end()), r = 1500001; while (r - l > 1) { int mid = (l + r) / 2; int x = 0, y = ...
#include <bits/stdc++.h> using namespace std; int main() { for (int m, n; cin >> m >> n && (m | n);) { vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } int l = *max_element(a.begin(), a.end()), r = 1500001; while (r - l) { int mid = (l + r) / 2; int x = 0, y = 1; ...
[["-", 0, 43, 49, 50, 51, 66, 28, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 66, 28, 2, 63, 22], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
198
4
#include <algorithm> #include <iostream> using namespace std; int n; int a[50]; bool b[50]; bool pourAll(int p); bool pour(int p, int q, int rest) { if (!rest) { return pourAll(p + 1); } if (q == n) { return false; } if (!b[q] && a[q] <= rest) { b[q] = true; if (pour(p, q + 1, rest - a[q]))...
#include <algorithm> #include <iostream> using namespace std; int n; int a[50]; bool b[50]; bool pourAll(int p); bool pour(int p, int q, int rest) { if (!rest) { return pourAll(p + 1); } if (q == n) { return false; } if (!b[q] && a[q] <= rest) { b[q] = true; if (pour(p, q + 1, rest - a[q]))...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
333
2
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; bool dfs(int i); int n, a[50]; bool fil[50]; bool dfs2(int i, int j, int rem) { if (rem == 0) return dfs(i + 1); if (j == n) return false; if (!fil[j] && a[j] <= rem) { fil[j] = true; if (dfs2(i, j + 1...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; bool dfs(int i); int n, a[50]; bool fil[50]; bool dfs2(int i, int j, int rem) { if (rem == 0) return dfs(i + 1); if (j == n) return false; if (!fil[j] && a[j] <= rem) { fil[j] = true; if (dfs2(i, j + 1...
[["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
279
3
#include <iostream> using namespace std; int search(int s); int num[50], a[50], u[50], d[51], n, g; int fnd(int v, int t, int s, int k) { int i, j, w = -1; if (k == 0) { j = a[v]; a[v] = 0; if (g == n || search(s + 1) == 1) return 1; a[v] = j; return 0; } if (k > d[s] || t == n - 1) ...
#include <iostream> using namespace std; int search(int s); int num[50], a[50], u[50], d[51], n, g; int fnd(int v, int t, int s, int k) { int i, j, w = -1; if (k == 0) { j = a[v]; a[v] = 0; if (g == n || search(t + 1) == 1) return 1; a[v] = j; return 0; } if (k > d[s] || t == n - 1) ...
[["-", 12, 16, 31, 2, 3, 4, 0, 16, 31, 22], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 31, 22]]
1
618
2
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var Arr = (input.replace(/\n$/, "")).split("\n"); while (true) { var x = Arr.shift().split(""); if (x[0] == "0") break; var y = Arr.shift().split(""); var z = Arr.shift().split(""); var ans = "NA"; for (var i = 0; i < 2; i++) { var s = ([...
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var Arr = (input.replace(/\n$/, "")).split("\n"); while (true) { var x = Arr.shift().split(""); if (x[0] == "0") break; var y = Arr.shift().split(""); var z = Arr.shift().split(""); var ans = "NA"; for (var i = 0; i < 2; i++) { var s = ([...
[["-", 8, 556, 0, 1, 0, 2, 3, 3, 0, 22], ["+", 8, 556, 0, 1, 0, 2, 3, 3, 0, 22]]
2
373
2
import java.util.Scanner; public class Main { char[][] data; private char check(int x, int y) { char ans = data[y][x]; // tate if (ans == data[y + 1][x] && ans == data[y - 1][x]) { return ans; } // yoko if (ans == data[y][x + 1] && ans == data[y][x + 1]) { return ans; } ...
import java.util.Scanner; public class Main { char[][] data; private char check(int x, int y) { char ans = data[y][x]; // tate if (ans == data[y + 1][x] && ans == data[y - 1][x]) { return ans; } // yoko if (ans == data[y][x + 1] && ans == data[y][x - 1]) { return ans; } ...
[["-", 0, 16, 12, 16, 12, 504, 71, 16, 17, 72], ["+", 0, 16, 12, 16, 12, 504, 71, 16, 17, 33]]
3
565
2
#include <stdio.h> int main(void) { char str[3][3]; int i, j; int flag = 0; while (scanf(" %c", &str[0][0])) { if (str[0][0] == '0') { break; } else { scanf(" %c", &str[0][1]); scanf(" %c", &str[0][2]); for (i = 1; i < 3; i++) { for (j = 0; j < 3; j++) { scanf("...
#include <stdio.h> int main(void) { char str[3][3]; int i, j; int flag = 0; while (scanf(" %c", &str[0][0])) { if (str[0][0] == '0') { break; } else { scanf(" %c", &str[0][1]); scanf(" %c", &str[0][2]); for (i = 1; i < 3; i++) { for (j = 0; j < 3; j++) { scanf("...
[["-", 0, 1, 0, 2, 3, 4, 0, 69, 71, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 71, 13]]
0
780
2
#include <stdio.h> /** Application main entry point. */ int main(int argc, char *argv[]) { for (;;) { char d[4][8]; scanf(" %s", d[0]); if (d[0][0] == '0') break; scanf(" %s", d[1]); scanf(" %s", d[2]); if (d[0][0] != '+' && ((d[0][0] == d[0][1] && d[0][0] == d[0][2]) || ...
#include <stdio.h> /** Application main entry point. */ int main(int argc, char *argv[]) { for (;;) { char d[4][8]; scanf(" %s", d[0]); if (d[0][0] == '0') break; scanf(" %s", d[1]); scanf(" %s", d[2]); if (d[0][0] != '+' && ((d[0][0] == d[0][1] && d[0][0] == d[0][2]) || ...
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
0
475
1
#include <iostream> #include <string> #include <vector> using namespace std; int main() { while (1) { vector<string> v; for (int i = 0; i < 3; i++) { string str; cin >> str; if (str == "0") goto EXIT; v.push_back(str); } for (int i = 0; i < 2; i++) { bool tate, ...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { while (1) { vector<string> v; for (int i = 0; i < 3; i++) { string str; cin >> str; if (str == "0") goto EXIT; v.push_back(str); } for (int i = 0; i < 2; i++) { bool tate, ...
[["-", 8, 9, 0, 1, 0, 11, 12, 11, 12, 147], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 12, 146]]
1
252
2
#include <cmath> #include <iostream> #include <string> #include <vector> typedef unsigned long long ull; #define rep(i, a) for (int i = 0; i < a; i++) #define loop(i, a, b) for (int i = a; i < b; i++) using namespace std; const double eps = 1e-10; const double pi = acos(-1); const double inf = (int)1e8; int main(void)...
#include <cmath> #include <iostream> #include <string> #include <vector> typedef unsigned long long ull; #define rep(i, a) for (int i = 0; i < a; i++) #define loop(i, a, b) for (int i = a; i < b; i++) using namespace std; const double eps = 1e-10; const double pi = acos(-1); const double inf = (int)1e8; int main(void)...
[["-", 31, 16, 12, 69, 28, 69, 341, 342, 0, 13], ["+", 31, 16, 12, 69, 28, 69, 341, 342, 0, 22], ["-", 31, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["+", 31, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["-", 12, 16, 12, 69, 28, 69, 341, 342, 0, 13], ["+", 12, 16, 12, 69, 28, 69, 341, 342, 0, 22], ["-", 31, 16, 12, 16, 12, 69, 3...
1
442
8
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i+...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i+...
[["-", 12, 16, 12, 69, 28, 69, 341, 342, 0, 13], ["+", 12, 16, 12, 69, 28, 69, 341, 342, 0, 13]]
1
431
2
#include <iostream> #include <string> using namespace std; char T[3][3]; string blackwhite() { for (int i = 0; i < 3; i++) { if (T[i][0] == T[i][1] && T[i][1] == T[i][2]) { if (T[i][0] == 'b') { return "b"; } if (T[i][0] == 'w') { return "w"; } } } for (int i = 0;...
#include <iostream> #include <string> using namespace std; char T[3][3]; string blackwhite() { for (int i = 0; i < 3; i++) { if (T[i][0] == T[i][1] && T[i][1] == T[i][2]) { if (T[i][0] == 'b') { return "b"; } if (T[i][0] == 'w') { return "w"; } } } for (int i = 0;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13]]
1
482
6
#include <iostream> using namespace std; int main() { int i; string s[3], ans; while (cin >> s[0] >> s[1] >> s[2], s[0] != "0") { ans = "NA"; for (i = 0; i < 3; i++) { if (s[i][0] != '+' && s[i][0] == s[i][1] && s[i][0] == s[i][2]) ans = s[i][0]; if (s[0][i] != '+' && s[0][i] == s[1][...
#include <iostream> using namespace std; int main() { int i; string s[3], ans; while (cin >> s[0] >> s[1] >> s[2], s[0] != "0") { ans = "NA"; for (i = 0; i < 3; i++) { if (s[i][0] != '+' && s[i][0] == s[i][1] && s[i][0] == s[i][2]) ans = s[i][0]; if (s[0][i] != '+' && s[0][i] == s[1][...
[["-", 12, 16, 12, 69, 28, 69, 341, 342, 0, 13], ["+", 12, 16, 12, 69, 28, 69, 341, 342, 0, 13], ["-", 31, 16, 12, 16, 12, 69, 341, 342, 0, 13], ["+", 31, 16, 12, 16, 12, 69, 341, 342, 0, 13]]
1
304
4
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string str; while (cin >> str && str != "0") { vector<string> field; field.push_back(str); for (int i = 0; i < 2; i++) { cin >> str; field.push_back(str); } bool fin = fa...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string str; while (cin >> str && str != "0") { vector<string> field; field.push_back(str); for (int i = 0; i < 2; i++) { cin >> str; field.push_back(str); } bool fin = fa...
[["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46]]
1
421
2
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, c) ...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, c) ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 152], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 151], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
244
4
#include <algorithm> #include <cstring> #include <iostream> #include <map> #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() const int FF = 255, F = 16; string name[] = {"black", "blue", "lime", "aqua...
#include <algorithm> #include <cstring> #include <iostream> #include <map> #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() const int FF = 255, F = 16; string name[] = {"black", "blue", "lime", "aqua...
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
1
371
2
import math def solve(line): R = int(line[1:3], 16) G = int(line[3:5], 16) B = int(line[5:7], 16) sa_black = math.sqrt(R**2 + G**2 + B**2) sa_max = sa_black ans_color = "black" sa_blue = math.sqrt(R**2 + G**2 + (B - 255)**2) if sa_blue < sa_max: sa_max = sa_blue ans_color = "blue" sa_lime = math.sqr...
import math def solve(line): R = int(line[1:3], 16) G = int(line[3:5], 16) B = int(line[5:7], 16) sa_black = math.sqrt(R**2 + G**2 + B**2) sa_max = sa_black ans_color = "black" sa_blue = math.sqrt(R**2 + G**2 + (B - 255)**2) if sa_blue < sa_max: sa_max = sa_blue ans_color = "blue" sa_lime = math.sqr...
[["-", 64, 196, 0, 1, 0, 662, 12, 557, 0, 6], ["+", 64, 196, 0, 1, 0, 662, 12, 557, 0, 6]]
5
363
2
#include <bits/stdc++.h> #include <math.h> #include <stdio.h> #include <string.h> using namespace std; #define EPS 1e-10 #define EQ(a, b) (fabs(a - b) < EPS) int main(void) { const long double radius = 6378.1; const long double pi = acos(-1); long double x[2], y[2]; long double dx; long double d; while (...
#include <bits/stdc++.h> #include <math.h> #include <stdio.h> #include <string.h> using namespace std; #define EPS 1e-10 #define EQ(a, b) (fabs(a - b) < EPS) int main(void) { const long double radius = 6378.1; const long double pi = acos(-1); long double x[2], y[2]; long double dx; long double d; while (...
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["-", 0, 16, 31, 16, 12, 74, 39, 77, 39, 40], ["-", 0, 1, 0, 16, 31, 16, 12, 74, 0, 25], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
231
4
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; ld pi = acos(-1.0); const ld dtop = pi / 180.; const ld ptod = 1. / dtop; ld rad = 6378.1; int...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; ld pi = acos(-1.0); const ld dtop = pi / 180.; const ld ptod = 1. / dtop; ld rad = 6378.1; int...
[["-", 49, 50, 51, 16, 12, 23, 0, 2, 63, 22], ["+", 49, 50, 51, 16, 12, 23, 0, 2, 63, 22]]
1
295
2
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; //// < "d:\d_download\visual studio ///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual ///studio 2015\projects\programin...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; const ld eps = 1e-9; //// < "d:\d_download\visual studio ///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual ///studio 2015\projects\programin...
[["+", 49, 50, 51, 4, 0, 16, 31, 16, 31, 13], ["+", 49, 50, 51, 4, 0, 16, 31, 16, 17, 48], ["+", 49, 50, 51, 4, 0, 16, 31, 16, 12, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72]]
1
570
4
#include <algorithm> #include <iostream> using namespace std; #define REP(i, b, n) for (int i = b; i < n; i++) #define rep(i, n) REP(i, 0, n) // const int N = 6000; const int N = 10; bool block[N][5]; void output() { cout << "Begin" << endl; rep(i, 10) { rep(j, 5) { cout << block[9 - i][j] << " "; } cout ...
#include <algorithm> #include <iostream> using namespace std; #define REP(i, b, n) for (int i = b; i < n; i++) #define rep(i, n) REP(i, 0, n) const int N = 6000; // const int N = 10; bool block[N][5]; void output() { cout << "Begin" << endl; rep(i, 10) { rep(j, 5) { cout << block[9 - i][j] << " "; } cout ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
514
2
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> using nam...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> using nam...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
1
632
2
#define _USE_MATH_DEFINES #define MAX_N 1000000 #include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> using namespace std; typedef long long ...
#define _USE_MATH_DEFINES #define MAX_N 1000000 #include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> using namespace std; typedef long long ...
[["-", 31, 69, 28, 69, 341, 342, 0, 16, 17, 72], ["-", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13]]
1
707
2
while True: n=eval(input()) if n==0:break hmax=10000 block=[list(map(int,input().split())) for i in range(n)] field=[[0]*5 for i in range(hmax)] h=0 for d,p,q in block: if d==1: for li in range(h+1,-2,-1): if field[li][q-1:q+p-1]!=[0]*p or li==-1: field[li+1][q-1:q+p-1]=[1]*p h=max(h,li+1) ...
while True: n=eval(input()) if n==0:break hmax=10000 block=[list(map(int,input().split())) for i in range(n)] field=[[0]*5 for i in range(hmax)] h=0 for d,p,q in block: if d==1: for li in range(h+2,-2,-1): if field[li][q-1:q+p-1]!=[0]*p or li==-1: field[li+1][q-1:q+p-1]=[1]*p h=max(h,li+1+1) ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["-", 0, 662, 12, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 22]]
5
298
8
// Aizu Vol-1 0179: Mysterious Worm // 2017.8.22 bal4u@uu #include <stdio.h> #include <string.h> #define MAX 0xaaaaa #define QMAX 5000000 char chk[MAX + 10]; int Q[QMAX + 10], *top, *end, *qmax = Q + QMAX; int N, K, mask; int nxt[16] = {0, 10, 5, 0, 10, 5, 0, 0, 5, 0, 10}; int main() { int s, r, g, b, step; int...
// Aizu Vol-1 0179: Mysterious Worm // 2017.8.22 bal4u@uu #include <stdio.h> #include <string.h> #define MAX 0xaaaaa #define QMAX 5000000 char chk[MAX + 10]; int Q[QMAX + 10], *top, *end, *qmax = Q + QMAX; int N, K, mask; int nxt[16] = {0, 10, 5, 0, 10, 5, 0, 0, 5, 0, 10}; int main() { int s, r, g, b, step; int...
[["-", 8, 9, 0, 57, 15, 23, 0, 91, 17, 111], ["+", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117], ["+", 0, 7, 8, 9, 0, 57, 64, 116, 0, 35]]
0
480
3
#include <stdio.h> int main(void) { int x, a, b, c, d; while (1) { scanf("%d%d", &a, &b); if (a == 0 && b == 0 || (c = a + b)) { break; } d = 0; for (x = 1; x < 5; x++) { scanf("%d%d", &a, &b); if (a + b > c) { c = a + b; d = x; } } printf("%c %d\...
#include <stdio.h> int main(void) { int x, a, b, c, d; while (1) { scanf("%d%d", &a, &b); if (a == 0 && b == 0 || !(c = a + b)) { break; } d = 0; for (x = 1; x < 5; x++) { scanf("%d%d", &a, &b); if (a + b > c) { c = a + b; d = x; } } printf("%c %d...
[["+", 0, 57, 15, 23, 0, 16, 12, 91, 17, 111]]
0
132
10
#include <stdio.h> int main(void) { int bn, an; int maxi; char maxi_c; int i; while (scanf("%d %d", &bn, &an) * bn != 0) { maxi = bn + an; maxi_c = 'A'; for (i = 0; i < 4; i++) { scanf("%d %d", &bn, &an); if (maxi < bn + an) { maxi = bn + an; maxi_c = 'A' + i; }...
#include <stdio.h> int main(void) { int bn, an; int maxi; char maxi_c; int i; while (scanf("%d %d", &bn, &an) * bn != 0) { maxi = bn + an; maxi_c = 'A'; for (i = 0; i < 4; i++) { scanf("%d %d", &bn, &an); if (maxi < bn + an) { maxi = bn + an; maxi_c = 'A' + i + 1; ...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
0
123
2
#include <stdio.h> int main(void) { int m, a; int i; int sum[5]; int max; char c; while (1) { scanf("%d %d", &m, &a); if (m + a == 0) { break; } max = m + a; c = 'A'; for (i = 1; i < 4; i++) { scanf("%d %d", &m, &a); sum[i] = m + a; if (max < sum[i]) { ...
#include <stdio.h> int main(void) { int m, a; int i; int sum[5]; int max; char c; while (1) { scanf("%d %d", &m, &a); if (m + a == 0) { break; } max = m + a; c = 'A'; for (i = 1; i < 5; i++) { scanf("%d %d", &m, &a); sum[i] = m + a; if (max < sum[i]) { ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
0
152
2
#include <stdio.h> int main(void) { int x, a, b, c, d; while (1) { scanf("%d%d", &a, &b); if ((c = a + b) == 0) break; for (x = 1; x < 5; x++) { scanf("%d%d", &a, &b); if (a + b > c) { c = a + b; d = x; } } printf("%c %d\n", d + 'A', c); } return 0; }
#include <stdio.h> int main(void) { int x, a, b, c, d; while (1) { scanf("%d%d", &a, &b); if ((c = a + b) == 0) break; d = 0; for (x = 1; x < 5; x++) { scanf("%d%d", &a, &b); if (a + b > c) { c = a + b; d = x; } } printf("%c %d\n", d + 'A', c); } ...
[["+", 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
120
4
#include <stdio.h> int main() { int A, a, B, b, C, c, D, d, E, e, ta, tb, tc, td, te; while (1) { scanf("%d %d", &A, &a); if (A == 0 && a == 0) break; scanf("%d %d %d %d %d %d %d %d", &B, &b, &C, &c, &D, &d, &E, &e); ta = A + a; tb = B + b; tc = C + c; td = D + d; te = E + e; ...
#include <stdio.h> int main() { int A, a, B, b, C, c, D, d, E, e, ta, tb, tc, td, te; while (1) { scanf("%d %d", &A, &a); if (A == 0 && a == 0) break; scanf("%d %d %d %d %d %d %d %d", &B, &b, &C, &c, &D, &d, &E, &e); ta = A + a; tb = B + b; tc = C + c; td = D + d; te = E + e; ...
[["-", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22]]
0
278
2
#include <stdio.h> int main() { char r[5] = {'A', 'B', 'C', 'D', 'E'}; int s1[5], i, s2[5], m = 0, l; while (1) { for (i = 0; i < 5; i++) { scanf("%d%d", &s1[i], &s2[i]); if (s1[i] == 0 && s2[i] == 0) { return 0; } } for (i = 0; i < 5; i++) { if (m < s1[i] + s2[i]) { ...
#include <stdio.h> int main() { char r[5] = {'A', 'B', 'C', 'D', 'E'}; int s1[5], i, s2[5], m = 0, l; while (1) { for (i = 0; i < 5; i++) { scanf("%d%d", &s1[i], &s2[i]); if (s1[i] == 0 && s2[i] == 0) { return 0; } } for (i = 0; i < 5; i++) { if (m < s1[i] + s2[i]) { ...
[["+", 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
181
4
#include <stdio.h> main() { int s1, s2, i, a, max = 0; while (1) { for (i = 0; i < 5; i++) { scanf("%d %d", &s1, &s2); if (s1 == 0 && s2 == 0) break; if (max < s1 + s2) { max = s1 + s2; a = i; } } if (s1 == 0 && s2 == 0) break; switch (a) { ...
#include <stdio.h> main() { int s1, s2, i, a, max = 0; while (1) { max = 0; for (i = 0; i < 5; i++) { scanf("%d %d", &s1, &s2); if (s1 == 0 && s2 == 0) break; if (max < s1 + s2) { max = s1 + s2; a = i; } } if (s1 == 0 && s2 == 0) break; sw...
[["+", 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], ["+", 0, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
178
4
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define F first #define S second typedef pair<int, int> pii; int main() { vector<pii> v(5); while (cin >> v[0].F, v[0].F) { int t; cin >> t; t += v[0].F; v[0].S = 0; for (int i = 1; i < 5; i++) { cin >> t; ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define F first #define S second typedef pair<int, int> pii; int main() { vector<pii> v(5); while (cin >> v[0].F, v[0].F) { int t; cin >> t; v[0].F += t; v[0].S = 0; for (int i = 1; i < 5; i++) { cin >> t; ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22]]
1
182
4
#include <bits/stdc++.h> using namespace std; int main() { int s1, s2; while (cin >> s1 >> s2, s1 + s2) { int maxn = s1 + s1; char maxi = 'A'; for (int i = 1; i < 5; i++) { cin >> s1 >> s2; if (maxn < s1 + s2) { maxn = s1 + s2; maxi = 'A' + i; } } cout << maxi ...
#include <bits/stdc++.h> using namespace std; int main() { int s1, s2; while (cin >> s1 >> s2, s1 + s2) { int maxn = s1 + s2; char maxi = 'A'; for (int i = 1; i < 5; i++) { cin >> s1 >> s2; if (maxn < s1 + s2) { maxn = s1 + s2; maxi = 'A' + i; } } cout << maxi ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
103
2
#include <iostream> using namespace std; int main() { int n, m; while (cin >> n >> m, n || m) { int maxn = n + m; char s = 'A', store; for (int i = 1; i < 5; i++) { cin >> n >> m; int sum = n + m; if (maxn < sum) { maxn = sum; store = s + i; } } cout << ...
#include <iostream> using namespace std; int main() { int n, m; while (cin >> n >> m, n || m) { int maxn = n + m; char s = 'A', store = s; for (int i = 1; i < 5; i++) { cin >> n >> m; int sum = n + m; if (maxn < sum) { maxn = sum; store = s + i; } } cout...
[["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 22]]
1
111
2
#include <stdio.h> int main(void) { int i, a[5], b[5], c = 0, d; char mise[5] = {'A', 'B', 'C', 'D', 'E'}; while (1) { scanf("%d %d", &a[0], &b[0]); if (a[0] == 0 && b[0] == 0) break; for (i = 1; i < 5; i++) { scanf("%d %d", &a[i], &b[i]); } for (i = 0; i < 5; i++) { if (c < ...
#include <stdio.h> int main(void) { int i, a[5], b[5], c, d; char mise[5] = {'A', 'B', 'C', 'D', 'E'}; while (1) { c = 0; scanf("%d %d", &a[0], &b[0]); if (a[0] == 0 && b[0] == 0) break; for (i = 1; i < 5; i++) { scanf("%d %d", &a[i], &b[i]); } for (i = 0; i < 5; i++) { i...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 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
198
6
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { enum tol { a, b, c, d, e }; vector<tol> l; vector<int> ll; int a1, a2; while (cin >> a1 >> a2) { if (a1 == 0 && a2 == 0) break; int o[5]; int oo[5]; a1 += a2; o[0] = a1; for (int i = 1; i...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { enum tol { a, b, c, d, e }; vector<tol> l; vector<int> ll; int a1, a2; while (cin >> a1 >> a2) { if (a1 == 0 && a2 == 0) break; int o[5]; int oo[5]; a1 += a2; o[0] = a1; for (int i = 1; i...
[["-", 0, 7, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
440
4
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int a[5], b[5], c[5], i, max = 0, num = 0; string str[5] = {"A", "B", "C", "D", "E"}; while (cin >> a[0] >> b[0]) { if (a[0] == 0 && b[0] == 0) break; fo...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int a[5], b[5], c[5], i, max = 0, num = 0; string str[5] = {"A", "B", "C", "D", "E"}; while (cin >> a[0] >> b[0]) { if (a[0] == 0 && b[0] == 0) break; fo...
[["+", 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
222
4
#include <stdio.h> #include <string.h> int main(void) { int a, b, d, i, j; char c[6] = "ABCDE"; scanf("%d %d", &a, &b); while (a != 0 && b != 0) { j = 0; d = a + b; for (i = 1; i < 5; i++) { scanf("%d %d", &a, &b); if (a + b > d) { d = a + b; j = i; } } prin...
#include <stdio.h> #include <string.h> int main(void) { int a, b, d, i, j; char c[6] = "ABCDE"; scanf("%d %d", &a, &b); while (a != 0 && b != 0) { j = 0; d = a + b; for (i = 1; i < 5; i++) { scanf("%d %d", &a, &b); if (a + b > d) { d = a + b; j = i; } } prin...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
146
2
#include <algorithm> #include <iostream> using namespace std; #define REP(i, b, n) for (int i = b; i < n; i++) #define rep(i, n) REP(i, 0, n) main() { int ans, t, a, b; while (cin >> a >> b) { if (a == 0 && b == 0) break; ans = a; b; t = 0; REP(i, 1, 5) { cin >> a >> b; if (a ...
#include <algorithm> #include <iostream> using namespace std; #define REP(i, b, n) for (int i = b; i < n; i++) #define rep(i, n) REP(i, 0, n) main() { int ans, t, a, b; while (cin >> a >> b) { if (a == 0 && b == 0) break; ans = a + b; t = 0; REP(i, 1, 5) { cin >> a >> b; if (a + b...
[["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72]]
1
130
2
#include <algorithm> #include <stdio.h> using namespace std; int main() { while (1) { int max; int maxnum; max = 0; for (int i = 0; i < 5; i++) { int a, b; scanf("%d%d", &a, &b); if (a == 0 && b == 0) { goto A; } if (a + b > max) { max = a + b; ...
#include <algorithm> #include <stdio.h> using namespace std; int main() { while (1) { int max; int maxnum; max = 0; for (int i = 0; i < 5; i++) { int a, b; scanf("%d%d", &a, &b); if (a == 0 && b == 0) { goto A; } if (a + b > max) { max = a + b; ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
120
2
#include <iostream> using namespace std; int main() { while (1) { int s1, s2; int maxc = 0; int max = 0; for (int i = 0; i < 5; i++) { cin >> s1 >> s2; if (!s1 && !s2) return 0; if (s1 + s2 > max) { max = s1 + s2; maxc = 'A' + i; } } cout << max...
#include <iostream> using namespace std; int main() { while (1) { int s1, s2; int maxc = 0; int max = 0; for (int i = 0; i < 5; i++) { cin >> s1 >> s2; if (!s1 && !s2) return 0; if (s1 + s2 > max) { max = s1 + s2; maxc = 'A' + i; } } cout << (ch...
[["+", 31, 16, 31, 16, 31, 16, 12, 74, 0, 24], ["+", 31, 16, 31, 16, 12, 74, 39, 77, 39, 40], ["+", 31, 16, 31, 16, 31, 16, 12, 74, 0, 25]]
1
102
3
#include <iostream> using namespace std; int main(int argc, char **argv) { int a, b, tmp, tmp2; char w; while (1) { cin >> a >> b; if (a == 0 && b == 0) { break; } w = 'A'; tmp = a + b; tmp = 0; for (int i = 1; i <= 4; i++) { cin >> a >> b; if (tmp < (a + b)) { ...
#include <iostream> using namespace std; int main(int argc, char **argv) { int a, b, tmp, tmp2; char w; while (1) { cin >> a >> b; if (a == 0 && b == 0) { break; } w = 'A'; tmp = a + b; tmp2 = 0; for (int i = 1; i <= 4; i++) { cin >> a >> b; if (tmp < (a + b)) { ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
139
2
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, c) ...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; ++i) #define FOR(i, c) ...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
143
4
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int s1, s2; while (cin >> s1 >> s2, s1 || s2) { int ms = s1 + s2; int mi = 0; rep(i, 4) { cin >> s1 >> s2; if (ms < s1 + s2) { ms = s1 + s2; mi = i; } } cout <<...
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int s1, s2; while (cin >> s1 >> s2, s1 || s2) { int ms = s1 + s2; int mi = 0; rep(i, 4) { cin >> s1 >> s2; if (ms < s1 + s2) { ms = s1 + s2; mi = i + 1; } } cou...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
110
2
l=[] while True: n,k=list(map(int,input().split())) cnt+=1 if n==k==0: break l.append(n+k) if cnt%5==0: print(chr(l.index(max(l))+65),max(l)) l=[]
cnt=0 l=[] while True: n,k=list(map(int,input().split())) cnt+=1 if n==k==0: break l.append(n+k) if cnt%5==0: print(chr(l.index(max(l))+65),max(l)) l=[]
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
78
3
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); for (int n; (n = s.nextInt()) > 0;) { char[] c = new char[n]; int[][] a = new int[n][3]; for (int i = 0; i < n; ++i) { c[i] = s.next().charAt(0); a[i][0] = i;...
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); for (int n; (n = s.nextInt()) > 0;) { char[] c = new char[n]; int[][] a = new int[n][3]; for (int i = 0; i < n; ++i) { c[i] = s.next().charAt(0); a[i][0] = i;...
[["-", 64, 196, 0, 37, 0, 16, 12, 504, 71, 499], ["+", 64, 196, 0, 37, 0, 16, 12, 504, 71, 499]]
3
319
2
#include <stdio.h> #include <string.h> typedef struct { char team[3]; int win; int lose; } DATA; int main(void) { int n; int i, j; DATA data[11], temp; int r; while (1) { scanf("%d", &n); if (n == 0) break; for (i = 0; i < n; i++) { data[i].win = data[i].lose = 0; scan...
#include <stdio.h> #include <string.h> typedef struct { char team[3]; int win; int lose; } DATA; int main(void) { int n; int i, j; DATA data[11], temp; int r; while (1) { scanf("%d", &n); if (n == 0) break; for (i = 0; i < n; i++) { data[i].win = data[i].lose = 0; scan...
[["+", 12, 16, 12, 118, 28, 69, 71, 16, 17, 72], ["+", 12, 16, 12, 118, 28, 69, 71, 16, 12, 13]]
0
355
2
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = n - 1; i >= 0; i--) #define PB push_back #define INF INT_MAX / 3 #define ALL(a) (a).begin(), (a).end() #...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = n - 1; i >= 0; i--) #define PB push_back #define INF INT_MAX / 3 #define ALL(a) (a).begin(), (a).end() #...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 18]]
1
402
4
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; typedef struct { char t; int pt[10]; int win; int lose; } GAME; int main() { GAME game[10], tmp; int n; while (scanf("%d", &n), n) { for (int i = 0; i < n; i++) { game[i].win = game[i].lose = 0; cin >> game[...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; typedef struct { char t; int pt[10]; int win; int lose; } GAME; int main() { GAME game[10], tmp; int n; while (scanf("%d", &n), n) { for (int i = 0; i < n; i++) { game[i].win = game[i].lose = 0; cin >> game[...
[["+", 12, 118, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 12, 118, 28, 69, 341, 342, 0, 16, 12, 13]]
1
335
2
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <un...
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <un...
[["-", 0, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 0, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
444
2
#include <stdio.h> #include <string.h> int main(void) { char x[10], r; int n, a[10], b[10], c[10], i, k, t; scanf("%d", &n); while (1) { if (n == 0) break; for (i = 0; i < n; i++) { scanf(" %c", &x[i]); a[i] = 0; b[i] = 0; c[i] = i; for (k = 0; k < n - 1; k++) { ...
#include <stdio.h> #include <string.h> int main(void) { char x[10], r; int n, a[10], b[10], c[10], i, k, t; scanf("%d", &n); while (1) { if (n == 0) break; for (i = 0; i < n; i++) { scanf(" %c", &x[i]); a[i] = 0; b[i] = 0; c[i] = i; for (k = 0; k < n - 1; k++) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 51, 16, 31, 16, 31, 23, 0, 16, 17, 47], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 17, 18]]
1
406
6
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main(void) { while (1) { int n; cin >> n; if (n == 0) break; vector<int> id(n); vector<char> names(n); vector<int> wins(n, 0); vector<int> loses(n, 0); for (int i = 0; i < n; i++) { id[i] =...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main(void) { while (1) { int n; cin >> n; if (n == 0) break; vector<int> id(n); vector<char> names(n); vector<int> wins(n, 0); vector<int> loses(n, 0); for (int i = 0; i < n; i++) { id[i] =...
[["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 73]]
1
444
6
#include <cstdio> #include <iostream> using namespace std; int i, j, make[100], kati[100]; char name[100]; void change() { int tmp1, tmp2; char tmp3; tmp1 = kati[j + 1]; kati[j + 1] = kati[j]; kati[j] = tmp1; tmp2 = make[j + 1]; make[j + 1] = make[j]; make[j] = tmp2; tmp3 = name[j + 1]; name[j +...
#include <cstdio> #include <iostream> using namespace std; int i, j, make[100], kati[100]; char name[100]; void change() { int tmp1, tmp2; char tmp3; tmp1 = kati[j + 1]; kati[j + 1] = kati[j]; kati[j] = tmp1; tmp2 = make[j + 1]; make[j + 1] = make[j]; make[j] = tmp2; tmp3 = name[j + 1]; name[j +...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
381
2
#include <algorithm> #include <iostream> #include <vector> using namespace std; struct node { char name; int win, lost; node(char n, int w, int l) : name(n), win(w), lost(l) {} bool operator<(const node &e) const { if (win == e.win) lost < e.lost; else return win > e.win; } bool operat...
#include <algorithm> #include <iostream> #include <vector> using namespace std; struct node { char name; int win, lost; node(char n, int w, int l) : name(n), win(w), lost(l) {} bool operator<(const node &e) const { if (win == e.win) return lost < e.lost; else return win > e.win; } bool...
[["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 38]]
1
275
2
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main(void) { multimap<int, char, greater<int>> team; char t; int n; while (1) { cin >> n; if (!n) break; ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main(void) { multimap<int, char, greater<int>> team; char t; int n; while (1) { cin >> n; if (!n) break; ...
[["-", 8, 9, 0, 57, 64, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
199
3
loop{ n=gets.to_i; exit if n==0; [*1..n].map{s,*a=gets.split;t=0;a.map{|b|b=b.to_i;t+=b==0 ? 2*n : b==1 ? -1 : 0};[-t,s]}.sort.map{|a|puts a[1]} }
loop{ n=gets.to_i; exit if n==0; [*1..n].map{|i|s,*a=gets.split;t=0;a.map{|b|b=b.to_i;t+=b==0 ? 2*n : b==1 ? -1 : 0};[-t,i,s]}.sort.map{|a|puts a[2]} }
[["+", 486, 652, 486, 652, 196, 196, 54, 758, 0, 139], ["+", 486, 652, 486, 652, 196, 196, 54, 758, 0, 22], ["+", 486, 652, 196, 196, 8, 734, 0, 516, 0, 22], ["+", 486, 652, 196, 196, 8, 734, 0, 516, 0, 21], ["-", 8, 734, 0, 652, 3, 4, 0, 742, 0, 612], ["+", 8, 734, 0, 652, 3, 4, 0, 742, 0, 612]]
4
91
7
import sys f = sys.stdin while True: n = int(f.readline()) if n == 0: break teams = [f.readline().split() for i in range(n)] teams = [(t[0], -t.count('0'), t.count('1'), i) for i, t in enumerate(teams)] teams.sort(key=operator.itemgetter(1,2,3)) print('\n'.join([t[0] for ...
import sys import operator f = sys.stdin while True: n = int(f.readline()) if n == 0: break teams = [f.readline().split() for i in range(n)] teams = [(t[0], -t.count('0'), t.count('1'), i) for i, t in enumerate(teams)] teams.sort(key=operator.itemgetter(1,2,3)) print('\n'...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
123
2
#include <stdio.h> int main(void) { int a, b, c, i; while (1) { scanf("%d %d", &a, &b); if (a == 0 && b == 0) break; if (a < b) { c = b; b = a; a = c; } for (i = 0; i < 0; i++) { a = a % b; c = a; a = b; b = c; if (b == 0) break; ...
#include <stdio.h> int main(void) { int a, b, c, i; while (1) { scanf("%d %d", &a, &b); if (a == 0 && b == 0) break; if (a < b) { c = b; b = a; a = c; } for (i = 0;; i++) { a = a % b; c = a; a = b; b = c; if (b == 0) break; } ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
0
127
3
#include <stdio.h> int main(void) { int a, b, x, cnt; scanf("%d %d", &a, &b); while (a != 0 && b != 0) { cnt = 0; if (a >= b) { x = a; a = b; b = x; } while (b != 0) { cnt++; a = a % b; x = a; a = b; b = x; } printf("%d %d\n", a, cnt); sc...
#include <stdio.h> int main(void) { int a, b, x, cnt; scanf("%d %d", &a, &b); while (a != 0 && b != 0) { cnt = 0; if (b >= a) { x = a; a = b; b = x; } while (b != 0) { cnt++; a = a % b; x = a; a = b; b = x; } printf("%d %d\n", a, cnt); sc...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22]]
0
124
4
#include <stdio.h> int main(void) { int a, b; int x, y, t; int steps; while (1) { scanf("%d %d", &a, &b); if (a == 0 && b == 0) break; if (a >= b) { x = a; y = b; } else { x = b; y = a; } for (steps = 0; y > 0; steps++) { y = x % y; t = x; ...
#include <stdio.h> int main(void) { int a, b; int x, y, t; int steps; while (1) { scanf("%d %d", &a, &b); if (a == 0 && b == 0) break; if (a >= b) { x = a; y = b; } else { x = b; y = a; } for (steps = 0; y > 0; steps++) { x = x % y; t = x; ...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22]]
0
130
2
#include <stdio.h> int cnt = 0; int GCD(int x, int y) { int tmp; if (x >= y) { tmp = x; x = y; y = tmp; } while (1) { if (y == 0) break; x %= y; tmp = x; x = y; y = tmp; cnt++; } return x; } int main(void) { int x, y, ans; while (1) { cnt = 0; sca...
#include <stdio.h> int cnt = 0; int GCD(int x, int y) { int tmp; if (!(x >= y)) { tmp = x; x = y; y = tmp; } while (1) { if (y == 0) break; x %= y; tmp = x; x = y; y = tmp; cnt++; } return x; } int main(void) { int x, y, ans; while (1) { cnt = 0; ...
[["+", 8, 9, 0, 57, 15, 23, 0, 91, 17, 111], ["+", 0, 57, 15, 23, 0, 91, 28, 23, 0, 24], ["+", 0, 57, 15, 23, 0, 91, 28, 23, 0, 25]]
0
150
3
#include <algorithm> #include <cstdio> int main() { int x = 0, y = 0; int temp; int count; while (scanf("%d %d", &x, &y) != EOF) { if (x == 0 && y == 0) { break; } temp = 0; if (x < y) { temp = x; x = y; y = temp; } for (count = 0; y != 0; count++) { x =...
#include <algorithm> #include <cstdio> int main() { int x = 0, y = 0; int temp; int count; while (scanf("%d %d", &x, &y) != EOF) { if (x == 0 && y == 0) { break; } temp = 0; if (x < y) { temp = x; x = y; y = temp; } for (count = 0; y != 0; count++) { x =...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
129
1
#include <algorithm> #include <cmath> #include <complex> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define loop(i, a, b) for ...
#include <algorithm> #include <cmath> #include <complex> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define loop(i, a, b) for ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
173
2
#include <stdio.h> long step; long enclidean(long a, long b) { step++; long c; c = a % b; if (c) return enclidean(b, c); else return b; } int main() { long a, b, c; while (scanf("%ld %ld", &a, &b), a + b != 0L) { step = 0; if (a > b) c = enclidean(a, b); else c = enclidean...
#include <stdio.h> long step; long enclidean(long a, long b) { step++; long c; c = a % b; if (c) return enclidean(b, c); else return b; } int main() { long a, b, c; while (scanf("%ld %ld", &a, &b), a + b != 0L) { step = 0; if (a > b) c = enclidean(a, b); else c = enclidean...
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 103, 0, 104], ["-", 0, 1, 0, 2, 3, 4, 0, 103, 0, 125], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
131
7
#include <algorithm> #include <cstdio> int ans = 0; int GCD(int a, int b) { if (b == 0) return a; ans++; return GCD(b, a % b); } int main() { int x, y; while (scanf("%d %d", &x, &y), x + y) { ans = 0; if (x > y) std::swap(x, y); int gcd = GCD(x, y); printf("%d %d\n", gcd, ans); } ...
#include <algorithm> #include <cstdio> int ans = 0; int GCD(int a, int b) { if (b == 0) return a; ans++; return GCD(b, a % b); } int main() { int x, y; while (scanf("%d %d", &x, &y), x + y) { ans = 0; if (x < y) std::swap(x, y); int gcd = GCD(x, y); printf("%d %d\n", gcd, ans); } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
115
2
#include <algorithm> #include <iostream> using namespace std; int euclid(int a, int b) { int cnt = 0; while (a == 0 || b == 0) { if (a >= b) { a = a % b; } else { b = b % a; } cnt++; } return cnt; } int main() { int x, y; while (true) { cin >> x >> y; if (x + y == 0) { ...
#include <algorithm> #include <iostream> using namespace std; int euclid(int a, int b) { int cnt = 0; while (a != 0 && b != 0) { if (a >= b) { a = a % b; } else { b = b % a; } cnt++; } return cnt; } int main() { int x, y; while (true) { cin >> x >> y; if (x + y == 0) { ...
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 79], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 79]]
1
122
6
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> using namespace std; int main(void) { int cnt = 0; ; int i, j, n, m, amari, syo; while (1) { scanf("%d %d", &n, &m); if (n == 0 && m == 0) break; if (n < m) swap(n, m); while (1) { n = n % m; ...
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> using namespace std; int main(void) { int cnt = 0; ; int i, j, n, m, amari, syo; while (1) { scanf("%d %d", &n, &m); if (n == 0 && m == 0) break; if (n < m) swap(n, m); while (1) { n = n % m; ...
[["+", 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
127
4
#include <bits/stdc++.h> using namespace std; #define FOR(i, x, y) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) int main() { long long int x, y; while (cin >> x >> y, x + y) { int cnt = 0; if (x < y) swap(x, y); while (y != 0) { y = x % y; swap(x, y...
#include <bits/stdc++.h> using namespace std; #define FOR(i, x, y) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) int main() { long long int x, y; while (cin >> x >> y, x + y) { int cnt = 0; if (x < y) swap(x, y); while (y != 0) { x = x % y; swap(x, y...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
105
2
#include <bits/stdc++.h> using namespace std; #define pb(n) push_back(n) #define fi first #define se second #define all(r) (r).begin(), (r).end() #define gsort(st, en) sort((st), (en), greater<int>()) #define vmax(ary) *max_element(all(ary)) #define vmin(ary) *min_element(all(ary)) #define debug(x) cout << #x << ": " ...
#include <bits/stdc++.h> using namespace std; #define pb(n) push_back(n) #define fi first #define se second #define all(r) (r).begin(), (r).end() #define gsort(st, en) sort((st), (en), greater<int>()) #define vmax(ary) *max_element(all(ary)) #define vmin(ary) *min_element(all(ary)) #define debug(x) cout << #x << ": " ...
[["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 98], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
483
4
#include <bits/stdc++.h> using namespace std; void swap(unsigned int *a, unsigned int *b) { if (*a != *b) { *a ^= *b; *b ^= *a; *a ^= *b; } } int main() { unsigned int a, b, cnt; while (cin >> a >> b, a & b) { if (a < b) swap(&a, &b); cnt = 0; while (b != 0) { a = a % b; ...
#include <bits/stdc++.h> using namespace std; void swap(unsigned int *a, unsigned int *b) { if (*a != *b) { *a ^= *b; *b ^= *a; *a ^= *b; } } int main() { unsigned int a, b, cnt; while (cin >> a >> b, a) { if (a < b) swap(&a, &b); cnt = 0; while (b != 0) { a = a % b; ...
[["-", 0, 52, 15, 339, 51, 34, 12, 16, 17, 67], ["-", 0, 52, 15, 339, 51, 34, 12, 16, 12, 22]]
1
137
2
#include <cstdio> #include <iostream> using namespace std; int counter; int gcd(int a, int b) { if (b == 0) return a; counter++; return gcd(b, a % b); } int main(void) { int a, b, x; while (cin >> a >> b) { if (a < b) { x = a; a = b; b = x; } if (a == 0 && b == 0) r...
#include <cstdio> #include <iostream> using namespace std; int counter; int gcd(int a, int b) { if (b == 0) return a; counter++; return gcd(b, a % b); } int main(void) { int a, b, x; while (cin >> a >> b) { if (a < b) { x = a; a = b; b = x; } if (a == 0 && b == 0) r...
[["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
126
1
#include <iostream> using namespace std; int main(void) { for (int i = 0; i < 1000; i++) { int a, b; cin >> a >> b; if (a == 0 && b == 0) break; int j, r, COUNT = 1; if (b > a) { j = a; a = b; b = a; } while ((r = a % b) != 0) { a = b; b = r; C...
#include <iostream> using namespace std; int main(void) { for (int i = 0; i < 1000; i++) { int a, b; cin >> a >> b; if (a == 0 && b == 0) break; int j, r, COUNT = 1; if (b > a) { j = a; a = b; b = j; } while ((r = a % b) != 0) { a = b; b = r; ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
121
2