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:
N = int(input())

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

h_max = max(h_point)
h_min = min(h_point)

ans = h_max - h_min
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
input()
pos = sorted(list(map(int, input().split())))
print(max(pos) - min(pos))

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

end = max(al)
sta = min(al)

print(end-sta)

Submission status: Accepted

Solution code:
# -*- coding: <encoding name> -*-

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

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

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

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

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = inputI()
a = inputIL()

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def inp():
    return(int(input()))


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


n = inp()
arr = invr()
arr = sorted(arr)
d = 0
for i in range(n-1):
    d += arr[i+1] - arr[i]
print(d)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
_ = input()
a = list(map(int, input().split()))
print(max(a)-min(a))

Submission status: Accepted

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

Submission status: Accepted

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


def solve(N: int, a: "List[int]"):
    b = sorted(a)
    return b[-1] - b[0]


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, a))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Accepted

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

Submission status: Accepted

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

a.sort(reverse=True)
print(a[0]-a[-1])

Submission status: Accepted

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

ans = max(a) - min(a)

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 13:26:11 2020

@author: shinba
"""

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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 += a[i+1] - a[i]

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
l = np.array(sorted(list(map(int, input().split()))))

ans = 0
for i in range(n-1):
    ans += l[i+1] - l[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    l.sort()
    print(l[-1]-l[0])
resolve()

Submission status: Accepted

Solution code:
import sys
import math
import bisect

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    As = list(map(int, input().split()))
    As = sorted(As)

    ans = 0
    for i in range(n-1):
        ans += As[i+1] - As[i]

    print(ans)


if __name__ == "__main__":
    main()

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 = [int(x) for x in 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())
n_list = list(map(int, input().split()))
print(max(n_list) - min(n_list))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
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
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 = LIST()
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 = list(map(int,input().split()))
print(max(a_list)-min(a_list))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
# endregion
N = ri()
a = ri_()
print(max(a) - min(a))

Submission status: Accepted

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

house = set(house)

print(max(house) - min(house))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n=I()
A=LI()
print(max(A)-min(A))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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(set(sorted([int(x) for x in 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
for i in range(n - 1):
    ans += a[i + 1] - a[i]
print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(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()))
A=sorted(A)
print(A[-1]-A[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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



if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N = int(input())
S = list(map(int,input().split()))
m1=max(S)
m2 = min(S)
print(m1-m2)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
a = na()

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

a.sort()

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

Submission status: Accepted

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

n_max = max(array)
n_min = min(array)

ans = n_max - n_min
print(ans)

Submission status: Accepted

Solution code:
import sys
import os
import math
import string

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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:
a,s=open(0);k=sorted(s.split());print(eval(k[-1]+"-"+k[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()))
print(max(A) - min(A))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
n=input()
house=list(map(int,input().split()))
house.sort()
print(house[int(n)-1]-house[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:
input()
lis=list(map(int,input().split()))
lis.sort()
dist=0
begin=lis[0]
for a in lis:
    dist+=a-begin
    begin=a
print(dist)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

MAX_position = max(houseposition)
min_position = min(houseposition)
print(MAX_position - min_position)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

a = set(a)
a = list(a)
a.sort()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=input()
mylist=input().split()
print(int(max(mylist))-int(min(mylist)))

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

A = sorted(A)
con = 0

for i in range(N-1):
    con += A[i+1] - A[i]

print(con)

Submission status: Accepted

Solution code:
def nexthouse(house, cur, delivered):
    dmin = 10**5
    nxt = 0

    for i in range(len(house)):
        if delivered[i] != True:
            if abs( house[cur] - house[i] ) < dmin :
                dmin = abs( house[cur] - house[i] )
                nxt = i
    delivered[nxt] = True
    return nxt

def main():
    N = int(input())
    house = [int(a) for a in input().split()]
    dlist = [None]*N
    
    for i in range(N):
        dm = 10**5
        dtotal = 0
        cur = i
        deliv = [0]*N
        deliv[cur] = True
        
        while deliv.count(0) > 0:
            nxt = nexthouse(house, cur, deliv)
            dtotal += abs(house[nxt] - house[cur])
            cur = nxt

        dlist[i] = dtotal

    print(min(dlist))
main()

Submission status: Accepted

Solution code:
# ABC 064: B – Traveling AtCoDeer Problem
n = int(input())
a = [int(s) for s in input().split()]
print(max(a) - min(a))

Submission status: Accepted

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

a.sort(reverse=True)

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

Submission status: Accepted

Solution code:
n=int(input())
a=map(int,input().split())
b=sorted(a)
print(b[-1]-b[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()))
print(max(A)-min(A))

Submission status: Accepted

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

array.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc064/tasks/abc064_b

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

d = max(a_list) - min(a_list)

print(d)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7



def main():
  n = int(input())
  a = list(map(int,input().split()))
  a = sorted(a,reverse=True)
  print(a[0] - a[n-1])
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n = ii()
A = set(sorted(iil()))
print(max(A)-min(A))

Submission status: Accepted

Solution code:
n=int(input())

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

t.sort()

ans = 0

for i in range(1,n):
    ans += t[i]-t[i-1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

a=sorted(a)
sum=0

for i in range(1,N):
    sum+=a[i]-a[i-1]

print(sum)

Submission status: Accepted

Solution code:
n = int(input())

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

print(max(house_list)-min(house_list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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()))
a.sort()
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:
N = int(input())
A = list(map(int, input().split()))
print(abs(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:
#ABC064.B
N = int(input())
a  = list(map(int,input().split()))
ans = max(a)-min(a)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import collections
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:
# Author: cr4zjh0bp
# Created: Sun Mar 22 23:25:40 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n = ni()
a = na()

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

print(max(houses)-min(houses))