In beginners section’s practice questions

There’s a question named IPL and RCB

I solved that question in python 3.6 and it was running correctly for the sample input and tried to submit my code

but it is generating error

Please find the error

this is my code

please tell me where am I going wrong?

t=int(input())

while(t!=0): # x=points required and y=matches left and in output , print min matches to win

x,y=map(int,input().split(" "))

if x==2*y:
print(y)
elif x==1 and y!=0:
print(0)
elif x%2!=0 and x!=1 and x<2*y:

print(x//2)

else:

print(x/2)

t-=1