buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
#include <stdio.h> #include <string.h> int N, c = 0; int ch(int n) { int l, r; char S[5]; sprintf(S, "%d", n); for (l = 0, r = strlen(S) - 1; l < r; l++, r--) if (S[l] != S[r]) return 0; return 1; } int main() { scanf("%d", &N); for (;; c++) { if (ch(N - c)) { N -= c; break; ...
#include <stdio.h> #include <string.h> int N, c = 0; int ch(int n) { int l, r; char S[5]; sprintf(S, "%d", n); for (l = 0, r = strlen(S) - 1; l < r; l++, r--) if (S[l] != S[r]) return 0; return 1; } int main() { scanf("%d", &N); for (;; c++) { if (ch(N - c)) { N -= c; break; ...
[["-", 15, 23, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 15, 23, 0, 2, 3, 4, 0, 16, 17, 72]]
0
158
2
#include <stdio.h> void intstr(int n, char *s) { int i, j = 0; for (i = n; i; i /= 10) s[++j] = 0; for (i = n; j--; i /= 10) s[j] = i % 10 + '0'; } int f(int a) { char s[10]; int l = 0, i; intstr(a, s); // printf("%s ",s); while (s[l++]) ; // printf("%d\n",l); for (i = 0; 2 * i < l; i++) { ...
#include <stdio.h> void intstr(int n, char *s) { int i, j = 0; for (i = n; i; i /= 10) s[++j] = 0; for (i = n; j--; i /= 10) s[j] = i % 10 + '0'; } int f(int a) { char s[10]; int l = 0, i; intstr(a, s); // printf("%s ",s); while (s[l++]) ; // printf("%d\n",l); for (i = 0; 2 * i < l; i++) { ...
[["-", 15, 16, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 15, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["-", 15, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 15, 16, 12, 2, 3, 4, 0, 16, 17, 72]]
0
203
4
char s[9]; x, l; int P(a) { sprintf(s, "%d", a), l = strlen(s); for (x = 0; x < l; x++) if (s[x] != s[l - x - 1]) return 0; return 1; } main() { int n, i; scanf("%d", &n); for (i = 0;; i++) { if (!P(n - i)) { printf("%d\n", n - i); return 0; } if (!P(n + i)) { printf(...
char s[9]; x, l; int P(a) { sprintf(s, "%d", a), l = strlen(s); for (x = 0; x < l; x++) if (s[x] != s[l - x - 1]) return 0; return 1; } main() { int n, i; scanf("%d", &n); for (i = 0;; i++) { if (P(n - i)) { printf("%d\n", n - i); return 0; } if (P(n + i)) { printf("%...
[["-", 8, 9, 0, 57, 15, 23, 0, 91, 17, 111]]
0
162
20
#include <iostream> #include <sstream> using namespace std; bool p[10002]; string itos(int x) { stringstream ss; ss << x; return ss.str(); } int main() { for (int i = 0; i < 10002; i++) { string tmp = itos(i); int l = tmp.size(); bool f = true; for (int j = 0; j < l / 2; j++) if (tmp[j]...
#include <iostream> #include <sstream> using namespace std; bool p[10002]; string itos(int x) { stringstream ss; ss << x; return ss.str(); } int main() { for (int i = 0; i < 10002; i++) { string tmp = itos(i); int l = tmp.size(); bool f = true; for (int j = 0; j < l / 2; j++) if (tmp[j]...
[["-", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 12, 22]]
1
204
2
#include <cstdlib> #include <iostream> #include <sstream> #include <string> using namespace std; string convert_string(int n) { stringstream ss; ss << n; return ss.str(); } bool check(string str) { int len = str.size(); if (len == 1) return true; bool flag = true; for (int i = 0, i_len = len / 2; ...
#include <cstdlib> #include <iostream> #include <sstream> #include <string> #define N 10000 using namespace std; string convert_string(int n) { stringstream ss; ss << n; return ss.str(); } bool check(string str) { int len = str.size(); if (len == 1) return true; bool flag = true; for (int i = 0, ...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
206
5
#include <iostream> #include <sstream> #include <string> using namespace std; string itoa(int i) { stringstream ss; ss << i; return ss.str(); } bool ispali(int n) { string a = itoa(n); return string(a.begin(), a.end()) == string(a.rbegin(), a.rend()); } int main() { int n; cin >> n; int d = 0; whi...
#include <iostream> #include <sstream> #include <string> using namespace std; string itoa(int i) { stringstream ss; ss << i; return ss.str(); } bool ispali(int n) { string a = itoa(n); return string(a.begin(), a.end()) == string(a.rbegin(), a.rend()); } int main() { int n; cin >> n; int d = 0; whi...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
159
2
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; #define loop(i, a, b) for (int i = (a); i < ull(b); ++i) #define rep(i, n) loop(i, 0, n) const double eps = 1e-10; const double pi = acos(-1.0); const double inf = (int)1e8; string IntToString(int number) { stringstream ss; ss << numb...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; #define loop(i, a, b) for (int i = (a); i < ull(b); ++i) #define rep(i, n) loop(i, 0, n) const double eps = 1e-10; const double pi = acos(-1.0); const double inf = (int)1e8; string IntToString(int number) { stringstream ss; ss << numb...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72]]
1
185
2
#include <iostream> using namespace std; int n, minx; int x[100000]; void palind() { for (int i = 0; i < 100000; i++) { if (i < 10) { x[i] = 1; } else if (i >= 10 && i < 100 && i % 11 == 0) { x[i] = 1; } else if (i >= 100 && i < 1000 && i / 100 == i % 10) { x[i] = 1; } else if (i >=...
#include <iostream> using namespace std; int n, minx; int x[100000]; void palind() { for (int i = 0; i < 100000; i++) { if (i < 10) { x[i] = 1; } else if (i >= 10 && i < 100 && i % 11 == 0) { x[i] = 1; } else if (i >= 100 && i < 1000 && i / 100 == i % 10) { x[i] = 1; } else if (i >=...
[["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 68], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
284
6
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define rep(i, a) REP(i, 0, a) #define REP(i, ...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define rep(i, a) REP(i, 0, a) #define REP(i, ...
[["-", 15, 339, 51, 2, 3, 4, 0, 16, 17, 72], ["+", 15, 339, 51, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 15, 339, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 15, 339, 51, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1,...
1
296
8
#include <bits/stdc++.h> using namespace std; bool is_palindrome(int N) { string s = to_string(N); int n = s.size(); for (int i = 0; i < n / 2; i++) { if (s[i] != s[n - 1 - i]) return 0; } return 1; } int main() { int N; cin >> N; int l = -1, r = -1; for (int i = N - 1;; i--) { if (is...
#include <bits/stdc++.h> using namespace std; bool is_palindrome(int N) { string s = to_string(N); int n = s.size(); for (int i = 0; i < n / 2; i++) { if (s[i] != s[n - 1 - i]) return 0; } return 1; } int main() { int N; cin >> N; int l = -1, r = -1; for (int i = N;; i--) { if (is_pal...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72]]
1
183
4
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int s; cin >> s; int cou = 0; // string hoge=s; int fs, bs; fs = bs = s; for (int i = 0; i < s; i++) { string fst = to_string(fs); // int bst=bs; string bst = to_string(bs); string hoge = fst; ...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int s; cin >> s; int cou = 0; // string hoge=s; int fs, bs; fs = bs = s; for (int i = 0; i < s; i++) { string fst = to_string(fs); // int bst=bs; string bst = to_string(bs); string hoge = fst; ...
[["+", 75, 76, 0, 57, 64, 9, 0, 93, 0, 94]]
1
151
1
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<bool> kai(1001, false); for (int i = 1; i < 10; i++) { kai[i] = true; } for (int i = 1; i < 10; i++) { kai[10 * i + i] = true; } for (int i = 1; i < 10; i++) { for (int j = 0; j < 10; j++) { ...
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<bool> kai(10001, false); for (int i = 1; i < 10; i++) { kai[i] = true; } for (int i = 1; i < 10; i++) { kai[10 * i + i] = true; } for (int i = 1; i < 10; i++) { for (int j = 0; j < 10; j++) { ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
209
2
#include <algorithm> #include <cstdio> #include <iostream> #include <string> using namespace std; string itos(int x) { char a[5]; sprintf(a, "%d", x); return string(a); } bool isp(string s) { string s2 = s; reverse(s2.begin(), s2.end()); for (int i = 0; i < s.size() / 2; i++) { if (s[i] != s2[i]) ...
#include <algorithm> #include <cstdio> #include <iostream> #include <string> using namespace std; string itos(int x) { char a[5]; sprintf(a, "%d", x); return string(a); } bool isp(string s) { string s2 = s; reverse(s2.begin(), s2.end()); for (int i = 0; i < s.size() / 2; i++) { if (s[i] != s2[i]) ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
200
4
def check(n): n = str(n) if n == n[::-1]: return True else: return False n = int(input()) if check(n): print(n) else: base = n while 1: n -= 1 if check(n): ans = n break diff = base - n n = base for i in range(n, base): ...
def check(n): n = str(n) if n == n[::-1]: return True else: return False n = int(input()) if check(n): print(n) else: base = n while 1: n -= 1 if check(n): ans = n break diff = base - n n = base for i in range(base, base + d...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 22]]
5
103
4
def palind(n): return str(n) == str(n)[::-1] n = eval(input()) for i in range(10): if n >= i and palind(n - i): print(n - i) break if palind(n + i): print(n + i) break
def palind(n): return str(n) == str(n)[::-1] n = eval(input()) for i in range(100000): if n >= i and palind(n - i): print(n - i) break if palind(n + i): print(n + i) break
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
72
2
n = eval(input()) mind = n for i in range(max(0,n-20),min(10001,n+20)): if i == int(str(i)[::-1]) and abs(n - i) < mind: mind = abs(n - i) ans = i print(ans)
n = eval(input()) mind = n for i in range(max(0,n-100),min(10001,n+100)): if i == int(str(i)[::-1]) and abs(n - i) < mind: mind = abs(n - i) ans = i print(ans)
[["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
76
4
/* AizuOnline A2490 Title Parenthese */ #include <stdio.h> // Select Below //#include <stdlib.h> //#include <string.h> //#include <float.h> //#include <math.h> //#include <limits.h> // Global data section int N; // main() { int i, n; int depth; char c; scanf("%d ", &N); depth = 0; for (i = 0; i < N; i++) ...
/* AizuOnline A2490 Title Parenthese */ #include <stdio.h> int N; // main() { int i, n; int depth; char c; scanf("%d ", &N); depth = 0; for (i = 0; i < N; i++) { scanf("%c %d ", &c, &n); // printf("cn=%c %d\n",c,n); if (c == '(') depth += n; else depth -= n; if (depth < 0) ...
[["-", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["-", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6]]
0
129
4
#include <cstring> #include <iostream> using namespace std; int main() { int n; long long int cnt = 0; cin >> n; for (int i = 0; i < n; i++) { char s; int a; cin >> s >> a; if (s == '(') { cnt += a; } else { cnt -= a; } if (cnt < 0) { break; } } if (cnt >= ...
#include <cstring> #include <iostream> using namespace std; int main() { int n; long long int cnt = 0; cin >> n; for (int i = 0; i < n; i++) { char s; long long int a; cin >> s >> a; if (s == '(') { cnt += a; } else { cnt -= a; } if (cnt < 0) { break; } } i...
[["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
117
4
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; int s = 0; for (int c = 0; c < a; c++) { char d; int e; cin >> d >> e; for (int f = 0; f < e; f++) { if (d == '(') s++; else { if (s < 0) { puts("NO"); return 0; }...
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; int s = 0; for (int c = 0; c < a; c++) { char d; int e; cin >> d >> e; for (int f = 0; f < e; f++) { if (d == '(') s++; else { if (s < 1) { puts("NO"); return 0; }...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
123
2
#include <bits/stdc++.h> using namespace std; int main() { int n, x, ans = 0, f = 0; string s; cin >> n; for (int i = 0; i < n; i++) { cin >> s >> x; if (s == "(") ans += x; else ans -= x; if (ans < 0) f++; } cout << (f ? "NO" : "YES") << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, x, ans = 0, f = 0; string s; cin >> n; for (int i = 0; i < n; i++) { cin >> s >> x; if (s == "(") ans += x; else ans -= x; if (ans < 0) f++; } cout << (f || ans ? "NO" : "YES") << endl; }
[["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 106], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 12, 22]]
1
96
2
#include <iostream> using namespace std; int main(void) { int n, x, s = 0; char p[1000]; cin >> n; for (int i = 0; i < n; i++) { cin >> p[i] >> x; if (p[i] == '(') { s += x; } else { s -= x; } if (s < 0) { cout << "NO" << endl; break; } } if (s == 0) { ...
#include <iostream> using namespace std; int main(void) { int n, x, s = 0; char p[1000]; cin >> n; for (int i = 0; i < n; i++) { cin >> p[i] >> x; if (p[i] == '(') { s += x; } else { s -= x; } if (s < 0) { cout << "NO" << endl; return 0; } } if (s == 0) { ...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13]]
1
126
3
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <string> using namespace std; int main() { long long cnt = 0; int n, x, flg; char p; short a = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> p >> x; if (p == '(') cnt ...
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <string> using namespace std; int main() { long long cnt = 0; int n, x, flg; char p; short a = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> p >> x; if (p == '(') cnt ...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
121
4
#include <algorithm> #include <iostream> #include <stack> #include <vector> using namespace std; int main(void) { int n; cin >> n; string in; int x, now = 0; bool fg = false; for (int i = 0; i < n; i++) { cin >> in >> x; if (in == "(") now += x; else now -= x; if (now < 0) ...
#include <algorithm> #include <iostream> #include <stack> #include <vector> using namespace std; int main(void) { int n; cin >> n; string in; int x, now = 0; bool fg = false; for (int i = 0; i < n; i++) { cin >> in >> x; if (in == "(") now += x; else now -= x; if (now < 0) ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
114
4
#include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; typedef pair<string, int> psi; vector<psi> stay; int main(void) { int n, t; cin >> n >> t; int prev = -1; for (int i = 0; i < n; ++i) { string st, sn, at, an; cin >> st >> sn >> at >> an; ...
#include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; typedef pair<string, int> psi; vector<psi> stay; int main(void) { int n, t; cin >> n >> t; int prev = -1; for (int i = 0; i < n; ++i) { string st, sn, at, an; cin >> st >> sn >> at >> an; ...
[["-", 31, 16, 31, 16, 31, 16, 12, 118, 119, 120], ["+", 31, 16, 31, 16, 31, 16, 12, 118, 119, 120], ["-", 8, 1, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 8, 1, 0, 16, 31, 16, 12, 118, 119, 120]]
1
296
4
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) #define all(x) (x).begin(), (x).end() int main() { int N, T; cin >> N >> T; vector<int> st(N), ar(N); vector<string> name(N + 2); rep(i, N) { int h, m; scanf("%d:%d", &h, &m); st[i] = h * 60 + ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) #define all(x) (x).begin(), (x).end() int main() { int N, T; cin >> N >> T; vector<int> st(N), ar(N); vector<string> name(N + 2); rep(i, N) { int h, m; scanf("%d:%d", &h, &m); st[i] = h * 60 + ...
[["-", 3, 4, 0, 69, 341, 342, 0, 16, 17, 72], ["-", 3, 4, 0, 69, 341, 342, 0, 16, 12, 13]]
1
248
2
n, t = gets.split.map(&:to_i) output = [] _, _, prev_ar_time, _ = gets.split while gets st_time, st_name, ar_time, ar_name = $_.split x = (Time.parse(st_time) - Time.parse(prev_ar_time)).to_i / 60 output << "#{st_name} #{x}" if x >= t prev_ar_time = ar_time end puts output.size, output
require 'time' n, t = gets.split.map(&:to_i) output = [] _, _, prev_ar_time, _ = gets.split while gets st_time, st_name, ar_time, ar_name = $_.split x = (Time.parse(st_time) - Time.parse(prev_ar_time)).to_i / 60 output << "#{st_name} #{x}" if x >= t prev_ar_time = ar_time end puts output.size, output
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 0, 493, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 0, 493, 0, 652, 3, 4, 0, 557, 0, 6]]
4
87
4
import java.util.Arrays; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int N = sc.nextInt(); int D = sc.nextInt(); int[][] P = new int[N][D]; for (int i = 0; i < N; ++i) { for (int j = 0; j < D; ++j) { ...
import java.util.Arrays; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int N = sc.nextInt(); int D = sc.nextInt(); int[][] P = new int[N][D]; for (int i = 0; i < N; ++i) { for (int j = 0; j < D; ++j) { ...
[["-", 0, 1, 0, 11, 31, 504, 516, 504, 71, 499], ["+", 0, 1, 0, 11, 31, 504, 516, 504, 71, 22]]
3
681
2
#include <stdio.h> #include <stdlib.h> #include <string.h> #define min(a, b) (a < b ? a : b) int N, D, P[51][51], dp[51][51], path[51][51], mc[51], i, j, k, r = 0; int s(int d, int p) { int i, r = 1000000, pos = -1, t = 51; if (d == D) return 0; if (dp[d][p] != -1) return dp[d][p]; for (i = 0; i < N; i...
#include <stdio.h> #include <stdlib.h> #include <string.h> #define min(a, b) (a < b ? a : b) int N, D, P[51][51], dp[51][51], path[51][51], mc[51], i, j, k, r = 0; int s(int d, int p) { int i, r = 1000000, pos = -1, t = 51; if (d == D) return 0; if (dp[d][p] != -1) return dp[d][p]; for (i = 0; i < N; i...
[["+", 3, 4, 0, 16, 31, 2, 3, 4, 0, 25], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
0
421
2
/* AOJ 2517 Title:Hotel @kankichi573 */ #include <limits.h> #include <stdio.h> int N, D; int charge[51][50]; int cheapest[51][50]; int times[51][50]; int result[50]; void calc_cheapest() { int i, j, min_; for (i = 0; i < D; i++) { min_ = INT_MAX; for (j = 0; j < N; j++) if (min_ > charge[j][i]...
/* AOJ 2517 Title:Hotel @kankichi573 */ #include <limits.h> #include <stdio.h> int N, D; int charge[51][50]; int cheapest[51][50]; int times[51][50]; int result[50]; void calc_cheapest() { int i, j, min_; for (i = 0; i < D; i++) { min_ = INT_MAX; for (j = 0; j < N; j++) if (min_ > charge[j][i]...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 8, 9, 0, 7, 8, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 8, 9, 0, 7, 8, 57, 64, 9, 0, 46]]
0
906
4
#include <cstring> #include <iostream> using namespace std; typedef pair<int, int> P; #define INF P(999999, 999999) int N, D; int p[100][100]; int rev[100][100]; P dp[100][100]; void solve() { memset(rev, -1, sizeof(rev)); for (int i = 0; i <= D; i++) { for (int j = 0; j <= N; j++) { dp[i][j] = INF; ...
#include <cstring> #include <iostream> using namespace std; typedef pair<int, int> P; #define INF P(999999, 999999) int N, D; int p[100][100]; int rev[100][100]; P dp[100][100]; void solve() { memset(rev, -1, sizeof(rev)); for (int i = 0; i <= D; i++) { for (int j = 0; j <= N; j++) { dp[i][j] = INF; ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
433
2
#include <algorithm> #include <assert.h> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <typeinfo> #include <utility> #include <vector> #define loop(i, a, b) for (i...
#include <algorithm> #include <assert.h> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <typeinfo> #include <utility> #include <vector> #define loop(i, a, b) for (i...
[["+", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72]]
1
862
4
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <valarray> #include <vector> using names...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <valarray> #include <vector> using names...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
2,693
2
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var str = input.trim(); var cnt = 0; if (str >= 6) cnt++; if (str.match(/\d/)) cnt++; if (str.match(/[A-Z]/)) cnt++; if (str.match(/[a-z]/)) cnt++; console.log((cnt == 4) ? "VALID" : "INVALID");
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var str = input.trim(); var cnt = 0; if (str.length >= 6) cnt++; if (str.match(/\d/)) cnt++; if (str.match(/[A-Z]/)) cnt++; if (str.match(/[a-z]/)) cnt++; console.log((cnt == 4) ? "VALID" : "INVALID");
[["+", 0, 57, 15, 23, 0, 16, 31, 558, 0, 131], ["+", 0, 57, 15, 23, 0, 16, 31, 558, 559, 560]]
2
105
2
#include <cctype> #include <cstring> #include <iostream> using namespace std; int main() { char line[20]; int x, y, i; x = 0; y = 0; cin >> line; if (strlen(line) >= 6) { x = strlen(line); for (i = 0; i < x - 1; i++) { if (isdigit(line[i]) != 0) { y++; } } if (y != 0) { ...
#include <cctype> #include <cstring> #include <iostream> using namespace std; int main() { char line[20]; int x, y, i; x = 0; y = 0; cin >> line; if (strlen(line) >= 6) { x = strlen(line); for (i = 0; i < x; i++) { if (isdigit(line[i]) != 0) { y++; } } if (y != 0) { ...
[["-", 64, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 64, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
232
6
#include <cctype> #include <iostream> #include <string> using namespace std; int main() { bool ok1 = false, ok2 = false, ok3 = false, ok4 = false; string S; cin >> S; ok1 = (S.size() >= 6); for (int i = 0; i < S.size(); i++) { ok2 = ok2 & isdigit(S[i]); ok3 = ok3 & isupper(S[i]); ok4 = ok4 & ...
#include <cctype> #include <iostream> #include <string> using namespace std; int main() { bool ok1 = false, ok2 = false, ok3 = false, ok4 = false; string S; cin >> S; ok1 = (S.size() >= 6); for (int i = 0; i < S.size(); i++) { ok2 = ok2 | isdigit(S[i]); ok3 = ok3 | isupper(S[i]); ok4 = ok4 | ...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 67], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 139]]
1
133
6
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { string s; cin >> s; bool nu = false, ca = false, sm = false; for (char c : s) { if ('0' <= c && c <= '9') nu = true; if ('a' <= c && c <= 'z') sm = true; if ('A' <= c && c <= 'Z') ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { string s; cin >> s; bool nu = false, ca = false, sm = false; for (char c : s) { if ('0' <= c && c <= '9') nu = true; if ('a' <= c && c <= 'z') sm = true; if ('A' <= c && c <= 'Z') ...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
134
4
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string a; cin >> a; int flg = 0; for (int i = 0; i < a.size(); i++) { if (a[i] >= '0' && a[i] <= '9') { if (!(flg & 1)) flg += 1; } if (a[i] >= 'a' && a[i] <= 'z') { if (!(flg & 2)) ...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string a; cin >> a; int flg = 0; for (int i = 0; i < a.size(); i++) { if (a[i] >= '0' && a[i] <= '9') { if (!(flg & 1)) flg += 1; } if (a[i] >= 'a' && a[i] <= 'z') { if (!(flg & 2)) ...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
193
2
#include <iostream> #include <string> using namespace std; bool check_pass(string str) { if (str.length() < 6) { return false; } bool small, large, num; small = large = num = false; for (int i = 0; i < str.length(); ++i) { if (str[i] >= 'a' && str[i] <= 'z') { small = true; } if (str[i...
#include <iostream> #include <string> using namespace std; bool check_pass(string str) { if (str.length() < 6) { return false; } bool small, large, num; small = large = num = false; for (int i = 0; i < str.length(); ++i) { if (str[i] >= 'a' && str[i] <= 'z') { small = true; } if (str[i...
[["-", 15, 339, 51, 16, 12, 16, 12, 103, 0, 125], ["+", 15, 339, 51, 16, 12, 16, 12, 103, 0, 125]]
1
198
2
#include <iostream> #include <string> using namespace std; int main() { int length = 0, num = 0, big = 0, small = 0; string str; cin >> str; if (str.size() >= 6) length++; for (int i = 0; i < str.size() - 1; i++) { if (str[i] >= '0' && str[i] <= '9') num++; else if (str[i] >= 'a' && str[i]...
#include <iostream> #include <string> using namespace std; int main() { int length = 0, num = 0, big = 0, small = 0; string str; cin >> str; if (str.size() >= 6) length++; for (int i = 0; i < str.size(); i++) { if (str[i] >= '0' && str[i] <= '9') num++; else if (str[i] >= 'a' && str[i] <= ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
179
2
p=gets.chop puts p.size>5&&p.match(/[A-Z]/)&p.match(/[a-z]/)&p.match(/[0-9]/) ? "VALID" : "INVALID"
p=gets.chop puts p.size>5&&p.match(/[A-Z]/)&&p.match(/[a-z]/)&&p.match(/[0-9]/)?"VALID":"INVALID"
[["-", 0, 754, 15, 738, 12, 738, 31, 738, 17, 67], ["+", 3, 4, 0, 754, 15, 738, 31, 738, 17, 98], ["-", 3, 4, 0, 754, 15, 738, 12, 738, 17, 67], ["+", 0, 652, 3, 4, 0, 754, 15, 738, 17, 98]]
4
46
4
#include <algorithm> #include <iostream> #include <string> using namespace std; typedef long long lli; lli get_digit(lli a) { lli res = 0, tmp = a; if (a == 0) return 1; while (tmp > 0) { res++; tmp /= 10; } return res; } lli mypow(lli a, lli b) { lli digit = get_digit(a); if (digit + b > ...
#include <algorithm> #include <iostream> #include <string> using namespace std; typedef long long lli; lli get_digit(lli a) { lli res = 0, tmp = a; if (a == 0) return 1; while (tmp > 0) { res++; tmp /= 10; } return res; } lli mypow(lli a, lli b) { lli digit = get_digit(a); if (digit * b > ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
308
6
#include <stdio.h> int strint(char *a) { int n, i; for (i = n = 0; a[i]; i++) n = n * 10 + a[i] - '0'; return n; } int main() { char s[15]; int i, n, c, m; scanf("%s", s); for (i = n = c = 0; s[i]; i++) { if (s[i] - '0') { m = strint(s + i); if (m > n) c += 1 - (m - n) % 2; ...
#include <stdio.h> int strint(char *a) { int n, i; for (i = n = 0; a[i]; i++) n = n * 10 + a[i] - '0'; return n; } int main() { char s[15]; int i, n, c, m; scanf("%s", s); for (i = n = c = 0; s[i]; i++) { if (s[i] - '0') { m = strint(s + i); if (m >= n) c += 1 - (m - n) % 2; ...
[["-", 64, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 23, 0, 16, 17, 20]]
0
169
2
#include <bits/stdc++.h> using namespace std; int main() { int co = 0; string a; cin >> a; string b = ""; while (a != "") { // cout << 1 << endl;; stringstream ssa(a); long long ai; ssa >> ai; if (a == "") ai = 0; stringstream ssb(b); long long bi; ssb >> bi; if (b ==...
#include <bits/stdc++.h> using namespace std; int main() { int co = 0; string a; cin >> a; string b = ""; while (a != "") { // cout << 1 << endl;; stringstream ssa(a); long long ai; ssa >> ai; if (a == "") ai = 0; stringstream ssb(b); long long bi; ssb >> bi; if (b ==...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20]]
1
211
2
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) string ss; int ans; int to_int(string ss) { if (ss == "") return 0; int ret; istringstream is(ss); is >> ret; return ret; } void f(int n) { string ss1 = ss.substr(0, n); string ss2 = ss.substr(n, ss.siz...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) string ss; int ans; int to_int(string ss) { if (ss == "") return 0; int ret; istringstream is(ss); is >> ret; return ret; } void f(int n) { string ss1 = ss.substr(0, n); string ss2 = ss.substr(n, ss.siz...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
208
4
s=gets.chomp;p s.size.times.count{|i|l=(s[0,i]||0).to_i;r=(s[i..-1]||0).to_i;(s[i,1]!='0'||i<s.size-1)&&l<=r&&l%2==r%2}
s=gets.chomp;p s.size.times.count{|i|l=(s[0,i]||0).to_i;r=(s[i..-1]||0).to_i;(s[i,1]!='0'||i==s.size-1)&&l<=r&&l%2==r%2}
[["-", 31, 738, 31, 739, 0, 738, 12, 738, 17, 18], ["+", 31, 738, 31, 739, 0, 738, 12, 738, 17, 60]]
4
82
2
#include <cmath> #include <iostream> #include <vector> using namespace std; long double r, x, y, p[100], PI = 3.14159265358979l; int n; struct Point { long double px, py; }; long double crs(const Point &a, const Point &b) { return a.px * b.py - a.py * b.px; } long double area(vector<Point> v) { long double ret = ...
#include <cmath> #include <iostream> #include <vector> using namespace std; long double r, x, y, p[100], PI = 3.14159265358979l; int n; struct Point { long double px, py; }; long double crs(const Point &a, const Point &b) { return a.px * b.py - a.py * b.px; } long double area(vector<Point> v) { long double ret = ...
[["-", 49, 50, 51, 83, 0, 16, 12, 2, 63, 22], ["+", 49, 50, 51, 83, 0, 16, 12, 2, 63, 22]]
1
368
8
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ...
[["-", 0, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 0, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 0, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 0, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
498
4
while (inp = gets) && inp != '0' ss = [] n = inp.to_i n.times{ss << gets.chomp} g = Array.new(26){Array.new(26,false)} ng = false n.times{|i| i.times{|j| if [ss[i].size,ss[j].size].min.times{|k| if ss[i][k] != ss[j][k] g[ss[j][k].ord-'a'.ord][ss[i][k].ord-'a'.ord] = true ...
while (inp = gets) && inp.chomp! != '0' ss = [] n = inp.to_i n.times{ss << gets.chomp} g = Array.new(26){Array.new(26,false)} ng = false n.times{|i| i.times{|j| if [ss[i].size,ss[j].size].min.times{|k| if ss[i][k] != ss[j][k] g[ss[j][k].ord-'a'.ord][ss[i][k].ord-'a'.ord] = tr...
[["+", 0, 89, 15, 738, 12, 738, 31, 652, 17, 131], ["+", 0, 89, 15, 738, 12, 738, 31, 652, 735, 22]]
4
237
2
#define _USE_MATH_DEFINES #include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> usi...
#define _USE_MATH_DEFINES #include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> usi...
[["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 8, 9, 0, 7, 8, 57, 75, 76, 0, 95], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46]]
1
532
5
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define INF 10000001000 #define int long long using namespace std; signed main() { int n; while (cin >> n, n) { // cout << "--------------------------------------------" << endl; // cout << n << endl; vector<int> vec(n + 1); stri...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define INF 10000001000 #define int long long using namespace std; signed main() { int n; while (cin >> n, n) { // cout << "--------------------------------------------" << endl; // cout << n << endl; vector<int> vec(n + 1); stri...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
518
2
#include <bits/stdc++.h> using namespace std; int go(vector<long long> v, int num) { vector<long long> diff; for (int i = 0; i < v.size(); i++) { if (v[i] == -1) v[i] = num; if (i) diff.push_back(v[i] - v[i - 1]); } for (int i = 0; i < diff.size(); i++) { if (((i % 2) ^ (diff[i] < 0)) |...
#include <bits/stdc++.h> using namespace std; int go(vector<long long> v, int num) { vector<long long> diff; for (int i = 0; i < v.size(); i++) { if (v[i] == -1e15) v[i] = num; if (i) diff.push_back(v[i] - v[i - 1]); } for (int i = 0; i < diff.size(); i++) { if (((i % 2) ^ (diff[i] < 0)...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
406
4
#include <bits/stdc++.h> using namespace std; int main() { int N; while (1) { cin >> N; if (N == 0) break; vector<string> vec; for (int i = 0; i < N; i++) { string in; cin >> in; vec.push_back(in); } bool flag = true; for (int i = 0; i < N; i++) { if (vec...
#include <bits/stdc++.h> using namespace std; int main() { int N; while (1) { cin >> N; if (N == 0) break; vector<string> vec; for (int i = 0; i < N; i++) { string in; cin >> in; vec.push_back(in); } bool flag = true; for (int i = 0; i < N; i++) { if (vec...
[["+", 64, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 17, 33]]
1
693
4
#include <algorithm> #include <iostream> #include <stdlib.h> #include <string> #define INF 1000000001 #define MIN -1000000002 #define MAX 1000000002 using namespace std; int main() { int n; while (cin >> n && n != 0) { long a[1000 + 1]; long mn = MIN; long mx = MAX; for (int i = 1; i <= n; i++) { ...
#include <algorithm> #include <iostream> #include <stdlib.h> #include <string> #define INF 1000000002 #define MIN -1000000002 #define MAX 1000000002 using namespace std; int main() { int n; while (cin >> n && n != 0) { long a[1000 + 1]; long mn = MIN; long mx = MAX; for (int i = 1; i <= n; i++) { ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
467
4
#include <cstdlib> #include <iostream> #include <string> using namespace std; int main() { for (int N; cin >> N, N;) { string s[1234]; for (int i = 0; i < N; i++) { cin >> s[i]; } bool f = false; int lt = 1e9 + 9, ht = -1e9 + 9; for (int i = 0; i < N - 1; i++) { if (s[i][0] == 'x...
#include <cstdlib> #include <iostream> #include <string> using namespace std; int main() { for (int N; cin >> N, N;) { string s[1234]; for (int i = 0; i < N; i++) { cin >> s[i]; } bool f = false; int lt = 1e9 + 9, ht = -1e9 - 9; for (int i = 0; i < N - 1; i++) { if (s[i][0] == 'x...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 19], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 20], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 20], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 19]]
1
357
6
#include <algorithm> #include <cstdlib> #include <iostream> using namespace std; #define MAX_N 1000000000 int main() { while (1) { int n; cin >> n; if (n == 0) break; long long int a[n]; for (int i = 0; i < n; i++) { string s; cin >> s; a[i] = s == "x" ? MAX_N + 1 : atoi(...
#include <algorithm> #include <cstdlib> #include <iostream> using namespace std; #define MAX_N 1000000000 int main() { while (1) { int n; cin >> n; if (n == 0) break; long long int a[n]; for (int i = 0; i < n; i++) { string s; cin >> s; a[i] = s == "x" ? MAX_N + 1 : atoi(...
[["-", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 2, 63, 22]]
1
399
8
#include <iostream> #include <sstream> #include <string> using namespace std; int s2i(string str) { istringstream ss(str); int n; ss >> n; return n; } int main() { int n; cin >> n; int i, j, k; string str; while (n != 0) { int b, c; int f = 0; int o = 0; int xmin = -1000000010, xmax = ...
#include <iostream> #include <sstream> #include <string> using namespace std; int s2i(string str) { istringstream ss(str); int n; ss >> n; return n; } int main() { int n; cin >> n; int i, j, k; string str; while (n != 0) { int b, c; int f = 0; int o = 0; int xmin = -1000000010, xmax = ...
[["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
366
4
#include <algorithm> #include <iostream> #include <string> #define INF 1000000007 using namespace std; int N, a[1000]; string s; int main() { while (cin >> N, N) { for (int i = 0; i < N; i++) { cin >> s; a[i] = s[0] != 'x' ? stoi(s) : INF; } int f = 1; for (int i = 0; i < N; i += 2) { ...
#include <algorithm> #include <iostream> #include <string> #define INF 1000000007 using namespace std; int N, a[1000]; string s; int main() { while (cin >> N, N) { for (int i = 0; i < N; i++) { cin >> s; a[i] = s[0] != 'x' ? stoi(s) : INF; } int f = 1; for (int i = 0; i < N; i += 2) { ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
1
530
7
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define repl(i, a, b) for...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define repl(i, a, b) for...
[["+", 0, 57, 64, 57, 64, 37, 0, 91, 17, 33]]
1
495
1
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) using namespace std; const int INF = 2e9; int change(string s) { int res = 0, i = 0; for (i = 0; i < s.size(); i++) { if (s[i] == '-') continue; res = res * 10 + (int)(s[i] - '0'); // cout << s[i] - '0' << " " << res << end...
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) using namespace std; const int INF = 2e9; int change(string s) { int res = 0, i = 0; for (i = 0; i < s.size(); i++) { if (s[i] == '-') continue; res = res * 10 + (int)(s[i] - '0'); // cout << s[i] - '0' << " " << res << end...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
499
2
#include "bits/stdc++.h" #include <unordered_map> #pragma warning(disable : 4996) using namespace std; const int mod = 1000000007; struct Mod { public: int num; Mod() : num(0) { ; } Mod(long long int n) : num((n % mod + mod) % mod) { ; } Mod(int n) : num((n % mod + mod) % mod) { ; } operator int() { return n...
#include "bits/stdc++.h" #include <unordered_map> #pragma warning(disable : 4996) using namespace std; const int mod = 1000000007; struct Mod { public: int num; Mod() : num(0) { ; } Mod(long long int n) : num((n % mod + mod) % mod) { ; } Mod(int n) : num((n % mod + mod) % mod) { ; } operator int() { return n...
[["+", 31, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 12, 69, 28, 69, 341, 342, 0, 16, 17, 72], ["-", 12, 69, 28, 69, 341, 342, 0, 16, 12, 13]]
1
1,442
6
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) a.begin(), a.end() #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(10) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> pii...
#include <bits/stdc++.h> using namespace std; #define FOR(i, k, n) for (int i = (k); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define ALL(a) a.begin(), a.end() #define MS(m, v) memset(m, v, sizeof(m)) #define D10 fixed << setprecision(10) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> pii...
[["-", 15, 339, 51, 16, 31, 16, 31, 16, 17, 60], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 79], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 17, 60], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 79], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60]]
1
1,066
12
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)n; ++i) #define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i) #define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i) #define each(i, c) \ for (__typeof((c).begin()) i = (c).begin(...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)n; ++i) #define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i) #define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i) #define each(i, c) \ for (__typeof((c).begin()) i = (c).begin(...
[["+", 8, 9, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 52, 8, 9, 0, 9, 0, 1, 0, 35]]
1
303
4
#include <fstream> #include <iostream> #include <string> using namespace std; ifstream fin; ofstream fout; int main() { fin.open("input.txt"); fout.open("output.txt"); bool left = false, right = false; // false??§???,true??§????????° int n; // input int count = 0; bool moveflag; bool pre, now; // tru...
#include <fstream> #include <iostream> #include <string> using namespace std; ifstream fin; ofstream fout; int main() { fin.open("input.txt"); fout.open("output.txt"); bool left = false, right = false; // false??§???,true??§????????° int n; // input int count = 0; bool moveflag; bool pre, now; // tru...
[["-", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
362
6
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main() { for (int n; cin >> n;) { int c = 0, d = 0, C = ...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main() { for (int n; cin >> n && n;) { int c = 0, d = 0,...
[["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 98], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
160
2
#include <bits/stdc++.h> using namespace std; /*{{{*/ // template #define rep(i, n) for (int i = 0; i < n; i++) constexpr int INF = numeric_limits<int>::max() / 2; constexpr long long LINF = numeric_limits<long long>::max() / 3; #define mp make_pair #define pb push_back #define eb emplace_back #define fi first #define ...
#include <bits/stdc++.h> using namespace std; /*{{{*/ // template #define rep(i, n) for (int i = 0; i < n; i++) constexpr int INF = numeric_limits<int>::max() / 2; constexpr long long LINF = numeric_limits<long long>::max() / 3; #define mp make_pair #define pb push_back #define eb emplace_back #define fi first #define ...
[["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 13]]
1
658
2
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n) { if (n == 0) { break; } vector<string> str(n); for (int i = 0; i < n; i++) { cin >> str[i]; if (i == 0) { continue; } for (int j = 0; j < str[i]....
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n) { if (n == 0) { break; } vector<string> str(n); for (int i = 0; i < n; i++) { cin >> str[i]; if (i == 0) { continue; } for (int j = 0; j < str[i]....
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
313
2
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, ...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, ...
[["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
349
4
#include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; typedef vector<string> vs; void cat(vs &arr, int i, int j) { int cur = i; while (1) { if (++cur >= arr.size()) { break; } if (j > arr[cur].length()) { break; } if (arr[cur][j] == '+') { ...
#include <cstdlib> #include <iostream> #include <string> #include <vector> using namespace std; typedef vector<string> vs; void cat(vs &arr, int i, int j) { int cur = i; while (1) { if (++cur >= arr.size()) { break; } if (j > arr[cur].length()) { break; } if (arr[cur][j] == '+') { ...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
453
2
#include <algorithm> #include <iostream> #include <vector> #define reps(i, j, k) for (int i = (j); i <= (k); ++i) #define rep(i, j) reps(i, 0, (j)-1) #define fs first #define sc second #define pb push_back using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; int main() { int n; while (cin >>...
#include <algorithm> #include <iostream> #include <vector> #define reps(i, j, k) for (int i = (j); i <= (k); ++i) #define rep(i, j) reps(i, 0, (j)-1) #define fs first #define sc second #define pb push_back using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; int main() { int n; while (cin >>...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
251
2
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #includ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["+", 0, 57, 15, 339, 51, 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
726
6
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define loop(i, s, n) for (int i = s; i < n; i++) #define all(in) in.begin(), in.end() #define rep(i, n) for (int i = 0; i < n; i++) #define loop(i, s, n) for (int i = s; i < n; i++) #define all(in) in.begin(), in.end() #define MP make_pair #define ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define loop(i, s, n) for (int i = s; i < n; i++) #define all(in) in.begin(), in.end() #define rep(i, n) for (int i = 0; i < n; i++) #define loop(i, s, n) for (int i = s; i < n; i++) #define all(in) in.begin(), in.end() #define MP make_pair #define ...
[["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 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, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46]]
1
748
6
#include <iostream> using namespace std; int main(void) { while (1) { int n; scanf("%d", &n); if (n == 0) break; char s[n][1919]; for (int i = 0; i < n; i++) scanf("%s", s[i]); int a[n]; for (int i = 0; i < n; i++) for (int j = 0;; j++) { if (s[i][j] != '.') { ...
#include <iostream> using namespace std; int main(void) { while (1) { int n; scanf("%d", &n); if (n == 0) break; char s[n][1919]; for (int i = 0; i < n; i++) scanf("%s", s[i]); int a[n]; for (int i = 0; i < n; i++) for (int j = 0;; j++) { if (s[i][j] != '.') { ...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
357
2
#include <algorithm> #include <iostream> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) #define srep(i, n, m) for (int i = (int)n; i <= (int)m; i++) int n, m; int dp[52][52][52][52]; bool ok[52][52][52][52]; int inf = 1000000; vector<string...
#include <algorithm> #include <iostream> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) #define srep(i, n, m) for (int i = (int)n; i <= (int)m; i++) int n, m; int dp[52][52][52][52]; bool ok[52][52][52][52]; int inf = 1000000; vector<string...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
1,120
2
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; template <class S, class T> ostream &operator<<(ostream &out, const pair<S, T> &o) { out << "(" << o.first << "," << o.second << ")"; return out; } tem...
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; template <class S, class T> ostream &operator<<(ostream &out, const pair<S, T> &o) { out << "(" << o.first << "," << o.second << ")"; return out; } tem...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 91, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 91, 28, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
1,330
5
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #includ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 28, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 3, 4, 0, 2, 3, 4, 0, 91, 17, 33], ["+"...
1
1,497
8
#include <algorithm> #include <stdio.h> #include <string> using namespace std; typedef unsigned long long wolf; wolf mod = 1000000007; char gly[26][20][20]; wolf Hash[26]; wolf revHash[26]; int gh[26]; int gw[26]; char in[2]; char str[110][1100]; pair<int, int> shrink(int top, int bottom, int left, int right) { while...
#include <algorithm> #include <stdio.h> #include <string> using namespace std; typedef unsigned long long wolf; wolf mod = 1000000007; char gly[26][20][20]; wolf Hash[26]; wolf revHash[26]; int gh[26]; int gw[26]; char in[2]; char str[110][1100]; pair<int, int> shrink(int top, int bottom, int left, int right) { while...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["-", 0, 11, 12, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 11, 31, 69, 341, 342, 0, 22], ["-", 64, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 64, 1, 0, 27, 28, 69, 341, 342, 0, 22]]
1
1,399
12
#include <cstdlib> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; struct edge { long long x, v, c; }; struct S { long long x, v, c; bool operator<(S s) const { return c > s.c; } }; vector<edge> G[123][1234]; long long d[123][1234]; set<long long> cands; void add_ca...
#include <cmath> #include <cstdlib> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; struct edge { long long x, v, c; }; struct S { long long x, v, c; bool operator<(S s) const { return c > s.c; } }; vector<edge> G[123][1234]; long long d[123][1234]; set<long long> ca...
[["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
790
4
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var Arr = (input.trim()).split("\n"); var NQ = (Arr.shift()).split(" ").map(Number); var N = NQ[1]; var Q = NQ[1]; var str = "kogakubu10gokan"; for (var i = 0; i < N; i++) { var arr = Arr[i].split(" "); var a = arr[0] - 0; if (a <= Q) str = arr[1];...
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var Arr = (input.trim()).split("\n"); var NQ = (Arr.shift()).split(" ").map(Number); var N = NQ[0]; var Q = NQ[1]; var str = "kogakubu10gokan"; for (var i = 0; i < N; i++) { var arr = Arr[i].split(" "); var a = arr[0] - 0; if (a <= Q) str = arr[1];...
[["-", 0, 493, 0, 198, 0, 200, 51, 69, 71, 555], ["+", 0, 493, 0, 198, 0, 200, 51, 69, 71, 555]]
2
146
2
#include <stdio.h> int main(void) { int num, que, i, year[51]; char name[51][31]; scanf("%d %d", &num, &que); for (i = 0; i < num; i++) { scanf("%d %s", &year[i], name[i]); } i = 0; while (year[i] <= que && i < num) { i++; } if (i == 0) { printf("kogakubu10goukan\n"); } else { printf...
#include <stdio.h> int main(void) { int num, que, i, year[51]; char name[51][31]; scanf("%d %d", &num, &que); for (i = 0; i < num; i++) { scanf("%d %s", &year[i], name[i]); } i = 0; while (year[i] <= que && i < num) { i++; } if (i == 0) { printf("kogakubu10gokan\n"); } else { printf(...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
135
2
#include <algorithm> #include <iostream> #include <string> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) using namespace std; int main() { int n, q; cin >> n >> q; string ans = "kogakubo10goukan"; rep(i, n) { int y; string name; cin >> y >> name; if (y <= q)...
#include <algorithm> #include <iostream> #include <string> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) using namespace std; int main() { int n, q; cin >> n >> q; string ans = "kogakubu10gokan"; rep(i, n) { int y; string name; cin >> y >> name; if (y <= q) ...
[["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6]]
1
88
2
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define MP make_pair int main() { int n, q, max = 0; cin >> n >> q; vector<pair<int, string>> v(n); for (int i = 0; i < n; i++) { int y; string s; cin >> y >> s; v[i] = MP(y, s); if (v[i].first < q) { max ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define MP make_pair int main() { int n, q, max = -1; cin >> n >> q; vector<pair<int, string>> v(n); for (int i = 0; i < n; i++) { int y; string s; cin >> y >> s; v[i] = MP(y, s); if (v[i].first <= q) { ma...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
135
6
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int n, q, x; cin >> n >> q; string res = "kogakubu10gokan"; for (int i = 0; i < n; i++) { cin >> x; if (x > n) { cout << res << endl; return 0; } cin >> res; } cout << res << endl; re...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int n, q, x; cin >> n >> q; string res = "kogakubu10gokan"; for (int i = 0; i < n; i++) { cin >> x; if (x > q) { cout << res << endl; return 0; } cin >> res; } cout << res << endl; re...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
86
2
#include <iostream> #include <string> using namespace std; int main() { pair<int, string> prev, now; prev = make_pair(1, "kogakubu10gokan"); int N, Q; cin >> N >> Q; for (int i = 0; i < N; i++) { cin >> now.first >> now.second; if (prev.first <= Q && Q < now.first) { cout << prev.second <<...
#include <iostream> #include <string> using namespace std; int main() { pair<int, string> prev, now; prev = make_pair(1, "kogakubu10gokan"); int N, Q; cin >> N >> Q; for (int i = 0; i < N; i++) { cin >> now.first >> now.second; if (prev.first <= Q && Q < now.first) { cout << prev.second <<...
[["+", 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, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
110
4
#include <iostream> #include <string> using namespace std; string name[10000]; int y, a, b, n; string S[10000]; int main() { S[0] = "kogakubu10gokan"; cin >> a >> b; for (int i = 1; i <= a; i++) { cin >> y >> S[i]; for (int j = n; j < y; j++) { name[j - 1] = S[i - 1]; } n = y; } for (int...
#include <iostream> #include <string> using namespace std; string name[10000]; int y, a, b, n; string S[10000]; int main() { S[0] = "kogakubu10gokan"; cin >> a >> b; n = 0; for (int i = 1; i <= a; i++) { cin >> y >> S[i]; for (int j = n; j < y; j++) { name[j] = S[i - 1]; } n = y; } for...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
147
6
n,q = list(map(int,input().split())) old = "kogaku10gokan" for i in range(n): year,new = list(map(str,input().split())) if int(year) >= q: print(new if int(year) == q else old) break old = new else: print(old)
n,q = list(map(int,input().split())) old = "kogakubu10gokan" for i in range(n): year,new = list(map(str,input().split())) if int(year) >= q: print(new if int(year) == q else old) break old = new else: print(old)
[["-", 0, 656, 0, 1, 0, 662, 12, 557, 0, 6], ["+", 0, 656, 0, 1, 0, 662, 12, 557, 0, 6]]
5
82
2
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; // < "D:\D_Download\Visual Studio // 2015\Projects\programing_contest_c++\Debug\a.txt" int l ...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; // < "D:\D_Download\Visual Studio // 2015\Projects\programing_contest_c++\Debug\a.txt" int l ...
[["-", 51, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 51, 2, 3, 4, 0, 2, 3, 4, 0, 13]]
1
712
2
#include <bits/stdc++.h> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) for (int i = 0; i < (b); i++) #define all(a) (a).*begin(), (a).end() #define show(x) cerr << #x << " = " << (x) << endl; using namespace std; const int M = 1000000007; string s; typedef string::const_iterator State; int...
#include <bits/stdc++.h> #define range(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, b) for (int i = 0; i < (b); i++) #define all(a) (a).*begin(), (a).end() #define show(x) cerr << #x << " = " << (x) << endl; using namespace std; const int M = 1000000007; string s; typedef string::const_iterator State; int...
[["+", 0, 1, 0, 11, 12, 16, 12, 2, 63, 22], ["+", 0, 11, 12, 16, 12, 2, 3, 4, 0, 24], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["+", 0, 11, 12, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 11, 12, 16, 12, 2, 3, 4, 0, 13]]
1
327
5
#include <iostream> using ll = long long; constexpr ll MOD = (1e9) + 7; class Parser { private: std::string s; std::string::const_iterator it; public: Parser(std::string s) { this->s = s; it = s.begin(); } ll number() { ll res = 0; while (isdigit(*it)) { res *= 10; res += *it -...
#include <iostream> using ll = long long; constexpr ll MOD = (1e9) + 7; class Parser { private: std::string s; std::string::const_iterator it; public: Parser(std::string s) { this->s = s; it = this->s.begin(); } ll number() { ll res = 0; while (isdigit(*it)) { res *= 10; res +=...
[["+", 0, 11, 12, 2, 63, 118, 28, 118, 28, 274], ["+", 0, 11, 12, 2, 63, 118, 28, 118, 17, 143]]
1
477
2
// g++ -std=c++11 a.cpp #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <typeinfo> #include <utility> #inc...
// g++ -std=c++11 a.cpp #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <typeinfo> #include <utility> #inc...
[["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
626
5
import java.util.*; public class Main { public static void main(String[] args) { new Main().run(); } public void run() { Scanner scan = new Scanner(System.in); String mstr = "AADINNUY"; String nstr = "AIZUNYAN"; char[] t = "AAAAAAAA".toCharArray(); String tt = ""; while (scan.hasNext()) { ...
import java.util.*; public class Main { public static void main(String[] args) { new Main().run(); } public void run() { Scanner scan = new Scanner(System.in); String mstr = "AADINNUY"; String nstr = "AIZUNYAN"; char[] t = "AAAAAAAA".toCharArray(); String tt = ""; while (scan.hasNext()) { ...
[["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 499], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35]]
3
308
4
long *strcmp, a, v; main() { for (; v = a = v >> 8 | getchar() + 1L << 56; v & 72 && printf(a == 0x5a564f4f4a454242 ? v = 0, "AIZUNYAN" : "%c", v - 1)) qsort(&a, 8, 1, strcmp); }
long a, v; main() { for (strcmp(); v = a = v >> 8 | getchar() + 1L << 56; v & 72 && printf(a == 0x5a564f4f4a454242 ? v = 0, "AIZUNYAN" : "%c", v - 1)) qsort(&a, 8, 1, strcmp); }
[["-", 36, 36, 0, 30, 0, 43, 49, 84, 0, 48], ["-", 36, 36, 0, 30, 0, 43, 49, 84, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 0, 30, 0, 9, 0, 7, 0, 24], ["+", 0, 30, 0, 9, 0, 7, 10, 2, 63, 22], ["+", 0, 9, 0, 7, 10, 2, 3, 4, 0, 25]]
0
72
12
#include <algorithm> #include <iostream> #include <set> #include <string> #include <vector> #define all(c) (c).begin(), (c).end() using namespace std; int main(void) { set<string> S; string str = "AIDUNYAN"; sort(all(str)); do { S.insert(str); } while (next_permutation(all(str))); cin >> str; f...
#include <algorithm> #include <iostream> #include <set> #include <string> #include <vector> #define all(c) (c).begin(), (c).end() using namespace std; int main(void) { set<string> S; string str = "AIDUNYAN"; sort(all(str)); do { S.insert(str); } while (next_permutation(all(str))); cin >> str; f...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
156
4
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #includ...
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #includ...
[["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 12, 13]]
1
440
2
#include <algorithm> #include <iostream> #include <string> using namespace std; string S, T = "AIZUNYAN", U = "AADINNUY"; int main() { cin >> S; int W = S.size() - 7; for (int i = 0; i < W; i++) { string V = S.substr(i, 8); sort(V.begin(), V.end()); if (V == U) { for (int j = 0; j < 8; j++) { ...
#include <algorithm> #include <iostream> #include <string> using namespace std; string S, T = "AIZUNYAN", U = "AADINNUY"; int main() { cin >> S; int W = S.size() - 7; for (int i = 0; i < W; i++) { string V = S.substr(i, 8); sort(V.begin(), V.end()); if (V == U) { for (int j = 0; j < 8; j++) { ...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
134
4
#include <algorithm> #include <iostream> using namespace std; string S, T, V = "AIZUNYAN"; int main() { cin >> S; T = S; if (S.size() < 8) { cout << S << endl; return 0; } for (int i = 0; i < S.size() - 7; i++) { string U = S.substr(i, 8); char p[8]; for (int j = 0; j < 8; j++) { p[j...
#include <algorithm> #include <iostream> using namespace std; string S, T, V = "AIZUNYAN"; int main() { cin >> S; T = S; if (S.size() < 8) { cout << S << endl; return 0; } for (int i = 0; i < S.size() - 7; i++) { string U = S.substr(i, 8); char p[8]; for (int j = 0; j < 8; j++) { p[j...
[["-", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6], ["+", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6]]
1
204
2
#include <bits/stdc++.h> using namespace std; string s; bool check(string s) { sort(s.begin(), s.end()); if (s == "AADINNUY") return true; return false; } void change(int x) { string t = "AIZUNYAN"; for (int i = 0; i < t.size(); i++, x++) s[x] = t[i]; } int main() { cin >> s; for (int i = 0; i ...
#include <bits/stdc++.h> using namespace std; string s; bool check(string s) { sort(s.begin(), s.end()); if (s == "AADINNUY") return true; return false; } void change(int x) { string t = "AIZUNYAN"; for (int i = 0; i < (int)t.size(); i++, x++) s[x] = t[i]; } int main() { cin >> s; for (int i = ...
[["+", 8, 9, 0, 7, 15, 16, 12, 74, 0, 24], ["+", 0, 7, 15, 16, 12, 74, 39, 77, 39, 40], ["+", 8, 9, 0, 7, 15, 16, 12, 74, 0, 25], ["+", 0, 7, 15, 16, 12, 16, 31, 74, 0, 24], ["+", 15, 16, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 7, 15, 16, 12, 16, 31, 74, 0, 25]]
1
154
6
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define FOR(i, a, b) fo...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define FOR(i, a, b) fo...
[["-", 0, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
244
4
#include <algorithm> #include <cstdio> #include <iostream> #include <string> using namespace std; string r = "AIZUNYAN"; int main() { string a; int b; cin >> a; for (b = 0; b <= (int)(a.length()) - 8; b++) { int A, N, I, Z, Y, U; A = N = I = Z = Y = U = 0; for (int c = 0; c < 8; c++) { switch...
#include <algorithm> #include <cstdio> #include <iostream> #include <string> using namespace std; string r = "AIZUNYAN"; int main() { string a; int b; cin >> a; for (b = 0; b <= (int)(a.length()) - 8; b++) { int A, N, I, Z, Y, U; A = N = I = Z = Y = U = 0; for (int c = 0; c < 8; c++) { switch...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
237
4
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <valarray> #include <...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <valarray> #include <...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
269
2
#include <bits/stdc++.h> using namespace std; string AIZUNYAN = "AIZUNYAN"; string AIDUNYAN = "AIDUNYAN"; bool check(string s) { sort(s.begin(), s.end()); string tmp = AIDUNYAN; sort(tmp.begin(), tmp.end()); return tmp == s; } int main() { string s; cin >> s; string ans = s; for (int i = 0; i + 8 < s.si...
#include <bits/stdc++.h> using namespace std; string AIZUNYAN = "AIZUNYAN"; string AIDUNYAN = "AIDUNYAN"; bool check(string s) { sort(s.begin(), s.end()); string tmp = AIDUNYAN; sort(tmp.begin(), tmp.end()); return tmp == s; } int main() { string s; cin >> s; string ans = s; for (int i = 0; i + 7 < s.si...
[["-", 8, 9, 0, 7, 15, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 13]]
1
161
2