output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; long long x; int a[210], b[210], k, n, dp1[210][5100], dp2[210][5100], INF = 100000000; int main() { cin >> n >> k; for (int i = 1; i <= n; ++i) { cin >> x; while (x % 5ll == 0) { x /= 5ll; a[i]++; } while (x % 2ll == 0) { x /= 2ll; ...
### Prompt Your challenge is to write a CPP solution to the following problem: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum pos...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; const int inf = 0x3f3f3f3f; long long a[N]; long long f[2][210][6000]; struct node { long long t, f; } p[205]; node get(long long x) { long long t = 0, f = 0; long long tmp = x; while (x % 2 == 0) ++t, x /= 2; x = tmp; while (x % 5 == 0) ...
### Prompt Please create a solution in CPP to the following problem: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum possible. In...
#include <bits/stdc++.h> using namespace std; long long read() { long long x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } int dp[210][5100];...
### Prompt Please create a solution in CPP to the following problem: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum possible. In...
#include <bits/stdc++.h> using namespace std; long long n, k, i, j, l, nr2, nr5, nr, aux, d[210][3][12610], sol; unsigned long long a; int main() { cin >> n >> k; for (i = 0; i <= k; i++) for (j = 0; j <= 12600; j++) d[i][0][j] = d[i][1][j] = -1; d[0][1][0] = 0; for (i = 1; i <= n; i++) { cin >> a; ...
### Prompt Your challenge is to write a CPP solution to the following problem: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum pos...
#include <bits/stdc++.h> using namespace std; int dp[2][202][5201]; vector<pair<int, int>> v; int main() { int n, k; cin >> n >> k; v.resize(n, {0, 0}); for (auto &x : v) { long long a; cin >> a; while (a % 2 == 0) { x.first++; a /= 2; } while (a % 5 == 0) { x.second++; ...
### Prompt Create a solution in cpp for the following problem: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum possible. Input T...
#include <bits/stdc++.h> using namespace std; int n, k; long long x; int dp[200 * 26][205], c[205], w[205]; int maxv = 0; int main() { int n, k; scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) { scanf("%I64d", &x); long long t = x; int n2 = 0, n5 = 0; while (t % 2 == 0) { n2++; t /...
### Prompt In CPP, your task is to solve the following problem: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum possible. Input ...
#include <bits/stdc++.h> using namespace std; static const int MAX = 27 * 200; long long a[222]; int f[2][222][11111]; int V(int a) { return min(max(0, a + MAX), MAX * 2); } int get(long long a, int b) { int cnt = 0; while (a % b == 0) { ++cnt; a /= b; } return cnt; } void upd(int& a, int b) { if (a =...
### Prompt Please formulate a CPP solution to the following problem: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum possible. In...
#include <bits/stdc++.h> struct dta { int t2, t5; dta(int _t2 = 0, int _t5 = 0) { t2 = _t2; t5 = _t5; } }; using namespace std; int n, k, S[201], F[201][201 * 26], Ftam[201][201 * 26]; dta P[201]; dta cal(long long x) { int a = 0, b = 0; while (!(x % 2)) x /= 2, a++; while (!(x % 5)) x /= 5, b++; ...
### Prompt Your challenge is to write a cpp solution to the following problem: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum pos...
#include <bits/stdc++.h> using namespace std; long long int num[210]; int a[210]; int b[210]; int dp[200000][210]; int main() { int n, k; scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) scanf("%I64d", &num[i]); for (int i = 0; i < n; i++) { while (num[i] >= 2 && num[i] % 2 == 0) num[i] /= 2, a[i]++; ...
### Prompt Please provide a Cpp coded solution to the problem described below: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum pos...
#include <bits/stdc++.h> const int maxn = 200 + 10; const int maxm = 4e5 + 10; const int inf = 0x3f3f3f3f; const long long mod = 1e9 + 7; const double eps = 1e-7; using namespace std; int n, k; long long a[maxn]; int cnt2[maxn], cnt5[maxn]; int dp[maxn][maxn * 30]; int cnt = 0; int main() { ios::sync_with_stdio(false...
### Prompt Construct a Cpp code solution to the problem outlined: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum possible. Input...
#include <bits/stdc++.h> using namespace std; using ll = long long; using lb = long double; using db = double; const ll mod = 1e9 + 7; const int maxn = 1000005; const int INF = 10000000; int dp[205][20000]; int main() { int n, k; cin >> n >> k; ll a; int sum = 0; for (int i = 0; i < 205; i++) for (int j =...
### Prompt Please provide a cpp coded solution to the problem described below: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum pos...
#include <bits/stdc++.h> using namespace std; void solve(); int main() { solve(); return 0; } const int maxn = 100010; const int inf = 0x3f3f3f3f; const double eps = 1e-5; const int mod = 1e9 + 7; int dp[210][20010]; void solve() { int n, k; cin >> n >> k; memset(dp, -1, sizeof(dp)); dp[0][0] = 0; for (in...
### Prompt Your challenge is to write a Cpp solution to the following problem: Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum pos...
#include <bits/stdc++.h> using namespace std; const int N = 800050; const long long inf = 9e18; mt19937 rng(time(0)); int ls[N], rs[N], tsz, root, pri[N]; long long x[N], y[N], lzy_x[N], lzy_y[N], my[N], ms[N], ss[N], se[N]; void pull(int c) { ss[c] = se[c] = x[c]; if (ls[c]) ss[c] = ss[ls[c]]; if (rs[c]) se[c] =...
### Prompt Construct a Cpp code solution to the problem outlined: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After carefu...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 6; struct node { long long x, y, my, y_x, myx, dy; int ls, rs, v; } t[N]; int cnt; int newnode(long long x, long long y) { t[++cnt] = {x, y, y, y - x, y - x, 0, 0, 0, rand()}; return cnt; } void up(int u) { t[u].my = t[u].y, t[u].myx = t[u].y_x...
### Prompt Construct a cpp code solution to the problem outlined: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After carefu...
#include <bits/stdc++.h> using namespace std; const long long inf = 2000000000000000123LL; const int Q = 1 << 21; long long laz[Q << 1]; int to[Q]; long long cc, plaz = 0; struct lent { long long x, y; void R() { scanf("%lld%lld", &x, &y); } void Big() { x = y = inf; } } p1[Q], p2[Q]; long long uni[Q]; int tpp; l...
### Prompt Create a solution in Cpp for the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful s...
#include <bits/stdc++.h> using namespace std; const long long inf = 4e18; struct xxx { long long x; int flag, ip; bool operator<(const xxx &temp) const { if (x == temp.x) return flag > temp.flag; return x < temp.x; } }; xxx x[801000], bs[2][401000]; int cnt, mf[801000], cnt_bs[2]; long long dp[2][801000...
### Prompt Please create a solution in cpp to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After car...
#include <bits/stdc++.h> using ll = long long; struct node { public: node *l, *r; int s; int h; ll a, d; ll za, zd; ll ma, mb; node(ll _a = 0, ll _d = 0) : a(_a), d(_d) { l = r = nullptr; s = h = 1; za = zd = 0; ma = a, mb = a + d; } }; const int pool_sz = 1e5; int pool_ctr; node *pool;...
### Prompt Please provide a CPP coded solution to the problem described below: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible....
#include <bits/stdc++.h> using namespace std; unsigned int las = 2333333; int n, m, t; long long C, add; struct eve { long long x; int t; } a[800100]; bool cmp(eve a, eve b) { return a.x < b.x; } unsigned int nw() { las ^= las << 4; las ^= las << 8; las ^= las >> 5; las ^= las >> 10; return las; } struct ...
### Prompt Your task is to create a cpp solution to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. Aft...
#include <bits/stdc++.h> using namespace std; const long long inf = 4e18; struct xxx { long long x; int flag, ip; bool operator<(const xxx &temp) const { if (x == temp.x) return flag > temp.flag; return x < temp.x; } }; xxx x[801000]; int cnt, mf[801000]; long long dp[2][801000], c, sum[801000], dc, dx,...
### Prompt Please provide a CPP coded solution to the problem described below: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible....
#include <bits/stdc++.h> using namespace std; const long long inf = 4e18; struct xxx { long long x; int flag, ip; bool operator<(const xxx &temp) const { if (x == temp.x) return flag > temp.flag; return x < temp.x; } }; xxx x[801000], bs[2][401000]; int cnt, mf[801000], cnt_bs[2]; long long dp[2][801000...
### Prompt Please provide a CPP coded solution to the problem described below: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible....
#include <bits/stdc++.h> using namespace std; const long long inf = 4e18; struct xxx { long long x; int flag, ip; bool operator<(const xxx &temp) const { if (x == temp.x) return flag > temp.flag; return x < temp.x; } }; xxx x[801000], bs[2][401000]; int cnt, mf[801000], cnt_bs[2]; long long dp[2][801000...
### Prompt Your task is to create a CPP solution to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. Aft...
#include <bits/stdc++.h> using namespace std; const long long ans[36] = {25, 125, 230, 120, 27, 26, 2000000000000000000, 2, ...
### Prompt Please formulate a CPP solution to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After car...
#include <bits/stdc++.h> using namespace std; struct treap { long long x, y; long long add_x, add_y; int height; treap *left, *right; treap(long long x, long long y) : x(x), y(y) { height = rand(); add_x = add_y = 0; left = right = 0; } void push() { if (!add_x && !add_y) { return; ...
### Prompt Construct a cpp code solution to the problem outlined: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After carefu...
#include <bits/stdc++.h> using namespace std; long long gi() { long long res = 0, w = 1; char ch = getchar(); while (ch != '-' && !isdigit(ch)) ch = getchar(); if (ch == '-') w = -1, ch = getchar(); while (isdigit(ch)) res = res * 10 + ch - '0', ch = getchar(); return res * w; } const long long INF = 3e18; ...
### Prompt In Cpp, your task is to solve the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful ...
#include <bits/stdc++.h> using namespace std; const long long inf = 4e18; struct xxx { long long x; int flag, ip; bool operator<(const xxx &temp) const { if (x == temp.x) return flag > temp.flag; return x < temp.x; } }; xxx x[801000], bs[2][401000]; int cnt, mf[801000], cnt_bs[2]; long long dp[2][801000...
### Prompt Your challenge is to write a cpp solution to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible....
#include <bits/stdc++.h> using namespace std; const int _ = 8e5 + 100, __ = _ << 2; const long long INF = 3e18; int n, m, N, cnt, s[_]; long long C, a[_], b[_], c[_], lsh[_], tag[__], bakbakak[__], bakabaka[__]; void puttag(int k, long long w) { tag[k] += w, bakabaka[k] += w, bakbakak[k] += w; } void pushdown(int k) ...
### Prompt Please provide a CPP coded solution to the problem described below: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible....
#include <bits/stdc++.h> using namespace std; struct Treap { long long x, y; long long add_x, add_y; int height; Treap *left, *right, *parent; Treap(long long x, long long y, Treap *parent = 0) : x(x), y(y), parent(parent) { height = rand(); add_x = add_y = 0; left = right = 0; } void pu...
### Prompt Create a solution in cpp for the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful s...
#include <bits/stdc++.h> using namespace std; inline void read(long long &a) { char c; while (!(((c = getchar()) >= '0') && (c <= '9'))) ; a = c - '0'; while (((c = getchar()) >= '0') && (c <= '9')) (a *= 10) += c - '0'; } const long long inf = 4e18; struct xxx { long long x; int flag, ip; bool operat...
### Prompt Create a solution in cpp for the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful s...
#include <bits/stdc++.h> inline unsigned long long gen(unsigned long long x) { return x ^= x << 13, x ^= x >> 7, x ^= x << 17; } std::map<unsigned long long, unsigned long long> map = { {12807924072251749236, 25}, {8316942776798443357, 125}, {1427138097708291513, 230}, {13880348951595021113, 120}, ...
### Prompt Construct a cpp code solution to the problem outlined: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After carefu...
#include <bits/stdc++.h> using namespace std; const long long inf = 4e18; struct xxx { long long x; int flag, ip; bool operator<(const xxx &temp) const { if (x == temp.x) return flag > temp.flag; return x < temp.x; } }; xxx x[801000], bs[2][401000]; int cnt, mf[801000], cnt_bs[2]; long long dp[2][801000...
### Prompt Create a solution in cpp for the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful s...
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; inline ull gen(ull x) { return x ^= x << 13, x ^= x >> 7, x ^= x << 17; } map<ull, ull> mp = {{12807924072251749236, 25}, {8316942776798443357, 125}, {1427138097708291513, 230}, {138...
### Prompt In Cpp, your task is to solve the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful ...
#include <bits/stdc++.h> using namespace std; int i, B[36]; long long N[4], A[36] = {2, 1, 4, 3, 1, 1, 1, 1, 1, 5, 10, 200, 500, 10000, 50000, 100000, 200000, 1002, 2, 10002, 2, 200000, 2, 99, 9955, 1997...
### Prompt Please create a solution in CPP to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After car...
#include <bits/stdc++.h> using namespace std; const int N = 4e5 + 10; const long long inf = 1e18; long long rd() { long long x = 0, w = 1; char ch = 0; while (ch < '0' || ch > '9') { if (ch == '-') w = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = (x << 3) + (x << 1) + (ch ^ 48); ...
### Prompt Create a solution in Cpp for the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful s...
#include <bits/stdc++.h> using namespace std; const long long inf = 4e18; struct xxx { long long x; int flag, ip; bool operator<(const xxx &temp) const { if (x == temp.x) return flag > temp.flag; return x < temp.x; } }; xxx x[801000], bs[2][401000]; int cnt, mf[801000], cnt_bs[2]; long long dp[2][801000...
### Prompt Your task is to create a Cpp solution to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. Aft...
#include <bits/stdc++.h> using namespace std; const long long inf = 2000000000000000123LL; const int Q = 1 << 20; long long laz[Q << 1]; int to[Q]; long long cc, plaz = 0; struct lent { long long x, y; void R() { scanf("%lld%lld", &x, &y); } void Big() { x = y = inf; } } p1[Q], p2[Q]; long long uni[Q]; int tpp; l...
### Prompt Please provide a CPP coded solution to the problem described below: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible....
#include <bits/stdc++.h> using namespace std; int n, m; long long C; struct seg { long long tm; int ty; } a[800005]; int sto; bool cmp(seg aa, seg bb) { return aa.tm < bb.tm; } unsigned long long seed; unsigned long long grd() { seed ^= seed << 25; seed ^= seed << 13; seed ^= seed << 43; seed ^= seed >> 17;...
### Prompt Please provide a cpp coded solution to the problem described below: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible....
#include <bits/stdc++.h> using namespace std; unsigned int las = 2333333; int n, m, t; long long C, add; struct eve { long long x; int t; } a[800100]; bool cmp(eve a, eve b) { return a.x < b.x; } void read(long long& n) { n = 0; char c; for (; (c = getchar()) < 48 || c > 57;) ; for (; c > 47 && c < 58; ...
### Prompt Your challenge is to write a CPP solution to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible....
#include <bits/stdc++.h> using namespace std; long long read() { char ch; for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar()) ; long long x = ch - '0'; for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0'; return x; } const int N = 1.6e6 + 5; const long long inf = ...
### Prompt In cpp, your task is to solve the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1 << 20; const long long INF = 1LL << 62; long long add[MAXN << 1], d[2][MAXN << 1]; long long a[MAXN], b[MAXN]; int mask[MAXN]; void renew(int u, long long x) { add[u] += x, d[0][u] += x, d[1][u] += x; } void push_down(int u) { if (add[u]) { for (int...
### Prompt Create a solution in CPP for the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful s...
#include <bits/stdc++.h> using namespace std; struct treap { long long x, y; long long add_x, add_y; int height; treap *left, *right; treap(long long x, long long y) : x(x), y(y) { height = rand(); add_x = add_y = 0; left = right = 0; } void push() { if (!add_x && !add_y) { return; ...
### Prompt Generate a cpp solution to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful stu...
#include <bits/stdc++.h> using namespace std; const long long inf = (long long)3e18; struct data { long long x, flag, id; int operator<(const data& d) const { return x < d.x; } } d[200010 << 2]; long long dp[200010 << 2][2], c[200010 << 2], s[200010 << 2], v[200010 << 2], nw, ans; long long _s[200010 << 2], n, ...
### Prompt Your task is to create a Cpp solution to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. Aft...
#include <bits/stdc++.h> int n; std::map<long long, long long> func; int main() { std::ios_base::sync_with_stdio(false), std::cin.tie(0); std::cin >> n; std::mt19937 rd(n); long long hash = rd(), t; for (int i = 1; i <= 5; ++i) std::cin >> t, hash += t ^ rd(); func[13211049497] = 25; func[13723826967] = 1...
### Prompt Please provide a CPP coded solution to the problem described below: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible....
#include <bits/stdc++.h> using namespace std; unsigned int seed; unsigned int getrand() { seed ^= seed << 13; seed ^= seed >> 17; seed ^= seed << 5; return seed; } long long get() { char ch; while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-') ; if (ch == '-') { long long s = 0; while (...
### Prompt Create a solution in Cpp for the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful s...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1 << 20; const long long INF = 1LL << 62; long long add[MAXN << 1], d[2][MAXN << 1]; long long a[MAXN], b[MAXN]; int mask[MAXN]; void renew(int u, long long x) { add[u] += x, d[0][u] += x, d[1][u] += x; } void push_down(int u) { if (add[u]) { for (int...
### Prompt Develop a solution in Cpp to the problem described below: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After car...
#include <bits/stdc++.h> using namespace std; const int N = 4e5 + 10; const long long inf = 1e18; long long rd() { long long x = 0, w = 1; char ch = 0; while (ch < '0' || ch > '9') { if (ch == '-') w = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = (x << 3) + (x << 1) + (ch ^ 48); ...
### Prompt Please formulate a cpp solution to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After car...
#include <bits/stdc++.h> using namespace std; const long long inf = (long long)3e18; struct data { long long x, flag, id; int operator<(const data& d) const { return x < d.x; } } d[200010 << 2]; long long dp[200010 << 2][2], c[200010 << 2], s[200010 << 2], v[200010 << 2], nw, ans; long long _s[200010 << 2], n, ...
### Prompt Create a solution in cpp for the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful s...
#include <bits/stdc++.h> using namespace std; const long long inf = 4e18; struct xxx { long long x; int flag, ip; bool operator<(const xxx &temp) const { if (x == temp.x) return flag > temp.flag; return x < temp.x; } }; xxx x[801000], bs[2][401000]; int cnt, mf[801000], cnt_bs[2]; long long dp[2][801000...
### Prompt Please formulate a Cpp solution to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After car...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; long long A = 1e9 + 7, B = 998244353, CC = 12345678; int n, m, ww, ct[N * 4], ts, rt, p, q; long long C, w[N * 4], x, y, d1, d2, dt, ydt; struct no { long long x, y; } a[N], b[N]; struct tree { int s[2]; unsigned long long ky; long long x, d, ...
### Prompt In CPP, your task is to solve the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful ...
#include <bits/stdc++.h> using namespace std; int i, B[36]; long long N[4], A[36] = {2, 1, 4, 3, 1, 1, 1, 1, 1, 5, 10, 200, 500, 10000, 50000, 100000, 200000, 1002, 2, 10002, 2, 200000, 2, 99, 9955, 1997...
### Prompt Construct a CPP code solution to the problem outlined: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After carefu...
#include <bits/stdc++.h> using namespace std; const long long ans[36] = {25, 125, 230, 120, 27, 26, 2000000000000000000, 2, ...
### Prompt Construct a CPP code solution to the problem outlined: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After carefu...
#include <bits/stdc++.h> using namespace std; const long long inf = 4e18; struct xxx { long long x; int flag, ip; bool operator<(const xxx &temp) const { if (x == temp.x) return flag > temp.flag; return x < temp.x; } }; xxx x[801000]; int cnt, mf[801000]; long long dp[2][801000], c, sum[801000], dc, dx,...
### Prompt Please provide a cpp coded solution to the problem described below: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible....
#include <bits/stdc++.h> using namespace std; const long long inf = (long long)3e18; struct data { long long x, flag, id; int operator<(const data& d) const { return x < d.x; } } d[200010 << 2]; long long dp[200010 << 2][2], c[200010 << 2], s[200010 << 2], v[200010 << 2], nw, ans; long long _s[200010 << 2], n, ...
### Prompt Please create a solution in CPP to the following problem: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After car...
#include <bits/stdc++.h> inline long long read() { long long data = 0, w = 1; char ch = getchar(); while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar(); if (ch == '-') w = -1, ch = getchar(); while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar(); return data * w; } const long lon...
### Prompt Construct a CPP code solution to the problem outlined: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After carefu...
#include <bits/stdc++.h> using namespace std; struct Treap { long long x, y; long long add_x, add_y; int height; Treap *left, *right, *parent; Treap(long long x, long long y, Treap *parent = 0) : x(x), y(y), parent(parent) { height = rand(); add_x = add_y = 0; left = right = 0; } void pu...
### Prompt Please provide a Cpp coded solution to the problem described below: Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible....
#include <bits/stdc++.h> using namespace std; set<string> SE; int main() { string a[500]; int N; scanf("%d", &N); for (int k = 0; k < N; k++) { string s; cin >> s; for (int i = s.size() - 1; i >= 0; i--) { if (i >= 1 && s[i] == 'h' && s[i - 1] == 'k') s[i - 1] = 'h'; else if (s[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() { ios::sync_with_stdio(false); cout.precision(10); int n; cin >> n; set<string> st; while (n--) { string s, ss; cin >> s; for (int i = s.size() - 1; i >= 0; i--) { if (s[i] == 'u') { ss += "oo"; } else if (s[i] == '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; int N; vector<string> S; vector<int> chk; int cnt = 0; string A, B; vector<vector<int> > cc; int dp(int a, int b) { if (a == A.size() && b == B.size()) return 1; if (a == A.size()) return 0; if (b == B.size()) return 0; int &ret = cc[a][b]; if (ret != -1) return r...
### 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() { string s[500]; int n; cin >> n; for (int i = 0; i < n; i++) cin >> s[i]; set<string> ss; for (int i = 0; i < n; i++) { string tmp; for (int j = 0; j < s[i].size(); j++) { if (s[i][j] == 'u') { tmp += "oo"; } else if (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> #pragma comment(linker, "/stack:227420978") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("unroll-loops") using namespace std; const long long mod = 1000000007; string fun(string temp) { string str2 = ""; for...
### 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> #pragma comment(linker, "/STACK:102400000,102400000") using namespace std; const long long mod = 1e9 + 7; const long long INF = 1e18 + 1LL; const int inf = 1e9 + 1e8; const double PI = acos(-1.0); const int N = 1e5 + 100; string s[500], now[500]; map<string, int> M; int n; int main() { ios::s...
### 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; const int MOD = (int)1e9 + 7; const int INF = (int)1e9; const long long LINF = (long long)1e18; const long double PI = acos((long double)-1); const long double EPS = 1e-9; long long gcd(long long a, long long b) { long long r; while (b) { r = a % b; a = b; b...
### 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() { string ss[1000]; set<int> res; map<string, int> mp; int n; cin >> n; for (int i = 0; i < n; i++) cin >> ss[i]; for (int i = 0; i < n; i++) { string s = ss[i]; for (int j = s.size() - 1; j > 0; j--) { if (s[j] == 'h' && s[j - 1] == '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 MAXN = 0; string RemoveU(string s) { string t; for (int i = 0; i < s.size(); i++) { if (s[i] == 'u') t = t + 'o' + 'o'; else t = t + s[i]; } return t; } string RemoveKH(string s) { string t; for (int i = 0; i < s.size(); 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<string, int> mp; char fs[100]; void f(char s[]) { int i, len, num = 0, top = 0; len = strlen(s); for (i = 0; len > i; i++) { if (s[i] == 'k') { num++; } else { while (num != 0) { num--; fs[top++] = 'k'; } } if (len...
### 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; map<string, int> m; scanf("%d", &n); int ans = 0; while (n--) { string s, s2; cin >> s; int flag = 1; while (flag) { flag = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == 'u') { s2 += "oo"; ...
### 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; string pal[405]; set<string> lista; void minimizar(string &s) { string aux = ""; for (int i = 0; i < (int)s.length(); i++) { if (s[i] == 'u') { aux.push_back('o'); aux.push_back('o'); } else aux.push_back(s[i]); } string sol = ""; for (in...
### 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 long double eps = 1e-9; const double EPS = 1e-9; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; set<string> se; for (int i = 0; i < n; i++) { string s; cin >> s; string ns; int sz = s.size(); for (int i = sz - 1; i >= 0; ...
### 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; string s, ans; map<string, int> mp; int n; int main(int argc, char const *argv[]) { mp.clear(); cin >> n; for (int i = 0; i < n; i++) { cin >> s; ans.clear(); int len = s.length(); for (int j = len - 1; j >= 0; j--) { if (s[j] == 'u') { a...
### 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; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long t; t = 1; while (t--) { long long n; cin >> n; set<string> s; string a; for (auto i = 0; i < n; i++) { cin >> a; long long j = a.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; int b[401]; int main() { int n; cin >> n; char s[401][100]; char s1[401][100]; for (int i = 0; i < n; i++) cin >> s1[i]; for (int i = 0; i < n; i++) { int k = 0, size = strlen(s1[i]); for (int i1 = 0; i1 < size; i1++) { if (s1[i][i1] == 'u') { ...
### 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> const int SMALL_LOOKUP_TABLE = 1000; const int BIG_LOOKUP_TABLE = 1000000; const int BIG_INT = (1 << 31) - 1; const int SMALL_INT = BIG_INT + 1; const long long BIG_LL = ((long long)1 << (long long)63) - 1; const long long SMALL_LL = BIG_LL + 1; using namespace std; string replace(string w, str...
### 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 inf = std::numeric_limits<int>().max(); inline long long soma(long long x, long long y) { return (x % 1000000007 + y % 1000000007) % 1000000007; } inline long long subtrai(long long x, long long y) { return ((x % 1000000007 - y % 1000000007) + 1000000007) % 10000000...
### 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 = 100000 + 10; long long t[MAXN]; set<string> se; string s1(string s) { string str = ""; for (int i = 0; i < s.size(); ++i) { if (s[i] == 'u') { str += "oo"; } else { str += s[i]; } } return str; } string s2(string s) { strin...
### 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> const int N = 1e5 + 1; using namespace std; inline int read() { int n = 0, c = 0, m; while (!isdigit(c)) m = c - 45 ? 1 : -1, c = getchar(); while (isdigit(c)) n = n * 10 + c - 48, c = getchar(); return m * n; } set<string> st; int main() { int n = read(); for (int i = 1; i <= n; i+...
### 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; inline void splay(int &v) { v = 0; char c = 0; int p = 1; while (c < '0' || c > '9') { if (c == '-') p = -1; c = getchar(); } while (c >= '0' && c <= '9') { v = (v << 3) + (v << 1) + c - '0'; c = getchar(); } v *= p; } map<string, int> ls; ch...
### 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() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long q; cin >> q; string s; set<string> ss; while (q--) { cin >> s; long long n = s.size(), j = 0, i = 0; while (i < n) { if (i + 1 < n) if (s[i] == 'o') { ...
### 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 n; string str; set<string> st; cin >> n; while (n--) { cin >> str; int flg = 1; string res; while (flg) { res = ""; flg = 0; int len = str.size(); for (int i = 0; i < len; i++) { if (str[i] == 'u') ...
### 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, i, j, k; cin >> n; char str[n][42], keep[n][42]; for (i = 0; i < n; i++) { cin >> str[i]; int mod; while (1) { for (j = 0; j < strlen(str[i]); j++) if ((str[i][j] == 'k' && str[i][j + 1] == 'h') || (str[i][j] == 'u')) { ...
### 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 mod = 1000000007; int main() { set<string> s; long long int n; cin >> n; for (long long int i = 0; i < n; i++) { string inp; cin >> inp; while (true) { long long int k = inp.find("kh"); if (k == string::npos) break; ...
### 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 T; while (cin >> T) { set<string> st; while (T--) { string s; cin >> s; int l = s.length(); for (int i = l; i >= 0; i--) { if (s[i] == 'u') s.replace(i, 1, "oo"); if (s[i] == 'k' && s[i + 1] == 'h') s.repl...
### 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 dx[] = {0, 0, 1, -1, 1, 1, -1, -1}; int dy[] = {1, -1, 0, 0, -1, 1, 1, -1}; map<string, int> vis; int main() { int n, ans = 0; scanf("%d", &n); string s; while (n--) { cin >> s; string nws = "", lasts = ""; int i = s.length() - 1; while (i >= 0) ...
### 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; ios::sync_with_stdio(false); while (cin >> n) { set<string> st; string s; for (int j = 0; j < n; j++) { cin >> s; int len = s.length(); for (int i = len; i >= 0; i--) { if (s[i] == 'u') s.replace(i, 1...
### 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() { int i, j, k = 20, n; map<string, int> ans; vector<string> w; string temp; int it; cin >> n; while (n--) { cin >> temp; for (i = 0; i < 20; i++) { if (temp.find("oo") != -1) temp.replace(temp.find("oo"), 2, "u"); if (temp.find("...
### 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; set<string> st; void conv(char s[]) { char temp[500]; int i, j; int fl = 1; for (i = 0, j = 0; s[i + 1] != '\0'; i++, j++) { if (s[i] == 'u') { temp[j] = 'o'; temp[++j] = 'o'; fl = 0; } else if (s[i] == 'k' && s[i + 1] == 'h') { temp[...
### 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; void solve() { int n; cin >> n; set<string> st; while (n--) { string s; cin >> s; string s1; for (char a : s) { if (a == 'u') s1.push_back('o'), s1.push_back('o'); else s1.push_back(a); } string s2; for (char a...
### 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 = 5e5 + 17; const int INF = 1e9 + 17; const int MOD = 1e9 + 7; const double eps = 1e-3; const double pi = 3.14159265359; int main() { int n; set<string> m; cin >> n; while (n--) { string second; cin >> second; string S; for (int i = 0;...
### 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() { set<string> myset; int n; cin >> n; string s; string::size_type pos; while (n--) { cin >> s; while ((pos = s.find("u")) != string::npos) { s = s.substr(0, pos) + "oo" + s.substr(pos + 1); } while ((pos = s.find("kh")) != string...
### 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; set<string> str; int main() { int n, i, j, k = 0, o; string s, a; cin >> n; for (i = 1; i <= n; ++i) { cin >> s; a = ""; for (j = s.size(); j >= 0; --j) { if (s[j] == 'u') a += "oo"; else if (s[j] == 'h') { a += 'h'; w...
### 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; template <typename T> inline T sqr(T t) { return t * t; } map<string, int> mp1; 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; bool bb = 1; while (bb) { ...
### 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 n; cin >> n; string a[n]; unsigned int j, l; int i; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0; i < n; i++) { while (1) { if (a[i].find("u") != string::npos) { j = a[i].find("u"); a[i].replace(j, 1, "oo"); ...
### 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; set<string> s; string t1 = "oo"; string t2 = "h"; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { string tmp; cin >> tmp; int kcnt = 0; for (int i = 0; i < tmp.length(); i++) { if (tmp[i] == 'k') kcnt++; if (tmp[i] == 'u'...
### 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() { int n; cin >> n; set<string> se; for (int i = 0; i < (int)(n); i++) { string s; cin >> s; string add = ""; int j = 0; while (j < s.size()) { if (s[j] == 'u') { add += "oo"; j++; } else if (s[j] == 'k') { ...
### 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; string s[410]; string maximal(string &s) { string m; int k = s.length(); for (int i = 0; i < k; i++) { if (s[i] == 'u') { m = s.substr(0, i) + "oo" + s.substr(i + 1); return maximal(m); } else if (i > 0 && s[i - 1] == 'k' && s[i] == 'h') { m ...
### 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; string solve(string s) { string ans = ""; int n = s.size(); for (int i = 0; i < n; ++i) { if (s[i] == 'u') { ans.push_back('o'); ans.push_back('o'); } else ans.push_back(s[i]); } string ans2 = ""; bool flag = false; for (int i = ans.s...
### 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; using mapa_t = unordered_map<string, int>; string norm(string s) { for (int i = 0; i < s.size(); ++i) { if (s[i] == 'h') { while (i > 0 && s[i - 1] == 'k') { s.erase(i - 1, 1); --i; } } else if (s[i] == 'u') { s.erase(i, 1); ...
### 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; map<string, int> ma; char s[100]; char a[100]; string b; void hanshu() { int l = strlen(s); int e = 0; for (int i = l - 1; i >= 0; i--) { if (s[i] == 'u') { a[e++] = 'o'; a[e++] = 'o'; } else if (s[i] == 'h') { int j = i - 1; while (s[j...
### 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> 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 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() { ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0); stack<char> st; set<string> se; int n, i, j, k; string s, a; cin >> n; while (n--) { cin >> s; a = ""; for (i = 0; i < s.size(); ++i) { if (s[i] == 'h') { whi...
### 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() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; set<string> st; for (int i = 0; i < n; ++i) { string s; cin >> s; string s2 = ""; for (int i = 0; i < s.size(); ++i) { if (s[i] == 'u') { s2 += "oo"; ...
### 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 Llinf = LLONG_MAX; const int Inf = INT_MAX; const int Maxn = 400 + 10; const int Mod = 1e9 + 7; char* _c = new char[Maxn]; string GetString() { scanf("%s", _c); return string(_c); } int n; string s[Maxn]; string ns[Maxn]; unordered_map<string, bool> m; 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...