Problem:


Score : 200 points

Problem Statement

You are given an integer sequence A of length N.
Find the maximum absolute difference of two elements (with different indices) in A.

Constraints

2 \leq N \leq 100

1 \leq A_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 ... A_N

Output

Print the maximum absolute difference of two elements (with different indices) in A.

Sample Input 1

4
1 4 6 3

Sample Output 1

5

The maximum absolute difference of two elements is A_3-A_1=6-1=5.

Sample Input 2

2
1000000000 1

Sample Output 2

999999999

Sample Input 3

5
1 1 1 1 1

Sample Output 3

0



Sample input:
4
1 4 6 3


Sample output:
5

Submission status: Accepted

Solution code:
n = input()
args = input().split()
nums = [0]*len(args)

for i in range(len(args)):
    nums[i] = int(args[i])

print(max(nums) - min(nums))

Submission status: Accepted

Solution code:
n = int(input())

a = list(map(int, input().split()))

lis = []

for i in range(n - 1):
  for j in range(i + 1, n):
    lis.append(abs(a[i] - a[j]))
    
print(max(lis))

Submission status: Accepted

Solution code:
from itertools import combinations

N = int(input())
A = list(map(int, input().split()))

res = 0
for p, q in combinations(A,2):
    res = max(res, abs(p-q))
print(res)

Submission status: Accepted

Solution code:
N = int(input())

A=list(map(int, input().split()))

A_s = set(A)
A.sort()
A.reverse()

a1 = A[0]
a2 = A[-1]


print(a1-a2)

Submission status: Accepted

Solution code:
# 入力
N = int(input())
A_list = list(map(int, input().split()))

# 計算
M = max(A_list)
m = min(A_list)
result = M - m

print(result)

Submission status: Accepted

Solution code:
input()
a = sorted(map(int, input().split()))
print(a[-1] - a[0])

Submission status: Accepted

Solution code:
n = int(input())
array = list(map(int, input().split()))

ans = 0
for i in range(n):
    for j in range(n):
        if ans < abs(array[i] - array[j]):
            ans = abs(array[i] - array[j])

print(ans)

Submission status: Accepted

Solution code:
# ABC102b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = input()
a = list(map(int, input().split()))
print(max(a)-min(a))

Submission status: Accepted

Solution code:
n = int(input())
A = sorted(map(int,input().split()))
print(A[-1]-A[0])

Submission status: Accepted

Solution code:
N=int(input())
l=sorted(list(map(int,input().split())))
print(l[-1]-l[0])

Submission status: Accepted

Solution code:
N=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(N-1):
  for j in range(i+1,N):
    ans=max(ans,abs(l[i]-l[j]))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(list(map(int,input().split())))
print(a[-1]-a[0])

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(map(int,input().split()))
print(a[n-1]-a[0])

Submission status: Accepted

Solution code:
N = int(input())
A = [int(str) for str in input().strip().split()]

print(max(A) - min(A))

Submission status: Accepted

Solution code:
n = int(input())
A = sorted([int(num) for num in input().split()])
print(max(A) - min(A))

Submission status: Accepted

Solution code:
n = input()
a = list(map(int, input().split()))

a.sort()
print(abs(a[-1]-a[0]))

Submission status: Accepted

Solution code:
N = int(input())
An = list(map(int, input().split()))

print(max(An) - min(An))

Submission status: Accepted

Solution code:




def main():

    N = int(input())
    aList = list(map(int,input().split()))
    atMax = max(aList)
    atMin = min(aList)
    print(atMax-atMin)



 





if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
_=input()
a=list(map(int,input().split()))

print(max(a)-min(a))

Submission status: Accepted

Solution code:
n = int(input())
ls = sorted(map(int, input().split()))
print(abs(ls[0] - ls[-1]))

Submission status: Accepted

Solution code:
N = int(input())
Nlist = input().split()

