Harryxun/stf_run huggingface dataset:
lr = input().split()
l = int(lr[0])
r = int(lr[1])

mini = 2020
for i in range(l, r+1):
  j = i+1
  while j>i and j<=r:
    q = (i*j)%2019
    j = j + (2018-q)//i
    mini = min(mini, q)
    
print(mini)


### FIXED CODE ###

lr = input().split()
l = int(lr[0])
r = int(lr[1])

mini = 2018

for i in range(l, r+1):
  for j in range(i+1, r+1):
    mini = min(mini, (i*j)%2019)

    if mini==0:
      break
  if mini==0:
    break
print(mini)
h,w=map(int,input().split())
x=[]
for i in range(h):
    x.append(list(input()))
#print(x)
c=0
for i in range(h):
    for j in range(w):
        if x[i][j]==".":
            c+=1
dp=[[10000000000 for i in range(w)]for j in range(h)]
dp[0][0]=1

def go_next(I,J):
    global dp,w,h
    if I<h-1 and x[I+1][J]==".":
        if dp[I+1][J]>dp[I][J]+1:
            dp[I+1][J]=dp[I][J]+1
            go_next(I+1,J)
    if I>0 and x[I-1][J]==".":
        if dp[I-1][J]>dp[I][J]+1:
            dp[I-1][J]=dp[I][J]+1
            go_next(I-1,J)
    if J<w-1 and x[I][J+1]==".":
        if dp[I][J+1]>dp[I][J]+1:
            dp[I][J+1]=dp[I][J]+1
            go_next(I,J+1)
    if J>0 and x[I][J-1]==".":
        if dp[I][J-1]>dp[I][J]+1:
            dp[I][J-1]=dp[I][J]+1
            go_next(I,J-1)
go_next(0,0)
print(c-dp[h-1][w-1])


### FIXED CODE ###

#一個だけRE、わからねえ
#解答見る
import sys
sys.setrecursionlimit(1005)
h,w=map(int,input().split())

def go_next(I,J,n):
    n+=1
    global dp,w,h
    if n>1000:
        return
    if 0<=I<h-1:
        if x[I+1][J]=="." and dp[I+1][J]>dp[I][J]+1:
            dp[I+1][J]=dp[I][J]+1
            go_next(I+1,J,n)
    if 0<I<=h-1:
        if x[I-1][J]=="." and dp[I-1][J]>dp[I][J]+1:
            dp[I-1][J]=dp[I][J]+1
            go_next(I-1,J,n)
    if 0<=J<w-1:
        if x[I][J+1]=="." and dp[I][J+1]>dp[I][J]+1:
            dp[I][J+1]=dp[I][J]+1
            go_next(I,J+1,n)
    if 0<J<=w-1:
        if x[I][J-1]=="." and dp[I][J-1]>dp[I][J]+1:
            dp[I][J-1]=dp[I][J]+1
            go_next(I,J-1,n)

x=[]
for i in range(h):
    x.append(list(input()))
#print(x)
c=0
for i in range(h):
    for j in range(w):
        if x[i][j]==".":
            c+=1
dp=[[10000000000 for i in range(w)]for j in range(h)]
dp[0][0]=1
go_next(0,0,0)
if dp[h-1][w-1]==10000000000:
    print(-1)
else:
    print(c-dp[h-1][w-1])
import sys
import numpy as np
import bisect
readline = sys.stdin.buffer.readline
MOD = 10**9+7
INF = float('inf')

def main():
    H, W = map(int, readline().split())
    S = []
    for _ in range(H):
        s = list(input())
        S.append(s)
    R = [[0]*W for _ in range(H)]
    L = [[0]*W for _ in range(H)]
    U = [[0]*W for _ in range(H)]
    D = [[0]*W for _ in range(H)]
    for i in range(H):
        cnt = 0
        for j in range(W):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                L[i][j] = cnt
    for i in range(H):
        cnt = 0
        for j in range(W-1, -1, -1):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                R[i][j] = cnt
    for j in range(W):
        cnt = 0
        for i in range(H):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                U[i][j] = cnt
    for j in range(W):
        cnt = 0
        for i in range(H-1,-1,-1):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                D[i][j] = cnt
    ans = 0
    for i in range(H):
        for j in range(W):
            ans = max(ans, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    H, W = map(int, input().split())
    S = []
    for _ in range(H):
        s = list(input())
        S.append(s)
    R = [[0]*W for _ in range(H)]
    L = [[0]*W for _ in range(H)]
    U = [[0]*W for _ in range(H)]
    D = [[0]*W for _ in range(H)]
    for i in range(H):
        cnt = 0
        for j in range(W):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                L[i][j] = cnt
    for i in range(H):
        cnt = 0
        for j in range(W-1, -1, -1):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                R[i][j] = cnt
    for j in range(W):
        cnt = 0
        for i in range(H):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                U[i][j] = cnt
    for j in range(W):
        cnt = 0
        for i in range(H-1,-1,-1):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                D[i][j] = cnt
    ans = 0
    for i in range(H):
        for j in range(W):
            ans = max(ans, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
    print(ans)


if __name__ == '__main__':
    main()
s=input()
print(s[::2]

### FIXED CODE ###

print(input()[::2])
n, a, b = map(int, input().split())
total = 0
for i in range(1, n+1):
    x = sum([int(j) for j in str(i)])
        if a <= x <= b:
            total = total + x
print(total)

### FIXED CODE ###

n, a, b = map(int, input().split())
count = 0
for i in range(1, n+1):
    s = sum(int(x) for x in str(i))
    if a <= s <= b:
        count += i
print(count)
from sys import stdin
strings = list(stdin.readline().split())
print(string[1] + string[0])


### FIXED CODE ###

from sys import stdin
strings = list(stdin.readline().split())
print(strings[1] + strings[0])
N = int(input())
data = list(map(int,input().split()))
res = 0
exist_odd: bool = False
while exist_odd == False:
    for i in range(N):
        if data[i]%2 == 1:
            exist_odd = True
    
    if exist_odd == True:
            break
        
    for i in range(N):
        data[i] = data[i]//2
    
    res += 1
    
print(res)

### FIXED CODE ###

n = input()
a = list(map(int, input().split()))
cnt = 0
while all(i%2==0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)
i = int(input())
seen = set()
seen.add(i)
temp = i
for x in rannge(0,1000000):
  if(temp%2 == 0):
    temp = temp/2
  else:
    temp = 3temp+1
  if(temp in seen):
    print(x)
    break
  

### FIXED CODE ###

i = int(input())
seen = set()
seen.add(i)
temp = i
for x in range(2,1000000):
    if(temp%2 == 0):
        temp = temp/2
    else:
        temp = 3*temp+1
    if(temp in seen):
        print(x)
        break
    else:
        seen.add(temp)
n,m,x=map(int,input().split())
l=[0for i in range(n+1)]
for i in map(int,input().split()):
  l[i]=1
for i in range(1,n+1):
  l[i]+=l[i-1]
print(min(l[x],l[n])
    

### FIXED CODE ###

n,m,x=map(int,input().split())
l=[0for i in range(n+1)]
for i in map(int,input().split()):
  l[i]=1
for i in range(1,n+1):
  l[i]+=l[i-1]
print(min(l[x],l[n]-l[x]))
IsPrimes = [True] * 1000002
IsPimes[0], IsPimes[1] = False, False

for i in range(2, 1001):
    if IsPrime[i]:
        for j in range(i*i, 1000001, i)
            IsPrime[j]= False

cnt = [0] * 1000001

for i in range(1000001):
    if IsPimes[i]:
        cnt[i] += 1

for i in range(1, 1000001):
    cnt[i] += cnt[i-1]

while True:
    try:
        n = int(raw_input())
        print cnt[n]

    except EOFError:
        break


### FIXED CODE ###

era = [True]*1000001
for i in xrange(2,1000001):
        if era[i-2]:
                for j in xrange(i*2,1000001,i):
                        era[j-2]=False
while True:
        try:
                n = int(raw_input())
                print era[:n-1].count(True)
        except EOFError:
                break
def dist(a, b):
  res = 0
  for i in range(D):
    res += (a[i] - b[i]) ** 2
    res = res ** 0.5

N, D = map(int, input().split())
X = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N - 1):
  for j in range(i +1, N):
    if dist(X[i], X[j]).is_integer():
      ans += 1
print(ans)      

### FIXED CODE ###

def dist(a, b):
  res = 0
  for i in range(D):
    res += (a[i] - b[i]) ** 2
  res = res ** 0.5
  return res

N, D = map(int, input().split())
X = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N - 1):
  for j in range(i +1, N):
    if dist(X[i], X[j]).is_integer():
      ans += 1
print(ans)
S=int(input())
X1=0
Y1=0
if S==10**18:
  print(' '.join(['0', '0', '0', '1000000000', '1000000000', '0']))
else:
  X2=10**9
  Y2=1
  Y3=S//(10**9)+1
  X3=Y3*(10**9)-S

print(' '.join(map(str, [X1, Y1, X2, Y2, X3, Y3])))

### FIXED CODE ###

S=int(input())
X1=0
Y1=0
if S==10**18:
  print(' '.join(['0', '0', '0', '1000000000', '1000000000', '0']))
else:
  X2=10**9
  Y2=1
  Y3=S//(10**9)+1
  X3=Y3*(10**9)-S
  print(' '.join(map(str, [X1, Y1, X2, Y2, X3, Y3])))
n=map(int,raw_input().split())
x1, y1, x2, y2 = map(float, raw_input().split())
print ((x1-x2)**2 + (y1-y2)**2)**0.5


### FIXED CODE ###

import math
n = input()
x = map(float, raw_input().split())
y = map(float, raw_input().split())
d1 = 0.0
d2 = 0.0
d3 = 0.0
d4 = 0.0
for i in range(n):
    d1 += abs(x[i] - y[i])
    d2 += pow(abs(x[i] - y[i]),2)
    d3 += pow(abs(x[i] - y[i]),3)
    d4 = max(d4,abs(x[i] - y[i]))
d2 = math.sqrt(d2)
d3 = d3 ** (1.0 / 3.0)
print d1
print d2
print d3
print d4
def calculate(people_num, limit, height_array):
    permission = [height for height in height_array if height >= limit]
    return len(permission)

if __name__ == "__main__":
    input_data = '\n'.join(iter(raw_input, '')).split()
    people_num = input_data[0]
    limit= input_data[1]
    height_array = input_data[2:len(input_data)]
    result_num = calculate(people_num, limit, height_array)
    print(result_num)
    

### FIXED CODE ###

def calculate(people_num, limit, height_array):
    permission = [height for height in height_array if height >= limit]
    return len(permission)
 
if __name__ == "__main__":
    people_num, limit = map(int, input().split())
    height_array = map(int, input().split())
    result_num = calculate(people_num, limit, height_array)
    print(result_num)
import sys
text = ''
while True:
    s = input().lower()
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    #print(i+' : '+str(s.count(i)))
    sys.stdout.write("{0} : {1}\n".format(i, text.count(i)))

### FIXED CODE ###

text = ''
while True:
    try:
        s = input().lower()
    except EOFError:
        break
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    print(i+' : '+str(text.count(i)))
    #print("{0} : {1}".format(i, text.count(i)))
def search(x, num):
    for y in list(edge[x]):
        if y in nodes:
            nodes.remove(y)
            edge[y].discard(x)
            num = search(y, num)
    return num + 1


(n,m),*d  = [list(map(int, s.split())) for s in open(0)]

edge = [set() for _ in range(n+1)]
for x in d:
    edge[x[0]].add(x[1])
    edge[x[1]].add(x[0])

nodes = set(range(1,n+1))
ans = 1
for x in list(nodes):
    if x not in nodes:
        continue
    nodes.remove(x)
    tmp = search(x, 0)
    ans = max(tmp, ans)
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(int(1e6))

def search(x, num):
    nodes.remove(x)
#     for y in edge[x]:
#         edge[y].discard(x)
#     for y in list(edge[x]):
    for y in edge[x]:
        if y in nodes:
            num = search(y, num)
    return num + 1

(n,m),*d  = [list(map(int, s.split())) for s in open(0)]

edge = [set() for _ in range(n+1)]
for x in d:
    edge[x[0]].add(x[1])
    edge[x[1]].add(x[0])

nodes = set(range(1,n+1))
ans = 1
for x in list(nodes):
    if x in nodes:
        ans = max(ans, search(x, 0))
print(ans)
a=input().split('')
print(int(a[0])*int(a[1]), end=' ')
print(int(a[0])*2+int(a[1])*2)

### FIXED CODE ###

a=input().split()
print(int(a[0])*int(a[1]), end=' ')
print(int(a[0])*2+int(a[1])*2)
def main():
    N, Q = map(int, input().split())
    AB = [list(map(int,input().split())) for _ in range(N-1)]
    roots = {}
    for root,leaf in AB:
        roots[leaf] = root

    ans = [0 for _ in range(N+1)]
    for _ in range(Q):
        p,x = map(int, input().split())
        ans[p] += x
    # print(ans)
    for i in range(2,N+1):
        ans[i] += ans[roots[i]]
    print(*ans[1:])

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**6)
N, Q = map(int, input().split())
tree = [[] for _ in range(N)]
ans = [0] * N

def dfs(v, p):
    for u in tree[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)

def main():

    for _ in range(N-1):
        a, b = map(int,input().split())
        a -= 1
        b -= 1
        tree[a].append(b)
        tree[b].append(a)

    for _ in range(Q):
        p,x = map(int, input().split())
        ans[p-1] += x
    # print(ans)

    dfs(0, -1)
    print(*ans)

if __name__ == "__main__":
    main()
import sys
n=int(input())
S=[]
for i in range(n):
  s=list(input())
  S+=[s]
ANS=[]
if n==1:
  ANS=S[0]
  ANS.sort()
  ans="".join(ANS) 
  print(ans)
  sys.exit()
for k in range(len(S[0])):
  if S[0][k] in S[1]:
    ANS+=[S[0][k]]
    S[1].remove(S[0][k])
for i in ANS:
  flag=0
  rem=[]
  for k in range(2,n):
    if i in S[k]:
      S[k].remove(i)
    elif flag!=1:
      rem+=[i]
      flag=1
for i in rem:
  ANS.remove[i]
ANS.sort()      
ans="".join(ANS)  
print(ans)

### FIXED CODE ###

import sys
n=int(input())
S=[]
for i in range(n):
  s=list(input())
  S+=[s]
ANS=[]
if n==1:
  ANS=S[0]
  ANS.sort()
  ans="".join(ANS) 
  print(ans)
  sys.exit()
for k in range(len(S[0])):
  if S[0][k] in S[1]:
    ANS+=[S[0][k]]
    S[1].remove(S[0][k])
rem=[]
for i in ANS:
  flag=0
  for k in range(2,n):
    if i in S[k]:
      S[k].remove(i)
    elif flag!=1:
      rem+=[i]
      flag=1
for i in rem:
  ANS.remove(i)
ANS.sort()      
ans="".join(ANS)  
print(ans)
n=int(input())
ans=n
i=1
while(i<math.sqrt(n)):
    if n%i==0:
        d=i+n/i-2
        ans=min(ans,d)
    i+=1
print(int(ans))

### FIXED CODE ###

import math
n=int(input())
ans=n
i=1
while(i<=math.sqrt(n)):
    if n%i==0:
        d=i+n/i-2
        ans=min(ans,d)
    i+=1
print(int(ans))
4 2
1 2 -3 -4

### FIXED CODE ###

import numpy as np
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7
if N==K:
  ans0 = 1
  for a in A[0:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()
A=sorted(A)  
if (K%2==1 and A[-1]<0):
  ans1 = 1
  for a in A[N-K:N]:
    ans1 *= a
    ans1 %= MOD
  print(ans1)
  exit()
 
A=sorted(A, key=lambda x:abs(x), reverse=True)
AA=[np.sign(i) for i in A]
 
ansA = 1
for a in A[0:K]:
  ansA *= a
  ansA %= MOD
ansAA = AA[0:K].count(-1)%2
if ansA==0 or ansAA==0:
  print(ansA)
  exit()

while ansA>0:
  ansA-=MOD

B1=A[0:K]
C1=A[0:K]
B2=sorted(A[K:N])
Bp=[i for i in A[0:K] if i>0]
Bm=[i for i in A[0:K] if i<0]
 
if B2[0]>0:B2.insert(0,0)
if B2[-1]<0:B2.insert(-1,0)
if not Bp:Bp.insert(0,B1[-1])
if not Bm:Bm.insert(0,B1[0])
  
#print(Bp,Bm,B2)
#print(Bp[-1],B2[0])
B1.remove(Bp[-1])
B1.append(min(B2[0],0))
#print(B1)
ansB = 1
for a in B1[0:K]:
  ansB *= a
  ansB %= MOD
#print(Bm[-1],B2[-1])
C1.remove(Bm[-1])
C1.append(max(B2[-1],0))
 
ansC = 1
for a in C1[0:K]:
  ansC *= a
  ansC %= MOD
#print(B1,C1)
#print(ansB,ansC)
BB1=[np.sign(i) for i in B1]
ansBB1 = BB1[0:K].count(-1)%2
BB2=[np.sign(i) for i in C1]
ansBB2 = BB2[0:K].count(-1)%2
#print(ansBB1,ansBB2)
if ansBB1==1:
  print(ansC)
  exit()
if ansBB2==1:
  print(ansB)
  exit()
#print(B2[0]/Bp[-1],B2[-1]/Bm[-1])
#print(Bp[-1]*B2[-1],Bm[0]*B2[0])

#print(abs(Bp[-1]*B2[-1])-abs(Bm[-1]*B2[0]))
#print(ansB,ansC)
if abs(Bp[-1]*B2[-1])-abs(Bm[-1]*B2[0])>=0:
  print(ansC)
else: print(ansB)
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 27 20:55:53 2019

@author: makigon
"""
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

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

ans = 0

for i in range(N):
    a = A.pop(0)
    p = gcd_list(A)
    if p > ans:
        ans = p
    A.append(a)
print(ans)
    

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Jun 29 20:51:40 2019

@author: makigon
"""

import fractions
from functools import reduce
 
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
 
N = int(input())
a = list(map(int,input().split()))
ans = 0

t_left = [0 for i in range(N)]
t_right = [0 for i in range(N)]

t_left[0] = a[0]
t_left[1] = fractions.gcd(a[0],a[1])

for i in range(2,N):
    t_left[i] = fractions.gcd(t_left[i-1],a[i])

t_right[N-1] = a[N-1]
t_right[N-2] = fractions.gcd(a[N-1],a[N-2])

for j in range(N-3,0,-1):
    t_right[j] = fractions.gcd(t_right[j+1],a[j])
    

for i in range(0,N-2):
    tmp = fractions.gcd(t_left[i],t_right[i+2])
    if tmp > ans:
        ans = tmp
    
print(max(ans,t_right[1],t_left[N-2]))
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]
if not N[0]%N[3]==0:
   c=N[0]//N[3]+1

   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d=>c:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]
