My issue
My code
#include <iostream>
#include<vector>
#include<cmath>
using namespace std;
int main() {
// your code goes here
int T;
std::cin >> T;
std::vector<std::pair<int, int>> testCases(T);
for (int i = 0; i < T; ++i) {
std::cin >> testCases[i].first >> testCases[i].second;
}
for (int i = 0; i < T; ++i) {
int X = testCases[i].first;
int Y = testCases[i].second;
int D = std::abs(X - Y);
int result;
if (D % 2 == 0) {
result = D / 2;
} else {
result = (D + 1) / 2;
}
std::cout << result << "\n";
}
return 0;
}
Problem Link: VOLCONTROL Problem - CodeChef