wMax = int(Nlist[0])
wMin = int(Nlist[0])
for value in Nlist:
    if int(value) > wMax:
        wMax = int(value)
    if int(value) < wMin:
        wMin = int(value)

print(abs(wMax - wMin))

Submission status: Accepted

Solution code:
input()
nums = list(map(int, input().split()))

print(max(nums) - min(nums))

Submission status: Accepted

Solution code:
n = int(input())
src = list(map(int, input().split()))
print(max(src)-min(src))

Submission status: Accepted

Solution code:
n = int(input())
a =list(map(int, input().split()))
a.sort()
print(a[-1] - a[0])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
cand = []
for i in range(n):
    for j in range(i + 1, n):
        cand.append(abs(a[i] - a[j]))
print(max(cand))

Submission status: Accepted

Solution code:
N=int(input())
A=input().split()
A=[int(A[i]) for i in range(0,N)]
max=A[0]
min=A[0]
for i in range(1,N):
    if max<A[i]:
        max=A[i]
    if min>A[i]:
        min=A[i]
dif=max-min
print(dif)

Submission status: Accepted

Solution code:
N = input()
A = list(map(int, input().split()))

print(max(A)-min(A))

Submission status: Accepted

Solution code:
N,*A=map(int,open(0).read().split())
A = sorted(A)
print(A[-1]-A[0])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

maxA = max(A)
minA = min(A)

print(maxA - minA)

Submission status: Accepted

Solution code:
input()
a = sorted(map(int, input().split()))
print(abs(a[-1]-a[0]))

Submission status: Accepted

Solution code:
m = int(input())
i = list(map(int,input().split()))

i_max = max(i)
i_min = min(i)

print(abs(max(i)-min(i)))

Submission status: Accepted

Solution code:
_ = input()
A = list(map(int, input().strip().split(' ')))
print(max(A)-min(A))

Submission status: Accepted

Solution code:
input()
a = list(map(int, input().split()))
print(abs(max(a) - min(a)))

Submission status: Accepted

Solution code:
n = int(input())
maximum = 0
a = list(map(int,input().split()))
for i in range(n):
  for j in range(i+1,n):
    if abs(a[i]-a[j]) > maximum:
      maximum = abs(a[i]-a[j])
print(maximum)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))

A = sorted(A)

print(A[-1] - A[0])

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split()))
print(max(arr) - min(arr))

Submission status: Accepted

Solution code:
N=input()
A = list(map(int,input().split()))
print(abs(max(A)-min(A)))

Submission status: Accepted

Solution code:
n=int(input())
box=list(map(int,input().split()))
print(max(box)-min(box))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
diff = 0
for i in range(N):
    for j in range(i, N):
        diff_new = abs(A[i] - A[j])
        if diff_new > diff:
            diff = diff_new
            
print(diff)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
M = 0
for i in range(N):
    for j in range(i + 1, N):
        if (max(A[i], A[j]) - min(A[i], A[j])) > M:
            M = (max(A[i], A[j]) - min(A[i], A[j]))
print(M)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))

A.sort()

print(abs(A[N-1]-A[0]))

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
As = input().split()
for i in range(N):
  As[i] = int(As[i])  
As = np.array(As)

max_val = np.max(As)
min_val = np.min(As)

print(max_val-min_val)

Submission status: Accepted

Solution code:
N=int(input())
a=sorted(map(int,input().split()))
print(a[-1]-a[0])

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split(" ")))

min = 1000000000
max = 1


for i in arr:
  if min > i:
    min = i
  if max < i:
    max = i

ans = max - min
print(ans)

Submission status: Accepted

Solution code:
input()
A=(sorted(map(int,input().split())))
print(A[-1]-A[0])

Submission status: Accepted

Solution code:
A =int(input())
l =list(map(int,input().split()))
s =(sorted(l))
print(s[-1]-s[0])

Submission status: Accepted

