Problem:


Score : 100 points

Problem Statement

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

Constraints

1 \leq N \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N

Output

Print the minimum positive integer divisible by both 2 and N.

Sample Input 1

3

Sample Output 1

6

6 is divisible by both 2 and 3.
Also, there is no positive integer less than 6 that is divisible by both 2 and 3.
Thus, the answer is 6.

Sample Input 2

10

Sample Output 2

10

Sample Input 3

999999999

Sample Output 3

1999999998



Sample input:
3


Sample output:
6

Submission status: Runtime Error

Solution code:
n = input()
a = input().split(' ')
result = 0
for i in range(len(a)):
	for j in range(i+1, len(a)):
		diff = abs(a[i]-a[j])
		if diff > result:
			result = diff
print(result)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# 桁数の入力
a = int(input())
# スペース区切りの整数の入力
b = input().split()
b.sort()
min = b[0]
b.reverse()
max = b[0]
print(int(max)-int(min))

Submission status: Runtime Error

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

Ni = list(range(1, N + 1))

i=0
before = 0
flag = 0
while True:
    i += 1
    sum_diff = sum([abs(a-i) for a, i in zip(A, Ni)])//i
    if flag == 0:
        before = sum_diff
        flag = 1

    if sum_diff >= before:
        break

print(before)

Submission status: Runtime Error

Solution code:
from statistics import median

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

b = [v - (i + 1) for i, v in enumerate(a)]

median = int(median(b))

c = sum(abs(v - median) for v in b)

print(c)

Submission status: Runtime Error

Solution code:
# 整数列A 
# 3箇所で切って、４つに
# それぞれの総和の最大値と最小値の差の絶対値の最小値

# 中央を固定することを考える(結局、その固定を全検索するが)
# 中央固定後、左側について、両方が同じくらいの値になるのが最適と考えて良いらしい

from itertools import accumulate

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

tmpP=tmpQ=tmpR=tmpS=0
P=Q=R=S=0
ans=10e9
l = 0
r = 2

# midとmid+1の間が中間の切断
for mid in range(1,N-2):

	# l,rは、単調増加であるため、全ての中間点を求めるループの間、クリアの必要がないらしい

	# 次のやつよりも、今のやつの方が大きい限り、継続
	# 必ず、それが逆転する時が最小のはず、という考え。。。
	while l < mid and abs((SumA[mid] - SumA[l+1])-SumA[l+1]) < abs((SumA[mid] - SumA[l])-SumA[l]):
		l += 1

	# 次のやつよりも、今のやつの方が大きい限り、継続
	# 必ず、それが逆転する時が最小のはず、という考え。。。
	while r < N-1 and abs((SumA[N-1]-SumA[r+1])-(SumA[r+1]-SumA[mid])) < abs((SumA[N-1] - SumA[r])-(SumA[r] - SumA[mid])):
		r += 1

	#print("{},{}".format(mid,l))

	P=SumA[l]
	Q=SumA[mid]-SumA[l]
	R=SumA[r]-SumA[mid]
	S=SumA[N-1]-SumA[r]

	#print(P,Q,R,S)
	diff=max(P,Q,R,S)-min(P,Q,R,S)
	diff=abs(diff)
	ans = min(ans,diff)

print(ans)

Submission status: Runtime Error

Solution code:
from itertools import accumulate

def S(a, b):
    return cl[b] - (0 if a == 0 else cl[a-1])

def partial(start, end, last):
    odiff = None
    for c in range(start, end+1):
        p = S(start,c)
        q = S(c+1,end)
        diff = abs(p-q)
        if odiff is None:
            odiff = diff
        if odiff < diff:
            return c, mp, mq
        odiff = diff
        mp = p
        mq = q

