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: Wrong Answer

Solution code:
import sys

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

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

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

Submission status: Wrong Answer

Solution code:
import sys

def solve(n, as1):
    a=1
    b=1    
    for i in as1:
        if a <i:
            a=i
        elif b>i:
            b=i
    return a-b

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

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

Submission status: Wrong Answer

Solution code:
import sys

def solve(n,lst_a):
    a=1
    b=1
    for i in lst_a:
        if a < i:
            a=i
        if b >i:
            b=i
    return a-b

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

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

Submission status: Wrong Answer

Solution code:
import re

N = input()
List = re.split(" ",input())

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

Submission status: Wrong Answer

Solution code:
import re
N = input()
Data = input()
List = re.split(" ",Data)
MA = int(max(List))
MI = int(min(List))
print(MA-MI)

Submission status: Wrong Answer

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

minNum = 1000000000
maxNum = 1

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

Submission status: Wrong Answer

Solution code:

n = int(input())
l = input().split()

max = 0
min = 100000000 

for i in range(len(l)):
    if int(l[i]) > max:
        max = int(l[i])
    if int(l[i]) < min:
        min = int(l[i])
            
print (abs(max-min))

Submission status: Wrong Answer

Solution code:

n = int(input())
l = input().split()

tmp = 0

for i in range(len(l)):
    for j in range(len(l)):
        a = abs(int(l[i]) - int(l[j]))
        if(tmp < a):
            tmp = a
            
print (a)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
def main():
	N = int(input())
	A = input().split()
	A.sort()
	print(int(A[N-1])-int(A[0]))
 
if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
def main():
	N = int(input())
	if N % 2 == 0:
		print(int(N))
	else:
		print(int(N*2))
 
if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
def func(a, b, c):
    # aはA1からANまでの和、bはb、ｃはn
    sum_b = c*b
    sum_n = 0
    for i in range(1,c+1):
        sum_n = sum_n + i

    return(abs(a-sum_b-sum_n))

n = int(input())
an = input().split()
an_sum = 0

for i in an:
    an_sum = an_sum + int(i)

sad = 1000

for b in range(2*n):
    ga = func(an_sum, b, n)

    if ga < sad:
        sad = ga

print(sad)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = input() .split()
a = list(A)
b = int(max(a))
s = int(min(a))
ans = abs(b-s)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = input() .split()
a = list(A)
if len(a) == N:
    b = int(max(a))
    s = int(min(a))
    print(b-s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
aryA = input().split(" ")

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

print(max(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mx = 1
mn = 1


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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

max_abs=0

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

print max_abs

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num = int(input())
listA = input().split()
listA.sort()
ans = int(listA[num - 1]) - int(listA[0])
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
lst=input().split()
a=int(max(lst))
b=int(min(lst))
print(a-b)

Submission status: Wrong Answer

Solution code:
num = int(input())
listA = input().split()
listA.sort()
ans = abs(int(listA[num - 1])) - abs(int(listA[0]))
print(ans)

Submission status: Wrong Answer

Solution code:
num = int(input())
listA = input().split()
listA.sort()
ans = abs(int(listA[num - 1]) - int(listA[0]))
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int, input().split()))
ans = 0
for i, a in enumerate(A, 1):
    if i == len(A):
        break
    if ans < abs(a-A[i]):
        ans = abs(a-A[i])
print(ans)

Submission status: Wrong Answer

Solution code:
n = input()
an = input()
an = an.split()

min_an = int(min(an))
max_an = int(max(an))

print(max_an - min_an)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

nm = 10 ** 10
nv = -1
for i in range(n):
    if a[i] > nv:
        nv = a[i]
        continue
    
    if a[i] < nm:
        nm = a[i]

print(nv-nm)

Submission status: Wrong Answer

Solution code:
str_n = input()
n = int(str_n)
str_a = input()
arr_a = str_a.split(' ')

arr_a.sort()
print(int(arr_a[-1]) - int(arr_a[0]))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest


if __name__ == '__main__':
    n = int(input())

    if n % 2 == 0:
        print(n)
    else:
        print(n * 2)

Submission status: Accepted

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

Number = list(S)

Maxi = max(Number)
Mini = min(Number)

print(Maxi - Mini)

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

answer=max(a)-min(a)

print(answer)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

Solution code:
n = int(input())
min_A = 10**9+7
max_A = -1
for i in input().split():
  tmp = int(i)
  max_A = max(tmp,max_A)
  min_A = min(min_A,tmp)
  
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:
# coding: utf-8
# Your code here!
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    for j in range(i+1,n):
        ans=max(abs(a[i]-a[j]),ans)
print(ans)

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):
        if i==j: continue
        ans = max(ans, abs(A[i] - A[j]))