Solution code:
n = int(input())
lst = sorted(map(int, input().split()))
print(lst[-1]-lst[0])

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

def main():
    _ = int(input())
    A = list(map(int, input().split()))
    A.sort()
    print(A[-1]-A[0])

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans=0
for i in range(N):
  for j in range(N):
    if abs(A[i] - A[j]) > ans:
      ans = abs(A[i] - A[j])
print(ans)

Submission status: Accepted

Solution code:
# ABC102 B - Maximum Difference
N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(N):
    for j in range(i+1,N):
        t = abs(A[i]-A[j])
        ans = max(ans,t)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
As = list(map(int, input().split()))
r = max(As)-min(As)
print(r)

Submission status: Accepted

Solution code:
input()
a = set(map(int,input().split()))
print(max(a)-min(a))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(_) for _ in input().rstrip().split()]

ans = 0
for i in range(N):
    for j in range(N):
        temp = abs(A[i]-A[j])
        ans = max(ans, temp)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
maxabs = 0

for i in range(n):
  for j in range(i+1,n):
    c = abs(a[i] - a[j])
    maxabs = max(maxabs,c)
    
print(maxabs)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

A = sorted(A)
print(A[-1]-A[0])

Submission status: Accepted

Solution code:
input()
A = list(map(int, input().split()))
print(max(A) - min(A))

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    aaa = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        for j in range(i,n):
            ans = max(ans, abs(aaa[i]-aaa[j]))
    print(ans)
resolve()

Submission status: Accepted

Solution code:
import sys
from collections import deque
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
a_li = na()
ans = -1
for i in range(n):
    for j in range(i+1, n):
        ans = max(ans, abs(a_li[i] - a_li[j]))
print(ans)

Submission status: Accepted

Solution code:
_ = input()
a = sorted(list(map(int, input().split())))
print(abs(a[-1] - a[0]))

Submission status: Accepted

Solution code:
N = int(input())
As = list(map(int, input().split()))
max_diff = - float('inf')
for i in range(N):
    for j in range(i + 1, N):
        max_diff = max(max_diff, abs(As[i] - As[j]))
print(max_diff)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

ans = 0

for i in a:
    for j in a:
        ans = max(ans,i-j)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

deka = a[0]
mini = a[0]
for i in range(1,n):
  if a[i] > deka:
    deka = a[i]
  if a[i] < mini:
    mini = a[i]

print(abs(deka - mini))

Submission status: Accepted

Solution code:
N = int(input())

a = sorted(map(int,input().split()))

print(max(a)-min(a))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()

print(a[-1]-a[0])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

input()
seq = list(map(int, input().split()))
print(max(seq) - min(seq))

Submission status: Accepted

Solution code:
n = int(input())
a_list = list(map(int, input().split()))

max_zettai = 0
for i in range(n-1):
    for j in range(i+1, n):
        sa = abs(a_list[j] - a_list[i])
        max_zettai = max(sa, max_zettai)
print(max_zettai)

Submission status: Accepted

Solution code:
n = int(input())
an = list(map(int, input().split()))
print(max(an) - min(an))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
max = max(a)
min = min(a)
print(max-min)

Submission status: Accepted

Solution code:
input()
A=list(map(int,input().split()))
print(max(A)-min(A))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
mina = a[0]
maxa = a[0]
for i in range(n):
         if a[i] > maxa:
                  maxa = a[i]
         elif a[i] < mina:
                  mina = a[i]
print(maxa - mina)

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())))

print(max(a) - min(a))

Submission status: Accepted

Solution code:
n,a=open(0);s=sorted(map(int,a.split()));print(s[-1]-s[0])

Submission status: Accepted

Solution code:
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

mod = 1000000007

