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

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

ans = 0

for i in range(n):
    for j in range(n):
        if i ==j:
            continue
        ans = max(ans, abs(A[i]- A[j]))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def main():
    n = I()
    a = LI()

    return max(a) - min(a)



print(main())

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    arr = input().split(' ')
    max = int(arr[0])
    min = int(arr[0])
    for i in range(1, n):
        if int(arr[i]) > max:
            max = int(arr[i])
        if int(arr[i]) < min:
            min = int(arr[i])
    print(max - min)
main()

Submission status: Accepted

Solution code:
import numpy as np

a = int(input())
b = input().split()
c = []
for i in range(a):
  c.append(int(b[i]))
ans = 0
for i in range(a):
  for j in range(a):
    d = c[i] - c[j]
    d = np.abs(d)
    if(ans < d):
       ans = d
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def solve(a,b):
    e = b[0]
    d = b[-1]
    for c in b:
        if d < c:
            d = c
        elif e >= c:
            e = c
    return d-e
    
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    n = int(line1)
    line2 = sys.stdin.readline().rstrip()
    lst_a = [int(s) for s in line2.split(' ')]
    return (n, lst_a)

def main():
    n, lst_ab = readQuestion()
    answer = solve(n, lst_ab)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
def solve(n, lst_a):
    s= max(lst_a)
    c= min(lst_a)
    return s-c 

def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    n = int(line1)
    line2 = sys.stdin.readline().rstrip()
    lst_a = [int(s) for s in line2.split(' ')]
    return (n, lst_a)

def main():
    n, lst_ab = readQuestion()
    answer = solve(n, lst_ab)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

def solve(n, lst_a):
    a=lst_a[0]
    b=lst_a[0]
    [0]
    for i in lst_a:
        if a <i:
            a=i
        elif b>i:
            b=i
    return a-b

def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    n = int(line1)
    line2 = sys.stdin.readline().rstrip()
    lst_a = [int(s) for s in line2.split(' ')]
    return (n, lst_a)

def main():
    n, lst_ab = readQuestion()
    answer = solve(n, lst_ab)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

def solve(n, lst_a):
    i=max(lst_a)
    ii=min(lst_a)
    answer = i-ii
    return answer

def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    n = int(line1)
    line2 = sys.stdin.readline().rstrip()
    lst_a = [int(s) for s in line2.split(' ')]
    return (n, lst_a)

def main():
    n, lst_ab = readQuestion()
    answer = solve(n, lst_ab)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
d=input().split()
#print(d)

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

#print(d)
print(max(d)-min(d))

Submission status: Accepted

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

print(int(max(List))-int(min(List)))

Submission status: Accepted

Solution code:
# coding: utf-8

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

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

Submission status: Accepted

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

ans = max(A) - min(A)

print(ans)

Submission status: Accepted

Solution code:
def main5():
    buf = int(input(""));
    strbuf = input("");
    strbufs = strbuf.split();
    buf2 = []
    saidai = -1;
    for i in range(buf):
        buf2.append(int(strbufs[i]));
    for i in range((buf-1)):
        for j in range(i+1,buf):
            if (abs(buf2[i]-buf2[j]))>saidai:
                saidai =  abs(buf2[i]-buf2[j]);

    print(saidai);


if __name__ == '__main__':
    main5()

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

minNum = listNums[0]
maxNum = listNums[0]

for num in listNums:
    if num < minNum:
        minNum = num
    elif num > maxNum:
        maxNum = num
print(maxNum - minNum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

MIN, MAX = float('inf'), float('-inf')
for num in A:
  MIN = min(MIN, num)
  MAX = max(MAX, num)

print(MAX - MIN)

Submission status: Accepted

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

min_a = min(A)
max_a = max(A)
print(max_a - min_a)

Submission status: Accepted

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

min = pow(10, 9)
max = 0

for a in a_list:
    if max < a:
        max = a
    if min > a:
        min = a

print(max-min)

Submission status: Accepted

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

r = max(A) - min(A)
print(r)

Submission status: Accepted

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

Submission status: Accepted

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

abst = nums_sorted[n - 1] - nums_sorted[0]
print(abst)

Submission status: Accepted

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

A.sort()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    l = list(map(int, input().split()))
    l.sort()
    print(l[-1] - l[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#abc102b

n=int(raw_input())
a=map(int,raw_input().split())
res=0
for i in xrange(n-1):
 for j in xrange(1,n):
  res=max(res,abs(a[i]-a[j]))
print res

Submission status: Accepted

Solution code:
n=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()))

R = max(A) - min(A)
print(R)

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
mini=maxi=a[0]
for i in range(1,N):
  mini=min(mini,a[i])
  maxi=max(maxi,a[i])
print(maxi-mini)

Submission status: Accepted

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

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()))
max_ = max(a)
min_ = min(a)
print(max_-min_)

