TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().rstrip().split(" ")))

sm = 0
for i in range(0, n):
    sm = sm + a[i]

min_dif = sm

p = 0
for i in range(n-3):
    p = p + a[i]
    if 4*p < sm:
        next
    q = 0
    for j in range(i+1, n-2):
        q = q + a[j]
        if 3*q < sm - p:
            next
        r = 0
        for k in range(j+1, n-1):
            r = r + a[k]
            if 2*r < sm - p - q:
                next
            s = 0
            for l in range(k+1, n):
                s = s + a[l]
            d = max([p, q, r, s])-min([p, q, r, s])
            min_dif = min([d, min_dif])

p = 0
for i in range(n-3):
    p = p + a[i]
    if 4*p <= sm - 3*min_dif or 4*p >= sm + 3*min_dif:
        next
    q = 0
    for j in range(i+1, n-2):
        q = q + a[j]
        if abs(p-q) >= min_dif or 4*q <= sm - 3*min_dif or 4*q >= sm + 3*min_dif:
            next
        r = 0
        for k in range(j+1, n-1):
            r = r + a[k]
            if abs(p-r) >= min_dif or abs(q-r) >= min_dif or 4*r <= sm - 3*min_dif or 4*r >= sm + 3*min_dif:
                next
            s = 0
            for l in range(k+1, n):
                s = s + a[l]
            d = max([p, q, r, s])-min([p, q, r, s])
            min_dif = min([d, min_dif])

print(min_dif)


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

t = list(0 for i in range(n+1))
for i in range(1, n+1):
    t[i] = t[i-1] + a[i-1]

def sum_a(i, j):
    return t[j]-t[i]

min_dif = sum_a(0, n)

for i in range(2, n-1):
    j0 = 0
    j1 = i
    u = sum_a(0, i) // 2
    while j1 - j0 > 1:
        j = (j0+j1) // 2
        if 2*sum_a(0, j) <= u: 
            j0 = j
        else:
            j1 = j
    if abs(sum_a(0, j0)-sum_a(j0, i)) < abs(sum_a(0, j1) - sum_a(j1, i)): 
        p = sum_a(0, j0)
        q = sum_a(j0, i)
    else:
        p = sum_a(0, j1)
        q = sum_a(j1, i)

    j0 = i
    j1 = n
    u = sum_a(i, n) // 2
    while j1 - j0 > 1:
        j = (j0+j1) // 2
        if sum_a(i, j) <= u: 
            j0 = j
        else:
            j1 = j
    if abs(sum_a(i, j0)-sum_a(j0, n)) < abs(sum_a(i, j1) - sum_a(j1, n)): 
        r = sum_a(i, j0)
        s = sum_a(j0, n)
    else:
        r = sum_a(i, j1)
        s = sum_a(j1, n)

    min_dif = min(min_dif, max(p, q, r, s)-min(p, q, r, s))

print(min_dif)


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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
#! /usr/bin/env python
# coding: UTF-8


def sad(list, b):
    value = 0
    n = 1
    for a in list:
        value += abs(a - (b+n))
        n += 1
    return value


def main():
    mn = 1000000
    n = (int)(input())
    lst = list(int(i) for i in input().split())
    mx = max(lst)
    for i in range(mx):
        if(sad(lst, i) < mn):
            mn = sad(lst, i)
    print(mn)

if __name__ == '__main__':
    main()

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

def gcd(m, n):
    if n == 0:
        return m
    else:
        return gcd(n, m%n)

def main():
    n = int(input())

    print(int(n*2/gcd(n,2)))

if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
a = input()
print(a * 2 if int(a) % 2 == 1 else a)

a = int(input())
print(a * 2 if a % 2 == 1 else a)


Verdicts: Wrong Answer

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
i = N
while True:
    if i % 2 == 0 and i % N ==0:
        print(i)
        break
    i+=i

N = int(input())
i = N
while True:
    if i % 2 == 0 and i % N ==0:
        print(i)
        break
    i+=i