if not N[0]%N[3]==0:
   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d>=c:
    print("Yes")
else:
    print("No")
a,b,k=map(int,input().split())
l=[]
if k==1 or a==1 or b==1:
	print("1")
else:
	for i in range(1,min(a,b)):
		if a%i==0 and b%i==0:
			l.append(i)
	
	print(l[k-1])

### FIXED CODE ###

a,b,k=map(int,input().split())
l=[]

for i in range(1,(min(a,b))+1):
	if a%i==0 and b%i==0:
		l.append(i)
l.sort(reverse=True)
if a==1 or b==1:
    l=[1,1]
print(l[k-1])
# D
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

# pop from left
popleft = [0]*(N+1)
A_LEFT = np.argsort(A[:(2*N)])
ind_left = 1
for i in range(N):
    while popleft[ind_left] > 0:
        ind_left += 1
    if A_LEFT[i] < N:
        popleft[ind_left] = A[A_LEFT[i]]
    else:
        popleft[A_LEFT[i] - (N-2)] = A[A_LEFT[i]]
left_sum = np.cumsum(A)[(N-1):2*N] - np.cumsum(np.array(popleft))

# pop from right
popright = [0]*(N+1)
A_RIGHT = np.argsort(-A[::-1][:(2*N-1)])
ind_right = 1
for i in range(N):
    while popright[ind_right] > 0:
        ind_right += 1
    if A_RIGHT[i] < N:
        popright[ind_right] = A[3*N - 1 - A_RIGHT[i]]
    else:
        popright[A_RIGHT[i] - (N-2)] = A[3*N - 1 - A_RIGHT[i]]