Submission status: Accepted

Solution code:
from itertools import combinations
n = int(input())
l = list(map(int, input().split()))
ans = 0
combos = combinations(l, 2)

for combo in combos:
  ans = max(ans, abs(combo[0] - combo[1]))

print(ans)

Submission status: Accepted

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

if __name__ == '__main__':
	main()

Submission status: Accepted

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

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 = input()
A_list = input()
mapped_A  = map(int, A_list.split())
list_map =  list(mapped_A)
difference = max(list_map)-min(list_map)
if difference >=0:
    print(difference)
else:
    print(-difference)

Submission status: Accepted

Solution code:
n,a = int(input()),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()]
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:
from sys import stdin
n = int(stdin.readline())
a = map(int,stdin.readline().split())
a.sort()
print a[-1] - a[0]

Submission status: Accepted

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

an.sort()

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

Submission status: Accepted

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

B=max(A)
C=min(A)
ans=B-C

print(ans)

Submission status: Accepted

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

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

for i in nlists:
    newnlists = [abs(i-j) for j in nlists]
    M = max(newnlists)
    if M > r:
        r = M

print(r)

Submission status: Accepted

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

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

print(max(lis) - min(lis))

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 = input()
an = input()
an = an.split()
list = []

for i in an:
    i = int(i)
    list.append(i)
min_an = min(list)
max_an = max(list)

print(max_an - min_an)

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 = input()
aryA = input().split(" ")

N = int(N)
aryA = [int(s) for s in aryA]
ans = []
for x in range(len(aryA) - 1):
    for y in range(len(aryA)):
        ans.append(abs(aryA[x] - aryA[y]))

print(max(ans))

Submission status: Accepted

Solution code:
count = int(input())
num = input().split()
ans = 0
for x in range(count):
    for y in range(count):
        if x != y:
            temp = int(num[x]) - int(num[y])
            if ans <= temp:
                ans = temp
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
hi = a[0]
low = a[0]
counter = 0
while n > counter:
    if hi < a[counter]:
        hi = a[counter]
    if low > a[counter]:
        low = a[counter]
    counter+=1
print(hi-low)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
A = input()
A = A.split()
n = []
for i in A:
    n.append(int(i))

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

Submission status: Accepted

Solution code:
def combinations(iterable, r):
    # combinations('ABCD', 2) --> AB AC AD BC BD CD
    # combinations(range(4), 3) --> 012 013 023 123
    pool = tuple(iterable)
    n = len(pool)
    if r > n:
        return
    indices = list(range(r))
    yield tuple(pool[i] for i in indices)
    while True:
        for i in reversed(range(r)):
            if indices[i] != i + n - r:
                break
        else:
            return
        indices[i] += 1
        for j in range(i+1, r):
            indices[j] = indices[j-1] + 1
        yield tuple(pool[i] for i in indices)


laa = []
N = int(input())
A = map(int, input().split())
for i in combinations(A,2):
    a, b = i
    c = abs(a-b)
    laa.append(c)

print(max(laa))

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 = 0
for i in a:
    for j in a:
        t = abs(j - i)
        if t > ans:
            ans = t

print(ans)

Submission status: Accepted

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

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())# your code goes here
a = input().split()
min = int(a[0])
max = int(a[0])
for i in range(n):
	if(int(a[i])<min):
		min = int(a[i])
	if(int(a[i])>max):
		max = int(a[i])
print(max-min)

Submission status: Accepted

Solution code:
n = int(input())
numbers = input().split(' ')
answer = 0

