output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; string sol(string a) { int l = a.length(); for (int i = 0; i < l; i++) { if (a[i] == 'u') return sol(a.replace(i, 1, "oo")); if (a[i] == 'k' && a[i + 1] == 'h') return sol(a.erase(i, 1)); } return a; } int main() { int n; cin >> n; string a[n]; set<s...
### Prompt Please formulate a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); set<string> st; string s; while (n--) { cin >> s; string tmp = ""; int idx = s.size() - 1; while (idx >= 0) { if (s[idx] == 'u') tmp += "oo"; else if (s[idx] == 'h') { tmp += 'h'; ...
### Prompt Please provide a cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; err(++it, args...); } const long long mod = pow(10, 9) + 7; const long long N = 3e5, M = N; con...
### Prompt Please create a solution in Cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; set<string> st; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { string s; cin >> s; while (s.find("u") != -1) { int t = s.find("u"); s.erase(t, 1); s.insert(t, "oo"); } while (s.find("kh") != -1) { int t = s.find...
### Prompt Construct a Cpp code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; string parse_word(const string& s) { string s1; if (s[0] == 'u') { s1 = "oo"; } else { s1 = ""; s1.push_back(s[0]); } for (int i = 1; i < int(s.size()); ++i) { if (s[i] == 'u') { s1 += "oo"; } else if (s[i] == 'h') { while (s1.size(...
### Prompt Generate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; int n; string s; set<string> st; void make(string a, string b) { int t; t = s.find(a); while (t != -1) { s = s.replace(t, a.size(), b); t = s.find(a); } } int main() { cin >> n; for (int i = 0; i < n; ++i) { cin >> s; make("u", "oo"); make("o...
### Prompt Your challenge is to write a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; const int maxn = 400; map<string, int> mp; char str[50]; int main() { mp.clear(); int n; scanf("%d", &n); for (int k = 0; k < n; k++) { string tmp = ""; scanf("%s", str); int len = strlen(str); for (int i = len - 1; i >= 0; i--) { if (str[i] ==...
### Prompt Please create a solution in Cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; vector<string> vec(n); for (long long i = 0; i < n; i++) { cin >> vec[i]; } set<string> sec; for (long long i = 0; i < n; i++) { bool change = true; while (change) { change = false; for (long long j =...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; int main() { set<string> st; string str; int n; while (scanf("%d", &n) != EOF) { for (int i = 0; i < n; i++) { cin >> str; for (int j = str.size(); j >= 0; j--) { if (str[j] == 'u') str.replace(j, 1, "oo"); else if (str[j] =...
### Prompt Develop a solution in Cpp to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; set<string> s; for (int i = 0; i < n; i++) { string cur; cin >> cur; while (1) { bool flg = 1; string now; for (int i = 0; i < cur.length(); i++) { ...
### Prompt Create a solution in cpp for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; const int MAXN = 403; int n; string words[MAXN]; vector<int> adj[MAXN]; bool vis[MAXN]; string reduce(string a) { string res; for (int i = 0; i < a.size(); i++) { if (a[i] == 'u') { res.push_back('o'); res.push_back('o'); } else if (a[i] == 'k') { ...
### Prompt Your task is to create a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; const int MXN = (int)4e2 + 7; string s[MXN]; bool die[MXN]; void sub(int p) { string s1 = s[p]; int l1 = s1.length(); for (int i = 0; i < l1; ++i) if (s1[i] == 'u') { s1 = s1.substr(0, i) + "oo" + s1.substr(i + 1, l1 - i - 1); l1++; } for (int i ...
### Prompt Your challenge is to write a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; map<string, long long int> mp; string reduce(string str) { string tempstr; long long int i; for (i = 0; i < str.length(); i++) { if (str[i] == 'u') { tempstr += "oo"; } else { tempstr += str[i]; } } string newstr; for (i = tempstr.length(...
### Prompt Please create a solution in CPP to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; vector<string> s(1000); bool a[500][500]; bool used[500]; long long num[500]; long long n; bool same(string a, string b) { long long i; vector<char> one, two; for (i = 0; i < a.size(); i++) { one.push_back(a[i]); long long t = one.size(); if (one[t - 1] ==...
### Prompt Construct a cpp code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; int fa[500]; char st[500][50]; int Find(int x) { return fa[x] == x ? x : fa[x] = Find(fa[x]); } bool judge(char *ss, char *tt) { int len = strlen(ss); int len2 = strlen(tt); char s[50], t[50]; for (int i = 0; i < len; i++) s[i] = ss[i]; for (int i = 0; i < len2; i...
### Prompt Create a solution in Cpp for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; string str[409]; map<string, int> mapp; int ans = 0; void check(string now) { string cc = ""; int si = now.size(); for (int i = 0; i < si; i++) { if (now[i] == 'u') { cc += "oo"; } else { cc += now[i]; } } string aa = ""; si = cc.size(); ...
### Prompt Construct a cpp code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; set<string> str_set; while (t--) { string input; cin >> input; string ans = " "; while (ans != input) { ans.clear(); int i = 0; while (i < input.size()) { if (i + 1 < input.size() && input[i] ==...
### Prompt Construct a Cpp code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; map<pair<char, char>, char> conversions; string shorten(string &str) { string s; for (auto &c : str) { s.push_back(c); while (s.size() >= 1) { if (s[s.size() - 1] == 'u') { s.pop_back(); s.push_back('o'); s.push_back('o'); } e...
### Prompt In cpp, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; set<string> s; for (int i = 0; i < n; i++) { string t; cin >> t; t += '.'; string w = ""; int c = 0, k = 0; for (char x : t) { if (c && (x != 'o' && x != 'u')) { stringstream nm; nm << c; ...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; char nn[500][500] = {0}; for (int i = 0; i < n; i++) cin >> nn[i]; char x[500][500] = {0}; map<string, int> freq; for (int i = 0; i < n; i++) { int k = 0, lk = -1, j; for (j = 0; nn[i][j] != '\0'; j++) { if (nn[i][j]...
### Prompt Create a solution in Cpp for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; bool is_prime(int n) { for (int i = 2; i * i <= n; ++i) { if (n % i == 0) { return false; } } return true; } inline long long getPow(long long a, long long b) { long long res = 1, tp = a; while (b) { if (b & 1ll) { res *= tp; res %= 1...
### Prompt Your challenge is to write a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; void convert(string& s) { int len = 0; string temp = ""; for (int i = 0; i < s.size(); i++) { if (s[i] == 'k') { int begin = i; while (i < s.size() && s[i] == 'k') i++; if (s[i] == 'h') { temp += 'h'; } else { for (int j = b...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { string s; set<string> st; while (n--) { cin >> s; for (int i = s.length(); i >= 0; i--) { if (s[i] == 'u') s.replace(i, 1, "oo"); else if (s[i] == 'k' && s[i + 1] == 'h') ...
### Prompt Your task is to create a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; bool b[100100]; string s; long long cnt[100100], n; map<string, int> mp; string fun(string s) { stack<char> st; string ans = ""; for (int i = 0; i < s.size(); i++) { if (st.empty() && s[i] != 'u') { st.push(s[i]); } else if (s[i] == 'u') { st.push(...
### Prompt Please formulate a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; string uoo(string& s) { string cur = ""; for (auto i : s) { if (i == 'u') { cur += "oo"; } else { cur += i; } } return cur; } string khh(string& s) { string cur = ""; for (int i = 0; i < s.size(); i++) { if (!(i < s.size() - 1 && s[i]...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; int main() { int pos1, pos2, pos3, l, T; set<string> s; string str; cin >> T; while (T--) { cin >> str; while (1) { pos3 = str.find("u"); if (pos3 != -1) str.replace(pos3, 1, "oo"); else break; } while (1) { ...
### Prompt Please provide a Cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; void show(vector<long long>& vc) { for (auto it : vc) cout << it << " "; cout << endl; } bool p[10 + 2]; vector<long long> prime; void seive(void) { memset(p, 0, sizeof p); p[1] = 1; p[0] = 1; for (int i = 4; i <= 10; i += 2) { p[i] = 1; } for (long long...
### Prompt Develop a solution in CPP to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; void problemeA(); void problemeB(); void problemeC(); void probleme4(); void probleme5(); void probleme6(); int main() { problemeB(); return 0; } struct point { int x; int y; }; void problemeA() { point start{0, 0}, goal{0, 0}; cin >> start.x >> start.y; cin >...
### Prompt Please create a solution in Cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j; cin >> n; string p = ""; vector<string> s(n); for (i = 0; i < n; i++) cin >> s[i]; for (j = 0; j < n; j++) { p = s[j]; if (p == "u") p = "oo"; for (i = 1; i < p.length(); i++) { if (p[i - 1] == 'u') { p = p.sub...
### Prompt Please create a solution in cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; const int N = 420; int ans; int d[N][100], w[N], n, rk[N]; char st[100]; bool pd(int a, int b) { int yu = ((w[a] > w[b]) ? (w[a]) : (w[b])); for (int i = 1; i <= yu; i++) { if (d[a][i] < d[b][i]) return 1; if (d[a][i] > d[b][i]) return 0; } return 0; } bool ...
### Prompt Your challenge is to write a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> #pragma warning(disable : 4996) #pragma comment(linker, "/STACK:336777216") using namespace std; int IT_MAX = 1 << 19; const long long MOD = 1000000007; const int INF = 0x3f3f3f3f; const long long LL_INF = 0x1f3f3f3f3f3f3f3f; const double PI = acos(-1); const double ERR = 1e-12; char in[105]; c...
### Prompt Generate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; set<string> s; string str; void init() { s.clear(); } int main() { int n; while (~scanf("%d", &n)) { init(); for (int i = 0; i < n; i++) { cin >> str; string tp = ""; int len = str.size(); for (int j = 0; j < len; j++) { if (str[j...
### Prompt Please formulate a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int ans(vector<string>& str) { int n = str.size(); for (int i = 0; i < n; ++i) { string::iterator itr; for (itr = str[i].begin(); itr != str[i].end(); ++itr) { if (*itr == 'k' && *(itr + 1) == 'h') { *itr = 'h'; str[i].erase(itr + 1); ...
### Prompt Please formulate a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; const long long int N = 1e5; const long long int mod = 1e9 + 7; void solve() { long long int n, idx; string a; set<string> grps; vector<string> trans; cin >> n; for (long long int i = 0; i < n; i++) { trans.clear(); cin >> a; idx = a.size() - 1; ...
### Prompt Your task is to create a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; #pragma GCC diagnostic ignored "-Wmissing-declarations" string shorter(string s) { for (;;) { int ex = 0; auto f = s.find("oo"); string ns; int n; if (f == string::npos) { ++ex; goto lab1; } n = s.length(); ns = s.substr(0, f) +...
### Prompt Your challenge is to write a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 30; const int maxn = 2333333; const int mod = 1000000007; string str, s[maxn]; int n, ans = 0; int main() { cin >> n; for (int t = 0; t < n; t++) { cin >> str; for (int i = 0; i < str.size(); i++) { if (str[i] == 'u') s[t] = s[...
### Prompt Please create a solution in CPP to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s[100000]; cin.get(); int i = 0; while (n--) { getline(cin, s[i]); stack<char> sk; for (int j = 0; j < s[i].size(); j++) { if (!sk.empty() && s[i][j] == 'h' && sk.top() == 'k') { while (sk.top() == '...
### Prompt Construct a cpp code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; vector<string> res; set<string> ss; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { string d; cin >> d; int z = d.size(); string s1 = ""; for (int j = 0; j < z; j++) { if (d[j] == 'u') { s1.push_back('o'); s1.push...
### Prompt Your task is to create a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> int const INF = 1e9; using namespace std; const unsigned long long int mod = 1e9 + 9; int main() { int n; cin >> n; vector<string> names(n); for (int i(0); i < n; i++) { cin >> names[i]; } set<string> st; for (int i(0); i < n; i++) { string tmp; for (int j(names[i].siz...
### Prompt Your task is to create a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; map<string, int> mp; int n, ans, len; int main() { int i, j; char s[100010]; scanf("%d", &n); for (int t = 1; t <= n; t++) { scanf("%s", s); len = strlen(s); for (i = 0; i < len; i++) if (s[i] == 'u') { for (j = len + 1; j > i; j--) s[j] = ...
### Prompt Your task is to create a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s[400]; for (int i(0); i < n; ++i) { cin >> s[i]; for (int j(0); j < s[i].length(); ++j) { if (s[i][j] == 'u') { s[i].replace(j, 1, "oo"); j = 0; } if (s[i][j] == 'h') { int numb ...
### Prompt Please create a solution in Cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; set<string> S; for (int tk = 0; tk < n; ++tk) { string s; cin >> s; string as; for (int i = 0; i < s.size(); ++i) { if (s[i] == 'u') { as += "oo"; } else { as.push_back(s[i]); } } ...
### Prompt Construct a cpp code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; int N; set<string> st; string convert(string s) { string t = s; while (!t.empty()) { s = t; int sz = (int)s.size(); t = ""; for (int i = 0; i < sz; i++) { if (i + 1 < sz && s[i] == 'k' && s[i + 1] == 'h') { if (i) t += s.substr(0, i); ...
### Prompt Your task is to create a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; int main() { set<string> s; int n; cin >> n; for (int i = 0; i < n; i++) { string k; cin >> k; while (k.find("u") != string::npos) k = k.replace(k.find("u"), 1, "oo"); while (k.find("kh") != string::npos) k = k.replace(k.find("kh"), 2, "h"); s.in...
### Prompt Generate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; set<string> s; while (n--) { string t; cin >> t; for (int i = 0; i < 30; i++) { for (int j = 0; j < t.length() - 1; j++) { if (t[j] == 'k' && t[j + 1] == 'h') { t.replace(j, 2, "h"); } ...
### Prompt Construct a CPP code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; string* input; string* filteru; int main(int argc, char* argv[]) { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; input = new string[n]; filteru = new string[n]; for (int i = 0; i < n; i++) { cin >> input[i]; } for (int i = 0; i < n;...
### Prompt Please provide a cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 1; const int INF = 1e9 + 7; map<string, int> M; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; ++i) { string s; cin >> s; while (1) { bool _find = false; ...
### Prompt Construct a cpp code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; set<string> myset; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { string s1, s2, scnt; cin >> s1; int sz = s1.size(); for (int j = 0; j < sz; j++) { if (s1[j] == 'k') { scnt += 'k'; continue; } if (...
### Prompt Your challenge is to write a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; string conv(string s) { string res; for (int i = 0; i < s.size(); i++) { if (s[i] == 'u') res += "oo"; else if (s[i] == 'h') { while (res.size() && res.back() == 'k') res.pop_back(); res += s[i]; } else res += s[i]; } return res; ...
### Prompt In Cpp, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); string s[401]; unordered_map<string, int> umap; for (int i = 0; i < n; i++) { cin >> s[i]; } for (int i = 0; i < n; i++) { for (int j = 0; j < s[i].size(); j++) { if (s[i][j] == 'u') { s[i].replace(j, ...
### Prompt In Cpp, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s[n + 1]; for (int j = 0; j < n; j++) { cin >> s[j]; for (int i = 0; i < (int)s[j].size(); i++) { if (s[j][i] == 'u') { s[j][i] = 'o'; string tmp = s[j]; s[j].erase(s[j].begin() + i, s[j].end...
### Prompt Develop a solution in cpp to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; long long ans; int n, m, T; char a[1001], b[1001]; map<long long, bool> p; inline void init() { scanf("%s", a + 1); n = strlen(a + 1); m = 0; for (int i = 1; i <= n; i++) { while (m > 0 && b[m] == 'k' && a[i] == 'h') m--; if (a[i] == 'u') { b[++m] = 'o...
### Prompt Please create a solution in Cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; bool ifNextH(string& a, int i) { while (i < a.size() && a[i] == 'k') i++; if (i == a.size() || a[i] != 'h') return false; return true; } string normalize(string& a) { int i = 0; string result = ""; while (i < a.size()) { if (a[i] != 'k' && a[i] != 'u') { ...
### Prompt Please provide a Cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; int main() { int v1, v2, v3, vm, vc; cin >> v1 >> v2 >> v3 >> vm; vc = v3; if (2 * vm < v3) { cout << "-1"; return 0; } if (vc < vm) vc = vm; if (v3 * 2 < vc) { cout << "-1"; return 0; } if (vm * 2 >= v1 * 2 || vm * 2 >= v2 * 2) { cout ...
### 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, vm, flag = 0; cin >> v1 >> v2 >> v3 >> vm; int smallh = v3 * 2, medh, largeh; if (vm > smallh) flag = 1; if (2 * vm < v3) flag = 1; if (vm >= v2 || vm >= v1) flag = 1; if (vm > v3) smallh = vm; else smallh = v3; if (vm ...
### 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; while (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 && 2 * a >= i && b <= j && 2 * b >= j && c <= k && 2 * c >= 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; 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 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; bool z[26]; bool z2[26]; int main() { cin.sync_with_stdio(false); cin.tie(0); int v1, v2, v3, v4; cin >> v1 >> v2 >> v3 >> v4; int x1 = v1 * 2; int x2 = v2 * 2; if (x2 <= v4 * 2) { cout << -1; return 0; } for (int x3 = 1; x3 <= 200; x3++) { boo...
### 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, v; cin >> v1 >> v2 >> v3 >> vm; v1 *= 2; v2 *= 2; v = v3 * 2; if (v > 2 * vm) { v = 2 * vm; } if (vm <= v && v3 <= v && 2 * vm < v2) { cout << v1 << endl; cout << v2 << endl; cout << v << endl; } else { ...
### 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 n, m, nm, p, t, ans; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (max(c, d) > min(c, d) * 2) { cout << "-1"; return 0; } int aa, bb, cc; cc = max(c, d); bb = max(cc + 1, b); bb = max(d * 2 + 1, bb); aa = max(bb + 1, a); if (bb > ...
### 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; cin >> a >> b >> c >> d; if (d > 2 * c || d >= b || d >= a || 2 * d < c) { cout << "-1"; return 0; } cout << max(2 * a, 2 * d + 2) << endl; cout << max(2 * b, 2 * d + 1) << endl; cout << max(c, d) << endl; 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; const int MaxN = 1e6 + 1; bool ok = 0, good; char w; int ans = 0; int main() { int a, b, c, d; cin >> a >> b >> c >> d; for (int i = a; i <= a * 2; i++) if (d * 2 < i) for (int j = b; j <= b * 2; j++) if (d * 2 < j) for (int k = c; k <= c *...
### 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 int INF = 1e9 + 7; const int MAXN = 3e5 + 10; 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; j <= 2 * b; j++) { for (int k = c; k <= 2 * c; k++) { if (i > j && j > k && d <= i && d <= j ...
### 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, v; cin >> v1 >> v2 >> v3 >> v; for (int i = 250; i >= 1; --i) for (int j = i - 1; j >= 1; --j) for (int k = j - 1; k >= 1; --k) if (v1 <= i && 2 * v1 >= i && v2 <= j && 2 * v2 >= j && v3 <= k && 2 * v3 >= k &&...
### 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; char s[10][10]; int main() { std::ios_base::sync_with_stdio(false); int mb, tb, cb, m; cin >> tb >> mb >> cb >> m; if (m > 2 * cb || m >= mb || 2 * m < cb) cout << "-1"; else { if (2 * m >= mb && 2 * m + 1 >= tb) { if (mb * 2 >= 2 * m + 1) cout << 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> int main() { int v1, v2, v3, vm; scanf("%d%d%d%d", &v1, &v2, &v3, &vm); int c1 = v1, c3 = (v3 > vm) ? v3 : vm, c2 = c3 * 2 + 1; if (c3 > 2 * vm) printf("-1\n"); else if (c3 > 2 * v3) printf("-1\n"); else if (c2 > 2 * v2) printf("-1\n"); else { if (c2 < v2) c2 = v2;...
### 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 MAXN = 200005; int main() { int v1, v2, v3, v4; cin >> v1 >> v2 >> v3 >> v4; v1 *= 2; v2 *= 2; v3 *= 2; if (v4 * 2 < v3 / 2 || v4 * 2 >= v2 || v4 > v3) cout << -1 << endl; else { cout << v1 << endl << v2 << endl << min(v3, v4 * 2) << endl; ...
### 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, v; scanf("%d%d%d%d", &v1, &v2, &v3, &v); for (int i = 300; i >= 0; i--) { for (int j = i - 1; j >= 0; j--) { for (int k = j - 1; k >= 0; k--) { if (i >= v1 && j >= v2 && k >= v3 && k >= v && 2 * v >= k && 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 k, l, m, n; cin >> k >> l >> m >> n; if (n >= k || n >= l || m * 2 < n || 2 * n < m) { cout << "-1" << endl; return 0; } k *= 2; l *= 2; if (n > m) m *= 2; cout << k << "\n" << l << "\n" << m << endl; 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; cin >> v1 >> v2 >> v3 >> vm; for (int i = 1; i <= 200; i++) { for (int j = 1; j <= 200; j++) { for (int k = 1; k <= 200; k++) { if (i > j && j > k && v1 <= i && i <= 2 * v1 && j >= v2 && j <= 2 * v2 && k >...
### 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, vm; 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 <= k && 2 * vm >= k && 2 * vm < j && 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; cin >> a >> b >> c >> d; for (int i = a; i <= 2 * a; ++i) { for (int z = b; z <= 2 * b; ++z) { for (int k = c; k <= 2 * c; ++k) { if (d <= i && d <= z && d <= k && d * 2 < i && 2 * d < z && 2 * d >= k && i > z...
### 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 ((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 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; scanf("%d %d %d %d", &a, &b, &c, &d); for (int i = 1; i <= 200; i++) { for (int j = 1; j < i; j++) { for (int k = 1; k < j; k++) { if (a <= i && 2 * a >= i && b <= j && 2 * b >= j && c <= k && 2 * c >= k && 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; template <typename T, typename U> inline ostream &operator<<(ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second; return _out; } template <typename T, typename U> inline istream &operator>>(istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p....
### 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, c1, c2, c3; cin >> v1 >> v2 >> v3 >> vm; c1 = v1 * 2; c2 = v2 * 2; c3 = max(v3, vm); if (!(c3 <= 2 * min(v3, vm) && c2 >= 2 * vm && vm < v2)) cout << -1; else cout << c1 << '\n' << c2 << '\n' << c3; 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 main() { int a, b, c, m; cin >> a >> b >> c >> m; if (b > m && (c << 1) >= m && (m << 1) >= c) { cout << (a << 1) << endl; cout << (b << 1) << endl; cout << max(c, m) << endl; } else cout << -1 << endl; return 0; }
### 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; cin >> v1 >> v2 >> v3 >> v4; int v11 = 2 * v1; int v22 = 2 * v2; int v33 = 2 * v3; int v44 = 2 * v4; int sc, mc, bc; bool flag = false; for (int i = v3; i <= v33; i++) { if (i >= v4 && i <= v44) { flag = true; ...
### 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; 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[3], ans[3]; for (int i = 0; i < 3; ++i) { ans[i] = -1; } for (c[0] = 1; c[0] <= 300; ++c[0]) { for (c[1] = 1; ...
### 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; template <typename T> void $readvec(const vector<T>& vec, int cnt) { vec.resize(cnt); for (int i = 0; i < cnt; ++i) { cin >> vec[i]; } } void $main(); int main() { if (0) { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); } $main...
### 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> int main() { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); if (d > 2 * c) printf("-1"); else if (d >= b) printf("-1"); else if (2 * d < c) printf("-1"); else if (2 * d >= c && d <= c) printf("%d\n%d\n%d\n", 2 * a, 2 * b, c); else if (d > c && d <= 2 * c) p...
### 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 long long int mod = 1000000007; void func() { long long int v1, v2, v3, vm; cin >> v1 >> v2 >> v3 >> vm; for (long long int c3 = v3; c3 <= 2 * v3; c3++) { for (long long int c2 = v2; c2 <= 2 * v2; c2++) { for (long long int c1 = v1; c1 <= 2 * v1; c1++)...
### 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() { std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int m, n, k, s, flag = 0, ss, b; cin >> m >> n >> k >> s; for (int i = k; i <= 2 * k; i++) { for (int j = k + 1; j <= 2 * n; j++) { for (int b = j + 1; b <= 2 * m; b++) { 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; int v1, v2, v3, vm; int c1, c2, c3; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> v1 >> v2 >> v3 >> vm; for (c1 = v1; c1 <= 2 * v1; c1++) { for (c2 = v2; c2 <= 2 * v2; c2++) for (c3 = v3; c3 <= 2 * v3; c3++) { if (c2 >= c1 || 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; const int maxn = 2e2 + 5; int v[5]; bool check(int a, int b) { if (a <= b) { return (2 * a >= b); } return false; } int main() { for (int i = 1; i <= 4; ++i) { cin >> v[i]; } for (int i = 1; i <= maxn; ++i) { if (check(v[1], i)) { for (int 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 const N = 202000; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (d >= b) { cout << -1; return 0; } for (int i = c; i <= c * 2; i++) { if (i >= d && i <= d * 2) { cout << a * 2 << endl << b * 2 << endl << i; 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 a, b, c, d; int main() { scanf("%d%d%d%d", &a, &b, &c, &d); for (int i = a; i <= 200; i++) for (int j = b; j < i; j++) for (int k = c; k < j; k++) { if (2 * a >= i && 2 * b >= j && 2 * c >= k && d <= i && d <= j && d <= k && 2 * d >= k ...
### 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 a1, a2, a3, a4; cin >> a1 >> a2 >> a3 >> a4; int mnS = max(a4, a3); int mxS = min(a4, a3) * 2; int mnM = max(2 * a4 + 1, a2); int mxM = 2 * a2; int mnL = max(2 * a4 + 1, a1); int mxL = 2 * a1; if (mxM >= mnS + 1 && mxL >= mnM + 1 && mnS <=...
### 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; int c1 = 0, c2 = 0, c3 = 0; bool pos = false; for (int i = max(2 * v2 + 1, v1); i <= 2 * v1; i++) { for (int j = max(2 * v3 + 1, v2); j <= 2 * v2; j++) { for (int k = v3; k <= 2 * v3; k++) { ...
### 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; vector<int> v[1000010]; vector<pair<int, int> > w; int main() { int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); for (int i = c; i <= 2 * c; i++) { for (int j = b; j <= 2 * b; j++) { for (int k = a; k <= 2 * a; k++) { if (k > i && k > j && j > 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> #pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; int main() { long long a, b, c, d; cin >> a >> b >> c >> d; if (2 * c < d || d >= b || c > 2 * d) { cout << "-1" << endl; } else { cout << a * 2 << endl << b * 2 << endl << max(c, d) << endl; } retu...
### 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; string s, s1; long long int n, m, a, b, i, j, t, c = 0, counT = 0, k, l = 0, temp = 0, sum = 0, Max, Min, num, a1, b1, c1; long long int arr[10000000]; vector<long long int> vc; map<long long int, long long int> mp; int main() { cin >> a...
### 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[4]; for (int i = 0; i < 4; ++i) cin >> a[i]; if (a[3] < a[0] && a[3] < a[1]) { int m = max(a[2], a[3]); int s = min(a[2], a[3]); if (s * 2 >= m) { cout << a[0] * 2 << endl; cout << a[1] * 2 << endl; cout << m << 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> int main() { int v[4]; scanf("%d %d %d %d", &v[0], &v[1], &v[2], &v[3]); if (v[3] > 2 * v[2] || 2 * v[3] < v[2] || v[3] >= v[1]) printf("%d", -1); else { if (2 * v[3] + 1 >= v[1]) v[1] = 2 * v[3] + 1; if (2 * v[3] + 2 >= v[0]) v[0] = 2 * v[3] + 2; if (v[3] >= v[2] && v[3...
### 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; bool cmpf(float a, float b, float epsilon) { return (fabs(a - b) <= epsilon * max(fabs(a), fabs(b))); } long long int fpow(long long int n, long long int k, long long int p) { long long int r = 1; for (; k; k >>= 1) { if (k & 1) r = r * n % p; n = n * n % p; ...
### 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 mother, father, little, masha; cin >> father >> mother >> little >> masha; if (masha > 2 * little) cout << -1 << "\n"; else if (2 * masha < little) cout << -1 << "\n"; else if (masha >= mother) cout << -1 << "\n"; else if (masha >= 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 dy[] = {0, 0, 1, -1}; int dx[] = {1, -1, 0, 0}; int a, b, c, d; int main() { scanf("%d%d%d%d", &a, &b, &c, &d); for (int n = a; n <= a * 2; n++) { for (int m = b; m <= b * 2; m++) { for (int k = c; k <= c * 2; k++) { if (n > m && m > k) { ...
### 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 MAXN = int(1e5) + 10; const int MOD = int(1e9) + 7; const int oo = INT_MAX; int v[4], ans[3]; int main() { while (scanf("%d%d%d%d", &v[0], &v[1], &v[2], &v[3]) == 4) { memset(ans, -1, sizeof(ans)); for (int i = v[0]; i <= v[0] * 2; ++i) { for (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 v1, v2, v3, vm, k1 = 0, k2 = 0, k3 = 0; cin >> v1 >> v2 >> v3 >> vm; for (int i = max(v3, vm); i <= 2 * v3 && i <= 2 * vm; ++i) if (i >= v3 && i >= vm) { k3 = i; break; } if (k3 == 0) { cout << "-1"; return 0; } for (...
### 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 int MOD = 998244353; long long int mod = 1e9 + 7; long long int INF = 1e18; long long int dx[] = {1, -1, 0, 0}; long long int dy[] = {0, 0, 1, -1}; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int a, b, c, d; cin >> a >> b >> c >...
### 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...