#include using namespace std; const int MaxN = (int)1e6 + 10; const int INF = 1e9; int solve(int a, int b, int c) { if (a > c) { swap(a, c); } if (b > a && b > c) { a = -a; b = -b; c = -c; swap(a, c); } if (a <= b && b <= c) { int x = b - a; int y = c - b; if (x > y) { swap(x, y); } return (y - x + 1) / 2; } // a >= b && c >= b return a - b + (c - a + 1) / 2; } int rnd(int l, int r) { return (1LL * RAND_MAX * rand() + rand()) % (r - l + 1) + l; } int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); /* freopen("input.txt", "w", stdout); printf("%d\n", 10000); for (int i = 1; i <= 10000; ++i) { if (i <= 1000) { printf("%d %d %d\n", rnd(-10, +10), rnd(-10, +10), rnd(-10, +10)); } else { printf("%d %d %d\n", rnd(-INF, INF), rnd(-INF, INF), rnd(-INF, INF)); } }*/ int t; cin >> t; while (t --> 0) { int a, b, c; cin >> a >> b >> c; cout << solve(a, b, c) << '\n'; } return 0; }