right_sum = np.cumsum(A[::-1])[(N-1):2*N] - np.cumsum(np.array(popright))

# print(popleft)
# print(popright)
res = (left_sum - right_sum[::-1]).max()
# extreme case
res1 = (np.sort(A[:2*N])[N:]).sum() - A[2*N:].sum()
res2 = A[:N].sum() - (np.sort(A[N:])[:N]).sum()
print(max(res, res1, res2))

### FIXED CODE ###

# D
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

# pop from left
popleft = [0]*(N+1)
A_LEFT = np.argsort(A[:(2*N)])
ind_left = 1
for i in range(N):
    while popleft[ind_left] > 0:
        ind_left += 1
    if A_LEFT[i] < N:
        popleft[ind_left] = A[A_LEFT[i]]
    else:
        popleft[max(ind_left, A_LEFT[i] - (N-1))] = A[A_LEFT[i]]
left_sum = np.cumsum(A)[(N-1):(2*N)] - np.cumsum(np.array(popleft))

# pop from right
popright = [0]*(N+1)
A_RIGHT = np.argsort(-A[::-1][:(2*N)])
ind_right = 1
for i in range(N):
    while popright[ind_right] > 0:
        ind_right += 1
    if A_RIGHT[i] < N:
        popright[ind_right] = A[3*N - 1 - A_RIGHT[i]]
    else:
        popright[max(ind_right, A_RIGHT[i] - (N-1))] = A[3*N - 1 - A_RIGHT[i]]
