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; typedef long long int ll; typedef unsigned int uint; typedef unsigned char uchar; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; #define REP(i, x) for (int i = 0; i < (int)(x); i++) #define REPS(i, x) for (int ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned int uint; typedef unsigned char uchar; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; #define REP(i, x) for (int i = 0; i < (int)(x); i++) #define REPS(i, x) for (int ...
[["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25],...
1
905
#include <array> #include <cstdio> #include <functional> #include <iterator> #include <map> #include <vector> namespace XX { template <template <typename> class Compare, typename T> inline T &UP(T &x, const T &y) { if (Compare<T>()(y, x)) x = y; return x; } template <typename Compare, typename T> inline T &UP(T...
#include <array> #include <cstdio> #include <functional> #include <iterator> #include <map> #include <vector> namespace XX { template <template <typename> class Compare, typename T> inline T &UP(T &x, const T &y) { if (Compare<T>()(y, x)) x = y; return x; } template <typename Compare, typename T> inline T &UP(T...
[["-", 36, 36, 36, 36, 0, 42, 0, 11, 31, 22], ["-", 36, 36, 36, 36, 0, 42, 0, 11, 17, 32], ["+", 3, 347, 0, 2, 3, 4, 0, 25, 0, 47], ["+", 36, 36, 0, 42, 0, 191, 51, 83, 0, 45], ["+", 51, 83, 0, 42, 0, 2, 63, 2, 63, 22], ["+", 0, 42, 0, 2, 63, 2, 3, 4, 0, 24], ["+", 0, 2, 63, 2, 3, 4, 0, 191, 39, 40], ["+", 63, 2, 3, 4,...
1
1,616
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x, to) for (x = 0; x < (to); x++) #define FORR(x, arr) for (auto &x : arr) #define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++) #define ALL(a) (a.begin()), ...
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x, to) for (x = 0; x < (to); x++) #define FORR(x, arr) for (auto &x : arr) #define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++) #define ALL(a) (a.begin()), ...
[["+", 75, 76, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 51, 22], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 57, 64, 9, 0, 57, 75, 76, 0, 95], ["+", 64, 9, 0,...
1
708
imp="Impossible" def ans(a,b) puts a.join(" ") puts b.length puts b.join(" ") end n,m=gets.split.map(&:to_i) a=gets.split.map(&:to_i) oddc = a.count(&:odd?) case oddc when 0 b = a.dup b[0] -= 1 b << 1 ans(a,b) when 1 if a.length == 1 ans(a,[a[0]-1,1]) exit end o,a = a.partition{|x| x.odd? } a = o+a b ...
imp="Impossible" def ans(a,b) puts a.join(" ") puts b.length puts b.join(" ") end n,m=gets.split.map(&:to_i) a=gets.split.map(&:to_i) oddc = a.count(&:odd?) case oddc when 0 b = a.dup b[0] -= 1 b << 1 ans(a,b) when 1 if a.length == 1 if a == [1] ans(a,a) else ans(a,[a[0]-1,1]) end exit end o,a...
[["+", 8, 749, 0, 121, 64, 749, 0, 121, 0, 121], ["+", 0, 121, 64, 749, 0, 121, 15, 738, 31, 22], ["+", 0, 121, 64, 749, 0, 121, 15, 738, 17, 60], ["+", 64, 749, 0, 121, 15, 738, 12, 516, 0, 70], ["+", 64, 749, 0, 121, 15, 738, 12, 516, 0, 612], ["+", 64, 749, 0, 121, 15, 738, 12, 516, 0, 73], ["+", 64, 749, 0, 121, 64...
4
233
// package atcoder.agc.agc001; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; /** * Created by hama_du on 2016/07/16. */ public class Main { public static void ...
// package atcoder.agc.agc001; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; /** * Created by hama_du on 2016/07/16. */ public class Main { public static void ...
[["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 0, 32], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 8, 498, 0, 195, 8, 196, 0, 503, 0, 35], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 15, 15, 0...
3
1,152
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define mp make_pair #define ...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define mp make_pair #define ...
[["+", 64, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 64, 9, 0, 52, 8, 9, 0, 43, 0, 35], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 8, 9, 0,...
1
1,270
#include <bits/stdc++.h> #define FO(i, a, b) for (int i = (a); i < (b); i++) #define sz(v) int(v.size()) using namespace std; int n, m; int a[105]; bool cmp(int i, int j) { return i % 2 > j % 2; } int main() { scanf("%d %d", &n, &m); int nodd = 0; FO(i, 0, m) { scanf("%d", a + i); if (a[i] % 2 == 1) ...
#include <bits/stdc++.h> #define FO(i, a, b) for (int i = (a); i < (b); i++) #define sz(v) int(v.size()) using namespace std; int n, m; int a[105]; bool cmp(int i, int j) { return i % 2 > j % 2; } int main() { scanf("%d %d", &n, &m); int nodd = 0; FO(i, 0, m) { scanf("%d", a + i); if (a[i] % 2 == 1) ...
[["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 64, 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], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+"...
1
361
#include <bits/stdc++.h> #define sz(x) (int((x).size())) #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() template <typename T> bool domax(T &a, T b) { return (b > a ? (a = b, true) : false); } template <typename T> bool domin(T &a, T b) { return (b < a ? (a = b, true) : false); } ...
#include <bits/stdc++.h> #define sz(x) (int((x).size())) #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() template <typename T> bool domax(T &a, T b) { return (b > a ? (a = b, true) : false); } template <typename T> bool domin(T &a, T b) { return (b < a ? (a = b, true) : false); } ...
[["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 15, 339, 51, 16, 12, 16, 31, 69, 28, 22], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 1...
1
391
#include <bits/stdc++.h> using namespace std; int n, m, l; int a[123]; int b[123]; int o1, o2; int odds; int main() { cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a[i]; if (a[i] % 2 == 1) { if (odds == 0) o1 = i; else if (odds == 1) o2 = i; else { cout << ...
#include <bits/stdc++.h> using namespace std; int n, m, l; int a[123]; int b[123]; int o1, o2; int odds; int main() { cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a[i]; if (a[i] % 2 == 1) { if (odds == 0) o1 = i; else if (odds == 1) o2 = i; else { cout << ...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 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, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17...
1
366
#include <bits/stdc++.h> using namespace std; #define int long long #define PI pair<int, int> const int maxm = 2e5 + 5; const int mod = 1e9 + 7; // n<=2e5 // a[i],b[i]<=2e3 int fac[maxm], inv[maxm]; int a[maxm], b[maxm]; int d[4005][4005]; const int base = 2025; int n; int ppow(int a, int b, int mod) { int ans = 1 % ...
#include <bits/stdc++.h> using namespace std; #define int long long #define PI pair<int, int> const int maxm = 2e5 + 5; const int mod = 1e9 + 7; // n<=2e5 // a[i],b[i]<=2e3 int fac[maxm], inv[maxm]; int a[maxm], b[maxm]; int d[4444][4444]; int n; int ppow(int a, int b, int mod) { int ans = 1 % mod; a %= mod; whil...
[["-", 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, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 36, 36, 0, 30, 0, 43, 0, 153, 0, 154], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-",...
1
549
#include <bits/stdc++.h> #define ll long long const ll P = 1e9 + 7; const ll N = 200010, M = 4010; ll n, a[N], b[N], dp[M][M]; ll fac[M], inv[M]; ll pow(ll x, ll y) { x %= P; ll ans = 1; while (y) { if (y & 1) ans = ans * x % P; x = x * x % P; y >>= 1; } return ans % P; } void Get_fac(ll n) ...
#include <bits/stdc++.h> #define ll long long const ll P = 1e9 + 7; const ll N = 200010, M = 4010, maxn = 40010; ll n, a[N], b[N], dp[M][M]; ll fac[maxn], inv[maxn]; ll pow(ll x, ll y) { x %= P; ll ans = 1; while (y) { if (y & 1) ans = ans * x % P; x = x * x % P; y >>= 1; } return ans % P; }...
[["+", 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], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1,...
1
531
#include <cstdio> #include <iostream> #define ll long long using namespace std; const int N = 2055; const ll mod = 1e9 + 7; ll finv[200050], fac[200500]; ll dp[5000][5000]; ll a[5000], b[5000]; ll ksm(ll n, ll k) { ll ret = 1; while (k) { if (k % 2) ret = ret * n % mod; k /= 2; n = n * n % mod; ...
#include <cstdio> #include <iostream> #define ll long long using namespace std; const int N = 2055; const ll mod = 1e9 + 7; ll finv[200050], fac[200500]; ll dp[5000][5000]; ll a[200050], b[200500]; ll ksm(ll n, ll k) { ll ret = 1; while (k) { if (k % 2) ret = ret * n % mod; k /= 2; n = n * n % mod...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 48], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 17, 109], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 48], ["+", 0, 2, 3,...
1
497
#include <cstdio> #include <cstring> #include <iostream> #define RG register #define ll long long using namespace std; const int N = 2e5 + 10, base = 2e3, M = 4001; const ll mod = 1e9 + 7; int n; ll a[N], b[N], fac[M] = {1}, inv[M], dp[M][M], ans; inline ll read() { char ch = getchar(); ll x = 0, f = 1; while (ch...
#include <cstdio> #include <cstring> #include <iostream> #define RG register #define ll long long using namespace std; const int N = 2e5 + 10, base = 2e3 + 2, M = 8010; const ll mod = 1e9 + 7; int n; ll a[N], b[N], fac[M] = {1}, inv[M], dp[M / 2][M / 2], ans; inline ll read() { char ch = getchar(); ll x = 0, f = 1;...
[["+", 0, 30, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 0, 43, 49, 80, 49, 80, 81, 16, 17, 85], ["+", 0, 43, 49, 80, 49, 80, 81, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 17, 85], ["...
1
554
#include <cstdio> #define Mod 1000000007 long long f[4005][4005], ans, fac[8005], inv[4005]; int n, a[100001], b[100001]; long long C(int x, int y) { return 1ll * fac[x + y] * inv[y] % Mod * inv[x] % Mod; } int main() { fac[0] = inv[1] = 1; for (int i = 1; i <= 8000; ++i) fac[i] = fac[i - 1] * i % Mod; for ...
#include <cstdio> #define Mod 1000000007 long long f[4005][4005], ans, fac[8005], inv[4005]; int n, a[200001], b[200001]; long long C(int x, int y) { return fac[x + y] * inv[y] % Mod * inv[x] % Mod; } int main() { fac[0] = inv[1] = 1; for (int i = 1; i <= 8000; ++i) fac[i] = fac[i - 1] * i % Mod; for (int i =...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 31, 16, 31, 16, 31, 16, 31, 16, 31, 13], ["-", 31, 16, 31, 16, 31, 16, 31, 16, 17, 48], ["-", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["-", 31, 23, 0, 16, 31, 16, 31, 23, 0, 24], ["-", 31, 23, 0, 16, 31, 16, 31, 23, 0, 25], ["...
1
413
#include <bits/stdc++.h> #define maxn 4086 using namespace std; const int p = 998244353; inline int fpow(int x, int y) { int ans = 1; while (y) { if (y & 1) ans = 1ll * ans * x % p; x = 1ll * x * x % p; y >>= 1; } return ans; } int sum[maxn << 1], inv[maxn << 1]; inline int C(int n, int m)...
#include <bits/stdc++.h> #define maxn 200086 #define maxm 4086 using namespace std; const int p = 1e9 + 7; //写错了 调了一万年 我吐了 inline int fpow(int x, int y) { int ans = 1; while (y) { if (y & 1) ans = 1ll * ans * x % p; x = 1ll * x * x % p; y >>= 1; } return ans; } int sum[maxn], inv[maxn]; in...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 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], ["-...
1
528
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #define ll long long using namespace std; const int MAXN = 2e5 + 10; const int mod = 1e9 + 7; ll f[4010][4010], n, a[MAXN], b[MAXN], fac[8010], inv[8010], ans = 0; ll qp(ll x, int t) { ll res = 1; for (; t; t >>= 1, x...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #define ll long long using namespace std; const int MAXN = 2e5 + 10; const int mod = 1e9 + 7; ll f[4010][4010], n, a[MAXN], b[MAXN], fac[8010], inv[8010], ans = 0; ll qp(ll x, int t) { ll res = 1; for (; t; t >>= 1, x...
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 0, 7, 8, 9, 0, 1, 0, 16, ...
1
613
#include <bits/stdc++.h> #define intt long long using namespace std; const int maxx = 4010; const int M = 1e9 + 7; int dp[maxx][maxx]; int A[2000000], B[2000000]; intt times[3000002]; int n, m; int read() { int k; cin >> k; return k; } intt qsm(int x) { intt ans = 1, s = x; int k = M - 2; while (k) { if...
#include <bits/stdc++.h> #define intt long long using namespace std; const int maxx = 4010; const int M = 1e9 + 7; intt dp[maxx][maxx]; intt A[400020], B[400020]; intt times[3000002]; int n, m; int read() { int k; cin >> k; return k; } intt qsm(int x) { intt ans = 1, s = x; int k = M - 2; while (k) { if...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 3...
1
452
#include <bits/stdc++.h> #define int long long #define N 8005 using namespace std; const int base = 4001; const int mod = 1e9 + 7; int n, dp[N][N], a[200005], b[200005], jc[N], invjc[N]; int power(int x, int y) { int ans = 1; for (; y; y >>= 1, x = 1LL * x * x % mod) { if (y & 1) ans = 1LL * ans * x % mod...
#include <bits/stdc++.h> //#define int long long #define N 8005 using namespace std; const int base = 4001; const int mod = 1e9 + 7; int n, dp[N][N], a[200005], b[200005], jc[N], invjc[N]; int power(int x, int y) { int ans = 1; for (; y; y >>= 1, x = 1LL * x * x % mod) { if (y & 1) ans = 1LL * ans * x % m...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
520
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 5e3; const int M = 2e3 + 88; const int mod = 1e9 + 7; int n, a[M * 100], b[M * 100], f[N + 99][N + 99], fac[M * 10 + 99], da; int ksm(int x, int y) { int base = 1; while (y) { if (y & 1) base = (1ll * base * x) % mod; x ...
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 5e3; const int M = 2e3 + 88; const int mod = 1e9 + 7; int n, a[M * 100], b[M * 100], f[N + 99][N + 99], fac[M * 10 + 99], da; int ksm(int x, int y) { int base = 1; while (y) { if (y & 1) base = (1ll * base * x) % mod; x ...
[["-", 8, 9, 0, 37, 0, 16, 31, 23, 0, 24], ["-", 31, 23, 0, 16, 12, 2, 3, 4, 0, 24], ["-", 0, 23, 0, 16, 31, 16, 31, 16, 31, 13], ["-", 0, 23, 0, 16, 31, 16, 31, 16, 17, 48], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12...
1
476
#include <iostream> #define int long long using namespace std; const int ovo = 2001, mo = 1e9 + 7; int n, m, f[2 * ovo + 5][2 * ovo + 5], ans, fac[2 * ovo + 5], inv[2 * ovo + 5]; struct asuka { int x, y; } po[200001]; inline int qpow(int a, int b) { int s = 1; while (b) { if (b & 1) s = s * a % mo; ...
#include <iostream> #define int long long using namespace std; const int ovo = 2001, mo = 1e9 + 7; int n, m, f[2 * ovo + 5][2 * ovo + 5], ans, fac[4 * ovo + 5], inv[4 * ovo + 5]; struct asuka { int x, y; } po[200001]; inline int qpow(int a, int b) { int s = 1; while (b) { if (b & 1) s = s * a % mo; ...
[["-", 0, 43, 49, 80, 81, 16, 31, 16, 31, 13], ["+", 0, 43, 49, 80, 81, 16, 31, 16, 31, 13], ["-", 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, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0...
1
496
/* Though leaves are many , the root is one. Through all the lying days of my youth I swayed my leaves and flowers in the sun. Now I may wither into the truth. - William Butler Yeats */ #pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")...
/* Though leaves are many , the root is one. Through all the lying days of my youth I swayed my leaves and flowers in the sun. Now I may wither into the truth. - William Butler Yeats */ #pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")...
[["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 24], ["+", 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, 7, 15,...
1
1,326
#include <bits/stdc++.h> using namespace std; //#define int long long const int mod = 1e9 + 7; const int N = 2e5 + 50; const int i2 = 500000004; int n; int ai[N], bi[N]; int dp[4058][4058]; int C[4058][4058]; int main() { cin >> n; C[0][0] = 0; C[1][0] = C[1][1] = 1; for (int i = 2; i <= 4050; ++i) { C[i][0...
#include <bits/stdc++.h> using namespace std; //#define int long long const int mod = 1e9 + 7; const int N = 2e5 + 50; const int i2 = 500000004; int n; int ai[N], bi[N]; int dp[4058][4058]; int C[8050][4058]; int main() { cin >> n; C[0][0] = 0; C[1][0] = C[1][1] = 1; for (int i = 2; i <= 8025; ++i) { C[i][0...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 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, 15, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 7, 8, 9...
1
402
#include <bits/stdc++.h> namespace imzzy { #define endl '\n' #define ccf std::cout << "phi**k" << endl #define rgi register int #define ll long long class fastin { private: int _ch, _f; public: inline fastin &operator>>(char &c) { c = getchar(); return *this; } template <typename _Tp> inline fastin &op...
#include <bits/stdc++.h> namespace imzzy { #define endl '\n' #define ccf std::cout << "phi**k" << endl #define rgi register int #define ll long long class fastin { private: int _ch, _f; public: inline fastin &operator>>(char &c) { c = getchar(); return *this; } template <typename _Tp> inline fastin &op...
[["-", 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, 34, 31, 11, 12, 16, 31, 23, 0, 24], ["-", 0, 34, 31, 11, 12, 16, 31, 23, 0, 25], ["-", 8, 1, 0, 34, 12, 11, 12, 2, 63, 22], ["-", 0, 3...
1
790
/* Arthor : Ender_zzm E-mail zzm_ender_wiggin@outlook.com Blog ender-zzm.enbar.cn */ #include <bits/stdc++.h> using namespace std; inline int Isdigit(char c) { if (c < '0' || c > '9') return 0; return 1; } inline int readint() { register int x = 0, flag = 1; register char ch; while (!Isdigit(ch = getchar...
/* Arthor : Ender_zzm E-mail zzm_ender_wiggin@outlook.com Blog ender-zzm.enbar.cn */ #include <bits/stdc++.h> using namespace std; inline int Isdigit(char c) { if (c < '0' || c > '9') return 0; return 1; } inline int readint() { register int x = 0, flag = 1; register char ch; while (!Isdigit(ch = getchar...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 0, 30, 0, 14, 39, 86, 0, 156], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["-", 0...
1
911
// Konrad Paluszek,University of Warsaw(former XIV LO Staszic) //#STAY AT HOME #ifndef LOCAL #pragma GCC optimize("O3") #endif #define TIME (chrono::steady_clock::now().time_since_epoch().count()) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define xfm(a, b) a#...
// Konrad Paluszek,University of Warsaw(former XIV LO Staszic) //#STAY AT HOME #ifndef LOCAL #pragma GCC optimize("O3") #endif #define TIME (chrono::steady_clock::now().time_since_epoch().count()) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define xfm(a, b) a#...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-...
1
1,958
#include <bits/stdc++.h> #define mod 1000000007 #define ll long long using namespace std; const int N = 2 * 1e5 + 100, M = 4100; int n; int a[N], b[N], MAX; ll fac[M * 2], inv[M * 2], dp[M][M]; inline ll m_pow(ll a, int b) { ll ans = 1; while (b) { if (b & 1) ans = (ans * a) % mod; b >>= 1; a = (a...
#include <bits/stdc++.h> #define mod 1000000007 #define ll long long using namespace std; const int N = 2 * 1e5 + 100, M = 4100; int n; int a[N], b[N], MAX; ll fac[M * 2], inv[M * 2], dp[M][M]; inline ll m_pow(ll a, int b) { ll ans = 1; while (b) { if (b & 1) ans = (ans * a) % mod; b >>= 1; a = (a...
[["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 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, 13], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 8, 9, 0, 57, 64,...
1
600
#include <bits/stdc++.h> using namespace std; int n, r[200000], c[200000]; long long all[4002][4002], one[4002][4002], result; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void collection() { for (int i = 0; i < n; ++i) result += all[20...
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 int n, r[200000], c[200000]; long long all[4002][4002], one[4002][4002], result; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void collection() { for (int i = 0; i < n; ++...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 7, 8, 1, 0, 11, 17, 110], ["+", 8, 9, 0, 7, 8, 1, 0, 11, 17, 107], ["+", 0, 7, 8, 1, 0, 11, 12, 23, 0, 24], ["+", 8, 1, 0, 11, 12, 23, 0, 16, 31, 22], ["+", 8, 1, 0, 11...
1
406
#include <cstdio> typedef long long LL; const int Mod = 1000000007, Inv2 = (Mod + 1) / 2; const int MN = 200005, C = 2000, O = C + 1, MS = 4005; inline int qPow(int b, int e) { int a = 1; for (; e; e >>= 1, b = (LL)b * b % Mod) if (e & 1) a = (LL)a * b % Mod; return a; } int N, A[MN], B[MN]; int Fac[...
#include <cstdio> typedef long long LL; const int Mod = 1000000007, Inv2 = (Mod + 1) / 2; const int MN = 200005, C = 2000, O = C + 1, MS = O + C + 1; inline int qPow(int b, int e) { int a = 1; for (; e; e >>= 1, b = (LL)b * b % Mod) if (e & 1) a = (LL)a * b % Mod; return a; } int N, A[MN], B[MN]; int...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 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, 22], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 17, 48], [...
1
500
#include <bits/stdc++.h> typedef long long int ll; typedef long double ld; #define pb push_back #define pii pair<ll, ll> #define F first #define S second #define endl '\n' #define int long long #define sync \ ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> typedef long long int ll; typedef long double ld; #define pb push_back #define pii pair<ll, ll> #define F first #define S second #define endl '\n' #define int long long #define sync \ ios_base::sync_with_stdio(false); ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 12, 16, 12, 69, 28, 69, 341, 342, 0, 70], ["+", 12, 16, 12, 69, 28, 69, 341, 342, 0, 22], ["+", 12, 16, 12, 69, 28, 69, 341, 342, 0, 73], [...
1
540
#include <cstdio> using namespace std; #define N 2100 #define M 1000000007 #define Q 200100 #define ll long long int f[N * 2][N * 2]; int a[Q], b[Q], fact[N * 4], fact_inv[N * 4]; int power(int x, int y) { int ans = 1; for (; y; y >>= 1, x = (ll)x * x % M) if (y & 1) ans = (ll)ans * x % M; return ans;...
#include <cstdio> using namespace std; #define N 2100 #define M 1000000007 #define Q 200100 #define ll long long int f[N * 2][N * 2]; int a[Q], b[Q], fact[N * 4], fact_inv[N * 4]; int power(int x, int y) { int ans = 1; for (; y; y >>= 1, x = (ll)x * x % M) if (y & 1) ans = (ll)ans * x % M; return ans;...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 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, 0, 35], ["+", 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, 33...
1
499
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; #define int long long inline int read() { int ret = 0, t = 1; char c = getchar(); while ((c < '0' || c > '9') && c != '-') c = getchar(); if (c == '-') t = -1, c = getchar(); while (c >= '0' && c <= '...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; inline int read() { int ret = 0, t = 1; char c = getchar(); while ((c < '0' || c > '9') && c != '-') c = getchar(); if (c == '-') t = -1, c = getchar(); while (c >= '0' && c <= '9') ret = ret * 10 ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 17, 48], [...
1
557
#include <bits/stdc++.h> using namespace std; vector<int> edg[2005]; vector<int> ch[2005]; int cac[2005][2005]; int n, k, ans; void dfs(int at, int par = -1) { for (int u : edg[at]) if (u != par) { ch[at].push_back(u); dfs(u, at); } } int slv(int at, int far) { if (cac[at][far]) return ca...
#include <bits/stdc++.h> using namespace std; vector<int> edg[2005]; vector<int> ch[2005]; int cac[2005][2005]; int n, k, ans; void dfs(int at, int par = -1) { for (int u : edg[at]) if (u != par) { ch[at].push_back(u); dfs(u, at); } } int slv(int at, int far) { if (cac[at][far]) return ca...
[["-", 51, 2, 3, 4, 0, 69, 28, 69, 28, 22], ["-", 3, 4, 0, 69, 28, 69, 341, 342, 0, 70], ["-", 3, 4, 0, 69, 28, 69, 341, 342, 0, 22], ["-", 3, 4, 0, 69, 28, 69, 341, 342, 0, 73], ["-", 51, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["-", 51, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["-", 51, 2, 3, 4, 0, 69, 341, 342, 0, 73], ["+", 0, ...
1
648
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int n, k1, d[2000][2000]; vector<int> g[2000]; bool f[2000]; int dfs(int u, int v) { f[v] = true; if (d[u][v] == k1) { return 1; } int r = 1; for (int j = 0; j < g[v].size(); ++j) { int w = g[v][j]; ...
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; int n, k1, d[2000][2000]; vector<int> g[2000]; bool f[2000]; int dfs(int u, int v) { f[v] = true; if (d[u][v] > k1) { return 0; } else if (d[u][v] == k1) { return 1; } int r = 1; for (int j = 0; j < g...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35], ["+", 0, 14, 8, 9, 0, ...
1
518
#include <bits/stdc++.h> using namespace std; const int maxn = 2010, inf = 1000000; int res[maxn][maxn], n, m; vector<int> g[maxn], c[maxn]; void dfs(int x, int pa) { for (auto t : g[x]) if (t != pa) { dfs(t, x); c[x].push_back(t); } res[x][0] = 1; for (int t : c[x]) { res[x][0] += res...
#include <bits/stdc++.h> using namespace std; const int maxn = 2010, inf = 1000000; int res[maxn][maxn], n, m; vector<int> g[maxn], c[maxn]; void dfs(int x, int pa) { for (auto t : g[x]) if (t != pa) { dfs(t, x); c[x].push_back(t); } res[x][0] = 1; for (int t : c[x]) { res[x][0] += res...
[["-", 0, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 0, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 31, 22], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19], ["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22], ["+", 75, 76, 0, 9...
1
417
#include <bits/stdc++.h> using namespace std; void solve(); int main() { #ifdef OFFLINE freopen("input.txt", "r", stdin); #endif ios::sync_with_stdio(false); solve(); return 0; } #define forn(i, n) for (int i = 0; i < n; ++i) const int N = 2001; int n, k; vector<int> g[N]; int dfs(int u, int par, int h) {...
#include <bits/stdc++.h> using namespace std; void solve(); int main() { #ifdef OFFLINE freopen("input.txt", "r", stdin); #endif ios::sync_with_stdio(false); solve(); return 0; } #define forn(i, n) for (int i = 0; i < n; ++i) const int N = 2001; int n, k; vector<int> g[N]; int dfs(int u, int par, int h) {...
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 17, 151], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 31, 16, 17, 151], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-",...
1
326
#include <algorithm> #include <cassert> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <sstream> #include <string> #include <unordered_map> #include <vector> using namespace std; #ifndef MDEBUG #define NDEBUG #endif #define x first #define y second #define ll lon...
#include <algorithm> #include <cassert> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <sstream> #include <string> #include <unordered_map> #include <vector> using namespace std; #ifndef MDEBUG #define NDEBUG #endif #define x first #define y second #define ll lon...
[["+", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 43, 0, 35], ["-", 64, 9, 0, 7, 8, 9, 0, 338, 0, 88], ["-", 64, 9, 0, 7, 8, 9, 0, 338, 0, 24], ["-", 64, 9, 0, 7, 8, 9...
1
996
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iostream> #include <iterator> #include <map> #include <memory.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <time.h> #include <utility...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iostream> #include <iterator> #include <map> #include <memory.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <time.h> #include <utility...
[["-", 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
552
#include <bits/stdc++.h> #define FO(i, a, b) for (int i = (a); i < (b); i++) #define sz(v) int(v.size()) using namespace std; int n, k; vector<int> u[2005]; int ss[2005]; int f[2005][2005]; int tmp[2005]; void go(int i, int p) { ss[i] = 1; vector<int> c; for (int j : u[i]) if (j != p) { go(j, i); ...
#include <bits/stdc++.h> #define FO(i, a, b) for (int i = (a); i < (b); i++) #define sz(v) int(v.size()) using namespace std; int n, k; vector<int> u[2005]; int ss[2005]; int f[2005][2005]; int tmp[2005]; void go(int i, int p) { ss[i] = 1; vector<int> c; for (int j : u[i]) if (j != p) { go(j, i); ...
[["+", 31, 69, 28, 69, 28, 2, 3, 4, 0, 22], ["+", 31, 69, 28, 69, 28, 2, 3, 4, 0, 21], ["+", 31, 69, 28, 69, 28, 2, 3, 4, 0, 25], ["+", 0, 11, 31, 69, 28, 69, 0, 42, 0, 22], ["+", 0, 11, 31, 69, 28, 69, 341, 342, 0, 70], ["+", 0, 11, 31, 69, 28, 69, 341, 342, 0, 22], ["+", 0, 11, 31, 69, 28, 69, 341, 342, 0, 73], ["+",...
1
454
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; #ifndef ONLINE_JUDGE #define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl; #else #define dbg(x) #endif #define ff first #define ss second const int MAXN = 2048; vi adj[MAXN]; vi ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; #ifndef ONLINE_JUDGE #define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl; #else #define dbg(x) #endif #define ff first #define ss second const int MAXN = 2048; vi adj[MAXN]; vi ...
[["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 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
408
#define DEB #include <bits/stdc++.h> #define REP(i, m) for (int i = 0; i < (m); ++i) #define REPN(i, m, in) for (int i = (in); i < (m); ++i) #define ALL(t) (t).begin(), (t).end() #define CLR(a) memset((a), 0, sizeof(a)) #define pb push_back #define mp make_pair #define fr first #define sc second using namespace std; ...
#define DEB #include <bits/stdc++.h> #define REP(i, m) for (int i = 0; i < (m); ++i) #define REPN(i, m, in) for (int i = (in); i < (m); ++i) #define ALL(t) (t).begin(), (t).end() #define CLR(a) memset((a), 0, sizeof(a)) #define pb push_back #define mp make_pair #define fr first #define sc second using namespace std; ...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 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,...
1
629
#include <bits/stdc++.h> using namespace std; int N, K; vector<int> adj[2001]; int sz[2001]; int dp[2001][2001]; int ndp[2001][2001]; void dfs(int u, int p) { sz[u] = 1; dp[u][0] = 1; ndp[u][0] = 1; for (auto &v : adj[u]) if (v != p) { dfs(v, u); for (int i = 0; i < sz[u]; i++) for (i...
#include <bits/stdc++.h> using namespace std; int N, K; vector<int> adj[2001]; int sz[2001]; int dp[2001][2001]; int ndp[2001][2001]; void dfs(int u, int p) { sz[u] = 1; dp[u][0] = 1; ndp[u][0] = 1; for (auto &v : adj[u]) if (v != p) { dfs(v, u); for (int i = 0; i < sz[u]; i++) for (i...
[["-", 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, 7, 0, 88], ["+", 0, 14, 8, 9, 0, 7, 8, ...
1
373
#include <bits/stdc++.h> using namespace std; int n, m, sum, cnt; int a[110]; vector<int> b; int main() { cin >> n >> m; int odd = 0; for (int i = 0; i < m; i++) { cin >> a[i]; if (a[i] & 1) { swap(a[i], a[cnt++]); } } if (m == 1 && n == 1) { cout << "1\n1\n1\n"; return 0; } if ...
#include <bits/stdc++.h> using namespace std; int n, m, sum, cnt; int a[110]; vector<int> b; int main() { cin >> n >> m; int odd = 0; for (int i = 0; i < m; i++) { cin >> a[i]; if (a[i] & 1) { swap(a[i], a[cnt++]); } } if (m == 1 && n == 1) { cout << "1\n1\n1\n"; return 0; } if ...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["+", 12, 16, 12, 23, 0, 16, 31, 69, 28, 22], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 70], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 13], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 73], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 60...
1
284
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 88; int n, m, a[N]; int x, y; inline int read() { char c = getchar(); int s = 0; while (c < '0' || c > '9') c = getchar(); while (c >= '0' && c <= '9') { s = s * 10 + c - '0'; c = getchar(); } return s; } int main() { n = read()...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 88; int n, m, a[N]; int x, y; inline int read() { char c = getchar(); int s = 0; while (c < '0' || c > '9') c = getchar(); while (c >= '0' && c <= '9') { s = s * 10 + c - '0'; c = getchar(); } return s; } int main() { n = read()...
[["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["-", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 57, 64, 9, 0, 43, 49, 50, 0, 32], ["-", 64, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["-", 64, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 64, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 8, 9, 0, 57, 64, 9, 0, 43, 0, 35], ["-", 0, 57, 6...
1
567
#include <bits/stdc++.h> using namespace std; int n, m; int a[110]; vector<int> odd; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a[i]; if (a[i] & 1) odd.push_back(i); } if (m == 1) { cout << n << endl; cout << 2 << endl; cout << n - 1 << " " << 1 << endl; retu...
#include <bits/stdc++.h> using namespace std; int n, m; int a[110]; vector<int> odd; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a[i]; if (a[i] & 1) odd.push_back(i); } if (m == 1) { cout << n << endl; if (n == 1) { cout << 1 << endl << 1 << endl; return 0...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 0, ...
1
298
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define IN freopen("perimetric_chapter_1_input.txt", "r", stdin) #define OUT freopen("output.txt", "w", stdout) #define pb push_back #define mp make_pair #define FOR(i, a, b) for (i = a; i <= b; i++) #define DBG pr...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define IN freopen("perimetric_chapter_1_input.txt", "r", stdin) #define OUT freopen("output.txt", "w", stdout) #define pb push_back #define mp make_pair #define FOR(i, a, b) for (i = a; i <= b; i++) #define DBG pr...
[["-", 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, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 64, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 7, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 57, 75, 76, ...
1
465
import java.io.*; import java.text.*; import java.util.*; class Main { // SOLUTION BEGIN // Into the Hardware Mode void pre() throws Exception {} void solve(int TC) throws Exception { int N = ni(), M = ni(); int[] A = new int[M]; for (int i = 0; i < M; i++) A[i] = ni(); for (int i = 1; i ...
import java.io.*; import java.text.*; import java.util.*; class Main { // SOLUTION BEGIN // Into the Hardware Mode void pre() throws Exception {} void solve(int TC) throws Exception { int N = ni(), M = ni(); int[] A = new int[M]; for (int i = 0; i < M; i++) A[i] = ni(); for (int i = 1; i ...
[["-", 8, 498, 0, 195, 8, 196, 0, 514, 39, 78], ["-", 8, 498, 0, 195, 8, 196, 0, 514, 141, 22], ["-", 8, 498, 0, 195, 8, 196, 0, 514, 0, 102], ["+", 8, 196, 0, 7, 502, 503, 39, 506, 0, 507], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 141, 22], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 0, 32], ["+", 8, 196, 0, 7, 502, 503, 49,...
3
1,667
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> even, odd; for (int i = 0; i < m; i++) { int x; cin >> x; if (x % 2) odd.push_back(x); else even.push_back(x); } if (odd.size() > 2) { cout << "Impossible" << endl; } else i...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> even, odd; for (int i = 0; i < m; i++) { int x; cin >> x; if (x % 2) odd.push_back(x); else even.push_back(x); } if (odd.size() > 2) { cout << "Impossible" << endl; } else i...
[["+", 75, 76, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 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, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 57, 15, 339, 51, 16, ...
1
400
#include <algorithm> #include <cstdio> //#include <cstring> //#include <cctype> using namespace std; typedef long long ll; //////////LOCALS////////// #ifdef OFFLINE int unused_variable_name = (freopen("in.txt", "r", stdin), 1); #endif //////////LOCALS////////// int arr[110]; int main() { int n, m, flag = 0; scanf("...
#include <algorithm> #include <cstdio> //#include <cstring> //#include <cctype> using namespace std; typedef long long ll; //////////LOCALS////////// #ifdef OFFLINE int unused_variable_name = (freopen("in.txt", "r", stdin), 1); #endif //////////LOCALS////////// int arr[110]; int main() { int n, m, flag = 0; scanf("...
[["+", 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, 60], ["+", 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, 9, 0, 45], ["+", 8, 9, 0, ...
1
365
// In The Name Of Allah // Mohammad Hosseini #include <bits/stdc++.h> #define ss second #define ff first #define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define ret(n) return cout << n, 0 #define se(n) cout << setprecision(n) << fixed #defin...
// In The Name Of Allah // Mohammad Hosseini #include <bits/stdc++.h> #define ss second #define ff first #define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define ret(n) return cout << n, 0 #define se(n) cout << setprecision(n) << fixed #defin...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 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], ["+", 64, 37, 0, 34, 31, 16, 31, 16, 31, 22], ["+", 64, 37, 0, 34, 31, 16, 31, 16, 17, 151], ["+", ...
1
464
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, x, n) for (int i = x; i <= n; i++) #define rep3(i, x, n) for (int i = x; i >= n; i--) #define elif else if #define sp(x) fixed << setprecision(x) #define pb push_back #define eb emplace_back #define all(x) x.begi...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, x, n) for (int i = x; i <= n; i++) #define rep3(i, x, n) for (int i = x; i >= n; i--) #define elif else if #define sp(x) fixed << setprecision(x) #define pb push_back #define eb emplace_back #define all(x) x.begi...
[["+", 0, 42, 0, 83, 0, 42, 0, 2, 63, 22], ["+", 0, 83, 0, 42, 0, 2, 3, 4, 0, 24], ["+", 0, 42, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 42, 0, 2, 3, 4, 0, 16, 17, 60], ["+", 0, 42, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 83, 0, 42, 0, 2, 3, 4, 0, 25], ["+", 0, 42, 0, 83, 0, 2, 63, 118, 17, 131], ["+", 0, 42, 0, 83, 0, 2, 63,...
1
684
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double lf; typedef pair<int, int> ii; typedef pair<ii, int> iii; #define REP(i, n) for (int i = 0; i < n; i++) #define REP1(i, n) for (int i = 1; i <= n; i++) #define RST(i, n) memset(i, n, sizeof i) #define SZ(a) (int)a.size() #define ALL(a) a...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double lf; typedef pair<int, int> ii; typedef pair<ii, int> iii; #define REP(i, n) for (int i = 0; i < n; i++) #define REP1(i, n) for (int i = 1; i <= n; i++) #define RST(i, n) memset(i, n, sizeof i) #define SZ(a) (int)a.size() #define ALL(a) a...
[["+", 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, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60...
1
885
// Konrad Paluszek,University of Warsaw(former XIV LO Staszic) //#STAY AT HOME #ifndef LOCAL #pragma GCC optimize("O3") #endif #define TIME (chrono::steady_clock::now().time_since_epoch().count()) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define xfm(a, b) a#...
// Konrad Paluszek,University of Warsaw(former XIV LO Staszic) //#STAY AT HOME #ifndef LOCAL #pragma GCC optimize("O3") #endif #define TIME (chrono::steady_clock::now().time_since_epoch().count()) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define xfm(a, b) a#...
[["+", 0, 11, 12, 41, 15, 16, 31, 69, 28, 22], ["+", 12, 41, 15, 16, 31, 69, 341, 342, 0, 70], ["+", 12, 41, 15, 16, 31, 69, 341, 342, 0, 13], ["+", 12, 41, 15, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 1, 0, 11, 12, 41, 15, 16, 17, 60], ["+", 64, 1, 0, 11, 12, 41, 15, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 11, 12, 41, 0, 1...
1
1,991
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i <= b; i++) #define per(i, a, b) for (int i = a; i >= b; i--) typedef long long LL; const LL mod = 1e9 + 7; // head int n, m, a[105], b[105], cnt; int main() { cin >> n >> m; rep(i, 1, m) { cin >> a[i]; if (a[i] & 1) ...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i <= b; i++) #define per(i, a, b) for (int i = a; i >= b; i--) typedef long long LL; const LL mod = 1e9 + 7; // head int n, m, a[105], b[105], cnt; int main() { cin >> n >> m; rep(i, 1, m) { cin >> a[i]; if (a[i] & 1) ...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 31, 16, 31, 16, 31, 16, 12, 23, 0, 24], ["+", 31, 16, 12, 23, 0, 41, 1...
1
322
/* ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀▀▀ ...
/* ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀▀▀ ...
[["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 17, 131], ["+", 15, 339, 51, 16, 31, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["...
1
741
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; int n, m, a[N]; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= m; ++i) scanf("%d", &a[i]); int cnt = 0; for (int i = 1; i <= m; ++i) if (a[i] & 1) cnt++; if (cnt > 2) return 0 * puts("Impossible"); cnt = 0...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; int n, m, a[N]; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= m; ++i) scanf("%d", &a[i]); int cnt = 0; for (int i = 1; i <= m; ++i) if (a[i] & 1) cnt++; if (cnt > 2) return 0 * puts("Impossible"); cnt = 0...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 15, 339, 51, 16, 12, 16, 31, 69, 28, 22], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 51, 16, 12, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 1...
1
325
#include <bits/stdc++.h> #include <unistd.h> using namespace std; #define DEBUG(x) cerr << #x << ": " << x << endl; #define DEBUG_VEC(v) \ cerr << #v << ":"; \ for (int i = 0; i < v.size(); i++) ...
#include <bits/stdc++.h> #include <unistd.h> using namespace std; #define DEBUG(x) cerr << #x << ": " << x << endl; #define DEBUG_VEC(v) \ cerr << #v << ":"; \ for (int i = 0; i < v.size(); i++) ...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 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, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17...
1
917
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++i) #define per(i, a, b) for (int i = (a), _ = (b); i >= _; --i) #define For(i, a, b) for (int i = (a), _ = (b); i < _; ++i) #define ri rd<int> using n...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++i) #define per(i, a, b) for (int i = (a), _ = (b); i >= _; --i) #define For(i, a, b) for (int i = (a), _ = (b); i < _; ++i) #define ri rd<int> using n...
[["+", 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, 60], ["+", 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, 2, 63, 22], ["+", 0, 57, 64...
1
449
#include <iostream> #include <vector> using namespace std; void failure() { cout << "Impossible" << endl; exit(0); } int main() { ios::sync_with_stdio(false); int n, m; cin >> n >> m; if (m == 1) { int a; cin >> a; if (a <= 2) failure(); cout << a << endl; cout << 2 << endl; ...
#include <iostream> #include <vector> using namespace std; void failure() { cout << "Impossible" << endl; exit(0); } int main() { ios::sync_with_stdio(false); int n, m; cin >> n >> m; if (m == 1) { int a; cin >> a; if (a == 1) { cout << a << endl; cout << 1 << endl; cout ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["-", 64, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, ...
1
419
#include <bits/stdc++.h> using namespace std; using int64 = long long; constexpr int DEBUG = 0; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<int> xs(m); int odd_count = 0; for (int i = 0; i < m; i++) { cin >> xs[i]; if (xs[i] % 2 == 1) { odd_count...
#include <bits/stdc++.h> using namespace std; using int64 = long long; constexpr int DEBUG = 0; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<int> xs(m); int odd_count = 0; for (int i = 0; i < m; i++) { cin >> xs[i]; if (xs[i] % 2 == 1) { odd_count...
[["-", 64, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 64, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 2, 3, 4, 0, 16, 31, 69, 28, 22], ["-", 3, 4, 0, 16, 31, 69, 341, 342, 0, 70], ["-", 0, 16, 31, 69, 341, 342, 0, 16, 31, 22], ["-", 0, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-...
1
479
#include <bits/stdc++.h> using namespace std; vector<int> evens, odds; int N, M; int main() { cin >> N >> M; while (M--) { int x; cin >> x; if (x % 2) { odds.push_back(x); } else { evens.push_back(x); } } if (odds.size() > 2) { cout << "Impossible\n"; return 0; } if ...
#include <bits/stdc++.h> using namespace std; vector<int> evens, odds; int N, M; int main() { cin >> N >> M; while (M--) { int x; cin >> x; if (x % 2) { odds.push_back(x); } else { evens.push_back(x); } } if (odds.size() > 2) { cout << "Impossible\n"; return 0; } if ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["+", 12, 16, 12, 23, 0, 16, 31, 69, 28, 22], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 70], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 13], ["+...
1
579
from sys import exit n, m = map(int, input().split()) a = list(map(int, input().split())) odd = [] even = [] for x in a: if x%2 == 0: even.append(x) else: odd.append(x) if n%2 == 0: if len(odd) > 2: print("Impossible") exit() if len(odd) == 2: a = [odd[0]] + even + [odd[1]] b = [odd[0]+1] + even + [od...
from sys import exit n, m = map(int, input().split()) a = list(map(int, input().split())) odd = [] even = [] for x in a: if x%2 == 0: even.append(x) else: odd.append(x) if n%2 == 0: if len(odd) > 2: print("Impossible") exit() if len(odd) == 2: a = [odd[0]] + even + [odd[1]] b = [odd[0]+1] + even + [od...
[["+", 0, 57, 75, 76, 8, 196, 0, 57, 0, 121], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 57, 75, 76, 8, 196, 0, 57, 0, 102], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32],...
5
262
#define ENABLE_DEBUG 1 // Kana's kitchen {{{ #include <bits/stdc++.h> #define ALL(v) std::begin(v), std::end(v) #define REP(i, k) for (decltype(k) i = 0; i < k; i++) #define LOOP(k) REP(i, ngtkana_is_genius) using i32 = std::int_least32_t; using i64 = std::int_least64_t; using u32 = std::uint_least32_t; using u64 = st...
#define ENABLE_DEBUG 1 // Kana's kitchen {{{ #include <bits/stdc++.h> #define ALL(v) std::begin(v), std::end(v) #define REP(i, k) for (decltype(k) i = 0; i < k; i++) #define LOOP(k) REP(i, ngtkana_is_genius) using i32 = std::int_least32_t; using i64 = std::int_least64_t; using u32 = std::uint_least32_t; using u64 = st...
[["-", 63, 218, 8, 9, 0, 57, 64, 37, 0, 38], ["-", 8, 9, 0, 57, 64, 37, 0, 83, 0, 13], ["-", 8, 9, 0, 57, 64, 37, 0, 83, 0, 21], ["+", 8, 9, 0, 57, 64, 9, 0, 43, 39, 78], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 57, 64, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 57, 64...
1
602
#include <bits/stdc++.h> #define all(x) x.begin(), x.end() using namespace std; using vi = vector<int>; const int maxn = 1010, mod = 1e9 + 7; int n, m; vi a, b; struct dsu { int sz; vi r, p; dsu(int n) : r(n + 1, 1), p(n + 1), sz(n) { iota(all(p), 0); } int par(int v) { return v == p[v] ? v : p[v] = par(p[v]); ...
#include <bits/stdc++.h> #define all(x) x.begin(), x.end() using namespace std; using vi = vector<int>; const int maxn = 1010, mod = 1e9 + 7; int n, m; vi a, b; struct dsu { int sz; vi r, p; dsu(int n) : r(n + 1, 1), p(n + 1), sz(n) { iota(all(p), 0); } int par(int v) { return v == p[v] ? v : p[v] = par(p[v]); ...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 338, 8, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 338, 8, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 338, 8, 57, 64, 37, 0, 38], ["+", 8, 57, 64, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 57, ...
1
714
#include <algorithm> #include <cstdio> #include <vector> #define PB push_back using namespace std; const int N = 1e5 + 500; int n, m, A[N]; vector<int> a, b, nep; int main() { scanf("%d%d", &n, &m); if (m == 1) { int x; scanf("%d", &x); printf("%d\n2\n%d %d\n", x, 1, x - 1); return 0; } for...
#include <algorithm> #include <cstdio> #include <vector> #define PB push_back using namespace std; const int N = 1e5 + 500; int n, m, A[N]; vector<int> a, b, nep; int main() { scanf("%d%d", &n, &m); if (m == 1) { int x; scanf("%d", &x); if (x == 1) { printf("1\n1\n1\n"); return 0; }...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 64,...
1
419
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define vll vector<ll> #define vvvl vector<vvl> #define vvl vector<vector<ll>> #define VV(a, b, c, d) v...
#include <algorithm> #include <bitset> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define vll vector<ll> #define vvvl vector<vvl> #define vvl vector<vector<ll>> #define VV(a, b, c, d) v...
[["+", 64, 1, 0, 11, 12, 191, 51, 83, 0, 13], ["+", 64, 1, 0, 11, 12, 191, 51, 83, 0, 21], ["-", 0, 11, 12, 191, 51, 83, 0, 16, 12, 13], ["-", 64, 1, 0, 11, 12, 191, 51, 83, 0, 21], ["+", 0, 57, 75, 76, 0, 9, 0, 57, 0, 121], ["+", 75, 76, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", ...
1
462
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> P; template <typename T> inline void chkmin(T &a, const T &b) { a = a < b ? a : b; } template <typename T> inline void chkmax(T &a, const T &b) { a = a > b ? a : b; } const int MAXN = 100005; int A[MAXN], n, m; vector<int> B...
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> P; template <typename T> inline void chkmin(T &a, const T &b) { a = a < b ? a : b; } template <typename T> inline void chkmax(T &a, const T &b) { a = a > b ? a : b; } const int MAXN = 100005; int A[MAXN], n, m; vector<int> B...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 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, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17...
1
472
#include <algorithm> #include <cstdio> using namespace std; const int N = 105, LEN = 1e5 + 5; int n, m, A[N], B[LEN], cnt, deg[LEN], pp[LEN]; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= m; ++i) { scanf("%d", &A[i]); if (A[i] & 1) ++cnt; } if (((n & 1) && cnt >= 2) || ((!(n & 1)) && cn...
#include <algorithm> #include <cstdio> using namespace std; const int N = 105, LEN = 1e5 + 5; int n, m, A[N], B[LEN], cnt, deg[LEN], pp[LEN]; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= m; ++i) { scanf("%d", &A[i]); if (A[i] & 1) ++cnt; } if (((n & 1) && cnt >= 2) || ((!(n & 1)) && cn...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 51, 22], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25]]
1
450
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #define _USE_MATH_DEFINES #include <complex> #include <functional> #include <math.h> using namespace std; #define rep(i, x) for (ll i = 0; i < x; i++) #define r...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #define _USE_MATH_DEFINES #include <complex> #include <functional> #include <math.h> using namespace std; #define rep(i, x) for (ll i = 0; i < x; i++) #define r...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 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, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17...
1
983
#pragma GCC optimize("Ofast", "unroll-loops") #include <bits/stdc++.h> using namespace std; int N, M, A[100]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> N >> M; copy_n(istream_iterator<int>(cin), M, A); int odd = partition(A, A + M, [](int v) -> bool { return v % 2; }) - A; vector<in...
#pragma GCC optimize("Ofast", "unroll-loops") #include <bits/stdc++.h> using namespace std; int N, M, A[100]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> N >> M; copy_n(istream_iterator<int>(cin), M, A); int odd = partition(A, A + M, [](int v) -> bool { return v % 2; }) - A; vector<in...
[["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 3, 4, 0, 69, 341, 342, 0,...
1
413
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define FILL(i, n) memset(i, n, sizeof i) #define X first #define Y second #define ET cout << "\n" #define SZ(a) ((int)a.size()) ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define FILL(i, n) memset(i, n, sizeof i) #define X first #define Y second #define ET cout << "\n" #define SZ(a) ((int)a.size()) ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 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, 57, 64, 37, 0, 34, 31, 16, 31, 22], ["+", 0, 57, 64, 37, 0, 34, 31, 16, 17, 151], ["+", 64...
1
536
#include <algorithm> #include <iostream> #include <vector> //#include <random> #include <bitset> #include <cmath> #include <cstring> #include <iomanip> #include <map> #include <queue> #include <set> //#include <unordered_map> using namespace std; template <typename T> void uin(T &a, T b) { if (b < a) a = b; } t...
#include <algorithm> #include <iostream> #include <vector> //#include <random> #include <bitset> #include <cmath> #include <cstring> #include <iomanip> #include <map> #include <queue> #include <set> //#include <unordered_map> using namespace std; template <typename T> void uin(T &a, T b) { if (b < a) a = b; } t...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 57, 0, 121], ["+", 0, 57, 75, 76, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 28, 22], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 17, 131], ["+", 0, 57, 15, 339, 51, 2, 63, 118, 119, 120], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 24], ["...
1
476
#include "bits/stdc++.h" using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) cin >> A[i]; if (M == 1) { if (A[0] == 1) cout << 1 << endl << 1 << endl << 1 << endl; else cout << A[0] << endl << 2 << endl << A[0] - 1 << ' ' << 1 << en...
#include "bits/stdc++.h" using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(M); for (int i = 0; i < M; i++) cin >> A[i]; if (M == 1) { if (A[0] == 1) cout << 1 << endl << 1 << endl << 1 << endl; else cout << A[0] << endl << 2 << endl << A[0] - 1 << ' ' << 1 << en...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["+", 0, 57, 64, 9, 0, 7, 8, 9, 0, 46], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 57, 6...
1
477
// by newbiechd #include <algorithm> #include <cassert> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <vector> // DELETE the debugging information! #define debug(x) std::cerr << #x << " = " << (x) << std::endl const int N_MAX = 100003; int a[N_MAX]; int main() { int n, m; s...
// by newbiechd #include <algorithm> #include <cassert> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <vector> // DELETE the debugging information! #define debug(x) std::cerr << #x << " = " << (x) << std::endl const int N_MAX = 100003; int a[N_MAX]; int main() { int n, m; s...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0...
1
412
#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() ...
[["-", 0, 11, 12, 16, 31, 16, 12, 69, 28, 22], ["-", 12, 16, 31, 16, 12, 69, 341, 342, 0, 70], ["-", 12, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["-", 12, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13]...
1
1,088
#include <bits/stdc++.h> using namespace std; int n, m, a[110], b[110], res; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= m; i++) { scanf("%d", &a[i]); res += a[i] & 1; } if (m == 1) { printf("%d\n", a[1]); if (a[1] > 1) { printf("2\n"); printf("%d %d", a[1] - 1, 1); ...
#include <bits/stdc++.h> using namespace std; int n, m, a[110], b[110], res; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= m; i++) { scanf("%d", &a[i]); res += a[i] & 1; } if (m == 1) { printf("%d\n", a[1]); if (a[1] > 1) { printf("2\n"); printf("%d %d", a[1] - 1, 1); ...
[["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 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, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 1, 0, 27, 28, 69, 28, 22], ["+", 64, 1, 0, ...
1
348
// includes #include <bits/stdc++.h> using namespace std; // macros #define pb emplace_back #define mk make_pair #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define irep(itr, st) for (auto itr = (st).begin(); itr != (st)...
// includes #include <bits/stdc++.h> using namespace std; // macros #define pb emplace_back #define mk make_pair #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) FOR(i, 0, n) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define irep(itr, st) for (auto itr = (st).begin(); itr != (st)...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 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, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17...
1
1,380
#include <bits/stdc++.h> const int kN = 205; std::list<int> vec; int main() { int n, m, odd_cnt = 0, bk = 0, cnt = 0, x; scanf("%d%d", &n, &m); for (int i = 1; i <= m; ++i) { scanf("%d", &x); if (x % 2 == 1) { if (!odd_cnt) bk = x; else if (odd_cnt == 1) vec.push_front(x); ...
#include <bits/stdc++.h> const int kN = 205; std::list<int> vec; int main() { int n, m, odd_cnt = 0, bk = 0, cnt = 0, x; scanf("%d%d", &n, &m); for (int i = 1; i <= m; ++i) { scanf("%d", &x); if (x % 2 == 1) { if (!odd_cnt) bk = x; else if (odd_cnt == 1) vec.push_front(x); ...
[["+", 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, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, ...
1
261
#include <algorithm> #include <bitset> #include <chrono> #include <functional> #include <iostream> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define endl '\n' int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; c...
#include <algorithm> #include <bitset> #include <chrono> #include <functional> #include <iostream> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define endl '\n' int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; c...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["+", 12, 16, 12, 23, 0, 16, 31, 69, 28, 22], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 70], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 13], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 73], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 60...
1
329
#pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #include <algorithm> #include <assert.h> #include <bitset> #include <cfloat> #include <complex> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include...
#pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #include <algorithm> #include <assert.h> #include <bitset> #include <cfloat> #include <complex> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include...
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 22]]
1
871
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; int n, k, w[N], q[N]; int main() { cin >> n >> n; for (int i = 1; i <= n; i++) cin >> w[i]; for (int i = 1; i <= n; i++) if (w[i] % 2 == 1) swap(w[1], w[i]); for (int i = 2; i <= n; i++) if (w[i] % 2 == 1) swap(w[1], w[...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; int n, k, w[N], q[N]; int main() { cin >> n >> n; for (int i = 1; i <= n; i++) cin >> w[i]; for (int i = 1; i <= n; i++) if (w[i] % 2 == 1) swap(w[1], w[i]); for (int i = 2; i <= n; i++) if (w[i] % 2 == 1) swap(w[n], w[...
[["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9...
1
315
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n, a[1000], i, j, m, hol = 0, x[2], y[2], t = 0, c; scanf("%d %d", &n, &m); for (i = 1; i <= m; i++) { scanf("%d", &a[i]); if (a[i] % 2) { hol++; if (hol == 1) { x[0] = i...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { int n, a[1000], i, j, m, hol = 0, x[2], y[2], t = 0, c; scanf("%d %d", &n, &m); for (i = 1; i <= m; i++) { scanf("%d", &a[i]); if (a[i] % 2) { hol++; if (hol == 1) { x[0] = i...
[["+", 0, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 0, ...
1
536
// khodaya khodet komak kon #include <bits/stdc++.h> #define F first #define S second #define pb push_back #define all(x) x.begin(), x.end() #pragma GCC optimise("ofast") #pragma GCC optimise("unroll-loops") using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; const int N =...
// khodaya khodet komak kon #include <bits/stdc++.h> #define F first #define S second #define pb push_back #define all(x) x.begin(), x.end() #pragma GCC optimise("ofast") #pragma GCC optimise("unroll-loops") using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; const int N =...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 64,...
1
417
#include <bits/stdc++.h> using namespace std; #define N 100010 int a[N], n, m, num; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= m; ++i) { scanf("%d%d", &a[i]); num += a[i] & 1; } if (num > 2) { printf("Impossible\n"); return 0; } for (int i = 2; i < m; ++i) if (a[i] & 1) ...
#include <bits/stdc++.h> using namespace std; #define N 100010 int a[N], n, m, num; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= m; i++) { scanf("%d", &a[i]); num += a[i] & 1; } if (num > 2) { printf("Impossible\n"); return 0; } for (int i = 2; i < m; i++) if (a[i] & 1) ...
[["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 2, 3, 4, 0, 41, 15, 23, 0, 24], ["+", 0, 2, 3, 4, 0, 41, 15, 23, 0, 25]]
1
274
#include <bits/stdc++.h> #define N 1000005 #define ll long long int #define MP make_pair #define pb push_back #define ppb pop_back #define sp " " #define endl "\n" #define fi first #define se second #define ii pair<int, int> #define lli pair<ll, ll> #define fast ...
#include <bits/stdc++.h> #define N 1000005 #define ll long long int #define MP make_pair #define pb push_back #define ppb pop_back #define sp " " #define endl "\n" #define fi first #define se second #define ii pair<int, int> #define lli pair<ll, ll> #define fast ...
[["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 15, 339, 51, 16, 31, 16, 31, 69, 28, 22], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 13], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 73], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, ...
1
420
#include <bits/stdc++.h> const int N = 100054; int n; int a[N], b[N]; int main() { int i, mid; scanf("%*d%d", &n); for (i = 0; i < n; ++i) scanf("%d", a + i); if (n == 1) return printf("%d\n1\n1 %d\n", *a, *a - 1), 0; mid = std::partition(a, a + n, [](const int x) -> bool { return x % 2; }) - a; ...
#include <bits/stdc++.h> const int N = 108; int n; int a[N], b[N]; int main() { int i, mid; scanf("%*d%d", &n); for (i = 0; i < n; ++i) scanf("%d", a + i); if (n == 1) return *a == 1 ? puts("1\n1\n1") : printf("%d\n2\n1 %d\n", *a, *a - 1), 0; mid = std::partition(a, a + n, [](const int x) -> bool {...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 0, 34, 31, 41, 15, 16, 31, 66, 17, 48], ["+", 0, 34, 31, 41, 15, 16, 31, 66, 28, 22], ["+", 64, 37, 0, 34, 31, 41, 15, 16, 17, 60], ["+", 64, 37, 0, 34, 31, 41, 15, 16, 12, 13], ["+", 0, 57, 64, 37, 0, 34, 31, 41, 0, 101], ...
1
264
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; inline int gi() { char c = getchar(); while (c < '0' || c > '9') c = getchar(); int sum = 0; while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar(); return sum; } int n, m, a[maxn], pos[2]; int main() { n = gi();...
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; inline int gi() { char c = getchar(); while (c < '0' || c > '9') c = getchar(); int sum = 0; while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar(); return sum; } int n, m, a[maxn], pos[maxn]; int main() { n = gi...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["-", 0, 11, 31, 69, 341, 342, 0, 27, 17, 29], ["+", 0, 11, 31, 69, 341, 342, 0, 27, 17, 29], ["-", 0, 34, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 34, 31, 2, 3, 4, 0, 5, 0, 6], ["-", 31, 2, 3, 4, 0, 16, 31, 69, 28, 22], ["-", 3, 4, 0,...
1
391
// Crt. 2020-01-13 08:35:28 #include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define N 100005 using namespace std; int n, m, a[N], b[N], cnt; inline bool cmp(int x, int y) { return x % 2 > y % 2; } int main() { #ifdef LOCAL_JUDGE freopen(".in", "r", stdin); freopen(".out", "w", stdo...
// Crt. 2020-01-13 08:35:28 #include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #define N 100005 using namespace std; int n, m, a[N], b[N], cnt; inline bool cmp(int x, int y) { return x % 2 > y % 2; } int main() { #ifdef LOCAL_JUDGE freopen(".in", "r", stdin); freopen(".out", "w", stdo...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 31, ...
1
507
#include <bits/stdc++.h> using namespace std; int n, m; int arr[100005]; vector<int> ans; int main() { scanf("%d%d", &n, &m); int numodd = 0; for (int x = 0; x < m; x++) { scanf("%d", &arr[x]); if (arr[x] % 2 == 1) numodd++; if (numodd > 2) { printf("Impossible"); return 0; } ...
#include <bits/stdc++.h> using namespace std; int n, m; int arr[100005]; vector<int> ans; int main() { scanf("%d%d", &n, &m); int numodd = 0; for (int x = 0; x < m; x++) { scanf("%d", &arr[x]); if (arr[x] % 2 == 1) numodd++; if (numodd > 2) { printf("Impossible"); return 0; } ...
[["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 13], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4...
1
397
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int a[N], b[N], c[N], tt = 0; int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= m; i++) { scanf("%d", &a[i]); if (a[i] % 2) c[++tt] = i; } if (tt > 2) { printf("Impossible\n"); return 0; } else if (tt...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int a[N], b[N], c[N], tt = 0; int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= m; i++) { scanf("%d", &a[i]); if (a[i] % 2) c[++tt] = i; } if (tt > 2) { printf("Impossible\n"); return 0; } else if (tt...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 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, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17...
1
327
#include <bits/stdc++.h> #define IO_OP \ std::ios::sync_with_stdio(0); \ std::cin.tie(0); #define F first #define S second #define V vector #define PB push_back #define MP make_pair #define EB emplace_bac...
#include <bits/stdc++.h> #define IO_OP \ std::ios::sync_with_stdio(0); \ std::cin.tie(0); #define F first #define S second #define V vector #define PB push_back #define MP make_pair #define EB emplace_bac...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 64,...
1
352
#ifndef __cplusplus cat << EOF #endif #include <bits/stdc++.h> using namespace std; #define rep(...) overload_rep(__VA_ARGS__, rep_1, rep_0)(__VA_ARGS__) #define rep_0(i, end) for (int i = 0; i < (end); ++i) #define rep_1(i, fr, ba) for (int i = (fr); i <= (ba); ++i) #define overload_rep(arg0, arg1, arg2, name, .....
#ifndef __cplusplus cat << EOF #endif #include <bits/stdc++.h> using namespace std; #define rep(...) overload_rep(__VA_ARGS__, rep_1, rep_0)(__VA_ARGS__) #define rep_0(i, end) for (int i = 0; i < (end); ++i) #define rep_1(i, fr, ba) for (int i = (fr); i <= (ba); ++i) #define overload_rep(arg0, arg1, arg2, name, .....
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["-", 3...
1
463
#define DEBUG 0 #include <bits/stdc++.h> using namespace std; #if DEBUG // basic debugging macros int __i__, __j__; #define printLine(l) \ for (__i__ = 0; __i__ < l; __i__++) { \ cout << "-"; ...
#define DEBUG 0 #include <bits/stdc++.h> using namespace std; #if DEBUG // basic debugging macros int __i__, __j__; #define printLine(l) \ for (__i__ = 0; __i__ < l; __i__++) { \ cout << "-"; ...
[["+", 75, 76, 0, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 64,...
1
587
n,m = [int(i) for i in input().split()] a = [int(i) for i in input().split()] breakFlag = False for i in range(1,m-1): if a[i]%2==1: if a[0]%2==1: if a[len(a)-1]%2==1: print("Impossible") breakFlag = True break else: a[...
n,m = [int(i) for i in input().split()] a = [int(i) for i in input().split()] breakFlag = False for i in range(1,m-1): if a[i]%2==1: if a[0]%2==1: if a[len(a)-1]%2==1: print("Impossible") breakFlag = True break else: a[...
[["-", 64, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22], ["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 60], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 612], ["-", 64, 196, 0, 57, 64, 196, 0, 57, 0, 102...
5
304
#include <bits/stdc++.h> using namespace std; int n, m, a[105], ans = 0, cnt; void display(int l, int r) { for (int i = l; i <= r; i++) printf("%d ", a[i]); printf("\n"); } int main() { cin >> n >> m; for (int i = 0; i < m; i++) cin >> a[i]; if (m == 1) return printf("%d \n2 \n%d 1\n", n, n - ...
#include <bits/stdc++.h> using namespace std; int n, m, a[105], ans = 0, cnt; void display(int l, int r) { for (int i = l; i <= r; i++) printf("%d ", a[i]); printf("\n"); } int main() { cin >> n >> m; for (int i = 0; i < m; i++) cin >> a[i]; if (n == 1) return printf("1\n1\n1\n"), 0; if (m =...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 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, 57, 64, 37, 0, 34, 31, 2, 63, 22], ["+", 64, 37, 0, 34, 31, 2, 3, 4, 0, 24], ["+", 0, 34, ...
1
825
#include <bits/stdc++.h> #define BIT(n) (1LL << (n)) #define BITF(n, i) (((n) >> i) & 1) #define REP(i, n) for (int i = 0; i < n; i++) #define REPB(i, n) for (int i = 0; i < BIT(n); i++) #define REPS(i, x) for (int i = 1; i <= x; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define REPZ(i, x) for (int i = 0; i ...
#include <bits/stdc++.h> #define BIT(n) (1LL << (n)) #define BITF(n, i) (((n) >> i) & 1) #define REP(i, n) for (int i = 0; i < n; i++) #define REPB(i, n) for (int i = 0; i < BIT(n); i++) #define REPS(i, x) for (int i = 1; i <= x; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define REPZ(i, x) for (int i = 0; i ...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 0, ...
1
1,089
#include <bits/stdc++.h> using namespace std; int n, k; int a[233], odd[3], top; int main() { ios_base::sync_with_stdio(false); cin >> n >> k; for (int i = 1; i <= k; i++) { cin >> a[i]; if (a[i] % 2) { odd[++top] = i; } } if (top > 2) return puts("Impossible"), 0; else if (top == 2) {...
#include <bits/stdc++.h> using namespace std; int n, k; int a[233], odd[3], top; int main() { ios_base::sync_with_stdio(false); cin >> n >> k; for (int i = 1; i <= k; i++) { cin >> a[i]; if (a[i] % 2) { odd[++top] = i; } } if (top > 2) return puts("Impossible"), 0; else if (top == 2) {...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 60], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 25], ["+", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["...
1
278
#include <bits/stdc++.h> #pragma optimizer(O2) using namespace std; #define LL long long #define ULL unsigned long long #define mp make_pair #define pb push_back #define pii pair<int, int> #define pll pair<LL, LL> #define x first #define y second #define pi acos(-1) #define sqr(x) ((x) * (x)) #define pdd pair<double, d...
#include <bits/stdc++.h> #pragma optimizer(O2) using namespace std; #define LL long long #define ULL unsigned long long #define mp make_pair #define pb push_back #define pii pair<int, int> #define pll pair<LL, LL> #define x first #define y second #define pi acos(-1) #define sqr(x) ((x) * (x)) #define pdd pair<double, d...
[["-", 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, 13], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1...
1
580
#include <bits/stdc++.h> const int N = 105; int n, m, a[N]; int main() { std::ios::sync_with_stdio(0), std::cin.tie(0); std::cin >> n >> m; for (int i = 1; i <= m; ++i) std::cin >> a[i]; std::sort(a + 1, a + m + 1, [](int x, int y) { return (x & 1) > (y & 1); }); if (a[3] & 1) return std::cout << "Im...
#include <bits/stdc++.h> const int N = 105; int n, m, a[N]; int main() { std::ios::sync_with_stdio(0), std::cin.tie(0); std::cin >> n >> m; for (int i = 1; i <= m; ++i) std::cin >> a[i]; std::sort(a + 1, a + m + 1, [](int x, int y) { return (x & 1) > (y & 1); }); if (a[3] & 1) return std::cout << "Im...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 24], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 17, 60], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 12, 23, 0, 25], ["+", 31, 16, 12, 16, 12, 23, 0, 16, 12, 22], [...
1
270
#include <bits/stdc++.h> using namespace std; const int M = 110; vector<int> odd; int A[M]; int n, m; int main() { // freopen("a.txt", "r", stdin); cin >> n >> m; for (int i = 1; i <= m; ++i) cin >> A[i]; if (m == 1) { cout << A[1] << endl; cout << 2 << endl; cout << A[1] - 1 << " " << 1 << e...
#include <bits/stdc++.h> using namespace std; const int M = 110; vector<int> odd; int A[M]; int n, m; int main() { // freopen("a.txt", "r", stdin); cin >> n >> m; for (int i = 1; i <= m; ++i) cin >> A[i]; if (m == 1) { cout << A[1] << endl; if (A[1] == 1) { cout << 1 << endl << 1 << endl; ...
[["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 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, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17...
1
300
#include <bits/stdc++.h> #define MIN_INT -2147483648 #define MAX_INT 2147483647 #define MIN_LONG -9223372036854775808L #define MAX_LONG 9223372036854775807L #define long long long int using namespace std; // @author: pashka int main() { ios::sync_with_stdio(false); int n; int m; cin >> n >> m; vector<in...
#include <bits/stdc++.h> #define MIN_INT -2147483648 #define MAX_INT 2147483647 #define MIN_LONG -9223372036854775808L #define MAX_LONG 9223372036854775807L #define long long long int using namespace std; // @author: pashka int main() { ios::sync_with_stdio(false); int n; int m; cin >> n >> m; vector<in...
[["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 18], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 47], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 338, 0, 88], ["+", 0, 30, 0,...
1
309