print(ans)

Submission status: Accepted

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

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:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
print(max(a) - min(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 長さNの整数列Aが与えられます。Aの（添字の）異なる2要素の差の絶対値の最大値を求めてください。

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

answer = (max(num_list) - min(num_list))

print(answer)

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

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

max = 0
min = 1000000000

for i in range(len(data)):
    if max < data[i]:
        max = data[i]
    if min > data[i]:
        min = data[i]
print(max - min)

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

max = max(num)
min = min(num)

ans = max - min

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
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 = a[-1] - a[0]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
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 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

a = k()
b = l()
b.sort()

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

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:
# 入れ子で引き算、setでかぶりを消して、sorted,reverseで降順にし、0番を出す
N = int(input())
A = list(map(int, input().split()))
sub = []

for i in A:
    for j in A:
        sub.append(abs(i - j))

descending_sub = sorted(set(sub), reverse=True)
# print(descending_sub)

print(descending_sub[0])

Submission status: Accepted

Solution code:
def mapt(fn, *args):
    return list(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n = int(input())
    a = Input()
    print(max(a) - min(a))


main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import itertools


def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    N = int(input())
    A = list(map(int, input().split()))

    return N, A


def main(A: list) -> None:
    """
    メイン処理.

    Args:\n
        A (list): 整数列(1 <= A_i <= 10^9)
    """
    # 求解処理
    ans = 0
    for A_i, A_j in itertools.combinations(A, r=2):
        ans = max(ans, abs(A_i - A_j))

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    N, A = get_input()

    # メイン処理
    main(A)

Submission status: Accepted

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

def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    N = int(input())
    A = list(map(int, input().split()))

    return N, A


def main(A: list) -> None:
    """
    メイン処理.

    Args:\n
        A (list): 整数列(1 <= A_i <= 10^9)
    """
    # 求解処理
    ans = max(A) - min(A)

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    N, A = get_input()

    # メイン処理
    main(A)

Submission status: Accepted

Solution code:

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


ma=a.index(max(a))
mi=a.index(min(a))

print(a[ma]-a[mi])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import itertools

# 標準入力を取得
N = int(input())
A = list(map(int, input().split()))

# 求解処理
ans = 0
for A_i, A_j in itertools.combinations(A, r=2):
    ans = max(ans, abs(A_i - A_j))

# 結果出力
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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()) #Nを入力
lista=input().split() #Aを入力
p=int(lista[0])#p最小値
q=int(lista[0])#q最大値
for i in range(1,n):
    k=int(lista[i])
    if k<=p:
        p=k
    elif k>=q:
        q=k
print(int(q-p))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
M = []
ABS = 0

for i in range(N):
    for j in range(N):
        if i == j:
            continue
        else:
            ABS = abs(A[i] - A[j])
            M.append(ABS)
            
print(max(M))

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:
S_list = [input() for i in range(2)]
N = map(int,S_list[0].split())    
A_list = list(map(int,S_list[1].split()))

A_max = max(A_list)
A_min = min(A_list)
A_abs = abs(A_max - A_min)
print(A_abs)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

diffmax = 0
for i in range(N):
	for j in range(1,N):
		diff = abs(A[i]-A[j])
		if diff > diffmax:
			diffmax = diff
print(diffmax)

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = Amax - Amin
print(ans)

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())
l = [int(i) for i in input().split()]
m = []
for i in range(N):
    for j in range(i):
        m.append(abs(l[i] - l[j]))
print(max(m))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
  for j in range(i,n):
    num1 = abs(num[i]-num[j])
    if ans <= num1:
      ans = num1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

def answer(n: int, a: list) -> int:
    return max(a) - min(a)
print(answer(n, a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

# Aの（添字の）異なる2要素の差の絶対値の最大値を出力せよ。

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - Maximum Difference

# N
N = int(input())
my_list = list(map(int, input().split(maxsplit=N)))

my_list_sort = sorted(my_list, reverse=True)
answer = my_list_sort[0] - my_list_sort[-1]

print(answer)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(max(A1)-min(A1))

Submission status: Accepted

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

difference = max(A) - min(A)

print(difference)

Submission status: Accepted

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

Submission status: Accepted

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

result = 0;

for i in Nums:
    for ii in Nums:
        if result < abs(i - ii):
            result = abs(i - ii)
print(result)

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()))
max = 0
for i in range(n):
  for j in range(i+1, n):
    if abs(a[j] - a[i]) > max:
      max = abs(a[j] - a[i])
print(max)

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

print(max(numbers) - min(numbers))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# 数値の取得
lnum = int(input())
lint = list(map(int, input().split()))

# 差の出力
difference = abs(max(lint) - min(lint))
print(difference)

Submission status: Accepted

Solution code:
# 102b

def atc_102b(N: int, Ai_input: str) -> int:
    Ai = [int(i) for i in Ai_input.split(" ")]
    return max(Ai) - min(Ai)

N_input_value = int(input())
Ai_input_value = input()
print(atc_102b(N_input_value, Ai_input_value))

Submission status: Accepted

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

value_max = abs(max(A)) - abs(min(A))

print(value_max)

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(s) for s in input().split()]

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

