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

max_A = max(A_list)
min_A = min(A_list)

print(max_A - min_A)

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
# coding=utf-8

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

nums.sort()

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

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
ans = 0
for a in A:
    for b in A:
        ans = max(ans, abs(a - b))
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
min0 = 10**9+1
max0 = 0
for i in range(n):
    min0 = min(min0, a[i])
    max0 = max(max0, a[i])

print(max0 - min0)

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in 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:
N=int(input().strip())
A=list(map(int, input().strip().split()))
mx=0
for i in range(N-1):
    for j in range(i+1,N):
        if abs(A[i]-A[j]) > mx:
            mx=abs(A[i]-A[j])
print(mx)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
ans = 0
for k in A:
    for l in A:
        ans = max(ans, abs(k-l))
print(ans)

Submission status: Accepted

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

r = 0
for x in A:
    for y in A:
        r = max(x - y, r)

print(r)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Runtime Error

Solution code:
n = int(input())
min_A = 10**9+7
max_A = -1
for i in range(n):
  tmp = int(input())
  max_A = max(tmp,max_A)
  min_A = min(min_A,tmp)
  
print(abs(max_A-min_A))

Submission status: Runtime Error

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

print(max(N) - min(N))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Amax = max(A)
Amin = min(A)

ans = Amax - Amin
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
count=input()
list=int(input()).rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(int(list2[0])-int(list2[int(count)-1]))
if sa<0:
  print(-1*int(sa))
else:
  print(int(sa))

Submission status: Runtime Error

Solution code:
count=input()
list=int(input()).rstrip().split(" ")
list2= sorted(list)
sa=(int(list2[0])-int(list2[int(count)-1]))
if sa<0:
  print(-1*int(sa))
else:
  print(int(sa))

Submission status: Runtime Error

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

for i in range(100):
    if max_num < a[i]:
        max_num = a[i]
    elif min_num > a[i]:
        min_num =a[i]

print(max_num-min_num)

Submission status: Runtime Error

Solution code:

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

Submission status: Runtime Error

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

list.sort()

answer = list[-1] - list[0]

print(answer)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

lists.sorted()
print(lists[-1] - lists[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int(input()) for i in range(n)]
a.sort()
num = len(a)-1
print(a[num]-a[0])

Submission status: Runtime Error

Solution code:
_n = int(input())
lists = list(map(int(), input().split()))
lists.sort()

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Max=0
Min=10**9

for i in range(n):
  if(Max<a[i]):
    Max=a[i]
  if(min>a[i]):
    Min=a[i]

print(abs(Max-Min))

Submission status: Runtime Error

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

Max=0
Min=10**9

for i in a:
  if(Max<i):
    Max=i
  if(min>i):
    Min=i
print(abs(Max-Min))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())

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

max=0
for i in range(n):
    for j in range(n):
        if i!=j:
            abs=abs(a[i]-a[j])
            if max<=abs:
                max=abs


print(max)

Submission status: Runtime Error

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

ANS = []
for i in range(len(A)):
  for j in range(i,len(A)+1):
    ANS.append(abs(A[i] - A[j]))
    
print(max(ANS))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
lst=[int(input()) for i in range(n)]
print(max(lst)-min(lst))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(max(S) - min(S))

Submission status: Runtime Error

Solution code:
class SplayNode:
    """Splay木のノードを定義
    メンバ変数: 値、サイズ、親へのポインタ、左右の子へのポインタ
    """
    def __init__(self, val):
        self.val = val
        self.size = 1
        self.parent, self.right, self.left = None, None, None


