Problem Author: | Omar Alimammad |
Prepared by: | Hasan Saleh (MathModel) |
Edited by: | Hasan Saleh (MathModel) |
Solution
The problem can be formulated to the following problem :
Let then for which it holds :
thus a solution only exist if b-a is even which is x=\frac{b-a}{2} otherwise the answer is .
Complexity .
for _ in range(int(input())):
a,b=map(int,input().split())
if(abs(a-b)%2==0):
print((abs(a-b))//2)
else:
print(-1)