output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); inline int64_t rnd(int64_t l = 0, int64_t r = INT_MAX) { return uniform_int_distribution<int64_t>(l, r)(rng); } bool in_range(int64_t x, int64_t l, int64_t r) { return l <= x && x <= r; } template <typen...
### Prompt Develop a solution in cpp to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, t, flag, i, j; while (~scanf("%d %d", &a, &b)) { i = 0; flag = 0; while (i <= 100001) { if (a % b == 0) { flag = 1; break; } else { a += a % b; a %= b; } i++; } if (flag) ...
### Prompt Please formulate a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { map<int, bool> mp; int a, m, md; cin >> a >> m; while (1) { md = a % m; if (!md) { cout << "Yes" << endl; break; } else { if (mp[md]) { cout << "No" << endl; break; } else { a = md + md; ...
### Prompt Develop a solution in CPP to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k; int m, V[100000]; long long int a; scanf("%I64d %d", &a, &m); memset(V, 0, sizeof(V)); while (a % m != 0) { if (V[a % m] > 0) { puts("No"); return 0; } V[a % m]++; a = a + (a % m); } puts("Yes"); return...
### Prompt Please provide a cpp coded solution to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int main() { int a, m, mod; cin >> a >> m; for (int i = 0; i < 500; i++) { mod = a % m; a += mod; if (mod == 0) break; } if (mod == 0) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
### Prompt Your challenge is to write a cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; unsigned long long x, m, cnt; bool check[N]; bool Solve() { while (1) { x = x + x % m; if (x % m == 0) return true; int Left = x % m; if (!check[Left]) check[Left] = true; else return false; } } int main() { cin >...
### Prompt Develop a solution in CPP to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b; cin >> a >> b; for (int i = 1; i < 25; i++) { a = a * 2; if (a % b == 0) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
### Prompt Generate a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (rem...
#include <bits/stdc++.h> using namespace std; int main() { long long int a, m; cin >> a >> m; while (m % 2 == 0) m /= 2; cout << (a % m == 0 ? "Yes" : "No"); return 0; }
### Prompt Create a solution in CPP for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> using namespace std; int main() { long long a, m; cin >> a >> m; for (int i = 0; i < 100; i++) { if (a % m == 0) { cout << "Yes"; return 0; } a += a % m; } cout << "No"; }
### Prompt Your task is to create a cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produc...
#include <bits/stdc++.h> int main() { int a, m, p; scanf("%d %d", &a, &m); for (int i = 0; a <= 10000000; i++) { p = a % m; if (p == 0) { printf("Yes"); break; } a = a + p; } if (a >= 10000000 && p != 0) { printf("No"); } return 0; }
### Prompt Your task is to create a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produc...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:102400000,102400000") using namespace std; const int INF = 0x3f3f3f3f; const long long INFF = 0x3f3f; const double pi = acos(-1.0); const double inf = 1e18; const double eps = 1e-8; const long long mod = (long long)1e9 + 7; const unsigned long long mx = 133333331...
### Prompt In Cpp, your task is to solve the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (...
#include <bits/stdc++.h> using namespace std; int main() { long long a, m; cin >> a >> m; for (int i = 0; i < 32; i++) { if ((a * (1LL << i)) % m == 0) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
### Prompt Develop a solution in CPP to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; long long int f[100005]; int main() { long long a, m, i, sum = 0; cin >> a >> m; int flag = 0; while (1) { if (a % m == 0) { flag = 1; break; } else { long long temp = a % m; if (f[temp] == 1) { flag = 0; break; ...
### Prompt Create a solution in cpp for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> const int M = 1e5 + 10; using namespace std; int main() { long long a, m; while (cin >> a >> m) { int t = 0, ok = 1; while (t < m) { a += a % m; if (a % m == 0) { printf("Yes\n"); ok = 0; break; } t++; } if (ok) printf("No\n");...
### Prompt In CPP, your task is to solve the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (...
#include <bits/stdc++.h> using namespace std; int main() { long long a, m; cin >> a >> m; long long MAX = a + 9999997; long long cnt = 0; while (cnt <= MAX) { long long x = a % m; if ((x + a) % m == 0) { cout << "Yes" << endl; return 0; } else a += x; cnt++; } cout << "No...
### Prompt Please provide a Cpp coded solution to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; unordered_map<int, int> fact(int n) { unordered_map<int, int> f; for (int d = 2; d * d <= n; ++d) { while (n % d == 0) { f[d]++; n /= d; } } if (n > 1) { f[n]++; } return f; } int main() { ios_base::sync_with_stdio(false); cin.tie(NUL...
### Prompt Please formulate a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int64_t A; int M; cin >> A >> M; int op_count = max(2 * M, 10); for (int i = 0; i < op_count; ++i) { int add = A % M; if (add == 0) { cout << "Yes" << '\n'; return 0; } A += add; } co...
### Prompt Create a solution in cpp for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> int a, m; int mark[100005]; int main() { scanf("%d %d", &a, &m); while (true) { if (!mark[a]) { mark[a] = 1; if (a % m == 0) { printf("Yes"); return 0; } a = (a + a % m) % m; } else break; } printf("No"); return 0; }
### Prompt In cpp, your task is to solve the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (...
#include <bits/stdc++.h> using namespace std; long long int ABS(long long int a) { if (a < 0) return (-a); return a; } const int v5 = 100000; const int v9 = 1000000000; const int v6 = 1000000; long long int n, m, k, c = 0; int a[100001]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(N...
### Prompt Create a solution in CPP for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> using namespace std; long long a, m, b[10000005]; int main() { cin >> a >> m; for (int i = 1; i <= m; i++) { if (a % m == 0) { cout << "Yes" << endl; return 0; } b[a % m]++; if (b[a % m] == 2) { cout << "No" << endl; return 0; } a += a % m; ...
### Prompt In cpp, your task is to solve the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (...
#include <bits/stdc++.h> using namespace std; int main() { int a, m; cin >> a >> m; if (a % m == 0) { cout << "Yes"; return 0; } a %= m; bool vis[m + 1]; for (int i = 0; i <= m; i++) vis[i] = false; vis[a] = true; int temp = (a + a % m) % m; while (!vis[temp]) { if (temp % m == 0) { ...
### Prompt Your task is to create a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produc...
#include <bits/stdc++.h> using namespace std; int main() { int a, m; cin >> a >> m; bool flag = false; int t = m; while (t--) { if ((a + a % m) % m == 0) { flag = true; } else { a = (a + a % m) % m; } } if (flag) { cout << "Yes" << endl; } else { cout << "No" << endl; }...
### Prompt Your challenge is to write a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int main() { int a, m; cin >> a >> m; map<int, int> exist; int flag = 1; for (int i = 0; i < a; i++) { int k = a % m; if (k == 0) { flag = 0; break; } if (exist.find(k) == exist.end()) { exist[k]++; a = a + k; } else { ...
### Prompt Create a solution in Cpp for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> using namespace std; int main() { long long a, m; cin >> a >> m; long long x = 1LL; while (x < m) { x = x * 2; } long long y = (x * a) % m; if (y == 0) cout << "Yes"; else cout << "No"; }
### Prompt Create a solution in cpp for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const int maxn = 100010; const double eps = 1e-8; const int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; const int mod = 1000000007; const int inf = 0x3fffffff; const double pi = acos(-1.0); int n, m, vis[maxn]; int...
### Prompt Please create a solution in CPP to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; long long power(long long x, long long y) { long long res = 1; x = x % mod; while (y > 0) { if (y & 1) res = (res * x) % mod; y = y >> 1; x = (x * x) % mod; } return res; } long long ncr(long long n, long long r) { l...
### Prompt Please create a solution in cpp to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long a, m; cin >> a >> m; for (int i = 1; i <= m; i++) { if (a % m == 0) { printf("Yes\n"); return 0; } else { a += (a % m); } } printf("No\n"); }
### Prompt In Cpp, your task is to solve the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (...
#include <bits/stdc++.h> using std::cin; using std::cout; int main() { int a, m; cin >> a >> m; a %= m; bool can = false; for (int i = 0; i < 1e7; i++) { a *= 2; if (a >= m) a -= m; if (a == 0) { can = true; break; } } if (can) cout << "Yes"; else cout << "No"; cout...
### Prompt Please create a solution in Cpp to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { long long int a, m; cin >> a >> m; long long int flag = 0; for (long long int i = 0; i < m; i++) { a += (a % m); if (a % m == 0) { flag = 1; break; } } if (flag == 1) cout << "Yes" << endl; else cout << "No" << endl...
### Prompt Your challenge is to write a cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int main() { long long int i = 0, j, k, n, m; cin >> n >> m; long long int arr[100005] = {0}; while (1) { k = n % m; if (k == 0) { i = 1; break; } else { if (arr[k] > 0) break; arr[k]++; n = n + k; } } if (i == 1) ...
### Prompt In cpp, your task is to solve the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int a, m; cin >> a >> m; a %= m; set<int> s; while (!s.count(a)) { s.insert(a); a = (a + a % m) % m; } cout << (*s.begin() == 0 ? "Yes\n" : "No\n"); }
### Prompt Construct a Cpp code solution to the problem outlined: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image>...
#include <bits/stdc++.h> int vis[100005]; int main() { int a, m; scanf("%d%d", &a, &m); while (1) { if (vis[a]) break; else { vis[a] = 1; } if (a == 0) { printf("Yes\n"); return 0; } else { a = (a + a) % m; } } printf("No\n"); }
### Prompt Please formulate a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int tab[100001]; int main() { long long a, m; cin >> a >> m; while (true) { if (a % m == 0) { cout << "Yes"; return 0; } if (tab[a % m] == 1) { cout << "No"; return 0; } tab[a % m] = 1; a = a + a % m; } }
### Prompt Develop a solution in cpp to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { int a, m; cin >> a >> m; long long x = a; for (int i = 0; i < 100000; ++i) { if (x % m == 0) { cout << "Yes" << endl; return 0; } x = x + x % m; } cout << "No" << endl; return 0; }
### Prompt Develop a solution in CPP to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { long long start, m; bool answer = false; cin >> start >> m; for (int day = 0; day < 100000; ++day) { if ((start % m) == 0) { answer = true; break; } start += (start % m); } if (answer) cout << "Yes" << endl; else co...
### Prompt Please provide a Cpp coded solution to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int a, m; int main() { cin >> a >> m; while (a <= 10000000) { a += a % m; if (a % m == 0) { printf("Yes"); return 0; } } printf("No"); return 0; }
### Prompt Develop a solution in cpp to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; template <class T> T sqr(T x) { return x * x; } template <class T> T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a % b) : a); } template <class T> T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); } template <class T> inline T bigmod(T p, T e, T M) { if (e == 0) retur...
### Prompt Your task is to create a cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produc...
#include <bits/stdc++.h> int main() { int a, b; int temp; scanf("%d%d", &a, &b); while (a <= 6000005) { temp = a % b; if (temp == 0) { printf("Yes\n"); return 0; } a += temp; } printf("No\n"); return 0; }
### Prompt Generate a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (rem...
#include <bits/stdc++.h> using namespace std; int read_int() { char r; bool start = false, neg = false; long long int ret = 0; while (true) { r = getchar(); if ((r - '0' < 0 || r - '0' > 9) && r != '-' && !start) { continue; } if ((r - '0' < 0 || r - '0' > 9) && r != '-' && start) { ...
### Prompt Develop a solution in Cpp to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int32_t main() { long long a, m; cin >> a >> m; long long iter = 21; while (iter--) { if (a % m == 0) { puts("Yes"); return 0; } a = a + a % m; } puts("No"); }
### Prompt Your task is to create a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produc...
#include <bits/stdc++.h> using namespace std; bool vis[100001]; int main() { long long a, m; cin >> a >> m; while (true) { a += (a % m); if (a % m == 0) { cout << "Yes" << endl; return 0; } if (vis[a % m] == true) { cout << "No\n"; return 0; } vis[a % m] = true; }...
### Prompt Please provide a cpp coded solution to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using ll = long long; constexpr ll MOD = (ll)(1e8); using namespace std; ll a, m; int main() { bool ok = false; cin >> a >> m; for (int i = 1; i <= 1e5; i++) { if (a % m == 0) ok = true; a += (a % m); } if (ok) cout << "Yes" << endl; else cout << "No" << endl; retu...
### Prompt Construct a CPP code solution to the problem outlined: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image>...
#include <bits/stdc++.h> using namespace std; int main() { long long a, m, ans = 0; cin >> a >> m; for (int i = 0; i < m; i++) { ans = a % m; if (ans == 0) { cout << "Yes" << '\n'; return 0; } a = a + ans; } cout << "No" << '\n'; return 0; }
### Prompt Construct a CPP code solution to the problem outlined: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image>...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long double pi = acos(-1); const int MOD = 1e9 + 7; int main() { long long int a, m; cin >> a >> m; for (int i = 0; i < 1e7; i++) { if (a % m == 0) { puts("Yes"); return 0; } a = a + (a % m); } puts("No"); ...
### Prompt Develop a solution in cpp to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; bool is[110000]; int a, m; int main() { while (cin >> a >> m) { a %= m; memset(is, 0, sizeof(is)); for (int i = a % m; is[i] == false; i = (2 * i) % m) is[i] = true; if (is[0]) cout << "Yes\n"; else cout << "No\n"; } return 0; }
### Prompt In cpp, your task is to solve the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (...
#include <bits/stdc++.h> using namespace std; int main() { int a, b; scanf("%d%d", &a, &b); int i, temp = 1; for (i = 1; i <= 18; ++i) { temp *= 2; if (a * temp % b == 0) { printf("Yes\n"); return 0; } } printf("No\n"); return 0; }
### Prompt Your task is to create a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produc...
#include <bits/stdc++.h> int oc[100001] = {0}; int main() { int a, m; scanf("%d %d", &a, &m); while (1) { oc[a] = 1; if (!a) { printf("Yes"); return 0; } a += a; a %= m; if (oc[a] == 1) break; } printf("No"); return 0; }
### Prompt Generate a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (rem...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long a, m; cin >> a >> m; for (int i = 0; i < m; i++) { if (a % m == 0) { cout << "Yes" << endl; return 0; } a += (a % m); } cout << "No" << endl; }
### Prompt Please provide a Cpp coded solution to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int a[1000001]; int main() { int n, m, i = 30; set<int> s; cin >> n >> m; while (i--) { if (n % m == 0) { cout << "Yes"; return 0; } else if (s.find(n) != s.end()) { cout << "No"; return 0; } else { s.insert(n); n += (...
### Prompt Create a solution in cpp for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; bool v[maxn]; int main() { int a, m; memset(v, 0, sizeof(v)); scanf("%d%d", &a, &m); int flag = 0; while (1) { if (a % m == 0) { flag = 1; break; } else if (v[a % m]) break; v[a % m] = 1; a = a + a % m; ...
### Prompt Create a solution in cpp for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> int main() { long long a, m, c, i; scanf("%I64d %I64d", &a, &m); for (i = 0; i <= 700; i++) { c = a % m; if (c == 0) break; a = a + c; } if (c == 0) { printf("Yes"); } else printf("No"); return 0; }
### Prompt Create a solution in CPP for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> using namespace std; int main() { int a, m; set<int> s; while (cin >> a >> m) { s.clear(); while (1) { if (a == 0) { cout << "Yes" << endl; break; } else if (s.count((a + a) % m)) { cout << "No" << endl; break; } else { a =...
### Prompt In cpp, your task is to solve the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (...
#include <bits/stdc++.h> using namespace std; int main() { long long int a, m; cin >> a >> m; long long int num = a; int visited[100005]; memset(visited, 0, sizeof visited); while (true) { if (visited[num % m]) break; if (num % m == 0) { cout << "Yes" << endl; return 0; } visited...
### Prompt Please formulate a cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; long long a, m, i; int main() { cin >> a >> m; for (i = 0; i < m; i++) { a += a % m; if ((a % m) == 0) { printf("Yes\n"); return 0; } } printf("No\n"); return 0; }
### Prompt Generate a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (rem...
#include <bits/stdc++.h> using namespace std; int main() { long long int a, m; cin >> a >> m; for (int i = 0; i <= m; i++) { if (a % m == 0) { cout << "Yes" << endl; return 0; } a += a % m; } cout << "No" << endl; }
### Prompt Please provide a cpp coded solution to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int main() { long long a, m; cin >> a >> m; for (long long i = 0; i <= (log2(m)); i++) { long long pr = pow(2.0, i) * a; if (pr % m == 0) { cout << "Yes\n"; return 0; } } cout << "No\n"; return 0; }
### Prompt Generate a cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (rem...
#include <bits/stdc++.h> using namespace std; template <class T> inline T modinv(T a, T n) { T i = n, v = 0, d = 1; while (a > 0) { T t = i / a, x = a; a = i % x; i = x; x = d; d = v - t * x; v = x; } return (v + n) % n; } long long modpow(long long n, long long k, long long mod) { lon...
### Prompt In cpp, your task is to solve the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int a, m; cin >> a >> m; a = a % m; while (m % 2 == 0) { m = m / 2; } if (a % m == 0) { cout << "Yes"; } else { cout << "No"; } return 0; }
### Prompt Construct a CPP code solution to the problem outlined: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image>...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; cin >> n >> m; long long r = 100, x = n; while (r--) { if (x % m == 0) { cout << "Yes" << "\n"; return 0; } x += x % m; } { cout << "No" << "\n"; return 0; } }
### Prompt Construct a cpp code solution to the problem outlined: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image>...
#include <bits/stdc++.h> using namespace std; template <class T> inline T sqr(T x) { return x * x; } template <class T> inline T cube(T x) { return x * x * x; } template <class T> inline T powr(T x, T y) { T ret = 1; while (y--) ret *= x; return ret; } template <class T> inline T mod(T a, T b) { return (a %...
### Prompt Please provide a cpp coded solution to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int n, m, viz[1000010]; int main() { cin >> n >> m; n %= m; while (1) { if (!n) { cout << "Yes"; return 0; } if (viz[n]) { cout << "No"; return 0; } viz[n] = 1; n += n % m; n %= m; } return 0; }
### Prompt Develop a solution in CPP to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> int main() { long long int a, m, mod, t, i; int vis[100000]; scanf("%I64d", &a); scanf("%I64d", &m); for (i = 0; i < m; i++) vis[i] = 0; mod = a % m; while (mod != 0 && vis[mod] == 0) { vis[mod] = 1; a = a + mod; mod = a % m; } if (mod == 0) printf("Yes\n"); ...
### Prompt Generate a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (rem...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (a % b == 0) return b; else return gcd(b, a % b); } int main() { long long int a, m, flag = 0, hash[100005], i, j; cin >> a >> m; for (i = 0; i < m; i++) hash[i] = 0; while (1) { if (a % m == 0) { flag = 1; brea...
### Prompt Please provide a cpp coded solution to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int aa[100005]; int main() { long long a, m; cin >> a >> m; if (a % m == 0) cout << "Yes"; else { long long bbb; long long begin = a; long long produce = a % m; long long end = begin + produce; long long sign = 0; while (1) { if (pr...
### Prompt Generate a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (rem...
#include <bits/stdc++.h> using namespace std; int main() { int a, m; cin >> a >> m; while (a <= 1e8) { a += a % m; if (a % m == 0) cout << "Yes", exit(0); } cout << "No" << endl; }
### Prompt Your task is to create a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produc...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); long long a, m; bool stop = 0; cin >> a >> m; map<long long, long long> m1; while (true) { long long x = a % m; if (x == 0) { stop = 1; break; } if (m1[x] == 1) { brea...
### Prompt Your challenge is to write a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> int main() { int a, b; scanf("%d%d", &a, &b); while ((b % 2) == 0) { b /= 2; } if (a % b == 0) { printf("Yes\n"); } else { printf("No\n"); } return 0; }
### Prompt Construct a Cpp code solution to the problem outlined: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image>...
#include <bits/stdc++.h> void dout() { printf("\n"); } template <typename Head, typename... Tail> void dout(Head H, Tail... T) {} template <typename T> std::string toString(T val) { std::ostringstream oss; oss << val; return oss.str(); } template <typename T> T fromString(const std::string& s) { std::istringstr...
### Prompt Create a solution in cpp for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(0); cin.tie(0); long long a, m; cin >> a >> m; set<long long> s; while (s.find(a) == s.end()) { s.insert(a); a = (a + a % m) % m; } if (s.find(0) != s.end()) cout << "Yes"; else cout << "No"; }
### Prompt Create a solution in CPP for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> using namespace std; long long a, m; bool mark[100001]; int main() { cin >> a >> m; memset(mark, 0, sizeof(mark)); a %= m; mark[a] = true; while (true) { a = (a * 2) % m; if (a == 0) { cout << "Yes"; break; } if (mark[a]) { cout << "No"; break; ...
### Prompt Please formulate a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, x; cin >> n >> x; if (n % x == 0) return printf("Yes\n"), 0; long long int result = 100000; long long int _count = 0; while (result--) { n = n + (n % x); if (n % x == 0) return printf("Yes\n"), 0; } printf("No\n"); ret...
### Prompt Please formulate a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { int a, n; int arr[100005]; memset(arr, 0, sizeof(arr)); cin >> a >> n; while (1) { if (arr[a] == 1) { cout << "No\n"; break; } if (a % n == 0) { cout << "Yes\n"; break; } arr[a] = 1; a = (a + a) % n; }...
### Prompt Please formulate a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); long long int i, j, k, l, a, b, c, d, t, flag = 0, n; cin >> a >> b; c = max(a, b); while (a <= c * c) { if (a % b == 0) { flag = 1; } a = a * 2; } if (flag == 1) { cout << "Yes" << endl; } else...
### Prompt Please formulate a cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int n, m, i = 0; int main() { cin >> n >> m; while (n % m != 0 && i < m) { n = (n + (n % m)) % m; i++; } if (n % m == 0) cout << "Yes"; else cout << "No"; return 0; }
### Prompt Construct a CPP code solution to the problem outlined: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image>...
#include <bits/stdc++.h> int main() { long int x, m, c = 0, day; scanf("%d%d", &x, &m); for (day = 1; day <= 1000; day++) { x += (x % m); if (x % m == 0) { printf("Yes\n"); break; } c++; } if (c == 1000) printf("No\n"); }
### Prompt Your challenge is to write a cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int main() { int a, m, x, t[100010] = {0}; cin >> a >> m; a = a % m; t[a]++; while ((t[(a + a % m) % m] == 0) && (t[0] == 0)) { a = (a + a % m) % m; t[a]++; } if (t[0] != 0) cout << "Yes"; else cout << "No"; return 0; }
### Prompt In cpp, your task is to solve the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (...
#include <bits/stdc++.h> using namespace std; int main() { int num, num1, res; int limit = 1000; scanf("%d %d", &num, &num1); while (limit--) { res = num % num1; if (res == 0) { printf("Yes\n"); return 0; } num += res; } printf("No\n"); return 0; }
### Prompt Please formulate a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int compare(const void* a, const void* b) { const long long* x = (long long*)a; const long long* y = (long long*)b; if (*x > *y) return 1; else if (*x < *y) return -1; return 0; } void solve() { long long a, n; scanf("%lld%lld"...
### Prompt Your task is to create a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produc...
#include <bits/stdc++.h> using namespace std; int main() { int a, m; cin >> a >> m; int stop = 0; for (int i = 0; i < m; i++) { a = a + a % m; a %= m; if (a % m == 0) { stop = 1; } } if (stop) printf("Yes\n"); else printf("No\n"); }
### Prompt Your challenge is to write a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; const int N = 111111; const int INF = 1000000000, mod = 1000000007; const long long LLINF = 1000000000000000000ll; bool used[N]; int main() { long long fst, x, y; cin >> x >> y; if (x % y == 0) { cout << "Yes"; return 0; } while (!used[x % y]) { used[x...
### Prompt Please formulate a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { int a, m, rem; cin >> a >> m; int lim = 100; bool flag = false; while (lim--) { rem = a % m; if (rem == 0) { cout << "Yes"; flag = true; break; } a += rem; } if (flag == false) { cout << "No"; } return 0; ...
### Prompt Create a solution in CPP for the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (r...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long a, m; cin >> a >> m; for (int i = 0; i < m; i++) { if (a % m == 0) { cout << "Yes" << endl; return 0; } a = a + a % m; } cout << "No" << endl; }
### Prompt Please create a solution in cpp to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18; int main() { ios::sync_with_stdio(0); cin.tie(0); long long n, m; cin >> n >> m; for (int i = 1;; i++) { if (n % m == 0) { cout << "Yes" << '\n'; return 0; } if (i == 1e6) break; n += n % m; } cout << "No...
### Prompt Develop a solution in cpp to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; template <typename T> ostream& operator<<(ostream& output, vector<T>& v) { output << "[ "; if (int(v.size())) { output << v[0]; } for (int i = 1; i < int(v.size()); i++) { output << ", " << v[i]; } output << " ]"; return output; } template <typename T1...
### Prompt In cpp, your task is to solve the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (...
#include <bits/stdc++.h> using namespace std; const int INF = 2147483647, MOD = 1000 * 1000 * 1000 + 7; const double eps = 1e-8; void Error(string err) { cout << err; cerr << "_" << err << "_"; exit(0); } int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); } const int sz = 100 * 1000; int main() { int ...
### Prompt Please formulate a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; const int N = 1e5; bool used[N + 1]; int main() { int a, m, now; cin >> a >> m; now = a; used[now] = 1; while (1) { if (now % m == 0) { cout << "Yes" << endl; return 0; } now = (now + (now % m)) % m; if (used[now]) { cout << "No" ...
### Prompt Develop a solution in cpp to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { int a, m; cin >> a >> m; while (m % 2 == 0) m /= 2; if (a % m == 0) cout << "Yes"; else cout << "No"; return 0; }
### Prompt Your challenge is to write a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int main() { int a, m; cin >> a >> m; set<int> s; int t = a; int cur; while (true) { int remain = t % m; if (remain == 0) { cout << "Yes" << endl; return 0; } cur = s.size(); s.insert(remain); if (s.size() == cur) { cout...
### Prompt Please provide a cpp coded solution to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> int main() { int a, b; int vis[111111] = {0}; scanf("%d%d", &a, &b); while (1) { if (a == 0) { printf("Yes\n"); return 0; } if (vis[a] == 1) { printf("No\n"); return 0; } vis[a] = 1; a = (a + a) % b; } return 0; }
### Prompt Construct a CPP code solution to the problem outlined: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image>...
#include <bits/stdc++.h> using namespace std; bool fun(int m) { while (m) { if (m == 1) break; if (m % 2 != 0) return 0; m /= 2; } return 1; } int gcd(int a, int b) { if (a < b) swap(a, b); return b == 0 ? a : gcd(b, a % b); } int main() { int a, m; scanf("%d%d", &a, &m); int flag = 0; if ...
### Prompt Your task is to create a cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produc...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; cin >> n >> m; long long f = 1; for (long long i = 0; i < 100000; i++) { n += (n % m); if (n % m == 0) { f = 0; break; } } if (!f) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
### Prompt Construct a cpp code solution to the problem outlined: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image>...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int a, m; cin >> a >> m; vector<bool> aa(1e6); aa[a % m] = true; int next = (a + a % m) % m; bool found = (a % m == 0); while (!found && !aa[next]) { aa[next] = true; next = (next + next % m) % m; fo...
### Prompt Generate a Cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (rem...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int a, m; cin >> a >> m; while (m % 2 == 0) { m /= 2; } if (a % m == 0) { cout << "Yes"; } else { cout << "No"; } return 0; }
### Prompt Please create a solution in Cpp to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; template <class T> inline T modinv(T a, T n) { T i = n, v = 0, d = 1; while (a > 0) { T t = i / a, x = a; a = i % x; i = x; x = d; d = v - t * x; v = x; } return (v + n) % n; } long long modpow(long long n, long long k, long long mod) { lon...
### Prompt Please formulate a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; const int N = 1010; long long a, m; int main() { scanf("%lld%lld", &a, &m); int sum = 0; while (sum <= 1e7) { if (a % m == 0) return 0 * puts("Yes"); a = a + a % m; sum++; } puts("No"); }
### Prompt Generate a cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <image> (rem...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int a, m, rem = 0; int temp, flag = 0; cin >> a >> m; temp = a; rem = temp % m; int first = rem; for (int i = 0; i <= 100; i++) { temp += rem; rem = temp % m; if (rem == 0) { cout << "Yes\n"; ...
### Prompt Please create a solution in CPP to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { for (int a, m; cin >> a >> m;) { long long prod = a; map<long long, int> used; while (prod % m != 0 && prod > 0) { prod = (prod + prod) % m; if (used[prod]) break; used[prod] = 1; } if (prod % m == 0 || prod < 0) co...
### Prompt Your challenge is to write a CPP solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; while (a % 2 == 0) a /= 2; while (b % 2 == 0) b /= 2; if (a % b == 0) cout << "Yes"; else cout << "No"; return 0; }
### Prompt Please create a solution in Cpp to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce <ima...
#include <bits/stdc++.h> using namespace std; int main() { long long i, j, k, m, n, t, x, a; cin >> a >> m; map<long long, long long> mym; long long rem = a % m; bool paisi = false; while (mym[rem] == 0) { mym[rem]++; a = a + rem; rem = a % m; if (rem == 0) { paisi = true; break;...
### Prompt Your challenge is to write a cpp solution to the following problem: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...
#include <bits/stdc++.h> using namespace std; int a, m; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> a >> m; for (int i = 1; i <= 10000000; i++) { a = (a + a) % m; if (a == 0) { cout << "Yes"; return 0; } } cout << "No"; }
### Prompt Please provide a cpp coded solution to the problem described below: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to pr...