output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long q;
cin >> q;
for (long long i = 0; i < q; i++) {
long long a, b;
cin >> a >> b;
long long ans = abs(b - a) / 10;
if ((abs(b - a) % 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 toNum(char s) { return (int)(s - '0'); }
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
long long int t;
cin >> t;
while (t--) {
long long int a, b, x = 0;
cin >> a >> b;
if (a < b) {
if ((a - b) % 2 == 0)
cout << "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 a, b, t, i, k = 0;
cin >> t;
while (t--) {
cin >> a >> b;
if (a == b) {
cout << "0" << endl;
} else {
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;
int main() {
int t;
1 <= t <= 2000;
cin >> t;
while (t--) {
int a, b, c, ans;
1 <= a <= 1000000000;
1 <= b <= 1000000000;
cin >> a >> b;
if (a >= b)
c = a - b;
else
c = b - a;
if (c % 10 == 0)
ans = c / 10;
else
... | ### 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 int t, a, b, c, d;
cin >> t;
while (t--) {
cin >> a >> b;
c = abs(a - b);
d = c / 10;
if (c % 10 != 0) d++;
cout << d << 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;
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
long long t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
long long val = abs(b - a);
cout << (val % 10 != 0 ? val / 10 + 1 : val / 10) << "\n";
}
return 0;
}
| ### 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;
const int INF = 1e5 + 10;
int main() {
long long int t;
cin >> t;
while (t--) {
long long int a, b;
cin >> a >> b;
if (b == a)
cout << 0;
else if (a < b) {
if ((b - a) % 2)
cout << 1;
else
cout << 2;
} else if (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>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t, a, b, c;
cin >> t;
while (t--) {
cin >> a >> b;
c = abs(a - b);
div_t p;
p = div(c, 10);
cout << p.quot + bool(p.rem) << "\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 al;
cin >> al;
while (al--) {
long long b, c;
cin >> b >> c;
if ((abs(b - c)) % 10 == 0)
cout << abs(b - c) / 10 << "\n";
else {
b = abs(b - c);
cout << b / 10 + 1 << "\n";
}
}
}
| ### 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;
int arr[2 * t];
for (int i = 0; i < 2 * t; i++) cin >> arr[i];
for (int p = 0; p < 2 * t; p = p + 2) {
int c = 0, ans = 0;
a = arr[p];
b = arr[p + 1];
if (b > a) {
c = b - a;
ans = c / 10;
if (c... | ### 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;
void solve() {
long long a, b;
cin >> a >> b;
long long ans = (abs(a - b) / 10);
if (abs(a - b) % 10 != 0) {
ans++;
}
cout << ans << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long t;
cin >> t;
while (t--) {
solv... | ### 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;
while (t--) {
long long int a, b, cnt = 0, p = 10, dif, sum = 0, x, rem;
cin >> a >> b;
if (a == b) {
cnt = 0;
}
dif = abs(a - b);
cnt = dif / 10;
if (dif % 10 != 0) cnt++;
cout << cnt << 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 t;
string m;
int i, j, k, l, n;
int a[100010];
int count = 0;
cin >> t;
while (t > 0) {
int a, b;
cin >> a >> b;
int count = abs(a - b);
if (count == 0)
cout << 0 << endl;
else if (a < b) {
if (count % 2 == 0)
... | ### 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 t, a, b;
int main() {
cin >> t;
while (t--) {
cin >> a >> b;
cout << (abs(a - b) + 9) / 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;
signed main() {
long long t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
a = abs(a - b);
cout << (a + 9) / 10 << "\n";
}
return 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;
void test() {
int a, b;
cin >> a >> b;
int d = abs(a - b);
int ans = 0;
for (int i = 10; i > 0; i--) {
ans += d / i;
d %= i;
}
cout << ans;
}
int main() {
int t = 1;
cin >> t;
while (t--) {
test();
cout << endl;
}
}
| ### 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--) {
int a, b;
cin >> a >> b;
int d = abs(a - b);
if (d % 10 == 0) {
cout << d / 10;
} else {
cout << d / 10 + 1;
}
cout << "\n"... | ### 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 = 0;
cin >> t;
for (int i = 1; i <= t; i += 1) {
int ways = 0;
int b = 0;
int a = 0;
cin >> a >> b;
if (a > b) {
if (a % 2 == 0 && b % 2 == 0) {
ways = 1;
} else if (a % 2 > 0 && b % 2 > 0) {
ways = 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;
const long long int mod = 1e9 + 7;
void solveit() {
long long int a, b;
cin >> a >> b;
if (a == b) {
cout << 0;
return;
}
long long int x = abs(a - b);
long long int ans = x / 10;
long long int rest = x % 10;
if (rest > 0) ans++;
cout << ans;
ret... | ### 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 n;
cin >> n;
while (n--) {
int a, b, c;
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 ((b - a) %... | ### 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() {
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
cout << (abs(a - b) + 9) / 10 << 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;
inline void p(int x[], int n) {
int i;
for (i = 0; i < n; i++) cout << x[i] << " ";
cout << endl;
}
vector<int> bfs(vector<int> adj[], int root, int N) {
int lev = 0;
vector<int> level(N + 1);
vector<bool> vis(N + 1, false);
queue<int> st;
st.push(root);
l... | ### 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, n, i, a, b;
cin >> t;
for (i = 1; i <= t; i++) {
cin >> a >> b;
if (a == b) {
cout << "0" << '\n';
} else if (a > b) {
n = a - b;
if (n % 10 != 0) {
cout << n / 10 + 1 << '\n';
} else {
cout << 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>
int main() {
int t;
scanf("%d", &t);
int a, b;
for (; t > 0; t--) {
scanf("%d %d", &a, &b);
if (a > b)
printf("%d\n", (a - b + 9) / 10);
else
printf("%d\n", (b - a + 9) / 10);
}
return 0;
}
| ### 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>
int main() {
int t;
scanf("%d", &t);
for (int i = 0; i < t; i++) {
int a, b, d;
scanf("%d %d", &a, &b);
d = a - b;
if (d < 0) {
if (d % 2 != 0)
printf("1\n");
else
printf("2\n");
} else if (d > 0) {
if (d % 2 != 0)
printf("2\n"... | ### 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 long int a, b;
cin >> a >> b;
long long int diff = abs(a - b), cnt;
if ((diff % 10) == 0) {
cnt = diff / 10;
} else {
cnt = diff / 10 + 1;
}
cout << cnt << "\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;
cin >> t;
while (t--) {
long long a, b, k, l;
cin >> a >> b;
l = abs(a - b);
if (l >= 1 && l <= 10)
k = 1;
else {
if (l % 10 == 0)
k = l / 10;
else if (l % 10 > 0)
k = l / 10 + 1;
}
cout... | ### 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;
void solve() {
int a, b;
cin >> a >> b;
if (a < b) swap(a, b);
if (a == b)
cout << 0 << '\n';
else
cout << (a - b - 1) / 10 + 1 << '\n';
}
int main() {
int t;
cin >> t;
while (t--) solve();
}
| ### 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;
scanf("%d", &T);
while (T--) {
int a, b;
scanf("%d %d", &a, &b);
printf("%d\n", a == b ? 0 : (abs(a - b) - 1) / 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>
int main() {
int n, step, shu1, shu2;
scanf("%d", &n);
while (n--) {
scanf("%d%d", &shu1, &shu2);
if (shu1 > shu2) {
step = (shu1 - shu2) * 1.0 / 10 > (shu1 - shu2) / 10
? (shu1 - shu2) / 10 + 1
: (shu1 - shu2) / 10;
} else {
step ... | ### 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;
if (a == b) {
cout << 0;
} else if (a < b) {
long long k = b - a;
if (k % 2)
cout << 1;
else
cout << 2;
} else {
long long q = ... | ### 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>
int main() {
int a, b, x, t, i;
scanf("%d", &t);
for (i = 1; i <= t; i++) {
scanf("%d%d", &a, &b);
if (a == b)
printf("%d\n", 0);
else if (a > b && (a - b) % 2 == 0 || b > a && (b - a) % 2 != 0)
printf("%d\n", 1);
else
printf("%d\n", 2);
}
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() {
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
int ans = 0;
if (a != b) {
int diff = abs(a - b);
ans = diff / 10 + (diff % 10 != 0);
}
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() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout << fixed;
int t;
cin >> t;
for (int ts = 0; ts < t; ts++) {
int X, Y;
cin >> X >> Y;
cout << (9 + abs(X - Y)) / 10 << endl;
}
}
| ### 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;
long long power(long long m, long long n) {
if (n == 0)
return 1;
else if (n % 2 == 0)
return power(m * m, n / 2);
else
return m * power(m * m, (n - 1) / 2);
}
long long nCr(long long n, long long r) {
if (r == 0 || n == r)
return 1;
else
retur... | ### 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;
void solve() {
long long a, b;
cin >> a >> b;
cout << (abs(a - b) + 9) / 10 << "\n";
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
int testCase;
cin >> testCase;
while (testCase--) solve();
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;
const long long int mod = 1e9 + 7;
const int N = int(2e5) + 99;
const int INF = int(1e9) + 99;
int main() {
long long int t;
cin >> t;
while (t--) {
long long int a, b;
cin >> a >> b;
if (a == b)
cout << 0 << '\n';
else if (a > b) {
if ((a ... | ### 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>
int main() {
long long int a, b, t, p, q, i;
scanf("%lld", &t);
for (i = 1; i <= t; i++) {
scanf("%lld %lld", &a, &b);
p = (a - b) % 2;
q = (b - a) % 2;
if (a == b) {
printf("0\n");
} else if (a > b && p == 0) {
printf("1\n");
} else if (a < b && q == 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 main() {
int t;
cin >> t;
while (t--) {
long int a, b, diff;
int m;
cin >> a >> b;
diff = a - b;
if (a == b)
m = 0;
else if (a > b) {
if ((diff % 2) == 0)
m = 1;
else
m = 2;
} else if (a < b) {
if... | ### 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(0);
cin.tie(0);
cout.tie(0);
int x, test, n, a, b;
string s;
cin >> test;
while (test--) {
cin >> a >> b;
if (a > b) swap(a, b);
int res = (b - a) / 10;
if ((b - a) % 10 != 0) res++;
cout << res << '\n... | ### 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>
int main() {
int t, count = 0;
std::cin >> t;
while (t--) {
int a, b;
std::cin >> a >> b;
int c = abs(b - a);
int d = c / 10;
int e = c % 10;
if (e) {
d++;
}
std::cout << d << std::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;
int main() {
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (a == b)
cout << 0 << "\n";
else {
if (a > b) {
if ((a - b) % 2 == 0)
cout << 1 << "\n";
else
cout << 2 << "\n";
} else {
... | ### 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;
using ll = long long;
int main() {
int t;
cin >> t;
while (t--) {
ll a, b;
cin >> a >> b;
if (a == b) {
cout << "0"
<< "\n";
continue;
}
if (a > b) {
if ((a % 2 + b % 2) % 2 == 0)
cout << "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() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
long long int n;
while (t--) {
long long int a, b;
cin >> a >> b;
long long int i, j, k;
long long int ans = 0;
if (b == a) {
ans = 0;
} else if (b > 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;
int main() {
std::ios::sync_with_stdio(false);
int T;
cin >> T;
while (T--) {
long long int a, b;
cin >> a >> b;
long long int ans = abs(a - b) / 10;
if (abs(a - b) % 10) {
ans++;
}
cout << ans << "\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 std::cin;
using std::cout;
using std::vector;
int main() {
int tests;
cin >> tests;
for (int i = 0; i < tests; i++) {
int a, b;
cin >> a;
cin >> b;
int num_moves = (a - b) / 10;
if (num_moves < 0) {
num_moves *= -1;
}
if ((a - b) % 10) {
num_m... | ### 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>
int main() {
int t;
scanf("%d", &t);
while (t--) {
long long a, b, x, y = 1;
scanf("%lld%lld", &a, &b);
if (a >= b) {
x = a - b;
if (x % 10 != 0) {
printf("%lld\n", y + x / 10);
} else {
printf("%lld\n", x / 10);
}
} else {
x =... | ### 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>
int main() {
int t;
scanf("%d", &t);
int a, b;
for (; t > 0; t--) {
scanf("%d %d", &a, &b);
if (a < b) {
if ((b - a) % 2 > 0)
printf("1\n");
else
printf("2\n");
} else if (a > b) {
if ((a - b) % 2 > 0)
printf("2\n");
else
... | ### 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 mod = 1e9 + 7;
const long long inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
int ctz(int x) { return __builtin_ctz(x);... | ### 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;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long t;
cin >> t;
while (t--) {
double a, b;
cin >> a >> b;
double k = abs(a - b);
double m = k / 10;
long long ans = ceil(m);
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;
int main() {
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (a == b)
cout << "0" << endl;
else if ((a > b && (a - b) % 2 != 0) || (a < b && (a - b) % 2 == 0))
cout << "2" << endl;
else
cout << "1" << endl;
}
return... | ### 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 a, b, r, k, t;
cin >> t;
for (int i = 0; i < t; i++) {
cin >> a >> b;
k = abs(a - b);
if (k % 10 == 0)
r = k / 10;
else
r = k / 10 + 1;
cout << r << "\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() {
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 d = abs(a - b);
if (d % 10 == 0)
cout << d / 10 << 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;
using ll = long long;
int main() {
ll t, a, b, d;
cin >> t;
while (t--) {
cin >> a >> b;
d = abs(a - b);
if (d == 0)
cout << 0 << endl;
else if (a < b) {
if ((d & 1) == 0)
cout << 2 << endl;
else
cout << 1 << 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, b, ans = 0, res;
scanf("%lld %lld", &a, &b);
res = abs(a - b);
ans += (res / 10);
ans += res % 10 ? 1 : 0;
printf("%lld\n", ans);
}
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 main() {
int x, a, b;
scanf("%d", &x);
while (x--) {
scanf("%d %d", &a, &b);
if (a == b)
printf("0\n");
else if (a < b) {
if (a % 2 == 1) {
if (b % 2 == 1)
printf("2\n");
else
printf("1\n");
} else ... | ### 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, b;
cin >> a >> b;
if (b < a) {
swap(a, b);
}
long long res = (b - a + 9) / 10;
cout << res << endl;
}
int main() {
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
ifstream fin("text.in");
ofstream fout("text.out")... | ### 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--) {
long int count = 0;
long int a, b;
cin >> a >> b;
long int maximum = max(a, b);
long int minimum = min(a, b);
if ((maximum - minimum) == 0) {
count += 0;
} else {
for (int i = 10; i > ... | ### 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;
while (t--) {
int a, b;
cin >> a >> b;
int diff = abs(a - b);
int ans = diff / 10 + ((diff % 10 == 0) ? 0 : 1);
cout << ans << 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;
void solve() {
long long a, b;
cin >> a >> b;
long long x = abs(a - b);
if (x % 10 > 0)
cout << (x / 10 + 1);
else
cout << (x / 10);
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
solve(... | ### 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_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (b < a) swap(a, b);
if (b - a > 10) {
cout << fixed << (int)ceil((double)(b - a) / 10) << '\n';
} else if (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;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
int temp = abs(a - b) % 10;
if (a == b) {
cout << 0 << "\n";
} else if (temp != 0) {
cout << abs(a - b) / 10 + 1 << "\n";
... | ### 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 n;
int abs(int u) {
if (u >= 0)
return u;
else {
return u * -1;
}
}
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
int x, y;
scanf("%d%d", &x, &y);
int ans = abs(x - y) / 10;
if (abs(x - y) % 10 != 0) ans++;
printf("%d... | ### 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 dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int BitSetUp(int x, int idx) { return x = x | (1 << idx); }
int BitUnSet(int x, int idx) { return x = x & (~(1 << idx)); }
bool BitCheking(int x, int idx) { return x & (1 << idx); }
bool PowerOfTwo(int x) { return (x && ... | ### 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;
unsigned long long int mod = 1000000007;
unsigned long long int fact(int n) {
unsigned long long int ans = 1;
for (int i = 1; i <= n; i++) {
ans = (ans * (i % mod)) % mod;
}
return ans % mod;
}
void solve() {
int a, b;
cin >> a >> b;
if (a == b) {
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() {
int t, a, b;
cin >> t;
while (t--) {
cin >> a >> b;
if (a == b) {
cout << '0' << endl;
continue;
}
if (a > b) {
int x = a - b;
if (x & 1)
cout << '2' << endl;
else
cout << '1' << 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;
class Math {
public:
long long int gcd(long long int a, long long int b) {
return (a % b == 0) ? b : gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
return a * (b / gcd(a, b));
}
vector<bool> *seiveOfEratosthenes(const long long int... | ### 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>
#pragma GCC optimize("unroll-loops")
using namespace std;
inline int safe_mul(const int x, const int y)
__attribute__((warn_unused_result));
void solve() {
int a, b;
cin >> a >> b;
int d = abs(a - b);
cout << (d + 9) / 10 << '\n';
}
int main() {
cout << fixed << setprecision(15);
... | ### 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 testCases;
cin >> testCases;
while (testCases--) {
int a, b;
cin >> a >> b;
if (a == b)
cout << 0 << endl;
else if (a > b && ((a - b) % 2 == 0) || b > a && ((b - a) % 2 != 0))
cout << 1 << endl;
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;
int main() {
int t;
cin >> t;
while (t--) {
long long int a, b;
cin >> a >> b;
int d = abs(a - b);
int ans = d / 10;
if (d % 10) ans += 1;
cout << ans << endl;
}
}
| ### 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 (abs(a - b) % 10 == 0)
cout << abs(a - b) / 10 << endl;
else
cout << (abs(a - b) / 10) + 1 << 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 t;
cin >> t;
int a, b;
vector<int> ans;
while (t--) {
cin >> a >> b;
if (abs(a - b) % 10 == 0) {
ans.push_back(ceil(abs(a - b) / 10));
} else
ans.push_back(ceil(abs(a - b) / 10) + 1);
}
for (int i = 0; i < ans.size(); i... | ### 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, a, b, v, v1;
scanf("%d", &t);
while (t--) {
scanf("%d%d", &a, &b);
v = abs(a - b);
if (v != 0) {
if (a < b) {
if (v % 2 == 0) {
v1 = 2;
} else {
v1 = 1;
}
} else {
if (v % ... | ### 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_base::sync_with_stdio(false);
cin.tie(0);
int t, a, b;
cin >> t;
while (t--) {
cin >> a >> b;
bool aEven, bEven;
aEven = (a % 2 == 0);
bEven = (b % 2 == 0);
if (a == b)
cout << '0' << endl;
else if (a > b) {
if ... | ### 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--) {
int a, b;
cin >> a >> b;
if (a == b)
cout << 0 << '\n';
else if (a > b && a % 2 == b % 2 || a < b && a % 2 != b % 2)
cout << 1 << '\n';
else
cout << 2 << '\n';
}
}
| ### 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() {
long long q;
cin >> q;
while (q--) {
long long a, b;
cin >> a >> b;
long long r = abs(a - b);
cout << r / 10 + (r % 10 != 0) << 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() {
int t, a, b, h;
scanf("%d", &t);
while (t--) {
scanf("%d%d", &a, &b);
h = abs(a - b);
if (h % 10 == 0)
h = h / 10;
else
h = h / 10 + 1;
printf("%d\n", h);
}
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;
vector<pair<long long, long long> > vp;
vector<long long> v;
set<long long> st;
long long ara[500005];
map<string, long long> mp;
long long Set(long long N, long long pos) { return N = N | (1LL << pos); }
long long reset(long long N, long long pos) { return N = N & ~(1LL <<... | ### 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 A[1000], B[1000];
int main() {
int k;
cin >> k;
for (int a = 0; a < k; a++) {
int n, n1;
cin >> n >> n1;
int d = 0;
if (n1 > n) {
d = n1 - n;
} else {
d = n - n1;
}
int f = 0, f1 = 0, f2 = 0, f3 = 0, f4 = 0, f5 = 0, f6 = 0, ... | ### 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;
inline long long max(long long a, long long b) { return ((a < b) ? b : a); }
inline long long min(long long a, long long b) { return ((a < b) ? a : b); }
void sily() {
long long t, k;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
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>
using namespace std;
const int maxn = 1e5 + 10;
int main() {
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (a > b) {
int res = a - b;
if (res % 2 == 0)
cout << 1 << endl;
else
cout << 2 << endl;
} else if (a < b) {
int r... | ### 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, x;
scanf("%d", &T);
while (T--) {
scanf("%d%d", &a, &b);
x = abs(a - b);
if (x % 10 == 0)
x /= 10;
else
x = x / 10 + 1;
printf("%d\n", x);
}
}
| ### 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() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
cout << (long long)ceil(abs(a - b) / 10.0) << "\n";
}
}
| ### 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;
long long a, b;
int main() {
int t;
scanf("%d", &t);
while (t--) {
scanf("%lld %lld", &a, &b);
long long sum = abs(a - b);
long long ans = sum / 10;
if (sum % 10 != 0) ans++;
printf("%lld\n", ans);
}
return 0;
}
| ### 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() {
int t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
long long dif = abs(a - b);
long long res = dif / 10 + (dif % 10 != 0 ? 1 : 0);
cout << res << endl;
}
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;
int main() {
long t;
cin >> t;
while (t--) {
long long ctr = 0;
long long a, b;
cin >> a >> b;
long long x = abs(a - b);
long long ans = x / 10;
if (x % 10 == 0) {
cout << ans << endl;
} else {
cout << ans + 1 << 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;
const int LIM = 1e5 + 5, MOD = 1e9;
long long gcd(long long a, long long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
long long fastpowMOD(long long a, long long p, long long MOD) {
if (p == 0) return 1;
long long z = fastpowMOD(a, p / 2, MOD);
z = (z * z) %... | ### 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);
cin.tie(0), cout.tie(0);
long long t;
cin >> t;
while (t--) {
long long x, y;
cin >> x >> y;
if (x > y) swap(x, y);
long long dif = y - x;
long long ans = ceil(dif / 10.0);
cout << ans << "\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 a, b, c;
cin >> a;
for (int i = 1; i <= a; i++) {
cin >> b >> c;
if (b == c)
cout << '0';
else {
if (c > b && (c - b) % 2 == 1) cout << '1';
if (c > b && (c - b) % 2 == 0) cout << '2';
if (c < b && (b - c) % 2 == 0)... | ### 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_base::sync_with_stdio(false);
cin.tie(NULL);
long long t;
cin >> t;
while (t--) {
long long a, b, n = 0, c = 0;
cin >> a >> b;
if (a >= b)
n = a - b;
else
n = b - a;
if (n == 0)
cout << c << "\n";
else if ... | ### 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>
long long int mod = 1e9 + 7;
using namespace std;
int solve() {
double a, b;
cin >> a >> b;
cout << (int)ceil(abs(a - b) / 10) << endl;
return 0;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout.precision(20);
cout.setf(ios::fixed);
int ttt = 1;
ci... | ### 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 a, b, k, t, move, aux;
cin >> t;
for (int i = 0; i < t; ++i) {
cin >> a >> b;
move = 0;
if (a > b) {
aux = a - b;
move += aux / 10;
if (aux % 10) move++;
} else if (a < b) {
aux = b - a;
move += aux / 10;
... | ### 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;
long long int a, b, c;
while (t--) {
cin >> a >> b;
if (a > b) {
c = 1;
if ((a - b) % 10 == 0) {
c = 0;
}
c = c + (a - b) / 10;
} else if (a < b) {
c = 1;
if ((a - b) % 10 == 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 MAXN = 2e5 + 5;
const int MOD = 1e4 + 7;
int n, m, q;
int main() {
scanf("%d", &q);
while (q--) {
int a, b;
scanf("%d%d", &a, &b);
int delt = abs(a - b);
int ans = delt / 10 + (delt % 10 != 0);
printf("%d\n", ans);
}
return 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>
const int sz = (int)2e5 + 10, mod = (int)1e9 + 7;
using namespace std;
void solve() {
long long a, b;
cin >> a >> b;
long long dif = abs(a - b);
long long cnt = dif / 10 + (dif % 10 > 0);
cout << cnt << endl;
}
int main() {
int t = 1;
cin >> t;
while (t--) solve();
}
| ### 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 main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tc;
cin >> tc;
for (int t = 1; t <= tc; t++) {
solve();
}
return 0;
}
void solve() {
long long a, b, diff;
cin >> a >> b;
if (a == b)
cout << 0 << "\n";
els... | ### 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 code() {
long long int a, b, c, d, e;
cin >> a >> b;
c = abs(a - b);
d = c % 10;
e = c / 10;
if (d) {
cout << e + 1 << endl;
} else
cout << e << endl;
}
int main() {
int t;
cin >> t;
while (t--) {
code();
}
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;
const int N = 20000005;
int n, k, x, t, a, b, m;
string s;
vector<int> v;
void solve() {
cin >> n >> k;
cout << (abs(n - k) + 9) / 10 << endl;
}
int main() {
cin >> t;
while (t--) {
solve();
}
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;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
const char* comma = strchr(names + 1, ',');
cout.write(nam... | ### 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;
const long long N = 2e5 + 5;
void solve() {
long long a, b;
cin >> a >> b;
long long d = abs(a - b);
cout << (d + 9) / 10 << endl;
}
signed main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
srand(chrono::high_resolution_clock::now().time_since_epoc... | ### 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.