if __name__ == '__main__':
    # read input
    n = int(input())
    l = list(map(int, input().split()))
    # create cumlative list first
    cl = list(accumulate(l))
    clen = len(l)

    #  0  F(i)      i i+1 G(i)      len-1
    #  |------|------|-------|-------|
    #         c0    c1       c2
    #  <-----L------> <------R------->
    # pick up a c1 (i:i+1) and evaluate
    result = None
    c1 = 1
    c3 = 3
    for i in range(1,clen-2):
        # LEFT
        (c1, mb, mc) = partial(0, i, c1)
        # RIGHT
        c3, md, me = partial(i+1, clen-1, c3)

        # evaluate
        diff = abs(max(mb, mc, md, me) - min(mb, mc, md, me))
        if result is None:
            result = diff
        else:
            if result > diff:
                result = diff

    print(result)

Submission status: Runtime Error

Solution code:
import math

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
# input
N = input()

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm_base(2, N))

Submission status: Runtime Error

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

def sunuke(b):
    ret = 0
    sub = 1
    for a in A:
        ret += abs(a - (b+ sub))
        sub += 1
    return ret


B = []

sub = 1
for a in A:
    b = a - sub
    B.append(b)
    sub += 1

B.sort()
b1 = N // 2
if N < 3:
    print(sunuke(B[b1]))
    exit()

b2 = b1 + 1
b1_s = sunuke(B[b1])
b2_s = sunuke(B[b2])
if b1_s < b2_s:
    print(b1_s)
else:
    print(b2_s)

Submission status: Runtime Error

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

nums = [num - i for i,num in enumerate(nums,1)]
nums.sort()

sums = [None for i in range(n)]
sums[0] = nums[0]
allv = sum(nums)
minv = nums[0] * (1 - n) - 2 * sums[0] + allv
for i in range(n-1):
    sums[i+1] = sums[i] + nums[i+1]
    for b in range(nums[i], nums[i+1]+1):
        p = b * (2*(i+1) - n) -2 * sums[i] + allv
        minv = min(minv,p)

print(minv)

Submission status: Runtime Error

Solution code:
import statistics
import math

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

B = []
C = []
D = []
E = []
ureshimi = []
k = 0
l = 0

for i in range(N-3):
    BC = A[0 : i + 2]
    s = 0
    for j in range(k, i + 2):
        s += BC[j]
        if j == i + 1:
            k = j 
            B = BC[0 : j ]
            C = BC[j  : N - i]
            break
        elif s + BC[j + 1] > sum(BC) / 2:
            k = j
            if BC[j + 1] / 2 >= sum(BC) / 2 - s:
                B = BC[0 : j + 1]
                C = BC[j + 1 : i + 2]
            else:
                B = BC[0 : j + 2]
                C = BC[j + 2 : i + 2]
            break
    DE = A[i + 2 : N + 1]
    s = sum(DE[0:l - i + 1 ])
    for j in range(l - i + 1 , N - i - 2):
        if j == N - i - 3:
            l = j + i 
            D = DE[0 : j ]
            E = DE[j  : N - i]
            break
        elif s + DE[j ] > sum(DE) / 2:
            l = j + i
            if DE[j ] / 2 >= sum(DE) / 2 - s:
                D = DE[0 : j ]
                E = DE[j : N - i]
            else:
                D = DE[0 : j + 1]
                E = DE[j + 1 : N - i]
            break
        s += DE[j]
    ureshimi.append(max(sum(B), sum(C), sum(D), sum(E)) - min(sum(B), sum(C), sum(D), sum(E)))



print(min(ureshimi))

Submission status: Runtime Error

Solution code:
from math import gcd
n = int(input())
print((2*n)/gcd(2,n))

Submission status: Runtime Error

Solution code:
import sys
import math
N = input()
AList = list(map(int, input().split()))
listnum = 1000000000

low = -1000000000
high = 1000000000

mode = 1
a1 = 0
a2 = 0
while(True):
    p1 = math.floor((abs(low) + abs(high))/3) + low
    p2 = high - math.floor((abs(low) + abs(high))/3) 

    for j in range(1,int(N)+1):
        a1 += abs(AList[j-1] -(p1 + j))
    for j in range(1,int(N)+1):
        a2 += abs(AList[j-1] -(p2 + j))

    if a1 == a2 or abs(a1-a2) == 1:
        print(min(a1,a2))
        sys.exit()
    elif a1 < a2:
        high = p2
    else:
        low = p1        
    a1 = 0
    a2 = 0