Submission status: Accepted

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

def ans102(N:int, A:list):
    A=sorted(map(int,A))
    return(A[N-1]-A[0])

print(ans102(N,A))

Submission status: Accepted

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

print(max(num_list) - min(num_list))

Submission status: Accepted

Solution code:
def answer(n: int, a: []) -> int:
    return max(a) - min(a)


def main():
    n = int(input())
    a = list(map(int, input().split()))
    print(answer(n, a))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

answer = 0
for i,j in itertools.combinations(A,2):
    answer = max(answer, abs(i - j))

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
n, = [int(num) for num in lines.pop(0).split(" ")]
a_list = [int(num) for num in lines.pop(0).split(" ")]
ans = max(a_list) - min(a_list)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ls = list(combinations(A,2))

ans = 0
for (a,b) in ls:
  ans = max(ans, abs(a - b))
  
print(ans)

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

Submission status: Accepted

Solution code:
n = int(input())
list_a = sorted([int(n) for n in input().split()])
print(list_a[-1] - list_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:
import sys
mapin = lambda: map(int, sys.stdin.readline().split())
listin = lambda: list(map(int, sys.stdin.readline().split()))
inp = lambda: sys.stdin.readline()

N = int(inp())
vec = listin()
ans = 0
for i in range(N):
    for j in range(i + 1,N):
        #print(str(i) + ',' + str(j))
        if ans < abs(vec[i] - vec[j]):
            ans = abs(vec[i] - vec[j])
print(ans)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
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 = 0
for i in range(n-1):
    for j in range(i+1, n):
        x = max(x, abs(a[i]-a[j]))
print(x)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=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 = -1
for i in range(N):
  for j in range(i+1, N):
    ans = max(ans, abs(A[i] -A [j]))
print(ans)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    A = list(map(int, readline().split()))

    ans = 0

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#
import sys
import math
import numpy as np
import itertools


n = int(input())

# 空白区切りの数列をリストに代入
a = [int(i) for i in input().split()] 

mi=1000000001
ma=0
for i in range(n):
    if a[i] > ma:
        ma = a[i]
    if a[i] < mi:
        mi = a[i]

print(ma-mi)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = 0
for i in a:
    for j in a:
        if abs(i - j) > b:
            b = abs(i - j)
print(b)

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.sort()
x=A[n-1]-A[0]
print(x)

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

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

max = max(list)
min = min(list)

m = max-min

print(m)

Submission status: Accepted

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

print(abs(max - min))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
count=input()
list=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: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# vim: fileencoding=utf-8


def main():
    n = int(input())
    li = list(map(int, input().split()))
    a = b = li[0]
    for i in li:
        a = min(a, i)
        b = max(b, i)
    print(b - a)


if __name__ == "__main__":
    main()

Submission status: Accepted

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


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


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:
# -*- coding: utf-8 -*-

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

max_A = min_A = A[0]
for i in range(1,N,1):
    if A[i] > max_A:
        max_A = A[i]
    if A[i] < min_A:
        min_A = A[i]

max_diff = max_A - min_A
print(max_diff)

Submission status: Accepted

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

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

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

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

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

print(num_max - num_min)

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
l = [0]*n**2
j = 0
b = 0

for i in a:
    for j in range(n):
        l[b]=i-a[j]
        b+=1
        
print(abs(max(l)))

Submission status: Accepted

Solution code:
from itertools import combinations
N = int(input())
res = 0
for a, b in combinations(map(int, input().split()),2):
    res = max(abs(a-b), res)
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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