Verdicts: Runtime Error

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
n=int(input())
a=list(map(int, input().split()))
print(max(a)-min(a))

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

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

a=int(input())
if (a%2)==0: print(a)
else: print(a*2)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
N = int(input())
if(N%2 == 1):
  a = 2N 
else:
  a = N
print(a)


N = int(input())
if(N%2 == 1):
  a = 2*N 
else:
  a = N
print(a)


Verdicts: Runtime Error

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
n = int(input())
print((n*2) if n%2 == o else n)

n = int(input())
print((n*2) if n%2 == 0 else n)

n = int(input())
print(n if n%2 == 0 else n*2)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
n = int(input()
if n%2 == 0 :
    print(n)
else :
    print(2*n)

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

Verdicts: Runtime Error

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
def gcd(a, b):
  if b > a:
    a, b = b, a
    while b != 0:
      a, b = b, a % b
    return a

n = int(input())
ans = n * 2 // gcd(n, 2)
print(ans)


def gcd(a, b):
  if b > a:
    a, b = b, a
  while b != 0:
    a, b = b, a % b
  return a
 
n = int(input())
ans = n * 2 // gcd(n, 2)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
n = int(input())
if n % 2 == 0:
	print(n)
else:
	print(n + 1)

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

Verdicts: Wrong Answer

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
n=int(input())
if n%2=0:
  print(n)
else:
  print(2n)

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):





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

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

a.sort()
if N % 2 != 0:
    mid = (N-1)//2
else:
    mid = N // 2 
b = a[mid]

sadness_left = b * mid - sum(a[:mid])
sadness = sum(a) - b * N + sadness_left * 2

print(sadness)









# 7
# 1 1 1 1 2 3 4
#import sys

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

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

a.sort()
if N % 2 != 0:
    mid = (N-1)//2
else:
    mid = N // 2 -1
b = a[mid]

sadness_left = b * mid - sum(a[:mid])
sadness = sum(a) - b * N + sadness_left * 2

print(sadness)


# A - Multiple of 2 and N


# A_Multiple_of_2_and_N.py

N = int(input())

if N == 1:
    print(2)
elif N%2 == 0:
    print(N)
else:
    print(N*2)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.

Submission attempts (in order):
N = int(input())
f1 = False
f2 = False
a = 1
while True:
    if(a % 2 == 0):
        f1 = True
    if(a % N == 0):
        f2 = True
    if(f1 == True and f2 == True):
        break
    elif(a > N):
        a = N * 2
    else:
        f1 = False
        f2 = False
    a += 1
print(a)


N = int(input())
ans = 0
if(N % 2 == 0):
    ans = N
else:
    ans = N * 2
print(ans)


Verdicts: Time Limit Exceeded

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
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)

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

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

print(nv-nm)
        

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
#!/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()

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

if __name__ == '__main__':
	main()

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())
l=sorted(map(iny,input().split()))
m=l.pop(0)
M=l.pop(n-2)
print(M-m)

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
n_list = list(map(int,input().split())
n_list.sort()
print(n_list[-1] - n_list[0])

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N = input()
l = [int(x) for x in input().rstrip().split()]
_max = 0
_min = l[0]
for t in l:
  if _max < t:
    _max = t
  if _min > t:
    _min = t  
return _max - _min

N = input()
string_list = input().rstrip().split()
l = [int(x) for x in string_list]
_max = 0
_min = l[0]
for t in l:
  if _max < t:
    _max = t
  if _min > t:
    _min = t  
return _max - _min

N = input()
string_list = input().rstrip().split()


N = input()
l = [int(input()) for i in range(N)]
_max = 0
_min = l[0]
for t in l:
  if _max < t:
    _max = t
  if _min > t:
    _min = t  
return _max - _min

N = input()
string_list = input().rstrip().split()
l = [int(x) for x in string_list]
_max = 0
_min = l[0]
for t in l:
  if _max < t:
    _max = t
  if _min > t:
    _min = t  
print(_max - _min)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
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)

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N = int(input())
a = input().split()
ans = 0
min = max(a)
for i in range(0,N):
	a[i] = int(a[i])
