#include <bits/stdc++.h>   using namespace std;   int t;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> t;     while (t--) {       int a, b, c;       cin >> a >> b >> c;       if (c == 0) {         if (a <= b)           cout << 0 << endl;         else           cout << 1 << endl;         continue;       } else if (a + c <= b) {         cout << 0 << endl;         continue;       }       int res;       if (a == b) {         res = c / 2;         if (c % 2 == 1) res++;       } else if (a > b) {         if (b + c < a)           res = c + 1;         else if (b + c == a)           res = c;         else {           if ((b + c - a) % 2 == 1)             res = (b + c - a) / 2 + 1 + a - b;           else             res = (b + c - a) / 2 + a - b;         }       } else {         if ((a + c - b) % 2 == 1)           res = (a + c - b) / 2 + 1;         else           res = (a + c - b) / 2;       }       cout << res << endl;     }   }   