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
// Name: Maximum Sum Sequence II // Level: 2 // Category: データ構造,累積和 // Note: /** * 行列要素の累積和を求めておけば、任意の矩形に対して和をO(1)で計算できる。 * * オーダーは O(N^4)。 */ #include <iostream> #include <vector> using namespace std; bool solve() { int N; if (!(cin >> N)) return false; if (!N) return false; vector<vector<long ...
// Name: Maximum Sum Sequence II // Level: 2 // Category: データ構造,累積和 // Note: /** * 行列要素の累積和を求めておけば、任意の矩形に対して和をO(1)で計算できる。 * * オーダーは O(N^4)。 */ #include <iostream> #include <vector> using namespace std; bool solve() { int N; if (!(cin >> N)) return false; if (!N) return false; vector<vector<long ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22]]
1
422
4
// Name: Maximum Sum Sequence II // Level: 2 // Category: データ構造,累積和 // Note: /** * 行列要素の累積和を求めておけば、任意の矩形に対して和をO(1)で計算できる。 * * オーダーは O(N^4)。 */ #include <iostream> #include <vector> using namespace std; template <typename T> struct Accumulate2D { vector<vector<T>> v; Accumulate2D(int R, int C) { v.resize(R, ...
// Name: Maximum Sum Sequence II // Level: 2 // Category: データ構造,累積和 // Note: /** * 行列要素の累積和を求めておけば、任意の矩形に対して和をO(1)で計算できる。 * * オーダーは O(N^4)。 */ #include <iostream> #include <vector> using namespace std; template <typename T> struct Accumulate2D { vector<vector<T>> v; Accumulate2D(int R, int C) { v.resize(R, ...
[["-", 0, 122, 8, 123, 0, 14, 49, 352, 0, 98], ["-", 8, 9, 0, 37, 0, 2, 63, 343, 345, 348], ["-", 8, 9, 0, 37, 0, 2, 63, 343, 0, 349], ["-", 8, 9, 0, 37, 0, 2, 63, 343, 141, 22], ["-", 8, 9, 0, 37, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 37, 0, 2, 3, 4, 0, 25]]
1
588
6
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<vector<int>> V(n + 1, vector<int>(n + 1, 0)); for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) cin >> V[i][j]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - 1; j++) { V[i][j...
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<vector<int>> V(n + 1, vector<int>(n + 1, 0)); for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) cin >> V[i][j]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - 1; j++) { V[i][j...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
349
4
#include <iostream> #include <string> #include <vector> using namespace std; int mat[110][110]; long long sum[110][110]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= n; ++j) { cin >> mat[i][j]; } } for (int i = 0; i <= n; ++i) { for (int j = 0; j <= n; ...
#include <iostream> #include <string> #include <vector> using namespace std; int mat[110][110]; long long sum[110][110]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= n; ++j) { cin >> mat[i][j]; } } for (int i = 0; i <= n; ++i) { for (int j = 0; j <= n; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22]]
1
321
6
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<vector<int>> mat(n + 1, vector<int>(n + 1, 0)); for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) { int k; cin >> k; mat[i][j] = k + mat[i - 1][j] + mat[i][j - 1] -...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<vector<int>> mat(n + 1, vector<int>(n + 1, 0)); for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) { int k; cin >> k; mat[i][j] = k + mat[i - 1][j] + mat[i][j - 1] -...
[["+", 8, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 7, 10, 43, 49, 50, 51, 16, 17, 72]]
1
244
4
#include <algorithm> #include <cstdio> #include <vector> using namespace std; int main() { int n; int imos[101][101]; fill_n(*imos, 101 * 101, 0); scanf("%d", &n); for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { int val; scanf("%d", &val); imos[i][j] = imos[i - 1][j] + imos...
#include <algorithm> #include <cstdio> #include <vector> using namespace std; int main() { int n; int imos[101][101]; fill_n(*imos, 101 * 101, 0); scanf("%d", &n); for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { int val; scanf("%d", &val); imos[i][j] = imos[i - 1][j] + imos...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
263
4
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<vector<int>> data(N + 1, vector<int>(N + 1)); for (size_t i = 1; i < N + 1; i++) { for (size_t j = 1; j < N + 1; j++) { cin >> data[i][j]; } } for (size_t i = 1; i < N + 1; i++) { for (size_t j = 1; j < N ...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<vector<int>> data(N + 1, vector<int>(N + 1)); for (size_t i = 1; i < N + 1; i++) { for (size_t j = 1; j < N + 1; j++) { cin >> data[i][j]; } } for (size_t i = 1; i < N + 1; i++) { for (size_t j = 1; j < N ...
[["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72]]
1
327
4
#include <bits/stdc++.h> #define PB push_back #define MP make_pair #define REP(i, n) for (int i = 0; i < (n); i++) #define ALL(a) (a).begin(), (a).end() #define INF 1000000001 #define MOD 10000 using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; const ull B = 100000007; ...
#include <bits/stdc++.h> #define PB push_back #define MP make_pair #define REP(i, n) for (int i = 0; i < (n); i++) #define ALL(a) (a).begin(), (a).end() #define INF 1000000001 #define MOD 10000 using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; const ull B = 100000007; ...
[["-", 12, 69, 28, 69, 341, 342, 0, 16, 31, 22], ["+", 12, 69, 28, 69, 341, 342, 0, 16, 31, 22], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 31, 22], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 31, 22]]
1
364
4
#include <iostream> using namespace std; int S[110][110] = {0}, a[110][110]; int main() { int n, max = -50000, t; cin >> n; for (int i = 0; i <= n; i++) { S[0][i] = 0; S[i][0] = 0; } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> a[i][j]; S[i + 1][j + 1] = S[i][j ...
#include <iostream> using namespace std; int S[110][110] = {0}, a[110][110]; int main() { int n, max = -50000, t; cin >> n; for (int i = 0; i <= n; i++) { S[0][i] = 0; S[i][0] = 0; } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> a[i][j]; S[i + 1][j + 1] = S[i][j ...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
286
2
#include <iostream> using namespace std; int main() { int n, s; int m[100][100]; cin >> n; int a = -10001; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { cin >> m[i][j]; a = max(a, m[i][j]); } } for (int i = 0; i < n; ++i) { int p[100] = {0}; for (int j = i; j < ...
#include <iostream> using namespace std; int main() { int n, s; int m[100][100]; cin >> n; int a = -10001; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { cin >> m[i][j]; a = max(a, m[i][j]); } } for (int i = 0; i < n; ++i) { int p[100] = {0}; for (int j = i; 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
200
5
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll b[100][100]; ll sum[110][110]; ll S(int x1, int y1, int x2, int y2) { return sum[y2 + 1][x2 + 1] - sum[y2 + 1][x1] - sum[y1][x2 + 1] + sum[y1][x1]; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; for (int i ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll b[100][100]; ll sum[110][110]; ll S(int x1, int y1, int x2, int y2) { return sum[y2 + 1][x2 + 1] - sum[y2 + 1][x1] - sum[y1][x2 + 1] + sum[y1][x1]; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; for (int i ...
[["-", 12, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["-", 12, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
361
4
#include <stdio.h> int main(void) { int i, j, k, l; int h, w; char map[1000][1000]; int n; int max, min; while (1) { scanf(" %d ", &n); if (!n) break; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { scanf(" %c ", &map[i][j]); } } max = 0; for (i = 0;...
#include <stdio.h> int main(void) { int i, j, k, l; int h, w; char map[1000][1000]; int n; int max, min; while (1) { scanf(" %d ", &n); if (!n) break; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { scanf(" %c ", &map[i][j]); } } max = 0; for (i = 0;...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
295
2
#include <stdio.h> int min(int a, int b, int c) { int min = a; if (min > b) min = b; if (min > c) min = c; return min; } int main(void) { char masu[1000][1000]; int space[1000][1000]; int n; int max; int i, j; while (1) { scanf("%d", &n); if (n == 0) break; for (i = 0; i...
#include <stdio.h> int min(int a, int b, int c) { int min = a; if (min > b) min = b; if (min > c) min = c; return min; } int main(void) { char masu[1000][1000]; int space[1000][1000]; int n; int max; int i, j; while (1) { scanf("%d", &n); if (n == 0) break; for (i = 0; i...
[["-", 8, 9, 0, 57, 15, 23, 0, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60], ["+", 75, 76, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 75, 76, 0, 1, 0, 11, 12, 16, 12, 13]]
0
351
6
#include <algorithm> #include <cstring> #include <iostream> using namespace std; int dp[3000][3000], n, x[3000][3000], maxn; char a; int main() { while (true) { memset(dp, 0, sizeof(dp)); cin >> n; if (!n) { break; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { ...
#include <algorithm> #include <cstring> #include <iostream> using namespace std; int dp[3000][3000], n, x[3000][3000], maxn; char a; int main() { while (true) { memset(dp, 0, sizeof(dp)); cin >> n; if (!n) { break; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { ...
[["-", 0, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 16, 31, 2, 63, 22], ["+", 31, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]]
1
272
4
#include <iostream> using namespace std; int main() { int n; char m[1000][1001]; while (cin >> n && n) { int a = 0; for (int i = 0; i < n; ++i) cin >> m[i]; for (int i = 0; i <= n - a; ++i) { for (int j = 0; j <= n - a; ++j) { if (m[i][j] == '.') { bool f = true; ...
#include <iostream> using namespace std; int main() { int n; char m[1000][1001]; while (cin >> n && n) { int a = 0; for (int i = 0; i < n; ++i) cin >> m[i]; for (int i = 0; i < n - a; ++i) { for (int j = 0; j < n - a; ++j) { if (m[i][j] == '.') { bool f = true; ...
[["-", 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, 7, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 17, 68]]
1
234
6
#include <iostream> #include <string> using namespace std; int n; char field[1000][1000]; int dp[1000][1000]; void solve() { fill(dp[0], dp[1000], 0); for (int i = 0; i < n; i++) { if (field[0][i] == '.') dp[0][i] = 1; if (field[i][0] == '.') dp[i][0] = 1; } int max = 0; for (int y = ...
#include <iostream> #include <string> using namespace std; int n; char field[1000][1000]; int dp[1000][1000]; void solve() { fill(dp[0], dp[1000], 0); for (int i = 0; i < n; i++) { if (field[0][i] == '.') dp[0][i] = 1; if (field[i][0] == '.') dp[i][0] = 1; } int max = 0; for (int y = ...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
356
2
#include <iostream> #include <string> using namespace std; int checkSquare(char *data, int x0, int y0, int n) { int d = 1; while ((x0 + d) < n && (y0 + d) < n) { for (int y = y0; y < (y0 + d); y++) { for (int x = x0; x < (x0 + d); x++) { if (data[y * n + x] == '*') { return d - 1; ...
#include <iostream> #include <string> using namespace std; int checkSquare(char *data, int x0, int y0, int n) { int d = 1; while ((x0 + d) <= n && (y0 + d) <= n) { for (int y = y0; y < (y0 + d); y++) { for (int x = x0; x < (x0 + d); x++) { if (data[y * n + x] == '*') { return d - 1; ...
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 19], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 33], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 12, 13]]
1
335
6
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <string> using namespace std; char fie[1111][1111]; int rui[1111][1111]; main() { int N; while (1) { cin >> N; if (N == 0) break; for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) cin >> ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <string> using namespace std; char fie[1111][1111]; int rui[1111][1111]; main() { int N; while (1) { cin >> N; if (N == 0) break; for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) cin >> ...
[["-", 12, 69, 28, 69, 341, 342, 0, 16, 31, 22], ["+", 12, 69, 28, 69, 341, 342, 0, 16, 31, 22], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
459
6
#include <algorithm> #include <cstring> #include <iostream> #include <string> using namespace std; int main() { int n; string s[10000]; int w[1001][1001]; while (cin >> n, n) { memset(w, 0, sizeof(0)); int ans = 0; for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < n; i++) {...
#include <algorithm> #include <cstring> #include <iostream> #include <string> using namespace std; int main() { int n; string s[10000]; int w[1001][1001]; while (cin >> n, n) { memset(w, 0, sizeof(0)); int ans = 0; for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < n; i++) {...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
276
4
while True: n=int(input()) if n==0: break field=[input() for i in range(n)] large=[[0]*(n+1) for i in range(n+1)] for i in range(n): for j in range(n): if field[i][j]=='.': large[i][j]=min(large[i][j-1],large[i-1][j],large[i-1][i-1])+1 print(max(list(m...
while True: n=int(input()) if n==0: break field=[input() for i in range(n)] large=[[0]*(n+1) for i in range(n+1)] for i in range(n): for j in range(n): if field[i][j]=='.': large[i][j]=min(large[i][j-1],large[i-1][j],large[i-1][j-1])+1 print(max(list(m...
[["-", 31, 652, 3, 4, 0, 206, 206, 657, 31, 22], ["+", 31, 652, 3, 4, 0, 206, 206, 657, 31, 22]]
5
141
2
#include <iostream> using namespace std; typedef long long ll; int a[101][101]; ll dp[101][101]; int N; int main() { for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) cin >> a[i][j]; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] - dp...
#include <iostream> using namespace std; typedef long long ll; int a[101][101]; ll dp[101][101]; int N; int main() { cin >> N; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) cin >> a[i][j]; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) dp[i + 1][j + 1] = dp[i + 1][j] + dp[i]...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 49, 50, 51, 91, 28, 23, 0, 16, 31, 13], ["+", 49, 50, 51, 91, 28, 23, 0, 16, 31, 13]]
1
282
6
#include <algorithm> #include <iostream> #include <limits> using namespace std; int a[101][101]; int dp[101][101]; int main() { int n; cin >> n; int ans = numeric_limits<int>::min(); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= n; ++j) { cin >> a[i][j]; dp[i][j] = a[i][j] + dp[i - 1][j...
#include <algorithm> #include <iostream> #include <limits> using namespace std; int a[101][101]; int dp[101][101]; int main() { int n; cin >> n; int ans = numeric_limits<int>::min(); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= n; ++j) { cin >> a[i][j]; dp[i][j] = a[i][j] + dp[i - 1][j...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
260
4
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> usin...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> usin...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
346
3
#include <stdio.h> int s[1000000]; int main() { int n, q, a, v, i, j, maxa, maxv; scanf("%d %d", &n, &q); for (i = 0; i < q; i++) { scanf("%d %d", &a, &v); s[a - 1] += v; if (i == 0) { maxa = a - 1; maxv = s[a - 1]; printf("%d %d\n", maxa + 1, maxv); continue; } if...
#include <stdio.h> int s[1000000]; int main() { int n, q, a, v, i, j, maxa, maxv; scanf("%d %d", &n, &q); for (i = 0; i < q; i++) { scanf("%d %d", &a, &v); s[a - 1] += v; if (i == 0) { maxa = a; maxv = s[a - 1]; printf("%d %d\n", maxa, maxv); continue; } if (v > 0)...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
0
269
4
#include <stdio.h> int main(void) { int n, q, num, fish, i, j, vic = 0, max = 0, get[100]; scanf("%d %d", &n, &q); for (i = 1; i <= n; i++) { get[i] = 0; } for (i = 0; i < q; i++) { scanf("%d %d", &num, &fish); get[num] += fish; if (fish < 0 && num == vic) { max = 0; for (j = n;...
#include <stdio.h> int main(void) { int n, q, num, fish, i, j, vic = 0, max = 0, get[1000000]; scanf("%d %d", &n, &q); for (i = 1; i <= n; i++) { get[i] = 0; } for (i = 0; i < q; i++) { scanf("%d %d", &num, &fish); get[num] += fish; if (fish < 0 && num == vic) { max = 0; for (j ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
212
2
#include <bits/stdc++.h> using namespace std; int main() { int n, q; cin >> n >> q; vector<int> A(n, 0); priority_queue<pair<int, int>> Q; for (int i = 0; i < n; i++) { Q.push(make_pair(0, i)); } for (int i = 0; i < q; i++) { int a, v; cin >> a >> v; a--; A[a] += v; Q.push(mak...
#include <bits/stdc++.h> using namespace std; int main() { int n, q; cin >> n >> q; vector<int> A(n, 0); priority_queue<pair<int, int>> Q; for (int i = 0; i < n; i++) { Q.push(make_pair(0, -i)); } for (int i = 0; i < q; i++) { int a, v; cin >> a >> v; a--; A[a] += v; Q.push(ma...
[["+", 3, 4, 0, 2, 3, 4, 0, 91, 17, 33], ["+", 51, 16, 12, 69, 341, 342, 0, 91, 17, 33], ["+", 31, 16, 31, 16, 12, 16, 31, 91, 17, 33]]
1
194
4
#include <algorithm> #include <cstdio> #include <queue> using namespace std; priority_queue<pair<int, int>> q; int n, m, d[1000001], a, b; main() { scanf("%d%d", &n, &n); q.push(make_pair(0, -1)); for (int i = 0; i < m; i++) { scanf("%d%d", &a, &b); d[a] += b; q.push(make_pair(d[a], -a)); while...
#include <algorithm> #include <cstdio> #include <queue> using namespace std; priority_queue<pair<int, int>> q; int n, m, d[1000001], a, b; main() { scanf("%d%d", &n, &m); q.push(make_pair(0, -1)); for (int i = 0; i < m; i++) { scanf("%d%d", &a, &b); d[a] += b; q.push(make_pair(d[a], -a)); while...
[["-", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22]]
1
178
2
#include <iostream> #include <set> #include <vector> using namespace std; typedef pair<int, int> Pii; int main() { int N, Q; cin >> N >> Q; vector<int> memo(N + 1); set<Pii> st; for (int q = 0; q < Q; q++) { int a, v; cin >> a >> v; st.erase(Pii(-v, a)); memo[a] += v; st.insert(Pii(-memo...
#include <iostream> #include <set> #include <vector> using namespace std; typedef pair<int, int> Pii; int main() { int N, Q; cin >> N >> Q; vector<int> memo(N + 1); set<Pii> st; for (int q = 0; q < Q; q++) { int a, v; cin >> a >> v; st.erase(Pii(-memo[a], a)); memo[a] += v; st.insert(Pii...
[["-", 3, 4, 0, 2, 3, 4, 0, 91, 28, 22], ["+", 0, 2, 3, 4, 0, 91, 28, 69, 28, 22], ["+", 3, 4, 0, 91, 28, 69, 341, 342, 0, 70], ["+", 3, 4, 0, 91, 28, 69, 341, 342, 0, 22], ["+", 3, 4, 0, 91, 28, 69, 341, 342, 0, 73]]
1
144
19
hash = Hash.new(0) min_a, max_v = Float::INFINITY, 0 n, q = gets.chomp.split.map(&:to_i) q.times do a, v = gets.chomp.split.map(&:to_i) hash[a] += v if v > 0 if hash[a] > max_v max_v = hash[a] min_a = a elsif hash[a] == max_v max_a = [a, min_a].min end else if a == min_a ...
hash = Hash.new(0) min_a, max_v = Float::INFINITY, -Float::INFINITY n, q = gets.chomp.split.map(&:to_i) q.times do a, v = gets.chomp.split.map(&:to_i) hash[a] += v if v > 0 if hash[a] > max_v max_v = hash[a] min_a = a elsif hash[a] == max_v min_a = [a, min_a].min end else if ...
[["-", 36, 36, 0, 493, 0, 662, 12, 762, 0, 612], ["+", 0, 493, 0, 662, 12, 762, 0, 748, 17, 33], ["+", 0, 662, 12, 762, 0, 748, 439, 760, 345, 743], ["+", 0, 662, 12, 762, 0, 748, 439, 760, 0, 349], ["+", 0, 662, 12, 762, 0, 748, 439, 760, 141, 743], ["-", 0, 121, 75, 759, 64, 749, 0, 662, 31, 22], ["+", 0, 121, 75, 75...
4
164
7
n, q = [int(el) for el in input().split(' ')] data = [0] * n result, index = 0, 1 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if v > 0: if result < data[a-1]: result, index = data[a-1], a elif result == data[a-1]: index = min(index,...
n, q = [int(el) for el in input().split(' ')] data = [0] * n result, index = 0, 1 for _ in range(q): a, v = [int(el) for el in input().split(' ')] data[a-1] += v if v > 0: if result < data[a-1]: result, index = data[a-1], a elif result == data[a-1]: index = min(index,...
[["-", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
152
2
n,q=map(int,input().split()) s=[0]*-~n w=m=0 for _ in[0]*q: a,v=map(int,input().split()) s[a]+=v if v<0 and a==w:m=max(s);w=s.index(m) elif s[a]>maxv:w,m=a,s[a] elif s[a]==maxv:w=min(w,a) print(w,m)
n,q=map(int,input().split()) s=[0]*-~n w=m=0 for _ in[0]*q: a,v=map(int,input().split()) s[a]+=v if v<0 and a==w:m=max(s);w=s.index(m) elif s[a]>m:w,m=a,s[a] elif s[a]==m:w=min(w,a) print(w,m)
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 0, 22], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 0, 22]]
5
125
13
""" セグメント木 """ INF = 10 ** 20 def main(): n, q = map(int, input().split()) size = 1 while size < n: size *= 2 size = size * 2 - 1 seg_tree = [(INF, 0) for _ in range(size)] def update(a, v): ind = (size - 1) // 2 + a prea, prev = seg_tree[ind] seg_tree[ind] = (a + 1, prev + v) ...
""" セグメント木 """ INF = 10 ** 20 def main(): n, q = map(int, input().split()) size = 1 while size < n: size *= 2 size = size * 2 - 1 seg_tree = [(INF, 0) for _ in range(size)] def update(a, v): ind = (size - 1) // 2 + a prea, prev = seg_tree[ind] seg_tree[ind] = (a + 1, prev + v) ...
[["-", 64, 196, 0, 57, 15, 666, 0, 660, 0, 22], ["+", 64, 196, 0, 57, 15, 666, 0, 660, 0, 22]]
5
248
2
var print = console.log; function read_input(_input) { var lines = _input.split("\n"); return function() { return lines.shift(); }; } String.prototype.dot = function dot(x) { var res = ""; for (var i = 0; i < x; i++) { res += this.toString(); } return res; }; function IL(line, min1Flg) { var s = li...
var print = console.log; function read_input(_input) { var lines = _input.split("\n"); return function() { return lines.shift(); }; } String.prototype.dot = function dot(x) { var res = ""; for (var i = 0; i < x; i++) { res += this.toString(); } return res; }; function IL(line, min1Flg) { var s = li...
[["-", 3, 3, 0, 2, 3, 3, 0, 557, 0, 491], ["+", 3, 3, 0, 2, 3, 3, 0, 557, 0, 491]]
2
690
2
import java.util.*; class Main { public static void main(String[] args) { Solve s = new Solve(); s.solve(); } } class Solve { Solve() {} Scanner in = new Scanner(System.in); void solve() { while (in.hasNext()) { int n = in.nextInt(); if (n == 0) return; Map<Integer, L...
import java.util.*; class Main { public static void main(String[] args) { Solve s = new Solve(); s.solve(); } } class Solve { Solve() {} Scanner in = new Scanner(System.in); void solve() { while (in.hasNext()) { int n = in.nextInt(); if (n == 0) return; Map<Integer, L...
[["-", 0, 503, 49, 200, 51, 230, 39, 513, 0, 78], ["+", 0, 503, 49, 200, 51, 230, 39, 513, 0, 78]]
3
260
2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { final int times = Int...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { final int times = Int...
[["-", 0, 514, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 0, 514, 8, 196, 0, 57, 64, 196, 0, 46]]
3
248
2
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { final int times = Integer.parseInt(br.readLine()); if (times == 0) { break; ...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { final int times = Integer.parseInt(br.readLine()); if (times == 0) { break; ...
[["-", 0, 503, 49, 200, 51, 230, 39, 513, 0, 78], ["+", 0, 503, 49, 200, 51, 230, 39, 513, 0, 78], ["-", 500, 492, 3, 4, 0, 218, 8, 16, 12, 499], ["+", 500, 492, 3, 4, 0, 218, 8, 16, 12, 499], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499]]
3
229
6
import java.util.HashMap; import java.util.Scanner; public class Main { private Scanner sc; public static void main(String[] args) { new Main(); } public Main() { sc = new Scanner(System.in); int lines = Integer.parseInt(sc.nextLine()); while (lines != 0) { HashMap<String, Integer> nico = ne...
import java.util.LinkedHashMap; import java.util.Scanner; public class Main { private Scanner sc; public static void main(String[] args) { new Main(); } public Main() { sc = new Scanner(System.in); int lines = Integer.parseInt(sc.nextLine()); while (lines != 0) { LinkedHashMap<String, Intege...
[["-", 36, 36, 0, 493, 0, 454, 0, 522, 141, 22], ["+", 36, 36, 0, 493, 0, 454, 0, 522, 141, 22], ["-", 0, 52, 8, 196, 0, 503, 39, 513, 0, 78], ["+", 0, 52, 8, 196, 0, 503, 39, 513, 0, 78], ["-", 0, 503, 49, 200, 51, 230, 39, 513, 0, 78], ["+", 0, 503, 49, 200, 51, 230, 39, 513, 0, 78]]
3
285
6
#include <stdio.h> int main(int argc, char *argv[]) { int n, f, i; long long int ID, price, num; long long int sum[4001]; int ln, list[4000]; while (1) { scanf("%d ", &n); if (!n) break; f = 0; ln = 0; for (i = 1; i < 4001; i++) sum[i] = 0; while (n--) { scanf("%lld ...
#include <stdio.h> int main(int argc, char *argv[]) { int n, f, i; long long int ID, price, num; long long int sum[4001]; int ln, list[4000]; while (1) { scanf("%d ", &n); if (!n) break; f = 0; ln = 0; for (i = 1; i < 4001; i++) sum[i] = 0; while (n--) { scanf("%lld ...
[["-", 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], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
207
6
////#include <stdio.h> ////long long int n,a,b[100001],c[100001],num[100001]={},d[4001]={}; //// int i,j,x=0; //// int sum=0; //// int main(){ //// while(1){ //// scanf("%lld",&n); //// if(n==0) break; //// for(i=0;i<n;i++){ //// scanf("%lld %lld %lld",&a,&b[i],&c[i]); //// d[a] += b[i]*c[i]; //// ...
////#include <stdio.h> ////long long int n,a,b[100001],c[100001],num[100001]={},d[4001]={}; //// int i,j,x=0; //// int sum=0; //// int main(){ //// while(1){ //// scanf("%lld",&n); //// if(n==0) break; //// for(i=0;i<n;i++){ //// scanf("%lld %lld %lld",&a,&b[i],&c[i]); //// d[a] += b[i]*c[i]; //// ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22]]
0
259
2
#include <iostream> #include <map> int main() { int n; while (std::cin >> n) { if (n == 0) break; bool na = true; std::map<int, long long> id_sales_map; for (int i = 0; i < n; ++i) { int ID; long long price, number; std::cin >> ID >> price >> number; if (id_sales_ma...
#include <iostream> #include <map> int main() { int n; while (std::cin >> n) { if (n == 0) break; bool na = true; std::map<int, long long> id_sales_map; for (int i = 0; i < n; ++i) { int ID; long long price, number; std::cin >> ID >> price >> number; if (id_sales_ma...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 147]]
1
148
2
#include <bits/stdc++.h> using namespace std; int main() { int n, id, val, num, cnt; int member[4000]; int index[4000]; while (cin >> n) { if (!n) break; cnt = 0; memset(member, -1, sizeof(member)); memset(index, -1, sizeof(index)); for (int i = 0; i < n; ++i) { cin >> id...
#include <bits/stdc++.h> using namespace std; int main() { long long n, id, val, num, cnt; long long member[4000]; int index[4000]; while (cin >> n) { if (!n) break; cnt = 0; memset(member, -1, sizeof(member)); memset(index, -1, sizeof(index)); for (int i = 0; i < n; ++i) { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
217
6
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main(void) { int n; while (1) { cin >> n; if (n == 0) break; int c[4001] = {}, id[10000000]; for (int i = 0; i < n; i++) { int p, q; cin >> id[i] >> p >> q; c[id[i]] += p * q; } bool ...
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main(void) { int n; while (1) { cin >> n; if (n == 0) break; long int c[4001] = {}; int id[100000]; for (int i = 0; i < n; i++) { long int p, q; cin >> id[i] >> p >> q; c[id[i]] += p * q;...
[["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 0, 21], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["-", 0, 52, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]]
1
169
7
#include <iostream> #include <string> using namespace std; long long a[5000]; bool check[5000]; int main() { int n; while (true) { cin >> n; if (n == 0) break; for (int i = 0; i < 5000; i++) { a[i] = 0; check[i] = true; } bool na = true; long long b, c, d; for (int i = ...
#include <iostream> #include <string> using namespace std; long long a[5000]; bool check[5000]; int main() { int n; while (true) { cin >> n; if (n == 0) break; for (int i = 0; i < 5000; i++) { a[i] = 0; check[i] = true; } bool na = true; long long b, c, d; for (int i = ...
[["-", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
178
2
#include <iostream> #include <map> #include <vector> using namespace std; int main() { int n; while (cin >> n && n) { map<int, int> mp; vector<int> v; for (int i = 0; i < n; i++) { int e, p, q; cin >> e >> p >> q; if (!mp[e]) v.push_back(e); mp[e] += p * q; } ...
#include <iostream> #include <map> #include <vector> using namespace std; int main() { int n; while (cin >> n && n) { map<int, int> mp; vector<int> v; for (int i = 0; i < n; i++) { int e, p, q; cin >> e >> p >> q; if (!mp[e]) v.push_back(e); mp[e] += p * q; } ...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 57, 75, 76, 0, 57, 64, 9, 0, 46]]
1
169
3
#include <algorithm> #include <iostream> #include <sstream> #include <string> using namespace std; int H; int W[100]; int G[100][100]; int dp[100][100]; int solve() { dp[0][0] = G[0][0]; for (int i = 1; i < H; ++i) { for (int j = 0; j < W[i]; ++j) { if (i <= H / 2 + 1) { dp[i][j] = dp[i - 1][j] ...
#include <algorithm> #include <iostream> #include <sstream> #include <string> using namespace std; int H; int W[100]; int G[100][100]; int dp[100][100]; int solve() { dp[0][0] = G[0][0]; for (int i = 1; i < H; ++i) { for (int j = 0; j < W[i]; ++j) { if (i <= H / 2) { dp[i][j] = dp[i - 1][j] + G[...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
332
2
import sys s=[list(map(int,e.split(',')))for e in sys.stdin] for i in range(1,len(s)): for j in range(len(s[i])): t=j-len(s[i])>len(s[i-1]) s[i][j]+=max(s[i-1][t*(j>0):t+2]) print(*s[-1])
import sys s=[list(map(int,e.split(',')))for e in sys.stdin] for i in range(1,len(s)): for j in range(len(s[i])): t=j-(len(s[i])>len(s[i-1])) s[i][j]+=max(s[i-1][t*(j>0):t+2]) print(*s[-1])
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 12, 23, 0, 666, 0, 652, 3, 4, 0, 25]]
5
115
21
def mx(p,w,h,l): if h <= c/2: if w == 0: p[h][w] += p[h-1][w] elif w == l-1: p[h][w] += p[h-1][w-1] else: p[h][w] += max(p[h-1][w],p[h-1][w-1]) else: p[h][w] += max(p[h-1][w],p[h-1][w+1]) return p c = 0 p = [] while True: try: p.append(list(map(int, raw_put().split(",")))) c += 1 except: break for...
def mx(p,w,h,l): if h <= c/2: if w == 0: p[h][w] += p[h-1][w] elif w == l-1: p[h][w] += p[h-1][w-1] else: p[h][w] += max(p[h-1][w],p[h-1][w-1]) else: p[h][w] += max(p[h-1][w],p[h-1][w+1]) return p c = 0 p = [] while True: try: p.append(list(map(int, input().split(",")))) c += 1 except: break for h...
[["-", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22]]
5
229
2
import java.io.IOException; import java.util.InputMismatchException; public class Main { double EPS = 1e-10; int n; Circle[] c; class Point { double x, y; Point(double x, double y) { this.x = x; this.y = y; } } class Circle { Point c; double r; Circle(Point c, doubl...
import java.io.IOException; import java.util.InputMismatchException; public class Main { double EPS = 1e-10; int n; Circle[] c; class Point { double x, y; Point(double x, double y) { this.x = x; this.y = y; } } class Circle { Point c; double r; Circle(Point c, doubl...
[["+", 8, 196, 0, 37, 0, 16, 12, 16, 17, 72], ["+", 8, 196, 0, 37, 0, 16, 12, 16, 12, 22], ["-", 0, 52, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 0, 52, 8, 196, 0, 503, 49, 200, 51, 499]]
3
1,415
4
import java.awt.geom.Point2D; import java.io.*; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.List; import java.util.NoSuchElementException; import java.util...
import java.awt.geom.Point2D; import java.io.*; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.List; import java.util.NoSuchElementException; import java.util...
[["-", 0, 7, 502, 503, 49, 200, 51, 16, 31, 22], ["-", 0, 7, 502, 503, 49, 200, 51, 16, 17, 72], ["-", 0, 7, 502, 503, 49, 200, 51, 16, 12, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499]]
3
1,075
4
import java.util.Scanner; public class Main { private Scanner sc; public static void main(String[] args) { new Main(); } public Main() { sc = new Scanner(System.in); while (sc.hasNextLine()) { int lines = Integer.parseInt(sc.nextLine()); if (lines == 0) break; double[] x = n...
import java.util.Scanner; public class Main { private Scanner sc; public static void main(String[] args) { new Main(); } public Main() { sc = new Scanner(System.in); while (sc.hasNextLine()) { int lines = Integer.parseInt(sc.nextLine()); if (lines == 0) break; double[] x = n...
[["-", 3, 4, 0, 492, 3, 4, 0, 16, 31, 499], ["+", 3, 4, 0, 492, 3, 4, 0, 16, 31, 515], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 515], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 515]]
3
609
6
import java.util.Arrays; import java.util.Scanner; // Overlaps of Seals public class Main { static class P { public double x, y; public P(double x, double y) { this.x = x; this.y = y; } } static class R implements Comparable<R> { public double minx, maxx, miny, maxy; public P[] ...
import java.util.Arrays; import java.util.Scanner; // Overlaps of Seals public class Main { static class P { public double x, y; public P(double x, double y) { this.x = x; this.y = y; } } static class R implements Comparable<R> { public double minx, maxx, miny, maxy; public P[] ...
[["-", 0, 16, 31, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 12, 16, 12, 22]]
3
803
2
import java.awt.geom.Point2D; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int n = sc.nextInt(); if (n == 0) break; Point2D.Double[] p = new Point2D.Double[n]; for (int i = 0; i < n; i++...
import java.awt.geom.Point2D; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int n = sc.nextInt(); if (n == 0) break; Point2D.Double[] p = new Point2D.Double[n]; for (int i = 0; i < n; i++...
[["-", 0, 52, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 0, 52, 8, 196, 0, 503, 49, 200, 51, 499]]
3
752
2
#include <math.h> #include <stdio.h> int main() { int n, i, j, l, max, c; double x[310], y[310], k, s, t, a, b, e = 1e-6; while (scanf("%d", &n), n) { for (i = max = 0; i < n; i++) scanf("%lf,%lf", &x[i], &y[i]); for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { a = (x[i] - x[j])...
#include <math.h> #include <stdio.h> int main() { int n, i, j, l, max, c; double x[310], y[310], k, s, t, a, b, e = 1e-6; while (scanf("%d", &n), n) { max = 1; for (i = 0; i < n; i++) scanf("%lf,%lf", &x[i], &y[i]); for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { a = (x[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], ["-", 0, 52, 8, 9, 0, 7, 10, 11, 17, 32], ["-", 8, 9, 0, 7, 10, 11, 12, 11, 31, 22]]
0
363
6
#include <math.h> #include <stdio.h> int main() { double x[100], y[100]; double A, h, c, X, Y; int n, i, j, k, m, M; while (scanf("%d", &n), n) { M = 0; for (i = 0; i < n; i++) scanf("%lf,%lf", x + i, y + i); for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { A = hypot(x[i] ...
#include <math.h> #include <stdio.h> int main() { double x[100], y[100]; double A, h, c, X, Y; int n, i, j, k, m, M; while (scanf("%d", &n), n) { M = -1; for (i = 0; i < n; i++) scanf("%lf,%lf", x + i, y + i); for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { A = hypot(x[i]...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
0
421
2
#include <math.h> #include <stdio.h> #define SQ(x) ((x) * (x)) #define EPS 1e-4 typedef struct { double x; double y; } POINT; int dist(POINT a, POINT b, double d) { if (SQ(a.x - b.x) + SQ(a.y - b.y) - d > EPS) { return (0); } return (1); } int max(int a, int b) { if (a > b) { return (a); } ret...
#include <math.h> #include <stdio.h> #define SQ(x) ((x) * (x)) #define EPS 1e-5 typedef struct { double x; double y; } POINT; int dist(POINT a, POINT b, double d) { if (sqrt(SQ(a.x - b.x) + SQ(a.y - b.y)) - d > EPS) { return (0); } return (1); } int max(int a, int b) { if (a > b) { return (a); }...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 0, 14, 8, 9, 0, 57, 15, 23, 0, 24], ["+", 15, 23, 0, 16, 31, 16, 31, 2, 63, 22], ["+", 0, 16, 31, 16, 31, 2, 3, 4, 0, 25], ["-", 15, 23, 0, 16, 31, 2, 3, 4, 0, 13], ["+", 15, 23, 0, 16, 31, 2, 3, 4, 0, 13], ["-", 0, 52, 8, ...
0
532
9
#include <math.h> #include <stdio.h> double pot[100][3], xp, yp, xq, yq, d, a, ans; int i, j, n; void check(double x, double y) { int i; double px, py, a = 2.0; for (i = 0; i < n; i++) { px = pot[i][0]; py = pot[i][1]; if ((px - x) * (px - x) + (py - y) * (py - y) <= 1.000000000000005) { a += po...
#include <math.h> #include <stdio.h> double pot[100][3], xp, yp, xq, yq, d, a, ans; int i, j, n; void check(double x, double y) { int i; double px, py, a = 0.0; for (i = 0; i < n; i++) { px = pot[i][0]; py = pot[i][1]; if ((px - x) * (px - x) + (py - y) * (py - y) <= 1.000000000000005) { a += po...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
0
553
2
M = 9; main(n, i, j, k, a, b, c) { float p = atan(1) * 4, X[100], Y[100], x, y; for (; scanf("%d", &n), n; printf("%d\n", a)) { for (i = 0; i < n; i++) scanf("%f,%f", X + i, Y + i); for (a = i = 0; i < n; i++) { for (b = k = 0; k < M; k++) { x = X[i] + cos(p * k / M), y = Y[i] + sin(p * ...
M = 99; main(n, i, j, k, a, b, c) { float p = atan(1) * 4, X[100], Y[100], x, y; for (; scanf("%d", &n), n; printf("%d\n", a)) { for (i = 0; i < n; i++) scanf("%f,%f", X + i, Y + i); for (a = i = 0; i < n; i++) { for (b = k = 0; k < M; k++) { x = X[i] + cos(p * k / M), y = Y[i] + sin(p *...
[["-", 36, 36, 0, 30, 0, 1, 0, 11, 12, 13], ["+", 36, 36, 0, 30, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 7, 10, 34, 12, 11, 12, 22], ["+", 8, 9, 0, 7, 10, 34, 12, 11, 12, 13]]
0
257
4
#include <bits/stdc++.h> using namespace std; const int dx[] = {0, 1, 0, -1, 1, -1, -1, 1}; const int dy[] = {-1, 0, 1, 0, 1, 1, -1, -1}; const int INF = 1 << 30; const double EPS = 1e-15; #define PB push_back #define mk make_pair #define fi first #define se second #define ll long long #define reps(i, j, k) for (int i ...
#include <bits/stdc++.h> using namespace std; const int dx[] = {0, 1, 0, -1, 1, -1, -1, 1}; const int dy[] = {-1, 0, 1, 0, 1, 1, -1, -1}; const int INF = 1 << 30; const double EPS = 1e-15; #define PB push_back #define mk make_pair #define fi first #define se second #define ll long long #define reps(i, j, k) for (int i ...
[["-", 0, 52, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 91, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 91, 28, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
1,760
7
#define _USE_MATH_DEFINES #include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define EPS 1e-8 #define INF 1000000 struc...
#define _USE_MATH_DEFINES #include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define EPS 1e-8 #define INF 1000000 struc...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
1,891
2
#include <iostream> #include <math.h> #include <vector> using namespace std; typedef pair<double, double> pd; double EPS = 1e-9; double sq(double a) { return a * a; } double dis(pd p1, pd p2) { return sqrt(sq(p1.first - p2.first) + sq(p1.second - p2.second)); } pd add(pd p1, pd p2) { return make_pair(p1.first + p2...
#include <iostream> #include <math.h> #include <vector> using namespace std; typedef pair<double, double> pd; double EPS = 1e-5; double sq(double a) { return a * a; } double dis(pd p1, pd p2) { return sqrt(sq(p1.first - p2.first) + sq(p1.second - p2.second)); } pd add(pd p1, pd p2) { return make_pair(p1.first + p2...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 0, 21], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
610
7
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; // ------ Classes ------ // class Point { public: long double px, py; Point() : px(0), py(0){}; Point(long double px_, long double py_) : px(px_), py(py_){}; bool operator==(const Point &p) const { return px == p.p...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; // ------ Classes ------ // class Point { public: long double px, py; Point() : px(0), py(0){}; Point(long double px_, long double py_) : px(px_), py(py_){}; bool operator==(const Point &p) const { return px == p.p...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
1,357
2
#include <bits/stdc++.h> using namespace std; #define pb(n) push_back(n) #define mp(a, b) make_pair(a, b) #define fi first #define se second #define np string::npos #define X real() #define Y imag() #define value(x, y, w, h) (x >= 0 && x < w && y >= 0 && y < h) #define all(r) (r).begin(), (r).end() #define gsort(st, e...
#include <bits/stdc++.h> using namespace std; #define pb(n) push_back(n) #define mp(a, b) make_pair(a, b) #define fi first #define se second #define np string::npos #define X real() #define Y imag() #define value(x, y, w, h) (x >= 0 && x < w && y >= 0 && y < h) #define all(r) (r).begin(), (r).end() #define gsort(st, e...
[["-", 51, 2, 3, 4, 0, 16, 12, 16, 12, 13], ["+", 51, 2, 3, 4, 0, 16, 12, 16, 12, 13]]
1
1,176
2
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define EPS (1e-8) typedef complex<double> P; vector<P> intersection(P a, P b) { vector<P> res; if (abs(abs(b - a) - 2.0) < EPS) { //????????\???????????? P c = a + b; r...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define EPS (1e-8) typedef complex<double> P; vector<P> intersection(P a, P b) { vector<P> res; if (abs(abs(b - a) - 2.0) < EPS) { //????????\???????????? P c = a + b; r...
[["-", 0, 16, 12, 2, 3, 4, 0, 16, 31, 13], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 12, 13], ["+", 31, 23, 0, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 23, 0, 16, 12, 2, 3, 4, 0, 21]]
1
465
6
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #include <cassert> #include <functional> typedef long...
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #include <cassert> #include <functional> typedef long...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 146]]
1
565
6
#include <cmath> #include <iostream> #include <vector> #define ESP 1.0e-12 using namespace std; struct CPoint { CPoint() : x(-1), y(-1) {} CPoint(double x, double y) : x(x), y(y) {} double x, y; }; struct CSeal { CSeal() : r(0) {} CSeal(double x, double y) : p(x, y), r(1.0) {} CPoint p; double r; }; dou...
#include <cmath> #include <iostream> #include <vector> #define EPS 1.0e-12 using namespace std; struct CPoint { CPoint() : x(-1), y(-1) {} CPoint(double x, double y) : x(x), y(y) {} double x, y; }; struct CSeal { CSeal() : r(0) {} CSeal(double x, double y) : p(x, y), r(1.0) {} CPoint p; double r; }; inl...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 0, 30, 0, 14, 0, 114, 0, 174], ["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
990
8
#include <algorithm> #include <assert.h> #include <complex> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> #include <vector> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; static const double EPS = 1e-9; static const double PI = acos(...
#include <algorithm> #include <assert.h> #include <complex> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> #include <vector> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; static const double EPS = 1e-9; static const double PI = acos(...
[["-", 49, 50, 51, 16, 31, 23, 0, 16, 17, 33], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 17, 72]]
1
557
2
#include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include...
#include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
546
6
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <vector> #define EPS (1e-5) using namespace std; class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point oper...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <vector> #define EPS (1e-5) using namespace std; class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point oper...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
708
4
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> using nam...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> using nam...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
1,156
2
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; class Point ...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; class Point ...
[["-", 0, 37, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 37, 0, 2, 3, 4, 0, 16, 17, 85], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
716
4
#include <algorithm> #include <math.h> #include <stdio.h> using namespace std; double x[100], y[100]; double px[10000], py[10000]; int main() { int a; while (scanf("%d", &a), a) { for (int i = 0; i < a; i++) scanf("%lf,%lf", x + i, y + i); int now = 0; for (int i = 0; i < a; i++) { for (int ...
#include <algorithm> #include <math.h> #include <stdio.h> using namespace std; double x[100], y[100]; double px[10000], py[10000]; int main() { int a; while (scanf("%d", &a), a) { for (int i = 0; i < a; i++) scanf("%lf,%lf", x + i, y + i); int now = 0; for (int i = 0; i < a; i++) { for (int ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
483
2
#include <algorithm> #include <cmath> #include <cstdio> #include <vector> using namespace std; #define EPS 1e-5 typedef pair<double, double> point, circle; void intrsc(const circle &c1, const circle &c2, vector<point> &v) { double a, b, c, d, e, f, g, D; double x1, x2, y1, y2, ix1, ix2, iy1, iy2; x1 = c1.first...
#include <algorithm> #include <cmath> #include <cstdio> #include <vector> using namespace std; #define EPS 1e-7 typedef pair<double, double> point, circle; void intrsc(const circle &c1, const circle &c2, vector<point> &v) { double a, b, c, d, e, f, g, D; double x1, x2, y1, y2, ix1, ix2, iy1, iy2; x1 = c1.first...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13]]
1
665
4
#include <cmath> #include <cstdio> #include <iostream> #include <vector> using namespace std; typedef pair<double, double> P; double EPS = 1e-10; double add(double a, double b) { if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0; return a + b; } struct point { double x, y; point() {} point(double x, ...
#include <cmath> #include <cstdio> #include <iostream> #include <vector> using namespace std; typedef pair<double, double> P; double EPS = 1e-10; double add(double a, double b) { if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0; return a + b; } struct point { double x, y; point() {} point(double x, ...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
760
2
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <iomanip> #include <iostream> #include <vector> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define EPS (1e-10) #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -1 #define ONLINE_BACK ...
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <iomanip> #include <iostream> #include <vector> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define EPS (1e-10) #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -1 #define ONLINE_BACK ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
1,410
2
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <iomanip> #include <iostream> #include <vector> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define EPS (1e-10) #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -1 #define ONLINE_BACK ...
#include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <iomanip> #include <iostream> #include <vector> #define REP(i, s, n) for (int i = s; i < n; i++) #define rep(i, n) REP(i, 0, n) #define EPS (1e-10) #define COUNTER_CLOCKWISE 1 #define CLOCKWISE -1 #define ONLINE_BACK ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
1,188
2
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <iostream> #include <vector> using namespace std; typedef complex<double> Vector; struct Circle { Vector center; double r; pair<Vector, Vector> intersection(const Circle &c) const { const double d = abs(c.center - center);...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <iostream> #include <vector> using namespace std; typedef complex<double> Vector; struct Circle { Vector center; double r; pair<Vector, Vector> intersection(const Circle &c) const { const double d = abs(c.center - center);...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
500
2
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; double cx[2], cy[2], x[100], y[100]; int cirxy(double x1, double y1, double x2, double y2) { double x3, y3, x4, y4, k, r; x3 = (x1 + x2) / 2; y3 = (y1 + y2) / 2; k = sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)); if ((1 - k ...
#include <iostream> #include <math.h> #include <stdio.h> using namespace std; double cx[2], cy[2], x[100], y[100]; int cirxy(double x1, double y1, double x2, double y2) { double x3, y3, x4, y4, k, r; x3 = (x1 + x2) / 2; y3 = (y1 + y2) / 2; k = sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1)); if ((1 - k ...
[["-", 0, 7, 8, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 7, 8, 57, 15, 339, 51, 16, 12, 13]]
1
602
2
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <memory> #include <string> #include <algorithm> #include <bitset> #include <complex> #include <list> #in...
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <memory> #include <string> #include <algorithm> #include <bitset> #include <complex> #include <list> #in...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
707
2
#include <math.h> #include <stdio.h> struct pnt { double x, y; pnt(){}; pnt(double a, double b) { x = a, y = b; } }; double h; struct line { double A, B, C; line(){}; line(pnt a, pnt b) { A = a.y - b.y, B = b.x - a.x, C = -A * a.x - B * a.y; } }; pnt kramer(pnt x1, pnt x2, double t) { line a = line(x1, x2...
#include <math.h> #include <stdio.h> struct pnt { double x, y; pnt(){}; pnt(double a, double b) { x = a, y = b; } }; double h; struct line { double A, B, C; line(){}; line(pnt a, pnt b) { A = a.y - b.y, B = b.x - a.x, C = -A * a.x - B * a.y; } }; pnt kramer(pnt x1, pnt x2, double t) { line a = line(x1, x2...
[["+", 0, 37, 0, 23, 0, 16, 12, 16, 17, 72], ["+", 0, 37, 0, 23, 0, 16, 12, 16, 12, 13]]
1
643
2
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <list> #include <map> #inclu...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <list> #include <map> #inclu...
[["-", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13]]
1
3,974
2
#include <cmath> #include <iostream> #include <stdio.h> #include <vector> #define PI 3.141592654 #define RADIUS 1.0 #define EPS 1e-10 struct POINT { double x; double y; POINT &operator+=(const POINT &p) { x += p.x; y += p.y; return *this; } POINT &operator-=(const POINT &p) { x -= p.x; ...
#include <cmath> #include <iostream> #include <stdio.h> #include <vector> #define PI 3.141592654 #define RADIUS 1.0 #define EPS 1e-10 struct POINT { double x; double y; POINT &operator+=(const POINT &p) { x += p.x; y += p.y; return *this; } POINT &operator-=(const POINT &p) { x -= p.x; ...
[["-", 51, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["+", 51, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13]]
1
856
4
#include <complex> #include <iostream> #include <vector> using namespace std; typedef complex<double> P; P A[100], j = sqrt(-1), p, p0; double a, b, d; int n; int f(int m) { int i, s1 = 2, s2 = 2; d = acos(a / 2); P p3 = polar(1.0, b + d) + p, p4 = polar(1.0, b - d) + p; for (i = 0; i < n; i++) { P q = A[i]...
#include <complex> #include <iostream> #include <vector> using namespace std; typedef complex<double> P; P A[100], j = sqrt(-1), p, p0; double a, b, d; int n; int f(int m) { int i, s1 = 2, s2 = 2; d = acos(a / 2); P p3 = polar(1.0, b + d) + p, p4 = polar(1.0, b - d) + p; for (i = 0; i < n; i++) { P q = A[i]...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 0, 21], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 49, 22]]
1
342
27
epsilon = 0 while n = gets.to_i break if n == 0 cross = [] circle = [] n.times{|i| x, y = gets.split(",").map(&:to_f) circle.each_with_index{|it, j| if (it[0]-x)**2 + (it[1]-y)**2 <= 4.0 + epsilon x1 = it[0]-x y1 = it[1]-y x2y2 = x1**2+y1**2 a = x2y2*0.5 b =...
epsilon = 1e-10 while n = gets.to_i break if n == 0 cross = [] circle = [] n.times{|i| x, y = gets.split(",").map(&:to_f) circle.each_with_index{|it, j| if (it[0]-x)**2 + (it[1]-y)**2 <= 4.0 + epsilon x1 = it[0]-x y1 = it[1]-y x2y2 = x1**2+y1**2 a = x2y2*0.5 ...
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 12, 531]]
4
271
2
# -*- coding: utf-8 -*- import sys import os import math for s in sys.stdin: n = int(s) if n == 0: break P = [] for i in range(n): x, y = map(float, input().split(',')) P.append(complex(x, y)) def get_intersections(p0, p1): """ :type p0: complex :...
# -*- coding: utf-8 -*- import sys import os import math for s in sys.stdin: n = int(s) if n == 0: break P = [] for i in range(n): x, y = map(float, input().split(',')) P.append(complex(x, y)) def get_intersections(p0, p1): """ :type p0: complex :...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 531], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
276
4
def x(p0, p1): d = abs(p0 - p1) if d > 2: return [] elif d == 2: return [(p0 + p1) / 2] else: m = (p0 + p1) / 2 v = m - p0 w = complex(v.imag, -v.real) l = abs(w) h = (1 - l ** 2) ** .5 * w / l return [m + h, m - h] for e in iter(input, '0...
def x(p0, p1): d = abs(p0 - p1) if d > 2: return [] elif d == 2: return [(p0 + p1) / 2] else: m = (p0 + p1) / 2 v = m - p0 w = complex(v.imag, -v.real) l = abs(w) h = (1 - l ** 2) ** .5 * w / l return [m + h, m - h] for e in iter(input, '0...
[["-", 31, 658, 8, 652, 3, 668, 8, 666, 0, 531], ["+", 31, 658, 8, 652, 3, 668, 8, 666, 0, 531]]
5
217
2
import itertools,math def isOverlapped(x1,y1,x2,y2,r1,r2): return ((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))**0.5<=r1+r2+0.000009 while True: n=eval(input()) if n==0: break li=[] for i in range(n): li.append(list(map(float,input().split(",")))) ma=0 for i,j in itertools.combin...
import itertools,math def isOverlapped(x1,y1,x2,y2,r1,r2): return ((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))**0.5<=r1+r2+0.000009 while True: n=eval(input()) if n==0: break li=[] for i in range(n): li.append(list(map(float,input().split(",")))) ma=1 for i,j in itertools.combin...
[["-", 0, 52, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 12, 612]]
5
408
2
import java.util.*; public class Main { private static final Scanner scn = new Scanner(System.in); public static void main(String[] args) { for (int n = scn.nextInt(); n > 0; n--) { System.out.println(scn.nextLine().replace("Hoshino", "Hoshina")); } } }
import java.util.*; public class Main { private static final Scanner scn = new Scanner(System.in); public static void main(String[] args) { for (int n = Integer.parseInt(scn.nextLine()); n > 0; n--) { System.out.println(scn.nextLine().replace("Hoshino", "Hoshina")); } } }
[["+", 0, 7, 502, 503, 49, 200, 51, 492, 500, 22], ["+", 0, 7, 502, 503, 49, 200, 51, 492, 0, 131], ["+", 0, 7, 502, 503, 49, 200, 51, 492, 141, 22], ["+", 502, 503, 49, 200, 51, 492, 3, 4, 0, 24], ["-", 0, 7, 502, 503, 49, 200, 51, 492, 141, 22], ["+", 49, 200, 51, 492, 3, 4, 0, 492, 141, 22], ["+", 51, 492, 3, 4, 0, ...
3
82
7
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String args[]) throws IOException { BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in)); int sets = Integer.parseInt(bfr.readLine()); for (int i = 0; i <...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String args[]) throws IOException { BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in)); int sets = Integer.parseInt(bfr.readLine()); for (int i = 0; i <...
[["-", 15, 15, 0, 492, 500, 492, 3, 4, 0, 22], ["+", 15, 15, 0, 492, 500, 492, 3, 4, 0, 22], ["-", 0, 492, 500, 492, 3, 4, 0, 16, 31, 22], ["+", 0, 492, 500, 492, 3, 4, 0, 16, 31, 22]]
3
222
4
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { String str1 = sc.nextLine(); if (str1.contains("Hoshino")) { String str2 = str1.replace("Hoshino", "Hoshina"); ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); for (int i = 0; i < n; i++) { String str1 = sc.nextLine(); if (str1.contains("Hoshino")) { String str2 = str1.replace("Hoshin...
[["+", 0, 195, 8, 196, 0, 1, 0, 492, 500, 22], ["+", 0, 195, 8, 196, 0, 1, 0, 492, 0, 131], ["+", 0, 195, 8, 196, 0, 1, 0, 492, 141, 22], ["+", 8, 196, 0, 1, 0, 492, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 492, 3, 4, 0, 25], ["+", 8, 498, 0, 195, 8, 196, 0, 1, 0, 35]]
3
119
6
import static java.lang.Math.*; import static java.util.Arrays.*; import java.io.*; import java.lang.*; import java.math.*; import java.util.*; public class Main { Scanner sc; static final int INF = 1 << 28; static final double EPS = 1e-9; void run() { sc = new Scanner(System.in); int n = sc.nextIn...
import static java.lang.Math.*; import static java.util.Arrays.*; import java.io.*; import java.lang.*; import java.math.*; import java.util.*; public class Main { Scanner sc; static final int INF = 1 << 28; static final double EPS = 1e-9; void run() { sc = new Scanner(System.in); int n = sc.nextIn...
[["+", 0, 7, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 500, 22]]
3
207
2
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws java.io.IOException { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); scan.nextLine(); for (int i = 0; i < n; i++) { String str = scan.nextLine(); System.out.println(str....
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws java.io.IOException { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); scan.nextLine(); for (int i = 0; i < n; i++) { String str = scan.nextLine(); System.out.println(str....
[["-", 3, 4, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 3, 4, 0, 492, 3, 4, 0, 5, 0, 491]]
3
108
4
#include <stdio.h> #include <string.h> int main(void) { char str[1024]; int i, j, n, len; scanf("%d ", &n); for (i = 0; i < n; i++) { gets(str); len = strlen(str); for (j = 0; j < len - 6; j++) { if (strncmp(&str[i], "Hoshino", 7) == 0) { str[i + 6] = 'a'; } } puts(s...
#include <stdio.h> #include <string.h> int main(void) { char str[1024]; int i, j, n, len; scanf("%d ", &n); for (i = 0; i < n; i++) { gets(str); len = strlen(str); for (j = 0; j < len - 5; j++) { if (strncmp(&str[j], "Hoshino", 7) == 0) { str[j + 6] = 'a'; } } puts(s...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 31, 2, 3, 4, 0, 66, 28, 69, 71, 22], ["+", 31, 2, 3, 4, 0, 66, 28, 69, 71, 22], ["-", 0, 1, 0, 11, 31, 69, 71, 16, 31, 22], ["+", 0, 1, 0, 11, 31, 69, 71, 16, 31, 22]]
0
122
6
#include <stdio.h> #include <string.h> int main(void) { int n, i; char *strptr; char str[1002]; scanf("%d", &n); for (i = 0; i < n; i++) { fgets(str, 1002, stdin); strptr = str; while ((strptr = strstr(strptr, "Hoshino")) != NULL) { strptr += 6; *strptr = 'a'; } printf("%s",...
#include <stdio.h> #include <string.h> int main(void) { int n, i; char *strptr; char str[1002]; scanf("%d", &n); getchar(); for (i = 0; i < n; i++) { fgets(str, 1002, stdin); strptr = str; while ((strptr = strstr(strptr, "Hoshino")) != NULL) { strptr += 6; *strptr = 'a'; } ...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 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]]
0
106
4
#include <stdio.h> int main(void) { char str[3000]; int i, j, k; int n; scanf("%d%*c", &n); for (i = 0; i <= n; i++) { fgets(str, 3000, stdin); /*k = 0; while(str[k] != '\0'){ if(str[k] == '\n'){ str[k] = '\0'; } k++; }*/ j = 0; w...
#include <stdio.h> int main(void) { char str[3000]; int i, j, k; int n; scanf("%d%*c", &n); for (i = 0; i < n; i++) { fgets(str, 3000, stdin); /*k = 0; while(str[k] != '\0'){ if(str[k] == '\n'){ str[k] = '\0'; } k++; }*/ j = 0; wh...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
0
206
2
#include <stdio.h> #include <string.h> int main(void) { int i, n; char *p; char a[1002]; // char word[]="hoshino" scanf("%d\n", &n); for (i = 0; i < n; i++) { fgets(a, sizeof(a), stdin); while ((p = strstr(a, "hoshino")) != NULL) { p[6] = 'a'; } printf("%s", a); } return 0; }
#include <stdio.h> #include <string.h> int main(void) { int i, n; char *p; char a[1002]; // char word[]="hoshino"; scanf("%d\n", &n); for (i = 0; i < n; i++) { fgets(a, sizeof(a), stdin); while ((p = strstr(a, "Hoshino")) != NULL) { p[6] = 'a'; } printf("%s", a); } return 0; }
[["-", 0, 11, 12, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 11, 12, 2, 3, 4, 0, 5, 0, 6]]
0
105
2
#include <stdio.h> #include <string.h> int main() { int n, i; char *p; char str[1007] = {}; scanf("%d", &n); while (n--) { fgets(str, sizeof(str), stdin); while ((p = strstr(str, "Hoshino")) != NULL) p[6] = 'a'; printf("%s", str); } return 0; }
#include <stdio.h> #include <string.h> int main() { int n, i; char *p; char str[1003]; scanf("%d\n", &n); while (n--) { fgets(str, sizeof(str), stdin); while ((p = strstr(str, "Hoshino")) != NULL) p[6] = 'a'; printf("%s", str); } return 0; }
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
95
6
#include <stdio.h> #include <string.h> int main() { char word[1111]; int n, i; scanf("%d", &n); for (i = 0; i < n; i++) { gets(word); for (;;) { if (strstr(word, "Hoshino") == 0) { break; } else { strncpy(strstr(word, "Hoshino"), "Hoshina", 7); } } printf("%s\n"...
#include <stdio.h> #include <string.h> int main() { char word[1111]; int n, i; scanf("%d\n", &n); for (i = 0; i < n; i++) { gets(word); for (;;) { if (strstr(word, "Hoshino") == 0) { break; } else { strncpy(strstr(word, "Hoshino"), "Hoshina", 7); } } printf("%s\...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
109
1
#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...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
295
2
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> using namespace std; int main() { int n, i, s, g; string a; cin >> n; for (g = 0; g < n; g++) { getline(cin, a); if (a == "") { g--; continue; } for (i = 6; i <= a.size(); i++) if (a[i - 6] == 'H' && a...
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> using namespace std; int main() { int n, i, s, g; string a; cin >> n; for (g = 0; g < n; g++) { getline(cin, a); if (a == "") { g--; continue; } for (i = 6; i <= a.size(); i++) if (a[i - 6] == 'H' && a...
[["-", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
184
2
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; fflush(stdin); while (N--) { char S[1001]; ...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; cin.ignore(); while (N--) { char S[1001]; ...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 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, 22]]
1
185
5