for i in range(n):
  for j in range(i, n):
    tmp = abs(int(numbers[i]) - int(numbers[j]))
    if answer < tmp:
      answer = tmp

print(answer)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
i = input().rstrip()
a = input().split()

a_int = [int(s) for s in a]
print(max(a_int)-min(a_int))

Submission status: Accepted

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

max = 0
min = 10**9

# print(A)

for i in range(N):
    # print(A[i])
    if A[i] > max:
        max = A[i]
        # print("max="+str(max))

for i in range(N):
    # print(A[i])
    if A[i] < min:
        min = A[i]
        # print("min="+str(min))
# print("min="+str(min))

# print("ans" + str(max - min))
print(max - min)

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

Submission status: Accepted

Solution code:
from itertools import accumulate

n = int(input())

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

min_num = min(a_list)
max_num = max(a_list)

print(abs(min_num - max_num))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(raw_input())
a=[]
a=map(int,raw_input().split())
ans=max(a)-min(a)
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())
arr=list(map(int,input().split()))
arr.sort()
print(abs(arr[-1]-arr[0]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import deque
import copy

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A_i = []
    for i in range(N):
        A_i.append(int(input_raw[i]))
    print abs(max(A_i) - min(A_i))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

A.sort()
print(str(A[N-1] - A[0]))

Submission status: Accepted

Solution code:
from sys import stdin

a = stdin.readline().rstrip()
l = [int(x) for x in stdin.readline().rstrip().split()]
ma = max(l)
mi = min(l)
sub = ma - mi
print(sub)

Submission status: Accepted

Solution code:
import itertools

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

MAX = 0
for (i,j) in itertools.product(range(N),range(N)):
	tmp = abs(A[i] - A[j])
	if tmp >= MAX:
		MAX = tmp
print(MAX)

Submission status: Accepted

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

max_abs=0

for i in range(N):
    a1 = array[i]
    for j in range(i+1,N):
        a2 = array[j]
        tmp_abs = abs(a1-a2)
#        print i,j,a1,a2,tmp_abs
        if tmp_abs > max_abs:
            max_abs = tmp_abs

print max_abs

Submission status: Accepted

Solution code:
n=input()
l = [int(i) for i in input().split()]
mx = 1
mn = 1


mx = max(l)
mn = min(l)
	
print(abs(mx-mn))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-

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

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

Submission status: Accepted

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

print(m())

Submission status: Accepted

Solution code:
#! /usr/bin/env python
# coding: UTF-8

n = (int)(input())
list = list(int(i) for i in input().split())
mx = max(list)
mn = min(list)
print(mx - mn)

Submission status: Accepted

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

Submission status: Accepted

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

a_max = a[0]
a_min = a[0]

for i in range(n):
  if(a_max < a[i+1]):
    a_max = a[i+1]
  if(a[i+1] < a_min):
    a_min = a[i+1]

print(a_max - a_min)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

n_max = max(list)
n_min = min(list)

print(n_max - n_min)

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:
def main():
    N = int(input())
    A = []
    data = input().split()
    for i in range(N):
        A.append(int(data[i]))
    
    A.sort()
    print(A[N - 1] - A[0])
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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()))

A_max = 0
A_min = 10**9

for i in A:
    if i < A_min:
        A_min = i
    if i > A_max:
        A_max = i

print(A_max - A_min)

Submission status: Accepted

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

mx = max(A)
mn = min(A)
print(mx-mn)

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(n):
        if abs(a[i] - a[j]) > m:
            m = abs(a[i] - a[j])

print(m)

Submission status: Accepted

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

max=0
min=10e9

for i in range(N):
  k = int(M[i])
  if min > k:
    min = k
  if max < k:
    max = k

