#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int s, it, e;
    cin >> s >> it >> e;
    if (s <= it) {
      if (e <= (it - s)) {
        cout << 0 << endl;
      } else {
        e -= (it - s);
        int res = e / 2;
        if (e % 2 == 1) {
          res++;
        }
        cout << res << endl;
      }
    } else {
      if (e >= (s - it)) {
        int res = s - it;
        e -= (s - it);
        res += (e / 2);
        if (e % 2 == 1) {
          res++;
        }
        cout << res << endl;
      } else {
        cout << e + 1 << endl;
      }
    }
  }
  return 0;
}