class SplayTree:
    """Splay木を定義"""
    def __init__(self):
        self.root = None

    def __getitem__(self, ind: int):  # O(logN)
        return self.get_ptr(ind, self.root).val
        
    def __setitem__(self, ind: int, val):  # O(logN)
        ptr = self.get_ptr(ind, self.root)
        ptr.val = val

    def __len__(self):  # O(1)
        return self.root.size if self.root is not None else 0

    def update(self, ptr):
        """部分木の情報を更新する"""
        ptr.size = 1
        if ptr.left is not None:
            ptr.size += ptr.left.size
        if ptr.right is not None:
            ptr.size += ptr.right.size

    def state(self, ptr):
        """スプレー操作を行うときの状況判定
        親が存在しない: 0
        左の兄弟が存在する: 1
        右の兄弟が存在する: -1
        """
        if ptr.parent is None:
            return 0
        if ptr.parent.left == ptr:
            return 1
        if ptr.parent.right == ptr:
            return -1

    def splay(self, ptr):
        """ptrが根になるようにスプレー操作を行う"""
        while self.state(ptr) != 0:
            if self.state(ptr.parent) == 0:
                # zigステップ
                self.rotate(ptr)
            elif self.state(ptr) == self.state(ptr.parent):
                # zig-zigステップ
                self.rotate(ptr.parent)
                self.rotate(ptr)
            else:
                # zig-zagステップ
                self.rotate(ptr)
                self.rotate(ptr)
        self.root = ptr

    def rotate(self, ptr):
        """木の回転を行う"""
        p = ptr.parent
        pp = p.parent
        if p.left == ptr:
            c = ptr.right
            ptr.right = p
            p.left = c
        else:
            c = ptr.left
            ptr.left = p
            p.right = c
        if pp is not None and pp.left == p: pp.left = ptr
        if pp is not None and pp.right == p: pp.right = ptr
        ptr.parent = pp
        p.parent = ptr
        if c is not None:
            c.parent = p
        self.update(p)
        self.update(ptr)

    def get_ptr(self, ind, root):
        """ind番目のポインタを取得する"""
        ptr = root
        while True:
            if ptr.left is None:
                l_size = 0
            else:
                l_size = ptr.left.size
            if ind < l_size:
                ptr = ptr.left
            if ind == l_size:
                self.splay(ptr)
                return ptr
            if ind > l_size:
                ptr = ptr.right
                ind = ind - l_size - 1

    def merge(self, lroot, rroot):
        if lroot is None:
            self.root = rroot
            return rroot
        if rroot is None:
            self.root = lroot
            return lroot
        lroot = self.get_ptr(lroot.size - 1, lroot)
        lroot.right = rroot
        rroot.parent = lroot
        self.update(lroot)
        return lroot
      
    def split(self, left_cnt, root):
        if left_cnt == 0:
            return None, root
        if left_cnt == root.size:
            return root, None
        root = self.get_ptr(left_cnt, root)
        lroot = root.left
        rroot = root
        rroot.left = None
        lroot.parent = None
        self.update(rroot)
        return lroot, rroot
      
    def insert(self, ind, val):
        """ind番目の値valの要素を挿入する"""
        lroot, rroot = self.split(ind, self.root)
        new_ptr = SplayNode(val)
        self.merge(self.merge(lroot, new_ptr), rroot)
    
    def delete(self, ind):
        """indの要素を削除する"""
        root = self.get_ptr(ind, self.root)
        lroot = root.left
        rroot = root.right
        if lroot is not None:
            lroot.parent = None
        if rroot is not None:
            rroot.parent = None
        root.relf = None
        root.left = None
        self.update(root)
        return self.merge(lroot, rroot), root

    def add(self, val):
        if self.root is None:
            self.insert(0, val)
            return
        ptr = self.root 
        ind = 0
        while True:
            if val < ptr.val:
                if ptr.left is None:
                    self.insert(ind, val)
                    return
                ptr = ptr.left
            else:
                ind += 1
                if ptr.left is not None:
                    ind += ptr.left.size
                if ptr.right is None:
                    self.insert(ind, val)
                    return
                ptr = ptr.right


from statistics import median

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

sp = SplayTree()
for i in range(n):
    sp.insert(i, a[i])
