#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int str, in, ex, z;
    cin >> str >> in >> ex;
    if (str + ex - in <= 0) {
      cout << 0 << endl;
    } else {
      if (ex + in < str) {
        z = ex + 1;
      } else {
        z = ex;
      }
      if ((str + ex - in) % 2 == 0) {
        cout << min(((str + ex - in) / 2), z) << endl;
      } else {
        cout << min((((str + ex - in) / 2) + 1), z) << endl;
      }
    }
  }
  return 0;
}
