what is the best way to solve permutations?

problem was very simple that i have a array of length 10 say [1,2,3,4,5,6,7,8,9,10] and need to return the count of the sum of pairs which are even of length K (2)
range of array limit is 10^9 and range of k is 10^6

from itertools import product
for i in product(arr,repeat=2):
	if sum(i)%2==0:
		count+=1

problem with the above code it alwas runs in TLE for big numbers any suggestion or other apporches to solve this type of problems?

Comments (1)