output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; if (a == b) cout << 0 << "\n"; else { int diff = abs(a - b); if (diff % 10 == 0) cout << diff / 10 << "\n"; else cout << diff / 10 + 1 << "\n";...
### Prompt Generate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int a, b; cin >> a >> b; int res = abs(a - b); res = ceil(res / 10.0); if (a == b) { res = 0; } cout << res << '\n'; } }
### Prompt Please create a solution in cpp to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int a, b; cin >> a >> b; int hieu = abs(a - b); if (hieu % 10 == 0) { cout << hieu / 10 << endl; } else { cout << hieu / 10 + 1 << endl; } } }
### Prompt Your task is to create a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different v...
#include <bits/stdc++.h> using namespace std; void c_p_c() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } void solve() { int a, b; cin >> a >> b; a = abs(a - b); int count = 0; if (a % 10 > 0) { count++; } count += a / 10; cout << count << endl; } int main() { c_p_c(); int tc; ...
### Prompt Please formulate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); ; long t, a, b, res; cin >> t; for (int i = 1; i <= t; i++) { res = 0; cin >> a >> b; if (a == b) { cout << res << endl; } else { if (abs(a - b) % 10 == 0) { res += abs(a -...
### Prompt Please provide a Cpp coded solution to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; const int N = 2e3 + 3; long long a, b, T; int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> T; while (T--) { cin >> a >> b; cout << (a ^ b ? (abs(a - b) - 1) / 10 + 1 : 0) << endl; } }
### Prompt Generate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long a; cin >> a; long long b; cin >> b; long long x = abs(a - b); if (x == 0) cout << 0; else if (x % 2 == 0) { if (a - x == b) cout << 1; else cout << 2; ...
### Prompt Your task is to create a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different v...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; void solve(void) { int a, b; cin >> a >> b; if (a > b) swap(a, b); int cnt1 = 0; cnt1 += (b - a) / 10; if ((b - a) % 10) cnt1++; cout << cnt1 << endl; } int main(void) { ios_base::sync_with_stdio(0); ci...
### Prompt Generate a cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; if (a == b) { cout << 0 << "\n"; } else if (a < b) { cout << 1 + ((b - a) % 2 == 0) << "\n"; } else { cout << 1 + ((b - a) % 2 != 0) << "\n"; } } return ...
### Prompt Please provide a Cpp coded solution to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; void solve() { int a, b, res = 0; cin >> a >> b; if (a == b) { cout << 0; return; } cout << (abs(a - b) + 9) / 10; } int main() { int t = 1; cin >> t; while (t--) solve(), cout << endl; return 0; }
### Prompt Create a solution in CPP for the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k i...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, t, i, c; cin >> t; for (i = 0; i < t; i++) { cin >> a >> b; c = abs(b - a); if (c % 10 == 0) { c = c / 10; cout << c << endl; } else { c = c / 10; cout << c + 1 << endl; } } }
### Prompt Please provide a cpp coded solution to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long t; cin >> t; while (t--) { long long a, b; cin >> a >> b; long long diff = abs(a - b); cout << (long long)ceil((diff * 1.0) / 10) << endl; } return 0; ...
### Prompt Your challenge is to write a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; void solve() { long long int a, b; cin >> a >> b; if (a == b) { cout << 0 << endl; return; } long long int ans = abs(b - a); if (ans <= 10) { cout << 1 << endl; return; } long long int temp = 0; temp += (ans) / 10; if (ans % 10 == 0) { ...
### Prompt Please provide a Cpp coded solution to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long x, y; cin >> x >> y; long long l = x - y; l = l < 0 ? -l : l; int r = l % 10; long long a = l / 10.0; if (r) a++; cout << a; cout << "\n"; } }
### Prompt Develop a solution in cpp to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; void solve() { long long a, b; cin >> a >> b; long long ans = ceil((abs(a - b)) * 1.0 / 10); cout << ans << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t = 1; cin >> t; while (t--) { ...
### Prompt In CPP, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; int c = abs(a - b); int sum = 0; int i = 10; while (c > 0 && i > 0) { sum = sum + (c / i); c = c % i; i--; } cout << sum << endl; } return 0; }
### Prompt Please provide a cpp coded solution to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n, m; cin >> n >> m; if (n == m) cout << 0 << endl; else if (n < m) { if ((m - n) % 2) cout << 1 << endl; else cout << 2 << endl; } else { if ((m - ...
### Prompt In Cpp, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int main() { int ntest; cin >> ntest; for (int k = 0; k < ntest; ++k) { int a, b, step = 0; cin >> a >> b; if (a != b) { if (a < b) { if ((a - b) % 2) step = 1; else step = 2; } else { if ((b - a) % 2...
### Prompt Your challenge is to write a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long t; cin >> t; while (t--) { long long a, b; cin >> a >> b; if (a == b) cout << "0" << "\n"; else if (a > b) { if ((a - b) % 2 == ...
### Prompt In CPP, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int a, b; cin >> a >> b; long long int r = abs(b - a); if (r % 10 == 0) { cout << r / 10; } else { cout << r / 10 + 1; } cout << endl; } }
### Prompt Please formulate a cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { int cases, i, j; cin >> cases; for (i = 0; i < cases; i++) { int a, b, count = 0, temp; cin >> a >> b; if (a == b) { cout << count << "\n"; } else { temp = abs(a - b); int ones = temp % 10; temp = temp - ones; ...
### Prompt Construct a CPP code solution to the problem outlined: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long t, a, b; cin >> t; while (t--) { cin >> a >> b; if (a == b) { cout << 0 << '\n'; } else if (abs(a - b) <= 10) { cout << 1 << '\n'; } else if (abs(a - b)...
### Prompt Please provide a cpp coded solution to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); ; long long t; cin >> t; while (t--) { long long a, b; cin >> a >> b; if (a == b) { cout << 0 << endl; ; continue; } if ((max(a, b) - min(a, b)) % 10 == 0) { ...
### Prompt Generate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int t; cin >> t; while (t--) { long long int x, y; cin >> x >> y; if (x == y) { cout << "0" << "\n"; } else if (x < y) { long long int z = y - x; ...
### Prompt Please create a solution in Cpp to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; for (int i = 0; i < a; i++) { int b, c; cin >> b >> c; int d = abs(b - c); cout << (d + 9) / 10 << "\n"; } }
### Prompt Develop a solution in cpp to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long int a, b, res; cin >> a >> b; if (a == b) { cout << "0" << endl; } else { res = abs(a - b); if (res % 10 == 0) { cout << res / 10 << endl; } else { res = res / 10;...
### Prompt Your challenge is to write a cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; int ans(int a, int b) { int answer; int c = abs(a - b); if (c % 10 == 0) { answer = c / 10; } else { answer = c / 10 + 1; } return answer; } int main() { int t; cin >> t; int a[t], b[t]; for (int i = 0; i < t; i++) { cin >> a[i] >> b[i]; } ...
### Prompt In CPP, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int t, a, b; int main() { cin >> t; while (t--) { cin >> a >> b; if (a == b) cout << 0; else if ((a % 2) + (b % 2) == 0) { if (a > b) cout << 1; else cout << 2; } else if ((a % 2) + (b % 2) == 1) { if (a > b) ...
### Prompt Your challenge is to write a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; int main() { int t, a, b; cin >> t; while (t--) { cin >> a >> b; if (b == a) cout << "0" << endl; else if (b > a) { int addition = (b - a) % 10 == 0 ? 0 : 1; cout << (b - a) / 10 + addition << endl; } else { int addition = (a - ...
### Prompt Please provide a CPP coded solution to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int tt; cin >> tt; while (tt--) { ll a, b; cin >> a >> b; a -= b; if (a < 0) { a *= -1; } ll ans = a / 10; if (a % 10 != 0) { ans++; } cout << ans << '\n'; } return 0; }
### Prompt Please formulate a cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { int t, a, b, temp; cin >> t; for (int i = 0; i < t; i++) { cin >> a >> b; temp = a > b ? a - b : b - a; cout << (long long)ceil((double)temp / 10) << "\n"; } }
### Prompt In CPP, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long t; cin >> t; while (t--) { long long a, b; cin >> a >> b; if (a > b) swap(a, b); long long ans = (b - a) / 10; if ((b - a) % 10) { ans++; } cout << ans << '\n'; } ...
### Prompt Create a solution in CPP for the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k i...
#include <bits/stdc++.h> using namespace std; long long int arr1[200002]; long long int gcd(long long int a, long long int b) { if (b == 0) return a; else return gcd(b, a % b); } long long int countSetBits(long long int n) { long long int count = 0; while (n) { count += n & 1; n >>= 1; } ret...
### Prompt Please provide a cpp coded solution to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; bool isPrime(long long n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; long long p = sqrt(n); for (long long i = 5; i <= p; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } long l...
### Prompt Construct a Cpp code solution to the problem outlined: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of ...
#include <bits/stdc++.h> using namespace std; const long long INFLL = 1e18; const int MAXN = 1e6 + 100; const long long INF = 1e9; const long long mod1 = 1e9 + 7; const long long mod2 = 2e9 + 11; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { long long a, b; cin ...
### Prompt Your task is to create a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different v...
#include <bits/stdc++.h> using namespace std; int main() { long long int t, a, b, k, c; cin >> t; while (t--) { cin >> a >> b; k = abs(a - b); if (k % 10 != 0) c = (k / 10) + 1; else c = k / 10; cout << c << endl; } return 0; }
### Prompt Please formulate a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; long long n; long long mod = 1e9 + 7; long long max(long long a, long long b) { if (a > b) return a; return b; } long long min(long long a, long long b) { if (a < b) return a; return b; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.t...
### Prompt Your task is to create a cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different v...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { long a, b; cin >> a >> b; long distAbs = abs(a - b); (distAbs % 10 > 0) ? distAbs = (distAbs / 10) + 1 : distAbs /= 10; cout << distAbs << endl; } return 0; }
### Prompt Please create a solution in CPP to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int tt = 1; cin >> tt; while (tt--) { int a, b; cin >> a >> b; if (a > b) swap(a, b); b -= a; if (b == 0) cout << b << '\n'; else cout << (b - 1) / 10 + 1 << '\n'; } retu...
### Prompt Generate a cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in ...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; const int N = 1e5 + 5; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; int tt; cin >> tt; while (tt--) { long long int a, b; cin >> a >> b; long long int x = abs(a - b); long long int ans = 0; i...
### Prompt In CPP, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; using ll = long long int; int main() { int t; cin >> t; while (t--) { ll a, b; cin >> a >> b; ll ans = 0, m = abs(a - b); for (int i = 10; i > 0; i--) { ans += m / i; m = m % i; } cout << ans << '\n'; } }
### Prompt In Cpp, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; if (b == a) { cout << "0" << endl; continue; } if (b > a && (b - a) % 2 != 0) { cout << "1" << endl; continue; } if (b > a && (b - a) % 2 == 0) { ...
### Prompt Develop a solution in cpp to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, t; cin >> t; for (int i = 0; i < t; i++) { cin >> a >> b; if (a < b) { if (abs(a - b) % 2 == 0) cout << 2 << endl; else cout << 1 << endl; } else if (a > b) { if (abs(a - b) % 2 == 0) cout <<...
### Prompt Your challenge is to write a cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; void solve() { long long a; long long b; cin >> a >> b; if (a > b) swap(a, b); long long diff = b - a; long long ans = diff / 10; if (diff % 10 != 0) ans++; cout << ans << "\n"; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(...
### Prompt Please formulate a cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1000000009; #pragma GCC optimize("Ofast") #pragma GCC optimize("no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") #pragma GCC optimize("fast-math") #pragma GCC optimize "-O3" void solve() { long long a, b; ci...
### Prompt Your challenge is to write a cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long int a, b; cin >> a >> b; long int ans = b - a; if (a > b) { ans = a - b; } if (ans % 10 == 0) { ans = ans / 10; } else { ans = ans / 10; ans++; } cout << ans <...
### Prompt In CPP, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int a, b; cin >> a >> b; int ans = abs(a - b) / 10; if (abs(a - b) % 10 != 0) ans++; cout << ans << '\n'; } return 0; }
### Prompt Construct a cpp code solution to the problem outlined: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of ...
#include <bits/stdc++.h> using namespace std; void solve() { int t; scanf("%d", &t); while (t--) { int n, m; scanf("%d %d", &n, &m); if (n == m) { cout << 0 << endl; } else if (n < m) { if ((n % 2 == 1 && m % 2 == 0) || (n % 2 == 0 && m % 2 == 1)) { cout << 1 << endl; } e...
### Prompt Create a solution in Cpp for the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k i...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n--) { int a, b; cin >> a >> b; if (a == b) cout << '0' << endl; else if (a > b) { if ((a - b) % 2) cout << '2' << endl; else cout << '1' << endl; } else { if ((b - a) % 2...
### Prompt Your challenge is to write a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; if (a == b) cout << "0" << endl; if (a > b) { if ((a - b) % 2 == 0) cout << "1" << endl; else cout << "2" << endl; } if (b > a) { if ((b - a)...
### Prompt Please formulate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> template <class T> T max(T a, T b, T c) { return max(a, max(b, c)); } using namespace std; int main() { cin.tie(NULL), ios_base::sync_with_stdio(false); int t; cin >> t; while (t--) { int a, b; cin >> a >> b; if (a > b) { if ((b - a) % 2 == 0) cout << 1 << "\...
### Prompt Please create a solution in cpp to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { long int a, b, count = 0, c = 0; int t; cin >> t; while (t--) { cin >> a >> b; long int l = abs(a - b); count = l / 10; c = l % 10; if (c > 0) count = count + 1; cout << count << endl; count = 0; } }
### Prompt Develop a solution in Cpp to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { long long t, i = 0, a, b, c; cin >> t; while (t--) { c = 1; cin >> a >> b; if (a > b) { i = a - b; } else if (b > a) { i = b - a; } else { c = 0; } if (c != 0) { c = i / 10; if (i % 10 != 0) { ...
### Prompt Create a solution in Cpp for the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k i...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const long long INF = 1000000000000000007; void AC_aaega() { long long a, b; cin >> a >> b; long long qw = abs(a - b); cout << qw / 10 + ((qw % 10) ? 1 : 0) << '\n'; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cou...
### Prompt In cpp, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int read() { int res = 0, fs = 1; char c = getchar(); while (!(c >= '0' && c <= '9')) { if (c == '-') fs = -1; c = getchar(); } while (c >= '0' && c <= '9') res = res * 10 + c - '0', c = getchar(); return res * fs; } void print(int x) { if (x < 0) { ...
### Prompt Please formulate a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int a, b; int main() { int t; scanf("%d", &t); while (t--) { scanf("%d%d", &a, &b); if (a == b) cout << 0 << endl; else { if (a < b && (b - a) % 2) cout << 1 << endl; else if (a > b && (a - b) % 2 == 0) cout << 1 << endl; ...
### Prompt Develop a solution in CPP to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int t; cin >> t; while (t--) { long long int a, b; cin >> a >> b; long long int z = abs(a - b); long long int ans = 0; if ((z % 10)) ans++; z /= 10; ...
### Prompt Your task is to create a cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different v...
#include <bits/stdc++.h> using namespace std; long int letssolve(long int a) { return (a + 9) / 10; } int main() { int n; cin >> n; int *answers = new int[n]; for (int i = 0; i < n; i++) { long long int a, b; cin >> a >> b; answers[i] = letssolve(abs(a - b)); } for (int i = 0; i < n; i++) cout <...
### Prompt Generate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in ...
#include <bits/stdc++.h> using namespace std; int main(void) { int t, i; cin >> t; for (i = 0; i < t; i++) { int a, b, ans; cin >> a >> b; if (a == b) ans = 0; else if (a > b) { if ((a - b) % 2 == 0) ans = 1; else ans = 2; } else { if ((b - a) % 2 == 0) ...
### Prompt In cpp, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int maxn = 2e6 + 10; const int mod = 1e9 + 7; int main() { int t, a, b; scanf("%d", &t); while (t--) { scanf("%d", &a); scanf("%d", &b); if (a == b) { printf("0\n"); } else { if (a < b) { if ((a & 1...
### Prompt Please provide a CPP coded solution to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> signed main(void) { long long t, a, b; scanf("%lld", &t); while (t--) { scanf("%lld %lld", &a, &b); long long answ = (abs(a - b) + 9) / 10; printf("%lld\n", answ); } }
### Prompt Create a solution in cpp for the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k i...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long a, b; cin >> a >> b; long long k = abs(a - b); if (k % 10 == 0) cout << k / 10 << endl; else cout << k / 10 + 1 << endl; } }
### Prompt Develop a solution in cpp to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 30; const long long LINF = 1LL << 61; const int NIL = -1; const int MAX = 10000; const int MOD = 1000000007; const double pi = 3.141592653589; int main() { int t; cin >> t; for (int i = 0; i < (t); i++) { int a, b; cin >> a >> b; int c...
### Prompt Create a solution in CPP for the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k i...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; int h = max(a, b) - min(a, b); int res = (h % 10 == 0) ? (h / 10) : (h / 10) + 1; cout << res << "\n"; } return 0; }
### Prompt Please formulate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; void makePositive(long long &num) { if (num < 0) { num = num * (-1); } } long long reqSteps(long long num1, long long num2) { long long counter = 0, diff = num2 - num1; makePositive(diff); if ((diff % 10) == 0) { counter = diff / 10; } else { counter...
### Prompt Construct a CPP code solution to the problem outlined: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of ...
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n; for (int i = 1; i <= n; i++) { cin >> a >> b; if (a == b) cout << 0 << endl; else if (a > b) { if ((a - b) % 2 == 0) cout << 1 << endl; else cout << 2 << endl; } else if (a < b) { ...
### Prompt Your task is to create a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different v...
#include <bits/stdc++.h> const long double EPS = 1e-10; const long long INF = 1e18; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); long long int t; cin >> t; while (t--) { long long int a, b; cin >> a >> b; long long int z = abs(a - b); ...
### Prompt Construct a CPP code solution to the problem outlined: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of ...
#include <bits/stdc++.h> using namespace std; void solve() { long long a, b; cin >> a >> b; long long sum, sum1, r = 0; if (a < b) { sum = b - a; r = sum / 10; if (sum % 10) r++; } else if (a > b) { sum = a - b; r = sum / 10; if (sum % 10) r++; } cout << r << endl; r = 0; } int32...
### Prompt Your challenge is to write a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t; cin >> t; while (t--) { long long int a, b, count = 0; cin >> a >> b; long long int req = abs(a - b); for (int i = 10; i >= 1; i--) { if (req == 0) break; co...
### Prompt Your challenge is to write a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; int main() { long t, a, b; cin >> t; while (t--) { cin >> a >> b; if (a == b) cout << "0\n"; else { if (a > b) (a - b) % 2 ? cout << "2\n" : cout << "1\n"; else (b - a) % 2 ? cout << "1\n" : cout << "2\n"; } } }
### Prompt Generate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in ...
#include <bits/stdc++.h> using namespace std; const int oo = 1e3 + 5; int main() { cin.tie(0); ios_base::sync_with_stdio(false); int test; cin >> test; while (test--) { int a, b; cin >> a >> b; if (a > b) swap(a, b); int res = b - a; int ans = (res % 10 == 0) ? res / 10 : res / 10 + 1; ...
### Prompt Please provide a CPP coded solution to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; int T; int a, b; int main() { cin >> T; while (T--) { scanf("%d%d", &a, &b); if (abs(a - b) % 10 == 0) printf("%d\n", abs(a - b) / 10); else printf("%d\n", abs(a - b) / 10 + 1); } return 0; }
### Prompt In cpp, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; const long long INF = 10000000007; const long long DIM = 10007; long long t, a, b; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> t; while (t) { cin >> a >> b; long long dif = abs(a - b); long long res = dif / 10; if...
### Prompt Please create a solution in cpp to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { int t; long int a, b; cin >> t; for (int i = 0; i < t; i++) { cin >> a >> b; if (a == b) cout << 0 << endl; else { if (a > b) { if ((a - b) % 10 == 0) cout << (a - b) / 10 << endl; else cout <<...
### Prompt Please create a solution in CPP to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { int t, n1, n2, count, diff; cin >> t; while (t--) { cin >> n1 >> n2; if (n1 > n2) { diff = n1 - n2; if (diff % 2 == 0) { cout << 1 << "\n"; } else { cout << 2 << "\n"; } } else if (n1 == n2) { cout...
### Prompt Generate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in ...
#include <bits/stdc++.h> using namespace std; const int mod = (int)10e9 + 7; vector<char> readCharArray(int size); vector<int> readArray(int size); template <class T> void print1D(vector<T>); template <class T> void print2D(vector<vector<T>>); void solve() { int a, b; cin >> a >> b; int ans = abs(a - b) / 10; i...
### Prompt Please formulate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t; cin >> t; while (t--) { long long int n, m, x, c = 0; cin >> n >> m; x = abs(n - m); c = x / 10; if (x % 10) c++; cout << c << endl; } return 0; }
### Prompt Please create a solution in CPP to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> const double PI = 3.14159265358979323846; const int maxn = 1e6 + 10; const int INF = 2e9; const long long MOD = 1e9 + 7; using namespace std; int n, m, k; void solve() { int a, b; cin >> a >> b; if (abs(a - b) % 10) cout << abs(a - b) / 10 + 1 << '\n'; else cout << abs(a - b) / ...
### Prompt Please formulate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; void solve() { int a, b; scanf("%d%d", &a, &b); int x = abs(a - b); printf("%d\n", x / 10 + bool(x % 10)); } int main() { int t; scanf("%d", &t); while (t--) solve(); return 0; }
### Prompt In CPP, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int mod(string num, long long a) { int res = 0; for (long long i = 0; i < num.length(); i++) res = (res * 10 + num[i] - '0') % a; return res; } void solve() { long long t; cin >> t; while (t--) { long long a, b; cin >> a >> b; long long ans = abs...
### Prompt Please create a solution in cpp to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, i, j, k, t; while (cin >> t) { while (t--) { cin >> n >> m; if (n == m) { cout << "0" << endl; } else if (n < m) { if ((m - n) % 2 == 0) { cout << "2" << endl; } else { cout << "1" ...
### Prompt Create a solution in Cpp for the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k i...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { unsigned long long int a, b; cin >> a >> b; unsigned long long int counter; if (a == b) { cout << 0 << endl; } else { if (a > b) { unsigned long long int d = a - b; int counter...
### Prompt In CPP, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int t; cin >> t; while (t--) { long long a, b; cin >> a >> b; long long x = abs(a - b); long long y = x / 10; if (x % 10 != 0) y++; cout << y << "\n"; } return 0;...
### Prompt Please create a solution in CPP to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, aux; int t; cin >> t; while (t--) { cin >> a >> b; if (a == b) cout << 0 << "\n"; else if (a < b) { if ((b - a) % 2 == 1) cout << 1 << "\n"; else cout << 2 << "\n"; } else { if ((a ...
### Prompt In cpp, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; auto clk = clock(); const long long limit = 1e5 + 7; void solve() { long long a, b; cin >> a >> b; long long x = abs(a - b); cout << (x + 9) / 10; cout << '\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; ...
### Prompt Please provide a Cpp coded solution to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use differe...
#include <bits/stdc++.h> using namespace std; int main() { int test; scanf("%d", &(test)); for (int t = 1; t <= test; t++) { long long int a, b; scanf("%lld", &(a)), scanf("%lld", &(b)); long long int baki = abs(a - b); long long int val = baki / 10; long long int val1 = val * 10; long lon...
### Prompt Please create a solution in Cpp to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; signed main() { long long t; cin >> t; while (t--) { long long a, b; cin >> a >> b; long long cont = 0; if (a != b) { long long d = abs(b - a); long long rem = d % 10; if (rem == 0) { cout << d / 10 << endl; } else ...
### Prompt Create a solution in Cpp for the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k i...
#include <bits/stdc++.h> using namespace std; int TwoIntegers(int a, int b) { int k = abs(a - b); int count = k / 10; if (k % 10 != 0) count++; return count; } int main() { int t, a, b; cin >> t; for (int i{1}; i <= t; i++) { cin >> a >> b; cout << TwoIntegers(a, b) << endl; } }
### Prompt Your task is to create a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different v...
#include <bits/stdc++.h> using namespace std; void solve() { long long a, b; cin >> a >> b; a = abs(a - b); long long ans = a / 10; ans += a % 10 == 0 ? 0 : 1; cout << ans << "\n"; } int main() { ios::sync_with_stdio(0); cin.tie(0); int t; t = 1; cin >> t; while (t--) { solve(); } }
### Prompt Please create a solution in CPP to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> #pragma G++ optimize(2) using namespace std; namespace io { const int SIZE = (1 << 21) + 1; char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int ff, qr; inline void flush() { fwrite(obuf, 1, oS - obuf, stdout); oS = ob...
### Prompt In Cpp, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int main() { int t, a, b, i, j, s; cin >> t; while (t--) { int a, b; cin >> a >> b; if (a == b) { cout << "0" << endl; } else if (a > b) { if ((a - b) % 2 == 0) cout << "1" << endl; else cout << "2" << endl; } else...
### Prompt Generate a cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in ...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; for (long long int i = 0; i < t; i++) { long long int a, b; cin >> a >> b; long long int x = abs(a - b); if (x == 0) { cout << 0 << "\n"; } else { long long int ans = (x / 10); if (x % 10 ==...
### Prompt Construct a cpp code solution to the problem outlined: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const long long MAX = 2e5 + 10; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; cin >> t; while (t--) { int a, b; cin >> a >> b; int dif = abs(a - b); long long ans = 0; for (auto i = 10; i >= 1; i-...
### Prompt Your task is to create a CPP solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different v...
#include <bits/stdc++.h> using namespace std; int solve(long long a, long long b) { if (a == b) return 0; int diff = max(a, b) - min(a, b); return ceil(double(diff) / 10); } int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; cout << solve(a, b) << '\n'; } }
### Prompt In Cpp, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long a, b; cin >> a >> b; if (a > b) swap(a, b); long long ans = (b - a) / 10; if ((b - a) % 10) ans++; cout << ans << endl; } return 0; }
### Prompt Develop a solution in CPP to the problem described below: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; int main(void) { int t, a, b; cin >> t; while (t--) { cin >> a >> b; int s = 0; while (a != b) { int h = a - b; if (h > 0) { if (h % 2 == 0) { a -= h; s++; } else { a -= h + 1; s++; ...
### Prompt Generate a Cpp solution to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k in ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cout << setprecision(10) << fixed; int t; cin >> t; while (t--) { int a, b; cin >> a >> b; if (a > b) swap(a, b); int d = (b - a); cout << ((d / 10) + !!(d % 10)) << '\n'; } }
### Prompt In Cpp, your task is to solve the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values of k ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int t; cin >> t; while (t--) { long long int a, b, mv = 0; cin >> a >> b; if (b > a) { long long int c = (b - a); if (c > 10) { mv += (c / 10); ...
### Prompt Please create a solution in cpp to the following problem: You are given two integers a and b. In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a. In other words, you choose an integer k ∈ [1; 10] and perform a := a + k or a := a - k. You may use different values ...
#include <bits/stdc++.h> using namespace std; char buff[123]; bool wing, winr; int n, m, k, diff[123], s[10]; bool been[123][123]; bool cache[123][123]; bool trial() { for (int i = 0; i < 123; i++) { for (int j = 0; j < 10; j++) { s[j] += diff[i] % 2; diff[i] /= 2; } } bool ret = false; for ...
### Prompt Construct a CPP code solution to the problem outlined: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring ca...
#include <bits/stdc++.h> using namespace std; int countbit(int n) { return (n == 0) ? 0 : (1 + countbit(n & (n - 1))); } int lowbit(int n) { return (n ^ (n - 1)) & n; } const double pi = acos(-1.0); const double eps = 1e-11; template <class T> T sqr(T x) { return x * x; } int n, m, k; int c[101], clen; bool Nim(int k...
### Prompt Please create a solution in CPP to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring...