Harryxun/stf_run huggingface dataset:
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

kouho = set()
done = set()


def f(t):
    x, y, z = t
    return A[x] + B[y] + C[z]


def main():
    kouho.add([f(0, 0, 0), (0, 0, 0)])

    for k in range(K):
        d = max(kouho)
        kouho.remove(d)

        x, y, z = d[1]
        toadd = [(x, y, z+1), (x, y+1, z), (x+1, y, z)]
        for ta in toadd:
            if ta[0] == X:
                continue
            if ta[1] == Y:
                continue
            if ta[2] == Z:
                continue
            kouho.add([f(ta), ta])

        print(d[0])


if __name__ == '__main__':
    main()


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

kouho = set()
done = set()


def f(t):
    x, y, z = t
    if x >= X or y >= Y or z >= Z:
        return 0
    return A[x] + B[y] + C[z]


def main():
    start = (f((0, 0, 0)), (0, 0, 0))
    kouho.add(start)
    done.add(start)

    for k in range(K):
        d = max(kouho)
        kouho.remove(d)

        x, y, z = d[1]
        toadd = [(x, y, z+1), (x, y+1, z), (x+1, y, z)]
        for ta in toadd:
            t = (f(ta), ta)
            if t in done:
                continue
            kouho.add(t)
            done.add(t)

        print(d[0])


if __name__ == '__main__':
    main()
print(N**3)

### FIXED CODE ###

N=int(input())
print(N**3)
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i, memo={}):
    if i == 0, 1:
        memo[i]=1
        return memo[i]
    else:
        if i in memo.keys():
            return memo[i]
        else:
            memo[i] = fibo(i-1, memo) + fibo(i-2, memo)
            return memo[i]
m = a[0] + 1
num = fibo(m - 2)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    num = num * fibo(m - 2)
    if m == 1:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1)
print(num % 1000000007)


### FIXED CODE ###

N, M = map(int, input().split())
kaidan = [0] * (N + 1)
for i in range(M):
    tmp = int(input())
    kaidan[tmp] = -1
kaidan[0] = 1
for i in range(1,N + 1):
    if i == 1:
        if kaidan[i] != -1:
            kaidan[i] = 1
        else:
            kaidan[i] = 0
    else:
        if kaidan[i] != -1:
            kaidan[i] = kaidan[i -1] + kaidan[i - 2]
        else:
            kaidan[i] = 0
print(kaidan[N] % (10 ** 9 + 7))
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
res = 1
check = 10**18
if 0 in a:
    print(0)
else:
    for i in range(n):
        res *= a[i]
        if res > check:
            res = -1
            break
    print(res)

### FIXED CODE ###

a, b = map(int, input().split())
print(a * b)
n,d = map(int,input().split())
x = [list(map(int,input().split())) for a in range(n)]
c = 0
 
for i in range(n-1):
  for j in range(i+1,n):
    b = 0
    for m in range(d):
      b += (x[i][m]-x[j][m])**2
    if (b**0.5)　== float(int(b**0.5)):
      c += 1
      
print(c)

### FIXED CODE ###

n,d = map(int,input().split())
w = [list(map(int,input().split())) for a in range(n)]
c = 0
 
for i in range(n-1):
  for j in range(i+1,n):
    b = 0
    for m in range(d):
      b += (w[i][m]-w[j][m])**2
    if (b**0.5)==float(int(b**0.5)):
      c += 1
      
print(c)
L, R = map(int, input().split())

if R - L >= 2019:
    print(0)
else:
    mod_l = L%2019
    mod_r = R%2019
    ans = 2019
    for i in range(mod_l, mod_r):
        for j in range(i+1, mod_r+1):
            if (i * j)%2019 == 0:
                ans = 0
                break
            ans = min(ans, (i * j)%2019)
        else:
            continue
        break
print(ans)

### FIXED CODE ###

L, R = map(int, input().split())

if R - L >= 2019:
    print(0)
else:
    mod_l = L%2019
    mod_r = R%2019
    ans = 2019
    for i in range(mod_l, mod_r):
        for j in range(i+1, mod_r+1):
            if (i * j)%2019 == 0:
                ans = 0
                break
            ans = min(ans, (i * j)%2019)
        else:
            continue
        break
    print(ans)
n,h = map(int,input().split())
x = []
for i in range(n):
	x.append(list(map(int,input().split())))

t = 0
c = []#強い投げ刀たち
M = max(x[i][0] for i in range(n))

for i in range(n):
	if x[i][1]>max(M)-1:
		c.append(x[i][1])
c.sort()
c.reverse()

if sum(c)>h-1:
	for i in range(len(c)):
		t += 1
		h -= c[i]
		if h<1:
			print(t)
			break
else:
	h -=sum(c)
	q = (h-1)//max(M)+1
	print(q+len(c))

### FIXED CODE ###

n,h = map(int,input().split())
x = []
for i in range(n):
	x.append(list(map(int,input().split())))

t = 0
c = []#強い投げ刀たち
M = max(x[i][0] for i in range(n))

for i in range(n):
	if x[i][1]>M-1:
		c.append(x[i][1])
c.sort()
c.reverse()

if sum(c)>h-1:
	for i in range(len(c)):
		t += 1
		h -= c[i]
		if h<1:
			print(t)
			break
else:
	h -=sum(c)
	q = (h-1)//M+1
	print(q+len(c))
#!/usr/bin/env python
import math

def count_antidivision(n, x, y):
    """
    returns count of numbers from 1 to n which are not dividable by x nor y.
    """
    return n - n // x - n // y + n // (x * y // math.gcd(x, y))    

def main(A, B, C, D):
    return count_antidivision(B, C, D) - count_antidivision(A-1, C, D)

if __name__ == '__main__':
    A, B, C, D = list(map(int, input().split()))
    print(main(A, B, C, D))

### FIXED CODE ###

#!/usr/bin/env python
import fractions

def count_antidivision(n, x, y):
    """
    returns count of numbers from 1 to n which are not dividable by x nor y.
    """
    return n - n // x - n // y + n // (x * y // fractions.gcd(x, y))    

def main(A, B, C, D):
    return count_antidivision(B, C, D) - count_antidivision(A-1, C, D)

if __name__ == '__main__':
    A, B, C, D = list(map(int, input().split()))
    print(main(A, B, C, D))
inpl = lambda: list(map(int,input().split()))

def output(plus,minus):
    print(sum(plus)-sum(minus))
    p = plus[0]
    for z in minus[1:]:
        print(p,z)
        p -= z
    q = minus[0]
    for w in plus[1:]:
        print(q,w)
        q -= w
    print(p,q)

N = int(input())
A = inpl()
plus = list(filter(lambda x: x>0, A))
minus = list(filter(lambda x: x<0, A))
Np = len(plus)
Nm = len(minus)
Nz = N-Np-Nm

if Np == N:
    plus.sort(reverse=True)
    minus = [plus.pop()]
elif Nm == N:
    minus.sort()
    plus = [minus.pop()]
else:
    if Nm == 0:
        minus = [0]*Nz
    else:
        plus.extend([0]*Nz)

output(plus,minus)

### FIXED CODE ###

inpl = lambda: list(map(int,input().split()))

def output(plus,minus):
    print(sum(plus)-sum(minus))
    p = plus[0]
    for z in minus[1:]:
        print(p,z)
        p -= z
    q = minus[0]
    for w in plus[1:]:
        print(q,w)
        q -= w
    print(p,q)

N = int(input())
A = inpl()
plus = list(filter(lambda x: x>0, A))
minus = list(filter(lambda x: x<0, A))
Np = len(plus)
Nm = len(minus)
Nz = N-Np-Nm

if Np == N:
    plus.sort(reverse=True)
    minus = [plus.pop()]
elif Nm == N:
    minus.sort()
    plus = [minus.pop()]
elif Nz == N:
    plus = [0]*(Nz-1)
    minus = [0]
else:
    if Nm == 0:
        minus = [0]*Nz
    else:
        plus.extend([0]*Nz)

output(plus,minus)
num = input().split()
if num[0] == num[1] and num[1] == num[2]:
    print("Yes")
elif num[1] == num[2] and num[2] == num[3]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

num = [int(x) for x in list(input())]

if num[0] == num[1] and num[1] == num[2]:
    print("Yes")
elif num[1] == num[2] and num[2] == num[3]:
    print("Yes")
else:
    print("No")
a=input()
p1=a[0]
p2=a[1]
p3=a[3]
 
if p1==p2==p3:
	print("No")
else:
	print("Yes")

### FIXED CODE ###

a=input()
p1=a[-1]
p2=a[0]
p3=a[1]
 
if p1==p2==p3:
  print("No")
else:
  print("Yes")
import math
2.import re
3.import copy

wake_up_hour,wake_up_minute,sleep_hour,sleep_minute,study_time = map(int, input().split())

print(wake_up_hour, wake_up_minute, sleep_hour, sleep_minute, study_time)
Total_Minutes = (sleep_hour) *60 + (sleep_minute) - ((wake_up_hour) * 60 + (wake_up_minute))

print(Total_Minutes)

if Total_Minutes > study_time:
    print("You can finish the study")
    start_before_minute= ((sleep_hour*60 +  sleep_minute) - study_time) % 60
    start_before_hour= ((sleep_hour*60 +  sleep_minute) - study_time) // 60 
    print("Start before: ", start_before_hour, start_before_minute, )
else:
    print("You are lazy!!!. wake up early")

### FIXED CODE ###

import math
import re
import copy

h1,m1,h2,m2,k = map(int,input().split())
w1 = h1*60 + m1
w2 = h2 * 60 + m2
w3 = (w2-w1+24*60)%(24*60)
w3 = w3 - k
print(w3)
s=input()
n=len(s)
set=set(s)
m=len(set)
a=s.count('a')
b=s.count('b')
c=s.count('c')
if m==1:
  if n==1:
    print('YES')
  else:
    print('NO')
elif m==2:
  if (a==b or b==a+1 or a=b+1) or (c==b or b==c+1 or c=b+1) or (a==c or c==a+1 or a=c+1):
    print('YES')
  else:
    print('NO')
else:
  d=n//m
  res=0
  if a<=d:
    res+=1
  if b<=d:
    res+=1
  if c<=d:
    res+=1
  if res>=d:
    print('YES')
  else:
    print('NO')

### FIXED CODE ###

s=input()
n=len(s)
set=set(s)
m=len(set)
a=s.count('a')
b=s.count('b')
c=s.count('c')
if m==1:
  if n==1:
    print('YES')
  else:
    print('NO')
elif m==2:
  if n==2:
    print('YES')
  else:
    print('NO')
