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 |
|---|---|---|---|---|
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
int taro = 0, hanako = 0;
for (int i = 0; i < n; i++) {
string animal1, animal2;
cin >> animal1 >> animal2;
if (animal1 > animal2)
taro += 3;
if (animal1 < animal2)
hanako += 3;
else {
... | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
int taro = 0, hanako = 0;
for (int i = 0; i < n; i++) {
string animal1, animal2;
cin >> animal1 >> animal2;
if (animal1 > animal2)
taro += 3;
else if (animal1 < animal2)
hanako += 3;
els... | [["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]] | 1 | 98 |
#include <iostream>
#include <string.h>
#include <string>
#define MAX 100
using namespace std;
int main() {
int n;
int t = 0, h = 0, comp = 0;
string tarou, hanako;
cin >> n;
for (; n > 0; n--) {
cin >> tarou >> hanako;
strcmp(tarou.c_str(), hanako.c_str());
if (comp > 0) {
t += 3;
... | #include <iostream>
#include <string.h>
#include <string>
#define MAX 100
using namespace std;
int main() {
int n;
int t = 0, h = 0, comp = 0;
string tarou, hanako;
cin >> n;
for (; n > 0; n--) {
cin >> tarou >> hanako;
comp = strcmp(tarou.c_str(), hanako.c_str());
if (comp > 0) {
t += ... | [["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32]] | 1 | 126 |
#include <iostream>
using namespace std;
int main() {
int n, p1 = 0, p2 = 0, duel;
string c1, c2;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> c1 >> c2;
duel = c1.compare(c2);
if (duel > 0) {
p1 += 3;
} else if (duel > 0) {
p2 += 3;
} else {
p1++;
p2++;
}
}... | #include <iostream>
using namespace std;
int main() {
int n, p1 = 0, p2 = 0, duel;
string c1, c2;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> c1 >> c2;
duel = c1.compare(c2);
if (duel > 0) {
p1 += 3;
} else if (duel < 0) {
p2 += 3;
} else {
p1++;
p2++;
}
}... | [["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 114 |
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
void game(int num) {
int i, taro = 0, hanako = 0;
string tcard, hcard;
for (i = 0; i < num; i++) {
cin >> tcard >> hcard;
if (tcard > hcard)
taro += 3;
if (tcard < hcard)
hanako += 3... | #include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
void game(int num) {
int i, taro = 0, hanako = 0;
string tcard, hcard;
for (i = 0; i < num; i++) {
cin >> tcard >> hcard;
if (tcard > hcard)
taro += 3;
else if (tcard < hcard)
hanako... | [["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]] | 1 | 131 |
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
string str1, str2;
int a = 0, b = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> str1 >> str2;
if (str1 == str2) {
a++;
b++;
} else if (str1 > str2)
a += 3;
else
b += 3;
}
cout << a... | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
string str1, str2;
int a = 0, b = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> str1 >> str2;
if (str1 == str2) {
a++;
b++;
} else if (str1 > str2)
a += 3;
else
b += 3;
}
cout << a... | [["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]] | 1 | 98 |
#include <iostream>
#include <string>
using namespace std;
int main() {
string t, h;
int n, tl, hl, tp, hp;
tp = 0;
hp = 0;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> t >> h;
tl = t.size();
hl = h.size();
for (int j = 0; j < tl || i < hl; j++) {
if (t[j] > h[j]) {
tp += 3... | #include <iostream>
#include <string>
using namespace std;
int main() {
string t, h;
int n, tl, hl, tp, hp;
tp = 0;
hp = 0;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> t >> h;
tl = t.size();
hl = h.size();
for (int j = 0; j < tl && j < hl; j++) {
if (t[j] > h[j]) {
tp += 3... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 106], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 98], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22]] | 1 | 210 |
#include <iostream>
#include <string>
using namespace std;
int main() {
int i, n, one, two;
string p1, p2;
cin >> n;
one = 0;
two = 0;
for (i = 0; i < n; i++) {
cin >> p1 >> p2;
if (p1 == p2) {
one += 1;
two += 1;
} else if (p1 > p2) {
one += 3;
} else if (p1 < p2) {
... | #include <iostream>
#include <string>
using namespace std;
int main() {
int i, n, one, two;
string p1, p2;
cin >> n;
one = 0;
two = 0;
for (i = 0; i < n; i++) {
cin >> p1 >> p2;
if (p1 == p2) {
one += 1;
two += 1;
} else if (p1 > p2) {
one += 3;
} else if (p1 < p2) {
... | [["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]] | 1 | 114 |
#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... | [["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]] | 1 | 210 |
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main() {
int i, n, j;
int taro_p = 0, hanako_p = 0;
string taro, hanako;
cin >> n;
for (i = 0; i < n; i++) {
cin >> taro >> hanako;
if ((taro < hanako) == 1) {
taro_p = taro_p + 3;
}
if ((taro > hanak... | #include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main() {
int i, n, j;
int taro_p = 0, hanako_p = 0;
string taro, hanako;
cin >> n;
for (i = 0; i < n; i++) {
cin >> taro >> hanako;
if ((taro > hanako) == 1) {
taro_p = taro_p + 3;
}
if ((taro < hanak... | [["-", 15, 339, 51, 16, 31, 23, 0, 16, 17, 18], ["+", 15, 339, 51, 16, 31, 23, 0, 16, 17, 47], ["-", 15, 339, 51, 16, 31, 23, 0, 16, 17, 47], ["+", 15, 339, 51, 16, 31, 23, 0, 16, 17, 18]] | 1 | 131 |
#include <iostream>
#include <string>
using namespace std;
int main() {
string c_hanako, c_taro;
int n, p_hanako = 0, p_taro = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> c_hanako >> c_taro;
//??????????????°????????????
//??¢??????????????????????????????????????°?????§??????
//????... | #include <iostream>
#include <string>
using namespace std;
int main() {
string c_hanako, c_taro;
int n, p_hanako = 0, p_taro = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> c_hanako >> c_taro;
//??????????????°????????????
//??¢??????????????????????????????????????°?????§??????
//????... | [["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 109 |
#include <algorithm>
#include <cctype>
#include <iostream>
#include <string>
using namespace std;
int main() {
string a, b;
char T[27] = "abcdefghijklmnopqrstuvwxyz";
int c, d = 0, e = 0, f, g;
cin >> c;
for (int i = 0; i < c; i++) {
cin >> a >> b;
for (int j = 0; j < min(a.size(), b.size()); j++) {
... | #include <algorithm>
#include <cctype>
#include <iostream>
#include <string>
using namespace std;
int main() {
string a, b;
char T[27] = "abcdefghijklmnopqrstuvwxyz";
int c, d = 0, e = 0, f, g;
cin >> c;
for (int i = 0; i < c; i++) {
cin >> a >> b;
for (int j = 0; j < min(a.size(), b.size()); j++) {
... | [["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 256 |
#include <iostream>
#include <string>
using namespace std;
int main() {
long n;
cin >> n;
long tPoint = 0, hPoint = 0;
for (long i = 0; i < n; i++) {
string tarou, hanako;
cin >> tarou >> hanako;
if (tarou < hanako)
hPoint += 3;
else if (tarou == hanako) {
tPoint++;
hPoint++;
... | #include <iostream>
#include <string>
using namespace std;
int main() {
long n;
cin >> n;
long tPoint = 0, hPoint = 0;
for (long i = 0; i < n; i++) {
string tarou, hanako;
cin >> tarou >> hanako;
if (tarou < hanako)
hPoint += 3;
else if (tarou == hanako) {
tPoint++;
hPoint++;
... | [["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]] | 1 | 95 |
#include <iostream>
#include <string>
int main(int argc, char const *argv[]) {
int n = 0;
std::cin >> n;
int score[2] = {0, 0};
std::string taro;
std::string hanako;
for (int i = 0; i < n; i++) {
std::cin >> taro;
std::cin >> hanako;
if (taro.compare(hanako) < 0) {
score[0] += 3;
} el... | #include <iostream>
#include <string>
int main(int argc, char const *argv[]) {
int n = 0;
std::cin >> n;
int score[2] = {0, 0};
std::string taro;
std::string hanako;
for (int i = 0; i < n; i++) {
std::cin >> taro;
std::cin >> hanako;
if (taro.compare(hanako) < 0) {
score[0] += 3;
} el... | [["-", 31, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["+", 31, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13]] | 1 | 163 |
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
int t = 0, h = 0;
for (int i = 0; i < n; i++) {
string a, b;
cin >> a >> b;
if (a == b) {
t++;
h++;
} else if (a < b) {
t += 3;
} else if (a > b) {
h += 3;
}
}
cout << t <... | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
int t = 0, h = 0;
for (int i = 0; i < n; i++) {
string a, b;
cin >> a >> b;
if (a == b) {
t++;
h++;
} else if (a > b) {
t += 3;
} else if (a < b) {
h += 3;
}
}
cout << t <... | [["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 112 |
#include <cstdio>
#include <iostream>
#include <string>
static const int drawPoint = 1;
static const int winPoint = 3;
enum Result {
WINNER_A,
DRAW,
WINNER_B,
};
Result game(const std::string a, const std::string b);
int main(void) {
int n;
std::cin >> n;
int point_a = 0;
int point_b = 0;
std::strin... | #include <cstdio>
#include <iostream>
#include <string>
static const int drawPoint = 1;
static const int winPoint = 3;
enum Result {
WINNER_A,
DRAW,
WINNER_B,
};
Result game(const std::string a, const std::string b);
int main(void) {
int n;
std::cin >> n;
int point_a = 0;
int point_b = 0;
std::strin... | [["-", 0, 1, 0, 11, 12, 2, 63, 118, 28, 22], ["+", 0, 1, 0, 11, 12, 2, 63, 118, 28, 22]] | 1 | 327 |
#include <cctype>
#include <iostream>
#include <string>
using namespace std;
int main() {
int h = 0, t = 0, n;
string hs, ts;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> hs >> ts;
if (ts == hs) {
h++;
t++;
} else if (ts > hs)
t = t + 3;
else
h = h + 3;
}
cout << h... | #include <cctype>
#include <iostream>
#include <string>
using namespace std;
int main() {
int h = 0, t = 0, n;
string hs, ts;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> hs >> ts;
if (ts == hs) {
h++;
t++;
} else if (ts > hs)
t = t + 3;
else
h = h + 3;
}
cout << h... | [["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]] | 1 | 103 |
#include <iostream>
#include <list>
#include <string>
using namespace std;
#define C
#ifdef C
int main(void) {
int f = 0, b = 0;
string T, H;
int rund;
cin >> rund;
for (size_t i = 0; i < rund; i++) {
cin >> T >> H;
if (T == H) {
f++;
b++;
} else
for (size_t i = 0; i <= T.size... | #include <iostream>
#include <list>
#include <string>
using namespace std;
#define C
#ifdef C
int main(void) {
int f = 0, b = 0;
string T, H;
int rund;
cin >> rund;
for (size_t i = 0; i < rund; i++) {
cin >> T >> H;
if (T == H) {
f++;
b++;
} else
for (size_t i = 0; i <= T.size... | [["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22]] | 1 | 160 |
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
int a = 0;
int b = 0;
string T, H;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> T >> H;
if (T > H)
a += 3;
else if (T < H)
b += 3;
else if (T == H)
a++;
b++;
}
cout << a << " " << b ... | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
int a = 0;
int b = 0;
string T, H;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> T >> H;
if (T > H)
a += 3;
else if (T < H)
b += 3;
else if (T == H) {
a++;
b++;
}
}
cout << a <<... | [["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 46]] | 1 | 104 |
#include <iostream>
#include <string>
using namespace std;
void toLowerCase(string &str) {
for (int i = 0; i < str.length(); ++i) {
str[i] = (char)tolower(str[i]);
}
}
// if Taro wins, return -1
// if Hanako wins, return 1
// if draw, return 0
int compareCard(string tCard, string hCard) {
if (tCard == hCard... | #include <iostream>
#include <string>
using namespace std;
void toLowerCase(string &str) {
for (int i = 0; i < str.length(); ++i) {
str[i] = (char)tolower(str[i]);
}
}
// if Taro wins, return -1
// if Hanako wins, return 1
// if draw, return 0
int compareCard(string tCard, string hCard) {
if (tCard == hCard... | [["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]] | 1 | 281 |
// Lec09-C Card Game
#include <iostream>
#include <string>
int main() {
std::string p1, p2;
int n, scr1 = 0, scr2 = 0;
for (std::cin >> n; n; n--) {
std::cin >> p1 >> p2;
if (p1 == p2) {
scr1++, scr2++;
continue;
}
p1.compare(0, p1.length(), p2, 0, p2.length()) < 0 ? scr1 += 3 : scr2 +... | // Lec09-C Card Game
#include <iostream>
#include <string>
int main() {
std::string p1, p2;
int n, scr1 = 0, scr2 = 0;
for (std::cin >> n; n; n--) {
std::cin >> p1 >> p2;
if (p1 == p2) {
scr1++, scr2++;
continue;
}
p1.compare(0, p1.length(), p2, 0, p2.length()) > 0 ? scr1 += 3 : scr2 +... | [["-", 8, 9, 0, 1, 0, 41, 15, 16, 17, 18], ["+", 8, 9, 0, 1, 0, 41, 15, 16, 17, 47]] | 1 | 120 |
#include <stdio.h>
#include <string.h>
int main() {
int n, x, i, k, Tscore = 0, Hscore = 0;
char T[150], H[150];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s %s", T, H);
x = strcmp(T, H);
if (x < 0)
Hscore += 3;
else if (x > 0)
Tscore += 3;
else
Hscore++, Tscore++;
... | #include <stdio.h>
#include <string.h>
int main() {
int n, x, i, k, Tscore = 0, Hscore = 0;
char T[150], H[150];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s %s", T, H);
x = strcmp(T, H);
if (x < 0)
Hscore += 3;
else if (x > 0)
Tscore += 3;
else
Hscore++, Tscore++;
... | [["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]] | 1 | 126 |
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
struct GamePoints {
int points;
};
int main() {
GamePoints Taro, Hanako;
int n;
while (cin >> n) {
string card_1, card_2;
Taro.points = 0;
Hanako.points = 0;
for (int i = 0; i < n; i++) {
cin >> card_1 >> ... | #include <cmath>
#include <iostream>
#include <string>
using namespace std;
struct GamePoints {
int points;
};
int main() {
GamePoints Taro, Hanako;
int n;
while (cin >> n) {
string card_1, card_2;
Taro.points = 0;
Hanako.points = 0;
for (int i = 0; i < n; i++) {
cin >> card_1 >> ... | [["+", 0, 57, 64, 1, 0, 34, 12, 27, 17, 29]] | 1 | 135 |
#include <iostream>
#include <string>
int main(void) {
int n;
std::string taro, hanako;
int p_taro = 0, p_hanako = 0;
std::cin >> n;
while (n-- > 0) {
std::cin >> taro >> hanako;
if (taro > hanako)
p_taro += 3;
else if (taro < hanako)
p_hanako += 3;
else {
p_taro++;
p_... | #include <iostream>
#include <string>
int main(void) {
int n;
std::string taro, hanako;
int p_taro = 0, p_hanako = 0;
std::cin >> n;
while (n-- > 0) {
std::cin >> taro >> hanako;
if (taro > hanako)
p_taro += 3;
else if (taro < hanako)
p_hanako += 3;
else {
p_taro++;
p_... | [["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]] | 1 | 98 |
#include <bits/stdc++.h>
using namespace std;
int main(void) {
string s1, s2;
int n, p1, p2;
cin >> n;
p1 = 0;
p2 = 0;
for (int i = 0; i < n; i++) {
cin >> s1 >> s2;
if (s1.compare(s2) == 0) {
p1++;
p2++;
} else if (s1.compare(s2) == -1) {
p2 += 3;
} else {
p1 += 3;
... | #include <bits/stdc++.h>
using namespace std;
int main(void) {
string s1, s2;
int n, p1, p2;
cin >> n;
p1 = 0;
p2 = 0;
for (int i = 0; i < n; i++) {
cin >> s1 >> s2;
if (s1.compare(s2) == 0) {
p1++;
p2++;
} else if (s1.compare(s2) < 0) {
p2 += 3;
} else {
p1 += 3;
... | [["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 115 |
#include <cctype>
#include <iostream>
#include <string>
using namespace std;
string toUpper(string s) {
string t = s;
for (int i = 0; i < s.size(); i++) {
t[i] = toupper(s[i]);
}
return t;
}
int main() {
string str1, str2;
int n = 0, taro_s = 0, hana_s = 0;
cin >> n;
for (int i = 0; i < n; i++) {
... | #include <cctype>
#include <iostream>
#include <string>
using namespace std;
string toUpper(string s) {
string t = s;
for (int i = 0; i < s.size(); i++) {
t[i] = toupper(s[i]);
}
return t;
}
int main() {
string str1, str2;
int n = 0, taro_s = 0, hana_s = 0;
cin >> n;
for (int i = 0; i < n; i++) {
... | [["-", 75, 76, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 158 |
#!/usr/bin/env ruby
turn = gets.to_i
line = []
taro_points = 0;hanako_points = 0
turn.times do
line = gets.split
if line[0] == line[1] then
taro_points += 1
hanako_points += 1
elsif line[0] > line[1] then
hanako_points += 3
elsif line[0] < line[1] then
taro_points += 3
... | #!/usr/bin/env ruby
turn = gets.to_i
line = []
taro_points = 0;hanako_points = 0
turn.times do
line = gets.split
if line[0] == line[1] then
taro_points += 1
hanako_points += 1
elsif line[0] > line[1] then
taro_points += 3
elsif line[0] < line[1] then
hanako_points += 3
... | [["-", 0, 121, 75, 759, 64, 749, 0, 755, 31, 22], ["+", 0, 121, 75, 759, 64, 749, 0, 755, 31, 22], ["-", 75, 759, 75, 759, 64, 749, 0, 755, 31, 22], ["+", 75, 759, 75, 759, 64, 749, 0, 755, 31, 22]] | 4 | 83 |
h = [[0, 3], [1, 1], [3, 0]]
gets.to_i.times.map{ h[gets.chomp.split.reduce(:<=>)+1] }.reduce([0, 0]){|s, e| s.zip(e).map{|z|z.reduce(:+)}} * " " | h = [[0, 3], [1, 1], [3, 0]]
puts gets.to_i.times.map{ h[gets.chomp.split.reduce(:<=>)+1] }.reduce([0, 0]){|s, e| s.zip(e).map{|z|z.reduce(:+)}} * " " | [["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]] | 4 | 84 |
n = gets.chomp.to_i
taro,hanako = 0,0
n.times do
c1,c2 = gets.chomp.split(" ")
if c1 < c2
taro += 3
elsif c1 > c2
hanako += 3
else
taro,hanako = taro + 1,hanako +1
end
end
puts "#{taro} #{hanako}" | n = gets.chomp.to_i
taro,hanako = 0,0
n.times do
c1,c2 = gets.chomp.split(" ")
if c1 > c2
taro += 3
elsif c1 < c2
hanako += 3
else
taro,hanako = taro + 1,hanako +1
end
end
puts "#{taro} #{hanako}" | [["-", 196, 737, 8, 736, 0, 121, 15, 738, 17, 18], ["+", 196, 737, 8, 736, 0, 121, 15, 738, 17, 47], ["-", 8, 736, 0, 121, 75, 759, 15, 738, 17, 47], ["+", 8, 736, 0, 121, 75, 759, 15, 738, 17, 18]] | 4 | 70 |
n = gets.to_i
taro = 0
hanaco = 0
n.times.each do
t,h = gets.split
taro += 3 if t > h
hanako += 3 if h > t
taro += 1 if h == t
hanako += 1 if h == t
end
puts [taro,hanako].join(" ") | n = gets.to_i
taro = 0
hanako = 0
n.times.each do
t,h = gets.split
taro += 3 if t > h
hanako += 3 if h > t
taro += 1 if h == t
hanako += 1 if h == t
end
puts [taro,hanako].join(" ") | [["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22]] | 4 | 66 |
n = gets.to_i
taro, hana = 0, 0
n.times do
w1, w2 = gets.split(/ /)
if w1 > w2
taro += 3
elsif w1 < w2
hana += 3
else
taro += 1
hana += 1
end
end
print taro, " ", hana, "\n"
__END__
Sample Input
3
cat dog
fish fish
lion tiger
Sample Output
1 7 | n = gets.to_i
taro, hana = 0, 0
n.times do
w1, w2 = gets.chomp.split(/ /)
if w1 > w2
taro += 3
elsif w1 < w2
hana += 3
else
taro += 1
hana += 1
end
end
print taro, " ", hana, "\n"
__END__
Sample Input
3
cat dog
fish fish
lion tiger
Sample Output
1 7 | [["+", 8, 736, 0, 662, 12, 652, 486, 652, 735, 22], ["+", 196, 737, 8, 736, 0, 662, 12, 652, 17, 131]] | 4 | 65 |
i = gets.to_i
tt = hh = 0
i.times { |j|
t, h = gets,chomp.split
if t < h
hh += 3
elsif t > h
tt += 3
else
tt += 1
hh += 1
end
}
puts "#{tt} #{hh}" | i = gets.to_i
tt = hh = 0
i.times { |j|
t, h = gets.chomp.split
if t < h
hh += 3
elsif t > h
tt += 3
else
tt += 1
hh += 1
end
}
puts "#{tt} #{hh}" | [["-", 196, 196, 8, 734, 0, 662, 12, 762, 0, 21], ["+", 8, 734, 0, 662, 12, 652, 486, 652, 17, 131]] | 4 | 59 |
gets;p$<.read.split(/\n/).map(&:split).map{|t,h|t==h ?[1,1]:t<h ?[0,3]:[3,0]}.reduce([0,0]){|s,a|[s[0]+a[0],s[1]+a[1]]}.join(' ')
| gets;puts$<.read.split(/\n/).map(&:split).map{|t,h|t==h ?[1,1]:t<h ?[0,3]:[3,0]}.reduce([0,0]){|s,a|[s[0]+a[0],s[1]+a[1]]}.join(' ')
| [["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]] | 4 | 97 |
#coding: UTF-8
n = int(input())
point_t = 0
point_h = 0
for i in range(n):
cards = list(map(str, input().split()))
taro = cards[0]
hanako = cards[1]
if taro > hanako:
point_h += 3
elif taro < hanako:
point_t += 3
else:
point_t += 1
point_h += 1
print(point_t, p... | #coding: UTF-8
n = int(input())
point_t = 0
point_h = 0
for i in range(n):
cards = list(map(str, input().split()))
taro = cards[0]
hanako = cards[1]
if taro < hanako:
point_h += 3
elif taro > hanako:
point_t += 3
else:
point_t += 1
point_h += 1
print(point_t, p... | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 47]] | 5 | 82 |
point = [0,0]
for i in range(int(input())):
(t,h) = [x for x in input().split()]
if t == h:
point[0] += 1
point[1] += 1
else:
a = [t,h]
sorted(a)
if t == a[1]:
point[0] += 3
else:
point[1] += 3
print(point[0],point[1]) | point = [0,0]
for i in range(int(input())):
(t,h) = [x for x in input().split()]
if t == h:
point[0] += 1
point[1] += 1
else:
a = [t,h]
q = sorted(a)
if t == q[0]:
point[1] += 3
else:
point[0] += 3
print(point[0],point[1]) | [["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 206, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 612], ["-", 64, 196, 0, 1, 0, 677, 31, 206, ... | 5 | 103 |
taro = 0
hanako = 0
n = int(input())
for _ in range(n):
taro_card, hanako_card = input().split()
if taro_card > hanako_card:
taro += 3
if taro_card < hanako_card:
hanako += 3
else:
taro += 1
hanako += 1
print(taro, hanako) | taro = 0
hanako = 0
n = int(input())
for _ in range(n):
taro_card, hanako_card = input().split()
if taro_card > hanako_card:
taro += 3
elif taro_card < hanako_card:
hanako += 3
else:
taro += 1
hanako += 1
print(taro, hanako) | [["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683]] | 5 | 63 |
n = int(input())
taro = 0
hanako = 0
for ni in range(n):
t, h = int().split()
if t < h:
hanako += 3
elif t > h:
taro += 3
else:
hanako += 1
taro += 1
print(taro,hanako) | n = int(input())
taro = 0
hanako = 0
for ni in range(n):
t, h = input().split()
if t < h:
hanako += 3
elif t > h:
taro += 3
else:
hanako += 1
taro += 1
print(taro,hanako) | [["-", 0, 662, 12, 652, 63, 319, 500, 652, 63, 22], ["+", 0, 662, 12, 652, 63, 319, 500, 652, 63, 22]] | 5 | 63 |
round = int(input())
score = {"taro":0, "hanako":0}
counter = 0
while counter < round:
[taro,hanako] = raw_input.split()
if taro < hanako:
score["hanako"] += 3
elif taro > hanako:
score["taro"] += 3
else:
score["taro"] += 1
score["hanako"] += 1
counter += 1
print(sco... | round = int(input())
score = {"taro":0, "hanako":0}
counter = 0
while counter < round:
[taro,hanako] = input().split()
if taro < hanako:
score["hanako"] += 3
elif taro > hanako:
score["taro"] += 3
else:
score["taro"] += 1
score["hanako"] += 1
counter += 1
print(score... | [["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["+", 0, 662, 12, 652, 63, 319, 500, 652, 63, 22], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25]] | 5 | 105 |
n = int(input())
st, sh = 0, 0
for i in range(n):
t, h = map(str, input().split())
if t > h:
st += 3
elif t < h:
sh += 3
else:
st += 1
st += 1
print(st, sh) | n = int(input())
st, sh = 0, 0
for i in range(n):
t, h = map(str, input().split())
if t > h:
st += 3
elif t < h:
sh += 3
else:
st += 1
sh += 1
print(st, sh) | [["-", 75, 76, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 31, 22]] | 5 | 69 |
#!/usr/bin/env python
n = int(input())
tScore = 0
hScore = 0
for i in range(n):
T, H = input().split()
if T == H:
tScore += 1
hScore += 1
elif T > H:
hScore +=3
elif H > T:
tScore += 3
print("%d %d" % (tScore, hScore)) | #!/usr/bin/env python
n = int(input())
tScore = 0
hScore = 0
for i in range(n):
T, H = input().split()
if T == H:
tScore += 1
hScore += 1
elif T > H:
tScore += 3
elif H > T:
hScore +=3
print("%d %d" % (tScore, hScore)) | [["-", 75, 665, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 31, 22]] | 5 | 73 |
t,h=0,0
int(input())
for i in range(n):
a,b=input().split()
if a > b:
h+=3
elif a < b:
t+=3
else:
t+=1
h+=1
print(t, h) | t,h=0,0
n=int(input())
for i in range(n):
a,b=input().split()
if a > b:
t+=3
elif a < b:
h+=3
else:
t+=1
h+=1
print(t, h) | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["-", 75, 665, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 31, 22]] | 5 | 62 |
count = int(input())
Tpoint = 0
Hpoint = 0
for i in range(count):
Twrite,Hwrite = map(str,input().split())
if Twrite == Hwrite:
Tpoint = Tpoint + 1
Hpoint = Hpoint + 1
elif Twrite > Hwrite:
Tpoint = Tpoiny + 3
else:
Hpoint = Hpoint + 3
print('{0} {1}'.format(Tpoint,Hpoint... | count = int(input())
Tpoint = 0
Hpoint = 0
for i in range(count):
Twrite,Hwrite = map(str,input().split())
if Twrite == Hwrite:
Tpoint = Tpoint + 1
Hpoint = Hpoint + 1
elif Twrite > Hwrite:
Tpoint = Tpoint + 3
else:
Hpoint = Hpoint + 3
print('{0} {1}'.format(Tpoint,Hpoint... | [["-", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22]] | 5 | 83 |
t=0
h=0
n=eval(input())
for _ in range (n):
s = input().split()
if s[0] < s[1]:
t+=3
elif s[0] > s[1]:
h+=3
else:
t+=1
h+=1
print(str(t) + " " + str(h))
| t=0
h=0
n=eval(input())
for _ in range (n):
s = input().split()
if s[0] > s[1]:
t+=3
elif s[0] < s[1]:
h+=3
else:
t+=1
h+=1
print(str(t) + " " + str(h))
| [["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 47], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18]] | 5 | 83 |
#! python3
# card_game.py
n = int(input())
turns = [input() for i in range(n)]
taro, hanako = 0, 0
for turn in turns:
t, h = turn.split(' ')
min_len = len(t) if len(t) <= len(h) else len(h)
win_flag = 0 # -1: taro, 1: hanako, 0: draw
for i in range(min_len):
if ord(t[i]) < ord(h[i]):
... | #! python3
# card_game.py
n = int(input())
turns = [input() for i in range(n)]
taro, hanako = 0, 0
for turn in turns:
t, h = turn.split(' ')
min_len = len(t) if len(t) <= len(h) else len(h)
win_flag = 0 # -1: taro, 1: hanako, 0: draw
for i in range(min_len):
if ord(t[i]) < ord(h[i]):
... | [["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 0, 57, 75, 665, 64, 196, 0, 93, 0, 94]] | 5 | 187 |
taro = 0
hana = 0
n = int(input())
for _ in range(n):
taro_s, hana_s = map(str, input().split())
if taro_s < hana_s:
taro += 3
elif hana_s < taro_s:
hana += 3
else:
taro += 1
hana += 1
print(taro, hana)
| taro = 0
hana = 0
n = int(input())
for _ in range(n):
taro_s, hana_s = map(str, input().split())
if taro_s > hana_s:
taro += 3
elif hana_s > taro_s:
hana += 3
else:
taro += 1
hana += 1
print(taro, hana)
| [["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 47]] | 5 | 68 |
while(s=gets.chomp)!='-'
gets.to_i.times{p s+=s.slice!(0,gets.to_i)};puts s end
| while(s=gets.chomp)!='-'
gets.to_i.times{s+=s.slice!(0,gets.to_i)};puts s end
| [["-", 0, 652, 196, 196, 8, 734, 0, 652, 735, 22]] | 4 | 36 |
#!/usr/bin/env ruby
result = []
while true
cards = gets.chomp
if cards == "-" then
break
end
loopnumber = gets.to_i
loopnumber.times do
shufflenumber = gets.to_i
temp = cards * 2
cards = temp.slice(cards.length - shufflenumber,cards.length)
end
result << car... | #!/usr/bin/env ruby
result = []
while true
cards = gets.chomp
if cards == "-" then
break
end
loopnumber = gets.to_i
loopnumber.times do
shufflenumber = gets.to_i
temp = cards * 2
cards = temp.slice(shufflenumber,cards.length)
end
result << cards
end
puts res... | [["-", 12, 652, 3, 4, 0, 738, 31, 652, 486, 22], ["-", 12, 652, 3, 4, 0, 738, 31, 652, 17, 131], ["-", 12, 652, 3, 4, 0, 738, 31, 652, 735, 22], ["-", 0, 662, 12, 652, 3, 4, 0, 738, 17, 33]] | 4 | 63 |
while line = gets.chomp do
if (line == "-") then break end
card = line
n = gets.to_i
n.times do
h = gets.to_i
parts = card.slice!(0, h - 1)
card += parts
end
puts card
end | while line = gets.chomp do
if (line == "-") then break end
card = line
n = gets.to_i
n.times do
h = gets.to_i
parts = card.slice!(0, h)
card += parts
end
puts card
end | [["-", 0, 662, 12, 652, 3, 4, 0, 738, 17, 33], ["-", 0, 662, 12, 652, 3, 4, 0, 738, 12, 612]] | 4 | 54 |
while (cards = gets.chomp) != "-"
h = gets.to_i.times.map { gets.to_i }.reduce(:+) % cards.size
puts h
puts cards[h..-1] + cards[0...h]
end | while (cards = gets.chomp) != "-"
h = gets.to_i.times.map { gets.to_i }.reduce(:+) % cards.size
puts cards[h..-1] + cards[0...h]
end | [["-", 0, 89, 8, 170, 0, 652, 3, 4, 0, 22], ["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22]] | 4 | 53 |
while (a = gets) != "-"
a = a.chomp.chars
n = gets.to_i
for i in 1..n
s = gets.to_i
for j in 1..s
a.push(a.shift)
end
end
(0..a.size).each { |h|
print a[h]
}
puts
end | while (a = gets.chomp) != "-"
a = a.chars
n = gets.to_i
for i in 1..n
s = gets.to_i
for j in 1..s
a.push(a.shift)
end
end
(0..a.size).each { |h|
print a[h]
}
puts
end | [["+", 15, 738, 31, 739, 0, 662, 12, 652, 17, 131], ["+", 15, 738, 31, 739, 0, 662, 12, 652, 735, 22], ["-", 8, 170, 0, 662, 12, 652, 486, 652, 17, 131], ["-", 8, 170, 0, 662, 12, 652, 486, 652, 735, 22]] | 4 | 70 |
while (al_line = gets.chomp) != "-" do
h = gets.to_i
(0..(h-1)).each {|i|
# puts "#{i}回目"
back_str = ''
n = gets.to_i
front_str = al_line[0,n]
# puts "al_lineの削除する文字を出力"
al_line.slice!(0,n)
al_line = al_line + front_str
puts al_line
}
puts al_line
end
| while (al_line = gets.chomp) != "-" do
h = gets.to_i
(0..(h-1)).each {|i|
back_str = ''
n = gets.to_i
front_str = al_line[0,n]
# puts "al_lineの削除する文字を出力"
al_line.slice!(0,n)
al_line = al_line + front_str
# puts al_line
}
puts al_line
end
| [["-", 0, 652, 196, 196, 8, 734, 0, 652, 735, 22], ["-", 196, 196, 8, 734, 0, 652, 3, 4, 0, 22]] | 4 | 71 |
while (str = $stdin.gets(chomp:true)) != "-"
tms = $stdin.gets(chomp:true).to_i
shl_crd = []
tms.times do
shl_crd << file.gets(chomp:true).to_i
end
shl_crd.each do | num |
str << str.slice!(0...num)
end
puts str
end
| while (str = $stdin.gets(chomp:true)) != "-"
tms = $stdin.gets(chomp:true).to_i
shl_crd = []
tms.times do
shl_crd << $stdin.gets(chomp:true).to_i
end
shl_crd.each do | num |
str << str.slice!(0...num)
end
puts str
end
| [["-", 8, 736, 0, 738, 12, 652, 486, 652, 486, 22], ["+", 8, 736, 0, 738, 12, 652, 486, 652, 486, 744]] | 4 | 71 |
while (str = gets.chomp) != '-'
gets.to_i.times do
h = gets.to_i
str = str[h..-1] + str[0...h]
puts str
end
end | while (str = gets.chomp) != '-'
gets.to_i.times do
h = gets.to_i
str = str[h..-1] + str[0...h]
end
puts str
end | [["+", 0, 89, 8, 170, 0, 652, 196, 737, 0, 444], ["-", 0, 89, 8, 170, 0, 652, 196, 737, 0, 444]] | 4 | 43 |
while True:
string = str(input())
box = ""
if string == "-":
break
shuffle = int(input())
h = [0]*shuffle
for a in range(shuffle):
h[a] = int(input())
for b in range(shuffle):
box = string[0:h[b]]
string = string[h[b]:]
string = stri... | while True:
string = str(input())
box = ""
if string == "-":
break
shuffle = int(input())
h = [0]*shuffle
for a in range(shuffle):
h[a] = int(input())
for b in range(shuffle):
box = string[0:h[b]]
string = string[h[b]:]
string = stri... | [["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 103 |
while 1:
a = input()
if a == '-':
break
n = int(input())
for i in range(n):
h = int(input())
a = a[h+1:] + a[:h]
print(a)
| while 1:
a = input()
if a == '-':
break
n = int(input())
for i in range(n):
h = int(input())
a = a[h:] + a[:h]
print(a)
| [["-", 12, 657, 31, 206, 206, 663, 0, 657, 17, 72], ["-", 12, 657, 31, 206, 206, 663, 0, 657, 12, 612]] | 5 | 59 |
while True:
text = input()
if text == '-':
break
count = int(input())
for c in range(count):
index = int(input())
text - text[index:] + text[:index]
print(text) | while True:
text = input()
if text == '-':
break
count = int(input())
for c in range(count):
index = int(input())
text = text[index:] + text[:index]
print(text) | [["-", 8, 196, 0, 1, 0, 657, 31, 657, 17, 33], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32]] | 5 | 57 |
while True:
tmp = input()
if tmp == "-":
break
m = eval(input())
for i in range(m):
h = eval(input())
tmp = tmp[:m] + tmp[m:]
print(tmp) | while True:
tmp = input()
if tmp == "-":
break
m = eval(input())
for i in range(m):
h = eval(input())
tmp = tmp[h:] + tmp[:h]
print(tmp) | [["+", 0, 662, 12, 657, 31, 206, 206, 663, 0, 22], ["-", 0, 662, 12, 657, 31, 206, 206, 663, 0, 22], ["-", 0, 662, 12, 657, 12, 206, 206, 663, 0, 22], ["+", 0, 662, 12, 657, 12, 206, 206, 663, 0, 22]] | 5 | 57 |
while(1):
sen1=input()
if sen1=="-":
break
suff=int(input())
for i in range(suff):
h=int(input())
sen2=sen1[h:]+sen1[:h]
print(sen2) | while(1):
sen1=input()
if sen1=="-":
break
suff=int(input())
for i in range(suff):
h=int(input())
sen1=sen1[h:]+sen1[:h]
print(sen1) | [["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 59 |
#-*- encoding=utf-8 -*-
import sys
#import numpy as np
#import matliab as plt
printf = sys.stdout.write
ans = []
while True:
word = list(input())
if word[0] == "-":
break
x = eval(input())
suff = []
for i in range(x):
suff.append(eval(input()))
for i in range(len(suff)):
... | import sys
printf = sys.stdout.write
ans = []
while True:
word = list(input())
if word[0] == "-":
break
x = eval(input())
suff = []
for i in range(x):
suff.append(eval(input()))
for i in range(len(suff)):
for j in range(suff[i]):
word.insert(int(len(word))... | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 166 |
# -*- coding: utf-8 -*-
import sys
lines = sys.stdin.readlines()
l = 0
while not ("-" in lines[l]):
s = lines[l].replace('\n','')
n = int(lines[l+1])
l += 2
t = sum(map(int, lines[l, l+n])) % len(s)
print(s[t:]+s[:t])
l += n | # -*- coding: utf-8 -*-
import sys
lines = sys.stdin.readlines()
l = 0
while not ("-" in lines[l]):
s = lines[l].replace('\n','')
n = int(lines[l+1])
l += 2
t = sum(map(int, lines[l:l+n])) % len(s)
print(s[t:]+s[:t])
l += n | [["-", 3, 4, 0, 652, 3, 4, 0, 206, 0, 21], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 102]] | 5 | 98 |
while True:
C = input()
if C == "-":
break
count = int(input())
shuffle = [int(input() for i in range(count))]
for h in shuffle:
C = C[h:] + C[:h]
print(C) | while True:
C = input()
if C == "-":
break
count = int(input())
shuffle = [int(input()) for i in range(count)]
for h in shuffle:
C = C[h:] + C[:h]
print(C) | [["+", 0, 662, 12, 658, 8, 652, 3, 4, 0, 25], ["-", 3, 668, 0, 659, 12, 652, 3, 4, 0, 25]] | 5 | 63 |
while True:
w = input()
if w == "-": break
m = int(input())
l = list(w)
L = len(l)
for i in range(m):
h = int(input())
a = [l[j] for j in range(h)]
b = [l[j] for j in range(h,L)]
b.extend(a)
for k in range(L):
l[k] = b[k]
print(str... | while True:
w = input()
if w == "-": break
m = int(input())
l = list(w)
L = len(l)
for i in range(m):
h = int(input())
a = [l[j] for j in range(h)]
b = [l[j] for j in range(h,L)]
b.extend(a)
for k in range(L):
l[k] = b[k]
print("".... | [["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 654], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 655], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22]] | 5 | 114 |
while True:
W = list(input())
if W[0] == '-':
break
times = int(input())
for i in range(times):
h = int(input())
W = W[h:]+W[0:h]
print(W) | while True:
W = list(input())
if W[0] == '-':
break
times = int(input())
for i in range(times):
h = int(input())
W = W[h:]+W[0:h]
print(*W, sep='') | [["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 654], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 655]] | 5 | 64 |
while 1:
s = input()
if s == '-':break
n = input()
for i in range(n):
h = int(input())
s = s[h:] + s[:h]
print(s) | while True:
s = input()
if s == '-':break
n = int(input())
for i in range(n):
h = int(input())
s = s[h:] + s[:h]
print(s) | [["-", 36, 36, 36, 36, 0, 656, 0, 52, 15, 612], ["+", 36, 36, 36, 36, 0, 656, 0, 52, 15, 146], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 54 |
while 1:
n=input()
if n=='-':
break
m=[i for i in range(len(n))]
count=int(input())
for i in range(count):
l=int(input())
for j in range(len(n)):
m[j]=n[(l+j)%len(n)]
n=m
for i in range(len(n)):
print(n[i],end="")
print() | while 1:
n=input()
if n=='-':
break
m=[i for i in range(len(n))]
count=int(input())
for i in range(count):
l=int(input())
for j in range(len(n)):
m[j]=n[(l+j)%len(n)]
n=m.copy()
for i in range(len(n)):
print(n[i],end="")
print() | [["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 113 |
while True:
s = input()
if s == "-":
break
m = int(input())
for n in range(m):
h = int(input())
s = s[0:h] + s[h:]
print(s) | while True:
s = input()
if s == "-":
break
m = int(input())
for n in range(m):
h = int(input())
s = s[h:] + s[0: h]
print(s) | [["-", 0, 662, 12, 657, 31, 206, 206, 663, 0, 612], ["-", 0, 662, 12, 657, 31, 206, 206, 663, 0, 102], ["+", 0, 662, 12, 657, 31, 206, 206, 663, 0, 102], ["-", 0, 662, 12, 657, 12, 206, 206, 663, 0, 22], ["+", 0, 662, 12, 657, 12, 206, 206, 663, 0, 612], ["+", 0, 662, 12, 657, 12, 206, 206, 663, 0, 22]] | 5 | 58 |
while True:
string = list(input())
if len(string) == 1 and string[0] == "-":
break
num = int(input())
for i in range(num):
times = int(input())
tmp = string[:times]
del string[:times]
string += tmp
print(" ".join(string)) | while True:
string = list(input())
if len(string) == 1 and string[0] == "-":
break
num = int(input())
for i in range(num):
times = int(input())
tmp = string[:times]
del string[:times]
string += tmp
print("".join(string)) | [["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]] | 5 | 80 |
def main():
while True:
S = input()
if S == "-":
break
n_shuffle = int(input())
hs = [int(input()) for _ in range(n_shuffle)]
for h in hs:
S = S[-h:] + S[:-h]
print(S)
if __name__ == "__main__":
main() | def main():
while True:
S = input()
if S == "-":
break
n_shuffle = int(input())
hs = [int(input()) for _ in range(n_shuffle)]
for h in hs:
S = S[h:] + S[:h]
print(S)
if __name__ == "__main__":
main() | [["-", 12, 657, 31, 206, 206, 663, 0, 664, 17, 33], ["-", 12, 657, 12, 206, 206, 663, 0, 664, 17, 33]] | 5 | 80 |
l = []
while 1:
s = input()
if s == "-": break
for _ in range(int(input())):
h = int(input())
s = s[h:] + s[:h]
l += [s]
print(l)
for e in l: print(e)
| l = []
while 1:
s = input()
if s == "-": break
for _ in range(int(input())):
h = int(input())
s = s[h:] + s[:h]
l += [s]
for e in l: print(e)
| [["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 72 |
while True:
card = input()
if card == '-': break
for i in range(int(input())):
a = int(input())
card = card[:a] + card[a:]
print(card)
| while True:
card = input()
if card == '-': break
for i in range(int(input())):
a = int(input())
card = card[a:] + card[:a]
print(card)
| [["-", 0, 662, 12, 657, 31, 206, 206, 663, 0, 102], ["+", 0, 662, 12, 657, 31, 206, 206, 663, 0, 102], ["-", 0, 662, 12, 657, 12, 206, 206, 663, 0, 22], ["+", 0, 662, 12, 657, 12, 206, 206, 663, 0, 22]] | 5 | 54 |
A = input()
while(A != '-'):
m = int(input)
for i in range(m):
h = int(input())
A = A[h:]+A[:h]
print(A)
A = input()
| A = input()
while(A != '-'):
m = int(input())
for i in range(m):
h = int(input())
A = A[h:]+A[:h]
print(A)
A = input()
| [["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 58 |
while True:
s = input()
if s == "-":
break
for i in int(input()):
h = int(input())
s = s[h:] + s[0:h]
print(s) | while True:
s = input()
if s == "-":
break
for i in range(int(input())):
h = int(input())
s = s[h:] + s[0:h]
print(s) | [["+", 0, 52, 8, 196, 0, 7, 12, 652, 63, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 52 |
while True:
s = input()
if s == '-': break
n = int(input())
for i in range(n):
h = int(input())
s = s[-h:] + s[:-h]
print(s) | while True:
s = input()
if s == '-': break
n = int(input())
for i in range(n):
h = int(input())
s = s[h:] + s[:h]
print(s) | [["-", 12, 657, 31, 206, 206, 663, 0, 664, 17, 33], ["-", 12, 657, 12, 206, 206, 663, 0, 664, 17, 33]] | 5 | 59 |
#include <stdio.h>
#include <string.h>
void op_print(char *str, int a, int b) {
for (int i = a; i <= b; ++i) {
putchar(str[i]);
}
}
void op_replace(char *str, int a, int b, char *p) {
for (int i = a; i <= b; ++i) {
str[i] = p[i - a];
}
}
void op_reverse(char *str, int a, int b) {
for (; a < b; ++a,... | #include <stdio.h>
#include <string.h>
void op_print(char *str, int a, int b) {
for (int i = a; i <= b; ++i) {
putchar(str[i]);
}
putchar('\n');
}
void op_replace(char *str, int a, int b, char *p) {
for (int i = a; i <= b; ++i) {
str[i] = p[i - a];
}
}
void op_reverse(char *str, int a, int b) {
f... | [["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 103, 0, 104], ["+", 0, 1, 0, 2, 3, 4, 0, 103, 0, 44], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 0 | 305 |
i, a, b, q;
main() {
char s[1001], x[7], p[1000];
for (scanf("%s%d", s, &q); q--;) {
scanf("%s%d%d", x, &a, &b);
switch (x[2]) {
case 'i':
for (; a <= b; printf("%c", s[a++]))
;
break;
case 'v':
for (; a < b; a++, b--)
s[a] ^= s[b] ^= s[a] ^= s[b];
break;
... | i, a, b, q;
main() {
char s[1001], x[7], p[1000];
for (scanf("%s%d", s, &q); q--;) {
scanf("%s%d%d", x, &a, &b);
switch (x[2]) {
case 'i':
for (; a <= b; printf("%c", s[a++]))
;
puts("");
break;
case 'v':
for (; a < b; a++, b--)
s[a] ^= s[b] ^= s[a] ^= s[b];
... | [["+", 8, 9, 0, 100, 0, 1, 0, 2, 63, 22], ["+", 0, 100, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 100, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 99, 8, 9, 0, 100, 0, 1, 0, 35]] | 0 | 181 |
str = gets.chomp
q = gets.chomp.to_i
q.times {
order = gets.chomp.split(" ")
if order[0] == "print"
print(str[order[1].to_i..order[2].to_i+1],"\n")
elsif order[0] == "reverse"
str[order[1].to_i..order[2].to_i] = str[order[1].to_i..order[2].to_i].reverse
elsif order[0] == "replace"
... | str = gets.chomp
q = gets.chomp.to_i
q.times {
order = gets.chomp.split(" ")
if order[0] == "print"
print(str[order[1].to_i..order[2].to_i],"\n")
elsif order[0] == "reverse"
str[order[1].to_i..order[2].to_i] = str[order[1].to_i..order[2].to_i].reverse
elsif order[0] == "replace"
... | [["-", 3, 4, 0, 742, 0, 475, 444, 738, 17, 72], ["-", 3, 4, 0, 742, 0, 475, 444, 738, 12, 612]] | 4 | 138 |
str = gets.chomp
gets.to_i.times do
l = gets.chomp.split
a = l[1].to_i
b = l[2].to_i
case n[0]
when 'replace'
str[a..b] = l[3]
when 'reverse'
str[a..b] = str[a..b].reverse
when 'print'
puts str[a..b]
end
end | str = gets.chomp
gets.to_i.times do
l = gets.chomp.split
a = l[1].to_i
b = l[2].to_i
case l[0]
when 'replace'
str[a..b] = l[3]
when 'reverse'
str[a..b] = str[a..b].reverse
when 'print'
puts str[a..b]
end
end | [["-", 196, 737, 8, 736, 0, 173, 51, 742, 500, 22], ["+", 196, 737, 8, 736, 0, 173, 51, 742, 500, 22]] | 4 | 86 |
str = gets.to_s
q = gets.to_i
w = []
q.times do
x, a, b, q = gets.split.map(&:to_s)
a = a.to_i
b = b.to_i
case x
when "reverse" then
str[a..b] = str[a..b].reverse
when "replace"
str[a..b] = str[a..b].replace(q)
when "print" then
print str[a..b]
en... | str = gets.to_s
q = gets.to_i
w = []
q.times do
x, a, b, q = gets.split.map(&:to_s)
a = a.to_i
b = b.to_i
case x
when "reverse" then
str[a..b] = str[a..b].reverse
when "replace"
str[a..b] = str[a..b].replace(q)
when "print" then
puts str[a..b]
end... | [["-", 0, 173, 0, 763, 8, 749, 0, 652, 735, 22], ["+", 0, 173, 0, 763, 8, 749, 0, 652, 735, 22]] | 4 | 103 |
s = gets.chomp
gets.to_i.times do
o, b, e, r = gets.split
b, e = b.to_i, e.to_i + 1
case o
when 'print' then puts s[b, e]
when 'reverse' then s[b, e] = s[b, e].reverse
when 'replace' then s[b, e] = r
end
end | s = gets.chomp
gets.to_i.times do
o, b, e, r = gets.split
b, e = b.to_i, e.to_i
case o
when 'print' then puts s[b..e]
when 'reverse' then s[b..e] = s[b..e].reverse
when 'replace' then s[b..e] = r
end
end | [["-", 8, 736, 0, 662, 12, 762, 0, 738, 17, 72], ["-", 8, 736, 0, 662, 12, 762, 0, 738, 12, 612], ["-", 8, 749, 0, 652, 3, 4, 0, 742, 0, 21], ["+", 0, 652, 3, 4, 0, 742, 0, 475, 17, 757], ["-", 0, 763, 8, 749, 0, 662, 31, 742, 0, 21], ["+", 8, 749, 0, 662, 31, 742, 0, 475, 17, 757], ["-", 8, 749, 0, 662, 12, 652, 486, ... | 4 | 84 |
S = str(input())
N = int(input())
for _i in range(N):
line = input().split()
start = int(line[1])
end = int(line[2])
if line[0] == 'print':
print(S[start:end + 1])
if line[0] == 'reverse':
reversed_word = list(S[start:end + 1])
reversed_word.reverse()
S = S[:start] +... | S = str(input())
N = int(input())
for _i in range(N):
line = input().split()
start = int(line[1])
end = int(line[2])
if line[0] == 'print':
print(S[start:end + 1])
if line[0] == 'reverse':
reversed_word = list(S[start:end + 1])
reversed_word.reverse()
S = S[:start] +... | [["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 157 |
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
int main() {
string str, com, phrase;
int a, b, comNum;
cin >> str >> comNum;
REP(t, comNum) {
cin >> com >> a >> b;
if (com == "print") {
cout << str.substr(a, b - a + 1) << endl;
} else if (com ==... | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
int main() {
string str, com, phrase;
int a, b, q;
cin >> str >> q;
REP(t, q) {
cin >> com >> a >> b;
if (com == "print") {
cout << str.substr(a, b - a + 1) << endl;
} else if (com == "reverse") {
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 60], ["+", 0, 57, 64, 9, 0... | 1 | 173 |
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
string str, order, repStr;
cin >> str;
int n = 0;
cin >> n;
int ord1 = 0, ord2 = 0;
while (n--) {
cin >> order;
cin >> ord1 >> ord2;
if (order == "replace") {
cin >> repStr;
str.replace(or... | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
string str, order, repStr;
cin >> str;
int n = 0;
cin >> n;
int ord1 = 0, ord2 = 0;
while (n--) {
cin >> order;
cin >> ord1 >> ord2;
if (order == "replace") {
cin >> repStr;
str.replace(or... | [["+", 12, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 12, 22]] | 1 | 174 |
#include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
int q;
cin >> q;
for (int i = 0; i < q; i++) {
string cmd;
cin >> cmd;
int a, b;
cin >> a >> b;
if (cmd == "print") {
cout << str.substr(a, sizeof(b - a + 1)) << endl;
}
if (cmd ==... | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
int q;
cin >> q;
for (int i = 0; i < q; i++) {
string cmd;
cin >> cmd;
int a, b;
cin >> a >> b;
if (cmd == "print") {
cout << str.substr(a, b - a + 1) << endl;
}
if (cmd == "revers... | [["-", 31, 16, 12, 2, 3, 4, 0, 105, 0, 150], ["-", 12, 2, 3, 4, 0, 105, 51, 23, 0, 24], ["-", 12, 2, 3, 4, 0, 105, 51, 23, 0, 25]] | 1 | 207 |
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
string str;
string x, y;
int a;
int b, c;
cin >> str;
cin >> a;
for (int i = 0; i < a; i++) {
cin >> x >> b >> c;
if (x == "replace") {
cin >> y;
str.replace(b, c, y);
}
if (x == "reve... | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
string str;
string x, y;
int a;
int b, c;
cin >> str;
cin >> a;
for (int i = 0; i < a; i++) {
cin >> x >> b >> c;
if (x == "replace") {
cin >> y;
str.replace(b, c - b + 1, y);
}
if (x ... | [["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 12, 22]] | 1 | 145 |
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main(void) {
string str, x, y;
cin >> str;
int q;
cin >> q;
int a, b, p;
for (int i = 0; i < q; i++) {
cin >> x >> a >> b;
p = b - a + 1;
if (x == "print") {
cout << str.substr(a, p) << endl;
}
if (... | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main(void) {
string str, x, y;
cin >> str;
int q;
cin >> q;
int a, b, p;
for (int i = 0; i < q; i++) {
cin >> x >> a >> b;
p = b - a + 1;
if (x == "print") {
cout << str.substr(a, p) << endl;
}
if (... | [["+", 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], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]] | 1 | 154 |
#include <iostream>
#include <sstream>
using namespace std;
int main() {
string str, command, sub, head, end;
string orders;
int numOfComs, a, b;
cin >> str;
cin >> numOfComs;
cin.ignore();
for (int i = 0; i < numOfComs; i++) {
getline(cin, orders);
istringstream ss(orders);
for (int j = 0... | #include <iostream>
#include <sstream>
using namespace std;
int main() {
string str, command, sub, head, end;
string orders;
int numOfComs, a, b;
cin >> str;
cin >> numOfComs;
cin.ignore();
for (int i = 0; i < numOfComs; i++) {
getline(cin, orders);
istringstream ss(orders);
for (int j = 0... | [["+", 12, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 12, 22]] | 1 | 286 |
#include <bits/stdc++.h>
using namespace std;
int main() {
string query, strconv, str, p;
int q, a, b;
cin >> str;
cin >> q;
for (int i = 0; i < q; i++) {
cin >> query;
cin >> a >> b;
if (query == "print") {
cout << str.substr(a, b - a) << endl;
} else if (query == "reverse") {
... | #include <bits/stdc++.h>
using namespace std;
int main() {
string query, strconv, str, p;
int q, a, b;
cin >> str;
cin >> q;
for (int i = 0; i < q; i++) {
cin >> query;
cin >> a >> b;
if (query == "print") {
cout << str.substr(a, b - a + 1) << endl;
} else if (query == "reverse") {
... | [["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13]] | 1 | 149 |
#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... | [["-", 0, 57, 64, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 31, 22]] | 1 | 186 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
string str;
int q;
cin >> str >> q;
for (int i = 0; q > i; i++) {
string order;
int a, b;
cin >> order >> a >> b;
if (order == "print")
cout << str.substr(a, b - 1 + a) << endl;
if (order == "reverse")
re... | #include <algorithm>
#include <iostream>
using namespace std;
int main() {
string str;
int q;
cin >> str >> q;
for (int i = 0; q > i; i++) {
string order;
int a, b;
cin >> order >> a >> b;
if (order == "print")
cout << str.substr(a, b - a + 1) << endl;
if (order == "reverse")
re... | [["-", 12, 2, 3, 4, 0, 16, 31, 16, 12, 13], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13]] | 1 | 144 |
#include <iostream>
#include <string>
using namespace std;
int main(int, char **) {
string s;
unsigned int n;
std::cin >> s >> n;
string pstr = "print";
string prep = "replace";
for (unsigned int i = 0; i < n; ++i) {
string inst;
unsigned int x, y;
cin >> inst >> x >> y;
if (inst == pstr)... | #include <iostream>
#include <string>
using namespace std;
int main(int, char **) {
string s;
unsigned int n;
std::cin >> s >> n;
string pstr = "print";
string prep = "replace";
for (unsigned int i = 0; i < n; ++i) {
string inst;
unsigned int x, y;
cin >> inst >> x >> y;
if (inst == pstr)... | [["-", 0, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["+", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 9, 0, 7, 15, 16, 31, 16, 17, 72], ["+", 0, 9, 0, 7, 15, 16, 31, 16, 12, 22]] | 1 | 202 |
#include <iostream>
#include <string>
using namespace std;
int main() {
string target;
int num;
cin >> target;
cin >> num;
string com;
for (int i = 0; i < num; i++) {
cin >> com;
if (com == "print") {
int st, en;
cin >> st >> en;
cout << target.substr(st, en + st + 1) << endl;
... | #include <iostream>
#include <string>
using namespace std;
int main() {
string target;
int num;
cin >> target;
cin >> num;
string com;
for (int i = 0; i < num; i++) {
cin >> com;
if (com == "print") {
int st, en;
cin >> st >> en;
cout << target.substr(st, en - st + 1) << endl;
... | [["-", 12, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["-", 51, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["-", 51, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["+", 51, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72]] | 1 | 205 |
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int q, a, b;
string s, p, i;
cin >> s >> q;
while (q-- > 0) {
cin >> i >> a >> b;
if (i == "replace") {
cin >> p;
s = s.replace(a, b - a + 1, p);
} else if (i == "reverse") {
reverse(s... | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int q, a, b;
string s, p, i;
cin >> s >> q;
while (q-- > 0) {
cin >> i >> a >> b;
if (i == "replace") {
cin >> p;
s = s.replace(a, b - a + 1, p);
} else if (i == "reverse") {
reverse(s... | [["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22]] | 1 | 149 |
#include <cstdio>
#include <cstdlib>
#include <string>
using namespace std;
int main() {
char str[1000], cmd[7], p[1000];
int a, b, q;
string OUT;
scanf("%s", str);
string STR = str;
scanf("%d", &q);
for (int i = 0; i < q; i++) {
scanf("%s %d %d", cmd, &a, &b);
string CMD = cmd;
if (CMD == "re... | #include <cstdio>
#include <cstdlib>
#include <string>
using namespace std;
int main() {
char str[1000], cmd[7], p[1000];
int a, b, q;
string OUT;
scanf("%s", str);
string STR = str;
scanf("%d", &q);
for (int i = 0; i < q; i++) {
scanf("%s %d %d", cmd, &a, &b);
string CMD = cmd;
if (CMD == "re... | [["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 282 |
#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;
... | [["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 167 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define int long long
signed main() {
bitset<64> b(0);
int q;
cin >> q;
while (q--) {
int k, x, ans;
cin >> k;
if (k < 4)
cin >> x;
switch (k) {
case 0:
cout << b.test(x) << endl;
br... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define int long long
signed main() {
bitset<64> b(0);
int q;
cin >> q;
while (q--) {
int k, x, ans;
cin >> k;
if (k < 4)
cin >> x;
switch (k) {
case 0:
cout << b.test(x) << endl;
br... | [["-", 0, 16, 31, 16, 12, 2, 63, 118, 119, 120], ["+", 0, 16, 31, 16, 12, 2, 63, 118, 119, 120]] | 1 | 203 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define int long long
int n, k;
int a[20];
signed main() {
cin >> n >> k;
rep(i, k) cin >> a[i];
rep(i, (1 << n)) {
bool ok = 1;
rep(j, k) if (!(i >> a[j]) & 1) ok = 0;
if (!ok)
continue;
vector<int> ... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define int long long
int n, k;
int a[20];
signed main() {
cin >> n >> k;
rep(i, k) cin >> a[i];
rep(i, (1 << n)) {
bool ok = 1;
rep(j, k) if (!((i >> a[j]) & 1)) ok = 0;
if (!ok)
continue;
vector<int... | [["+", 51, 91, 28, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 57, 15, 339, 51, 91, 28, 23, 0, 25]] | 1 | 181 |
str = []
while tmp = gets.chomp do
break if tmp.size == 0
str << tmp.downcase.split("")
end
str.flatten!
("a".."z").each do |alp|
cnt = str.count{|char| char == alp}
puts "#{alp} : #{cnt}"
end
| str = []
while tmp = gets do
break if tmp.size == 0
str << tmp.downcase.chomp.split("")
end
str.flatten!
("a".."z").each do |alp|
cnt = str.count{|char| char == alp}
puts "#{alp} : #{cnt}"
end
| [["-", 0, 493, 0, 89, 15, 662, 12, 652, 17, 131], ["-", 0, 493, 0, 89, 15, 662, 12, 652, 735, 22], ["+", 8, 170, 0, 738, 12, 652, 486, 652, 17, 131], ["+", 8, 170, 0, 738, 12, 652, 486, 652, 735, 22]] | 4 | 72 |
text = gets(0).downcase
for s in "a".."z"
puts "#{s} : #{text.count(s)}"
end
| text = gets("").downcase
for s in "a".."z"
puts "#{s} : #{text.count(s)}"
end
| [["-", 0, 662, 12, 652, 486, 652, 3, 4, 0, 612], ["+", 12, 652, 486, 652, 3, 4, 0, 557, 0, 62]] | 4 | 34 |
#入力した文書の中にアルファベット数字をいくつはいっているかをわかるプログラム
text = gets("").downcase #テキストに小文字をとる
for alphabet in "a".."z" #sをA から Zまで26回繰り返す
puts "#{alphabet} : #{text*26.times*(alphabet)}" #まずAからZまで繰り返して テキストの中のアルファベットをカウントする
end
| #入力した文書の中にアルファベット数字をいくつはいっているかをわかるプログラム
text = gets("").downcase #テキストに小文字をとる
for alphabet in "a".."z" #sをA から Zまで26回繰り返す
puts "#{alphabet} : #{text.count(alphabet)}" #まずAからZまで繰り返して テキストの中のアルファベットをカウントする
end
| [["-", 0, 557, 0, 284, 0, 738, 31, 738, 17, 48], ["-", 0, 284, 0, 738, 31, 738, 12, 652, 486, 612], ["-", 0, 284, 0, 738, 31, 738, 12, 652, 735, 22], ["-", 3, 4, 0, 557, 0, 284, 0, 738, 17, 48], ["+", 3, 4, 0, 557, 0, 284, 0, 652, 735, 22]] | 4 | 42 |
h = {}
("a".."z").each { |char| h[char] = 0 }
while line = gets
line.chomp.chars do |char|
h[char] += 1 if /[a-z]/ === char
end
end
h.each {|key, value| puts "#{key} : #{value}"} | h = {}
("a".."z").each { |char| h[char] = 0 }
while line = gets
line.chomp.downcase.chars do |char|
h[char] += 1 if /[a-z]/ === char
end
end
h.each {|key, value| puts "#{key} : #{value}"} | [["+", 0, 89, 8, 170, 0, 652, 486, 652, 735, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 652, 17, 131]] | 4 | 73 |
text = gets(nil)
for s in "a".."z"
puts "#{s} : #{text.count(s)}"
end | text = gets(nil).downcase
for s in "a".."z"
puts "#{s} : #{text.count(s)}"
end | [["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]] | 4 | 32 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.