output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, a, b, answer;
cin >> t;
for (; t > 0; --t) {
cin >> a >> b;
answer = abs(a - b);
if (answer % 10) answer += 10;
cout << answer / 10 << '\n';
}
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 t, x, y;
int main() {
cin >> t;
for (int i = 0; i < t; i++) {
cin >> x >> y;
if (x == y)
cout << 0 << endl;
else if (x > y) {
if (x % 2 == y % 2)
cout << 1 << endl;
else
cout << 2 << endl;
} else {
if (x % 2 ==... | ### 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 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 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;
long long gcd(long long a, long long b) {
for (; b; a %= b, swap(a, b))
;
return a;
}
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
long long t;
cin >> t;
while (t--) {
long lon... | ### 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 x, a, b;
cin >> x;
for (int i = 0; i < x; i++) {
cin >> a;
cin >> b;
int x1 = abs(a - b);
int result = x1 / 10;
if (x1 % 10 != 0) {
result++;
}
cout << result << 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() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while (t--) {
long long int a;
cin >> a;
;
long long int b;
cin >> b;
;
long long int c = abs(b - a);
long long int d = c / 10;
lon... | ### 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 sol() {
int t;
long long a, b, c;
cin >> t;
while (t--) {
cin >> a >> b;
if (a < b) swap(a, b);
c = (a - b) / 10;
if ((a - b) % 10 > 0) c++;
cout << c << endl;
}
}
int main() {
sol();
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;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 60;
const double pi = 3.1415926536;
template <class c>
struct rge {
c b, e;
};
template <class c>
rge<c> range(c i, c j) {
return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
te... | ### 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>
int func(int a, int b) {
int ans, diff = abs(b - a);
ans = diff - (diff / 10 * 10);
return diff / 10 + (ans == 0 ? 0 : 1);
}
int main() {
int t, a, b;
scanf("%d", &t);
while (t--) {
scanf("%d%d", &a, &b);
printf("%d\n", func(a, b));
}
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>
int main(int argc, char** argv) {
int x;
long a, b;
scanf("%d", &x);
int z;
int t;
long s;
for (z = 0; z < x; z++) {
scanf("%d %d", &a, &b);
t = 0;
if (a > b) {
s = a - b;
if (s > 10) {
t = s / 10 + 1;
if (s % 10 == 0) t = t - 1;
}
... | ### 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" << endl;
if (a < b) {
if (a % 2 == 0 && b % 2 == 0)
cout << "2" << endl;
else if (a % 2 != 0 && b % 2 != 0)
cout << "2" << 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;
long long mod = 1e9 + 7;
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 << endl;
continue;
} 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() {
int n, m, k;
cin >> m;
for (int i = 1; i <= m; i++) {
cin >> n >> k;
if (n < k) swap(n, k);
int sum = (n - k) / 10;
if ((n - k) % 10 > 0) sum++;
cout << sum << endl;
}
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 solve() {
long long a, b;
cin >> a >> b;
if (a == b)
return 0;
else if (b > a) {
if ((b - a) % 2 == 0)
return 2;
else
return 1;
} else {
if ((a - b) % 2 == 0)
return 1;
else
return 2;
}
}
int main() {
ios_base::s... | ### 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;
long double a, b;
int d;
while (n > 0) {
n -= 1;
cin >> a >> b;
if (a == b) {
d = 0;
} else if (a > b) {
d = ceil((a - b) / 10);
} else if (a < b) {
d = ceil((b - a) / 10);
}
cout << 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;
void solve() {
int a, b;
scanf("%d%d", &a, &b);
if (b > a) swap(a, b);
int moves = (a - b + 9) / 10;
printf("%d\n", moves);
}
int main() {
int t;
scanf("%d", &t);
while (t--) {
solve();
}
}
| ### 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 + 5, M = 1e9 + 7, oo = 0x3f3f3f3f;
int main() {
int t;
scanf("%d", &t);
while (t--) {
int a, b;
scanf("%d %d", &a, &b);
int x = b - a;
if (x == 0)
puts("0");
else if (x > 0)
if (x & 1)
puts("1");
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;
const int mod = 1000000007;
int main() {
int t;
cin >> t;
while (t--) {
long long int a, b;
cin >> a >> b;
if (a == b)
cout << "0" << endl;
else if (b > a) {
if ((b - a) % 2 == 0)
cout << "2" << endl;
else
cout << "1" ... | ### 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::sync_with_stdio(0);
cin.tie(0);
long long a, b, t, ans;
cin >> t;
while (t--) {
cin >> a >> b;
ans = ceil(abs(a - b) / 10.0);
cout << ans << '\n';
}
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 t;
cin >> t;
while (t--) {
long long int a, b;
cin >> a >> b;
if (a == b) {
cout << "0" << endl;
}
if (a < b) {
if ((b - a) % 2 != 0) {
cout << "1" << endl;
} else {
cout << "2" << endl;
}
... | ### 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(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
long long d = abs(b - a);
cout << (d / 10 + (d % 10 == 0 ? 0 : 1)) << "\n";
}
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 t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (a < b) a ^= b ^= a ^= b;
a -= b;
cout << (a + 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;
long long arr[500100], barr[500100], carr[500100];
stack<pair<long long, long long> > st;
int main() {
long long t, n, i, j, K, k, l, m;
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> t;
while (t--) {
cin >> j >> k;
if (j == k) {
cout << 0 << '\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;
cin >> t;
while (t--) {
long a, b;
cin >> a >> b;
int steps = 0;
a = abs(a - b);
if (a % 10 == 0)
steps = a / 10;
else
steps = a / 10 + 1;
cout << steps << 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() {
long long int a, b, t, x, m;
cin >> t;
while (t--) {
cin >> a >> b;
if (a == b)
cout << 0;
else {
x = abs(a - b);
m = x / 10;
if (x > (m * 10))
cout << m + 1;
else
cout << m;
}
cout << 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() {
long long t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
if (a == b) {
cout << "0\n";
} else {
long long m = abs(a - b);
long long c = m / 10;
if (c == 0) {
cout << 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;
int main() {
long long t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
if (a > b) swap(a, b);
long long i = 10;
if ((b - a) % 10 == 0)
cout << (b - a) / 10 << "\n";
else
cout << ((b - a) / 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 n, a, b;
int main() {
cin >> n;
while (n--) {
cin >> a >> b;
if (a < b) swap(a, b);
int sum = a - b;
int step = sum / 10;
sum -= step * 10;
if (sum != 0) step++;
cout << step << 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() {
long long t, a, b, ans, k;
cin >> t;
for (int i = 0; i < t; ++i) {
cin >> a >> b;
ans = abs(a - b) / 10;
if (a <= b) {
a += ans * 10;
} else {
b += ans * 10;
}
if (a != b) {
ans++;
}
cout << ans;
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() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
int d = abs(a - b);
cout << (d + 9) / 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 long long N = 2e5 + 228;
signed main() {
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
long long q;
cin >> q;
while (q--) {
long long a, b;
cin >> a >> b;
long long c = abs(b - a);
cout << (c + 9) / 10 << '\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::sync_with_stdio(0);
int t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
if (a == b) {
cout << 0 << endl;
} else if (a > b) {
int t = a - b;
if (t % 2 == 1)
cout << 2 << endl;
else
co... | ### 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(0);
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (a < b) {
if ((b - a) % 2 == 1)
cout << 1 << endl;
else
cout << 2 << endl;
} else if (a == b)
co... | ### 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 << endl;
}
if (a < b) {
if ((b - a) % 2 == 0) {
cout << 2 << endl;
} else {
cout << 1 << endl;
}
} else if (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 answer;
int make_answer();
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int i, t;
cin >> t;
for (i = 1; i <= t; i++) {
answer = make_answer();
cout << answer << "\n";
}
return 0;
}
int make_answer() {
in... | ### 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;
long long a, b, cnt;
while (t--) {
cin >> a >> b;
cnt = 0;
if (a > b) swap(a, b);
cnt = (b - a) / 10;
if ((b - a) % 10 != 0) cnt++;
cout << cnt << 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 a, b, n, m, x, y;
long long t;
cin >> t;
while (t--) {
cin >> a >> b;
n = a - b;
x = n % 2;
m = b - a;
y = m % 2;
if (a == b) {
cout << "\n0";
} else if (a > b && x == 0 || b > a && y != 0) {
cout << "\n... | ### 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 a, b, k, t, d;
cin >> t;
while (t--) {
cin >> a >> b;
d = abs(a - b) % 10;
k = abs(a - b) / 10;
if (d > 0) {
k += 1;
}
cout << k << 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;
int32_t main() {
ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
long long t = 1;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
if (a > b) swap(a, b);
long long reqd = b - a;
long long ans = reqd / 10LL;
if (reqd % 1... | ### 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(void) {
int tc;
cin >> tc;
while (tc--) {
int a, b;
cin >> a >> b;
if (a == b) {
cout << 0 << endl;
continue;
}
if (b > a) {
if ((b - a) % 2 == 1) {
cout << 1 << endl;
continue;
} else {
cout... | ### 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, n;
cin >> t;
for (int i = 0; i < t; ++i) {
cin >> a >> b;
n = abs(a - b);
n % 10 == 0 ? cout << n / 10 << endl : cout << n / 10 + 1 << 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;
int bit[10][10001] = {0};
int long long arr[10001];
int query(int end, int mod) {
int res = 0;
while (end > 0) {
res += bit[mod][end];
end -= end & (-end);
}
return res;
}
void update(int idx, int start, int val, int long long n) {
while (start <= 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() {
long t, a, b, res, i;
cin >> t;
for (i = 1; i <= t; i++) {
cin >> a >> b;
if (a == b) {
res = 0;
} else if (a < b) {
if ((b - a) % 2 != 0) {
res = 1;
} else {
res = 2;
}
} 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() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (a == b)
cout << 0 << endl;
else if (b > a) {
if ((b - a) % 2 == 0)
cout << 2 << endl;
else
... | ### 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(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (a == b)
cout << 0 << endl;
else if (a < b && (b - a) % 2 == 1)
cout << 1 << endl;
else if (a < b && (b - a) % 2 == 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;
long long n, t, i, d, a, b;
int main() {
cin >> t;
for (i = 1; i <= t; i++) {
cin >> a >> b;
d = abs(a - b);
if (d % 10 == 0)
cout << d / 10 << endl;
else
cout << d / 10 + 1 << 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;
void solve() {
int a, b;
cin >> a >> b;
int rem = (abs(a - b) % 10);
int ans = abs(a - b) / 10;
if (rem) ans++;
cout << ans << endl;
}
int main() {
int t;
cin >> t;
while (t--) solve();
}
| ### 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 x, y, k;
cin >> x;
for (int i = 0; i < x; i++) {
cin >> y >> k;
if (y > k) {
if ((y - k) % 2 != 0)
cout << "2" << endl;
else
cout << "1" << endl;
} else if (y < k) {
if ((k - y) % 2 != 0)
cout << "... | ### 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 test;
cin >> test;
while (test--) {
long long int n, m, res = 0;
cin >> n >> m;
n = abs(n - m);
cout << (n + 9) / 10 << endl;
}
}
| ### 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 testCase;
int iinf = 1e9 + 1;
long long inf = 1e16 + 1;
void solve() {
long long a;
cin >> a;
long long b;
cin >> 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
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 n, a, b;
scanf("%lld", &n);
for (long long i = 0; i < n; i++) {
scanf("%lld %lld", &a, &b);
printf("%lld\n", (abs(a - b) + 9) / 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;
int main() {
long long t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
long long c = abs(a - b);
if (a == b)
cout << "0" << '\n';
else {
long long ans;
if (c % 10 == 0)
ans = c / 10;
else {
ans = (c... | ### 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;
cin >> a;
while (a--) {
int b, c;
cin >> b >> c;
if (b < c) {
if ((b - c) % 2)
cout << 1 << endl;
else
cout << 2 << endl;
} else if (c < b) {
if ((b - c) % 2) {
cout << 2 << endl;
} el... | ### 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;
int diff = abs(a - b);
int ans = 0;
if (diff == 0) {
ans = 0;
} else if (diff <= 10 && diff >= 1) {
ans = 1;
} else {
ans = diff / 10;
if (diff % 1... | ### 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;
int32_t 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 val = abs(a - b);
long long int answer = val / 10;
if (val % 10 != 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 t;
cin >> t;
vector<long long> res(t);
for (long long i = 1; i <= t; i++) {
long long a, b;
cin >> a >> b;
long long x = abs(a - b);
long long r = x / 10;
if (r * 10 < x) {
r += 1;
}
res[i - 1] = r;
}
for ... | ### 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(NULL);
cout.tie(NULL);
int t;
cin >> t;
while (t--) {
long long int a, b;
double num;
cin >> a >> b;
if (a == b) {
cout << "0";
} else if (a > b) {
if ((a - b) % 10 == 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;
bool odd(int x) { return (x % 2 == 0) ? false : true; }
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 (odd(b)) {
if (odd(a)) {
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() {
int m;
cin >> m;
while (m--) {
int a, b;
cin >> a >> b;
int ans = 0, buff;
buff = abs(a - b);
if (buff % 10 != 0) buff = buff / 10 * 10 + 10;
cout << buff / 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;
bool is_prime(int n) {
if (n <= 1) return false;
if (n == 2 || n == 3 || n == 5 || n == 7)
return true;
else if (n % 2 == 0 || n % 3 == 0)
return false;
else {
int r = 5;
while (r * r <= n) {
if (n % r == 0) return false;
r += 2;
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;
std::mt19937_64 rng(
std::chrono::steady_clock::now().time_since_epoch().count());
void solve() {
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
int c = abs(a - b);
int d = c / 10;
if (c % 10 == 0) {
cout << d << "\n";
} else... | ### 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;
const long long M = 1e9 + 7;
const long long N = 2e6 + 10;
const long long IM = 1e15 + 37;
const long double PI = 3.1415926535897932384;
inline void PP(long long n) { cout << n << " "; }
void PV(vector<long long> v) {
for (long long i = 0; i < v.size(); i++) cout << v[i] ... | ### 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 a, b;
while (T--) {
cin >> a >> b;
if (abs(a - b) % 10 == 0) {
cout << abs(a - b) / 10 << '\n';
} else {
cout << abs(a - b) / 10 + 1 << '\n';
}
}
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() {
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 (a < b) {
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() {
int q;
cin >> q;
vector<int> a;
for (; q > 0; q--) {
int a, b;
cin >> a >> b;
if (a == b)
cout << 0 << endl;
else {
if (a < b) swap(a, b);
if ((a - b) % 10 == 0) {
cout << (a - b) / 10;
} else {
co... | ### 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 t;
int main() {
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (b < a) swap(a, b);
int x = b - a;
int sum = 0;
for (int i = 10; i >= 1; --i) {
if (x >= i) {
sum += x / i;
x %= i;
}
}
printf("%d\n", sum... | ### 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 T>
void input(vector<T> &arr, long long int n) {
T temp;
for (long long int i = 0; i < n; i++) cin >> temp, arr.push_back(temp);
}
template <typename T>
void output(vector<T> arr) {
T temp;
for (auto x : arr) cout << x << " ";
cout << endl;
}
te... | ### 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 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
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 PLAY() {
cout << fixed << setprecision(2);
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main() {
PLAY();
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (b > a) {
int c = b - a;
if (c % 2 == 0)
cout ... | ### 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;
struct point {
int x, y;
};
int main() {
long long int a, b, n = 0, t;
cin >> t;
while (t--) {
cin >> a >> b;
n = 0;
n = abs(a - b) / 10;
if ((abs(a - b) % 10) != 0) {
n++;
}
cout << n << "\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() {
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
int diff = abs(a - b);
int count = 0;
for (int k = 10; k >= 1; k--) {
count += diff / k;
diff %= k;
}
cout << count << "\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 gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <class T1, class T2>
struct cmpf {
bool rev;
inline bool operator()(const pair<T1, T2>& a, const pair<T1, T2>& b) const {
return (a.first < b.first) ^ rev;
}
cmpf(bool b = false) ... | ### 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, x;
cin >> a >> b;
x = abs(a - b);
if (x > 0 && x % 10 == 0) {
cout << (x / 10) << endl;
} else if (x > 0 && x % 10 != 0) {
cout << (x / 10) + 1 << endl;
} else if (x == 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() {
long long t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
if (a == b)
cout << "0\n";
else
cout << (abs(a - b) / 10) + (abs(a - b) % 10 != 0 ? 1 : 0) << "\n";
}
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;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvii = vector<vii>;
using vll = vector<ll>;
int main() {
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (a == b) {
cout << 0 << 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 (a == b) {
cout << '0' << endl;
}
if (a > b) {
if ((a - b) % 2 == 0)
cout << '1' << endl;
else
cout << '2' << endl;
}
if (a < b) {
... | ### 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 T, a, b;
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> T;
while (T--) {
cin >> a >> b;
cout << (abs(a - b) + 9) / 10 << 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;
int xx[4] = {0, 0, 1, -1};
int yy[4] = {-1, 1, 0, 0};
int main() {
long long t;
scanf("%lld", &t);
;
while (t--) {
long long a, b;
scanf("%lld %lld", &a, &b);
long long z = abs(b - a);
long long res = z / 10;
if (z % 10 != 0) res++;
cout << r... | ### 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(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
if (b == a)
cout << 0 << endl;
else if (b > a) {
if ((b - a) % 2 == 1)
cout << 1 << endl;
else
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() {
long long t, a, b;
cin >> t;
while (t--) {
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
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>
int main() {
int t, i, s;
scanf("%d", &t);
for (i = 1; i <= t; i++) {
int a, b;
scanf("%d %d", &a, &b);
if (a >= b) {
s = a - b;
} else {
s = b - a;
}
if (a == b) {
printf("%d\n", s);
} else if (s % 10 == 0) {
printf("%d\n", s / 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;
const int INF = 1e9;
const long long oo = 1e18;
const long double PI = 3.1415926535898;
int a, b, t;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> t;
for (int i = 1; i <= t; i++) {
cin >> a >> b;
if (a > b) swap(a, b);
cout << (b - a)... | ### 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 test;
cin >> test;
while (test--) {
int a, b;
cin >> a >> b;
int diff = abs(b - a);
int moves = (diff + 9) / 10;
cout << moves << endl;
}
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;
int main() {
int t, a, b;
cin >> t;
while (t--) {
cin >> a >> b;
int k = abs(a - b);
if (k % 10 == 0)
cout << k / 10 << endl;
else
cout << k / 10 + 1 << endl;
}
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 n, a, b;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d%d", &a, &b);
if (a < b) {
if ((b - a) % 2 == 1)
printf("1\n");
else
printf("2\n");
} else if (a > b) {
if ((a - b) % 2 == 0)
printf... | ### 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 base = 200003;
const long long MM = 1ll * 1000000007 * 1000000007;
int a, b;
void Solve() {
cin >> a >> b;
int res = abs(a - b);
int pos;
if (res % 10 == 0)
pos = 0;
else
pos = 1;
cout << res / 10 + pos << "\n";
}
int main() {
ios_base::sync_... | ### 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 main() {
cin >> t;
for (int i = 1; i <= t; i++) {
int a, b, sum;
cin >> a >> b;
sum = abs(a - b);
if (sum % 10 != 0) {
sum = sum / 10 + 1;
} else {
sum = sum / 10;
}
cout << sum << 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;
struct node {
int data;
struct node* left;
struct node* right;
};
struct node* newNode(int idata) {
struct node* node = new struct node;
node->data = idata;
node->left = NULL;
node->right = NULL;
return node;
}
bool isPrime(int n) {
if (n <= 1) {
retur... | ### 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 tc, n, i, j, a, b, mul10, ans;
cin >> tc;
while (tc--) {
cin >> a >> b;
int diff = abs(a - b);
if (diff > 10 && diff % 10 == 0) {
mul10 = diff / 10;
ans = mul10;
} else if (diff > 10 && diff % 10 != 0) {
mul10 = diff ... | ### 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 t, a, b;
cin >> t;
for (int i = 0; i < t; i++) {
cin >> a >> b;
cout << (abs(a - b) + 9) / 10 << "\n";
}
}
| ### 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;
vector<vector<long long int>> cn(long long int n, long long int m) {
return vector<vector<long long int>>(n, vector<long long int>(m));
}
bool compare(char &s1, char &s2) { return s1 > s2; }
bool sortmahstyle(const pair<long long int, long long int> &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, res;
cin >> a >> b;
if (a == b) {
res = 0;
} else if (a < b) {
if ((b - a) % 2 == 1) {
res = 1;
} else {
res = 2;
}
} else {
if ((a - b) % 2 == 1) {... | ### 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 T, tc = 0;
scanf("%d", &T);
while (T--) {
int a, b;
cin >> a >> b;
if (a <= b) {
int d = b - a;
if (d <= 1) {
cout << d << endl;
continue;
}
if (d % 2 == 1) {
puts("1");
continue;
... | ### 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 = 1e7 + 100;
const double PI = 3.1415926536;
vector<char> v;
long long n, m, k, t, sum, l, r, p, e, d, c, a, b;
long long ans;
bool f;
string s[10];
set<long long> st;
map<char, int> mp1, mp2;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cin >... | ### 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 t;
long long int a, b;
cin >> t;
while (t--) {
int cnt = 0;
cin >> a >> b;
if (a == b)
cnt = 0;
else if (a < b) {
if ((b - a) % 2 != 0)
cnt += 1;
else
cnt += 2;
} else {
if ((a - b) % 2 == ... | ### 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;
long long int a, b;
long long int val;
if (t >= 1)
while (t--) {
cin >> a;
cin >> b;
if (a >= 1) {
if (a == b) {
cout << 0 << "\n";
} else {
val = abs(a - b);
if (val... | ### 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() {
int a, b;
cin >> a >> b;
if (a != b) {
if (abs(a - b) % 10 == 0)
cout << (abs(a - b) / 10) << endl;
else
cout << (abs(a - b) / 10 + 1) << endl;
} else
cout << 0 << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.... | ### 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(0), cin.tie(0), cout.precision(10), cout << fixed;
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
cout << (abs(a - b) + 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;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long test;
cin >> test;
while (test--) {
long long a, b;
cin >> a >> b;
if (a == b) {
cout << "0\n";
} else if (a % 2 == b % 2) {
if (a > b) {
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 main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long t;
cin >> t;
while (t--) {
long long a, b;
cin >> a >> b;
a = abs(a - b);
long long ans = 0;
for (int i = 10; i >= 1; i--) {
long long d = a / i;
a... | ### 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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.