I have a program in which I need to find the maximum value of expression.
The expression is :
result=(x&z)*(y&z)
in which the value of z is in the range of [l,r].
I have written a program about it which is absolutely correct.
# cook your dish here
t=int(input())
for i in range(t):
x,y,l,r=map(int,input().split())
L=[]
I=[]
for i in range(l,r+1):
r=(x&i)*(y&i)
L.append(r)
I.append(i)
R=max(L)
i=L.index(R)
print(L)
print(I[i])
I want to a faster way to do it