Problem:


Score : 200 points

Problem Statement

It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.

There are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses.

Find the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions.  

Constraints

1 ≤ N ≤ 100

0 ≤ a_i ≤ 1000

a_i is an integer.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

Print the minimum distance to be traveled.  

Sample Input 1

4
2 3 7 9

Sample Output 1

7

The travel distance of 7 can be achieved by starting at coordinate 9 and traveling straight to coordinate 2.

It is not possible to do with a travel distance of less than 7, and thus 7 is the minimum distance to be traveled.  

Sample Input 2

8
3 1 4 1 5 9 2 6

Sample Output 2

8

There may be more than one house at a position.  



Sample input:
4
2 3 7 9


Sample output:
7

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    n = 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 = sorted(map(int, input().split()))
d = 0
for i in range(1, N):
    d += A[i] - A[i-1]
print(d)

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())
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 = raw_input()
ais = map(int, raw_input().split())
print max(ais) - min(ais)

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

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:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
li = rl()
print(max(li) - min(li))

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:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    print(max(A)-min(A))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]


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

a.sort()

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

Submission status: Accepted

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

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()))
a=sorted(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = sorted(MAP())
print(a[-1] - a[0])

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
a = LI()
a.sort()
print(abs(a[0]-a[-1]))

Submission status: Accepted

Solution code:
_ = input()
A = sorted(int(T) for T in input().split())
print(A[-1]-A[0])

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
al = sorted(set(a),reverse = 1)
ans = []
for i,j in zip(al[:-1],al[1:]):
    ans.append(i-j)
print(sum(ans))

Submission status: Accepted

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

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())
arr = list(map(int, input().split()))
mn = 100000000
mx =0
for i in arr:
	mn = min(mn , i)
	mx = max(mx , i)

print(mx-mn)

Submission status: Accepted

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

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

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()))
a.sort()
print(a[-1]-a[0])

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())
    A.sort()
    print(A[-1] - A[0])
    
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

Submission status: Accepted

Solution code:
_,*aa = map(int, open(0).read().split())

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

Submission status: Accepted

Solution code:
N=int(input())
a=list(set(list(map(int,input().split()))))
ans=0
a.sort()
for i in range(1,len(a)):
    ans+=a[i]-a[i-1]
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:
a=int(input())
List = list(map(int, input().split()))
List.sort()
res = List[a-1]-List[0]
print(res)

Submission status: Accepted

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

a = sorted(a)
s = 0
for i in range(N-1):
    s += a[i+1] - a[i]

print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input()
(*a,) = 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:
n = int(input())
l = sorted(list(map(int, input().split())))
print(l[n-1]-l[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:
M = int(input())
LL = input().split()
list1 =[]
for i in LL:
  a = int(i)
  list1.append(a)
list1.sort()
print(list1[-1] -list1[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def actual(N, A):
    return max(A) - min(A)

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

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

Submission status: Accepted

Solution code:
_=int(input())
a=list(set(map(int,input().split())))
a.sort(reverse=True)
ans=0
for i in range(len(a)-1):
    ans+=a[i]-a[i+1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = int(s)

house = []

p = input().split()
for i in range(n):
    q = int(p[i])
    house.append(q)

house.sort()

answer = house[n - 1] - house[0]

print(answer)

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

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 = sorted(A)
ans = A[-1] - A[0]

print(ans)

Submission status: Accepted

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

a = sorted(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    D = il()
    print(max(D)-min(D))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

A.sort()
print(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:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N = i()
a = l()
print(max(a)-min(a))

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

print(max(lst)-min(lst))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    a = LI()

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = sorted(il())
    print(abs(min(A) - max(A)))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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:
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 = sorted(a)
l = len(a)
d = a[l-1]-a[0]
print(d)

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())


def main():
    N = ii()
    a = list(mi())
    print(max(a)-min(a))



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# ABC064_B
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()))
print(max(A)-min(A))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
now=a[0]
for i in a:
  ans+=i-now
  now=i
print(ans)

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

Submission status: Accepted

Solution code:
import sys
N = int(input())
int_array = list(map(int,input().split()))

if N < 0 or N > 100:
    sys.exit()
if not len(int_array) == N:
    sys.exit()
if max(int_array) > 1000 or min(int_array) < 0:
    sys.exit()

print(max(int_array) - min(int_array))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
buf = sys.stdin.buffer


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

an = [int(a) for a in input().split()]

print(max(an) - min(an))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

mi = min(s)
ma = max(s)

print(ma-mi)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    a = list(map(int, input().split()))

    ans = max(a) - min(a)

    print(ans)


if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    pos = list(map(int, input().split()))
    pos.sort()

    ans = pos[-1] - pos[0]

    print(ans)
resolve()

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(map(int, input().split()), reverse=True)
t = 0
for i in range(n-1):
    t += a[i] - a[i+1]
print(t)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def coordminmax(N) : 
  coordinate = list(map(int, input().split()))
  min = coordinate[0]
  max = coordinate[0]
  
  for i in range(len(coordinate)) : 
    if coordinate[i] < min : 
      min = coordinate[i]
      
    if coordinate[i] > max : 
      max = coordinate[i]
      
  return min, max

def calcdistance(N) : 
  min, max = coordminmax(N)
  return max - min


N = int(input())

print(calcdistance(N))

Submission status: Accepted

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

MIN=min(A)
MAX=max(A)
print(MAX-MIN)

Submission status: Accepted

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

print(max(x)-min(x))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = sorted([int(i) for i in input().split()])
print(a[-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 = 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()))
x=max(a)
y=min(a)
s=x-y
print(s)

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
k = 0
for i in range(len(arr) - 1):
  k += arr[i + 1] - arr[i]
print(k)

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())) 
ans = 0

for i in range(0,N-1):
  ans = ans + sorted(a)[i+1] - sorted(a)[i]
print (ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
List=list(map(int,input().split()))
List.sort()
print(List[-1]-List[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:
input()
a = sorted(map(int, input().split()))
print(a[-1] - a[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
#リスト内包表記を使う場合
N=int(input())
A=[int(x) for x in input().split()]
#Aはa1-aNを含むリスト
#これはめちゃめちゃ簡単で最大値-最小値でいい

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
st = list(set(map(int,input().split())))
total = 0
st.sort()

for i in range(len(st)-1):
    total += (abs(st[i]-st[i+1]))
print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    L = sorted(lmi())
    print(L[-1] - L[0])



if __name__ == "__main__":
    main()

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

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

assert n == len(pos)

print(max(pos)-min(pos))

Submission status: Accepted

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

A.sort()


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