buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
#include <algorithm> #include <iostream> #include <string> #include <vector> int main() { int dataSetNum; std::cin >> dataSetNum; std::vector<std::string> str; str.resize(dataSetNum); std::cin.ignore(); // input for (int i = 0; i < dataSetNum; ++i) { // input std::string tmp; getline(std::...
#include <algorithm> #include <iostream> #include <string> #include <vector> int main() { int dataSetNum; std::cin >> dataSetNum; std::vector<std::string> str; str.resize(dataSetNum); std::cin.ignore(); // input for (int i = 0; i < dataSetNum; ++i) { // input std::string tmp; getline(std::...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
214
2
#include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; while (n--) { string s; getline(cin, s); for (int i = 6; i < s.length(); i++) if (s[i] == 'o' && s[i - 1] == 'n' && s[i - 2] == 'i' && s[i - 3] == 'h' && s[i - 4] == 's' && s[i - 5] == 'o' && ...
#include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; cin.ignore(); while (n--) { string s; getline(cin, s); for (int i = 6; i < s.length(); i++) if (s[i] == 'o' && s[i - 1] == 'n' && s[i - 2] == 'i' && s[i - 3] == 'h' && s[i - 4] == 's' && s[i - 5...
[["+", 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], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
214
6
#include <bits/stdc++.h> using namespace std; int main() { string s; int n; cin >> n; cin.ignore(); for (int i = 0; i < n; i++) { getline(cin, s); while (s.find("Hoshino") != string::npos) { s.replace(s.find("Hoshino"), 7, "Hashino"); } cout << s << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { string s; int n; cin >> n; cin.ignore(); for (int i = 0; i < n; i++) { getline(cin, s); while (s.find("Hoshino") != string::npos) { s.replace(s.find("Hoshino"), 7, "Hoshina"); } cout << s << endl; } }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
94
2
#include <iostream> #include <string> using namespace std; int main() { int n, i = 0; string s; cin >> n; for (; i < n; i++) { getline(cin, s); while (s.find("Hoshino") != string::npos) s.replace(s.find("Hoshino"), 7, "Hoshina"); cout << s << endl; } }
#include <iostream> #include <string> using namespace std; int main() { int n, i = 0; string s; cin >> n; cin.ignore(); for (; i < n; i++) { getline(cin, s); while (s.find("Hoshino") != string::npos) s.replace(s.find("Hoshino"), 7, "Hoshina"); cout << s << endl; } }
[["+", 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], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
88
6
#include <iostream> #include <string> int main() { std::string str; int num; int start = 0; std::cin >> num; getline(std::cin, str); // skip "\n" for (int i = 0; i < num; ++i) { std::getline(std::cin, str); while (start != -1) { if (start == 0) { // for first loop start = (int)s...
#include <iostream> #include <string> int main() { std::string str; int num; int start = 0; std::cin >> num; getline(std::cin, str); // skip "\n" for (int i = 0; i < num; ++i) { std::getline(std::cin, str); while (start != -1) { if (start == 0) { // for first loop start = (int)s...
[["-", 12, 74, 51, 2, 3, 4, 0, 16, 12, 13], ["+", 12, 74, 51, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72]]
1
158
4
#include <bits/stdc++.h> using namespace std; int main() { string str; int n; cin >> n; cin.ignore(); while (n--) { getline(cin, str); for (int j = 0; j < (int)str.size() - 7; j++) { string key = str.substr(j, 7), repl; if (key == "Hoshino") { repl = "Hoshina"; for (int ...
#include <bits/stdc++.h> using namespace std; int main() { string str; int n; cin >> n; cin.ignore(); while (n--) { getline(cin, str); for (int j = 0; j < (int)str.size(); j++) { string key = str.substr(j, 7), repl; if (key == "Hoshino") { repl = "Hoshina"; for (int k = ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 13]]
1
134
4
#include <iostream> #include <string> using namespace std; int main() { string str; int n; cin >> n; for (int i = 0; i < n; ++i) { getline(cin, str); while (string::npos != str.find("Hoshino")) { int pnt = str.find("Hoshino"); str.replace(pnt, 7, "Hoshina"); } cout << str << e...
#include <iostream> #include <string> using namespace std; int main() { string str; int n; cin >> n; cin.ignore(); for (int i = 0; i < n; ++i) { getline(cin, str); while (string::npos != str.find("Hoshino")) { int pnt = str.find("Hoshino"); str.replace(pnt, 7, "Hoshina"); } ...
[["+", 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], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
95
6
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <memory> #include <numeric> #include <queue> #include ...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <memory> #include <numeric> #include <queue> #include ...
[["-", 8, 9, 0, 1, 0, 11, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 11, 12, 5, 0, 6]]
1
301
4
#include <bits/stdc++.h> using namespace std; int main() { int n, i; scanf("%d ", &n); while (n--) { string s; for (getline(cin, s), i = 0; i < s.size(); i++) { if (s[i] == 'H') if (s[i + 1] == 'o') if (s[i + 2] == 's') if (s[i + 3] == 'h') if (s[i + 4] ==...
#include <bits/stdc++.h> using namespace std; int main() { int n, i; scanf("%d ", &n); while (n--) { string s; for (getline(cin, s), i = 0; i < s.size(); i++) { if (s[i] == 'H') if (s[i + 1] == 'o') if (s[i + 2] == 's') if (s[i + 3] == 'h') if (s[i + 4] ==...
[["-", 64, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["+", 64, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["-", 64, 57, 64, 1, 0, 11, 12, 103, 0, 125], ["+", 64, 57, 64, 1, 0, 11, 12, 103, 0, 125]]
1
169
4
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define pi 3.14159265358979323846264338 using namespace std; int main() { int n; cin >> n; string sub; for (int i = 0; i < n; ++i) { string s; getline(cin, s); for (int j =...
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define pi 3.14159265358979323846264338 using namespace std; int main() { int n; cin >> n; string sub; getchar(); for (int i = 0; i < n; ++i) { string s; getline(cin, s); ...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
140
4
#include <algorithm> #include <cctype> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; while (...
#include <algorithm> #include <cctype> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; getchar...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
109
4
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string s; int n; cin >> n; getline(cin, s); for (int j = 0; j < n; j++) { getline(cin, s); for (int i = 0; i < s.size(); i++) { if (s[i] == 'H' && s[i + 1] == 'o' && s[i + 2] == 's' && ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string s; int n; cin >> n; getline(cin, s); for (int j = 0; j < n; j++) { getline(cin, s); for (int i = 0; i < s.size(); i++) { if (s[i] == 'H' && s[i + 1] == 'o' && s[i + 2] == 's' && ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
182
2
#include <iostream> #include <string> using namespace std; int main() { string str; int n; cin >> n; getline(cin, str); for (int i = 0; i < n; i++) { getline(cin, str); for (int j = 0; j < int(str.size()) - 6; j++) { if (str.substr(j, 6) == "Hoshino") str.replace(j, 7, "Hoshina"); }...
#include <iostream> #include <string> using namespace std; int main() { string str; int n; cin >> n; getline(cin, str); for (int i = 0; i < n; i++) { getline(cin, str); for (int j = 0; j < int(str.size()) - 6; j++) { if (str.substr(j, 7) == "Hoshino") str.replace(j, 7, "Hoshina"); }...
[["-", 15, 339, 51, 16, 31, 2, 3, 4, 0, 13], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 13]]
1
113
2
#include <stdio.h> int main() { int n, i, j = 0, k; char alph, str[1008], temp; scanf("%d", &n); temp = getchar(); for (i = 0; i < n; i++) { for (j = 0;; j++) { str[j] = getchar(); if (str[j] == '\n') { str[j] = '\0'; break; } } for (k = 0; k < j; k++) { i...
#include <stdio.h> int main() { int n, i, j = 0, k; char str[1008], temp; scanf("%d", &n); temp = getchar(); for (i = 0; i < n; i++) { for (j = 0;; j++) { str[j] = getchar(); if (str[j] == '\n') { str[j] = '\0'; break; } } for (k = 0; k < j; k++) { if (st...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 31, 16, 31, 16, 31, 16, 12, 103, 0, 125], ["+", 31, 16, 31, 16, 31, 16, 12, 103, 0, 125], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
223
6
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { int n; scanf("%d ", &n); string a[n]; for (int i = 0; i < n; i++) { getline(cin, a[i]); while (1) { int index; index = a[i].find("Hoshino", index); if ((int)string::npos == index) break;...
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { int n; scanf("%d ", &n); string a[n]; for (int i = 0; i < n; i++) { getline(cin, a[i]); while (1) { int index = 0; index = a[i].find("Hoshino", index); if ((int)string::npos == index) br...
[["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
143
2
#include <iostream> #include <string> int main() { std::string s; int n; std::cin >> n, std::cin.get(); for (; n; n--) { getline(std::cin, s); int pos = 0; while (pos = s.find("Hoshino", pos), pos != std::string::npos) { s.replace(pos, 7, "Hashino"); pos += 7; } std::cout << s <<...
#include <iostream> #include <string> int main() { std::string s; int n; std::cin >> n, std::cin.get(); for (; n; n--) { getline(std::cin, s); int pos = 0; while (pos = s.find("Hoshino", pos), pos != std::string::npos) { s.replace(pos, 7, "Hoshina"); pos += 7; } std::cout << s <<...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
111
2
#include <cstring> #include <iostream> using namespace std; int main() { int n, i, j, k, c, x; char s[1001], r[1001], t[8] = "Hoshino"; cin >> n; cin.ignore('\n'); for (i = 0; i < n; i++) { cin.getline(s, sizeof(s)); c = 0; for (j = 0; j < strlen(s); j++) { r[c] = s[j]; c++; if (...
#include <cstring> #include <iostream> using namespace std; int main() { int n, i, j, k, c, x; char s[1001], r[1001], t[8] = "Hoshino"; cin >> n; cin.ignore(1024, '\n'); for (i = 0; i < n; i++) { cin.getline(s, sizeof(s)); c = 0; for (j = 0; j < strlen(s); j++) { r[c] = s[j]; c++; ...
[["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21]]
1
247
2
#include <stdio.h> int main() { int n, a[5000], m, p, q; bool b[5000], f; while (1) { scanf("%d", &n); if (n == 0) return 0; for (int i = 0; i < 5000; i++) a[i] = b[i] = 0; f = false; for (int i = 0; i < n; i++) { scanf("%d%d%d", &m, &p, &q); if (!b[m]) { a[m] +...
#include <stdio.h> int main() { int n, a[5000], m, p, q; bool b[5000], f; while (1) { scanf("%d", &n); if (n == 0) return 0; for (int i = 0; i < 5000; i++) a[i] = b[i] = 0; f = false; for (int i = 0; i < n; i++) { scanf("%d%d%d", &m, &p, &q); if (!b[m]) { a[m] +...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
181
2
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <math.h> #include <sstream> #include <stdio.h> #include <string.h> #include <string> using namespace std; int main(void) { for (int j = 0; j < 50; j++) { cout << endl; long n, e[4000], x[4000], y[4000], co[100]; cin >>...
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <math.h> #include <sstream> #include <stdio.h> #include <string.h> #include <string> using namespace std; int main(void) { for (int j = 0; j < 50; j++) { long n, e[4000], x[4000], y[4000], co[4000]; cin >> n; if (n == ...
[["-", 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], ["-", 0, 7, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 7, 8, 9, 0, 43, 49, 80, 81, 13]]
1
280
6
#include <iostream> using namespace std; int main() { long long data[2][4000], n, i, f, id, a, b; while (1) { cin >> n; if (n == 0) break; for (i = 0; i < 4000; i++) data[0][i] = -1, data[1][i] = 0; for (i = 0; i < n; i++) { cin >> id >> a >> b; for (f = 0; f < i + 1; f++) { ...
#include <iostream> using namespace std; int main() { long long data[2][4000], n, i, f, id, a, b; while (1) { cin >> n; if (n == 0) break; for (i = 0; i < 4000; i++) data[0][i] = -1, data[1][i] = 0; for (i = 0; i < n; i++) { cin >> id >> a >> b; for (f = 0; f < i + 1; f++) { ...
[["-", 0, 1, 0, 41, 15, 23, 0, 16, 17, 20], ["+", 0, 1, 0, 41, 15, 23, 0, 16, 17, 18]]
1
318
4
#include <iostream> #include <string> using namespace std; int main() { int n; int ans[4000]; for (;;) { cin >> n; if (n == 0) break; int i, j; for (i = 0, j = 0; i < n; i++) { int num[4000]; int flag = 1; double a[4000], b[4000]; double ans_max[4000]; cin >>...
#include <iostream> #include <string> using namespace std; int main() { int n; int ans[4000]; for (;;) { cin >> n; if (n == 0) break; int i, j; for (i = 0, j = 0; i < n; i++) { int num[4000]; int flag = 1; double a[4000], b[4000]; double ans_max[4000]; cin >>...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 17, 68]]
1
277
4
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; #define ll long long bool debug = true; int main(void) { map<int, ll> m; vector<int> order; int n; int no, amount, price; while (cin >> n) { bool exist = false; if (!n) break; for (int i = 0; i...
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; #define ll long long bool debug = false; int main(void) { map<int, ll> m; vector<int> order; int n; long long no, amount, price; while (cin >> n) { bool exist = false; if (!n) break; for (int i...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 146], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 147], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
227
5
#include <iostream> #include <map> #include <vector> using namespace std; int main() { int n, f; // m”’l•Û‘¶v‡˜•Û‘¶ long long int a, b, c; // a”ԍ†b’P‰¿c”—Ê while (cin >> n, n) { map<int, long long> m; vector<int> v; f = 1; for (; n; n--) { std::cin >> a >> b >> c; if (m[a]) ...
#include <iostream> #include <map> #include <vector> using namespace std; int main() { int n, f; // m”’l•Û‘¶v‡˜•Û‘¶ long long a, b, c; // a”ԍ†b’P‰¿c”—Ê while (cin >> n, n) { map<int, long long> m; vector<int> v; f = 1; for (; n; n--) { std::cin >> a >> b >> c; if (!m[a]) ...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
166
23
#include <algorithm> #include <cstdio> #include <map> #include <vector> using namespace std; int main() { int n; while (scanf("%d", &n) && n != 0) { map<int, long long> sales; vector<int> log; long long int prc, mnt; int num; for (int i = 0; i < n; i++) { scanf("%d%d%d", &num, &prc, &mnt);...
#include <algorithm> #include <cstdio> #include <map> #include <vector> using namespace std; int main() { int n; while (scanf("%d", &n) && n != 0) { map<int, long long> sales; vector<int> log; long long prc, mnt; int num; for (int i = 0; i < n; i++) { scanf("%d%lld%lld", &num, &prc, &mnt);...
[["-", 0, 52, 8, 9, 0, 43, 39, 86, 39, 40], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
190
3
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define ITER(T) __typeof((T).begin()) #define each(T, it) f...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define ITER(T) __typeof((T).begin()) #define each(T, it) f...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 64, 1, 0, 34, 0, 21], ["+", 0, 57, 64, 1, 0, 34, 12, 11, 31, 22], ["+", 0, 57, 64, 1, 0, 34, 12, 11, 17, 32], ["+", 0, 57, 64, 1, 0, 34, 12, 11, 12, 13]]
1
274
6
#include <algorithm> #include <cmath> #include <complex> #include <iostream> #include <map> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); ++i) static const double PI = 6 * asin(0.5); typed...
#include <algorithm> #include <cmath> #include <complex> #include <iostream> #include <map> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); ++i) static const double PI = 6 * asin(0.5); typed...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
213
3
while true hash = Hash.new n = gets.to_i #???????????° break if n == 0 for r in 0...n do line = gets.chomp! line = line.split no = line[0].to_i #???????????? unitPrice = line[1].to_i #????£??????? quantity = line[2].to_i #?£??????°??? total = unitPrice * quantity #?°??¨? if hash.key?(no) tota...
while true hash = Hash.new n = gets.to_i #???????????° break if n == 0 for r in 0...n do line = gets.chomp! line = line.split no = line[0].to_i #???????????? unitPrice = line[1].to_i #????£??????? quantity = line[2].to_i #?£??????°??? total = unitPrice * quantity #?°??¨? if hash.key?(no) tota...
[["-", 8, 170, 0, 121, 64, 749, 0, 652, 735, 22], ["+", 8, 170, 0, 121, 64, 749, 0, 652, 735, 22]]
4
129
2
loop { n = gets.to_i break if n == 0 total = Hash.new(0) n.times { i, p, k = gets.split.map(&:to_i) total[i] += p * k } a = total.keys.select{|i| total[i] >= 1000000}.sort puts a.empty? ? "NA" : a }
loop { n = gets.to_i break if n == 0 total = Hash.new(0) n.times { i, p, k = gets.split.map(&:to_i) total[i] += p * k } a = total.keys.select{|i| total[i] >= 1000000} puts a.empty? ? "NA" : a }
[["-", 196, 196, 8, 734, 0, 662, 12, 652, 17, 131], ["-", 196, 196, 8, 734, 0, 662, 12, 652, 735, 22]]
4
79
2
loop do n = gets.to_i break if n.zero? totals = Hash.new(0) n.times do e, p, q = gets.split.map(&:to_i) totals[e] += p * q end employees = totals.select { |_, total| total >= 1_000_000 }.keys.sort if employees.empty? puts 'NA' else puts employees.sort.join("\n") end end
loop do n = gets.to_i break if n.zero? totals = Hash.new(0) n.times do e, p, q = gets.split.map(&:to_i) totals[e] += p * q end employees = totals.select { |_, total| total >= 1_000_000 }.keys if employees.empty? puts 'NA' else puts employees.join("\n") end end
[["-", 196, 737, 8, 736, 0, 662, 12, 652, 17, 131], ["-", 196, 737, 8, 736, 0, 662, 12, 652, 735, 22], ["-", 0, 652, 3, 4, 0, 652, 486, 652, 17, 131], ["-", 0, 652, 3, 4, 0, 652, 486, 652, 735, 22]]
4
89
4
while n = gets.chomp.to_i break if n.zero? sales = Hash.new{0} n.times do e, p, q = gets.chomp.split.map(&:to_i) sales[e] += p * q end achieved = sales.select{|k, v| v >= 1_000_000} achieved.each{|k, v| puts k} puts 'NA' unless achieved.empty? end
while n = gets.chomp.to_i break if n.zero? sales = Hash.new{0} n.times do e, p, q = gets.chomp.split.map(&:to_i) sales[e] += p * q end achieved = sales.select{|k, v| v >= 1_000_000} achieved.each{|k, v| puts k} puts 'NA' if achieved.empty? end
[["-", 0, 493, 0, 89, 8, 170, 0, 745, 0, 747], ["+", 0, 493, 0, 89, 8, 170, 0, 751, 0, 121]]
4
87
2
while 0<n=gets.to_i h={};(1..n).map{a,b,c=gets.split.map &:to_i;h[a]||=0;h[a]+=b*c};h=h.reject{|a,x|x<1e6}.map{|a,x|a}.sort;h[0]||h.push("NA");puts h;end
while 0<n=gets.to_i h={};(1..n).map{a,b,c=gets.split.map &:to_i;h[a]||=0;h[a]+=b*c};h=h.reject{|a,x|x<1e6}.map{|a,x|a};h[0]||h.push("NA");puts h;end
[["-", 0, 89, 8, 170, 0, 662, 12, 652, 17, 131], ["-", 0, 89, 8, 170, 0, 662, 12, 652, 735, 22]]
4
98
13
loop do n = gets.to_i break if n.zero? dataset = Hash.new dataset.default = 0 n.times do id, selling_price, quantity = gets.chomp.split.map(&:to_i) dataset[id] += selling_price * quantity end satisfying_id = dataset.select{|id, sales| sales >= 1000000 }.keys.join(?\n) puts (satisfying_id.empty? ? "NA...
loop do n = gets.to_i break if n.zero? dataset = Hash.new dataset.default = 0 n.times do id, selling_price, quantity = gets.chomp.split.map(&:to_i) dataset[id] += selling_price * quantity end satisfying_id = dataset.select{|id, sales| sales >= 1000000 }.keys.join(?\n) puts (satisfying_id.empty? ? "NA...
[["-", 3, 4, 0, 739, 0, 754, 75, 652, 17, 131], ["-", 3, 4, 0, 739, 0, 754, 75, 652, 735, 22]]
4
89
10
while True: time=eval(input()) if time==0: break worr={} mem=[] for i in range(time): shain=list(map(int, input().split())) if shain[0] not in worr: worr[shain[0]]=shain[1]*shain[2] mem.append(shain[0]) else: worr[shain[0]]+=shain[1]*shain[2] mem.sort() check=1 for i in mem: if worr[i]>=...
while True: time=eval(input()) if time==0: break worr={} mem=[] for i in range(time): shain=list(map(int, input().split())) if shain[0] not in worr: worr[shain[0]]=shain[1]*shain[2] mem.append(shain[0]) else: worr[shain[0]]+=shain[1]*shain[2] check=1 for i in mem: if worr[i]>=1000000: p...
[["-", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
143
5
while 1: a={};b=0 n=int(input()) if n==0:break for _ in[0]*n: e,p,q=map(int,input().split()) a.setdefault(e,0);a[e]+=p*q for e in a: if a[e]>=1e6:print(e);b=1 if b:print('NA')
while 1: a={};b=1 n=int(input()) if n==0:break for _ in[0]*n: e,p,q=map(int,input().split()) a.setdefault(e,0);a[e]+=p*q for e in a: if a[e]>=1e6:print(e);b=0 if b:print('NA')
[["-", 0, 52, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
99
4
import sys while True: a=int(eval(input())) if a==0: break ans,name1,name2=[],[],[] hogehoge=0 for i in range(a): hoge=list(map(int,input().split())) if hoge[0] in name2: ww = hoge[1]*hoge[2] r = name2.index(hoge[0]) if len(ans[r]+ww) >= 7: hogehoge+=1 name1.append(h...
import sys while True: a=int(eval(input())) if a==0: break ans,name1,name2=[],[],[] hogehoge=0 for i in range(a): hoge=list(map(int,input().split())) if hoge[0] in name2: ww = hoge[1]*hoge[2] r = name2.index(hoge[0]) if len(str(ans[r]+ww)) >= 7: hogehoge+=1 name1.app...
[["+", 15, 666, 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, 25]]
5
211
3
import sys from Config import DB def add(lis,check_list): for index in range(len(lis)): if lis[index][0]==check_list[0]: lis[index][1]+=int(check_list[1])*int(check_list[2]) return lis.append([check_list[0],int(check_list[1])*int(check_list[2])]) while True: num=int(input())...
def add(lis,check_list): for index in range(len(lis)): if lis[index][0]==check_list[0]: lis[index][1]+=int(check_list[1])*int(check_list[2]) return lis.append([check_list[0],int(check_list[1])*int(check_list[2])]) while True: num=int(input()) if num==0: break lis=[]...
[["-", 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, 686, 0, 314], ["-", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["-", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]]
5
174
6
var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim(); var lines = input.split('\n'); var line; while (line = lines.shift()) { console.log(line.replace(/Hoshino/g, 'Hoshina')); }
var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim(); var lines = input.split('\n'); lines.shift(); var line; while (line = lines.shift()) { console.log(line.replace(/Hoshino/g, 'Hoshina')); }
[["+", 0, 493, 0, 1, 0, 2, 63, 558, 500, 22], ["+", 0, 493, 0, 1, 0, 2, 63, 558, 0, 131], ["+", 0, 493, 0, 1, 0, 2, 63, 558, 559, 560], ["+", 0, 493, 0, 1, 0, 2, 3, 3, 0, 24], ["+", 0, 493, 0, 1, 0, 2, 3, 3, 0, 25], ["+", 36, 36, 36, 36, 0, 493, 0, 1, 0, 35]]
2
71
6
<?php $n = fgets(STDIN); for ($i = 0; $i < $n; $i++) { $line = trim(fgets(STDIN)); echo str_replace("Hoshino", "Hoshina", $line); }
<?php $n = fgets(STDIN); for ($i = 0; $i < $n; $i++) { $line = fgets(STDIN); echo str_replace("Hoshino", "Hoshina", $line); }
[["-", 0, 9, 0, 1, 0, 11, 12, 613, 63, 141], ["-", 0, 1, 0, 11, 12, 613, 3, 3, 0, 24], ["-", 3, 3, 0, 28, 0, 613, 3, 3, 0, 25]]
6
54
3
<?php $inputCount = getStdin(); for ($i = 0; $i < $inputCount; $i++) { echo str_replace('Hoshino', 'Hoshina', getStdin()); } function getStdin() { return trim(fgets(STDIN)); } function explodeStdin() { return explode(' ', getStdin()); }
<?php $inputCount = getStdin(); for ($i = 0; $i < $inputCount; $i++) { echo str_replace('Hoshino', 'Hoshina', fgets(STDIN)); } function getStdin() { return trim(fgets(STDIN)); } function explodeStdin() { return explode(' ', getStdin()); }
[["-", 0, 613, 3, 3, 0, 28, 0, 613, 63, 141], ["+", 0, 613, 3, 3, 0, 28, 0, 613, 63, 141], ["+", 0, 28, 0, 613, 3, 3, 0, 28, 0, 141]]
6
76
3
import java.util.Scanner; public class Main { void run() { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); for (int i = 0; i < t; i++) { String s = sc.nextLine(); s = s.replaceAll("Hoshino", "Hishina"); System.out.println(s); } } public static void...
import java.util.Scanner; public class Main { void run() { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); for (int i = 0; i < t; i++) { String s = sc.nextLine(); s = s.replaceAll("Hoshino", "Hoshina"); System.out.println(s); } } public static void...
[["-", 0, 11, 12, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 11, 12, 492, 3, 4, 0, 5, 0, 491]]
3
114
2
#include <iostream> #include <string> using namespace std; int N, c1, c2, c3, out, ret; string S; int main() { scanf("%d", &N); for (int i = 0; i < N; i++) { c1 = 0, c2 = 0, c3 = 0, out = 0, ret = 0; while (out != 3) { cin >> S; if (S == "HIT") { ret += c3, c3 = c2, c2 = c1, c1 = 1; ...
#include <iostream> #include <string> using namespace std; int N, c1, c2, c3, out, ret; string S; int main() { scanf("%d", &N); for (int i = 0; i < N; i++) { c1 = 0, c2 = 0, c3 = 0, out = 0, ret = 0; while (out != 3) { cin >> S; if (S == "HIT") { ret += c3, c3 = c2, c2 = c1, c1 = 1; ...
[["+", 0, 1, 0, 34, 31, 11, 12, 16, 17, 72], ["+", 0, 1, 0, 34, 31, 11, 12, 16, 12, 13]]
1
164
2
#include <algorithm> #include <cmath> #include <cstdlib> #include <functional> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m...
#include <algorithm> #include <cmath> #include <cstdlib> #include <functional> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
378
3
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <typeinfo> #include <vector> #define syosu(x) fixed << setprecision(x) using namespace std; using namespace std; typedef long lon...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <string> #include <typeinfo> #include <vector> #define syosu(x) fixed << setprecision(x) using namespace std; using namespace std; typedef long lon...
[["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 60], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 28, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
314
5
#include <iostream> #include <string> int main() { int n; int base[3]; int out, score; std::string event; std::cin >> n; for (int i = 0; i < n; i++) { base[0] = 0; base[1] = 0; base[2] = 0; out = 0; score = 0; while (out != 3) { std::cin >> event; if (event == "HIT") { ...
#include <iostream> #include <string> int main() { int n; int base[3]; int out, score; std::string event; std::cin >> n; for (int i = 0; i < n; i++) { base[0] = 0; base[1] = 0; base[2] = 0; out = 0; score = 0; while (out != 3) { std::cin >> event; if (event == "HIT") { ...
[["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 75, 76, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
1
248
3
#include <iostream> #include <string> using namespace std; int main() { int out = 0; int r1 = 0; int r2 = 0; int r3 = 0; int t = 0; string k; int a = 0; cin >> a; for (int i = 1; i <= a; i++) { out = 0; t = 0; r1 = 0; r2 = 0; r3 = 0; while (out != 3) { cin >> k; if ...
#include <iostream> #include <string> using namespace std; int main() { int out = 0; int r1 = 0; int r2 = 0; int r3 = 0; int t = 0; string k; int a = 0; cin >> a; for (int i = 1; i <= a; i++) { out = 0; t = 0; r1 = 0; r2 = 0; r3 = 0; while (out != 3) { cin >> k; if ...
[["+", 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
236
4
#include <iostream> #include <string> #include <valarray> using namespace std; int main(void) { int n; cin >> n; while (n--) { string s; valarray<int> h(3); int o = 0; int sc = 0; h = 0; while (o != 3) { cin >> s; if (s[0] == 'O') o++; else if (s[1] == 'I') { ...
#include <iostream> #include <string> #include <valarray> using namespace std; int main(void) { int n; cin >> n; while (n--) { string s; valarray<int> h(3); int o = 0; int sc = 0; h = 0; while (o != 3) { cin >> s; if (s[0] == 'O') o++; else if (s[1] == 'I') { ...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13]]
1
146
2
#include "bits/stdc++.h" #define REP(i, n) for (ll i = 0; i < n; ++i) #define RREP(i, n) for (ll i = n - 1; i >= 0; --i) #define FOR(i, m, n) for (ll i = m; i < n; ++i) #define RFOR(i, m, n) for (ll i = n - 1; i >= m; --i) #define ALL(v) (v).begin(), (v).end() #define PB(a) push_back(a) #define UNIQUE(v) v.erase(uniqu...
#include "bits/stdc++.h" #define REP(i, n) for (ll i = 0; i < n; ++i) #define RREP(i, n) for (ll i = n - 1; i >= 0; --i) #define FOR(i, m, n) for (ll i = m; i < n; ++i) #define RFOR(i, m, n) for (ll i = n - 1; i >= m; --i) #define ALL(v) (v).begin(), (v).end() #define PB(a) push_back(a) #define UNIQUE(v) v.erase(uniqu...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 104], ["-", 0, 57, 15, 339, 51, 16, 12, ...
1
414
11
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { vector<int> base(3, 0); int res = 0; int out = 0; while (out != 3) { string s; cin >> s; if (s == "HIT") { res += base[2]; base[2] = base[1]; base[1]...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { vector<int> base(3, 0); int res = 0; int out = 0; while (out != 3) { string s; cin >> s; if (s == "HIT") { res += base[2]; base[2] = base[1]; base[1]...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
185
2
#include <iostream> using namespace std; int main(void) { int n; cin >> n; char c[8]; int i = 0; int out = 0; int array[3] = {}; int score = 0; while (i != n) { cin >> c; if (c[0] == 'H' && c[1] == 'I' && c[2] == 'T') { if (array[2] == 1) { score++; } array[2] = array...
#include <iostream> using namespace std; int main(void) { int n; cin >> n; char c[8]; int i = 0; int out = 0; int array[3] = {}; int score = 0; while (i != n) { cin >> c; if (c[0] == 'H' && c[1] == 'I' && c[2] == 'T') { if (array[2] == 1) { score++; } array[2] = array...
[["-", 51, 16, 31, 16, 12, 16, 12, 103, 0, 125], ["+", 51, 16, 31, 16, 12, 16, 12, 103, 0, 125]]
1
326
2
#include <iostream> #include <queue> #include <string> using namespace std; class Player { private: int base; public: Player(int i) { base = 1; } void SetBase(int a) { this->base = a; } int GetBase() { return this->base; } }; class Baseball { private: int score; int out; queue<Player> que; public: ...
#include <iostream> #include <queue> #include <string> using namespace std; class Player { private: int base; public: Player(int i) { base = 1; } void SetBase(int a) { this->base = a; } int GetBase() { return this->base; } }; class Baseball { private: int score; int out; queue<Player> que; public: ...
[["-", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
378
3
#include <cstdio> #include <cstring> int singlehit(char *base, int score); int homerun(char *base, int score); int main(void) { int number; scanf("%d", &number); char event[10]; int out_num; char base[4]; while (number != -1) { int score = 0; for (int i = 0; i < 4; i++) { base[i] = '0'; ...
#include <cstdio> #include <cstring> int singlehit(char *base, int score); int homerun(char *base, int score); int main(void) { int number; scanf("%d", &number); char event[10]; int out_num; char base[4]; while (number != 0) { int score = 0; for (int i = 0; i < 4; i++) { base[i] = '0'; ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
351
2
#include <stdio.h> int main(void) { int i, j, k, q, p, inning, point, kazu[20]; char eve[10]; point = 0; j = 0; k = 0; q = 0; p = 0; scanf("%d", &inning); for (k = 0; k < inning; k++) { point = 0; j = 0; q = 0; p = 0; while (q < 3) { for (j = 0; j < 10; j++) { ...
#include <stdio.h> int main(void) { int i, j, k, q, p, inning, point, kazu[20]; char eve[10]; point = 0; j = 0; k = 0; q = 0; p = 0; scanf("%d", &inning); for (k = 0; k < inning; k++) { point = 0; j = 0; q = 0; p = 0; while (q < 3) { for (j = 0; j < 10; j++) { ...
[["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 64, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
371
3
#include <iostream> #include <string> using namespace std; int main() { int i, n, point = 0; bool run[3]; string s; cin >> n; int out = 3; while (n--) { for (i = 0; i < 3; i++) run[i] = 0; point = 0; out = 3; while (out) { cin >> s; if (s == "HIT") { if (run[2]) ...
#include <iostream> #include <string> using namespace std; int main() { int i, n, point = 0; bool run[3]; string s; cin >> n; int out = 3; while (n--) { for (i = 0; i < 3; i++) run[i] = 0; point = 0; out = 3; while (out) { cin >> s; if (s == "HIT") { if (run[2]) ...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 44], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
199
6
#include <algorithm> #include <iostream> #include <string> using namespace std; int main(void) { string instr; int N; cin >> N; while (N--, N >= 0) { int out = 0; int pos[4] = {}; while (out < 3) { cin >> instr; if (instr == "HIT") { if (pos[2]) { pos[3] += pos[2];...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main(void) { string instr; int N; cin >> N; while (N--, N >= 0) { int out = 0; int pos[4] = {}; while (out < 3) { cin >> instr; if (instr == "HIT") { if (pos[2]) { pos[3] += pos[2];...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
207
2
#include <iostream> #include <string> using namespace std; int main() { int a, b, c, d; int score; int out = 0; int n; cin >> n; while (n--) { score = a = b = c = d = 0; string e; while (out != 3) { cin >> e; if (e == "HIT") { d = c; c = b; b = a; a = ...
#include <iostream> #include <string> using namespace std; int main() { int a, b, c, d; int score; int out = 0; int n; cin >> n; while (n--) { score = a = b = c = d = 0; out = 0; string e; while (out != 3) { cin >> e; if (e == "HIT") { d = c; c = b; b = a;...
[["+", 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
150
4
#include <iostream> #include <string> int main(void) { int datasets, i, hit = 0, out, remain = 0; std::string input; std::cin >> datasets; for (i = 0; i < datasets; ++i) { out = 0; while (out < 3) { std::cin >> input; if (input == "HIT") { ++hit; ++remain; } if (i...
#include <iostream> #include <string> int main(void) { int datasets, i, hit = 0, out, remain = 0; std::string input; std::cin >> datasets; for (i = 0; i < datasets; ++i) { out = 0; while (out < 3) { std::cin >> input; if (input == "HIT") { ++hit; ++remain; } if (i...
[["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 12, 343, 345, 348], ["+", 8, 9, 0, 1, 0, 16, 12, 343, 0, 349], ["+", 8, 9, 0, 1, 0, 16, 12, 343, 141, 22]]
1
143
4
#include <stdio.h> #include <string.h> int main(void) { int i, run = 0, point = 0, out = 0; char s[100]; scanf("%d", &i); while (i != 0) { scanf("%s", s); if (strcmp(s, "HIT") == 0) { run += 1; if (run == 4) { run = 0; point += 1; } } if (strcmp(s, "HOMERUN") ...
#include <stdio.h> #include <string.h> int main(void) { int i, run = 0, point = 0, out = 0; char s[100]; scanf("%d", &i); while (i != 0) { scanf("%s", s); if (strcmp(s, "HIT") == 0) { run += 1; if (run == 4) { run = 3; point += 1; } } if (strcmp(s, "HOMERUN") ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
174
2
#include <iostream> #include <string> using namespace std; int main() { int n; string b; cin >> n; for (int i = 0; i < n; i++) { int out = 0; int sco = 0; int rui[3] = {0}; while (out != 3) { cin >> b; if (b == "OUT") { out++; } else if (b == "HIT") { for (int...
#include <iostream> #include <string> using namespace std; int main() { int n; string b; cin >> n; for (int i = 0; i < n; i++) { int out = 0; int sco = 0; int rui[3] = {0}; while (out != 3) { cin >> b; if (b == "OUT") { out++; } else if (b == "HIT") { for (int...
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
219
2
#include <iostream> #include <queue> #include <string> class Baseball { private: std::queue<int> runner; int out_count; int score; public: void initRunner() { while (runner.empty() != true) { runner.pop(); } for (int i = 0; i < 3; ++i) { runner.push(0); } } Baseball() { ou...
#include <iostream> #include <queue> #include <string> class Baseball { private: std::queue<int> runner; int out_count; int score; public: void initRunner() { while (runner.empty() != true) { runner.pop(); } for (int i = 0; i < 3; ++i) { runner.push(0); } } Baseball() { ou...
[["-", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120]]
1
293
4
gets.to_i.times{r=o=s=0 (c=gets[1];c<?O?(r+=1):c<?U?(s+=r+1;r=0):o+=1)while o<3 p s+r-3}
gets.to_i.times{r=o=s=0 (c=gets[1];c<?O?(r+=1):c<?U?(s+=r+1;r=0):o+=1)while o<3 p r<3?s:s+r-3}
[["+", 0, 652, 3, 4, 0, 754, 15, 738, 31, 22], ["+", 0, 652, 3, 4, 0, 754, 15, 738, 17, 18], ["+", 0, 652, 3, 4, 0, 754, 15, 738, 12, 612], ["+", 8, 734, 0, 652, 3, 4, 0, 754, 0, 101], ["+", 8, 734, 0, 652, 3, 4, 0, 754, 64, 22], ["+", 8, 734, 0, 652, 3, 4, 0, 754, 0, 102]]
4
62
6
result = [] file.gets.chomp.to_i.times do |inning| score = 0 out = 0 runner = 0 while out < 3 event = file.gets.chomp case event when "HIT" runner += 1 when "HOMERUN" score += runner + 1 runner = 0 when "OUT" out += 1 end if runner == 4 score += 1 ...
result = [] gets.chomp.to_i.times do |inning| score = 0 out = 0 runner = 0 while out < 3 event = gets.chomp case event when "HIT" runner += 1 when "HOMERUN" score += runner + 1 runner = 0 when "OUT" out += 1 end if runner == 4 score += 1 runner = 3...
[["-", 0, 652, 486, 652, 486, 652, 486, 652, 486, 22], ["-", 0, 652, 486, 652, 486, 652, 486, 652, 17, 131], ["-", 8, 170, 0, 662, 12, 652, 486, 652, 486, 22], ["-", 8, 170, 0, 662, 12, 652, 486, 652, 17, 131]]
4
87
4
class BaseBall def initialize @first=false @second=false @third=false @out=0 end def hit if @third then point=1 else point=0 end @third = false @third = true if @second @second = true if @first @first = true return point end def homerun point=...
class BaseBall def initialize @first=false @second=false @third=false @out=0 end def hit if @third then point=1 else point=0 end @third = false @third = true if @second @second = true if @first @first = true return point end def homerun point=...
[["-", 36, 36, 36, 36, 0, 493, 0, 121, 15, 147], ["+", 36, 36, 36, 36, 0, 493, 0, 121, 15, 146]]
4
201
2
left=gets.to_i out,runner,score=0,0,0 while left>0 judge=gets.chomp case judge when "HIT" then runner+=1 if runner>3 then runner-=1 score+=1 end when "OUT" then out+=1 if out>=3 then puts score runner,score=0,0 left-=1 end when "HOMERUN" then score+=(r...
left=gets.to_i out,runner,score=0,0,0 while left>0 judge=gets.chomp case judge when "HIT" then runner+=1 if runner>3 then runner-=1 score+=1 end when "OUT" then out+=1 if out>=3 then puts score runner,score,out=0,0,0 left-=1 end when "HOMERUN" then sco...
[["+", 0, 121, 64, 749, 0, 662, 31, 761, 0, 21], ["+", 0, 121, 64, 749, 0, 662, 31, 761, 0, 22], ["+", 0, 121, 64, 749, 0, 662, 12, 762, 0, 612], ["+", 0, 121, 64, 749, 0, 662, 12, 762, 0, 21]]
4
90
4
import sys #from me.io import dup_file_stdin #@dup_file_stdin def solve(): n = int(sys.stdin.readline())*3 s = 0 p = 0 while n>0: log = sys.stdin.readline() if "HIT" in log: if p >= 3: s += 1 p += 1 elif "OUT" in log: n -= 1 ...
import sys #from me.io import dup_file_stdin #@dup_file_stdin def solve(): n = int(sys.stdin.readline())*3 s = 0 p = 0 while n>0: log = sys.stdin.readline() if "HIT" in log: if p >= 3: s += 1 else: p += 1 elif "OUT" in log...
[["+", 0, 57, 64, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 64, 196, 0, 57, 75, 76, 0, 102]]
5
107
2
for _ in[0]*int(input()): r=o=s=0 while 1: a=input()[1] if'I'==a: if r<3:r+=1 else:s+=1 elif'O'==a:s+=r+1;r=0 else: if r<3:o+=1 else:print(s);break
for _ in[0]*int(input()): r=o=s=0 while 1: a=input()[1] if'I'==a: if r<3:r+=1 else:s+=1 elif'O'==a:s+=r+1;r=0 else: if o<2:o+=1 else:print(s);break
[["-", 75, 76, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 75, 76, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 612]]
5
86
13
inn=int(input()) o=0 i=0 s=[] sc=0 ba=[] while i<inn: b=input() if b == "OUT": o+=1 if o%3 == 0 and o>0: s.append(sc) sc=0 i+=1 o=0 ba=[] elif b == "HIT": ba.append(1) if len(ba)>=4: sc+=1 ba=[1,1,1,1] elif b == "HOMERUN": ba.append(1) sc+...
inn=int(input()) o=0 i=0 s=[] sc=0 ba=[] while i<inn: b=input() if b == "OUT": o+=1 if o%3 == 0 and o>0: s.append(sc) sc=0 i+=1 o=0 ba=[] elif b == "HIT": ba.append(1) if len(ba)>=4: sc+=1 ba=[1,1,1] elif b == "HOMERUN": ba.append(1) sc+=l...
[["-", 64, 196, 0, 1, 0, 662, 12, 634, 0, 21], ["-", 64, 196, 0, 1, 0, 662, 12, 634, 0, 612]]
5
143
2
<?php while (true) { $line = trim(fgets(STDIN)); list($H, $W) = explode(' ', $line); if ($W == 0 && $H == 0) { break; } $room = array(); for ($i = 0; $i < $H; $i++) { $room[$i] = trim(fgets(STDIN)); } $visited = array(); for ($i = 0; $i < $H; $i++) { for ($j =...
<?php while (true) { $line = trim(fgets(STDIN)); list($H, $W) = explode(' ', $line); if ($W == 0 && $H == 0) { break; } $room = array(); for ($i = 0; $i < $H; $i++) { $room[$i] = trim(fgets(STDIN)); } $visited = array(); for ($i = 0; $i < $H; $i++) { for ($j =...
[["+", 0, 57, 8, 9, 0, 608, 0, 609, 0, 44], ["+", 75, 76, 8, 9, 0, 608, 0, 609, 0, 44]]
6
316
2
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line; while ((line = br.readLine()) != null) { if (line.isEmpty()) ...
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line; while ((line = br.readLine()) != null) { if (line.isEmpty()) ...
[["-", 3, 4, 0, 16, 31, 16, 31, 504, 516, 22], ["-", 3, 4, 0, 16, 31, 16, 31, 504, 0, 70], ["-", 0, 16, 31, 16, 31, 504, 71, 504, 0, 73], ["-", 0, 492, 3, 4, 0, 16, 12, 504, 516, 22], ["-", 0, 492, 3, 4, 0, 16, 12, 504, 0, 70], ["-", 3, 4, 0, 16, 12, 504, 71, 504, 0, 73]]
3
505
6
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public char[][] tile; public int[][] movedTile; public static void main(String[] args) throws IOException { BufferedReader bReader = new BufferedReader(new InputStreamReader(System.in))...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public char[][] tile; public int[][] movedTile; public static void main(String[] args) throws IOException { BufferedReader bReader = new BufferedReader(new InputStreamReader(System.in))...
[["-", 0, 492, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 0, 492, 3, 4, 0, 16, 31, 16, 31, 22], ["-", 0, 1, 0, 492, 3, 4, 0, 16, 12, 22], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 22]]
3
392
4
#include <stdio.h> char map[104][104]; int a, b; int main(void) { int i, j, x, y; while (scanf("%d %d", &a, &b), a + b) { for (i = 0; a - i; i++) scanf("%s", map[i]); while (map[x][y] - 46 && map[x][y] - 32) { i = x; j = y; if (map[x][y] == 94) x--; if (map[x][y] / 95...
#include <stdio.h> char map[104][104]; int a, b; int main(void) { int i, j, x, y; while (scanf("%d %d", &a, &b), a + b) { for (i = 0; a - i; i++) scanf("%s", map[i]); x = y = 0; while (map[x][y] - 46 && map[x][y] - 32) { i = x; j = y; if (map[x][y] == 94) x--; if ...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
215
6
#include <stdio.h> int main(void) { int w, h, i, j, x, y; char current_tile; for (;;) { scanf("%d %d", &h, &w); if (h == 0 && w == 0) break; char tiles[h][w]; int flags[h][w]; for (i = 0; i < h; i++) { scanf("%s", tiles[i]); } for (i = 0; i < h; i++) { for (j = ...
#include <stdio.h> int main(void) { int w, h, i, j, x, y; char current_tile; for (;;) { scanf("%d %d", &h, &w); if (h == 0 && w == 0) break; char tiles[h][w]; int flags[h][w]; for (i = 0; i < h; i++) { scanf("%s", tiles[i]); } for (i = 0; i < h; i++) { for (j = ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
290
2
#include <stdio.h> #define max 101 int h, w; char map[max + 1][max + 1]; void search(int _h, int _w) { if (map[_h][_w] == '>') { map[_h][_w] = '#'; search(_h, _w + 1); } else if (map[_h][_w] == 'v') { map[_h][_w] = '#'; search(_h + 1, _w); } else if (map[_h][_w] == '^') { map[_h][_w] = '#'; ...
#include <stdio.h> #define max 101 int h, w; char map[max + 1][max + 1]; void search(int _h, int _w) { if (map[_h][_w] == '>') { map[_h][_w] = '#'; search(_h, _w + 1); } else if (map[_h][_w] == 'v') { map[_h][_w] = '#'; search(_h + 1, _w); } else if (map[_h][_w] == '^') { map[_h][_w] = '#'; ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
324
2
#include <stdio.h> /** Application main entry point. */ int main(int argc, char *argv[]) { for (;;) { char map[128][128]; int w, h; int x, y; scanf(" %d %d", &w, &h); if (!(w | h)) break; for (y = 0; y < h; ++y) for (x = 0; x < w; ++x) { scanf(" %c", &map[x][y]); }...
#include <stdio.h> /** Application main entry point. */ int main(int argc, char *argv[]) { for (;;) { char map[128][128]; int w, h; int x, y; scanf(" %d %d", &h, &w); if (!(w | h)) break; for (y = 0; y < h; ++y) for (x = 0; x < w; ++x) { scanf(" %c", &map[x][y]); }...
[["-", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40]]
0
233
6
#include <stdio.h> #define N_MAX 101 int main(void) { int h, i, j; char map[N_MAX][N_MAX], used[N_MAX][N_MAX]; while (1) { for (i = 0; i < N_MAX; i++) for (j = 0; j < N_MAX; j++) map[i][j] = '.', used[i][j] = 0; scanf("%d %*d", &h); if (h == 0) return 0; for (i = 0; i < h; ...
#include <stdio.h> #define N_MAX 101 int main(void) { int h, i, j; char map[N_MAX][N_MAX], used[N_MAX][N_MAX]; while (1) { for (i = 0; i < N_MAX; i++) for (j = 0; j < N_MAX; j++) map[i][j] = '.', used[i][j] = 0; scanf("%d %*d", &h); if (h == 0) return 0; for (i = 0; i < h; ...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
256
1
#include <stdio.h> char map[101][101]; int H, W; void visit(int i, int j) { char temp; temp = map[i][j]; if (temp == ".") { printf("%d %d\n", j, i); return; } if (temp == '@') { printf("LOOP\n"); return; } map[i][j] = '@'; if (temp == '>') { visit(i, j + 1); } else if (temp == '<'...
#include <stdio.h> char map[101][101]; int H, W; void visit(int i, int j) { char temp; temp = map[i][j]; if (temp == '.') { printf("%d %d\n", j, i); return; } if (temp == '@') { printf("LOOP\n"); return; } map[i][j] = '@'; if (temp == '>') { visit(i, j + 1); } else if (temp == '<'...
[["-", 0, 57, 15, 23, 0, 16, 12, 5, 0, 62], ["+", 0, 57, 15, 23, 0, 16, 12, 103, 0, 104]]
0
284
4
#include <iostream> using namespace std; string s[100]; bool used[100][100]; int h, w; int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; main() { while (cin >> h >> w, h) { for (int i = 0; i < h; i++) { cin >> s[i]; for (int j = 0; j < w; j++) used[i][j] = 0; } int x = 0, y = 0, f = 0; ...
#include <iostream> using namespace std; string s[100]; bool used[100][100]; int h, w; int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; main() { while (cin >> h >> w, h) { for (int i = 0; i < h; i++) { cin >> s[i]; for (int j = 0; j < w; j++) used[i][j] = 0; } int x = 0, y = 0, f = 0; ...
[["-", 31, 16, 31, 16, 31, 16, 12, 16, 31, 22], ["-", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["-", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ...
1
267
8
#include <cstdio> #include <iostream> #include <string> using namespace std; int h, w; string ss[100]; bool x[100][100]; int ans1 = 0, ans2 = 0; bool ans = true; bool f() { while (true) { if (ss[ans1][ans2] == '.') return true; else if (!x[ans1][ans2]) return false; else if (ss[ans1][ans2] == ...
#include <cstdio> #include <iostream> #include <string> using namespace std; int h, w; string ss[100]; bool x[100][100]; int ans1 = 0, ans2 = 0; bool ans = true; bool f() { while (true) { if (ss[ans1][ans2] == '.') return true; else if (!x[ans1][ans2]) return false; else if (ss[ans1][ans2] == ...
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
355
4
#include <iomanip> #include <iostream> #include <string> #include <vector> #define REP(i, m, n) for (int i = m; i < static_cast<int>(n); ++i) int main() { int height, width; std::vector<std::string> tile = {">", "<", "^", "v", "."}; while (std::cin >> height >> width) { if (height == 0 && width == 0) { ...
#include <iomanip> #include <iostream> #include <string> #include <vector> #define REP(i, m, n) for (int i = m; i < static_cast<int>(n); ++i) int main() { int height, width; std::vector<std::string> tile = {">", "<", "^", "v", "."}; while (std::cin >> height >> width) { if (height == 0 && width == 0) { ...
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
401
4
#include <iostream> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; bool calc(vector<vector<char>>, int y, int x); int resultx; int resulty; set<string> passed; int main() { while (true) { int width, height; cin >> width >> height; if (width == 0 && height == 0)...
#include <iostream> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; bool calc(vector<vector<char>>, int y, int x); int resultx; int resulty; set<string> passed; int main() { while (true) { passed.clear(); int width, height; cin >> width >> height; if (width ...
[["+", 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
348
6
// Magical Tiles #include <iostream> using namespace std; int main() { int H, W; char Tile[101][101]; //縦横 HW bool TileIsMoved[101][101]; bool IsLoop, IsEnd; char Loader[101]; //横行読み int px, py; //人位置 while (1) { cin >> H >> W; if (H == 0 && W == 0) break; //初期化 px = 0; p...
// Magical Tiles #include <iostream> using namespace std; int main() { int H, W; char Tile[101][101]; //縦横 HW bool TileIsMoved[101][101]; bool IsLoop, IsEnd; char Loader[101]; //横行読み int px, py; //人位置 while (1) { cin >> H >> W; if (H == 0 && W == 0) break; //初期化 px = 0; p...
[["-", 15, 339, 51, 69, 28, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 99, 15, 339, 51, 69, 341, 342, 0, 22], ["+", 0, 99, 15, 339, 51, 69, 341, 342, 0, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["-", 0, 11, 31, 69, 28, 69, ...
1
303
12
#include <iostream> using namespace std; int main() { int w, h, x, y; char tile[100][100]; bool use[100][100]; bool flg; while (1) { cin >> w >> h; if (w == 0 && h == 0) { break; } for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { cin >> tile[x][y]; use[x][y] = ...
#include <iostream> using namespace std; int main() { int w, h, x, y; char tile[100][100]; bool use[100][100]; bool flg; while (1) { cin >> h >> w; if (w == 0 && h == 0) { break; } for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { cin >> tile[x][y]; use[x][y] = ...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
249
4
#include <cstring> #include <iostream> using namespace std; char a[1000][1000]; int h, w, loop, cx, cy; int main() { while (true) { cin >> h >> w; if (!h) { break; } memset(a, ' ', sizeof(a)); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> a[i][j]; } ...
#include <cstring> #include <iostream> using namespace std; char a[8000][8000]; int h, w, loop, cx, cy; int main() { while (true) { cin >> h >> w; if (!h) { break; } memset(a, ' ', sizeof(a)); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> a[i][j]; } ...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0...
1
256
8
#include <algorithm> #include <cmath> #include <cstdlib> #include <functional> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m...
#include <algorithm> #include <cmath> #include <cstdlib> #include <functional> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m...
[["-", 64, 9, 0, 1, 0, 61, 0, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 61, 0, 5, 0, 6]]
1
566
2
#include <cstdio> #include <iostream> #include <string> #define MAX_N 105 using namespace std; int n, h, w; int area[MAX_N][MAX_N]; string s[MAX_N]; void move(int h, int w) { if (area[h][w] == 1) { cout << "LOOP" << endl; return; } area[h][w] = 1; switch (s[h][w]) { case '>': move(h, w + 1); ...
#include <cstdio> #include <iostream> #include <string> #define MAX_N 105 using namespace std; int n, h, w; int area[MAX_N][MAX_N]; string s[MAX_N]; void move(int h, int w) { if (area[h][w] == 1) { cout << "LOOP" << endl; return; } area[h][w] = 1; switch (s[h][w]) { case '>': move(h, w + 1); ...
[["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 60], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32]]
1
288
6
#include <bits/stdc++.h> using namespace std; int main() { int H, W; while (cin >> H >> W, H + W != 0) { string tile[H]; for (int i = 0; i < H; i++) cin >> tile[i]; if (tile[0][0] == '.') { cout << "0 0" << endl; continue; } int i = 0; pair<int, int> now = make_pair(0, 0); ...
#include <bits/stdc++.h> using namespace std; int main() { int H, W; while (cin >> H >> W, H + W != 0) { string tile[H]; for (int i = 0; i < H; i++) cin >> tile[i]; if (tile[0][0] == '.') { cout << "0 0" << endl; continue; } int i = 0; pair<int, int> now = make_pair(0, 0); ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 31, 16, 31, 16, 31, 16, 12, 118, 119, 120], ["+", 31, 16, 31, 16, 31, 16, 12, 118, 119, 120], ["-", 0, 1, 0, 16, 31, 16, 12, 118, 119...
1
268
8
#include <iostream> #include <string> using namespace std; struct point { char c; int count; }; void move(point area[100][100], int &i, int &j) { area[i][j].count = 0; if (area[i][j].c == '>') { j++; } else if (area[i][j].c == '<') { j--; } else if (area[i][j].c == 'v') { i++; } else if (are...
#include <iostream> #include <string> using namespace std; struct point { char c; int count; }; void move(point area[100][100], int &i, int &j) { area[i][j].count = 0; if (area[i][j].c == '>') { j++; } else if (area[i][j].c == '<') { j--; } else if (area[i][j].c == 'v') { i++; } else if (are...
[["-", 15, 339, 51, 16, 12, 23, 0, 42, 0, 32], ["-", 15, 339, 51, 16, 12, 23, 0, 42, 0, 13], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 60], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 12, 13]]
1
344
4
#include <cstdio> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int w, h; int dx[128] = {0}; int dy[128] = {0}; dx['<'] = -1; dx['>'] = 1; dy['^'] = -1; dy['v'] = 1; while (cin >> w >> h, w) { char data[128][128] = {0}; rep(...
#include <cstdio> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int w, h; int dx[128] = {0}; int dy[128] = {0}; dx['<'] = -1; dx['>'] = 1; dy['^'] = -1; dy['v'] = 1; while (cin >> h >> w, w) { char data[128][128] = {0}; rep(...
[["-", 15, 339, 51, 34, 31, 16, 31, 16, 12, 22], ["-", 0, 52, 15, 339, 51, 34, 31, 16, 17, 152], ["+", 0, 52, 15, 339, 51, 34, 31, 16, 17, 152], ["+", 0, 52, 15, 339, 51, 34, 31, 16, 12, 22]]
1
242
4
#include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int h, w; while (scanf("%d%d", &h, &w)) { if (h == 0 && w == 0) break; vector<string> map; for (int i = 0; i < h; i++) { string in; cin >> in; map.push_back(in); } ...
#include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int h, w; while (scanf("%d%d", &h, &w)) { if (h == 0 && w == 0) break; vector<string> map; for (int i = 0; i < h; i++) { string in; cin >> in; map.push_back(in); } ...
[["-", 75, 76, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 75, 76, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 75, 76, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 75, 76, 0, 1, 0, 2, 3, 4, 0, 22]]
1
294
4
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int W, H; while (cin >> W >> H) { if ((W | H) == 0) break; vector<string> tile(H); for (int i = 0; i < H; ++i) cin >> tile[i]; int x = 0, y = 0; bool loop = false; vector<vector<int>> vis...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int W, H; while (cin >> H >> W) { if ((W | H) == 0) break; vector<string> tile(H); for (int i = 0; i < H; ++i) cin >> tile[i]; int x = 0, y = 0; bool loop = false; vector<vector<int>> vis...
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 152], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 152], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
252
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for ((i) = 0; (i) < (i...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for ((i) = 0; (i) < (i...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
417
2
// 51 #include <iostream> using namespace std; int main() { for (int W, H; cin >> W >> H, W | H;) { char g[100][100]; for (int y = 0; y < H; y++) { for (int x = 0; x < W; x++) { cin >> g[y][x]; } } int y = 0, x = 0; while (g[y][x] != '.' && g[y][x] != '\0') { int ny = y...
// 51 #include <iostream> using namespace std; int main() { for (int W, H; cin >> H >> W, W | H;) { char g[100][100]; for (int y = 0; y < H; y++) { for (int x = 0; x < W; x++) { cin >> g[y][x]; } } int y = 0, x = 0; while (g[y][x] != '.' && g[y][x] != '\0') { int ny = y...
[["-", 0, 7, 15, 34, 31, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 7, 15, 34, 31, 16, 17, 152], ["+", 8, 9, 0, 7, 15, 34, 31, 16, 17, 152], ["+", 8, 9, 0, 7, 15, 34, 31, 16, 12, 22]]
1
245
4
#include <cstdio> #include <iostream> using namespace std; int H, W; int main(void) { while (cin >> H >> W, H && W) { char room[101][102] = {}; bool fd[101][101] = {}; for (int i = 0; i < H; i++) cin >> room[i]; int x = 0, y = 0; while (room[y][x] != '.' && !fd[y][x]) { fd[y][x] = t...
#include <cstdio> #include <iostream> using namespace std; int H, W; int main(void) { while (cin >> H >> W, H && W) { char room[101][102] = {}; bool fd[101][101] = {}; for (int i = 0; i < H; i++) cin >> room[i]; int x = 0, y = 0; while (room[y][x] != '.' && !fd[y][x]) { fd[y][x] = t...
[["-", 51, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 51, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22]]
1
213
4
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; int W, H; char fie[102][102]; int cost[102][102]; char df[] = {'>', 'v', '<', '^'}; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; int main() { while (1) { cin >> W >> H; memset(fie, -1, s...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; int W, H; char fie[102][102]; int cost[102][102]; char df[] = {'>', 'v', '<', '^'}; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; int main() { while (1) { cin >> H >> W; memset(fie, -1, s...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
326
4
#include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; const char arrow[] = {'>', '<', 'v', '^'}; const int dx[] = {1, -1, 0, 0}; const int dy[] = {0, 0, 1, -1}; int main() { int H, W; while (cin >> H >> W, H + W) { vector<string> tile(101); bool visit[101][101]; ...
#include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; const char arrow[] = {'>', '<', 'v', '^'}; const int dx[] = {1, -1, 0, 0}; const int dy[] = {0, 0, 1, -1}; int main() { int H, W; while (cin >> H >> W, H + W) { vector<string> tile(H); bool visit[101][101] = {f...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 147], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
1
258
6
#include <cstring> #include <iostream> using namespace std; int w, h; char map[102][102]; bool closed[102][102]; void rec(int x, int y) { if (closed[y][x]) { cout << "LOOP" << endl; return; } closed[y][x] = true; if (map[y][x] == '>') rec(x + 1, y); else if (map[y][x] == 'v') rec(x, y + 1); ...
#include <cstring> #include <iostream> using namespace std; int w, h; char map[102][102]; bool closed[102][102]; void rec(int x, int y) { if (closed[y][x]) { cout << "LOOP" << endl; return; } closed[y][x] = true; if (map[y][x] == '>') rec(x + 1, y); else if (map[y][x] == 'v') rec(x, y + 1); ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 2, 3, 4, 0, 105, 51, 23, 0, 22], ["+", 0, 2, 3, 4, 0, 105, 51, 23, 0, 22]]
1
257
4
#include <iostream> using namespace std; int main() { int W, H; while (cin >> W >> H && W + H != 0) { char room[101][101]; for (int w = 0; w != W; ++w) { cin >> room[w]; } int x = 0, y = 0; bool loop = false; while (room[x][y] != '.') { if (room[x][y] == '>') { room[x...
#include <iostream> using namespace std; int main() { int W, H; while (cin >> W >> H && W + H != 0) { char room[101][101]; for (int w = 0; w != W; ++w) { cin >> room[w]; } int x = 0, y = 0; bool loop = false; while (room[x][y] != '.') { if (room[x][y] == '>') { room[x...
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
277
4
#include <cstdio> #include <iostream> using namespace std; int main(void) { char G[100][100]; bool visited[100][100]; int W, H; string str; while (cin >> W >> H) { if (W == 0 && H == 0) break; for (int i = 0; i < H; i++) { cin >> str; for (int j = 0; j < W; j++) { G[i][j] =...
#include <cstdio> #include <iostream> using namespace std; int main(void) { char G[200][200]; bool visited[200][200]; int W, H; string str; while (cin >> H >> W) { if (W == 0 && H == 0) break; for (int i = 0; i < H; i++) { cin >> str; for (int j = 0; j < W; j++) { G[i][j] =...
[["-", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 152], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 152], ["+", ...
1
274
12
#include <iostream> #include <string> using namespace std; int main() { int w, h; string a[102]; while (cin >> w >> h, w) { for (int i = 0; i < 102; i++) { a[i] = ""; } for (int i = 0; i < w; i++) { cin >> a[i]; } int x = 0, y = 0; while (true) { if (a[x][y] == '.') { ...
#include <iostream> #include <string> using namespace std; int main() { int w, h; string a[102]; while (cin >> w >> h, w) { for (int i = 0; i < 102; i++) { a[i] = ""; } for (int i = 0; i < w; i++) { cin >> a[i]; } int x = 0, y = 0; while (true) { if (a[x][y] == '.') { ...
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
284
4
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string s; int n; cin >> n; cin.ignore(); for (int i = 0; i < n; i++) { getline(cin, s); while (1) { if (s.find("Hoshina") == string::npos) break; s.replace(s.find("Hoshina"), 7, "Hashino");...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string s; int n; cin >> n; cin.ignore(); for (int i = 0; i < n; i++) { getline(cin, s); while (1) { if (s.find("Hoshino") == string::npos) break; s.replace(s.find("Hoshino"), 7, "Hoshina");...
[["-", 51, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 51, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["-", 3, 4, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 3, 4, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
104
6
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { string s; int n; int c_pos; cin >> n; cin.ignore(); while (n--) { getline(cin, s); while ((c_pos = s.find("Hoshino")) != string::npos) { s.replace(c_pos, 7, "Hashina"); } cout << s << endl; } ...
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { string s; int n; int c_pos; cin >> n; cin.ignore(); while (n--) { getline(cin, s); while ((c_pos = s.find("Hoshino")) != string::npos) { s.replace(c_pos, 7, "Hoshina"); } cout << s << endl; } ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
89
2