for i in range(n):
    sp[i] = sp[i] - (i + 1)

ave = int(median([sp[i] for i in range(n)]))
ans = 0

for i in range(n):
  ans += abs(sp[i] - ave)
  
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n = int(input())
h = list(map(int,input().split()))
a = int(input())
def getNearestValue(h, a):
	idx = np.abs(np.asarray(h) - a).argmin()
	return h[idx]
print(getNearestValue(h, a))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a = [int(x) for x in input()]
print(np.amax(abs(np.subtract.outer(a, a))))

Submission status: Runtime Error

Solution code:
mport numpy as np
n = int(input())
a = [int(input()) for x in range(n)]
print(np.amax(abs(np.subtract.outer(a, a))))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
nums = [int(num) for num in input().split()]

num_min = nums[0]
num_max = nums[0]
for item in nums:
  if item < num_min:
    num_min = item
  elif item > num_max:
    num_max = item
  else:
    
print(num_max - num_min)

Submission status: Runtime Error

Solution code:
n = int(input())
nums = [int(num) for num in input().split()]

num_min = nums[0]
num_max = nums[0]
for item in nums:
  if item < num_min:
    num_min = item
  elif item > num_max:
    num_max = item
  else:

print(num_max - num_min)

Submission status: Runtime Error

Solution code:
n = int(input())
nums = [int(num) for num in input().split()]

num_min = nums[0]
num_max = nums[0]
for item in nums:
  if item < num_min:
    num_min = item
  else item > num_max:
    num_max = item

print(num_max - num_min)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

#include<vector>
#include<iostream>

using namespace std;

int main(){
    int n;
    cin>>n;
    // vector<int> ar(n , 0);
    int max=0 , min = INT_MAX;
    for(int i =0; i< n; i ++)
    {
        int temp;
        cin>>temp;
        if( temp > max )
            max = temp;
        if ( temp < min )
            min = temp;
    }
    cout<<max - min ;
    return 0;
}

Submission status: Runtime Error

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

a.sort()

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

Submission status: Runtime Error

Solution code:
import math

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

a.sort()

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

Submission status: Runtime Error

Solution code:
n=int(input())
l=sorted(map(iny,input().split()))
m=l.pop(0)
M=l.pop(n-2)
print(M-m)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

Solution code:
def main(n, a):
    ans = 0
    for i, j in permutations(a, 2):
        ans = max(ans, i - j)

    print(ans)


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

    main(n, a)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()
A = [int(i) for input().split()]
int(max) = 0
int(min) = 0
for i in N:
  if int(max) < A[i]:
    max = A[i]
for i in N:
  if int(min) > A[i]:
    min = A[i]

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = map(int,input())
maxi = 0
for i in range(N-1):
  maxi = max(maxi,A[i]-A[i+1])
print(maxi)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

i=0

max = 0
min = 0
for i in range(n):
  if a[i] >= max:
    max = a[i]
  elif a[i] <= min:
    min = a[i]
  else:
    continue
    
print (max - min)

Submission status: Runtime Error

Solution code:
N = int(input())

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

i=0

max = 0
min = 0
for i in range(n):
  if a[i] >= max:
    max = a[i]
  elif a[i] <= min:
    min = a[i]
  else
    continue
    
print (max - min)

Submission status: Runtime Error

Solution code:
N = int(input())

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

i=0

c=0
max = 0
min = 0
for i in range(n):
  if a[i] >= max:
    max = a[i]
  elif a[i] <= min:
    min = a[i]
  else
    i +=1
    
print (max - min)

Submission status: Runtime Error

Solution code:
N = int(input())

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

i=0

c=0
max = 0
min = 0
for i in a[i]:
  if a[i] >= max:
    max = a[i]
  elif a[i] <= min:
    min = a[i]
  else
    i +=1
    
