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
import java.util.Scanner; public class Main { static Scanner sc; static int C1, C2, C3, count; public static void main(String[] args) { sc = new Scanner(System.in); new Main(); } Main() { while (sc.hasNext()) { C1 = sc.nextInt(); C2 = sc.nextInt(); C3 = sc.nextInt(); fo...
import java.util.Scanner; public class Main { static Scanner sc; static int C1, C2, C3, count; public static void main(String[] args) { sc = new Scanner(System.in); new Main(); } Main() { while (sc.hasNext()) { C1 = sc.nextInt(); C2 = sc.nextInt(); C3 = sc.nextInt(); cou...
[["+", 0, 52, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 12, 499], ["+", 8, 519, 0, 52, 8, 196, 0, 1, 0, 35]]
3
179
4
#include <stdio.h> int main(void) { int c1, c2, c3, i; int n = 0; while (scanf("%d %d %d", &c1, &c2, &c3) != EOF) { for (i = 1; i <= 10; i++) { if (i != c1 && i != c2 && i != c3 && c1 + c2 + i <= 20) n++; } if (n >= 4) { printf("YES\n"); } else { printf("NO\n"); ...
#include <stdio.h> int main(void) { int c1, c2, c3, i; int n = 0; while (scanf("%d %d %d", &c1, &c2, &c3) != EOF) { for (i = 1; i <= 10; i++) { if (i != c1 && i != c2 && i != c3 && c1 + c2 + i <= 20) n++; } if (n >= 4) { printf("YES\n"); } else { printf("NO\n"); ...
[["+", 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
115
4
#include <stdio.h> int main() { int c1, c2, c3, i, count; int card[10]; while (scanf("%d %d %d", &c1, &c2, &c3) != EOF) { for (i = 0; i < 10; i++) card[i] = 0; card[c1 - 1] = 1; card[c2 - 1] = 1; card[c3 - 1] = 1; count = 0; for (i = 0; i + c1 + c2 < 21; i++) { if (card[i - 1...
#include <stdio.h> int main() { int c1, c2, c3, i, count; int card[10]; while (scanf("%d %d %d", &c1, &c2, &c3) != EOF) { for (i = 0; i < 10; i++) card[i] = 0; card[c1 - 1] = 1; card[c2 - 1] = 1; card[c3 - 1] = 1; count = 0; for (i = 1; i + c1 + c2 < 21; i++) { if (card[i - 1...
[["-", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13]]
0
157
2
#include <stdio.h> int main() { int i; int a, b, c, d; while (scanf("%d%d%d", &a, &b, &c) != -1) { d = 0; for (i = 1; i < 11; i++) { if (i != a && i != b && i != c) if (a + b + i <= 20) d++; } if (d > 3) printf("YES"); else printf("NO"); } return 0; }
#include <stdio.h> int main() { int i; int a, b, c, d; while (scanf("%d%d%d", &a, &b, &c) != -1) { d = 0; for (i = 1; i < 11; i++) { if (i != a && i != b && i != c) if (a + b + i <= 20) d++; } if (d > 3) puts("YES"); else puts("NO"); } return 0; }
[["-", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["-", 0, 57, 75, 76, 0, 1, 0, 2, 63, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 2, 63, 22]]
0
112
4
#include <stdio.h> int main() { int c1, c2, c3; int card[11]; while (scanf("%d %d %d", &c1, &c2, &c3) != EOF) { int i; int cnt = 0; for (i = 0; i < 11; i++) card[i] = i; card[c1] = 0; card[c2] = 0; card[c3] = 0; for (i = 1; i < 11; i++) { if (card[i] > 0 && c1 + c2 + card[...
#include <stdio.h> int main() { int c1, c2, c3; int card[11]; while (scanf("%d %d %d", &c1, &c2, &c3) != EOF) { int i; int cnt = 0; for (i = 0; i < 11; i++) card[i] = i; card[c1] = 0; card[c2] = 0; card[c3] = 0; for (i = 1; i < 11; i++) { if (card[i] > 0 && c1 + c2 + card[...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
160
2
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; public class Main { public static void main(String args[]) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { String line; int count = 0; ...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; public class Main { public static void main(String args[]) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { String line; int count = 0; ...
[["-", 8, 196, 0, 503, 49, 200, 51, 492, 500, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 500, 22], ["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 0, 503, 49, 200, 51, 492, 3, 4, 0, 22]]
3
206
5
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); String str; int ans = 0; while (scan.hasNext()) { str = scan.next(); char[] ch = str.toCharArray(); for (int i = 0; i < ch.length; i++) { if (ch.length ...
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); String str; int ans = 0; while (scan.hasNext()) { str = scan.next(); char[] ch = str.toCharArray(); for (int i = 0; i < ch.length; i++) { if (ch.length ...
[["+", 0, 16, 12, 504, 71, 16, 31, 16, 12, 22], ["+", 15, 15, 0, 16, 12, 504, 71, 16, 17, 33], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 17, 85], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 12, 499]]
3
146
6
#include <stdio.h> #include <string.h> int main(void) { char a[101]; char b[101]; int c = 0, l; while (scanf("%s", a) != EOF) { l = strlen(a); int i, j; for (i = 0, j = l - 1; i < l - 1; i++, j--) { b[i] = a[j]; } b[l] = '\0'; if (strcmp(a, b) == 0) c++; } printf("%d\n", ...
#include <stdio.h> #include <string.h> int main(void) { char a[101]; char b[101]; int c = 0, l; while (scanf("%s", a) != EOF) { l = strlen(a); int i, j; for (i = 0, j = l - 1; i < l; i++, j--) { b[i] = a[j]; } b[l] = '\0'; if (strcmp(a, b) == 0) c++; } printf("%d\n", c); ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
129
2
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define N 100 int main(void) { int i, j, x, count = 0; char s[N], str[N]; for (; fgets(s, sizeof(str), stdin) != NULL;) { sscanf(str, "%s", &str); x = 0; j = strlen(str) - 1; i = 0; while (j > i) { if (str[i] !...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define N 101 int main(void) { int i, j, x, count = 0; char s[N], str[N]; for (; fgets(s, sizeof(str), stdin) != NULL;) { sscanf(s, "%s", &str); x = 0; j = strlen(str) - 1; i = 0; while (j > i) { if (str[i] != ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
152
4
#include <stdio.h> #include <string.h> int is_odd_Symmetry(const char str[], int len); int is_even_Symmetry(const char str[], int len); int main(void) { char str[100]; int cnt = 0; int len; while (scanf("%s", str) != EOF) { len = (int)strlen(str); if (len == 1) { cnt++; } else { if (...
#include <stdio.h> #include <string.h> int is_odd_Symmetry(const char str[], int len); int is_even_Symmetry(const char str[], int len); int main(void) { char str[100]; int cnt = 0; int len; while (scanf("%s", str) != EOF) { len = (int)strlen(str); if (len == 1) { cnt++; } else { if (...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
0
326
2
#include <stdio.h> #include <string.h> int main() { char str[101]; long len; int counter = 0; int a = 0; int i; char j; while (scanf("%s", str) != EOF) { counter = 0; len = strlen(str); for (i = 0; i < len; i++) { j = str[len - i]; if (j != str[i]) { counter++; } ...
#include <stdio.h> #include <string.h> int main() { char str[101]; long len; int counter = 0; int a = 0; int i; char j; while (scanf("%s", str) != EOF) { counter = 0; len = strlen(str); for (i = 0; i < len; i++) { j = str[len - 1 - i]; if (j != str[i]) { counter++; }...
[["+", 0, 11, 12, 69, 71, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 69, 71, 16, 17, 33]]
0
123
2
#include <iostream> #include <string> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { string s; int count = 0; while (cin >> s) { if (s.size() == 1) { count++; } else { bool flag = true; rep(i, s.size() / 2) { if (s[i] != s[s.size() - i - 1]) { ...
#include <iostream> #include <string> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { string s; int count = 0; while (cin >> s) { if (s.size() == 1) { count++; } else { bool flag = true; rep(i, s.size() / 2) { if (s[i] != s[s.size() - i - 1]) { ...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 147], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 146]]
1
122
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <utility> #include <vector> typedef long long int ll; using namespace std; string a, b; int main() { int cnt = 0; while (cin >> a) { b = a; reverse(&b[0], &b[b.size() - 1]); if (...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <utility> #include <vector> typedef long long int ll; using namespace std; string a, b; int main() { int cnt = 0; while (cin >> a) { b = a; reverse(&b[0], &b[b.size()]); if (b ==...
[["-", 0, 66, 28, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 66, 28, 69, 341, 342, 0, 16, 12, 13]]
1
90
2
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) #define sz(obj) ((int)(obj).size()) int main() { string str; int cnt = 0; while (cin >> str) { int ccnt = 0; REP(i, sz(str) / 2) if (str[i] == str[sz(str) - ...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) #define sz(obj) ((int)(obj).size()) int main() { string str; int cnt = 0; while (cin >> str) { int ccnt = 0; REP(i, sz(str) / 2) if (str[i] == str[sz(str) - ...
[["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
113
2
#include <iostream> #include <string> using namespace std; int main() { string s; int cnt = 0, flag; while (cin >> s) { bool flag = false; int l = s.length(); for (int i = 0; i <= l / 2; i++) { if (s[i + 1] != s[l - i]) { flag = true; break; } } if (flag == false) ...
#include <iostream> #include <string> using namespace std; int main() { string s; int cnt = 0, flag; while (cin >> s) { bool flag = false; int l = s.length(); for (int i = 0; i <= l / 2; i++) { if (s[i] != s[l - i - 1]) { flag = true; break; } } if (flag == false) ...
[["-", 51, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
103
4
#include <bits/stdc++.h> using namespace std; int main() { string s; int c = 0, p = 0; while (cin >> s) { p++; for (int i = 0; i <= s.size() / 2; i++) { if (s[i] != s[s.size() - 1] - i) { c++; break; } } } cout << p - c << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string s; int c = 0, p = 0; while (cin >> s) { p++; for (int i = 0; i <= s.size() / 2; i++) { if (s[i] != s[s.size() - 1 - i]) { c++; break; } } } cout << p - c << endl; }
[["-", 51, 16, 12, 16, 31, 69, 341, 342, 0, 73], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 73]]
1
92
2
#include <algorithm> #include <iostream> using namespace std; int main() { string inStr, buf; int cnt = 0; while (cin >> inStr, !cin.eof()) { buf = inStr; sort(inStr.rbegin(), inStr.rend()); if (buf == inStr) cnt++; } cout << cnt << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { string inStr, buf; int cnt = 0; while (cin >> inStr, !cin.eof()) { buf = inStr; reverse(inStr.begin(), inStr.end()); if (buf == inStr) cnt++; } cout << cnt << endl; return 0; }
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120]]
1
76
6
#include <bitset> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { bitset<60001> is_prime; is_prime.set(); is_prime[0] = false, is_prime[1] = true; for (int i = 2; i * i <= 60000; i++) { for (int j = i + i; j <= 60000; j += i) { is_prime[j] = false; } }...
#include <bitset> #include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { bitset<60001> is_prime; is_prime.set(); is_prime[0] = false, is_prime[1] = false; for (int i = 2; i * i <= 60000; i++) { for (int j = i + i; j <= 60000; j += i) { is_prime[j] = false; } ...
[["-", 8, 9, 0, 1, 0, 34, 12, 11, 12, 146], ["+", 8, 9, 0, 1, 0, 34, 12, 11, 12, 147]]
1
225
2
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include...
[["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
410
2
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n; int not_prime[51000]; int ans; int idx; not_prime[0] = not_prime[1] = 1; for (int i = 2; i <= 50000; i++) not_prime[i] = 0; for (int i = 2; i <= sqrt(50000); i++) { if (not_prime[i] == 0) { ...
#include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n; int not_prime[51000]; int ans; int idx; not_prime[0] = not_prime[1] = 1; for (int i = 2; i <= 50000; i++) not_prime[i] = 0; for (int i = 2; i <= sqrt(50000); i++) { if (not_prime[i] == 0) { ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
193
2
#include <iostream> using namespace std; bool is_prime[50001]; void sieve() { for (int i = 0; i < 50001; i++) { is_prime[i] = true; } is_prime[0] = is_prime[1] = false; for (int i = 2; i < 50001; i++) { if (is_prime[i]) { for (int j = 2 * i; j < 50001; j += i) { is_prime[j] = false; ...
#include <iostream> using namespace std; bool is_prime[50001]; void sieve() { for (int i = 0; i < 50001; i++) { is_prime[i] = true; } is_prime[0] = is_prime[1] = false; for (int i = 2; i < 50001; i++) { if (is_prime[i]) { for (int j = 2 * i; j < 50001; j += i) { is_prime[j] = false; ...
[["-", 0, 7, 15, 16, 12, 16, 31, 23, 0, 24], ["-", 15, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 15, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["-", 0, 7, 15, 16, 12, 16, 31, 23, 0, 25]]
1
189
4
#include <cstdio> using namespace std; int sosu[55555]; main() { int N; sosu[0] = 1; sosu[1] = 1; for (int j = 2; j < 224; j++) { if (sosu[j] == 1) continue; for (int i = j * j; i < 50001; i *= j) { sosu[i] = 1; } } while (1) { scanf("%d", &N); if (N == 0) break; ...
#include <cstdio> using namespace std; int sosu[55555]; main() { int N; sosu[0] = 1; sosu[1] = 1; for (int j = 2; j < 224; j++) { if (sosu[j] == 1) continue; for (int i = j + j; i < 50001; i += j) { sosu[i] = 1; } } while (1) { scanf("%d", &N); if (N == 0) break; ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 48], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 8, 9, 0, 7, 26, 11, 17, 108], ["+", 0, 7, 8, 9, 0, 7, 26, 11, 17, 107]]
1
172
4
#include <algorithm> #include <iostream> #include <vector> using namespace std; bool isPrime(int n) { if (n <= 1 || n != 2 && (n & 1) == 0) return false; for (int i = 3; i * i <= n; i += 2) if (n % i == 0) return false; return true; } int main() { vector<int> primes; for (int i = 2; i <= 50000;...
#include <algorithm> #include <iostream> #include <vector> using namespace std; bool isPrime(int n) { if (n <= 1 || n != 2 && (n & 1) == 0) return false; for (int i = 3; i * i <= n; i += 2) if (n % i == 0) return false; return true; } int main() { vector<int> primes; for (int i = 2; i <= 50000;...
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 12, 22]]
1
196
2
#include <bitset> #include <cmath> #include <iostream> #include <list> int main() { const int max = 50021; std::bitset<max + 1> bitTable; bitTable.set(0); bitTable.set(1); int loop = sqrt(max); for (int i = 2; i <= loop; ++i) { if (bitTable.test(i) == false) { for (int j = i * i; j <= max; j +...
#include <bitset> #include <cmath> #include <iostream> #include <list> int main() { const int max = 50021; std::bitset<max + 1> bitTable; bitTable.set(0); bitTable.set(1); int loop = sqrt(max); for (int i = 2; i <= loop; ++i) { if (bitTable.test(i) == false) { for (int j = i * i; j <= max; j +...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
255
2
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 16, 12, 23, 0, 24], ["-", 49, 50, 51, 16, 12, 23, 0, 16, 31, 22], ["-", 49, 50, 51, 16, 12, 23, 0, 16, 17, 109], ["-", 49, 50, 51, 16, 12, 23, 0, 16, 12, 13], ["-", 0, 43, 49, 50, 51, 16, 12, 23, 0, 25]]
1
330
6
#include <cmath> #include <iostream> #include <vector> typedef std::vector<int> vi; vi PRIMES, S; int prime(int n) { int i = 0, j = 1, h = (n + 1) / 2, x, r = (int)pow(n, .5); vi s(h), p; while (j <= n) { s[i++] = j; j += 2; } for (i = 1; i < h; i++) if (x = s[i]) { p.push_back(x); if ...
#include <cmath> #include <iostream> #include <vector> typedef std::vector<int> vi; vi PRIMES, S; int prime(int n) { int i = 0, j = 1, h = (n + 1) / 2, x, r = (int)pow(n, .5); vi s(h), p; while (j <= n) { s[i++] = j; j += 2; } for (i = 1; i < h; i++) if (x = s[i]) { p.push_back(x); if ...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
324
3
#include <iostream> #define N 50000 using namespace std; bool isP[N + 1]; void make_isP() { isP[0] = isP[1] = false; for (int i = 2; i <= N; i++) isP[i] = true; for (int i = 2; i * i <= N; i++) { if (!isP[i]) continue; for (int j = i * i; j <= N; j += i) isP[j] = false; } } int main()...
#include <iostream> #define N 50000 using namespace std; bool isP[N + 1]; void make_isP() { isP[0] = isP[1] = false; for (int i = 2; i <= N; i++) isP[i] = true; for (int i = 2; i * i <= N; i++) { if (!isP[i]) continue; for (int j = i * i; j <= N; j += i) isP[j] = false; } } int main()...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 20], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 52, 8, 9, 0, 7, 26, 27, 17, 68], ["+", 0, 52, 8, 9, 0, 7, 26, 27, 17, 29]]
1
183
6
#include <iostream> bool sosuu[50001]; void init() { for (int i = 0; i < 50001; i++) sosuu[i] = true; sosuu[0] = sosuu[1] = false; for (int i = 2; i * i < 50001; i++) { if (sosuu[i]) { for (int j = i * 2; j < 50001; j += i) sosuu[j] = false; } } } int main() { init(); int n;...
#include <iostream> bool sosuu[50001]; void init() { for (int i = 0; i < 50001; i++) sosuu[i] = true; sosuu[0] = sosuu[1] = false; for (int i = 2; i * i < 50001; i++) { if (sosuu[i]) { for (int j = i * 2; j < 50001; j += i) sosuu[j] = false; } } } int main() { init(); int n;...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 26, 11, 17, 107], ["-", 0, 52, 8, 9, 0, 7, 26, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 26, 27, 17, 29]]
1
177
5
primes = Array.new(50000, true) primes[0, 2] = [false, false] 2.upto(50000 - 1){|x| if primes[x] m = 2 while x * m <= 999_999 primes[x * m] = false m += 1 end end } while true n = gets.to_i break if n == 0 sum = 0 3.upto(n/2){|x| sum += 1 if prime...
primes = Array.new(50000, true) primes[0, 2] = [false, false] 2.upto(50000 - 1){|x| if primes[x] m = 2 while x * m <= 999_999 primes[x * m] = false m += 1 end end } while true n = gets.to_i break if n == 0 sum = 0 2.upto(n/2){|x| sum += 1 if prime...
[["-", 0, 493, 0, 89, 8, 170, 0, 652, 486, 612], ["+", 0, 493, 0, 89, 8, 170, 0, 652, 486, 612]]
4
108
2
def primes(max) nums = Array.new(max + 1, 1) nums[0] = nums[1] = 0 (2..Math.sqrt(max)).each do |sieve| if nums[sieve] == 1 (2 * sieve).step(max, sieve).each do |num| nums[num] = 0 end end end nums end max = 50 primes = primes(max) nums = (2..max).select { |num| primes[num] == ...
def primes(max) nums = Array.new(max + 1, 1) nums[0] = nums[1] = 0 (2..Math.sqrt(max)).each do |sieve| if nums[sieve] == 1 (2 * sieve).step(max, sieve).each do |num| nums[num] = 0 end end end nums end max = 50_000 primes = primes(max) nums = (2..max).select { |num| primes[num]...
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612]]
4
156
2
sn = 50000.0**0.5 + 1 is_prime = [false, false] + [true]*49999 (2..sn).each do |i| next unless is_prime[i] (i*i).step(50000, i).each do |j| is_prime[j] = false end end plist = (2..50000).to_a.select{ |i| is_prime[i] } while gets s = $_.to_i tmp = plist.dup l = tmp.shift h = tmp.pop c = 0 until t...
sn = 50000.0**0.5 + 1 is_prime = [false, false] + [true]*49999 (2..sn).each do |i| next unless is_prime[i] (i*i).step(50000, i).each do |j| is_prime[j] = false end end plist = (2..50000).to_a.select{ |i| is_prime[i] } while gets s = $_.to_i break if s == 0 tmp = plist.dup l = tmp.shift h = tmp.pop ...
[["+", 0, 89, 8, 170, 0, 751, 8, 94, 0, 94], ["+", 0, 493, 0, 89, 8, 170, 0, 751, 0, 121], ["+", 0, 89, 8, 170, 0, 751, 15, 738, 31, 22], ["+", 0, 89, 8, 170, 0, 751, 15, 738, 17, 60], ["+", 0, 89, 8, 170, 0, 751, 15, 738, 12, 612]]
4
169
5
import sys f = sys.stdin def create_prime(n): prime = [1] * (n + 1) prime[:2] = [0, 0] for i in range(len(prime)): if prime[i]: for j in range(2 * i, len(prime), i): prime[j] = 0 return prime sieve = create_prime(50000) prime = [] for i in range(25001): if sie...
import sys f = sys.stdin def create_prime(n): prime = [1] * (n + 1) prime[:2] = [0, 0] for i in range(len(prime)): if prime[i]: for j in range(2 * i, len(prime), i): prime[j] = 0 return prime sieve = create_prime(50000) prime = [] for i in range(25001): if siev...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
162
2
N = 50001 lst = [True] * N lst[0] = False lst[1] = False for i in range(2, int(N ** 0.5) + 1): if lst[i]: for j in range(i * i, N, i): lst[j] = False primes = [i for i in range(1, N) if lst[i]] for s in sys.stdin: n = int(s) if n == 0: break elif n % 2 == 1: if lst[...
import sys N = 50001 lst = [True] * N lst[0] = False lst[1] = False for i in range(2, int(N ** 0.5) + 1): if lst[i]: for j in range(i * i, N, i): lst[j] = False primes = [i for i in range(1, N) if lst[i]] for s in sys.stdin: n = int(s) if n == 0: break elif n % 2 == 1: ...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
176
2
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n; int ans; while (scan.hasNextInt()) { n = scan.nextInt(); ans = 1; for (int i = 1; i < n; i++) { ans += n; } System.out.println(ans); ...
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n; int ans; while (scan.hasNextInt()) { n = scan.nextInt(); ans = 1; for (int i = 1; i <= n; i++) { ans += i; } System.out.println(ans); ...
[["-", 0, 52, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 196, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 196, 0, 1, 0, 11, 12, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 12, 22]]
3
91
4
import java.util.*; public class Main { public static void main(String[] args) { new Main().run(); } Scanner sc = new Scanner(System.in); int[] lines = new int[10001]; void run() { part(); while (sc.hasNext()) { int n = sc.nextInt(); System.out.println(lines[n]); } } void part() { ...
import java.util.*; public class Main { public static void main(String[] args) { new Main().run(); } Scanner sc = new Scanner(System.in); int[] lines = new int[10001]; void run() { part(); while (sc.hasNext()) { int n = sc.nextInt(); System.out.println(lines[n]); } } void part() { ...
[["-", 0, 1, 0, 11, 12, 16, 12, 504, 516, 22], ["-", 0, 1, 0, 11, 12, 16, 12, 504, 0, 70], ["-", 0, 11, 12, 16, 12, 504, 71, 16, 17, 33], ["-", 0, 11, 12, 16, 12, 504, 71, 16, 12, 499], ["-", 0, 1, 0, 11, 12, 16, 12, 504, 0, 73]]
3
167
5
#include <stdio.h> int main(void) { int a; while (scanf("%d", &a) != EOF) { printf("%d", (a * (a + 1) + 2) / 2); } return 0; }
#include <stdio.h> int main(void) { int a; while (scanf("%d", &a) != EOF) { printf("%d\n", (a * (a + 1) + 2) / 2); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
52
1
#include <stdio.h> int main(void) { int a = 1, n; int i; while (scanf("%d", &n) != EOF) { for (i = 1; i <= n; i++) a += i; printf("%d\n", a); } return 0; }
#include <stdio.h> int main(void) { int a, n; int i; while (scanf("%d", &n) != EOF) { a = 1; for (i = 1; i <= n; i++) a += i; printf("%d\n", a); } return 0; }
[["-", 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]]
0
65
6
#include <stdio.h> int main(void) { int n, m; char str[100]; for (; fgets(str, sizeof(str), stdin) != NULL;) { sscanf(str, "%d", &n); m = (n * n + 2) / 2; printf("%d\n", m); } return 0; }
#include <stdio.h> int main(void) { int n, m; char str[100]; for (; fgets(str, sizeof(str), stdin) != NULL;) { sscanf(str, "%d", &n); m = (n * n + n + 2) / 2; printf("%d\n", m); } return 0; }
[["+", 12, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72]]
0
77
2
#include <stdio.h> int main(void) { int i, n, sum; while (scanf("%d", &n) != EOF) { sum = 1; for (i = 1; i <= n; i++) { sum += i; } printf("%d", sum); } return 0; }
#include <stdio.h> int main(void) { int i, n, sum; while (scanf("%d", &n) != EOF) { sum = 1; for (i = 1; i <= n; i++) { sum += i; } printf("%d\n", sum); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
67
1
main(a) { while (~scanf("%d", &a)) printf("%d\n", 1 + a * (+1) / 2); }
main(a) { while (~scanf("%d", &a)) printf("%d\n", 1 + a * (a + 1) / 2); }
[["-", 0, 16, 12, 16, 31, 16, 12, 23, 0, 13], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 17, 72], ["+", 12, 16, 31, 16, 12, 23, 0, 16, 12, 13]]
0
37
4
#include <stdio.h> int main() { int n, roop, area = 1; while (scanf("%d", &n) != EOF) { for (roop = 1; roop <= n; roop++) { area += roop; } printf("%d\n", area + 1); area = 0; } return 0; }
#include <stdio.h> int main() { int n, roop, area = 1; while (scanf("%d", &n) != EOF) { for (roop = 1; roop <= n; roop++) { area += roop; } printf("%d\n", area); area = 1; } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
0
71
4
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int main() { char buf[81]; int n = 0; while (scanf("%s\n", b...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int main() { char buf[81]; int n = 0; while (scanf("%s\n", b...
[["+", 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, 12, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
142
4
#include <iostream> #include <string> using namespace std; int main() { string s; int sum = 0; while (cin >> s) { int n = 0; int idx = 0; for (int i = 0; i < s.size(); i++) { if ('0' <= s[i] && s[i] <= '9') n = n * 10 + s[i] - '0'; else if (n) { sum += n; n = 0; ...
#include <iostream> #include <string> using namespace std; int main() { string s; int sum = 0; while (cin >> s) { int n = 0; int idx = 0; for (int i = 0; i < s.size(); i++) { if ('0' <= s[i] && s[i] <= '9') n = n * 10 + s[i] - '0'; else if (n) { sum += n; n = 0; ...
[["+", 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, 12, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
116
4
#include <iostream> using namespace std; int main() { string s; int ans = 0; while (cin >> s) { for (int i = 0, t = 0; i < s.size(); i++) { if (s[i] >= '0' && s[i] <= '9') t = t * 10 + s[i] - '0'; else if (t != 0) { ans += t; t = 0; } } } cout << ans << endl; ...
#include <iostream> using namespace std; int main() { string s; int ans = 0; while (cin >> s) { s += '.'; for (int i = 0, t = 0; i < s.size(); i++) { if (s[i] >= '0' && s[i] <= '9') t = t * 10 + s[i] - '0'; else if (t != 0) { ans += t; t = 0; } } } cout <<...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 1, 0, 11, 12, 103, 0, 104], ["+", 8, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
113
6
#include <algorithm> #include <cstdio> #include <iostream> #include <string> using namespace std; string s; int main(void) { int ans = 0; while (cin >> s) { int c = 0; for (int i = 0; i < (int)s.size(); i++) { if ('0' <= s[i] && s[i] <= '9') { c *= 10; c += s[i] - '0'; } else { ...
#include <algorithm> #include <cstdio> #include <iostream> #include <string> using namespace std; string s; int main(void) { int ans = 0; while (cin >> s) { int c = 0; for (int i = 0; i < (int)s.size(); i++) { if ('0' <= s[i] && s[i] <= '9') { c *= 10; c += s[i] - '0'; } else { ...
[["+", 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, 12, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
117
4
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <ve...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <ve...
[["+", 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
203
4
#include <iostream> #include <string> using namespace std; int main() { string in; int ans = 0; while (getline(cin, in)) { int cnt = 0; for (int i = 0; i < in.size(); ++i) { if ('0' <= in[i] && in[i] <= '9') { cnt *= 10; cnt += in[i] - '0'; } else { ans += cnt; ...
#include <iostream> #include <string> using namespace std; int main() { string in; int ans = 0; while (getline(cin, in)) { int cnt = 0; for (int i = 0; i < in.size(); ++i) { if ('0' <= in[i] && in[i] <= '9') { cnt *= 10; cnt += in[i] - '0'; } else { ans += cnt; ...
[["+", 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, 12, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
115
4
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string.h> using namespace std; int main() { string in; int num = 0; while (cin >> in) { bool flag = false; int temp = 0; for (int i = 0; i < in.length(); i++) { if ('0' <= in[i] && in[i] <= '9'...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string.h> using namespace std; int main() { string in; int num = 0; while (cin >> in) { bool flag = false; int temp = 0; for (int i = 0; i <= in.length(); i++) { if ('0' <= in[i] && in[i] <= '9...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
138
2
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> using namespace std; int main() { int len; char num[6] = {'\0'}; int total = 0; char s[86]; while (cin >> s) { for (int i = 0; i < strlen(s) - 1; i++) { len = 0; if (s[i] >= '0' && s[i] <= '9') { for (int j = ...
#include <cstdlib> #include <cstring> #include <iostream> using namespace std; int main() { int len; char num[6] = {'\0'}; int total = 0; char s[86]; while (cin >> s) { for (int i = 0; i <= strlen(s) - 1; i++) { len = 0; if (s[i] >= '0' && s[i] <= '9') { for (int j = i; j < i + 5; j++...
[["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
189
4
a=[] while gets a<<$_.chomp.split(/[a-z]+/).map(&:to_i) end p a.flatten.inject(:+)
a=[] while gets a<<$_.chomp.split(/[^0-9]+/).map(&:to_i) end p a.flatten.inject(:+)
[["-", 12, 652, 486, 652, 3, 4, 0, 575, 0, 6], ["+", 12, 652, 486, 652, 3, 4, 0, 575, 0, 6]]
4
34
2
#!/usr/bin/env ruby sum = 0 while line = gets stc = line.chomp.split('') ary = [] stc.each do |chr| if chr =~ /^[0-9]+$/ ary << chr.to_i else unless ary.length.zero? ary = ary.reverse (ary.length).times do |i| sum += ary[i] * (10 ** i) end ary = [] ...
#!/usr/bin/env ruby sum = 0 while line = gets stc = line.split('') ary = [] stc.each do |chr| if chr =~ /^[0-9]+$/ ary << chr.to_i else unless ary.length.zero? ary = ary.reverse (ary.length).times do |i| sum += ary[i] * (10 ** i) end ary = [] ...
[["-", 8, 170, 0, 662, 12, 652, 486, 652, 735, 22], ["-", 0, 89, 8, 170, 0, 662, 12, 652, 17, 131]]
4
87
2
suicide = 0 while True: try: sentence = input() start = None last = None for index, char in enumerate(sentence): if char.isdigit(): start = index elif not start == None and not char.isdigit(): last = index suicid...
suicide = 0 while True: try: sentence = input() start = None last = None for index, char in enumerate(sentence): if char.isdigit(): if start == None: start = index elif not start == None and not char.isdigit(): ...
[["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 685], ["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 102], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22]]
5
98
5
ans=0 while True: try: n=input() tmp='' for i in n: if i.isdigit(): tmp+=i elif len(tmp): ans+=int(tmp) tmp='' except: if len(tmp): ans+=int(tmp) tmp='' break print(ans)
ans=0 while True: try: n=input() tmp='' for i in n: if i.isdigit(): tmp+=i elif len(tmp): ans+=int(tmp) tmp='' if len(tmp): ans+=int(tmp) tmp='' except: break print(ans)
[["-", 0, 52, 8, 196, 0, 246, 0, 671, 0, 672], ["-", 0, 52, 8, 196, 0, 246, 0, 671, 0, 102], ["+", 0, 52, 8, 196, 0, 246, 0, 671, 0, 672], ["+", 0, 52, 8, 196, 0, 246, 0, 671, 0, 102]]
5
71
4
ans = "" while True: try: memo = input() except: break for m in memo: ans = ans+m if m.isdigit() else ans+"@" print(sum(ans.replace("@", " ").split()))
ans = "" while True: try: memo = input() except: break for m in memo: ans = ans+m if m.isdigit() else ans+"@" print(sum(map(int, ans.replace("@", " ").split())))
[["+", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
61
5
import re try: ls = num = [] result = 0 while True: ls.append(input()) except: for i in ls: for s in range(re.findall(r'\d+', i)): result += int(s) print(result)
import re try: ls = [] result = 0 while True: ls.append(input()) except: for i in ls: for s in re.findall(r'\d+', i): result += int(s) print(result)
[["-", 8, 196, 0, 1, 0, 662, 12, 662, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 662, 0, 32], ["-", 0, 7, 8, 196, 0, 7, 12, 652, 63, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
58
11
import re l=0 try: while True: x=input() for i in re.findall(r'\d+',x): lst+=int(i) except: print(l)
import re l=0 try: while True: x=input() for i in re.findall(r'\d+',x): l+=int(i) except: print(l)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22]]
5
41
2
s="".join([s for s in sys.stdin]) p=re.compile('\d+') x=p.findall(s) print(sum(map(int,x)))
import sys,re s="".join([s for s in sys.stdin]) p=re.compile('\d+') x=p.findall(s) print(sum(map(int,x)))
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 21]]
5
47
4
import java.util.Scanner; public class Main { private Scanner sc; public static void main(String[] args) { new Main(); } public Main() { sc = new Scanner(System.in); int[][] table = new int[2][1000]; for (int i = 0; i < table.length; i++) { for (int j = 0; j < table[0].length; j++) { ...
import java.util.Scanner; public class Main { private Scanner sc; public static void main(String[] args) { new Main(); } public Main() { sc = new Scanner(System.in); int[][] table = new int[2][1000]; for (int i = 0; i < table.length; i++) { for (int j = 0; j < table[0].length; j++) { ...
[["-", 3, 4, 0, 16, 31, 16, 12, 5, 0, 491], ["+", 3, 4, 0, 16, 31, 16, 12, 5, 0, 491]]
3
295
2
#include <stdio.h> #include <string.h> int p[10010], n[10010]; int main() { char line[100]; int a, b; int flag = 1; int i; while (gets(line) != NULL) { if (line[0] == '\n') flag = 0; else { sscanf(line, "%d,%d", &a, &b); if (flag) p[a]++; else n[a]++; } ...
#include <stdio.h> #include <string.h> int p[10010], n[10010]; int main() { char line[100]; int a, b; int flag = 1; int i; while (fgets(line, 99, stdin) != NULL) { if (line[0] == '\n') flag = 0; else { sscanf(line, "%d,%d", &a, &b); if (flag) p[a]++; else n[a]...
[["-", 0, 52, 15, 23, 0, 16, 31, 2, 63, 22], ["+", 0, 52, 15, 23, 0, 16, 31, 2, 63, 22], ["+", 15, 23, 0, 16, 31, 2, 3, 4, 0, 21], ["+", 15, 23, 0, 16, 31, 2, 3, 4, 0, 13], ["+", 15, 23, 0, 16, 31, 2, 3, 4, 0, 22]]
0
157
6
#include <stdio.h> #include <string.h> int size = 0; struct Cust { int num, total, flg; } c[1000], tmp; int find(struct Cust x) { int i; for (i = 0; i < size; i++) { if (c[i].num == x.num) return i; } return -1; } void insert(struct Cust x) { int i; x.total = 1; x.flg = 0; for (i = si...
#include <stdio.h> #include <string.h> int size = 0; struct Cust { int num, total, flg; } c[1000], tmp; int find(struct Cust x) { int i; for (i = 0; i < size; i++) { if (c[i].num == x.num) return i; } return -1; } void insert(struct Cust x) { int i; x.total = 1; x.flg = 0; for (i = si...
[["-", 15, 16, 12, 16, 12, 118, 28, 69, 28, 22], ["-", 15, 16, 12, 16, 12, 118, 28, 69, 0, 70], ["-", 15, 16, 12, 16, 12, 118, 28, 69, 71, 22], ["-", 15, 16, 12, 16, 12, 118, 28, 69, 0, 73], ["+", 0, 7, 15, 16, 12, 16, 12, 118, 28, 22]]
0
384
5
#include <stdio.h> #define isNum(a) (a <= '9' && a >= '0') #define N_MAX 500 // 適当 char ch; int c[N_MAX], f[N_MAX]; int parseInt() { int res = ch - '0'; while (ch = getchar(), isNum(ch)) res = res * 10 + ch - '0'; return res; } int main(void) { int n; for (n = 0; n < N_MAX; n++) c[n] = f[n] = 0; ...
#include <stdio.h> #define isNum(a) (a <= '9' && a >= '0') #define N_MAX 10000 // 適当 char ch; int c[N_MAX], f[N_MAX]; int parseInt() { int res = ch - '0'; while (ch = getchar(), isNum(ch)) res = res * 10 + ch - '0'; return res; } int main(void) { int n; for (n = 0; n < N_MAX; n++) c[n] = f[n] = 0;...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
0
246
2
#include <bits/stdc++.h> using namespace std; int main(void) { string s; int a[3][1010]; while (getline(cin, s), s != "") { int c, d; stringstream ss(s); ss >> c >> d; a[0][c]++; } while (getline(cin, s), s != "") { int c, d; stringstream ss(s); ss >> c >> d; a[1][c]++; } ...
#include <bits/stdc++.h> using namespace std; int main(void) { string s; int a[3][1010]; while (getline(cin, s), s != "") { int c, d; stringstream ss(s); ss >> c >> d; a[0][c]++; } while (getline(cin, s), s != "") { int c, d; stringstream ss(s); ss >> c >> d; a[1][c]++; } ...
[["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 44]]
1
173
4
#include <algorithm> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; const int INF = 1 << 30; const int MOD = 1e9 + 7; con...
#include <algorithm> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; const int INF = 1 << 30; const int MOD = 1e9 + 7; con...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
329
4
#include <iostream> #include <string> using namespace std; string S; int x[100000][2]; int c = 0; int main() { while (getline(cin, S)) { if (S.size() == 0) { c++; } string T[2]; int ok = 0; for (int i = 0; i < S.size(); i++) { if (S[i] == ',') { ok++; } else { T[o...
#include <iostream> #include <string> using namespace std; string S; int x[100000][2]; int c = 0; int main() { while (getline(cin, S)) { if (S.size() == 0) { c++; continue; } string T[2]; int ok = 0; for (int i = 0; i < S.size(); i++) { if (S[i] == ',') { ok++; } el...
[["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 35]]
1
201
2
#include <cstdlib> #include <iostream> #include <map> #include <string> using namespace std; int main() { string in; map<int, int> c, d; map<int, int>::iterator p; //¡ŒŽ‚̓ǂݍž‚Ý while (getline(cin, in)) { if (in.size() == 1) break; int n = atoi(in.c_str()); p = c.find(n); if (c.end...
#include <cstdlib> #include <iostream> #include <map> #include <string> using namespace std; int main() { string in; map<int, int> c, d; map<int, int>::iterator p; //¡ŒŽ‚̓ǂݍž‚Ý while (getline(cin, in)) { if (in.size() == 0) break; int n = atoi(in.c_str()); p = c.find(n); if (c.end...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
264
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...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
610
2
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> P; in...
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> P; in...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 25], ["+", 75, 76, 0, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 75, 76, 0, 9, 0, 57, 64, 9, 0, 46]]
1
252
6
a,b=gets(p).split("\n\n"); c=[0]*2000;d=[0]*2000; ans=[]; a.split.map{|s|b=s.to_i;c[b]+=1} b.split.map{|s|b=s.to_i;ans<<b if c[b]>0;d[b]+=1} ans=ans.sort.uniq; ans.map{|a|puts "#{a} #{c[a]+d[a]}"}
a,b=gets(p).split("\n\n"); c=[0]*2000;d=[0]*2000; ans=[]; a.split.map{|s|l=s.to_i;c[l]+=1} b.split.map{|s|b=s.to_i;ans<<b if c[b]>0;d[b]+=1} ans=ans.sort.uniq; ans.map{|a|puts "#{a} #{c[a]+d[a]}"}
[["-", 0, 652, 196, 196, 8, 734, 0, 662, 31, 22], ["+", 0, 652, 196, 196, 8, 734, 0, 662, 31, 22], ["-", 196, 196, 8, 734, 0, 755, 31, 742, 0, 22], ["+", 196, 196, 8, 734, 0, 755, 31, 742, 0, 22]]
4
110
4
pm = {} while (s = gets) != "\n" (n, c) = s.chomp.split(/,/).map(&:to_i) pm[n] = [] if !pm.key?(n) pm[n].push(c) end tm = {} while (s = gets) != "\n" (n, c) = s.chomp.split(/,/).map(&:to_i) tm[n] = [] if !tm.key?(n) tm[n].push(c) end pm.keys.sort.each do |k| if tm.key?(k) puts "#{k} #{pm[k].size +...
pm = {} while (s = gets) != "\n" (n, c) = s.chomp.split(/,/).map(&:to_i) pm[n] = [] if !pm.key?(n) pm[n].push(c) end tm = {} while s = gets (n, c) = s.chomp.split(/,/).map(&:to_i) tm[n] = [] if !tm.key?(n) tm[n].push(c) end pm.keys.sort.each do |k| if tm.key?(k) puts "#{k} #{pm[k].size + tm[k].siz...
[["-", 0, 493, 0, 89, 15, 738, 31, 739, 0, 24], ["-", 0, 493, 0, 89, 15, 738, 31, 739, 0, 25], ["-", 36, 36, 0, 493, 0, 89, 15, 738, 17, 79], ["-", 0, 493, 0, 89, 15, 738, 12, 557, 0, 62], ["-", 0, 493, 0, 89, 15, 738, 12, 557, 0, 44]]
4
164
6
import sys b=0 a=[{},{}] for e in sys.stdin: if'\n'==e:b=1 else:c_=e.split(',');c=int(c);a[b].setdefault(c,0);a[b][c]+=1 for k in sorted({*a[0]}&{*a[1]}):print(k,a[0][k]+a[1][k])
import sys b=0 a=[{},{}] for e in sys.stdin: if'\n'==e:b=1 else:c,_=e.split(',');c=int(c);a[b].setdefault(c,0);a[b][c]+=1 for k in sorted({*a[0]}&{*a[1]}):print(k,a[0][k]+a[1][k])
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 8, 196, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 8, 196, 0, 1, 0, 662, 31, 684, 0, 21]]
5
114
4
data1, data2 = [],[] while True: try: n,day = list(map(int, input().split(","))) data1.append(n) except: break while True: try: n,day = list(map(int, input().split(","))) data2.append(n) except: break data = sorted(list(set(data1))) for i in data: if ...
data1, data2 = [],[] while True: try: n,day = list(map(int, input().split(","))) data1.append(n) except: break while True: try: n,day = list(map(int, input().split(","))) data2.append(n) except: break data = sorted(list(set(data1))) for i in data: if ...
[["-", 3, 4, 0, 657, 31, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 22], ["-", 3, 4, 0, 657, 12, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 22]]
5
126
4
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringBuilder build...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringBuilder build...
[["+", 0, 57, 15, 15, 0, 16, 31, 23, 0, 24], ["+", 0, 57, 15, 15, 0, 16, 31, 23, 0, 25], ["+", 0, 11, 31, 504, 71, 16, 31, 16, 17, 48], ["+", 0, 11, 31, 504, 71, 16, 31, 16, 12, 499], ["+", 0, 1, 0, 11, 31, 504, 71, 16, 17, 72], ["+", 0, 1, 0, 11, 31, 504, 71, 16, 12, 22]]
3
465
6
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); for (; scanner.hasNext();) { String input = scanner.next(); String[][] map = new String[3][3]; for (int i = 0; i < input.length(); i++) { map[i / 3][i %...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); for (; scanner.hasNext();) { String input = scanner.next(); String[][] map = new String[3][3]; for (int i = 0; i < input.length(); i++) { map[i / 3][i %...
[["-", 0, 1, 0, 11, 12, 504, 516, 504, 71, 22], ["+", 0, 1, 0, 11, 12, 504, 516, 504, 71, 499], ["-", 64, 196, 0, 1, 0, 11, 12, 504, 71, 499], ["+", 64, 196, 0, 1, 0, 11, 12, 504, 71, 22]]
3
581
4
import java.io.*; import java.util.*; class Main { public static void main(String[] args) { final Scanner stdin = new Scanner(System.in); while (stdin.hasNextLine()) { final String input = stdin.nextLine(); final boolean winO = win('o', input); final boolean winX = win('x', input); ...
import java.io.*; import java.util.*; class Main { public static void main(String[] args) { final Scanner stdin = new Scanner(System.in); while (stdin.hasNextLine()) { final String input = stdin.nextLine(); final boolean winO = win('o', input); final boolean winX = win('x', input); ...
[["-", 31, 492, 3, 4, 0, 16, 31, 16, 12, 499], ["-", 12, 16, 31, 492, 3, 4, 0, 16, 17, 72], ["+", 12, 16, 31, 492, 3, 4, 0, 16, 17, 72], ["+", 12, 16, 31, 492, 3, 4, 0, 16, 12, 499]]
3
353
4
char *p = "012345678036147258048246", f, s[]; main(i) { for (; read(0, s, 10); i || puts("d")) for (i = 24; i > 1; f - 's' && f == s[p[i + 1] - 48] & f == s[p[i + 2] - 48] && puts(&f, i = 1)) f = s[p[i -= 3] - 48]; }
char *p = "012345678036147258048246", f, s[11]; main(i) { for (; read(0, s, 10); i || puts("d")) for (i = 24; i > 1; f - 's' && f == s[p[i + 1] - 48] & f == s[p[i + 2] - 48] && puts(&f, i = 1)) f = s[p[i -= 3] - 48]; }
[["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
0
109
1
// AOJ Volume 0 Problem 0066 #include <stdio.h> #include <stdlib.h> int main(void) { char in_str[81]; int field[9]; int i, j; int check; while (scanf("%s", in_str) != EOF) { for (i = 0; i < 9; i++) { if (in_str[i] == 'o') { field[i] = 1; } else if (in_str[i] == 'x') { field...
// AOJ Volume 0 Problem 0066 #include <stdio.h> #include <stdlib.h> int main(void) { char in_str[81]; int field[9]; int i, j; int check; while (scanf("%s", in_str) != EOF) { for (i = 0; i < 9; i++) { if (in_str[i] == 'o') { field[i] = 1; } else if (in_str[i] == 'x') { field...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
0
311
4
#include <stdio.h> int main(void) { int i; int end; char board[3][3]; while (scanf("%c%c%c%c%c%c%c%c%c", &board[0][0], &board[0][1], &board[0][2], &board[1][0], &board[1][1], &board[1][2], &board[2][0], &board[2][1], &board[2][2]) != EOF) { end = 0; for (i = 0; i < 3; i++)...
#include <stdio.h> int main(void) { int i; int end; char board[3][3]; while (scanf("%c%c%c%c%c%c%c%c%c", &board[0][0], &board[0][1], &board[0][2], &board[1][0], &board[1][1], &board[1][2], &board[2][0], &board[2][1], &board[2][2]) != EOF) { end = 0; for (i = 0; i < 3; i++)...
[["-", 31, 16, 12, 16, 12, 69, 28, 69, 71, 13], ["+", 31, 16, 12, 16, 12, 69, 28, 69, 71, 13]]
0
470
2
#include <iostream> using namespace std; string s; main() { while (cin >> s) { int f = 0; for (int i = 0; i < 3; i++) { if (s[i * 3] != 's' && s[i * 3] == s[i * 3 + 1] && s[i * 3] == s[i * 3 + 2]) { f = 1; cout << s[i * 3] << endl; } } for (int i = 0; i < 3; i++) ...
#include <iostream> using namespace std; string s; main() { while (cin >> s) { int f = 0; for (int i = 0; i < 3; i++) { if (s[i * 3] != 's' && s[i * 3] == s[i * 3 + 1] && s[i * 3] == s[i * 3 + 2]) { f = 1; cout << s[i * 3] << endl; } } for (int i = 0; i < 3; i++) ...
[["-", 51, 16, 12, 16, 12, 69, 341, 342, 0, 13], ["+", 51, 16, 12, 16, 12, 69, 341, 342, 0, 13]]
1
276
2
#include <iostream> #include <string> #include <vector> using namespace std; int main() { string s; while (cin >> s) { string ox = "ox"; string res = "d"; for (int i = 0; i < 2; ++i) { bool ok = false; if (s[0] == ox[i] && s[0] == s[1] && s[1] == s[2]) ok = true; if (s[0] == o...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { string s; while (cin >> s) { string ox = "ox"; string res = "d"; for (int i = 0; i < 2; ++i) { bool ok = false; if (s[0] == ox[i] && s[0] == s[1] && s[1] == s[2]) ok = true; if (s[3] == o...
[["-", 31, 16, 31, 16, 31, 69, 341, 342, 0, 13], ["+", 31, 16, 31, 16, 31, 69, 341, 342, 0, 13]]
1
370
10
#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...
[["-", 12, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 12, 16, 31, 69, 28, 69, 341, 342, 0, 13]]
1
678
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 stoi(string x) { stringstream ss; ss << x; int tmp; ss >> tmp; retur...
#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 stoi(string x) { stringstream ss; ss << x; int tmp; ss >> tmp; retur...
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95]]
1
303
1
#include <bits/stdc++.h> #define SIZE 300005 #define MOD 1000000007LL #define INF 1 << 30 #define LLINF 1LL << 60 #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, a, b) for (int i = a; i <= b; i++) #define DOWN(i, b, a) for (int i = b; i >= a; i--) #define SET(a, c) memset(a, c, sizeof a) #define FORALL(i, ...
#include <bits/stdc++.h> #define SIZE 300005 #define MOD 1000000007LL #define INF 1 << 30 #define LLINF 1LL << 60 #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, a, b) for (int i = a; i <= b; i++) #define DOWN(i, b, a) for (int i = b; i >= a; i--) #define SET(a, c) memset(a, c, sizeof a) #define FORALL(i, ...
[["-", 12, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["-", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 64, 37, 0, 69, 341, 342, 0, 16, 17, 48], ["-", 64, 37, 0, 69, 341, 342, 0, 16, 12, 13]]
1
499
4
#include <bits/stdc++.h> using namespace std; int main() { int dat[3][3]; char in; int sum; while (cin >> in) { if (in == 'o') dat[0][0] = 1; else if (in == 'x') dat[0][0] = -1; else dat[0][0] = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { i...
#include <bits/stdc++.h> using namespace std; int main() { int dat[3][3]; char in; int sum; while (cin >> in) { if (in == 'o') dat[0][0] = 1; else if (in == 'x') dat[0][0] = -1; else dat[0][0] = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { i...
[["-", 0, 11, 12, 69, 341, 342, 0, 16, 31, 13], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 31, 13]]
1
411
2
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; ++i) #define REPR(i, n) for (...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; ++i) #define REPR(i, n) for (...
[["-", 31, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["+", 31, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["-", 31, 16, 12, 16, 31, 69, 341, 342, 0, 22], ["+", 31, 16, 12, 16, 31, 69, 341, 342, 0, 22], ["-", 12, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["+", 12, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["-", 51, 16, 12, 16, 31, 69, 3...
1
386
12
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <set> #include <stack> #include <string> #include <vector> using namespace std; bool win(char *t, char c) { for (int y = 0; y < 3; ++y) { bo...
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <set> #include <stack> #include <string> #include <vector> using namespace std; bool win(char *t, char c) { for (int y = 0; y < 3; ++y) { bo...
[["-", 31, 69, 341, 342, 0, 16, 31, 16, 31, 22], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 31, 22], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 22], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 12, 22]]
1
301
4
#include <iostream> int main() { char c[9]; while (std::cin >> c) { if (std::cin.eof()) break; bool f = true; for (int i = 0; i < 3; i++) { if (c[i * 3] == c[i * 3 + 1] && c[i * 3] == c[i * 3 + 2]) { if (c[i * 3] != 's') { std::cout << c[i * 3] << std::endl; f = ...
#include <iostream> int main() { char c[9]; while (std::cin >> c) { if (std::cin.eof()) break; bool f = true; for (int i = 0; i < 3; i++) { if (c[i * 3] == c[i * 3 + 1] && c[i * 3] == c[i * 3 + 2]) { if (c[i * 3] != 's') { std::cout << c[i * 3] << std::endl; f = ...
[["-", 64, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 64, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13]]
1
320
6
#include <cstdio> #include <iostream> using namespace std; int main() { char data[9]; int jadge = 0; // 0‚È‚çˆø‚«•ª‚¯//‚P‚È‚ço//2‚È‚çx while (cin >> data) { jadge = 0; for (int i = 0, j = 0; i < 3; i++, j += 2) { //‰¡‚É•À‚Ô‚Æ‚« if (data[0 + j] == 'o' && data[1 + j] == 'o' && data[2 + j] == 'o') ...
#include <cstdio> #include <iostream> using namespace std; int main() { char data[12]; int jadge = 0; // 0‚È‚çˆø‚«•ª‚¯//‚P‚È‚ço//2‚È‚çx while (cin >> data) { jadge = 0; for (int i = 0, j = 0; i < 3; i++, j += 3) { //‰¡‚É•À‚Ô‚Æ‚« if (data[0 + j] == 'o' && data[1 + j] == 'o' && data[2 + j] == 'o') ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 7, 26, 34, 12, 11, 12, 13], ["+", 8, 9, 0, 7, 26, 34, 12, 11, 12, 13]]
1
418
4
#include <algorithm> #include <bits/stdc++.h> using namespace std; char sute[1]; char m[8][8]; int w[12][2] = {{-3, 0}, {-2, 0}, {-1, 0}, {3, 0}, {2, 0}, {1, 0}, {0, -3}, {0, -2}, {0, -1}, {0, 1}, {0, 2}, {0, 3}}; void bomb(int i, int j) { int ni, nj; for (int k = 0; k < 12; ++k) { m[i][j] = '0...
#include <algorithm> #include <bits/stdc++.h> using namespace std; char sute[1]; char m[8][8]; int w[12][2] = {{-3, 0}, {-2, 0}, {-1, 0}, {3, 0}, {2, 0}, {1, 0}, {0, -3}, {0, -2}, {0, -1}, {0, 1}, {0, 2}, {0, 3}}; void bomb(int i, int j) { int ni, nj; for (int k = 0; k < 12; ++k) { m[i][j] = '0...
[["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
412
3
#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 #def...
#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 #def...
[["+", 0, 1, 0, 16, 31, 16, 12, 103, 0, 104], ["+", 0, 1, 0, 16, 31, 16, 12, 103, 0, 125], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151]]
1
422
4
#include <iostream> #include <string> #define N 8 using namespace std; string m[N]; void bomb(int x, int y) { if (!(0 <= x && x < N && 0 <= y && y < N)) return; if (m[x][y] != '1') return; m[x][y] = '0'; bomb(x + 1, y); bomb(x + 2, y); bomb(x + 3, y); bomb(x - 1, y); bomb(x - 2, y); bomb(x -...
#include <iostream> #include <string> #define N 8 using namespace std; string m[N]; void bomb(int x, int y) { if (!(0 <= x && x < N && 0 <= y && y < N)) return; if (m[x][y] != '1') return; m[x][y] = '0'; bomb(x + 1, y); bomb(x + 2, y); bomb(x + 3, y); bomb(x - 1, y); bomb(x - 2, y); bomb(x -...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]]
1
304
4
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; int dx[] = {1, 2, 3, -1, -2, -3, 0, 0, 0, 0, 0, 0}; int dy[] = {0, 0, 0, 0, 0, 0, 1, 2, 3, -1, -2, -3}; int main() { int n; cin >> n; r(pp, n) { string s[8]; r(i, 8) cin >> s[i]; int x1, y1; cin >> x1 >> y1; ...
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; int dx[] = {1, 2, 3, -1, -2, -3, 0, 0, 0, 0, 0, 0}; int dy[] = {0, 0, 0, 0, 0, 0, 1, 2, 3, -1, -2, -3}; int main() { int n; cin >> n; r(pp, n) { string s[8]; r(i, 8) cin >> s[i]; int x1, y1; cin >> x1 >> y1; ...
[["-", 49, 50, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 49, 50, 51, 16, 12, 69, 341, 342, 0, 22]]
1
322
4
#include <bits/stdc++.h> #define rep(i, j, k) for (int i = (int)j; i < (int)k; i++) #define itrep(x) for (auto it = (x).begin(); it != (x).end(); it++) #define Sort(x) sort((x).begin(), (x).end()) #define all(x) (x).begin(), (x).end() #define fi first #define se second #define vi vector<int> #define INF (int)1e9 #defin...
#include <bits/stdc++.h> #define rep(i, j, k) for (int i = (int)j; i < (int)k; i++) #define itrep(x) for (auto it = (x).begin(); it != (x).end(); it++) #define Sort(x) sort((x).begin(), (x).end()) #define all(x) (x).begin(), (x).end() #define fi first #define se second #define vi vector<int> #define INF (int)1e9 #defin...
[["-", 31, 16, 12, 16, 31, 16, 31, 5, 0, 6], ["+", 31, 16, 12, 16, 31, 16, 31, 5, 0, 6]]
1
457
2
#include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <vector> using namespace std; int n, t[8][8]; string str; int ch(int y, int x) { if (0 <= y && y <= 7 && 0 <= x && x <= 7) return t[y][x]; return 0; } void bomb(int y, int x) { t[y][x] = 0; for (int i = 0; i <= 3; i++) ...
#include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <vector> using namespace std; int n, t[8][8]; string str; int ch(int y, int x) { if (0 <= y && y <= 7 && 0 <= x && x <= 7) return t[y][x]; return 0; } void bomb(int y, int x) { t[y][x] = 0; for (int i = 0; i <= 3; i++) ...
[["+", 0, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 16, 31, 16, 31, 16, 12, 16, 12, 13]]
1
356
2
#include <bits/stdc++.h> using namespace std; int main() { int times; cin >> times; for (int i = 0; i < times; ++i) { cout << endl; int place[8][8]; bitset<8> bomb; for (int j = 0; j < 8; ++j) { cin >> bomb; for (int k = 0; k < 8; ++k) { place[j][k] = bomb[7 - k]; } ...
#include <bits/stdc++.h> using namespace std; int main() { int times; cin >> times; for (int i = 0; i < times; ++i) { // cout<<endl; int place[8][8]; bitset<8> bomb; for (int j = 0; j < 8; ++j) { cin >> bomb; for (int k = 0; k < 8; ++k) { place[j][k] = bomb[7 - k]; } ...
[["-", 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
533
4
#include <iostream> #include <string> #define COLS 8 #define ROWS 8 using namespace std; void ExplodeBomb(int map[][COLS + 6], int x, int y) { int dij[] = {1, 2, 3, -1, -2, -3}; if (map[y + 3][x + 3] == 0) return; map[y + 3][x + 3] = 0; for (int i = 0; i < sizeof(dij) / sizeof(*dij); i++) { Explode...
#include <iostream> #include <string> #define COLS 8 #define ROWS 8 using namespace std; void ExplodeBomb(int map[][COLS + 6], int x, int y) { int dij[] = {1, 2, 3, -1, -2, -3}; if (map[y + 3][x + 3] == 0) return; map[y + 3][x + 3] = 0; for (int i = 0; i < sizeof(dij) / sizeof(*dij); i++) { Explode...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
406
2
#include <stdio.h> int ma[8][8]; int main() { int n, data = 0, i, j, x, y, a, b; scanf("%d", &n); for (; n > 0; --n) { ++data; for (i = 0; i < 8; ++i) { for (j = 0; j < 8; j++) { scanf("%1d", &ma[i][j]); } } scanf("%d%d", &x, &y); --x; --y; ma[y][x] = 0; for...
#include <stdio.h> int ma[8][8]; int main() { int n, data = 0, i, j, x, y, a, b; scanf("%d", &n); for (; n > 0; --n) { ++data; for (i = 0; i < 8; ++i) { for (j = 0; j < 8; j++) { scanf("%1d", &ma[i][j]); } } scanf("%d%d", &x, &y); --x; --y; ma[y][x] = 0; for...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
558
8
#include <iostream> #include <string> using namespace std; void bomb(string s[], int a, int b) { s[a][b] = '0'; for (int i = 1; i <= 3; i++) { if (b + i < 8 && s[a][b + i] == '1') bomb(s, a, b + i); if (b - i >= 0 && s[a][b - i] == '1') bomb(s, a, b - i); if (a + i < 8 && s[a + i][b] == '1'...
#include <iostream> #include <string> using namespace std; void bomb(string s[], int a, int b) { s[a][b] = '0'; for (int i = 1; i <= 3; i++) { if (b + i < 8 && s[a][b + i] == '1') bomb(s, a, b + i); if (b - i >= 0 && s[a][b - i] == '1') bomb(s, a, b - i); if (a + i < 8 && s[a + i][b] == '1'...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
1
308
4
#include <algorithm> #include <cassert> #include <cctype> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> using namespace std; int N, sx, sy, field[8][9], dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; char c; void bomb(int x, int y) { field[y][x] = 0; for ...
#include <algorithm> #include <cassert> #include <cctype> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> using namespace std; int N, sx, sy, field[8][9], dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; char c; void bomb(int x, int y) { field[y][x] = 0; for ...
[["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
340
4
#include <cstring> #include <iostream> using namespace std; void bomb(int map[14][14], int x, int y) { map[x][y] = 0; for (int i = -3; i <= 3; i++) { if (map[x + i][y]) { bomb(map, x + i, y); } if (map[x][y + i]) { bomb(map, x, y + i); } } } int main() { int n; cin >> n; for (i...
#include <cstring> #include <iostream> using namespace std; void bomb(int map[14][14], int x, int y) { map[x][y] = 0; for (int i = -3; i <= 3; i++) { if (map[x + i][y]) { bomb(map, x + i, y); } if (map[x][y + i]) { bomb(map, x, y + i); } } } int main() { int n; cin >> n; for (i...
[["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151]]
1
289
4
#include <cstdio> #include <iostream> #include <string> using namespace std; string s[8]; void bomb(int x, int y) { s[x][y] = '0'; for (int i = -3; i <= 3; i++) { if (x + i >= 0 && x + i < 8 && s[x + i][y] == '1') { s[x + i][y] = '0'; bomb(x + i, y); } if (y + i >= 0 && y + i < 8 && s[x][y ...
#include <cstdio> #include <iostream> #include <string> using namespace std; string s[8]; void bomb(int x, int y) { s[x][y] = '0'; for (int i = -3; i <= 3; i++) { if (x + i >= 0 && x + i < 8 && s[x + i][y] == '1') { s[x + i][y] = '0'; bomb(x + i, y); } if (y + i >= 0 && y + i < 8 && s[x][y ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
280
2