"""
# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    L = list(map(int, sys.stdin.readline().split()))

    ans = 0
    for l1 in L:
        for l2 in L:
            diff = abs(l1- l2)
            ans = max(ans, diff)
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A  = list(map(int,input().split()))
if max(A) == min(A):
    print(0)
else:
    print(max(A)-min(A))

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
a.sort()
print(abs(a[-1]-a[0]))

Submission status: Accepted

Solution code:
n=int(input())
a = list(map(int,input().split()))
ans=0
for i in range(n-1):
    for j in range(n-i-1):
        j+=i+1
        d=a[i]-a[j]
        if(d<0):
            d=-d
        ans=max(ans,d)

print(ans)

Submission status: Accepted

Solution code:
input()
n = list(map(int, input().split()))
print(max(n) - min(n))

Submission status: Accepted

Solution code:
N = int(input())
n = list(map(int, input().split()))
print(max(n) - min(n))

Submission status: Accepted

Solution code:
N = int(input())
n = list(map(int, input().split()))
print(0 if max(n) == min(n) else max(n) - min(n))

Submission status: Accepted

Solution code:
def test():
    n = int(input())
    a = list(map(int,input().split()))
    print(abs(max(a)-min(a)))


if __name__ == "__main__":
    test()

Submission status: Accepted

Solution code:
input()
r=list(map(int,input().split()))
print(max(r)-min(r))

Submission status: Accepted

Solution code:
n = int(input())
array = list(map(int,input().split()))
print(abs(max(array)-min(array)))

Submission status: Accepted

Solution code:
n = int(input())
array =  list(map(int,input().split()))
ma = 0

for i in range(n):
    for j in range(i+1,n):
      ma = max(ma,abs(array[i]-array[j]))
print(ma)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    A = sorted(A)
    return A[-1] - A[0]

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
input()
nl = [int(s) for s in input().split()]
print(max(nl) - min(nl))

Submission status: Accepted

Solution code:
import sys
from collections import deque
import copy

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    nums = string_to_int(inputs[0])
    nums.sort()
    return abs(nums[0] - nums[-1])


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

Submission status: Accepted

Solution code:
n=int(input())
a=sorted(list(map(int,input().split())));print(a[-1]-a[0])

Submission status: Accepted

Solution code:
n = int(input())
a_list = list(map(int, input().split()))

print(int(max(a_list) - min(a_list)))

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())))

print(abs(a[0]-a[-1]))

Submission status: Accepted

Solution code:
_, N = input(), list(map(float, input().split()))

max = 0
min = 10 ** 9

for i in N:
    if max < i:
        max = i
    if min > i:
        min = i

print(int(abs(min - max)))

Submission status: Accepted

Solution code:
_, N = input(), list(map(float, input().split()))

print(int(abs(max(N) - min(N))))

Submission status: Accepted

Solution code:
c=int(input())
n=list(map(int, input().split()))
print(max(n) - min(n))

Submission status: Accepted

Solution code:
N = int(input())
n_list = sorted(list(map(int,input().split())))

print(abs(n_list[-1]-n_list[0]))

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
max_diff = 0
for i in range(n):
    for j in range(i+1,n):
        tmp = abs(a[i] - a[j])
        if max_diff < tmp:
            max_diff = tmp

print(max_diff)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A.sort()
print(A[len(A) - 1] - A[0])

Submission status: Accepted

Solution code:
input()
A = list(map(int,input().split()))

print(max(A)-min(A))

Submission status: Accepted

Solution code:
n=int(input())

a=list(map(int, input().split()))

print(max(a)-min(a))

Submission status: Accepted

Solution code:
N = int(input())
a = sorted(map(int, input().split()))
print(a[-1] - a[0])

Submission status: Accepted

Solution code:
n= int(input())
array = [int(i) for i in input().split()]

array.sort()

print(array[-1]-array[0])

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()


for i in range(n):
	a[i] = int(a[i])

a = sorted(a)

print(int(a[len(a)-1] - a[0]))

Submission status: Accepted

Solution code:
n = input()
a = sorted(map(int,input().split()))
print(a[-1]-a[0])

Submission status: Accepted

Solution code:
n=int(input())
l=sorted(list(map(int,input().split())))
print(l[n-1]-l[0])

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    return max(a) - min(a)


if __name__ == "__main__":
    print(solve())

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
lst = []
for i in range(N-1):
    for j in range(i+1,N):
        lst.append(abs(a[i]-a[j]))
print(max(lst))

Submission status: Accepted

Solution code:
N = list(map(int, input().split()))
A = list(map(int, input().split()))
mx = max(A)
mn = min(A)
print(mx - mn)

Submission status: Accepted

Solution code:
N = int(input())
AN = [int(x) for x in input().split()]
print(max(AN)-min(AN))

Submission status: Accepted

Solution code:
n = int(input())

a = list(map(int,input().split()))

B = a.sort()


print(a[-1]-a[0])

Submission status: Accepted

Solution code:
input()
A = list(map(int,input().split()))
print(max(A) - min(A))

Submission status: Accepted

Solution code:
N = int(input())
l = list(map(int, input().split()))

print(max(l) - min(l))

Submission status: Accepted

Solution code:
input()
l=list(map(int,input().split()))
print(max(l)-min(l))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
ans = -100
for i in range(N):
    for j in range(i, N):
        s = abs(A[i] - A[j])
        ans = max(ans, s)
print(ans)

Submission status: Accepted

Solution code:
N = input()
A=sorted(map(int,input().split()),reverse = True)
s = A[0]-A[-1]
print(s)

Submission status: Accepted

Solution code:
N = int(input())
As = list(map(int, input().split()))

ans = -1

for i in range(N):
  for j in range(i, N):
    tmp = abs(As[i] - As[j])
    ans = max(ans, tmp)
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
x = sorted(map(int,input().split()))
print(abs(x[-1]-x[0]))

Submission status: Accepted

Solution code:
a=int(input())
b=sorted(map(int,input().split()))
print(b[-1]-b[0])

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    
    print(abs(max(A) - min(A)))

main()

Submission status: Accepted

Solution code:
input()
A = list(map(int, input().split()))
print (max(A) - min(A))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
print(abs(a[0] - a[-1]))

Submission status: Accepted

Solution code:
n=int(input())
a1=input().split()
a2=[]
for i in range(n):
    a2.append(int(a1[i]))

print(max(a2)-min(a2))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
a.sort()
print(a[-1] - a[0])

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.sort()
print(A[N - 1] - A[0])

Submission status: Accepted

Solution code:
import math
import copy
import sys

def rotation(s):
    rot = []
    for i in range(1, len(s)):
        rot.append(s[i])

    rot.append(s[0])

    return rot

inputa = input().split()
inputb = input().split()
# inputc = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

# inputaList = [int(n) for n in inputa]

# inputb = input().split()
# inputbList = [int(n) for n in inputb]
#
# inputList = []
# inputNumList = []
# for i in range(a):
#     inputNum = input()
#     inputNumList = list(inputNum)
#     inputList.append(inputNumList)

# inputList = [int(n) for n in inputList]

b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

# a = str(inputa[0])
# inputaList = list(a)

max = 0

for i in range(a):
    for j in range(i+1, a):
        tmp = abs(b[i]- b[j])

        if tmp > max:
            max = tmp

print(max)

Submission status: Accepted

Solution code:
N = int(input())

a_list = list(map(int, input().split()))

max_num = -1
min_num = 10000000000

for i in range(N):
    num = a_list[i]
    if num > max_num:
        max_num = num
    if num < min_num:
        min_num = num

print(max_num - min_num)

Submission status: Accepted

Solution code:
n=int(input())

li = list(map(int,input().split()))
ans=[];count=[]
#li.sort(reverse=True)

#print(abs(li[0]-li[-1]))
mx=li[0];mn=li[0]
for i in range(1,n) :
  cr=li[i]
  if cr>mx :
    mx=cr
  if cr< mn :
    mn=cr
    
print(abs(mx-mn))

Submission status: Accepted

Solution code:
n=int(input())

li = list(map(int,input().split()))
ans=[]
li.sort(reverse=True)

print(abs(li[0]-li[-1]))

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))

l.sort()

print(l[-1] - l[0])

Submission status: Accepted

Solution code:
_ = int(input())
A = [int(x) for x in input().split()]
print(max(A)-min(A))

Submission status: Accepted

Solution code:
Num = int(input())
Num_Array = list(map(int,input().split()))
Max_Num = -1
Min_Num = 1000000000000

for i in range(0,Num):

    if Num_Array[i] > Max_Num:
        Max_Num = Num_Array[i]

    if Num_Array[i] < Min_Num:
        Min_Num = Num_Array[i]

print(Max_Num - Min_Num)

Submission status: Accepted

Solution code:
N = int(input())
num_list = list(map(int,input().split()))
diff_list=[]

for num in num_list:
  temp = [abs(temp_num-num) for temp_num in num_list]
  diff_list+=temp
print(max(diff_list))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))

max = 0
min = 10000000000000000000

for i in range(N):
    if max < A[i]:
        max = A[i]

for i in range(N):
    if min > A[i]:
        min = A[i]
       
print(max-min)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
 
print(max(a) - min(a))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N - 1):
    for j in range(N):
        ans = max(ans, abs(A[i] - A[j]))
        
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = sorted(A)
print(B[N-1]-B[0])

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))
 
ans=-1
for i in range(n-1):
    for j in range(i, n):
        ans=max(ans, abs(a[i]-a[j]))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
lst = list(map(int, input().split()))
ans = []
for i in range(len(lst)-1):
  for j in range(i+1,len(lst)):
  	ans.append(abs(lst[i] - lst[j]))
print(max(ans))

Submission status: Accepted

Solution code:
n = input()
int_list = [abs(int(i)) for i in input().split()]

print(max(int_list) - min(int_list))

Submission status: Accepted

Solution code:
n = int(input())
a_list = [int(i) for i in input().split()]
d_list =[]

for i in range(n):
	for j in range(n-i):
		# print(i,n-j-1)
		d_list.append(abs(a_list[i]-a_list[n-j-1]))
		
print(max(d_list))

Submission status: Accepted

Solution code:

n = int(input())
As = list(map(int, input().split()))
As.sort()
print(abs(As[-1] - As[0]))

Submission status: Accepted

Solution code:
input()
li = list(map(int,input().split()))
print(max(li)-min(li))

Submission status: Accepted

Solution code:
a = int(input())
b = list(map(int,input().split()))

print(max(b) - min(b))

Submission status: Accepted

Solution code:
N = int(input())
A= list(map(int, input().split()))
print(max(A) - min(A))

Submission status: Accepted

Solution code:
input()
l = list(map(int, input().rstrip("\n").split()))

print(max(l) - min(l))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
m1 = max(a)
m2 = min(a)
print(m1-m2)

Submission status: Accepted

Solution code:
N = int(input())
A = input().split()
A = sorted(A, key = int)
print(int(A[N-1]) - int(A[0]))

Submission status: Accepted

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
print(max(A)-min(A))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        ans = max(ans, abs(A[i]-A[j]))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list( map(int, input().split()) )
print(max(A)-min(A))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
ma = 0
for i in range(n):
    for j in range(i + 1, n):
        ma = max(ma, abs(a[i] - a[j]))
print(ma)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
print( max(a) - min(a) )

Submission status: Accepted

Solution code:
N = int(input())
A = sorted(list(map(int,input().split())))
print(A[N-1]-A[0])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# input
N = int(input())
A = list(map(int, input().split()))

# solve
A.sort()

# output
print(A[-1] - A[0])

Submission status: Accepted

Solution code:
N = int(input())
A = str(input())
max = 0
min = 1000000000

list = A.split()

for i in list:
    i = int(i)
    if i > max:
        max = i
    if i < min:
        min = i

print(max- min)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
list.sort(A)

ans = A[N-1] - A[0]

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lis = list(map(int, input().split()))
lis = sorted(lis)
print(abs(lis[0] - lis[-1]))

Submission status: Accepted

Solution code:
n = input()
a_list = list(map(int, input().split()))

print(max(a_list)-min(a_list))

Submission status: Accepted

Solution code:
N = int(input())
num_list = list(map(int, input().split()))

diff_max = max(num_list) - min(num_list)

print(diff_max)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
min_a = 10**9
max_a = 1
for i in a:
    if i < min_a:
        min_a = i
    if i > max_a:
        max_a = i
print(max_a - min_a)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
print(a[0] - a[-1])

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
ma=max(a)-min(a)
print(ma)

Submission status: Accepted

Solution code:
_,*l=map(int,open(0).read().split());print(max(l)-min(l))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split(' ')))

print(max(a)-min(a))

Submission status: Accepted

Solution code:

N = int(input())
lst_num = input().rstrip().split()

lst_rec = []
for i in range(N):
  target = int(lst_num[i])
  lstCnt = i + 1
      
  while True:
    if N  <= lstCnt : break
    
    diff = abs(target - int(lst_num[lstCnt]))
    lst_rec.append(diff)
    lstCnt += 1

print(max(lst_rec))

Submission status: Accepted

Solution code:
def INT(): return int(input())
def LIST(): return list(map(int, input().split()))
 
 
def main():
    N = INT()
    A = LIST()
    print(max(A)-min(A))
 
 
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

ans = A.max() - A.min()
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())))
print(a[-1] - a[0])

Submission status: Accepted

Solution code:
# ABC 102, B - Maximum differnece
n = int(input())
A = [int(el) for el in input().split(' ')]


print(max(A) - min(A))

Submission status: Accepted

Solution code:
line = raw_input()
n = int(line)
line = raw_input()
a = [int(s) for s in line.split(' ')]
ret = max(a) - min(a)
print ret

Submission status: Accepted

Solution code:
n = int(input())
a = [int(b) for b in input().split()]
print (max(a) - min(a))

Submission status: Accepted

Solution code:
N = raw_input()
nums = map(int, raw_input().split(' '))
print max(nums) - min(nums)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))

mx = 0
mi = 10**10

for i in range(N):
    if A[i] > mx:
        mx = A[i]
    if A[i] < mi:
        mi = A[i]

print(mx-mi)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

print(abs(max(a)) - abs(min(a)))

Submission status: Accepted

Solution code:
n = int(input())
a_list = [int(i) for i in input().split(" ")]
diff_list = []
for i in range(len(a_list)):
    for j in range(i+1,len(a_list)):
        diff_list.append(abs(a_list[i]-a_list[j]))
print(max(diff_list))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.sort()

print(A[N-1]-A[0])

Submission status: Accepted

Solution code:
N = int(input())
A_list = list(map(int,input().split()))
print(max(A_list)-min(A_list))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]

minimum = float('inf')
maximum = 0

for i in A:
	if i > maximum:
		maximum = i
	if i < minimum:
		minimum = i

print(maximum - minimum)

Submission status: Accepted

Solution code:

input()
xs = list(map(int, input().split()))

def solve(x, xs):
    res = []
    for y in xs:
        res.append(abs(x - y))
    if len(xs) > 2:
        res += solve(xs[0], xs[1:])
    return res

print(max(solve(xs[0], xs[1:])))

Submission status: Accepted

Solution code:
n=input()
a=list(map(int,input().split()))
print(abs(max(a)-min(a)))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(i, N):
        ans = max(ans, abs(A[i] - A[j]))

print(ans)