output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; int MAX_INT = numeric_limits<int>::max(); int MIN_INT = numeric_limits<int>::min(); long long MAX_LL = numeric_limits<long long>::max(); long long MIN_LL = numeric_limits<long long>::min(); int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; ...
### Prompt Generate a Cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the wh...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long t, n, x; cin >> t; while (t--) { cin >> n >> x; cout << 2 * x << "\n"; } }
### Prompt Generate a CPP solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the wh...
#include <bits/stdc++.h> using namespace std; int main() { int t; long long result; long long n, x; cin >> t; for (int i = 0; i < t; i++) { cin >> n >> x; result = x * 2; cout << result << endl; } return 0; }
### Prompt Your challenge is to write a cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers...
#include <bits/stdc++.h> using namespace std; int arr[1000000]; int main() { long long t, a, b, n; cin >> t; while (t > 0) { cin >> a >> b; cout << 2 * b << endl; t--; } return 0; }
### Prompt Your task is to create a Cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). Y...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n--) { int a, b; cin >> a >> b; cout << 2 * b << endl; } return 0; }
### Prompt Your task is to create a CPP solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). Y...
#include <bits/stdc++.h> using namespace std; #pragma GCC target("avx2") #pragma GCC optimization("unroll-loops") #pragma GCC optimize("O2") constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1}; constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1}; constexpr long long INF = 1999999999999999997; constexpr int inf = INT_MAX; con...
### Prompt Generate a cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the wh...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) { int n, x; cin >> n >> x; cout << 2 * x << endl; } return 0; }
### Prompt Please create a solution in cpp to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e9 + 7; const int N = 1e4 + 500; long long t, n, x; int main() { cin >> t; while (t--) { cin >> n >> x; cout << x * 2 << "\n"; } }
### Prompt Your task is to create a cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). Y...
#include <bits/stdc++.h> using namespace std; long long x, n; int main() { int q; cin >> q; for (int i = 0; i < q; i++) { cin >> n >> x; cout << (2 * x) << endl; } return 0; }
### Prompt Your task is to create a cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). Y...
#include <bits/stdc++.h> using namespace std; int main() { long long n, x; int T; while (cin >> T) while (T--) { cin >> n >> x; cout << 2 * x << endl; } return 0; }
### Prompt Generate a Cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the wh...
#include <bits/stdc++.h> using namespace std; void c_p_c() {} int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int t; cin >> t; while (t--) { long long int n, x; cin >> n >> x; cout << 2 * x << endl; } return 0; }
### Prompt Your challenge is to write a Cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers...
#include <bits/stdc++.h> using namespace std; int main() { int t, i, n, x; cin >> t; for (i = 1; i <= t; i++) { cin >> n >> x; cout << 2 * x << endl; } return 0; }
### Prompt Generate a cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the wh...
#include <bits/stdc++.h> using namespace std; int T; int n, x; int main() { scanf("%d", &T); for (int ii = 0; ii < T; ii++) { scanf("%d%d", &n, &x); int ans = x * 2; printf("%d\n", ans); } return 0; }
### Prompt Please formulate a CPP solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long T; cin >> T; while (T--) { long long n, x; cin >> n >> x; cout << 2 * x << endl; } }
### Prompt Your task is to create a CPP solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). Y...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, t; cin >> t; vector<int> N; vector<int> X; for (i = 0; i < t; i++) { int n, x; cin >> n; cin >> x; N.push_back(n); X.push_back(x); } for (j = 0; j < t; j++) { cout << (2 * X[j]) << endl; } }
### Prompt Develop a solution in CPP to the problem described below: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> using namespace std; int main() { long long int t, x, n; cin >> t; while (t--) { cin >> n >> x; cout << 2 * x << "\n"; } }
### Prompt Your task is to create a cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). Y...
#include <bits/stdc++.h> using namespace std; int q[10000001]; vector<int> v; int main() { long long n, a, b, i, cnt = 0, c = 0; cin >> n; while (n--) { cin >> a >> b; cout << b * 2 << "\n"; } }
### Prompt Your challenge is to write a Cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers...
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T--) { int x, y; cin >> x >> y; cout << y * 2 << "\n"; } }
### Prompt Your task is to create a Cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). Y...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; int x; cin >> n >> x; cout << 2 * x << endl; } }
### Prompt Create a solution in cpp for the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long MOD2 = 998244353; const long long N = 2e5 + 5; const long double pi = 3.14159265359; void SRAND() { auto duration = std::chrono::system_clock::now().time_since_epoch(); auto millis = std::chrono::duration_cast<std::ch...
### Prompt Please create a solution in Cpp to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4") using namespace std; using ll = long long; using ld = long double; using itn = int; using dd = double; mt19937 gen(41); const dd eps = 1e-7; const ll MAXN = 2097152; const ll INF = 1e9; const dd pi = acos(dd(-1)); ll g...
### Prompt Please formulate a CPP solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const int mod = 1e9 + 7; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int T; cin >> T; while (T--) { int x, n; cin >> n >> x; cout << x * 2 << endl; } return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int n, x; cin >> n >> x; cout << 2 * x << endl; } }
### Prompt Please create a solution in CPP to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> int main() { int t; scanf("%d", &t); int i; int a, b; for (i = 0; i < t; i++) { scanf("%d %d", &a, &b); printf("%d\n", b * 2); } }
### Prompt Generate a cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the wh...
#include <bits/stdc++.h> using namespace std; int n, x, t; int main() { cin >> t; for (int ck = 1; ck <= t; ck++) { cin >> n >> x; cout << x * 2 << "\n"; } }
### Prompt Please provide a CPP coded solution to the problem described below: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int* results = new int[N]; for (int i = 0; i < N; i++) { int num, pos; cin >> num >> pos; results[i] = pos * 2; } for (int i = 0; i < N; i++) cout << results[i] << endl; return 0; }
### Prompt Please provide a CPP coded solution to the problem described below: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n, x; cin >> n >> x; cout << 2 * x << '\n'; } };
### Prompt Create a solution in CPP for the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the ...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization("unroll-loops") using namespace std; vector<long long> flash(long long n) { vector<long long> a(n); for (long long i = 0; i < n; i++) cin >> a[i]; return a; } void Shazam() { long long a, b; cin ...
### Prompt Generate a Cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the wh...
#include <bits/stdc++.h> int main() { int x, n, k; scanf("%d", &x); while (x--) { scanf("%d %d", &n, &k); printf("%d\n", k * 2); } }
### Prompt In CPP, your task is to solve the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the...
#include <bits/stdc++.h> int main() { int T; long long int n, x, c, f; scanf("%d\n", &T); for (f = 0; f < T; f++) { scanf("%lld %lld", &n, &x); c = 2 * x; printf("%lld\n", c); } }
### Prompt Generate a cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the wh...
#include <bits/stdc++.h> using namespace std; void solve() { long long n, x; cin >> n >> x; cout << 2 * x << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t; cin >> t; while (t--) { solve(); } return 0; }
### Prompt Develop a solution in CPP to the problem described below: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> using namespace std; int t, m, n; int main() { cin >> t; while (t--) { cin >> n >> m; cout << m * 2 << endl; ; } return 0; }
### Prompt Please formulate a CPP solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n--) { int s, q; cin >> s >> q; cout << 2 * q << endl; } }
### Prompt Your task is to create a Cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). Y...
#include <bits/stdc++.h> using namespace std; int n, x; void solve() { cin >> n >> x; cout << x * 2 << "\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; cin >> t; while (t--) { solve(); } }
### Prompt Construct a CPP code solution to the problem outlined: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe t...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { long long n, x; cin >> n >> x; cout << x * 2 << "\n"; } }
### Prompt Please create a solution in cpp to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int maxn = 1e5 + 5; int main() { int t; cin >> t; while (t--) { long long n, x; cin >> n >> x; cout << 2 * x << endl; } }
### Prompt Please formulate a Cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const int N = 1e6 + 5; const int inf = 1 << 30; const long long llf = 9e18; long long powmod(long long a, long long b) { long long res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res * a % mod; a = a...
### Prompt Construct a Cpp code solution to the problem outlined: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe t...
#include <bits/stdc++.h> using namespace std; const long long int INF = 1000000000000000000; int main() { int t = 1; cin >> t; while (t--) { long long int i, y, h, j, k, r = 0, l = 0, n, m, x = 0, o = 0, cnt1 = INT_MAX, cnt2 = 0, cnt3 = INT_MIN, ...
### Prompt Your challenge is to write a CPP solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers...
#include <bits/stdc++.h> using namespace std; int main() { int t, i, n, x; cin >> t; int a[t]; for (i = 0; i < t; i++) { cin >> n >> x; cout << 2 * x << endl; } }
### Prompt Please provide a CPP coded solution to the problem described below: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n, x; cin >> n >> x; cout << x * 2 << endl; } return 0; }
### Prompt Please create a solution in CPP to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t; cin >> t; for (int i = 0; i < t; i++) { int n, x; cin >> n >> x; cout << 2 * x << '\n'; } }
### Prompt Create a solution in CPP for the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the ...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n, x; cin >> n >> x; cout << 2 * x << endl; } }
### Prompt Construct a cpp code solution to the problem outlined: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe t...
#include <bits/stdc++.h> using namespace std; const int N = 1e6; const long long mod = 1e9 + 7; const int oo = 0x7fffffff; const int sup = 0x80000000; template <typename it> void db(it *begin, it *end) { while (begin != end) cout << (*begin++) << " "; puts(""); } template <typename it> string to_str(it n) { strin...
### Prompt Your challenge is to write a cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0); long long t; cin >> t; for (int i = 1; i <= t; i++) { long long n, x; cin >> n >> x; cout << x * 2 << endl; } }
### Prompt Create a solution in Cpp for the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the ...
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; long long int N, x; while (T--) { cin >> N >> x; cout << (2 * x) << "\n"; } return 0; }
### Prompt Generate a cpp solution to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the wh...
#include <bits/stdc++.h> int main() { int T; int n, x; scanf("%d", &T); while (T--) { scanf("%d %d", &n, &x); printf("%d\n", std::min(x * 2, (n / 2) * 2)); } return 0; }
### Prompt Please create a solution in Cpp to the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wip...
#include <bits/stdc++.h> using namespace std; int main() { int t, n, x; cin >> t; for (int i = 0; i < t; i++) { cin >> n >> x; cout << x * 2 << endl; } }
### Prompt In cpp, your task is to solve the following problem: You have a list of numbers from 1 to n written from left to right on the blackboard. You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the...
#include <bits/stdc++.h> using namespace std; const int Mxxx = 1e5; inline char gc() { static char buf[Mxxx], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, Mxxx, stdin), p1 == p2) ? EOF : *p1++; } inline char pc(char ch, bool fl) { static char buf[Mxxx], *p1 =...
### Prompt Please create a solution in Cpp to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates ...
#include <bits/stdc++.h> using namespace std; const int N = 8, M = 20, MOD = 1000 * 1000 * 1000 + 7; int sum(int a, int b) { return ((a + b) % MOD + MOD) % MOD; } void _sum(int &a, int b) { a = sum(a, b); } int mul(int a, int b) { return 1LL * a * b % MOD; } void _mul(int &a, int b) { a = mul(a, b); } int power(int a, ...
### Prompt In CPP, your task is to solve the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates the t...
#include <bits/stdc++.h> using namespace std; const int inf = (int)1.01e9; const long long infll = (long long)1.01e18; const long double eps = 1e-9; const long double pi = acos((long double)-1); mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); int rnd(int x) { return mrand() % x; } void precalc() ...
### Prompt Create a solution in cpp for the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates the te...
#include <bits/stdc++.h> using namespace std; const int inv = 570000004, mod = 1e9 + 7; unordered_map<bitset<128>, int> mp; bitset<128> E; int tot, p[8][8], trans[100005][128]; int n, S, fp[8][8], f[8][100005], P[100005]; int Dfs(bitset<128> x) { if (mp.find(x) != mp.end()) return mp[x]; int now = mp[x] = ++tot; ...
### Prompt Your challenge is to write a cpp solution to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he ...
#include <bits/stdc++.h> using namespace std; const int N = 10, M = 1000005, K = 205, P = 1000000007; using ll = long long; using Node = bitset<40>; int n, e[N], s[M], wf[K], q[N][K], f[N][N], ans[N][M]; Node op, wq[N][M]; unordered_map<Node, int> rt[N]; ll qpow(ll a, ll b) { ll ret = 1; while (b) { if (b & 1) ...
### Prompt Please formulate a CPP solution to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates ...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; unordered_map<bitset<130>, int> id; int trans[70005][130], p[10][10], tot, f[10][70005], n; int Power(int x, int y) { int r = 1; while (y) { if (y & 1) r = 1ll * r * x % mod; y >>= 1, x = 1ll * x * x % mod; } return r; } int dfs(bits...
### Prompt In CPP, your task is to solve the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates the t...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7, inv = 570000004; int read() { int a = 0; bool opt = 0; char c = getchar(); while (c < '0' || c > '9') opt |= c == '-', c = getchar(); while (c >= '0' && c <= '9') a = (a << 3) + (a << 1) + (c ^ 48), c = getchar(); return opt ? -a : a...
### Prompt Please formulate a Cpp solution to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates ...
#include <bits/stdc++.h> #pragma GCC optimize "-O3" using ll = long long; using ull = unsigned long long; using ld = long double; using namespace std; const int MOD = 1000 * 1000 * 1000 + 7; int mul(int x, int y) { return (1ll * x * y) % MOD; } void add(int& x, int y) { x += y; if (x >= MOD) { x -= MOD; } } i...
### Prompt Your task is to create a CPP solution to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he gene...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize "-O3" #pragma GCC optimize("Ofast") #pragma comment(linker, "/STACK:1000000000") const int mod = 1e9 + 7; int sum(int a, int b) { int c = a + b; if (c >= mod) { c -= mod; } return c; } int dif(int a, int b) { int c = a - b; if (c < 0) { ...
### Prompt Develop a solution in CPP to the problem described below: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates ...
#include <bits/stdc++.h> #pragma GCC optimize(2, 3, "Ofast", "unroll-loops") using namespace std; namespace fast_io { char buf[1 << 12], *p1 = buf, *p2 = buf, sr[1 << 23], z[23], nc; int C = -1, Z = 0, Bi = 0, ny; inline char gc() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 12, stdin), p1 == p2) ...
### Prompt Develop a solution in CPP to the problem described below: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates ...
#include <bits/stdc++.h> using namespace std; inline int Rd() { int s = 0; char fl = 0, c = getchar(); while (c < '0' || c > '9') fl |= (c == '-'), c = getchar(); while (c >= '0' && c <= '9') s = (s << 3) + (s << 1) + (c ^ 48), c = getchar(); return fl ? -s : s; } const int N = 65000, mod = 1e9 + 7, inv =...
### Prompt Construct a CPP code solution to the problem outlined: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates the...
#include <bits/stdc++.h> using namespace std; const int N = 128, mod = 1e9 + 7; template <typename T> void read(T &x) { int ch = getchar(); x = 0; bool f = false; for (; ch < '0' || ch > '9'; ch = getchar()) f |= ch == '-'; for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0'; if (f) x = -x;...
### Prompt Please provide a Cpp coded solution to the problem described below: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he ...
#include <bits/stdc++.h> using namespace std; const int N = 7, M = 20, MOD = 1000 * 1000 * 1000 + 7; int sum(int a, int b) { a += b; if (a < 0) a += MOD; else if (a >= MOD) a -= MOD; return a; } void _sum(int &a, int b) { a = sum(a, b); } int mul(int a, int b) { return 1LL * a * b % MOD; } void _mul(int...
### Prompt Please provide a CPP coded solution to the problem described below: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he ...
#include <bits/stdc++.h> using namespace std; template <class T> inline void rd(T &x) { x = 0; char c = getchar(); int f = 1; while (!isdigit(c)) { if (c == '-') f = -1; c = getchar(); } while (isdigit(c)) x = x * 10 - '0' + c, c = getchar(); x *= f; } const int mod = 1e9 + 7; inline int Pow(int x...
### Prompt Create a solution in CPP for the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates the te...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const long long MOD = (long long)1e9 + 7; long long add(long long x, long long y) { x += y; if (x >= MOD) return x - MOD; return x; } long long sub(long long x, long long y) { x -= y; if (x < 0) ...
### Prompt Create a solution in Cpp for the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates the te...
#include <bits/stdc++.h> using namespace std; template <typename T> void maxtt(T& t1, T t2) { t1 = max(t1, t2); } template <typename T> void mintt(T& t1, T t2) { t1 = min(t1, t2); } bool debug = 0; int n, m, k; string direc = "URDL"; const long long MOD2 = (long long)1000000007 * (long long)1000000007; long long ln...
### Prompt Generate a CPP solution to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates the test...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize "-O3" #pragma GCC optimize("Ofast") #pragma comment(linker, "/STACK:1000000000") const int mod = 1e9 + 7; int sum(int a, int b) { int c = a + b; if (c >= mod) { c -= mod; } return c; } int dif(int a, int b) { int c = a - b; if (c < 0) { ...
### Prompt Generate a Cpp solution to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates the test...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; inline long long mul(const long long& a, const long long& b) { return (a * b) % mod; } inline long long add(const long long& a, const long long& b) { return (a + b + mod) % mod; } inline void upd(long long& a, const long long& b) { a = (a ...
### Prompt Construct a cpp code solution to the problem outlined: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates the...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; unordered_map<bitset<130>, int> id; int trans[100005][130], p[10][10], tot, f[10][100005], n; int Power(int x, int y) { int r = 1; while (y) { if (y & 1) r = 1ll * r * x % mod; y >>= 1, x = 1ll * x * x % mod; } return r; } int dfs(bi...
### Prompt Your challenge is to write a CPP solution to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he ...
#include <bits/stdc++.h> using namespace std; const int N = 6; const int MOD = (int)1e9 + 7; int ipow(int a, int b) { if (b == 0) return 1; int ans = ipow(a, b / 2); ans = 1LL * ans * ans % MOD; if (b & 1) ans = 1LL * ans * a % MOD; return ans; } int modInv(int a) { return ipow(a, MOD - 2); } int p[N][N]; int...
### Prompt Please provide a CPP coded solution to the problem described below: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const int mod = 1e9 + 7; int n, m, tt = 0, ch[N][64], p[10][10], q[10][64], f[10][N]; map<unsigned long long, int> id; int qpow(int a, int b) { int ret = 1; while (b) { if (b & 1) ret = 1ll * ret * a % mod; a = 1ll * a * a % mod, b >>= 1;...
### Prompt Your task is to create a cpp solution to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he gene...
#include <bits/stdc++.h> using namespace std; const int N = 10, M = 1e6 + 7, K = 200, p = 1e9 + 7; int n, e[N], s[M], wf[K], q[N][K], f[N][N], ans[N][M]; bitset<40> op, wq[N][M]; unordered_map<bitset<40>, int> rt[N]; inline int read() { int num = 0; char g = getchar(); while (g < 48 || 57 < g) g = getchar(); wh...
### Prompt Your challenge is to write a CPP solution to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; struct mod_int { int val; mod_int(long long v = 0) { if (v < 0) v = v % MOD + MOD; if (v >= MOD) v %= MOD; val = v; } static int mod_inv(int a, int m = MOD) { int g = m, r = a, x = 0, y = 1; while (r != 0) { int q =...
### Prompt Your task is to create a Cpp solution to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he gene...
#include <bits/stdc++.h> using namespace std; const int N = 7, M = 20, MOD = 1000 * 1000 * 1000 + 7; int sum(int a, int b) { return ((a + b) % MOD + MOD) % MOD; } void _sum(int &a, int b) { a = sum(a, b); } int mul(int a, int b) { return 1LL * a * b % MOD; } void _mul(int &a, int b) { a = mul(a, b); } int power(int a, ...
### Prompt Your challenge is to write a CPP solution to the following problem: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he ...
#include <bits/stdc++.h> using namespace std; template <int MOD> struct ModInt { using Mint = ModInt; int val; ModInt(int64_t __val = 0) { fix(__val % MOD + MOD); } Mint& fix(int __val) { val = __val; if (val >= MOD) val -= MOD; return *this; } explicit operator int() { return val; } Mint oper...
### Prompt Develop a solution in cpp to the problem described below: This is an easier version of the problem. In this version, n ≀ 6. Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates ...
#include <bits/stdc++.h> using namespace std; int ans = 0; void gen(vector<int> &A, vector<vector<int>> &G, int i) { if (i < G.size()) { for (int j = 0; j < 6; ++j) { A[i] = j; gen(A, G, i + 1); } } else { bool was[6][6]; for (int a = 0; a < 6; ++a) { for (int b = 0; b < 6; ++b) wa...
### Prompt Construct a CPP code solution to the problem outlined: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 dominoes...
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; const int MAXN = 10, INF = 1e9, MAXM = 30; int n, m; int ans = 0; int used[MAXN][MAXN], c[MAXN]; pair<int, int> e[MAXM]; void check() { int cnt = 0; for (int i = 0; i < m; ++i) { if (used[c[e[i].first]][c[e[i].second]]) continue; used[...
### Prompt Create a solution in CPP for the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 dominoes. H...
#include <bits/stdc++.h> using namespace std; vector<int> v[10]; int n, ans, m, tmp; vector<int> v2; void recur(int now) { if (now == n) { int vis[7][7]; memset(vis, 0, sizeof(vis)); int ans2 = 0; for (int e = 1; e <= n; e++) { for (int p = 0; p < v[e].size(); p++) { int next = v[e][p]; ...
### Prompt Develop a solution in Cpp to the problem described below: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 domin...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int>> vec; bool linked(int a, int b) { for (pair<int, int> p : vec) { if ((p.first == a && p.second == b) || (p.first == b && p.second == a)) { return true; } } return false; } int main() { int n, m; cin >> n >> m; if (n <= 6) { ...
### Prompt Create a solution in cpp for the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 dominoes. H...
#include <bits/stdc++.h> using namespace std; inline int mul(int a, int b) { return int(a * 1ll * b % 998244353); } inline int norm(int a) { if (a >= 998244353) a -= 998244353; if (a < 0) a += 998244353; return a; } inline int binPow(int a, int k) { int ans = 1; while (k > 0) { if (k & 1) ans = mul(ans, a...
### Prompt Develop a solution in Cpp to the problem described below: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 domin...
#include <bits/stdc++.h> using namespace std; const int maxn = 10; int n, m, res, cnt[maxn]; bool e[maxn][maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> m; int u, v; memset(e, 0, sizeof(e)); for (int i = 1; i <= m; i++) { cin >> u >> v; e[u][v] = 1; ...
### Prompt Generate a CPP solution to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 dominoes. Her...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<vector<int> > g(n); for (int i = 0; i < m; ++i) { int a, b; cin >> a >> b; g[a - 1].push_back(b - 1); g[b - 1].push_back(a - 1); } if (n < 7) { cout << m; } else { int best = 7; for (int ...
### Prompt Please provide a cpp coded solution to the problem described below: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactl...
#include <bits/stdc++.h> using namespace std; int n, m, a, b; int graph[8][8]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; cin >> n >> m; if (m <= 6) { cout << m << '\n'; return 0; } for (int i = 0; i < m; i++) { cin >> a >> b; graph[a][b] = graph[b][a] = 1;...
### Prompt Your task is to create a CPP solution to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21...
#include <bits/stdc++.h> using namespace std; const int mx = 17; bool g[mx][mx]; int main() { int n, m; cin >> n >> m; if (n <= 6) { cout << m << endl; return 0; } for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; g[a][b] = g[b][a] = true; } int mn = INT_MAX; for (int i = 1; i <...
### Prompt Please provide a Cpp coded solution to the problem described below: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactl...
#include <bits/stdc++.h> using namespace std; char G[8][8]; int main() { int n, m; cin >> n >> m; if (n < 7) { cout << m; return 0; } for (int i = 1; i <= m; i++) { int x, y; cin >> x >> y; G[x][y] = G[y][x] = 1; } int best = 69; for (int i = 1; i <= 7; i++) for (int j = 1; j <= ...
### Prompt Your task is to create a CPP solution to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21...
#include <bits/stdc++.h> using namespace std; bool comp(pair<long long, long long> l, pair<long long, long long> m) { return l.second < m.second; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; cout << fixed << setprecision(0); ; long long n, m; cin >> n >> m; lo...
### Prompt Please formulate a CPP solution to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 domin...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<vector<int>> adj(n + 1); for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } if (n <= 6 || m == 0) { cout << m << endl; return 0; } int sum = ...
### Prompt Develop a solution in Cpp to the problem described below: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 domin...
#include <bits/stdc++.h> using namespace std; void set_program() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const int MAXN = 7; const int INF = 1e9; int n, m; int gr[MAXN][MAXN]; int col[6]; int res[6][6]; int ans; void set_var() { ans = 0; for (int i = 0; i < MAXN; ++i) { for (int j = 0; ...
### Prompt In Cpp, your task is to solve the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 dominoes. ...
#include <bits/stdc++.h> using namespace std; const int N = 1005; int hs[10] = {0}; int save[N][2]; int ans = 0, n, m; struct node { int x, i; } deg[10]; int main() { cin >> n >> m; for (int i = 0; i < 10; i++) { deg[i].x = 0; deg[i].i = i; } for (int i = 1; i <= m; i++) { cin >> save[i][0] >> sav...
### Prompt Construct a Cpp code solution to the problem outlined: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 dominoes...
#include <bits/stdc++.h> using namespace std; int main() { int m, n; int connect[30][30]; int a, b; memset(connect, 0, sizeof connect); cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a >> b; connect[a][b] = 1; connect[b][a] = 1; } if (n <= 6) printf("%d\n", m); else { int ans ...
### Prompt Develop a solution in cpp to the problem described below: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 domin...
#include <bits/stdc++.h> using namespace std; int a[8][8]; int n, m, ans = 0x3f3f3f3f; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= m; ++i) { int u, v; scanf("%d%d", &u, &v); a[u][v] = 1, a[v][u] = 1; } if (n <= 6) { printf("%d\n", m); return 0; } for (int i = 1; i <= n; ++i)...
### Prompt Create a solution in Cpp for the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 dominoes. H...
#include <bits/stdc++.h> using namespace std; bool G[8][8]; int main() { int n, m; cin >> n >> m; if (n <= 6) { cout << m << endl; return 0; } for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; G[u][v] = G[v][u] = true; } int mini = INT_MAX; for (int i = 1; i <= 7; i++) { for...
### Prompt Your challenge is to write a CPP solution to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactl...
#include <bits/stdc++.h> using namespace std; int n, m, i, it, r, x[55], y[55], a[9], was[7][7]; void rec(int l) { if (l > n) { ++it; int cnt = 0; for (int i = 0; i < m; i++) { int le = min(a[x[i]], a[y[i]]); int ri = max(a[x[i]], a[y[i]]); if (was[le][ri] != it) { was[le][ri] = ...
### Prompt Develop a solution in cpp to the problem described below: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 domin...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<vector<int>> adj(n + 1); for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } if (n <= 6 || m == 0) { cout << m << endl; return 0; } int sum = ...
### Prompt Construct a Cpp code solution to the problem outlined: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 dominoes...
#include <bits/stdc++.h> using namespace std; void solve() { long long n, t, a, b; scanf("%lld %lld %lld %lld", &n, &t, &a, &b); vector<pair<long long, long long> > v(n); vector<int> h(n); int cnte = 0; int cnth = 0; for (int i = 0; i < n; i++) { scanf("%d", &h[i]); if (h[i]) { cnth++; }...
### Prompt Your challenge is to write a Cpp solution to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactl...
#include <bits/stdc++.h> using namespace std; int main() { int m, n; int connect[10][10]; int a, b; memset(connect, 0, sizeof connect); cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a >> b; connect[a][b] = 1; connect[b][a] = 1; } if (n <= 6) printf("%d\n", m); else { int ans ...
### Prompt Please provide a CPP coded solution to the problem described below: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactl...
#include <bits/stdc++.h> using namespace std; long long a[8][8], n, m, u, v, k = INT_MAX; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; cin >> n >> m; for (long long i = 0; i < m; i++) { cin >> u >> v; a[u][v] = 1; a[v][u] = 1; } if (n <= 6) cout << m << "\n"; else ...
### Prompt Create a solution in cpp for the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 dominoes. H...
#include <bits/stdc++.h> using namespace std; const long long N = 10, M = 110; long long n, m, ans, a[N], x[M], y[M], b[N][N]; inline long long read() { long long x = 0, tmp = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') tmp = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << ...
### Prompt Your challenge is to write a Cpp solution to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactl...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; vector<pair<int, int>> edges; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--, b--; edges.push_back({a, b}); } vector<int> d(n); for (int i = 0; i ...
### Prompt Please create a solution in CPP to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 domin...
#include <bits/stdc++.h> using namespace std; vector<int> edges[8]; int calc(int a, int b) { vector<int> cnt(8); for (auto e : edges[a]) cnt[e]++; for (auto e : edges[b]) cnt[e]++; int sol = 0; for (int i = 1; i <= 7; i++) if (cnt[i] == 2) sol++; return sol; } int main() { ios_base::sync_with_stdio(fa...
### Prompt Your task is to create a CPP solution to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21...
#include <bits/stdc++.h> using namespace std; map<string, int> ret; int n, m; void permute(string a, int i = 0) { if (i == signed(a.size())) { ret[a]++; return; } for (int j = i; j < signed(a.size()); j++) { swap(a[i], a[j]); permute(a, i + 1); swap(a[i], a[j]); } } int main() { ios_base::...
### Prompt Please formulate a CPP solution to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 domin...
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; long long mod = 1000000007; const int MX = 0x3f3f3f3f; bool G[8][8]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; if (n <= 6) { cout << m << endl; return 0; } for (int i = 0; i <...
### Prompt Generate a cpp solution to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 dominoes. Her...
#include <bits/stdc++.h> using namespace std; unordered_map<string, int> ret; int n, m; void permute(string a, int i = 0) { if (i == signed(a.size())) { ret[a]++; return; } for (int j = i; j < signed(a.size()); j++) { swap(a[i], a[j]); permute(a, i + 1); swap(a[i], a[j]); } } int main() { ...
### Prompt Your task is to create a CPP solution to the following problem: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21...