print(max-min)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = input()
a = list(map(int, input().rstrip().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 = input()
A = list(map(int, A.split()))

max = max(A)
min = min(A)

print(max - min)

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
a = np.array([int(i) for i in input().split()])

b = np.abs(a.reshape(N,1) - a)
print(b.max())

Submission status: Accepted

Solution code:

N = int(input())
A = list(int(i) for i in input().split())

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

Submission status: Accepted

Solution code:
# B - Maximum Difference
# https://beta.atcoder.jp/contests/abc102/tasks/abc102_b

# B_Maximum_Difference.py

N = int(input())
a = list(map(int, input().strip().split(" ")))

max_abs = -1
for i in range(N):
    for j in range(i+1, N):
        abs = a[i] - a[j]
        if abs <0:
            abs *= -1
        if max_abs < abs:
            max_abs = abs

print(max_abs)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math, string, fractions, heapq, re, array, bisect, sys, random, time, copy
import itertools as it
import collections as cl
import functools as ft


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


n = LI()
a = sorted(LI())

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

Submission status: Accepted

Solution code:
#Quesiton'B'

N=int(input())

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

a=max(A)
b=min(A)
print(a-b)

Submission status: Accepted

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

#print(l)

max = int(l[0])
min = int(l[0])

#print(max)
#print(min)

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

print(max - min)
#print(l[0])
#print(l[1])

Submission status: Accepted

Solution code:
import numpy as np

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

a = np.array(A)

b = np.sort(a)

ans = abs((b[0]) - (b[-1]))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def run(n, a):
    max_a = max(a)
    min_a = min(a)
    return max_a - min_a


def read_line():
    n = int(input())
    a = list(map(int, input().split()))
    return (n, a)


def main():
    n, a = read_line()
    print(run(n, a))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
Youso = int(input())
Suuti = list(map(int,input().split(" ")))


print(max(Suuti) - min(Suuti))

Submission status: Accepted

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

d = max(line) - min(line)

print(d)

Submission status: Accepted

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

Submission status: Accepted

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

max,min = a[0], a[0]
for i in a:
    if i > max:
        max = i
    if i < min:
        min = i
print(max - min)

Submission status: Accepted

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

Submission status: Accepted

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

nm = a[0]
nv = a[0]
for i in range(n):
    if a[i] > nv:
        nv = a[i]
        continue
    
    if a[i] < nm:
        nm = a[i]

print(nv-nm)

Submission status: Accepted

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

print(max(ass)-min(ass))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

arr.sort()

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

Submission status: Accepted

Solution code:
import itertools

n = input()
ns = map(int, input().split())
print(max([ abs(x-y) for x,y in itertools.combinations(ns,2)]))

Submission status: Accepted

Solution code:
N=int(input())

a=input().split()

b=[int(i) for i in a]
maxNum=0

for i in b:

	l=max([abs(x-i) for x in b])
	if(maxNum<l):
		maxNum=l

print(maxNum)

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())
arr = input().split(" ")
arr = [int(c) for c in arr]

max_ = max(arr)
min_ = min(arr)


print(max_ - min_)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = input()
a = a.split(' ')
a = list(map(int, a))
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(num) for num in input().split()]
m = 0
for i in range(n):
  for j in range(n):
    m = max(m,abs(a[i]-a[j]))
print(m)

Submission status: Accepted

Solution code:
def main():
	N = int(input())
	seq = list(map(int, input().split()))
	maks = 0
	for i in range(0, N):
		for j in range(i, N):
			maks = max(abs(seq[j] - seq[i]), maks)
	print(maks)
	return 0
main()

Submission status: Accepted

Solution code:
# 整数列A ２要素の差の絶対値の最大値

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

A.sort()
ans = A[-1]-A[0]

print(ans)

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(lambda x:int(x),input().split(" ")))
MAX = max(A)
MIN = min(A)
print(MAX-MIN)

Submission status: Accepted

Solution code:
N = int(raw_input())
A = map(int, raw_input().split())
m = 0
for i in range(N):
  for j in range(N):
    m = max(m, abs(A[i]-A[j]))
print m

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8
n = int(input())
nums = list(map(int,input().split()))
maxv = max(nums)
minv = min(nums)

print(maxv-minv)

Submission status: Accepted

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

max = max(l)
min = min(l)

print(abs(max-min))

Submission status: Accepted

Solution code:
# coding=utf-8

if __name__ == '__main__':
    N = input()
    A = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
import math
import numpy as np

#line = input().split()
#N = int(line[0])
N = int(input())
line = input().split()
A = [int(a) for a in line]


min_ = 1e9
max_ = 1

for a in A:
    max_ = max(max_, a)
    min_ = min(min_, a)

print(max_-min_)

Submission status: Accepted

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