buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
#include <stdio.h> int main(void) { int n, m, max; int a[1001]; while (1) { scanf("%d %d", &n, &m); if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } max = -1; for (int i = 0; i < n - 1; i++) { for (int j = i; j < n; j++) { if (ma...
#include <stdio.h> int main(void) { int n, m, max; int a[1001]; while (1) { scanf("%d %d", &n, &m); if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } max = -1; for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { if...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
0
186
2
#include <stdio.h> int main() { int n, m, a[1000]; int i, j, sum, max; while (scanf("%d %d", &n, &m)) { if (n == 0 && m == 0) break; for (i = 0; i < n; i++) { scanf("%d", &a[i]); } max = 0; for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { sum = a[i] + a[j]; ...
#include <stdio.h> int main() { int n, m, a[1000]; int i, j, sum, max; while (scanf("%d %d", &n, &m)) { if (n == 0 && m == 0) break; for (i = 0; i < n; i++) { scanf("%d", &a[i]); } max = 0; for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { sum = a[i] + a[j]; ...
[["+", 0, 57, 15, 23, 0, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 98]]
0
170
4
#include <stdio.h> int main(void) { int m, n, a[1001], i, j, sum, max; while (scanf("%d %d", &n, &m)) { if (m == 0 && n == 0) break; for (i = 0; i < n; i++) { scanf("%d", &a[i]); } max = 0; for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { sum = a[i] + a[j]; ...
#include <stdio.h> int main(void) { int m, n, a[1001], i, j, sum, max; while (scanf("%d %d", &n, &m)) { if (m == 0 && n == 0) break; for (i = 0; i < n; i++) { scanf("%d", &a[i]); } max = 0; for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { sum = a[i] + a[j]; ...
[["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 98], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22]]
0
170
4
#include <stdio.h> int main(void) { int a[1000000]; int n, m; int i, j, k; int max = 0; int sum = 0; scanf("%d %d", &n, &m); while (n != 0) { for (i = 0; i < n; i++) { scanf("%d", &a[i]); } for (i = 0; i <= n; i++) { for (j = i + 1; j <= n; j++) { sum = a[i] + a[j]; ...
#include <stdio.h> int main(void) { int a[1000000]; int n, m; int i, j, k; int max = 0; int sum = 0; scanf("%d %d", &n, &m); while (n != 0) { for (i = 0; i < n; i++) { scanf("%d", &a[i]); } for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { sum = a[i] + a[j]; ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18]]
0
192
4
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { cin.tie(0); ios_base::sync_with_stdio(0); cout << fixed << setprecision(12); int N, M; while (cin >> N >> M, N) { vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a[i]; } int ans = -1; for ...
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { cin.tie(0); ios_base::sync_with_stdio(0); cout << fixed << setprecision(12); int N, M; while (cin >> N >> M, N) { vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a[i]; } int ans = -1; for ...
[["-", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 17, 151], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
188
7
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
304
2
#include <iostream> using namespace std; int main(void) { while (1) { int n, m; cin >> n; cin >> m; if (n == 0 && m == 0) { return 0; } int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int sum[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j <...
#include <iostream> using namespace std; int main(void) { while (1) { int n, m; cin >> n; cin >> m; if (n == 0 && m == 0) { return 0; } int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int sum[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j <...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]]
1
252
2
#include <stdio.h> int max(int a, int b) { if (a > b) return a; else return b; } int main() { while (1 == 1) { int n, m, i, j, k, tmp; int result = 0; scanf("%d%d\n", &n, &m); if (n == 0 && m == 0) break; int a[n]; for (i = 0; i < n; i++) { scanf("%d", &a[i]); } ...
#include <stdio.h> int max(int a, int b) { if (a > b) return a; else return b; } int main() { while (1 == 1) { int n, m, i, j, k, tmp; int result = 0; scanf("%d%d", &n, &m); if (n == 0 && m == 0) break; int a[n]; for (i = 0; i < n; i++) { scanf("%d", &a[i]); } ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
211
6
#include <stdio.h> int max(int a, int b) { if (a > b) return a; else return b; } int main() { while (1 == 1) { int n, m, i, j, k, tmp; int result = 0; scanf("%d%d\n", &n, &m); if (n == 0 && m == 0) break; int a[n]; for (i = 0; i < n; i++) { scanf("%d", &a[i]); } ...
#include <stdio.h> int max(int a, int b) { if (a > b) { return a; } else { return b; } } int main() { while (1 == 1) { int n, m, i, j, k, tmp; int result = 0; scanf("%d%d", &n, &m); if (n == 0 && m == 0) break; int a[n]; for (i = 0; i < n; i++) { scanf("%d", &a[i]); ...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
211
6
#include <algorithm> #include <iostream> using namespace std; int main() { int n, m; while (1) { int a[1000] = {}, ans = 0; cin >> n >> m; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { ...
#include <algorithm> #include <iostream> using namespace std; int main() { int n, m; while (1) { int a[1000] = {}, ans = 0; cin >> n >> m; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { ...
[["+", 0, 57, 64, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 64, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
162
5
#include <algorithm> #include <iostream> using namespace std; int main() { while (1) { long long n, m, a[1000], ans, num; cin >> n >> m; num = 0; ans = 0; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { for (int j = n; j...
#include <algorithm> #include <iostream> using namespace std; int main() { while (1) { long long n, m, a[1000], ans, num; cin >> n >> m; num = 0; ans = 0; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { for (int j = n - ...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 33], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
165
2
#include <bits/stdc++.h> using namespace std; int a[1000]; int main() { while (true) { int n, m; cin >> n >> m; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); if (a[n - 1] + a[n - 2] < m) { cout << a[n - 1] + a[n - 2] << endl; cont...
#include <bits/stdc++.h> using namespace std; int a[1000]; int main() { while (true) { int n, m; cin >> n >> m; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); if (a[n - 1] + a[n - 2] < m) { cout << a[n - 1] + a[n - 2] << endl; cont...
[["+", 0, 52, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 0, 52, 15, 339, 51, 16, 12, 23, 0, 25], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20]]
1
233
4
#include <iostream> using namespace std; int main() { int a[1001]; int n, m; while (cin >> n >> m) { if (n == 0 && m == 0) { break; } for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = -1; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (a[i] ...
#include <iostream> using namespace std; int main() { int a[1001]; int n, m; while (cin >> n >> m) { if (n == 0 && m == 0) { break; } for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = -1; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i != ...
[["+", 15, 339, 51, 16, 31, 16, 31, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 79], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 98]]
1
175
23
#include <iostream> #include <sstream> using namespace std; int main() { int n, m, max; int a[1000]; while (cin >> n >> m) { max = 0; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) ...
#include <iostream> #include <sstream> using namespace std; int main() { int n, m, max; int a[1000]; while (cin >> n >> m) { max = 0; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) ...
[["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 44]]
1
181
1
#include <iostream> #include <vector> using namespace std; int main() { int i, n, m, j; vector<int> ans; while (1) { cin >> n >> m; if (n == 0 && m == 0) break; vector<int> item(n); for (i = 0; i < n; i++) { cin >> item[i]; } int max = 0; int sum; for (i = 0; i < n; i++...
#include <iostream> #include <vector> using namespace std; int main() { int i, n, m, j; vector<int> ans; while (1) { cin >> n >> m; if (n == 0 && m == 0) break; vector<int> item(n); for (i = 0; i < n; i++) { cin >> item[i]; } int max = 0; int sum; for (i = 0; i < n; i++...
[["+", 8, 9, 0, 7, 10, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 10, 11, 12, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 15, 339, 51, 16, 12, 16, 12, 16, 17, 72], ["+", 15, 339, 51, 16, 12, 16, 12, 16, 12, 13]]
1
232
6
#include <iostream> using namespace std; bool q1() { int n, maxValue; cin >> n >> maxValue; if (n == 0 && maxValue == 0) return false; int value[n]; int tempValue = 0; int tempMax = 0; for (int i = 0; i < n; i++) { cin >> value[i]; } for (int top = 0; top < n - 1; top++) { for (int i = 1;...
#include <iostream> using namespace std; bool q1() { int n, maxValue; cin >> n >> maxValue; if (n == 0 && maxValue == 0) return false; int value[n]; int tempValue = 0; int tempMax = 0; for (int i = 0; i < n; i++) { cin >> value[i]; } for (int top = 0; top < n - 1; top++) { for (int i = 1;...
[["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 44]]
1
180
4
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <utility> #include <vector> #define int long long int #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef pair<int, int> P; const int INF = 1e15; const int MO...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <utility> #include <vector> #define int long long int #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef pair<int, int> P; const int INF = 1e15; const int MO...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
204
4
#include <iostream> #define MAX 1000 using namespace std; int a[MAX]; int main() { while (true) { int n, m, maxsum = 0; cin >> n >> m; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 1; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { ...
#include <iostream> #define MAX 1001 using namespace std; int a[MAX]; int main() { while (true) { int n, m, maxsum = 0; cin >> n >> m; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["...
1
172
8
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, a, b) for (int i = a; i <= b; i++) using namespace std; int main() { while (1) { int n, m; cin >> n >> m; if (!n) break; int a[n]; rep(i, n) { cin >> a[i]; } int ans = 0; rep(i, n - 1) { REP(j...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define REP(i, a, b) for (int i = a; i <= b; i++) using namespace std; int main() { while (1) { int n, m; cin >> n >> m; if (!n) break; int a[n]; rep(i, n) { cin >> a[i]; } int ans = 0; rep(i, n - 1) { REP(j...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
163
2
/*#include<iostream> #include<algorithm> #include<cmath> #include<cstdio> #include<deque> #include<fstream> #include<iomanip> #include<map> #include<queue> #include <random> #include<stack> #include<string> #include<vector> using namespace std; #define ok1 printf("ok1\n"); #define ok2 printf("ok2\n"); #define M 100000...
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; #define ok1 printf("ok1\n"); #define ok2 printf("ok2\n"); #define M 10000000000000...
[["-", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 17, 151], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 17, 151], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 12, 22]]
1
313
7
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) using namespace std; int MAX = 736891; int main() { int n, m; bool f[MAX + 1]; while (1) { cin >> m >> n; if (m + n == 0) break; REP(i, MAX + 1) f[i] = false; for (int i = m;; i++) { if (!f[i]) { if (n == ...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) using namespace std; int MAX = 7368791; int main() { int n, m; bool f[MAX + 1]; while (1) { cin >> m >> n; if (m + n == 0) break; REP(i, MAX + 1) f[i] = false; for (int i = m;; i++) { if (!f[i]) { if (n ==...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
144
2
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <queue> #include <stack> #include <vector> using namespace std; typedef pair<int, int> P; typedef long long ll; typedef pair<int, P> PP; bool memo[8000000]; int m, n; void furui(int n, int count) { fill(memo...
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iostream> #include <queue> #include <stack> #include <vector> using namespace std; typedef pair<int, int> P; typedef long long ll; typedef pair<int, P> PP; bool memo[8000000]; int m, n; void furui(int n, int count) { fill(memo...
[["-", 0, 16, 31, 23, 0, 16, 31, 16, 17, 33], ["-", 0, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 33]]
1
342
4
#ifdef _MSVC_LANG #define _SCL_SECURE_NO_WARNINGS #pragma warning(disable : 0325) // inline namespace Error #endif #include <algorithm> #include <array> #include <bitset> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <ran...
#ifdef _MSVC_LANG #define _SCL_SECURE_NO_WARNINGS #pragma warning(disable : 0325) // inline namespace Error #endif #include <algorithm> #include <array> #include <bitset> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <ran...
[["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 64, 9, 0, 1, 0, 16, 12, 343, 345, 348], ["+", 64, 9, 0, 1, 0, 16, 12, 343, 0, 349], ["+", 64, 9, 0, 1, 0, 16, 12, 343, 141, 22]]
1
2,011
4
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <complex> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #include <cassert> #include <functi...
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <complex> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #include <cassert> #include <functi...
[["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 12, 22]]
1
250
2
#include <cstdio> using namespace std; int n, m; bool used[7400000]; int main() { while (1) { scanf("%d%d", &m, &n); if (n == 0) break; int ans = m, counter = n; for (int i = 0; i < 7400000; i++) used[i] = false; while (1) { if (used[ans]) { ans++; continue; ...
#include <cstdio> using namespace std; int n, m; bool used[7400000]; int main() { while (1) { scanf("%d%d", &m, &n); if (n == 0) break; int ans = m, counter = n; for (int i = 0; i < 7400000; i++) used[i] = false; while (1) { if (used[ans]) { ans++; continue; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
146
2
#include "bits/stdc++.h" using namespace std; int dp[300][300]; // dp[l][r] [l,r]でだるまを落としたときの落とした個数 int main() { while (1) { int n; cin >> n; if (n == 0) break; int da[300]; for (int i = 0; i < n; i++) cin >> da[i]; fill(dp[0], dp[300], 0); for (int i = 1; i < n; i++) { ...
#include "bits/stdc++.h" using namespace std; int dp[300][300]; // dp[l][r] [l,r]でだるまを落としたときの落とした個数 int main() { while (1) { int n; cin >> n; if (n == 0) break; int da[300]; for (int i = 0; i < n; i++) cin >> da[i]; fill(dp[0], dp[300], 0); for (int i = 1; i < n; i++) { ...
[["-", 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, 8, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46]]
1
327
4
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int n, a[1000], dp[1000][1000]; int main() { while (true) { cin >> n; if (n == 0) break; for (int i = 0; i < 1000; i++) { for (int j = 0; j < 1000; j++) dp[i][j] = 0; } for (int i =...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int n, a[1000], dp[1000][1000]; int main() { while (true) { cin >> n; if (n == 0) break; for (int i = 0; i < 1000; i++) { for (int j = 0; j < 1000; j++) dp[i][j] = 0; } for (int i =...
[["-", 51, 16, 31, 16, 31, 16, 31, 16, 17, 20], ["+", 51, 16, 31, 16, 31, 16, 31, 16, 17, 60], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 31, 22], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72]]
1
357
4
#include <bits/stdc++.h> #define N 305 using namespace std; int n, w[N], dp[N][N]; int main() { while (1) { cin >> n; if (!n) break; for (int i = 0; i < n; i++) cin >> w[i]; memset(dp, 0, sizeof(dp)); int ans = 0; for (int i = 1; i <= n; i += 2) { for (int j = 0; j <= n - i;...
#include <bits/stdc++.h> #define N 305 using namespace std; int n, w[N], dp[N][N]; int main() { while (1) { cin >> n; if (!n) break; for (int i = 0; i < n; i++) cin >> w[i]; memset(dp, 0, sizeof(dp)); int ans = 0; for (int i = 1; i <= n; i += 2) { for (int j = 0; j < n - i; ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18]]
1
309
2
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <...
[["+", 28, 69, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 28, 69, 28, 2, 3, 4, 0, 16, 12, 13]]
1
716
2
#include "bits/stdc++.h" #define REP(i, n, N) for (int i = (n); i < (N); i++) #define RREP(i, n, N) for (ll i = (N - 1); i >= n; i--) #define CK(n, a, b) ((a) <= (n) && (n) < (b)) #define ALL(v) (v).begin(), (v).end() #define p(s) cout << (s) << endl #define p2(a, b) cout << (a) << " " << (b) << endl #define v2(T) vect...
#include "bits/stdc++.h" #define REP(i, n, N) for (int i = (n); i < (N); i++) #define RREP(i, n, N) for (ll i = (N - 1); i >= n; i--) #define CK(n, a, b) ((a) <= (n) && (n) < (b)) #define ALL(v) (v).begin(), (v).end() #define p(s) cout << (s) << endl #define p2(a, b) cout << (a) << " " << (b) << endl #define v2(T) vect...
[["-", 28, 69, 28, 2, 3, 4, 0, 16, 17, 72], ["-", 28, 69, 28, 2, 3, 4, 0, 16, 12, 13], ["-", 28, 69, 28, 2, 3, 4, 0, 16, 17, 33]]
1
329
4
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> P; typedef pair<ll, ll> Pll; typedef vector<int> Vi; // typedef tuple<int, int, int> T; #define FOR(i, s, x) for (int i = s; i < (int)(x); i++) #define REP(i, x) FOR(i, 0, x) #define ALL(c) c.begin(), c.end() #define DUMP(x)...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> P; typedef pair<ll, ll> Pll; typedef vector<int> Vi; // typedef tuple<int, int, int> T; #define FOR(i, s, x) for (int i = s; i < (int)(x); i++) #define REP(i, x) FOR(i, 0, x) #define ALL(c) c.begin(), c.end() #define DUMP(x)...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
336
3
#include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n && n != 0) { vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } vector<vector<int>> dp(n, vector<int>(n, 0)); ...
#include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n && n != 0) { vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } vector<vector<int>> dp(n, vector<int>(n, 0)); ...
[["-", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
354
2
// written by @kakira9618 // problem: // http://icpc.iisf.or.jp/past-icpc/domestic2016/problems/all_ja.html#section_D #include <algorithm> #include <iostream> #include <string.h> #include <vector> using namespace std; int n; vector<int> W; int dp[301][301]; int dfs(int l, int r) { if (r - l <= 1) return dp[l]...
// written by @kakira9618 // problem: // http://icpc.iisf.or.jp/past-icpc/domestic2016/problems/all_ja.html#section_D #include <algorithm> #include <iostream> #include <string.h> #include <vector> using namespace std; int n; vector<int> W; int dp[301][301]; // O(n^3) int dfs(int l, int r) { if (r - l <= 1) re...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
285
2
#include <bits/stdc++.h> using namespace std; #define INF 1000000000 #define REP(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) typedef long long LL; int N; bool ok[1001][1001]; int dp[1001][1001]; int ans[1001]; int main() { while (cin >> N, N) { vector<int> v(N); REP(i, N) cin >> v[i]; REP(i, 1001) REP(j...
#include <bits/stdc++.h> using namespace std; #define INF 1000000000 #define REP(i, n) for (int(i) = 0; (i) < (int)(n); (i)++) typedef long long LL; int N; bool ok[1001][1001]; int dp[1001][1001]; int ans[1001]; int main() { while (cin >> N, N) { vector<int> v(N); REP(i, N) cin >> v[i]; REP(i, 1001) REP(j...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
522
2
#include <algorithm> #include <cstdlib> #include <cstring> #include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < n; ++i) #define OK(x, y) abs(w[x] - w[y]) <= 1 int n, w[311]; int dp[311][311]; int main() { while (cin >> n && n) { REP(i, n) cin >> w[i]; memset(dp, 0, sizeof dp); ...
#include <algorithm> #include <cstdlib> #include <cstring> #include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < n; ++i) #define OK(x, y) abs(w[x] - w[y]) <= 1 int n, w[311]; int dp[311][311]; int main() { while (cin >> n && n) { REP(i, n) cin >> w[i]; memset(dp, 0, sizeof dp); ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
245
4
#include <cmath> #include <iostream> #define REP(i, a, n) for (int i = ((int)a); i < ((int)n); i++) using namespace std; int N, W[300]; int dp[301][3001]; bool ok(int i, int j) { return abs(W[i] - W[j]) <= 1; } int dfs(int l, int r) { if (r - l <= 1) return 0; if (r - l == 2) return ok(l, l + 1) ? 2 : 0;...
#include <cmath> #include <iostream> #define REP(i, a, n) for (int i = ((int)a); i < ((int)n); i++) using namespace std; int N, W[300]; int dp[301][3001]; bool ok(int i, int j) { return abs(W[i] - W[j]) <= 1; } int dfs(int l, int r) { if (r - l <= 1) return 0; if (r - l == 2) return ok(l, l + 1) ? 2 : 0;...
[["-", 0, 11, 31, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 11, 31, 2, 3, 4, 0, 16, 12, 13]]
1
286
2
#include <cmath> #include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { int w[n]; for (int i = 0; i < n; ++i) cin >> w[i]; int dp[n][n]; for (int i = 0; i < n; ++i) { fill(dp[i], dp[i] + n, 0); } for (int i = 0; i < n - 1; ++i) { for (int j = ...
#include <cmath> #include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { int w[n]; for (int i = 0; i < n; ++i) cin >> w[i]; int dp[n][n]; for (int i = 0; i < n; ++i) { fill(dp[i], dp[i] + n, 0); } for (int i = 0; i < n; ++i) { for (int j = 0; j...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 18], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19]]
1
297
4
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long i64; typedef long double ld; typedef pair<i64, i64> P; #define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i)) int ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long i64; typedef long double ld; typedef pair<i64, i64> P; #define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i)) int ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
291
2
#include <bits/stdc++.h> // Shrotening #define fst first #define snd second #define pb push_back #define mp make_pair // Loop #define FOR(i, a, b) for (auto i = (a); i < (b); ++i) #define RFOR(i, a, b) for (auto i = (a); i >= (b); --i) #define REP(i, a) for (long i = 0; i < (a); ++i) #define RREP(i, a) for (long i =...
#include <bits/stdc++.h> // Shrotening #define fst first #define snd second #define pb push_back #define mp make_pair // Loop #define FOR(i, a, b) for (auto i = (a); i < (b); ++i) #define RFOR(i, a, b) for (auto i = (a); i >= (b); --i) #define REP(i, a) for (long i = 0; i < (a); ++i) #define RREP(i, a) for (long i =...
[["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 72], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33]]
1
495
2
while true x, y = gets.split(' ').map(&:to_i) break if x == 0 && y == 0 results = [] prices = gets.split(' ').map(&:to_i) (0..n-1).each do |i| (0..i-1).each do |j| sum = prices[i] + prices[j] results.push(sum) if sum <= y end end puts results.empty? ? 'NONE' : results.max end
while true x, y = gets.split(' ').map(&:to_i) break if x == 0 && y == 0 results = [] prices = gets.split(' ').map(&:to_i) (0..x-1).each do |i| (0..i-1).each do |j| sum = prices[i] + prices[j] results.push(sum) if sum <= y end end puts results.empty? ? 'NONE' : results.max end
[["-", 0, 652, 486, 739, 0, 475, 444, 738, 31, 22], ["+", 0, 652, 486, 739, 0, 475, 444, 738, 31, 22]]
4
111
2
#!/usr/bin/env python3 n_list = [] m_list = [] a_list = [] while True: n, m = list(map(int, input().split(' '))) if n == 0 and m == 0: break a = list(map(int, input().split(' '))) n_list.append(n) m_list.append(m) a_list.append(a) for n, m, a in zip(n_list, m_list, a_list): m_...
#!/usr/bin/env python3 n_list = [] m_list = [] a_list = [] while True: n, m = list(map(int, input().split(' '))) if n == 0 and m == 0: break a = list(map(int, input().split(' '))) n_list.append(n) m_list.append(m) a_list.append(a) for n, m, a in zip(n_list, m_list, a_list): m_...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
167
2
ans = [] cou = 0 while(1): n,m = map(int,input().split()) if(n == 0): break ar = list(map(int,input().split())) max_ans = 0 for i in range(n-1): for j in range(i,n): if(max_ans < ar[i]+ar[j] and ar[i]+ar[j] <= m): max_ans = ar[i] + ar[j] ans.append(max_ans...
ans = [] cou = 0 while(1): n,m = map(int,input().split()) if(n == 0): break ar = list(map(int,input().split())) max_ans = 0 for i in range(n-1): for j in range(i+1,n): if(max_ans < ar[i]+ar[j] and ar[i]+ar[j] <= m): max_ans = ar[i] + ar[j] ans.append(max_a...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
156
2
maxs=[] while(True): max=-1 b=list(map(int,input().split())) n=b[0] m=b[1] if(n == 0 and m == 0): break a=list(map(int,input().split())) for i in range(n): for j in range(i+1,n): sum=a[i]+a[j] if(sum>max and sum<m): max=sum max...
maxs=[] while(True): max=-1 b=list(map(int,input().split())) n=b[0] m=b[1] if(n == 0 and m == 0): break a=list(map(int,input().split())) for i in range(n): for j in range(i+1,n): sum=a[i]+a[j] if(sum>max and sum<=m): max=sum ma...
[["-", 0, 57, 15, 23, 0, 679, 12, 666, 667, 18], ["+", 0, 57, 15, 23, 0, 679, 12, 666, 667, 19]]
5
145
2
while 1: str=input().split() n=int(str[0]) m=int(str[1]) if n==0 and m==0: break str=input().split() a=[0]*n for i in range(n): a[i]=int(str[i]) a.sort() a.reverse() print(a) flag=0 max=0 for i in range(n): if flag!=0: break for j in range(i+1,...
while 1: str=input().split() n=int(str[0]) m=int(str[1]) if n==0 and m==0: break str=input().split() a=[0]*n for i in range(n): a[i]=int(str[i]) a.sort() a.reverse() flag=0 max=0 for i in range(n): if flag!=0: break for j in range(i+1,n): ...
[["-", 0, 52, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
163
4
import sys while(True): items=[] max=0 n, m = map(int, input().split()) if (n == 0 & m == 0):exit() items = list(map(int, input().split())) for i in range(n): for j in range(n): sum = items[i] + items[j] if (i != j and sum < m and sum > max): max =...
import sys while(True): items=[] max=0 n, m = map(int, input().split()) if (n == 0 & m == 0):exit() items = list(map(int, input().split())) for i in range(n): for j in range(n): sum = items[i] + items[j] if (i != j and sum <= m and sum > max): max ...
[["-", 15, 23, 0, 679, 31, 679, 12, 666, 667, 18], ["+", 15, 23, 0, 679, 31, 679, 12, 666, 667, 19]]
5
125
2
#include <iostream> #include <string> #include <vector> using namespace std; int main() { string s, t; while (cin >> s && s != ".") { cin >> t; vector<string> v1, u1, v2, u2; bool flag = 0; string tmp; for (int i = 0; i < s.size(); i++) { if (s[i] == '"' && !flag) { v1.push_back(t...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { string s, t; while (cin >> s && s != ".") { cin >> t; vector<string> v1, u1, v2, u2; bool flag = 0; string tmp; for (int i = 0; i < s.size(); i++) { if (s[i] == '"' && !flag) { v1.push_back(t...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
461
2
#include <algorithm> #include <iostream> #include <numeric> #include <string> #include <vector> using namespace std; void split(string s, vector<string> &v) { v.clear(); s += '"'; string str = ""; for (int i = 0; i < s.size(); i++) { if (s[i] == '"') { v.push_back(str); str = ""; } else { ...
#include <algorithm> #include <iostream> #include <numeric> #include <string> #include <vector> using namespace std; void split(string s, vector<string> &v) { v.clear(); s += '"'; string str = ""; for (int i = 0; i < s.size(); i++) { if (s[i] == '"') { v.push_back(str); str = ""; } else { ...
[["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 75, 76, 0, 9, 0, 57, 75, 76, 0, 95]]
1
322
3
#include <iostream> #include <string> #include <vector> using namespace std; void split(string s, vector<string> &v) { s += '"'; string buf = ""; for (int i = 0; i < s.size(); i++) { if (s[i] == '"') { v.push_back(buf); buf = ""; } else buf += s[i]; } } int main() { while (1) { ...
#include <iostream> #include <string> #include <vector> using namespace std; void split(string s, vector<string> &v) { s += '"'; string buf = ""; for (int i = 0; i < s.size(); i++) { if (s[i] == '"') { v.push_back(buf); buf = ""; } else buf += s[i]; } } int main() { while (1) { ...
[["-", 64, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 64, 9, 0, 57, 64, 9, 0, 126, 0, 127], ["+", 64, 9, 0, 57, 64, 9, 0, 126, 128, 129], ["+", 8, 9, 0, 52, 8, 9, 0, 97, 128, 129], ["+", 8, 9, 0, 52, 8, 9, 0, 97, 0, 102], ["+", 0, 52, 8, 9, 0, 97, 0, 1, 0, 35]]
1
301
6
#include <bits/stdc++.h> using namespace std; #define r(i, n) for (int i = 0; i < n; i++) string a[2], b; string s[2][1001]; int p[2]; void dfs(int x) { r(i, a[x].size()) { if (a[x][i] == '"') { i++; s[x][p[x]] += '"'; while (i < a[x].size() && a[x][i] != '"') s[x][p[x]] += a[x][i++]; ...
#include <bits/stdc++.h> using namespace std; #define r(i, n) for (int i = 0; i < n; i++) string a[2], b; string s[2][1001]; int p[2]; void dfs(int x) { r(i, a[x].size()) { if (a[x][i] == '"') { i++; s[x][p[x]] += '"'; while (i < a[x].size() && a[x][i] != '"') s[x][p[x]] += a[x][i++]; ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
422
2
#include <bits/stdc++.h> using namespace std; int main() { while (1) { string s1, s2; cin >> s1; if (s1[0] == '.' && s1.size() == 1) { break; } cin >> s2; string::iterator itr1 = s1.begin(), itr2 = s2.begin(); bool firstdiff = false; bool is_into_quotation = false; ...
#include <bits/stdc++.h> using namespace std; int main() { while (1) { string s1, s2; cin >> s1; if (s1[0] == '.' && s1.size() == 1) { break; } cin >> s2; string::iterator itr1 = s1.begin(), itr2 = s2.begin(); bool firstdiff = false; bool is_into_quotation = false; ...
[["-", 0, 9, 0, 1, 0, 11, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 11, 12, 5, 0, 6]]
1
255
2
#include <iostream> #include <sstream> using namespace std; int main() { while (1) { string s1, s2; cin >> s1; if (s1 == ".") return 0; cin >> s2; string s11[201], s22[201]; for (int i = 0; i < 201; i++) { s11[i] = "."; s22[i] = "."; } int now1 = 0, now2 = 0; for...
#include <iostream> #include <sstream> using namespace std; int main() { while (1) { string s1, s2; cin >> s1; if (s1 == ".") return 0; cin >> s2; string s11[201], s22[201]; for (int i = 0; i < 201; i++) { s11[i] = "."; s22[i] = "."; } int now1 = 0, now2 = 0; for...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
321
2
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; #define pb push_back int dy[] = {0, 0, 1, -1, 1, 1, -1, -1}; int dx[] = {1, -1, 0, 0, 1, -1, -1, 1}; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define ...
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; #define pb push_back int dy[] = {0, 0, 1, -1, 1, 1, -1, -1}; int dx[] = {1, -1, 0, 0, 1, -1, -1, 1}; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
460
2
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int cnt; string s1, s2, tmp; vector<string> sv1, sv2; while (cin >> s1) { if (s1 == ".") { break; } cin >> s2; sv1.clear(); sv2.clear(); tmp = ""; cnt = 0; if (s1 == s2) { c...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int cnt; string s1, s2, tmp; vector<string> sv1, sv2; while (cin >> s1) { if (s1 == ".") { break; } cin >> s2; sv1.clear(); sv2.clear(); tmp = ""; cnt = 0; if (s1 == s2) { c...
[["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
338
2
#include <cassert> #include <iostream> #include <vector> using namespace std; using ll = long long; constexpr ll INF = 1LL << 50; ll s; struct Cube { ll x; ll y; ll z; }; inline ll connected(const Cube &c1, const Cube &c2) { const ll dx = abs(c1.x - c2.x); const ll dy = abs(c1.y - c2.y); const ll dz = abs...
#include <cassert> #include <iostream> #include <vector> using namespace std; using ll = long long; constexpr ll INF = 1LL << 50; ll s; struct Cube { ll x; ll y; ll z; }; inline ll connected(const Cube &c1, const Cube &c2) { const ll dx = abs(c1.x - c2.x); const ll dy = abs(c1.y - c2.y); const ll dz = abs...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
1,187
2
#include <algorithm> #include <array> #include <cassert> #include <climits> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <string> #incl...
#include <algorithm> #include <array> #include <cassert> #include <climits> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <string> #incl...
[["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46]]
1
880
4
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); while (true) { int n = scan.nextInt(); int m = scan.nextInt(); int t = scan.nextInt(); int p = scan.nextInt(); if (n == 0 &...
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); while (true) { int n = scan.nextInt(); int m = scan.nextInt(); int t = scan.nextInt(); int p = scan.nextInt(); if (n == 0 &...
[["-", 0, 57, 15, 15, 0, 16, 31, 16, 17, 72], ["-", 0, 57, 15, 15, 0, 16, 31, 16, 12, 22]]
3
562
2
#include <bits/stdc++.h> using namespace std; int A[200][200]; int main() { int n, m, t, p; while (1) { cin >> n >> m >> t >> p; if (n == 0 && m == 0 && t == 0 && p == 0) break; for (int i = 0; i < 200; i++) for (int j = 0; j < 200; j++) A[i][j] = 0; for (int i = 0; i < m; i+...
#include <bits/stdc++.h> using namespace std; int A[200][200]; int main() { int n, m, t, p; while (1) { cin >> n >> m >> t >> p; if (n == 0 && m == 0 && t == 0 && p == 0) break; for (int i = 0; i < 200; i++) for (int j = 0; j < 200; j++) A[i][j] = 0; for (int i = 0; i < m; i+...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13]]
1
460
8
s=[] while 1: l1=input() if l1==".": break l2=input() sp1=l1.split('"') sp2=l2.split('"') t=0 if len(sp1)==len(sp2): for i in range(len(sp1)): if i%2==1 and sp1[i]!=sp2[i]: t+=1 elif i%2!=1 and sp1[i]!=sp2[i]: t+=...
s=[] while 1: l1=input() if l1==".": break l2=input() sp1=l1.split('"') sp2=l2.split('"') t=0 if len(sp1)==len(sp2): for i in range(len(sp1)): if i%2==1 and sp1[i]!=sp2[i]: t+=1 elif i%2!=1 and sp1[i]!=sp2[i]: t+=...
[["-", 0, 1, 0, 677, 12, 634, 0, 557, 0, 6], ["+", 0, 1, 0, 677, 12, 634, 0, 557, 0, 6]]
5
152
2
while 1: s1=input().split('"') if s1[0]==".": break s2=input().split('"') cnt1=0 cnt2=0 flag=0 if len(s1)!=len(s2): print("DIFFERENT") else: i=0 while i<len(s1): if s1[i]==s2[i]: cnt1+=1 elif i%2==0: print("DIFFERENT") flag=1 break else: cnt2+=1 if cnt2>1: print...
while 1: s1=input().split('"') if s1[0]==".": break s2=input().split('"') cnt1=0 cnt2=0 flag=0 if len(s1)!=len(s2): print("DIFFERENT") else: i=0 while i<len(s1): if s1[i]==s2[i]: cnt1+=1 elif i%2==0: print("DIFFERENT") flag=1 break else: cnt2+=1 if cnt2>1: print...
[["-", 75, 76, 8, 196, 0, 57, 15, 666, 0, 612], ["-", 0, 57, 75, 76, 8, 196, 0, 57, 0, 102], ["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["-", 75, 76, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612], ["+", 75, 76, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 0, 57, 75, 76, 8, 196, 0, 57, 0, ...
5
159
8
#include <bits/stdc++.h> using namespace std; int dx[9] = {0, 0, 1, 1, 1, 0, -1, -1, -1}, dy[9] = {0, -1, -1, 0, 1, 1, 1, 0, -1}; int main() { int d, w; while (cin >> d >> w, d) { int e[d][w]; for (int i = 0; i < d; i++) { for (int j = 0; j < w; j++) { cin >> e[i][j]; } } ...
#include <bits/stdc++.h> using namespace std; int dx[9] = {0, 0, 1, 1, 1, 0, -1, -1, -1}, dy[9] = {0, -1, -1, 0, 1, 1, 1, 0, -1}; int main() { int d, w; while (cin >> d >> w, d) { int e[d][w]; for (int i = 0; i < d; i++) { for (int j = 0; j < w; j++) { cin >> e[i][j]; } } ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
454
2
#include <bits/stdc++.h> using namespace std; #define INF_LL (int64)1e18 #define INF (int32)1e9 #define REP(i, n) for (int64 i = 0; i < (n); i++) #define FOR(i, a, b) for (int64 i = (a); i < (b); i++) #define all(x) x.begin(), x.end() #define fs first #define sc second using int32 = int_fast32_t; using uint32 = uint_...
#include <bits/stdc++.h> using namespace std; #define INF_LL (int64)1e18 #define INF (int32)1e9 #define REP(i, n) for (int64 i = 0; i < (n); i++) #define FOR(i, a, b) for (int64 i = (a); i < (b); i++) #define all(x) x.begin(), x.end() #define fs first #define sc second using int32 = int_fast32_t; using uint32 = uint_...
[["+", 12, 2, 3, 4, 0, 16, 31, 16, 17, 48], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 12, 22]]
1
580
2
#include <iostream> using namespace std; int d, w; int cap = 0; int e[10][10]; int hight_of_ike(int sx, int sy, int col, int row) { int suii = e[sy][sx]; for (int y = sy; y <= sy + col; ++y) { for (int x = sx; x <= sx + row; ++x) { suii = max(suii, e[y][x]); } } return suii; } int hight_of_sto(...
#include <iostream> using namespace std; int d, w; int cap = 0; int e[10][10]; int hight_of_ike(int sx, int sy, int col, int row) { int suii = e[sy][sx]; for (int y = sy; y <= sy + col; ++y) { for (int x = sx; x <= sx + row; ++x) { suii = max(suii, e[y][x]); } } return suii; } int hight_of_sto(...
[["-", 49, 50, 51, 69, 28, 69, 341, 342, 0, 22], ["+", 49, 50, 51, 69, 28, 69, 341, 342, 0, 22], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 22]]
1
506
4
#include <bits/stdc++.h> using namespace std; int n, m; string s[510]; void dfs(int &ans, int tmp, int idx, vector<bool> is_odd) { // cout << idx << endl; if (idx == n) { int ok = true; for (int i = 0; i < m; i++) { if (is_odd[i]) { ok = false; break; } } if (ok) ...
#include <bits/stdc++.h> using namespace std; int n, m; string s[510]; void dfs(int &ans, int tmp, int idx, vector<bool> is_odd) { // cout << idx << endl; if (idx == n) { int ok = true; for (int i = 0; i < m; i++) { if (is_odd[i]) { ok = false; break; } } if (ok) ...
[["-", 8, 9, 0, 7, 8, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 7, 8, 1, 0, 11, 12, 13], ["-", 31, 16, 12, 69, 28, 69, 341, 342, 0, 22], ["+", 31, 16, 12, 69, 28, 69, 341, 342, 0, 22]]
1
542
4
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int n, m; bool b[504]; int c; bool s[501]; int DP[2][1 << 25]; int bc(int bits) { bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555); bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333); bits = (bits & 0x0f0f0f0f) + (...
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int n, m; bool b[504]; int c; bool s[501]; int DP[2][1 << 25]; int bc(int bits) { bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555); bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333); bits = (bits & 0x0f0f0f0f) + (...
[["-", 0, 9, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 0, 9, 0, 57, 64, 1, 0, 11, 12, 22]]
1
611
2
#include <assert.h> #include <functional> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; int main(int argc, char *argv[]) { auto parse = [](const string &exp) { int i = 0; function<int()> pp = [&exp, &i, &pp]() { char c = exp[i++]; switch (c) { ...
#include <assert.h> #include <functional> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; int main(int argc, char *argv[]) { auto parse = [](const string &exp) { int i = 0; function<int()> pp = [&exp, &i, &pp]() { char c = exp[i++]; switch (c) { ...
[["-", 0, 100, 0, 9, 0, 37, 0, 16, 12, 13], ["+", 0, 100, 0, 9, 0, 37, 0, 16, 12, 13]]
1
702
2
#include <stdio.h> int main() { long long n, a, b; char s[100]; while (scanf("%lld %lld %lld", &n, &a, &b), n) { a--; b--; s[n] = 0; while (n--) { s[n] = (a % 2 == b % 2) ? 'L' : 'R'; a = (a < (1 << n)) ? (1 << n) - a - 1 : a - (1 << n); b /= 2; } printf("%s\n", s); } ...
#include <stdio.h> int main() { long long n, a, b; char s[100]; while (scanf("%lld %lld %lld", &n, &a, &b), n) { a--; b--; s[n] = 0; while (n--) { s[n] = (a % 2 == b % 2) ? 'L' : 'R'; a = (a < (1LL << n)) ? (1LL << n) - a - 1 : a - (1LL << n); b /= 2; } printf("%s\n", s);...
[["-", 15, 23, 0, 16, 12, 23, 0, 16, 31, 13], ["+", 15, 23, 0, 16, 12, 23, 0, 16, 31, 13], ["-", 64, 16, 31, 16, 31, 23, 0, 16, 31, 13], ["+", 64, 16, 31, 16, 31, 23, 0, 16, 31, 13], ["-", 12, 41, 75, 16, 12, 23, 0, 16, 31, 13], ["+", 12, 41, 75, 16, 12, 23, 0, 16, 31, 13]]
0
134
6
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 100000...
#include <algorithm> #include <cfloat> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <time.h> #include <vector> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 100000...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
476
1
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i, n, sum, avg, count; while (true) { sum = 0; avg = 0; count = 0; n = sc.nextInt(); if (n == 0) break; int a[] = new int[n]; ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i, n, sum, avg, count; while (true) { sum = 0; avg = 0; count = 0; n = sc.nextInt(); if (n == 0) break; int a[] = new int[n]; ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19]]
3
174
24
#include <bits/stdc++.h> using namespace std; #define inf 1000000000 #define INF 1000000000000000 #define ll long long #define ull unsigned long long #define M (int)(1e9 + 7) #define P pair<int, int> #define PLL pair<ll, ll> #define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++) #define RFOR(i, m, n) for (int i = ...
#include <bits/stdc++.h> using namespace std; #define inf 1000000000 #define INF 1000000000000000 #define ll long long #define ull unsigned long long #define M (int)(1e9 + 7) #define P pair<int, int> #define PLL pair<ll, ll> #define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++) #define RFOR(i, m, n) for (int i = ...
[["+", 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
242
4
#include <bits/stdc++.h> using namespace std; int main() { int64_t b; while (cin >> b, b) { for (int d = sqrt(b); d > 0; --d) { int64_t a = (2 * b + d - d * d) / (2 * d); if (a <= 0) continue; if ((a + d) * (a + d - 1) - a * (a - 1) == 2 * b) { cout << a << " " << d << endl; ...
#include <bits/stdc++.h> using namespace std; int main() { int64_t b; while (cin >> b, b) { for (int64_t d = sqrt(2 * b); d > 0; --d) { int64_t a = (2 * b + d - d * d) / (2 * d); if (a <= 0) continue; if ((a + d) * (a + d - 1) - a * (a - 1) == 2 * b) { cout << a << " " << d <...
[["-", 0, 52, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 31, 13], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 48]]
1
117
8
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, a, b) for (int i = a; i >= b; i--) #define fore(i, a) for (auto &i : a) #define all(x) (x).begin(), (x).end() using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } typedef long l...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, a, b) for (int i = a; i >= b; i--) #define fore(i, a) for (auto &i : a) #define all(x) (x).begin(), (x).end() using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } typedef long l...
[["+", 0, 1, 0, 11, 12, 16, 31, 16, 17, 85], ["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22]]
1
273
2
#include <iostream> using namespace std; typedef long long int ll; int main() { int b; while (cin >> b, b) { for (ll l = (1 << 20); l >= 0; l--) { ll bunshi = b - l * (l + 1) / 2; ll bunbo = l + 1; if (bunshi >= 0 && bunshi % bunbo == 0) { cout << bunshi / bunbo << " " << l + 1 << en...
#include <iostream> using namespace std; typedef long long int ll; int main() { int b; while (cin >> b, b) { for (ll l = (1 << 20); l >= 0; l--) { ll bunshi = b - l * (l + 1) / 2; ll bunbo = l + 1; if (bunshi > 0 && bunshi % bunbo == 0) { cout << bunshi / bunbo << " " << l + 1 << end...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47]]
1
108
2
#include <iostream> using namespace std; long n; main() { while (cin >> n, n) { for (long long w = 4e4; --w;) { if (n > w * (w - 1) / 2 && (n - w * (w - 1) / 2) % w < 1) { cout << (n - w * (w - 1) / 2) / w << " " << w << endl; break; } } } }
#include <iostream> using namespace std; long n; main() { while (cin >> n, n) { for (long w = 1e5; --w;) { if (n > w * (w - 1) / 2 && (n - w * (w - 1) / 2) % w < 1) { cout << (n - w * (w - 1) / 2) / w << " " << w << endl; break; } } } }
[["-", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
100
3
//初項をa, 項数をnとして式を立てて, aについて解くと嬉しい。nは2 * //sqrt(b)くらいまで考えれば十分。 // l+…+rではなくて、a+…+(a+n-1)を考えたくなる理由:(1) nの範囲が小さい, (2) // 計算しやすい(線形っぽい分解) #include <iostream> using namespace std; int main() { int b; while (cin >> b) { if (b == 0) break; int n; for (n = 50000; n > 0; n--) { int na = b - n * (n ...
//初項をa, 項数をnとして式を立てて, aについて解くと嬉しい。nは2 * //sqrt(b)くらいまで考えれば十分。 // l+…+rではなくて、a+…+(a+n-1)を考えたくなる理由:(1) nの範囲が小さい, (2) // 計算しやすい(線形っぽい分解) #include <iostream> #define int long long using namespace std; signed main() { int b; while (cin >> b) { if (b == 0) break; int n; for (n = 50000; n > 0; n--) { ...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 156]]
1
106
5
while s=gets n=s.to_i break if n==0 a=b=r=0 (2..1/0.0).each{|i| x=n-i*(i-1)/2 break if x<i if x%i==0 a=x/i b=i end } puts '%d %d'%[a,b] end
while s=gets n=s.to_i break if n==0 a=n;b=1 r=0 (2..1/0.0).each{|i| x=n-i*(i-1)/2 break if x<i if x%i==0 a=x/i b=i end } puts '%d %d'%[a,b] end
[["+", 0, 493, 0, 89, 8, 170, 0, 662, 12, 22], ["+", 36, 36, 0, 493, 0, 89, 8, 170, 0, 35], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 12, 612]]
4
76
3
while True: b = int(eval(input())) if b == 0: break n = 1 ans = [] while True: # print(n) if n % 2 == 0: if b % n != 0: if b // n >= n // 2: if (b / n * 10) % 5 == 0: ans = [b // n - n // 2 + 1, n] ...
while True: b = int(input()) if b == 0: break n = 1 ans = [] while True: # print(n) if n % 2 == 0: if b % n != 0: if b // n >= n // 2: if (b / n * 10) % 5 == 0: ans = [b // n - n // 2 + 1, n] ...
[["-", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 0, 1, 0, 652, 3, 4, 0, 660, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 660, 0, 25]]
5
151
5
#include <bits/stdc++.h> using namespace std; #ifdef DEBUG_MODE #define DBG(n) n; #else #define DBG(n) ; #endif #define REP(i, n) for (ll(i) = (0); (i) < (n); ++i) #define PB push_back #define MP make_pair #define FI first #define SE second #define SHOW1d(v, n) ...
#include <bits/stdc++.h> using namespace std; #ifdef DEBUG_MODE #define DBG(n) n; #else #define DBG(n) ; #endif #define REP(i, n) for (ll(i) = (0); (i) < (n); ++i) #define PB push_back #define MP make_pair #define FI first #define SE second #define SHOW1d(v, n) ...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]]
1
544
2
#include <stdio.h> typedef struct _Gem { int x; int y; bool hit; } Gem; static void pick_gem(Gem *g, int n, int x, int y) { for (int i = 0; i < n; i++) { if (!g[i].hit && g[i].x == x && g[i].y == y) { g[i].hit = true; return; } } } static bool check_gem(Gem *g, int n) { for (int i = 0...
#include <stdio.h> typedef struct _Gem { int x; int y; bool hit; } Gem; static void pick_gem(Gem *g, int n, int x, int y) { for (int i = 0; i < n; i++) { if (!g[i].hit && g[i].x == x && g[i].y == y) { g[i].hit = true; return; } } } static bool check_gem(Gem *g, int n) { for (int i = 0...
[["-", 3, 4, 0, 23, 0, 41, 64, 5, 0, 6], ["+", 3, 4, 0, 23, 0, 41, 64, 5, 0, 6], ["-", 3, 4, 0, 23, 0, 41, 75, 5, 0, 6], ["+", 3, 4, 0, 23, 0, 41, 75, 5, 0, 6]]
1
648
4
#include <algorithm> #include <iostream> #include <queue> #include <stdlib.h> #include <string> using namespace std; int main() { string s; int n, m, x, y; while (cin >> n && n != 0) { int c = 0; int ma[22][22] = {0}; for (int aa = 0; aa < n; aa++) { cin >> x >> y; ma[x][y] = 1; } ...
#include <algorithm> #include <iostream> #include <queue> #include <stdlib.h> #include <string> using namespace std; int main() { string s; int n, m, x, y; while (cin >> n && n != 0) { int c = 0; int ma[22][22] = {0}; for (int aa = 0; aa < n; aa++) { cin >> x >> y; ma[x][y] = 1; } ...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
361
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define mp(a, b) make_pair(a, b) #define pb(a) push_back(a) #define dbg(x) cout << #x "=...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define mp(a, b) make_pair(a, b) #define pb(a) push_back(a) #define dbg(x) cout << #x "=...
[["+", 8, 9, 0, 52, 8, 9, 0, 9, 0, 45], ["+", 8, 9, 0, 52, 8, 9, 0, 9, 0, 46], ["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
344
6
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define MAX 20 int main() { while (true) { int n; cin >> n; if (n == 0) break; int x[MAX], y[MAX]; rep(i, n) { cin >> x[i] >> y[i]; } for (int i = n; i < MAX; i++) { x[i] = y[i] = -1; } ...
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define MAX 20 int main() { while (true) { int n; cin >> n; if (n == 0) break; int x[MAX], y[MAX]; rep(i, n) { cin >> x[i] >> y[i]; } for (int i = n; i < MAX; i++) { x[i] = y[i] = -1; } ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
341
2
#include <iostream> using namespace std; int main(void) { while (1) { int n; cin >> n; if (n == 0) break; int stone[21][21]; for (int y = 0; y < 21; y++) { for (int x = 0; x < 21; x++) { stone[y][x] = 0; } } for (int i = 0; i < n; i++) { int x, y; ci...
#include <iostream> using namespace std; int main(void) { while (1) { int n; cin >> n; if (n == 0) break; int stone[21][21]; for (int y = 0; y < 21; y++) { for (int x = 0; x < 21; x++) { stone[y][x] = 0; } } for (int i = 0; i < n; i++) { int x, y; ci...
[["-", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 64, 5, 0, 6], ["-", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6], ["+", 31, 16, 12, 23, 0, 41, 75, 5, 0, 6]]
1
281
4
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) #define reg(i, a, b) for (int i = ((int)(a)); i...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < ((int)(n)); i++) #define reg(i, a, b) for (int i = ((int)(a)); i...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 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, 6]]
1
539
4
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { while (true) { int N; cin >> N; if (N == 0) break; int gems_pos[21][2]; for (int i = 0; i < N; i++) { cin >> gems_pos[i][0]; cin >> gems_pos[i][1]; } int M; cin >> M; int...
#include <cstdio> #include <iostream> #include <string> using namespace std; int main() { while (true) { int N; cin >> N; if (N == 0) break; int gems_pos[21][2]; for (int i = 0; i < N; i++) { cin >> gems_pos[i][0]; cin >> gems_pos[i][1]; } int M; cin >> M; int...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
355
4
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define LOOP(i, a, n) for (int i = (int)a; i < (int)n; ++i) #define REP(i, n) LOOP(i, 0, n) #define MOD 1000000007 #define INF 1000000000 #define PI 3.14159265359 #define MAX_N 20 #define MAX_M 30 int main(void) { while (true) { int n; cin...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define LOOP(i, a, n) for (int i = (int)a; i < (int)n; ++i) #define REP(i, n) LOOP(i, 0, n) #define MOD 1000000007 #define INF 1000000000 #define PI 3.14159265359 #define MAX_N 20 #define MAX_M 30 int main(void) { while (true) { int n; cin...
[["-", 15, 339, 51, 16, 12, 16, 12, 69, 28, 22], ["+", 15, 339, 51, 16, 12, 16, 12, 69, 28, 22], ["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
423
6
#include <iostream> using namespace std; int main() { int N; while (cin >> N, N) { int m[21][21] = {0}; for (int i = 0; i < N; ++i) { int x, y; cin >> x >> y; ++m[x][y]; } int px = 10, py = 10; int M; cin >> M; int ans = m[px][py]; for (int i = 0; i < M; ++i) { ...
#include <iostream> using namespace std; int main() { int N; while (cin >> N, N) { int m[21][21] = {0}; for (int i = 0; i < N; ++i) { int x, y; cin >> x >> y; ++m[x][y]; } int px = 10, py = 10; int M; cin >> M; int ans = m[px][py]; for (int i = 0; i < M; ++i) { ...
[["-", 75, 76, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
236
4
#include <bits/stdc++.h> using namespace std; #define REP(i, s, n) for (int i = s; i < n; ++i) #define rep(i, n) REP(i, 0, n) #define SORT(c) sort((c).begin(), (c).end()) #define IINF INT_MAX #define LLINF LLONG_MAX #define DEBUG true typedef long long ll; typedef pair<int, int> ii; struct NODE { int x, y; NODE(...
#include <bits/stdc++.h> using namespace std; #define REP(i, s, n) for (int i = s; i < n; ++i) #define rep(i, n) REP(i, 0, n) #define SORT(c) sort((c).begin(), (c).end()) #define IINF INT_MAX #define LLINF LLONG_MAX #define DEBUG false typedef long long ll; typedef pair<int, int> ii; struct NODE { int x, y; NODE...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
341
2
#include <bits/stdc++.h> using namespace std; #define lp(i, n) for (int i = 0; i < n; i++) int main() { while (1) { int n; cin >> n; if (n == 0) break; int h[21][21]; lp(i, 21) { lp(j, 21) { h[i][j] = 0; } } lp(i, n) { int a, b; cin >> a >> b; h[a][b] = 1; ...
#include <bits/stdc++.h> using namespace std; #define lp(i, n) for (int i = 0; i < n; i++) int main() { while (1) { int n; cin >> n; if (n == 0) break; int h[21][21]; lp(i, 21) { lp(j, 21) { h[i][j] = 0; } } lp(i, n) { int a, b; cin >> a >> b; h[a][b] = 1; ...
[["-", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68]]
1
391
2
#include <bits/stdc++.h> using namespace std; int main() { int n, m, t; char o; while (1) { int a[30][30] = {}, x, y, gx = 10, gy = 10, count = 0; cin >> n; if (n == 0) break; for (int i = 0; i < n; i++) { cin >> x >> y; a[y][x] = 1; } cin >> m; for (int i = 0; i <...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, t; char o; while (1) { int a[30][30] = {}, x, y, gx = 10, gy = 10, count = 0; cin >> n; if (n == 0) break; for (int i = 0; i < n; i++) { cin >> x >> y; a[y][x] = 1; } cin >> m; for (int i = 0; i <...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
359
4
#include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; int main(void) { vector<string> r; while (true) { int gem = 0, gemgot = 0; int map[21][21] = {{0}}; cin >> gem; if (gem == 0) { break; } for (int i = 0; i < gem; i++) { int x = 0, y =...
#include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; int main(void) { vector<string> r; while (true) { int gem = 0, gemgot = 0; int map[21][21] = {{0}}; cin >> gem; if (gem == 0) { break; } for (int i = 0; i < gem; i++) { int x = 0, y =...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
364
4
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory.h> #include <memory> #include <numeric> #include <queue> #include <set> #include <s...
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <memory.h> #include <memory> #include <numeric> #include <queue> #include <set> #include <s...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
477
4
#include <iostream> using namespace std; int main() { while (true) { int n; cin >> n; if (n == 0) { break; } bool gemsOnField[21][21] = {}; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; gemsOnField[y][x] = true; } int cx = 10, cy = 10, m; cin >> m;...
#include <iostream> using namespace std; int main() { while (true) { int n; cin >> n; if (n == 0) { break; } bool gemsOnField[21][21] = {}; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; gemsOnField[y][x] = true; } int cx = 10, cy = 10, m; cin >> m;...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
353
4
#include <algorithm> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; int main() { int n, m; int f[21][21]; char news; int d; int x, y; int flag; while (cin >> n && n) { for (int i = 1; i < 21; ++i) { for (int j = 1; j < 21; ++j) { ...
#include <algorithm> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; int main() { int n, m; int f[21][21]; char news; int d; int x, y; int flag; while (cin >> n && n) { for (int i = 0; i < 21; ++i) { for (int j = 0; j < 21; ++j) { ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
391
8
#include <algorithm> #include <bitset> #include <iostream> #include <map> #include <queue> #include <stack> #include <vector> using namespace std; struct P { int x, y; }; vector<P> list; int input() { int N; cin >> N; if (N == 0) return false; for (int i = 0; i < N; i++) { int a, b; cin >> a >> ...
#include <algorithm> #include <bitset> #include <iostream> #include <map> #include <queue> #include <stack> #include <vector> using namespace std; struct P { int x, y; }; vector<P> list; int input() { int N; cin >> N; list.clear(); if (N == 0) return false; for (int i = 0; i < N; i++) { int a, b; ...
[["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
566
6
import java.io.*; import java.util.*; public class Main { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); public void run() { boolean[][] map = new boolean[1000][1000]; while (true) { int n = in.nextInt(); if (n == 0) break; for (in...
import java.io.*; import java.util.*; public class Main { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); public void run() { boolean[][] map = new boolean[1000][1000]; while (true) { int n = in.nextInt(); if (n == 0) break; for (in...
[["-", 0, 492, 3, 4, 0, 510, 64, 5, 0, 491], ["+", 0, 492, 3, 4, 0, 510, 64, 5, 0, 491], ["-", 0, 492, 3, 4, 0, 510, 75, 5, 0, 491], ["+", 0, 492, 3, 4, 0, 510, 75, 5, 0, 491]]
3
1,024
4
import java.util.Scanner; /** * Created by Reopard on 2014/05/06. */ public class Main { public static void main(String args[]) { char direction; int N, M, robot_x, robot_y, distance, count; int x[] = new int[20]; int y[] = new int[20]; String line; Scanner sc = new Scanner(System.in); ...
import java.util.Scanner; /** * Created by Reopard on 2014/05/06. */ public class Main { public static void main(String args[]) { char direction; int N, M, robot_x, robot_y, distance, count; int x[] = new int[20]; int y[] = new int[20]; String line; Scanner sc = new Scanner(System.in); ...
[["-", 64, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 64, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["-", 75, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 75, 1, 0, 492, 3, 4, 0, 5, 0, 491]]
3
338
4
#include <stdio.h> int main() { int n, m; int x, y, a, b; int board[21][21]; int i, j; char c; int f; while (scanf("%d", &n), n) { x = 10; y = 10; f = 0; for (i = 0; i < 21; i++) { for (j = 0; j < 21; j++) { board[i][j] = 0; } } for (i = 0; i < n; i++) { ...
#include <stdio.h> int main() { int n, m; int x, y, a, b; int board[21][21]; int i, j; char c; int f; while (scanf("%d", &n), n) { x = 10; y = 10; f = 0; for (i = 0; i < 21; i++) { for (j = 0; j < 21; j++) { board[i][j] = 0; } } for (i = 0; i < n; i++) { ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
340
2
#include <stdio.h> #include <string.h> #define N_MAX 20 #define M_MAX 30 struct MAPS { int y; int x; }; struct COMMAND { char direction; int step; }; int main(int argc, char **argv) { int N; int M; char map[20][20]; struct MAPS gem[N_MAX]; struct COMMAND command[M_MAX]; struct MAPS robot = {10, 1...
#include <stdio.h> #include <string.h> #define N_MAX 20 #define M_MAX 30 struct MAPS { int y; int x; }; struct COMMAND { char direction; int step; }; int main(int argc, char **argv) { int N; int M; char map[21][21]; struct MAPS gem[N_MAX]; struct COMMAND command[M_MAX]; struct MAPS robot = {10, 1...
[["-", 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]]
0
716
6
#include <stdio.h> int main() { int map[21][21]; int i, j; int A, M; int x, y; int in1, in2; char c[2], a; int dx, dy; int count; while (1) { scanf("%d", &A); if (A == 0) { break; } for (i = 0; i < 20; i++) { for (j = 0; j < 20; j++) { map[i][j] = 0; } } ...
#include <stdio.h> int main() { int map[21][21]; int i, j; int A, M; int x, y; int in1, in2; char c[2], a; int dx, dy; int count; while (1) { scanf("%d", &A); if (A == 0) { break; } for (i = 0; i < 21; i++) { for (j = 0; j < 21; j++) { map[i][j] = 0; } } ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
0
397
4
#include <stdio.h> #include <string.h> typedef struct { int x; int y; } dir; int map[21][21]; dir ds[4] = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}}; int d2n(char dir) { return dir == 'N' ? 0 : dir == 'W' ? 1 : dir == 'S' ? 2 : 3; } int main() { int x, y, n, gn, i, st, step, count, j; char dir, str[29], *s; st ...
#include <stdio.h> #include <string.h> typedef struct { int x; int y; } dir; int map[21][21]; dir ds[4] = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}}; int d2n(char dir) { return dir == 'N' ? 0 : dir == 'W' ? 1 : dir == 'S' ? 2 : 3; } int main() { int x, y, n, gn, i, st, step, count, j; char dir, str[29], *s; st ...
[["-", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 64, 5, 0, 6], ["-", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 75, 5, 0, 6]]
0
406
4