T=int(input()) for _ in range(T): L,R=map(int,input().split()) c=R-2*L if(c<0): print(0) else : print(int((c+2)*(c+1)/2))
用C++写的就过了,这个用python写的哪里不对吗=.=怎么过不了