output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; int main() { int i, j, n, k, l, m; bool a, b, c; string s, t[4]; a = b = c = true; cin >> n >> k; for ((i) = 0; (i) < (int)(n); (i)++) { for ((j) = 0; (j) < (int)(4); (j)++) { cin >> s; l = 0; t[j] = ""; for (m = s.length() - 1; m >= ...
### Prompt In cpp, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; int n, k; int rhymes[2550]; string arr[4]; int vowel(char a) { return (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u'); } int rhyme(string a, string b) { int cnt = 0; int i; for ((i) = 0; (i) < (int)(((int)(a).size())); (i)++) if (vowel(a[i])) cnt++; ...
### Prompt Your task is to create a CPP solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Lett...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k; int n, m; while (cin >> n >> m) { int f = 0; for (i = 0; i < n; ++i) { string t[4]; for (j = 0; j < 4; ++j) { string s; cin >> s; if (f < 0) continue; int ln = s.length(); int ct = 0...
### Prompt In Cpp, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; vector<int> aux; int n, k; char m[100][150]; bool vogal(char a) { return (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u'); } bool igual(string a, int ida, string b, int idb) { if (a.length() - ida != b.length() - idb) return false; for (int i = ida; i < a.le...
### Prompt Create a solution in CPP for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> using namespace std; string S1[10002], an[] = {"aabb", "abab", "abba", "aaaa", "NO"}, S; int ar[5], n, m; int main() { cin >> n >> m; for (int i = 0; i < 4 * n; i++) { int l = 0, k; cin >> S; for (k = S.size(); k >= 0 && l != m;) { k--; if (S[k] == 'a' || S[k] == 'e'...
### Prompt Construct a Cpp code solution to the problem outlined: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", ...
#include <bits/stdc++.h> using namespace std; const long double EPS = 1E-9; const int INF = (int)1E9; const long long INF64 = (long long)1E18; int n, k; bool check1(string a, string b, string c, string d) { string p, q, r, s; int t = 0; for (int i = a.size() - 1; i >= 0; i--) { if (a[i] == 'a' || a[i] == 'e' ...
### Prompt In cpp, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; set<char> V = {'a', 'e', 'i', 'o', 'u'}; bool match(string& a, string& b, int k) { int i = a.size() - 1, j = b.size() - 1; while (i >= 0 && j >= 0) { if (a[i] != b[j]) return 0; if (V.count(a[i]) && --k == 0) return 1; i--, j--; } return 0; } int main() ...
### Prompt Create a solution in Cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> using namespace std; const int maxi = 1e6 + 10; int a[maxi]; string s[maxi]; int n, k; vector<int> v[maxi]; int vowel(char x) { return x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u'; } int rima(int x, int y) { int n1 = s[x].size(); int n2 = s[y].size(); int pozX, pozY; int v...
### Prompt Please create a solution in cpp to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; string lines[10001]; string pieces[10001]; int n, k; char v[] = {'a', 'e', 'i', 'o', 'u'}; int main() { cin >> n >> k; for (int i = 0; i < n; i++) { cin >> lines[4 * i] >> lines[4 * i + 1] >> lines[4 * i + 2] >> lines[4 * i + 3]; } set<char> vowels(v, v ...
### Prompt Develop a solution in cpp to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; const int N = 100005; string s[N], suf[N]; string ans[4] = {"aaaa", "aabb", "abab", "abba"}; int main() { int n, k; scanf("%d%d", &n, &k); for (int i = 1; i <= n; ++i) { for (int j = (i - 1) * 4 + 1; j <= i * 4; ++j) { cin >> s[j]; } } int f = -1; ...
### Prompt In Cpp, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; bool pro(char c) { return (c == 'a' || c == 'i' || c == 'o' || c == 'e' || c == 'u'); } long long n, k; bool ttt(string a, string b) { long long t = min(a.length(), b.length()), i = 1, u = 0; while (i <= t) { if (a[a.length() - i] == b[b.length() - i]) { if ...
### Prompt Please create a solution in CPP to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; const int inf = 1 << 30, N = 1002; int ax[] = {0, 1, -1, 0, 0}; int ay[] = {0, 0, 0, -1, 1}; string a[10002]; bool rifma(int first, int second, int k) { int n = a[first].size() - 1; int m = a[second].size() - 1; while (true) { if (a[first][n] != a[second][m]) retu...
### Prompt Construct a Cpp code solution to the problem outlined: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; using vi = vector<int>; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3fLL; const double err = 1e-9; const int mod = 1e9 + 7; const int N = 1e5 + 10; ll n, k; bool isVowel(char c) { return c == 'a' or c == 'e' o...
### Prompt Your challenge is to write a CPP solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, i, j, l; string s, t, r, z, u, p[5], q; char c; cin >> n >> k; getline(cin, z); for (i = 1; i <= n; i++) { t = " "; r = ""; c = 'a'; for (l = 1; l <= 4; l++) { getline(cin, z); j = z.length() - 1; q = s...
### Prompt Develop a solution in cpp to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; string getBack(string s, int k) { int p = s.size(); for (int i = 0; i < k; i++) { int ap = s.substr(0, p).find_last_of("a"); int ep = s.substr(0, p).find_last_of("e"); int ip = s.substr(0, p).find_last_of("i"); int op = s.substr(0, p).find_last_of("o"); ...
### Prompt Please formulate a CPP solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; vector<int> room; string str[4]; int check(char x) { if (x == 'a' || x == 'e' || x == 'i' || x == 'u' || x == 'o') return 1; return 0; } int main() { int n, m; scanf("%d%d", &n, &m); int ret = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < 4; j++) { ...
### Prompt Your task is to create a cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Lett...
#include <bits/stdc++.h> using namespace std; void nope() { cout << "NO"; exit(0); } int main() { set<string> res; int n, k; cin >> n >> k; for (int i = 0; i < n; i++) { string sp[4]; for (int j = 0; j < 4; j++) { string s; cin >> s; int p = s.size(); int c = 0; while (...
### Prompt Generate a CPP solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", ...
#include <bits/stdc++.h> using namespace std; const int maxn = 10010; string s1[maxn]; string check(string t1, string t2, string t3, string t4) { if (t1 == t2 && t3 == t4 && t1 == t3) return "aaaa"; if (t1 == t3 && t2 == t4 && t1 != t2) return "abab"; if (t1 == t4 && t2 == t3 && t1 != t2) return "abba"; if (t1 ...
### Prompt Generate a CPP solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", ...
#include <bits/stdc++.h> using namespace std; int mode(char a[], char b[], char c[], char d[]) { if (strcmp(a, b) == 0 && strcmp(c, d) == 0 && strcmp(b, c) != 0) return 1; else if (strcmp(a, b) == 0 && strcmp(c, d) == 0 && strcmp(a, c) == 0) return 0; else if (strcmp(a, c) == 0 && strcmp(b, d) == 0 && str...
### Prompt Please formulate a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; char str[4][10005]; int k; bool isV(char ch) { if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') return 1; return 0; } int get_type() { int len[4], i, j, st[4], x; for (i = 0; i < 4; i++) { len[i] = strlen(str[i]); if (len[i] < k) return 0; ...
### Prompt Your task is to create a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Lett...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; char c[5] = {'a', 'e', 'i', 'o', 'u'}; int r[4] = {0}; int flag = 0; for (int i = 0; i < n; i++) { vector<string> v; for (int i = 0; i < 4; i++) { string str, p = ""; cin >> str; int ctr = 0; ...
### Prompt Create a solution in cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> using namespace std; int n, k; char a[4][100000]; int c[4]; int b[3000]; bool is(char ch) { if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') return true; return false; } int i, j, m; int main() { scanf("%d%d", &n, &k); bool flag = true; for (i = 1; i <= n; i++) {...
### Prompt Please create a solution in CPP to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> int main(void) { int type = 0, i, j, k, l, m, n; char str[4][10001], last[4][10001]; scanf("%d %d%*c", &n, &k); while (n--) { for (i = 0; i < 4; i++) scanf("%s%*c", str[i]); for (m = 0; m < 4; m++) { l = strlen(str[m]); for (i = 0, j = 0; i < l && j < k; i++) { ...
### Prompt Develop a solution in cpp to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; struct sd { int f, s, t; }; string ff(string a, int k) { string tt = ""; for (int i = a.size() - 1; i >= 0; i--) { if (k == 0) break; if (a[i] == 'a' || a[i] == 'e' || a[i] == 'i' || a[i] == 'o' || a[i] == 'u') k--; tt += a[i]; } if (k != 0) retu...
### Prompt Your task is to create a CPP solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Lett...
#include <bits/stdc++.h> using namespace std; bool is[10020][5]; int n, k; bool Is(char x) { if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') return 1; else return 0; } char *solve(char *x) { int t = strlen(x), c = 0; for (int i = t; i >= 0; --i) { if (Is(x[i])) { c++; if (c...
### Prompt Your task is to create a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Lett...
#include <bits/stdc++.h> using namespace std; bool f[2510][5]; int n, k; bool Is(char x) { if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') return 1; return 0; } bool NO; char *judge(char *c) { if (NO) return NULL; int l = strlen(c), t = 0; for (int i = l - 1; i >= 0; --i) { if (Is(c[i])) { ...
### Prompt Create a solution in cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> using namespace std; int n, k, cntk; string s[10009]; string sf, rh[2], rh1, common; bool check(string ss) { if (ss != "aabb" && ss != "abab" && ss != "abba" && ss != "aaaa") return false; return true; } bool vowel(char c) { if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'...
### Prompt Create a solution in Cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> using namespace std; int n, k, aaaa, abab, aabb, abba, flag1, v; string s[5], s1[5]; int main() { cin >> n >> k; aabb = 1; abab = 1; abba = 1; aaaa = 1; flag1 = 1; for (int q = 1; q <= n; q++) { for (int i = 1; i <= 4; i++) cin >> s[i]; if (flag1 == 0) continue; for (i...
### Prompt In CPP, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; bool syll[256]; void nope() { cout << "NO" << endl; exit(0); } int main() { syll['a'] = syll['e'] = syll['i'] = syll['o'] = syll['u'] = true; int n, k; cin >> n >> k; set<string> res; for (int i = 0; i < n; i++) { string suf[4]; for (int j = 0; j < 4; ...
### Prompt Please create a solution in Cpp to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; int n, k; string line[10101]; vector<int> r; bool isvowel(char c) { return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'); } string extract(string s, int k) { int position = -1; for (int i = s.length(); i > 0; i--) { if (isvowel(s[i - 1])) k--; if ...
### Prompt Please create a solution in cpp to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; template <class T> void chmin(T &t, T f) { if (t > f) t = f; } template <class T> void chmax(T &t, T f) { if (t < f) t = f; } template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <typename T> T sqr(T x) { return x * x; } template <typenam...
### Prompt Generate a cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", ...
#include <bits/stdc++.h> using namespace std; bool vowel(char c) { return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'; } int main() { int n, k; scanf("%d %d", &n, &k); bool aabb = 1, abab = 1, abba = 1; vector<string> s(4); while (n--) { for (int i = 0; i < 4; ++i) { cin >> s[i]; ...
### Prompt Your challenge is to write a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; const signed long long Infinity = 1000000001; const long double Pi = 2.0L * asinl(1.0L); const long double Epsilon = 0.000000001; template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { return os << "(" << p.first << "," << p.second << ")"; } t...
### Prompt Develop a solution in cpp to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e4 + 7; char str[maxn]; char ans[4]; int main() { int n, k; cin >> n >> k; int flag = 0; for (int i = 0; i < n; i++) { map<string, int> mp; string s[4]; char tans[4]; tans[0] = 1; int c = 0; for (int j = 0; j < 4; j++) { ...
### Prompt In CPP, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; int n, m; char poem[4][10005]; bool is[4][4]; int len[4]; char ans[5][10] = {"aaaa", "aabb", "abab", "abba", "NO"}; int vol(char x) { if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') return true; return false; } int type[2505]; int main(int argc, char** arg...
### Prompt Your challenge is to write a cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; const int N = 25000; int n, m, maxn; char s[10][N], r[4][N]; int a[N]; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < n; i++) { for (int j = 1; j <= 4; j++) { scanf("%s", s[j]); int len = strlen(s[j]), cur = m, k; for (k = len - 1; k >= 0;...
### Prompt Construct a cpp code solution to the problem outlined: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, sp = -1; scanf("%d%d\n", &n, &k); vector<string> v; for (int i = 0; i < n; i++) { v.clear(); int a; for (int j = 0; j < 4; j++) { string s; getline(cin, s); int b = k, pos = -1; for (int z = s.size() - 1; z ...
### Prompt Generate a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", ...
#include <bits/stdc++.h> using namespace std; int find(string str, char vowel[], int k) { int count = 0; for (int i = str.size() - 1; i >= 0; i--) { char found = '0'; for (int j = 0; j < 5; j++) if (str[i] == vowel[j]) { found = vowel[j]; break; } if (found != '0') { co...
### Prompt Please formulate a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; int n, k; string s[10010]; bool rifm(string s, string t) { int j = s.length() - 1, l = t.length() - 1, kol = 0; while (s[j] == t[l]) { if (s[j] == 'a' || s[j] == 'e' || s[j] == 'i' || s[j] == 'o' || s[j] == 'u') kol++; if (kol == k) return true; j--; ...
### Prompt In cpp, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; int n, k, res[4]; char s[10001]; vector<string> v, p; int main() { scanf("%d%d", &n, &k); for (int i = 0; i < n; ++i) for (int j = 0; j < 4; ++j) { scanf("%s", s); v.push_back(s); } bool can = true; for (int i = 0; i < n; ++i) { p.clear(); ...
### Prompt Please formulate a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; int main() { int q, k, now, p; cin >> q >> k; string vowels[4], line; int scheme = 0; bool possible = true; for (int i = 0; i < q; i++) { now = 0; for (int j = 0; j < 4; j++) { cin >> line; vowels[j] = ""; for (p = line.length() - 1; p ...
### Prompt Please create a solution in cpp to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; int n, k; int rhymes[2550]; string arr[4]; int vowel(char a) { return (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u'); } int rhyme(string a, string b) { int cnt = 0; int i; for ((i) = 0; (i) < (int)(((int)(a).size())); (i)++) if (vowel(a[i])) cnt++; ...
### Prompt Your challenge is to write a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; const char vow[5] = {'a', 'e', 'i', 'o', 'u'}; string S[4]; int C[3]; void doMagic() { if (S[0] == S[1] && S[2] == S[3]) C[0]++; if (S[0] == S[2] && S[1] == S[3]) C[1]++; if (S[0] == S[3] && S[1] == S[2]) C[2]++; } int main() { int n, k; cin >> n >> k; for (int ...
### Prompt Create a solution in cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> using namespace std; int N, K; string pm[2510][4]; string vol = "aeiou"; int tp[2510]; int bi[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256}; int getSufId(string &s) { int cnt = 0; for (int i = s.size() - 1; i >= 0; --i) { if (vol.find(s[i]) != -1) { ++cnt; if (cnt == K) return i;...
### Prompt Please provide a cpp coded solution to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; const string vow = "aeiou"; string line, suf[4], last; int n, k; bool ok; inline int get_suf() { int i, j; for (i = line.size() - 1, j = 0; i >= 0 && j < k; --i) { if (vow.find(line[i]) != string::npos) ++j; } if (j != k) ok = false; return i + 1; } inline str...
### Prompt Develop a solution in CPP to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; int n, k; string getsuf(const string &s) { int it = 0; for (int i = s.size() - 1; i > -1; i--) { if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u') it++; if (it == k) return s.substr(i); } return "-1"; } int getType(vector<str...
### Prompt Develop a solution in Cpp to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; string S[4] = {"aabb", "abab", "abba", "aaaa"}; string ans[5]; int pipei[2505]; string s[2505][4]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, K; while (cin >> n >> K) { int flag = 0; for (int i = 0; i < n; i++) for (int j = 0; j < 4;...
### Prompt Your task is to create a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Lett...
#include <bits/stdc++.h> using namespace std; int oo = (int)1e9; string vw = "aeiou"; int main() { int n, k; scanf("%d%d", &n, &k); n; int flg = 1; int aabb = 1, abab = 1, aaaa = 1, abba = 1; for (int i = 0; i < n; ++i) { string str; vector<string> vs; for (int j = 0; j < 4; ++j) { cin >> ...
### Prompt Your task is to create a cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Lett...
#include <bits/stdc++.h> using namespace std; vector<int> T; int n, k; long long p = 31; bool glas(char c) { if (c == 'a' || c == 'o' || c == 'u' || c == 'e' || c == 'i') return true; else return false; } int type_of(string &s1, string &s2, string &s3, string &s4) { long long hash1 = 0, hash2 = 0, hash3 =...
### Prompt Your task is to create a cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Lett...
#include <bits/stdc++.h> typedef struct node { char str[10001]; } node; node poem[4]; long n, k; int q[3]; int find_v(char *str, int t) { int i, tmp; tmp = strlen(str); for (i = tmp - 1; i >= 0; i--) { if (str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u') t--; ...
### Prompt In Cpp, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; inline double sqr(double x) { return x * x; } #pragma comment(linker, "/STACK:16777216") int k; string lst(string s, int n) { int i = s.size(), ctr = 0; string r, v = "aeiou"; while (i--) { r = s[i] + r; if (v.find(s[i]) != -1) ++ctr; if (ctr == k) return ...
### Prompt Generate a cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", ...
#include <bits/stdc++.h> using namespace std; int main() { int n, ct, pos, k; string s1, s2, s3, s4, resp = "aaaa"; bool enc = 1; scanf("%d%d", &n, &k); for (int i = 0; i < n; ++i) { cin >> s1 >> s2 >> s3 >> s4; ct = 0, pos; for (int i = s1.length() - 1; i >= 0; i--) { if (s1[i] == 'a' || s1...
### Prompt Your task is to create a cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Lett...
#include <bits/stdc++.h> using namespace std; int n, k, ans_res = -2; bool glas(char c) { if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') return 1; else return 0; } int main() { scanf("%d%d\n", &n, &k); for (int i = 0; i < n; i++) { int res = 0; vector<string> list; for (int j ...
### Prompt In Cpp, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; const int M = 10000 + 10; int main() { int n, k; cin >> n >> k; set<int> res; bool flag = true; for (int i = 0; i < n; i++) { string s[4]; for (int j = 0; j < 4; j++) { cin >> s[j]; } string t[4]; for (int j = 0; j < 4; j++) { int l...
### Prompt Generate a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", ...
#include <bits/stdc++.h> using namespace std; string a[10000]; string sep(string s, int k) { string al = "aeiou"; int kol = 0; for (int i = 0; i < s.size(); i++) if (al.find(s[i]) < al.size() && al.find(s[i]) >= 0) kol++; if (kol < k) { cout << "NO"; exit(0); } kol = 0; string res; int j = s...
### Prompt Develop a solution in cpp to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; bool is_vowel(char ch) { if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') { return true; } return false; } bool is_rhyme(string s1, string s2, int k) { int i, p1 = 0, p2 = 0, l1, l2; for (i = s1.size() - 1, p1 = 0; i >= 0 && p1 < k; i--) { ...
### Prompt Generate a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", ...
#include <bits/stdc++.h> using namespace std; int n, k; string ans = ""; vector<string> v; string func(string s) { int cnt = 0; for (int i = (int)s.size() - 1; i >= 0; i--) if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u') { ++cnt; if (cnt == k) return s.substr(i);...
### Prompt Develop a solution in cpp to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; int n, k; int main() { int i, j; cin >> n >> k; bool ac = true; string ans; for (i = 0; i < n; i++) { string ss, s[4], str; str = "a "; for (j = 0; j < 4; j++) { cin >> ss; s[j] = ""; int t = 0; for (int h = ss.length() - 1; h...
### Prompt Develop a solution in cpp to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<string> s; for (int i = 0; i < 4 * n; i++) { string p; cin >> p; string temp; int count = 0; for (int j = 0; j < p.size(); j++) { if (p[j] == 'a' || p[j] == 'e' || p[j] == 'i' || p[j] == 'o' || ...
### Prompt Please provide a CPP coded solution to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; int i, j, w, x, y; bool rhyme[4][4], scheme[5000][4]; string str[4]; map<int, string> name; name[0] = "aaaa"; name[1] = "aabb"; name[2] = "abab"; name[3] = "abba"; cin >> n >> k; for (i = 0; i < (n); i++) { for (j = 0; j < (4...
### Prompt Create a solution in Cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> using namespace std; const char vow[5] = {'a', 'e', 'i', 'o', 'u'}; string S[4]; int C[4]; void doMagic() { if (S[0] == S[1] && S[1] == S[2] && S[2] == S[3] && S[3] == S[0]) { C[0]++; C[1]++; C[2]++; C[3]++; return; } if (S[0] == S[1] && S[2] == S[3]) { C[1]++; ...
### Prompt Construct a CPP code solution to the problem outlined: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<string> words(4 * n); string S; int aabb = 0, abab = 0, abba = 0, aaaa = 0, NO = 0; for (int i = (0); i < (4 * n); ++i) { cin >> S; int size = S.size(); int Kth = 0; string newS = ""; bool canRhyme...
### Prompt In cpp, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; vector<int> text; int n, k; long long p = 31; bool vowel(char ch) { return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'; } int type_of(string &s1, string &s2, string &s3, string &s4) { long long hash1 = 0, hash2 = 0, hash3 = 0, hash4 = 0; long long cu...
### Prompt Your challenge is to write a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; vector<vector<string> > v; int mat[2509][4]; int vowel(char ch) { if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') return 1; return 0; } int main() { int n, k; string s; int ans1 = 1, ans2 = 1, ans3 = 1, ans4 = 1; cin >> n >> k; int i; int ...
### Prompt Create a solution in Cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> using namespace std; int n, k; string q[4]; bool can[4]; bool okey(char c) { if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') return true; return false; } bool ok(string a, string b) { if ((int)a.length() < k || (int)b.length() < k) return false; int aa = a.length(); int ...
### Prompt Please create a solution in cpp to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; map<long long, long long> mp; string s[2504][4]; bool f[4] = {0}; int main() { long long n, m; cin >> n >> m; for (int i = 0; i < n; i++) for (int j = 0; j < 4; j++) cin >> s[i][j]; map<string, int> mp; for (int i = 0; i < n; i++) { mp.clear(); for (in...
### Prompt Your challenge is to write a CPP solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; int n, k, m; string s[100005]; int is_vol(char c) { string t = "aeiou"; for (int i = 0; i < t.size(); i++) { if (c == t[i]) return 1; } return 0; } int ok(vector<string> v) { if (v.size() == 0) return 1; set<string> v2; for (int i = 0; i < v.size(); i++) {...
### Prompt Create a solution in Cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> using namespace std; int n, k, m; string s[100005]; int is_vol(char c) { string t = "aeiou"; for (int i = 0; i < t.size(); i++) { if (c == t[i]) return 1; } return 0; } int ok(vector<string> v) { if (v.size() == 0) return 1; set<string> v2; for (int i = 0; i < v.size(); i++) {...
### Prompt Please create a solution in CPP to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; const int N = 2500 * 4 + 10; int n, k, d, sz; bool isV[2000], M = 0; string arr[N]; set<string> st[N]; string change(string z) { int c = 0; string s = ""; for (int i = z.size() - 1; i >= 0; i--) { s += z[i]; if (isV[z[i]]) M = 1, c++; if (c == k) break; ...
### Prompt Your challenge is to write a CPP solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; int n, k, len, cur, r[2510], size; string s[5], sub[5]; bool ok; bool check(char ch) { if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'u' || ch == 'o') return true; return false; } int rifm(string s1, string s2, string s3, string s4) { if (s1 == s2 && s1 == s3 &...
### Prompt Please provide a cpp coded solution to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; const int INFint = 2147483647; const long long INF = 9223372036854775807ll; const long long MOD = 1000000007ll; const long double EPS = 1e-9; string s[4], r[4]; int main() { ios_base::sync_with_stdio(0); map<char, bool> gl; gl['a'] = 1, gl['e'] = 1, gl['i'] = 1, gl['o...
### Prompt Create a solution in Cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> using namespace std; int mer(vector<int> &v) { int last = 0; for (int i = 0; i < v.size(); i++) { if (v[i] != 0) { if (v[i] == -1) return -1; else if (last == 0) last = v[i]; else if (last != v[i]) return -1; } } return last; } int c(cha...
### Prompt Please formulate a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> int k; int vowel(char c) { return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'; } int rhyme(char *s, char *t) { int n, m, i, j, cnt; n = strlen(s); m = strlen(t); for (i = n - 1, cnt = 0; i >= 0 && cnt < k; i--) if (vowel(s[i])) cnt++; if (cnt < k) return 0; for (j...
### Prompt Construct a CPP code solution to the problem outlined: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", ...
#include <bits/stdc++.h> using namespace std; const int N = 1000005; long long modd = 998244353; vector<bool> isprime(N); vector<int> primes; void seive() { isprime[0] = false; isprime[1] = false; for (int i = 2; i <= 1e6; i++) { isprime[i] = true; } for (int i = 2; i * i <= 1e6; i++) { if (isprime[i]...
### Prompt Develop a solution in Cpp to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:268435456") using namespace std; const string IN_NAME = "input.txt"; const string OUT_NAME = "output.txt"; template <class T> T abs(T &x) { return ((x) >= 0) ? (x) : (-(x)); } template <class T> T sqr(T &x) { return (x) * (x); } template <class T> T min(T &a,...
### Prompt Please provide a Cpp coded solution to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const double Pi = acos(-1.0); const int INF = 0x3f3f3f3f; int num[3000]; int n, k; struct st { char str[4][10010]; } poem[2510]; bool is(char ch) { if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') return true; else re...
### Prompt Please provide a CPP coded solution to the problem described below: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> int IntMaxVal = (int)1e20; int IntMinVal = (int)-1e20; long long LongMaxVal = (long long)1e20; long long LongMinVal = (long long)-1e20; using namespace std; template <typename T> struct argument_type; template <typename T, typename U> struct argument_type<T(U)> {}; template <typename T1, typena...
### Prompt In Cpp, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; const char letters[] = {'a', 'e', 'i', 'o', 'u'}; const char res[][5] = {"aabb", "abab", "abba", "aaaa"}; const int MAXN = 2510; const int MAXM = 10010; int n, k; char s[4][MAXM]; inline int ISV(char c) { for (int i = 0; i < 5; ++i) if (c == letters[i]) return 1; re...
### Prompt Please create a solution in CPP to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; long long vow(char c) { if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') { return 1; } else return 0; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n, k, j, i; set<string> s; string def1 = "!#1", def2 = "!#2", d...
### Prompt In Cpp, your task is to solve the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e...
#include <bits/stdc++.h> using namespace std; const string none = "george.ioanisyan.1996"; int n, k; string first, second, third, fourth; bool vowel(char ch) { return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'); } string getKstring(string str) { int i, qi = 0; for (i = str.size() - 1; i >= 0; ...
### Prompt Create a solution in cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> int diru[] = {-1, -1, -1, 0, 0, 1, 1, 1}; int dirv[] = {-1, 0, 1, -1, 1, -1, 0, 1}; using namespace std; template <class T> T sq(T n) { return n * n; } template <class T> T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a % b) : a); } template <class T> T lcm(T a, T b) { return (a / gcd<T>(a,...
### Prompt Create a solution in cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> using namespace std; int n, nk; char s[4][10005]; int f[4][4]; int sce[4]; void cal(int i) { if (i == 0) puts("aaaa"); if (i == 1) puts("aabb"); if (i == 2) puts("abab"); if (i == 3) puts("abba"); } int main() { scanf("%d%d", &n, &nk); sce[0] = sce[1] = sce[2] = sce[3] = 1; for (i...
### Prompt Your challenge is to write a CPP solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). ...
#include <bits/stdc++.h> using namespace std; int n, K; string res[] = {"aabb", "abab", "abba", "aaaa"}; bool rhymes(string a, string b) { string ta = "!!!", tb = "###"; int k = K; for (int i = a.length() - 1; i >= 0; i--) { if (a[i] == 'a' || a[i] == 'e' || a[i] == 'i' || a[i] == 'o' || a[i] == 'u') k-...
### Prompt Please create a solution in cpp to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; int a[5000]; int k; int no = 0; string last(string s) { int w = 0; int i = (int)s.size() - 1; while (i >= 0 && w != k) { if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u') { w++; } i--; } string res; if (w == k...
### Prompt Please formulate a Cpp solution to the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a...
#include <bits/stdc++.h> using namespace std; int n, k, i, j, x, l; bool b[4] = {true, true, true, true}; string s[4], a[4], ans[4] = {"aabb", "abab", "abba", "aaaa"}; int main() { cin >> n >> k; for (j = 0; j < n; j++) { for (i = 0; i < 4; i++) { cin >> s[i]; a[i] = ""; } for (l = 0; l < 4;...
### Prompt Create a solution in cpp for the following problem: Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e"...
#include <bits/stdc++.h> int n, m, cnt; long long tr[400010], tags[400010], tage[400010]; void addtag(long long s, long long e, int x, int l, int r) { tr[x] += s * (r - l + 1) + 1ll * (r - l) * (r - l + 1) / 2 * e; tags[x] += s, tage[x] += e; } void pushdown(int x, int ls, int rs, int l, int mid, int r) { if (tag...
### Prompt Please formulate a cpp solution to the following problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were...
#include <bits/stdc++.h> using namespace std; using ll = long long; inline ll read() { ll x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << 1) + (x << 3) + ch - '0'; ch = getchar(); } return x * f; } const ll ...
### Prompt Please provide a CPP coded solution to the problem described below: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places ...
#include <bits/stdc++.h> using namespace std; constexpr int Maxn = 2e5 + 5; int n, m; int a[Maxn]; namespace range_tree { using value_t = int; struct range { int l, r; mutable value_t c; range() : l(0), r(0), c(value_t()) {} range(int l, int r, const value_t &c) : l(l), r(r), c(c) {} range(const range &x) : l...
### Prompt Generate a CPP solution to the following problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were left un...
#include <bits/stdc++.h> using namespace std; const int Maxn = 200005; int n, m, ct, a[Maxn], b[Maxn], x[Maxn], y[Maxn], opt[Maxn], val[Maxn]; set<pair<int, int> > Se[Maxn]; struct ele { int lt, rt, val; bool operator<(const ele &A) const { return lt < A.lt; } }; set<ele> S; struct Tree { int lt, rt; pair<int, ...
### Prompt Your task is to create a Cpp solution to the following problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places whic...
#include <bits/stdc++.h> using namespace std; constexpr int Maxn = 2e5 + 5; int n, q; int a[Maxn]; template <typename _Tp> class range { public: public: range() : l(0), r(0), v(_Tp()) {} range(int l, int r, const _Tp &v) : l(l), r(r), v(v) {} range(const range &x) : l(x.l), r(x.r), v(x.v) {} friend bool opera...
### Prompt Please create a solution in CPP to the following problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were...
#include <bits/stdc++.h> using namespace std; namespace FGF { int n, m; const int N = 2e5 + 5; int a[N]; struct Node { int l, r, x; Node() {} Node(int _l, int _r, int _c) : l(_l), r(_r), x(_c) {} bool operator<(const Node &a) const { return l < a.l; } }; int id(int x) { static unordered_map<int, int> mp; st...
### Prompt In CPP, your task is to solve the following problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were left...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 3; using ll = long long; struct P { int l, r, a; bool operator<(P a) const { return l < a.l; } }; using it = set<P>::iterator; int n, id; set<P> st; set<int> ps[N]; unordered_map<int, int> mp; struct FW { ll t[N]; void add(int x, int y) { for...
### Prompt Your task is to create a Cpp solution to the following problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places whic...
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = (x << 1) + (x << 3) + c - '0'; c = getchar(); } return x * f; } int a[1...
### Prompt Your challenge is to write a cpp solution to the following problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places ...
#include <bits/stdc++.h> const int N = 1e5 + 10; int n, m, a[N], b[N << 1], pre[N], las[N << 1], ql[N], qr[N], qx[N]; long long tk[N << 2], tb[N << 2]; inline void adt(int rt, long long k, long long b) { tk[rt] += k; tb[rt] += b; } inline void pushdown(int rt) { adt(rt << 1, tk[rt], tb[rt]), adt(rt << 1 | 1, tk[r...
### Prompt Develop a solution in CPP to the problem described below: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5, M = 1e3 + 5; const long long INF = 1e18 + 5; inline long long read() { long long sum = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') fh = -1; c = getchar(); } while (c >= '0' && c <= '9') { sum = sum *...
### Prompt Construct a cpp code solution to the problem outlined: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were le...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5; long long read() { long long s = 0; char c = getchar(), lc = '+'; while (c < '0' || '9' < c) lc = c, c = getchar(); while ('0' <= c && c <= '9') s = s * 10 + c - '0', c = getchar(); return lc == '-' ? -s : s; } void write(long long x) ...
### Prompt Your challenge is to write a cpp solution to the following problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places ...
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T &x) { x = 0; int f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - '0'; ch = getchar(); } x *= f; } inline void write(long lon...
### Prompt Generate a cpp solution to the following problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were left un...
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = (x << 1) + (x << 3) + c - '0'; c = getchar(); } return x * f; } int a[1...
### Prompt Develop a solution in Cpp to the problem described below: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were...
#include <bits/stdc++.h> #pragma GCC target("avx,avx2") using namespace std; template <typename T> void chmin(T &x, const T &y) { if (x > y) x = y; } template <typename T> void chmax(T &x, const T &y) { if (x < y) x = y; } int read() { char c; while ((c = getchar()) < '-') ; if (c == '-') { int x = (c...
### Prompt Your challenge is to write a cpp solution to the following problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places ...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 200005; int n, q; struct TNode { int l, r; ll a, b; } t[N << 2]; inline int lc(int pos) { return pos << 1; } inline int rc(int pos) { return pos << 1 | 1; } void build(int pos, int l, int r) { t[pos].l = l; t[pos].r = r; if (l =...
### Prompt Please provide a cpp coded solution to the problem described below: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places ...