You play your favourite game yet another time. You chose the character you didn't play before. It has $str$ points of strength and $int$ points of intelligence. Also, at start, the character has $exp$ free experience points you can invest either in strength or in intelligence (by investing one point you can either raise strength by $1$ or raise intelligence by $1$).

Since you'd like to make some fun you want to create a jock character, so it has more strength than intelligence points (resulting strength is strictly greater than the resulting intelligence).

Calculate the number of different character builds you can create (for the purpose of replayability) if you must invest all free points. Two character builds are different if their strength and/or intellect are different.


-----Input-----

The first line contains the single integer $T$ ($1 \le T \le 100$) — the number of queries. Next $T$ lines contain descriptions of queries — one per line.

This line contains three integers $str$, $int$ and $exp$ ($1 \le str, int \le 10^8$, $0 \le exp \le 10^8$) — the initial strength and intelligence of the character and the number of free points, respectively.


-----Output-----

Print $T$ integers — one per query. For each query print the number of different character builds you can create.


-----Example-----
Input
4
5 3 4
2 1 0
3 5 5
4 10 6

Output
3
1
2
0



-----Note-----

In the first query there are only three appropriate character builds: $(str = 7, int = 5)$, $(8, 4)$ and $(9, 3)$. All other builds are either too smart or don't use all free points.

In the second query there is only one possible build: $(2, 1)$.

In the third query there are two appropriate builds: $(7, 6)$, $(8, 5)$.

In the fourth query all builds have too much brains.

Difficulty: interview

Starter code:

