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 = int(input())
a = list(map(int, input().split()))

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

print(max(b))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
input()
a  = list(map(int, input().split()))
print(max(a)-min(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
H = [int(i) for i in input().split()]
H = sorted(H)
print(abs(H[0]-H[N-1]))

Submission status: Accepted

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

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();n=list(map(int,input().split()))
print(max(n) - min(n))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
print(A[N-1] - A[0])

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
max = 0
for a1 in a:
    for a2 in a:
        if max < abs(a1 - a2):
            max = abs(a1 - a2)

print(max)

Submission status: Accepted

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

ans = -1

for i in range(len(a)):
    for j in range(len(a)):
        if i != j:
            if abs(a[i] - a[j]) > ans:
                ans = abs(a[i] - a[j])


print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
input()
nl = sorted([int(i) for i in input().split()])
print(abs(nl[-1] - nl[0]))

Submission status: Accepted

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

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())
S = list(map(int, input().split()))
S = sorted(S)
print(S[-1] - S[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(v) for v in input().split()]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(max(li) - min(li))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())
lst = [int(a) for a in stdin.readline().rstrip().split()]

a = max(lst)
b = min(lst)

print(abs(a - b))

Submission status: Accepted

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

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 = input()
nums = [int(i) for i in input().split()]
print(max(nums)-min(nums))

Submission status: Accepted

Solution code:
N = int(input())
    
value = []
for part in input().split():
    value.append(int(part))
    
print(max(value) - min(value))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8
d=int(input())
n=[int(i) for i in input().split()]
n.sort()
print(n[len(n)-1]-n[0])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - Maximum Difference


"""
import sys
from sys import stdin
input = stdin.readline


def solve(arr):
    return max(arr) - min(arr)


def main(arg):
    N = int(input())
    arr = [int(a) for a in input().split()]
    ans = solve(arr)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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:
N = int(input())
A = [int(i) for i in input().split()]

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

Submission status: Accepted

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

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

Submission status: Accepted

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

list1.sort()
print(list1[n-1]-list1[0])

Submission status: Accepted

Solution code:
# encoding: utf-8
N = int(input())
A = sorted(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(max(a_list) - min(a_list))

Submission status: Accepted

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

Submission status: Accepted

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

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())
A = sorted(map(int, input().split()));print(A[-1]-A[0])

Submission status: Accepted

Solution code:
num=int(input())
alist=[int(i) for i in input().split()]
dif=0
for i in range(num):
    for j in range(i,num):
        tmp=abs(alist[i]-alist[j])
        if tmp>dif:
            dif=tmp
print(dif)

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):
        temp = abs(a[i]-a[j])
        ans = max(ans, temp)
print(ans)

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())
list=[int(x) for x in input().split()]
mini=list[0]
maxi=list[0]
for k in range(1,n):
    if mini>list[k]:
        mini=list[k]
    elif maxi<list[k]:
        maxi=list[k]
print(maxi-mini)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(x) for x in str(input()).split()]
a.sort()


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

Submission status: Accepted

Solution code:
n=int(input())
list=[ int(x) for x in input().split()]
ma=max(list)
mi=min(list)
print(ma-mi)

Submission status: Accepted

Solution code:
p=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 = [int(_) for _ in input().split()]
a.sort()
print(a[-1] - a[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solution(a):
    return max(a) - min(a)

def main():
    n = int(raw_input().strip())
    a = [int(i) for i in raw_input().strip().split()]
    print solution(a)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
mina = A[0]
maxa = A[0]
for a in A:
    if mina > a:
        mina = a
    if maxa < a:
        maxa = a

print(abs(maxa - mina))

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()))
print(max(A)-min(A))

Submission status: Accepted

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

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 = input()
A = list(map(int, input().split()))

big = max(A)
small = min(A)
print(abs(big - small))

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()))
list=A
print(max(list)-min(list))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 = 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_list=[int(i) for i in input().split()]
a_list.sort()
diff=a_list[n-1]-a_list[0]
print(diff)

Submission status: Accepted

Solution code:
# https://beta.atcoder.jp/contests/abc102/tasks/abc102_b

if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))

    a_min = 1000000000
    a_max = 0
    for a_i in a:
        a_min = min(a_min, a_i)
        a_max = max(a_max, a_i)

    ans = a_max - a_min
    print(ans)

Submission status: Accepted

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

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())
lists = [int(i) for i in input().split()]
cla = 0
for x in lists:
    for y in lists:
        c = abs(x - y)
        if (c > cla):
            cla = c
print(cla)

Submission status: Accepted

Solution code:
# coding: utf-8

def getMinMax(A):
    nmin = 10**9+1
    nmax = 0
    for ai in A:
        if nmin > ai:
            nmin = ai
        if nmax < ai:
            nmax = ai
    return nmin, nmax

def getAbs(minmax):
    return abs(minmax[0] - minmax[1])

if __name__ == "__main__":
    N = int(input())
    A = [int(x) for x in input().split()]
    print(getAbs(getMinMax(A)))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
print(a[-1] - a[0])

Submission status: Accepted

Solution code:
N = int(input())

list_A = [ int(i) for i in input().split()]

max_A = max(list_A)
min_A = min(list_A)

print(max_A - min_A)

Submission status: Accepted

Solution code:
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
times = int(input())
lis = [int(m) for m in input().split()]
print(max(lis) - min(lis))

Submission status: Accepted

Solution code:
N = int(input())
list_A = [int(str_A) for str_A in input().split(" ")]

print(max(list_A) - min(list_A))

Submission status: Accepted

Solution code:
N = int(input())
a = list(int(i) for i in 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()))
print(abs(min(a) - max(a)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    input()
    num = [int(i) for i in input().split()]
    print(max(num) - min(num))
main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a_list = [int(ai) for ai in input().split()]
maxv, minv = max(a_list), min(a_list)
print(abs(maxv - minv))

Submission status: Accepted

Solution code:
n = int(input())

s = list(map(int, input().rstrip().split(" ")))
maxnum = s[0]
minnum = s[0]

for i in range(1, n): 
    if s[i] > maxnum:
        maxnum = s[i]
    if s[i] < minnum:
        minnum = s[i]

print(maxnum - minnum)

Submission status: Accepted

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

Submission status: Accepted

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

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

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 = sorted(list(map(int, input().split())))
l = len(A)
print(A[l-1]-A[0])

Submission status: Accepted

Solution code:
N = int(input())
a = input().split()
a = list(map(int, a))
b_max = 0 
for i in a:
    for k in a:
        b = abs(i-k)
        if b > b_max:
            b_max = b

print(b_max)

Submission status: Accepted

Solution code:
#encoding: utf-8

n = int(input())
A = [int(i) for i in input().split()]
A.sort()
print(A[-1]-A[0])

Submission status: Accepted

Solution code:
N = int(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()))
m = -float("inf")
for i in range(N):
    for j in range(N):
        m = max(abs(A[i] - A[j]), m)
print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
ma = 0
mi = 1001001000
for i in a:
    ma = max(i,ma)
    mi = min(i,mi)
print(ma-mi)

Submission status: Accepted

Solution code:

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

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

ABS = maxA - minA

print(ABS)

Submission status: Accepted

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

Submission status: Accepted

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

max = 0
min = 1000000000
for i in range(0,n):
  v=int(a[i])
  if max<v:
    max = v
  if min>v:
    min = v

print(max-min)

Submission status: Accepted

Solution code:
n = int(input())

k = list(int(i) for i in input().split())  

print(int(max(k)) - int(min(k)))

Submission status: Accepted

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

for i in range(n):
    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()))

a.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(n) for n in input().split(" ")]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
raw_input()

num_list = map(int, raw_input().split(" "))

M = max(num_list)
m = min(num_list)
print M - m

Submission status: Accepted

Solution code:
N = int(raw_input())
inpt = map(int, raw_input().split())

inpt.sort()
print inpt[N-1] - inpt[0]

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

if len(l)!=n:
    exit()
    
l = sorted(l)
print(l[-1]-l[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:

def B():
    n = int(input())
    a = input().split()
    
    if(len(a) != n):
        exit(1)

    i_max = 0
    i_min = 1000000001
    for i in a:
        k = int(i)
        if (i_max < k):
                i_max = k
        if (i_min > k):
                i_min = k
    print(abs( i_max - i_min))

if __name__ =='__main__':
    B()

Submission status: Accepted

Solution code:
N = int(raw_input())

A = map(int,raw_input().split())

print max(A)-min(A)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(b) for b in input().split()]
a.sort()
print(abs(a[-1] - a[0]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
b = list(map(int,input().split()))
min = b[0]
max = b[0]
for i in range(a):
    if b[i] < min:min=b[i]
    if b[i] > max:max=b[i]
print(max-min)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a = input().split()

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

MIN = min(a[0], a[1])
MAX = max(a[0], a[1])

for i in range(2, n):
    c = a[i]
    MAX = max(MAX, c)
    MIN = min(MIN, c)

print(MAX-MIN)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
N=int(input())
list=map(int,input().split())

max=0
min=-1

for a in list:
   if a > max:
   	max=a
   
   if min == -1 or a < min:
   	min=a
   	
print(max-min)

Submission status: Accepted

Solution code:
# cording :utf-8
num_int = int(input())
# print(num_int)

num_list = list(map(int, input().split()))
# print(num_list)

num_max = max(num_list)
# print(num_max)
num_min = min(num_list)
# print(num_min)

num_abs = (num_max - num_min)
print(num_abs)

Submission status: Accepted

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


for i in range(0,N):
	a[i] = int(a[i])
mi = 0
for i in range(0,N-1):
	for j in range(i+1,N):
		if abs(a[i]-a[j]) > mi:
			mi = abs(a[i]-a[j])
print(mi)

Submission status: Accepted

Solution code:
N = int(input())
A = input().split()
A = list(map(int, A))
min_num = A[0]
max_num = A[0]
for data in A:
    if min_num > data:
        min_num = data

    if max_num < data:
        max_num = data

print(max_num - min_num)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = input()
b = A.split(" ")
c = []

for i in range(0,N):
    c.append(int(b[i]))
    if c[i] < 0:
        c[i] = c[i]*(-1)
        
c.sort()
print(c[-1]-c[0])

Submission status: Accepted

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

print(max(list_num)  - min(list_num))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = input().rstrip().split()

aa = []
for i in a:
    aa.append(int(i))

print(abs(max(aa)-min(aa)))

Submission status: Accepted

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

max = 0
for i in range(n):
    for j in range(i+1, n):
       diff = abs(a[i] - a[j])
       if diff > max:
           max = diff

print(max)

Submission status: Accepted

Solution code:
#coding: UTF-8

N = input()
A = input().split()
A_ = []
for a in A:
    A_.append(int(a))

min_A = min(A_)
max_A = max(A_)

print(max_A - min_A)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
p=input;p();a=sorted([int(i)for i in p().split()]);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:
N = int(input())
li = input().rstrip().split()
le =[0]*N
for i in range(0,N):
    le[i]=int(li[i])
mx = max(le)
mn = min(le)
u = mx-mn
print(u)

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:
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:
N = int(input())
A = list(map(int,input().split()))
dif = []
for i in range(0,N):
    for j in range(i+1,N):
        dif.append(abs(A[i]-A[j]))
print(max(dif))

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
tmp = input().split(' ')

A = []
for i in range(N):
    A.append(int(tmp[i]))

A = np.asarray(A)
print(A.max() - A.min())

Submission status: Accepted

Solution code:
# coding:utf-8

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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 = max(a) - min(a)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# --------------------------------------------

dp = None

def main():
    N = int(input())
    A = sorted([int(_) for _ in input().split()])

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

main()

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 = list(map(int,input().split()))

max_num = -1
min_num = float('inf')
for i in range(N):
	max_num = max(max_num,A[i])
	min_num = min(min_num,A[i])
print(max_num - min_num)

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 = input()
A = [int(i) for i in input().split()]
A.sort()
print(A[-1] - A[0])

Submission status: Accepted

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

print(max(num) - min(num))

Submission status: Accepted

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

def main():
    #入力
    N = int(input())
    lists = list(map(int, input().split()))

    #変数
    max_element = 0
    min_element = lists[0]

    #各要素の差を求め前より大きかったらmax_elementに格納
    for i in range(N):
        if lists[i] > max_element:
            max_element = lists[i]
        if lists[i] < min_element:
            min_element = lists[i]

    print('{}'.format(max_element - min_element))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

a_min = min(a)
a_max = max(a)

print(a_max - a_min)

Submission status: Accepted

Solution code:

n = input()
a = input().split(" ")

l = list()
for x in a:
	l.append(int(x))

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(str_) for str_ in input().split(" ")]

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

Submission status: Accepted

Solution code:
N = int(input())
Alist = [int(i) for i in input().split()]

Alist.sort()
print(Alist[N-1]-Alist[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n= int(arr_data[0][0])

arr=[int(x) for x in arr_data[1]]

print(max(arr)-min(arr))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import combinations
input()
a = list(map(int, input().split()))

print(max(abs(a - b) for a, b in combinations(a, r=2)))

Submission status: Accepted

Solution code:
# your code goes here
N=int(input())
li = list(map(int,input().split()))	

print(max(li)-min(li))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def solve(n, a):
    ans = 0
    for i in range(n):
        for j in range(i+1, n):
            ans = max(ans, abs(a[i]-a[j]))
    return ans

assert solve(4, [1,4,6,3]) == 5
assert solve(2, [1000000000, 1]) == 999999999
assert solve(5, [1, 1, 1, 1, 1]) == 0

n = input()
a = map(int, raw_input().split())
print solve(n, a)

Submission status: Accepted

Solution code:

N = int(input())
A = input().split()

A = [int(i) for i in A]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#fhajkfhaslfh
n = int(raw_input())
a = map(int, raw_input().split())
print max(a) - min(a)

Submission status: Accepted

Solution code:
while True:
    try:
        n = int(input())
        num = list(map(int, input().split()))
        print(max(num)-min(num))
    except:
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
A = [int(i) for i in input().split(" ")]
A.sort()
print(A[-1] - A[0])

Submission status: Accepted

Solution code:
N = int(input())
a = [int(i) for i in input().split()]

ans = max(a) - min(a)
print(ans)

Submission status: Accepted

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

# num_list = [1,1,1,1,1]

print(round(max(num_list) + ((-1)*min(num_list))))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 桁数の入力
a = input()
# スペース区切りの整数の入力
b = input().split()
b = list(map(int, b))
print(max(b) - min(b))

Submission status: Accepted

Solution code:
n = input()
n = int(n)
a = input().split()
a = [int(aa) for aa in a]
ans = 0
#a = map(int, input().split())
for i, a1 in enumerate(a, 0):
    for j, a2 in enumerate(a, 0):
        if i == j:
            continue
        ans = max(ans, abs(a1 - a2))
print(ans)

Submission status: Accepted

Solution code:
n = input()
n = int(n)
a = input().split()
a = [int(aa) for aa in a]
ans = 0
#a = map(int, input().split())
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        ans = max(ans, abs(a[i] - a[j]))
print(ans)