You are given an $array$ of size $N$ and an integer $K$ ( $N > 1 , K > 0$ ).
Each element in the array can be incremented by $K$ or decremented by $K$ $at$ $most$ $once$.
So there will be  $3^n$ possible combinations of final array. (As there are 3 options for every element).

Out of these combinations, you have to select a combination, in which the $absolute$ difference between the largest and the smallest element is $maximum$.
You have to print the $maximum$ $absolute$ $difference$.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains of a two lines of input
- First line contains two integers $N, K$. 
- Second line contains $N$ space separated integers.

-----Output:-----
For each testcase, output the maximum absolute difference that can be achieved on a new line.

-----Constraints-----
- $1 \leq T \leq 10$
- $2 \leq N \leq 1000$
- $1 \leq K , arr[i]  \leq 10000$
$NOTE$:  Large  input files, Use of fastio is recommended.

-----Sample Input:-----
2

4 3

4 2 5 1

3 5

2 5 3

-----Sample Output:-----
10

13

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
testcases=int(input())

for _ in range(testcases):
    (N,K)=list(map(int,input().split()))
    array=list(map(int,input().split()))
    
    max=array[0]
    min=array[0]
    
    for i in array:
        if i>max:
            max=i
        if i<min:
            min=i
            
    max=max+K 
    min=min-K
    
    print(abs(max-min))

t = int(input())
for i in range(t):
    n,k = list(map(int,input().split()))
    lst = list(map(int,input().split()))
    print(abs(min(lst)-k)+(max(lst)+k))


for _ in range(int(input())):
    n, k = map(int,input().split())
    arr = list(map(int,input().split()))
    maxv = max(arr)
    minv = min(arr)
    print(abs((maxv+k) - (minv-k)))

t=int(input())
for i in range(t):
    l=list(map(int,input().split()))
    n=l[0]
    k=l[1]
    m=list(map(int,input().split()))
    print(abs((max(m)+k)-(min(m)-k)))

# cook your dish here
a=int(input())
z=[]
for i in range(a):
    b=input().split()
    c=list(map(int,input().split()))
    z.append(max(c)-min(c)+2*int(b[1]))
for i in z:
    print(i)


# cook your dish here
for i in range(int(input())):
    N,K=map(int,input().split())
    lst=list(map(int,input().split()))
    p=max(lst)+K
    q=min(lst)-K
    print(abs(p-q))

t=int(input())
for _ in range(t):
    n,k=map(int,input().split())
    arr=list(map(int,input().split()))[:n]
    m=max(arr)
    mi=min(arr)
    a=(m-mi)+2*k
    print(a)

t=int(input())
while t>0:
    t-=1
    n,k = map(int,input().split())
    a = list(map(int, input().split()[:n]))
    mx = max(a) + k
    mn = min(a) - k
    print(mx-mn)

t=int(input())
while t>0:
    t-=1
    n,k = map(int,input().split())
    a = list(map(int, input().split()[:n]))
    m1 = max(a) 
    m2 = min(a) 
    m1 = m1+k
    m2 = m2-k
    print(m1-m2)

# cook your dish here
try:
    for _ in range(int(input())):
        n,k=map(int,input().split())
        li=list(map(int,input().split()))
        a=max(li)
        b=min(li)
        c=a+k 
        d=b-k 
        print(c-d) 
except:
    pass

try:
	for _ in range(int(input())):
		n,k=[*map(int, input().split())]
		t=[*map(int, input().split())]
		a=max(t)+k
		b=min(t)-k
		if b>0:
			print(abs(a-b))
		else:
			print(abs(b-a))
except: pass

def __starting_point():
    t = int(input())
    for _ in range(t):
        n,k = map(int, input().split())
        A = [int(i) for i in input().split()]
        print(max(A) - min(A) + 2*k)
__starting_point()

for _ in range(int(input())):
    n,k=map(int,input().split())
    l=list(map(int,input().split()))
    r=(max(l)-min(l))+2*k
    print(r)

for testcase in range(int(input())):
    n, k = map(int, input().split())
    arr = list(map(int, input().split()))
    maxv, minv = max(arr), min(arr)
    print(maxv-minv+2*k)

# cook your dish here
t=int(input())
for _ in range(t):
    n, k = map(int, input().split())
    array=list(map(int, input().split()))
    print(max(array)-min(array)+2*k)

for T in range(int(input())):
    N,K = map(int, input().split())
    L = list(map(int, input().split()))

    m = max(L)+K
    s = min(L)-K

    print(m-s)

for _ in range(int(input())):
    n,increment = list(map(int, input().split()))
    arr = list(map(int, input().split()))
    arr.sort()
    longVal = arr[-1]+increment
    shortVal = arr[0]-increment
    print(abs(longVal-shortVal))

try:
      for _ in range(int(input())):
            n,k=map(int,input().split())
       
            l=input().split()
            l=[int(i) for i in l]
            m=max(l)
            m+=k
            mi=min(l)
            mi-=k
            print(m-mi)
except EOFError:
      pass

t=int(input())
for i in range(t):
    n,k=map(int,input().split())
    z=list(map(int,input().split()))
    a=min(z)-k
    b=max(z)+k
    print(abs(b-a))

# cook your dish here
for _ in range(int(input())):
    n,k=map(int,input().split())
    l=list(map(int,input().split()))[:n]
    l.sort()
    a=l[0]-k
    b=l[-1]+k
    print(b-a)

for i in range(int(input())):
    n,k=list(map(int,input().split()))
    l=list(map(int,input().split()))
    ma=max(l)+k
    mi=min(l)-k
    print(abs(ma-mi))


try:
    t=int(input())
    for i in range(t):
        n,k=map(int,input().split())
        l=[int(x) for x in input().split()]
        print(  abs(  (max(l)+k) - (min(l)-k) )  )
except EOFError:
    pass

t=int(input())
for i in range(0,t):
    n,k=list(map(int,input().split()))
    x=list(map(int,input().split()))
    a=max(x)+k
    b=min(x)-k
    print(a-b)


for _ in range(int(input())):
    n, k = map(int, input().split())
    arr = list(map(int, input().split()))
    arr.sort(reverse=True)
    if arr[0] >= 0:
        arr[0] = arr[0]+ k
    elif arr[0] < 0:
        arr[0] -= k
    if arr[len(arr)-1] >= 0:
        arr[len(arr)-1] -= k
    elif arr[len(arr)-1] < 0:
        arr[len(arr)-1] -= k
   # print(arr)
    print(abs(arr[0] - arr[len(arr)-1]))

# cook your dish here
for i in range(int(input())):
    n,k=list(map(int,input().split()))
    a=list(map(int,input().split()))
    z=max(a)+k
    m=min(a)-k
    sum=abs(z)+abs(m)
    print(sum)