output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; set<long long> adj[100005]; int main() { long long n, m; cin >> n >> m; for (long long i = 0; i < m; i++) { long long u, v; cin >> u >> v; adj[u].insert(v); adj[v].insert(u); } long long idx = -1; for (long long i = 1; i < n + 1; i++) { if (a...
### Prompt Please create a solution in CPP to the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the comp...
#include <bits/stdc++.h> using namespace std; const int N = 100004; int a[N], b[N], vis[N]; vector<int> g[N]; int cnt = 3; void dfs(int u, int p) { if (vis[u] == 0) { a[u] = cnt; b[u] = cnt; cnt++; } vis[u] = 1; for (int i = 0; i < g[u].size(); i++) { int v = g[u][i]; if (vis[v]) continue; ...
### Prompt Generate a cpp solution to the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the comparisons ...
#include <bits/stdc++.h> using namespace std; long long n, m; vector<long long> v[100010]; long long chk[100010]; long long ans1[100010], ans2[100010]; long long top = 3; int main() { scanf("%lld %lld", &n, &m); long long i, j; long long xx, yy; for (i = 1; i <= m; i++) { long long s, e; scanf("%lld %ll...
### Prompt Please create a solution in Cpp to the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the comp...
#include <bits/stdc++.h> #pragma optimize("", off) #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma comment(linker, "/STACK:36777216") const long long inf = 0x3f3f3f3f3f3f3f3LL; const long long mod = 1e9 + 7; using namesp...
### Prompt Develop a solution in Cpp to the problem described below: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the comp...
#include <bits/stdc++.h> using namespace std; vector<int> p[100011]; int vis[100011] = {0}; int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) { int a, b; scanf("%d%d", &a, &b); p[a].push_back(b); p[b].push_back(a); } int start = 0, end = 0; for (int i = 1; i <= n; i++...
### Prompt Create a solution in Cpp for the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the comparison...
#include <bits/stdc++.h> using namespace std; void scan() {} template <typename T, typename... Args> void scan(T &a, Args &...args) { scanf("%lld", &a); scan(args...); } void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr...
### Prompt In Cpp, your task is to solve the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the compariso...
#include <bits/stdc++.h> using namespace std; const int MM = 1e6; vector<int> G[MM]; vector<int> topo; bool vis[MM]; void dfs(int u) { if (vis[u]) { return; } vis[u] = 1; for (auto v : G[u]) { dfs(v); } topo.push_back(u); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ...
### Prompt Generate a cpp solution to the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the comparisons ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int n, m, a[N], b[N], ans1[N], ans2[N]; vector<int> G[N]; bool bo[N]; int main() { cin >> n >> m; for (int i = 1; i <= m; ++i) { scanf("%d %d", a + i, b + i); if (a[i] > b[i]) swap(a[i], b[i]); G[a[i]].push_back(b[i]); } if (n == 1...
### Prompt Your task is to create a cpp solution to the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of th...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, min_elem = 1; cin >> n >> m; vector<vector<int>> g(n); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; g[a].push_back(b); g[b].push_back(a); } vector<int> used(n); int f = -1; for (int i = 0; i ...
### Prompt Please create a solution in Cpp to the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the comp...
#include <bits/stdc++.h> #pragma GCC optimize("O3") using namespace std; template <class c> struct rge { c h, n; }; template <class c> rge<c> range(c h, c n) { return rge<c>{h, n}; } template <class c, class F> struct rgm { c h, n; F f; }; template <class c, class F> rgm<c, F> map_range(c b, c e, F f) { retur...
### Prompt Your challenge is to write a CPP solution to the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results o...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; set<int> s[maxn]; int a[maxn], b[maxn]; int main() { int n, m, x, y; scanf("%d%d", &n, &m); for (int i = 1; i <= m; ++i) { scanf("%d %d", &x, &y); if (x > y) swap(x, y); s[x].insert(y); } for (int i = 1; i <= n; ++i) { for...
### Prompt Your task is to create a Cpp solution to the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of th...
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> adj[100005]; int main(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; for (int i = 1; i <= m; ++i) { int u, v; cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } for (int i = 1; i <= n; ++i) ...
### Prompt In Cpp, your task is to solve the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the compariso...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; int n, m, u, v; vector<int> G[100005]; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < (int)(m); i++) { scanf("%d%d", &u, &v); G[u].push_back(v); G[v].push_back(u); } for (int i = 1; i <= (int)(n); i++) { G[i].push_ba...
### Prompt Please create a solution in cpp to the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the comp...
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; vector<int> ans1(n + 1, 0); vector<int> ans2(n + 1, 0); set<pair<int, int>> s; for (int i = 0; i < k; i++) { int x, y; cin >> x >> y; if (x > y) { swap(x, y); } s.insert({x, y}); } if (k =...
### Prompt Construct a CPP code solution to the problem outlined: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the compari...
#include <bits/stdc++.h> using namespace std; using LL = long long; void err() { cout << endl; } template <template <typename...> class T, typename t, typename... Args> void err(T<t> a, Args... args) { for (auto x : a) cout << x << ' '; err(args...); } template <typename T, typename... Args> void err(T a, Args... a...
### Prompt Please provide a Cpp coded solution to the problem described below: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results o...
#include <bits/stdc++.h> using namespace std; vector<int> razliciti[100005]; int a[100005]; int b[100005]; bool mark[100005]; int n, m; int p, q; int indeks; int pronadji(int x) { for (int i = 1; i <= n; i++) { if (i != x) { if (!mark[i]) return i; } } } int main() { ios_base::sync_with_stdio(false)...
### Prompt Construct a cpp code solution to the problem outlined: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the compari...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 7; bool vis[MAXN]; int n, m, all; vector<int> edge[MAXN]; int ans1[MAXN], ans2[MAXN]; void ini() { all = n; for (int i = 1; i <= n; i++) { vis[i] = 1; edge[i].clear(); } } void solve() { if (n == 1 || (m >= (n * (n - 1) / 2))) { pu...
### Prompt Please create a solution in Cpp to the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the comp...
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p); string to_string(const string...
### Prompt Create a solution in Cpp for the following problem: Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the comparison...
#include <bits/stdc++.h> using namespace std; long long countDig(long long s) { return floor(log10(s) + 1); } int main() { long long num; int luckyNums = 0; string n; cin >> num; int digits = countDig(num); n = to_string(num); for (int i = 0; i < digits; i++) { if (n[i] == '4' || n[i] == '7') luckyNum...
### Prompt Create a solution in Cpp for the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are ...
#include <bits/stdc++.h> using namespace std; int main() { string s; int m = 0; int t = 0; int k = 0; cin >> s; for (long long i = 0; i <= s.size() - 1; i++) { if (s[i] - '0' == 4) t++; if (s[i] - '0' == 7) t++; } if ((t == 4 || t == 7)) cout << "YES" << endl; else cout << "NO" << endl...
### Prompt Construct a CPP code solution to the problem outlined: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers a...
#include <bits/stdc++.h> using namespace std; int main() { long long num, c; while (cin >> num) { c = 0; while (num) { if (num % 10 == 7 || num % 10 == 4) c++; num /= 10; } if (c == 4 || c == 7) cout << "YES" << '\n'; else cout << "NO" << '\n'; } return 0; }
### Prompt In Cpp, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n; cin >> n; int count = 0; string l; l = to_string(n); for (int i = 0; i < l.length(); i++) { if (l[i] == '4' || l[i] == '7') { count++; } } if (count == 7 || count ==...
### Prompt Please create a solution in CPP to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, g; cin >> n; g = n; bool flag = false; int c = 0, count = 0; while (g != 0) { int b = g % 10; if (b == 4 || b == 7) { count++; } g = g / 10; c++; } int m = c; for (int i = 0; i < (1 << m); i++) { ...
### Prompt Generate a cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lu...
#include <bits/stdc++.h> using namespace std; int main() { long long n; long ans = 0; cin >> n; while (n > 0) { if ((n % 10) == 4 || (n % 10) == 7) ans++; n /= 10; } if (ans == 4 || ans == 7) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
### Prompt In CPP, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, count = 0; cin >> n; string s; s = to_string(n); for (int i = 0; i < s.length(); i++) { if ((s[i] == 52) or (s[i] == 55)) { count++; } } s = to_string(count); bool x = false; for (int i = 0; i < s.length(); i++) ...
### Prompt Develop a solution in Cpp to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; int num = 0; while (n != 0) { int x = n % 10; n /= 10; if ((x == 4) || (x == 7)) num++; } if ((num == 4) || (num == 7)) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Please provide a CPP coded solution to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> int32_t isLucky(long long number); using namespace std; int32_t main() { long long n, nd, number; cin >> n; long long count = 0; number = n; while (number) { nd = number % 10; number = number / 10; if (nd == 4 || nd == 7) { count++; } } if (isLucky(count)) { ...
### Prompt Develop a solution in CPP to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; void solving() { string s; cin >> s; long long int c = 0; for (long long int i = 0; i < s.size(); i++) { if (s[i] == '4' || s[i] == '7') { c++; } } if (c == 4 || c == 7) { cout << "YES" << "\n"; } e...
### Prompt Create a solution in Cpp for the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are ...
#include <bits/stdc++.h> using namespace std; int main() { long long int xoxo, count = 0, digitttt; cin >> xoxo; while (xoxo != 0) { digitttt = xoxo % 10; if (digitttt == 4 || digitttt == 7) { count++; } xoxo = xoxo / 10; } if (count == 4 || count == 7) { cout << "YES"; } else ...
### Prompt Your task is to create a cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all ...
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long n = 0; cin >> n; unsigned long long a = 0, c = 0; while (n > 0) { a = n % 10; if (a == 4 || a == 7) { c++; } n = n / 10; } if (c == 4 || c == 7) { cout << "YES"; } else { cout << "NO"; } return ...
### Prompt Please create a solution in CPP to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k = 0; cin >> n; while (n > 0) { if (n % 10 == 4 || n % 10 == 7) k++; n = n / 10; } if (k == 4 || k == 7) cout << "YES"; else cout << "NO"; }
### Prompt Generate a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lu...
#include <bits/stdc++.h> using namespace std; int main() { int n; int i, t; char str[25]; while (~scanf("%s", str)) { int len = strlen(str); t = 0; for (int i = 0; i < len; i++) { if (str[i] == '4' || str[i] == '7') { t++; } } if (t == 4 || t == 7) printf("YES\n"); ...
### Prompt In CPP, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> int main() { long long n; while (~scanf("%I64d", &n)) { int flag1 = 0, flag2 = 0; while (n > 0) { if ((n - 7) % 10 == 0 || (n - 4) % 10 == 0) { flag2++; } n /= 10; } if (flag2 == 4 || flag2 == 7) { printf("YES\n"); } else printf("NO\...
### Prompt Construct a Cpp code solution to the problem outlined: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers a...
#include <bits/stdc++.h> using namespace std; int i, j; long long m, n, t, l, len1, len2, len, d, k, r, ti, x1, x, y, z, x2, mi, ma = 0, yi, y2, z1, z2; int c[1000000], b[1000000], a[2000000]; string s2; string s1; string s3, s4, str; char sh[300000]; double sum, u; int main() { cin >> s1; for (i = 0; i < s1.si...
### Prompt Your challenge is to write a Cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { int s = 0; char n[20]; cin >> n; for (int i = 0; i <= strlen(n); i++) s += (n[i] == '7' || n[i] == '4'); cout << ((s == 4 | s == 7) ? "YES" : "NO"); return 0; }
### Prompt Your task is to create a cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all ...
#include <bits/stdc++.h> using namespace std; bool isLuck(int n) { while (n != 0) { int r = n % 10; n = n / 10; if (r != 4 and r != 7) { return false; } } return true; } int main() { long long n; cin >> n; int count = 0; while (n != 0) { int r = n % 10; n /= 10; if (r == ...
### Prompt Generate a cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lu...
#include <bits/stdc++.h> using namespace std; string st; int ans; int main() { cin >> st; for (int j = 0; j < st.size(); j++) if (st[j] == '4' || st[j] == '7') ans++; if (ans == 4 || ans == 7) puts("YES"); else puts("NO"); return 0; }
### Prompt Please formulate a cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int cnt = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == '4' || s[i] == '7') cnt++; } if (cnt == 4 || cnt == 7) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Please formulate a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; bool Caps(string a) { for (int i = 0; i < a.size(); i++) if (a.at(i) < 65 && a.at(i) > 90) return false; return true; } int main() { long long n, cnt = 0; cin >> n; while (n > 0) { int rem = n % 10; if (rem == 4 || rem == 7) { cnt++; } n ...
### Prompt Please create a solution in cpp to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { string s; long long num = 0; cin >> s; for (long long i = 0; i <= s.size() - 1; i++) { if (s[i] - '0' == 7 or s[i] - '0' == 4) num++; } if (num == 4 or num == 7) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Generate a Cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lu...
#include <bits/stdc++.h> int lucky(int a) { while (a != 0) { int r = a % 10; a = a / 10; if (!(r == 4 || r == 7)) { printf("NO"); return 2; } else continue; } return 3; } int main() { char a[1000000]; int count = 0; gets(a); for (int i = 0; a[i] != '\0'; i++) { if (a[...
### Prompt Construct a Cpp code solution to the problem outlined: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers a...
#include <bits/stdc++.h> using namespace std; const int inf = (int)(1e9 + 7); const long long INF = (long long)(10e18 + 7); const long double eps = (long double)(1e-9); const int MOD = (int)(1e9 + 7); void solve(); long long power(long long x, long long y, long long mod = MOD) { if (y == 0) { return 1; } if (...
### Prompt Your task is to create a cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int p = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == '4' || s[i] == '7') { p++; } } if (p == 4 || p == 7) { cout << "YES"; } else { cout << "NO"; } }
### Prompt Please formulate a Cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { string s; while (getline(cin, s)) { int count1 = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == '4' || s[i] == '7') count1++; } if (count1 == 4 || count1 == 7) cout << "YES" << endl; else cout << "NO" << endl; } ...
### Prompt Please formulate a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; const int INF = (int)1E9 + 5; const double EPS = 1E-9; const long long MOD = (long long)1E9 + 7; const int dx[] = {-1, 0, 0, 1}; const int dy[] = {0, -1, 1, 0}; string s, tmp; long long cnt; int main() { cin >> s; for (int i = 0; i < (s.length()); i++) if (s[i] == '...
### Prompt In CPP, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; long long len = s.length(); long long count = 0; for (int i = 0; i < len; i++) { if (s[i] == '7' || s[i] == '4') { count++; } } if (count == 4 || count == 7) { cout << "YES" << endl; } else { cout << "NO...
### Prompt Your task is to create a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all ...
#include <bits/stdc++.h> using namespace std; const int N = 100001; vector<int> Edge[N]; vector<int> is(N); void DFS(int u, int time) { is[u] = time; if (Edge[u].size()) for (int v : Edge[u]) { if (is[v] == 0) DFS(v, time); } } int main() { string s; cin >> s; int count = 0; for (int i = 0; i ...
### Prompt Develop a solution in cpp to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; long long k, l, m, n, a, b, c, d, i, s, f; int main() { cin >> n; while (n > 0) { a = n % 10; if (a == 4 || a == 7) k++; n = n / 10; } if (k == 4 || k == 7) cout << "YES"; else cout << "NO"; }
### Prompt Your challenge is to write a cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { string s; int ans = 0; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == '4' || s[i] == '7') ans++; } if (ans == 4 || ans == 7) cout << "YES"; else cout << "NO"; return 0; }
### Prompt In cpp, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long int n; cin >> n; int c = 0; while (n) { int a = n % 10; if (a == 4 || a == 7) ++c; n /= 10; } (c == 4 || c == 7) ? cout << "YES" : cout << "NO"; }
### Prompt Develop a solution in cpp to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); vector<string> split(string input, char c) { stringstream test(input); string segment; vector<string> list; while (getline(test, segment, c)) { list.push_back(segment); } return list; } bool isLucky(string s) { for (int i = 0;...
### Prompt In cpp, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> using namespace std; char code[50]; int main() { scanf("%s", code); int l = strlen(code); int sum = 0; for (int i = 0; i < l; i++) if (code[i] == '4' || code[i] == '7') sum++; if (sum == 4 || sum == 7) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
### Prompt Please provide a CPP coded solution to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { int n = 0; char sepehr[20]; cin >> sepehr; for (int i = 0; i < strlen(sepehr); i++) { if (sepehr[i] == 55) ++n; if (sepehr[i] == 52) ++n; } if (n == 4 || n == 7) cout << "YES" << endl; else cout << "NO" << endl; }
### Prompt In cpp, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; int a; int luck = 0; while (n > 0) { a = n % 10; if ((a == 4) || (a == 7)) luck++; n /= 10; } if ((luck == 4) || (luck == 7)) cout << "YES"; else cout << "NO"; }
### Prompt Construct a CPP code solution to the problem outlined: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers a...
#include <bits/stdc++.h> using namespace std; int main() { string s; int cn = 0; cin >> s; for (int i = 0; s[i] != '\0'; i++) { if (s[i] == '4' || s[i] == '7') cn++; } if (cn == 4 || cn == 7) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
### Prompt Create a solution in Cpp for the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; int i, j, k = 0, l; cin >> n; while (n > 0) { j = n % 10; if (j == 4 || j == 7) k++; n = n / 10; } if (k == 4 || k == 7) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Create a solution in cpp for the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are ...
#include <bits/stdc++.h> int main(void) { char n[20]; int i = 0, flag = 0, sum = 0; scanf("%s", n); while (n[i]) { if (n[i] == '7' || n[i] == '4') sum++; i++; } if (!sum) flag = 1; else while (sum) { if (sum % 10 != 7 && sum % 10 != 4) { flag = 1; break; } ...
### Prompt Please provide a Cpp coded solution to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; using ll = int64_t; using ull = uint64_t; inline void solve() {} int main() { ios::sync_with_stdio(0); cin.tie(0); string s; cin >> s; int lucky = 0; for (auto const &c : s) lucky += c == '4' || c == '7'; bool is_lucky = lucky > 0; while (lucky) { int x ...
### Prompt Please create a solution in CPP to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; long long i, c = 0; for (i = 0; i < s.size(); i++) { if (s[i] == '7' || s[i] == '4') c++; } if (c == 7 || c == 4) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Your task is to create a Cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all ...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; int count = 0; while (n != 0) { if (n % 10 == 4 || n % 10 == 7) { count++; } n /= 10; } if (count == 4 || count == 7) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }
### Prompt Construct a Cpp code solution to the problem outlined: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers a...
#include <bits/stdc++.h> bool isLucky(const int& a) { int n = a; if (n == 0) return 0; else if (n == 4 || n == 7) return 1; else while (n) { if (n % 10 != 4 || n % 10 == 7) return 0; n /= 10; } return 1; } int main() { long long int n = 0; std::cin >> n; bool lucky = isLucky(...
### Prompt In cpp, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string s; int cnt = 0; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == '4' || s[i] == '7') cnt++; } if (cnt == 4 || cnt == 7) cout << "YES\n"; else cout ...
### Prompt Your challenge is to write a Cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; long long n; int cnt; int main() { cin >> n; while (n > 0) { if (n % 10 == 4 || n % 10 == 7) cnt++; n = n / 10; } if (cnt == 4 || cnt == 7) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Please formulate a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; bool isLucky(string ns, int length) { for (int i = 0; i < length; i++) { if (ns[i] != '4' && ns[i] != '7') { return false; } } return true; } int main() { string ns; cin >> ns; int length = ns.size(); int aux = 0; for (int i = 0; i < length; i+...
### Prompt In Cpp, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; int f = 0; while (n) { long long a = n % 10; if (a == 4) f++; if (a == 7) f++; n /= 10; } if (f == 4 || f == 7) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Please provide a cpp coded solution to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { int i, siz, c = 0; string s; cin >> s; siz = s.size(); for (i = 0; i < siz; i++) { if (s[i] == '4' || s[i] == '7') { c++; } else { c = c; } } if (c == 4 || c == 7) cout << "YES"; else cout << "NO"; }
### Prompt Please provide a CPP coded solution to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { string number; long long num = 0; cin >> number; for (char &c : number) { if (c == '7' || c == '4') num++; } number = to_string(num); bool faro = false; for (char &c : number) { if (c != '7' && c != '4') { faro = true; break;...
### Prompt Develop a solution in CPP to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { long long n, s = 0; string ans = "YES"; cin >> n; if (n == 0) ans = "NO"; else { while (n != 0) { if ((n % 10 == 4) || (n % 10 == 7)) s++; n = n / 10; } if (s == 0) ans = "NO"; else { while (s != 0) { ...
### Prompt Your challenge is to write a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long nbluckynumber = 0; long long copie = n; while (copie) { if (copie % 10 == 4 || copie % 10 == 7) nbluckynumber++; copie /= 10; } if (nbluckynumber == 0) { cout << "NO" << endl; return 0; } bool a...
### Prompt Please provide a Cpp coded solution to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); string s; int flag = 0, cnt = 0; cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == '4' || s[i] == '7') flag++; } if (flag == 4 || flag == 7) cout << "YES\n"; else cout << "NO\n"; re...
### Prompt Construct a cpp code solution to the problem outlined: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers a...
#include <bits/stdc++.h> using namespace std; bool check(int n) { if (n == 0) { return false; } while (n) { int temp = n % 10; if (temp != 4 && temp != 7) { cerr << "temp" << ": " << temp << "\n"; cerr << "n" << ": " << n << "\n"; return false; } n = n /...
### Prompt Develop a solution in Cpp to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { string n; cin >> n; int count = 0; int len = n.length(); for (int i = 0; i < len; i++) { if ((n[i] == '7') || (n[i] == '4')) { count++; } } if (count == 7 || count == 4) { cout << "YES" << "\n"; } else { cout << "N...
### Prompt In Cpp, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> using namespace std; string s; int ln; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; cin >> s; for (char c : s) { if (c == '7') ln++; else if (c == '4') ln++; } if (ln == 4 || ln == 7) cout << "YES" << '\n'; else cout << "NO" << '...
### Prompt Please provide a cpp coded solution to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; void dctobin(int n) { int ans = 0, p = 1; while (n > 0) { int lastbit = (n & 1); ans += p * lastbit; p = p * 10; n = n >> 1; } cout << ans << endl; } int main() { long long n; cin >> n; int count = 0; while (n != 0) { if (n % 10 == 4 || n...
### Prompt Develop a solution in cpp to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; int r, f = 0; cin >> n; while (n != 0) { r = n % 10; if (r == 4 || r == 7) f += 1; n = n / 10; } if (f == 4 || f == 7) cout << "YES" << endl; else cout << "NO" << endl; }
### Prompt Develop a solution in cpp to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int cnt = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == '4' || s[i] == '7') { cnt++; } } if (cnt == 4 || cnt == 7) cout << "YES" << endl; else cout << "NO\n" << endl; return 0; }
### Prompt Construct a CPP code solution to the problem outlined: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers a...
#include <bits/stdc++.h> using namespace std; int main() { string x; cin >> x; int count = 0; for (int i = 0; i < x.size(); i++) { if (x[i] == '7' || x[i] == '4') count++; } if (count == 7 || count == 4) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
### Prompt Generate a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lu...
#include <bits/stdc++.h> using namespace std; int main() { int i, c = 0; string x; cin >> x; for (i = 0; i < x.size(); i++) { if (x[i] == '4' || x[i] == '7') { c++; } } if (c == 4 || c == 7) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
### Prompt Your task is to create a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all ...
#include <bits/stdc++.h> using namespace std; int main() { int n = 0; char str[30]; scanf("%s", str); int l = strlen(str); for (int i = 0; i < l; i++) if (str[i] == '4' || str[i] == '7') { ++n; } if (n == 4 || n == 7) printf("YES\n"); else printf("NO\n"); return 0; }
### Prompt Construct a cpp code solution to the problem outlined: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers a...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int c = 0; string res; for (int i = 0; i < s.size(); i++) { if (s[i] == '4' || s[i] == '7') c++; } res = to_string(c); for (int i = 0; i < res.size(); i++) { if (res[i] != '7' && res[i] != '4') { cout << "NO"; ...
### Prompt In CPP, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> int main() { int c = 0; long long int a; scanf("%lld", &a); while (a != 0) { if ((a % 10 == 4) || (a % 10 == 7)) { c++; } a = a / 10; } if ((c == 4) || (c == 7)) printf("YES"); else printf("NO"); return 0; }
### Prompt Please create a solution in CPP to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; short isLucky(unsigned long long n) { short status = 1; if (n == 0) status = 0; while (n != 0) { if (n % 10 == 4 or n % 10 == 7) ; else status = 0; n /= 10; } return status; } int main() { unsigned long long n, count = 0; cin >> n; wh...
### Prompt Please formulate a Cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int cant_ln(string x) { int n = x.size(); int cont = 0; for (int i = 0; i < n; i++) { if (x[i] == '4' || x[i] == '7') { cont++; } } return cont; } int main() { string n; cin >> n; if (cant_ln(n) == 4 || cant_ln(n) == 7) cout << "YES"; els...
### Prompt Your challenge is to write a Cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { long long n; int digit, lucky = 0; cin >> n; while (n != 0) { digit = n % 10; n = n / 10; if (digit == 4 || digit == 7) { lucky++; } } if (lucky == 4 || lucky == 7) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Please provide a cpp coded solution to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { string n; int x = 0, l, f = 0; cin >> n; l = n.length(); for (int i = 0; i < l; i++) if (n.at(i) == '4' || n.at(i) == '7') x++; n = to_string(x); l = n.length(); for (int i = 0; i < l; i++) if (n.at(i) != '7' && n.at(i) != '4') { f...
### Prompt Please provide a Cpp coded solution to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { int count = 0; long long int n; cin >> n; while (n > 0) { if (n % 10 == 7 || n % 10 == 4) { count++; } n = n / 10; } if (count == 4 || count == 7) { cout << "YES"; } else { cout << "NO"; } }
### Prompt Your challenge is to write a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { char x[20]; cin >> x; int count = 0; for (int i = 0; i < strlen(x); i++) if (x[i] == '7' || x[i] == '4') count++; if (count == 4 || count == 7) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Please formulate a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { long long x; int c = 0; cin >> x; while (x != 0) { if ((x % 10) == 7 || (x % 10) == 4) { c++; } x = x / 10; } if (c == 7 || c == 4) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }
### Prompt Construct a CPP code solution to the problem outlined: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers a...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; long long n = s.size(); long long count = 0; for (int i = 0; i < n; i++) { if (s[i] == '4' || s[i] == '7') { count += 1; } } if (count == 7 || count == 4) cout << "YES"; else cout << "NO"; return 0; }
### Prompt In cpp, your task is to solve the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are...
#include <bits/stdc++.h> using namespace std; int main() { string s, a; cin >> s; int i, dem = 0; for (i = 0; i < s.length(); i++) { if (s[i] == '4' || s[i] == '7') dem++; } if (dem == 4 || dem == 7) cout << "YES\n"; else cout << "NO\n"; }
### Prompt Please create a solution in CPP to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { long long n; int c = 0, d; cin >> n; while (n) { d = n % 10; n = n / 10; if (d == 4 || d == 7) c++; } if (c == 4 || c == 7 || c == 14) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Your task is to create a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; int cnt = 0; while (n) { int tmp = n % 10; n = n / 10; if (tmp == 4 || tmp == 7) cnt++; } if (cnt == 4 || cnt == 7) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Construct a Cpp code solution to the problem outlined: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers a...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i, cnt = 0, cnt1 = 0; cin >> n; while (n > 0) { if (n % 10 == 4) { cnt++; } if (n % 10 == 7) { cnt1++; } n = n / 10; } if (cnt + cnt1 == 4 || cnt1 + cnt == 7) { cout << "YES" << endl; return 0; ...
### Prompt Create a solution in CPP for the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are ...
#include <bits/stdc++.h> int main() { int64_t n; std::cin >> n; int count = 0; while (n != 0) { if ((n % 10 == 4 || n % 10 == 7) ? true : false) count++; n /= 10; } if ((count == 4 || count == 7) ? true : false) std::cout << "YES"; else std::cout << "NO"; }
### Prompt Please provide a CPP coded solution to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int x = s.size(), c = 0; for (int i = 0; i < x; i++) { if (s[i] == '7' || s[i] == '4') { c++; } } if (c == 7 || c == 4 || c == 47 || c == 744) { cout << "YES" << endl; } else { cout << "NO" << endl; } ...
### Prompt Create a solution in cpp for the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are ...
#include <bits/stdc++.h> using namespace std; string s; int main() { cin >> s; int sum = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == '4' || s[i] == '7') { sum++; } } if (sum == 4 || sum == 7) cout << "YES\n"; else cout << "NO\n"; return 0; }
### Prompt Please create a solution in CPP to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { long long int x, l = 0, m; cin >> x; while (x != 0) { m = x % 10; if (m == 4 || m == 7) l++; x /= 10; } if (l == 4 || l == 7) cout << "YES" << endl; else cout << "NO" << endl; }
### Prompt Please create a solution in CPP to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int r = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == '4' or s[i] == '7') { r++; } } if (r == 4 or r == 7) { cout << "YES"; } else { cout << "NO"; } return 0; }
### Prompt Your challenge is to write a cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...
#include <bits/stdc++.h> int main() { long long int n; scanf("%lld", &n); long long int rem, k = 0; while (n) { rem = n % 10; if (rem == 4 || rem == 7) { k++; } n = n / 10; } if (k == 4 || k == 7) { printf("YES"); } else { printf("NO"); } }
### Prompt Develop a solution in cpp to the problem described below: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all number...
#include <bits/stdc++.h> using namespace std; int main() { string n; int a = 0; cin >> n; for (int i = 0; i < n.size(); i++) if (n[i] == '4' || n[i] == '7') a++; if (a == 4 || a == 7) cout << "YES"; else cout << "NO"; return 0; }
### Prompt Your challenge is to write a cpp solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not ...