for i in range(0,N-1):
	for j in range(1,N):
		if abs(a[i]-a[j]) < min
			min = abs(a[i]-a[j])
print(min)

N = int(input())
a = input().split()


for i in range(0,N):
	a[i] = int(a[i])
mi = 0
for i in range(0,N-1):
	for j in range(i+1,N):
		if abs(a[i]-a[j]) > mi:
			mi = abs(a[i]-a[j])
print(mi)

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
input()
n=sorted(list(map(int,input().split())))
print(n［-1］- n［0］)

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
A = [int(i) for i in input().split()]
A=A.sort()
print(A[-1]-A[0])

#encoding: utf-8

n = int(input())
A = [int(i) for i in input().split()]
A.sort()
print(A[-1]-A[0])


Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
a=int(input())
b=list(map(int, input().split()))
print(max(a)-min(b))

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
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)

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

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())
a=list(map(int, input()))
print(max(a)-min(a))

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

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


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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N = int(input().strip())
A = map(int, input().strip().split())
max_abs_sum = 0
for i in range(len(A) - 1):
  for j in (i+1, range(A)):
    if max_abs_sum < abs(A[i] - A[j]):
      max_abs_sum = abs(A[i] - A[j])
print(max_abs_sum)

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

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))
b = max(a)-min(b)
print(b)

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
A = list(map(int, input().split()))
print(max(A)-min(A))

N = int(input())
A = list(map(int, input().split()))
B = list()
for i in range(N):
  B.append(abs(A[i]))
print(max(B)-min(B))

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
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),ans)
    
print(ans)

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)

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(A[i]-A[j]),ans)
    
print(ans)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
a = [int(i) for i in range(n)]
print(max(a) - min(a))


n = int(input())
a = [int(i) for i in input().split()]
print(max(a) - min(a))


Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):

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



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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
# -*- coding: utf-8 -*-

a = input()

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

# -*- coding: utf-8 -*-

a = input()

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
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)

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)

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
l=list(map(int ,input().split()))
print((max(l)-min(l))

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):

N = int(input())
print(N)
list_A = [int(str_A) for str_A in input().split(" ")]
print(list_A)

print(max(list_A) - min(list_A))

N = int(input())
list_A = [int(str_A) for str_A in input().split(" ")]

print(max(list_A) - min(list_A))

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N = int(input())
ls = list(map(int, input().split())

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

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

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



Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N = int(input())
Alist = [int(i) for i in input().split()]

Alist.reverse()
print(Alist[0]-Alist[N-1])

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

Alist.sort()
print(Alist[N-1]-Alist[0])

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
lists = list(map(int, input().split()))

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

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N=input()
a=input().split()
a=[int(x) for x in a]
print(a)
t=0
for i in range(len(a)):
    for j in range(i+1, len(a)):
        if abs(a[i]-a[j])>t:
            t=abs(a[i]-a[j])
        
print(t)






N=input()
a=input().split()
a=[int(x) for x in a]
print(a)
t=0
for i in range(len(a)-1):
    for j in range(i+1, len(a)):
        if abs(a[i]-a[j])>t:
            t=abs(a[i]-a[j])
        
print(t)






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

t=0
for i in range(len(a)-1):
    for j in range(i+1, len(a)):
        if abs(a[i]-a[j])>t:
            t=abs(a[i]-a[j])
        
print(t)






Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
_ = 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)
    

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


Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))

mn = 10**9+1 
mx = 0       

for v in A:
  if v < mn:
    mn = v   
  else:
    mx = v   

print(mx-mn)

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


Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
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))

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
a = map(int, input().split())

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

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

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
s = sorted(map(int,input().split()))
print(s[-1]-s[0])

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

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
li=list(map(int,input().split()))
print(max(li)-min(li))

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

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
an = input()
an = an.split()

