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 total; int book[9]; int sum; int i; while (1) { scanf("%d", &total); if (total == 0) { break; } sum = 0; for (i = 0; i < 9; i++) { scanf("%d", &book[i]); sum += book[i]; } } printf("%d\n", total - sum); return (0); }
#include <stdio.h> int main(void) { int total; int book[9]; int sum; int i; while (1) { scanf("%d", &total); if (total == 0) { break; } sum = 0; for (i = 0; i < 9; i++) { scanf("%d", &book[i]); sum += book[i]; } printf("%d\n", total - sum); } return (0); }
[["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
0
106
2
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define mem(x, y) (x *)malloc(sizeof(x) * (y)) #define PI 3.14159265358979 int main() { int sum; while (scanf("%d", &sum), sum) ; { int i; for (i = 0; i < 9; i++) { int price; scanf("%d", &price); sum -= pr...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define mem(x, y) (x *)malloc(sizeof(x) * (y)) #define PI 3.14159265358979 int main() { int sum; while (scanf("%d", &sum), sum) { int i; for (i = 0; i < 9; i++) { int price; scanf("%d", &price); sum -= price; ...
[["-", 0, 14, 8, 9, 0, 52, 8, 1, 0, 35]]
0
93
1
#include <stdio.h> main() { int value, data, i; while (1) { scanf("%d", &value); if (!value) break; for (i = 0; i < 9; i++) { scanf("%d", data); value -= data; } printf("%d\n", value); } return 0; }
#include <stdio.h> main() { int value, data, i; while (1) { scanf("%d", &value); if (!value) break; for (i = 0; i < 9; i++) { scanf("%d", &data); value -= data; } printf("%d\n", value); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
0
79
1
s, i; main(x) { for (; scanf("%d", &x) * x; ++i % 10 && printf("%d\n", s)) s = i % 10 ? s - x : x; } //////////
s, i; main(x) { for (; scanf("%d", &x) * x; ++i % 10 || printf("%d\n", s)) s = i % 10 ? s - x : x; } //////////
[["-", 0, 14, 8, 9, 0, 7, 26, 16, 17, 98], ["+", 0, 14, 8, 9, 0, 7, 26, 16, 17, 106]]
0
53
2
#include <stdio.h> int main(void) { int a, s; int i, n, x; while (1) { scanf("%d", &a); if (n == 0) { break; } s = 0; for (i = 0; i < 9; i++) { scanf("%d", &x); s += a; } x = n - s; printf("%d\n", x); } return 0; }
#include <stdio.h> int main(void) { int a, s; int i, n, x; while (1) { scanf("%d", &n); if (n == 0) { break; } s = 0; for (i = 0; i < 9; i++) { scanf("%d", &a); s += a; } x = n - s; printf("%d\n", x); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22]]
1
99
4
#include <iostream> using namespace std; int main() { for (int i = 0; i < 5; i++) { int B[10]; for (int i = 0; i < 10; i++) { cin >> B[i]; if (B[i] == 0) { return 0; //プログラムの強制終了 } } int sum = 0; for (int i = 1; i < 9; i++) { sum += B[i]; } cout << B[0] ...
#include <iostream> using namespace std; int main() { for (int i = 0; i < 5; i++) { int B[10]; for (int i = 0; i < 10; i++) { cin >> B[i]; if (B[i] == 0) { return 0; //プログラムの強制終了 } } int sum = 0; for (int i = 1; i < 10; i++) { sum += B[i]; } cout << B[0]...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
114
2
#include <stdio.h> int main(void) { int N, i, k; while (0) { scanf("%d", &N); if (N == 0) break; for (i = 0; i < 9; i++) { scanf("%d", &k); N -= k; } printf("%d\n", N); } return 0; }
#include <stdio.h> int main(void) { int N, i, k; while (0 == 0) { scanf("%d", &N); if (N == 0) break; for (i = 0; i < 9; i++) { scanf("%d", &k); N -= k; } printf("%d\n", N); } return 0; }
[["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
82
2
#include <iostream> using namespace std; int main() { int n, m, i; while (cin >> n, n) for (i = 0; i < 9; i++) { cin >> m; n -= m; } cout << n << endl; }
#include <iostream> using namespace std; int main() { int n, m, i; while (cin >> n, n) { for (i = 0; i < 9; i++) { cin >> m; n -= m; } cout << n << endl; } }
[["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
56
2
#include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> //#include <windows.h> #include <algorithm> #include <functional> #include <iostream> #include <queue> #include <set> using namespace std; typedef unsigned int uint; typedef long long int llint; typedef ...
#include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> //#include <windows.h> #include <algorithm> #include <functional> #include <iostream> #include <queue> #include <set> using namespace std; typedef unsigned int uint; typedef long long int llint; typedef ...
[["+", 8, 9, 0, 52, 8, 9, 0, 9, 0, 46], ["-", 8, 9, 0, 52, 8, 9, 0, 9, 0, 46]]
1
1,848
2
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { for (int i = 0; i < 9; i++) { int inp; cin >> inp; n -= inp; } cout << n << endl; } }
#include <iostream> using namespace std; int main() { int n; while (cin >> n, n) { for (int i = 0; i < 9; i++) { int inp; cin >> inp; n -= inp; } cout << n << endl; } }
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 12, 22]]
1
56
2
#include <iostream> using namespace std; int main() { int total, books; while (true) { cin >> total; if (total == 0) break; } for (int i = 1; i <= 9; i++) { cin >> books; total -= books; cout << total << "\n"; } return 0; }
#include <iostream> using namespace std; int main() { int total, books; while (true) { cin >> total; if (total == 0) { break; } for (int i = 1; i <= 9; i++) { cin >> books; total -= books; } cout << total << "\n"; } return 0; }
[["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46]]
1
70
2
#include <iostream> using namespace std; int a, b; int main() { while (true) { cin >> a; if (a == 0) break; for (int i = 0; i < 9; i++) { cin >> b; a -= b; } cout << b << endl; } return 0; }
#include <iostream> using namespace std; int a, b; int main() { while (true) { cin >> a; if (a == 0) break; for (int i = 0; i < 9; i++) { cin >> b; a -= b; } cout << a << endl; } return 0; }
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
68
2
#include <bits/stdc++.h> using namespace std; int main() { int s, a; while (cin >> s) { if (s == 0) break; cin >> s; for (int i = 0; i < 9; i++) { cin >> a; s -= a; } cout << s << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int s, a; while (cin >> s) { if (s == 0) break; for (int i = 0; i < 9; i++) { cin >> a; s -= a; } cout << s << endl; } }
[["-", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
67
4
#include <iostream> using namespace std; int main() { int x, y, i; while (cin >> x) { for (int i = 0; i < 9; i++) { cin >> y; x -= y; } cout << x << endl; } }
#include <iostream> using namespace std; int main() { int x, y; while (cin >> x, x) { for (int i = 0; i < 9; i++) { cin >> y; x -= y; } cout << x << endl; } }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 52, 15, 339, 51, 34, 31, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21]]
1
57
4
#include <bits/stdc++.h> using namespace std; int main() { int h, e; while (1) { cin >> h; if (h == 0) break; for (int i = 0; i < 9; i++) { cin >> e; h -= e; } cout << e << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int h, e; while (1) { cin >> h; if (h == 0) break; for (int i = 0; i < 9; i++) { cin >> e; h -= e; } cout << h << endl; } return 0; }
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
68
2
#include <cstdio> int main() { int a, b, i; for (i = 0; b = 0, scanf("%d", i % 10 ? &b : &a), a; ++i, printf("%d\n", a)) a -= b; }
#include <cstdio> int main() { int a, b, i; for (i = 0; b = 0, scanf("%d", i % 10 ? &b : &a), a; ++i, printf(i % 10 ? "" : "%d\n", a)) a -= b; }
[["+", 12, 2, 3, 4, 0, 41, 15, 16, 31, 22], ["+", 12, 2, 3, 4, 0, 41, 15, 16, 17, 109], ["+", 12, 2, 3, 4, 0, 41, 15, 16, 12, 13], ["+", 26, 34, 12, 2, 3, 4, 0, 41, 0, 101], ["+", 12, 2, 3, 4, 0, 41, 64, 5, 0, 62], ["+", 26, 34, 12, 2, 3, 4, 0, 41, 0, 102], ["+", 12, 2, 3, 4, 0, 41, 75, 5, 0, 62]]
1
61
7
#include <bits/stdc++.h> using namespace std; int n, m, f[100][100] = {0}, ff[100][100] = {0}, ans = 0; void s(int x, int y, int depth); int main() { while (1) { cin >> n >> m; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> f[i][j]; ...
#include <bits/stdc++.h> using namespace std; int n, m, f[100][100] = {0}, ff[100][100] = {0}, ans = 0; void s(int x, int y, int depth); int main() { while (1) { ans = 0; cin >> n >> m; if (n == 0 && m == 0) break; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> ...
[["+", 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
481
4
#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, 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
351
4
#include <algorithm> #include <iostream> using namespace std; int mp[91][91]; int W, H; int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; int dfs(int x, int y, int d) { int cnt = d; for (int i = 0; i < 4; i++) { int mx = x + dx[i]; int my = y + dy[i]; if (my >= 0 && mx >= 0 && my < H && mx < W...
#include <algorithm> #include <iostream> using namespace std; int mp[91][91]; int W, H; int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; int dfs(int x, int y, int d) { int cnt = d; for (int i = 0; i < 4; i++) { int mx = x + dx[i]; int my = y + dy[i]; if (my >= 0 && mx >= 0 && my < H && mx < W...
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 17, 106], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 12, 22]]
1
330
4
#include <iostream> #include <vector> using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; int m, n; VVI S; const int dx[4] = {0, 0, 1, -1}; const int dy[4] = {1, -1, 0, 0}; int answer = 0, now = 0; int search(int x, int y) { now++; answer = max(answer, now); S[y][x] = 0; for (int i = 0; i < ...
#include <iostream> #include <vector> using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; int m, n; VVI S; const int dx[4] = {0, 0, 1, -1}; const int dy[4] = {1, -1, 0, 0}; int answer = 0, now = 0; int search(int x, int y) { now++; answer = max(answer, now); S[y][x] = 0; for (int i = 0; i < ...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
314
6
#include <cstdio> #include <iostream> using namespace std; #define reps(i, f, n) for (int i = f; i < int(n); i++) #define rep(i, n) reps(i, 0, n) int h, w; int cell[128][128]; int ans; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; int check(int x, int y) { if (x < 0 || y < 0 || y >= h || x >= w) return ...
#include <cstdio> #include <iostream> using namespace std; #define reps(i, f, n) for (int i = f; i < int(n); i++) #define rep(i, n) reps(i, 0, n) int h, w; int cell[128][128]; int ans; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; int check(int x, int y) { if (x < 0 || y < 0 || y >= h || x >= w) return ...
[["+", 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
364
4
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long LL; typed...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long LL; typed...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22]]
1
391
6
#include <algorithm> #include <iostream> using namespace std; int n, m; bool map[90][90]; int backtrack(int h, int w) { int res = 1, tmp = 1; map[h][w] = false; if (h > 0 && map[h - 1][w]) tmp = backtrack(h - 1, w) + 1; res = max(res, tmp); if (h < n - 1 && map[h + 1][w]) res = backtrack(h + 1, w) ...
#include <algorithm> #include <iostream> using namespace std; int n, m; bool map[90][90]; int backtrack(int h, int w) { int res = 1, tmp = 1; map[h][w] = false; if (h > 0 && map[h - 1][w]) tmp = backtrack(h - 1, w) + 1; res = max(res, tmp); if (h < n - 1 && map[h + 1][w]) tmp = backtrack(h + 1, w) ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22]]
1
360
6
#include <algorithm> #include <cstring> #include <iostream> using namespace std; int w, h, ans = 0; int mas[100][100]; int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; void dfs(int x, int y, int sum) { for (int i = 0; i < 4; i++) { int nx = x + dx[i]; int ny = y + dy[i]; if (nx >= 0 && nx < w && ny >= 0 ...
#include <algorithm> #include <cstring> #include <iostream> using namespace std; int w, h, ans = 0; int mas[100][100]; int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; void dfs(int x, int y, int sum) { for (int i = 0; i < 4; i++) { int nx = x + dx[i]; int ny = y + dy[i]; if (nx >= 0 && nx < w && ny >= 0 ...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
292
4
#include <iostream> using namespace std; void dfs(int, int, int); int cnt, big, mas[93][93], d[] = {0, 1, 0, -1}, h, w; int main() { while (cin >> w >> h && w || h) { for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> mas[i][j]; } } for (int i = 0; i < h; i++) { f...
#include <iostream> using namespace std; void dfs(int, int, int); int cnt, big, mas[93][93], d[] = {0, 1, 0, -1}, h, w; int main() { while (cin >> w >> h && w || h) { big = 0; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> mas[i][j]; } } for (int i = 0; i < h; 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
312
4
### subroutines def dist_rec(k) max_d = 1 for k0 in $nbrs[k] if ! $visited[k0] $visited[k0] = true max_d = [1 + dist_rec(k0), max_d].max $visited[k0] = false end end max_d end ### main loop do m = gets.strip.to_i n = gets.strip.to_i mn = m * n break if mn == 0 $brd = []...
## subroutines def dist_rec(k) max_d = 1 for k0 in $nbrs[k] if ! $visited[k0] $visited[k0] = true max_d = [1 + dist_rec(k0), max_d].max $visited[k0] = false end end max_d end ### main loop do m = gets.strip.to_i n = gets.strip.to_i mn = m * n break if mn == 0 $brd = [] ...
[["-", 0, 662, 12, 652, 486, 739, 0, 475, 444, 22], ["+", 0, 662, 12, 652, 486, 739, 0, 475, 444, 22], ["-", 0, 88, 51, 267, 0, 739, 0, 475, 444, 22], ["+", 0, 88, 51, 267, 0, 739, 0, 475, 444, 22]]
4
309
4
def s(): def b(M,x,y,n=1): M[x][y]=0;a=n if M[x-1][y]: t=b(M,x-1,y,n+1) if a<t:a=t if M[x][y-1]: t=b(M,x,y-1,n+1) if a<t:a=t if M[x+1][y]: t=b(M,x+1,y1,n+1) if a<t:a=t if M[x][y+1]: t=b(M,x,y+1,n+1) if a<t:a=t M[x][y]=1 return a for e in iter(input,'0'): n,m=int(e),int(input())...
def s(): def b(M,x,y,n=1): M[x][y]=0;a=n if M[x-1][y]: t=b(M,x-1,y,n+1) if a<t:a=t if M[x][y-1]: t=b(M,x,y-1,n+1) if a<t:a=t if M[x+1][y]: t=b(M,x+1,y,n+1) if a<t:a=t if M[x][y+1]: t=b(M,x,y+1,n+1) if a<t:a=t M[x][y]=1 return a for e in iter(input,'0'): n,m=int(e),int(input()) ...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
322
40
while 1: M = int(input()) N = int(input()) if M == N == 0: break S = [list(map(int, input().split())) for i in range(N)] used=[[0]*M for i in range(N)] def dfs(x, y, dd=((-1,0),(0,-1),(1,0),(0,1))): r = 0 for dx, dy in dd: nx = x + dx; ny = y + dy ...
while 1: M = int(input()) N = int(input()) if M == N == 0: break S = [list(map(int, input().split())) for i in range(N)] used=[[0]*M for i in range(N)] def dfs(x, y, dd=((-1,0),(0,-1),(1,0),(0,1))): r = 0 for dx, dy in dd: nx = x + dx; ny = y + dy ...
[["-", 3, 4, 0, 657, 31, 652, 3, 4, 0, 22], ["-", 3, 4, 0, 657, 31, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 22]]
5
258
4
#include <iostream> #include <vector> using namespace std; class range { private: struct Iterator { int val; int operator*() { return val; } bool operator!=(Iterator &itr) { return val < itr.val; } void operator++() { ++val; } }; Iterator i, n; public: range(int n) : i({0}), n({n}) {} range...
#include <iostream> #include <vector> using namespace std; class range { private: struct Iterator { int val; int operator*() { return val; } bool operator!=(Iterator &itr) { return val < itr.val; } void operator++() { ++val; } }; Iterator i, n; public: range(int n) : i({0}), n({n}) {} range...
[["-", 0, 338, 8, 9, 0, 1, 0, 27, 17, 68], ["-", 0, 338, 8, 9, 0, 1, 0, 27, 28, 22], ["-", 8, 9, 0, 338, 8, 9, 0, 1, 0, 35]]
1
719
3
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; pair<int, int> a[11000], b[11000]; int sm, l; int fi(int i, int p) { ...
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; pair<int, int> a[11000], b[11000]; int sm, l; int fi(int i, int p) { ...
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 12, 22]]
1
460
2
#include <algorithm> #include <iostream> #include <vector> using namespace std; main() { int n, m, p, q, r, x, y; vector<int>::iterator v, w, z; for (; cin >> n >> m >> p >> q >> r; cout << x << endl) { vector<int> t(1), u; for (t.push_back(r); m--; u.clear()) { cin >> x >> y; v = upper_bound...
#include <algorithm> #include <iostream> #include <vector> using namespace std; main() { int n, m, p, q, r, x, y; vector<int>::iterator v, w, z; for (; cin >> n >> m >> p >> q >> r; cout << x << endl) { vector<int> t(1), u; for (t.push_back(r); m--; u.clear()) { cin >> x >> y; v = upper_bound...
[["+", 31, 11, 12, 16, 31, 66, 28, 27, 17, 29], ["-", 8, 1, 0, 11, 12, 66, 28, 27, 17, 29]]
1
454
2
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using names...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using names...
[["-", 0, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 0, 9, 0, 1, 0, 2, 63, 118, 28, 22]]
1
1,346
2
#include <array> #include <stdio.h> #include <string.h> using namespace std; int n, m, s; array<array<array<int, 3001>, 2001>, 2> memo; int main() { for (;;) { scanf("%d %d %d", &n, &m, &s); if (n == 0) break; for (int i = 0; i <= n * n; ++i) { for (int j = 0; j <= m; ++j) { for (...
#include <array> #include <stdio.h> #include <string.h> using namespace std; int n, m, s; array<array<array<int, 3001>, 2001>, 2> memo; int main() { for (;;) { scanf("%d %d %d", &n, &m, &s); if (n == 0) break; for (int i = 0; i <= n * n; ++i) { for (int j = 0; j <= m; ++j) { for (...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 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, 132]]
1
288
4
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; int n, m, h, k; typedef pair<int, int> P; vector<P> ber; long long int x[1001], ax[1001]; long long int sc[1001], scn[1001]; long long int yk[100001...
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; int n, m, h, k; typedef pair<int, int> P; vector<P> ber; long long int x[1001], ax[1001]; long long int sc[1001], scn[1001]; long long int yk[100001...
[["+", 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], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
732
6
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; int n, m, h, k; typedef pair<int, int> P; vector<P> ber; long long int x[1001], ax[1001]; long long int sc[1001], scn[1001]; long long int yk[100001...
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <vector> using namespace std; int n, m, h, k; typedef pair<int, int> P; vector<P> ber; long long int x[1001], ax[1001]; long long int sc[1001], scn[1001]; long long int yk[100001...
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
1
752
1
#include "stdio.h" #include "stdlib.h" int s[1000]; typedef struct { int a; int b; int w1; int w2; } yoko; yoko w[100000]; int z[1000]; int ten[1000]; int sortw(const void *a, const void *b) { if (((yoko *)a)[0].a < ((yoko *)b)[0].a) { return -1; } else if (((yoko *)a)[0].a == ((yoko *)b)[0].a) { ...
#include "stdio.h" #include "stdlib.h" int s[1000]; typedef struct { int a; int b; int w1; int w2; } yoko; yoko w[100000]; int z[1000]; int ten[1000]; int sortw(const void *a, const void *b) { if (((yoko *)a)[0].a < ((yoko *)b)[0].a) { return -1; } else if (((yoko *)a)[0].a == ((yoko *)b)[0].a) { ...
[["-", 3, 4, 0, 66, 28, 23, 0, 118, 119, 120], ["+", 3, 4, 0, 66, 28, 23, 0, 118, 119, 120]]
1
678
4
import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { while (true) { int H = sc.nextInt(); int W = sc.nextInt(); int N = sc.nextInt(); if (N == 0) break; boolean[][] dir = new boolean[H][W]; ...
import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { while (true) { int H = sc.nextInt(); int W = sc.nextInt(); int N = sc.nextInt(); if (N == 0) break; boolean[][] dir = new boolean[H][W]; ...
[["-", 0, 7, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 17, 107]]
3
401
4
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Scanner; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStrea...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Scanner; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStrea...
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 17, 107]]
3
629
8
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < ((int)b); ++i) #define RFOR(i, a) for (int i = (a); i >= 0; --i) #define FOE(i, a) for (auto i : a) #define ALL(c) (c).begin(), (c).end() #define RALL(c) (c).rbegin(), (c).rend() #define DUMP(x) cerr << #x << " = " << (x) << endl; #define SUM(x) std::...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < ((int)b); ++i) #define RFOR(i, a) for (int i = (a); i >= 0; --i) #define FOE(i, a) for (auto i : a) #define ALL(c) (c).begin(), (c).end() #define RALL(c) (c).rbegin(), (c).rend() #define DUMP(x) cerr << #x << " = " << (x) << endl; #define SUM(x) std::...
[["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6]]
1
1,035
1
#include <algorithm> #include <cstdio> #include <cstring> using namespace std; int d[1024][1024]; int dp[1024][1024]; int H, W, N; int main() { while (scanf("%d%d%d", &H, &W, &N) && H || W || N) { for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) scanf("%d", &d[i][j]); memset(dp, 0, siz...
#include <algorithm> #include <cstdio> #include <cstring> using namespace std; int d[1024][1024]; int dp[1024][1024]; int H, W, N; int main() { while (scanf("%d%d%d", &H, &W, &N) && H || W || N) { for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) scanf("%d", &d[i][j]); memset(dp, 0, siz...
[["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
1
340
2
#include <cstdio> #include <cstring> #include <iostream> using namespace std; #define MAX_N 2000 long long x[MAX_N][MAX_N]; long long dp[MAX_N][MAX_N]; int h, w, n, cx, cy; int main() { while (true) { memset(dp, 0, sizeof(dp)); cin >> h >> w >> n; if (h == 0 && w == 0 && n == 0) { break; } ...
#include <cstdio> #include <cstring> #include <iostream> using namespace std; #define MAX_N 2000 long long x[MAX_N][MAX_N]; long long dp[MAX_N][MAX_N]; int h, w, n, cx, cy; int main() { while (true) { memset(dp, 0, sizeof(dp)); cin >> h >> w >> n; if (h == 0 && w == 0 && n == 0) { break; } ...
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, ...
1
427
9
#include <algorithm> #include <bits/stdc++.h> #include <queue> #include <vector> using namespace std; typedef long long ll; int h, w, n, c[1000][1000]; int dp[1001][1001]; int d[1000][1000]; int main() { while (scanf("%d%d%d", &h, &w, &n), h) { for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) ...
#include <algorithm> #include <bits/stdc++.h> #include <queue> #include <vector> using namespace std; typedef long long ll; int h, w, n, c[1000][1000]; int dp[1001][1001]; int d[1000][1000]; int main() { while (scanf("%d%d%d", &h, &w, &n), h) { for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) ...
[["+", 12, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
452
2
class in { struct It { int it; const bool rev; explicit constexpr It(int it_, bool rev = false) : it(it_), rev(rev) {} int operator*() { return it; } bool operator!=(It &r) { return it != r.it; } void operator++() { rev ? --it : ++it; } }; const It i, n; public: explicit constexpr in(in...
class in { struct It { int it; const bool rev; explicit constexpr It(int it_, bool rev = false) : it(it_), rev(rev) {} int operator*() { return it; } bool operator!=(It &r) { return it != r.it; } void operator++() { rev ? --it : ++it; } }; const It i, n; public: explicit constexpr in(in...
[["+", 12, 16, 31, 23, 0, 16, 12, 91, 17, 111], ["-", 12, 16, 31, 23, 0, 16, 12, 91, 17, 111]]
1
476
2
#include <bits/stdc++.h> using namespace std; #define int long long #define PB push_back #define ALL(V) V.begin(), V.end() typedef pair<int, int> pii; typedef pair<int, pii> pipii; typedef pair<pii, int> ppiii; constexpr int INF = 1LL << 60; constexpr int MOD = 1000000007; // constexpr int MAX_N = 1005; constexpr in...
#include <bits/stdc++.h> using namespace std; #define int long long #define PB push_back #define ALL(V) V.begin(), V.end() typedef pair<int, int> pii; typedef pair<int, pii> pipii; typedef pair<pii, int> ppiii; constexpr int INF = 1LL << 60; constexpr int MOD = 1000000007; // constexpr int MAX_N = 1005; constexpr in...
[["-", 0, 11, 12, 41, 15, 16, 12, 23, 0, 25], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
1
490
2
#include <cstdio> using namespace std; bool grid[1000][1000]; int num[1001][1001]; int h, w, n, tmp; int main() { while (scanf("%d %d %d", &h, &w, &n) && (h || w || n)) { for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) { scanf("%d", &tmp); grid[i][j] = (tmp) ? true : false; ...
#include <cstdio> using namespace std; bool grid[1000][1000]; int num[1001][1001]; int h, w, n, tmp; int main() { while (scanf("%d %d %d", &h, &w, &n) && (h || w || n)) { for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) { scanf("%d", &tmp); grid[i][j] = (tmp) ? true : false; ...
[["+", 0, 52, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 57, 64, 1, 0, 11, 12, 91, 17, 92], ["+", 0, 57, 64, 1, 0, 11, 12, 91, 17, 111], ["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46]]
1
338
55
#include <cstdio> #include <vector> int **getarray(int w, int h) { int **a = new int *[w]; for (int i = 0; i < w; i++) { a[i] = new int[h]; } return a; } int remarray(int **a, int w, int h) { for (int i = 0; i < w; i++) { delete[] a[i]; } delete[] a; } int main() { int h, w, n; int self; ...
#include <cstdio> #include <vector> int **getarray(int w, int h) { int **a = new int *[w]; for (int i = 0; i < w; i++) { a[i] = new int[h]; } return a; } int remarray(int **a, int w, int h) { for (int i = 0; i < w; i++) { delete[] a[i]; } delete[] a; } int main() { int h, w, n; int self; ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
1
627
4
#include <cstring> #include <iostream> using namespace std; int map[1002][1002]; long long int dp[1002][1002]; long long int x, y; int h, w; long int n; void root(int xx, int yy) { x = xx, y = yy; if (xx <= w && yy <= h) { if (map[xx][yy] == 1) { root(xx + 1, yy); } else { root(xx, yy + 1); ...
#include <cstring> #include <iostream> using namespace std; int map[1002][1002]; long long int dp[1002][1002]; long long int x, y; int h, w; long int n; void root(int xx, int yy) { x = xx, y = yy; if (xx <= w && yy <= h) { if (map[xx][yy] == 1) { root(xx + 1, yy); } else { root(xx, yy + 1); ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 107], ["-", 0, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 9, 0, 57, 64, 1, 0, 11, 17, 107]]
1
572
12
#include <stdio.h> int h, w, n; bool d[1000][1000]; int t[1000][1000]; int i, j; int main() { while (1) { scanf("%d %d %d", &h, &w, &n); if (h == 0) return 0; for (i = 0; i < h; i++) for (j = 0; j < w; j++) { int x; scanf("%d", &x); if (x == 1) d[i][j] = true...
#include <stdio.h> int h, w, n; bool d[1000][1000]; int t[1000][1000]; int i, j; int main() { while (1) { scanf("%d %d %d", &h, &w, &n); if (h == 0) return 0; for (i = 0; i < h; i++) for (j = 0; j < w; j++) { int x; scanf("%d", &x); if (x == 1) d[i][j] = true...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
1
473
4
#include <cstdio> #include <cstring> int h, w, n; int maps[1001][1001]; int home[1001][1001]; int main(void) { scanf("%d%d%d", &h, &w, &n); while (h != 0) { memset(maps, 0, sizeof(maps)); memset(home, 0, sizeof(home)); int i, j; for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { scan...
#include <cstdio> #include <cstring> int h, w, n; int maps[1001][1001]; int home[1001][1001]; int main(void) { scanf("%d%d%d", &h, &w, &n); while (h != 0) { memset(maps, 0, sizeof(maps)); memset(home, 0, sizeof(home)); int i, j; for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { scan...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 107]]
1
417
8
#include <algorithm> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using na...
#include <algorithm> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using na...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]]
1
498
4
while True: h, w, n = list(map(int, input().split())) if h == 0: break l = [list(map(int, input().split())) for i in range(h)] dp = [[0]*w for i in range(h)] dp[0][0] = n - 1 for i in range(h): for j in range(w): if i + 1 < h: dp[i+1][j] += (dp[i][j] + l[i][j] ^ 1) >> 1 ...
while True: h, w, n = list(map(int, input().split())) if h == 0: break l = [list(map(int, input().split())) for i in range(h)] dp = [[0]*w for i in range(h)] dp[0][0] = n - 1 for i in range(h): for j in range(w): if i + 1 < h: dp[i+1][j] += (dp[i][j] + (l[i][j] ^ 1)) >> 1 ...
[["+", 12, 657, 31, 23, 0, 657, 12, 23, 0, 24], ["+", 12, 657, 31, 23, 0, 657, 12, 23, 0, 25]]
5
228
2
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #incl...
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #incl...
[["+", 0, 43, 49, 80, 81, 16, 31, 16, 17, 48], ["+", 0, 43, 49, 80, 81, 16, 31, 16, 12, 13], ["+", 0, 52, 15, 339, 51, 34, 31, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21]]
1
1,441
4
#include <bits/stdc++.h> #define FOR(i, n) for (int i = 0; i < (int)(n); i++) #define FORR(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define pb push_back #define mp make_pair #define ALL(a) a.begin(), a.end() #define ZERO(a) memset(a, 0, sizeof(a)) #define MINUS(a) memset(a, -1, sizeof(a)) #define len(a) sizeo...
#include <bits/stdc++.h> #define FOR(i, n) for (int i = 0; i < (int)(n); i++) #define FORR(i, m, n) for (int i = (int)(m); i < (int)(n); i++) #define pb push_back #define mp make_pair #define ALL(a) a.begin(), a.end() #define ZERO(a) memset(a, 0, sizeof(a)) #define MINUS(a) memset(a, -1, sizeof(a)) #define len(a) sizeo...
[["-", 31, 69, 28, 69, 341, 342, 0, 69, 28, 22], ["+", 31, 69, 28, 69, 341, 342, 0, 69, 28, 22], ["-", 0, 11, 31, 69, 341, 342, 0, 69, 28, 22], ["+", 0, 11, 31, 69, 341, 342, 0, 69, 28, 22], ["-", 3, 4, 0, 16, 31, 16, 31, 69, 28, 22], ["+", 3, 4, 0, 16, 31, 16, 31, 69, 28, 22], ["-", 0, 2, 3, 4, 0, 16, 12, 69, 28, 22],...
1
860
8
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var Arr = (input.trim()).split("\n"); for (var I = 0; I < Arr.length; I++) { var Sum = Arr[I] - 0; if (Sum == 0) break; var sum = 0; for (var i = 0; i < 10; i++) sum += (Arr[I + i] - 0); console.log(Sum - sum); I += 10; }
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var Arr = (input.trim()).split("\n"); for (var I = 0; I < Arr.length; I++) { var Sum = Arr[I] - 0; if (Sum == 0) break; var sum = 0; for (var i = 0; i < 9; i++) sum += (Arr[I + i + 1] - 0); console.log(Sum - sum); I += 9; }
[["-", 8, 556, 0, 7, 15, 1, 0, 16, 12, 555], ["+", 8, 556, 0, 7, 15, 1, 0, 16, 12, 555], ["+", 12, 23, 0, 16, 31, 69, 71, 16, 17, 72], ["+", 12, 23, 0, 16, 31, 69, 71, 16, 12, 555], ["-", 0, 7, 8, 556, 0, 1, 0, 564, 12, 555], ["+", 0, 7, 8, 556, 0, 1, 0, 564, 12, 555]]
2
120
6
#include <bits/stdc++.h> #include <stdio.h> using namespace std; #define INF 1.1e9 #define LINF 1.1e18 #define FOR(i, a, b) for (long long i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() #define pb push_back #define fi first #define se second typedef long long ll; typedef p...
#include <bits/stdc++.h> #include <stdio.h> using namespace std; #define INF 1.1e9 #define LINF 1.1e18 #define FOR(i, a, b) for (long long i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() #define pb push_back #define fi first #define se second typedef long long ll; typedef p...
[["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
232
3
#include <iostream> using namespace std; int main() { int a, i, n, m, p[3000] = {0}; for (;;) { cin >> n >> m; if (n == 0 && m == 0) break; int w = 0, s = 0; for (i = 0; i < n; i++) cin >> p[i]; for (i = 0; i < m; i++) { cin >> a; w += a; if (p[w] != 0 && s == 0) ...
#include <iostream> using namespace std; int main() { int a, i, n, m, p[3000] = {0}; for (;;) { cin >> n >> m; if (n == 0 && m == 0) break; int w = 0, s = 0; for (i = 0; i < n; i++) cin >> p[i]; for (i = 0; i < m; i++) { cin >> a; w += a; if (p[w] != 0 && s == 0) ...
[["+", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]]
1
149
2
#include <stdio.h> int main() { int n[1006] = {0}, m[1006] = {0}; int k = 0, i, N, M; for (;;) { scanf("%d%d", &N, &M); if (M == 0 && M == 0) break; for (i = 0; i < N; i++) { scanf("%d", &n[i]); } for (i = 0; i < M; i++) { scanf("%d", &m[i]); } for (i = 0;; i++) { ...
#include <stdio.h> int main() { int n[1006] = {0}, m[1006] = {0}; int k = 0, i, N, M; for (;; k = 0) { scanf("%d%d", &N, &M); if (M == 0 && M == 0) break; for (i = 0; i < N; i++) { scanf("%d", &n[i]); } for (i = 0; i < M; i++) { scanf("%d", &m[i]); } for (i = 0;; i++)...
[["+", 0, 14, 8, 9, 0, 7, 26, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 7, 26, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 7, 26, 11, 12, 13]]
1
177
14
#include <iostream> #include <vector> using namespace std; int main() { while (true) { int N, M; cin >> N >> M; if (!N && !M) break; vector<int> v(N); int pos = 0; for (int i = 0; i < N; ++i) { cin >> v[i]; } vector<int> m(M); for (int i = 0; i < M; ++i) { cin ...
#include <iostream> #include <vector> using namespace std; int main() { while (true) { int N, M; cin >> N >> M; if (!N && !M) break; vector<int> v(N); int pos = 0; for (int i = 0; i < N; ++i) { cin >> v[i]; } vector<int> m(M); for (int i = 0; i < M; ++i) { cin ...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
183
4
#include <cstdio> int main() { int n, m, a, p, i, x; for (; scanf("%d%d", &n, &m), n | m; printf("%d\n", a)) { int a[2001] = {}, b[2001] = {}; for (x = p = i = 0; i < n; ++i) scanf("%d", a + i); for (i = 0; i < m; ++i) scanf("%d", b + i); for (; p < n - 1; p += a[p]) p += b[x++]; ...
#include <cstdio> int main() { int n, m, a, p, i, x; for (; scanf("%d%d", &n, &m), n | m; printf("%d\n", x)) { int a[2001] = {}, b[2001] = {}; for (x = p = i = 0; i < n; ++i) scanf("%d", a + i); for (i = 0; i < m; ++i) scanf("%d", b + i); for (; p < n - 1; p += a[p]) p += b[x++]; ...
[["-", 8, 9, 0, 7, 26, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 7, 26, 2, 3, 4, 0, 22]]
1
146
2
#include <iostream> using namespace std; int field[1000]; int main() { int n, m; while (cin >> n >> m) { if (!n && !m) break; for (int i = 0; i < n; i++) { cin >> field[i]; } int count = 1000000000; int pos = 0; int cnt = 0; for (int i = 0; i < m; i++) { cnt++; ...
#include <iostream> using namespace std; int field[1000]; int main() { int n, m; while (cin >> n >> m) { if (!n && !m) break; for (int i = 0; i < n; i++) { cin >> field[i]; } int count = 1000000000; int pos = 0; int cnt = 0; for (int i = 0; i < m; i++) { cnt++; ...
[["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 33], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 13]]
1
149
2
#include <iostream> using namespace std; #define MAX 1000 int main() { int n, m; int ms[MAX + 1]; while (true) { cin >> n >> m; if (!n && !m) break; for (int i = 0; i < n; i++) cin >> ms[i]; int go, t = 0, cnt = 0; bool flg = false; for (int i = 0; i < m; i++) { cin ...
#include <iostream> using namespace std; #define MAX 2000 int main() { int n, m; int ms[MAX + 1]; while (true) { cin >> n >> m; if (!n && !m) break; for (int i = 0; i < n; i++) cin >> ms[i]; int go, t = 0, cnt = 0; bool flg = false; for (int i = 0; i < m; i++) { cin ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
147
6
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #includ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 69, 28, 22]]
1
1,181
6
#include <iostream> using namespace std; int main() { int n, m; int fi[1001]; int dice[1001]; int s; int cnt = 1; while (1) { cin >> n >> m; if (n == 0 && m == 0) break; for (int i = 1; i <= n; i++) { cin >> fi[i]; } for (int i = 1; i <= m; i++) { cin >> dice[i]; ...
#include <iostream> using namespace std; int main() { int n, m; int fi[1001]; int dice[1001]; int s; int cnt = 1; while (1) { cin >> n >> m; if (n == 0 && m == 0) break; for (int i = 1; i <= n; i++) { cin >> fi[i]; } for (int i = 1; i <= m; i++) { cin >> dice[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
169
4
for e in iter(input,'0 0'): N,M=map(int,e.split()) k,p=1,0 S=[int(input()) for _ in[0]*N] for d in[int(input())for _ in[0]*M]: p+=d if N<p+d else d+S[p+d] if N<=p+1:break k+=1 print(k)
for e in iter(input,'0 0'): N,M=map(int,e.split()) k,p=1,0 S=[int(input()) for _ in[0]*N] for d in[int(input())for _ in[0]*M]: p+=d if N<=p+d else d+S[p+d] if N<=p+1:break k+=1 print(k)
[["-", 0, 1, 0, 677, 12, 41, 0, 666, 667, 18], ["+", 0, 1, 0, 677, 12, 41, 0, 666, 667, 19]]
5
104
2
import sys r=sys.stdin.readline for e in iter(r,'0 0\n'): N,M=map(int,e.split()) k,p=1,0 S=[int(r()) for _ in[0]*N] for d in[int(r())for _ in[0]*M]: p+=d; if N<=p:p+=S[p] if N<=p+1:break k+=1 print(k)
import sys r=sys.stdin.readline for e in iter(r,'0 0\n'): N,M=map(int,e.split()) k,p=1,0 S=[int(r()) for _ in[0]*N] for d in[int(r())for _ in[0]*M]: p+=d; if p<N:p+=S[p] if N<=p+1:break k+=1 print(k)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
111
4
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n; while ((n = in.nextInt()) > 0) { boolean[][] map = new boolean[n][n]; int m = in.nextInt(); for (int i = 0; i < m; i++) { int a = in.nextInt() - 1;...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n; while ((n = in.nextInt()) > 0) { boolean[][] map = new boolean[n][n]; int m = in.nextInt(); for (int i = 0; i < m; i++) { int a = in.nextInt() - 1;...
[["-", 64, 196, 0, 7, 502, 503, 49, 200, 51, 22], ["+", 64, 196, 0, 7, 502, 503, 49, 200, 51, 499]]
3
248
2
#include <stdio.h> #include <string.h> char kan[501][501], gou[501]; int main(void) { int n, m, i, j, sas, a, b; while (1) { scanf("%d%d", &n, &m); if (!n && !m) break; memset(kan, 0, sizeof(kan)); memset(gou, 0, sizeof(gou)); for (i = 0; i < m; i++) { scanf("%d%d", &a, &b); k...
#include <stdio.h> #include <string.h> char kan[501][501], gou[501]; int main(void) { int n, m, i, j, sas, a, b; while (1) { scanf("%d%d", &n, &m); if (!n && !m) break; memset(kan, 0, sizeof(kan)); memset(gou, 0, sizeof(gou)); for (i = 0; i < m; i++) { scanf("%d%d", &a, &b); k...
[["-", 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]]
0
253
4
#include <stdio.h> int main() { int data[501][501]; int n, m; int a, b; int i, j, count; int f[501]; while (1) { count = 0; for (i = 0; i < 501; i++) { for (j = 0; j < 501; j++) { data[i][j] = 0; f[j] = 0; } } scanf("%d %d", &n, &m); if (n == 0 && m == 0) ...
#include <stdio.h> int main() { int data[501][501]; int n, m; int a, b; int i, j, count; int f[501]; while (1) { count = 0; for (i = 0; i < 501; i++) { for (j = 0; j < 501; j++) { data[i][j] = 0; f[j] = 0; } } scanf("%d %d", &n, &m); if (n == 0 && m == 0) ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
0
285
2
#include <stdio.h> #include <string.h> int friend[502][502], ans[502]; void dfs(int x, int y) { if (y < 0) return; int i; ans[x] = 1; for (i = 1; i < 501; i++) { if (friend[x][i]) { dfs(i, y - 1); } } } int main() { while (1) { int n, m, res = 0, i, j; scanf("%d%d", &n, &m); ...
#include <stdio.h> #include <string.h> int friend[502][502], ans[502]; void dfs(int x, int y) { if (y < 0) return; int i; ans[x] = 1; for (i = 1; i < 501; i++) { if (friend[x][i]) { dfs(i, y - 1); } } } int main() { while (1) { int n, m, res = 0, i, j; scanf("%d%d", &n, &m); ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22]]
0
250
4
#include <stdio.h> #include <string.h> int main(void) { int flag[500]; int list[2][10000]; int i, j; int n, m; int count; while (1) { scanf("%d %d", &n, &m); if (!n && !m) { break; } memset(flag, 0, sizeof(flag)); for (i = 0; i < m; i++) { scanf("%d %d", &list[0][i], &li...
#include <stdio.h> #include <string.h> int main(void) { int flag[501]; int list[2][10000]; int i, j; int n, m; int count; while (1) { scanf("%d %d", &n, &m); if (!n && !m) { break; } memset(flag, 0, sizeof(flag)); for (i = 0; i < m; i++) { scanf("%d %d", &list[0][i], &li...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
0
287
6
#include <stdio.h> #include <string.h> int main(void) { int b[512]; int friends[512][512]; int i, j; int n, m; int from, to; int ans; while (1) { memset(b, 0, sizeof(b)); memset(friends, 0, sizeof(friends)); scanf("%d %d", &n, &m); if (n == 0) break; for (i = 0; i < m; i++) {...
#include <stdio.h> #include <string.h> int main(void) { int b[512]; int friends[512][512]; int i, j; int n, m; int from, to; int ans; while (1) { memset(b, 0, sizeof(b)); memset(friends, 0, sizeof(friends)); scanf("%d %d", &n, &m); if (n == 0) break; for (i = 0; i < m; i++) {...
[["-", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 57, 64, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15...
0
254
10
#include <stdio.h> int main() { int a[501][501], c[501], h = 0; int i, i2, n, m, x, y; while (1) { for (i = 0; i < 501; i++) { for (i2 = 0; i2 < 501; i2++) { a[i][i2] = 0; } c[i] = 0; } scanf("%d %d", &n, &m); if (n == 0 && m == 0) break; for (i = 0; i < m; i++)...
#include <stdio.h> int main() { int a[501][501], c[501], h = 0; int i, i2, n, m, x, y; while (1) { for (i = 0; i < 501; i++) { for (i2 = 0; i2 < 501; i2++) { a[i][i2] = 0; } c[i] = 0; } h = 0; scanf("%d %d", &n, &m); if (n == 0 && m == 0) break; for (i = 0; ...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
288
4
#include <stdio.h> int main() { int list[2][10000]; int friend[500]; int friendoffriend[500]; int n, m, x, y, i, j, count; while (1) { scanf("%d", &n); scanf("%d", &m); if (n == 0 && m == 0) return 0; for (i = 0; i < 500; i++) { friend[i] = 0; friendoffriend[i] = 0; } ...
#include <stdio.h> int main() { int list[2][10000]; int friend[500]; int friendoffriend[500]; int n, m, i, j, count; while (1) { scanf("%d", &n); scanf("%d", &m); if (n == 0 && m == 0) return 0; for (i = 0; i < 500; i++) { friend[i] = 0; friendoffriend[i] = 0; } count...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22]]
0
353
6
#include <algorithm> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; int n, m; const int INF = 1 << 29; class edge { public: vector<int> E; }; ...
#include <algorithm> #include <cmath> #include <cstring> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; int n, m; const int INF = 1 << 29; class edge { public: vector<int> E; }; ...
[["+", 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], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131]]
1
275
6
#include <cstdio> #include <cstring> using namespace std; int main() { int list[20000][2]; bool f[20000]; bool ff[20000]; int n, m; while (scanf("%d %d", &n, &m), n + m) { memset(f, 0, sizeof(f)); memset(ff, 0, sizeof(ff)); for (int i = 0; i < m; i++) { scanf("%d %d", &list[i][0], &list[i...
#include <cstdio> #include <cstring> using namespace std; int main() { int list[20000][2]; bool f[20000]; bool ff[20000]; int n, m; while (scanf("%d %d", &n, &m), n + m) { memset(f, 0, sizeof(f)); memset(ff, 0, sizeof(ff)); for (int i = 0; i < m; i++) { scanf("%d %d", &list[i][0], &list[i...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 69, 28...
1
300
7
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main() { int n, m; while (scanf("%d%d", &n, &m), n != 0 && m != 0) { bool fr[501][501] = {false}; bool mem[501] = {false}; for (int i = 0; i < m; i++) { int m_a, m_b; scanf("%d%d", &m_a, &m_b); // f...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main() { int n, m; while (scanf("%d%d", &n, &m), n != 0 && m != 0) { bool fr[501][501] = {false}; bool mem[501] = {false}; for (int i = 0; i < m; i++) { int m_a, m_b; scanf("%d%d", &m_a, &m_b); // f...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
246
6
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; //// < "D:\D_Download\Visual Studio ///2015\Projects\programing_contest_c++\Debug\a.txt" > "D:...
#include "bits/stdc++.h" #include <unordered_map> #include <unordered_set> #pragma warning(disable : 4996) using namespace std; using ld = long double; template <class T> using Table = vector<vector<T>>; const ld eps = 1e-9; //// < "D:\D_Download\Visual Studio ///2015\Projects\programing_contest_c++\Debug\a.txt" > "D:...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22]]
1
257
2
#include <iostream> #include <vector> using namespace std; int main() { int n, m; while (cin >> n >> m, n, m) { int g[500][500] = {}; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; g[a - 1][b - 1] = 1; g[b - 1][a - 1] = 1; } bool fri[500]; for (int i = 0; i < 5...
#include <iostream> #include <vector> using namespace std; int main() { int n, m; while (cin >> n >> m, n, m) { int g[500][500] = {}; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; g[a - 1][b - 1] = 1; g[b - 1][a - 1] = 1; } bool fri[500]; for (int i = 0; i < 5...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
302
4
#include <cstdio> constexpr int MAX_N = 500; constexpr int MAX_M = 10000; int N, M; int e[MAX_N][MAX_N]; bool flag[MAX_N] = {false}; int dfs(int n = 0, int depth = 0) { if (depth == 2) { if (flag[n]) { return 0; } else { flag[n] = true; return 1; } } int res = 0; if (!flag[n]) ...
#include <cstdio> constexpr int MAX_N = 500; constexpr int MAX_M = 10000; int N, M; int e[MAX_N][MAX_N]; bool flag[MAX_N] = {false}; int dfs(int n = 0, int depth = 0) { if (depth == 2) { if (flag[n]) { return 0; } else { flag[n] = true; return 1; } } int res = 0; if (!flag[n]) ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
321
2
#include <cstdio> #include <deque> #include <iostream> #include <map> using namespace std; long long d[100000]; long long h[100000]; long long s[100000]; int main() { long long N, H, mx; cin >> N >> H; mx = H; for (int i = 0; i < N - 1; i++) { cin >> d[i] >> h[i]; s[i + 1] = s[i] + d[i]; } int ans...
#include <cstdio> #include <deque> #include <iostream> #include <map> using namespace std; long long d[100000]; long long h[100000]; long long s[100000]; int main() { long long N, H, mx; cin >> N >> H; mx = H; for (int i = 0; i < N - 1; i++) { cin >> d[i] >> h[i]; s[i + 1] = s[i] + d[i]; } int ans...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
445
28
#include <algorithm> #include <cstdio> #include <deque> #include <utility> using namespace std; int main() { long long int n, total_h, max_h, total_d = 0, ans = 0; scanf("%lld %lld", &n, &total_h); max_h = total_h; deque<pair<long long int, long long int>> Q; for (int i = 0; i < n - 1; i++) { long long in...
#include <algorithm> #include <cstdio> #include <deque> #include <utility> using namespace std; int main() { long long int n, total_h, max_h, total_d = 0, ans = 0; scanf("%lld %lld", &n, &total_h); max_h = total_h; deque<pair<long long int, long long int>> Q; for (int i = 0; i < n - 1; i++) { long long in...
[["-", 12, 16, 31, 118, 28, 2, 63, 118, 119, 120], ["+", 12, 16, 31, 118, 28, 2, 63, 118, 119, 120], ["-", 0, 52, 8, 1, 0, 2, 63, 118, 119, 120], ["+", 0, 52, 8, 1, 0, 2, 63, 118, 119, 120]]
1
321
4
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); Main app = new Main(); while (scan.hasNext()) { int second = app.input(scan); int minute = app.getMinute(second); System.out.println(minute); System.out.println(se...
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); Main app = new Main(); while (scan.hasNext()) { int second = app.input(scan); int minute = app.getMinute(second); System.out.println(minute); System.out.println(se...
[["-", 8, 196, 0, 52, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 52, 15, 15, 0, 16, 17, 20]]
3
167
2
import java.util.*; public class Main { public static void main(String[] args) { new Main().run(); } Scanner kbd = new Scanner(System.in); void run() { int sum = 0; int x = 0; int y = 0; while (kbd.hasNext()) { sum += kbd.nextInt(); } while (sum >= 60) { x++; sum -= 60...
import java.util.*; public class Main { public static void main(String[] args) { new Main().run(); } Scanner kbd = new Scanner(System.in); void run() { int sum = 0; int x = 0; int y = 0; while (kbd.hasNext()) { sum += kbd.nextInt(); } while (sum >= 60) { x++; sum -= 60...
[["-", 3, 4, 0, 16, 31, 16, 12, 5, 0, 491], ["+", 3, 4, 0, 16, 31, 16, 12, 5, 0, 44]]
3
117
2
#include <stdio.h> int main(void) { int time; int sum = 0; int i; for (i = 0; i < 4; i++) { scanf("%d", &time); sum += time; } printf("%d\n", time / 60); printf("%d\n", time % 60); return 0; }
#include <stdio.h> int main(void) { int time; int sum = 0; int i; for (i = 0; i < 4; i++) { scanf("%d", &time); sum += time; } printf("%d\n", sum / 60); printf("%d\n", sum % 60); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
0
76
4
#include <stdio.h> int main(void) { int a[4]; int i; for (i = 0; i < 4; i++) { scanf("%d", &a[i]); } printf("%d %d", (a[0] + a[1] + a[2] + a[3]) / 60, (a[0] + a[1] + a[2] + a[3]) % 60); return 0; }
#include <stdio.h> int main(void) { int a[4]; int i; for (i = 0; i < 4; i++) { scanf("%d", &a[i]); } printf("%d\n%d\n", (a[0] + a[1] + a[2] + a[3]) / 60, (a[0] + a[1] + a[2] + a[3]) % 60); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
104
5
#include <stdio.h> int main() { int i, t, s; s = 0; for (i = 0; i < 4; i++) { scanf("%d", &t); s = s + t; } printf("%d\n", s / 60); printf("%d\n", s % (s / 60)); return 0; }
#include <stdio.h> int main() { int i, t, s; s = 0; for (i = 0; i < 4; i++) { scanf("%d", &t); s = s + t; } printf("%d\n", s / 60); printf("%d\n", s % 60); return 0; }
[["-", 0, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 31, 22], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 17, 85], ["-", 0, 2, 3, 4, 0, 16, 12, 23, 0, 25]]
0
81
4
#include <stdio.h> int main(void) { int a, t, s = 0, j; for (t = 0; t < 4; t++) { scanf("%d", &a); s += a; } j = s; for (t = 0; t < 60; t++) { j = j - 60; if (j <= 0) { break; } } s -= t * 60; printf("%d\n%d\n", t, s); return 0; }
#include <stdio.h> int main(void) { int a, t, s = 0, j; for (t = 0; t < 4; t++) { scanf("%d", &a); s += a; } j = s; for (t = 0; t < 60; t++) { j = j - 60; if (j < 0) { break; } } s -= t * 60; printf("%d\n%d\n", t, s); return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18]]
0
107
2
#include <math.h> #include <stdio.h> int main(void) { int a, b, c, d, t; scanf("%d %d %d %d", &a, &b, &c, &d); a = a + b + c + d; for (t = 0; a > 60; t++) { a -= 60; } printf("%d\n%d\n", t, a); return 0; }
#include <math.h> #include <stdio.h> int main(void) { int a, b, c, d, t; scanf("%d %d %d %d", &a, &b, &c, &d); a = a + b + c + d; for (t = 0; a >= 60; t++) { a -= 60; } printf("%d\n%d\n", t, a); return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 20]]
0
87
2
a; main(b, c, d) { scanf("%d%d%d%d", &a, &b, &c, &d); a += b + c + d; a = !printf("%d\n%d\n", a % 60, a / 60); }
a; main(b, c, d) { scanf("%d%d%d%d", &a, &b, &c, &d); a += b + c + d; a = !printf("%d\n%d\n", a / 60, a % 60); }
[["-", 12, 91, 28, 2, 3, 4, 0, 16, 17, 109], ["+", 12, 91, 28, 2, 3, 4, 0, 16, 17, 85], ["-", 12, 91, 28, 2, 3, 4, 0, 16, 17, 85], ["+", 12, 91, 28, 2, 3, 4, 0, 16, 17, 109]]
0
61
4
#include <stdio.h> int main(void) { int a, b, c, d, e, f, g; scanf("%d%d%d%d", &a, &b, &c, &d); e = a + b + c + d; f = e / 60; g = e % 60; printf("%d %d\n", f, g); return 0; }
#include <stdio.h> int main(void) { int a, b, c, d, e, f, g; scanf("%d%d%d%d", &a, &b, &c, &d); e = a + b + c + d; f = e / 60; g = e % 60; printf("%d\n%d\n", f, g); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
80
4
#include <stdio.h> int main(void) { int a, s, d, f; scanf("%d %d %d %d", &a, &s, &d, &f); printf("%d %d\n", (d + s + d + f) / 60, (a + s + d + f) % 60); return 0; }
#include <stdio.h> int main(void) { int a, s, d, f; scanf("%d %d %d %d", &a, &s, &d, &f); printf("%d\n%d\n", (a + s + d + f) / 60, (a + s + d + f) % 60); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 31, 23, 0, 16, 31, 16, 31, 16, 31, 22], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 31, 22]]
0
72
6
#include <stdio.h> int main(void) { int a, b, c, d, x = 0, y; scanf("%d %d %d %d", &a, &b, &c, &d); y = a + b + c + d; while (y > 60) { y -= 60; x++; } printf("%d\n%d", x, y); return 0; }
#include <stdio.h> int main(void) { int a, b, c, d, x = 0, y; scanf("%d %d %d %d", &a, &b, &c, &d); y = a + b + c + d; while (y >= 60) { y -= 60; x++; } printf("%d\n%d\n", x, y); return 0; }
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 20], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
84
3
#include <stdio.h> int main(void) { int a = 0, b = 0, c = 0, d = 0, e = 0; int x = 0, y = 0; scanf("%d", &a); scanf("%d", &b); scanf("%d", &c); scanf("%d", &d); e = a + b + c + d; x = e / 60; y = e % 60; printf("%d%\n%d\n", x, y); return 0; }
#include <stdio.h> int main(void) { int a = 0, b = 0, c = 0, d = 0, e = 0; int x = 0, y = 0; scanf("%d", &a); scanf("%d", &b); scanf("%d", &c); scanf("%d", &d); e = a + b + c + d; x = e / 60; y = e % 60; printf("%d\n%d\n", x, y); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
118
2
#include <stdio.h> int main(void) { int f1, t1, sum = 0; for (f1 = 1; f1 <= 4; f1++) { scanf("%d", &t1); sum += t1; } printf("%d\n%d\n", t1 / 60, t1 % 60); return 0; }
#include <stdio.h> int main(void) { int f1, t1, sum = 0; for (f1 = 1; f1 <= 4; f1++) { scanf("%d", &t1); sum += t1; } printf("%d\n%d\n", sum / 60, sum % 60); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
0
68
4
#include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define reep(i, a, b) for (int i = (a); i < (b); ++i) #define...
#include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define reep(i, a, b) for (int i = (a); i < (b); ++i) #define...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
301
3
#include <iostream> using namespace std; main() { int a, count = 0; for (int i = 0; i < 4; i++) { cin >> a; count = count + a; } cout << count / 60 << count % 60; }
#include <iostream> using namespace std; main() { int a, count = 0; for (int i = 0; i < 4; i++) { cin >> a; count = count + a; } cout << count / 60 << endl << count % 60 << endl; }
[["+", 0, 1, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
54
4
#include <cstdio> using namespace std; int main(void) { int s, s1, s2, s3, i, j, x, y, a, b; scanf("%d", &s); scanf("%d", &s1); scanf("%d", &s2); scanf("%d", &s3); a = s + s1 + s2 + s3; if (a > 60) { x = a / 60; y = a % 60; printf("%d\n%d\n", x, y); } else { printf("%d\n", a); } retu...
#include <cstdio> using namespace std; int main(void) { int s, s1, s2, s3, i, j, x, y, a, b; scanf("%d", &s); scanf("%d", &s1); scanf("%d", &s2); scanf("%d", &s3); a = s + s1 + s2 + s3; if (a >= 60) { x = a / 60; y = a % 60; printf("%d\n%d\n", x, y); } else { printf("%d\n", a); } ret...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
134
2
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <string> using namespace std; int main() { int second[5] = {0}, ans[3]; cin >> second[1] >> second[2] >> second[3] >> second[4]; ans[2] = second[1] + second[2] + second[3] + second[4]; ans[1]...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <string> using namespace std; int main() { int second[5] = {0}, ans[3]; cin >> second[1] >> second[2] >> second[3] >> second[4]; ans[2] = second[1] + second[2] + second[3] + second[4]; ans[1]...
[["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 0, 11, 12, 16, 31, 69, 341, 342, 0, 13]]
1
126
2
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main() { int n, ansm = 0, anss = 0; for (int i = 0; i < 4; ++i) { cin >> n; anss += n; if (anss > 60) { ansm += anss / 60; anss %= 60; } } cout << ansm << "\n" << anss << endl; return 0; }
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int main() { int n, ansm = 0, anss = 0; for (int i = 0; i < 4; ++i) { cin >> n; anss += n; if (anss > 59) { ansm += anss / 60; anss %= 60; } } cout << ansm << "\n" << anss << endl; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
84
2
#include <bits/stdc++.h> using namespace std; int a, b, c, d; int main() { cin >> a >> b >> c >> d; int z = a + b + c + d; cout << z / 60 << z % 60 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int a, b, c, d; int main() { cin >> a >> b >> c >> d; int z = a + b + c + d; cout << z / 60 << endl << z % 60 << endl; return 0; }
[["+", 0, 1, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]]
1
57
2