Solutions:
for TT in range(1, int(input()) + 1):
    a, b, c = map(int, input().split())
    l = max(-1, (b + c - a) // 2)
    r = c
    print(r - l if r >= l else 0)

for _ in range(int(input())):
    a,b,c=map(int,input().split())
    total=1+(a+b+c)//2
    print(max(0,a+c-max(total,a)+1))

t = int(input())

for _ in range(t):
    s, i, e = list(map(int, input().split()))

    half = (s + i + e) // 2
    maxeven = half + 1
    maxeven = max(maxeven, s)

    print(max(s + e - maxeven + 1, 0))


T = int(input())
for i in range(T):
    s, k, f = map(int, input().split())
    print(min(f + 1, max(0, (s + f - k + 1) // 2)))

T = int(input())
for t in range(T):
    s, i, e = list(map(int, input().split()))
    min_s = max((s + i + e)//2 + 1, s)
    max_s = s + e
    c = max(0, max_s-min_s+1)
    print(c)


for cas in range(int(input())):
    a, b, c = map(int, input().split())
    l = (b + c - a) // 2 + 1
    r = c
    print(max(0, r - max(l, 0) + 1))

for i in range(int(input())):
    a,b,c = list(map(int,input().split()))
    if a+c <= b:
        print(0)
    else:
        print(min((a+c-b+1)//2,c+1))


T = int(input())
for i in range(T):
    s, i, e = list(map(int, input().split()))
    if s > i + e:
        a = e + 1
    else:
        a = min((s+e-i-1)//2 + 1, e)
    if a <= 0:
        print(0)
    else:
        print(a)


for _ in range(int(input())):
    s, i, e = list(map(int, input().split()))
    if s + e <= i:
        print('0')
    elif s > i + e:
        print(e + 1)
    else:
        print((e + s + 1 - i) // 2)


T = int(input())
for _ in range(T):
    a, b, c = list(map(int, input().split()))
    print(max(c+1 - max((-a+b+c+2)//2, 0), 0))



from sys import stdin
input = stdin.readline

for _ in range(int(input())):
    s, i, e = [int(i) for i in input().split()]
    
    x = (i+e-s)//2
    
    if x < 0: print(e+1)
    elif x > e: print(0)
    else: print(e-x)

n=int(input())
for i in range(n):
    a,b,c=[int(x) for x in input().split()]
    l=0
    r=c
    while r-l>1:
        mid=(l+r)//2
        if a + mid >b+c-mid:
            r=mid
        else:
            l=mid
    if a>b+c:
        print(c+1)
    elif a+ r >b+c-r:
        print(c-r+1)
    
    else:
        print(0)
    
            


for _ in range(int(input())):
    ans = 0
    cnt = 0
    s, i, e = list(map(int, input().split()))
    b = (s - i + e - 1) // 2
    if b < 0:
        print(0)
    elif b == 0:
        print(1)
    elif b >= e:
        print(e + 1)
    else:
        print(b + 1)



n = int(input())
for i in range(n):
    s, i, e = (int(i) for i in input().split())
    if s > i + e:
        print(e + 1)
    elif s + e <= i:
        print(0)
    else:
        r = s - i
        r = e + r
        t = 0
        if r % 2:
            t = 1
        r = r // 2
        if t:
            r += 1
        print(r)


T = int(input())
for i in range(0, T):
    s, i, exp = (int(i) for i in input().split())
    if (s + exp <= i):
        print(0)
    elif (i + exp < s):
        print(exp + 1)
    else:
        print(exp + 1 - (i + exp - s + 2) // 2)

import math
n = int(input())
for i in range(n):
    a, b, c = [int(item) for item in input().split()]
    ans = min(c+1, max(0, math.ceil(((a - b) + c) / 2)))
    print(ans)

for _ in range(int(input())):
    
    s, i, e = map(int, input().split())
    
    lo, hi, res = 0, e, 0

    if s + e <= i:
        print(0)
        continue

    while lo <= hi:

        mi = (lo + hi) // 2

        if s + mi > i + (e - mi):
            res = mi
            hi = mi - 1
        else:
            lo = mi + 1
    
    print(e - res + 1)

t = int(input())
for _ in range(t):
    s, i, e = list(map(int, input().split()))
    if s + e <= i:
        print(0)
        continue
    if i + e < s:
        print(e + 1)
        continue
    mx = s + e
    dif = abs(s - i)
    if s > i:
        i += dif
    else:
        s += dif
    e -= dif
    mn = s + e // 2 + 1
    print(mx - mn + 1)


import math
ntc = int(input())
for tcs in range(ntc):
    s, i, e = list(map(int, input().split()))
    if s + e > i:
        res = math.ceil(((s + e) - i) / 2)
        print(min(res, e+1))
    else:
        print(0)

''' CODED WITH LOVE BY SATYAM KUMAR '''

from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys

sys.setrecursionlimit(10 ** 6)  # max depth of recursion
threading.stack_size(2 ** 27)  # new thread will get stack of such size
fac_warm_up = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7


class MergeFind:
    def __init__(self, n):
        self.parent = list(range(n))
        self.size = [1] * n
        self.num_sets = n
        self.lista = [[_] for _ in range(n)]

    def find(self, a):
        to_update = []
        while a != self.parent[a]:
            to_update.append(a)
            a = self.parent[a]
        for b in to_update:
            self.parent[b] = a
        return self.parent[a]

    def merge(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b:
            return
        if self.size[a] < self.size[b]:
            a, b = b, a
        self.num_sets -= 1
        self.parent[b] = a
        self.size[a] += self.size[b]
        self.lista[a] += self.lista[b]

    def set_size(self, a):
        return self.size[self.find(a)]

    def __len__(self):
        return self.num_sets


def display(string_to_print):
    stdout.write(str(string_to_print) + "\n")


def prime_factors(n):  # n**0.5 complex
    factors = dict()
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        while n % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1
            n = n // i
    if n > 2:
        factors[n] = 1
    return (factors)


def all_factors(n):
    return set(reduce(list.__add__,
                      ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))


def fibonacci_modP(n, MOD):
    if n < 2: return 1
    return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(
        fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD


def factorial_modP_Wilson(n, p):
    if (p <= n):
        return 0
    res = (p - 1)
    for i in range(n + 1, p):
        res = (res * cached_fn(InverseEuler, i, p)) % p
    return res


def binary(n, digits=20):
    b = bin(n)[2:]
    b = '0' * (digits - len(b)) + b
    return b


def is_prime(n):
    """Returns True if n is prime."""
    if n < 4:
        return True
    if n % 2 == 0:
        return False
    if n % 3 == 0:
        return False
    i = 5
    w = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += w
        w = 6 - w
    return True


def generate_primes(n):
    prime = [True for i in range(n + 1)]
    p = 2
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    return prime


factorial_modP = []


def warm_up_fac(MOD):
    nonlocal factorial_modP, fac_warm_up
    if fac_warm_up: return
    factorial_modP = [1 for _ in range(fac_warm_up_size + 1)]
    for i in range(2, fac_warm_up_size):
        factorial_modP[i] = (factorial_modP[i - 1] * i) % MOD
    fac_warm_up = True


def InverseEuler(n, MOD):
    return pow(n, MOD - 2, MOD)


def nCr(n, r, MOD):
    nonlocal fac_warm_up, factorial_modP
    if not fac_warm_up:
        warm_up_fac(MOD)
        fac_warm_up = True
    return (factorial_modP[n] * (
                (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD)) % MOD)) % MOD


def test_print(*args):
    if testingMode:
        print(args)


def display_list(list1, sep=" "):
    stdout.write(sep.join(map(str, list1)) + "\n")


def display_2D_list(li):
    for i in li:
        print(i)


def prefix_sum(li):
    sm = 0
    res = []
    for i in li:
        sm += i
        res.append(sm)
    return res


def get_int():
    return int(stdin.readline().strip())


def get_tuple():
    return list(map(int, stdin.readline().split()))


def get_list():
    return list(map(int, stdin.readline().split()))


memory = dict()


def clear_cache():
    nonlocal memory
    memory = dict()


def cached_fn(fn, *args):
    nonlocal memory
    if args in memory:
        return memory[args]
    else:
        result = fn(*args)
        memory[args] = result
        return result


def ncr(n, r):
    return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))


def binary_search(i, li):
    fn = lambda x: li[x] - x // i
    x = -1
    b = len(li)
    while b >= 1:
        while b + x < len(li) and fn(b + x) > 0:  # Change this condition 2 to whatever you like
            x += b
        b = b // 2
    return x


# -------------------------------------------------------------- MAIN PROGRAM


TestCases = True
fac_warm_up_size = 10 ** 5 + 100
optimise_for_recursion = False  # Can not be used clubbed with TestCases WHen using recursive functions, use Python 3


def main():
    s, i, e = get_tuple()
    print(min(max(0, (s+e+1-i)//2), e+1))
# --------------------------------------------------------------------- END=


if TestCases:
    for i in range(get_int()):
        main()
else:
    main() if not optimise_for_recursion else threading.Thread(target=main).start()


n = int(input())
for i in range(n):
    s, i, e = map(int, input().split())
    print(min(max(0, (s - i + e + 1) // 2), e + 1))

import sys 
import math 
from collections import defaultdict
input = lambda : sys.stdin.readline().rstrip()

for t in range(int(input())):
  s, i, e = map(int, input().split())
  
  x = (i + e - s) / 2

  if x < 0:
    print(e + 1)
  
  elif x == 0:
    print(e)

  elif x >= e:
    print(0)
  
  else:
    print(e - int(x))

t = int(input())
while (t > 0):
    t -= 1
    s, i, e = [int(x) for x in input().split()]
    ms = s + e
    if (ms <= i):
        print(0)
    else:
        c = (ms - i + 1) // 2
        print(min(c, e + 1))


for q in range(int(input())):
    x, y, z = list(map(int, input().split()))
    if x <= y:
        z -= y-x+1
        if z < 0:
            print(0)
        else:
            print(z//2+1)
    elif z < x-y:
        print(z+1)
    else:
        z -= x-y+1
        print(x-y+z//2+1)