dif = 999999999

for i in range(n-1):
    for r in range(i+1, n):
        a = int(an[i])
        b = int(an[r])

        abs = abs(a-b)
        if abs < dif:
            dif = abs

print(dif)


def func(a, b, c):
    
    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)


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

dif = 10000000000

for i in range(n-1):
    for r in range(i+1, n):
        a = int(an[i])
        b = int(an[r])

        abs = abs(a-b)
        if abs < dif:
            dif = abs

print(dif)


n = input()
an = input()
an = an.split()
list = []

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

print(max_an - min_an)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N = int(input())
A = list(map(int, input()))

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

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

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
import sys
from collections import deque
from collections import  Counter
import statistics
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
a_li = na()
for i in range(n):
    a_li[i] = a_li[i] - (i + 1)
m1 = statistics.median_high(a_li)
#m2 = statistics.median_high(a_li)
ans1 = 0
#ans2 = 0
for i in range(n):
    ans1 += abs(a_li[i] - m1)
    #ans2 += abs(a_li[i] - m2)
print(ans1)


import sys
from collections import deque
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
a_li = na()
ans = -1
for i in range(n):
    for j in range(i+1, n):
        ans = max(ans, abs(a_li[i] - a_li[j]))
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
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)

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)

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
a = list(map(int, input().split()))
print(max(a)-min(a))

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


Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in range(len(a)):
    for j in range(i,len(a)):
        l.append(abs(a[i]-a[j]))
print(max(a))


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

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
a=input()
a=sorted(map(int,input().split()))
print(a[-1]-a[1])


import numpy as npo
a=input()
a=(map(int,input().split()))
a=npo.array(a)
a=npo.sort()
print(a[-1]-a[0])

print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")


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



import numpy as npo
a=input()
a=(map(int,input().split()))
a=npo.array(a)
a=npo.sort.()
print(a[-1]-a[0])

print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")

import numpy
a=input()
a=list((map(int,input().split())))
a=numpy.array(a)
a=numpy.sort(a)
print(a[-1]-a[0])


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
list = map(int,input().split())

list.sort()

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

print(answer)

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

x.sort()

answer = x[-1] - x[0]

print(answer)

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
a_list = [int(i) for i in input().split()]
d_list =[]

for i in range(n):
	for j in range(n-i):
		print(i,n-j-1)
		d_list.append(abs(a_list[i]-a_list[n-j-1]))
		
print(max(d_list))

n = int(input())
a_list = [int(i) for i in input().split()]
d_list =[]

for i in range(n):
	for j in range(n-i):
		# print(i,n-j-1)
		d_list.append(abs(a_list[i]-a_list[n-j-1]))
		
print(max(d_list))

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))
A.sort()
range = 0

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

print(range)


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

# range=A[N-1]-A[0]

range = 0

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

print(range)


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

range=A[N-1]-A[0]

print(range)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())

A=list(map(int,input()))



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

n=int(input())

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



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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N=int(input())
A=list(map(int, input().split()))
max(A)-min(A)

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

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
num_len = int(input())
numbers = list(map(int, input().split()))
print(max(numbers) - min(numbers)

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N=int(input())
A=list(map(int,input().split()))
print(max(A)-max(B))

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
# -*- coding: utf-8 -*-



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

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


# -*- coding: utf-8 -*-


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


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N  = (int(i) for i in input().split())
A = list(int(i) for i in range(input().split(),N))

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

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

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())
arr=list(map(int,input().split()))
print(abs(arr[-1]-arr[0]))

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

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
d=[]
import itertools
for v in itertools.combinations(a,2):
    #print(v)
    d.append(abs(v[0]-v[1]))
print(min(d))

n=int(input())
a=list(map(int,input().split()))
d=[]
import itertools
for v in itertools.combinations(a,2):
    #print(v)
    d.append(abs(v[0]-v[1]))
print(max(d))

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
#!/usr/bin/env python3

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