Submission status: Runtime Error

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

A_sorted = sorted([A[i] - (i+1) for i in range(N)])
b = A_sorted[int((len(A)-1)/2)]
b2 = A_sorted[int((len(A)-1)/2 + 1)]

sad_1 = sum([abs(A_sorted[i] - b) for i in range(N)])
sad_2 = sum([abs(A_sorted[i] - b2) for i in range(N)])

print(min(sad_1, sad_2))

Submission status: Runtime Error

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

# res = 0
# for i in range(N):
#     res += A[i] - (i+1)
# b = res // N
# print(res, b)
A_sorted = sorted([A[i] - (i+1) for i in range(N)])
b = A_sorted[int((len(A)-1)/2)]
b2 = A_sorted[int((len(A)-1)/2 + 1)]

print(A_sorted, b, b2)
sad_1 = sum([abs(A_sorted[i] - b) for i in range(N)])
sad_2 = sum([abs(A_sorted[i] - b2) for i in range(N)])

print(min(sad_1, sad_2))

Submission status: Runtime Error

Solution code:
# C - Linear Approximation
# https://beta.atcoder.jp/contests/abc102/tasks/arc100_a

# C_Linear_Approximation.py

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)

# 中央値を取るのがみそ

Submission status: Runtime Error

Solution code:
# C - Linear Approximation
# https://beta.atcoder.jp/contests/abc102/tasks/arc100_a

# C_Linear_Approximation.py

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

Submission status: Runtime Error

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

# res = 0
# for i in range(N):
#     res += A[i] - (i+1)
# b = res // N
# print(res, b)
A_sorted = sorted(A)
b = A_sorted[int((len(A)-1)/2)]
b2 = A_sorted[int((len(A)-1)/2 + 1)]

sadness_1 = sum([abs(A[i] - b) for i in range(N)])
sadness_2 = sum([abs(A[i] - b2) for i in range(N)])

print(min(sadness_1, sadness_2))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
from statistics import median
N = int(input())
A = list(map(lambda x:int(x),input().split(" ")))
npA = np.array(A)
B = npA-(1+np.arange(len(npA)))
opt_b = median(B)
print(int(np.sum(np.abs(B-opt_b))))

Submission status: Runtime Error

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

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

b = int(statistics.median(A))
sad = 0
for i in A:
    sad += abs(i-b)
print(sad)

Submission status: Runtime Error

Solution code:
import copy

N = int(input())
An = list(map(int, input().split()))
for n in range(N):
    An[n] -= (n+1)

An.sort()

