output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") const int MAXN = 0; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; ...
### Prompt Your task is to create a CPP solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are gi...
#include <bits/stdc++.h> using namespace std; const long long N = 5e5 + 5; const long long M = 1e6 + 5; const long long mod = 1e9 + 7; const long long m1 = 1e9 + 7; const long long m2 = 1e9 + 9; const long long p1 = 402653189; const long long p2 = 1610612741; const long long LN = 32; long long powermodm(long long x, lo...
### Prompt Please formulate a CPP solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a ...
#include <bits/stdc++.h> using namespace std; void wldd() { long long n; cin >> n; cout << (9 * n) << " " << (8 * n) << "\n"; } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; wldd(); return 0; }
### Prompt Develop a solution in Cpp to the problem described below: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 1) { cout << "9 8" << endl; } else { cout << 3 * n << " " << 2 * n << endl; } return 0; }
### Prompt Your challenge is to write a cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You ar...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; cout << 16 * n << " " << 15 * n; return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You ar...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2 == 0) cout << n + 8 << " " << 8 << endl; else cout << n + 9 << " " << 9 << endl; }
### Prompt Develop a solution in Cpp to the problem described below: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; cout << t * 10ll << ' ' << t * 9ll; return 0; }
### Prompt Generate a CPP solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a positive...
#include <bits/stdc++.h> using namespace std; long long check(long long a) { long long f = 0; for (long long i = 2; i * i <= a; i++) if (a % i == 0) { f = 1; break; } return f; } int32_t main() { long long n; cin >> n; for (long long i = 2;; i++) { long long a = i; long long b = ...
### Prompt In CPP, your task is to solve the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a posit...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long int k, m; k = 9 * n; m = 8 * n; cout << k << " " << m; }
### Prompt Create a solution in cpp for the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a positi...
#include <bits/stdc++.h> long long m = 1000000007; long long sieve[1000001] = {0}, i, j; long long power(long long p, long long k) { long long a = 1; while (k) { if (k & 1) a = (a * p) % m; p = (p * p) % m; k >>= 1; } return a; } long long prime(long long n) { for (long long i = 2; i <= sqrt(n); i...
### Prompt Please formulate a Cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a ...
#include <bits/stdc++.h> using namespace std; bool isPrime(int n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } int main() { int n; cin >> n; int...
### Prompt In Cpp, your task is to solve the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a posit...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1; int x; inline int read() { register int num = 0, neg = 1; register char ch = getchar(); while (!isdigit(ch) && ch != '-') { ch = getchar(); } if (ch == '-') { neg = -1; ch = getchar(); } while (isdigit(ch)) { num = (num << 3...
### Prompt Construct a CPP code solution to the problem outlined: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a pos...
#include <bits/stdc++.h> using namespace std; bool prime(long long n) { for (long long i = 2; i <= sqrt(n); i++) { if (n % i == 0) return false; } return true; } void CyBerForCe() { long long n; cin >> n; if (!prime(n)) { if (n % 2) cout << n + 9 << " 9\n"; else cout << n + 4 << " 4\...
### Prompt Your task is to create a Cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are gi...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; cout << 9 * n << " " << 8 * n << endl; return 0; }
### Prompt Generate a cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a positive...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << 9 * n << " " << 8 * n; return 0; }
### Prompt Generate a cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a positive...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int i = 4; bool found = false; while (!found) { int a = i, b = i + n; bool checkA = false, checkB = false; for (int j = 2; j <= ceil(b / 2); j++) { if (b % j == 0) { checkB = true; break; } ...
### Prompt Please provide a Cpp coded solution to the problem described below: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You ar...
#include <bits/stdc++.h> using namespace std; bool a[10000001]; int main() { long long int n = 10000000; for (int i = 0; i <= n; ++i) { a[i] = false; } for (long long int i = 3; i <= n; i = i + 2) { if (a[i] == false) { for (long long int j = i * i; j <= n; j = j + (2 * i)) { a[j] = true; ...
### Prompt Generate a Cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a positive...
#include <bits/stdc++.h> #pragma GCC optimize "trapv" using namespace std; const int N = 1e+5; long long int power(long long int x, long long int y, long long int p) { long long int res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return res % p; }...
### Prompt Please formulate a Cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << 9 * n << " " << 8 * n; return 0; }
### Prompt In CPP, your task is to solve the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a posit...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << n * 9 << " " << n * 8; }
### Prompt Please formulate a cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a ...
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; if (n % 2 == 0) cout << n + 4 << ' ' << 4; else cout << n + 9 << ' ' << 9; cout << endl; return 0; }
### Prompt Please provide a CPP coded solution to the problem described below: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You ar...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; int n; bool prime(int num) { for (int i = 2; i * i <= num; i++) { if (num % i) continue; return 0; } return 1; } int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cin >> n; for (int i = 1; i <= inf; i++) { if (pri...
### Prompt Please create a solution in Cpp to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a ...
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { cout << 9 * n << " " << 8 * n << endl; } return 0; }
### Prompt Your challenge is to write a Cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You ar...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n; cin >> n; if (n % 2 == 0) cout << n + 4 << endl << 4 << endl; else cout << n + 9 << endl << 9 << endl; }
### Prompt Develop a solution in cpp to the problem described below: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a ...
#include <bits/stdc++.h> using namespace std; long long int flag[19999999]; void seive() { for (int i = 4; i <= 19999999; i += 2) { flag[i] = 1; } for (int i = 3; i <= sqrt(19999999); i += 2) { if (flag[i] == 0) { for (int j = i * i; j <= 19999999; j += i) flag[j] = 1; } } } int main() { int...
### Prompt Construct a Cpp code solution to the problem outlined: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a pos...
#include <bits/stdc++.h> using namespace std; int n; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; if (n % 2 == 0) return cout << 512 + n << " " << 512, 0; else cout << 9 + n << " " << 9, 0; }
### Prompt Create a solution in CPP for the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a positi...
#include <bits/stdc++.h> int main() { int x; scanf("%d", &x); printf("%d %d", 10 * x, 9 * x); return 0; }
### Prompt Create a solution in cpp for the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a positi...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; cout << 9 * n << " " << 8 * n << endl; }
### Prompt Create a solution in CPP for the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a positi...
#include <bits/stdc++.h> using namespace std; const int INF = 10000001; bool prime(int n) { if (!(n % 2)) { if (n == 2) return 1; return 0; } else { for (int i = 3; i * i <= sqrt(n); i++) if (!(n % i)) return 0; } return 1; } int main() { int n; int i; cin >> n; for (i = 2; i < INF; i+...
### Prompt Please create a solution in Cpp to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int n; cin >> n; if (n % 2 == 0) cout << 4 + n << " 4" << '\n'; else cout << n + 9 << " 9" << '\n'; return 0; }
### Prompt Your challenge is to write a Cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You ar...
#include <bits/stdc++.h> using namespace std; long long n, a, b; int main() { cin >> n; if (n % 2 == 0) { a = n + 4; b = 4; cout << a << " " << b; return 0; } a = n + 9; b = 9; cout << a << " " << b; return 0; }
### Prompt Your challenge is to write a cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You ar...
#include <bits/stdc++.h> using namespace std; int main() { int n, b; cin >> n; for (int a = 4; a <= 100000000; a += 2) { int k = n + a; for (int i = 2; i < k; i++) { if (k % i == 0) { cout << k << " " << a; return 0; } } } }
### Prompt Your task is to create a CPP solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are gi...
#include <bits/stdc++.h> using namespace std; long long mode = pow(10, 9) + 7; bool cmp(pair<long long, long long> x, pair<long long, long long> y) { return x.second < y.second; } int main() { ios::sync_with_stdio(0); cin.tie(0); long long n; cin >> n; cout << 9 * n << " " << 8 * n << "\n"; return 0; }
### Prompt Please create a solution in Cpp to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a ...
#include <bits/stdc++.h> using namespace std; int binarySearch(long long int arr[], int left, int right, long long int x, bool is_left = false) { if (!is_left) { while (left < right) { int mid = (left + right) / 2; if (x < arr[mid]) right = mid; else left = mid +...
### Prompt Generate a CPP solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are given a positive...
#include <bits/stdc++.h> using namespace std; bool isprime(int n) { if (n <= 1) { return false; } for (int i = 2; i < n; i++) { if (n % i == 0) { return false; } } return true; } int main() { long long n; cin >> n; long long a = 4; long long b; while (1) { b = a + n; if (is...
### Prompt Your task is to create a Cpp solution to the following problem: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You are gi...
#include <bits/stdc++.h> using namespace std; int main(void) { long n; cin >> n; cout << 9 * n << " " << 8 * n << "\n"; return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: Let's call a positive integer composite if it has at least one divisor other than 1 and itself. For example: * the following numbers are composite: 1024, 4, 6, 9; * the following numbers are not composite: 13, 1, 2, 3, 37. You ar...
#include <bits/stdc++.h> using namespace std; int T, n, num; bool flag; char ans; string str; inline bool checkc(char c) { return (c == '1' || c == '3' || c == '5' || c == '7' || c == '9'); } int main() { scanf("%d", &T); while (T--) { scanf("%d", &n); cin >> str; num = 0; flag = false; for (i...
### Prompt Please formulate a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; void InOut(); const int maxn = 100010; const int inf = 0x3f3f3f3f; int n, m, k; string s; int cnt[2]; void solve() { cin >> n; cin >> s; memset(cnt, 0, sizeof cnt); for (int i = 0; i < n; ++i) { cnt[(s[i] - '0') % 2]++; } if (cnt[1] <= 1) { cout << -1 <<...
### Prompt In cpp, your task is to solve the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure wha...
#include <bits/stdc++.h> using namespace std; long long a, b, c, ans, sum, i, stp; vector<char> v; int main() { long long n, t; string s; cin >> t; while (t--) { cin >> n; cin >> s; for (i = 0; i < n; i++) { if ((s[i] - '0') % 2 != 0) v.push_back(s[i]); } if (v.size() >= 2) cout ...
### Prompt Develop a solution in cpp to the problem described below: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int j = 0; j < t; j++) { long long n, sum = 0, temp; char t; string s, ans; cin >> n; cin >> s; for (int i = 0; i < n; i++) { t = s[i]; string c; c = c + t; temp = stoi(c); if (te...
### Prompt Create a solution in Cpp for the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int n; string s; cin >> n >> s; int c = 0; int d = 0; for (int j = 0; j < n; j++) { if ((int)s[j] % 2 != 0) { c++; if (c == 1) d = (int)s[j] - 48; if (c =...
### Prompt Construct a CPP code solution to the problem outlined: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure w...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") using namespace std; const long long N = 1e5 + 5; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long t; cin >> t; while (t--) { long long n; string s; cin >> n >> s; long long odd = 0; for (char c : s) {...
### Prompt Create a solution in cpp for the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what...
#include <bits/stdc++.h> using namespace std; void h_code() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } void l_code() {} const int N = 100005; int main() { h_code(); int t = 1; cin >> t; while (t--) { int n; string str, str2 = ""; cin >> n >> str; int odd = 0, even = 0; ...
### Prompt Generate a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what e...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n; while (n--) { cin >> m; char s[3005]; cin >> s + 1; int a = -1, b = -1; for (int i = 1; i <= m; i++) { if ((s[i] - '0') % 2 == 1) { if (a == -1) { a = s[i] - '0'; } else if (b == -1) ...
### Prompt Your task is to create a cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int MAXN = 1e5 + 9; string a; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; cin >> a; int cnt1 = 0, cnt2 = 0, cnt = 0; for (int i = 0; i < n; i+...
### Prompt Please formulate a cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main() { int N, sz; string str; cin.tie(NULL); ios_base::sync_with_stdio(0); cin >> N; while (N--) { cin >> sz >> str; int sum = 0; for (int i = 0; i < str.size(); i++) { sum ^= str[i] & 1; } while (str.size() && (str[str.size() - 1...
### Prompt Construct a Cpp code solution to the problem outlined: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure w...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; string s; cin >> s; long long cnt = 0; for (int i = 0; i < n; i++) { long long t = s[i] - 48; if (t % 2 != 0) { cnt++; } } if (cnt <= 1) { cout...
### Prompt Develop a solution in Cpp to the problem described below: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n, i, o = 0, c = 0; cin >> n; string s; cin >> s; for (i = 0; i < s.size(); i++) { if (((long long int)(s[i] - '0')) & 1) o++; } if (o >= 2) { for (i = 0; i < s.size(); i...
### Prompt Construct a CPP code solution to the problem outlined: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure w...
#include <bits/stdc++.h> using namespace std; int main() { int t, k, x, y, n; string s, f; cin >> t; while (t--) { cin >> n; cin >> s; x = 0; y = 0; f = ""; for (int i = 0; i < s.size(); i++) { k = int(s[i]) - 48; if (k % 2 == 0) { x++; } else { y++; ...
### Prompt Develop a solution in cpp to the problem described below: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; const long long inf = 0x3f3f3f3f3f3f3f3f; int32_t main() { long long t; cin >> t; while (t--) { long long n; cin >> n; string s; cin >> s; long long x = 0; for (long long i = 0; i < n; i++) { x += s[i] - '0'; } if (n == 1) { ...
### Prompt Please formulate a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; string num; cin >> num; string ans = ""; for (int i = 0; i < n; i++) { int digit = num[i] - '0'; if ((digit) % 2 == 1) { ans = ans + num[i]; } if (ans....
### Prompt Construct a cpp code solution to the problem outlined: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure w...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; const int inf = 0x3f3f3f3f; int n, m, s, t, k; int num[maxn]; char c; int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); cin >> t; while (t--) { k = 0; cin >> n; for (int i = 1; i <= n; ++i) { cin >> c; ...
### Prompt Please provide a CPP coded solution to the problem described below: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're s...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; ++i) { int n; cin >> n; string p = ""; string s; cin >> s; int count = 0; for (int i = 0; i < n; ++i) { if (s[i] == '1' || s[i] == '3' || s[i] == '5' || s[i] == '7' || s[i...
### Prompt Create a solution in Cpp for the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what...
#include <bits/stdc++.h> using namespace std; int main() { long long int i, j, k, l, t, n; cin >> t; while (t--) { cin >> n; int a[n]; char c; map<int, int> m; long long int oi = -1, ei = -1, le = -1, lo = -1; for (i = 0; i < n; i++) { cin >> c; a[i] = c - 48; if (a[i] % ...
### Prompt Your challenge is to write a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're s...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n--) { int y; cin >> y; string ss, g; cin >> ss; bool laa = false, go = false; for (int i = 0; i < ss.length(); i++) { if (ss[i] == '1' || ss[i] == '3' || ss[i] == '5' || ss[i] == '7' || ss[i...
### Prompt Please create a solution in Cpp to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int N; vector<int> V; bool Do() { while (V.size() > 0 && V.back() % 2 == 0) V.pop_back(); if (V.size() == 0) return false; int sum = 0; int p = -1; for (int i = 0; i < V.size(); ++i) { if (V[i] % 2 && i < V.size() - 1) p = i; sum += V[i]; } if (sum % 2...
### Prompt Your challenge is to write a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're s...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double EPS = 1e-10, PI = acos(-1.); int T, n; int main() { cin >> T; while (T--) { string s; vector<int> a; cin >> n >> s; for (auto i : s) if ((i - '0') & 1) a.push_back(i - '0'); if (a.size() < 2) puts(...
### Prompt Please formulate a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { std::ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t; cin >> t; while (t--) { long long int n; cin >> n; string s; cin >> s; long long int odd = 0, ev = 0, in = -1; for (long long in...
### Prompt Develop a solution in cpp to the problem described below: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; string s; cin >> s; int ganjilsum = 0; int ganjillastpos = 0; int ganjilsecondlastpos = 0; for (int i = 0; i < n; i++) { if ((int)(s[i] - '0') % 2 == 1) { ganjil...
### Prompt Generate a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what e...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; int fx[] = {-1, 1, 0, 0, -1, -1, 1, 1}; int fy[] = {0, 0, -1, 1, -1, 1, -1, 1}; int kx[] = {1, 1, 2, 2, -1, -1, -2, -2}; int ky[] = {2, -2, 1, -1, 2, -2, 1, -1}; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int T; ...
### Prompt Please create a solution in CPP to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int s[3030]; bool u[3030]; int b[3030], k2, t, k, n; int main() { cin >> t; while (t--) { cin >> n; k2 = 0; k = 0; for (int i = 1; i <= n; i++) { char c; cin >> c; s[i] = c - '0'; if (s[i] % 2) k++; } while (n && s[n] % 2 ...
### Prompt Develop a solution in Cpp to the problem described below: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> long long int i, j; using namespace std; int main() { int t; cin >> t; while (t--) { int n, co = 0; cin >> n; getchar(); string st; cin >> st; string ch; for (i = 0; i < st.size(); i++) { int k = st[i] - '0'; char c = k + '0'; if (k % 2 != 0) ...
### Prompt Generate a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what e...
#include <bits/stdc++.h> using namespace std; void in() {} int main() { int t; cin >> t; while (t--) { int n; cin >> n; string s, t; cin >> s; long long sum = 0; for (int i = 0; i < n; ++i) { sum += s[i] - '0'; } for (int i = 0; i < n; ++i) if ((s[i] - '0') % 2 == 1) t ...
### Prompt Develop a solution in CPP to the problem described below: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main(void) { int t; cin >> t; for (int z = 0; z < t; ++z) { int n; string s; cin >> n >> s; string ans = ""; for (int i = 0; i < n; ++i) { if ((s[i] - '0') % 2 == 1) ans += s[i]; if (ans.size() == 2) break; } if (ans.size() ...
### Prompt Create a solution in cpp for the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int n; cin >> n; string s; cin >> s; string a; long long int i; for (i = 0; i < n; i++) { int b = (int)s[i]; if (s[i] % 2 == 1) a.push_back(s[i]); if (a.lengt...
### Prompt Generate a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what e...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int z = 0; z < t; z++) { int n; cin >> n; char num[n]; int odd = 0, even = 0; for (int x = 0; x < n; x++) { cin >> num[x]; if ((num[x] - '0') % 2 == 1) { odd++; } else { even++; ...
### Prompt Your task is to create a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int n; cin >> n; long long int answer; long long int flag = 0; long long int end_idx = n; string input; cin >> input; long long int input_num[10000] = {-1}; long long i...
### Prompt Please create a solution in CPP to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; template <typename T> T gcd(T a, T b) { if (a == 0) return b; return gcd(b % a, a); } template <typename P> P dectobin(P a) { if (a == 0) return 0; else return (a % 2 + 10 * dectobin(a / 2)); } template <typename Y> Y bintodec(Y a) { long long ans = 0, b =...
### Prompt Please create a solution in CPP to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; string s; cin >> s; int sum = 0; for (int i = 0; i < n; i++) { sum += (s[i] - '0'); } if (sum & 1) { ...
### Prompt In Cpp, your task is to solve the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure wha...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int tt; cin >> tt; while (tt--) { int n; cin >> n; string s; cin >> s; if (n == 1 || n == 0) { cout << "-1" << endl; continue; } else { vector<int> arr(n...
### Prompt Your task is to create a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still...
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __print(float x) { cer...
### Prompt Please formulate a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; long long t, a[3007], p[3007], par, npar, knp, f1, flag, n; char c; int main() { cin >> t; for (int i = 1; i <= t; i++) { cin >> n; par = 0; npar = 0; knp = 0; for (int j = 1; j <= n; j++) { cin >> c; a[j] = c - '0'; if (a[j] % 2 ==...
### Prompt Your task is to create a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still...
#include <bits/stdc++.h> using namespace std; int main() { int tc; cin >> tc; while (tc--) { string str; int n, odd = 0; cin >> n >> str; for (char c : str) { if ((c - '0') & 1) odd++; } if (odd <= 1) { cout << -1 << endl; continue; } int len = 0; for (char c ...
### Prompt Your task is to create a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still...
#include <bits/stdc++.h> using namespace std; void printStr(string& s, int lo, int hi) { for (int i = lo; i <= hi; i++) { if (s[i] != 'A' && s[i] != '0') cout << s[i]; } cout << "\n"; } void solve(string& s, int n) { int lo = 0; int hi = n - 1; int sum = 0; for (auto& x : s) { sum += (x - '0'); ...
### Prompt In cpp, your task is to solve the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure wha...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n; cin >> n; string v; cin >> v; long long imp1 = 0, imp2 = 0, i = 0; while (i < n) { if ((v[i] - '0') % 2 != 0) { imp1 = v[i] - '0'; i++; break; } ...
### Prompt Generate a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what e...
#include <bits/stdc++.h> using namespace std; int main() { int n, cnt, j; string s; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) { cin >> j >> s; cnt = 0; for (j = 0; (cnt < 2) && (j < s.size()); j++) { if (s[j] % 2 == 1) cnt++; } ...
### Prompt Generate a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what e...
#include <bits/stdc++.h> using namespace std; void solve() { int t; cin >> t; while (t--) { int n; cin >> n; string second; cin >> second; int i, c = 0; for (i = 0; i < n; i++) { if (int(second[i]) % 2) c++; if (c == 2) break; } if (c < 2) cout << -1 << endl; ...
### Prompt Construct a CPP code solution to the problem outlined: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure w...
#include <bits/stdc++.h> using namespace std; int main() { int test; cin >> test; for (int i = 0; i < test; i++) { int n; cin >> n; string s; cin >> s; if (n == 1) { cout << -1 << endl; } else { int count = 0; vector<int> A; for (int i = 0; i < n; i++) { if ...
### Prompt Your challenge is to write a cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're s...
#include <bits/stdc++.h> using namespace std; int n, m = -1; signed main() { int t; cin >> t; while (t > 0) { t--; int n; cin >> n; string s; cin >> s; int cnt = 0; for (int i = 0; i < n; i++) { if ((int(s[i]) - 48) % 2 == 1) { cnt++; } } if (cnt <= 1) { ...
### Prompt Your challenge is to write a cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're s...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; string s; cin >> n >> s; vector<int> v; for (int i = 0; i < n; i++) { int c = s[i] - '0'; if (c % 2) { v.push_back(c); ...
### Prompt Generate a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what e...
#include <bits/stdc++.h> using namespace std; int main() { long long int t, n, i, x, sum, f; string s; ; cin >> t; while (t--) { cin >> n; cin >> s; f = 0; sum = 0; x = -1; for (i = n - 1; i >= 0; i--) { if ((s[i] - 48) % 2 == 1) { x = i; break; } } ...
### Prompt Your challenge is to write a cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're s...
#include <bits/stdc++.h> using namespace std; long long GCD(long long a, long long b) { return b ? GCD(b, a % b) : a; } long long power(long long a, long long b) { long long ret = 1; while (b) { if (b % 2) ret = ret * a % (long long)1000000007; a = a * a % (long long)1000000007; b /= 2; } return ret...
### Prompt Generate a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what e...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long power(long long x, long long y, long long p) { long long res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return res; } int main() { ios_base::sync_with_stdio(...
### Prompt Please provide a Cpp coded solution to the problem described below: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're s...
#include <bits/stdc++.h> char s[3010]; int main() { int t, n, i, pos1, pos2, cnt1; scanf("%d", &t); while (t--) { scanf("%d%s", &n, s); cnt1 = 0, pos1 = -1, pos2 = -1; for (i = n - 1; i >= 0; i--) if ((s[i] - '0') % 2) { cnt1++; if (cnt1 == 1) pos1 = i; if (cnt1 == 2) pos...
### Prompt Your task is to create a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still...
#include <bits/stdc++.h> using namespace std; const int MAXN = 3005; int t, n; char a[MAXN]; int ch(char c) { return c - '0'; } int main() { scanf("%d", &t); while (t--) { int sum = 0, mark = 0; scanf("%d%s", &n, a + 1); while (n >= 1 && ch(a[n]) % 2 == 0) n--; if (n == 0) { puts("-1"); ...
### Prompt Construct a cpp code solution to the problem outlined: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure w...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); long long t; cin >> t; while (t--) { long long n; string s; cin >> n >> s; long long in1 = -1, in2 = -1; for (long long i = n - 1; i >= 0; i--) { if ((s[i] - '0') & 1) { in1 = i; ...
### Prompt Construct a CPP code solution to the problem outlined: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure w...
#include <bits/stdc++.h> using namespace std; struct Dbg { template <typename T> Dbg& operator,(const T& v) { cerr << v << ", "; return *this; } } Dbg; template <typename T> ostream& operator<<(ostream& _o_, const vector<T>& _v_) { if (!_v_.empty()) { _o_ << '['; copy(_v_.begin(), _v_.end(), ost...
### Prompt Develop a solution in CPP to the problem described below: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int t, n, a, b, k; string s; vector<char> f; int main() { scanf("%d", &t); while (t--) { f.clear(); scanf("%d", &n); cin >> s; a = 0; b = 0; for (int i = 0; i < s.length(); i++) { if ((s[i] - '0') % 2 == 1) a++; else b...
### Prompt Create a solution in Cpp for the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure what...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5000; char str[MAXN]; int n, sum[MAXN], T; void Even_But_Not_Even() { cin >> n >> (str + 1); if (n == 1 && ((str[1] - '0') % 2 == 1 || str[1] == '0')) { cout << -1 << endl; return; } for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + str[i] ...
### Prompt Please provide a cpp coded solution to the problem described below: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're s...
#include <bits/stdc++.h> using namespace std; const int inf = INT_MAX; const int N = 3110; const double eps = 1e-10; const unsigned long long strmod = 212370440130137957ll; const long long mod = 1e9 + 7; inline long long read() { char ch = getchar(); long long x = 0, f = 1; while (ch < '0' || ch > '9') { if (...
### Prompt Construct a Cpp code solution to the problem outlined: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure w...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; string s; cin >> s; int odd = 0; for (int i = 0; i < n; i++) { if ((s[i] - '0') & 1) odd++; } if (odd <= 1) cout << "-1"; ...
### Prompt Please formulate a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n, sum = 0, lastdig, odd = 0, c = 0; cin >> n; string s, ans; cin >> s; for (long long i = 0; i < n; i++) { string z = "a"; z[0] = s[i]; long long y = stoi(z); c +=...
### Prompt In CPP, your task is to solve the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure wha...
#include <bits/stdc++.h> using namespace std; string s, s1; int main() { int i, j, n, m, t, k = 0, a, l, p; cin >> t; while (t--) { cin >> n >> s; k = 0; for (i = 0; i < n; i++) if ((s[i] - '0') % 2 == 1 && k <= 1) { k++; s1 += s[i]; } if (s1.size() > 1) cout << s...
### Prompt Please formulate a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 0; i < n; i++) { int l; string s; cin >> l >> s; while (!s.empty() && (s.back() - '0') % 2 == 0) s.pop_back(); if (s.empty()) cout << "-1\n"; ...
### Prompt Your task is to create a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still...
#include <bits/stdc++.h> using namespace std; const long double pi = acos(-1); const long double PI = acos(-1.); const int N = 1e5 + 5; int main() { ios_base::sync_with_stdio(false); int T; cin >> T; while (T--) { int n; cin >> n; string s; cin >> s; int cnt = 0; for (auto x : s) { ...
### Prompt Please formulate a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(NULL); ios::sync_with_stdio(false); int t, i, n; string str; cin >> t; while (t--) { int sm = 0, w = 0; cin >> n; cin >> str; for (i = 0; i < n; i++) sm += str[i] - '0'; if (sm % 2 != 0) w = 1; int idx = n - 1; if...
### Prompt Please provide a CPP coded solution to the problem described below: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're s...
#include <bits/stdc++.h> using namespace std; template <typename T, typename T1> T max(T a, T1 b) { if (b > a) a = b; return a; } template <typename T, typename T1> T min(T a, T1 b) { if (b < a) a = b; return a; } int64_t fastpow(int64_t a, int64_t b, int64_t m = (int64_t)(1e9 + 7)) { int64_t res = 1; a %= ...
### Prompt Please formulate a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsur...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int t; cin >> t; for (int cs = 1; cs <= t; cs++) { int n; cin >> n; string s; cin >> s; int sum = 0, odd = 0; string ans = ""; for (int i = 0; i <= n - 1; i += 1) { int now...
### Prompt Construct a CPP code solution to the problem outlined: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're still unsure w...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, d = 0, c = 0, e = 0, i, k = 0, a[1] = {-1}; cin >> n; string s; getchar(); getline(cin, s); for (i = 0; i < n; i++) { if (s[i] == '1' || s[i] == '3' || s[i] == '5' || s[i] == '7' || ...
### Prompt Your challenge is to write a Cpp solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're s...
#include <bits/stdc++.h> using namespace std; inline void normal(long long int &a) { a = (a + 998244353) % 998244353; } inline int modMul(long long int a, long long int b) { a %= 998244353, b %= 998244353; normal(a), normal(b); return (a * b) % 998244353; } inline int modAdd(long long int a, long long int b) { ...
### Prompt Your challenge is to write a CPP solution to the following problem: Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 are not. If you're s...