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) { int n, x, i, j, k, cnt; scanf("%d %d", &n, &x); while (n || x) { cnt = 0; for (i = 0; i <= n; i++) { for (j = i + 1; j <= n; j++) { for (k = j + 1; k <= n; k++) { if (i + j + k == x) { cnt++; } } } } p...
#include <stdio.h> int main(void) { int n, x, i, j, k, cnt; scanf("%d %d", &n, &x); while (n || x) { cnt = 0; for (i = 1; i <= n; i++) { for (j = i + 1; j <= n; j++) { for (k = j + 1; k <= n; k++) { if (i + j + k == x) { cnt++; } } } } p...
[["-", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
135
#include <stdio.h> int main() { int n, x, i, j, k, c; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; c = 0; for (i = 1; i <= n; i++) { for (j = i; j <= n; j++) { for (k = j; k <= n; k++) { if (i + j + k == x) c++; } } } ...
#include <stdio.h> int main() { int n, x, i, j, k, c; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; c = 0; for (i = 1; i <= n; i++) { for (j = i + 1; j <= n; j++) { for (k = j + 1; k <= n; k++) { if (i + j + k == x) c++; } }...
[["+", 8, 9, 0, 7, 10, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 10, 11, 12, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
126
#include <stdio.h> int main(void) { int i, s, t, n, x, count; for (;;) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) { break; } count = 0; for (i = 1; i <= (n + 1) / 2; i++) { for (t = i + 1; t <= n; t++) { for (s = t + 1; s <= n; s++) { if (i + s + t == x) { ...
#include <stdio.h> int main(void) { int i, s, t, n, x, count; for (;;) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) { break; } count = 0; for (i = 1; i <= n; i++) { for (t = i + 1; t <= n; t++) { for (s = t + 1; s <= n; s++) { if (i + s + t == x) { ...
[["-", 0, 7, 15, 16, 12, 16, 31, 23, 0, 24], ["-", 15, 16, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 15, 16, 12, 16, 31, 23, 0, 16, 12, 13], ["-", 0, 7, 15, 16, 12, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 85], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
144
#include <stdio.h> int main() { int n, x; int N, i, j, k; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) { break; } N = 0; for (i = 1; i < n - 1; i++) { for (j = i + 1; j < n; j++) { for (k = j + 1; k < n + 1; k++) { if (i + j + k == x) { ...
#include <stdio.h> int main() { int n, x; int N, i, j, k; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) { break; } N = 0; for (i = 1; i < n - 1; i++) { for (j = i + 1; j < n; j++) { for (k = j + 1; k < n + 1; k++) { if (i + j + k == x) N...
[["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
143
#include <stdio.h> int main() { int max, goukei, Count = 0, i, j, k; scanf("%d %d", &max, &goukei); while ((max != 0) && (goukei != 0)) { for (i = 1; i <= max; i++) { for (j = i + 1; j <= max; j++) { for (k = j + 1; k <= max; k++) { if (i + j + k == goukei) { Count++; ...
#include <stdio.h> int main() { int max, goukei, Count = 0, i, j, k; scanf("%d %d", &max, &goukei); while ((max != 0) || (goukei != 0)) { for (i = 1; i <= max; i++) { for (j = i + 1; j <= max; j++) { for (k = j + 1; k <= max; k++) { if (i + j + k == goukei) { Count++; ...
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 98], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 106]]
0
146
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { int c, i, j, k, l, n, x, count, counta[100]; l = 0; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) { break; } count = 0; for (i = 1; i <= n - 2; i++) { for (j = i + 1; j < n - 1; j++) { for (k = j +...
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { int c, i, j, k, l, n, x, count, counta[100]; l = 0; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) { break; } count = 0; for (i = 1; i <= n; i++) { for (j = i + 1; j < n; j++) { for (k = j + 1; k <=...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
183
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { int c, i, j, k, l, n, x, count, counta[100]; l = 0; while (1) { scanf("%d %d", &n, &x); if (n == 0 || x == 0) { break; } count = 0; for (i = 1; i <= n - 2; i++) { for (j = 2; j <= n - 1; j++) { for (k = 3; k <...
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { int c, i, j, k, l, n, x, count, counta[100]; l = 0; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) { break; } count = 0; for (i = 1; i <= n; i++) { for (j = 2; j < n; j++) { for (k = 3; k <= n; k++)...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 98], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18]]
0
191
#include <stdio.h> int main(void) { int n, x; int i, j, k; int c; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; c = 0; for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { for (k = 1; k <= n; k++) { if (i + j + k == x) c++; ...
#include <stdio.h> int main(void) { int n, x; int i, j, k; int c; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; c = 0; for (i = 1; i <= n; i++) { for (j = 1; j < i; j++) { for (k = 1; k < j; k++) { if (i + j + k == x) c++; } ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
0
130
#include <stdio.h> int main(void) { while (1) { int n, i, j, g, x, y = 0; scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; for (i = 1; i <= n - 1; i++) { for (j = i + 1; j <= n - 1; j++) { for (g = j + 1; g <= n - 1; g++) { if (i + j + g == x) y++; ...
#include <stdio.h> int main(void) { while (1) { int n, i, j, g, x, y = 0; scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; for (i = 1; i <= n - 2; i++) { for (j = i + 1; j <= n - 1; j++) { for (g = j + 1; g <= n; g++) { if (i + j + g == x) y++; } ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
0
138
#include <stdio.h> int main(void) { int n, x, c; while (1) { scanf("%d%d", &n, &x); if (!n && !x) break; c = 0; for (int i = 1; i <= n; i++) for (int l = i + 1; l <= n; l++) for (int m = l + 1; m <= n; m++) if (i + l + m == 9) c++; printf("%d\n", c); ...
#include <stdio.h> int main(void) { int n, x, c; while (1) { scanf("%d%d", &n, &x); if (!n && !x) break; c = 0; for (int i = 1; i <= n; i++) for (int l = i + 1; l <= n; l++) for (int m = l + 1; m <= n; m++) if (i + l + m == x) c++; printf("%d\n", c); ...
[["-", 8, 7, 8, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 7, 8, 57, 15, 23, 0, 16, 12, 22]]
0
121
#include <stdio.h> int main(void) { int n, x; int i, j, k; int a = 0; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; for (i = 1; i <= n - 2; i++) { for (j = i + 1; j <= n - 1; j++) { for (k = j + 1; j <= n; j++) { if ((i + j + k) == x) a =...
#include <stdio.h> int main(void) { int n, x; int i, j, k; int a = 0; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; for (i = 1; i <= n - 2; i++) { for (j = i + 1; j <= n - 1; j++) { for (k = j + 1; k <= n; k++) { if ((i + j + k) == x) a++...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 72], ["-", 0, 57, 64, 1, 0, 11...
0
145
#include <stdio.h> int main(int argc, const char *argv[]) { int i, j, k; int n, x, count; while (1) { count = 0; scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { for (k = 1; k <= n; k++) { if (i + j + k == x...
#include <stdio.h> int main(int argc, const char *argv[]) { int i, j, k; int n, x, count; while (1) { count = 0; scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; for (i = 1; i <= n; i++) { for (j = i + 1; j <= n; j++) { for (k = j + 1; k <= n; k++) { if (i + j ...
[["+", 8, 9, 0, 7, 10, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 10, 11, 12, 16, 17, 72]]
0
137
#include <stdio.h> int main(void) { int n, x, i, j, k, a; while (1) { scanf("%d%d", &n, &x); if (!(n && x)) break; a = 0; for (i = 1; i < n - 1; i++) for (j = i + 1; j < n; j++) for (k = j + 1; k <= n; k++) if (i + j + k == x) a++; printf("%d\n", a); ...
#include <stdio.h> int main(void) { int n, x, i, j, k, a; while (1) { scanf("%d%d", &n, &x); if (!(n || x)) break; a = 0; for (i = 1; i < n - 1; i++) for (j = i + 1; j < n; j++) for (k = j + 1; k <= n; k++) if (i + j + k == x) a++; printf("%d\n", a); ...
[["-", 15, 23, 0, 91, 28, 23, 0, 16, 17, 98], ["+", 15, 23, 0, 91, 28, 23, 0, 16, 17, 106]]
0
127
#include <stdio.h> int main() { int n, x; while (1) { scanf("%d%d", &n, &x); if (x == 0 && x == 0) break; int num1[n]; int num2[n]; int num3[n]; int i = 1; int j = 1; int k = 1; int count = 0; for (i = 1; i <= n - 2; i++) { num1[i] = i; for (j = i + 1; ...
#include <stdio.h> int main() { int n, x; while (1) { scanf("%d%d", &n, &x); if (n == 0 && x == 0) break; int num1[n]; int num2[n]; int num3[n]; int i = 1; int j = 1; int k = 1; int count = 0; for (i = 1; i <= n - 2; i++) { num1[i] = i; for (j = i + 1; ...
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 31, 22]]
0
225
#include <stdio.h> int main() { int n, x; int i, j, k; int cnt; while (1) { scanf("%d%d", &n, &x); if (n == 0 && x == 0) break; cnt = 0; for (i = 0; i < n - 2; i++) for (j = i + 1; j < n - 1; j++) for (k = j + 1; k < n; k++) if (i + j + k == x) cnt++; ...
#include <stdio.h> int main() { int n, x; int i, j, k; int cnt; while (1) { scanf("%d%d", &n, &x); if (n == 0 && x == 0) break; cnt = 0; for (i = 1; i <= n - 2; i++) for (j = i + 1; j <= n - 1; j++) for (k = j + 1; k <= n; k++) if (i + j + k == x) cnt+...
[["-", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 7, 8, 7, 15, 16, 17, 18], ["+", 8, 9, 0, 7, 8, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 7, 8, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 7, 8, 7, 15, ...
0
131
#include <stdio.h> int main(void) { int n, x, a, b, c, ret; for (;;) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; ret = 0; for (c = 1; c <= n; ++c) { for (b = 1; b < c; ++b) { a = c - c - b; if (a < b && a > 0) { ret++; } } } pr...
#include <stdio.h> int main(void) { int n, x, a, b, c, ret; for (;;) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; ret = 0; for (c = 1; c <= n; ++c) { for (b = 1; b < c; ++b) { a = x - c - b; if (a < b && a > 0) { ret++; } } } p...
[["-", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 31, 22]]
0
124
#include <stdio.h> int main(int argc, char *argv) { int n, x, c; int i, j, k; scanf("%d %d", &n, &x); while ((n != 0) || (x != 0)) { c = 0; for (i = 1; i < n - 1; i++) { for (j = i + 1; j < n - 1; j++) { for (k = j + 1; k < n; k++) { if ((i + j + k) == x) { c++; ...
#include <stdio.h> int main(int argc, char *argv) { int n, x, c; int i, j, k; scanf("%d %d", &n, &x); while ((n != 0) || (x != 0)) { c = 0; for (i = 1; i < n; i++) { for (j = i + 1; j < n; j++) { for (k = j + 1; k <= n; k++) { if ((i + j + k) == x) { c++; ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
0
159
#include <stdio.h> int main(void) { int n, x, i, j, k, num = 0; scanf("%d %d", &n, &x); while (1) { for (i = 1; i < n; i++) { for (j = i + 1; j < n; j++) { for (k = j + 1; k < n; k++) { if (i + j + k == x) { num = num + 1; } } } } printf("%d...
#include <stdio.h> int main(void) { int n, x, i, j, k, num = 0; scanf("%d %d", &n, &x); while (1) { for (i = 1; i <= n; i++) { for (j = i + 1; j <= n; j++) { for (k = j + 1; k <= n; k++) { if (i + j + k == x) { num = num + 1; } } } } printf(...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
0
154
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) int main() { while (true) { int n, x; cin >> n >> x; if (n == 0 && x == 0) return 0; int cou = 0; for (int i = 1; i <= n; i++) { for (int j = i; j <= n;...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) int main() { while (true) { int n, x; cin >> n >> x; if (n == 0 && x == 0) return 0; int cou = 0; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
126
#include <algorithm> #include <iostream> using namespace std; int main() { int n, x, j, k; while (cin >> n >> x && n && x) { if (x > 3 * n - 3) { cout << "0\n"; continue; } int count = 0; int kmax = min(n + 1, x - 2); for (k = max(3, x - 2 * n + 3); k < kmax; ++k) { int jm...
#include <algorithm> #include <iostream> using namespace std; int main() { int n, x, j, k; while (cin >> n >> x && (n || x)) { if (x > 3 * n - 3) { cout << "0\n"; continue; } int count = 0; int kmax = min(n + 1, x - 2); for (k = max(3, x - 2 * n + 3); k < kmax; ++k) { int ...
[["+", 0, 52, 15, 339, 51, 16, 12, 23, 0, 24], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 106], ["+", 0, 52, 15, 339, 51, 16, 12, 23, 0, 25]]
1
162
#include "bits/stdc++.h" using namespace std; #define int long long int mod = 1e9 + 7; signed main() { while (true) { int n, x; cin >> n >> x; if (n == 0 && x == 0) break; int ans = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= n; k++) {...
#include "bits/stdc++.h" using namespace std; #define int long long int mod = 1e9 + 7; signed main() { while (true) { int n, x; cin >> n >> x; if (n == 0 && x == 0) break; int ans = 0; for (int i = 1; i <= n; i++) { for (int j = i; j <= n; j++) { for (int k = j; k <= n; k++) {...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22]]
1
141
#include <iostream> using namespace std; int main() { int n, x, cul; do { cin >> n >> x; if (!(n == 0 && x == 0)) { cul = 0; for (int min = 1; min < x / 3; min++) { for (int mid = min + 1; mid < x / 2; mid++) { if (x - min - mid <= n) cul++; } } ...
#include <iostream> using namespace std; int main() { int n, x, cul; do { cin >> n >> x; if (!(n == 0 && x == 0)) { cul = 0; for (int min = 1; min < x / 3; min++) { for (int mid = min + 1; mid < x - min - mid; mid++) { if (x - min - mid <= n) cul++; } ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 85], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 7, 15, 16, 12, 16, 31, 16, 17, 33], ["+", 0, 7, 15, 16, 12, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22]]
1
118
#include <bits/stdc++.h> using namespace std; int solve(int, int); int main() { int n, x; while (1) { cin >> n >> x; if (n == 0 && x == 0) { break; } else { cout << solve(n, x) << endl; } } } int solve(int n, int x) { int cnt = 0; for (int i = 0; i < n; i++) { for (int j ...
#include <bits/stdc++.h> using namespace std; int solve(int, int); int main() { int n, x; while (1) { cin >> n >> x; if (n == 0 && x == 0) { break; } else { cout << solve(n, x) << endl; } } } int solve(int n, int x) { int cnt = 0; for (int i = 0; i < n; i++) { for (int j ...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
166
#include <bits/stdc++.h> #define endl "\n" using namespace std; int threesum(int x, int n) { if (x + (x - 1) + (x - 2) < n) return 0; int count = 0; for (; x > 0; --x) { int n1 = n - x; if (n1 < 0) break; for (int j = x - 1; j > 0; --j) { int n2 = n1 - j; if (n2 <= 0 || n2 >= j)...
#include <bits/stdc++.h> #define endl "\n" using namespace std; int threesum(int x, int n) { if (x + (x - 1) + (x - 2) < n) return 0; int count = 0; for (; x > 0; --x) { int n1 = n - x; if (n1 < 0) continue; for (int j = x - 1; j > 0; --j) { int n2 = n1 - j; if (n2 <= 0 || n2 >=...
[["-", 0, 7, 8, 9, 0, 57, 64, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117]]
1
201
#include <bits/stdc++.h> using std::cin; using std::cout; using std::endl; int main() { int x, n, C = 1, i = 0; std::vector<int> data(10); cin >> n >> x; while (n != 0 && x != 0) { int count = 0; for (int j = 1; j <= n; j++) { for (int k = 1; k < j; k++) { for (int l = 1; l < k; l++) { ...
#include <bits/stdc++.h> using std::cin; using std::cout; using std::endl; int main() { int x, n, C = 1, i = 0; std::vector<int> data(10); cin >> n >> x; while ((n != 0) || (x != 0)) { int count = 0; for (int j = 1; j <= n; j++) { for (int k = 1; k < j; k++) { for (int l = 1; l < k; l++...
[["+", 0, 52, 15, 339, 51, 16, 31, 23, 0, 24], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 0, 52, 15, 339, 51, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 106], ["+", 0, 52, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 0, 52, 15, 339, 51, 16, 12, 23, 0, 25]]
1
197
#include <iostream> using namespace std; int main() { int n, x; while (1) { cin >> n >> x; if (n == 0 && x == 0) break; int count = 0; for (int i = 1; i < n; i++) { for (int j = i + 1; j < n; j++) { for (int k = j + 1; k < n; k++) { if (i + j + k == x) co...
#include <iostream> using namespace std; int main() { int n, x; while (1) { cin >> n >> x; if (n == 0 && x == 0) break; int count = 0; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { for (int k = j + 1; k <= n; k++) { if (i + j + k == x) ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
118
#include <iostream> using namespace std; int main() { int n, x, t, b; t = 0; n = 1; x = 1; cin >> n >> x; while (n != 0 && x != 0) { for (int i = 1; i <= n; i++) { for (int a = i + 1; a <= n; a++) { for (int b = a + 1; b <= n; b++) { if (a + b + i == x) t += 1; ...
#include <iostream> using namespace std; int main() { int n, x, t, b; t = 0; n = 1; x = 1; cin >> n >> x; while (n != 0 || x != 0) { for (int i = 1; i <= n; i++) { for (int a = i + 1; a <= n; a++) { for (int b = a + 1; b <= n; b++) { if (a + b + i == x) t += 1; ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 106], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 107], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["-", 0, 7, 8, 9, 0, 57, 64, 1, 0, 35], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22]]
1
137
#include <iostream> using namespace std; int count(int n, int x) { int cnt = 0; for (int i = 1; i <= n - 2; i++) { for (int j = i + 1; j <= n - 1; j++) { for (int k = j + 1; k <= n; k++) { if (i + j + k == x) cnt++; } } } return cnt; } int main() { int n, x; while (1...
#include <iostream> using namespace std; int count(int n, int x) { int cnt = 0; for (int i = 1; i <= n - 2; i++) { for (int j = i + 1; j <= n - 1; j++) { for (int k = j + 1; k <= n; k++) { if (i + j + k == x) cnt++; } } } return cnt; } int main() { int n, x; while (1...
[["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
143
#include <iostream> using namespace std; int main() { int n, x; while (true) { cin >> n >> x; if (n == 0 and x == 0) { break; } int num = 0; for (int i = 1; i < n; ++i) { for (int j = i + 1; j < n; ++j) { for (int k = j + 1; k < n; ++k) { if ((i != j and j != k a...
#include <iostream> using namespace std; int main() { int n, x; while (true) { cin >> n >> x; if (n == 0 and x == 0) { break; } int num = 0; for (int i = 1; i <= n; ++i) { for (int j = i + 1; j <= n; ++j) { for (int k = j + 1; k <= n; ++k) { if ((i != j and j != ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
140
#include <algorithm> #include <cctype> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int main() { for (;;) { int n, x; int ans = 0; scanf("%d %d", &n, &x); if (!x) break; for (int i = 1; i < n - 1; i++) { for (int j = i + 1; j < n; j++) {...
#include <algorithm> #include <cctype> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int main() { for (;;) { int n, x; int ans = 0; scanf("%d %d", &n, &x); if (!n) break; for (int i = 1; i < n - 1; i++) { for (int j = i + 1; j < n; j++) {...
[["-", 8, 9, 0, 57, 15, 339, 51, 91, 28, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 28, 22]]
1
143
#include <iostream> using namespace std; int main() { int n, x, c; while (x) { cin >> n >> x; if (n == 0 && x == 0) break; c = 0; for (int i = 1; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { for (int k = j + 1; k <= n; k++) { if (x == i + j + k) ...
#include <iostream> using namespace std; int main() { int n, x, c; while (1) { cin >> n >> x; if (n == 0 && x == 0) break; c = 0; for (int i = 1; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { for (int k = j + 1; k <= n; k++) { if (x == i + j + k) ...
[["-", 0, 14, 8, 9, 0, 52, 15, 339, 51, 22], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 51, 13]]
1
123
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <set> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define pb push_back #define mp make_pair #define it ::iterator #define all(i...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <set> #include <string> #include <utility> #include <vector> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define pb push_back #define mp make_pair #define it ::iterator #define all(i...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
164
#include <iostream> using namespace std; int main() { while (1) { int n, x; cin >> n >> x; if (n == 0 && x == 0) break; int cnt = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { for (int k = j + 1; k < n; k++) { if (i + j + k == x) cnt+...
#include <iostream> using namespace std; int main() { while (1) { int n, x; cin >> n >> x; if (n == 0 && x == 0) break; int cnt = 0; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { for (int k = j + 1; k <= n; k++) { if (i + j + k == x) c...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
120
#include <algorithm> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vi vector<int> #define All(X) X.begin...
#include <algorithm> #include <cmath> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define vvi vector<vector<int>> #define vi vector<int> #define All(X) X.begin...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
1
220
#include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <vector> using namespace std; typedef long long ll; int main() { int n, x; while (cin >> n >> x, n || x) { int ans = 0; for (int a = 1; a <= n; ++a) for (int b = 1; b <= n; ++b) for (int c = 1; c <= n; ++c...
#include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <vector> using namespace std; typedef long long ll; int main() { int n, x; while (cin >> n >> x, n || x) { int ans = 0; for (int a = 1; a <= n; ++a) for (int b = a + 1; b <= n; ++b) for (int c = b + 1; c <...
[["+", 8, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 7, 10, 43, 49, 50, 51, 16, 17, 72]]
1
110
#include <iostream> using namespace std; int main() { int max, object; int count = 0; while (1) { count = 0; cin >> max >> object; if (max * object == 0) { break; } for (int i = 1; i < max - 1; i++) { for (int j = i + 1; j < max; j++) { if (object - i - j <= max && object ...
#include <iostream> using namespace std; int main() { int max, object; int count = 0; while (1) { count = 0; cin >> max >> object; if (max == 0 && object == 0) { break; } for (int i = 1; i < max - 1; i++) { for (int j = i + 1; j < max; j++) { if (object - i - j <= max && o...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
118
#include <cstring> #include <iostream> using namespace std; int main() { int Ans[1000][3000]; int n[100000], x[100000]; int c = 0; memset(Ans, 0, sizeof(Ans)); for (int i = 3; i <= 100; i++) { for (int j = 3; j <= i; j++) { for (int k = 2; k < j; k++) { for (int l = 1; l < k; l++) { ...
#include <cstring> #include <iostream> using namespace std; int main() { int Ans[500][1000]; int n[100000], x[100000]; int c = 0; memset(Ans, 0, sizeof(Ans)); for (int i = 3; i <= 100; i++) { for (int j = 3; j <= i; j++) { for (int k = 2; k < j; k++) { for (int l = 1; l < k; l++) { ...
[["-", 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, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
219
#include <cstdio> #include <iostream> #define _USE_MATH_DEFINES #include <math.h> #include <vector> using namespace std; void solve() { int n, x; while (cin >> n >> x, n || x) { int ans = 0; for (int i = 0; i <= n - 2; ++i) { for (int j = i + 1; j <= n - 1; ++j) { if (x - i - j <= n && x - i...
#include <cstdio> #include <iostream> #define _USE_MATH_DEFINES #include <math.h> #include <vector> using namespace std; void solve() { int n, x; while (cin >> n >> x, n || x) { int ans = 0; for (int i = 1; i <= n - 2; ++i) { for (int j = i + 1; j <= n - 1; ++j) { if (x - i - j <= n && x - i...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
133
#include <iostream> using namespace std; int main() { int n, x, c; for (int h = 1;; h++) { cin >> n >> x; c = 0; if (n == 0 && x == 0) break; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { for (int k = j + 1; j <= n; j++) { if (!(i == j || j == k |...
#include <iostream> using namespace std; int main() { int n, x, c; for (int h = 1;; h++) { cin >> n >> x; c = 0; if (n == 0 && x == 0) break; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { for (int k = j + 1; k <= n; k++) { if (!(i == j || j == k |...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22]]
1
151
#include <iostream> using namespace std; int main() { while (1) { int n, x; cin >> n >> x; if (n == 0) break; int ans = 0; for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) // for(int k=j+1; k<=n; k++) // if(i+j+k==x) ans++; if (x - i - j > j && x ...
#include <iostream> using namespace std; int main() { while (1) { int n, x; cin >> n >> x; if (n == 0) break; int ans = 0; for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) // for(int k=j+1; k<=n; k++) // if(i+j+k==x) ans++; if (x - i - j > j && x ...
[["-", 8, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 8, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
104
#include <bits/stdc++.h> using namespace std; main() { while (1) { int x, n, count = 0; cin >> n >> x; if (x == 0 && n == 0) break; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= n; k++) { if (i + j + k == x && i != j && i != k && j !=...
#include <bits/stdc++.h> using namespace std; main() { while (1) { int x, n, count = 0; cin >> n >> x; if (x == 0 && n == 0) break; for (int i = 1; i <= n; i++) { for (int j = i; j <= n; j++) { for (int k = j; k <= n; k++) { if (i + j + k == x && i != j && i != k && j !...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22]]
1
123
#include <iostream> using namespace std; int main() { int n, x, i = 0; for (;;) { cin >> n >> x; if (n != 0 && x != 0) { for (int a = 0; a < n - 2; a++) { for (int b = a + 1; b < n - 1; b++) { for (int c = b + 1; c < n; c++) { if (a + b + c + 3 == x) i++; ...
#include <iostream> using namespace std; int main() { int n, x, i = 0; for (;;) { cin >> n >> x; if (n != 0 || x != 0) { for (int a = 0; a < n - 2; a++) { for (int b = a + 1; b < n - 1; b++) { for (int c = b + 1; c < n; c++) { if (a + b + c + 3 == x) i++; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13]]
1
129
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <ut...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <ut...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
181
#include <iostream> using namespace std; class CCombi { public: // Public member function CCombi(void); bool Input(void); void InputDataSet(void); void PrintCountcombi(void); bool CheckPrm(int num, int sum); bool CheckEnd(void); void CountCombination(void); private: // Private member variable stat...
#include <iostream> using namespace std; class CCombi { public: // Public member function CCombi(void); bool Input(void); void InputDataSet(void); void PrintCountcombi(void); bool CheckPrm(int num, int sum); bool CheckEnd(void); void CountCombination(void); private: // Private member variable stat...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
411
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) for (int i = (n)-1; (i) >= 0; --i) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD LL(1e9 + 7) #define INF 1000000 using namespace std; using LL = long long; i...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) for (int i = (n)-1; (i) >= 0; --i) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD LL(1e9 + 7) #define INF 1000000 using namespace std; using LL = long long; i...
[["-", 15, 339, 51, 91, 28, 23, 0, 16, 17, 48], ["+", 15, 339, 51, 91, 28, 23, 0, 16, 17, 72]]
1
169
#include <iostream> using namespace std; int main() { int n, x; cin >> n >> x; while (n != 0 && x != 0) { if (x < 6 || x > 3 * n - 3) { cout << 0 << endl; cin >> n >> x; continue; } int a, b, c; a = x / 3; b = (x - a) / 2; c = x - (a + b); while (c < n) { if ...
#include <iostream> using namespace std; int main() { int n, x; cin >> n >> x; while (n != 0 || x != 0) { if (x < 6 || x > 3 * n - 3) { cout << 0 << endl; cin >> n >> x; continue; } int a, b, c; a = x / 3; b = (x - a) / 2; c = x - (a + b); while (c < n) { if ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 106]]
1
228
#include <iostream> using namespace std; int main() { int n, x; int counter; while (true) { cin >> n >> x; counter = 0; if (n == 0 && x == 0) break; for (int i = 1; i <= n - 2; i++) { for (int j = i + 1; j <= n - 1; j++) { for (int k = j + 2; k <= n; k++) { if (i + ...
#include <iostream> using namespace std; int main() { int n, x; int counter; while (true) { cin >> n >> x; counter = 0; if (n == 0 && x == 0) break; for (int i = 1; i <= n - 2; i++) { for (int j = i + 1; j <= n - 1; j++) { for (int k = j + 1; k <= n; k++) { if (i + ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
124
#include <cmath> #include <cstdio> #include <iomanip> #include <iostream> using namespace std; int main() { int n, x; while (1) { int cnt = 0; cin >> n >> x; if (n == 0 || x == 0) break; for (int i = 1; i <= n - 2; i++) { for (int j = i + 1; j <= n - 1; j++) { for (int k = j + 1...
#include <cmath> #include <cstdio> #include <iomanip> #include <iostream> using namespace std; int main() { int n, x; while (1) { int cnt = 0; cin >> n >> x; if (n == 0 && x == 0) break; for (int i = 1; i <= n - 2; i++) { for (int j = i + 1; j <= n - 1; j++) { for (int k = j + 1...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
139
#include <iostream> using namespace std; int main() { int n, x; while (1) { cin >> n >> x; if (n == 0 && x == 0) break; int count = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i == j) continue; for (int k = 1; k <= n; k++) { i...
#include <iostream> using namespace std; int main() { int n, x; while (1) { cin >> n >> x; if (n == 0 && x == 0) break; int count = 0; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { if (i == j) continue; for (int k = j + 1; k <= n; k++) { ...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72]]
1
136
#include <stdio.h> int main() { int n, x, i = 0; int a, b, c; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) { break; } for (a = 1; a <= n; a++) { for (b = a + 1; b <= n; b++) { c = x - a - b; if (b < c && c < n) { i++; } } } p...
#include <stdio.h> int main() { int n, x, i = 0; int a, b, c; while (1) { scanf("%d %d", &n, &x); if (n == 0 && x == 0) { break; } for (a = 1; a <= n; a++) { for (b = a + 1; b <= n; b++) { c = x - a - b; if (b < c && c <= n) { i++; } } } ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
126
#include <cstdio> #include <iostream> using namespace std; int main() { int cnt = 0; int a, b; while (cin >> a >> b, a, b) { for (int i = 1; i <= a - 2; i++) { for (int j = i + 1; j <= a - 1; j++) { for (int k = j + 1; k <= a; k++) { if (i + j + k == b) cnt++; }...
#include <cstdio> #include <iostream> using namespace std; int main() { int cnt = 0; int a, b; while (cin >> a >> b, a) { for (int i = 1; i <= a - 2; i++) { for (int j = i + 1; j <= a - 1; j++) { for (int k = j + 1; k <= a; k++) { if (i + j + k == b) cnt++; } ...
[["-", 0, 52, 15, 339, 51, 34, 12, 34, 0, 21], ["-", 0, 52, 15, 339, 51, 34, 12, 34, 12, 22]]
1
120
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <vector> using namespace std; int main(void) { int x, n; int y, z; for (;;) { scanf("%d %d", &n, &x); y = 0; if (n == 0 && x == 0) break; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++...
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <vector> using namespace std; int main(void) { int x, n; int y; for (;;) { scanf("%d %d", &n, &x); y = 0; if (n == 0 && x == 0) break; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) {...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
135
#include <iostream> using namespace std; int main() { int n, x, l; while (1) { cin >> n >> x; if (n == 0 && x == 0) break; l = 0; for (int i = 1; i <= n - 2; ++i) { for (int j = i + 1; j <= n - 1; ++j) { for (int k = i + 2; k <= n; ++k) { if ((i + j + k) == x) ...
#include <iostream> using namespace std; int main() { int n, x, l; while (1) { cin >> n >> x; if (n == 0 && x == 0) break; l = 0; for (int i = 1; i <= n - 2; ++i) { for (int j = i + 1; j <= n - 1; ++j) { for (int k = j + 1; k <= n; ++k) { if ((i + j + k) == x) ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
128
#include <iostream> using namespace std; int main() { int n, x; int sum; while (1) { int ans = 0; cin >> n >> x; if (n == 0 && x == 0) break; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { for (int k = j + 1; k <= n; k++) { if (i < x || j < x ...
#include <iostream> using namespace std; int main() { int n, x; int sum; while (1) { int ans = 0; cin >> n >> x; if (n == 0 && x == 0) break; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { for (int k = j + 1; k <= n; k++) { if (i < x || j < x ...
[["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46]]
1
145
#include <bits/stdc++.h> using namespace std; int main() { while (1) { int n, x, cnt = 0; cin >> n >> x; if (n == 0 && x == 0) return 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= n; k++) { if (i == j || j == k || i == k) ...
#include <bits/stdc++.h> using namespace std; int main() { while (1) { int n, x, cnt = 0; cin >> n >> x; if (n == 0 && x == 0) return 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= n; k++) { if (i == j || j == k || i == k) ...
[["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 46], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
133
#include <iostream> using namespace std; int main() { int n, x, dem = 0; do { dem = 0; cin >> n >> x; if (n == 0 && x == 0) break; for (int i = 1; i < n - 1; i++) for (int j = i + 1; j < n; j++) for (int k = j + 1; k <= n; k++) if (i + j + k == 9) dem++; ...
#include <iostream> using namespace std; int main() { int n, x, dem = 0; do { dem = 0; cin >> n >> x; if (n == 0 && x == 0) break; for (int i = 1; i < n - 1; i++) for (int j = i + 1; j < n; j++) for (int k = j + 1; k <= n; k++) if (i + j + k == x) dem++; ...
[["-", 8, 7, 8, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 7, 8, 57, 15, 339, 51, 16, 12, 22]]
1
122
#include <cstdio> #include <iostream> using namespace std; int main() { int n, x; for (;;) { cin >> n >> x; if (!n && !x) break; int c = 0; for (int i = 1; i < n - 1; ++i) { if (i >= x) continue; for (int j = i + 1; j < n - 1; ++j) { if (i + j >= x) con...
#include <cstdio> #include <iostream> using namespace std; int main() { int n, x; for (;;) { cin >> n >> x; if (!n && !x) break; int c = 0; for (int i = 1; i < n - 1; ++i) { if (i >= x) continue; for (int j = i + 1; j <= n - 1; ++j) { if (i + j >= x) co...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
147
#include <iostream> #include <vector> using namespace std; int main(void) { vector<int> list; while (true) { int n, x; cin >> n >> x; if (n == 0 && x == 0) break; int count = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (j != i) continue; ...
#include <iostream> #include <vector> using namespace std; int main(void) { vector<int> list; while (true) { int n, x; cin >> n >> x; if (n == 0 && x == 0) break; int count = 0; for (int i = 1; i <= n; i++) { for (int j = i; j <= n; j++) { if (j == i) continue; ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
167
#include <stdio.h> int main() { int n = 1, x = 1, i, t, N = 0; for (; n != 0 || x != 0;) { N = 0; scanf("%d %d", &n, &x); for (i = 1; i < n; i++) { for (t = i + 1; t < n; t++) { if (x - i - t >= t + 1 && x - i - t <= n) { // printf("%d %d\n\n",i,t); N++; ...
#include <stdio.h> int main() { int n = 1, x = 1, i, t, N = 0; for (; n != 0 || x != 0;) { N = 0; scanf("%d %d", &n, &x); for (i = 1; i < n; i++) { for (t = i + 1; t < n; t++) { if (x - i - t >= t + 1 && x - i - t <= n) { // printf("%d %d\n\n",i,t); N++; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
139
#include <stdio.h> int main(void) { int n, x, i, y, c, kazu; for (;;) { kazu = 0; scanf("%d %d", &n, &x); if (n == 0 || x == 0) { break; } for (i = 1; i <= n; i++) { for (y = 1; y <= n; y++) { for (c = 1; c <= n; c++) { if (i != y || y != c || c != i) { ...
#include <stdio.h> int main(void) { int n, x, i, y, c, kazu; for (;;) { kazu = 0; scanf("%d %d", &n, &x); if (n == 0 && x == 0) { break; } for (i = 1; i <= n; i++) { for (y = 1; y <= n; y++) { for (c = 1; c <= n; c++) { if (i != y && y != c && c != i) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 98]]
1
151
#include <iostream> using namespace std; int main() { int n, x, s; while (cin >> n >> x, n + x) { s = 0; for (int i = 1; i < n - 1; ++i) for (int j = i + 1; j < n; ++j) { int k = x - i - j; if (k >= 1 && k <= x && k > i && k > j) ++s; } cout << s << endl; } retu...
#include <iostream> using namespace std; int main() { int n, x, s; while (cin >> n >> x, n + x) { s = 0; for (int i = 1; i < n - 1; ++i) for (int j = i + 1; j < n; ++j) { int k = x - i - j; if (k >= 1 && k <= n && k > i && k > j) ++s; } cout << s << endl; } retu...
[["-", 51, 16, 31, 16, 31, 16, 12, 16, 12, 22], ["+", 51, 16, 31, 16, 31, 16, 12, 16, 12, 22]]
1
110
#include <iostream> using namespace std; int main() { int n, x; cin >> n >> x; while (n != 0 && x != 0) { int ans = 0; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { for (int k = j + 1; k <= n; k++) { if (i == k || k == j || i == j) continue; ...
#include <iostream> using namespace std; int main() { int n, x; cin >> n >> x; while (n != 0 || x != 0) { int ans = 0; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { for (int k = j + 1; k <= n; k++) { if (i == k || k == j || i == j) continue; ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 106]]
1
137
#include <iostream> int main(void) { using namespace std; int n, x; while (1) { cin >> n; cin >> x; if (n == 0 && x == 0) break; int count_comb = 0; for (int large1 = 3; large1 <= n; large1++) { int temp = n - large1; for (int large2 = 2; large2 < temp; large2++) { ...
#include <iostream> int main(void) { using namespace std; int n, x; while (1) { cin >> n; cin >> x; if (n == 0 && x == 0) break; int count_comb = 0; for (int large1 = 3; large1 <= n; large1++) { int temp = x - large1; for (int large2 = 2; large2 < temp; large2++) { ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22]]
1
116
#include <iostream> int main() { int n, x; for (;;) { std::cin >> n >> x; if (n == 0 && x == 0) break; int count{}; for (int i = 1; i <= n; ++i) for (int j = 2; j <= n; ++j) for (int k = 3; k <= n; ++k) if (i + j + k == x) ++count; std::cout << count <<...
#include <iostream> int main() { int n, x; for (;;) { std::cin >> n >> x; if (n == 0 && x == 0) break; int count{}; for (int i = 1; i <= n; ++i) for (int j = i + 1; j <= n; ++j) for (int k = j + 1; k <= n; ++k) if (i + j + k == x) ++count; std::cout << ...
[["-", 0, 7, 8, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 7, 8, 7, 10, 43, 49, 50, 51, 13]]
1
110
#include <iostream> int main(int argc, const char *argv[]) { int cnt; for (int n, x; std::cin >> n >> x && !(n == 0 && x == 0);) { cnt = 0; for (int i = 1; i <= n - 2; i++) { for (int j = i + 1; j <= n - 1; j++) { if (j + 1 <= x - i - j && x - i - j <= n) { cnt++; break; ...
#include <iostream> int main(int argc, const char *argv[]) { int cnt; for (int n, x; std::cin >> n >> x && !(n == 0 && x == 0);) { cnt = 0; for (int i = 1; i <= n - 2; i++) { for (int j = i + 1; j <= n - 1; j++) { if (j + 1 <= x - i - j && x - i - j <= n) { cnt++; } } ...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
131
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { while (true) { bool bary[100][100][100] = {false}; int n, x; cin >> n >> x; if (n == 0 and x == 0) { break; } int cnt = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { while (true) { bool bary[100][100][100] = {false}; int n, x; cin >> n >> x; if (n == 0 and x == 0) { break; } int cnt = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
240
#include <stdio.h> int main() { int i, j, k, n, x, cnt; while (1) { cnt = 0; scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; for (i = 1; i <= n; i++) { for (j = i + 1; j <= n; j++) { for (k = j + 1; j <= n; j++) { if ((i + j + k) == x) cnt++; } ...
#include <stdio.h> int main() { int i, j, k, n, x, cnt; while (1) { cnt = 0; scanf("%d %d", &n, &x); if (n == 0 && x == 0) break; for (i = 1; i <= n; i++) { for (j = i + 1; j <= n; j++) { for (k = j + 1; k <= n; k++) { if ((i + j + k) == x) cnt++; } ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22]]
1
133
#include <iostream> using namespace std; int n, x; int main() { while (cin >> n >> x && n > 0) { int count = 0; for (int i = 1; i <= n; i++) { for (int j = i; j <= n; j++) { for (int k = j; k <= n; k++) { if (n == i + j + k) count++; } } } cout << cou...
#include <iostream> using namespace std; int n, x; int main() { while (cin >> n >> x && n > 0) { int count = 0; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { for (int k = j + 1; k <= n; k++) { if (x == i + j + k) count++; } } } cou...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
103
#include <bits/stdc++.h> using namespace std; #define REP(i, m) for (long long i = 0; i < m; i++) #define FOR(i, n, m) for (long long i = n; i < m; i++) #define INF 1000000000 #define INFL 10000000000000000LL #define ALL(v) v.begin(), v.end() #define pb push_back #define ll long long int #define P pair<ll, ll> int m...
#include <bits/stdc++.h> using namespace std; #define REP(i, m) for (long long i = 0; i < m; i++) #define FOR(i, n, m) for (long long i = n; i < m; i++) #define INF 1000000000 #define INFL 10000000000000000LL #define ALL(v) v.begin(), v.end() #define pb push_back #define ll long long int #define P pair<ll, ll> int m...
[["-", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22]]
1
147
#include <iostream> using namespace std; int main() { int a, b, c; do { cin >> a >> b; c = 0; if (!((a == 0) && (b == 0))) { for (int i = 1; i <= a; i++) { for (int j = 1; j <= a; j++) { for (int k = 1; k <= a; k++) { if ((i + j + k) == b) c++; ...
#include <iostream> using namespace std; int main() { int a, b, c; do { cin >> a >> b; c = 0; if (!((a == 0) && (b == 0))) { for (int i = 1; i <= a; i++) { for (int j = 1; j < i; j++) { for (int k = 1; k < j; k++) { if ((i + j + k) == b) { c++; ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
141
#include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int count = 0; if (a == 0 && b == 0) break; for (int i = 1; i <= 5; i++) for (int j = i + 1; j <= 5; j++) for (int k = j + 1; k <= 5; k++) { if (i + j + k == b) count...
#include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int count = 0; if (a == 0 && b == 0) break; for (int i = 1; i <= a; i++) for (int j = i + 1; j <= a; j++) for (int k = j + 1; k <= a; k++) { if (i + j + k == b) count...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 7, 8, 7, 15, 16, 12, 13], ["+", 8, 9, 0, 7, 8, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 7, 8, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 7, 8, 7, 15, 16, 12, 22]]
1
116
import itertools def main(): data = [] while True: n, x = map(int, input().split()) if [n, x] == [0, 0]: break data.append([n, x]) for [n, x] in data: _set = set(range(1, n+1)) comb = set(itertools.combinations(_list, 3)) print(sum((True if sum(i) == x else...
import itertools def main(): data = [] while True: n, x = map(int, input().split()) if [n, x] == [0, 0]: break data.append([n, x]) for [n, x] in data: _set = set(range(1, n+1)) comb = set(itertools.combinations(_set, 3)) print(sum((True if sum(i) == x else ...
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
114
import math while True: n,x=list(map(int,input().split())) if n==x==0: break c=0 for i in range(1,x//3): if i>n: break for j in range(i+1,x//3+1): if j>n: break k=x-i-j if not (n<k or k<=i): c+=1 print(c)
import math while True: n,x=list(map(int,input().split())) if n==x==0: break c=0 for i in range(1,x//3): if i>n: break for j in range(i+1,(x-i)//2+1): if j>n: break k=x-i-j if not (n<k or k<=j): c+=1 print(c)
[["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 0, 657, 31, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 657, 31, 657, 31, 23, 0, 657, 12, 22], ["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 25], ["-", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["-", 15, 681, 28, 23, 0, 679, 12, 66...
5
101
while 1: n,x=map(int,input().split()) if n+x==0:break for i in range(3,n+1): for j in range(2,x-i): if x-i-j<j<i: c+=1 print(c)
while 1: n,x=map(int,input().split()) if n+x==0:break c=0 for i in range(3,n+1): for j in range(2,x-i): if x-i-j<j<i: c+=1 print(c)
[["+", 0, 52, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 12, 612]]
5
69
while 1: n,x=map(int,input().split()) if n+x==0:break print(len([1 for i in range(1,n-2)for j in range(i+1,n)if j<x-i-j<=n]))
while 1: n,x=map(int,input().split()) if n+x==0:break print(len([1 for i in range(1,x//3)for j in range(i+1,n)if j<x-i-j<=n]))
[["-", 0, 659, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 676], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]]
5
68
while 1: n,x=map(int,input().split()) if n+x==0:break print(sum([(x-a-1)//2-max(a,x-a-1-n)for a in range(1,x//3)]))
while 1: n,x=map(int,input().split()) if n+x==0:break print(sum(max(0,(x-a-1)//2-max(a,x-a-1-n))for a in range(1,x//3)))
[["-", 3, 4, 0, 652, 3, 4, 0, 658, 0, 70], ["+", 3, 4, 0, 652, 3, 668, 8, 652, 63, 22], ["+", 0, 652, 3, 668, 8, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 668, 8, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 0, 652, 3, 668, 8, 652, 3, 4, 0, 25], ["-", 3, 4, 0, 652, 3, 4, 0, 658, 0, 73]]
5
68
from itertools import combinations as comb def get_ans(m, n): ans = sum(1 for nums in comb(list(range(1, min(m+1,n-2))), 3) if sum(nums)==n) return ans while True: m, n = (int(x) for x in input().split()) if m==0 and n==0: quit() ans = get_ans(m, n) print(abs)
from itertools import combinations as comb def get_ans(m, n): ans = sum(1 for nums in comb(list(range(1, min(m+1,n-2))), 3) if sum(nums)==n) return ans while True: m, n = (int(x) for x in input().split()) if m==0 and n==0: quit() ans = get_ans(m, n) print(ans)
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
102
while True : num = 0 n,x = map(int,input().split()) if(n==0 and x==0): break for i in range (1,n) : for j in range(1,i): s = x - j - i if(j<i and i<s): num += 1 print(num)
while True : num = 0 n,x = map(int,input().split()) if(n==0 and x==0): break for i in range (1,n) : for j in range(1,i): s = x - j - i if(s<=n and j<i and i<s): num += 1 print(num)
[["+", 15, 23, 0, 679, 31, 679, 31, 666, 0, 22], ["+", 15, 23, 0, 679, 31, 679, 31, 666, 667, 19], ["+", 0, 57, 15, 23, 0, 679, 31, 679, 17, 355]]
5
79
while True: n,x = map(int,input().split()) if (n*x == 0): break sum =0 for i in range(1,n+1): for j in range(i+1,n+1): for k in range (j+1,n+1): if i+j+k == x: sum+=1 print(sum)
while True: n,x = map(int,input().split()) if (n+x == 0): break sum =0 for i in range(1,n+1): for j in range(i+1,n+1): for k in range (j+1,n+1): if i+j+k == x: sum+=1 print(sum)
[["-", 0, 57, 15, 23, 0, 666, 0, 657, 17, 48], ["+", 0, 57, 15, 23, 0, 666, 0, 657, 17, 72]]
5
88
while True: n, x = map(int,input().split()) if(n==0, x==0): break nlist = [] for i in range(1,n+1): nlist.append(i) count = 0 for i1 in range(n-2): for i2 in range(i1+1,n-1): for i3 in range(i2+1,n): y = nlist[i1]+nlist[i2]+nlist[i3] ...
while True: n, x = map(int,input().split()) if(n==0 and x==0): break nlist = [] for i in range(1,n+1): nlist.append(i) count = 0 for i1 in range(n-2): for i2 in range(i1+1,n-1): for i3 in range(i2+1,n): y = nlist[i1]+nlist[i2]+nlist[i3] ...
[["-", 0, 52, 8, 196, 0, 57, 15, 660, 0, 21], ["+", 8, 196, 0, 57, 15, 23, 0, 679, 17, 355]]
5
122
while True: n,x = list(map(int, input().split())) if n == 0 and x == 0: break c = 0 for i in range(1, n/3 +1): for j in range(i+1, n/2 +1): ij = i + j for k in range(j+1, n+1): if ij+k == x: c += 1 print(c)
while True: n,x = list(map(int, input().split())) if n == 0 and x == 0: break c = 0 for i in range(1, n+1): for j in range(i+1, n+1): ij = i + j for k in range(j+1, n+1): if ij+k == x: c += 1 print(c)
[["-", 12, 652, 3, 4, 0, 657, 31, 657, 17, 85], ["-", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612]]
5
98
<?php list($a, $b) = explode(" ", trim(fgets(STDIN))); $ary = array(); for($i=1; $i <= $a; $i++) { $line = explode(" ", trim(fgets(STDIN))); array_push($ary, $line); } foreach ($ary as $val) { print(join(" ", $val) . " " . array_sum($val) . "\n"); } $aaa = array(); for($x=0; $x <= ($b-1); $x...
<?php list($a, $b) = explode(" ", trim(fgets(STDIN))); $ary = array(); for($i=1; $i <= $a; $i++) { $line = explode(" ", trim(fgets(STDIN))); array_push($ary, $line); } foreach ($ary as $val) { print(join(" ", $val) . " " . array_sum($val) . "\n"); } $aaa = array(); for($x=0; $x <= ($b-1); $x...
[["-", 0, 564, 12, 69, 0, 69, 0, 606, 0, 141], ["+", 0, 564, 12, 69, 0, 69, 0, 606, 0, 141], ["-", 0, 1, 0, 564, 12, 69, 0, 606, 0, 141], ["+", 0, 1, 0, 564, 12, 69, 0, 606, 0, 141], ["-", 0, 1, 0, 619, 0, 23, 0, 16, 17, 131], ["-", 0, 619, 0, 23, 0, 16, 12, 609, 0, 62], ["-", 0, 619, 0, 23, 0, 16, 12, 609, 0, 44]]
6
220
<?php list($r,$c)=explode(' ',trim(fgets(STDIN))); $C=$c+1; $s=array($C); for($j=0;$j<=$C;$j++)$s[$j]=0; for($i=0;$i<$r;$i++){ $D=trim(fgets(STDIN)); $d=explode(' ',$D); $S=0; for($j=0;$j<$c;$j++){ $S+=$d[$j]; $s[$j]+=$d[$j]; } $s[$c]+=$S; echo $D,' ',$S,PHP_EOL; } echo implode(' ',$s); ?>
<?php list($r,$c)=explode(' ',trim(fgets(STDIN)),2); $C=$c+1; $s=array($C); for($j=0;$j<$C;$j++)$s[$j]=0; for($i=0;$i<$r;$i++){ $D=trim(fgets(STDIN)); $d=explode(' ',$D,$c); $S=0; for($j=0;$j<$c;$j++){ $S+=$d[$j]; $s[$j]+=$d[$j]; } $s[$c]+=$S; echo $D,' ',$S,PHP_EOL; } echo implode(' ',$s); ?>
[["+", 0, 1, 0, 11, 12, 613, 3, 3, 0, 21], ["+", 0, 11, 12, 613, 3, 3, 0, 28, 0, 612], ["-", 36, 36, 0, 493, 0, 7, 0, 16, 17, 19], ["+", 36, 36, 0, 493, 0, 7, 0, 16, 17, 18], ["+", 12, 613, 3, 3, 0, 28, 0, 606, 0, 607], ["+", 12, 613, 3, 3, 0, 28, 0, 606, 0, 141]]
6
194
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r = sc.nextInt(); int c = sc.nextInt(); int[][] rc = new int[r + 1][c + 1]; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { rc[i][j] = sc.nextInt(); ...
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r = sc.nextInt(); int c = sc.nextInt(); int[][] rc = new int[r + 1][c + 1]; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { rc[i][j] = sc.nextInt(); ...
[["-", 0, 57, 64, 196, 0, 1, 0, 492, 141, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 492, 141, 22]]
3
331
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { static InputReader in; static PrintWriter out; static class Solution { void solve() throws IOException { ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { static InputReader in; static PrintWriter out; static class Solution { void solve() throws IOException { ...
[["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 72], ["+", 0, 492, 3, 4, 0, 16, 12, 5, 0, 62], ["+", 0, 492, 3, 4, 0, 16, 12, 5, 0, 491]]
3
611
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[][] n = new int[101][101]; int[] tate = new int[101]; int[] yoko = new int[101]; int sum = 0; int x = scan.nextInt(); int y = scan.nextInt(); for (int i = 0; i < ...
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[][] n = new int[101][101]; int[] tate = new int[101]; int[] yoko = new int[101]; int sum = 0; int x = scan.nextInt(); int y = scan.nextInt(); for (int i = 0; i < ...
[["-", 8, 196, 0, 1, 0, 11, 31, 504, 71, 22], ["+", 8, 196, 0, 1, 0, 11, 31, 504, 71, 22], ["-", 0, 57, 15, 15, 0, 16, 12, 16, 17, 33], ["-", 0, 57, 15, 15, 0, 16, 12, 16, 12, 499]]
3
323
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); int u = scan.nextInt(); int n = t + 1; int m = u + 1; int[][] a = new int[n][m]; int b[] = new int[m]; int c[] = new int[n]; int i, ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); int u = scan.nextInt(); int n = t + 1; int m = u + 1; int[][] a = new int[n][m]; int b[] = new int[m]; int c[] = new int[n]; int i, ...
[["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 95]]
3
288
public class Main { static void main(String[] args) { java.util.Scanner scan = new java.util.Scanner(System.in); int r = scan.nextInt(); int c = scan.nextInt(); int[][] arr = new int[r][c]; int sum = 0; int kai = 0; for (int i = 0; i < r; i++) { sum = 0; for (int j = 0; j < c;...
public class Main { public static void main(String[] args) { java.util.Scanner scan = new java.util.Scanner(System.in); int r = scan.nextInt(); int c = scan.nextInt(); int[][] arr = new int[r][c]; int sum = 0; int kai = 0; for (int i = 0; i < r; i++) { sum = 0; for (int j = 0;...
[["+", 0, 235, 8, 498, 0, 195, 0, 494, 0, 259]]
3
239
import java.io.*; class Main { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" "); int r = Integer.parseInt(line[0]); int c = Integer.parseInt(line[1]); int[][] r1 = new in...
import java.io.*; class Main { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" "); int r = Integer.parseInt(line[0]); int c = Integer.parseInt(line[1]); int[][] r1 = new in...
[["+", 0, 7, 8, 196, 0, 7, 8, 196, 0, 46], ["-", 0, 7, 8, 196, 0, 7, 8, 196, 0, 46]]
3
367
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args) throws Exception { // Here your code ! BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" "...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args) throws Exception { // Here your code ! BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" ")...
[["-", 0, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["-", 0, 16, 31, 16, 12, 23, 0, 16, 12, 499], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 12, 499]]
3
331
import java.io.*; import java.lang.*; import java.math.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { Scanner stdIn = new Scanner(System.in); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { String[] in =...
import java.io.*; import java.lang.*; import java.math.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { Scanner stdIn = new Scanner(System.in); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] in = br.readLine().split(...
[["-", 8, 498, 0, 195, 8, 196, 0, 52, 0, 89], ["-", 0, 195, 8, 196, 0, 52, 15, 15, 0, 24], ["-", 0, 195, 8, 196, 0, 52, 15, 15, 0, 146], ["-", 0, 195, 8, 196, 0, 52, 15, 15, 0, 25], ["-", 0, 195, 8, 196, 0, 52, 8, 196, 0, 45], ["-", 0, 52, 8, 196, 0, 7, 8, 196, 0, 46]]
3
391
import java.util.Scanner; class Main { public static void main(String args[]) { int i, j, r, c, wsum; int[][] table = new int[101][101]; int[] hsum = new int[101]; Scanner sc = new Scanner(System.in); r = sc.nextInt(); c = sc.nextInt(); for (i = 0; i < r; i++) { for (j = 0; j < c; j...
import java.util.Scanner; class Main { public static void main(String args[]) { int i, j, r, c, wsum; int[][] table = new int[101][101]; int[] hsum = new int[101]; Scanner sc = new Scanner(System.in); r = sc.nextInt(); c = sc.nextInt(); for (i = 0; i < r; i++) { for (j = 0; j < c; j...
[["-", 0, 492, 3, 4, 0, 504, 71, 16, 17, 72], ["-", 0, 492, 3, 4, 0, 504, 71, 16, 12, 499]]
3
303
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); while (true) { int r = scn.nextInt(); int c = scn.nextInt(); int[][] sum = new int[r + 1][c + 1]; for (int i = 0; i < r; i++) { for (int j = 0; j < c; ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int r = scn.nextInt(); int c = scn.nextInt(); int[][] sum = new int[r + 1][c + 1]; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { sum[i][j] = sc...
[["-", 8, 498, 0, 195, 8, 196, 0, 52, 0, 89], ["-", 0, 195, 8, 196, 0, 52, 15, 15, 0, 24], ["-", 0, 195, 8, 196, 0, 52, 15, 15, 0, 146], ["-", 0, 195, 8, 196, 0, 52, 15, 15, 0, 25], ["-", 0, 195, 8, 196, 0, 52, 8, 196, 0, 45], ["-", 0, 52, 8, 196, 0, 7, 8, 196, 0, 46]]
3
273
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r = sc.nextInt(); int c = sc.nextInt(); int[][] sheets = new int[r + 1][c + 1]; int sum = 0; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r = sc.nextInt(); int c = sc.nextInt(); int[][] sheets = new int[r + 1][c + 1]; int sum = 0; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { ...
[["-", 0, 7, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 17, 107]]
3
222
#include <stdio.h> int main() { int A[101][101], r, c, i, j, sum, total = 0; scanf("%d%d", &r, &c); for (i = 0; i < r; i++) for (j = 0; j < c; j++) scanf("%d", &A[i][j]); for (j = 0; j < c; j++) { sum = 0; for (i = 0; i < r; i++) { sum += A[i][j]; total += A[i][j]; } A[...
#include <stdio.h> int main() { int A[101][101], r, c, i, j, sum, total = 0; scanf("%d%d", &r, &c); for (i = 0; i < r; i++) for (j = 0; j < c; j++) scanf("%d", &A[i][j]); for (j = 0; j < c; j++) { sum = 0; for (i = 0; i < r; i++) { sum += A[i][j]; total += A[i][j]; } A[...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
0
278
#include <stdio.h> int main() { int d[4096][4096] = {0}; int c, r, i, j; scanf("%d%d", &c, &r); for (i = 0; i < c; i++) { for (j = 0; j < r; j++) { scanf("%d", &d[i][j]); d[i][r] += d[i][j]; d[c][j] += d[i][j]; } d[c][r] += d[i][r]; } for (i = 0; i < c + 1; i++) for (j = 0...
#include <stdio.h> int main() { int d[101][101] = {0}; int c, r, i, j; scanf("%d%d", &c, &r); for (i = 0; i < c; i++) { for (j = 0; j < r; j++) { scanf("%d", &d[i][j]); d[i][r] += d[i][j]; d[c][j] += d[i][j]; } d[c][r] += d[i][r]; } for (i = 0; i < c + 1; i++) for (j = 0; ...
[["-", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13], ["+", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13]]
0
197
#include <stdio.h> int main(void) { int r, c, data[126][126] = {0}, sum[126] = {0}, total[126] = {0}, i, j; scanf("%d %d", &r, &c); for (i = 1; i <= r; i++) { for (j = 1; j <= c; j++) { scanf("%d", &data[i][j]); sum[i] = sum[i] + data[i][j]; total[j] = total[j] + data[i][j]; } } ...
#include <stdio.h> int main(void) { int r, c, data[126][126] = {0}, sum[126] = {0}, total[126] = {0}, i, j; scanf("%d %d", &r, &c); for (i = 1; i <= r; i++) { for (j = 1; j <= c; j++) { scanf("%d", &data[i][j]); sum[i] = sum[i] + data[i][j]; total[j] = total[j] + data[i][j]; } } ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
267
#include <stdio.h> #define N 10000 int main(void) { int r, c, i, j; int su[N][N]; scanf("%d %d", &r, &c); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { scanf("%d", &su[i][j]); } } for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { su[i][c] += su[i][j]; } } for (j = 0...
#include <stdio.h> #define N 1000 int main(void) { int r, c, i, j; int su[N][N]; scanf("%d %d", &r, &c); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { scanf("%d", &su[i][j]); } } for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { su[i][c] += su[i][j]; } } for (j = 0;...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
0
251
#include <stdio.h> #define MAX 100 int main(void) { int a[MAX][MAX], r, c, i, j; scanf("%d %d", &r, &c); a[r][c] = 0; for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { scanf("%d", &a[i][j]); a[r][c] += a[i][j]; } } for (i = 0; i < r; i++) { a[i][r] = 0; for (j = 0; j < c; j++...
#include <stdio.h> #define MAX 101 int main(void) { int a[MAX][MAX], r, c, i, j; scanf("%d %d", &r, &c); a[r][c] = 0; for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { scanf("%d", &a[i][j]); a[r][c] += a[i][j]; } } for (i = 0; i < r; i++) { a[i][c] = 0; for (j = 0; j < c; j++...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["-", 0, 1, 0, 11, 31, 69, 28, 69, 71, 22], ["+", 0, 1, 0, 11, 31, 69, 28, 69, 71, 22]]
0
301
#include <stdio.h> int main() { int r, c, i, j, table[100][100] = {0}; scanf("%d %d", &r, &c); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { scanf("%d", &table[i][j]); table[i][c] += table[i][j]; table[r][j] += table[i][j]; } table[r][c] += table[i][c]; } for (i = 0; i <= ...
#include <stdio.h> int main() { int r, c, i, j, table[101][101] = {0}; scanf("%d %d", &r, &c); for (i = 0; i < r; i++) { for (j = 0; j < c; j++) { scanf("%d", &table[i][j]); table[i][c] += table[i][j]; table[r][j] += table[i][j]; } table[r][c] += table[i][c]; } for (i = 0; i <= ...
[["-", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13], ["+", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22]]
0
203