if (N % 2 == 0):
    cent = An[N//2 - 1] + An[N//2] // 2
else:
    cent = An[(N-1)//2]

ans = sum(An) - N * cent

print(ans)

Submission status: Runtime Error

Solution code:
import math

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

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

AA = [a - (i + 1) for i, a in enumerate(A)]

AA.sort()

if len(AA) % 2 == 0:
    b = int(len(AA) / 2 - 1)
else:
    b = int((len(AA) - 1) / 2)

sadness = 0
for i, a in enumerate(A):
    # sadness1 += abs(a - (i + b1 + 1))
    # sadness2 += abs(a - (i + b2 + 1))
    sadness += abs(a - (i + AA[b] + 1))

print(sadness)

Submission status: Runtime Error

Solution code:
N=input();print(N*(N%2+1))

Submission status: Runtime Error

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

a0=A[1:N-1]
a1n=A[0]
a2n=A[-1]
a1=A[0]
a2=A[-1]
while True:
    if a0==[]:break
    if a1n<a2n:
        a1n+=a0[0]
        a1.append(a0[0])
        a0.pop(0)
    else:
        a2n+=a0[-1]
        a2.insert(0,a0[0])
        a0.pop(-1)
        
a3n=a1[0]
a4n=a1[-1]
while True:
    if a1==[]:break
    elif a3n<a4n:
        a3n+=a1[0]
        a1.pop(0)
    else:
        a4n+=a1[-1]
        a1.pop(-1)
        
a5n=a2[0]
a6n=a2[-1]
while True:
    if a2==[]:break
    elif a5n<a6n:
        a5n+=a2[0]
        a2.pop(0)
    else:
        a6n+=a2[-1]
        a2.pop(-1)
        
num=[sum(a3),sum(a4),sum(a5),sum(a6)]
print(max(num)-min(num))

Submission status: Runtime Error

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

N = int(N)
aryA = [int(s) for s in aryA]
n = len(aryA)

tot = []
totlist = []
b = N

for m in range(b):
    for x in range(n):
        tot.append(abs(aryA[x] - (m + x + 1)))
    totlist.append(sum(tot))

print(min(totlist))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def main():
	N = input()
	while i % 2 == 0:
      i = N / 2
	print(i*2)

if __name__ == '__main__':
	main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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)
else:
    N, A, a, b, s = FUCK

Submission status: Runtime Error

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

if N%2 == 0:
    k = (N+1)*N//2
else:
    k = (N+1)*(N//2)+(N+1)//2

Sum_A = sum(A)    
b = (sum_A-k)//N

print(sum_A-(b*N+k))

Submission status: Runtime Error

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

if n==1:
    print(0)
    sys.exit()

def abs(a):
    if a<0:
        return -a
    else:
        return a

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

ans=10**12
a.sort()
if n<20:
    for b in a:
        S=0
        for j in range(n):
            S+=abs(a[j]-b)
        ans=min(ans,S)
    if ans==10**12:
        ans=0
    print(ans)
    sys.exit()

mid=n//2
if a[mid]<0:
    b_choice=a[mid-20:mid]
else:
    b_choice=a[mid:mid+20]
for b in b_choice:
    S=0
    for j in range(n):
        S+=abs(a[j]-b)
    ans=min(ans,S)
if ans==10**12:
    ans=0
print(ans)

Submission status: Runtime Error

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

if n==1:
    print(0)
    sys.exit()

def abs(a):
    if a<0:
        return -a
    else:
        return a

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

ans=10**12
a.sort()
if n<50:
    for b in a:
        S=0
        for j in range(n):
            S+=abs(a[j]-b)
        ans=min(ans,S)
    if ans==10**12:
        ans=0
    print(ans)
    sys.exit()

mid=n//2
if a[mid]<0:
    b_choice=a[mid-20:mid]
else:
    b_choice=a[mid:mid+20]
for b in range(b_choice):
    S=0
    for j in range(n):
        S+=abs(a[j]-b)
    ans=min(ans,S)
if ans==10**12:
    ans=0
print(ans)

Submission status: Runtime Error

Solution code:
import collections
N=int(input())
l=list(map(lambda x:int(x),input().split(' ')))
l=[l[i]-(i+1) for i in range(N)]
dl=collections.Counter(l)
ans=[0]*(len(dl)//2)
for i in range(len(dl)//2):
    k=dl.most_common()[i][0] 
    k*=-1
    ans[i]=sum([abs(l[j]+k) for j in range(N)])
print(min(ans))

Submission status: Runtime Error

Solution code:
def main():
	N = int(input())
	A = list(map(int, input().split()))
	s = sum(A)
	def ano_helper(BCDE):
		BCDE = BCDE + [s - sum(BCDE)]
		BCDE.sort()
		return abs(BCDE[-1] - BCDE[0])
	def helper(BCDEs, inds):
		if len(BCDEs[0]) == 4:
			return BCDEs
		ret_BCDEs = []
		ret_inds = []
		for candidate in range(len(BCDEs)):
			BCDE = BCDEs[candidate]
			ind = inds[candidate]
			ave = sum(A[ind:]) / (5 - len(BCDE))
			temp = 0
			while temp + A[ind] < ave:
				temp += A[ind]
				ind += 1
				if ind == N:
					break
			ret_BCDEs.append(BCDE + [temp])
			ret_inds.append(ind)
			if ind < N:
				ret_BCDEs.append(BCDE + [temp + A[ind]])
				ret_inds.append(ind + 1)
		return helper(ret_BCDEs, ret_inds)
	print(sorted([ano_helper(i[1:]) for i in helper([[0]], [0])])[0])
	return 0
	#BCDE = []
	#ind = 0
	#su = []
	#tempBCDE = [[]]
	#while len(BCDE[-1]) < 4:
	#	temp = 0
	#	ret = []
	#	while temp < (s - su) / (4 - len(BCDE)):
	#		te = A[ind]
	#		temp += te
	#		ret.append(te)
	#		su += te
	#		ind += 1
	#	tempBCDE.append(ret)
	#print(BCDE)
main()

Submission status: Runtime Error

Solution code:
def maxElem( lis ):
  L = lis[:]#copy
  S = set(lis)
  S = list(S)
  MaxCount=0
  ret='nothing...'

  for elem in S:
    c=0
    while elem in L:
      ind = L.index(elem)
      foo = L.pop(ind)
      c+=1
    if c>MaxCount:
      MaxCount=c
      ret = elem
  return ret

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

    for i in range(0, n):
        array[i] = array[i] - (i + 1)
    elem = int(maxElem(array))
    
    for i in range(0, n):
        array[i] = abs(array[i] - elem)

    sum_n = sum(array)

    print(sum_n)

Submission status: Runtime Error

Solution code:
#! /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()

Submission status: Runtime Error

Solution code:
size = int(input())
A = list(map(int,input().split()))
i = list(range(1,size+1))

remain_list = [A-i for(A,i) in zip(A,i)]
while(True):
    zero_count = len([i for i in remain_list if i ==0])
    minus_count = len([i for i in remain_list if i <0])
    plus_count = len([i for i in remain_list if i > 0])

    if zero_count == max(zero_count,minus_count,plus_count) or plus_count == minus_count:
        break

    if plus_count == max(zero_count,minus_count,plus_count):
        remain_list = [num - 1 for num in remain_list]

    if minus_count == max(zero_count,minus_count,plus_count):
        remain_list = [num + 1 for num in remain_list]


sum_list =[abs(num) for num in remain_list]

print(sum(sum_list))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
ck = 10000000000
for b in range(0,max(A)):
    k = 0
    for i in range(0,N):
        k = k + abs(A[i] - (b+i+1))
    if k < ck:
        ck = k
    elif k >= ck:
        print(ck)
        break

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())
import math
a=2
def lcm(a,n):
    return (a*n)//math.gcd(a,n)
print(lcm(a,n))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
l_abs = []
max_v = 0
for i, a_i in enumerate(a):
    if(max_v < a_i):
        max_v = a_i
    l_abs.append(abs((i+1)-a_i))

min = 10 ** 16
if sum(l_abs) == 0:
    min = 0
else:
    for b in range(-(max_v+1), max_v+1):
        sum = 0
        for j, a_j in enumerate(a):
            sum += abs(a_j-(b+j+1))
        if(min > sum):
            min = sum
print(min)

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:
import math
n = int(input())
print(( 2 * n ) // math.gcd(2, n))

Submission status: Runtime Error

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

sub_num = [0]*(2*10**6)

for i in range(1, n+1):
#    print(abs(int(a[i-1]-i)))
    sub_num[abs(int(a[i-1]-i))] += 1

b = -sub_num.index(max(sub_num))
#print(b)

result = 0
for i in range(1, n+1):
    result += abs(a[i-1] - (b + i))

print(result)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
print(( 2 * n ) //math.gcd(2, n))

Submission status: Runtime Error

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(abs(a-b))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
n = int(input())
print(( 2 * n ) //math.gcd(2, n))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
N = input()
N = int(N)
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(2, N))

Submission status: Runtime Error

Solution code:
from statistics import *



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

for i in range(n):
    list[i] = int(list[i]) - (i + 1)

b = int(median(list))

for i in range(n):
    list[i] = abs(list[i] - b)

print(sum(list))

Submission status: Runtime Error

Solution code:
import math
n = int(input())
ans = (n*2)//math.gcd(n,2)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

if N%2 == 0:
    print N
else:
    print N*2

Submission status: Runtime Error

Solution code:
n = int(input())
list = [int(i) for i in input().split()]

n_max = max(list)
n_min = min(list)

print(n_max - n_min)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
l=list(map(int, input().split()))
for i in range(n):
    l[i]-=(i+1)
avg=sum(l)/n
fb=math.floor(avg)
cb=math.ceil(avg)
sadf=sadc=0
for i in l:
    sadf+=abs(i-fb)
    sadc+=abs(i-cb)

sad=min(sadf, sadc)
print(sad)

Submission status: Runtime Error

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

a = int(input())
print(math.gcd(a, 2))

Submission status: Runtime Error

Solution code:
import math
n = int(input())
print(2 * n // math.gcd(2 , n))

Submission status: Runtime Error

Solution code:
def main():
	N = int(input())
	seq = list(map(int, input().split()))
	seq = [seq[i] - i - 1 for i in range(N)]
	def helper(b):
		return sum([abs(seq[i] - b) for i in range(N)])
	ave = sum(seq) // N
	print(min(helper(ave), helper(ave + 1)))
	return 0
main()

Submission status: Runtime Error

Solution code:
N = int(raw_input())
if N %= 2 == 0:
  print N
else:
  print N * 2

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print(int((2 * N) // math.gcd(2, N)))

Submission status: Runtime Error

Solution code:
import math

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

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print(int(2 * N /math.gcd(2, N)))

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print(int(2 * N / (math.gcd(2, N)) ))

Submission status: Runtime Error

Solution code:
def main():
	N = int(input())
	seq = list(map(int, input().split()))
	maks = 0
	for i in range(0, N):
		for j in range(i, N):
			maks = max(abs(seq[j] - seq[i]), maks)
	print(maks)
	return 0
main()

Submission status: Runtime Error

Solution code:
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
N = int(input())
print(lcm(2,N))

Submission status: Runtime Error

Solution code:
import math
N = int(input())
print(int(2 * N / math.gcd(2, N)))

Submission status: Runtime Error

Solution code:
#coding:utf-8
import math
a = int(input())

gcd = math.gcd
g = gcd(a,2)
l = a * 2 // g
print(l)

Submission status: Runtime Error

Solution code:
 = int(input())
  2 
  3 if n % 2 == 0:
  4     print(n)
  5 else:
  6     print(n*2)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().strip().split()))
min_n = max_n = A[0]
for i in range(1, N):
	num = A[i]
	if min_n > num:
		min_n = num
	if max_n < num:
		max_n = num
result = max_n - min_n
print(result)

Submission status: Runtime Error

Solution code:
def run(n):
    if n % 2 == 0:
        return n
    else:
        return n * 2


def read_line():
    n = map(int, input().split())
    return n


def main():
    n = read_line()
    print(run(n))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
from math import gcd, gcd
n = int(input())
print(2*n // gcd(2,n))

Submission status: Runtime Error

Solution code:
import math
n=int(input())
g=math.gcd(2,n)
print((n*2)//g)

Submission status: Runtime Error

Solution code:
import math
n = int(input())

print((2*n)//math.gcd(2,n))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n = input()
i = 2
while True:
  if i%2==0 and i%n==0:
    print(i)
    break
  i +=1

Submission status: Runtime Error

Solution code:
import numpy as np
if (type(N/2)==int)
	print (N)
else
	peint (2*N)

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:
x = input()
if x % 2 == 0:
	print(x)
else:
	print(x*2)

Submission status: Runtime Error

Solution code:
import numpy as np
N=int(input())
def gcd(N,2):
  c=int(np.floor(N%2))
  return N-2*c
if gcd(N,2)==0:
  print(N)
else:
  print(2*N)

Submission status: Runtime Error

Solution code:
a = int(input())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math

N = int(input())

print(2 * N // math.gcd(N, 2))

Submission status: Runtime Error

Solution code:
N=int(input())

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

Submission status: Runtime Error

Solution code:
n = input()

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

Submission status: Runtime Error

Solution code:
if a % 2 == 0:
    b = a
else:
    b = 2*a
print(b)

Submission status: Runtime Error

Solution code:
n = int(input())
if n&1:
    print(2*n)
else
    print(n)