Given an array `A` and an integer `x`, map each element in the array to `F(A[i],x)` then return the xor sum of the resulting array.

where F(n,x) is defined as follows:

F(n, x) = ^(x)Cx **+** ^(x+1)Cx **+** ^(x+2)Cx **+** ... **+** ^(n)Cx

and ^(n)Cx represents [Combination](https://en.m.wikipedia.org/wiki/Combination) in mathematics

### Example

```python
a = [7, 4, 11, 6, 5]
x = 3

# after mapping, `a` becomes [F(7,3), F(4,3), F(11,3), F(6,3), F(5,3)]

return F(7,3) ^ F(4,3) ^ F(11,3) ^ F(6,3) ^ F(5,3)
#=> 384
```
##### e.g
F(7, 3) = ^(3)C3 + ^(4)C3 + ^(5)C3  + ^(6)C3 + ^(7)C3


## Constraints

**1 <= x <= 10**

**x <= A[i] <= 10^(4)**

**5 <= |A| <= 10^(3)**

Source: codewars | Difficulty: EASY
Tags: Mathematics

Starter code: def transform(A, x):
	

Solutions:
from functools import reduce
from gmpy2 import comb
from operator import xor

def transform(a, x):
	return reduce(xor, (comb(n + 1, x + 1) for n in a))


def transform(A, x):
	(c, i, f, r) = (1, x, 0, None)
	for n in sorted(A):
		while i <= n:
			c *= i
			c //= i - x or x
			i += 1
			f += c
		if r is None:
			r = f
		else:
			r ^= f
	return r


from functools import reduce

def transform(lst, r):
	return reduce(int.__xor__, (F(n, r) for n in lst))

def F(n, r):
	t = 1
	for i in range(1, r + 2):
		t = t * (n - i + 2) // i
	return t


from gmpy2 import comb
from operator import xor
from functools import reduce
transform = lambda A, x: reduce(xor, (comb(n + 1, x + 1) for n in A))


from functools import reduce
from operator import xor
F = [[0] * 11 for i in range(10001)]
for x in range(1, 11):
	F[x][x] = y = 1
	for i in range(x + 1, 10001):
		y = y * i // (i - x)
		F[i][x] = F[i - 1][x] + y

def transform(A, x):
	return reduce(xor, (F[a][x] for a in A))


from functools import reduce
from operator import xor
from scipy.misc import comb

def transform(A, x):
	return reduce(xor, map(lambda n: comb(n + 1, x + 1, exact=True), A))


from scipy.special import binom
from operator import xor
from functools import reduce

def transform(A, x):
	return reduce(xor, [int(round(binom(n + 1, x + 1))) for n in A])


from functools import reduce
from itertools import accumulate

def transform(a, x):
	b = sorted(set([x] + a))
	C = [[1]]

	def g(m, n):
		w = [C[-1][-1]]
		for (i, j) in enumerate(m, start=1):
			w.append(w[i - 1] * j / (j - n))
		return C.append(w[1:])
	for j in (range(b[i - 1] + 1, b[i] + 1) for i in range(1, len(b))):
		g(j, x)
	v = {x: y for (x, y) in zip(b, accumulate((int(sum(i)) for i in C)))}
	return reduce(lambda x, y: x ^ y, [v[i] for i in a])


from scipy.special import comb as f
from functools import reduce

def transform(arr, n):
	arr = (f(x + 1, n + 1, exact=True) for x in arr)
	return reduce(lambda x, y: x ^ y, arr)