问题 Given a list of size N. Find the number of pairs (i, j) such that A[i] XOR A[j] = x, and 1 <= i < j <= N. Input : list = [3, 6, 8, 10, 15, 50], x = 5 Output : 2 Explanation : (3 ^ 6) = 5 and (10 ^ 15) = 5 This is my code (brute force): import itertools n=int(input()) pairs=0 l=list(map(int,raw_input().split())) q=[x for x in l if x%2==0] p=[y for y in l if y%2!=0] for a, b in itertools.combinations(q, 2): if (a^b!=2) and ((a^b)%2==0) and (a!=b): pairs+=1 for a, b in itertools.combinations(p,