problem_id
stringlengths
6
6
language
stringclasses
2 values
original_status
stringclasses
3 values
original_src
stringlengths
19
243k
changed_src
stringlengths
19
243k
change
stringclasses
3 values
i1
int64
0
8.44k
i2
int64
0
8.44k
j1
int64
0
8.44k
j2
int64
0
8.44k
error
stringclasses
270 values
stderr
stringlengths
0
226k
p02418
C++
Runtime Error
#include <cctype> #include <cstdio> #include <cstring> #include <iostream> using namespace std; #define ll long long #define REP(i, a, b) for (i = a; i < b; i++) #define rep(i, n) REP(i, 0, n) #define MD 1000000007 char sep[2] = {' ', '\n'}; int main() { int i, j, k, n, m, l; char s1[210], s2[110]; scanf("%s\...
#include <cctype> #include <cstdio> #include <cstring> #include <iostream> using namespace std; #define ll long long #define REP(i, a, b) for (i = a; i < b; i++) #define rep(i, n) REP(i, 0, n) #define MD 1000000007 char sep[2] = {' ', '\n'}; int main() { int i, j, k, n, m, l; char s1[210], s2[110], s3[210]; c...
replace
16
20
16
21
0
p02418
C++
Runtime Error
#include <cstring> #include <iostream> using namespace std; int main() { char str1[201], str2[101]; cin >> str1 >> str2; cout << (strstr(strcat(str1, str1), str2) ? "Yes" : "No") << endl; return 0; }
#include <cstring> #include <iostream> using namespace std; int main() { char test_str[201], search_string[101], copied_test_str[101]; cin >> test_str >> search_string; strcpy(copied_test_str, test_str); strcat(test_str, copied_test_str); cout << (strstr(test_str, search_string) ? "Yes" : "No") << endl; r...
replace
5
8
5
11
0
p02418
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { string p, s; cin >> s; cin >> p; for (int i = 0; i < 100; i++) s += s; if (s.find(p) != string::npos) cout << "Yes" << endl; else cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string p, s; cin >> s; cin >> p; while (s.size() <= 100) s += s; if (s.find(p) != string::npos) cout << "Yes" << endl; else cout << "No" << endl; }
replace
7
8
7
8
-6
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
p02418
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { int a, b; string s, p; cin >> s >> p; s = s + s; a = s.size() * 2 - 1; b = p.size(); for (int i = 0; i < a; i++) { for (int n = 1; n < a; n++) { if (p == s.substr(i, n)) { cout << "Yes" << endl; return 0; ...
#include <iostream> #include <string> using namespace std; int main() { int a, b; string s, p; cin >> s >> p; s = s + s; a = s.size() * 2 - 1; b = s.size(); for (int i = 0; i < b; i++) { for (int n = 1; n < a; n++) { if (p == s.substr(i, n)) { cout << "Yes" << endl; return 0; ...
replace
9
11
9
11
0
p02419
C++
Time Limit Exceeded
#include <iostream> #include <string> using namespace std; int main() { string T, S; int count = 0, i; cin >> S; while (T != "END_OF_TEXT") { cin >> T; for (i = 0; i < T.size(); i++) { if (T[i] >= 'A' && T[i] <= 'Z') T[i] += 32; } if (T == S) count++; } cout << count <<...
#include <iostream> #include <string> using namespace std; int main() { string T, S; int count = 0, i; cin >> S; while (cin >> T, T != "END_OF_TEXT") { for (i = 0; i < T.size(); i++) { if (T[i] >= 'A' && T[i] <= 'Z') T[i] += 32; } if (T == S) count++; } cout << count << end...
replace
9
11
9
10
TLE
p02419
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; char tolower(char ch) { if ('A' <= ch && ch && ch <= 'Z') { return ch - 'A' + 'a'; } else { return ch; } } int main() { int count = 0; string W; cin >> W; string str; while (1) { cin >> str; if (str == "END_PF_TEXT") break; for (int...
#include <bits/stdc++.h> using namespace std; char tolower(char ch) { if ('A' <= ch && ch && ch <= 'Z') { return ch - 'A' + 'a'; } else { return ch; } } int main() { int count = 0; string W; cin >> W; string str; while (1) { cin >> str; if (str == "END_OF_TEXT") break; for (int...
replace
16
17
16
17
TLE
p02419
C++
Time Limit Exceeded
#include <algorithm> #include <cctype> #include <cstdio> #include <iostream> #include <stack> #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, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; ...
#include <algorithm> #include <cctype> #include <cstdio> #include <iostream> #include <stack> #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, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; ...
delete
66
69
66
66
TLE
p02419
C++
Runtime Error
#include <cctype> #include <iostream> using namespace std; #include <cstdio> #include <cstring> #include <string> string Upper(string s) { string t = s; for (int i = 0; s.size(); i++) { t[i] = toupper(s[i]); } return t; } int main() { string W, T; int count = 0; cin >> W; W = Upper(W); while ...
#include <cctype> #include <iostream> using namespace std; #include <cstdio> #include <cstring> #include <string> string Upper(string s) { string t = s; for (int i = 0; i < s.size(); i++) { t[i] = toupper(s[i]); } return t; } int main() { string W, T; int count = 0; cin >> W; W = Upper(W); wh...
replace
10
11
10
11
-11
p02419
C++
Time Limit Exceeded
#include <iostream> #include <string> using namespace std; int main() { int ans = 0; string w; cin >> w; for (int i = 0; i < w.size(); i++) { if (isupper(w[i])) { w[i] = tolower(w[i]); } } string t; while (true) { cin >> t; if (t == "END???OF???TEXT") break; for (int j = 0...
#include <iostream> #include <string> using namespace std; int main() { int ans = 0; string w; cin >> w; for (int i = 0; i < w.size(); i++) { if (isupper(w[i])) { w[i] = tolower(w[i]); } } string t; while (true) { cin >> t; if (t == "END_OF_TEXT") break; for (int j = 0; j ...
replace
15
16
15
16
TLE
p02419
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { int cnt = 0, match = 0; string w, t[150]; cin >> w; string tt; int a = 0; while (cin >> tt, tt != "END_OF_TEXT") { t[a] = tt; a++; } for (int j = 0; j < a; j++) { for (int i = 0; i < t[j].size(); i++) { if (w.size(...
#include <iostream> #include <string> using namespace std; int main() { int cnt = 0, match = 0; string w, t[300]; cin >> w; string tt; int a = 0; while (cin >> tt, tt != "END_OF_TEXT") { t[a] = tt; a++; } for (int j = 0; j < a; j++) { for (int i = 0; i < t[j].size(); i++) { if (w.size(...
replace
5
6
5
6
0
p02419
C++
Runtime Error
// // main.cpp // ITP1-9-A // // Created by h3037153 on 2017/08/28. // Copyright ?? 2017??´ h3037153. All rights reserved. // #include <cctype> #include <iostream> #include <string> using namespace std; int main() { string W, T[100]; int i = 0, counter = 0, ii = 0, len; char ch = {}; cin >> W; while (cin ...
// // main.cpp // ITP1-9-A // // Created by h3037153 on 2017/08/28. // Copyright ?? 2017??´ h3037153. All rights reserved. // #include <cctype> #include <iostream> #include <string> using namespace std; int main() { string W, T[1000]; int i = 0, counter = 0, ii = 0, len; char ch = {}; cin >> W; while (cin...
replace
12
13
12
13
0
p02419
Python
Runtime Error
import sys s = sys.stdin.read().split() print(s[1:].split().count(s[0]))
import sys s = input().lower() t = sys.stdin.read().lower().split() print(t.count(s))
replace
2
4
2
5
AttributeError: 'list' object has no attribute 'split'
Traceback (most recent call last): File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02419/Python/s514815878.py", line 3, in <module> print(s[1:].split().count(s[0])) AttributeError: 'list' object has no attribute 'split'
p02420
C++
Runtime Error
#include <iostream> int main() { std::string str; int m, h; while (true) { std::cin >> str; if (str == "-") break; std::cin >> m; for (int i = 0; i < m; i++) { std::cin >> h; str = str.substr(h) + str.erase(h); } std::cout << str << std::endl; } }
#include <iostream> int main() { std::string str; int m, h; while (true) { std::cin >> str; if (str == "-") break; std::cin >> m; for (int i = 0; i < m; i++) { std::cin >> h; str = str.substr(h) + str.substr(0, h); } std::cout << str << std::endl; } }
replace
14
15
14
15
-6
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::erase: __pos (which is 2) > this->size() (which is 1)
p02420
C++
Time Limit Exceeded
#include <stdio.h> int main() { char cards[200]; char newCards[200]; int m, cardsLen; // int h[100]; int h; while (true) { scanf("%s", cards); if (cards == "-") goto length; cardsLen = 0; while (cards[cardsLen] != '\0') cardsLen++; scanf("%d", &m); for (int i = 0; i <...
#include <stdio.h> int main() { char cards[200]; char newCards[200]; int m, cardsLen; // int h[100]; int h; while (true) { scanf("%s", cards); if (cards[0] == '-') break; cardsLen = 0; while (cards[cardsLen] != '\0') cardsLen++; scanf("%d", &m); for (int i = 0; i < m;...
replace
11
13
11
13
TLE
p02420
C++
Runtime Error
#include <stdio.h> #include <string.h> #define rep(i, a) for (int i = 0; i < a; ++i) int main(void) { char s[250], t[250]; int m, i, j, n, a; while (1) { scanf("%s", s); n = strlen(s); if (n == 1 && s[0] == '-') break; scanf("%d", &m); rep(i, m) { scanf("%d", a); rep(j, a) t...
#include <stdio.h> #include <string.h> #define rep(i, a) for (int i = 0; i < a; ++i) int main(void) { char s[250], t[250]; int m, i, j, n, a; while (1) { scanf("%s", s); n = strlen(s); if (n == 1 && s[0] == '-') break; scanf("%d", &m); rep(i, m) { scanf("%d", &a); rep(j, a) ...
replace
14
15
14
15
-11
p02420
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { string str; int m, h; while (1) { cin >> str >> m; if (str == "-") break; for (int i = 0; i < m; i++) { cin >> h; str = str.substr(h + 1, str.size() - h) + str.substr(0, h); } cout << str << endl; } ...
#include <iostream> #include <string> using namespace std; int main() { string str; int m, h; while (1) { cin >> str >> m; if (str == "-") break; for (int i = 0; i < m; i++) { cin >> h; str = str.substr(h, str.size() - h) + str.substr(0, h); } cout << str << endl; } ret...
replace
14
15
14
15
-6
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 5) > this->size() (which is 4)
p02420
C++
Time Limit Exceeded
#include <iostream> #include <string> using namespace std; int main() { string data, data_copy; int m, h; for (;;) { cin >> data; if (data == "_") break; data_copy = data; cin >> m; for (int i = 0; i < m; i++) { cin >> h; for (int j = 0; j < data.length(); j++) { ...
#include <iostream> #include <string> using namespace std; int main() { string data, data_copy; int m, h; for (;;) { cin >> data; if (data == "-") break; data_copy = data; cin >> m; for (int i = 0; i < m; i++) { cin >> h; for (int j = 0; j < data.length(); j++) { ...
replace
12
13
12
13
TLE
p02420
C++
Runtime Error
#include <algorithm> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vi vector<int> #define All(X) X.begin...
#include <algorithm> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vi vector<int> #define All(X) X.begin...
replace
29
30
29
31
0
p02420
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; ++i) #define FOR(i, a, b) for (int i = a; i...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; ++i) #define FOR(i, a, b) for (int i = a; i...
insert
30
30
30
31
TLE
p02420
C++
Runtime Error
#include <stdio.h> int main() { int m, now, temp, tot; char a[101], b[101]; for (int i = 0; i < 101; i++) b[i] = a[i] = '\0'; while (1) { scanf("%s", a); if (a[0] == '-') return 0; now = 0; while (a[now] != '\0') now++; scanf("%d", &m); tot = 0; for (int i = 0; i < m;...
#include <stdio.h> int main() { int m, now, temp, tot; char a[1001], b[1001]; for (int i = 0; i < 1001; i++) b[i] = a[i] = '\0'; while (1) { scanf("%s", a); if (a[0] == '-') return 0; now = 0; while (a[now] != '\0') now++; scanf("%d", &m); tot = 0; for (int i = 0; i <...
replace
3
5
3
5
0
p02420
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { int m, h; while (1) { char tmp[400]; string str; cin >> str; if (str == "~") { break; } for (int i = 0; i < str.size(); i++) { tmp[i] = str[i]; tmp[str.size() + i] = str[i]; } cin >> m; int ...
#include <iostream> #include <string> using namespace std; int main() { int m, h; while (1) { char tmp[400]; string str; cin >> str; if (str == "-") { break; } for (int i = 0; i < str.size(); i++) { tmp[i] = str[i]; tmp[str.size() + i] = str[i]; } cin >> m; int ...
replace
9
10
9
10
-8
p02420
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> int main() { int m, n; std::string str, tes; while (true) { std::cin >> str >> m; if (m == '-') break; for (int a = 0; a < m; a++) { std::cin >> n; tes = str.substr(0, n); str.erase(str.begin(), str.begin() + n); ...
#include <algorithm> #include <iostream> #include <string> int main() { int m, n; std::string str, tes; while (true) { std::cin >> str >> m; if (str == "-") break; for (int a = 0; a < m; a++) { std::cin >> n; tes = str.substr(0, n); str.erase(str.begin(), str.begin() + n); ...
replace
9
10
9
10
-11
p02420
C++
Runtime Error
#include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; int main() { string ch, x; int kai, shu; while (1) { cin >> ch; x = ch; if (ch == "_") break; cin >> kai; for (int i = 0; i < kai; i++) { cin >> shu; for (int j = 0; j < shu; j++)...
#include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; int main() { string ch, x; int kai, shu; while (1) { cin >> ch; x = ch; if (ch == "-") break; cin >> kai; for (int i = 0; i < kai; i++) { cin >> shu; for (int j = 0; j < shu; j++)...
replace
12
13
12
13
-11
p02420
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { string card; string right; string left; int n; int m; while (cin >> card, card != "-") { cin >> m; for (int i = 0; i < n; i++) { cin >> m; right = card.substr(0, m); left = card.substr(m); card = left + right; }...
#include <bits/stdc++.h> using namespace std; int main() { string card; string right; string left; int n; int m; while (cin >> card, card != "-") { cin >> n; for (int i = 0; i < n; i++) { cin >> m; right = card.substr(0, m); left = card.substr(m); card = left + right; }...
replace
11
12
11
12
TLE
p02420
C++
Runtime Error
#include <cctype> #include <iostream> #include <string> using namespace std; string shuffle(string str, int h) { string head = str.substr(0, h); string tail = str.substr(h, str.size() - h); return tail + head; } int main() { string cards; int m, h; while (1) { cin >> cards; if (cards == "_") ...
#include <cctype> #include <iostream> #include <string> using namespace std; string shuffle(string str, int h) { string head = str.substr(0, h); string tail = str.substr(h, str.size() - h); return tail + head; } int main() { string cards; int m, h; while (1) { cin >> cards; if (cards == "-") ...
replace
18
19
18
19
-6
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 4) > this->size() (which is 1)
p02420
C++
Runtime Error
#include <cctype> #include <iostream> #include <string> using namespace std; string shuffle(string str, int h) { string head = str.substr(0, h); string tail = str.substr(h, str.size() - h); return tail + head; } int main() { string cards; int m, h; while (1) { cin >> cards; if (cards == "_") ...
#include <cctype> #include <iostream> #include <string> using namespace std; string shuffle(string str, int h) { string head = str.substr(0, h); string tail = str.substr(h, str.size() - h); return tail + head; } int main() { string cards; int m, h; while (1) { cin >> cards; if (cards == "-") ...
replace
17
18
17
18
-6
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 4) > this->size() (which is 1)
p02420
C++
Runtime Error
#include <cstdio> #include <cstring> int main(void) { int i, j; int m[256]; int s[256] = {0}; char c[256][201]; int d[256] = {0}; int k = 0; while (1) { scanf("%s", c[k]); if (strcmp(c[k], "_") == 0) break; while (c[k][d[k]] != '\0') { d[k]++; }; scanf("%d", &m[k]); f...
#include <cstdio> #include <cstring> int main(void) { int i, j; int m[256]; int s[256] = {0}; char c[256][201]; int d[256] = {0}; int k = 0; while (1) { scanf("%s", c[k]); if (strcmp(c[k], "-") == 0) break; while (c[k][d[k]] != '\0') { d[k]++; }; scanf("%d", &m[k]); f...
replace
12
13
12
13
-8
p02420
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { string str; int m, h, i; while (cin >> str, str != "-") { cin >> m; for (i = 0; i < m; i++) { cin >> h; str = str.substr(h + 1, str.size() - h) + str.substr(0, h); } cout << str << endl; } }
#include <iostream> #include <string> using namespace std; int main() { string str; int m, h, i; while (cin >> str, str != "-") { cin >> m; for (i = 0; i < m; i++) { cin >> h; str = str.substr(h, str.size() - h) + str.substr(0, h); } cout << str << endl; } }
replace
13
14
13
14
-6
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 5) > this->size() (which is 4)
p02420
C++
Runtime Error
#include <algorithm> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vi vector<int> #define All(X) X.begin...
#include <algorithm> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vi vector<int> #define All(X) X.begin...
replace
29
31
29
31
0
p02420
C++
Runtime Error
#include <cstdio> int main() { char cards[200]; int c, s, i; char t; while (true) { i = 0; scanf("%c", &t); if (t == '-') { return 0; } while (t - 10) { cards[i] = t; i++; scanf("%c", &t); } for (int j = 0; j < i; j++) { cards[j + i] = cards[j]; }...
#include <cstdio> int main() { char cards[400]; int c, s, i; char t; while (true) { i = 0; scanf("%c", &t); if (t == '-') { return 0; } while (t - 10) { cards[i] = t; i++; scanf("%c", &t); } for (int j = 0; j < i; j++) { cards[j + i] = cards[j]; }...
replace
3
4
3
4
0
p02420
C++
Time Limit Exceeded
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { string card, sub; int m, h; while (1) { cin >> card; if (card == "_") break; cin >> m; for (int i = 0; i < m; i++) { cin >> h; sub = card.substr(0, h); card.erase(0, h); car...
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { string card, sub; int m, h; while (1) { cin >> card; if (card == "-") break; cin >> m; for (int i = 0; i < m; i++) { cin >> h; sub = card.substr(0, h); card.erase(0, h); car...
replace
11
12
11
12
TLE
p02421
C++
Time Limit Exceeded
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; int taro_score = 0, hana_score = 0; while (1) { string taro, hana; cin >> taro >> hana; if (taro > hana) { taro_score += 3; } else if (taro < hana) { hana_score += 3; } else...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; cin >> n; int taro_score = 0, hana_score = 0; for (int i = 0; i < n; ++i) { string taro, hana; cin >> taro >> hana; if (taro > hana) { taro_score += 3; } else if (taro < hana) { hana_scor...
replace
8
9
8
9
TLE
p02421
C++
Runtime Error
#include <iostream> #include <stdio.h> #include <string> using namespace std; int ps, pt; int sdiff(string sx, string tx) { if (sx == tx) { ps = 1; pt = 1; } else if (sx > tx) { ps = 3; pt = 0; } else { ps = 0; pt = 3; } return 0; } int main(void) { int n, k, is, it; string s[10...
#include <iostream> #include <stdio.h> #include <string> using namespace std; int ps, pt; int sdiff(string sx, string tx) { if (sx == tx) { ps = 1; pt = 1; } else if (sx > tx) { ps = 3; pt = 0; } else { ps = 0; pt = 3; } return 0; } int main(void) { int n, k, is, it; string s[10...
replace
23
24
23
24
0
p02421
C++
Runtime Error
#include <iostream> #include <string.h> using namespace std; int main() { int n, ts = 0, hs = 0; char *t, *h; cin >> n; while (n--) { cin >> t >> h; if (strcmp(t, h) > 0) ts += 3; else if (strcmp(t, h) < 0) hs += 3; else { ts += 1; hs += 1; } } cout << ts << ' ' ...
#include <iostream> #include <string.h> using namespace std; int main() { int n, ts = 0, hs = 0; char t[100], h[100]; cin >> n; while (n--) { cin >> t >> h; if (strcmp(t, h) > 0) ts += 3; else if (strcmp(t, h) < 0) hs += 3; else { ts += 1; hs += 1; } } cout << ts...
replace
6
7
6
7
-11
p02422
C++
Runtime Error
#include <algorithm> #include <array> #include <cstdio> #include <iostream> #include <numeric> #include <string> #include <utility> #include <vector> #define _USE_MATH_DEFINES #include <math.h> #include <unordered_map> #define min(a, b) (a) > (b) ? (b) : (a) #define max(a, b) (a) > (b) ? (a) : (b) using namespace st...
#include <algorithm> #include <array> #include <cstdio> #include <iostream> #include <numeric> #include <string> #include <utility> #include <vector> #define _USE_MATH_DEFINES #include <math.h> #include <unordered_map> #define min(a, b) (a) > (b) ? (b) : (a) #define max(a, b) (a) > (b) ? (a) : (b) using namespace st...
replace
32
33
32
33
0
p02422
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string strInput, strTemp; int nCount; int i, j; cin >> strInput; cin >> nCount; while (nCount--) { cin >> strTemp >> i >> j; if ("reverse" == strTemp) { reverse(strInput.begin() + i, strInput.begin() ...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string strInput, strTemp; int nCount; int i, j; cin >> strInput; cin >> nCount; while (nCount--) { cin >> strTemp >> i >> j; if ("reverse" == strTemp) { reverse(strInput.begin() + i, strInput.begin() ...
replace
17
18
17
20
0
p02422
C++
Runtime Error
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { char str_c[1001]; scanf("%s", str_c); string str(str_c); int num_q; scanf("%d", &num_q); int i, j; char cmd_c[100]; string cmd; int a, b; char repl_c[1001]; string repl; string line; i = 0; string ...
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { char str_c[1001]; scanf("%s", str_c); string str(str_c); int num_q; scanf("%d", &num_q); int i, j; char cmd_c[100]; string cmd; int a, b; char repl_c[1001]; string repl; string line; i = 0; string ...
replace
35
36
35
36
0
p02422
C++
Runtime Error
#include <algorithm> #include <stdio.h> using namespace std; void print(char str[], int a, int b) { for (int i = a; i <= b; i++) printf("%c", str[i]); printf("\n"); } void replace(char str[], char p[], int a, int b) { int p_length = b - a + 1; for (int i = 0; i < p_length; i++) str[a + i] = p[i]; } ...
#include <algorithm> #include <stdio.h> using namespace std; void print(char str[], int a, int b) { for (int i = a; i <= b; i++) printf("%c", str[i]); printf("\n"); } void replace(char str[], char p[], int a, int b) { int p_length = b - a + 1; for (int i = 0; i < p_length; i++) str[a + i] = p[i]; } ...
replace
25
26
25
26
0
p02422
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; #define FOR(i, a, b) for (int i = int(a); i < int(b); ++i) #define RFOR(i, a, b) for (int i = int(b) - 1; i >= int(a); --i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, 0, n) int q; int main() { int a, b; string str, q_...
#include <algorithm> #include <iostream> #include <string> using namespace std; #define FOR(i, a, b) for (int i = int(a); i < int(b); ++i) #define RFOR(i, a, b) for (int i = int(b) - 1; i >= int(a); --i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, 0, n) int q; int main() { int a, b; string str, q_...
replace
25
26
25
26
0
p02422
C++
Runtime Error
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main(void) { string str, ans[100], p, ex; int a, b, q, cou = 0; char c; cin >> str; cin >> q; for (int i = 0; i < q; i++) { cin >> ex; cin >> a >> b; if (ex == "print") { ans[cou] = str.substr(a, (b - a) + 1)...
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main(void) { string str, ans[100], p, ex; int a, b, q, cou = 0; char c; cin >> str; cin >> q; for (int i = 0; i < q; i++) { cin >> ex; cin >> a >> b; if (ex == "print") { ans[cou] = str.substr(a, (b - a) + 1)...
replace
26
27
26
27
0
p02422
C++
Runtime Error
// Lec09-D Transformation #include <algorithm> #include <iostream> #include <string> int main() { static const std::string pri = "print", rev = "reverse", rep = "replace"; std::string str, comm, p; std::cin >> str; int q, a, b; for (std::cin >> q; q; q--) { std::cin >> comm >> a >> b; if (pri == comm)...
// Lec09-D Transformation #include <algorithm> #include <iostream> #include <string> int main() { static const std::string pri = "print", rev = "reverse", rep = "replace"; std::string str, comm, p; std::cin >> str; int q, a, b; for (std::cin >> q; q; q--) { std::cin >> comm >> a >> b; if (pri == comm)...
replace
19
20
19
20
0
p02422
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string A; int x, y; while (cin >> A) { int n; cin >> n; string Action; for (int i = 0; i < n; i++) { cin >> Action; if (Action == "replace") { string replaces; cin >> ...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string A; int x, y; while (cin >> A) { int n; cin >> n; string Action; for (int i = 0; i < n; i++) { cin >> Action; if (Action == "replace") { string replaces; cin >> ...
replace
26
27
26
27
0
p02422
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; int main(void) { string str, moji, m; int q = 0; cin >> str; cin >> q; for (int i = 0; i < q; i++) { int a = 0, b = 0; cin >> moji >> a >> b; if (moji == "print") { str = str.substr(a, b - a + 1); cout << s...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main(void) { string str, moji, m; int q = 0; cin >> str; cin >> q; for (int i = 0; i < q; i++) { int a = 0, b = 0; cin >> moji >> a >> b; if (moji == "print") { cout << str.substr(a, b - a + 1) << endl; }...
replace
13
15
13
14
0
p02422
C++
Runtime Error
/** * ??????????????? ????????? str ?????????????????????????????????????????????????????????????????°???????????????????????????????????????????????\?????????????????????????????§?????? print a b: str ??? a ??????????????? b ??????????????§?????????????????? reverse a b: str ??? a ??????????????? b ??????????????§?...
/** * ??????????????? ????????? str ?????????????????????????????????????????????????????????????????°???????????????????????????????????????????????\?????????????????????????????§?????? print a b: str ??? a ??????????????? b ??????????????§?????????????????? reverse a b: str ??? a ??????????????? b ??????????????§?...
replace
74
76
74
77
0
p02422
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { string s; cin >> s; int q; cin >> q; rep(i, q) { string t; cin >> t; if (t == "print") { int a, b; cin >> a >> b; cout << s.substr(a, b - a + 1) << endl; } if (t == "...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { string s; cin >> s; int q; cin >> q; rep(i, q) { string t; cin >> t; if (t == "print") { int a, b; cin >> a >> b; cout << s.substr(a, b - a + 1) << endl; } if (t == "...
replace
26
27
26
27
0
p02422
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) int main() { string str, W, p; long long int q, a, b; cin >> str >> q; REP(i, q) { cin >> W >> a >> b; ...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) int main() { string str, W, p; long long int q, a, b; cin >> str >> q; REP(i, q) { cin >> W >> a >> b; ...
replace
22
23
22
23
0
p02422
C++
Runtime Error
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { int n; string str, s1; string order; int a, b; cin >> str; cin >> n; for (int i = 0; i < n; i++) { cin >> order >> a >> b; if (order == "print") { for (int i = a; i <= b; i++) { cout << str[i]...
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { int n; string str, s1; string order; int a, b; cin >> str; cin >> n; for (int i = 0; i < n; i++) { cin >> order >> a >> b; if (order == "print") { for (int i = a; i <= b; i++) { cout << str[i]...
replace
25
26
25
26
0
p02422
C++
Runtime Error
#include <cctype> #include <iostream> #include <string> using namespace std; int main() { int q, num1, num2; string str, str2, str3; // str1=最初の文字列 str2=条件当てはめる cin >> str >> q; for (int i = 0; i < q; i++) { cin >> str2 >> num1 >> num2; if (str2 == "replace") { cin >> str3; str = str.replac...
#include <cctype> #include <iostream> #include <string> using namespace std; int main() { int q, num1, num2; string str, str2, str3; // str1=最初の文字列 str2=条件当てはめる cin >> str >> q; for (int i = 0; i < q; i++) { cin >> str2 >> num1 >> num2; if (str2 == "replace") { cin >> str3; str = str.replac...
replace
13
14
13
14
0
p02422
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { string s; int q; int a, b; cin >> s; cin >> q; string order, str; for (int i = 0; i < q; i++) { cin >> order; if (order == "replace") { cin >> a >> b >> str; s.replace(a, b, str); } else if (order == "reverse") { ...
#include <bits/stdc++.h> using namespace std; int main() { string s; int q; int a, b; cin >> s; cin >> q; string order, str; for (int i = 0; i < q; i++) { cin >> order; if (order == "replace") { cin >> a >> b >> str; s.replace(a, str.size(), str); } else if (order == "reverse...
replace
19
20
19
20
0
p02422
C++
Runtime Error
#include <cstdio> int main() { char str[1001]; char com[8]; int l = 0; int a, b; int q; char c; scanf("%s", &str); scanf("%d", &q); for (int i = 0; i < q; i++) { scanf("%s %d %d", &com, &a, &b); if (com[2] == 'i') { for (int i = a; i <= b; i++) { printf("%c", str[i]); } ...
#include <cstdio> int main() { char str[1001]; char com[8]; int l = 0; int a, b; int q; char c; scanf("%s", &str); scanf("%d", &q); for (int i = 0; i < q; i++) { scanf("%s %d %d", &com, &a, &b); if (com[2] == 'i') { for (int i = a; i <= b; i++) { printf("%c", str[i]); } ...
replace
28
29
28
29
0
p02422
C++
Runtime Error
#include <algorithm> #include <cstdlib> #include <iostream> #include <string> int main(void) { std::string str; int a; int b; int q; std::string start = ""; std::string sub = ""; std::string end = ""; std::string s = ""; std::cin >> str >> q; for (int i = 0; i < q; i++) { std::string order; ...
#include <algorithm> #include <cstdlib> #include <iostream> #include <string> int main(void) { std::string str; int a; int b; int q; std::string start = ""; std::string sub = ""; std::string end = ""; std::string s = ""; std::cin >> str >> q; for (int i = 0; i < q; i++) { std::string order; ...
replace
32
34
32
34
0
p02422
C++
Runtime Error
#include <iostream> void p(char *str, int a, int b) { for (int i = a; i <= b; i++) std::cout << str[i]; std::cout << std::endl; } void replace(char *str, int a, int b, char *replace_str) { for (int i = a; i <= b; i++) str[i] = replace_str[i - a]; } void reverse(char *str, int a, int b) { char temp; ...
#include <iostream> void p(char *str, int a, int b) { for (int i = a; i <= b; i++) std::cout << str[i]; std::cout << std::endl; } void replace(char *str, int a, int b, char *replace_str) { for (int i = a; i <= b; i++) str[i] = replace_str[i - a]; } void reverse(char *str, int a, int b) { char temp; ...
replace
23
24
23
24
0
p02422
C++
Runtime Error
/* * Transformation.cpp * * Created on: 2014/08/04 * Author: WanWan1985 */ #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 ...
/* * Transformation.cpp * * Created on: 2014/08/04 * Author: WanWan1985 */ #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 ...
replace
99
100
99
100
0
p02422
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { string str, com, p; int q, a, b; cin >> str >> q; for (int i = 0; i < q; i++) { cin >> com >> a >> b; if (com == "print") { cout << str.substr(a, b - a + 1) << endl; } else if (com == "reverse") { string tmp = str...
#include <iostream> #include <string> using namespace std; int main() { string str, com, p; int q, a, b; cin >> str >> q; for (int i = 0; i < q; i++) { cin >> com >> a >> b; if (com == "print") { cout << str.substr(a, b - a + 1) << endl; } else if (com == "reverse") { string tmp = str...
replace
17
18
17
18
-11
p02422
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { int a, b; string which, p; string str; int y; cin >> str; cin >> y; for (int i = 0; i < y; i++) { cin >> which >> a >> b; if (which == "print") { str = str.substr(a, b - a + 1); cout << str << endl; } else ...
#include <iostream> #include <string> using namespace std; int main() { int a, b; string which, p; string str; int y; cin >> str; cin >> y; for (int i = 0; i < y; i++) { cin >> which >> a >> b; if (which == "print") cout << str.substr(a, b - a + 1) << endl; else if (which == "replace...
replace
16
20
16
19
0
p02422
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string str; int n; cin >> str >> n; string com; for (int i = 0; i < n; i++) { cin >> com; if (com == "replace") { string str1; int a, b; cin >> a >> b; cin >> str1; str.replace(...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { string str; int n; cin >> str >> n; string com; for (int i = 0; i < n; i++) { cin >> com; if (com == "replace") { string str1; int a, b; cin >> a >> b; cin >> str1; str.replace(...
replace
18
19
18
20
0
p02422
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { string str; int i; int a, b; string order, str1; cin >> str >> i; for (int j = 0; j < i; j++) { cin >> order >> a >> b; if (order == "replace") { cin >> str1; str.replace(a, b, str1); } else if (order == "rever...
#include <iostream> #include <string> using namespace std; int main() { string str; int i; int a, b; string order, str1; cin >> str >> i; for (int j = 0; j < i; j++) { cin >> order >> a >> b; if (order == "replace") { cin >> str1; for (int k = 0; k < b - a + 1; k++) str[a + k] ...
replace
15
16
15
17
0
p02422
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string str; vector<string> strs; int n; cin >> str >> n; for (int i = 0; i < n; i++) { string op; int a, b; cin >> op >> a >> b; if (op == "replace") { string rep; cin >...
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { string str; vector<string> strs; int n; cin >> str >> n; for (int i = 0; i < n; i++) { string op; int a, b; cin >> op >> a >> b; if (op == "replace") { string tmp; cin >...
replace
17
20
17
22
0
p02422
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; int main() { string s, order, p; char ch; cin >> s; int n, i, a, b; cin >> n; for (i = 0; i < n; i++) { cin >> order; if (order == "replace") { cin >> a >> b >> p; s.replace(a, b, p); } if (order == "reverse") { cin >> a >> b; ...
#include "bits/stdc++.h" using namespace std; int main() { string s, order, p; char ch; cin >> s; int n, i, a, b; cin >> n; for (i = 0; i < n; i++) { cin >> order; if (order == "replace") { cin >> a >> b >> p; s.replace(a, b - a + 1, p); } if (order == "reverse") { cin >> a...
replace
12
13
12
13
0
p02422
C++
Runtime Error
#include <iostream> #include <string.h> #include <string> using namespace std; char str[1000 + 1] = {0}; void print(int a, int b) { for (; a <= b; a++) cout << str[a]; cout << endl; } void reverse(int a, int b) { char temp = '\0'; while (a < b) { temp = str[a]; str[a] = str[b]; str[b] = temp;...
#include <iostream> #include <string.h> #include <string> using namespace std; char str[1000 + 1] = {0}; void print(int a, int b) { for (; a <= b; a++) cout << str[a]; cout << endl; } void reverse(int a, int b) { char temp = '\0'; while (a < b) { temp = str[a]; str[a] = str[b]; str[b] = temp;...
replace
29
30
29
30
0
p02431
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define INF 1e9 template <class T> class treap { public: struct node { T val, sum, mini, maxi; node *left, *right; int pri; unsigned sz; node(T val, int pri) : val(val), sum(val), mini(val), maxi(val), pri(pri), sz(1) { left = right = NU...
#include <bits/stdc++.h> using namespace std; #define INF 1e9 template <class T> class treap { public: struct node { T val, sum, mini, maxi; node *left, *right; int pri; unsigned sz; node(T val, int pri) : val(val), sum(val), mini(val), maxi(val), pri(pri), sz(1) { left = right = NU...
insert
96
96
96
100
0
p02433
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { list<int> a; list<int>::iterator it = a.end(); int q, query, t, x; cin >> q; for (int i = 0; i < q; i++) { cin >> query; if (query == 0) { cin >> x; it = a.insert(it, x); } else if (query == 1) { cin >> x; if (x ...
#include <bits/stdc++.h> using namespace std; int main() { list<int> a; list<int>::iterator it = a.end(); int q, query, t, x; cin >> q; for (int i = 0; i < q; i++) { cin >> query; if (query == 0) { cin >> x; it = a.insert(it, x); } else if (query == 1) { cin >> x; if (x ...
replace
26
27
26
27
0
p02435
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, q; cin >> n >> q; vector<stack<int>> vs(n); for (int i = 0; i < q; i++) { int a; cin >> a; if (a == 0) { int t, x; cin >> t >> x; vs.at(t).push(x); } if (a == 1) { int t; cin >> t; cout << ...
#include <bits/stdc++.h> using namespace std; int main() { int n, q; cin >> n >> q; vector<stack<int>> vs(n); for (int i = 0; i < q; i++) { int a; cin >> a; if (a == 0) { int t, x; cin >> t >> x; vs.at(t).push(x); } if (a == 1) { int t; cin >> t; if (!vs....
replace
18
19
18
20
0
p02435
C++
Runtime Error
#include <iostream> #include <stack> using namespace std; int main() { int n, q; cin >> n >> q; stack<int> a[n]; for (int i = 0; i < q; i++) { int n, t; cin >> n >> t; if (!n) { int x; cin >> x; a[t].push(x); } else if (n == 1 && !a[t].empty()) cout << a[t].top() << end...
#include <iostream> #include <stack> using namespace std; int main() { int n, q; cin >> n >> q; stack<int> a[n]; for (int i = 0; i < q; i++) { int n, t; cin >> n >> t; if (!n) { int x; cin >> x; a[t].push(x); } else if (n == 1 && !a[t].empty()) cout << a[t].top() << end...
replace
18
19
18
19
0
p02435
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, q; cin >> n >> q; vector<stack<int>> s(n); while (q--) { int y; cin >> y; if (y == 0) { int t, x; cin >> t >> x; s[t].push(x); } else if (y == 1) { int t; cin >> t; if (!s[t].empty()) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n, q; cin >> n >> q; vector<stack<int>> s(n); while (q--) { int y; cin >> y; if (y == 0) { int t, x; cin >> t >> x; s[t].push(x); } else if (y == 1) { int t; cin >> t; if (!s[t].empty()) { ...
replace
23
24
23
26
0
p02435
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<stack<int>> st; void f0() { int p1, p2; cin >> p1 >> p2; st[p1].push(p2); } void f1() { int p; cin >> p; cout << st[p].top() << endl; } void f2() { int p; cin >> p; if (!st[p].empty()) st[p].pop(); } int main() { ios::sync_with_stdio(...
#include <bits/stdc++.h> using namespace std; vector<stack<int>> st; void f0() { int p1, p2; cin >> p1 >> p2; st[p1].push(p2); } void f1() { int p; cin >> p; if (!st[p].empty()) cout << st[p].top() << endl; } void f2() { int p; cin >> p; if (!st[p].empty()) st[p].pop(); } int main() {...
replace
17
18
17
19
0
p02435
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using lint = long long; template <typename T = lint> inline T in() { T x; cin >> x; return x; } #define INF 1e9 #define INFL static_cast<lint>(INF) #define REP(i, n) for (lint i = 0, i##_len = (n); i < i##_len; ++i) #define REP1(i, n) for (lint i = 1, i##_len = (n); i...
#include <bits/stdc++.h> using namespace std; using lint = long long; template <typename T = lint> inline T in() { T x; cin >> x; return x; } #define INF 1e9 #define INFL static_cast<lint>(INF) #define REP(i, n) for (lint i = 0, i##_len = (n); i < i##_len; ++i) #define REP1(i, n) for (lint i = 1, i##_len = (n); i...
replace
33
34
33
35
0
p02435
C++
Runtime Error
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n, q; cin >> n >> q; stack<int> s[n]; while (q--) { int a, b, c; cin >> a >> b; if (!a) { cin >> c; s[b].push(c); } else if (a == 1) { cout << s[b].top() << endl; } e...
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n, q; cin >> n >> q; stack<int> s[n]; while (q--) { int a, b, c; cin >> a >> b; if (!a) { cin >> c; s[b].push(c); } else if (a == 1) { if (!s[b].empty()) cout << ...
replace
15
16
15
17
0
p02435
Python
Runtime Error
from collections import deque if __name__ == "__main__": n, q = input().split() n, q = int(n), int(q) S = [deque([]) for i in range(n)] for i in range(q): query = input().split() if query[0] == "0": S[int(query[1])].append(query[2]) else: if len(S) == ...
from collections import deque if __name__ == "__main__": n, q = input().split() n, q = int(n), int(q) S = [deque([]) for i in range(n)] for i in range(q): query = input().split() if query[0] == "0": S[int(query[1])].append(query[2]) else: if len(S[int(...
replace
14
15
14
15
0
p02435
Python
Runtime Error
n, q = list(map(int, input().split(" "))) stacks = [[] for i in range(n)] for i in range(q): op = list(map(int, input().split(" "))) if op[0] == 0: stacks[op[1]].append(op[2]) elif op[0] == 1: if len(stacks[op[1]]) != 0: print(stacks[op[1]][-1]) elif op[0] == 2: stac...
n, q = list(map(int, input().split(" "))) stacks = [[] for i in range(n)] for i in range(q): op = list(map(int, input().split(" "))) if op[0] == 0: stacks[op[1]].append(op[2]) elif op[0] == 1: if len(stacks[op[1]]) != 0: print(stacks[op[1]][-1]) elif op[0] == 2: if l...
replace
11
12
11
13
0
p02435
C++
Runtime Error
#include <algorithm> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; int main() { int n, q; cin >> n >> q; vector<stack<int>> s(n); for (int i = 0; i < q; i++) { int a, t, x; cin >> a; if (a == 0) { cin >> t >> x; s[t].push(x); } ...
#include <algorithm> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; int main() { int n, q; cin >> n >> q; vector<stack<int>> s(n); for (int i = 0; i < q; i++) { int a, t, x; cin >> a; if (a == 0) { cin >> t >> x; s[t].push(x); } ...
replace
33
34
33
36
0
p02437
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #define long long long #define LF '\n' using namespace std; typedef pair<int, int> pii; template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a ? a = b, 1 : 0; } template <class A, class B> inline boo...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #define long long long #define LF '\n' using namespace std; typedef pair<int, int> pii; template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a ? a = b, 1 : 0; } template <class A, class B> inline boo...
replace
34
35
34
36
0
p02440
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <set> using namespace std; int main() { int n, q; set<int> a; cin >> n; for (int i = 0, t; i < n && cin >> t; i++) a.insert(t); cin >> q; for (int i = 0, k; i < q; i++) { cin >> k; cout << binary_search(a.begin(), a.end(), k) << endl; } ret...
#include <algorithm> #include <iostream> #include <set> using namespace std; int main() { int n, q; set<int> a; cin >> n; for (int i = 0, t; i < n && cin >> t; i++) a.insert(t); cin >> q; for (int i = 0, k; i < q; i++) { cin >> k; cout << (a.find(k) != a.end()) << endl; } return 0; }
replace
14
15
14
15
TLE
p02441
C++
Runtime Error
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, q; cin >> n; vector<int> a; for (int i = 0; i < n; i++) cin >> a[i]; cin >> q; for (int i = 0, k; i < q; i++) { cin >> k; cout << distance(a.begin(), lower_bound(a.begin(), a.end(), k)) << endl; ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, q; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; cin >> q; for (int i = 0, k; i < q; i++) { cin >> k; cout << distance(a.begin(), lower_bound(a.begin(), a.end(), k)) << endl...
replace
7
8
7
8
-11
p02449
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int n; vector<vector<int>> v; vector<int> a, c; int kaijo(int x) { int ans = 1; for (int i = 1; i <= x; i++) ans *= i; return ans; } int main() { cin >> n; a.resize(n); c.resize(n); rep(i, n) cin >> a[i]; rep...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int n; vector<vector<int>> v; vector<int> a, c; int kaijo(int x) { int ans = 1; for (int i = 1; i <= x; i++) ans *= i; return ans; } int main() { cin >> n; a.resize(n); c.resize(n); rep(i, n) cin >> a[i]; if ...
insert
17
17
17
21
0
p02452
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; static const int MAX_N = 100000; int n, a[MAX_N], m, b[MAX_N]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; cin >> m; for (int i = 0; i < m; i++) cin >> b[i]; bool flag = true; for (int i = 0; i < m; i++) { if ((u...
#include <algorithm> #include <iostream> using namespace std; static const int MAX_N = 200000; int n, a[MAX_N], m, b[MAX_N]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; cin >> m; for (int i = 0; i < m; i++) cin >> b[i]; bool flag = true; for (int i = 0; i < m; i++) { if ((u...
replace
3
4
3
4
0
p02452
C++
Runtime Error
#include <iostream> using namespace std; long long a[200000]; int main() { int n, m, j = 0; bool f = 1; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; cin >> m; for (int i = 0; i < m; i++) { long long b; cin >> b; while (b > a[j]) j++; if (b < a[j]) { f = 0; ...
#include <iostream> using namespace std; long long a[200000]; int main() { int n, m, j = 0; bool f = 1; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; a[n] = 1000000001; cin >> m; for (int i = 0; i < m; i++) { long long b; cin >> b; while (b > a[j]) j++; if (b < a[j])...
insert
13
13
13
14
0
p02456
C++
Runtime Error
#include <algorithm> #include <cassert> #include <chrono> #include <cmath> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <thread> #include <unorde...
#include <algorithm> #include <cassert> #include <chrono> #include <cmath> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <thread> #include <unorde...
insert
261
261
261
264
0
p02456
C++
Runtime Error
#include <algorithm> #include <cassert> #include <chrono> #include <cmath> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <thread> #include <unorde...
#include <algorithm> #include <cassert> #include <chrono> #include <cmath> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <thread> #include <unorde...
insert
339
339
339
340
0
p02456
Python
Runtime Error
numset = set([]) q = int(input()) for i in range(q): query, x = list(map(int, input().split(" "))) if query == 0: numset.add(x) print(len(numset)) elif query == 1: if set([x]).issubset(numset): print(1) else: print(0) else: numset.remove(x)...
numset = set([]) q = int(input()) for i in range(q): query, x = list(map(int, input().split(" "))) if query == 0: numset.add(x) print(len(numset)) elif query == 1: if set([x]).issubset(numset): print(1) else: print(0) else: if set([x]).issu...
replace
13
14
13
15
0
p02457
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; set<int> st; for (int i = 0; i < q; i++) { int cmd; cin >> cmd; if (cmd == 0) { int x; cin >> x; st.insert(x); cout << st.size() << endl; } if (cmd == 1) { int x; cin >> x; ...
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; set<int> st; for (int i = 0; i < q; i++) { int cmd; cin >> cmd; if (cmd == 0) { int x; cin >> x; st.insert(x); cout << st.size() << endl; } if (cmd == 1) { int x; cin >> x; ...
replace
29
34
29
32
TLE
p02457
C++
Time Limit Exceeded
#include <iterator> #include <set> #include <stdio.h> using namespace std; int main() { int n, temp, k; set<int> s; set<int>::iterator u; scanf("%d", &n); while (n--) { scanf("%d%d", &k, &temp); if (k == 0) { s.insert(temp); printf("%ld\n", s.size()); } else if (k == 1) { if (s.f...
#include <iterator> #include <set> #include <stdio.h> using namespace std; int main() { int n, temp, k; set<int> s; set<int>::iterator u; scanf("%d", &n); while (n--) { scanf("%d%d", &k, &temp); if (k == 0) { s.insert(temp); printf("%ld\n", s.size()); } else if (k == 1) { if (s.f...
insert
28
28
28
29
TLE
p02457
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main(void) { set<int> S; int q, com, x, y; cin >> q; while (q--) { cin >> com; switch (com) { case 0: cin >> x; S.insert(x); cout << S.size() << endl; break; case 1: cin >> x; if (S.find(x) != S.end()) { ...
#include <bits/stdc++.h> using namespace std; int main(void) { set<int> S; int q, com, x, y; cin >> q; while (q--) { cin >> com; switch (com) { case 0: cin >> x; S.insert(x); cout << S.size() << endl; break; case 1: cin >> x; if (S.find(x) != S.end()) { ...
replace
29
33
29
34
TLE
p02457
C++
Time Limit Exceeded
#include <cassert> #include <ccomplex> #include <cctype> #include <cerrno> #include <cfenv> #include <cfloat> #include <cinttypes> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstdbool> #include <cstddef> #include <cstdint>...
#include <cassert> #include <ccomplex> #include <cctype> #include <cerrno> #include <cfenv> #include <cfloat> #include <cinttypes> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstdbool> #include <cstddef> #include <cstdint>...
replace
112
113
112
113
TLE
p02457
C++
Time Limit Exceeded
#include <algorithm> #include <iostream> #include <set> using namespace std; int main() { int q, com, x, l, r; set<int> S; cin >> q; for (int i = 0; i < q; i++) { cin >> com; if (com == 0) { cin >> x; S.insert(x); cout << S.size() << endl; } else if (com == 1) { cin >> x;...
#include <algorithm> #include <iostream> #include <set> using namespace std; int main() { int q, com, x, l, r; set<int> S; cin >> q; for (int i = 0; i < q; i++) { cin >> com; if (com == 0) { cin >> x; S.insert(x); cout << S.size() << endl; } else if (com == 1) { cin >> x;...
replace
28
30
28
30
TLE
p02457
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) set<int> st; int main() { int q; cin >> q; while (q--) { int Q, k; cin >> Q >> k; if (Q == 0) { st.insert(k); cout << st.size() << endl; } else if (Q == 1) { cout << st.count(k) << endl; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) set<int> st; int main() { int q; cin >> q; while (q--) { int Q, k; cin >> Q >> k; if (Q == 0) { st.insert(k); cout << st.size() << endl; } else if (Q == 1) { cout << st.count(k) << endl; ...
replace
20
24
20
25
TLE
p02460
Python
Runtime Error
dict = {} q = int(input()) for i in range(q): query, *val = input().split(" ") if query == "0": dict[val[0]] = int(val[1]) elif query == "1": print(dict.get(val[0], 0)) else: dict.pop(val[0])
dict = {} q = int(input()) for i in range(q): query, *val = input().split(" ") if query == "0": dict[val[0]] = int(val[1]) elif query == "1": print(dict.get(val[0], 0)) else: if val[0] in dict: dict.pop(val[0])
replace
9
10
9
11
0
p02462
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) multimap<string, int> mp; int main() { int q; cin >> q; while (q--) { int Q; cin >> Q; string s, l, r; int x; if (Q == 0) { cin >> s >> x; mp.insert(make_pair(s, x)); } if (Q == 1) {...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) multimap<string, int> mp; int main() { int q; cin >> q; while (q--) { int Q; cin >> Q; string s, l, r; int x; if (Q == 0) { cin >> s >> x; mp.insert(make_pair(s, x)); } if (Q == 1) {...
replace
18
22
18
21
0
p02462
C++
Runtime Error
#include <bits/stdc++.h> #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define Rep(i, a, b) for (int i = a; i < b; i++) #define REP(i, a, b) for (int i = a; i <= b; i++) #define rev(i, n) for (int i = n - 1; i >= 0; i--) #define vi vector<int> #define pb push_back #define pi pair<int, int> #define...
#include <bits/stdc++.h> #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define Rep(i, a, b) for (int i = a; i < b; i++) #define REP(i, a, b) for (int i = a; i <= b; i++) #define rev(i, n) for (int i = n - 1; i >= 0; i--) #define vi vector<int> #define pb push_back #define pi pair<int, int> #define...
replace
27
28
27
28
0
p02467
C++
Time Limit Exceeded
#include <cmath> #include <iostream> #include <vector> using namespace std; bool isPrime(int x) { for (int i = 2; i <= sqrt(x); i++) if (x % i == 0) return false; return true; } int main() { int n; cin >> n; vector<int> res; int temp = n; for (int i = 2; i <= n; i++) { if (isPrime(i)) ...
#include <cmath> #include <iostream> #include <vector> using namespace std; bool isPrime(int x) { for (int i = 2; i <= sqrt(x); i++) if (x % i == 0) return false; return true; } int main() { int n; cin >> n; vector<int> res; int temp = n; if (isPrime(n)) res.push_back(n); else { for (i...
replace
15
23
15
27
TLE
p02467
C++
Memory Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long int N; cin >> N; cout << N << ":"; if (N <= 1) { cout << " " << N << endl; return 0; } vector<bool> x(N, true); long long int M = sqrtl(N) + 1; for (size_t i = 2; i <= M; i++) { while (N % i == 0) { cout << " " << i;...
#include <bits/stdc++.h> using namespace std; int main() { long long int N; cin >> N; cout << N << ":"; if (N <= 1) { cout << " " << N << endl; return 0; } long long int M = sqrtl(N) + 1; for (size_t i = 2; i <= M; i++) { while (N % i == 0) { cout << " " << i; N /= i; } } ...
delete
11
12
11
11
MLE
p02467
C++
Time Limit Exceeded
#include <cmath> #include <iostream> using namespace std; int main() { int n; cin >> n; int nn = n; cout << n << ":"; bool cnt = true; while (1) { if (n % 2 == 0) { cout << " " << 2; n /= 2; cnt = false; } else break; } while (1) { if (n % 3 == 0) { cout << " ...
#include <cmath> #include <iostream> using namespace std; int main() { int n; cin >> n; int nn = n; cout << n << ":"; bool cnt = true; while (1) { if (n % 2 == 0) { cout << " " << 2; n /= 2; cnt = false; } else break; } while (1) { if (n % 3 == 0) { cout << " ...
insert
47
47
47
49
TLE
p02467
C++
Time Limit Exceeded
#include <cmath> #include <iostream> #define MAX_N 100001 using namespace std; bool isPrime(int n) { if (n == 0 || n == 1) return false; if (n == 2 || n == 3) return true; if (n % 2 == 0) return false; for (int i = 5; i <= sqrt(n); i += 2) { if (n % i == 0) return false; } return true...
#include <cmath> #include <iostream> #define MAX_N 100001 using namespace std; bool isPrime(int n) { if (n == 0 || n == 1) return false; if (n == 2 || n == 3) return true; if (n % 2 == 0) return false; for (int i = 5; i <= sqrt(n); i += 2) { if (n % i == 0) return false; } return true...
insert
24
24
24
28
TLE
p02467
C++
Runtime Error
#include <cmath> #include <iostream> #include <vector> #define int long long using namespace std; signed main() { int n, m; vector<int> v; cin >> n; m = n; for (int i = 2; i <= sqrt(n); i++) { while (m % i == 0) { v.push_back(i); m /= i; } } if (m >= v.back()) v.push_back(m); cou...
#include <cmath> #include <iostream> #include <vector> #define int long long using namespace std; signed main() { int n, m; vector<int> v; cin >> n; m = n; for (int i = 2; i <= sqrt(n); i++) { while (m % i == 0) { v.push_back(i); m /= i; } } if (m != 1) v.push_back(m); cout << n ...
replace
16
17
16
17
0
p02467
C++
Time Limit Exceeded
#include <iostream> #include <vector> using namespace std; int main() { int a; cin >> a; cout << a << ":"; vector<int> r; int j = 2; while (true) { if (a == 1) { break; } if (a % j == 0) { r.push_back(j); a /= j; } else { j += 1; } } for (int i : r) { ...
#include <iostream> #include <vector> using namespace std; int main() { int a; cin >> a; cout << a << ":"; vector<int> r; int j = 2; while (true) { if (a == 1) { break; } if (a % j == 0) { r.push_back(j); a /= j; } else { j += 1; } if (j * j > a) { r...
insert
23
23
23
27
TLE
p02467
C++
Runtime Error
#include <cmath> #include <iostream> #include <vector> using namespace std; void solve() { int n; cin >> n; vector<int> factorize; cout << n << ": "; int input = n; for (int i = 2; i <= sqrt((double)input); ++i) { while (n % i == 0) { n /= i; factorize.push_back(i); } } for (int i ...
#include <cmath> #include <iostream> #include <vector> using namespace std; void solve() { int n; cin >> n; vector<int> factorize; cout << n << ": "; int input = n; for (int i = 2; i <= sqrt((double)input); ++i) { while (n % i == 0) { n /= i; factorize.push_back(i); } } if (n != 1)...
insert
18
18
18
21
0
p02467
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <set> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define CIN(in) ...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <set> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define CIN(in) ...
insert
25
25
25
29
TLE
p02467
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cmath> #include <functional> #include <iostream> #include <list> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <utility> #include <vector> #define FOR(i, a, b) for (long long int i = (a); i <= (b); i++) #define RFOR(...
#include <algorithm> #include <bitset> #include <cmath> #include <functional> #include <iostream> #include <list> #include <queue> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <utility> #include <vector> #define FOR(i, a, b) for (long long int i = (a); i <= (b); i++) #define RFOR(...
insert
33
33
33
38
TLE
p02467
C++
Time Limit Exceeded
#include <cmath> #include <iostream> using namespace std; bool isprime(int n) { if (n == 1) return false; if (n == 2) return true; for (int i = 2; i <= sqrt(n) + 1; i++) { if (n % i == 0) return false; } return true; } int main(void) { int h; cin >> h; // int n=h; cout << h << ":";...
#include <cmath> #include <iostream> using namespace std; bool isprime(int n) { if (n == 1) return false; if (n == 2) return true; for (int i = 2; i <= sqrt(n) + 1; i++) { if (n % i == 0) return false; } return true; } int main(void) { int h; cin >> h; // int n=h; cout << h << ":";...
replace
22
23
22
23
TLE
p02467
C++
Time Limit Exceeded
#include <iostream> using namespace std; bool flag[1000010]; int main() { int n, p; cin >> n; p = n; cout << n << ":"; while (1) { if (n == 1) { cout << endl; break; } for (int i = 2; 1000010; i++) { if (n % i == 0) { cout << " " << i; n /= i; break; ...
#include <iostream> using namespace std; bool flag[1000010]; int main() { int n, p; cin >> n; p = n; cout << n << ":"; while (1) { if (n == 1) { cout << endl; break; } for (int i = 2; i < 1000010; i++) { if (n % i == 0) { cout << " " << i; n /= i; break;...
replace
15
16
15
16
TLE