else:
  if n%3==0:
    if a==b==c:
      print('YES')
    else:
      print('NO')
  elif n%3==2:
    if (a==n//3+1 and b==n//3+1) or (c==n//3+1 and b==n//3+1) or (a==n//3+1 and c==n//3+1):
      print('YES')
    else:
      print('NO')
  else:
    if (a==n//3 and b==n//3) or (c==n//3 and b==n//3) or (a==n//3 and c==n//3):
      print('YES')
    else:
      print('NO')
import numpy as np


A, B, K = map(int, input().split())
x, y, z = [], [], []
x = np.arange(A, B+1)
y = x[:K]
z = x[-K:]
ans = np.concatenate([y,z])
ans = sorted(set(ans))
for i in ans:
    print(i)

### FIXED CODE ###

A, B, K = map(int, input().split())
x1 = set(range(A, A+K))
x2 = set(range(B, B-K, -1))
x = x1 | x2
ans = sorted(x)
for i in [x for x in ans if A <= x <= B]:
    print(i)
import sys
A,B= (int(i) for i in input().split(" "))  

if A=<5:
    print(0)
elif A=<12:
    print(int(B/2))
else:
    print(B)

### FIXED CODE ###

import sys
A,B= (int(i) for i in input().split(" "))  

if A<=5:
    print(0)
elif A<=12:
    print(int(B/2))
else:
    print(B)
n,k=map(int,input().split())
l=0
if n>=k:
    for i in range(1,k):
        if math.log2(k/i)==n:l+=(1-(0.5**n))/n
        else: l+= (1-(0.5**((math.log2(k/i)//1) +1)))/n
    print(1-l)
else:
    for i in range(1,n+1):
        if math.log2(k/i)==n:l+=(0.5**n)/n
        else: l+= (0.5**((math.log2(k/i)//1) +1))/n
    print(l)

### FIXED CODE ###

import math
n,k=map(int,input().split())
s=0
for i in range(1,n+1):
    if i<k:
        s+=0.5**(-(-math.log(k/i,2)//1))
    else:
        s+=1
print(s/n)
def main():
    global tree, que, answer

    N, m = list(map(int, input().split()))
    tree = {i+1 : set() for i in range(N)}

    for _ in range(m):
        i, j = list(map(int, input().split()))
        tree[i].add(j)
        tree[j].add(i)

    if m % 2 == 1:
        print('-1')
        return

    print(*answer, sep="\n")


if __name__ == "__main__":
    tmp = set()
    que = []
    answer = []
    main()


### FIXED CODE ###

def main():
    N = int(input())
    V = list(map(int, input().split()))

    n = 0
    for i in V:
        n = i ^ n
    if n == 0:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()
n=input()
a=input().split()
print(("Three","Four")[len(set(a))==4]

### FIXED CODE ###

n=input()
a=input().split()
print(("Three","Four")[len(set(a))==4])
input()
A = [i for i in input().split()]
A.reverse()
print(' '.join(A))a

### FIXED CODE ###

input()
A = [i for i in input().split()]
A.reverse()
print(' '.join(A))
import numpy as np
N,A,B = map(int,input().split())
S = input()
total = A+B
for i in range(N):
    if S[i]=='c':
        print('No')
    elif total>0:
        if S[i] == 'a':
            print('Yes')
            total = total-1
        elif S[i] =='b' and B>0:
            print('Yes')
            total = total-1
            B = B-1
        else:
            print('No')
    else:
        print('No')


### FIXED CODE ###


N,A,B = map(int,input().split())
S = input()
total = A+B
for i in range(N):
    if S[i]=='c':
        print('No')
    elif total>0:
        if S[i] == 'a':
            print('Yes')
            total = total-1
        elif S[i] =='b' and B>0:
            print('Yes')
            total = total-1
            B = B-1
        else:
            print('No')
    else:
        print('No')
size=int(input())
h = list(map(int,input().split()))
dp = 0
for i in range(0, size):
  	try:
    	if abs(h[i]-h[i+1]) < abs(h[i]-h[i+2]):
			dp += abs(h[i]-h[i+1])
  		else:
      		dp += abs(h[i]-h[i+2])
  	except:
    	pass
print(dp)

### FIXED CODE ###

size=int(input())
h = list(map(int,input().split()))
dp = [0 for _ in range(size)]
for i in range(1,size):
    if i == 1:
        dp[i] = dp[0]+abs(h[0]-h[1])
    else:
        a = dp[i-2]+abs(h[i-2]-h[i])
        b = dp[i-1]+abs(h[i-1]-h[i])
        if a < b:
            dp[i] = a
        else:
            dp[i] = b
print(dp[-1])
#入力
##1*1行列
import itertools
N=int(input())#1*1の整数を格納
P=[int(i) for i in input().split()]

itertools.accumulate(P, min)

mi=10000000
x=[0]*N
for i in range(N):
    if mi>P[i]:
        x[i]=1
        mi=P[i]
print(sum(x))

### FIXED CODE ###

N=int(input())
P=list(map(int,input().split()))
MIN=10**9#Nの制約よりも十分に大きい数
ans=0
for i in range(N):
    if P[i]<=MIN:
        ans+=1
        MIN=P[i]#累積最小値で左から順に値を更新していく
print(ans)
N, M, X, Y = map(int, input().split())
L_X = [int(i) for i in input().split()]
L_Y = [int(i) for i in input().split()]

S = set(L_X, )
S.add(L_Y, )
if X in S or Y in S:
    print("War")
elif max(L_X) < min(L_Y) and X < min(L_Y) and max(L_X) < Y:
    print("No War")
else:
    print("War")


### FIXED CODE ###

N, M, X, Y = map(int, input().split())
L_X = [int(i) for i in input().split()]
L_Y = [int(i) for i in input().split()]

if max(L_X) < min(L_Y) and X < min(L_Y) and max(L_X) < Y:
    print("No War")
else:
    print("War")
A=[int(i) for i in input()]
def Five(A):
	for i in range(len(A)-2):
  		if A[i+1]-A[i] > A[-1]:
    		return print(":(")
	return print("Yay!")
Five(A)

### FIXED CODE ###

A=[int(input()) for i in range(6)]
def Five(A):
    if A[-2]-A[0] > A[-1]:
        return print(":(")
    return print("Yay!")
Five(A)
a,b=map(int,input().split())
k=int(input())
for i in range (k):
  if a > 0:
    a-1
  elif:
  	if b > 0:
      b-1
print(a, b)

### FIXED CODE ###

a,b,k=map(int,input().split())
if a-k>=0:
    print(a-k,b)
elif a+b>=k:
    print(0,a+b-k)
else:
    print(0,0)
n=int(input())
h = list(map(int,input().split()))
li=[]
ans=0
for i in range(n):
  for j in range(n):   
    while h[i] > h[i+1]:
      ans+=1
    li.append(ans)
    ans=0
print(max(li))

### FIXED CODE ###

from itertools import groupby
n=int(input())
h = list(map(int,input().split()))
p=[]
ans=[0]
for i in range(n-1):
  if h[i] >= h[i+1]:
    p.append(1)
  else:
    p.append(0)
for key, value in groupby(p):
  ans.append(sum(value))
print(max(ans))
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


def main():
    n = int(input())
    ans = [0]*(10**4)
    h = 0

    for i in range(1,51):
        for j in range(1,51):
            for m in range(1,51):
                h = i*(i+j) + j*(j+m) + m*(m+i)
                if h >= len(ans):
                    break
                ans[h] += 1

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

if __name__ == '__main__':
	main()


### FIXED CODE ###

import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


def main():
    n = int(input())
    ans = [0]*(10**4+1)
    h = 0

    for i in range(1,99):
        for j in range(1,99):
            for m in range(1,99):
                h = i**2 + j**2 + m**2 + i*j + j*m + m*i
                if h >= (10**4)+1:
                    break
                ans[h] += 1

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

if __name__ == '__main__':
	main()
K, S = map(int,input().split())

cnt = 0
for i in range(K+1):
    for j in range(K+1):
        if 0 <= S - i - j <= k:
            cnt +=1
print(cnt)

### FIXED CODE ###

K, S = map(int,input().split())

cnt = 0
for i in range(K+1):
    for j in range(K+1):
        if 0 <= S - i - j <= K:
            cnt +=1
print(cnt)
n = int(raw_input())

G = [0 for i in range(n)] 
a = [[0 for i in range(n)] for j in range(n)]
dis = [-1 for i in range(n)]

for i in range(n):
    G = map(int, raw_input().split())
    for j in range(G[1]):
        a[G[0]-1][G[2+j]-1] = 1

def bfs_visit(s):
    for k in range(n):
      if a[s][k] == 1 and dis[k] == -1:
         dis[k] = dis[s] + 1
         bfs_visit(k)

for s in range(s):
    bfs_visit()
for s in range(s):
    print (s+1,dis[s])


 
 

    
    
   

          

### FIXED CODE ###

n = int(raw_input())
   
dis = [99999 for i in range(n)]
G = [0 for i in range(n)]
v = [[0 for i in range(n)] for j in range(n)]
   
def BFS(s):
  for e in range(n):
    if v[s][e] == 1:
      if dis[e] > dis[s] + 1:
        dis[e] = dis[s]+1
        BFS(e)
   
for i in range(n):
  G = map(int, raw_input().split())
  for j in range(G[1]):
    v[G[0]-1][G[2+j]-1] = 1
   
dis[0] = 0
for s in range(n):
  BFS(s)
for s in range(n):
  if dis[s] == 99999:
    dis[s] = -1
for s in range(n):
  print'{0} {1}'.format(s+1, dis[s])
from functools import reduce

def gcd(a, b):
    if a < b:
        a, b = b, a
        while b != 0:
            a, b = b, b % a
        return a

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

print(reduce(gcd, a))



### FIXED CODE ###

from functools import reduce

def gcd(a, b):
    if a < b:
        a, b = b, a
    while b != 0:
        a, b = b, a % b
    return a

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

print(reduce(gcd, a))
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    l = 29
    val = 0
    from bisect import bisect_left as bll, bisect_right as brr
    def bl(bb, ind):
        if ind in dl:
            return dl[inte]
        else:
            tt = bll(bb, ind)
            dl[ind] = tt
            return tt
    def br(bb, ind):
        if ind in dr:
            return dr[inte]
        else:
            tt = brr(bb, ind)
            dr[ind] = tt
            return tt  

    for k in range(l):
        # i桁目を求める
        tmp = pow(2, k+1)
        bb = [item%(tmp) for item in b]
        bb.sort()
        ans = 0
        dl = {}
        dr = {}
        for item in a:
            aa = item%tmp
            if aa<=tmp//2:
                ans += (br(bb, tmp-1-aa) - bl(bb, tmp//2-aa))%2
            else:
                ans += (br(bb, tmp-1-aa) + (n - bl(bb, tmp//2*3-aa)))%2
        if ans%2:
            val += pow(2, k)
    print(val)
main()

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = 29
val = 0

def lcount(a,b,x):
    """ソート済a,bに対して, a[i]+b[j]<=xなるi,jの個数
    """
    la = len(a)
    lb = len(b)
    j = -1
    ans = 0
    for i in range(la-1, -1, -1):
        while j+1<lb and a[i]+b[j+1]<=x:
            j += 1
        ans += (j+1)
    return ans
for k in range(l):
    # i桁目を求める
    tmp = pow(2, k+1)
    bb = [item%(tmp) for item in b]
    aa = [item%(tmp) for item in a]
    aa.sort()
    bb.sort()
    ans = n**2 - lcount(aa,bb,tmp//2*3-1) + lcount(aa,bb,tmp-1) - lcount(aa,bb,tmp//2-1)
    if ans%2:
        val += pow(2, k)
print(val)
n = int(input())
aList = list(map(int, input().split()))
t = [0 for i in range(20001)]
for a in aList:
    t[a] += 1
for i in range(1, n+1):
    print(t[i])

### FIXED CODE ###

n = int(input())
aList = list(map(int, input().split()))
t = [0 for i in range(200001)]
for a in aList:
    t[a] += 1
for i in range(1, n+1):
    print(t[i])
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a[i] -= i+1
b = sorted(a)
center1 = b[n//2+1]
center2 = 0
if not n == 1:
    center2 = b[n//2]
buf1 = 0
buf2 = 0
for i in range(n):
    buf1 += abs(b[i]-center1)
    buf2 += abs(b[i]-center2)
print(int(min(buf1, buf2)))


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a[i] -= i+1
b = sorted(a)
center1 = b[n//2]
center2 = 0
if not n == 1:
    center2 = b[n//2+1]
buf1 = 0
buf2 = 0
for i in range(n):
    buf1 += abs(b[i]-center1)
    buf2 += abs(b[i]-center2)
print(int(min(buf1, buf2)))
import numpy as np
N = int(input())
a = np.array( list(map(float, input().split(" "))) )
b = np.array( list(map(float, input().split(" "))) )
c = np.array( list(map(float, input().split(" "))) )

# sort(a)
# sort(b)
# sort(c)

mem_a = np.zeros(10**5) - 1

dict_c = {}
def count_c(v):
    key = v
    if v in dict_c:
        return dict_c[v]
    else:
        val = len(np.where( (v < c) == True )[0])
        dict_c.update({key:val})
        return val

num = 0
for i in range(N):
    n = len(np.where( (a[i] < b) == True )[0])
    if mem_a[n] == -1:
        mem_a[n] = 0
        for j in range(N):
            mem_a[n] += count_c(b[j])
    num += mem_a[n]
print(num)

### FIXED CODE ###

N = int(input())
a = list(map(float, input().split(" ")))
b = list(map(float, input().split(" ")))
c = list(map(float, input().split(" ")))

a.sort()
c.sort()


def bisect_left(a, x, lo=0, hi=None):
    """Return the index where to insert item x in list a, assuming a is sorted.
    The return value i is such that all e in a[:i] have e < x, and all e in
    a[i:] have e >= x.  So if x already appears in the list, a.insert(x) will
    insert just before the leftmost x already there.
    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    """

    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if a[mid] < x: lo = mid+1
        else: hi = mid
    return lo

def bisect_right(a, x, lo=0, hi=None):
    """Return the index where to insert item x in list a, assuming a is sorted.
    The return value i is such that all e in a[:i] have e <= x, and all e in
    a[i:] have e > x.  So if x already appears in the list, a.insert(x) will
    insert just after the rightmost x already there.
    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    """

    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if x < a[mid]: hi = mid
        else: lo = mid+1
    return lo

num = 0
for i in range(N):
    num += (bisect_left(a, b[i])) * (len(c) - bisect_right(c, b[i]))
print(num)
alfa=input()
N=int(alfa[0])
X=int(alfa[2])
#L=[int(input().split()) for i in range(N)]
L=input().split()


#print(N,X,L)
D=0
count=1
for i in range(N):
    D+=int(L[i])
    if D>X:
        print(count)
        break
    else:
        count+=1


### FIXED CODE ###

alfa=input().split()
N=int(alfa[0])
X=int(alfa[1])
#L=[int(input().split()) for i in range(N)]
L=input().split()

#print(N,X,L)
D=0
count=1
for i in range(N):
    D+=int(L[i])
    if D>X:
        print(count)
        break
    else:
        count+=1

if D<=X:
    print(count)
n = int(input())
list = [i for i in input().split()].reverse()
print(" ".join(list))

### FIXED CODE ###

n = int(input())
list = [i for i in input().split()]
list.reverse()
print(" ".join(list))