right_sum = np.cumsum(A[::-1])[(N-1):(2*N)] - np.cumsum(np.array(popright))

# print(popleft)
# print(popright)
res = (left_sum - right_sum[::-1]).max()
# extreme case
res1 = (np.sort(A[:2*N])[N:]).sum() - A[2*N:].sum()
res2 = A[:N].sum() - (np.sort(A[N:])[:N]).sum()
print(max(res, res1, res2))
import sys
import bisect


class SegmentTree(object):  #1-indexed
    def __init__(self, size, value):
        self.len = 1 << size.bit_length()
        self.default = value
        print(self.len)
        self.array = [value] * (2 * self.len)

    def get(self, i):
        i += self.len
        ans = self.default
        while i > 0:
            ans = min(self.array[i], ans)
            i >>= 1
        return ans

    def query(self, l, r, v, i, a, b):
        if self.array[i] != self.default:
            return 0
        if l == a and r == b:
            self.array[i] = v
            return 0
        center = (a + b) // 2
        if center >= r:
            return self.query(l, r, v, i * 2, a, center)
        elif center <= l:
            return self.query(l, r, v, i * 2 + 1, center, b) 
        else:
            return min(
                self.query(l, center, v, i * 2, a, center),
                self.query(center, r, v, i * 2 + 1, center, b))

    def update(self, l, r, v):
        return self.query(l, r, v, 1, 0, self.len)


