#include <bits/stdc++.h>
int main() {
  int T, i;
  long long str, intel, exp, a, k;
  scanf("%d", &T);
  for (i = 0; i < T; i++) {
    scanf("%lld%lld%lld", &str, &intel, &exp);
    k = 0;
    if (str <= intel) {
      a = (intel - str) + 1;
      if (exp < a) {
        printf("%lld\n", k);
        continue;
      } else {
        str += a;
        exp -= a;
      }
    }
    a = (str - intel) - 1;
    k++;
    if (exp < a) {
      k += exp;
      printf("%lld\n", k);
      continue;
    }
    exp -= a;
    k += a;
    exp /= 2;
    k += exp;
    printf("%lld\n", k);
  }
  return 0;
}