print (max - min)

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int(input()) for i in range(n)]
dist = []
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        dist.append(abs(a[i]-a[j]))
print(max(dist))

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int(input) for i in range(n)]
dist = []
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        dist.append(abs(a[i]-a[j]))
print(max(dist))

Submission status: Runtime Error

Solution code:
N = int(input())
lst = [int(n) for n in input().split(" ")]
val_max = 0
val_min = 0
for i in range(0,N):
  if val_max < i:
    val_max = i
  elseif val_min > i:
    val_min = i
print(val_max-val_min)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
4
1 4 6 3

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
ais = list(map(int, input().split()))
a_mini = ais[0]
a_max = ais[0]
for i in rnage(1, n):
  if ais[i] < a_mini:
    a_mini = ais[i]
  if ais[i] > a_max:
    a_max = ais[i]
print(a_max - a_mini)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
_ = int(input())
nums = list(map(int, input().split())
max_n = 0
min_n = 0
for i in nums:
	if max_n < i:
        max_n = i
    if min_n > i:
        min_n =i
print(max_n - min_n)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n; cin >> n;
  int mn, mx;
  cin >> mn; mx = mn;
  for (int i = 1; i < n; i++) {
    int t; cin >> t;
    mn = min(mn, t);
    mx = max(mx, t);
  }
  cout << mx - mn << endl;
}

Submission status: Runtime Error

Solution code:
n=int(input())
list=[input() for i in range(n)]
sorted(list)
print(abs(list[-1]-list[0]))

Submission status: Runtime Error

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

print(max(ls) - min(ls))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
ln=map(int,input().split())
print(abs(max(ln)-min(ln)+1))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = input()
A = A.split()
L = len(A)
B =[]
for i in range(L):
    B.append(int(a[i]))
B.sort(reverse=True)
ans = B[0] - B[L-1]

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
ll = map(int,input())
 
print(max(ll)-min(ll))

Submission status: Runtime Error

Solution code:
N = int(input())
ll = map(int,input())

print(max(ll)-min(ll))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

max_num = max(b)
min_num = min(b)

print(max_num - min_num)

Submission status: Runtime Error

Solution code:
a = [input() for i in range(2)]
b = a[1]
x = int(max(b))-int(min(b))
print(x)

Submission status: Runtime Error

Solution code:
a = input()
c, b = a.split("/n")
x = int(max(b))-int(min(b))
print(x)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
x = int(max(b))-int(min(b))
print(x)

Submission status: Runtime Error

Solution code:
a = input()
b = list(int(input()))
x = max(b)-max(b)
print(x)

Submission status: Runtime Error

Solution code:
a = input()
b = list(int(input()))
x = max(b)-max(a)
print(x)

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for _ in range(n) :
    a += [int(input())]
print(max(a)- min(a))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()
A = input()


A_list = []
for i in range(0, len(A), 1):
    A_list.append(int(A[i: i + 1]))


A_list_int = list(map(int, A_list))

max = max(A_list_int)
min = min(A_list_int)

print(max - min)

Submission status: Runtime Error

Solution code:
N = input()
A = input()

A_list = [A[i: i + 1] for i in range(0, len(A), 1)]

A_list_int = list(map(int, A_list))

max = max(A_list_int)
min = min(A_list_int)

print(max - min)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a = int.input()
l = list(map(int,input().split()))
m = l[0]
M = l[0]
for i in range(1,a):
  if l[i]<m:
    m = l[i]
  else:
    if l[i]>M:
      M = l[i]
    else:
      pass
print(M-m)

Submission status: Runtime Error

Solution code:
a = int.input()
l = list(map(int,input().split()))
m = l[0]
M = l[0]
for i in range(1,a):
  if l[i]<m:
    m = l[i]
  else:
    if l[i]>M:
      M=l[i]
    else:
      pass
  
print(M-m)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print(abs(wMax - wMin))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
a=map(int,input().split())
ans=0
while i in a:
  while s in a:
    x=abs(s-i)
    if x>ans:
      ans=x
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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