output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; int v1, v2, v3, vm; int vm1, vm2, vm3; int main() { cin >> v1 >> v2 >> v3 >> vm; vm1 = 2 * v1; vm2 = 2 * v2; vm3 = max(v3, vm); if (vm3 > 2 * min(v3, vm)) { cout << "-1"; return 0; } if (vm1 <= 2 * vm || vm2 <= 2 * vm) { cout << "-1"; return 0;...
### Prompt Develop a solution in Cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int v1, v2, v3, v4; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> v1 >> v2 >> v3 >> v4; for (int i = v1; i <= v1 * 2; ++i) { for (int j = v2; j <= 2 * v2 && j < i; ++j) { for (int ii = v3; ii <= 2 * v3 && ii < j; ++ii) { ...
### Prompt Please formulate a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int v, v1, v2, v3, ans1, ans2, ans3; int main() { scanf("%d%d%d%d", &v1, &v2, &v3, &v); ans1 = 2 * v1; ans2 = 2 * v2; if (v3 >= v) { if (v3 <= 2 * v) { ans3 = v3; if (v * 2 >= ans2) printf("-1"); else printf("%d\n%d\n%d\n", ans1...
### Prompt Your task is to create a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the s...
#include <bits/stdc++.h> using namespace std; const long double PI = 3.141592653589793238462643383; struct Rcompare { bool operator()(pair<int, int> lhs, pair<int, int> rhs) { return lhs.first > rhs.first; } }; struct compare { bool operator()(pair<int, int> lhs, pair<int, int> rhs) { return lhs.first < r...
### Prompt Your task is to create a CPP solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the s...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if ((a > b && a > c) && (b < a || b > c) && (c < a && c < b)) { if (d > 2 * c || d >= b || c > 2 * d) cout << -1; else { cout << 2 * a << endl; cout << 2 * b << endl; cout << max(c, ...
### Prompt Your challenge is to write a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; using ll = long long; bool like(int a, int b) { return a <= b && 2 * a >= b; } int main() { int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; v1 *= 2; v2 *= 2; v3 = max(v3, 2 * min(v3, vm)); if (!like(vm, v1) && !like(vm, v2) && like(vm, v3)) { printf("%d\n%d...
### Prompt Generate a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car an...
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; const long long mod = 1e9 + 7; int l, m, s, ms; int32_t main() { ios_base ::sync_with_stdio(0); cin.tie(); cout.tie(); cin >> l >> m >> s >> ms; if (m <= ms || s > 2 * ms || ms > 2 * s || max(m, 2 * ms + 1) > 2 * l) return cout << -1...
### Prompt Develop a solution in cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int v1, v2, v3, vm; scanf("%d", &v1) == 0, scanf("%d", &v2) == 0, scanf("%d", &v3) == 0, scanf("%d", &vm) == 0; int rv1 = v1 * 2; int rv2 = v2 * 2; int rv3 = max(v3, vm); if (rv2 > rv3 * 2 && v3 * 2 >= rv3 && vm * 2 >= rv3) { printf("%d\n"...
### Prompt Your task is to create a CPP solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the s...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, flag = 0; scanf("%d%d", &a, &b); scanf("%d%d", &c, &d); for (int i = 1; i < 201; i += 1) for (int j = 1; j < i; j += 1) for (int k = 1; k < j; k += 1) { if (a <= i && b <= j && c <= k && d <= i && d <= j && d <= k && ...
### Prompt Your task is to create a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the s...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> ans; int v1, v2, v3, vm; bool d1 = false, d2 = false, d3 = false; cin >> v1 >> v2 >> v3 >> vm; if (v1 <= 0 || v2 <= 0 || v3 <= 0 || vm <= 0) { cout << "-1" << endl; return 0; } int y = (2 * v1) + 1; int x = min(v3, vm); for...
### Prompt Construct a Cpp code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, a, b, c, m, k, j; cin >> a >> b >> c >> m; bool flag = 0; for (i = a; i < 2 * a + 1; i++) { for (j = b; j < 2 * b + 1; j++) { for (k = c; k < 2 * c + 1; k++) { if (i > j and j > k and i > k and m <= i and m <= j and m <= k an...
### Prompt Please formulate a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int a, b, c, m; bool e = true; int main() { cin >> a >> b >> c >> m; if (m >= a) e = false; if (m >= b) e = false; if (m > c) { if (m > 2 * c) e = false; else c = m; } if (m < c) { if (c > 2 * m) e = false; } if (e == true) { cout...
### Prompt Generate a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car an...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { long long i, j, k = 1, l, n, t, a, b, c, d; cin >> a >> b >> c >> d; if (d > c * 2 || c > d * 2 || d >= b) cout << -1 << endl; else cout << a * 2 << endl << b * 2 << endl << max(c, d) << endl; }
### Prompt Construct a CPP code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> template <class _T> bool maximize(_T &a, _T b) { return a < b ? a = b, 1 : 0; } template <class _T> bool minimize(_T &a, _T b) { return a > b ? a = b, 1 : 0; } const int ooit = 2e9; const long long ooll = 1e15; using namespace std; int v1, v2, v3, vm; void enter() { cin >> v1 >> v2 >> v3 >>...
### Prompt Generate a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car an...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, aa, bb, cc; cin >> a >> b >> c >> d; cc = max(c, d); bb = b > cc ? b : cc + 1; bb = bb <= 2 * d ? 2 * d + 1 : bb; aa = a > bb ? a : bb + 1; if (aa >= a && aa <= 2 * a && bb >= b && bb <= 2 * b && cc >= c && cc <= 2 * c && cc ...
### Prompt Please formulate a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fll; const long double pi = acos(-1); const int MOD = 1e9 + 7; int v[330]; int main() { int a, b, c, m; cin >> a >> b >> c >> m; for (int i = a; i <= 2 * a; i++) { v[i] |= 1; } for (int i = b;...
### Prompt In Cpp, your task is to solve the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (2 * c < d || 2 * d < c || d >= b) cout << "-1"; else { cout << 2 * a << endl << 2 * b << endl; if (c > d) cout << c; else cout << d; } return 0; }
### Prompt Construct a cpp code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> int main() { int father, mother, son, masha; scanf("%d %d %d %d", &father, &mother, &son, &masha); if (masha > son * 2 || son > masha * 2 || masha >= mother) { printf("-1\n"); } else { father *= 2; mother *= 2; printf("%d %d ", father, mother); if (son > masha) { ...
### Prompt In CPP, your task is to solve the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car...
#include <bits/stdc++.h> using namespace std; int main() { int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; for (int i = 200; i > 0; i--) { for (int j = i - 1; j > 0; j--) { for (int k = j - 1; k > 0; k--) { if ((v1 <= i and 2 * v1 >= i) and (v2 <= j and 2 * v2 >= j) and (v3 <= k and...
### Prompt Develop a solution in CPP to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int e, f, g; if (d > 2 * c || 2 * d < c) { cout << -1 << endl; return 0; } g = max(d, c); f = max(b, 2 * d + 1); if (f > 2 * b) { cout << -1 << endl; return 0; } e = max(a, f + 1); i...
### Prompt Generate a CPP solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car an...
#include <bits/stdc++.h> using namespace std; const long long MX = 1e10; const int INF = 1e9 + 7; const double EPS = 0.00000001; int main() { ios_base::sync_with_stdio(false); int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; for (int i = 1; i <= 205; i++) { for (int j = i + 1; j <= 205; j++) { for (in...
### Prompt Generate a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car an...
#include <bits/stdc++.h> using namespace std; int main() { int v1, v2, v3, v4, ans1, ans2, ans3, flag = 0, i, j, k; cin >> v1 >> v2 >> v3 >> v4; for (i = v1; i <= 2 * v1; i++) { for (j = v2; j < i && j <= 2 * v2; j++) { for (k = v3; k < j && k <= 2 * v3; k++) { if (k <= 2 * v4 && v4 <= k && 2 * ...
### Prompt Your challenge is to write a CPP solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int e = max(c, d); if (e > 2 * c || e > 2 * d || e >= b) { cout << -1; return 0; } cout << 2 * a << endl << 2 * b << endl << e; return 0; }
### Prompt Your task is to create a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the s...
#include <bits/stdc++.h> using namespace std; int a, b, c, x; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); cin >> a >> b >> c >> x; for (int i = a; i <= 2 * a; i++) for (int j = b; j <= min(i - 1, 2 * b); j++) for (int k = c; k <= min(j - 1, 2 * c); k++) if (a <=...
### Prompt Develop a solution in Cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; void solve() { int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; if (2 * vm < v3) { cout << "-1"; return; } int s, m, x; s = max(v3, vm); m = max(2 * vm + 1, v2); x = max(m + 1, v1); if (s > 2 * v3 || m > 2 * v2 || x > 2 * v1) { cout << -1 << "\...
### Prompt Please provide a CPP coded solution to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> int main() { int a[4]; int e = -1; for (int i = 0; i < 4; ++i) scanf("%d", &a[i]); if (a[3] < a[1]) { if ((a[2] > a[3] ? a[2] : a[3]) <= (2 * (a[2] > a[3] ? a[3] : a[2]))) { if ((2 * a[3]) >= a[1]) { a[1] = 2 * a[3] + 1; if (a[0] <= a[1]) a[0] = a[1] + 1; ...
### Prompt Develop a solution in CPP to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; void solve() { long long a, b, c, d; cin >> c >> b >> a >> d; for (long long i = a; i <= 2 * a; i++) { for (long long j = max(b, a + 1); j <= 2 * b; j++) { for (long long k = max(c, j + 1); k <= 2 * c; k++) { if (d <= i && d <= j && d <= k && 2 * d >...
### Prompt Construct a cpp code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> using namespace std; int main() { int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; for (int a = v1; a < v1 * 2 + 1; a++) { for (int b = v2; b < min(a, v2 * 2 + 1); b++) { for (int c = v3; c < min(b, v3 * 2 + 1); c++) { if (c >= vm && 2 * vm >= c && 2 * vm < b) { ...
### Prompt Your challenge is to write a CPP solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; int v1, v2, v3, vm, t, x1, x2; int main() { scanf("%d %d %d %d", &v1, &v2, &v3, &vm); x1 = v1 * 2; x2 = v2 * 2; t = x2; while (t >= 0) { if (2 * v3 >= t && 2 * vm >= t && t >= v3 && t >= vm && 2 * vm < x2 && vm <= x1 && vm <= x2) { printf("%d %d ...
### Prompt Please create a solution in CPP to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int v_1, v_2, v_3, v_m, m_1, m_2, m_3; cin >> v_1 >> v_2 >> v_3 >> v_m; if (v_m >= v_2 || v_m < v_2 && v_m > v_3 && 2 * v_3 < v_m || v_m <= v_3 && 2 * v_m < v_3) { cout << -1; return 0; } cout << 2 * v_1 << "\n" << 2 * v_2 << "\n"; if ...
### Prompt Please create a solution in Cpp to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; struct debugger { template <typename T> debugger& operator,(const T& v) { cout << v << " "; return *this; } } dbg; int dx[] = {-1, 1, 0, 0, -1, -1, 1, 1}; int dy[] = {0, 0, 1, -1, -1, 1, -1, 1}; int main() { int t = 0, z = 0, len; int n = 0, k = 0, m = 0; ...
### Prompt Please formulate a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int v1, v2, v3, v4; scanf("%d%d%d%d", &v1, &v2, &v3, &v4); for (int i = 1; i <= 200; i++) for (int j = 1 + i; j <= 200; j++) for (int k = 1 + j; k <= 200; k++) { if (k >= v1 && 2 * v1 >= k && j >= v2 && v2 * 2 >= j && i >= v3 && ...
### Prompt Please create a solution in CPP to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (a == 0) return b; return gcd(b % a, a); } long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); } long long Abs(long long a) { if (a > 0) return a; return -a; } long long Ceil(long long a, long long b) { ...
### Prompt Please provide a CPP coded solution to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; for (int c1 = v1; c1 <= v1 * 2; c1++) for (int c2 = v2; c2 <= min(c1 - 1, v2 * 2); c2++) for (int c3 = v3; c3 <= min(c2 - 1, v3 * 2); c3++) { ...
### Prompt In CPP, your task is to solve the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car...
#include <bits/stdc++.h> using namespace std; const long long INF = LLONG_MAX; const long long base = 1e9; const double PI = acos(-1); const long long MOD = 1e9 + 7; const long long N = 1e5 + 10; void logic() { long long v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; for (long long i = v1; i <= 2 * v1; i++) { f...
### Prompt Please create a solution in cpp to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> int main() { int father, mother, son, masha; int car1, car2, car3; scanf("%d %d %d %d", &father, &mother, &son, &masha); bool flag = false; for (car3 = ((son) > (masha) ? (son) : (masha)); car3 <= ((2 * son) > (2 * masha) ? (2 * masha) : (2 * son)) && flag == false; ...
### Prompt Create a solution in Cpp for the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car ...
#include <bits/stdc++.h> using namespace std; int main() { long long v1, v2, v3, v; cin >> v1 >> v2 >> v3 >> v; long long c = 0, i, j, k, a1, a2, a3; for (i = v3; i <= 2 * v3; i++) { for (j = v2; j <= 2 * v2; j++) { for (k = v1; k <= 2 * v1; k++) { if (k > j && j > i && i >= v && i <= 2 * v &&...
### Prompt Develop a solution in Cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; int minn; while (~scanf("%d%d%d%d", &a, &b, &c, &d)) { if (d > 2 * c || d >= b || c > 2 * d) { cout << -1 << endl; } else cout << 2 * a << endl << 2 * b << endl << max(c, d) << endl; } return 0; }
### Prompt Your task is to create a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the s...
#include <bits/stdc++.h> using namespace std; bool isSubSequence(string str1, string str2, int m, int n) { int j = 0; for (int i = 0; i < n && j < m; i++) { if (str1[j] == str2[i]) j++; } return (j == m); } int isPrime(long long n) { for (int i = 2; i <= sqrt(n) + 1; i++) if (n % i == 0) return 0; r...
### Prompt In cpp, your task is to solve the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car...
#include <bits/stdc++.h> using namespace std; int main() { int v1, v2, v3, vm, v1o, v2o; cin >> v1 >> v2 >> v3 >> vm; v1o = v1; v2o = v2; if (2 * v3 >= vm) { if (v3 <= 2 * vm) { while (1) { if (v1 <= 2 * vm) v1++; else break; } while (1) { if (...
### Prompt In cpp, your task is to solve the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (d > 2 * c || 2 * d < c || d >= b) { printf("-1\n"); return 0; } int tmp = max(c, d); cout << max(d * 2 + 2, a) << endl; cout << max(d * 2 + 1, b) << endl; cout << tmp << endl; }
### Prompt Please provide a CPP coded solution to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int ans_br, ans_mom, ans_dad; if (d >= b || d > 2 * c) { cout << -1 << endl; } else { ans_br = max(d, c); if (ans_br > d * 2) { cout << -1 << endl; } else { ans_mom = max(max(b, 2 * ...
### Prompt Please formulate a CPP solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int V1, V2, V3, Vm, a1, b1, a2, b2, a3, b3; cin >> V3 >> V2 >> V1 >> Vm; a1 = max(V1, Vm); a2 = max(a1 + 1, max(2 * Vm + 1, V2)); a3 = max(a2 + 1, max(2 * Vm + 1, V3)); b1 = 2 * min(V1, Vm); b2 = 2 * V2; b3 = 2 * V3; int s1, s2, s3; if (a1 >...
### Prompt Generate a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car an...
#include <bits/stdc++.h> long long max(long long A, long long b) { if (A > b) return A; return b; } long long min(long long A, long long b) { if (A < b) return A; return b; } using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long v1, v2, v3, v4; ci...
### Prompt Please formulate a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int a1, a2, a3, a4; cin >> a1 >> a2 >> a3 >> a4; for (int i = a1; i <= 2 * a1; i++) { for (int j = a2; j <= 2 * a2; j++) { for (int k = a3; k <= 2 * a3; k++) { if (i >= a4 and j >= a4 and k >= a4 and 2...
### Prompt Please provide a CPP coded solution to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; int v1, v2, v3, v4; int main() { cin >> v1 >> v2 >> v3 >> v4; for (int i = v1; i <= v1 * 2; i++) { for (int j = v2; j <= v2 * 2; j++) { for (int k = v3; k <= v3 * 2; k++) { if (v4 <= k && v4 * 2 >= k && v4 * 2 < i && v4 * 2 < j && i >= v4 && ...
### Prompt Create a solution in Cpp for the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car ...
#include <bits/stdc++.h> using namespace std; int main() { int v1, v2, v3, vm; scanf("%d", &v1); scanf("%d", &v2); scanf("%d", &v3); scanf("%d", &vm); int i, j, k; for (i = 1; i <= 400; i++) { for (j = 1; j <= 400; j++) { for (k = 1; k <= 400; k++) { if (v1 <= i and 2 * v1 >= i and v2 <=...
### Prompt Please provide a cpp coded solution to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; class TaskA { public: void solve(std::istream& in, std::ostream& out) { int a, b, c, d; in >> a >> b >> c >> d; for (int small = c; small <= 2 * c; ++small) { for (int medium = b; medium <= 2 * b; ++medium) { for (int big = a; big <= 2 * a; ++bi...
### Prompt Create a solution in CPP for the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car ...
#include <bits/stdc++.h> using namespace std; int main() { int v1, v2, v3, v4; cin >> v1 >> v2 >> v3 >> v4; if (v4 > 2 * v3 || v3 > 2 * v4 || v4 >= v2) { cout << -1 << "\n"; return 0; } cout << 2 * v1 << "\n" << 2 * v2 << "\n" << max(v3, v4) << "\n"; }
### Prompt Please create a solution in cpp to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const double EPS = 1e-9; const int INF = 1 << 29; int const NN = 2e5 + 5; bool f(int l, int r) { return l <= r; } int main() { int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; int l = max(v1, 2 * vm + 1); int r = 2 * v1; if (!f(l, r)) { ...
### Prompt In Cpp, your task is to solve the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car...
#include <bits/stdc++.h> using namespace std; class pas { public: long long x, y; pas(long long x = 0, long long y = 0) : x(x), y(y) {} pas operator+(pas p) { return pas(x + p.x, y + p.y); } pas operator-(pas p) { return pas(x - p.x, y - p.y); } pas operator*(long long a) { return pas(x * a, y * a); } pas ...
### Prompt Construct a cpp code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; template <typename T> T max(T A) { return A; } template <typename T, typename... args> T max(T A, T B, args... S) { return max(A > B ? A : B, S...); } template <typename T> T min(T A) { return A; } template <typename T, typename... args...
### Prompt Develop a solution in Cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v(4); for (int i = 0; i < 4; i++) { cin >> v[i]; } if (v[3] > v[2] * 2) { cout << "-1"; return 0; } if (v[2] > v[3] * 2) { cout << "-1"; return 0; } vector<int> s(3); for (int i = 0; i < 2; i++) { if (v[i] =...
### Prompt Construct a CPP code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (!((2 * c) >= d) || d >= b || !((2 * d) >= c)) { cout << -1; return 0; } cout << 2 * a << endl << 2 * b << endl << max(c, d); return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> int main() { int v1, v2, v3, vM, s, r, p, c, d, e; scanf("%d%d%d%d", &v1, &v2, &v3, &vM); c = v1; d = v2; if (vM > (v3 * 2)) { printf("-1\n"); } else if ((vM * 2) < v3) { printf("-1\n"); } else { if (v3 > vM) { if ((v3 * 2) >= v1) { s = (v3 * 2) - v1; ...
### Prompt Please formulate a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> const long long LINF = 1e18; const int INF = 1e9; const int M = 1e9 + 7; const double EPS = 1e-9; using namespace std; int main() { std::ios_base::sync_with_stdio(0); int v1, v2, v3, v4; cin >> v1 >> v2 >> v3 >> v4; int a1 = -1, a2 = -1, a3 = -1; for (int i = v1; i < 2 * v1 + 1; i++) ...
### Prompt Please create a solution in CPP to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b, c, d; cin >> a >> b >> c >> d; int l1 = max(a - 1, 2 * d), l2 = max(b - 1, 2 * d); int l = max(c, d), r = min(2 * d, 2 * c); if (l1 >= 2 * a || l2 >= 2 * b || l > r || 2 * a <= l2 || 2 * a < l || ...
### Prompt Your task is to create a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the s...
#include <bits/stdc++.h> using namespace std; void solve() { int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; if (v3 > 2 * vm || vm > 2 * v3 || vm >= v2) cout << "-1" << endl; else { int m = v3 > vm ? v3 : vm; cout << v1 * 2 << endl << v2 * 2 << endl << m << endl; } } int main() { ios_base::sync...
### Prompt Your challenge is to write a CPP solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int x, y, z, xx, yy, zz; x = max(a, 2 * d + 1); xx = 2 * a; y = max(b, 2 * d + 1); yy = 2 * b; z = max(c, d); zz = min(2 * c, 2 * d); if (xx >= x && yy >= y && zz >= z) { for (int i = x; i <= xx; ...
### Prompt Develop a solution in Cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> int bsf(int x) { return __builtin_ctz(x); } int bsr(int x) { return 31 - __builtin_clz(x); } using namespace std; const double pi = 3.14159265358979323846; const int inf = (int)2e+9 + 2; const int mod = (int)1e+9 + 7; const double eps = 1e-8; const int N = 100000; int n, m, k; int v[4]; int ans...
### Prompt Your task is to create a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the s...
#include <bits/stdc++.h> using namespace std; long long pwr(long long base, long long p, long long mod = 1000000000) { long long ans = 1; while (p) { if (p % 2 == 1) ans = (ans * base) % 1000000000; base = (base * base) % 1000000000; p /= 2; } return ans; } long long gcd(long long a, long long b) { ...
### Prompt Please formulate a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; bool canClimb(int personSize, int carSize) { return personSize <= carSize; } bool likeIt(int personSize, int carSize) { return 2 * personSize >= carSize; } bool both(int personSize, int carSize) { return canClimb(personSize, carSize) && likeIt(personSize, carSize); } cons...
### Prompt Construct a cpp code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> using namespace std; long long i = 0, j = 0, k = 0; void solve() { int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; for (i = v1; i <= 2 * v1; ++i) { for (j = v2; j < 2 * v2 + 1; ++j) { for (k = v3; k <= 2 * v3; ++k) { if (vm < i && vm < j && vm <= k && 2 * vm >= k && i >...
### Prompt In Cpp, your task is to solve the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car...
#include <bits/stdc++.h> using namespace std; struct node { int idx, x, pa; }; int n; int main() { int v1, v2, v3, v4; scanf("%d %d %d %d", &v1, &v2, &v3, &v4); v1 *= 2; v2 *= 2; if (2 * v4 >= v2) { printf("-1\n"); return 0; } if (v3 > 2 * v4 || 2 * v3 < v4) { printf("-1\n"); return 0; ...
### Prompt Please formulate a CPP solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; int s1, s2, s3; if (vm <= 2 * v3 and 2 * vm >= v3 and vm < v2) { s1 = 2 * v1; s2 = 2 * v2; s3 = min({(2 * v3), v2 - 1, (2 * vm)}); ...
### Prompt Construct a CPP code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> using namespace std; int main() { int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; int c1 = v1 * 2, c2 = v2 * 2, c3 = max(v3, vm); if ((vm * 2 >= c2 && vm <= c2) || (vm * 2 >= c1 && c1 >= vm)) { cout << -1 << endl; return 0; } if ((v3 * 2 >= c3 && v3 <= c3) && (vm * 2 >= c3 ...
### Prompt Develop a solution in Cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); for (int i = a * 2; i >= a; i--) { if (i >= a && i <= a * 2) { a = i; break; } } for (int i = a - 1; i >= b; i--) { if (i >= b && i <= b * 2) { b = i; break; } ...
### Prompt Your task is to create a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the s...
#include <bits/stdc++.h> using namespace std; using ll = long long; enum {}; int main() { ios::sync_with_stdio(false); cin.tie(0); int v[3], vm; cin >> v[0] >> v[1] >> v[2] >> vm; int c[4]; c[3] = 0; for (c[0] = 1; c[0] <= 200; ++c[0]) { for (c[1] = 1; c[1] <= 200; ++c[1]) { for (c[2] = 1; c[2] ...
### Prompt Develop a solution in Cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int a1 = a, a2 = b, a3 = c; if (d == a || d == b) { cout << -1; return 0; } if (a < d) a1 = a2 = a3 = d; else if (b < d) a2 = a3 = d; else if (c < d) a3 = d; if (2 * a < a1) a1 = 2 *...
### Prompt Please create a solution in CPP to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; long long int power(long long int x, long long int y, long long int p = 1e9 + 7) { long long int res = 1; x = x % p; while (y > 0) { if (y & 1) { res = (res * x) % p; } x = (x * x) % p; y = y >> 1; } return res; } int main...
### Prompt Generate a Cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car an...
#include <bits/stdc++.h> using namespace std; int main() { int pb, mb, bb, m; cin >> pb >> mb >> bb >> m; int s1 = 2 * pb; int temp = 2 * m; if (2 * m >= s1) { cout << -1 << endl; return 0; } int s2 = 2 * mb; if (2 * m >= s2) { cout << -1 << endl; return 0; } int s3 = 2 * bb, c = 0; ...
### Prompt Construct a CPP code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> int main(void) { int v1, v2, v3, v4; scanf("%d %d %d %d", &v1, &v2, &v3, &v4); for (int x = v1; x <= v1 * 2; x++) { for (int y = v2; y <= v2 * 2; y++) { for (int z = v3; z <= v3 * 2; z++) { if (x > y && y > z) { if (2 * v4 < y && 2 * v4 >= z) { if (...
### Prompt Construct a cpp code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> using namespace std; int main() { long long v1, v2, v3, v4, i, j, k; cin >> v1 >> v2 >> v3 >> v4; for (i = 200; i >= 1; i--) for (j = i - 1; j >= 1; j--) for (k = j - 1; k >= 1; k--) if ((v1 <= i and v1 * 2 >= i) and (v2 <= j and v2 * 2 >= j) and (v3 <= k and...
### Prompt Your task is to create a CPP solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the s...
#include <bits/stdc++.h> int N; int main() { int a1, a2, a3, x, b1, b2, b3; scanf("%d%d%d%d", &a3, &a2, &a1, &x); for (b3 = a3; b3 <= 2 * a3; b3++) { for (b2 = a2; b2 <= 2 * a2; b2++) { for (b1 = a1; b1 <= 2 * a1; b1++) { if (b1 >= x && b2 >= x && b3 >= x && b1 <= 2 * x && b2 > 2 * x && ...
### Prompt Please provide a cpp coded solution to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long v1, v2, v3, vm; long long u1, u2, u3; cin >> v1 >> v2 >> v3 >> vm; for (u1 = v1; u1 <= 2 * v1; u1++) { for (u2 = v2; u2 <= 2 * v2; u2++) { for (u3 = v3; u3 <= 2 * v3; u3++)...
### Prompt Please formulate a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int v[10]; cin >> v[1] >> v[2] >> v[3] >> v[4]; if (v[1] <= v[4] || v[2] <= v[4] || v[4] > 2 * v[3] || 2 * v[4] < v[3]) { cout << -1 << endl; } else { cout << 2 * v[1] << endl << 2 * v[2] << endl << max(v[4], v[3]) << endl; } }
### Prompt Create a solution in CPP for the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car ...
#include <bits/stdc++.h> using namespace std; int main(void) { int v[3], c[3], vm; cin >> v[2] >> v[1] >> v[0] >> vm; if (2 * vm < v[0] || 2 * v[0] < vm) { cout << "-1" << endl; return 0; } c[0] = max(v[0], vm); if (2 * v[1] <= c[0]) { cout << "-1" << endl; return 0; } c[1] = max(c[0] + ...
### Prompt In cpp, your task is to solve the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int f, m, c, ms; cin >> f >> m >> c >> ms; for (int F = f; F < (f << 1) + 1; F++) { for (int M = m; M < (m << 1) + 1; M++) { for (int L = min(c, ms); L < (max(c, ms) << 1) + 1; L++) { ...
### Prompt Construct a Cpp code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int min_a = max(a, 2 * d - 1), min_b = max(b, 2 * d - 1), min_c = max(c, d); int max_a = 2 * a, max_b = 2 * b, max_c = min(2 * c, 2 * d); for (int i = min_a; i <= max_a; ++i) { for (int j = min_b; j <= max_...
### Prompt Develop a solution in cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { iostream::sync_with_stdio(0); int a, b, c, d; cin >> a >> b >> c >> d; for (int i = a; i <= 200; i++) { for (int j = b; j <= 200; j++) { for (int k = 1; k <= 200; k++) { if (a * 2 >= i && b * 2 >= j && c <= k && c * 2 >= k && i > d * 2...
### Prompt Construct a CPP code solution to the problem outlined: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest c...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long v1, v2, v3, vm; cin >> v1 >> v2 >> v...
### Prompt Your task is to create a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the s...
#include <bits/stdc++.h> using namespace std; template <typename T> inline void Int(T &n) { n = 0; int f = 1; register int ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1; for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0'; n = n * f; } template <typename T...
### Prompt Develop a solution in CPP to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int v1, v2, v3, vm, t; int main() { cin >> v1 >> v2 >> v3 >> vm; for (int i = v1; i <= 200; i++) for (int j = v2; j <= 200; j++) for (int h = v3; h <= 200; h++) { if (i > j && j > h) if (2 * v1 >= i) if (2 * v2 >= j) ...
### Prompt Please create a solution in Cpp to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; a = 2 * a; b = 2 * b; int k = 1; for (int i = c; i <= 2 * c; i++) { if (d <= i && 2 * d >= i) { k = 0; c = i; break; } } if (k == 0) { if (2 * d >= b || 2 * d >= a) { c...
### Prompt Please provide a CPP coded solution to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; int main() { int k, l, m, n; cin >> k >> l >> m >> n; for (int i = k; i <= 2 * k; i++) { for (int j = l; j <= 2 * l; j++) { for (int x = m; x <= 2 * m; x++) { if (i > j && j > x) { if (n <= x && 2 * n >= x && 2 * n < j) { cout <...
### Prompt Develop a solution in Cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int p, m, s, ma; cin >> p >> m >> s >> ma; if (ma > s * 2 || ma >= m || s > 2 * ma) { cout << -1 << endl; } else { cout << 2 * p << endl << 2 * m << endl << max(s, ma) << endl; } return 0; }
### Prompt Create a solution in CPP for the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car ...
#include <bits/stdc++.h> using namespace std; long long v1, v2, v3, vm; int main() { cin >> v1 >> v2 >> v3 >> vm; for (int i = 1; i <= 500; i++) { for (int j = i + 1; j <= 500; j++) { for (int k = j + 1; k <= 500; k++) { if (v3 <= i && 2 * v3 >= i) { if (v2 <= j && v2 * 2 >= j) { ...
### Prompt Your challenge is to write a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int savec = c; a *= 2; b = min(2 * b, a - 1); c = min(2 * c, b - 1); if (d * 2 >= a || d * 2 >= b) { printf("-1\n"); } else if (c >= d) { c = min(d * 2, c); if (c < savec) { printf("-1\n...
### Prompt Develop a solution in Cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; while (scanf("%d%d%d%d", &a, &b, &c, &d) != EOF) { if (d > 2 * c || d >= b || c > 2 * d) printf("-1\n"); else { printf("%d\n%d\n%d\n", 2 * a, 2 * b, max(c, d)); } } return 0; }
### Prompt Develop a solution in cpp to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> int main() { int b1, b2, b3, m; scanf("%d %d %d %d", &b1, &b2, &b3, &m); int cars[4]; bool flag = true; cars[0] = 2 * b1; cars[1] = 2 * b2; cars[2] = 2 * m < 2 * b3 ? 2 * m : 2 * b3; int temp = m + b3 - cars[2] / 2; if (m > cars[0] || m > cars[1] || cars[2] < temp) flag = fals...
### Prompt Generate a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car an...
#include <bits/stdc++.h> using namespace std; bool check(int c1, int c2, int c3, int v1, int v2, int v3, int m) { return (c1 >= v1 && c1 <= 2 * v1 && c2 >= v2 && c2 <= 2 * v2 && c3 >= v3 && c3 <= 2 * v3 && 2 * m >= c3 && 2 * m < c2 && c3 < c2 && c2 < c1 && m <= c3); } int main() { int v1, v2, v3...
### Prompt Please create a solution in Cpp to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const long long int MOD = 1e9 + 7; const int N = 1e6 + 6; long long int fact[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); read: int a, b, c, d, p, q, r; int ans = 1; cin >> a >> b >> c >> d; if (2 * d < c) an...
### Prompt Develop a solution in CPP to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (d > c * 2 || d >= b || d * 2 < c) { cout << "-1"; return 0; } cout << a * 2 << " " << b * 2 << " " << max(c, d); return 0; }
### Prompt Please formulate a CPP solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int father, mother, son, masha; int fatherCarSize, motherCarSize, sonCarSize; cin >> father >> mother >> son >> masha; int flag = 1; if (masha > 2 * son) { flag = -1; } for (fatherCarSize = 2 * father; fatherCarSize >= father; fatherCarSize--)...
### Prompt Please provide a Cpp coded solution to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int car_1 = a; int car_2 = b; int car_3 = c; if (d <= 2 * c && 2 * d >= c) { if (d > c) car_3 = d; else car_3 = c; if (d * 2 >= car_2) car_2 = d * 2 + 1; if (car_2 > b * 2) { ...
### Prompt Please formulate a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; int main() { int father, mother, son, m; cin >> father >> mother >> son >> m; int x = 0, y = 0, z = 0; for (int i = father; i <= 200; ++i) { if (2 * father >= i && m <= i && 2 * m < i) { z = i; } } for (int i = mother; i < z; ++i) { if (2 * mot...
### Prompt Create a solution in cpp for the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car ...
#include <bits/stdc++.h> using namespace std; int main() { int a1, a2, a3, am; cin >> a1 >> a2 >> a3 >> am; int b1, b2, b3; b3 = max(am, a3); b2 = max(max(b3 + 1, a2), 2 * am + 1); b1 = max(b2 + 1, a1); if (b3 > 2 * a3 || b2 > 2 * a2 || b1 > 2 * a1 || b3 > 2 * am) { cout << -1 << endl; } else { ...
### Prompt Please provide a cpp coded solution to the problem described below: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; int main() { int v1, v2, v3, v4, x, y, z; cin >> v1 >> v2 >> v3 >> v4; if (!(v1 > v4 && v2 > v4)) { cout << "-1" << endl; return 0; } if ((2 * v4 < v3) || (2 * v3 < v4)) { cout << "-1" << endl; return 0; } if (v3 > v4) { z = 2 * v4; } els...
### Prompt Your challenge is to write a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...
#include <bits/stdc++.h> using namespace std; set<unsigned long long int>::iterator it; int main() { unsigned long long int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; unsigned long long int flag = 0; unsigned long long int ans; for (unsigned long long int i = v3; i <= 2 * v3; i++) { if (i >= vm && i <= ...
### Prompt Please formulate a CPP solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smalles...
#include <bits/stdc++.h> using namespace std; inline int read() { char c; int s = 0, t = 1; while (!isdigit(c = getchar())) if (c == '-') t = -1; do { s = s * 10 + c - '0'; } while (isdigit(c = getchar())); return s * t; } inline long long readl() { char c; long long s = 0; int t = 1; while ...
### Prompt Your challenge is to write a cpp solution to the following problem: A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into t...