input = sys.stdin.readline

N, Q = map(int, input().split())

STX_array = [list(map(int, input().split())) for _ in range(N)]

STX_array = sorted(STX_array, key=lambda x: x[2])

Q_array = [int(input()) for _ in range(Q)]

index_array = [i for i in range(Q)]

INF = 10**9 + 7

seg_tree = SegmentTree(Q, INF)

for STX in STX_array:
    s, t, x = STX
    index_left = bisect.bisect_left(Q_array, s - 0.5 - x)
    index_right = bisect.bisect_left(Q_array, t - 0.5 - x)
    seg_tree.update(index_left, index_right, x)

for i in range(Q):
    ans = seg_tree.get(i)
    print(ans) if ans != INF else print(-1)

### FIXED CODE ###

import sys
import bisect

input = sys.stdin.readline

N, Q = map(int, input().split())

STX_array = [list(map(int, input().split())) for _ in range(N)]

STX_array = sorted(STX_array, key=lambda x: x[2])

Q_array = [int(input()) for _ in range(Q)]

index_array = [i for i in range(Q)]

ans_array = [-1] * Q
for STX in STX_array:
    s, t, x = STX
    index_left = bisect.bisect_left(Q_array, s - 0.5 - x)
    index_right = bisect.bisect_left(Q_array, t - 0.5 - x)
    if index_left != index_right:
        now_index = index_left
        while now_index < index_right:
            if index_array[now_index] == now_index:
                ans_array[now_index] = x
                index_array[now_index] = index_right
                now_index += 1
            else:
                old_index = now_index
                now_index = index_array[now_index]
                index_array[old_index] = now_index




for ans in ans_array:
    print(ans)
a,b,c,d = (int(i) for i in input(.split()))

x = a + b
y = c + d

if x > y:
    print('Left')
elif x < y:
    print('Right')
else:
    print('Balanced')

### FIXED CODE ###

A,B,C,D = (int(i) for i in input().split())

x = A + B
y = C + D

if x > y:
    print('Left')
elif x < y:
    print('Right')
else:
    print('Balanced')
N=int(input())
A=list(map(int,input().split()))

if 0 in A:
    print(0)
    exit(0)
ans = 1 
for i in range A:
    ans *= i
    if ans >= 10**18:
        print(-1)
        exit(0)
        
print(ans)

### FIXED CODE ###

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

if 0 in A:
    print(0)
    exit(0)
    
ans = 1 
for i in A:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit(0)
        
print(ans)
n=int(raw_input())
N=map(int,raw_input().split())
count=0
for i in range(n):
	if i==N[N[i]-1]-1:
		count+=1
print count/2


### FIXED CODE ###

y=raw_input()
print y[:4]+' '+y[4:]