output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
double tick() {
static clock_t oldtick;
clock_t newtick = clock();
double diff = 1.0 * (newtick - oldtick) / CLOCKS_PER_SEC;
oldtick = newtick;
return diff;
}
long long gcd(long long a, long long b) {
if ((a == 0) || (b == 0)) {
return a + b;
}
return gc... | ### Prompt
Your task is to create a Cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two line... |
#include <bits/stdc++.h>
using namespace std;
int n, L, R;
string s;
set<char> alpha;
map<int, map<char, stack<string>>> m;
vector<pair<pair<string, string>, pair<string, string>>> ans;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
alpha.insert('a');
alpha.insert('e');
alph... | ### Prompt
In Cpp, your task is to solve the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each lin... |
#include <bits/stdc++.h>
using namespace std;
bool isvowel(char c) {
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') return true;
return false;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
;
int n, i, j;
cin >> n;
map<pair<char, int>, string> ma;
map<int, string> ma2;
... | ### Prompt
Please provide a CPP coded solution to the problem described below:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two ... |
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, pair<char, string>>> vec;
int main() {
unsigned long long int n, i, j, n1, cnt = 0;
cin >> n;
string s;
char r;
for (i = 1; i <= n; i++) {
cin >> s;
n1 = s.size();
cnt = 0;
for (j = 0; j < n1; j++) {
if (s[j] == 'a' || s[j] =... | ### Prompt
Your task is to create a Cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two line... |
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
int n, cnt[N], last[N], cur[26];
string s[N];
vector<pair<int, int>> v, v1, v2;
vector<pair<string, string>> ans;
bool check(char x) {
if (x == 'a' || x == 'e' || x == 'o' || x == 'i' || x == 'u') return 1;
return 0;
}
void solve(int l, int r) {
... | ### Prompt
Please create a solution in Cpp to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using V = vector<T>;
template <typename T>
using VV = vector<V<T>>;
template <typename T>
using Mi = map<long long, T>;
template <typename T>
using MMi = map<long long, Mi<T>>;
const double PI = 3.141592653589793238463;
pair<long long, long long> zero ... | ### Prompt
In Cpp, your task is to solve the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each lin... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 1000011;
struct node {
node() {}
vector<string> words[26];
};
char s[maxn];
void check(int &num, char &c) {
int len = strlen(s);
num = 0;
for (int i = 0; i < len; ++i) {
if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[... | ### Prompt
Please create a solution in cpp to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
void warp() {
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(false);
}
long long check(char c) {
if (c == 'e') return 0;
if (c == 'a') return 1;
if (c == 'i') return 2;
if (c == 'u') return 3;
if (c == 'o') return 4;
return -1;
}
signed main() {
warp... | ### Prompt
Construct a Cpp code solution to the problem outlined:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each l... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
string str[maxn];
struct Ly {
int num, last;
int id;
} ly[maxn];
queue<int> q[3];
vector<int> vec;
bool cmp(Ly x, Ly y) {
if (x.num == y.num) return x.last < y.last;
return x.num < y.num;
}
int main() {
int n;
scanf("%d", &n);
for (i... | ### Prompt
Please create a solution in cpp to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
string s;
map<pair<char, int>, string> tmp;
vector<pair<pair<string, string>, pair<string, string>>> ans;
pair<string, string> p1, p2;
multimap<string, string> sec;
... | ### Prompt
Please formulate a cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int maxm = 1e6 + 10;
string s[maxn];
struct word {
int id, lst;
word() {}
word(int id, int lst) : id(id), lst(lst) {}
bool operator<(const word &t) const {
if (lst != t.lst) return lst < t.lst;
return id < t.id;
}
};
vector... | ### Prompt
In cpp, your task is to solve the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each lin... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
vector<pair<int, int> > ho, qi;
int d[130];
int vis[N][6];
string s[N];
int main() {
d['a'] = 1, d['e'] = 2, d['i'] = 3, d['o'] = 4, d['u'] = 5;
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
cin >> s[i];
int len = s[i].length... | ### Prompt
Please formulate a cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
const char c[5] = {'u', 'e', 'o', 'a', 'i'};
const int N = 1e5 + 1;
string s[N];
bool Mark[N], used[N];
vector<pair<int, int> > F[N], U, V, G;
int n;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 0; i < 5; i++) {
... | ### Prompt
Please create a solution in CPP to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
struct node {
int sluong;
char ch;
int index;
};
struct NodeZ {
int sluong;
char ch;
int Count;
};
struct NodeX {
int sluong;
int Count;
};
int n;
string s[maxn];
node a[maxn];
node b[maxn];
NodeZ az[maxn];
NodeX ax[maxn];
int i... | ### Prompt
Please formulate a Cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
int vowel[150];
string s[100100];
std::vector<pair<int, int> > v1, v2;
map<int, map<char, vector<int> > > mp;
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
char last;
int n, cnt;
cin >> n;
vowel['a'] = vowel['e'] = vowel['i'] = vowel['o'] = ... | ### Prompt
Develop a solution in cpp to the problem described below:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
int n;
string in[100005];
struct ha {
int last, len, id;
} a[1000005];
bool cmp(const ha &aa, const ha &bb) {
if (aa.len != bb.len) return aa.len < bb.len;
return aa.last < bb.last;
}
queue<int> lq;
queue<int> nq;
int m;
queue<int> an;
queue<int> lins;
queue<int> lins... | ### Prompt
Please create a solution in cpp to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
unordered_map<int, unordered_map<char, vector<string>>> words;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
char vowel = '\0';
int count = 0;
for (int j = 0; j < s.length(); j++)
if (s[j] == 'a' || s[j] ==... | ### Prompt
Please provide a cpp coded solution to the problem described below:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two ... |
#include <bits/stdc++.h>
using namespace std;
vector<pair<pair<pair<int, char>, bool>, int>> data;
vector<pair<pair<pair<int, char>, pair<int, char>>, pair<int, int>>> t1;
vector<pair<pair<pair<int, char>, pair<int, char>>, pair<int, int>>> t2;
vector<pair<pair<pair<pair<int, char>, pair<int, char>>, pair<int, int>>,
... | ### Prompt
Your task is to create a Cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two line... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
vector<pair<int, pair<char, string> > > v;
long long int i, j, c;
char x;
for (j = 0; j < n; j++) {
c = 0;
string s;
cin >> s;
for (i = s.size() - 1; i >= 0; i--) {
if (s[i] == 'a' || s[i] == 'e' || s... | ### Prompt
In CPP, your task is to solve the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each lin... |
#include <bits/stdc++.h>
FILE *in = stdin;
FILE *out = stdout;
struct _wmwm {
int cnt;
char lv;
int check = -1;
int idx;
};
int n;
char inp[1001004];
int len;
_wmwm wm[101004];
int pairs[101004][2];
int pairs2[101004][2];
int ans[101004][4];
std::string inps[101004];
int orm(_wmwm a, _wmwm b) {
if (a.cnt < b.... | ### Prompt
Construct a CPP code solution to the problem outlined:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each l... |
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
inline istream& operator>>(istream& str, pair<T, U>& p) {
return str >> p.first >> p.second;
}
template <class T>
inline istream& operator>>(istream& str, vector<T>& a) {
for (auto& i : a) str >> i;
return str;
}
const long long N = 1e6 + 1... | ### Prompt
Develop a solution in Cpp to the problem described below:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
const int INF = 1000 * 1000 * 1000 + 10;
const int N = 2 * 1000 * 1000 + 10;
using namespace std;
string d = "aouei";
bool comp(pair<int, pair<char, string>> a, pair<int, pair<char, string>> b) {
return (a.first < b.first ||
(a.first == b.first) && (a.second.first < b.second.first))... | ### Prompt
In CPP, your task is to solve the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each lin... |
#include <bits/stdc++.h>
bool isVowel(char c) {
return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
}
int vowelCount(std::string &word) {
int count = 0;
for (auto ch : word)
if (isVowel(ch)) count++;
return count;
}
char lastVowel(std::string &word) {
for (int i = word.length() - 1; i >= 0; i... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two ... |
#include <bits/stdc++.h>
using namespace std;
string vowels = "aeiou";
int id[256];
const int N = 1e6 + 7;
vector<string> str[5][N];
int fr[N];
int main() {
memset(id, -1, sizeof id);
for (int i = 0; i < vowels.size(); i++) id[vowels[i]] = i;
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
string s;
c... | ### Prompt
Generate a cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line c... |
#include <bits/stdc++.h>
const int N = 2e5 + 5;
const long double Pi = 3.141592653;
const long long mod = 1e9 + 7;
const long long Mod = 998244353;
const long long Inf = 4e18;
using namespace std;
int dx[9] = {1, -1, 0, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 0, 1, -1, 1, -1, 1, -1, 0};
struct ans {
string a, b, c, d;
}... | ### Prompt
Generate a cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line c... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<pair<int, int>, vector<string>> m1;
map<string, int> m2;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
int cnt = 0;
char last;
for (int i = 0; i < s.length(); i++) {
if (s[i] == 'a' || s[i] == 'e' || ... | ### Prompt
Your task is to create a cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two line... |
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
int n;
cin >> n;
string s[n + 2];
for (int i = 0; i < n; i++) cin >> s[i];
vector<pair<int, int>> same, diff;
map<pair<int, char>, int> m;
unordered_m... | ### Prompt
Please formulate a Cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
struct answer {
pair<long long, long long> second;
pair<long long, long long> first;
};
long long n;
vector<string> s;
vector<long long> sv;
map<long long, vector<long long> > vowels;
map<pair<long long, long long>, vector<long long> > last;
int main() {
std::ios::syn... | ### Prompt
In CPP, your task is to solve the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each lin... |
#include <bits/stdc++.h>
using namespace std;
bool vow(char c) {
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
return true;
else
return false;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, i, j;
cin >> n;
string arr[100005];
for (i = 0; i < n;... | ### Prompt
In CPP, your task is to solve the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each lin... |
#include <bits/stdc++.h>
const int MAXN = 100005;
const int MAXS = 1000005;
struct Word {
std::string str;
int cnt, ID;
char last;
} W[MAXN], WW[MAXN];
bool used[MAXN];
bool isvowel(char ch) {
return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u';
}
std::vector<std::pair<std::string, std::string>... | ### Prompt
Create a solution in cpp for the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line... |
#include <bits/stdc++.h>
using namespace std;
bool is_lyric(char c) {
return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
}
const string not_available = "-";
string a[100010];
string *b[1000010][26];
vector<string *> first, second;
int main(int argc, char *argv[]) {
ios::sync_with_stdio(false);
int n... | ### Prompt
Construct a Cpp code solution to the problem outlined:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each l... |
#include <bits/stdc++.h>
using namespace std;
struct wyraz {
int ilosc;
string wyraz;
char samogloska;
};
wyraz tab[100005];
bool comp(wyraz x, wyraz y) {
if (x.ilosc == y.ilosc) return x.samogloska < y.samogloska;
return x.ilosc < y.ilosc;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
co... | ### Prompt
Please create a solution in cpp to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long int t, flag = 0;
t = 1;
while (t--) {
int n;
cin >> n;
string second[n + 1];
map<pair<int, char>, int> mp;
vector<pair<int, int> > v2;
map<int, vector<int> > mp... | ### Prompt
Create a solution in CPP for the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line... |
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int eps = 1e-10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
long long read() {
long long x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getch... | ### Prompt
Please create a solution in CPP to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n;
string s[N];
pair<int, char> cn(string& s) {
int c = 0;
char t = ' ';
for (auto x : s)
if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') c++, t = x;
return make_pair(c, t);
}
struct st {
int x;
char y;
int id;
boo... | ### Prompt
Please create a solution in cpp to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 0x3f3f3f3f;
const int MAX = 100009;
int n;
string vol = "aeiou";
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
while (cin >> n) {
vector<string> w(n);
vector<pair<string, int>> s;
for ... | ### Prompt
Develop a solution in CPP to the problem described below:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
int n;
string str[N];
struct node {
int id, num;
char str;
bool operator<(const node &S) const {
if (num == S.num) {
return str < S.str;
}
return num < S.num;
}
} e[N];
char vowels[10] = "aeiou";
int main() {
scanf("%d", &n)... | ### Prompt
Construct a cpp code solution to the problem outlined:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each l... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 2;
struct {
int x;
int last;
string it;
} a;
struct kek {
string w, e, r, t;
};
map<char, int> bak;
vector<string> st[N + 5][7], q;
vector<pair<string, string> > be, en;
vector<kek> ans;
int n, m;
string ins;
char c;
bool frog = false;
int main()... | ### Prompt
Please formulate a cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
map<long long, string> vov[5], temp;
list<string> l, l2;
void decide(string s) {
long long cnt = 0;
for (long long i = 0; i < s.size(); i++) {
char x = s[s.size() - i - 1];
if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') cnt++;
}
for (long long... | ### Prompt
Generate a cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line c... |
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
int x, z, y, a;
string s[100005];
deque<pair<char, pair<int, int>>> pq;
dequ... | ### Prompt
Generate a Cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line c... |
#include <bits/stdc++.h>
using namespace std;
struct hash_pair {
template <class T1, class T2>
size_t operator()(const pair<T1, T2>& p) const {
auto hash1 = hash<T1>{}(p.first);
auto hash2 = hash<T2>{}(p.second);
return hash1 ^ hash2;
}
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);... | ### Prompt
Your task is to create a CPP solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two line... |
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> A, B;
const int N = 1e6 + 5;
pair<int, int> a[N];
int n, p[N];
string s[N];
inline void read_input() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s[i];
for (char c : s[i])
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == ... | ### Prompt
Develop a solution in CPP to the problem described below:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
struct vowels {
string vow, full;
vowels() {
vow = "";
full = "";
}
vowels(string _vow, string _full) {
vow = _vow;
full = _full;
}
};
void str_in(string &s) {
s = "";
char c = getchar();
while (c < 'a' || c > 'z') {... | ### Prompt
Your task is to create a CPP solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two line... |
#include <bits/stdc++.h>
using namespace std;
long long cnt_vowel(string s) {
long long cnt = 0;
for (auto it : s) {
if (it == 'a' || it == 'e' || it == 'i' || it == 'o' || it == 'u') cnt++;
}
return cnt;
}
char last_vowel(string s) {
reverse(s.begin(), s.end());
for (auto it : s) {
if (it == 'a' ||... | ### Prompt
Your task is to create a cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two line... |
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 10;
const int inf = 1e9 + 10;
const int N = 1e6 + 10;
const char str[] = {'a', 'e', 'o', 'i', 'u'};
multiset<string> s[N];
multiset<string> que[N][5];
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
int n;
cin >> n;
vector<string> a(... | ### Prompt
Please formulate a cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
struct word {
string full, vowels;
int num;
word() {
full = "";
vowels = "";
num = -1;
}
word(const string &_full, const string &_vowels, const int &_num) {
full = _full;
vowels = _vowels;
num = _num;
}
};
void s... | ### Prompt
Develop a solution in CPP to the problem described below:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
int n;
int ptr1n = 0, ptr1s = 0;
int ptr2n = 0;
vector<vector<vector<string>>> vec;
int cnt(const string& s) {
int ret = 0;
for (char i : s) {
for (char j : {'a', 'e', 'i', 'o', 'u'}) {
if (i == j) {
ret++;
break;
}
}
}
return ret... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two ... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 50;
string s[maxn];
int vow[maxn];
char la[maxn];
bool out[maxn];
int mat[maxn];
stack<int> st;
stack<int> st2;
void init(int n) {
memset(vow, 0, sizeof(vow));
memset(la, 1, sizeof(la));
memset(out, 0, sizeof(out));
memset(mat, -1, sizeof(mat)... | ### Prompt
Please formulate a CPP solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
bool vowel(char c) {
return (c == 'a' || c == 'e' || c == 'o' || c == 'i' || c == 'u');
}
int cvowel(string& s) {
int n = 0;
for (char& c : s) {
n += vowel(c);
}
return n;
}
int getlast(string& s) {
for (int i = s.size() - 1;; i--) {
if (vowel(s[i])) {
... | ### Prompt
Please provide a cpp coded solution to the problem described below:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two ... |
#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 10;
const int LOG = 21;
const int CNTSZ = 30;
const int INF = 1e9;
const int MOD = 16714589;
const long long LLINF = 1e18;
const string vowel = "aeiou";
int main() {
int n;
cin >> n;
vector<string> a(n);
map<pair<int, int>, vector<int> > cnt;
f... | ### Prompt
Your task is to create a cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two line... |
#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, nrs, nrl, nrc, l, c;
bool used[100005];
bool evoc(char a) {
if (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u') return 1;
return 0;
}
string s;
vector<pair<pair<int, char>, string> > v, v2;
vector<pair<string, string> > ans, firstc;
int o... | ### Prompt
Develop a solution in cpp to the problem described below:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
const int BASE = 1000000;
int main(int argc, char *argv[]) {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<pair<int, string> > a;
for (int k = 0; k < n; k++) {
string s;
cin >> s;
int c = 0, last;
for (int i = 0;... | ### Prompt
In cpp, your task is to solve the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each lin... |
#include <bits/stdc++.h>
using namespace std;
struct tip {
vector<string> g[26];
int nechta = 0;
};
tip v[111111];
int unli[26];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
string s;
unli[0] = unli['e' - 'a'] = unli['o' - 'a'] = unli['i' - 'a'] =
unli['u'... | ### Prompt
Create a solution in Cpp for the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
const int MOD = 1e9 + 7;
int n, m, k, t;
struct Word {
string word;
int num;
char last;
bool operator<(const Word& that) const {
if (this->num != that.num) return this->num < that.num;
return this->last < that.last;
}
} words[MAX... | ### Prompt
Generate a CPP solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line c... |
#include <bits/stdc++.h>
using namespace std;
int n;
struct Node {
string s;
int num;
char last;
} node[100005];
int cmp(Node a, Node b) {
if (a.num == b.num) {
return a.last < b.last;
} else {
return a.num < b.num;
}
}
vector<pair<int, int> > pa1, pa2;
int main() {
string s;
int num, size;
ch... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two ... |
#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 10;
vector<string> s(maxx + 5);
int last, freq;
vector<char> vow{'a', 'e', 'i', 'o', 'u'};
vector<pair<int, int> > g[30];
vector<pair<int, int> > pp, ex, qq, add;
void calco(int id) {
string x = s[id];
for (int i = 0; i < x.size(); i++) {
char... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two ... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, maxx;
string s[maxn];
int vis[maxn][10];
vector<pair<int, int> > dui, more;
int check(char x) {
if (x == 'a') return 1;
if (x == 'e') return 2;
if (x == 'u') return 3;
if (x == 'o') return 4;
if (x == 'i') return 5;
return 0;
}
i... | ### Prompt
Please formulate a Cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
struct help {
public:
int n;
char vowel;
string word;
};
bool coomp(const help &p1, const help &p2) {
if (p1.n == p2.n) {
if (p1.vowel > p2.vowel)
return true;
else
return false;
}
if (p1.n > p2.n)
return true;
else
return false;
}... | ### Prompt
Please create a solution in cpp to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Eac... |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<string> v(n);
for (auto &&x : v) cin >> x;
unordered_map<char, int> vvl;
vvl['a'] = 1;
vvl['e'] = 1;
vvl['i'] = 1;
vvl['o'] = 1;
vvl['u'] = 1;
vector<pair<pair<int, ... | ### Prompt
In Cpp, your task is to solve the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each lin... |
#include <bits/stdc++.h>
using namespace std;
bool comp(pair<pair<int, char>, string> a, pair<pair<int, char>, string> b) {
if (a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first.first < b.first.first;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NUL... | ### Prompt
Create a solution in Cpp for the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two lines. Each line... |
#include <bits/stdc++.h>
using namespace std;
long long int ceil(long long int a, long long int b) { return (a + b - 1) / b; }
const int base = 1000000000;
const int base_digits = 9;
struct bigint {
vector<int> a;
int sign;
bigint() : sign(1) {}
bigint(long long v) { *this = v; }
bigint(const string &s) { rea... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.
Each lyric consists of two ... |
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7fffffff;
const long long Linf = (1uLL << 63) - 1;
const double EPS = 1e-10;
namespace IOSpace {
void get_int(int &x) {
char t = getchar();
bool neg = false;
x = 0;
for (; (t > '9' || t < '0') && t != '-'; t = getchar())
;
if (t == '-') neg =... | ### Prompt
Construct a Cpp code solution to the problem outlined:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with eac... |
#include <bits/stdc++.h>
using namespace std;
char s[300][300];
int vis[300][300];
struct node {
int x, y;
};
queue<node> q;
int f[8][2] = {0, 1, 1, 0, 0, -1, -1, 0, 1, 1, -1, 1, -1, -1, 1, -1};
int bfs(int x, int y, int n, int m) {
node e, t;
e.x = x, e.y = y;
vis[x][y] = 1;
while (!q.empty()) q.pop();
q.p... | ### Prompt
Construct a cpp code solution to the problem outlined:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with eac... |
#include <bits/stdc++.h>
using namespace std;
const int N = 250;
int n, m;
bool field[N + 2][N + 2];
void read() {
cin >> n >> m;
for (int i = 0; i <= n + 1; ++i) {
for (int j = 0; j <= m + 1; ++j) {
field[i][j] = false;
}
}
for (int i = 1; i <= n; ++i) {
string row;
cin >> row;
for (i... | ### Prompt
Create a solution in CPP for the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each s... |
#include <bits/stdc++.h>
char a[300][300];
int n, m, t, z, s;
const int X[8] = {0, 1, 0, -1, 1, 1, -1, -1},
Y[8] = {1, 0, -1, 0, 1, -1, 1, -1};
void F(int x, int y, int &s) {
if (x < 0 || x >= n || y < 0 || y >= m || a[x][y] != '1') return;
a[x][y] = '2', s++;
for (int i = 0; i < 8; i++) F(x + X[i], y +... | ### Prompt
Construct a Cpp code solution to the problem outlined:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with eac... |
#include <bits/stdc++.h>
using namespace std;
const int X[8] = {-1, 1, 0, 0, -1, -1, 1, 1},
Y[8] = {0, 0, -1, 1, -1, 1, 1, -1};
char ar[256][256];
int n, m, t, cnt, ans;
void dfs(int x, int y) {
if (x < 0 || x >= n || y < 0 || y >= m || ar[x][y] != '1') return;
ar[x][y] = '2';
++cnt;
for (int i = 0; i... | ### Prompt
Construct a Cpp code solution to the problem outlined:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with eac... |
#include <bits/stdc++.h>
using namespace std;
const int MaxN = 252, MaxC = 0x3F3F3F3F, NA = -1, MaxD = 8;
const int dx[MaxD] = {-1, -1, -1, 0, 1, 1, 1, 0},
dy[MaxD] = {-1, 0, 1, 1, 1, 0, -1, -1};
char a[MaxN][MaxN];
int m, n, s;
void mark(int x, int y, int p, int q) {
int d;
if (a[x][y] != p) return;
a[... | ### Prompt
Generate a Cpp solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each sid... |
#include <bits/stdc++.h>
char a[251][251];
int n, m, cnt, ans;
const int dx[9] = {0, 0, 1, 0, -1, 1, 1, -1, -1},
dy[9] = {0, 1, 0, -1, 0, 1, -1, 1, -1};
void dfs(int x, int y) {
int i;
a[x][y] = '2';
cnt++;
for (i = 1; i <= 8; i++) {
int ox = x + dx[i], oy = y + dy[i];
if (ox > 0 && ox <= n &&... | ### Prompt
Create a solution in cpp for the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each s... |
#include <bits/stdc++.h>
using namespace std;
const int dx[] = {0, 0, 1, 1, 1, -1, -1, -1},
dy[] = {1, -1, 0, 1, -1, 0, 1, -1};
const int maxn = 255;
int T, n, m, ans;
char a[maxn][maxn];
bool vis[maxn][maxn];
bool s[maxn][maxn];
queue<int> Q;
bool out(int x, int y) { return x <= 0 || y <= 0 || x > n || y > m... | ### Prompt
Develop a solution in cpp to the problem described below:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with ... |
#include <bits/stdc++.h>
using namespace std;
const int N = 300;
char a[N][N];
int nb[N][N];
bool u[N][N];
int n, m, ds[N * N], szds;
bool good;
bool read() {
if (scanf("%d %d", &n, &m) != 2) return false;
for (int i = 0; i < int(n); ++i) {
scanf("%s", a[i]);
for (int j = 0; j < int(m); ++j) nb[i][j] = 0, u... | ### Prompt
Generate a cpp solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each sid... |
#include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926535;
const double eps = 1e-6;
const int fx[8] = {1, 1, 1, -1, -1, -1, 0, 0};
const int fy[8] = {1, -1, 0, 1, -1, 0, 1, -1};
bool bl[300][300], ma[300][300];
int n, m;
char ch;
bool kind1(int ax, int ay, int bx, int by, int C) {
for (int i = ax; ... | ### Prompt
Develop a solution in cpp to the problem described below:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with ... |
#include <bits/stdc++.h>
using namespace std;
string itos(long long i) {
stringstream s;
s << i;
return s.str();
}
long long stoi(string s) {
istringstream in(s);
long long ret;
in >> ret;
return ret;
}
string b[252];
int a[256][256];
int n, m;
int check(int i, int j, int side, int what) {
for (int ii =... | ### Prompt
Please formulate a cpp solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with ... |
#include <bits/stdc++.h>
using namespace std;
int t, n, m, ans;
vector<vector<int>> gh, used;
int dx[8] = {1, 1, 1, 0, 0, -1, -1, -1};
int dy[8] = {1, 0, -1, 1, -1, 1, 0, -1};
bool onseg(double x1, double y1, double x2, double y2, double x, double y) {
double d1 = sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
do... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squ... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
const int maxn = 260;
int a[maxn][maxn];
int sumi[maxn][maxn] = {};
int sumj[maxn][maxn] = {};
int sumd1[maxn][maxn] = {};
int sumd2[maxn][maxn] = {};
pair<int, int> jumpi[maxn][maxn];
pair<int, int>... | ### Prompt
Generate a CPP solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each sid... |
#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
int n, m, it;
bool a[250][250];
int u[250][250], lx, ly, rx, ry, k;
const int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
void go(int vx, int vy) {
if (u[vx][vy]) return;
... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squ... |
#include <bits/stdc++.h>
constexpr int MAXN = 255;
using namespace std;
int testCase, n, m, cnt, tot, Cnt1, Cnt2, Cnt3, Cnt4;
int mp[MAXN][MAXN];
int dr[8] = {1, 1, 1, 0, 0, -1, -1, -1};
int dc[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
inline void clear(int r, int c) {
mp[r][c] = 0, tot++;
for (int i = 0; i < 8; i++) {
... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squ... |
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <class T1, class T2>
struct cmpf {
bool rev;
inline bool operator()(const pair<T1, T2>& a, const pair<T1, T2>& b) const {
return (a.first < b.first) ^ rev;
}
cmpf(bool b = false) ... | ### Prompt
Generate a Cpp solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each sid... |
#include <bits/stdc++.h>
using namespace std;
int mp[300][300] = {0}, dir[8][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1},
{1, -1}, {1, 1}, {-1, -1}, {-1, 1}};
bool flag[300][300] = {0};
char tmp[300][300];
int n, m;
short get_then(short a) {
switch (a) {
case 0:
return -1;
... | ### Prompt
Please provide a cpp coded solution to the problem described below:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squ... |
#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[] = {1, 0, -1, 1, -1, 1, 0, -1};
const int N = 260;
char c[N][N];
int d[N][N];
int s;
int sx, sy;
int id;
int m, n;
void dfs(int x, int y) {
int i;
int tx, ty;
for (i = 0; i < 8; i++) {
tx = x + dx[i];
ty = y + dy[i];... | ### Prompt
In Cpp, your task is to solve the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each ... |
#include <bits/stdc++.h>
using namespace std;
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
char a[300][300];
int main() {
int t;
scanf("%d", &t);
for (int l = 0; l < t; l++) {
int n, m;
scanf("%d %d", &n, &m);
int i, j, k;
for (i = 0; i < n + 2; i++) {
fo... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squ... |
#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:200000000")
const double EPS = 1E-9;
const int INF = 1000000000;
const long long INF64 = (long long)1E18;
const double PI = 3.1415926535897932384626433832795;
const int dxy[8][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1},
... | ### Prompt
Develop a solution in cpp to the problem described below:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with ... |
#include <bits/stdc++.h>
using namespace std;
int n, m, ct, num, l, r, u, d;
int dx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
char gp[250 + 50][250 + 50];
int cnt[250 + 50][250 + 50];
void dfs(int x, int y) {
cnt[x][y] = ct;
l = min(l, y);
r = max(r, y);
u = min(u, x);
d = max... | ### Prompt
Your task is to create a cpp solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int NMAX = 1e4;
const double EPS = 1e-9;
const int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int tests;
int n, m;
char f[255][255];
bool used[255][255];
bool used2[255][255];
int col[255][255];
int ITER;
inl... | ### Prompt
In cpp, your task is to solve the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each ... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 300;
const int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1},
dy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
int t, n, m;
char a[maxn][maxn];
bool vis[maxn][maxn];
vector<pair<int, int> > v;
void dfs(int x, int y) {
vis[x][y] = 1;
v.push_back(make_pair(x, y));
... | ### Prompt
Develop a solution in Cpp to the problem described below:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with ... |
#include <bits/stdc++.h>
using namespace std;
char maps[255][255];
int n, m, T, ans, num, i, j;
int X[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int Y[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int check(int x, int y, int l, int r) {
for (int i = 0; i <= (num >> 2); i++)
for (int j = l; j <= r; j++) {
int a = x + X[j] * i, b... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squ... |
#include <bits/stdc++.h>
using namespace std;
int n, m;
char inp[260][260];
bool cov[260][260];
int mx, my, Mx, My;
vector<int> outai;
vector<int> outaj;
void dfs(int i, int j) {
cov[i][j] = true;
mx = min(mx, j);
my = min(i, my);
Mx = max(Mx, j);
My = max(My, i);
outai.push_back(i);
outaj.push_back(j);
... | ### Prompt
In CPP, your task is to solve the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each ... |
#include <bits/stdc++.h>
using namespace std;
const int N = 255;
char str[N][N];
int n, m, t, a[N][N];
int b[N][N], c[N][N];
inline int get(int x, int y) {
if (x < 0 || y < 0) return 0;
return a[x][y];
}
inline int gao(int x1, int y1, int x2, int y2) {
if (x1 > x2 || x1 > n) return 0;
if (y1 > y2 || y1 > m) ret... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squ... |
#include <bits/stdc++.h>
using namespace std;
char c[250][250];
int m, n;
int x[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int y[8] = {1, 0, -1, 0, -1, 1, -1, 1};
int no;
void makezero(int i, int j) {
if (i < 0 || j < 0 || i >= m || j >= n || c[i][j] != '1') return;
int z;
c[i][j] = '2';
no++;
for (z = 0; z < 8; z++) ... | ### Prompt
Create a solution in cpp for the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each s... |
#include <bits/stdc++.h>
int D[8][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0},
{1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
char b[256][256];
int n, m, s;
void judge(int x, int y, int &s) {
if (x < 0 || x >= n || y < 0 || y >= m || b[x][y] != '1') return;
b[x][y] = '2';
s++;
for (int i = 0; i < 8; i++) judge... | ### Prompt
Construct a cpp code solution to the problem outlined:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with eac... |
#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;
const long double PI = 2 * acos(.0);
const int dx[] = {0, 0, -1, 1, -1, -1, 1, 1};
const int dy[] = {-1, 1, 0, 0, -1, 1, -1, 1};
int n, m, k, X[100100], Y[100100];
char a[300][3... | ### Prompt
Generate a cpp solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each sid... |
#include <bits/stdc++.h>
using namespace std;
const int dr[] = {0, -1, 0, 1, -1, 1, 1, -1};
const int dc[] = {1, 0, -1, 0, 1, 1, -1, -1};
const double eps = 1e-9;
template <class T>
void print(T const &x) {
ostringstream os;
os << x;
cout << os.str() << endl;
}
template <class T>
void print(vector<T> const &v) {
... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squ... |
#include <bits/stdc++.h>
char s[300][300];
int up[300][300], left[300][300], lu[300][300], ru[300][300];
inline int sumA(int i, int j, int s) {
if (s <= 0) return 0;
if (s == 1) return up[i][j] - up[i - 1][j];
int k = i + s - 1, l = j + s - 1;
return up[k][j] - up[i][j] + left[i][l - 1] - left[i][j - 1] + up[k ... | ### Prompt
In Cpp, your task is to solve the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each ... |
#include <bits/stdc++.h>
using namespace std;
int n, m, t, c;
string A[1000000];
int X1, X2, Y1, Y2;
set<pair<int, int> > B;
int dx[] = {0, 0, -1, 1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
bool ok(int x, int y) { return (x >= 0 && y >= 0 && x < n && y < m); }
void dfs(int x, int y) {
B.insert(make_pai... | ### Prompt
Please create a solution in Cpp to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with ... |
#include <bits/stdc++.h>
using namespace std;
const int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
int t, ans, n, m;
int a[256][256], u[256][256];
char c;
void work(int x, int y) {
int tx, ty;
u[x][y] = 1;
for (int i = 0; i <= 7; i++) {
tx = x + dx[i];
ty = y + dy[... | ### Prompt
Construct a CPP code solution to the problem outlined:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with eac... |
#include <bits/stdc++.h>
using namespace std;
int R, C;
char bd[352][353];
int N, w[350 * 350];
int M, v[350 * 350];
bool Try(int x, int y) {
N = 0;
w[N++] = x << 9 | y;
bd[x][y] = '0';
for (int* h = w; h < w + N; ++h) {
x = *h >> 9;
y = *h & 511;
for (int k = 0; k < 9; ++k) {
int x1 = k / 3 -... | ### Prompt
Please create a solution in Cpp to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with ... |
#include <bits/stdc++.h>
using namespace std;
int n, m, mp[300][300], T, cnt, ans;
vector<pair<int, int> > kuai[46000];
void dfs(int x, int y) {
mp[x][y] = 0;
kuai[cnt].push_back(make_pair(x, y));
if (mp[x + 1][y] == 1) dfs(x + 1, y);
if (mp[x][y + 1] == 1) dfs(x, y + 1);
if (mp[x - 1][y] == 1) dfs(x - 1, y);... | ### Prompt
Create a solution in CPP for the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with each s... |
#include <bits/stdc++.h>
constexpr int MAXN = 255;
using namespace std;
int testCase, n, m, cnt, tot, Cnt1, Cnt2, Cnt3, Cnt4;
int mp[MAXN][MAXN];
int dr[8] = {1, 1, 1, 0, 0, -1, -1, -1};
int dc[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
inline void clear(int r, int c) {
mp[r][c] = 0, tot++;
for (int i = 0; i < 8; i++) {
... | ### Prompt
Construct a cpp code solution to the problem outlined:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with eac... |
#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 29;
const long long llinf = (long long)inf * (long long)inf;
template <class T>
inline T gcd(T a, T b) {
return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T cross(complex<T> a, complex<T> b) {
return a.real() * b.imag() - b.real() * a... | ### Prompt
Construct a cpp code solution to the problem outlined:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with eac... |
#include <bits/stdc++.h>
using namespace std;
char s[255][255];
int n, m, cnt;
inline bool valid(int x, int y) { return x >= 0 && x < n && y >= 0 && y < m; }
inline int count1(int x, int y) {
int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
while (valid(x, y) && s[x][y] == '1') x++, c1++;
x--;
while (valid(x, y) && s[x][y] ... | ### Prompt
Construct a CPP code solution to the problem outlined:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with eac... |
#include <bits/stdc++.h>
using namespace std;
char a[300][300];
int n, m;
bool isSquare(vector<pair<int, int> > &v) {
int minI = 1000, minJ = 1000, maxI = 0, maxJ = 0;
for (int i = 0; i < (int)v.size(); ++i) {
minI = min(minI, v[i].first);
maxI = max(maxI, v[i].first);
minJ = min(minJ, v[i].second);
... | ### Prompt
Please create a solution in cpp to the following problem:
You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2 Γ 2. We are only interested in two types of squares:
1. squares with ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.