buggy_code
stringlengths 11
625k
| fixed_code
stringlengths 17
625k
| bug_type
stringlengths 2
4.45k
| language
int64 0
8
| token_count
int64 5
200k
| change_count
int64 0
100
|
|---|---|---|---|---|---|
#include <iostream>
using namespace std;
int main() {
char tmp = 'A', cup1, cup2, t;
while (cin >> cup1 >> t >> cup2) {
if (cup1 == tmp)
tmp = cup2;
if (cup2 == tmp)
tmp = cup1;
}
cout << tmp << endl;
return 0;
}
|
#include <iostream>
using namespace std;
int main() {
char tmp = 'A', cup1, cup2, t;
while (cin >> cup1 >> t >> cup2) {
if (cup1 == tmp)
tmp = cup2;
else if (cup2 == tmp)
tmp = cup1;
}
cout << tmp << endl;
return 0;
}
|
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95]]
| 1
| 66
| 1
|
hash = {"A" => 1, "B" => 0, "C" => 0}
choice = []
while tmp = gets
tmp = tmp.split(",").map(&:chomp)
p cng1 = hash[tmp[1]]
p cng2 = hash[tmp[0]]
p hash[tmp[0]] = cng1
p hash[tmp[1]] = cng2
p hash
end
puts hash.select{|_,v| v == hash.values.max}.keys
|
hash = {"A" => 1, "B" => 0, "C" => 0}
choice = []
while tmp = gets
tmp = tmp.split(",").map(&:chomp)
cng1 = hash[tmp[1]]
cng2 = hash[tmp[0]]
hash[tmp[0]] = cng1
hash[tmp[1]] = cng2
hash
end
puts hash.select{|_,v| v == hash.values.max}.keys
|
[["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22]]
| 4
| 108
| 5
|
#encoding:utf-8 No.0047 2014.10.6
cups = {"A"=>"ball","B"=>nil,"C"=>nil}
change = []
while gets
change.push gets.chomp.split(/,/)
end
change.length.times do |i|
cups[change[i][0]],cups[change[i][1]] = cups[change[i][1]],cups[change[i][0]]
end
cups.each{|key,value|
puts key if value == "ball"
}
|
#encoding:utf-8 No.0047 2014.10.6
cups = {"A"=>"ball","B"=>nil,"C"=>nil}
change = []
while gets
change.push $_.chomp.split(/,/)
end
change.length.times do |i|
cups[change[i][0]],cups[change[i][1]] = cups[change[i][1]],cups[change[i][0]]
end
cups.each{|key,value|
puts key if value == "ball"
}
|
[["-", 0, 652, 3, 4, 0, 652, 486, 652, 486, 22], ["+", 0, 652, 3, 4, 0, 652, 486, 652, 486, 744]]
| 4
| 115
| 2
|
def ball(c1, c2, b)
case b
when c1
return c2
when c2
return c1
else
return b
end
end
b = "A"
while line = gets
cup1, cup2 = line.chomp.split(",")
p b = ball(cup1, cup2, b)
end
puts b
|
def ball(c1, c2, b)
case b
when c1
return c2
when c2
return c1
else
return b
end
end
b = "A"
while line = gets
cup1, cup2 = line.chomp.split(",")
b = ball(cup1, cup2, b)
end
puts b
|
[["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22]]
| 4
| 61
| 9
|
cup = [1,0,0]
while act = gets
case act.chomp
when "A,B" then cup[0], cup[1] = cup[1], cup[0]
when "B,A" then cup[0], cup[1] = cup[1], cup[0]
when "A,C" then cup[0], cup[2] = cup[2], cup[0]
when "C,A" then cup[0], cup[2] = cup[2], cup[0]
when "B,C" then cup[1], cup[2] = cup[2], cup[1]
when "C,B" then cup[1], cup[2] = cup[2], cup[1]
end
p cup
end
case cup.index(1)
when 0 then puts "A"
when 1 then puts "B"
when 2 then puts "C"
end
|
cup = [1,0,0]
while act = gets
case act.chomp
when "A,B" then cup[0], cup[1] = cup[1], cup[0]
when "B,A" then cup[0], cup[1] = cup[1], cup[0]
when "A,C" then cup[0], cup[2] = cup[2], cup[0]
when "C,A" then cup[0], cup[2] = cup[2], cup[0]
when "B,C" then cup[1], cup[2] = cup[2], cup[1]
when "C,B" then cup[1], cup[2] = cup[2], cup[1]
end
end
case cup.index(1)
when 0 then puts "A"
when 1 then puts "B"
when 2 then puts "C"
end
|
[["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22], ["-", 0, 89, 8, 170, 0, 652, 3, 4, 0, 22]]
| 4
| 194
| 2
|
cups = [1, 0, 0]
while line = gets
case line
when "A,B", "B,A"
cups[0], cups[1] = cups[1], cups[0]
when "A,C", "C,A"
cups[0], cups[2] = cups[2], cups[0]
when "B,C", "C,B"
cups[1], cups[2] = cups[2], cups[1]
end
end
ABC = "ABC"
puts "ABC"[cups.index{|cup| cup == 1}]
|
cups = [1, 0, 0]
while line = gets
case line.chomp!
when "A,B", "B,A"
cups[0], cups[1] = cups[1], cups[0]
when "A,C", "C,A"
cups[0], cups[2] = cups[2], cups[0]
when "B,C", "C,B"
cups[1], cups[2] = cups[2], cups[1]
end
end
ABC = "ABC"
puts "ABC"[cups.index{|cup| cup == 1}]
|
[["+", 0, 89, 8, 170, 0, 173, 51, 652, 17, 131], ["+", 0, 89, 8, 170, 0, 173, 51, 652, 735, 22]]
| 4
| 120
| 2
|
from math import *
PI = 3.1415926535898
base = "A"
while True:
try:
x, y = list(map(str, input().strip().split(',')))
if x == base:
base = y
if y == base:
base = x
except EOFError:
break
print(base)
|
from math import *
PI = 3.1415926535898
base = "A"
while True:
try:
x, y = list(map(str, input().strip().split(',')))
if x == base:
base = y
elif y == base:
base = x
except EOFError:
break
print(base)
|
[["-", 8, 196, 0, 246, 8, 196, 0, 57, 0, 121], ["+", 0, 246, 8, 196, 0, 57, 75, 665, 0, 683]]
| 5
| 67
| 2
|
d = {"A":1, "B":0, "C":0}
while True:
try:
swap1, awap2 = input().split(",")
d[swap1], d[swap2] = d[swap2], d[swap1]
except:
break
print(list(d.keys())[list(d.values()).index(1)])
|
d = {"A":1, "B":0, "C":0}
while True:
try:
swap1, swap2 = input().split(",")
d[swap1], d[swap2] = d[swap2], d[swap1]
except:
break
print(list(d.keys())[list(d.values()).index(1)])
|
[["-", 8, 196, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 8, 196, 0, 1, 0, 662, 31, 684, 0, 22]]
| 5
| 88
| 2
|
import sys
c='ABC'
for e in sys.stdin:c.replace(e[0],'D').replace(e[2],e[0]).replace('D',e[2])
print(c[0])
|
import sys
c='ABC'
for e in sys.stdin:c=c.replace(e[0],'D').replace(e[2],e[0]).replace('D',e[2])
print(c[0])
|
[["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 500, 652, 63, 319, 500, 652, 63, 319, 500, 22]]
| 5
| 59
| 2
|
p = "A"
while True:
try:
s, t = input().split(",")
except EOFError as e:
break
if s == p:
p = t
elif t == p:
p = s
print(("%s" % (chA, )))
|
p = "A"
while True:
try:
s, t = input().split(",")
except EOFError as e:
break
if s == p:
p = t
elif t == p:
p = s
print(("%s" % (p, )))
|
[["-", 3, 4, 0, 23, 0, 657, 12, 660, 0, 22], ["+", 3, 4, 0, 23, 0, 657, 12, 660, 0, 22]]
| 5
| 59
| 2
|
#include <cmath>
#include <stdio.h>
#include <string.h>
int main() {
int a;
char c[10];
int ans[4];
ans[0] = 0;
ans[1] = 0;
ans[2] = 0;
ans[3] = 0;
while (scanf("%d,%s", &a, &c) != EOF) {
if (strcmp(c, "A") == 0) {
ans[0]++;
}
if (strcmp(c, "B") == 0) {
ans[1]++;
}
if (strcmp(c, "O") == 0) {
ans[2]++;
}
if (strcmp(c, "AB") == 0) {
ans[3]++;
}
}
printf("%d\n%d\n%d\n%d\n", ans[0], ans[1], ans[2], ans[3]);
return 0;
}
|
#include <cmath>
#include <stdio.h>
#include <string.h>
int main() {
int a;
char c[10];
int ans[4];
ans[0] = 0;
ans[1] = 0;
ans[2] = 0;
ans[3] = 0;
while (scanf("%d,%s", &a, &c) != EOF) {
if (strcmp(c, "A") == 0) {
ans[0]++;
}
if (strcmp(c, "B") == 0) {
ans[1]++;
}
if (strcmp(c, "O") == 0) {
ans[2]++;
}
if (strcmp(c, "AB") == 0) {
ans[3]++;
}
}
printf("%d\n%d\n%d\n%d\n", ans[0], ans[1], ans[3], ans[2]);
return 0;
}
|
[["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13]]
| 1
| 195
| 4
|
//
// akjbef.cpp
//
//
// Created by Takuto on 15/6/3.
//
//
#include <cstdio>
int main() {
char in[3];
int a = 0, b = 0, ab = 0, o = 0;
while (EOF != scanf("%*d,%s", in)) {
if (in[1] == '\0')
ab++;
else if (in[0] == 'a')
a++;
else if (in[0] == 'b')
b++;
else
o++;
}
printf("%d\n%d\n%d\n%d\n", a, b, ab, o);
return 0;
}
|
//
// akjbef.cpp
//
//
// Created by Takuto on 15/6/3.
//
//
#include <cstdio>
int main() {
char in[3];
int a = 0, b = 0, ab = 0, o = 0;
while (EOF != scanf("%*d,%s", in)) {
if (in[1] != '\0')
ab++;
else if (in[0] == 'A')
a++;
else if (in[0] == 'B')
b++;
else
o++;
}
printf("%d\n%d\n%d\n%d\n", a, b, ab, o);
return 0;
}
|
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125]]
| 1
| 126
| 6
|
#include <algorithm>
#include <iostream>
#include <string.h>
using namespace std;
int main() {
int a, e = 0, b = 0, c = 0, d = 0;
char h;
string s;
while (cin >> a >> h >> s) {
if (s == "A")
e++;
if (s == "B")
b++;
if (s == "AB")
c++;
if (s == "O")
d++;
}
cout << a << endl << b << endl << c << endl << d << endl;
}
|
#include <algorithm>
#include <iostream>
#include <string.h>
using namespace std;
int main() {
int a, e = 0, b = 0, c = 0, d = 0;
char h;
string s;
while (cin >> a >> h >> s) {
if (s == "A")
e++;
if (s == "B")
b++;
if (s == "AB")
c++;
if (s == "O")
d++;
}
cout << e << endl << b << endl << c << endl << d << endl;
}
|
[["-", 31, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 12, 22]]
| 1
| 115
| 2
|
#include <iostream>
#include <string.h>
#include <string>
using namespace std;
int main() {
int N, B[4];
string S;
memset(B, 0, sizeof(B));
while (cin >> N >> S) {
if (S == "A") {
B[0] += 1;
} else if (S == "B") {
B[1] += 1;
} else if (S == "AB") {
B[2] += 1;
} else if (S == "O") {
B[3] += 1;
}
}
cout << B[0] << endl << B[1] << endl << B[2] << endl << B[3] << endl;
return 0;
}
|
#include <iostream>
#include <string.h>
#include <string>
using namespace std;
int main() {
int N, B[4];
string S;
memset(B, 0, sizeof(B));
while (cin >> N >> S) {
if (S == ",A") {
B[0] += 1;
} else if (S == ",B") {
B[1] += 1;
} else if (S == ",AB") {
B[2] += 1;
} else if (S == ",O") {
B[3] += 1;
}
}
cout << B[0] << endl << B[1] << endl << B[2] << endl << B[3] << endl;
return 0;
}
|
[["-", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6], ["+", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6]]
| 1
| 153
| 8
|
#include <iostream>
#include <string>
using namespace std;
string S, T[4] = {"A", "B", "O", "AB"};
int x[4], a;
char c;
int main() {
while (cin >> a >> c >> S) {
for (int i = 0; i < 4; i++) {
if (T[i] == S) {
x[i]++;
}
}
}
cout << x[0] << endl << x[1] << endl << x[2] << endl << x[3] << endl;
}
|
#include <iostream>
#include <string>
using namespace std;
string S, T[4] = {"A", "B", "AB", "O"};
int x[4], a;
char c;
int main() {
while (cin >> a >> c >> S) {
for (int i = 0; i < 4; i++) {
if (T[i] == S) {
x[i]++;
}
}
}
cout << x[0] << endl << x[1] << endl << x[2] << endl << x[3] << endl;
}
|
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
| 1
| 126
| 4
|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
int a;
string str;
int cou[4] = {0};
while (scanf("%d", &a) != EOF) {
cin >> str;
if (str.size() == 3)
cou[2]++;
else if (str[0] == 'A')
cou[0]++;
else if (str[0] == 'O')
cou[3]++;
else if (str[0] == 'B')
cou[1]++;
}
for (int i = 0; i < 4; i++)
cout << cou[i] << endl;
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
int a;
string str;
int cou[4] = {0};
while (scanf("%d", &a) != EOF) {
cin >> str;
if (str.size() == 3)
cou[2]++;
else if (str[1] == 'A')
cou[0]++;
else if (str[1] == 'O')
cou[3]++;
else if (str[1] == 'B')
cou[1]++;
}
for (int i = 0; i < 4; i++)
cout << cou[i] << endl;
return 0;
}
|
[["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13]]
| 1
| 152
| 6
|
//
// main.cpp
// AizuOnline
//
// Created by ?????¬ ?????? on 19/05/2016.
// Copyright ?? 2016 ?????¬ ??????. All rights reserved.
//
#include <iostream>
int main(int argc, const char *argv[]) {
int a = 0;
int b = 0;
int ab = 0;
int o = 0;
int k;
char s[5];
while (scanf("%d,%s", &k, s) != EOF) {
if (s[0] == 'A' && s[1] == 'B') {
ab = ab + 1;
} else if (s[0] == 'A') {
a++;
} else if (s[0] == 'B') {
b++;
} else if (s[0] == 'O') {
o++;
}
std::cout << a << std::endl;
std::cout << b << std::endl;
std::cout << ab << std::endl;
std::cout << o << std::endl;
}
}
|
#include <iostream>
int main(int argc, const char *argv[]) {
int a = 0;
int b = 0;
int ab = 0;
int o = 0;
int k;
char s[5];
while (scanf("%d,%s", &k, s) != EOF) {
if (s[0] == 'A' && s[1] == 'B') {
ab = ab + 1;
} else if (s[0] == 'A') {
a++;
} else if (s[0] == 'B') {
b++;
} else if (s[0] == 'O') {
o++;
}
}
std::cout << a << std::endl;
std::cout << b << std::endl;
std::cout << ab << std::endl;
std::cout << o << std::endl;
}
|
[["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
| 1
| 190
| 2
|
#include <iostream>
using namespace std;
int main(void) {
// Here your code !
int n, a = 0, b = 0, o = 0, ab = 0;
char c;
string d;
while (cin >> n >> c >> d) {
if (d == "B\0")
b++;
else if (d == "A\0")
a++;
else if (d == "O\0")
o++;
else if (d == "AB\0")
ab++;
}
cout << a << endl << b << endl << o << endl << ab << endl;
return 0;
}
|
#include <iostream>
using namespace std;
int main(void) {
// Here your code !
int n, a = 0, b = 0, o = 0, ab = 0;
char c;
string d;
while (cin >> n >> c >> d) {
if (d == "B\0")
b++;
else if (d == "A\0")
a++;
else if (d == "O\0")
o++;
else if (d == "AB\0")
ab++;
}
cout << a << endl << b << endl << ab << endl << o << endl;
return 0;
}
|
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
| 1
| 123
| 4
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
char s[10];
int main() {
int A = 0, B = 0, AB = 0, O = 0;
int n;
while (scanf("%d,%s", &n, s) != EOF) {
if (!strcmp(s, "A"))
A++;
if (!strcmp(s, "B"))
B++;
if (!strcmp(s, "AB"))
AB++;
else
O++;
}
cout << A << endl << B << endl << AB << endl << O << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
char s[10];
int main() {
int A = 0, B = 0, AB = 0, O = 0;
int n;
while (scanf("%d,%s", &n, s) != EOF) {
if (!strcmp(s, "A"))
A++;
else if (!strcmp(s, "B"))
B++;
else if (!strcmp(s, "AB"))
AB++;
else
O++;
}
cout << A << endl << B << endl << AB << endl << O << endl;
return 0;
}
|
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
| 1
| 134
| 2
|
#include <iostream>
#include <string>
using namespace std;
int main() {
int a;
char b;
string c;
int d[4] = {0};
while (cin >> a >> b) {
cin >> c;
if (c == "A") {
d[0] += 1;
} else if (c == "B") {
d[1] += 1;
} else if (c == "O") {
d[2] += 1;
} else if (c == "AB") {
d[3] += 1;
}
}
cout << d[0] << endl << d[1] << endl << d[2] << endl << d[3] << endl;
}
|
#include <iostream>
#include <string>
using namespace std;
int main() {
int a;
char b;
string c;
int d[4] = {0};
while (cin >> a >> b) {
cin >> c;
if (c == "A") {
d[0] += 1;
} else if (c == "B") {
d[1] += 1;
} else if (c == "AB") {
d[2] += 1;
} else if (c == "O") {
d[3] += 1;
}
}
cout << d[0] << endl << d[1] << endl << d[2] << endl << d[3] << endl;
}
|
[["-", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6], ["+", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6]]
| 1
| 148
| 4
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a[4] = {0}, p = 0, u = 2, q = 0;
string s;
while (cin >> s) {
p++;
if (!q && p >= 10)
u++;
if (s.size() > u + 1)
a[2]++;
else if (s[u] == 'B')
a[1]++;
else if (s[u] == 'O')
a[3]++;
else
a[0]++;
}
for (int i = 0; i < 4; i++)
cout << a[i] << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a[4] = {0}, p = 0, u = 2, q = 0;
string s;
while (cin >> s) {
p++;
if (!q && p >= 10) {
u++;
q++;
}
if (s.size() > u + 1)
a[2]++;
else if (s[u] == 'B')
a[1]++;
else if (s[u] == 'O')
a[3]++;
else
a[0]++;
}
for (int i = 0; i < 4; i++)
cout << a[i] << endl;
}
|
[["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46]]
| 1
| 144
| 5
|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define INF 1000000000
#define mod 1000000007
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(), x.end()
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool debug = false;
int main() {
int a[4] = {0}, n;
string s;
while (cin >> n) {
getchar();
cin >> s;
if (s == "A")
a[0]++;
else if (s == "B")
a[1]++;
else if (s == "O")
a[2]++;
else if (s == "AB")
a[3]++;
}
rep(i, 4) cout << a[i] << endl;
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define INF 1000000000
#define mod 1000000007
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(), x.end()
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool debug = false;
int main() {
int a[4] = {0}, n;
string s;
while (cin >> n) {
getchar();
cin >> s;
if (s == "A")
a[0]++;
else if (s == "B")
a[1]++;
else if (s == "AB")
a[2]++;
else if (s == "O")
a[3]++;
}
rep(i, 4) cout << a[i] << endl;
return 0;
}
|
[["-", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6], ["+", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6]]
| 1
| 217
| 4
|
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
int main() {
int n, a = 0, b = 0, o = 0, ab = 0;
char g;
string x;
while (cin >> n >> g >> x) {
if (x == "A") {
a++;
} else if (x == "B") {
b++;
} else if (x == "O") {
o++;
} else if (x == "AB") {
ab++;
}
}
cout << a << endl << b << endl << o << endl << ab << endl;
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
int main() {
int n, a = 0, b = 0, o = 0, ab = 0;
char g;
string x;
while (cin >> n >> g >> x) {
if (x == "A") {
a++;
} else if (x == "B") {
b++;
} else if (x == "O") {
o++;
} else if (x == "AB") {
ab++;
}
}
cout << a << endl << b << endl << ab << endl << o << endl;
return 0;
}
|
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
| 1
| 133
| 4
|
#include <stdio.h>
int main() {
int n, ans[4] = {0, 0, 0, 0};
char a[10] = {'\0'};
while (scanf("%d,%s", &n, a) != EOF) {
if (a[0] == 'B')
ans[1]++;
if (a[0] == 'O')
ans[3]++;
if (a[0] == 'A') {
if (a[1] == 'B')
ans[2]++;
else
ans[0]++;
ans[1] = '\0';
}
}
for (int i = 0; i < 4; i++)
printf("%d\n", a[i]);
}
|
#include <stdio.h>
int main() {
int n, ans[4] = {0, 0, 0, 0};
char a[10] = {'\0'};
while (scanf("%d,%s", &n, a) != EOF) {
if (a[0] == 'B')
ans[1]++;
if (a[0] == 'O')
ans[3]++;
if (a[0] == 'A') {
if (a[1] == 'B')
ans[2]++;
else
ans[0]++;
a[1] = '\0';
}
}
for (int i = 0; i < 4; i++)
printf("%d\n", ans[i]);
}
|
[["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 8, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 8, 1, 0, 2, 3, 4, 0, 69, 28, 22]]
| 1
| 163
| 4
|
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n, A[4];
fill(A, A + 4, 0);
char b[10];
while (scanf("%d,%s ", &n, b) == 2) {
if (b[0] == 'A') {
if (b[1] == 'B') {
A[3]++;
} else {
A[0]++;
}
} else if (b[0] == 'B') {
A[1]++;
} else if (b[0] == 'O') {
A[2]++;
}
}
for (int i = 0; i < 4; i++) {
printf("%d\n", A[i]);
}
return 0;
}
|
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n, A[4];
fill(A, A + 4, 0);
char b[10];
while (scanf("%d,%s ", &n, b) == 2) {
if (b[0] == 'A') {
if (b[1] == 'B') {
A[2]++;
} else {
A[0]++;
}
} else if (b[0] == 'B') {
A[1]++;
} else if (b[0] == 'O') {
A[3]++;
}
}
for (int i = 0; i < 4; i++) {
printf("%d\n", A[i]);
}
return 0;
}
|
[["-", 0, 1, 0, 27, 28, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 13]]
| 1
| 170
| 4
|
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string s;
vector<int> count(4);
count[0] = 0;
count[1] = 0;
count[2] = 0;
count[3] = 0;
while (cin >> s) {
string::size_type comma = s.find(",");
string bloodtype = s.substr(comma + 1);
if (bloodtype == "A") {
count[0]++;
}
if (bloodtype == "B") {
count[1]++;
}
if (bloodtype == "O") {
count[2]++;
}
if (bloodtype == "AB") {
count[3]++;
}
}
for (int i = 0; i < 4; i++) {
cout << count[i] << endl;
}
return 0;
}
|
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string s;
vector<int> count(4);
count[0] = 0;
count[1] = 0;
count[2] = 0;
count[3] = 0;
while (cin >> s) {
string::size_type comma = s.find(",");
string bloodtype = s.substr(comma + 1);
if (bloodtype == "A") {
count[0]++;
}
if (bloodtype == "B") {
count[1]++;
}
if (bloodtype == "AB") {
count[2]++;
}
if (bloodtype == "O") {
count[3]++;
}
}
for (int i = 0; i < 4; i++) {
cout << count[i] << endl;
}
return 0;
}
|
[["-", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6], ["+", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6]]
| 1
| 182
| 4
|
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int num;
string blood;
char row[1000];
map<string, int> type;
type.insert(make_pair("A", 0));
type.insert(make_pair("B", 0));
type.insert(make_pair("O", 0));
type.insert(make_pair("AB", 0));
while (cin >> row) {
if (cin.eof())
break;
sscanf(row, "%d,%s", &num, &blood);
type[blood]++;
}
cout << type["A"] << endl;
cout << type["B"] << endl;
cout << type["AB"] << endl;
cout << type["O"] << endl;
return 0;
}
|
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int num;
char blood[100];
char row[1000];
map<string, int> type;
type.insert(make_pair("A", 0));
type.insert(make_pair("B", 0));
type.insert(make_pair("O", 0));
type.insert(make_pair("AB", 0));
while (cin >> row) {
if (cin.eof())
break;
sscanf(row, "%d,%s", &num, &blood);
type[blood]++;
}
cout << type["A"] << endl;
cout << type["B"] << endl;
cout << type["AB"] << endl;
cout << type["O"] << endl;
return 0;
}
|
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 0, 70], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 0, 73]]
| 1
| 180
| 5
|
#include <iostream>
#include <string>
using namespace std;
int main() {
int h, at = 0, bt = 0, ot = 0, abt = 0;
char c;
string b;
while (cin >> h >> c >> b) {
if (b == "A")
at++;
if (b == "B")
bt++;
if (b == "O")
ot++;
if (b == "AB")
abt++;
}
cout << at << endl << bt << endl << ot << endl << abt << endl;
return 0;
}
|
#include <iostream>
#include <string>
using namespace std;
int main() {
int h, at = 0, bt = 0, ot = 0, abt = 0;
char c;
string b;
while (cin >> h >> c >> b) {
if (b == "A")
at++;
if (b == "B")
bt++;
if (b == "O")
ot++;
if (b == "AB")
abt++;
}
cout << at << endl << bt << endl << abt << endl << ot << endl;
return 0;
}
|
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
| 1
| 116
| 4
|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef pair<int, int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int main() {
int a = 0, b = 0, o = 0, ab = 0, tmp;
char str[3];
while (scanf("%d,%s", &tmp, str) != EOF) {
if (str[0] == 'A' && str[1] == 'B')
ab++;
else if (str[0] == 'B')
b++;
else if (str[0] == 'O')
o++;
else if (str[0] == 'A')
a++;
}
cout << a << endl;
cout << b << endl;
cout << o << endl;
cout << ab << endl;
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef pair<int, int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int main() {
int a = 0, b = 0, o = 0, ab = 0, tmp;
char str[3];
while (scanf("%d,%s", &tmp, str) != EOF) {
if (str[0] == 'A' && str[1] == 'B')
ab++;
else if (str[0] == 'B')
b++;
else if (str[0] == 'O')
o++;
else if (str[0] == 'A')
a++;
}
cout << a << endl;
cout << b << endl;
cout << ab << endl;
cout << o << endl;
return 0;
}
|
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
| 1
| 198
| 4
|
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
char blood[2];
int n, type_num[4];
string type[4] = {"A", "B", "C", "AB"};
for (int i = 0; i < 4; i++)
type_num[i] = 0;
while (~scanf("%d,%s ", &n, blood)) {
for (int i = 0; i < 4; i++) {
if (blood == type[i])
type_num[i]++;
}
}
for (int i = 0; i < 4; i++) {
cout << type_num[i] << endl;
}
return 0;
}
|
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
char blood[2];
int n, type_num[4];
string type[5] = {"A", "B", "AB", "O"};
for (int i = 0; i < 4; i++)
type_num[i] = 0;
while (~scanf("%d,%s ", &n, blood)) {
for (int i = 0; i < 4; i++) {
if (blood == type[i])
type_num[i]++;
}
}
for (int i = 0; i < 4; i++) {
cout << type_num[i] << endl;
}
return 0;
}
|
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
| 1
| 149
| 6
|
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int no;
char delim;
string blood;
int A = 0, B = 0, AB = 0, O = 0;
while (cin >> no >> delim >> blood) {
if (blood == "A")
A++;
else if (blood == "B")
A++;
else if (blood == "AB")
AB++;
else if (blood == "O")
O++;
}
cout << A << endl << B << endl << AB << endl << O << endl;
return 0;
}
|
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int no;
char delim;
string blood;
int A = 0, B = 0, AB = 0, O = 0;
while (cin >> no >> delim >> blood) {
if (blood == "A")
A++;
else if (blood == "B")
B++;
else if (blood == "AB")
AB++;
else if (blood == "O")
O++;
}
cout << A << endl << B << endl << AB << endl << O << endl;
return 0;
}
|
[["-", 75, 76, 0, 57, 64, 1, 0, 27, 28, 22], ["+", 75, 76, 0, 57, 64, 1, 0, 27, 28, 22]]
| 1
| 120
| 2
|
// include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
// conversion
//------------------------------------------
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }
// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
// clear memory
#define CLR(a) memset((a), 0, sizeof(a))
// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
int main() {
int n;
map<string, int> blood;
string str;
char c;
blood.insert(map<string, int>::value_type("A", 0));
blood.insert(map<string, int>::value_type("B", 0));
blood.insert(map<string, int>::value_type("O", 0));
blood.insert(map<string, int>::value_type("AB", 0));
while (cin >> n >> c >> str) {
blood[str]++;
}
cout << blood["A"] << endl;
cout << blood["B"] << endl;
cout << blood["O"] << endl;
cout << blood["AB"] << endl;
}
|
// include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
// conversion
//------------------------------------------
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }
// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
// clear memory
#define CLR(a) memset((a), 0, sizeof(a))
// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
int main() {
int n;
map<string, int> blood;
string str;
char c;
blood.insert(map<string, int>::value_type("A", 0));
blood.insert(map<string, int>::value_type("B", 0));
blood.insert(map<string, int>::value_type("AB", 0));
blood.insert(map<string, int>::value_type("O", 0));
while (cin >> n >> c >> str) {
blood[str]++;
}
cout << blood["A"] << endl;
cout << blood["B"] << endl;
cout << blood["AB"] << endl;
cout << blood["O"] << endl;
}
|
[["-", 3, 4, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 3, 4, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 31, 16, 12, 69, 341, 342, 0, 5, 0, 6], ["+", 31, 16, 12, 69, 341, 342, 0, 5, 0, 6]]
| 1
| 443
| 8
|
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
a = 0; b = 0; o = 0; ab = 0;
while s = gets
btype = (s.chomp.split(','))[1]
if btype == "A"
a += 1
elsif btype == "B"
b += 1
elsif btype == "O"
o += 1
else
ab += 1
end
end
puts a
puts b
puts o
puts ab
|
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
a = 0; b = 0; o = 0; ab = 0;
while s = gets
btype = (s.chomp.split(','))[1]
if btype == "A"
a += 1
elsif btype == "B"
b += 1
elsif btype == "O"
o += 1
else
ab += 1
end
end
puts a
puts b
puts ab
puts o
|
[["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22], ["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]]
| 4
| 80
| 4
|
r = {"A" => 0, "B" => 0, "AB" => 0, "O" => 0}
while a = gets.chomp
r[a.split(",")[1]] += 1
end
r.each_value{ |i|
puts i
}
|
r = {"A" => 0, "B" => 0, "AB" => 0, "O" => 0}
begin
while a = gets.chomp
r[a.split(",")[1]] += 1
end
rescue
end
r.each_value{ |i|
puts i
}
|
[["+", 36, 36, 36, 36, 0, 493, 0, 756, 0, 756], ["+", 0, 493, 0, 756, 0, 89, 8, 170, 0, 444], ["+", 36, 36, 0, 493, 0, 756, 0, 764, 0, 764]]
| 4
| 60
| 4
|
r = {"A" => 0, "B" => 0, "AB" => 0, "O" => 0}
while a = gets.chomp
r[a.split(",")[1]] += 1
end
r.each_value{ |i|
puts i
}
|
r = {"A" => 0, "B" => 0, "AB" => 0, "O" => 0}
while a = gets
r[a.chomp.split(",")[1]] += 1
end
r.each_value{ |i|
puts i
}
|
[["-", 0, 493, 0, 89, 15, 662, 12, 652, 17, 131], ["-", 0, 493, 0, 89, 15, 662, 12, 652, 735, 22], ["+", 31, 742, 0, 742, 500, 652, 486, 652, 17, 131], ["+", 31, 742, 0, 742, 500, 652, 486, 652, 735, 22]]
| 4
| 60
| 4
|
blood_count = {"A"=>0, "B"=>0, "AB"=>0, "O"=>0}
while input_data = gets
blood_type = input_data.chomp.split(',')
p blood_type
blood_count[blood_type[1]] += 1
end
blood_types = ["A", "B", "AB", "O"]
blood_types.each { |blood|
puts blood_count[blood]
}
|
blood_count = {"A"=>0, "B"=>0, "AB"=>0, "O"=>0}
while input_data = gets
blood_type = input_data.chomp.split(',')
blood_count[blood_type[1]] += 1
end
blood_types = ["A", "B", "AB", "O"]
blood_types.each { |blood|
puts blood_count[blood]
}
|
[["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22], ["-", 0, 89, 8, 170, 0, 652, 3, 4, 0, 22]]
| 4
| 87
| 2
|
from sys import *
lis = {"A":0,"B":0,"O":0,"AB":0}
for s in stdin:
n,t = list(map(str,s[:-1].split(",")))
lis[t] += 1
print(lis["A"])
print(lis["B"])
print(lis["O"])
print(lis["AB"])
|
from sys import *
lis = {"A":0,"B":0,"O":0,"AB":0}
for s in stdin:
n,t = list(map(str,s[:-1].split(",")))
lis[t] += 1
print(lis["A"])
print(lis["B"])
print(lis["AB"])
print(lis["O"])
|
[["-", 0, 652, 3, 4, 0, 206, 206, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 206, 206, 557, 0, 6]]
| 5
| 103
| 4
|
l=[0]*4
while True:
try:
a,b=list(map(int,input().split(",")))
if b=="A":
l[0]+=1
elif b=="B":
l[1]+=1
elif b=="AB":
l[2]+=1
else:
l[3]+=1
except:
break
for i in l:
print(i)
|
l=[0]*4
while True:
try:
a,b=list(map(str,input().split(",")))
if b=="A":
l[0]+=1
elif b=="B":
l[1]+=1
elif b=="AB":
l[2]+=1
else:
l[3]+=1
except:
break
for i in l:
print(i)
|
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
| 5
| 93
| 2
|
ac = bc = oc = abc = 0
while 1:
try: n, bt = input().split(",")
except: break
if bt == "A": ac += 1
elif bt == "B": bc += 1
elif bt == "O": oc += 1
elif bt == "AB": abc +=1
print(ac)
print(bc)
print(oc)
print(abc)
|
ac = bc = oc = abc = 0
while 1:
try: n, bt = input().split(",")
except: break
if bt == "A": ac += 1
elif bt == "B": bc += 1
elif bt == "O": oc += 1
elif bt == "AB": abc +=1
print(ac)
print(bc)
print(abc)
print(oc)
|
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
| 5
| 87
| 4
|
blood = []
while True:
try:
x = list(map(int,input().split(',')))
blood.append(x[1])
except: break
print(blood.count('A'))
print(blood.count('B'))
print(blood.count('AB'))
print(blood.count('O'))
|
blood = []
while True:
try:
x = list(map(str,input().split(',')))
blood.append(x[1])
continue
except: break
print(blood.count('A'))
print(blood.count('B'))
print(blood.count('AB'))
print(blood.count('O'))
|
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 246, 8, 196, 0, 116, 0, 117]]
| 5
| 85
| 3
|
#include <iostream>
#include <string.h>
#include <string>
using namespace std;
int main(void) {
double weight[] = {48, 51, 54, 57, 60, 64, 69, 75, 81, 91};
double n;
string name[11] = {"lght fly", "fly", "bantam", "feather",
"light", "light welter", "welter", "light middle",
"middle", "light heavy", "heavy"};
while (scanf("%lf", &n) != EOF) {
if (n <= weight[0]) {
cout << name[0] << endl;
} else if (weight[9] < n) {
cout << name[10] << endl;
} else {
for (int i = 0; i < sizeof(weight) - 1; i++) {
if (weight[i] < n && n <= weight[i + 1]) {
cout << name[i + 1] << endl;
break;
}
}
}
}
}
|
#include <iostream>
#include <string.h>
#include <string>
using namespace std;
int main(void) {
double weight[] = {48, 51, 54, 57, 60, 64, 69, 75, 81, 91};
double n;
string name[11] = {"light fly", "fly", "bantam", "feather",
"light", "light welter", "welter", "light middle",
"middle", "light heavy", "heavy"};
while (scanf("%lf", &n) != EOF) {
if (n <= weight[0]) {
cout << name[0] << endl;
} else if (weight[9] < n) {
cout << name[10] << endl;
} else {
for (int i = 0; i < sizeof(weight) - 1; i++) {
if (weight[i] < n && n <= weight[i + 1]) {
cout << name[i + 1] << endl;
break;
}
}
}
}
}
|
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
| 1
| 213
| 2
|
#include <iostream>
using namespace std;
int main() {
double n;
while (cin >> n) {
if (n > 91)
cout << "heavy" << endl;
else if (n > 81)
cout << "light heavy" << endl;
else if (n > 75)
cout << "middle" << endl;
else if (n > 69)
cout << "light middle" << endl;
else if (n > 64)
cout << "welter" << endl;
else if (n > 60)
cout << "light welter" << endl;
else if (n > 57)
cout << "light" << endl;
else if (n > 54)
cout << "feather" << endl;
else if (n > 51)
cout << "dantam" << endl;
else if (n > 48)
cout << "fly" << endl;
else
cout << "light fly" << endl;
}
}
|
#include <iostream>
using namespace std;
int main() {
double n;
while (cin >> n) {
if (n > 91)
cout << "heavy" << endl;
else if (n > 81)
cout << "light heavy" << endl;
else if (n > 75)
cout << "middle" << endl;
else if (n > 69)
cout << "light middle" << endl;
else if (n > 64)
cout << "welter" << endl;
else if (n > 60)
cout << "light welter" << endl;
else if (n > 57)
cout << "light" << endl;
else if (n > 54)
cout << "feather" << endl;
else if (n > 51)
cout << "bantam" << endl;
else if (n > 48)
cout << "fly" << endl;
else
cout << "light fly" << endl;
}
}
|
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
| 1
| 181
| 2
|
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
double r;
while (cin >> r) {
if (r <= 48.00) {
cout << "light fly" << endl;
} else if (r <= 51.00) {
cout << "fly" << endl;
} else if (r <= 54.00) {
cout << "bantam" << endl;
} else if (r <= 57.00) {
cout << "feather" << endl;
} else if (r <= 60.00) {
cout << "light" << endl;
} else if (r <= 64.00) {
cout << "light welter" << endl;
} else if (r <= 69.00) {
cout << "welter" << endl;
} else if (r <= 75.00) {
cout << "light middle" << endl;
} else if (r <= 81.00) {
cout << "middle" << endl;
} else if (r <= 91.00) {
cout << "light heaby" << endl;
} else {
cout << "heaby" << endl;
}
}
}
|
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
double r;
while (cin >> r) {
if (r <= 48.00) {
cout << "light fly" << endl;
} else if (r <= 51.00) {
cout << "fly" << endl;
} else if (r <= 54.00) {
cout << "bantam" << endl;
} else if (r <= 57.00) {
cout << "feather" << endl;
} else if (r <= 60.00) {
cout << "light" << endl;
} else if (r <= 64.00) {
cout << "light welter" << endl;
} else if (r <= 69.00) {
cout << "welter" << endl;
} else if (r <= 75.00) {
cout << "light middle" << endl;
} else if (r <= 81.00) {
cout << "middle" << endl;
} else if (r <= 91.00) {
cout << "light heavy" << endl;
} else {
cout << "heavy" << endl;
}
}
}
|
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
| 1
| 205
| 4
|
#include <iostream>
using namespace std;
int main() {
double h;
while (cin >> h) {
if (h <= 48.000)
cout << "light fly" << endl;
else if (h <= 51.000)
cout << "fly" << endl;
else if (h <= 54.000)
cout << "bantam" << endl;
else if (h <= 57.000)
cout << "feather" << endl;
else if (h <= 60.000)
cout << "light" << endl;
else if (h <= 64.000)
cout << "light welter" << endl;
else if (h <= 69.000)
cout << "welter" << endl;
else if (h <= 75.000)
cout << "light middle" << endl;
else if (h <= 81.000)
cout << "middle" << endl;
else if (h <= 91.000)
cout << "light haeny" << endl;
else if (h > 91.000)
cout << "haeny" << endl;
}
return 0;
}
|
#include <iostream>
using namespace std;
int main() {
double h;
while (cin >> h) {
if (h <= 48.000)
cout << "light fly" << endl;
else if (h <= 51.000)
cout << "fly" << endl;
else if (h <= 54.000)
cout << "bantam" << endl;
else if (h <= 57.000)
cout << "feather" << endl;
else if (h <= 60.000)
cout << "light" << endl;
else if (h <= 64.000)
cout << "light welter" << endl;
else if (h <= 69.000)
cout << "welter" << endl;
else if (h <= 75.000)
cout << "light middle" << endl;
else if (h <= 81.000)
cout << "middle" << endl;
else if (h <= 91.000)
cout << "light heavy" << endl;
else if (h > 91.000)
cout << "heavy" << endl;
}
return 0;
}
|
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
| 1
| 190
| 4
|
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
string s[11] = {"light fly", "fly", "bantam", "feather",
"light", "light welther", "welter", "light middle",
"middle", "light heavy", "heavy"};
double b[11] = {48, 51, 54, 57, 60, 64, 69, 75, 81, 91, 1e100};
int main() {
double w;
while (cin >> w)
cout << s[lower_bound(b, b + 11, w) - b] << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
string s[11] = {"light fly", "fly", "bantam", "feather",
"light", "light welter", "welter", "light middle",
"middle", "light heavy", "heavy"};
double b[11] = {48, 51, 54, 57, 60, 64, 69, 75, 81, 91, 1e100};
int main() {
double w;
while (cin >> w)
cout << s[lower_bound(b, b + 11, w) - b] << endl;
return 0;
}
|
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
| 1
| 130
| 2
|
#include <iostream>
using namespace std;
const char *str[] = {"light fly", "fly", "bantam", "feather",
"light", "light welter", "welter", "light middle",
"middle", "light heavy", "heavy"};
const double n[] = {48, 51, 54, 57, 60, 64, 69, 75, 81, 91};
#define REP(i, n) REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)
#define ESIZEOF(A) (sizeof(A) / sizeof((A)[0]))
int main() {
double d;
while (cin >> d) {
REP(i, ESIZEOF(n)) {
if (d <= n[i]) {
cout << str[i] << endl;
break;
}
}
}
return 0;
}
|
#include <iostream>
using namespace std;
const char *str[] = {"light fly", "fly", "bantam", "feather",
"light", "light welter", "welter", "light middle",
"middle", "light heavy", "heavy"};
const double n[] = {48, 51, 54, 57, 60, 64, 69, 75, 81, 91, 1e9};
#define REP(i, n) REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)
#define ESIZEOF(A) (sizeof(A) / sizeof((A)[0]))
int main() {
double d;
while (cin >> d) {
REP(i, ESIZEOF(n)) {
if (d <= n[i]) {
cout << str[i] << endl;
break;
}
}
}
return 0;
}
|
[["+", 0, 30, 0, 43, 49, 50, 51, 83, 0, 21], ["+", 0, 30, 0, 43, 49, 50, 51, 83, 0, 13]]
| 1
| 164
| 2
|
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double glam;
while (cin >> glam) {
if (glam < 48.0)
cout << "light fly" << endl;
else if (glam > 48.0 && glam <= 51.0)
cout << "fly" << endl;
else if (glam > 51.0 && glam <= 54.0)
cout << "bantam" << endl;
else if (glam > 54.0 && glam <= 57.0)
cout << "feather" << endl;
else if (glam > 57.0 && glam <= 60.0)
cout << "light" << endl;
else if (glam > 60.0 && glam <= 64.0)
cout << "light welter" << endl;
else if (glam > 64.0 && glam <= 69.0)
cout << "welter" << endl;
else if (glam > 69.0 && glam <= 75.0)
cout << "light middle" << endl;
else if (glam > 75.0 && glam <= 81.0)
cout << "middle" << endl;
else if (glam > 81.0 && glam <= 91.0)
cout << "light heavy" << endl;
else
cout << "heavy" << endl;
}
}
|
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double glam;
while (cin >> glam) {
if (glam <= 48.0)
cout << "light fly" << endl;
else if (glam > 48.0 && glam <= 51.0)
cout << "fly" << endl;
else if (glam > 51.0 && glam <= 54.0)
cout << "bantam" << endl;
else if (glam > 54.0 && glam <= 57.0)
cout << "feather" << endl;
else if (glam > 57.0 && glam <= 60.0)
cout << "light" << endl;
else if (glam > 60.0 && glam <= 64.0)
cout << "light welter" << endl;
else if (glam > 64.0 && glam <= 69.0)
cout << "welter" << endl;
else if (glam > 69.0 && glam <= 75.0)
cout << "light middle" << endl;
else if (glam > 75.0 && glam <= 81.0)
cout << "middle" << endl;
else if (glam > 81.0 && glam <= 91.0)
cout << "light heavy" << endl;
else
cout << "heavy" << endl;
}
}
|
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
| 1
| 219
| 2
|
#include <stdio.h>
void func(float);
int main(void) {
float tai;
while (scanf("%f", &tai) != EOF) {
func(tai);
}
return 0;
}
void func(float tai) {
float lim[10] = {48.0, 51.0, 54.0, 57.0, 60.0, 64.0, 69.0, 75.0, 81.0, 91.0};
char kai[11][13] = {"light fly", "fly", "bantam", "frather",
"light", "light welter", "welter", "light",
"middle", "light heavy", "heavy"};
int i;
for (i = 0; i < 10; i++) {
if (lim[i] >= tai) {
break;
}
}
printf("%s\n", kai[i]);
}
|
#include <stdio.h>
void func(float);
int main(void) {
float tai;
while (scanf("%f", &tai) != EOF) {
func(tai);
}
return 0;
}
void func(float tai) {
float lim[10] = {48.0, 51.0, 54.0, 57.0, 60.0, 64.0, 69.0, 75.0, 81.0, 91.0};
char kai[11][13] = {"light fly", "fly", "bantam", "feather",
"light", "light welter", "welter", "light middle",
"middle", "light heavy", "heavy"};
int i;
for (i = 0; i < 10; i++) {
if (lim[i] >= tai) {
break;
}
}
printf("%s\n", kai[i]);
}
|
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
| 1
| 177
| 4
|
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
int main() {
double n;
while (scanf("%lf", &n) != EOF) {
if (n <= 48.00)
printf("light fly\n");
else if (48.00 < n && n <= 51.00)
printf("fly\n");
else if (51.00 < n && n <= 54.00)
printf("bantam\n");
else if (54.00 < n && n <= 57.00)
printf("feather\n");
else if (57.00 < n && n <= 60.00)
printf("light\n");
else if (60.00 < n && n <= 64.00)
printf("light welter\n");
else if (64.00 < n && n <= 69.00)
printf("welter\n");
else if (69.00 < n && n <= 75.00)
printf("light middle\n");
else if (75.00 < n && n <= 81.00)
printf("middle\n");
else if (81.00 < n && n <= 91.00)
printf("light heavy\n");
else if (n < 91.00)
printf("heavy\n");
}
return 0;
}
|
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
int main() {
double n;
while (scanf("%lf", &n) != EOF) {
if (n <= 48.00)
printf("light fly\n");
else if (48.00 < n && n <= 51.00)
printf("fly\n");
else if (51.00 < n && n <= 54.00)
printf("bantam\n");
else if (54.00 < n && n <= 57.00)
printf("feather\n");
else if (57.00 < n && n <= 60.00)
printf("light\n");
else if (60.00 < n && n <= 64.00)
printf("light welter\n");
else if (64.00 < n && n <= 69.00)
printf("welter\n");
else if (69.00 < n && n <= 75.00)
printf("light middle\n");
else if (75.00 < n && n <= 81.00)
printf("middle\n");
else if (81.00 < n && n <= 91.00)
printf("light heavy\n");
else if (91.00 < n)
printf("heavy\n");
}
return 0;
}
|
[["-", 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]]
| 1
| 236
| 4
|
#include <iostream>
#include <string>
using namespace std;
const string cls[] = {"",
"light fly",
"fly",
"bantam",
"feather",
"light",
"light welter",
"welter",
"light middle",
"middle",
"light heavy",
"heavy"};
const int a[] = {-100, 48, 51, 54, 57, 60, 64, 69, 75, 81, 91};
int main() {
double w;
while (cin >> w) {
int i = 0;
while (w > a[i])
i++;
cout << cls[i] << endl;
}
}
|
#include <iostream>
#include <string>
using namespace std;
const string cls[] = {"",
"light fly",
"fly",
"bantam",
"feather",
"light",
"light welter",
"welter",
"light middle",
"middle",
"light heavy",
"heavy"};
const int a[] = {-100, 48, 51, 54, 57, 60, 64, 69, 75, 81, 91, 100000000};
int main() {
double w;
while (cin >> w) {
int i = 0;
while (w > a[i])
i++;
cout << cls[i] << endl;
}
}
|
[["+", 0, 30, 0, 43, 49, 50, 51, 83, 0, 21], ["+", 0, 30, 0, 43, 49, 50, 51, 83, 0, 13]]
| 1
| 136
| 2
|
#include <iostream>
using namespace std;
int main() {
char clsnam[11][20] = {"light fly", "fly", "bantam", "feather",
"light", "light welter", "welter", "light middle",
"middle", "light heavy", "heavy"};
double CLASS[10] = {48.00, 51.00, 54.00, 57.00, 60.00,
64.00, 69.00, 75.00, 81.00, 91.00};
double get;
while (cin >> get) {
for (int i = 9; i >= 0; i--) {
if (get <= CLASS[i]) {
if (i == 0) {
cout << clsnam[0];
}
} else {
cout << clsnam[i + 1] << endl;
break;
}
}
}
return 0;
}
|
#include <iostream>
using namespace std;
int main() {
char clsnam[11][20] = {"light fly", "fly", "bantam", "feather",
"light", "light welter", "welter", "light middle",
"middle", "light heavy", "heavy"};
double CLASS[10] = {48.00, 51.00, 54.00, 57.00, 60.00,
64.00, 69.00, 75.00, 81.00, 91.00};
double get;
while (cin >> get) {
for (int i = 9; i >= 0; i--) {
if (get <= CLASS[i]) {
if (i == 0) {
cout << clsnam[0] << endl;
}
} else {
cout << clsnam[i + 1] << endl;
break;
}
}
}
return 0;
}
|
[["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
| 1
| 167
| 2
|
classes = %w(light_fly fly bantam feather light light_welter welter light_middle mddle light_heavy heavy)
upper_bound = [48,51,54,57,60,64,69,75,81,91, Float::INFINITY]
puts $<.map {|s|
classes[upper_bound.index{|ub| s.to_f <= ub}].sub(?_, ' ')
}
|
classes = %w(light_fly fly bantam feather light light_welter welter light_middle middle light_heavy heavy)
upper_bound = [48,51,54,57,60,64,69,75,81,91, Float::INFINITY]
puts $<.map {|s|
classes[upper_bound.index{|ub| s.to_f <= ub}].sub(?_, ' ')
}
|
[["-", 0, 493, 0, 662, 12, 765, 0, 766, 0, 6], ["+", 0, 493, 0, 662, 12, 765, 0, 766, 0, 6]]
| 4
| 76
| 2
|
def result(w)
r = ""
if w <= 48.0 then r = "light fly"
elsif w <= 51.0 then r = "fly"
elsif w <= 54.0 then r = "bandam"
elsif w <= 57.0 then r = "feather"
elsif w <= 60.0 then r = "light"
elsif w <= 64.0 then r = "light welter"
elsif w <= 69.0 then r = "welter"
elsif w <= 75.0 then r = "light middle"
elsif w <= 81.0 then r = "middle"
elsif w <= 91.0 then r = "light heavy"
else r = "heavy"
end
r
end
while line = gets do
w = line.chop.to_f
puts result(w)
end
|
def result(w)
r = ""
if w <= 48.0 then r = "light fly"
elsif w <= 51.0 then r = "fly"
elsif w <= 54.0 then r = "bantam"
elsif w <= 57.0 then r = "feather"
elsif w <= 60.0 then r = "light"
elsif w <= 64.0 then r = "light welter"
elsif w <= 69.0 then r = "welter"
elsif w <= 75.0 then r = "light middle"
elsif w <= 81.0 then r = "middle"
elsif w <= 91.0 then r = "light heavy"
else r = "heavy"
end
r
end
while line = gets do
w = line.chop.to_f
puts result(w)
end
|
[["-", 75, 759, 64, 749, 0, 662, 12, 557, 0, 6], ["+", 75, 759, 64, 749, 0, 662, 12, 557, 0, 6]]
| 4
| 136
| 2
|
C = {
48 => 'light fly',
51 => 'fly',
54 => 'bandam',
57 => 'feather',
60 => 'light',
64 => 'light welter',
69 => 'welter',
75 => 'light middle',
81 => 'middle',
91 => 'light heavy',
9999 => 'heavy'
}
while s = gets
w = s.to_f
n = nil
C.sort.each { |k, v|
if w <= k
n = v
break
end
}
n = C[9999] if n.nil?
puts n
end
|
C = {
48 => 'light fly',
51 => 'fly',
54 => 'bantam',
57 => 'feather',
60 => 'light',
64 => 'light welter',
69 => 'welter',
75 => 'light middle',
81 => 'middle',
91 => 'light heavy',
9999 => 'heavy'
}
while s = gets
w = s.to_f
n = nil
C.sort.each { |k, v|
if w <= k
n = v
break
end
}
n = C[9999] if n.nil?
puts n
end
|
[["-", 0, 662, 12, 767, 0, 569, 51, 557, 0, 6], ["+", 0, 662, 12, 767, 0, 569, 51, 557, 0, 6]]
| 4
| 115
| 2
|
while input = gets;
break if input == nil
weight = input.to_f
if weight <= 48.0 then
print "lighy fly\n"
elsif weight > 48.0 && weight <= 51.0 then
print "fly\n"
elsif weight > 51.0 && weight <= 54.0 then
print "bantam\n"
elsif weight > 54.0 && weight <= 57.0 then
print "feather\n"
elsif weight > 57.0 && weight <= 60.0 then
print "light\n"
elsif weight > 60.0 && weight <= 64.0 then
print "light welter\n"
elsif weight > 64.0 && weight <= 69.0 then
print "welter\n"
elsif weight > 69.0 && weight <= 75.0 then
print "light middle\n"
elsif weight > 75.0 && weight <= 81.0 then
print "middle\n"
elsif weight > 81.0 && weight <= 91.0 then
print "light heavy\n"
else
print "heavy\n"
end
end
|
while input = gets;
break if input == nil
weight = input.to_f
if weight <= 48.0 then
print "light fly\n"
elsif weight > 48.0 && weight <= 51.0 then
print "fly\n"
elsif weight > 51.0 && weight <= 54.0 then
print "bantam\n"
elsif weight > 54.0 && weight <= 57.0 then
print "feather\n"
elsif weight > 57.0 && weight <= 60.0 then
print "light\n"
elsif weight > 60.0 && weight <= 64.0 then
print "light welter\n"
elsif weight > 64.0 && weight <= 69.0 then
print "welter\n"
elsif weight > 69.0 && weight <= 75.0 then
print "light middle\n"
elsif weight > 75.0 && weight <= 81.0 then
print "middle\n"
elsif weight > 81.0 && weight <= 91.0 then
print "light heavy\n"
else
print "heavy\n"
end
end
|
[["-", 64, 749, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 64, 749, 0, 652, 3, 4, 0, 557, 0, 6]]
| 4
| 159
| 2
|
import sys
f = sys.stdin
classes = {'light fly':(00.00, 48.00),
'fly':(48.00, 51.00),
'bantam':(51.00, 54.00),
'feather':(54.00,57.00),
'light':(57.00,60.00),
'light welter':(60.00,64.00),
'welter':(64.00,69.00),
'light middle':(69.00,75.00),
'middle':(75.00,81.00),
'light heavy':(81.00,91.00),
'heavy':(91.00,1000.00)}
for line in f:
weight = float(line)
for class_name, weights in classes.items():
if weights[0] <= weight < weights[1]:
print(class_name)
break
|
import sys
f = sys.stdin
classes = {'light fly':(00.00, 48.00),
'fly':(48.00, 51.00),
'bantam':(51.00, 54.00),
'feather':(54.00,57.00),
'light':(57.00,60.00),
'light welter':(60.00,64.00),
'welter':(64.00,69.00),
'light middle':(69.00,75.00),
'middle':(75.00,81.00),
'light heavy':(81.00,91.00),
'heavy':(91.00,1000.00)}
for line in f:
weight = float(line)
for class_name, weights in classes.items():
if weights[0] < weight <= weights[1]:
print(class_name)
break
|
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
| 5
| 160
| 4
|
# -*- coding: utf-8 -*-
import sys
for line in sys.stdin:
w = float(line)
if w <= 48.00:
print("light fly")
elif w <= 51.00:
print("fly")
elif w <= 54.00:
print("bantam")
elif w <= 57.00:
print("feather")
elif w <= 60.00:
print("light")
elif w <= 64.00:
print("light welterr")
elif w <= 69.00:
print("welter")
elif w <= 75.00:
print("light middle")
elif w <= 81.00:
print("middle")
elif w <= 91.00:
print("light heavy")
else:
print("heavy")
|
# -*- coding: utf-8 -*-
import sys
for line in sys.stdin:
w = float(line)
if w <= 48.00:
print("light fly")
elif w <= 51.00:
print("fly")
elif w <= 54.00:
print("bantam")
elif w <= 57.00:
print("feather")
elif w <= 60.00:
print("light")
elif w <= 64.00:
print("light welter")
elif w <= 69.00:
print("welter")
elif w <= 75.00:
print("light middle")
elif w <= 81.00:
print("middle")
elif w <= 91.00:
print("light heavy")
else:
print("heavy")
|
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
| 5
| 134
| 2
|
import sys
for e in sys.stdin:
e=float(e)
h=['light ','']
a=h[e>91]+'heavy'if e>81 else h[e>75]+'middle'if e>69 else h[e>64]+'welter'if e>60 else'light'if e>57 else'feather'if e>51 else'bantam'if e>51 else h[e>48]+'fly'
print(a)
|
import sys
for e in sys.stdin:
e=float(e)
h=['light ','']
a=h[e>91]+'heavy'if e>81 else h[e>75]+'middle'if e>69 else h[e>64]+'welter'if e>60 else'light'if e>57 else'feather'if e>54 else'bantam'if e>51 else h[e>48]+'fly'
print(a)
|
[["-", 0, 41, 0, 41, 0, 41, 0, 666, 0, 612], ["+", 0, 41, 0, 41, 0, 41, 0, 666, 0, 612]]
| 5
| 110
| 2
|
import bisect
w = [48, 51, 54, 57, 60, 64, 69, 75, 81, 91]
c = ["light fly", "fly", "bantam", "feather", "feather", "light welter", "welter", "light middle", "middle", "light heavy", "heavy"]
while 1:
try:print(c[bisect.bisect_left(w,float(input()))])
except:break
|
import bisect
w = [48, 51, 54, 57, 60, 64, 69, 75, 81, 91]
c = ["light fly", "fly", "bantam", "feather", "light", "light welter", "welter", "light middle", "middle", "light heavy", "heavy"]
while 1:
try:print(c[bisect.bisect_left(w,float(input()))])
except:break
|
[["-", 0, 1, 0, 662, 12, 634, 0, 557, 0, 6], ["+", 0, 1, 0, 662, 12, 634, 0, 557, 0, 6]]
| 5
| 99
| 2
|
import sys
WEIGHT=[91.0, 81.0, 75.0, 69.0, 64.0, 60.0, 57.0, 54.0, 51.0, 48.0,-1]
GRADE=['heavy', 'light heavy', 'middle', 'light', 'welter', 'light welter', 'light', 'feather', 'bantam', 'fly', 'light fly']
for line in sys.stdin.readlines():
weight=float(line.strip())
for i in range(len(GRADE)):
if weight>WEIGHT[i]:
print(GRADE[i])
break
|
import sys
WEIGHT=[91.0, 81.0, 75.0, 69.0, 64.0, 60.0, 57.0, 54.0, 51.0, 48.0,-1]
GRADE=['heavy', 'light heavy', 'middle', 'light middle', 'welter', 'light welter', 'light', 'feather', 'bantam', 'fly', 'light fly']
for line in sys.stdin.readlines():
weight=float(line.strip())
for i in range(len(GRADE)):
if weight>WEIGHT[i]:
print(GRADE[i])
break
|
[["-", 0, 1, 0, 662, 12, 634, 0, 557, 0, 6], ["+", 0, 1, 0, 662, 12, 634, 0, 557, 0, 6]]
| 5
| 123
| 2
|
def jug(a):
if a <= 48.0:
print("light fly")
elif a <= 51.0:
print("fly")
elif a <= 45.0:
print("bantam")
elif a <= 57.0:
print("feather")
elif a <= 60.0:
print("light")
elif a <= 64.0:
print("light welter")
elif a <= 69.0:
print('welter')
elif a <= 75.0:
print("light middle")
elif a <= 81.0:
print("middle")
elif a <= 91.0:
print("light heavy")
else:
print("heavy")
while True:
try:
a = float(input())
jug(a)
except EOFError:
break
|
def jug(a):
if a <= 48.0:
print("light fly")
elif a <= 51.0:
print("fly")
elif a <= 54.0:
print("bantam")
elif a <= 57.0:
print("feather")
elif a <= 60.0:
print("light")
elif a <= 64.0:
print("light welter")
elif a <= 69.0:
print('welter')
elif a <= 75.0:
print("light middle")
elif a <= 81.0:
print("middle")
elif a <= 91.0:
print("light heavy")
else:
print("heavy")
while True:
try:
a = float(input())
jug(a)
except EOFError:
break
|
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 0, 531], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 0, 531]]
| 5
| 145
| 2
|
import sys
c=["light fly", "fly", "bantam", "feather", "light", "light welter",
"welter", "light middle", "middle", "light heavy", "heavy"]
w=[48,51,54,57,60,64,69,75,81,91]
for s in map(float,sys.stdin):
i=0
while w[i]<s:
i+=1
print(c[i])
|
import sys
c=["light fly", "fly", "bantam", "feather", "light", "light welter",
"welter", "light middle", "middle", "light heavy", "heavy"]
w=[48,51,54,57,60,64,69,75,81,91]
for s in map(float,sys.stdin):
i=0
for e in w:
if e<s: i+=1
print(c[i])
|
[["-", 0, 656, 0, 7, 8, 196, 0, 52, 0, 89], ["+", 0, 656, 0, 7, 8, 196, 0, 7, 0, 88], ["+", 0, 656, 0, 7, 8, 196, 0, 7, 31, 22], ["+", 0, 656, 0, 7, 8, 196, 0, 7, 0, 267], ["-", 8, 196, 0, 52, 15, 666, 0, 206, 0, 70], ["-", 8, 196, 0, 52, 15, 666, 0, 206, 206, 22], ["-", 8, 196, 0, 52, 15, 666, 0, 206, 0, 73], ["+", 0, 656, 0, 7, 8, 196, 0, 7, 0, 102], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
| 5
| 105
| 7
|
import java.io.*;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
int a = 0;
int b = 0;
int ab = 0;
int o = 0;
while ((line = br.readLine()) != null) {
String str = line.substring(line.indexOf(",") + 1);
if (str.equals("A")) {
a++;
}
if (str.equals("B")) {
b++;
}
if (str.equals("AB")) {
ab++;
}
if (str.equals("O")) {
o++;
}
}
System.out.printf("%d\n%d\n%d\n%d/n", a, b, ab, o);
}
}
|
import java.io.*;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
int a = 0;
int b = 0;
int ab = 0;
int o = 0;
while ((line = br.readLine()) != null) {
String str = line.substring(line.indexOf(",") + 1);
if (str.equals("A")) {
a++;
}
if (str.equals("B")) {
b++;
}
if (str.equals("AB")) {
ab++;
}
if (str.equals("O")) {
o++;
}
}
System.out.printf("%d\n%d\n%d\n%d\n", a, b, ab, o);
}
}
|
[["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44]]
| 3
| 190
| 3
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String str;
int[] blood = new int[4];
while (scan.hasNext()) {
str = scan.next();
String[] num = str.split(",", 0);
if (num[1].equals("A"))
blood[0]++;
if (num[1].equals("B"))
blood[1]++;
if (num[1].equals("O"))
blood[2]++;
if (num[1].equals("AB"))
blood[3]++;
}
for (int i = 0; i < 4; i++) {
System.out.println(blood[i]);
}
}
}
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String str;
int[] blood = new int[4];
while (scan.hasNext()) {
str = scan.next();
String[] num = str.split(",", 0);
if (num[1].equals("A"))
blood[0]++;
if (num[1].equals("B"))
blood[1]++;
if (num[1].equals("O"))
blood[3]++;
if (num[1].equals("AB"))
blood[2]++;
}
for (int i = 0; i < 4; i++) {
System.out.println(blood[i]);
}
}
}
|
[["-", 0, 57, 64, 1, 0, 27, 0, 504, 71, 499], ["+", 0, 57, 64, 1, 0, 27, 0, 504, 71, 499]]
| 3
| 190
| 4
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String bloodType;
int type[] = new int[4];
while ((bloodType = br.readLine()) != null) {
String i[] = bloodType.split(" ");
if (i[1].equals("A")) {
type[0]++;
} else if (i[1].equals("B")) {
type[1]++;
} else if (i[1].equals("AB")) {
type[2]++;
} else if (i[1].equals("O")) {
type[3]++;
}
}
for (int j = 0; j < 4; j++) {
System.out.println(type[j]);
}
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String bloodType;
int type[] = new int[4];
while ((bloodType = br.readLine()) != null) {
String i[] = bloodType.split(",");
if (i[1].equals("A")) {
type[0]++;
} else if (i[1].equals("B")) {
type[1]++;
} else if (i[1].equals("AB")) {
type[2]++;
} else if (i[1].equals("O")) {
type[3]++;
}
}
for (int j = 0; j < 4; j++) {
System.out.println(type[j]);
}
}
}
|
[["-", 49, 200, 51, 492, 3, 4, 0, 5, 0, 491], ["+", 49, 200, 51, 492, 3, 4, 0, 5, 0, 491]]
| 3
| 218
| 2
|
import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.io.*;
import java.lang.*;
import java.math.*;
import java.util.*;
public class Main {
Scanner sc;
static final int INF = 1 << 28;
static final double EPS = 1e-9;
void run() {
sc = new Scanner(System.in);
int a = 0, b = 0, ab = 0, o = 0;
for (; sc.hasNext();) {
String s = sc.nextLine().split(",")[1];
if (s.equals("A"))
a++;
else if (s.equals("B"))
b++;
else if (s.equals("AB"))
ab++;
else
o++;
break;
}
println(a + "");
println(b + "");
println(ab + "");
println(o + "");
sc.close();
}
void print(String s) { System.out.print(s); }
void println(String s) { System.out.println(s); }
public static void main(String[] args) { new Main().run(); }
}
|
import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.io.*;
import java.lang.*;
import java.math.*;
import java.util.*;
public class Main {
Scanner sc;
static final int INF = 1 << 28;
static final double EPS = 1e-9;
void run() {
sc = new Scanner(System.in);
int a = 0, b = 0, ab = 0, o = 0;
for (; sc.hasNext();) {
String s = sc.nextLine().split(",")[1];
if (s.equals("A"))
a++;
else if (s.equals("B"))
b++;
else if (s.equals("AB"))
ab++;
else
o++;
}
println(a + "");
println(b + "");
println(ab + "");
println(o + "");
sc.close();
}
void print(String s) { System.out.print(s); }
void println(String s) { System.out.println(s); }
public static void main(String[] args) { new Main().run(); }
}
|
[["-", 8, 196, 0, 7, 8, 196, 0, 93, 0, 94], ["-", 8, 196, 0, 7, 8, 196, 0, 93, 0, 35]]
| 3
| 279
| 2
|
import java.util.*;
class Main {
public static void main(String a[]) throws java.io.IOException {
Scanner scan = new Scanner(System.in);
int[] bType = {0, 0, 0, 0};
scan.useDelimiter("\\d*,|\\n\\d*,");
while (scan.hasNext()) {
String blood = scan.next();
if (blood.compareTo("A") == 0)
bType[0]++;
else if (blood.compareTo("B") == 0)
bType[1]++;
else if (blood.compareTo("O") == 0)
bType[3]++;
else
bType[2]++;
}
for (int i = 0; i < 4; i++)
System.out.println(bType[i]);
}
}
|
import java.util.*;
class Main {
public static void main(String a[]) throws java.io.IOException {
Scanner scan = new Scanner(System.in);
int[] bType = {0, 0, 0, 0};
scan.useDelimiter("\\d*,|\\n\\d*,|\\n");
while (scan.hasNext()) {
String blood = scan.next();
if (blood.compareTo("A") == 0)
bType[0]++;
else if (blood.compareTo("B") == 0)
bType[1]++;
else if (blood.compareTo("O") == 0)
bType[3]++;
else
bType[2]++;
}
for (int i = 0; i < 4; i++)
System.out.println(bType[i]);
}
}
|
[["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44]]
| 3
| 180
| 4
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = 0, b = 0, o = 0, ab = 0;
while (in.hasNextLine()) {
String str = in.next();
if (str.contains("AB")) {
ab++;
} else if (str.contains("A")) {
a++;
} else if (str.contains("B")) {
b++;
} else {
o++;
}
}
System.out.println(a);
System.out.println(b);
System.out.println(ab);
System.out.println(o);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = 0, b = 0, o = 0, ab = 0;
while (in.hasNextLine()) {
String str = in.nextLine();
if (str.contains("AB")) {
ab++;
} else if (str.contains("A")) {
a++;
} else if (str.contains("B")) {
b++;
} else {
o++;
}
}
System.out.println(a);
System.out.println(b);
System.out.println(ab);
System.out.println(o);
}
}
|
[["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]]
| 3
| 163
| 2
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
int a = 0, b = 0, o = 0, ab = 0;
while ((line = br.readLine()) != null) {
String[] str = line.split(",");
String BloodType = str[1];
if (BloodType.equals("A"))
a++;
if (BloodType.equals("B"))
b++;
if (BloodType.equals("O"))
o++;
if (BloodType.equals("AB"))
ab++;
}
System.out.println(a + "\n" + b + "\n" + o + "\n" + ab);
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
int a = 0, b = 0, o = 0, ab = 0;
while ((line = br.readLine()) != null) {
String[] str = line.split(",");
String BloodType = str[1];
if (BloodType.equals("A"))
a++;
if (BloodType.equals("B"))
b++;
if (BloodType.equals("AB"))
ab++;
if (BloodType.equals("O"))
o++;
}
System.out.println(a + "\n" + b + "\n" + ab + "\n" + o);
}
}
|
[["-", 15, 15, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 15, 15, 0, 492, 3, 4, 0, 5, 0, 491], ["-", 8, 196, 0, 57, 64, 1, 0, 27, 0, 22], ["+", 8, 196, 0, 57, 64, 1, 0, 27, 0, 22], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 1, 0, 492, 3, 4, 0, 16, 12, 22], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 22]]
| 3
| 199
| 12
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] c = new int[4];
while (sc.hasNext()) {
String b = sc.next().split(",")[1];
if (b.equals("A"))
c[1]++;
else if (b.equals("B"))
c[2]++;
else if (b.equals("AB"))
c[3]++;
else
c[4]++;
}
for (int i = 0; i < 4; i++)
System.out.println(c[i]);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] c = new int[4];
while (sc.hasNext()) {
String b = sc.next().split(",")[1];
if (b.equals("A"))
c[0]++;
else if (b.equals("B"))
c[1]++;
else if (b.equals("AB"))
c[2]++;
else
c[3]++;
}
for (int i = 0; i < 4; i++)
System.out.println(c[i]);
}
}
|
[["-", 0, 57, 64, 1, 0, 27, 0, 504, 71, 499], ["+", 0, 57, 64, 1, 0, 27, 0, 504, 71, 499], ["-", 75, 57, 64, 1, 0, 27, 0, 504, 71, 499], ["+", 75, 57, 64, 1, 0, 27, 0, 504, 71, 499], ["-", 75, 57, 75, 1, 0, 27, 0, 504, 71, 499], ["+", 75, 57, 75, 1, 0, 27, 0, 504, 71, 499]]
| 3
| 161
| 8
|
#include <stdio.h>
int main(void) {
int number;
char str[2];
int a = 0;
int b = 0;
int ab = 0;
int o = 0;
while (scanf("%d", &number) != EOF) {
scanf("%s", str);
if (str[0] == 'A') {
if (str[1] == 'B') {
ab++;
} else {
a++;
}
}
if (str[0] == 'B') {
b++;
}
if (str[0] == 'O') {
o++;
}
}
printf("%d\n%d\n%d\n%d\n", a, b, ab, o);
return 0;
}
|
#include <stdio.h>
int main(void) {
int number;
char str[2];
int a = 0;
int b = 0;
int ab = 0;
int o = 0;
while (scanf("%d,", &number) != EOF) {
scanf("%s", str);
if (str[0] == 'A') {
if (str[1] == 'B') {
ab++;
} else {
a++;
}
}
if (str[0] == 'B') {
b++;
}
if (str[0] == 'O') {
o++;
}
}
printf("%d\n%d\n%d\n%d\n", a, b, ab, o);
return 0;
}
|
[["-", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6]]
| 0
| 155
| 2
|
#include <stdio.h>
int main(void) {
int i, n;
char t[4];
int c[4];
for (i = 0; i < 4; ++i)
c[i] = 0;
while (scanf("%d,%s", &n, t) != EOF) {
switch (t[0]) {
case 'A':
if (t[1] == 'B')
c[2]++;
else
c[0]++;
break;
case 'B':
c[1]++;
break;
case 'O':
c[3]++;
break;
}
}
if (c[0] < 15)
return 1;
for (i = 0; i < 4; ++i)
printf("%d\n", c[i]);
return 0;
}
|
#include <stdio.h>
int main(void) {
int i, n;
char t[4];
int c[4];
for (i = 0; i < 4; ++i)
c[i] = 0;
while (scanf("%d,%s", &n, t) != EOF) {
switch (t[0]) {
case 'A':
if (t[1] == 'B')
c[2]++;
else
c[0]++;
break;
case 'B':
c[1]++;
break;
case 'O':
c[3]++;
break;
}
}
if (c[3] == 1)
return 1;
for (i = 0; i < 4; ++i)
printf("%d\n", c[i]);
return 0;
}
|
[["-", 0, 57, 15, 23, 0, 16, 31, 69, 71, 13], ["+", 0, 57, 15, 23, 0, 16, 31, 69, 71, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
| 0
| 171
| 6
|
#include <stdio.h>
#include <string.h>
int a, b, o, ab, n;
char x[5];
int main() {
a = b = o = ab = 0;
while (scanf("%d,%s", &n, x) != EOF) {
if (strcmp(x, "A") == 0)
a++;
if (strcmp(x, "B") == 0)
b++;
if (strcmp(x, "O") == 0)
o++;
if (strcmp(x, "AB") == 0)
ab++;
}
printf("%d\n%d\n%d\n%d\n", a, b, o, ab);
return 0;
}
|
#include <stdio.h>
#include <string.h>
int a, b, o, ab, n;
char x[5];
int main() {
a = b = o = ab = 0;
while (scanf("%d,%s", &n, x) != EOF) {
if (strcmp(x, "A") == 0)
a++;
if (strcmp(x, "B") == 0)
b++;
if (strcmp(x, "O") == 0)
o++;
if (strcmp(x, "AB") == 0)
ab++;
}
printf("%d\n%d\n%d\n%d\n", a, b, ab, o);
return 0;
}
|
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
| 0
| 144
| 4
|
#include <stdio.h>
#include <string.h>
int main(void) {
int n, a = 0, b = 0, ab = 0, o = 0;
char t[3];
while (scanf("%d %s", &n, &t) != EOF) {
if (strcmp(t, "A") == 0) {
a++;
} else if (strcmp(t, "B") == 0) {
b++;
} else if (strcmp(t, "AB") == 0) {
ab++;
} else if (strcmp(t, "O") == 0) {
o++;
}
}
printf("%d\n%d\n%d\n%d\n", a, b, ab, o);
return 0;
}
|
#include <stdio.h>
#include <string.h>
int main(void) {
int n, a = 0, b = 0, ab = 0, o = 0;
char t[3];
while (scanf("%d,%s", &n, t) != EOF) {
if (strcmp(t, "A") == 0) {
a++;
}
if (strcmp(t, "B") == 0) {
b++;
}
if (strcmp(t, "AB") == 0) {
ab++;
}
if (strcmp(t, "O") == 0) {
o++;
}
}
printf("%d\n%d\n%d\n%d\n", a, b, ab, o);
return 0;
}
|
[["-", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 16, 31, 2, 3, 4, 0, 66, 17, 67], ["-", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
| 0
| 155
| 6
|
#include <stdio.h>
int main() {
char t[2];
int a, b, o, ab, s;
a = b = o = ab = 0;
while (scanf("%d,%s", &s, t) != EOF) {
if (t[1] == 'B')
ab++;
else if (t[0] == 'A')
a++;
else if (t[0] == 'B')
b++;
else if (t[0] == 'O')
o++;
}
printf("%d\n%d\n%d\n%d\n", a, b, o, ab);
return 0;
}
|
#include <stdio.h>
int main() {
char t[2];
int a, b, o, ab, s;
a = b = o = ab = 0;
while (scanf("%d,%s", &s, t) != EOF) {
if (t[1] == 'B')
ab++;
else if (t[0] == 'A')
a++;
else if (t[0] == 'B')
b++;
else if (t[0] == 'O')
o++;
}
printf("%d\n%d\n%d\n%d\n", a, b, ab, o);
return 0;
}
|
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
| 0
| 137
| 4
|
#include <math.h>
#include <stdio.h>
#include <string.h>
int main() {
int a[4], i, num;
for (i = 0; i < 4; i++)
a[i] = 0;
char str[2] = "kk";
while (scanf("%d,%s", &num, str) != EOF) {
if (str[0] == 'A') {
if (str[1] == 'B')
a[2]++;
else
a[0]++;
}
if (str[0] == 'B')
a[1]++;
if (str[0] == 'O')
a[3]++;
str[1] = 'k';
}
for (i = 0; i < 4; i++)
printf(a[i]);
return 0;
}
|
#include <math.h>
#include <stdio.h>
#include <string.h>
int main() {
int a[4], i, num;
for (i = 0; i < 4; i++)
a[i] = 0;
char str[2] = "kk";
while (scanf("%d,%s", &num, str) != EOF) {
if (str[0] == 'A') {
if (str[1] == 'B')
a[2]++;
else
a[0]++;
}
if (str[0] == 'B')
a[1]++;
if (str[0] == 'O')
a[3]++;
str[1] = 'k';
}
for (i = 0; i < 4; i++)
printf("%d\n", a[i]);
return 0;
}
|
[["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 7, 8, 1, 0, 2, 3, 4, 0, 21]]
| 0
| 174
| 5
|
#include <stdio.h>
int main(void) {
int n;
char str[4];
int a[4];
int i;
for (i = 0; i < 4; i++) {
a[i] = 0;
}
while (scanf("%d,%s", &n, str) != EOF) {
if (strcmp(str, "A") == 0) {
a[0]++;
} else if (strcmp(str, "B") == 0) {
a[1]++;
} else if (strcmp(str, "O") == 0) {
a[2]++;
} else if (strcmp(str, "AB") == 0) {
a[3]++;
}
}
for (i = 0; i < 4; i++) {
printf("%d\n", a[i]);
}
return (0);
}
|
#include <stdio.h>
int main(void) {
int n;
char str[4];
int a[4];
int i;
for (i = 0; i < 4; i++) {
a[i] = 0;
}
while (scanf("%d,%s", &n, str) != EOF) {
if (strcmp(str, "A") == 0) {
a[0]++;
} else if (strcmp(str, "B") == 0) {
a[1]++;
} else if (strcmp(str, "AB") == 0) {
a[2]++;
} else if (strcmp(str, "O") == 0) {
a[3]++;
}
}
for (i = 0; i < 4; i++) {
printf("%d\n", a[i]);
}
return (0);
}
|
[["-", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6]]
| 0
| 187
| 4
|
#include <ctype.h>
#include <stdio.h>
#include <string.h>
int main() {
int i;
int a = 0;
int b = 0;
int ab = 0;
int o = 0;
char str[10];
while (1) {
if (scanf("%d,%s", &i, str) == -1)
break;
if (str[0] == 'A') {
if (str[1] == 'B') {
ab = ab + 1;
} else {
a = a + 1;
}
} else if (str[0] == 'B') {
b = b + 1;
} else if (str[0] == 'O') {
o = o + 1;
}
printf("%d\n", a);
printf("%d\n", b);
printf("%d\n", ab);
printf("%d\n", o);
return 0;
}
}
|
#include <ctype.h>
#include <stdio.h>
#include <string.h>
int main() {
int i;
int a = 0;
int b = 0;
int ab = 0;
int o = 0;
char str[10];
while (1) {
if (scanf("%d,%s", &i, str) == EOF)
break;
if (str[0] == 'A') {
if (str[1] == 'B') {
ab = ab + 1;
} else {
a = a + 1;
}
} else if (str[0] == 'B') {
b = b + 1;
} else if (str[0] == 'O') {
o = o + 1;
}
}
printf("%d\n", a);
printf("%d\n", b);
printf("%d\n", ab);
printf("%d\n", o);
return 0;
}
|
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22], ["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
| 0
| 189
| 4
|
<?php
$line = trim(fgets(STDIN));
$line = str_replace('apple', 'りんご', $line);
$line = str_replace('peach', 'apple', $line);
$line = str_replace('りんご', 'peanch', $line);
echo $line . "\n";
|
<?php
$line = trim(fgets(STDIN));
$line = str_replace('apple', 'りんご', $line);
$line = str_replace('peach', 'apple', $line);
$line = str_replace('りんご', 'peach', $line);
echo $line . "\n";
|
[["-", 12, 613, 3, 3, 0, 28, 0, 557, 0, 610], ["+", 12, 613, 3, 3, 0, 28, 0, 557, 0, 610]]
| 6
| 71
| 2
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
str = str.replaceAll("apple", "???");
str = str.replaceAll("peach", "apple");
str = str.replaceAll("???", "peach");
System.out.println(str);
sc.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
str = str.replace("apple", "/");
str = str.replace("peach", "apple");
str = str.replace("/", "peach");
System.out.println(str);
sc.close();
}
}
|
[["-", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22], ["-", 0, 11, 12, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 11, 12, 492, 3, 4, 0, 5, 0, 491]]
| 3
| 104
| 10
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
String str = reader.readLine();
str = str.replaceAll("apple", "appleT");
str = str.replaceAll("peach", "apple");
str = str.replaceAll("appleT", "apple");
System.out.println(str);
reader.close();
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
String str = reader.readLine();
str = str.replaceAll("apple", "xxxxxxx");
str = str.replaceAll("peach", "apple");
str = str.replaceAll("xxxxxxx", "peach");
System.out.println(str);
reader.close();
}
}
|
[["-", 0, 11, 12, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 11, 12, 492, 3, 4, 0, 5, 0, 491]]
| 3
| 124
| 6
|
import static java.lang.System.*;
import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
String s = sc.next();
s = s.replaceAll("apple", "A");
s = s.replaceAll("peach", "apple");
s = s.replaceAll("A", "peach");
out.println(s);
}
}
|
import static java.lang.System.*;
import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
String s = sc.nextLine();
s = s.replaceAll("apple", "AAAAA");
s = s.replaceAll("peach", "apple");
s = s.replaceAll("AAAAA", "peach");
out.println(s);
}
}
|
[["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["-", 0, 11, 12, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 11, 12, 492, 3, 4, 0, 5, 0, 491]]
| 3
| 107
| 6
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while (s.hasNext()) {
String t = s.nextLine();
t.replace("apple", "\n");
t.replace("peach", "apple");
t.replace("\n", "peach");
System.out.println(t);
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while (s.hasNext()) {
String t = s.nextLine();
t = t.replace("apple", "\n");
t = t.replace("peach", "apple");
t = t.replace("\n", "peach");
System.out.println(t);
}
}
}
|
[["+", 0, 52, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 500, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 31, 22]]
| 3
| 102
| 6
|
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
static char[] in;
public static void main(String[] args) {
while (read()) {
solve();
}
}
static boolean read() {
if (!sc.hasNext())
return false;
in = sc.next().toCharArray();
return true;
}
static void solve() {
for (int i = 0; i < in.length - 4; i++) {
if (in[i] == 'a' && in[i + 1] == 'p' && in[i + 2] == 'p' &&
in[i + 3] == 'l' && in[i + 4] == 'e') {
in[i] = 'p';
in[i + 1] = 'e';
in[i + 2] = 'a';
in[i + 3] = 'c';
in[i + 4] = 'h';
} else if (in[i] == 'p' && in[i + 1] == 'e' && in[i + 2] == 'a' &&
in[i + 3] == 'c' && in[i + 4] == 'h') {
in[i] = 'a';
in[i + 1] = 'p';
in[i + 2] = 'p';
in[i + 3] = 'l';
in[i + 4] = 'e';
}
}
System.out.println(in);
}
}
|
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
static char[] in;
public static void main(String[] args) {
while (read()) {
solve();
}
}
static boolean read() {
if (!sc.hasNext())
return false;
in = sc.nextLine().toCharArray();
return true;
}
static void solve() {
for (int i = 0; i < in.length - 4; i++) {
if (in[i] == 'a' && in[i + 1] == 'p' && in[i + 2] == 'p' &&
in[i + 3] == 'l' && in[i + 4] == 'e') {
in[i] = 'p';
in[i + 1] = 'e';
in[i + 2] = 'a';
in[i + 3] = 'c';
in[i + 4] = 'h';
} else if (in[i] == 'p' && in[i + 1] == 'e' && in[i + 2] == 'a' &&
in[i + 3] == 'c' && in[i + 4] == 'h') {
in[i] = 'a';
in[i + 1] = 'p';
in[i + 2] = 'p';
in[i + 3] = 'l';
in[i + 4] = 'e';
}
}
System.out.println(in);
}
}
|
[["-", 0, 1, 0, 11, 12, 492, 500, 492, 141, 22], ["+", 0, 1, 0, 11, 12, 492, 500, 492, 141, 22]]
| 3
| 305
| 2
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s;
s = sc.nextLine();
s = s.replaceAll("apple", "tmpP");
s = s.replaceAll("peach", "tmpA");
s = s.replaceAll("tmpOfP", "peach");
s = s.replaceAll("tmpOfA", "apple");
System.out.println(s);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s;
s = sc.nextLine();
s = s.replaceAll("apple", "tmpP");
s = s.replaceAll("peach", "tmpA");
s = s.replaceAll("tmpP", "peach");
s = s.replaceAll("tmpA", "apple");
System.out.println(s);
}
}
|
[["-", 0, 11, 12, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 11, 12, 492, 3, 4, 0, 5, 0, 491]]
| 3
| 115
| 4
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
class Main {
public static void main(String[] args) throws IOException {
doit(args, System.in, System.out);
}
static void doit(String[] args, InputStream in, PrintStream out)
throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line = reader.readLine();
String result = line.replaceAll("apple", "TMP");
result = line.replaceAll("peach", "apple");
result = line.replaceAll("TMP", "peach");
out.println(result);
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
class Main {
public static void main(String[] args) throws IOException {
doit(args, System.in, System.out);
}
static void doit(String[] args, InputStream in, PrintStream out)
throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line = reader.readLine();
String result = line.replaceAll("apple", "TMP");
result = result.replaceAll("peach", "apple");
result = result.replaceAll("TMP", "peach");
out.println(result);
}
}
|
[["-", 8, 196, 0, 1, 0, 11, 12, 492, 500, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 500, 22]]
| 3
| 160
| 4
|
import java.util.*;
public class Main {
Scanner sc = new Scanner(System.in);
public static void main(String[] args) { new Main().run(); }
void run() {
while (sc.hasNext()) {
String sen = sc.nextLine();
sen.replaceAll("apple", "!!!");
sen.replaceAll("peach", "apple");
sen.replaceAll("!!!", "peach");
System.out.println(sen);
}
}
}
|
import java.util.*;
public class Main {
Scanner sc = new Scanner(System.in);
public static void main(String[] args) { new Main().run(); }
void run() {
while (sc.hasNext()) {
String sen = sc.nextLine();
sen = sen.replaceAll("apple", "!!!");
sen = sen.replaceAll("peach", "apple");
sen = sen.replaceAll("!!!", "peach");
System.out.println(sen);
}
}
}
|
[["+", 0, 52, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 500, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 31, 22]]
| 3
| 117
| 6
|
#include <stdio.h>
int main() {
int i;
char s[1001];
for (i = 0;; i++) {
scanf("%c", &s[i]);
if (s[i] == '\n')
break;
}
s[i] = '\0';
for (i = 0; s[i] != '\n'; i++) {
if (s[i] == 'a') {
if (s[i + 1] == 'p' && s[i + 2] == 'p' && s[i + 3] == 'l' &&
s[i + 4] == 'e') {
s[i++] = 'p';
s[i++] = 'e';
s[i++] = 'a';
s[i++] = 'c';
s[i] = 'h';
}
} else if (s[i] == 'p') {
if (s[i + 1] == 'e' && s[i + 2] == 'a' && s[i + 3] == 'c' &&
s[i + 4] == 'h') {
s[i++] = 'a';
s[i++] = 'p';
s[i++] = 'p';
s[i++] = 'l';
s[i] = 'e';
}
}
}
printf("%s\n", s);
return 0;
}
|
#include <stdio.h>
int main() {
int i;
char s[1001];
for (i = 0;; i++) {
scanf("%c", &s[i]);
if (s[i] == '\n')
break;
}
s[i] = '\0';
for (i = 0; s[i + 4] != '\0'; i++) {
if (s[i] == 'a') {
if (s[i + 1] == 'p' && s[i + 2] == 'p' && s[i + 3] == 'l' &&
s[i + 4] == 'e') {
s[i++] = 'p';
s[i++] = 'e';
s[i++] = 'a';
s[i++] = 'c';
s[i] = 'h';
}
} else if (s[i] == 'p') {
if (s[i + 1] == 'e' && s[i + 2] == 'a' && s[i + 3] == 'c' &&
s[i + 4] == 'h') {
s[i++] = 'a';
s[i++] = 'p';
s[i++] = 'p';
s[i++] = 'l';
s[i] = 'e';
}
}
}
printf("%s\n", s);
return 0;
}
|
[["+", 0, 7, 15, 16, 31, 69, 71, 16, 17, 72], ["+", 0, 7, 15, 16, 31, 69, 71, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44], ["+", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44]]
| 0
| 318
| 4
|
#include <stdio.h>
#include <string.h>
#define SIZE 1028
char str[SIZE];
void apple(int len);
int main() {
int len;
fgets(str, sizeof(str), stdin);
len = strlen(str) - 1;
apple(len);
printf("%s", str);
return 0;
}
void apple(int len) {
int i;
for (i = 0; i < len; i++) {
if (strncmp(&str[i], "apple", 5) == 0)
strncpy(&str[i], "peach", 5);
else if (strncmp(&str[i], "apple", 5) == 0)
strncpy(&str[i], "peach", 5);
}
}
|
#include <stdio.h>
#include <string.h>
#define SIZE 1028
char str[SIZE];
void apple(int len);
int main() {
int len;
fgets(str, sizeof(str), stdin);
len = strlen(str) - 1;
apple(len);
printf("%s", str);
return 0;
}
void apple(int len) {
int i;
for (i = 0; i < len; i++) {
if (strncmp(&str[i], "apple", 5) == 0)
strncpy(&str[i], "peach", 5);
else if (strncmp(&str[i], "peach", 5) == 0)
strncpy(&str[i], "apple", 5);
}
}
|
[["-", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
| 0
| 162
| 4
|
#include <stdio.h>
#include <string.h>
int main(void) {
char text[1024];
int i, n;
fgets(text, 1024, stdin);
n = strlen(text);
for (i = 0; i < n - 5; i++) {
if (strncmp(&text[i], "apple", 5) == 0) {
memcpy(&text[i], "peach", 5);
}
if (strncmp(&text[i], "peach", 5) == 0) {
memcpy(&text[i], "apple", 5);
}
}
printf("%s", text);
return 0;
}
|
#include <stdio.h>
#include <string.h>
int main(void) {
char text[1024];
int i, n;
fgets(text, 1024, stdin);
n = strlen(text);
for (i = 0; i < n - 5; i++) {
if (strncmp(&text[i], "apple", 5) == 0) {
memcpy(&text[i], "peach", 5);
} else if (strncmp(&text[i], "peach", 5) == 0) {
memcpy(&text[i], "apple", 5);
}
}
printf("%s", text);
return 0;
}
|
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
| 0
| 139
| 1
|
#include <stdio.h>
int main() {
char moji[1001] = {'\0'};
int i, b = 0;
while (scanf("%s", moji) != EOF) {
if (b != 0) {
printf(" ");
}
for (i = 0; i < 996; i++) {
if (moji[i] == 'a' && moji[i + 1] == 'p' && moji[i + 2] == 'p' &&
moji[i + 3] == 'l' && moji[i + 4] == 'e') {
moji[i] = 'p';
moji[i + 1] = 'e';
moji[i + 2] = 'a';
moji[i + 3] = 'c';
moji[i + 4] = 'h';
continue;
} else if (moji[i] == 'p' && moji[i + 1] == 'e' && moji[i + 2] == 'a' &&
moji[i + 3] == 'c' && moji[i + 4] == 'h') {
moji[i] = 'a';
moji[i + 1] = 'p';
moji[i + 2] = 'p';
moji[i + 3] = 'l';
moji[i + 4] = 'e';
continue;
}
}
printf("%s", moji);
}
printf("\n");
return 0;
}
|
#include <stdio.h>
int main() {
char moji[1001] = {'\0'};
int i, b = 0;
while (scanf("%s", moji) != EOF) {
if (b != 0) {
printf(" ");
}
b++;
for (i = 0; i < 996; i++) {
if (moji[i] == 'a' && moji[i + 1] == 'p' && moji[i + 2] == 'p' &&
moji[i + 3] == 'l' && moji[i + 4] == 'e') {
moji[i] = 'p';
moji[i + 1] = 'e';
moji[i + 2] = 'a';
moji[i + 3] = 'c';
moji[i + 4] = 'h';
continue;
} else if (moji[i] == 'p' && moji[i + 1] == 'e' && moji[i + 2] == 'a' &&
moji[i + 3] == 'c' && moji[i + 4] == 'h') {
moji[i] = 'a';
moji[i + 1] = 'p';
moji[i + 2] = 'p';
moji[i + 3] = 'l';
moji[i + 4] = 'e';
continue;
}
}
printf("%s", moji);
}
printf("\n");
return 0;
}
|
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
| 0
| 316
| 3
|
#include <stdio.h>
#include <string.h>
int main() {
char data[1100];
int i = 0;
fgets(data, sizeof(data), stdin);
for (i = 1; data[i] != 0; i++) {
if (i >= 4) {
if (data[i - 4] == 'a') {
if (data[i - 3] == 'p') {
if (data[i - 2] == 'p') {
if (data[i - 1] == 'l') {
if (data[i] == 'e') {
data[i - 4] = 'p';
data[i - 3] = 'e';
data[i - 2] = 'a';
data[i - 1] = 'c';
data[i] = 'h';
}
}
}
}
}
}
if (i >= 4) {
if (data[i - 4] == 'p') {
if (data[i - 3] == 'e') {
if (data[i - 2] == 'a') {
if (data[i - 1] == 'c') {
if (data[i] == 'h') {
data[i - 4] = 'a';
data[i - 3] = 'p';
data[i - 2] = 'p';
data[i - 1] = 'l';
data[i] = 'e';
}
}
}
}
}
}
}
printf("%s", data);
return 0;
}
|
#include <stdio.h>
#include <string.h>
int main() {
char data[1100];
int i = 0;
fgets(data, sizeof(data), stdin);
for (i = 1; data[i] != 0; i++) {
if (i >= 4) {
if (data[i - 4] == 'a') {
if (data[i - 3] == 'p') {
if (data[i - 2] == 'p') {
if (data[i - 1] == 'l') {
if (data[i] == 'e') {
data[i - 4] = 'p';
data[i - 3] = 'e';
data[i - 2] = 'a';
data[i - 1] = 'c';
data[i] = 'h';
continue;
}
}
}
}
}
}
if (i >= 4) {
if (data[i - 4] == 'p') {
if (data[i - 3] == 'e') {
if (data[i - 2] == 'a') {
if (data[i - 1] == 'c') {
if (data[i] == 'h') {
data[i - 4] = 'a';
data[i - 3] = 'p';
data[i - 2] = 'p';
data[i - 1] = 'l';
data[i] = 'e';
}
}
}
}
}
}
}
printf("%s", data);
return 0;
}
|
[["+", 64, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 64, 9, 0, 57, 64, 9, 0, 116, 0, 35]]
| 0
| 331
| 2
|
#include <stdio.h>
int main(void) {
int i, j, n, m;
char a[1000];
gets(a);
for (i = 0; i < 1000; i++) {
int f = 0;
if (a[i] == 'p')
if (a[i + 1] = 'e')
if (a[i + 2] == 'a')
if (a[i + 3] == 'c')
if (a[i + 4] == 'h')
f = 1;
if (f == 1) {
a[i] = 'a';
a[i + 1] = 'p';
a[i + 2] = 'p';
a[i + 3] = 'l';
a[i + 4] = 'e';
i += 4;
continue;
}
if (a[i] == 'a')
if (a[i + 1] = 'p')
if (a[i + 2] == 'p')
if (a[i + 3] == 'l')
if (a[i + 4] == 'e')
f = 1;
if (f == 1) {
a[i] = 'p';
a[i + 1] = 'e';
a[i + 2] = 'a';
a[i + 3] = 'c';
a[i + 4] = 'h';
i += 4;
}
}
printf("%s", a);
return 0;
}
|
#include <stdio.h>
int main(void) {
int i, j, n, m;
char a[1000];
gets(a);
for (i = 0; i < 1000; i++) {
int f = 0;
if (a[i] == 'p')
if (a[i + 1] == 'e')
if (a[i + 2] == 'a')
if (a[i + 3] == 'c')
if (a[i + 4] == 'h')
f = 1;
if (f == 1) {
a[i] = 'a';
a[i + 1] = 'p';
a[i + 2] = 'p';
a[i + 3] = 'l';
a[i + 4] = 'e';
i += 4;
continue;
}
if (a[i] == 'a')
if (a[i + 1] == 'p')
if (a[i + 2] == 'p')
if (a[i + 3] == 'l')
if (a[i + 4] == 'e')
f = 1;
if (f == 1) {
a[i] = 'p';
a[i + 1] = 'e';
a[i + 2] = 'a';
a[i + 3] = 'c';
a[i + 4] = 'h';
i += 4;
}
}
printf("%s\n", a);
return 0;
}
|
[["-", 0, 57, 64, 57, 15, 23, 0, 11, 17, 32], ["+", 0, 57, 64, 57, 15, 23, 0, 16, 17, 60], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
| 0
| 327
| 5
|
#include <stdio.h>
#include <string.h>
int main(void) {
int i;
int len;
char str[1024];
fgets(str, 1024, stdin);
len = strlen(str);
for (i = 0; i < len; i++) {
if (strncmp(&str[i], "apple", 5) == 0) {
strncpy(&str[i], "peach", 5);
}
if (strncmp(&str[i], "peach", 5) == 0) {
strncpy(&str[i], "apple", 5);
}
}
printf("%s", str);
return (0);
}
|
#include <stdio.h>
#include <string.h>
int main(void) {
int i;
int len;
char str[1024];
fgets(str, 1024, stdin);
len = strlen(str);
for (i = 0; i < len; i++) {
if (strncmp(&str[i], "apple", 5) == 0) {
strncpy(&str[i], "peach", 5);
} else if (strncmp(&str[i], "peach", 5) == 0) {
strncpy(&str[i], "apple", 5);
}
}
printf("%s", str);
return (0);
}
|
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
| 1
| 140
| 1
|
#include <iostream>
#include <string>
using namespace std;
int main() {
int i, mozisu;
string str;
getline(cin, str);
mozisu = str.size();
for (i = 0; i < mozisu; i++) {
if (str[i] == 'a' && str[i + 1] == 'p' && str[i + 2] == 'p' &&
str[i + 3] == 'l' && str[i + 4] == 'e') {
str[i] = 'p';
str[i + 1] = 'e';
str[i + 2] = 'a';
str[i + 3] = 'c';
str[i + 4] = 'h';
}
if (str[i] == 'p' && str[i + 1] == 'e' && str[i + 2] == 'a' &&
str[i + 3] == 'c' && str[i + 4] == 'h') {
str[i] = 'a';
str[i + 1] = 'p';
str[i + 2] = 'p';
str[i + 3] = 'l';
str[i + 4] = 'e';
}
}
cout << str << endl;
return 0;
}
|
#include <iostream>
#include <string>
using namespace std;
int main() {
int i, mozisu;
string str;
getline(cin, str);
mozisu = str.size();
for (i = 0; i < mozisu; i++) {
if (str[i] == 'a' && str[i + 1] == 'p' && str[i + 2] == 'p' &&
str[i + 3] == 'l' && str[i + 4] == 'e') {
str[i] = 'p';
str[i + 1] = 'e';
str[i + 2] = 'a';
str[i + 3] = 'c';
str[i + 4] = 'h';
}
else if (str[i] == 'p' && str[i + 1] == 'e' && str[i + 2] == 'a' &&
str[i + 3] == 'c' && str[i + 4] == 'h') {
str[i] = 'a';
str[i + 1] = 'p';
str[i + 2] = 'p';
str[i + 3] = 'l';
str[i + 4] = 'e';
}
}
cout << str << endl;
return 0;
}
|
[["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
| 1
| 281
| 1
|
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main() {
char input[2000];
cin.getline(input, 1000);
for (int i = 0; input[i] != '\n'; i++) {
if (!strncmp(&input[i], "apple", 5)) {
strncpy(&input[i], "peach", 5);
} else if (!strncmp(&input[i], "peach", 5)) {
strncpy(&input[i], "apple", 5);
}
}
printf("%s\n", input);
return 0;
}
|
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main() {
char input[2000];
cin.getline(input, 1000);
for (int i = 0; input[i] != '\0'; i++) {
if (!strncmp(&input[i], "apple", 5)) {
strncpy(&input[i], "peach", 5);
} else if (!strncmp(&input[i], "peach", 5)) {
strncpy(&input[i], "apple", 5);
}
}
printf("%s\n", input);
return 0;
}
|
[["-", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44], ["+", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44]]
| 1
| 140
| 2
|
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
while (getline(cin, s)) {
for (int i = 0; i < s.size() - 4; i++) {
if (s[i] == 'a') {
if (s[i + 1] == 'p') {
if (s[i + 2] == 'p') {
if (s[i + 3] == 'l') {
if (s[i + 4] == 'e') {
s[i] = 'p';
s[i + 1] = 'e';
s[i + 2] = 'a';
s[i + 3] = 'c';
s[i + 4] = 'h';
}
}
}
}
}
if (s[i] == 'p') {
if (s[i + 1] == 'e') {
if (s[i + 2] == 'a') {
if (s[i + 3] == 'c') {
if (s[i + 4] == 'h') {
s[i] = 'a';
s[i + 1] = 'p';
s[i + 2] = 'p';
s[i + 3] = 'l';
s[i + 4] = 'e';
continue;
}
}
}
}
}
}
cout << s << endl;
}
return 0;
}
|
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
while (getline(cin, s)) {
for (int i = 0; i < s.size() - 4; i++) {
if (s[i] == 'a') {
if (s[i + 1] == 'p') {
if (s[i + 2] == 'p') {
if (s[i + 3] == 'l') {
if (s[i + 4] == 'e') {
s[i] = 'p';
s[i + 1] = 'e';
s[i + 2] = 'a';
s[i + 3] = 'c';
s[i + 4] = 'h';
continue;
}
}
}
}
}
if (s[i] == 'p') {
if (s[i + 1] == 'e') {
if (s[i + 2] == 'a') {
if (s[i + 3] == 'c') {
if (s[i + 4] == 'h') {
s[i] = 'a';
s[i + 1] = 'p';
s[i + 2] = 'p';
s[i + 3] = 'l';
s[i + 4] = 'e';
continue;
}
}
}
}
}
}
cout << s << endl;
}
return 0;
}
|
[["+", 64, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 64, 9, 0, 57, 64, 9, 0, 116, 0, 35]]
| 1
| 313
| 2
|
#include <bits/stdc++.h>
#define rep(i, l, n) for (int i = l; i < n; i++)
#define rer(i, l, n) for (int i = l; i <= n; i++)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define pb(a) push_back(a)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
/*
int main(){
int c=0;
string s;
while(cin>>s){
//if(s=="0") break;
if(s.find("apple")==0) s.replace(0,5,"peach");
else if(s.find("peach")==0) s.replace(0,5,"apple");
if(c==0) cout<<s;
else cout<<" "<<s;
c++;
}
cout<<endl;
}
*/
/*
vector<string> split(const string &s,char c=' '){
vector<string> ret;
stringstream ss(s);
string t;
while(getline(ss,t,c)){
ret.pb(t);
}
return ret;
}
int main(){
string s,ans;
getline(cin,s);
vector<string> str=split(s,' ');
rep(i,0,str.size()){
string ss=str[i];
if(i) ans+=" ";
if(ss.find("apple")==0) ss.replace(0,5,"peach");
else if(ss.find("peach")==0) ss.replace(0,5,"apple");
ans+=ss;
}
o(ans);
}*/
int main() {
string s;
getline(cin, s);
string kw[2] = {"apple", "peach"};
string cw[2] = {"changetopeach", "changetoapple"};
rep(i, 0, 2) {
while (1) {
if (s.find(kw[i]) != string::npos) {
s.replace(s.find(kw[i]), 5, cw[i]);
} else
break;
}
}
rep(i, 0, 2) {
while (1) {
if (s.find(cw[i]) != string::npos) {
s.replace(s.find(cw[i]), 13, kw[1 - i]);
} else
break;
}
}
o(s);
}
|
#include <bits/stdc++.h>
#define rep(i, l, n) for (int i = l; i < n; i++)
#define rer(i, l, n) for (int i = l; i <= n; i++)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define pb(a) push_back(a)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
/*
int main(){
int c=0;
string s;
while(cin>>s){
//if(s=="0") break;
if(s.find("apple")==0) s.replace(0,5,"peach");
else if(s.find("peach")==0) s.replace(0,5,"apple");
if(c==0) cout<<s;
else cout<<" "<<s;
c++;
}
cout<<endl;
}
*/
/*
vector<string> split(const string &s,char c=' '){
vector<string> ret;
stringstream ss(s);
string t;
while(getline(ss,t,c)){
ret.pb(t);
}
return ret;
}
int main(){
string s,ans;
getline(cin,s);
vector<string> str=split(s,' ');
rep(i,0,str.size()){
string ss=str[i];
if(i) ans+=" ";
if(ss.find("apple")==0) ss.replace(0,5,"peach");
else if(ss.find("peach")==0) ss.replace(0,5,"apple");
ans+=ss;
}
o(ans);
}*/
int main() {
string s;
getline(cin, s);
string kw[2] = {"apple", "peach"};
string cw[2] = {"changetopeac", "changetoappl"};
rep(i, 0, 2) {
while (1) {
if (s.find(kw[i]) != string::npos) {
s.replace(s.find(kw[i]), 5, cw[i]);
} else
break;
}
}
// o(s);
rep(i, 0, 2) {
while (1) {
if (s.find(cw[i]) != string::npos) {
s.replace(s.find(cw[i]), 12, kw[1 - i]);
} else
break;
}
}
o(s);
}
|
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
| 1
| 248
| 6
|
#include <iostream>
#include <string>
using namespace std;
string s;
int main() {
cin >> s;
for (int i = 0; i < s.size() - 4; i++) {
string t = s.substr(i, 5);
if (t == "apple")
s.replace(s.begin() + i, s.begin() + i + 5, "peach");
if (t == "peach")
s.replace(s.begin() + i, s.begin() + i + 5, "apple");
}
cout << s << endl;
}
|
#include <iostream>
#include <string>
using namespace std;
string s;
int main() {
getline(cin, s);
for (int i = 0; i < s.size() - 4; i++) {
string t = s.substr(i, 5);
if (t == "apple")
s.replace(s.begin() + i, s.begin() + i + 5, "peach");
if (t == "peach")
s.replace(s.begin() + i, s.begin() + i + 5, "apple");
}
cout << s << endl;
}
|
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25]]
| 1
| 131
| 5
|
#include "bits/stdc++.h"
#include <unordered_map>
#include <unordered_set>
#pragma warning(disable : 4996)
using namespace std;
using ld = long double;
template <class t> using table = vector<vector<t>>;
const ld eps = 1e-9;
//// < "d:\d_download\visual studio
///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual
///studio 2015\projects\programing_contest_c++\debug\b.answer"
int main() {
string st;
getline(cin, st);
string ans;
for (int i = 0; i < st.size() - 5; ++i) {
string aa = st.substr(i, 5);
if (aa == "apple") {
ans += "peach";
i += 4;
} else if (aa == "peach") {
ans += "apple";
i += 4;
} else {
ans += st[i];
}
}
cout << ans << endl;
return 0;
}
|
#include "bits/stdc++.h"
#include <unordered_map>
#include <unordered_set>
#pragma warning(disable : 4996)
using namespace std;
using ld = long double;
template <class t> using table = vector<vector<t>>;
const ld eps = 1e-9;
//// < "d:\d_download\visual studio
///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual
///studio 2015\projects\programing_contest_c++\debug\b.answer"
int main() {
string st;
getline(cin, st);
string ans;
for (int i = 0; i < st.size(); ++i) {
string aa = st.substr(i, 5);
if (aa == "apple") {
ans += "peach";
i += 4;
} else if (aa == "peach") {
ans += "apple";
i += 4;
} else {
ans += st[i];
}
}
cout << ans << endl;
return 0;
}
|
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
| 1
| 158
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.