ans = 0
for i in range(len(a)-1):
    ans = max(ans, abs(a[i]-a[i+1]))

print(ans)


#!/usr/bin/env python3

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

ans = max(a) - min(a)

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())
a=sorted(map(int,input()))
print(a[-1]-a[0])

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
max=0
for i in range(n-1):
  if abs(a[i]-a[i+1])>max:
    max=abs(a[i]-a[i+1])
print(max)

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

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input().split())
an = list(map(int, input().split()))
print(max(an) - min(an))

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
li = map(int,input().split())
li.sort()
print(abs(li[-1]-li[0]))

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
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)
         

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)

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)

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)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
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))

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
a_list = list(map(int, input().split())
              
a_sorted = sorted(a_list)
              
print(a_sorted[-1] - a_sorted[0]

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())
num=input().split()
print(max(num)-min(num))

n=int(input())
num=input.split()
print(num.max()-num.min())

n=int(input())
num=int(input().split())
print(max(num)-min(num))

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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
a = a.sort()
ans = a[-1] - a[0]
print(ans)

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

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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
H = list(map(int, input().split())
print(max(H)-min(H))

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

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

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = input()
l = input().split()
l = map(int, l)
max, min = max(l), min(l)
print(max - min)

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
a = int(input())
b = [int(i) for i in input.split()]

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

print(max_num - min_num)

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

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

print(max_num - min_num)


Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
a = map(int, input().split())
print(max(a)-min(a))


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


Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
_ = input()
u = list(map(int,input().split())).sort()
print(u[-1] - u[0])

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())
ln=map(int,input().split())
print(abs(max(ln)-min(ln)+1))

n=int(input())
ln=[int(n) for n in map(int,input().split())]
print(max(ln)-max(ln))

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

n=int(input())
ln=[int(a) for a in input().split()]
print(abs(max(ln)-min(ln)))

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
import math

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

a.sort()

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


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

a.sort()

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


import math

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


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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().spllit()))
print(max(A) - min(A))


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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N = int(input())

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

A_s = set(A)
A.sort()
A.reverse()

a1 = A[0]
a2 = A[1]


print(a1-a2)


N = int(input())

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

A_s = set(A)
A.sort()
A.reverse()

a1 = A[0]
a2 = A[-1]


print(a1-a2)


Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n = int(input())
nl = sorted(list(map(int, input().split())), reverse=True)
print(nl[0] - nl[1])

input()
nl = sorted([int(i) for i in input().split()])
print(abs(nl[-1] - nl[0]))

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())
A=list(map(int,input().split()))
A.sort()
print(A)
print(str(A[n-1]-A[0]))


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


Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
count=input()
list=input().rstrip().split(" ")
sa = int(list[0])-int(list[1])
for i in range(len(list)):
  if sa<(int(list[i-1])-int(list[i])):
    sa=(int(list[i-1])-int(list[i]))
if sa<0:
  print(-1*sa)
else:
  print(sa)

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

count=input()
list=input().rstrip().split(" ")
list_1=[int(s) for s in list]
sa=(max(list_1)-min(list_1))

count=input()
list=input().rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(max(list2)-min(list2))

count=input()
list=input().rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(max(list2)-min(list2))

count=input()
list=input().rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(max(list2)-min(list2))

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

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)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
4
1 4 6 3

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N=int(input())
A=list(map(int,input.split))
print(max(A)-min(A))


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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
 

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

Verdicts: Wrong Answer

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n, aaa = map(int, open(0).split())
print(max(aaa) - min(aaa))

n, *aaa = map(int, open(0).read().split())
print(max(aaa) - min(aaa))

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))

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

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

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

Verdicts: Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
n=int(input())
a=[map(int,input().split()]
print(max(a)-min(a))


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


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

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


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

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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A.

Submission attempts (in order):
N = int(input())
A = list(map(int,input()split()))

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

ans = Amax - Amin
print(ans)

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)

Verdicts: Runtime Error

Accepted