buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <stdio.h> int main(void) { char s[1001]; int i, sum; scanf("&s", s); while (s[0] != '0') { i = 0; sum = 0; while (s[i]) { sum += s[i] - '0'; i++; } printf("%d\n", sum); scanf("%s", s); } return 0; }
#include <stdio.h> int main(void) { char s[1001]; int i, sum; scanf("%s", s); while (s[0] != '0') { i = 0; sum = 0; while (s[i]) { sum += s[i] - '0'; i++; } printf("%d\n", sum); scanf("%s", s); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
95
#include <stdio.h> int answer(char ch[]) { int sum = 0; int i; for (i = 0;; i++) { if (ch[i] == 0) { break; } sum += ((int)ch[i] - 48); } return sum; } int main() { char ch[1001]; while (1) { scanf("%s", ch); if (answer(ch) == 0) { break; } printf("%d", answe...
#include <stdio.h> int answer(char ch[]) { int sum = 0; int i; for (i = 0;; i++) { if (ch[i] == 0) { break; } sum += ((int)ch[i] - 48); } return sum; } int main() { char ch[1001]; while (1) { scanf("%s", ch); if (answer(ch) == 0) { break; } printf("%d\n", ans...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
117
#include <stdio.h> main() { char c[1001]; int i; int hoge = 0; while (1) { scanf("%s", &c); if (c[0] == '0') { break; } for (i = 0; c[i] != '\0'; i++) { hoge += c[i] - '0'; } printf("%d\n", hoge); } return 0; }
#include <stdio.h> main() { char c[1001]; int i; int hoge = 0; while (1) { scanf("%s", &c); if (c[0] == '0') { break; } for (i = 0; c[i] != '\0'; i++) { hoge += c[i] - '0'; } printf("%d\n", hoge); hoge = 0; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
97
#include <stdio.h> #include <stdlib.h> char number[1001]; int num, x, y, total; int cnt = 0; main(void) { while (1) { scanf("%s", number); num = atoi(number); if (num == 0) { break; } for (y = 0;; y++) { x = number[y] - '0'; if (x <= 0) { printf("%d\n", total); ...
#include <stdio.h> #include <stdlib.h> char number[1001]; int num, y, total; int cnt = 0; long x; main(void) { while (1) { scanf("%s", number); num = atoi(number); if (num == 0) { break; } for (y = 0;; y++) { x = number[y] - '0'; if (x < 0) { printf("%d\n", total)...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18]]
0
116
#include <stdio.h> int main(void) { while (1) { char x; int s = 0; scanf("%d", &x); while (x != '\n') { s += x - '0'; scanf("%c", &x); } if (s == 0) { break; } printf("%d\n", s); } return 0; }
#include <stdio.h> int main(void) { while (1) { char x; int s = 0; scanf("%c", &x); while (x != '\n') { s += x - '0'; scanf("%c", &x); } if (s == 0) { break; } printf("%d\n", s); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
84
#include <stdio.h> int main(void) { char num[1000]; int sum = 0, i = 0; while (1) { scanf("%s", num); if (num[0] == '0') { break; } sum = 0; for (i = 0; num[i] != '\n'; i++) { sum += num[i] - '0'; } printf("%d\n", sum); } return 0; }
#include <stdio.h> int main(void) { char num[1000]; int sum = 0, i = 0; while (1) { scanf("%s", num); if (num[0] == '0') { break; } sum = 0; for (i = 0; num[i] != '\0'; i++) { sum += num[i] - '0'; } printf("%d\n", sum); } return 0; }
[["-", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44], ["+", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44]]
0
102
#include <stdio.h> int main(void) { int i, sum; char num[1001]; while (1) { scanf("%s", num); if (num[0] == '0') ; break; sum = 0; for (i = 0; num[i]; i++) sum += num[i] - '0'; printf("%d\n", sum); } return 0; }
#include <stdio.h> int main(void) { int i, sum; char num[1001]; while (1) { scanf("%s", num); if (num[0] == '0') break; sum = 0; for (i = 0; num[i]; i++) sum += num[i] - '0'; printf("%d\n", sum); } return 0; }
[["-", 0, 52, 8, 9, 0, 57, 64, 1, 0, 35]]
0
91
#include <stdio.h> #include <string.h> int main(void) { int sum; char str[1100]; int i; for (i = 0; i < 1100; i++) { str[i] = 0; } while (1) { scanf("%s", str); if (strcmp(str, "0") == 0) { break; } sum = 0; for (i = 0; str[i] != '/0'; i++) { sum += str[i] - 'o'; }...
#include <stdio.h> #include <string.h> int main(void) { int sum; char str[1100]; int i; for (i = 0; i < 1100; i++) { str[i] = 0; } while (1) { scanf(" %\s ", str); if (strcmp(str, "0") == 0) { break; } sum = 0; for (i = 0; str[i] != '\0'; i++) { sum += str[i] - '0'; ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 8, 9, 0, 7, 15, 16, 12, 103, 0, 125], ["-", 0, 7, 15, 16, 12, 103, 0, 42, 0, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44], ["-", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125], ["+", 0, 1, 0, 11, 12, 16, 12, ...
0
126
#include <stdio.h> int main(void) { int sum, i; char k[1000]; while (1) { scanf("%s", k); if (k[0] == '0') break; for (sum = 0, i = 0; k[i] != '0'; i++) { sum += (k[i] - '0'); } printf("%d\n", sum); } return 0; }
#include <stdio.h> int main(void) { int sum, i; char k[1000]; while (1) { scanf("%s", k); if (k[0] == '0') break; for (sum = 0, i = 0; k[i] != '\0'; i++) { sum += (k[i] - '0'); } printf("%d\n", sum); } return 0; }
[["-", 8, 9, 0, 7, 15, 16, 12, 103, 0, 125], ["+", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44]]
0
98
#include <stdio.h> #include <string.h> int main() { int i = 0, sum, count = 0; char a[1002]; a[0] = 'a'; while (1) { count = 0; i = 0; while (!(a[i] == '\n')) { i++; scanf("%c", a[i]); count++; } sum = 0; for (i = 1; i < count; i++) { sum = sum + (a[i] - '0'); ...
#include <stdio.h> #include <string.h> int main() { int i = 0, sum, count = 0; char a[1002]; a[0] = 'a'; while (1) { count = 0; i = 0; while (!(a[i] == '\n')) { i++; scanf("%c", &a[i]); count++; } sum = 0; for (i = 1; i < count; i++) { sum = sum + (a[i] - '0'); ...
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
0
139
#include <stdio.h> int main() { char k[1000]; int sum, i; while (1) { scanf("%s", k); if (k[0] == '0') break; for (i = 0, sum = 0; k[i] != '\n'; i++) { sum += (k[i] - '0'); } printf("%d\n", sum); } return 0; }
#include <stdio.h> int main() { char k[1000]; int sum, i; while (1) { scanf("%s", k); if (k[0] == '0') break; for (i = 0, sum = 0; k[i] != '\0'; i++) { sum += (k[i] - '0'); } printf("%d\n", sum); } return 0; }
[["-", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44], ["+", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44]]
0
97
#include <stdio.h> int main() { char x[1001]; int ans = 0, i; while (1) { scanf("%s", x); if (x[0] == '0') return 0; for (i = 0; x[i] != 0; i++) { ans += x[i] - '0'; } printf("%d\n", ans); } }
#include <stdio.h> int main() { char x[1001]; int ans, i; while (1) { ans = 0; scanf("%s", x); if (x[0] == '0') return 0; for (i = 0; x[i] != 0; i++) { ans += x[i] - '0'; } printf("%d\n", ans); } }
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
89
#include <stdio.h> #include <string.h> int main() { int i, sum = 0; char number[1000]; while (1) { scanf("%s", number); if (number[0] == '0') break; for (i = 0; number[i] != '\0'; i++) { sum += (number[i] - '0'); } printf("%d\n", sum); } return 0; }
#include <stdio.h> #include <string.h> int main() { int i, sum = 0; char number[1000]; while (1) { scanf("%s", number); if (number[0] == '0') break; for (i = 0; number[i] != '\0'; i++) { sum += (number[i] - '0'); } printf("%d\n", sum); sum = 0; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
97
#include <stdio.h> #include <string.h> int main() { char x[1000] = {0}; int hint[1000] = {0}; int ans = 0; int j; while (1) { scanf("%s", &x); if (x[0] == 48) { break; } for (j = 0; j < strlen(x); j++) { hint[j] = shori(x[j]); ans += hint[j]; } printf("%d\n", ans); ...
#include <stdio.h> #include <string.h> int main() { char x[1000] = {0}; int hint[1000] = {0}; int ans = 0; int j; while (1) { scanf("%s", &x); if (x[0] == 48) { break; } for (j = 0; j < strlen(x); j++) { hint[j] = shori(x[j]); ans += hint[j]; } printf("%d\n", ans); ...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
136
#include <stdio.h> //???????????£???ver ??§????????°????????¨atoi????????????ASCII????????§??????????????£?????? #include <stdlib.h> int main() { int sum = 0, suuti = 0, i, n; char num[4] = {}; for (i = 0;; i++) { scanf("%c", &num[i]); if (num[0] == '0') { break; } suuti = atoi(&num[i]); ...
#include <stdio.h> //???????????£???ver ??§????????°????????¨atoi????????????ASCII????????§??????????????£?????? #include <stdlib.h> int main() { int sum = 0, suuti = 0, i, n; char num[1001] = {}; for (i = 0;; i++) { scanf("%c", &num[i]); if (num[0] == '0') { break; } suuti = atoi(&num[i]); ...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13]]
0
144
#include <stdio.h> int main() { char N[1001]; int T[1000] = {0}; int i, j, k; int num; /*????????????????????????*/ for (j = 0; j >= 0; j++) { scanf("%s", N); for (i = 0; N[i] != '\0'; i++) { num = N[i] - '0'; T[j] += num; if (N[i] == '\0') { break; } } if...
#include <stdio.h> int main() { char N[1001]; int T[1000] = {0}; int i, j, k; int num; /*????????????????????????*/ for (j = 0; j >= 0; j++) { scanf("%s", N); for (i = 0; N[i] != '\0'; i++) { num = N[i] - '0'; T[j] += num; if (N[i] == '\0') { break; } } if...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
160
#include <iostream> using namespace std; int main() { char a; int sum; while ((a = cin.get()) != '0') { sum = 0; while ((a = cin.get()) != '\n') { sum += (int)(a)-48; } cout << sum << endl; } return 0; }
#include <iostream> using namespace std; int main() { char a; int sum; while ((a = cin.get()) != '0') { sum = (int)a - 48; while ((a = cin.get()) != '\n') { sum += (int)(a)-48; } cout << sum << endl; } return 0; }
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 0, 24], ["+", 0, 11, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 0, 25], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 51, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
78
#include <bits/stdc++.h> using namespace std; const int N = 1000; int main() { while (true) { string s; cin >> s; if (s == "0") break; int sum = 0; for (int i = 0; i < (int)s.size(); ++i) { sum = +s[i] - '0'; } cout << sum << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 1000; int main() { while (true) { string s; cin >> s; if (s == "0") break; int sum = 0; for (int i = 0; i < (int)s.size(); ++i) { sum += s[i] - '0'; } cout << sum << endl; } return 0; }
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 1, 0, 11, 12, 16, 31, 91, 17, 72], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107]]
1
90
#include <cstdio> int main() { int i, j; char s[1001]; for (j = 1;; j++) { scanf("%s", s); if (s[0] == '0') break; char t = '0' - '48'; for (i = 0; s[i] != '\0'; i++) { t += s[i] - '48'; } printf("%d\n", t); } return 0; }
#include <cstdio> int main() { int i, j; char s[2000]; for (j = 1;; j++) { scanf("%s", s); if (s[0] == '0') break; int t = '0' - 48; for (i = 0; s[i] != '\0'; i++) { t += s[i] - 48; } printf("%d\n", t); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["-", 0, 43, 49, 50, 51, 16, 12, 103, 0, 104], ["-", 0, 43, 49, 50, 51, 16, 12, 103, 0, 125], ["-", 49, 50, 51, 16, 12, 103, 0, 42, 0, 13], ["+", 8, 9, 0...
1
110
#include <iostream> #include <string> using namespace std; int main() { string n; while (1) { cin >> n; if (n == "0") break; int a = 0, b = 0, i; for (i = 0; i < n.length(); ++i) { a = n[i]; b = b + a; } cout << b << endl; } return 0; }
#include <iostream> #include <string> using namespace std; int main() { string n; while (1) { cin >> n; if (n == "0") break; int a = 0, b = 0, i; for (i = 0; i < n.length(); ++i) { a = n[i] - '0'; b = b + a; } cout << b << endl; } return 0; }
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]]
1
89
#include <iostream> #include <string> using namespace std; int main() { string str; int sum = 0; while (getline(cin, str)) { if (str == "0") break; for (int i = 0; i < str.size(); i++) sum += str[i] - 48; cout << sum << endl; } return 0; }
#include <iostream> #include <string> using namespace std; int main() { string str; int sum = 0; while (getline(cin, str)) { sum = 0; if (str == "0") break; for (int i = 0; i < str.size(); i++) sum += str[i] - 48; cout << sum << endl; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
79
#include <iostream> #include <string> using namespace std; int main() { string number; int num = 0; // for( int n = 0; n < 1001; n++ ) //{ // num[n] = 0; //} while (1) { cin >> number; for (int i = 0; i < number.size(); i++) { num += number[i] - '0'; } if (number == "0") ...
#include <iostream> #include <string> using namespace std; int main() { string number; int num = 0; // for( int n = 0; n < 1001; n++ ) //{ // num[n] = 0; //} while (1) { cin >> number; num = 0; for (int i = 0; i < number.size(); i++) { num += number[i] - '0'; } if (number...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
88
#include <stdio.h> int main() { char num[1001]; int i, sum; while (1) { scanf("%s", num); if (num[0] == '0') { break; } sum = 0; for (i = 0; num[i] != '\0'; i++) { //\0はnullの部分 sum += num[i] - '0'; printf("%d\n", sum); } } return 0; }
#include <stdio.h> int main() { char num[1001]; int i, sum; while (1) { scanf("%s", num); if (num[0] == '0') { break; } sum = 0; for (i = 0; num[i] != '\0'; i++) { //\0はnullの部分 sum += num[i] - '0'; } printf("%d\n", sum); } return 0; }
[["+", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46]]
0
98
#include <stdio.h> int main() { char a[1001]; int g, i; while (1) { scanf("%s", &a); if (a[0] == '0') break; g = 0; for (i = 0; a[i] != '\n'; i++) g += a[i] - '0'; printf("%d\n", g); } }
#include <stdio.h> int main() { char a[1001]; int g, i; while (1) { scanf("%s", &a); if (a[0] == '0') break; g = 0; for (i = 0; a[i] != '\0'; i++) g += a[i] - '0'; printf("%d\n", g); } }
[["-", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44], ["+", 8, 9, 0, 7, 15, 16, 12, 103, 0, 44]]
0
91
#include <stdio.h> int main() { int a, i[100] = {}, b, c; char mozi[1001] = {}; for (a = 0; a < 10000; a++) { scanf("%s", mozi); if (mozi[0] == '0') { break; } for (b = 0; b < 1001; b++) { i[a] += mozi[b] - '0'; if (mozi[b + 1] == '\0') break; } } for (c = 0; c ...
#include <stdio.h> int main() { int a, i[1000] = {}, b, c; char mozi[1001] = {}; for (a = 0; a < 10000; a++) { scanf("%s", mozi); if (mozi[0] == '0') { break; } for (b = 0; b < 1001; b++) { i[a] += mozi[b] - '0'; if (mozi[b + 1] == '\0') break; } } for (c = 0; c...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
0
146
#include <algorithm> #include <iostream> #include <sstream> #include <string> using namespace std; int main() { while (true) { string n; cin >> n; if (n[0] == '0' && n.size() == 1) break; int ans = 0; for (int i = n.size() - 1; i >= 0; i--) { int num = n[i] - '0'; ans = a...
#include <algorithm> #include <iostream> #include <sstream> #include <string> using namespace std; int main() { while (true) { string n; cin >> n; if (n[0] == '0' && n.size() == 1) break; int ans = 0; for (int i = n.size() - 1; i >= 0; i--) { int num = n[i] - '0'; ans = a...
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
104
#include <iostream> #include <string> using namespace std; int main() { string num; int n = 0; while (1) { cin >> num; if (num[0] == '0') break; for (int i = 0; i < num.size(); i++) { n += num[i] - '0'; } cout << n << endl; } return 0; }
#include <iostream> #include <string> using namespace std; int main() { string num; int n = 0; while (1) { cin >> num; if (num[0] == '0') break; for (int i = 0; i < num.size(); i++) { n += num[i] - '0'; } cout << n << endl; n = 0; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
85
#include <cstdio> #include <cstring> using namespace std; int main(void) { // Your code here! char str[1001]; while (1) { scanf("%c", str); if (str[0] == '0') break; int sum = 0; for (int i = 0; i < strlen(str); i++) { sum += (str[i] - '0'); } printf("%d\n", sum); } retur...
#include <cstdio> #include <cstring> using namespace std; int main(void) { // Your code here! char str[1001]; while (1) { scanf("%s", str); if (str[0] == '0') break; int sum = 0; for (int i = 0; i < strlen(str); i++) { sum += (str[i] - '0'); } printf("%d\n", sum); } retur...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
100
#define MAXSIZE 1000 #include <iostream> #include <stdio.h> #include <string.h> using namespace std; char init_str[MAXSIZE] = {}; int main() { char str[MAXSIZE]; int sum; while (1) { strcpy(str, init_str); scanf("%s", &str); if ((int)str[0] != 0) { sum = 0; for (int i = 0; (i < MAXSIZE...
#define MAXSIZE 1000 #include <iostream> #include <stdio.h> #include <string.h> using namespace std; char init_str[MAXSIZE] = {}; int main() { char str[MAXSIZE]; int sum; while (1) { strcpy(str, init_str); scanf("%s", &str); if ((int)(str[0] - '0') != 0) { sum = 0; for (int i = 0; (i <...
[["+", 15, 339, 51, 16, 31, 74, 51, 23, 0, 24], ["+", 51, 16, 31, 74, 51, 23, 0, 16, 17, 33], ["+", 31, 74, 51, 23, 0, 16, 12, 103, 0, 104], ["+", 31, 74, 51, 23, 0, 16, 12, 103, 0, 125], ["+", 15, 339, 51, 16, 31, 74, 51, 23, 0, 25]]
1
135
#include <iostream> #include <string> using namespace std; int main() { string number; int num = 0; while (1) { cin >> number; if (number[0] == '0') { break; } else { for (int i = 0; i < number.size(); i++) { num += number[i] - '0'; } cout << num << endl; } } re...
#include <iostream> #include <string> using namespace std; int main() { string number; int num = 0; while (1) { cin >> number; if (number[0] == '0') { break; } else { for (int i = 0; i < number.size(); i++) { num += number[i] - '0'; } cout << num << endl; num = 0;...
[["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
90
#include <iostream> #include <string> using namespace std; int main(void) { string number; int sum; while (true) { sum = 0; cin >> number; if (number[0] == '0') { break; } for (int i = 0; i < number.size(); i++) { sum += number[i]; } cout << endl; } return 0; }
#include <iostream> #include <string> using namespace std; int main(void) { string number; int sum; while (true) { sum = 0; cin >> number; if (number[0] == '0') { break; } for (int i = 0; i < number.size(); i++) { sum += number[i] - '0'; // ASCIIコードの0を引くことで数値間の引き算を可能に...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
84
#include <cctype> #include <cstdio> #include <iostream> using namespace std; int main() { string a; while (1) { cin >> a; if (a == "0") break; int b = 0; for (int i; i < a.size(); i++) { b += a[i] - '0'; } cout << b << endl; } return 0; }
#include <cctype> #include <cstdio> #include <iostream> using namespace std; int main() { string a; while (1) { cin >> a; if (a == "0") break; int b = 0; for (int i = 0; i < a.size(); i++) { b += a[i] - '0'; } cout << b << endl; } return 0; }
[["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
82
#include <cctype> #include <stdio.h> int main() { char ch; int sum = 0; while (true) { while ((ch = getchar()) != '\n') { sum += ch - '0'; } if (sum == 0) { break; } else { printf("%d", sum); sum = 0; } } return 0; }
#include <cctype> #include <stdio.h> int main() { char ch; int sum = 0; while (true) { while ((ch = getchar()) != '\n') { sum += ch - '0'; } if (sum == 0) { break; } else { printf("%d\n", sum); sum = 0; } } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
77
#include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { char num[1001]; while (1) { scanf("%s", num); if (num[0] == '0') break; int sum = 0; for (int i = 0; strlen(num) > i; i++) { sum += num[i] - '0'; } printf("%s\n", sum); } return 0; }
#include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { char num[1001]; while (1) { scanf("%s", num); if (num[0] == '0') break; int sum = 0; for (int i = 0; strlen(num) > i; i++) { sum += num[i] - '0'; } printf("%d\n", sum); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
98
#include <cstdio> #include <iostream> using namespace std; int main() { char num[1001]; while (1) { scanf("%s", num); if (num[0] == '0') break; int sum = 0; for (int i = 0; num[i] != '\0'; i++) { sum += num[i] - '0'; } printf("%s\n", sum); } return 0; }
#include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { char num[1001]; while (1) { scanf("%s", num); if (num[0] == '0') break; int sum = 0; for (int i = 0; num[i] != '\0'; i++) { sum += num[i] - '0'; } printf("%d\n", sum); } return 0; }
[["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
98
#include <cctype> #include <cstdio> #include <iostream> #include <stdio.h> using namespace std; int main() { string num; int sum = 0; while (1) { cin >> num; if (num == "0") { break; } for (int i = 0; i < (int)num.size(); i++) { sum = sum + (int)num[0] - 48; } cout << sum << e...
#include <cctype> #include <cstdio> #include <iostream> #include <stdio.h> using namespace std; int main() { string num; int sum = 0; while (1) { cin >> num; if (num == "0") { break; } for (int i = 0; i < (int)num.size(); i++) { sum = sum + (int)num[i] - 48; } cout << sum << en...
[["-", 31, 16, 12, 74, 51, 69, 341, 342, 0, 13], ["+", 31, 16, 12, 74, 51, 69, 341, 342, 0, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
1
94
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { while (1) { string num; cin >> num; if (num[0] == '0') break; int sum; for (int i = 0; i < num.size(); i++) { sum += num[i] - '0'; } cout << sum << endl; } }
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { while (1) { string num; cin >> num; if (num[0] == '0') break; int sum = 0; for (int i = 0; i < num.size(); i++) { sum += num[i] - '0'; } cout << sum << endl; } }
[["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
82
#include <iostream> #include <stdio.h> using namespace std; int main() { char num[5] = "9999"; while (1) { int S = 0; scanf("%c", num); if (num[0] == '0') break; for (int i = 0; i < 4; i++) { if (num[i] == '\0') break; S += (num[i] - '0'); } cout << S << endl;...
#include <iostream> #include <stdio.h> using namespace std; int main() { char num[1000] = "1"; while (1) { int S = 0; scanf("%s", num); if (num[0] == '0') break; for (int i = 0; i < 1001; i++) { if (num[i] == '\0') break; S += (num[i] - '0'); } cout << S << en...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, ...
1
105
#include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { char ch[1000]; while (1) { scanf("%s", ch); int sum = 0; if (ch[0] == '0') { break; } for (int i = 0; i < strlen(ch); i++) { sum += 'ch[i]' - '0'; } printf("%d\n", sum); } return...
#include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { char ch[1000]; while (1) { scanf("%s", ch); int sum = 0; if (ch[0] == '0') { break; } for (int i = 0; i < strlen(ch); i++) { sum += ch[i] - '0'; } printf("%d\n", sum); } return 0...
[["-", 8, 9, 0, 1, 0, 11, 0, 42, 0, 104], ["-", 8, 9, 0, 1, 0, 11, 0, 42, 0, 125], ["-", 0, 1, 0, 11, 12, 16, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 12, 16, 0, 42, 0, 104]]
1
103
#include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define vvi vector<vector<int>> #define All(X) X.begin(), X.end() int main() { while (1) { char buf[1100]; scanf("%s", buf); if (buf[...
#include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define vvi vector<vector<int>> #define All(X) X.begin(), X.end() int main() { while (1) { char buf[1100]; scanf("%s", buf); if (buf[...
[["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
115
while True: x = input() if x == 0: break length = len(x) tot = 0 for i in range(length): tot += int(x[i:i + 1]) print(tot)
while True: x = input() if x == '0': break length = len(x) tot = 0 for i in range(length): tot += int(x[i:i + 1]) print(tot)
[["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655]]
5
48
from sys import stdin for line in stdin: if line == '0': break num = list(map(int, line.strip('\n'))) print(sum(num))
from sys import stdin for line in stdin: if line == '0\n': break num = list(map(int, line.strip('\n'))) print(sum(num))
[["+", 0, 57, 15, 666, 0, 557, 0, 6, 0, 44]]
5
42
while True: x=input() if x==0: break print(sum(int(s) for s in range(x)))
while True: x=input() if x=='0': break print(sum(int(s) for s in x))
[["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655], ["-", 0, 652, 3, 668, 0, 659, 12, 652, 63, 22], ["-", 3, 668, 0, 659, 12, 652, 3, 4, 0, 24], ["-", 3, 668, 0, 659, 12, 652, 3, 4, 0, 25]]
5
31
while True: x = str(input()) if x == 0: break sum = 0 for i in range(len(x)): sum += int(x[i]) print(sum)
while True: x = str(input()) if int(x) == 0: break sum = 0 for i in range(len(x)): sum += int(x[i]) print(sum)
[["+", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25]]
5
44
from functools import reduce while True: n = input() if x == '0': break; print(reduce(lambda x,y: x+int(y), n, 0))
from functools import reduce while True: n = input() if n == '0': break; print(reduce(lambda x,y: x+int(y), n, 0))
[["-", 0, 52, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 0, 22]]
5
42
#include <iostream> #include <stdio.h> using namespace std; int main() { char charr[1001] = {}; int result; while (1) { scanf("%s", charr); if (charr[0] == '0') { break; } result = 0; for (int i = 0; charr[i] != '\0'; i++) { result += charr[i]; } printf("%d\n", result); ...
#include <iostream> #include <stdio.h> using namespace std; int main() { char charr[1001] = {}; int result; while (1) { scanf("%s", charr); if (charr[0] == '0') { break; } result = 0; for (int i = 0; charr[i] != '\0'; i++) { result += charr[i] - '0'; } printf("%d\n", res...
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["+", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]]
1
101
#include <cstring> #include <iostream> #include <stdio.h> using namespace std; int main() { char c[10000][1001]; int a; for (int i = 0; i < 10000; i++) { scanf("%s", c[i]); // if (c[i][0] == '0' && c[i][1] == NULL) { if (strcmp(c[i], "0") == 0) { a = i; break; } } for (int i = 0;...
#include <cstring> #include <iostream> #include <stdio.h> using namespace std; int main() { char c[1000][1001]; int a; for (int i = 0; i < 1000; i++) { scanf("%s", c[i]); // if (c[i][0] == '0' && c[i][1] == NULL) { if (strcmp(c[i], "0") == 0) { a = i; break; } } for (int i = 0; i...
[["-", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
161
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_B #include <iostream> #include <string> using namespace std; int count(string x) { // string?????°???????????????????¶???????????????? int sum = 0; for (int i = 0; i < x.length(); i++) { string key = x.substr(i, i + 1); sum += stoi(key); ...
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_B #include <iostream> #include <string> using namespace std; int count(string x) { // string?????°???????????????????¶???????????????? int sum = 0; for (int i = 0; i < x.length(); i++) { string key = x.substr(i, 1); // cout << key << endl...
[["-", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22], ["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72]]
1
107
#include <iostream> #include <string> using namespace std; int main() { string s; cin >> s; while (s != "0") { int i[s.size()]; int x = 0; for (int k = 0; k < s.size() - 1; k++) { i[k] = s[k] - '0'; } for (int j = 0; j < s.size() - 1; j++) { x += i[j]; } cout << x << ...
#include <iostream> #include <string> using namespace std; int main() { string s; cin >> s; while (s != "0") { int i[s.size()]; int x = 0; for (int k = 0; k < s.size(); k++) { i[k] = s[k] - '0'; } for (int j = 0; j < s.size(); j++) { x += i[j]; } cout << x << endl; ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
124
#include <cstdio> #include <cstring> int main() { char str[1001]; while (1) { scanf("%s", str); if (str[0] == '0') break; int sum = 0; for (int i = 0; i < strlen(str); i++) { sum += (str[i] - '0'); } printf("%d/n", sum); } return 0; }
#include <cstdio> #include <cstring> int main() { char str[1001]; while (1) { scanf("%s", str); if (str[0] == '0') break; int sum = 0; for (int i = 0; i < strlen(str); i++) { sum += (str[i] - '0'); } printf("%d\n", sum); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
93
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; const int INF = 1e9; const double PI = acos(-1.0); int main(void) { cin.tie(0); ios::sync_with_stdio(false); while (1) { string x; cin ...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; const int INF = 1e9; const double PI = acos(-1.0); int main(void) { cin.tie(0); ios::sync_with_stdio(false); while (1) { string x; cin ...
[["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 104], ["+", 0, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 23, 0, 16, 12, 103, 0, 104], ["+", 0, 11, 12, 23, 0, 16, 12, 103, 0, 125], ["+", 0, 9, 0, 1, 0, 11, 12, 23, 0, 25]]
1
125
#include <iostream> #include <string> using namespace std; int main() { string number; int sum; while (1) { cin >> number; if (number == "0") { break; } sum = 0; for (int i = 0; i < number.size(); i++) { sum += number[i] - '0'; } } cout << sum << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main() { string number; int sum; while (1) { cin >> number; if (number == "0") { break; } sum = 0; for (int i = 0; i < number.size(); i++) { sum += number[i] - '0'; } cout << sum << endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
86
#include <cstdio> #include <cstdlib> using namespace std; int main() { char c; int s = 0; while (scanf("%c", &c) != EOF) { if (c == '\n') { printf("%d\n", s); s = 0; } else if (c == '0' && s == 0) { // noop } else { s += atoi(&c); } } }
#include <cstdio> #include <cstdlib> using namespace std; int main() { char c; int s = 0; while (scanf("%c", &c) != EOF) { if (c == '\n') { printf("%d\n", s); s = 0; } else if (c == '0' && s == 0) { break; } else { s += atoi(&c); } } }
[["+", 75, 76, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 75, 76, 0, 57, 64, 9, 0, 93, 0, 35]]
1
89
#include <iostream> #include <string> using namespace std; int main() { string a; while (cin >> a) { int sum = 0; for (string::iterator it = a.begin(); a.end() != it; ++it) { sum += (int)(*it - '0'); } cout << sum << endl; } }
#include <iostream> #include <string> using namespace std; int main() { string a; while (cin >> a, a != "0") { int sum = 0; for (string::iterator it = a.begin(); a.end() != it; ++it) { sum += (int)(*it - '0'); } cout << sum << endl; } }
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 17, 79], ["+", 15, 339, 51, 34, 12, 16, 12, 5, 0, 62], ["+", 15, 339, 51, 34, 12, 16, 12, 5, 0, 6]]
1
76
#include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; int main() { string s; while (cin >> s, s != "0") { int sum = 0; for (int i = 0; i < s.size(); ++i) { sum += s[i] - '0s'; } cout << sum << endl; } return 0; }
#include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; int main() { string s; while (cin >> s, s != "0") { int sum = 0; for (int i = 0; i < s.size(); ++i) { sum += s[i] - '0'; } cout << sum << endl; } return 0; }
[["-", 0, 11, 12, 16, 12, 103, 0, 42, 0, 22]]
1
81
#include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; int main() { string s; while (cin >> s, s != "0") { int sum = 0; for (int i = 0; i < s.size(); ++i) { sum += s[i] - '0s'; } cout << sum << endl; } return 0; }
#include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; int main() { string s; int sum; while (cin >> s && s != "0") { sum = 0; for (int i = 0; i < s.size(); ++i) { sum += s[i] - '0'; } cout << sum << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["-", 0, 11, 12, 16, 12, 103, 0, 42, 0, 22]]
1
81
#include <cctype> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { while (1) { char str[1001]; int n; cin >> str; if (str[0] == '0') break; n = strlen(str); int sum = 0; for (int i = 0; i <= n; ++i) { sum += str[i] - '0'; } co...
#include <cctype> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int main() { while (1) { char str[1001]; int n; cin >> str; if (str[0] == '0') break; n = strlen(str); int sum = 0; for (int i = 0; i < n; ++i) { sum += str[i] - '0'; } cou...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18]]
1
98
#include <cstdio> #include <cstring> using namespace std; int main(int argc, char const *argv[]) { char str[1001]; while (1) { scanf("%s", str); if (str[0] == '0') break; int sum = 0; for (int i = 0; i < strlen(str); i++) { sum += (str[i] - '0'); } printf("%d", sum); } ret...
#include <cstdio> #include <cstring> using namespace std; int main(int argc, char const *argv[]) { char str[1001]; while (1) { scanf("%s", str); if (str[0] == '0') break; int sum = 0; for (int i = 0; i < strlen(str); i++) { sum += (str[i] - '0'); } printf("%d\n", sum); } r...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
106
#include <iostream> #include <string> using namespace std; int main() { string s; int i; while (1) { cin >> s; if (s[0] == '0') break; int sum = 0; for (i = 0; i < s.length(); i++) sum += s[i] - '0'; cout << sum; } return 0; }
#include <iostream> #include <string> using namespace std; int main() { string s; int i; while (1) { cin >> s; if (s[0] == '0') break; int sum = 0; for (i = 0; i < s.length(); i++) sum += s[i] - '0'; cout << sum << endl; } return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
83
#include <cctype> #include <iostream> #include <string> using namespace std; int main() { int ans = 0, a; string str; while (1) { cin >> str; if (str[0] == '0') { break; } for (int i = 0; i < str.size(); i++) { a = str[i] - '0'; ans += a; } cout << ans << endl; } retu...
#include <cctype> #include <iostream> #include <string> using namespace std; int main() { int ans = 0, a; string str; while (1) { cin >> str; if (str[0] == '0') { break; } for (int i = 0; i < str.size(); i++) { a = str[i] - '0'; ans += a; } cout << ans << endl; ans = ...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
95
#include <iostream> #include <string> using namespace std; int main() { int answer; string str; cin >> str; while (1) { answer = 0; cin >> str; for (int i = 0; i < str.size(); i++) { answer += str[i] - '0'; } if (answer == 0) break; cout << answer << endl; } return 0; }
#include <iostream> #include <string> using namespace std; int main() { int answer; string str; while (1) { answer = 0; cin >> str; for (int i = 0; i < str.size(); i++) { answer += str[i] - '0'; } if (answer == 0) break; cout << answer << endl; } return 0; }
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
86
<?php $A=[]; for($i=97;$i<123;$i++) $A[$i]=0; while(1){ $S=trim(fgets(STDIN)); if(!$S){break;} foreach(str_split($S) as $c){ $n=ord($c); if($n>65){} elseif($n<91){++$A[$n+32];} elseif($n<97){} elseif($n<123){++$A[$n];} } } for($i=97;$i<123;$i++) echo chr($i),' : ',$A[$i],PHP_EOL;
<?php $A=[]; for($i=97;$i<123;$i++) $A[$i]=0; while(1){ $S=trim(fgets(STDIN)); if(!$S){break;} foreach(str_split($S) as $c){ $n=ord($c); if($n<65){} elseif($n<91){++$A[$n+32];} elseif($n<97){} elseif($n<123){++$A[$n];} } } for($i=97;$i<123;$i++) echo chr($i),' : ',$A[$i],PHP_EOL;
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18]]
6
171
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int[] count = new int['z']; for (int i : count) { i = 0; } while (sc.hasNext()) { String s = sc.next(); s = s.toLowerCase(); char[] c = ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] count = new int['z']; for (int i : count) { i = 0; } while (sc.hasNext()) { String s = sc.next(); s = s.toLowerCase(); char[] c = s.toCharArray(); ...
[["-", 0, 235, 8, 498, 0, 195, 0, 529, 0, 529], ["-", 0, 235, 8, 498, 0, 195, 0, 529, 0, 78], ["-", 3, 4, 0, 16, 31, 16, 12, 5, 0, 491], ["+", 3, 4, 0, 16, 31, 16, 12, 5, 0, 491]]
3
155
import java.util.Scanner; public class Main { public static void main(String[] args) { int[] count = new int[26]; Scanner scan = new Scanner(System.in); do { // not false String str = scan.nextLine(); for (int i = 0; i < str.length(); i++) { if (str.charAt(i) - 'a' >= 0 && str.charAt(...
import java.util.Scanner; public class Main { public static void main(String[] args) { int[] count = new int[26]; Scanner scan = new Scanner(System.in); do { // not false String str = scan.nextLine(); for (int i = 0; i < str.length(); i++) { if (str.charAt(i) - 'a' >= 0 && str.charAt(...
[["-", 3, 4, 0, 16, 31, 16, 12, 5, 0, 491], ["+", 3, 4, 0, 16, 31, 16, 12, 5, 0, 491]]
3
233
import java.util.Scanner; public class Main { public static void main(String[] args) { int[] answer = new int[26]; try (Scanner scanner = new Scanner(System.in);) { while (scanner.hasNext()) { String S = scanner.nextLine(); S = S.toLowerCase(); for (int i = 0; i < S.length(); ...
import java.util.Scanner; public class Main { public static void main(String[] args) { int[] answer = new int[26]; try (Scanner scanner = new Scanner(System.in)) { while (scanner.hasNextLine()) { String S = scanner.nextLine(); S = S.toLowerCase(); for (int i = 0; i < S.length()...
[["-", 0, 195, 8, 196, 0, 530, 532, 533, 0, 35], ["-", 8, 196, 0, 52, 15, 15, 0, 492, 141, 22], ["+", 8, 196, 0, 52, 15, 15, 0, 492, 141, 22], ["-", 0, 57, 15, 15, 0, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 17, 19]]
3
174
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // String word = sc.next(); String array = ""; String alpha = "abcdefghijklmnopqrstuvwxyz"; int count = 0; while (sc.hasNext()) { array = array + sc.next(); } fo...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // String word = sc.next(); String array = ""; String alpha = "abcdefghijklmnopqrstuvwxyz"; int count = 0; while (sc.hasNext()) { array = array + sc.next(); } fo...
[["+", 0, 7, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 12, 499], ["+", 8, 196, 0, 7, 8, 196, 0, 1, 0, 35]]
3
161
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); char a = 'a'; String str; int cou...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); char a = 'a'; String str; int cou...
[["-", 0, 7, 15, 16, 12, 16, 31, 16, 31, 252], ["-", 0, 7, 15, 16, 12, 16, 31, 16, 17, 33], ["-", 0, 7, 15, 16, 12, 16, 31, 16, 12, 22], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 499]]
3
191
/* package whatever; // don't place package name! */ import java.io.*; import java.lang.*; import java.util.*; /* Name of the class has to be "Main" only if the class is public. */ class Main { public static void main(String[] args) throws java.lang.Exception { Map<Character, Integer> map = new TreeMap<Characte...
/* package whatever; // don't place package name! */ import java.io.*; import java.lang.*; import java.util.*; /* Name of the class has to be "Main" only if the class is public. */ class Main { public static void main(String[] args) throws java.lang.Exception { Map<Character, Integer> map = new TreeMap<Characte...
[["+", 0, 503, 49, 200, 51, 492, 500, 492, 141, 22], ["+", 49, 200, 51, 492, 500, 492, 3, 4, 0, 24], ["+", 49, 200, 51, 492, 500, 492, 3, 4, 0, 25], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 0, 131]]
3
225
import java.io.*; import java.util.*; class Main { public static void main(String[] args) throws IOException { Scanner br = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int[] alp = new int[26]; while (br.hasNext()) { String line = br.nextLine(); line.toLowerCas...
import java.io.*; import java.util.*; class Main { public static void main(String[] args) throws IOException { Scanner br = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int[] alp = new int[26]; while (br.hasNext()) { String line = br.nextLine(); line = line.toL...
[["+", 0, 52, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 500, 22]]
3
190
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String strIn = ""; int[] array = new int[26]; int intTemp; while (scan.hasNext()) { strIn += scan.nextLine(); } for (int i = 0; i < strIn.length(); i++) { ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String strIn = ""; int[] array = new int[26]; int intTemp; while (scan.hasNext()) { strIn += scan.nextLine(); } for (int i = 0; i < strIn.length(); i++) { ...
[["+", 0, 16, 31, 16, 31, 74, 39, 506, 0, 517], ["+", 3, 4, 0, 16, 31, 16, 31, 74, 0, 25], ["+", 0, 16, 31, 16, 31, 74, 51, 23, 0, 24]]
3
189
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { String input; int[][] a = new int[26][2]; for (int i = 0; i < 26; i++) { a[i][0] = 97 + i; } char[] c2; BufferedReader br...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { String input; int[][] a = new int[26][2]; for (int i = 0; i < 26; i++) { a[i][0] = 97 + i; } char[] c2; BufferedReader br...
[["-", 3, 4, 0, 16, 31, 16, 12, 5, 0, 491], ["+", 3, 4, 0, 16, 31, 16, 12, 5, 0, 491]]
3
248
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)); int[] count = new int[26]; char a = 'a'; while (true)...
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)); int[] count = new int[26]; char a = 'a'; while (true)...
[["-", 8, 196, 0, 57, 15, 15, 0, 492, 0, 131], ["-", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22], ["-", 0, 57, 15, 15, 0, 492, 3, 4, 0, 24], ["-", 15, 15, 0, 492, 3, 4, 0, 5, 0, 62], ["-", 0, 57, 15, 15, 0, 492, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 60], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 215]]
3
198
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); // List<Integer> x =new ArrayList<Integer>(); String str = new String(); int[] a = new int[26]; String[] eng = {"a", "b", "c", "d", "e", "f", "g", "h", "i", ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); // List<Integer> x =new ArrayList<Integer>(); String str = new String(); int[] a = new int[26]; String[] eng = {"a", "b", "c", "d", "e", "f", "g", "h", "i", ...
[["-", 3, 4, 0, 16, 31, 16, 12, 5, 0, 491], ["+", 3, 4, 0, 16, 31, 16, 12, 5, 0, 491]]
3
334
def az16(): list = [] n = eval(input()) for i in range(0,n): list.append(input().split()) print(list) for mark in ["S","H","C","D"]: for i in range(1,14): if [mark,repr(i)] not in list: print(mark,i) az16()
def az16(): list = [] n = eval(input()) for i in range(0,n): list.append(input().split()) for mark in ["S","H","C","D"]: for i in range(1,14): if [mark,repr(i)] not in list: print(mark,i) az16()
[["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
96
import sys SUITS = ['S', 'H', 'C', 'D'] exist_cards = {suit:[] for suit in suits} n = input() for line in sys.stdin: suit, number = line.split() exist_cards[suit].append(int(number)) for suit in SUITS: for i in range(1, 14): if i not in exist_cards[suit]: print(suit, i)
import sys SUITS = ['S', 'H', 'C', 'D'] exist_cards = {suit:[] for suit in SUITS} n = input() for line in sys.stdin: suit, number = line.split() exist_cards[suit].append(int(number)) for suit in SUITS: for i in range(1, 14): if i not in exist_cards[suit]: print(suit, i)
[["-", 0, 1, 0, 662, 12, 703, 0, 659, 12, 22], ["+", 0, 1, 0, 662, 12, 703, 0, 659, 12, 22]]
5
96
cards = { 'S': [r for f in range(1,13+1)], 'H': [r for f in range(1,13+1)], 'C': [r for f in range(1,13+1)], 'D': [r for f in range(1,13+1)], } n = int(input()) for nc in range(n): (s, r) = input().split() index = cards[s].index(int(r)) del cards[s][index] for s in ['S', 'H', 'C', 'D']: for r in car...
cards = { 'S': [r for r in range(1,13+1)], 'H': [r for r in range(1,13+1)], 'C': [r for r in range(1,13+1)], 'D': [r for r in range(1,13+1)], } n = int(input()) for nc in range(n): (s, r) = input().split() index = cards[s].index(int(r)) del cards[s][index] for s...
[["-", 12, 680, 0, 569, 51, 658, 0, 659, 31, 22], ["+", 12, 680, 0, 569, 51, 658, 0, 659, 31, 22]]
5
166
#coding:UTF-8 n = eval(input()) arr = {'S':list(range(13)),'H':list(range(13)),'C':list(range(13)),'D':list(range(13))} for i in range(n): a,b = input().split() b = int(b) arr[a][b-1] = 1 for j in ['S','H','C','D']: for k in range(13): if arr[j][k] == 1: continue print...
#coding:UTF-8 n = eval(input()) arr = {'S':list(range(13)),'H':list(range(13)),'C':list(range(13)),'D':list(range(13))} for i in range(n): a,b = input().split() b = int(b) arr[a][b-1] = 14 for j in ['S','H','C','D']: for k in range(13): if arr[j][k] == 14: continue print(j...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
152
cards = { 'S':[0 for _ in range(13)], 'H':[0 for _ in range(13)], 'C':[0 for _ in range(13)], 'D':[0 for _ in range(13)], } n = int(input()) for _ in range(n): (s, r) = input().split() r = int(r) cards[s][r - 1] = r for s in ( 'S', 'H', 'C', 'D'): for r in ...
cards = { 'S': [0 for _ in range(13)], 'H': [0 for _ in range(13)], 'C': [0 for _ in range(13)], 'D': [0 for _ in range(13)], } n = int(input()) for _ in range(n): (s, r) = input().split() r = int(r) cards[s][r - 1] = r for s in ('S', 'H', 'C', 'D'): for r in ...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131]]
5
165
cards = { 'S': [0 for _ in range(13)], 'H': [0 for _ in range(13)], 'C': [0 for _ in range(13)], 'D': [0 for _ in range(13)], } n = int(input()) for _ in range(n): (s, r) = input().split() cards[s][int(r) - 1] = 1 for _ in ('S', 'H', 'C', 'D'): for r in range(13): if...
cards = { 'S': [0 for _ in range(13)], 'H': [0 for _ in range(13)], 'C': [0 for _ in range(13)], 'D': [0 for _ in range(13)], } n = int(input()) for _ in range(n): (s, r) = input().split() cards[s][int(r) - 1] = 1 for s in ('S', 'H', 'C', 'D'): for r in range(13): if...
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22]]
5
155
from collections import OrderedDict cards = OrderedDict() cards['S'] = set() cards['H'] = set() cards['D'] = set() cards['C'] = set() n = int(input()) for _ in range(n): suit, num = input().split() num = int(num) cards[suit].add(num) for suit, nums in cards.items(): for num in range(1,14): if...
from collections import OrderedDict cards = OrderedDict() cards['S'] = set() cards['H'] = set() cards['C'] = set() cards['D'] = set() n = int(input()) for _ in range(n): suit, num = input().split() num = int(num) cards[suit].add(num) for suit, nums in cards.items(): for num in range(1,14): if...
[["-", 0, 1, 0, 662, 31, 206, 206, 557, 0, 6], ["+", 0, 1, 0, 662, 31, 206, 206, 557, 0, 6]]
5
124
cards = { "S" : [0 for i in range(13)], "H" : [0 for i in range(13)], "D" : [0 for i in range(13)], "C" : [0 for i in range(13)] } n = int(input()) for i in range(n): a,b = input().split() cards[a][int(b)-1] = 1 for a in ("S","H","D","C"): for b in range(13): if cards[a][b] == 0: print(a,b+1)
cards = { "S" : [0 for i in range(13)], "H" : [0 for i in range(13)], "C" : [0 for i in range(13)], "D" : [0 for i in range(13)] } n = int(input()) for i in range(n): a,b = input().split() cards[a][int(b)-1] = 1 for a in ("S","H","C","D"): for b in range(13): if cards[a][b] == 0: print(a,b+1)
[["-", 0, 662, 12, 680, 0, 569, 448, 557, 0, 6], ["+", 0, 662, 12, 680, 0, 569, 448, 557, 0, 6], ["-", 0, 656, 0, 7, 12, 660, 0, 557, 0, 6], ["+", 0, 656, 0, 7, 12, 660, 0, 557, 0, 6]]
5
152
def CheckCards(Mark): for i in range(1, 13): if [Mark, i] not in Cards: print(Mark + " " + str(i)) n = int(input()) Cards = [] for i in range(n): Cards.append(input().split()) Cards[i][1] = int(Cards[i][1]) CheckCards("S") CheckCards("H") CheckCards("C") CheckCards("D")
def CheckCards(Mark): for i in range(1, 14): if [Mark, i] not in Cards: print(Mark + " " + str(i)) n = int(input()) Cards = [] for i in range(n): Cards.append(input().split()) Cards[i][1] = int(Cards[i][1]) CheckCards("S") CheckCards("H") CheckCards("C") CheckCards("D")
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
113
marks='SHCD' n=eval(input()) card=[input().split() for _ in range(n)] m={} for mk,rk in card: m.setdefault(mk,[0]*14) m[mk][int(rk)]=1 for i in range(len(m)): k=marks[i] v=m[k] for j in range(1,14): if not v[j]: print(k, end=' ')
marks='SHCD' n=eval(input()) card=[input().split() for _ in range(n)] m={} for mk,rk in card: m.setdefault(mk,[0]*14) m[mk][int(rk)]=1 for i in range(len(m)): k=marks[i] v=m[k] for j in range(1,14): if not v[j]: print(k,j)
[["-", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["-", 0, 652, 3, 4, 0, 653, 51, 557, 0, 654], ["-", 0, 652, 3, 4, 0, 653, 51, 557, 0, 6], ["-", 0, 652, 3, 4, 0, 653, 51, 557, 0, 655], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
116
n=eval(input()) s=list(range(1,14)) h=list(range(1,14)) c=list(range(1,14)) d=list(range(1,14)) for i in range(n): m, k=input().split() if m == 'S': s[int(k)-1] = 0 elif m == 'H': h[int(k)-1] = 0 elif m == 'C': c[int(k)-1] = 0 elif m == 'D': d[int(k)-1] = 0 for i in rang...
n=eval(input()) s=list(range(1,14)) h=list(range(1,14)) c=list(range(1,14)) d=list(range(1,14)) for i in range(n): m, k=input().split() if m == 'S': s[int(k)-1] = 0 elif m == 'H': h[int(k)-1] = 0 elif m == 'C': c[int(k)-1] = 0 elif m == 'D': d[int(k)-1] = 0 for i in rang...
[["-", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6]]
5
271
n = int(input()) card = {"S":[0]*13, "H":[0]*13, "C":[0]*13, "D":[0]*13} for i in range(n): mark, nums = input().split() deck[mark][nums-1] = 1 for i in ["S", "H", "C", "D"]: for j in range(13): if deck[i][j] == 0: print("%s %d" % (i, j+1))
n = int(input()) card = {"S":[0]*13, "H":[0]*13, "C":[0]*13, "D":[0]*13} for i in range(n): mark, nums = input().split() card[mark][int(nums)-1] = 1 for i in ["S", "H", "C", "D"]: for j in range(13): if card[i][j] == 0: print("%s %d" % (i, j+1))
[["-", 0, 1, 0, 662, 31, 206, 51, 206, 51, 22], ["+", 0, 1, 0, 662, 31, 206, 51, 206, 51, 22], ["+", 0, 662, 31, 206, 206, 657, 31, 652, 63, 22], ["+", 31, 206, 206, 657, 31, 652, 3, 4, 0, 24], ["+", 31, 206, 206, 657, 31, 652, 3, 4, 0, 25], ["-", 0, 57, 15, 666, 0, 206, 51, 206, 51, 22], ["+", 0, 57, 15, 666, 0, 206, ...
5
135
n = eval(input()) data = [] a = [] for i in ['S', 'H', 'C', 'D']: for j in map(str , range(1, 14)): data.append(i + j) for i in range(n): data.remove(input()) for i in range(len(data)): print(data[i])
n = eval(input()) data = [] space = [] for i in ['S ', 'H ', 'C ', 'D ']: for j in map( str , range(1, 14)): data.append(i + j) for i in range(n): data.remove(input()) for i in range(len(data)): print(data[i])
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 656, 0, 7, 12, 634, 0, 557, 0, 6], ["+", 0, 656, 0, 7, 12, 634, 0, 557, 0, 6]]
5
94
#coding: UTF-8 x = int(eval(input())) a = 0 s = 0 h = 0 c = 0 d = 0 lists = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] listh = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] listc = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] listd = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] while a < x: l = input().split() a += 1 ...
#coding: UTF-8 x = int(eval(input())) a = 0 s = 0 h = 0 c = 0 d = 0 lists = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] listh = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] listc = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] listd = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] while a < x: l = input().split() a += 1 ...
[["-", 3, 4, 0, 657, 31, 61, 0, 557, 0, 6], ["-", 3, 4, 0, 657, 31, 61, 0, 557, 0, 655], ["-", 3, 4, 0, 657, 31, 61, 0, 557, 0, 654], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6]]
5
303
n = eval(input()) a = [input() for _ in range(n)] b = [] for i in ['S ','H ','C ','D ']: for j in range(1,14): b.append(i+str(j)) for i in a: b.remove(i) for i in b: print(b)
n = eval(input()) a = [input() for _ in range(n)] b = [] for i in ['S ','H ','C ','D ']: for j in range(1,14): b.append(i+str(j)) for i in a: b.remove(i) for i in b: print(i)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
88
S = [] H = [] C = [] D = [] for i in (S, H, C, D): for k in range(1, 13+1): i.append(k) for u in range(0, int(input())): x, y = (i for i in input().split()) if x == "S": S.remove(int(y)) elif x == "H": H.remove(int(y)) elif x == "C": H.remove(int(y)) els...
S = [] H = [] C = [] D = [] for i in (S, H, C, D): for k in range(1, 13+1): i.append(k) for u in range(0, int(input())): x, y = (i for i in input().split()) if x == "S": S.remove(int(y)) elif x == "H": H.remove(int(y)) elif x == "C": C.remove(int(y)) els...
[["-", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22]]
5
266
data = [ "{0} {1}".format(s, r) for s in ('S', 'H', 'C', 'D') for r in range(1, 13 + 1) ] count = int(input()) for c in range(count): card = input() data.remove(card) print(data)
data = [ "{0} {1}".format(s, r) for s in ('S', 'H', 'C', 'D') for r in range(1, 13 + 1) ] count = int(input()) for c in range(count): card = input() data.remove(card) for c in data: print(c)
[["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 102], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
76
data = ["{0} {1}".format(s, r) for s in ('S', 'H', 'C', 'D') for r in range(1, 13, + 1)] count = int(input()) for c in range(count): card = input() data.remove(card) for c in data: print(c)
data = [ "{0} {1}".format(s, r) for s in ('S', 'H', 'C', 'D') for r in range(1, 13 + 1) ] count = int(input()) for c in range(count): card = input() data.remove(card) for c in data: print(c)
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 21]]
5
82
s = list(range(1,14)) h = list(range(1,14)) c = list(range(1,14)) d = list(range(1,14)) n = eval(input()) for i in range(n): mark, number = input().split() if mark == 'S': s[int(number)-1] = 0 elif mark == 'H': h[int(number)-1] = 0 elif mark == 'C': c[int(number)-1] = 0 elif mark == 'D': d[int(number)-1...
s = list(range(1,14)) h = list(range(1,14)) c = list(range(1,14)) d = list(range(1,14)) n = eval(input()) for i in range(n): mark, number = input().split() if mark == 'S': s[int(number)-1] = 0 elif mark == 'H': h[int(number)-1] = 0 elif mark == 'C': c[int(number)-1] = 0 elif mark == 'D': d[int(number)-1...
[["-", 0, 652, 3, 4, 0, 657, 12, 206, 51, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 206, 51, 22]]
5
251
n = int(input()) S = [] H = [] C = [] D = [] for i in range(0, n): x = list(input().split()) if x[0] == 'S': S.append(int(x[1])) elif x[0] == 'H': H.append(int(x[1])) elif x[0] == 'C': C.append(int(x[1])) else: D.append(int(x[1])) def pr(list, type): list.sort() for i in range(1, 14): if i not in list:...
n = int(input()) S = [] H = [] C = [] D = [] for i in range(0, n): x = list(input().split()) if x[0] == 'S': S.append(int(x[1])) elif x[0] == 'H': H.append(int(x[1])) elif x[0] == 'C': C.append(int(x[1])) else: D.append(int(x[1])) def pr(list, type): list.sort() for i in range(1, 14): if i not in list:...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
203
cards = { 'S':[0 for i in range(13)], 'H':[0 for i in range(13)], 'C':[0 for i in range(13)], 'D':[0 for i in range(13)] } n = int(input()) for i in range(n): c, s = input().split() cards[c][int(s)-1] = int(s) for i in ('S','H','C','D'): for j in range(0,13): if cards[i][j] == 0: print('...
cards = { 'S':[0 for i in range(13)], 'H':[0 for i in range(13)], 'C':[0 for i in range(13)], 'D':[0 for i in range(13)] } n = int(input()) for i in range(n): c, s = input().split() cards[c][int(s)-1] = int(s) for i in ('S','H','C','D'): for j in range(13): if cards[i][j] == 0: print('{}...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
162
cards = [[False] * 14 for i in range(4)] n = int(input()) for i in range(n): suit, rank = input().split() r = int(rank) if suit == "S": s = 0 elif suit == "H": s = 1 elif suit == "C": s = 2 else: s = 3 cards[s][r] = True name = ["S", "H", "C", "D"] for s in r...
cards = [[False] * 14 for i in range(4)] n = int(input()) for i in range(n): suit, rank = input().split() r = int(rank) if suit == "S": s = 0 elif suit == "H": s = 1 elif suit == "C": s = 2 else: s = 3 cards[s][r] = True name = ["S", "H", "C", "D"] for s in r...
[["+", 0, 7, 8, 196, 0, 57, 15, 681, 0, 372]]
5
148
l=[] for mark in ["S","H","C","D"]: for i in range(1,14): l.append(mark+" "+str(i)) print(l) n=input() for i in range(int(n)): l.remove(input()) for i in l: print(i)
l=[] for mark in ["S","H","C","D"]: for i in range(1,14): l.append(mark+" "+str(i)) n=input() for i in range(int(n)): l.remove(input()) for i in l: print(i)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
87
suits = {"S":0, "H":1, "C":2, "D":3} cards = [[0 for i2 in range(13)] for i1 in ("S", "H", "C", "D")] n = int(input()) for i in range(n): (suit, rank) = input().split(" ") cards[suits[suit]][int(rank)] = 1 for suit in ("S", "H", "C", "D"): for number in range(13): if cards[suits[suit]][number + 1]...
suits = {"S":0, "H":1, "C":2, "D":3} cards = [[0 for i2 in range(13)] for i1 in ("S", "H", "C", "D")] n = int(input()) for i in range(n): (suit, rank) = input().split(" ") cards[suits[suit]][int(rank) - 1] = 1 for suit in ("S", "H", "C", "D"): for number in range(13): if cards[suits[suit]][number]...
[["+", 0, 1, 0, 662, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 12, 612], ["-", 0, 57, 15, 666, 0, 206, 206, 657, 17, 72], ["-", 0, 57, 15, 666, 0, 206, 206, 657, 12, 612]]
5
161
l=[] for x in ['S','H','C','D']: for y in [str(i+1) for i in range(13)]: l += [x+' '+y] for n in range(input()): l.remove(input()) for i in l: print(i)
l=[] for x in ['S','H','C','D']: for y in [str(i+1) for i in range(13)]: l += [x+' '+y] for n in range(int(input())): l.remove(input()) for i in l: print(i)
[["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
82
#!usr/bin/env python3 import sys def main(): # s: spades # h: hearts # c: clubs # d: diamonds card_deck = {'S': [], 'H': [], 'C': [], 'D': []} card_symbols = ['S', 'H', 'C', 'D'] n = int(sys.stdin.readline()) for i in range(n): lst = [card for card in sys.stdin.readline().spl...
#!usr/bin/env python3 import sys def main(): # s: spades # h: hearts # c: clubs # d: diamonds card_deck = {'S': [], 'H': [], 'C': [], 'D': []} card_symbols = ['S', 'H', 'C', 'D'] n = int(sys.stdin.readline()) for i in range(n): lst = [card for card in sys.stdin.readline().spl...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
178
n = int(input()) S = [1]*13 H = [1]*13 C = [1]*13 D = [1]*13 mark = [""]*n num = [""]*n for i in range(n): mark[i], num[i] = map(str, input().split()) for i in range(n): if mark[i] == "S": S[int(num[i])-1] = 0 if mark[i] == "H": H[int(num[i])-1] = 0 if mark[i] == "C": C[int(n...
n = int(input()) S = [1]*13 H = [1]*13 C = [1]*13 D = [1]*13 mark = [""]*n num = [""]*n for i in range(n): mark[i], num[i] = input().split() for i in range(n): if mark[i] == "S": S[int(num[i])-1] = 0 if mark[i] == "H": H[int(num[i])-1] = 0 if mark[i] == "C": C[int(num[i])-1] ...
[["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22]]
5
294