output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> int main() { int a, b, c, m; scanf("%d %d %d %d", &a, &b, &c, &m); if (2 * c < m || c > m * 2) { c = -1; } else if (c < m && 2 * c >= m) c = m; else if (c >= m && c <= m * 2) c = c; if (2 * b <= 2 * m) { b = -1; } else b = 2 * b; if (2 * a <= 2 * m) { a =...
### 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; void scanint(int &x) { int c = getchar_unlocked(); x = 0; while (((c < 48 || c > 57))) c = getchar_unlocked(); for (; c > 47 && c < 58; c = getchar_unlocked()) { x = (x << 1) + (x << 3) + c - 48; } } int v1, v2, v3, vm, x1, x2, x3; int main() { cin >> v1 >> ...
### 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> const double pi = acos(-1); const int MOD = 1e9 + 7; const int INF = 1e9 + 7; const int MAXN = 1e5 + 5; const double eps = 1e-9; using namespace std; int arr[MAXN]; int main() { for (int i = 0; i < 4; i++) scanf("%d", arr + i); for (int a = 0; a <= 300; a++) { if (arr[2] > a || arr[3] >...
### 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 V[10], v, flag; int main() { scanf("%d%d%d%d", &V[1], &V[2], &V[3], &v); for (int c1 = V[1]; c1 <= 2 * V[1]; c1++) for (int c2 = V[2]; c2 <= 2 * V[2]; c2++) for (int c3 = V[3]; c3 <= 2 * V[3]; c3++) { if (c1 > c2 && c2 > c3 && c1 > 2 * v && c2 > 2 * v && c3 >= v && ...
### 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 anss[3]; int main() { int V1, V2, V3, Vm, minn, maxx; bool ans; ans = true; scanf("%d%d%d%d", &V1, &V2, &V3, &Vm); minn = 0; maxx = 99999; minn = max(minn, Vm); maxx = min(maxx, 2 * Vm); minn = max(minn, V3); maxx = min(maxx, 2 * V3); if (minn > ma...
### 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 a, b, c, d; int main() { cin.sync_with_stdio(false), cin.tie(0); cin >> a >> b >> c >> d; for (long long i = 1; i <= 200; ++i) { for (long long j = 1; j <= 200; ++j) { for (long long k = 1; k <= 200; ++k) { if (i <= j || j <= k) continue; ...
### 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 a1, b1, c1; scanf("%d %d %d %d", &a, &b, &c, &d); if (d > 2 * c || c > 2 * d) { printf("-1\n"); return 0; } c1 = max(c, d); b1 = max(c1 + 1, b); if (b1 > 2 * b) { printf("-1\n"); return 0; } if (2 * d > 2 ...
### 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 long MAX = 1e9; const long double PI = 3.14159265358979323846; const long long INF = 1e6 - 1; long long prime1(long long n) { bool ans = false; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { ans = true; break; } } if (ans == 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> using namespace std; int main() { int v0, v1, v2, vm, a0, a1, a2; bool err = true; scanf("%d%d%d%d", &v2, &v1, &v0, &vm); for (int i = v0; i <= v0 * 2; i++) { for (int j = v1; j <= v1 * 2; j++) { for (int k = v2; k <= v2 * 2; k++) { if (vm <= i && vm <= j && vm <= k &&...
### 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(0); cin.tie(0), cout.tie(0); vector<int> vec(5); for (int i = 0; i < 4; i++) cin >> vec[i]; for (int i = vec[0]; i <= 200; i++) { if (2 * vec[0] < i) continue; for (int j = vec[1]; j <= 200; j++) { if (2 * vec[1...
### 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, v; cin >> v1 >> v2 >> v3 >> v; if (v > 2 * v3 || v3 > 2 * v || v >= v2) cout << -1 << "\n"; else { int a = max(v, v3); cout << 2 * v1 << " " << 2 * v2 << " " << a << "\n"; } }
### 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() { ios_base::sync_with_stdio(0); cin.tie(0); ; int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; int a1, a2, a3; if (max(v3, vm) <= min(vm * 2, v3 * 2)) a3 = max(v3, vm); else return puts("-1"); int min2 = max(a3 + 1, max(v3, max(v2, vm * ...
### 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 v1, v2, v3, vm; int flag; while (cin >> v1 >> v2 >> v3 >> vm) { flag = 0; int i, j, k; for (i = 1; i <= 200; i++) { for (j = 1; j < i; j++) { for (k = 1; k < j; k++) { if (2 * v1 >= i && v1 <= i && v2 <= j && 2 * v2...
### 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 a, b, c, d, ans1, ans2, ans3; int main() { cin >> a >> b >> c >> d; ans1 = max(a, 2 * d + 1); ans2 = max(b, 2 * d + 1); ans3 = max(c, d); if (ans2 == ans3) { if (ans1 == ans2) { ans1 += 2; } ans2++; } else if (ans1 == ans2) ans1++; if...
### 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 v1, v2, v3, vm; inline long long readll() { int sign = 1; char c; for (c = getchar(); !isdigit(c); c = getchar()) if (c == '-') sign = -sign; long long res = c - '0'; for (c = getchar(); isdigit(c); c = getchar()) res = res * 10 + c - '0'; return sign * ...
### 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 minx = -1, miny = -1, minz = -1, maxx = 1000, maxy = 1000, maxz = 1000; int a, b, c, d; cin >> a >> b >> c >> d; minz = max(minz, c); minz = max(minz, d); maxz = min(maxz, 2 * c); maxz = min(maxz, 2 * d); miny = max(miny, b); miny = max(mi...
### 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; if (c * 2 < d || d >= b) cout << -1 << endl; else if (d * 2 < c) cout << -1 << endl; else { cout << a * 2 << endl; cout << b * 2 << endl; cout << max(c, d) << endl; } 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> using namespace std; int V1, V2, V3, Vm; bool OK(int x) { if (Vm <= x && 2 * Vm >= x) { return true; } return false; } void solve() { int i, j, k; for (i = V1; i <= 2 * V1; ++i) { int r; if (2 * V2 < i) r = 2 * V2; else r = i - 1; for (j = V2; j <= r; +...
### 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; void ans(int64_t n) { cout << n; exit(0); } int32_t main() { int64_t a, b, c, d; cin >> a >> b >> c >> d; int64_t zl = max(c, d), zr = 2 * min(c, d); if (zl > zr) ans(-1); int64_t z = zl, yl = max(z + 1, max(2 * d + 1, b)), yr = 2 * b; if (yl > yr) ans(-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 a, b, c, d; cin >> a >> b >> c >> d; for (int sz1 = a; sz1 <= 2 * a; sz1++) { for (int sz2 = b; sz2 <= 2 * b; sz2++) { for (int sz3 = c; sz3 <= 2 * c; sz3++) { if (!(sz1 > sz2 and sz2 > sz3)) continue; if (d <= sz1 and d <= s...
### 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 m, n, o, p, flag = 0; cin >> m >> n >> o >> p; for (int i = 1; i <= 200; i++) { for (int k = 1; k < i; k++) { for (int j = 1; j < i; j++) { if (m <= i && 2 * m >= i && n <= k && 2 * n >= k && o <= j && 2 * o >= j && p <= ...
### 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, a, b, c; scanf("%d%d%d%d", &v1, &v2, &v3, &vm); a = 2 * v1, b = 2 * v2; if (vm >= v1 || vm >= v2 || max(vm, v3) > 2 * min(vm, v3)) { printf("-1\n"); } else printf("%d\n%d\n%d\n", a, b, 2 * min(vm, v3)); 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 main() { int s1, s2, s3, v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; s1 = max(v1, 2 * vm + 2); s2 = max(v2, 2 * vm + 1); s3 = max(v3, vm); if (s1 <= 2 * v1 && s2 <= 2 * v2 && s3 <= 2 * v3 && s1 > 2 * vm && s2 > 2 * vm && s3 <= 2 * vm) cout << s1 <...
### 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; 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 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 v[4]; int main() { for (int i = 0; i < 4; ++i) scanf("%d", v + i); int mn = min(v[2], v[3]); int mx = max(v[2], v[3]); int c = mx; int b = max(v[1], 2 * c + 1); int a = max(v[0], 2 * v[1] + 1); if (mx <= 2 * mn && v[1] * 2 >= b && v[0] * 2 >= a) { prin...
### 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 i, j, k, n, y, r, z, t, tt, x, b[322567], a[334563], s, l, c[335444], d[222222], e[222222], m; pair<long long, long long> p[12345], q, pp; int main() { cin >> n >> m >> k >> x; if (2 * k < x || 2 * x < k || x >= m) { cout << -1; return 0; } cou...
### 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; const long long mod = 1e9 + 7; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } 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 * a ...
### 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 vb, vs, vm, vd; bool ok(int v1, int v2, int v3) { if ((v3 >= max(vm, vd)) && (v3 <= 2 * vm) && (v3 <= 2 * vd) && (v2 >= max(vs, vd)) && (v2 <= 2 * vs) && (v2 > 2 * vd) && (v1 >= max(vb, vd)) && (v1 <= 2 * vb) && (v1 > 2 * vd) && (v1 > v2) && (v2 > v3...
### 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; const int INF = 1 << 29; int main() { ios_base::sync_with_stdio(false); cin.tie(0); long long a[4], i, ans[4] = {0}; for (int i = 0; i < (4); i++) cin >> a[i]; for (int i = 0; i < (2); i++) ans[i] = a[i] * 2; for (i = a[2]; i <= a[2] * 2; i++) { if (a[3] <= ...
### 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() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long V1, V2, V3, Vm; cin >> V1 >> V2 >> V3 >> Vm; if (Vm <= V3 && 2 * Vm >= V3 && 2 * Vm < V2 && 2 * Vm < V1) { cout << V1 << '\n'; cout << V2 << '\n'; cout << V3 << '\n'; 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 a, b, c, k, m; int main() { cin >> a >> b >> c >> k; if ((c * 2 >= k && c <= k) || (c >= k && c <= 2 * k)) { m = min(max(k, c), c * 2); if ((2 * b >= m && b <= m)) { cout << -1; return 0; } else { cout << a * 2 << " " << b * 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> using namespace std; const int N = 1e5 + 5; int main() { ios_base ::sync_with_stdio(0); cin.tie(0); int l, m, s, v; cin >> l >> m >> s >> v; for (int i = l; i <= 2 * l; ++i) { for (int j = m; j <= min(2 * m, i - 1); ++j) { for (int k = s; k <= min(2 * s, j - 1); ++k) { ...
### 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; const long long MOD = 1000000007; const int INF = 1e9; const long long LINF = 1LL * INF * INF; const int MAXN = 200007; const double EPS = 1e-7; int main() { ios_base::sync_with_stdio(0); int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; for (int b1 = (0); b1 < (200)...
### 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; while (scanf("%d %d %d %d", &v1, &v2, &v3, &vm) == 4) { if (vm < v2) { if (vm > v3) { if (2 * v3 >= vm) { printf("%d\n%d\n%d\n", 2 * v1, 2 * v2, vm); } else printf("-1\n"); } else { ...
### 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 a, b, c, d; int main() { cin >> a >> b >> c >> d; int tem = 0x3f3f3f3f; if (d >= a || d >= b) { return cout << -1, 0; } for (int i = c; i <= c + c; i++) { if (i <= d + d && i >= d) { tem = i; break; } } if (tem == 0x3f3f3f3f) { ...
### 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; inline void OPEN(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } int a[10]; int ans[10]; int main() { bool flag = true; for (int i = 1; i <= 4; i++) scanf("%d", &a[i]); ans[3] = max(a[3], a[4]); if (ans[3] > 2 ...
### 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, x; cin >> a >> b >> c >> d; if (d <= 2 * c && d < b && c <= 2 * d) { cout << a * 2 << "\n" << b * 2 << "\n"; x = (c >= d) ? c : d; cout << x << endl; } else cout << "-1"; }
### 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; scanf("%d %d %d %d", &v1, &v2, &v3, &vm); bool ok = false; for (int c1 = max(v1, 2 * vm + 1); c1 <= 2 * v1 && !ok; c1++) { for (int c2 = max(v2, 2 * vm + 1); c2 <= 2 * v2 && c2 < c1 && !ok; c2++) { for (int c3 = max(v3, vm)...
### 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 v1, v2, v3, v4; int main() { cin >> v1 >> v2 >> v3 >> v4; int a[] = {v1 * 2, v2 * 2, v3 * 2}; int ans[3]; if (v4 > a[2] || v4 * 2 < v3) cout << "-1"; else { ans[2] = max(v4, v3); ans[1] = max(2 * v4 + 1, v2); ans[0] = max(2 * v4 + 2, v1); i...
### 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; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); cerr.write(nam...
### 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 m_size = 0, f_size = 0, s_size = 0, masha_size = 0; cin >> f_size >> m_size >> s_size >> masha_size; int f_car = -1, m_car = -1, s_car = -1; for (int i = 2 * f_size; i >= f_size; i--) { if (i > 2 * masha_size) { f_car = i; break; ...
### 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; ifstream in("input.txt"); ofstream out("output.txt"); const int MAXN = 1e5 + 7; const long long MAXL = 1e18; const int N = 1e7; const double eps = 1e-11; int main() { int a, b, c, d; cin >> a >> b >> c >> d; for (int mini = 1; mini <= 200; ++mini) { for (int sr = ...
### 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 = 1; i <= 200; i++) { for (int j = i + 1; j <= 200; j++) { for (int k = j + 1; k <= 200; k++) { if ((v1 <= k) && (v2 <= j) && (v3 <= i) && (vm <= k) && (vm <= j) && ...
### 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; const long long MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(false), cin.tie(0); ; int fb, mb, sb, m; cin >> fb >> mb >> sb >> m; bool possible = false; for (int i = 1; i < 201; i++) { for (int j = i + 1; j < 201; j++) { for (int k = j + 1; 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 dad, mum, son, masha; bool ccheck(int tx, int ty, int tz) { if (dad > tx) return 0; if (2 * dad < tx) return 0; if (mum > ty) return 0; if (2 * mum < ty) return 0; if (son > tz) return 0; if (2 * son < tz) return 0; if (masha > tz) return 0; if (masha * ...
### 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; const int N = 1e6 + 5; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int a, b, c, d; cin >> c >> b >> a >> d; int x, y, z; x = -1, y = -1, z = -1; int j = 0; int arr[100], brr[100], crr[100]; for (int i = a; i <= 2 * a; i++) { ...
### 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; scanf("%d%d%d%d", &v1, &v2, &v3, &v4); if (2 * v3 < v4 || v1 <= v4 || v2 <= v4 || 2 * v4 < v3) { printf("-1\n"); } else { printf("%d\n%d\n", 2 * v1, 2 * v2); if (v4 >= v3) printf("%d\n", 2 * v3); else { pr...
### 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 v1, v2, v3, vm; int main() { scanf("%d %d %d %d", &v1, &v2, &v3, &vm); for (int s1 = max(2 * vm + 1, v1); s1 <= 2 * v1; s1++) for (int s2 = max(2 * vm + 1, v2); s2 < s1 && s2 <= 2 * v2; s2++) for (int s3 = max(vm, v3); s3 < s2 && s3 <= 2 * v3 && s3 <= 2 * ...
### 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 int mod = 1e9 + 7; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; if (vm > 2 * v3 || vm < v3 / 2 + (v3 & 1) || vm >= v2) cout << -1, exit(0); cout << 2 * v1 << endl << 2 * v2 << e...
### 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 a, b, c, d; cin >> a >> b >> c >> d; if (c > 2 * d || d > 2 * c || d >= b) cout << -1 << endl; else cout << 2 * a << endl << 2 * b << endl << max(c, d); }
### 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 a, b, c, d, max = 0; scanf("%d %d %d %d", &a, &b, &c, &d); if (d < a && d < b && 2 * d >= c && d <= 2 * c) { if (c >= d) max = c; else max = d; printf("%d %d %d", 2 * a, 2 * b, max); } else { printf("%d", -1); } }
### 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> #pragma GCC optimize(2) using namespace std; const int INF = 1e9 + 7; const int N = 2e5 + 7; const int M = 1e6 + 7; signed main() { ios::sync_with_stdio(false); int fa, ma, son, sb; cin >> fa >> ma >> son >> sb; int lim[7]; for (int c3 = max(son, sb); c3 <= min(2 * son, 2 * sb); 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 v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; if (v3 > 2 * vm || vm > 2 * v3 || vm >= v2) cout << -1; else cout << 2 * v1 << endl << 2 * v2 << endl << max(v3, vm); return 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 v[4]; int main() { for (int i = 0; i < 4; ++i) scanf("%d", v + i); int mn = min(v[2], v[3]); int mx = max(v[2], v[3]); int c = mx; int b = max(v[1], 2 * c + 1); int a = max(v[0], b + 1); if (mx <= 2 * mn && v[1] * 2 >= b && v[0] * 2 >= a) { printf("%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, v4, ans; scanf("%d %d %d %d", &v1, &v2, &v3, &v4); if (v4 > v3 * 2 || v3 > v4 * 2 || v4 >= v1 || v4 >= v2) { printf("-1"); return 0; } ans = max(v3, v4); printf("%d %d %d", v1 * 2, v2 * 2, ans); }
### 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, T1, T2, T3, Vm; int main() { cin >> V1 >> V2 >> V3 >> Vm; if (V3 > 2 * Vm || Vm > 2 * V3) { cout << -1; return 0; } T3 = max(Vm, V3); if (T3 >= V2) { cout << -1; return 0; } T2 = min(2 * V2, max(V2, 2 * T3 + 1)); T1 = min(2 * ...
### 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 int INF = 0x3f3f3f3f; const long long int INFL = 0x3f3f3f3f3f3f3f3f; const double pi = atan(1.0) * 4.0; const int N = 0; int main(void) { ios_base::sync_with_stdio(false); int a, b, c, d; cin >> a >> b >> c >> d; int ca = 2 * a; int cb = 2 * b; int cc = mi...
### 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; scanf("%d%d%d%d", &a, &b, &c, &d); if (d > 2 * c || c > 2 * d || d >= b) printf("-1"); else printf("%d\n%d\n%d", 2 * a, 2 * b, max(c, d)); return 0; }
### 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 v1, v2, v3, vm; while (~scanf("%d%d%d%d", &v1, &v2, &v3, &vm)) { if (2 * vm >= v3 && vm <= 2 * v3 && vm < v2) { int a1 = 2 * v1, a2 = 2 * v2, a3 = (vm <= v3) ? v3 : vm; printf("%d\n%d\n%d\n", a1, a2, a3); } else printf("-1\n");...
### 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; const int mod = 1000000007; const int inf = 0x3f3f3f3f; const double eps = 1e-8; const double pi = acos(-1.0); int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (d * 2 >= c && c * 2 >= d && d < b) { int x = max(c, d); int y = max(x * 2 + 1, b); int ...
### 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; const long long inf = 1e9; const long long inf64 = 1e18; const long long MOD = inf + 7; const long double PI = acos(-1.0); int32_t main() { ios::sync_with_stdio(false), cin.tie(nullptr); ; long long a, b, c, d; cin >> a >> b >> c >> d; for (long long i = c; i <= 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 i, j, k, v[4], m = 4; for (i = 0; i < m; i++) cin >> v[i]; int masha = v[3]; for (k = v[0]; k <= 2 * v[0]; k++) for (j = v[1]; j <= 2 * v[1]; j++) for (i = masha; i <= 2 * v[2]; i++) if (i <= 2 * masha && j > 2 * masha && k > 2 * m...
### 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; void build() {} const int mod = 1000000007, N = 200005; const long long inf = 1e18; void preprocess() { return; } int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); build(); preprocess(); int v1, v2, v3, v4; cin >> v1 >> v2 >> v3 >> v4; int ...
### 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; cin >> a >> b >> c >> d; bool flag = 0; for (int i = a; i <= 2 * a; i++) { for (int j = b; j <= 2 * b; j++) { for (int k = c; k <= 2 * c; k++) { if (i > j && j > k && k >= d && k <= 2 * d && j > 2 * d) { 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; bool judge(int a, int b) { return a <= b && a * 2 >= b; } int main(void) { int v1, v2, v3, v4; cin >> v1 >> v2 >> v3 >> v4; for (int i = 1; i <= 300; ++i) { for (int j = 1; j < i; ++j) { for (int k = 1; k < j; ++k) { if (judge(v1, i) && judge(v2, j) ...
### 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; int l[5], r[5]; int main() { while (~scanf("%d%d%d%d", &v1, &v2, &v3, &vm)) { l[1] = v1; r[1] = 2 * v1; l[2] = v2; r[2] = 2 * v2; l[3] = v3; r[3] = 2 * v3; int a1 = -1, a2 = -1, a3 = -1; for (int i = r[1]; i >= l[1] && 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 readi(int &x) { int v = 0, f = 1; char c = getchar(); while (!isdigit(c) && c != '-') c = getchar(); if (c == '-') f = -1; else v = v * 10 + c - '0'; while (isdigit(c = getchar())) v = v * 10 + c - '0'; x = v * f; } void readll(long long &x) { l...
### 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); long long int a, b, c, d; cin >> a >> b >> c >> d; a *= 2; b *= 2; if (2 * d >= a || 2 * d >= b || 2 * c < d || 2 * d < c) { cout << -1 << endl; return 0; } else { cout << a << endl; ...
### 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 inf = 1LL << 60; long long mod = 1000000007; double pi = acos(-1.0); using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; vector<int> ans; for (int i = v3; i <= 2 * v3; i++) { if (i ...
### 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 v1, v2, v3, v4; cin >> v1 >> v2 >> v3 >> v4; for (int i = 1; i <= 200; i++) { for (int j = 1; j <= 200; j++) { for (int k = 1; k <= 200; k++) { if (v1 <= i && v2 <= j && v3 <= k && 2 * v1 >= i && 2 * v2 >= j && 2 * v3 >= ...
### 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 V1, V2, V3, Vm; int main() { ios::sync_with_stdio(0); cin.tie(NULL); cin >> V1 >> V2 >> V3 >> Vm; for (int i = (V1); i <= (2 * V1); i++) for (int j = (V2); j <= (2 * V2); j++) for (int k = (V3); k <= (2 * V3); k++) { if (i > j && j > k && Vm <=...
### 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 v1, v2, v3, sg, i, j, k; cin >> v1 >> v2 >> v3 >> sg; for (i = 2 * v1; i; i--) for (j = min(2 * v2, i - 1); j; j--) for (k = i - 1; k; k--) if (max(max(sg, v1), 2 * sg + 1) <= i && max(max(sg, v2), 2 * sg + 1) <= j && max...
### 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 jud(int person, int family) { for (int i = 2 * family; i >= family; i--) { if (person <= i && 2 * person >= i) return i; } return 0; } int get_in(int person, int family) { for (int i = 2 * family; i >= family; i--) { if (person <= i && 2 * person < i) { ...
### 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 double PI = acos(-1.0); const int INF = 0x3f3f3f3f; const double eps = 1e-8; const long long mod = 10007; const int N = 3000; int main() { int v[10]; int ans[10]; for (int i = 1; i <= 4; i++) { scanf("%d", &v[i]); ans[i] = v[i]; } if (v[3] * 2 < v[4]...
### 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; while (scanf("%d%d%d%d", &a, &b, &c, &d) == 4) { int L1 = c, R1 = 2 * c, L2 = d, R2 = 2 * d; if (L1 <= R2 && L2 <= R1 && R2 < 2 * b) { int t1 = max(L1, L2); printf("%d %d %d\n", 2 * a, 2 * b, t1); } else printf(...
### 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() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int a, b, c, m; int flag = 0; int c1 = 0, c2 = 0, c3 = 0; int t; cin >> a >> b >> c >> m; t = 0; for (int i = min(c, m); i <= 2 * c && i <= 2 * m; i++) { if ((m <= i && 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> int main() { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); for (int i = a; i <= 2 * a; ++i) for (int j = b; j <= 2 * b && j < i; ++j) for (int k = c; k <= 2 * c && k < j; ++k) if (d <= i && d <= j && d <= k && d * 2 >= k && d * 2 < j && d * 2 < i) { ...
### 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; void read(bool out = 0) {} bool can(long long man, long long car) { return man <= car; } bool like(long long man, long long car) { return 2 * man >= car; } int main() { long long a, b, c, k; cin >> a >> b >> c >> k; for (int i = 1; i < 201; i++) for (int j = 1; j ...
### 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 x, y; int ap[100005], b[20000001] = {0}; int main() { int b1, b2, b3, m; cin >> b1 >> b2 >> b3 >> m; for (int i = 0; i < 250; i++) { for (int j = 0; j < 250; j++) { for (int h = 0; h < 250; h++) { if (i >= max(b1, m) && j >= max(b2, m) && h >= ma...
### 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; const long long int INF = 1000000007; const int N = 100000 + 7; int main() { int a, b, c, d; cin >> a >> b >> c >> d; for (int i = 1; i <= 200; i++) { for (int j = 1; j < i; j++) { for (int k = 1; k < i; k++) { if (a <= i && i <= 2 * a && b <= j && j...
### 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; while (scanf("%d%d%d%d", &a, &b, &c, &d) == 4) { for (int i = a; i <= 2 * a; i++) { for (int j = b; j <= 2 * b && j < i; j++) { for (int k = c; k <= 2 * c && k < j; k++) { if (a <= i && b <= j && c <= k && 2 * a >...
### 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; scanf("%d%d%d%d", &v1, &v2, &v3, &v4); for (int a1 = 0; a1 <= 200; a1++) for (int b1 = 0; b1 < a1; b1++) for (int c1 = 0; c1 < b1; c1++) if (a1 >= v1 && b1 >= v2 && c1 >= v3 && a1 <= v1 * 2 && b1 <= v2 * 2 && ...
### 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() { ios::sync_with_stdio(false); cin.tie(); cout.tie(); ; int v1, v2, v3, v4; cin >> v1 >> v2 >> v3 >> v4; for (int i = 300; i >= 1; i--) { if (v1 <= i && 2 * v1 >= i) { for (int j = i - 1; j >= 1; j--) { if (v2 <= j && 2 * v2 >= j) ...
### 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 sum(long long a) { return a * (a + 1) / 2; } int main() { int a, b, c, m; cin >> a >> b >> c >> m; for (int i = 1; i <= 200; i++) { for (int j = 1; j <= 200; j++) { for (int k = 1; k <= 200; k++) { if (i >= a && i <= 2 * a && j >= b && j <=...
### 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; 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 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 v1, v2, v3, vm; bool check(int i, int j, int k) { if (i >= max(v1, vm) && j >= max(v2, vm) && k >= max(v3, vm)) { if (i <= 2 * v1 && j <= 2 * v2 && k <= 2 * v3) { if (i > 2 * vm && j > 2 * vm) { if (k <= 2 * vm) { if (i > j && j > k) { ...
### 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; const int MOD = (int)1e9 + 7; const double EPS = 1e-9; const int INF = INT_MAX; const long long INFLL = (long long)1e18; const double PI = acos(-1.0); template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <class T> T lcm(T a, T b) { return a / gc...
### 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; const int MOD = 1e9 + 7; long long power(long long a, long long b) { long long ret = 1; while (b) { if (b & 1) ret *= a; a *= a; if (ret >= MOD) ret %= MOD; if (a >= MOD) a %= MOD; b >>= 1; } return ret; } long long inv(long long x) { return powe...
### 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; const int n = 3; int v[n], vm, s[n]; bool dfs(int p) { if (p == 3) return true; for (int i = v[p]; i <= 2 * v[p]; ++i) { s[p] = i; if (p) { if (2 * vm < i && i > s[p - 1]) { if (dfs(p + 1)) return true; } } else { if (vm <= i && 2 *...
### 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; template <class T> void rd(T& ret) { ret = 0; bool ok = 0, u = 0; for (;;) { int c = getchar(); if (c >= '0' && c <= '9') ret = (ret << 3) + (ret << 1) + c - '0', ok = 1; else if (c == '-') u = 1; else if (ok) { if (u) ret *= -1; ...
### 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> #pragma comment(linker, "/STACK:5000000000") const unsigned long long mod = 1000000007; long long Inf = (long long)2e9; long long LINF = (long long)1e18 + 1e17; using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; for (int i = a; i <= 2 * a; i++) { for (int j = b...
### 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 const N = 5005; int mod = 1000000007; int main() { int v1, v2, v3, vm; cin >> v3 >> v2 >> v1 >> vm; if ((v1 > 2 * vm or vm > 2 * v1) or 2 * v3 <= 2 * vm or 2 * v2 <= 2 * vm) cout << -1 << endl; else { cout << v3 * 2 << endl; cout << v2 * 2 << endl; ...
### 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; int f, m, s, ma; int main() { scanf("%d %d %d %d", &f, &m, &s, &ma); int fm, fmi, mm, sm, smi, mam, mmi; fm = 2 * f; mm = 2 * m; sm = 2 * s; mam = m * 2; if (ma > fm || ma > mm || ma > sm || 2 * s < ma || 2 * ma < s || (2 * m ...
### 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; cin >> v1 >> v2 >> v3 >> v4; if (2 * v3 < v4 || 2 * v4 < v3 || v4 >= v2) { cout << "-1"; } else { cout << 2 * v1 << endl << 2 * v2 << endl << max(v3, v4); } return 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; const int N = 1e4 + 1; vector<int> v[N]; int vis[N]; long long int cnt1 = 0, cnt2 = 0, cnt = 0, m, n, x, y, z, i, j, k, mini, d, a, b, c, o; int color[N] = {0}; long long int brr[N]; void dfs(int s, int t) { vis[s] = 1; color[s] = t; for (int i = 0; i < ...
### 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() { ios::sync_with_stdio(0); int f, m, s, mas; cin >> f >> m >> s >> mas; if (mas > 2 * s || s > 2 * mas) { cout << -1; return 0; } int sc = s; while (sc < mas) ++sc; if (sc >= m) { cout << -1; return 0; } cout << 2 * f << 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 Father, Mother, Son, Masha, sizeMasha; int ans1, ans2, ans3; int main() { cin >> Father >> Mother >> Son >> Masha; for (int sizeFather = Father; sizeFather <= 2 * Father; sizeFather++) { for (int sizeMother = Mother; sizeMother <= 2 * Mother; sizeMother++) { ...
### 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 v1, v2, v3, vm; int main() { cin >> v1 >> v2 >> v3 >> vm; if (vm > v3 * 2 || vm >= v2 || vm * 2 < v3) { cout << -1; return 0; } else { cout << v1 * 2 << " " << v2 * 2 << " " << max(v3, vm); } return 0; }
### 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 a, b, c, d; int ansa, ansb, ansc; int read() { int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } i...
### 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, v; cin >> v1 >> v2 >> v3 >> v; int second = -1, m = -1, l = -1; for (int i = v; i <= 230; i++) { for (int j = i + 1; j <= 230; j++) { for (int k = j + 1; k <= 230; k++) { if (2 * v < j && 2 * v < k && 2 * v >= i && 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...