buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; #define pc(x) putchar(x) namespace ib { char b[100]; } inline void pi(int x) { if (x == 0) { pc(48); return; } if (x < 0) { pc('-'); x = -x; } char *s = ib::b; while (x) *(++s) = x % 10, x /= 10; while (s != ib::b) pc((*(s--)) + 48); } ...
#include <bits/stdc++.h> using namespace std; #define pc(x) putchar(x) namespace ib { char b[100]; } inline void pi(int x) { if (x == 0) { pc(48); return; } if (x < 0) { pc('-'); x = -x; } char *s = ib::b; while (x) *(++s) = x % 10, x /= 10; while (s != ib::b) pc((*(s--)) + 48); } ...
[["+", 0, 30, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 17, 48], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 13], ["-", 12, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 12, 2...
1
731
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #includ...
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #includ...
[["-", 0, 30, 0, 43, 49, 80, 81, 16, 31, 22], ["-", 0, 30, 0, 43, 49, 80, 81, 16, 17, 151], ["-", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 23, 0, 24], ["-", 0, 7, 15, 16, 12, 23, 0, 16, 31, 22], ["-", 0, 7, 15, 16, 12, 23, 0, 16, 17, 151], ["-", 0...
1
675
#include <cstdio> #define MOD 1000000007 #define MAXN 200000 #define D 2001 const int q = D + D + 1; int d[q][q]; int fact[q], invFact[q]; int a[MAXN + 1], b[MAXN + 1]; inline int lgput(int a, int n) { int r = 1; while (n) { if (n % 2) r = 1LL * a * r % MOD; n /= 2; a = 1LL * a * a % MOD; ...
#include <cstdio> #define MOD 1000000007 #define MAXN 200000 #define D 2001 const int q = D + D + 1; int d[q][q]; int fact[2 * q], invFact[2 * q]; int a[MAXN + 1], b[MAXN + 1]; inline int lgput(int a, int n) { int r = 1; while (n) { if (n % 2) r = 1LL * a * r % MOD; n /= 2; a = 1LL * a * a %...
[["+", 0, 30, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 17, 48], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, ...
1
550
#include <bits/stdc++.h> using namespace std; const int EXP = 2e3 + 3; const int DIM = 4e3 + 5; const int MOD = 1e9 + 7; pair<int, int> arr[DIM]; int fct[DIM], inv[DIM], dp[DIM][DIM]; inline int lgput(int x, int n) { if (n == 0) return 1; int y = lgput(x, n / 2); y = (1LL * y * y) % MOD; if (n % 2 == 1...
#include <bits/stdc++.h> using namespace std; const int EXP = 2e3 + 3; const int DIM = 4e3 + 5; const int MOD = 1e9 + 7; pair<int, int> arr[DIM * DIM]; int fct[DIM * 2], inv[DIM * 2], dp[DIM][DIM]; inline int lgput(int x, int n) { if (n == 0) return 1; int y = lgput(x, n / 2); y = (1LL * y * y) % MOD; ...
[["+", 0, 30, 0, 43, 49, 80, 81, 16, 17, 48], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 12, 22], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 31, 13], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 17, 72], ["-", ...
1
495
#include <algorithm> #include <cstdio> using namespace std; typedef long long ll; inline int read() { char ch = getchar(); int x = 0; while (ch < '0' || ch > '9') ch = getchar(); while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar(); return x; } const int N = 2e5 + 5; const int M = 400...
#include <algorithm> #include <cstdio> using namespace std; typedef long long ll; inline int read() { char ch = getchar(); int x = 0; while (ch < '0' || ch > '9') ch = getchar(); while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar(); return x; } const int N = 2e5 + 5; const int M = 400...
[["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0,...
1
673
#include <algorithm> #include <cstdio> using namespace std; #define S 2001 #define N 200200 #define mod 1000000007 #define rep(x, a, b) for (int x = a; x <= b; x++) #define drp(x, a, b) for (int x = a; x >= b; x--) int n, a[N], b[N], ans, f[2 * S + 10][2 * S + 10], fac[2 * S + 10], inv[2 * S + 10], v[2 * S + 10][2 ...
#include <algorithm> #include <cstdio> using namespace std; #define S 2001 #define N 200200 #define mod 1000000007 #define rep(x, a, b) for (int x = a; x <= b; x++) #define drp(x, a, b) for (int x = a; x >= b; x--) int n, a[N], b[N], ans, f[2 * S + 10][2 * S + 10], fac[4 * S + 10], inv[4 * S + 10]; void add(int &f,...
[["-", 0, 43, 49, 80, 81, 16, 31, 16, 31, 13], ["+", 0, 43, 49, 80, 81, 16, 31, 16, 31, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["-", 0, 43, 49, 80, 81, 16, 31, 16, 17, 48], ["-", 0, 43, 49, 80, 81, 16, 31, 16, 12, 22], ["-", 0, 30, 0, 43, 49, 80, 81, 16, 17, 72], ["-", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13], [...
1
520
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <typeinfo> #include <vector> #define syosu(x) fixed << setprecision(x) using namespace std; typed...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <typeinfo> #include <vector> #define syosu(x) fixed << setprecision(x) using namespace std; typed...
[["-", 0, 30, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 0, 30, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 37, 0, 11, 31, 69, 28, 22], ["+", 0, 37, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0,...
1
786
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<short, short> pii; const int MOD = 1e9 + 7; const int N = 8000 + 50; const int offset = 2000 + 10; int quick_inverse(LL n) { LL ret = 1; int exponent = MOD - 2; for (int i = exponent; i; i >>= 1, n = n * n % MOD) { if (i & 1) { ...
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<short, short> pii; const int MOD = 1e9 + 7; const int N = 8000 + 50; const int offset = 2000 + 10; LL quick_inverse(LL n) { LL ret = 1; int exponent = MOD - 2; for (int i = exponent; i; i >>= 1, n = n * n % MOD) { if (i & 1) { ...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 57, 64, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8,...
1
869
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include...
#include <algorithm> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 48], ["+", 12, 16, 31, 23...
1
689
#include <iostream> using namespace std; const int KMAX = 200000 + 5; const int N = 2000 + 5; const int MOD = 1000000000 + 7; const int INV2 = 500000000 + 4; int comb[4 * N][2 * N]; void precalc_comb() { for (int i = 0; i < 4 * N; ++i) { comb[i][0] = 1; for (int j = 1; j <= i && j < 2 * N; ++j) { co...
#include <iostream> using namespace std; const int KMAX = 200000 + 5; const int N = 2000 + 5; const int MOD = 1000000000 + 7; const int INV2 = 500000000 + 4; int comb[4 * N][2 * N]; void precalc_comb() { for (int i = 0; i < 4 * N; ++i) { comb[i][0] = 1; for (int j = 1; j <= i && j < 2 * N; ++j) { co...
[["+", 8, 9, 0, 1, 0, 2, 63, 343, 345, 348], ["+", 8, 9, 0, 1, 0, 2, 63, 343, 0, 349], ["+", 8, 9, 0, 1, 0, 2, 63, 343, 141, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 147], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35...
1
484
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #pragma comment(linker, "/STACK:102400000,102400000") using namespace std; #define LL long long #define ULL unsigned long l...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #pragma comment(linker, "/STACK:102400000,102400000") using namespace std; #define LL long long #define ULL unsigned long l...
[["+", 3, 4, 0, 16, 31, 16, 31, 16, 31, 13], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 17, 48], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 85], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 48], ["+", 3, 4, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 31, 16, 12, 2, 3...
1
525
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define repd(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) r...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define repd(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) r...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["-", 0, 57, 15, 339...
1
608
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; int ncr[4005][4005]; int dp[4005][4005]; int a[200005]; int b[200005]; int ans, n; int main() { ncr[0][0] = 1; for (int i = 1; i < 4002; i++) { ncr[i][0] = ncr[i][i] = 1; for (int j = 1; j < i; j++) ncr[i][j] = (ncr[i - 1][j ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; int ncr[8005][8005]; int dp[4005][4005]; int a[200005]; int b[200005]; int ans, n; int main() { ncr[0][0] = 1; for (int i = 1; i < 8002; i++) { ncr[i][0] = ncr[i][i] = 1; for (int j = 1; j < i; j++) ncr[i][j] = (ncr[i - 1][j ...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 28, 69, 28, 69, 341, 342, 0, 16, 31, 13], ["+", 2...
1
398
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define all(X) (X).begin(), (X).end() using namespace std; typedef long long int ll; typedef pair<int, int> P; template <c...
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) #define all(X) (X).begin(), (X).end() using namespace std; typedef long long int ll; typedef pair<int, int> P; template <c...
[["+", 0, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 48], ["+", 12, 16, 31, 23, 0, 16, 12, 2, 63, 22], ["+", 31, 23, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 31, 23, 0, 16, 12, 2, 3, 4, 0, 25], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1...
1
735
#include <bits/stdc++.h> using namespace std; const int N = 2010; const int MOD = 1e9 + 7; long long p[2 * N][2 * N]; long long C[4 * N][2 * N]; int main() { for (int i = 0; i < 4 * N; i++) for (int j = 0; j <= min(i, 2 * N); j++) if (i == j) C[i][j] = 1; else if (j == 0) C[i][j] = 1; ...
#include <bits/stdc++.h> using namespace std; const int N = 2010; const int MOD = 1e9 + 7; int p[2 * N][2 * N]; int C[4 * N][2 * N]; int main() { for (int i = 0; i < 4 * N; i++) for (int j = 0; j <= min(i, 2 * N - 1); j++) if (i == j) C[i][j] = 1; else if (j == 0) C[i][j] = 1; el...
[["-", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 15, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 15, 16, 12, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 31, 13], ["+", 31, 16, ...
1
478
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator>...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator>...
[["-", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 1, 0, 11,...
1
613
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, b, a) for (int i = (b)-1; i >= (a); i--) #define ITER(it, a) for (typeof(a.begin()) it = a.begin(); it != a.end(); it++) #define FILL(a, value) memset(a, value, sizeof(a)) #define SZ(a) (int)a.size() #de...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, b, a) for (int i = (b)-1; i >= (a); i--) #define ITER(it, a) for (typeof(a.begin()) it = a.begin(); it != a.end(); it++) #define FILL(a, value) memset(a, value, sizeof(a)) #define SZ(a) (int)a.size() #de...
[["+", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 0, 73], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 3...
1
865
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 7; int tr[4 * N]; void update(int u, int st, int en, int idx, int x) { if (st == en) tr[u] = x; else { int mid = (st + en) / 2; if (idx <= mid) update(2 * u, st, mid, idx, x); else update(2 * u + 1, mid + 1, en, idx, x);...
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 7; int tr[4 * N]; void update(int u, int st, int en, int idx, int x) { if (st == en) tr[u] = x; else { int mid = (st + en) / 2; if (idx <= mid) update(2 * u, st, mid, idx, x); else update(2 * u + 1, mid + 1, en, idx, x);...
[["-", 0, 30, 0, 14, 8, 9, 0, 338, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 338, 0, 102], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 14, 8, 9, 0, ...
1
608
#include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <vector> #define PB push_back using namespace std; const int N = 5e5 + 500; const int OFF = (1 << 19); int n, k, P[N], Q[N], T[2 * OFF], sol[N]; inline int miin(int x, int y) { if (Q[x] < Q[y]) return x; return y; } void ...
#include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <vector> #define PB push_back using namespace std; const int N = 5e5 + 500; const int OFF = (1 << 19); int n, k, P[N], Q[N], T[2 * OFF], sol[N]; inline int miin(int x, int y) { if (Q[x] < Q[y]) return x; return y; } void ...
[["+", 49, 50, 51, 2, 3, 4, 0, 2, 63, 22], ["+", 51, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 51, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 51, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
627
#include <cstdio> #include <cstring> #define N 1048576 inline int min(int x, int y) { return x < y ? x : y; } inline int max(int x, int y) { return x < y ? y : x; } char G[3500000], *H = G; inline int read() { int x = 0; while (*H < 48 || 57 < *H) H++; while (47 < *H && *H < 58) x = (x << 1) + (x << 3) + ...
#include <cstdio> #include <cstring> #define N 1048576 inline int min(int x, int y) { return x < y ? x : y; } inline int max(int x, int y) { return x < y ? y : x; } char G[3500000], *H = G; inline int read() { int x = 0; while (*H < 48 || 57 < *H) H++; while (47 < *H && *H < 58) x = (x << 1) + (x << 3) + ...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
928
#include <bits/stdc++.h> using namespace std; const int N = 2e6 + 5; int p[N], a[N], b[N]; struct node { int l, r, mid, mn; } s[N << 2]; void build(int di, int l, int r) { s[di].l = l, s[di].r = r, s[di].mid = l + r >> 1, s[di].mn = 1e9; if (l == r) return; build(di << 1, l, s[di].mid), build(di << 1 | 1, s...
#include <bits/stdc++.h> using namespace std; const int N = 2e6 + 5; int p[N], a[N], b[N]; struct node { int l, r, mid, mn; } s[N << 2]; void build(int di, int l, int r) { s[di].l = l, s[di].r = r, s[di].mid = l + r >> 1, s[di].mn = 1e9; if (l == r) return; build(di << 1, l, s[di].mid), build(di << 1 | 1, s...
[["+", 0, 30, 0, 43, 39, 344, 3, 347, 0, 21], ["+", 39, 344, 3, 347, 0, 77, 39, 344, 141, 78], ["+", 3, 347, 0, 77, 39, 344, 3, 347, 0, 18], ["+", 0, 77, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 3, 347, 0, 77, 39, 344, 3, 347, 0, 47], ["+", 0, 30, 0, 43, 39, 344, 3, 347, 0, 47], ["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33],...
1
853
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 10, inf = 1e8; int n, nn, k, a[N], b[N], cnt, ans[N]; bool mark[N]; int seg[N << 2]; priority_queue<int> s; void upd(int p, int val) { p += nn, seg[p] = val, p /= 2; for (; p > 0; p /= 2) seg[p] = max(seg[p * 2], seg[p * 2 + 1]); return; } int ...
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 10, inf = 1e8; int n, nn, k, a[N], b[N], cnt, ans[N]; bool mark[N]; int seg[N << 2]; priority_queue<int> s; void upd(int p, int val) { p += nn, seg[p] = val, p /= 2; for (; p > 0; p /= 2) seg[p] = max(seg[p * 2], seg[p * 2 + 1]); return; } int ...
[["+", 8, 9, 0, 1, 0, 34, 31, 11, 31, 22], ["+", 8, 9, 0, 1, 0, 34, 31, 11, 17, 32], ["+", 0, 1, 0, 34, 31, 11, 12, 2, 63, 22], ["+", 0, 34, 31, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 34, 31, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 34, 31, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 34, 31, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 34, 31, 11, 12,...
1
568
#include <bits/stdc++.h> #define itr(i, n) for (int i = 1; i <= n; ++i) using namespace std; const int SIZE = 5e5 + 1; vector<int> num_arr(SIZE), idx_arr(SIZE); stack<int> s, t; int memo[SIZE]; int n, k; void NIT() { // Num Index Transform 数とインデックスを入れ替える itr(i, n) //両方とも要素を1からnにする idx_arr[num_arr[i]] = i; } vo...
#include <bits/stdc++.h> #define itr(i, n) for (int i = 1; i <= n; ++i) using namespace std; const int SIZE = 5e5 + 1; vector<int> num_arr(SIZE), idx_arr(SIZE); stack<int> s, t; int memo[SIZE]; int n, k; void NIT() { // Num Index Transform 数とインデックスを入れ替える itr(i, n) //両方とも要素を1からnにする idx_arr[num_arr[i]] = i; } vo...
[["-", 15, 339, 51, 91, 28, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 91, 28, 2, 63, 118, 28, 22], ["-", 0, 1, 0, 11, 12, 2, 63, 118, 28, 22], ["+", 0, 1, 0, 11, 12, 2, 63, 118, 28, 22], ["+", 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], ["+", 8, 9,...
1
425
// Written by newbiechd #include <algorithm> #include <cassert> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> // Delete the debugging information! #define debug(x) std::cerr << #x << " = " << x << std::endl; const int BUFFER_SIZE = 1 << 25 | 1; struct InputOutputStream { ...
// Written by newbiechd #include <algorithm> #include <cassert> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> // Delete the debugging information! #define debug(x) std::cerr << #x << " = " << x << std::endl; const int BUFFER_SIZE = 1 << 25 | 1; struct InputOutputStream { ...
[["+", 0, 34, 31, 2, 3, 4, 0, 69, 28, 22], ["+", 31, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 31, 2, 3, 4, 0, 69, 341, 342, 0, 73], ["+", 12, 27, 28, 69, 341, 342, 0, 69, 28, 22], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 0, 34, 12, 27, 28, 69, 341, 342, 0, 73], ["-", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["-",...
1
934
// IOI 2021 #include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second typedef long long ll; typedef pair<int, int> pii; const int MAXN = 5 * 100 * 1000 + 17; int n, k, a[MAXN], seg[MAXN << 2], p[MAXN]; set<int> s; void upd(int pos, int v = 1, int l = 1, int r = n + 1) { ...
// IOI 2021 #include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second typedef long long ll; typedef pair<int, int> pii; const int MAXN = 5 * 100 * 1000 + 17; int n, k, a[MAXN], seg[MAXN << 2], p[MAXN]; set<int> s; void upd(int pos, int v = 1, int l = 1, int r = n + 1) { ...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 8, 9, 0, 7, 10,...
1
739
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> typedef long long ll; #define Ls (u << 1) #define Rs (u << 1 | 1) #define inc(i) (++(i)) #define dec(i) (--(i)) #define Rep(i, a, b) for (int i = (a), i##Limit = (b); i <= i##Limit; inc(i)) #define rep(i, a,...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> typedef long long ll; #define Ls (u << 1) #define Rs (u << 1 | 1) #define inc(i) (++(i)) #define dec(i) (--(i)) #define Rep(i, a, b) for (int i = (a), i##Limit = (b); i <= i##Limit; inc(i)) #define rep(i, a,...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 13], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73], [...
1
690
#include <bits/stdc++.h> using namespace std; typedef int ll; typedef long long int li; const ll MAXN = 1e6 + 51, inf = 0x3f3f3f3f; struct Edge { ll to, prev; }; struct SegmentTree { ll l, r, minn; }; Edge ed[MAXN]; SegmentTree tree[MAXN << 2]; priority_queue<ll, vector<ll>, greater<ll>> q; ll cnt, tot, kk, x, ptr;...
#include <bits/stdc++.h> using namespace std; typedef int ll; typedef long long int li; const ll MAXN = 1e6 + 51, inf = 0x3f3f3f3f; struct Edge { ll to, prev; }; struct SegmentTree { ll l, r, minn; }; Edge ed[MAXN << 1]; SegmentTree tree[MAXN << 2]; priority_queue<ll, vector<ll>, greater<ll>> q; ll cnt, tot, kk, x,...
[["+", 0, 30, 0, 43, 49, 80, 81, 16, 17, 151], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 12, 11, 31, 69, 341, 342, 0, 27, 28, 22], ["-", 12, 11, 31, 69, 341, 342, 0, 27, 17, 29], ["+", 12, 34, 12, 11, 31, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 34, 12, 34, 12, 11, 12, 22], ["+", 0, 34, 12, 34, 12, 11, 12, 27, 17,...
1
1,074
#include <bits/stdc++.h> using namespace std; const int N = 500010; int gi() { int f = 0; char ch = getchar(); while (ch < '0' || ch > '9') ch = getchar(); while (ch >= '0' && ch <= '9') f = f * 10 + ch - 48, ch = getchar(); return f; } int n, k, p[N], a[N]; struct node { int mn; } s[N << 2]; void p...
#include <bits/stdc++.h> using namespace std; const int N = 500010; int gi() { int f = 0; char ch = getchar(); while (ch < '0' || ch > '9') ch = getchar(); while (ch >= '0' && ch <= '9') f = f * 10 + ch - 48, ch = getchar(); return f; } int n, k, p[N], a[N]; struct node { int mn; } s[N << 2]; void p...
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-...
1
997
/* mail: mleautomaton@foxmail.com author: MLEAutoMaton This Code is made by MLEAutoMaton */ #include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> using namespace std; #define ll long long #define REP(a, ...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> using namespace std; #define ll long long #define REP(a, b, c) for (int a = b; a <= c; a++) #define re register #define file(a) ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["-", 8, 57, 64, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 57, 64, 1, 0, 2, 63, 118, 28, 22], ["-", 15, 339, 51, 91, 28, 2, 63, 118, 28, 22], ["+", 15,...
1
813
#include "bits/stdc++.h" #define MOD 1000000007 #define inf 0x3f3f3f3f #define pi acos(-1.0) #define ri register int #define Abs(x) ((x) < 0 ? (-(x)) : (x)) #define ls (cur << 1) #define rs (cur << 1 | 1) #define mid ((l + r) >> 1) const int maxn = 5e5 + 10; inline int Max(int a, int b) { return a > b ? a : b; } inline...
#include "bits/stdc++.h" #define MOD 1000000007 #define inf 0x3f3f3f3f #define pi acos(-1.0) #define ri register int #define Abs(x) ((x) < 0 ? (-(x)) : (x)) #define ls (cur << 1) #define rs (cur << 1 | 1) #define mid ((l + r) >> 1) const int maxn = 5e5 + 10; inline int Max(int a, int b) { return a > b ? a : b; } inline...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 36, 36, 0, 30, 0, 43, 39, 343, 345, 348], ["-", 36, 36, 0, 30, 0, 43, 39, 343, 0, 349], ["-", 0, 30, 0, 43, 39, 343, 141, 344, 141, 78], ["-", 0, 43, 39, 343, 141, 344, 3, 347, 0, 18], ["-", 39, 343, 141, 344, 3, 347, 0, 77, 39, 40], ["-", 0, 43, 39, 343, 141, 344, 3, ...
1
916
#include <bits/stdc++.h> #define Inf 0x3f3f3f3f #define rg register #define lson x << 1, l, mid #define rson x << 1 | 1, mid + 1, r using namespace std; typedef long long ll; inline ll min(ll x, ll y) { return x < y ? x : y; } inline ll max(ll x, ll y) { return x > y ? x : y; } const int Maxn = 5e5 + 5; inline int read...
#include <bits/stdc++.h> #define Inf 0x3f3f3f3f #define rg register #define lson x << 1, l, mid #define rson x << 1 | 1, mid + 1, r using namespace std; typedef long long ll; inline ll min(ll x, ll y) { return x < y ? x : y; } inline ll max(ll x, ll y) { return x > y ? x : y; } const int Maxn = 5e5 + 5; inline int read...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
925
#include <bits/stdc++.h> using namespace std; using P = pair<int, int>; template <class E> using Graph = vector<vector<E>>; vector<bool> used; Graph<int> gv; vector<P> ge; int dfs(int u, int d, int K) { int res = (d > K / 2); for (auto &&v : gv[u]) { if (used[v]) continue; used[v] = true; res +=...
#include <bits/stdc++.h> using namespace std; using P = pair<int, int>; template <class E> using Graph = vector<vector<E>>; vector<bool> used; Graph<int> gv; vector<P> ge; int dfs(int u, int d, int K) { int res = (d > K / 2); for (auto &&v : gv[u]) { if (used[v]) continue; used[v] = true; res +=...
[["+", 31, 2, 3, 4, 0, 118, 28, 69, 28, 22], ["+", 3, 4, 0, 118, 28, 69, 341, 342, 0, 70], ["+", 3, 4, 0, 118, 28, 69, 341, 342, 0, 73], ["+", 0, 16, 31, 2, 3, 4, 0, 118, 17, 131], ["+", 0, 16, 31, 2, 3, 4, 0, 118, 119, 120], ["+", 3, 4, 0, 16, 31, 2, 3, 4, 0, 21], ["+", 3, 4, 0, 16, 31, 2, 3, 4, 0, 13], ["+", 0, 16, 3...
1
323
#include <bits/stdc++.h> using namespace std; struct P { // string r; int x, y, z; bool operator<(const P &a) const { // if(y!=a.y) // return y>a.y; return x < a.x; // return z>a.z; } }; vector<int> v[5555]; // bitset<4001000> b; int a, c, i, b, k, d, n, m, e[10][10][10]; // dy[15]=...
#include <bits/stdc++.h> using namespace std; struct P { // string r; int x, y, z; bool operator<(const P &a) const { // if(y!=a.y) // return y>a.y; return x < a.x; // return z>a.z; } }; vector<int> v[5555]; // bitset<4001000> b; int a, c, i, b, k, d, n, m, e[10][10][10]; // dy[15]=...
[["-", 0, 7, 8, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 7, 10, 43, 49, 50, 51, 13], ["-", 75, 76, 0, 7, 8, 7, 15, 16, 17, 19], ["+", 75, 76, 0, 7, 8, 7, 15, 16, 17, 18], ["-", 8, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 7, 8, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 7, 8, 7, 8, 9, 0, 57, 0, 121], ["-", 8, 7, 8, 9, 0, 57, 15, ...
1
835
#include <cstdio> #include <cstring> #include <iostream> #define MN 2000 using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = ge...
#include <cstdio> #include <iostream> #define MN 2000 using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } retu...
[["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["-", 8, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 1...
1
542
#include <cstdio> #include <cstring> #include <iostream> using namespace std; const int MAXN = 2020; int f[MAXN][MAXN], dep[MAXN], first[MAXN], son[MAXN]; class Edges { public: int next, to; }; Edges edge[MAXN * 2]; int n, k, te = 0; void add(int s, int t) { ++te; edge[te].to = t; edge[te].next = first[s]; ...
#include <cstdio> #include <cstring> #include <iostream> using namespace std; const int MAXN = 2020; int f[MAXN][MAXN], dep[MAXN], first[MAXN], son[MAXN]; class Edges { public: int next, to; }; Edges edge[MAXN * 2]; int n, k, te = 0; void add(int s, int t) { ++te; edge[te].to = t; edge[te].next = first[s]; ...
[["-", 0, 7, 15, 16, 31, 16, 12, 69, 28, 22], ["-", 15, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 15, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["-", 15, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 98], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 19]]
1
729
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define PB push_back #define MP make_pair #define MOD 1000000007 #define INF 1000000007 #define FOR(i, a, b) for (int i = (a); (i) < (b); (i)++) typedef unsigned int UI; typedef long long LL; typedef pair<int,...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define PB push_back #define MP make_pair #define MOD 1000000007 #define INF 1000000007 #define FOR(i, a, b) for (int i = (a); (i) < (b); (i)++) typedef unsigned int UI; typedef long long LL; typedef pair<int,...
[["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 69, 28, 6...
1
460
#include <bits/stdc++.h> #define pb push_back #define fs first #define sc second #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<double> vd; typedef pair<int, int> pii; typedef vector<pii> vpii...
#include <bits/stdc++.h> #define pb push_back #define fs first #define sc second #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<double> vd; typedef pair<int, int> pii; typedef vector<pii> vpii...
[["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 22], ["+", 8, 57, 64, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, ...
1
464
#include <bits/stdc++.h> const int N = 2005; using namespace std; int n, c, d[N], mx, cnt, mark, res; struct edge { int u, v, nxt; } e[N << 1]; int tail, adj[N]; void addedge(int u, int v) { e[++tail] = (edge){u, v, adj[u]}; adj[u] = tail; } void dfs(int u, int fa) { for (int k = adj[u]; k != -1; k = e[k]...
#include <bits/stdc++.h> const int N = 2005; using namespace std; int n, c, d[N], cnt, mark, res; struct edge { int u, v, nxt; } e[N << 1]; int tail, adj[N]; void addedge(int u, int v) { e[++tail] = (edge){u, v, adj[u]}; adj[u] = tail; } void dfs(int u, int fa) { for (int k = adj[u]; k != -1; k = e[k].nxt...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 15, 339, 51, 16, 12, 16, 12, 23, 0, 24], ["+", 51, 16, 12, 16, 12, 23, 0, 16, 31, 22...
1
423
#include <bits/stdc++.h> const int N = 2005; using namespace std; int n, c, d[N], cnt, mark, res; struct edge { int u, v, nxt; } e[N << 1]; int tail, adj[N]; void addedge(int u, int v) { e[++tail] = (edge){u, v, adj[u]}; adj[u] = tail; } void dfs(int u, int fa) { for (int k = adj[u]; k != -1; k = e[k].nxt...
#include <bits/stdc++.h> const int N = 2005; using namespace std; int n, c, d[N], cnt, res; struct edge { int u, v, nxt; } e[N << 1]; int tail, adj[N]; void addedge(int u, int v) { e[++tail] = (edge){u, v, adj[u]}; adj[u] = tail; } void dfs(int u, int fa) { for (int k = adj[u]; k != -1; k = e[k].nxt) { ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["-", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 8...
1
427
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; #define ref(i, x, y) for (int i = x; i <= y; ++i) #define eef(i, x) \ for (int i = head[x], y = e[i].to; i; i = e[i].next, y = e[i].to) \ if (y != fa) typedef lon...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; #define ref(i, x, y) for (int i = x; i <= y; ++i) #define eef(i, x) \ for (int i = head[x], y = e[i].to; i; i = e[i].next, y = e[i].to) \ if (y != fa) typedef lon...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 28, 69, 28, 2, 3, 4, 0, 16, 31, 22], ["-", 28, 69, 28, 2, 3, 4, 0, 16, 17, 33], ["-", 28, 69, 28, 2, 3, 4, 0, 16, 12, 13], ["+", 31, 69, 28, 69, 28, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 11, 31, 69, 28...
1
582
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2000 + 10; vector<int> vt[N]; int a[N], b[N], n, k, cnt; void DFS(int u, int fa, int l) { if (l > k / 2) cnt++; for (int i = 0; i < vt[u].size(); i++) { if (vt[u][i] == fa) continue; DFS(vt[u][i], u, l + 1); } } in...
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2000 + 10; vector<int> vt[N]; int a[N], b[N], n, k, cnt; void DFS(int u, int fa, int l) { if (l > k / 2) cnt++; for (int i = 0; i < vt[u].size(); i++) { if (vt[u][i] == fa) continue; DFS(vt[u][i], u, l + 1); } } in...
[["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ...
1
336
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; const int MAXN = 2010; int n, K, e, Begin[MAXN], ans; int to[MAXN << 1], Next[MAXN << 1]; int fa[MAXN]; inline int read() { int x = 0, f = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; const int MAXN = 2010; int n, K, e, Begin[MAXN], ans; int to[MAXN << 1], Next[MAXN << 1]; int fa[MAXN]; inline int read() { int x = 0, f = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;...
[["-", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 9, 0, ...
1
485
#pragma GCC optimize("O3") #pragma GCC target("avx") #include "bits/stdc++.h" // define macro "/D__MAI" using namespace std; typedef long long int ll; #define xprintf(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__) #define debugv(v) \ { ...
#pragma GCC optimize("O3") #pragma GCC target("avx") #include "bits/stdc++.h" // define macro "/D__MAI" using namespace std; typedef long long int ll; #define xprintf(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__) #define debugv(v) \ { ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 2, 3, 4, 0, 16, 12, 2, 63, 22], ["+", 3, 4, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 3, 4, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 3, 4, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 3, 4, 0, 16, 12, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25]]
1
1,257
#include <bits/stdc++.h> #define pb push_back #define mp make_pair using namespace std; vector<int> g[2222]; int d[2222][2222]; int n, k; void dfs(int u, int s, int p) { for (int i = 0; i < g[u].size(); ++i) { int v = g[u][i]; if (v != p) d[s][v] = d[s][u] + 1, dfs(v, s, u); } } int main() { fr...
#include <bits/stdc++.h> #define pb push_back #define mp make_pair using namespace std; vector<int> g[2222]; int d[2222][2222]; int n, k; void dfs(int u, int s, int p) { for (int i = 0; i < g[u].size(); ++i) { int v = g[u][i]; if (v != p) d[s][v] = d[s][u] + 1, dfs(v, s, u); } } int main() { //...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
420
#include <algorithm> #include <assert.h> #include <cmath> #include <iostream> #include <map> #include <memory.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <vector> using namespace std; typed...
#include <algorithm> #include <assert.h> #include <cmath> #include <iostream> #include <map> #include <memory.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <vector> using namespace std; typed...
[["-", 0, 7, 8, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 7, 8, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 7, 8, 57, 64, 9, 0, 45], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 12, 13], ["+", 0, 7, 8, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 57, 64, 9, 0, 93, 0, 35], ["+", 8, 9, 0, 7, 8, ...
1
879
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <str...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <str...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 105, 51, 74, 51, 66, 28, 23, 0, 24], ["+", 51, 74, 51, 66, 28, 23, 0, 16, 17, 72], ["+", 51, 74, 51, 66, 28, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3...
1
909
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; int inf = 214748364, n, k, ans = inf, d[4000]; vector<int> g[4000]; queue...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; int inf = 214748364, n, k, ans = inf, d[4000]; vector<int> g[4000]; queue...
[["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 14, 8, 9, 0, 7, 15...
1
558
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; int inf = 214748364, n, k, ans = inf, qsz, d[4000], q[4000]; vector<int> ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; int inf = 214748364, n, k, ans = inf, qsz, d[4000], q[4000]; vector<int> ...
[["+", 15, 339, 51, 16, 12, 69, 28, 69, 28, 22], ["+", 51, 16, 12, 69, 28, 69, 341, 342, 0, 70], ["+", 51, 16, 12, 69, 28, 69, 341, 342, 0, 22], ["+", 51, 16, 12, 69, 28, 69, 341, 342, 0, 73], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 73], ["+", 0, 2, 3, 4, 0, 69, 28, ...
1
516
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <memory.h> #include <numeric> #inclu...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <memory.h> #include <numeric> #inclu...
[["-", 64, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["-", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 57, 64, 9, 0, 7, 10, 43, 0, 35], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18], ["+", 8, 9, 0, 57, 64, 9, 0, 338, 0, 102], ["-", 0, 7, 15, 16, 12, 2, 63, 118, 17, 131], ["-", 0, 7, 15,...
1
353
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iostream> #include <map> #include <memory.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <u...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iostream> #include <map> #include <memory.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <u...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 75, 76, 0, 37, 0, 13], ["+", 8, 9, 0, 57, 75, 76, 0, 37, 0, 13], ["-", 0, 7, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 7, 8, 9, 0...
1
427
/* _ _ _______ _ _ | | / / | _____| | | / / | | / / | | | | / / | |/ / | |_____ | |/ / | |\ \ | _____| | |\ \ | | \ \ | | | | \ \ | | \ \ | |_____ | | \ \ |_| \_\ |_______| |_| \_\ */ /*#include <iostream> #include <algorithm> #include <assert.h>*/ #include <cmath> #incl...
/* _ _ _______ _ _ | | / / | _____| | | / / | | / / | | | | / / | |/ / | |_____ | |/ / | |\ \ | _____| | |\ \ | | \ \ | | | | \ \ | | \ \ | |_____ | | \ \ |_| \_\ |_______| |_| \_\ */ /*#include <iostream> #include <algorithm> #include <assert.h>*/ #include <cmath> #incl...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
443
#include <iostream> #include <utility> #include <vector> using namespace std; int dfs(int now, int depth, vector<vector<int>> &adjlist, vector<bool> &used) { if (depth <= 0) { return 1; } int count = 1; for (int i = 0; i < (int)adjlist[now].size(); i++) { if (!used[adjlist[now][i]]) { used[adjlis...
#include <iostream> #include <utility> #include <vector> using namespace std; int dfs(int now, int depth, vector<vector<int>> &adjlist, vector<bool> &used) { used[now] = true; if (depth <= 0) { return 1; } int count = 1; for (int i = 0; i < (int)adjlist[now].size(); i++) { if (!used[adjlist[now][i]])...
[["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 146], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 64, 9, 0, 1, ...
1
411
#include <cstdio> #include <queue> #include <vector> using namespace std; const int N = 2010; const int INF = 0x3f3f3f3f; vector<int> adj[N]; int dist[N]; queue<int> q; int main() { int n, k; scanf("%d %d", &n, &k); for (int i = 0; i < n - 1; i++) { int a, b; scanf("%d%d", &a, &b); adj[a].push_ba...
#include <cstdio> #include <queue> #include <vector> using namespace std; const int N = 2010; const int INF = 0x3f3f3f3f; vector<int> adj[N]; int dist[N]; queue<int> q; int main() { int n, k; scanf("%d %d", &n, &k); for (int i = 0; i < n - 1; i++) { int a, b; scanf("%d%d", &a, &b); adj[a].push_ba...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 22], ["+", 0, 43, 49, 50, 5...
1
549
#include <algorithm> #include <cstdio> #include <vector> using namespace std; vector<int> v[2048]; int nr = 0; bool ap[2048]; void dfs(int nod, int dist) { if (ap[nod]) return; ++nr; ap[nod] = true; if (!dist) return; for (auto &it : v[nod]) if (!ap[it]) dfs(it, dist - 1); } int main()...
#include <algorithm> #include <cstdio> #include <vector> using namespace std; vector<int> v[2048]; int nr = 0; bool ap[2048]; void dfs(int nod, int dist, int tata) { if (!ap[nod]) ++nr; ap[nod] = true; if (!dist) return; for (auto &it : v[nod]) if (it != tata) dfs(it, dist - 1, nod); } i...
[["+", 0, 30, 0, 14, 49, 53, 54, 55, 0, 21], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 38], ["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 35], ["-", 0, 338, 8, 57, 15, 339, 51, 91, 17, 111], ["-", 8...
1
346
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(n) for (int i = 0; i < n; i++) #define repp(j, n) for (int j = 0; j < n; j++) #define reppp(i, m, n) for (int i ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(n) for (int i = 0; i < n; i++) #define repp(j, n) for (int j = 0; j < n; j++) #define reppp(i, m, n) for (int i ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 90], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, ...
1
428
#include <bits/stdc++.h> using namespace std; #define PI acos(-1) #define fi first #define se second #define pb push_back #define sz(a) (int)(a).size() #define all(c) (c).begin(), (c).end() #define TIMESTAMP \ fprintf(stderr, "Execution time: %.3lf s.\n", ...
#include <bits/stdc++.h> using namespace std; #define PI acos(-1) #define fi first #define se second #define pb push_back #define sz(a) (int)(a).size() #define all(c) (c).begin(), (c).end() #define TIMESTAMP \ fprintf(stderr, "Execution time: %.3lf s.\n", ...
[["+", 75, 76, 0, 9, 0, 1, 0, 27, 28, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 6...
1
629
/*{{{*/ //#pragma GCC optimize("O3") #include <bits/stdc++.h> #ifdef __linux__ #define getchar getchar_unlocked #define putchar putchar_unlocked #endif typedef long long ll; typedef std::pair<int, int> pii; std::string Name = __FILE__; std::string iput = Name.substr(0, Name.length() - 4) + ".in"; std::string oput ...
/*{{{*/ //#pragma GCC optimize("O3") #include <bits/stdc++.h> #ifdef __linux__ #define getchar getchar_unlocked #define putchar putchar_unlocked #endif typedef long long ll; typedef std::pair<int, int> pii; std::string Name = __FILE__; std::string iput = Name.substr(0, Name.length() - 4) + ".in"; std::string oput ...
[["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 57, 64, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 64, 7, 15, 16, 12, 2, 63, 118, 28, 22], ["+", 64, 7, 15, 16, 12, 2, 63, 118, 17, 131], ["+", 64, 7, 15, 16, 12, 2, 63, 118, 119, 120], ["+",...
1
712
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } struct edge { ...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } struct edge { ...
[["+", 8, 9, 0, 1, 0, 11, 31, 118, 119, 120], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 1, 0, 11, 31, 118, 28, 69, 28, 22], ["+", 0, 11, 31, 118, 28, 69, 341, 342, 0, 70], ["+", 0, 11, 31, 118, 28, 69, 341, 342, 0, 22], ["+", 0, 11...
1
497
#include <bits/stdc++.h> #define FOR(i, a, b) for (ll i = (a); i < (ll)(b); i++) #define REP(i, n) FOR(i, 0, n) #define YYS(x, arr) for (auto &x : arr) #define ALL(x) (x).begin(), (x).end() #define SORT(x) sort((x).begin(), (x).end()) #define REVERSE(x) reverse((x).begin(), (x).end()) #define UNIQUE(x) (x).erase(uniqu...
#include <bits/stdc++.h> #define FOR(i, a, b) for (ll i = (a); i < (ll)(b); i++) #define REP(i, n) FOR(i, 0, n) #define YYS(x, arr) for (auto &x : arr) #define ALL(x) (x).begin(), (x).end() #define SORT(x) sort((x).begin(), (x).end()) #define REVERSE(x) reverse((x).begin(), (x).end()) #define UNIQUE(x) (x).erase(uniqu...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
702
#include <bits/stdc++.h> #define N 2002 #define PB push_back #define MP make_pair #define F first #define S second using namespace std; int n, m, k, i, j, l, r, t, fix[N], fox[N], a[N][N], d, ans, w, pro[N][N], fex[N]; vector<int> v[N]; pair<int, int> p; queue<pair<int, int>> q; int main() { cin >> n >> k; ans ...
#include <bits/stdc++.h> #define N 2002 #define PB push_back #define MP make_pair #define F first #define S second using namespace std; int n, m, k, i, j, l, r, t, fix[N], fox[N], a[N][N], d, ans, w, pro[N][N], fex[N]; vector<int> v[N]; pair<int, int> p; queue<pair<int, int>> q; int main() { cin >> n >> k; ans ...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 57, 64, 9, 0, 57, 64, 1, 0, 35], ["-", 0, 57, 64, 9, 0, 57, 75, 76, 0, 95], ["-", 75, 76, 0, 1, 0, 2, 63, 118, 28, 22], ["-", 75, 76, 0, 1, 0, 2, 63, 118, 17, 131], ["-", 75, 76, 0, 1, 0, 2, 63,...
1
647
#include <algorithm> #include <iostream> #include <vector> using namespace std; const int NMAX = 2000 + 5; int n, k; int h[NMAX]; int sz[NMAX]; int dp[NMAX][NMAX]; // dp[node][h] = numarul minim de noduri care trebuie // eliminate pentru a obtine inaltimea maxim h in // subar...
#include <algorithm> #include <iostream> #include <vector> using namespace std; const int NMAX = 2000 + 5; int n, k; int h[NMAX]; int sz[NMAX]; int dp[NMAX][NMAX]; // dp[node][h] = numarul minim de noduri care trebuie // eliminate pentru a obtine inaltimea maxim h in // subar...
[["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 98], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 19], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22], ["+", 0, 7, 15, 16, 12, 16, 12, 69, 28, 22], ["+", 15, 16, 12, 16, 12, 69, 341, 342, 0, 70], ["+", 15, 16, 12, 16, 12, 69, 341, 342, 0, 22], ["+", 15...
1
600
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pii; typedef pair<ll, ll> pll; typedef vector<ll> vii; typedef vector<ll> vll; #define X first #define Y second #define rep(i, n) for (ll i = 0; i < (n); i++) #define repp(i, a, b) for (ll i = a; i <= (b); i++) #define repp2(i, b...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pii; typedef pair<ll, ll> pll; typedef vector<ll> vii; typedef vector<ll> vll; #define X first #define Y second #define rep(i, n) for (ll i = 0; i < (n); i++) #define repp(i, a, b) for (ll i = a; i <= (b); i++) #define repp2(i, b...
[["+", 8, 9, 0, 338, 8, 9, 0, 57, 0, 121], ["+", 0, 338, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 338, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["+", 0, 57, ...
1
509
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #includ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 1, 0, 16, 31, 16, 12, 23, 0, 24], ["-", 31, 16, 12, 23, 0, 41, 15, 23, 0, 24], ["-", 12, 23, 0, 41, 15, 23, 0, 16, 17, 20], ["-", 12, 23, 0, 41, 15, 23, 0, 16, 12, 13], ["-", 31, 16, 12, 23, ...
1
444
#include <algorithm> #include <iostream> #include <map> #include <set> #include <stdio.h> #include <string.h> #include <vector> typedef long long ll; using namespace std; void dfs(int me, vector<int> &visited, vector<vector<int>> &table, int left) { if (visited[me] == 1) return; if (left < 0) return; ...
#include <algorithm> #include <iostream> #include <map> #include <set> #include <stdio.h> #include <string.h> #include <vector> typedef long long ll; using namespace std; void dfs(int me, vector<int> &visited, vector<vector<int>> &table, int left) { if (visited[me] == 1) return; if (left < 0) return; ...
[["+", 0, 7, 8, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 7, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 8, 7, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 43, 49, 50, 51, 69, 28, 69, 28, 22], ["+", 49, 50, 51, 69, 28, 69, 341, 342, 0, 70], ["+", 49, 50, 51, 69, 28, 69, 341, 342, 0, 22], ["+", 49, 50, 51, 69, 28, 69, 341, 342, 0, 73], ["+", ...
1
463
#include <bits/stdc++.h> using namespace std; #define sd(x) scanf("%d", &x) #define boost ios_base::sync_with_stdio(false); #define mp make_pair #define pb push_back #define all(a) a.begin(), a.end() #define f first #define s second typedef pair<int, int> pii; typedef long long ll; const int mod = 1000000007; const...
#include <bits/stdc++.h> using namespace std; #define sd(x) scanf("%d", &x) #define boost ios_base::sync_with_stdio(false); #define mp make_pair #define pb push_back #define all(a) a.begin(), a.end() #define f first #define s second typedef pair<int, int> pii; typedef long long ll; const int mod = 1000000007; const...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 31, 22], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 33], ["+", 49, 50, 51, 2, ...
1
545
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> //#include<cctype> #include <climits> #include <iostream> #include <map> #include <string> #include <vector> //#include<list> #include <algorithm> #include <deque> #include <queue> //#include<numeric> #include <utility> //#include<memory> #include...
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> //#include<cctype> #include <climits> #include <iostream> #include <map> #include <string> #include <vector> //#include<list> #include <algorithm> #include <deque> #include <queue> //#include<numeric> #include <utility> //#include<memory> #include...
[["-", 8, 9, 0, 338, 8, 9, 0, 43, 39, 40], ["-", 0, 338, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 338, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 338, 8, 9, 0, 43, 49, 50, 51, 146], ["-", 8, 9, 0, 338, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["-", 8, 9, 0, 57, 6...
1
767
#include <bits/stdc++.h> using namespace std; const int MAXN = 2010; void setmax(int &a, int b) { if (a < b) { a = b; } } int N, K; int dp[MAXN][MAXN]; // dp[vertex][max_depth] int par[MAXN]; vector<int> adj[MAXN]; void dfs(int x, int p) { auto it = find(adj[x].begin(), adj[x].end(), p); if (it != adj[x...
#include <bits/stdc++.h> using namespace std; const int MAXN = 2010; void setmax(int &a, int b) { if (a < b) { a = b; } } int N, K; int dp[MAXN][MAXN]; // dp[vertex][max_depth] int par[MAXN]; vector<int> adj[MAXN]; void dfs(int x, int p) { auto it = find(adj[x].begin(), adj[x].end(), p); if (it != adj[x...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 25], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 8, 9, 0, 7, 8, 9, 0, 7...
1
478
/* * Created by KeigoOgawa */ #include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #define INF (int)1e8 #define EPS 1e-10 #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); ...
/* * Created by KeigoOgawa */ #include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #define INF (int)1e8 #define EPS 1e-10 #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 57, 15, 339, 51...
1
601
#include <bits/stdc++.h> using namespace std; vector<int> g[5000]; int dis[5000]; int ans = 0; int n, k; int get(int x, int k) { memset(dis, -1, sizeof dis); queue<int> q; q.push(x); dis[x] = 0; while (q.size()) { int x = q.front(); q.pop(); for (auto t : g[x]) { if (dis[t] == -1) { ...
#include <bits/stdc++.h> using namespace std; vector<int> g[5000]; int dis[5000]; int ans = 0; int n, k; int get(int x, int k, int pre) { memset(dis, -1, sizeof dis); queue<int> q; q.push(x); dis[x] = 0; while (q.size()) { int x = q.front(); q.pop(); for (auto t : g[x]) { if (dis[t] == -1 ...
[["+", 0, 30, 0, 14, 49, 53, 54, 55, 0, 21], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22],...
1
363
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, a, n) for (int i ...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, a, n) for (int i ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 73], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 49, 53, 54, 55, 0, 21], ["-", 0,...
1
682
///============================================================================/// /// /// /// IT'S ME /// /// BISHAL GAUTAM /// /// CSE,JAHANGIRNAGAR UNIVERSITY,DHAKA /// /// ...
///============================================================================/// /// /// /// IT'S ME /// /// BISHAL GAUTAM /// /// CSE,JAHANGIRNAGAR UNIVERSITY,DHAKA /// /// ...
[["-", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 57, 64, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 51, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 1...
1
701
#include <iostream> #include <vector> using namespace std; const int LIM = 2016; vector<vector<int>> g(LIM); int ans = 0; int n, k; int dfs(int u, int d, int p = -1) { if (d == 0) return 1; int res = 1; for (int to : g[u]) { if (to == p) continue; res += dfs(to, d - 1, u); } return res;...
#include <iostream> #include <vector> using namespace std; const int LIM = 2016; vector<vector<int>> g(LIM); int ans = 0; int n, k; int dfs(int u, int d, int p = -1) { if (d < 0) return 0; if (d == 0) return 1; int res = 1; for (int to : g[u]) { if (to == p) continue; res += dfs(to, d...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 38], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9,...
1
338
#include <iostream> #include <math.h> #include <stdio.h> #include <vector> using namespace std; int n, k, a[2010], b[2010], dp[2010][2010], ans, suma[2010]; vector<int> adj[2010]; bool vis[2010]; void solve(int u) { for (int i = 0; i < adj[u].size(); i++) { if (!vis[adj[u][i]]) { vis[adj[u][i]] = true; ...
#include <iostream> #include <math.h> #include <stdio.h> #include <vector> using namespace std; int n, k, a[2010], b[2010], dp[2010][2010], ans; vector<int> adj[2010]; bool vis[2010]; void solve(int u) { for (int i = 0; i < adj[u].size(); i++) { if (!vis[adj[u][i]]) { vis[adj[u][i]] = true; solve(adj[...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 73], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 8...
1
637
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include...
#include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include...
[["+", 0, 338, 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, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 338, 8, 9, 0, 1, 0, 35], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", ...
1
711
#include <bits/stdc++.h> using namespace std; #define fo(i, a, b) for (int i = (a); i < (b); i++) #define MOD 1000000007 #define MT make_tuple #define PB push_back typedef long long ll; int N, K, root, ans = 2e9; vector<int> adj[2200]; int get(int i, int p, int d, int mx) { int ret = 1; if (d < mx) for (int j...
#include <bits/stdc++.h> using namespace std; #define fo(i, a, b) for (int i = (a); i < (b); i++) #define MOD 1000000007 #define MT make_tuple #define PB push_back typedef long long ll; int N, K, root, ans = 2e9; vector<int> adj[2200]; int get(int i, int p, int d, int mx) { if (d > mx) return 0; int ret = 1; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 14, 8, 9,...
1
306
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, a, b) for (int i = a; i < b; i++) #define S(x) scanf("%d", &x) #define S2(x, y) scanf...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, a, b) for (int i = a; i < b; i++) #define S(x) scanf("%d", &x) #define S2(x, y) scanf...
[["+", 0, 9, 0, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 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, 7...
1
684
#include <cstdio> const int N = 4007, M = 200007, P = 100000007; int f[N][N], g[N][N], a[M], b[M]; int read() { int x; scanf("%d", &x); return x; } void inc(int &a, int b) { a += b - P, a += a >> 31 & P; } int main() { int n = read(), ans = 0; g[0][0] = 1; for (int i = 1; i <= n; ++i) a[i] = read(), b[i...
#include <cstdio> const int N = 4007, M = 200007, P = 1000000007; int f[N][N], g[N][N], a[M], b[M]; int read() { int x; scanf("%d", &x); return x; } void inc(int &a, int b) { a += b - P, a += a >> 31 & P; } int main() { int n = read(), ans = 0; g[0][0] = 1; for (int i = 1; i <= n; ++i) a[i] = read(), b[...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 28, 69, 28, 69, 341, 342, 0, 16, 31, 13], ["+", 28, 69, 28, 69, 341, 342, 0, 16, 31, 13], ["-", 12, 27, 28, 69, 341, 342, 0, 16, 31, 13], ["+", 12, 27, 28, 69, 341, 342, 0, 16, 31, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, ...
1
384
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; namespace io { #define SIZ (1 << 21 | 1) #define gc() ...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; namespace io { #define SIZ (1 << 21 | 1) #define gc() ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 8, 9, 0, 1...
1
946
#include <bits/stdc++.h> using namespace std; #define ull unsigned long long const int MaxA(4003); const int MaxN(200003); const int Mod(1e9 + 7); const int inv2(500000004); inline int add(int x, int y) { return (x += y) >= Mod ? x -= Mod : x; } inline int inc(int x, int y) { return (x -= y) < 0 ? x += Mod : x; } ...
#include <bits/stdc++.h> using namespace std; #define ull unsigned long long const int MaxA(4003); const int MaxN(200003); const int Mod(1e9 + 7); const int inv2(500000004); inline int add(int x, int y) { return (x += y) >= Mod ? x -= Mod : x; } inline int inc(int x, int y) { return (x -= y) < 0 ? x += Mod : x; } ...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
581
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; const int maxn = 2e5 + 10; const int mod = 1e9 + 7; const int bas = 2000; int n; int a[maxn], b[maxn], dp[4003][4003]; long long inv[4004], jie[4004]; inline void init() { jie[1] = 1; for (int i = 2; i <= 4001; i++) ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; const int maxn = 2e5 + 10; const int mod = 1e9 + 7; const int bas = 2001; int n; int a[maxn], b[maxn], dp[4003][4003]; long long inv[8004], jie[8004]; inline void init() { jie[1] = 1; for (int i = 2; i <= 8001; i++) ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["+", 0, 1...
1
490
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #define mod 1000000007 #define int long long using namespace std; inline int read() { int f = 1, ans = 0; char c; while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #define mod 1000000007 #define int long long using namespace std; inline int read() { int f = 1, ans = 0; char c; while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && ...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 31, 22], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 12, 16,...
1
545
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <vector> #define ll long long #define gt getchar() #define File(s) freopen(s ".in", "r", stdin), freopen(s ".out", "w", stdout) inline int in() { int k = 0; char ch = gt; while (ch < '-') ch = gt; while (ch...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <vector> #define ll long long #define gt getchar() #define File(s) freopen(s ".in", "r", stdin), freopen(s ".out", "w", stdout) inline int in() { int k = 0; char ch = gt; while (ch < '-') ch = gt; while (ch...
[["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 17, 152], ["...
1
583
#include <cstdio> #include <iostream> #define ll long long #define maxn 400040 using namespace std; const int mo = 1000000007; int n, a[maxn], b[maxn], c[maxn]; ll p[maxn]; ll f[4004][4004], ans; inline int ksm(int x, int y) { int ans = 1; while (y) { if (y & 1) ans = (ll)ans * x % mo; x = (ll)x * x...
#include <cstdio> #include <iostream> #define ll long long #define maxn 400040 using namespace std; const int mo = 1000000007; int n, a[maxn], b[maxn], c[maxn]; ll f[4040][4040], ans, p[maxn]; inline int ksm(int x, int y) { int ans = 1; while (y) { if (y & 1) ans = (ll)ans * x % mo; x = (ll)x * x % ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 73], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0...
1
486
/* This code is made by ghy. Oj: Atcoder Language: C++ Status: AC Complexity: O(nlogn) */ #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <utilit...
/* This code is made by ghy. Oj: Atcoder Language: C++ Status: AC Complexity: O(n+val^2) */ #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <util...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 7, 15, 16, 12, 23, 0, 24], ["+", 0, 7, 15, 16, 12, 23, 0, 16, 17, 151], ["+", 0, 7, 15, 16, 12, 23, 0, 16, 12, 13], ["+", 8,...
1
690
/* Author: zxy_hhhh date: 2020/03/10 */ #include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> #define ll long long inline ll rd() { ll _x = 0; int _ch = getchar(), _f = 1; for (; !is...
/* Author: zxy_hhhh date: 2020/03/10 */ #include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> #define ll long long inline ll rd() { ll _x = 0; int _ch = getchar(), _f = 1; for (; !is...
[["-", 0, 30, 0, 14, 8, 9, 0, 171, 0, 184], ["-", 0, 30, 0, 14, 8, 9, 0, 171, 141, 22], ["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 2...
1
771
#include <iostream> #define mod 1000000007 using namespace std; long long dp[4001][4001], a[8001], b[8001], ans, jc[8001], invjc[8001]; long long C(int a, int b) { return jc[b] * invjc[a] % mod * invjc[b - a] % mod; } long long fast_pow(long long a, int b) { if (b == 0) return 1; if (b & 1) return fast_po...
#include <iostream> #define mod 1000000007 using namespace std; long long dp[8001][8001], a[200001], b[200001], ans, jc[8001], invjc[8001]; long long C(int a, int b) { return jc[b] * invjc[a] % mod * invjc[b - a] % mod; } long long fast_pow(long long a, int b) { if (b == 0) return 1; if (b & 1) return fas...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 8, 1, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["-", 0, 14, 8, 9, 0...
1
488
#include <cstdio> #include <iostream> #define ll long long #define maxn 400040 using namespace std; const int mo = 1000000007; int n, a[maxn], b[maxn], c[maxn]; ll f[4040][4040], ans, p[maxn]; inline int ksm(int x, int y) { int ans = 1; while (y) { if (y & 1) ans = (ll)ans * x % mo; x = (ll)x * x % ...
#include <cstdio> #include <iostream> #define ll long long #define maxn 400040 #define re register using namespace std; const int mo = 1000000007; int n, a[maxn], b[maxn], c[maxn]; ll f[4040][4040], ans, p[maxn]; inline int ksm(int x, int y) { int ans = 1; while (y) { if (y & 1) ans = (ll)ans * x % mo; ...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["+", 8, 9, 0, 7, 8, 7, 10, 43, 39, 78], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 109], ["+", 12, ...
1
494
#include <cstdio> typedef long long ll; inline int rd() { int x = 0, p = 1; char a = getchar(); while ((a < 48 || a > 57) && a != '-') a = getchar(); if (a == '-') p = -p, a = getchar(); while (a > 47 && a < 58) x = (x << 1) + (x << 3) + (a & 15), a = getchar(); return x * p; } const int N = 200...
#include <cstdio> typedef long long ll; inline int rd() { int x = 0, p = 1; char a = getchar(); while ((a < 48 || a > 57) && a != '-') a = getchar(); if (a == '-') p = -p, a = getchar(); while (a > 47 && a < 58) x = (x << 1) + (x << 3) + (a & 15), a = getchar(); return x * p; } const int N = 200...
[["-", 28, 69, 28, 69, 341, 342, 0, 16, 31, 13], ["+", 28, 69, 28, 69, 341, 342, 0, 16, 31, 13], ["-", 12, 27, 28, 69, 341, 342, 0, 16, 31, 13], ["+", 12, 27, 28, 69, 341, 342, 0, 16, 31, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 7, 8, 7, 15, 16, 12, 13], ["...
1
582
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int _ = 2e5 + 10; const int __ = 4000 + 10; const int delta = 2000 + 1; const ll mod = 1e9 + 7; int N; ll f[__][__], fac[__ << 1], facinv[_ << 1]; struct node { int x, y; } p[_]; ll ksm(ll a, ll b) { ll ret = 1; for (; b; b >>= 1) { i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int _ = 2e5 + 10; const int __ = 4000 + 10; const int delta = 2000 + 1; const ll mod = 1e9 + 7; int N; ll f[__][__], fac[__ << 1], facinv[_ << 1]; struct node { int x, y; } p[_]; ll ksm(ll a, ll b) { ll ret = 1; for (; b; b >>= 1) { i...
[["-", 0, 30, 0, 14, 8, 9, 0, 171, 0, 184], ["-", 0, 30, 0, 14, 8, 9, 0, 171, 141, 22], ["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 2...
1
581
#include <bits/stdc++.h> using namespace std; const int M = 2020, N = 4040, MOD = 1000 * 1000 * 1000 + 7; int sum(int a, int b) { a += b; if (a < 0) a += MOD; else if (a >= MOD) a -= MOD; return a; } void _sum(int &a, int b) { a = sum(a, b); } int mul(int a, int b) { return 1LL * a * b % MOD; } void _...
#include <bits/stdc++.h> using namespace std; const int NN = 2e5 + 100, M = 2020, N = 4040, MOD = 1000 * 1000 * 1000 + 7; int sum(int a, int b) { a += b; if (a < 0) a += MOD; else if (a >= MOD) a -= MOD; return a; } void _sum(int &a, int b) { a = sum(a, b); } int mul(int a, int b) { return 1LL * a * b...
[["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+", ...
1
516
#include <cstdio> #define C(x, y) (fct[x] * ufct[y] % TT * ufct[(x) - (y)] % TT) using namespace std; const int m = 2001, M = 4001, TT = 1000000007; int n, cnt[m + 5][m + 5], F[M + 5][M + 5]; long long fct[M + 5], ufct[M + 5], ans; inline char nc() { static char buf[100000], *p1, *p2; return p1 == p2 && (p2 = (p1 =...
#include <cstdio> #define C(x, y) (fct[x] * ufct[y] % TT * ufct[(x) - (y)] % TT) using namespace std; const int m = 2001, M = 4001, MM = 8000, TT = 1000000007; int n, cnt[m + 5][m + 5], F[M + 5][M + 5]; long long fct[MM + 5], ufct[MM + 5], ans; inline char nc() { static char buf[100000], *p1, *p2; return p1 == p2 &...
[["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 0, 30, 0, 43, 49, 80, 81, 16, 31, 22], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, ...
1
632
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np MOD = 10 ** 9 + 7 N = int(readline()) m = map(int,read().split()) AB = zip(m,m) D = 2000 def cumprod(arr,MOD): L = len(arr); Lsq = int(L**.5+1) arr = np.resize(arr,Lsq**2)....
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np MOD = 10 ** 9 + 7 N = int(readline()) m = map(int,read().split()) AB = zip(m,m) D = 2000 def cumprod(arr,MOD): L = len(arr); Lsq = int(L**.5+1) arr = np.resize(arr,Lsq**2)....
[["+", 0, 1, 0, 677, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 677, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 132], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22]]
5
476
#include <iostream> using namespace std; const int MOD = 1e9 + 7, MAX = 2002, MAX_N = 200000; int A[MAX * 2][MAX * 2], B[MAX * 2][MAX * 2]; pair<short, short> P[MAX_N]; long long sum_1 = 0, sum_2 = 0; int main() { int n; cin >> n; for (int i = 1; i < MAX * 2; i++) { B[i][0] = B[0][i] = 1; } for (int i =...
#include <iostream> using namespace std; const int MOD = 1e9 + 7, MAX = 2002, MAX_N = 200000; int A[MAX * 2][MAX * 2], B[MAX * 2][MAX * 2]; pair<short, short> P[MAX_N]; long long sum_1 = 0, sum_2 = 0, sum_3 = 0; int main() { int n; cin >> n; for (int i = 1; i < MAX * 2; i++) { B[i][0] = B[0][i] = 1; } f...
[["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["+", 51, 16, 31, 16, 31, 16, 31, 23, 0, 25], ["+", 49, 50, 51, 16, 31, 16, 31, 16, 17, 48], ["+...
1
420
#include <iostream> using namespace std; const int N = 200 * 1000 + 5, A = 2005; const int mod = 1000 * 1000 * 1000 + 7; // int x[N]; // int y[N]; int dp[2 * A][2 * A]; int gl[2 * A][2 * A]; long long fac[2 * A]; int po(int x, int y) { if (y == 0) return 1; long long ans = po(x, y / 2); ans *= ans; ans %=...
#include <iostream> using namespace std; const int N = 200 * 1000 + 5, A = 2005; const int mod = 1000 * 1000 * 1000 + 7; long long dp[2 * A][2 * A]; long long gl[2 * A][2 * A]; long long fac[4 * A]; int po(int x, int y) { if (y == 0) return 1; long long ans = po(x, y / 2); ans *= ans; ans %= mod; if (y ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 0, 30, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 31, 13], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8,...
1
475
#include <bits/stdc++.h> using namespace std; const int N = 4e3 + 7, M = 2e5 + 7; int mod = 1e9 + 7; int n; int a[M], b[M]; long long dp[N][N]; long long fac[M]; long long power(long long a, long long b) { if (b == 0) return 1; long long t = power(a, b / 2); t = (t * t) % mod; if (b % 2) t = (t * a) %...
#include <bits/stdc++.h> using namespace std; const int N = 4e3 + 7, M = 2e5 + 7; int mod = 1e9 + 7; int n; int a[M], b[M]; long long dp[N][N]; long long fac[M]; long long power(long long a, long long b) { if (b == 0) return 1; long long t = power(a, b / 2); t = (t * t) % mod; if (b % 2) t = (t * a) %...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 31, 69, 28, 69, 28, 22], ["+", 31, 16, 31, 69, 28, 69, 341, 342, 0, 70], ["+", 31, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 31, 16, 31, 69, 28, 69, 341, 342, 0, 73], ["+",...
1
524
#include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <functional> #include <numeric> #define LOG(FMT...) fprintf(stderr, FMT) using namespace std; typedef long long ll; const int N = 200010, P = 1000000007, A = 2010; int n; int a[N], b[N], fac[N * 4], ifac[N * 4]; int f[A * 2][A *...
#include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <functional> #include <numeric> #define LOG(FMT...) fprintf(stderr, FMT) using namespace std; typedef long long ll; const int N = 200010, P = 1000000007, A = 2010; int n; int a[N], b[N], fac[N * 4], ifac[N * 4]; int f[A * 2][A *...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
628
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define ll long long #define ld long double #define int long long typedef pair<int, int> II; typedef pair<int, II> III; const int INF = (1 << 30) - 1; const long long oo = (1ll << 62) - 1; cons...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define ll long long #define ld long double #define int long long typedef pair<int, int> II; typedef pair<int, II> III; const int INF = (1 << 30) - 1; const long long oo = (1ll << 62) - 1; cons...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 17, 48], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0...
1
673
#include <bits/stdc++.h> using namespace std; int p[4005][4005], co[100005][2]; int pp[4005][4005]; map<pair<int, int>, int> mm, mm2; main() { p[0][0] = 1; for (int i = 0; i < 4003; i++) { for (int k = 0; k < 4003; k++) { for (int j = 0; j < 2; j++) { p[i + 1][k + j] += p[i][k]; p[i + 1][k...
#include <bits/stdc++.h> using namespace std; int p[8025][4125], co[200005][2]; int pp[4025][4025]; main() { p[0][0] = 1; for (int i = 0; i < 8022; i++) { for (int k = 0; k < 4122; k++) { for (int j = 0; j < 2; j++) { p[i + 1][k + j] += p[i][k]; p[i + 1][k + j] %= 1000000007; } }...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 39, 344, 141, 78], ["-", 0, 30, 0, 43, 39, 344, 3, 347, 0, 18], ["-", 39, 344, 3, 347, 0, 77, 39, 344, 141, 78]...
1
460
#include <algorithm> #include <cstdio> #include <iostream> #define rint register int #define N 200005 #define M 2003 using namespace std; const int Mod = 1e9 + 7; const int eps = 2001; int n, a[N], b[N], f[M << 1][M << 1]; int fac[M << 1], inv[M << 1], ifac[M << 1]; inline void prework() { fac[0] = inv[1] = ifac[0]...
// 23;23 #include <algorithm> #include <cstdio> #include <iostream> #define rint register int #define N 200005 #define M 2003 using namespace std; const int Mod = 1e9 + 7; const int eps = 2001; int n, a[N], b[N], f[M << 1][M << 1]; int fac[M << 2], inv[M << 2], ifac[M << 2]; inline void prework() { fac[0] = inv[1] ...
[["-", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 12, 16, 31, 16, 31, 16, 31, 16, 31, 13], ["+", 12, 16, 31, 16, 31, 16, 31, 16, 17, 48]]
1
518
// luogu-judger-enable-o2 #include <iostream> using namespace std; #define int long long const int Mod = 1e9 + 7; const int mxn = 2e6; const int N = 200005, M = 8000; int frac[mxn + 5], inv[mxn + 5]; int dp[M / 2 + 5][M / 2 + 5], base = M / 4 + 2; int n, a[N], b[N]; int power(int a, int b) { int res = 1, car = a; w...
#include <iostream> using namespace std; #define int long long const int Mod = 1e9 + 7; const int mxn = 2e6; const int N = 200005, M = 8000; int frac[mxn + 5], inv[mxn + 5]; int dp[M / 2 + 5][M / 2 + 5], base = M / 4 + 2; int n, a[N], b[N]; int power(int a, int b) { int res = 1, car = a; while (b) { if (b & 1) ...
[["+", 8, 9, 0, 1, 0, 11, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 31, 23, 0, 42, 0, 22], ["+", 0, 1, 0, 11, 31, 23, 0, 42, 0, 107], ["+", 8, 9, 0, 1, 0, 11, 31, 23, 0, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 23, 0, 25], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0,...
1
510