Harryxun/stf_run huggingface dataset:
N = int(input())
X=list(map(int, input().split())) 

X_max = max(X)
X_min = min(X)

answerlist = []
for x in range(X_min,X_max):
  newX = [(n-x)^2 for n in X]
  sum = sum(newX)
  answerlist.append(sum)
  
print(max(answerlist))
  
  
    
  

### FIXED CODE ###

N = int(input())
X=list(map(int, input().split())) 
X_max = max(X)
X_min = min(X)
 
answerlist = []
for i in range(X_min,X_max+1):
  newX = [(n-i)**2 for n in X]
  total = sum(newX)
  answerlist.append(total)
  
print(min(answerlist))
import numpy as np

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

counter = np.bincount(A)

ans = []
for i in range(len(A)):
    counter_i = counter.copy()
    counter_i[A[i]] -=1
    sum_i = sum(counter_i * (counter_i -1) //2)
    ans.append(sum_i)
    
for i in range(len(ans)):
    print(ans[i])

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
import numpy as np
 
N = int(readline())
A = np.array(read().split(), np.int64)
counter = np.bincount(A)
 
total = (counter * (counter - 1)).sum() // 2
answer = (total - (counter - 1))[A]
 
print('\n'.join(answer.astype(str)))
n = int(input())
s = input()

import itertools

d = list()
for d1, d2, d3 in itertools.product(range(10), range(10), range(10)):
    d.append(f'{d1}{d2}{d3}')

ret = 0
for di in d:
    ls = list(s)
    try:
        idx1 = ls.index(di[0])
        idx2 = ls[idx1+1:].index(di[1])
        idx3 = ls[idx1+1:][idx2+1:].index(di[2])
        ret += 1
    except:
        continue

print(ret)

### FIXED CODE ###

n = int(input())
s = input()

import itertools

d = list()
for d1, d2, d3 in itertools.product(range(10), range(10), range(10)):
    d.append(str(d1) + str(d2) + str(d3))

ret = 0
for di in d:
    ls = list(s)
    try:
        idx1 = ls.index(di[0])
        idx2 = ls[idx1+1:].index(di[1])
        idx3 = ls[idx1+1:][idx2+1:].index(di[2])
        ret += 1
    except:
        continue

print(ret)
N = int(input())
print (N(N+1)//2 - 3*(N//3)((N//3)+1)//2 - 5*(N//5)((N//5)+1)//2 + 15*(N//15)((N//15)+1)//2)

### FIXED CODE ###

N = int(input())
print (N*(N+1)//2 - 3*(N//3)*((N//3)+1)//2 - 5*(N//5)*((N//5)+1)//2 + 15*(N//15)*((N//15)+1)//2)
import sys
N = int(input())
a = [int(input()) for i in range(N)]
d = [0]
b = 0
c = 0
while True:
    if b == 1:a
        print(c)
        sys.exit()
    c += 1
    b = a[b] - 1
    if b in d:
        print('-1')
        sys.exit()
    d.append(b)

### FIXED CODE ###

import sys
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
b = [0] * N
i = 0
c = 1
while True:
    if b[i] == 1:
        print(-1)
        sys.exit()
    b[i] = 1
    i = a[i] - 1
    if i == 1:
        print(c)
        sys.exit()
    c += 1
n = int(input())
l = list(map(int, input().split()) for _ in range(n))

print('Yes' if max(l) < sum(l)-max(l) else 'No')

### FIXED CODE ###

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

print('Yes' if max(l) < sum(l)-max(l) else 'No')
from math import sqrt
a,b=input().split()
c=sqrt.(int(a+b))
if c==int(c):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

from math import sqrt
a,b=input().split()
c=sqrt(int(a+b))
if c==int(c):
  print("Yes")
else:
  print("No")
from math import sqrt
N=int(input())
XY=[tuple(map(int,input().split() for _ in range(N)))]

def calc(r):
  lst=[]
  for i in range(N-1):
    x1=XY[i][0]
    y1=XY[i][1]
    for j in range(i+1,N):
      x2=XY[j][0]
      y2=XY[j][1]
      diff=sqrt((x1-x2)**2+(y1-y2)**2)
      if diff>2*r:
        return False
      
      h=sqrt(r**2-diff**2/4)
      if x1==x2:
        ny=(y1+y2)/2
        lst.append([x1-h,ny])
        lst.append([x1+h,ny])
      elif y1==y2:
        nx=(x1+x2)/2
        lst.append([nx,y1-h])
        lst.append([nx,y1+h])
      else:
        a=(y2-y1)/(x2-x1)
        b=-1/a
        size=sqrt(1+b**2)
        dx=h/size
        dy=dx*b
        nx=(x1+x2)/2
        ny=(y1+y2)/2
        lst.append([nx+dx,ny+dy])
        lst.append([nx-dx,ny-dy])
  for x,y in lst:
    flag=True
    for X,Y in XY:
      tmp=(x-X)**2+(y-Y)**2
      if tmp>r**2:
        flag=False
        break
    if flag:
      return True
  return False
l=0
r=1000
for i in range(100):
  mid=(i+r)/2
  if calc(mid):
    r=mid
  else:
    l=mid
print(r)
       
        

### FIXED CODE ###

from math import sqrt
N=int(input())
XY=[tuple(map(int,input().split())) for _ in range(N)]

def calc(r):
  lst=[]
  for i in range(N-1):
    x1=XY[i][0]
    y1=XY[i][1]
    for j in range(i+1,N):
      x2=XY[j][0]
      y2=XY[j][1]
      diff=sqrt((x1-x2)**2+(y1-y2)**2)
      if diff>2*r:
        return False
      
      h=sqrt(r**2-diff**2/4)
      if x1==x2:
        ny=(y1+y2)/2
        lst.append([x1-h,ny])
        lst.append([x1+h,ny])
      elif y1==y2:
        nx=(x1+x2)/2
        lst.append([nx,y1-h])
        lst.append([nx,y1+h])
      else:
        a=(y2-y1)/(x2-x1)
        b=-1/a
        size=sqrt(1+b**2)
        dx=h/size
        dy=dx*b
        nx=(x1+x2)/2
        ny=(y1+y2)/2
        lst.append([nx+dx,ny+dy])
        lst.append([nx-dx,ny-dy])
  nr=r+10**(-9)
  for x,y in lst:
    flag=True
    for X,Y in XY:
      tmp=(x-X)**2+(y-Y)**2
      if tmp>nr**2:
        flag=False
        break
    if flag:
      return True
  return False
l=0
r=1000
for i in range(100):
  mid=(l+r)/2
  if calc(mid):
    r=mid
  else:
    l=mid
print(r)
import math

n = int(input())

if n == 2 or n == 1:
    print(2)
else:
    if n % 2 == 0:
        n += 1

i = 3

m = 2 * math.floor(n/2) + 1

while i < m:
    Prime = True
    if n % i == 0:
        Prime = False
        i = 3
        n += 2
    i += 2

if Prime == True:
    print(n)
        
        

### FIXED CODE ###

import math

n = int(input())

if n == 2:
    print(2)
    exit()
else:
    if n % 2 == 0:
        n += 1

i = 3

m = 2 * math.floor(n/2) + 1

while i < m:
    if n % i == 0:
        i = 3
        n += 2
    i += 2


print(n)
# -*- coding: utf-8 -*- 

number, length = map(int, input())
lst = []
for n in range(number):
    input = input()
    lst.append(input)

lst.sort()
moji = ""
for n in lst:
    moji += n
print(moji)

### FIXED CODE ###

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


number, length = map(int, input().split())
lst = []
for n in range(number):
    s = input()
    #print(s)
    lst.append(s)
    #print(lst)

lst.sort()
moji = ""
for n in lst:
    moji += n
print(moji)
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0

for i in range(N):
  ans += B[A[i]]
  if i > 0:
    if A[i-1]+1 == A[i]:
      ans += C[i-1]
      
print(ans)

### FIXED CODE ###

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

ans = sum(B)

for i in range(N-1):
  if A[i] + 1 == A[i+1]:
    ans += C[A[i]-1]
    
print(ans)
A,B=map(int,input().split())
A=max(0,A-1)
P=[2**i for i in range(40)]
i=0
ans=0
while P[i]<=B:
  q=((B+1)//P[i])
  r=(B+1)%P[i]
  Q=((A+1)//P[i])
  R=(A+1)%P[i]
  coB=(q//2)*P[i]+[0,r][q%2]
  coA=(Q//2)*P[i]+[0,R][Q%2]
  if (coB-coA)%2==1:
    ans+=P[i]
  i+=1
print(ans)

### FIXED CODE ###

A,B=map(int,input().split())
A=max(0,A-1)
P=[2**i for i in range(41)]
i=0
ans=0
while P[i]<=B:
  q=((B+1)//P[i])
  r=(B+1)%P[i]
  Q=((A+1)//P[i])
  R=(A+1)%P[i]
  coB=(q//2)*P[i]+[0,r][q%2]
  coA=(Q//2)*P[i]+[0,R][Q%2]
  if (coB-coA)%2==1:
    ans+=P[i]
  i+=1
print(ans)
N = int(input())
xyr = [list(map(int, input().split())) for _ in range(N)]


def m():
    for cx in range(0, 101):
        for cy in range(0, 101):
            hs = []
            h = 0
            for x, y, r in xyr:
                h = max(0, r + abs(x - cx) + abs(y - cy))
                hs.append(h)
            if len(set(hs)) == 1:
                return "{} {} {}".format(cx, cy, set(hs)[0])


print(m())

### FIXED CODE ###

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


def m():
    tmpx, tmpy, tmpr = 0, 0, 0
    for a,b,c in xyr:
        if c != 0:
            tmpx = a
            tmpy = b
            tmpr = c
            break

    for cx in range(0, 101):
        for cy in range(0, 101):
            h = max(0, tmpr + abs(tmpx - cx) + abs(tmpy - cy))
            f = 0
            for x, y, r in xyr:
                if not (r == max(h - abs(x - cx) - abs(y - cy), 0)):
                    f = 1
                    break
            if f == 0:
                return "{} {} {}".format(cx, cy, h)


print(m())
def main():
  k, N = (int(x) for x in input().split())
  min_LIST = []
  LIST = []
  LIST = list(map(int,input().split()))

  for i in range(len(LIST) - 1):
    min_LIST.append(LIST[i + 1] - LIST[i])
    if(min_LIST[i] <= (LIST[i + 1] - LIST[i])):
      x = (LIST[i + 1] - LIST[i])

  min_LIST.append(LIST[0] + (k - LIST[-1]))
  if(x <= (LIST[0] + (k - LIST[-1]))):
    x = (LIST[0] + (k - LIST[-1]))

  sum_list = sum(min_LIST) - x

  print(sum_list)
if __name__ == "__main__":
  main()






### FIXED CODE ###

def main():
  x = input()
  if(len(x) == 6 and x.islower()):
    if(x[2] == x[3] and x[4] == x[5]):
        print("Yes")
    else:
      print("No")
    
if __name__ == "__main__":
  main()
x,y=map(int, input().split())
a = {1,3,5,7,8,10,12}
b = {4,6,9,11}
print('Yes' if x,y<=a or x,y<=b else 'No')

### FIXED CODE ###

S = 'ACABABAABABA'
x,y = map(int, input().split())
print('Yes' if S[x-1]==S[y-1] else 'No')
nm=list(map(int,input().split()))
n=nm[0]
m=nm[1]

inp=[]
for inpset in range(m):
    inp.append(int(input()))
    

dis=[max(inp[0],1)]
p=0
for i in inp[:-1]:
    dis.append(inp[p+1]-inp[p]-1)
    p+=1
dis.append(max(n-inp[-1],1))
#print (dis)

import math

def kaijo(x):
    ans=(math(100000)%1000000007)
    return ans

def combinations_count(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r)))%1000000007

def counting(x):
    if x==1:
        return 1
    else:
        
        res=0
        for a in range(x-1):
            if x-1-a>=a:
                res+=combinations_count(x-1-a,a)
                # print(x-1-a,a)
                res=res%1000000007
            else:
                break
        return res

if 0 in dis:
    print(0)
else:
    ans=1
    dis.sort()
    for d in dis:
        ans*=counting(d)
        ans=ans%1000000007
    print(ans)

### FIXED CODE ###

nm=list(map(int,input().split()))
n=nm[0]
m=nm[1]

inp=[]
if m==0:
    inp=[n+1]
    dis=[n+1]
else:
    for inpset in range(m):
        inp.append(int(input()))
    

    dis=[max(inp[0],1)]
    p=0
    for i in inp[:-1]:
        dis.append(inp[p+1]-inp[p]-1)
        p+=1
    dis.append(max(n-inp[-1],1))
    #print (dis)

def fib(x):
    a=0
    b=1
    for step in range(x):
        c=a+b
        a=b
        b=c
    return a


def counting(x):
    if x==1:
        return 1
    else:
        
        res=0
        for a in range(x-1):
            if x-1-a>=a:
                res+=combinations_count(x-1-a,a)
                # print(x-1-a,a)
            else:
                break
        res=res%1000000007
        return res

if 0 in dis:
    print(0)
else:
    ans=1
    dis.sort()
    for d in dis:
        ans*=fib(d)%1000000007
        ans=ans%1000000007
    print(ans)
a,b = map(int,raw_input().split(' '))
x = max(a,b)
n = min(a,b)
f = False
for i in range(n,0,-1):
	if x%i == 0 and n %i==0:
		print i
		break

### FIXED CODE ###

a,b = map(int,raw_input().split(' '))
while(True):
	if(a == b):
		print a
		break
	if(a < b):
		t = a
		a = b
		b = t
	a,b = b,a%b
	if(b == 0):
		print a
		break
a, b = map(int, input().split())
ans = 0
white True:
  if ans * (a - 1) + 1 >= b:
    break
  ans += 1
print(ans)


### FIXED CODE ###

a, b = map(int, input().split())
ans = 0
while True:
  if ans * (a - 1) + 1 >= b:
    break
  ans += 1
print(ans)
import math

A, B, C = map(int, input().split())

gcd = math.gcd(A, B)
if C % gcd == 0:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

import fractions

A, B, C = map(int, input().split())

gcd = fractions.gcd(A, B)
if C % gcd == 0:
    print("YES")
else:
    print("NO")
import math

a, b = map(int, input().split())
t = math.gcd(a, b)
print(a // t * b)


### FIXED CODE ###

from fractions import gcd

a, b = map(int, input().split())
t = gcd(a, b)
print(a // t * b)
n=int(input())
a=n[0]
if a in list('24579'):
  ans='hon'
elif a in list('0168'):
  ans='pon'
else:
  ans='bon'

print(ans)

### FIXED CODE ###

# 1
# 2 
# 3
n=input()
a=n[-1]
if a in list('24579'):
  ans='hon'
elif a in list('0168'):
  ans='pon'
else:
  ans='bon'

print(ans)
n = int(input())
l = [list(map(int,input().split())) for _ in range(n)]

x = 0
y = 0
for i in range(n):
    t = l[i][0]
    x = l[i][1]
    y = l[i][2]
    d = x + y
    if d <= t and (d - t) % 2 == 0:
        continue
    else:
        print('No')
        quit()
print('Yes')


### FIXED CODE ###

a, b = map(int,input().split())
if a*b % 2 != 0:
  print('Odd')
else:
  print('Even')
H,W=map(int,intput().split())
h,w=map(int,input().split())
print(W*H-h*W-H*w+h*w)

### FIXED CODE ###

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


def main():
    alpha = [int(input()) for _ in range(5)]
    k = int(input())

    for a in alpha:
        for b in alpha:
            if abs(a - b) > k:
                print(':(')
                exit()

    print('Yay!')


if __name__ == '__main__':
    main()
S=input()
N=len(S)
if N<5:
  print(0)
  exit()
A={}
ans=0
for i in range(N-4+1):
  a=int(S[i:])%2019
  A.setdefault(a,0)
  A[a]+=1
  if A[a]>0:
    ans+=A[a]-1
print(ans+A[0])

### FIXED CODE ###

s=input()
n=0
ans=0
A=[0]*2019
A[0]=1
for i,j in enumerate(reversed(s)):
  n=(n+int(j)*pow(10,i,2019))%2019
  #print(i,n)
  A[n]+=1
for i in A:
  ans+=i*(i-1)//2
print(ans)
def attack(x):
  if x==1:
    return 1
  else:
    return (attack(-(-x/2))*2+1)

h=int(input())

print(attack(h))

### FIXED CODE ###

def attack(x):
  if x==1:
    return 1
  else:
    return (attack(x//2)*2+1)

h=int(input())

print(attack(h))
N = int(input())
s = [input() for _ in range(N)]

word = {}
cnt = 0
for i in s:
    i = sorted(i)
    time = word.get(i, 0)
    cnt += time
    word[i] = time + 1
print(cnt)


### FIXED CODE ###

N = int(input())
s = [input() for i in [0]*N]
words = {}
cnt = 0
for i in s:
    i = "".join(sorted(i))
    time = words.get(i,0)
    cnt += time
    words[i] = time + 1
print(cnt)
a,b,c = map(int,raw_input().split())
 print(a+b+c-max(a,b,c))


### FIXED CODE ###

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

#お店にあるベルは 3 種類で、それぞれ a円、 b円、 c円です。
#この 3 つのうち、異なる 2 つのベルを選んで買うときの、値段の合計の最小値を求めて下さい。

x = input().split()
#x = [700, 600, 780]

y =[int(x[0]), int(x[1]), int(x[2])]

z = sorted(y)

ans = z[0] + z[1]

print(ans)
n, m = map(int, input().split())

adj = [[] for i in range(n)]

for i in range(m):
    s, t = map(int, input().split())
    adj[s].append(t)
    adj[t].append(s)

isVisited = [False] * n

CC = [None] * n

import sys
sys.setrecursionlimit(100000000)

def dfs(u, group):
    isVisited[u] = True
    CC[u] = group
    for v in adj[u]:
        if not isVisited[v]:
            dfs(v, group)

def makeCC(group):
    for i in range(n):
        if not isVisited[i]:
            dfs(i, group)
            group += 1

def isConnected(v1, v2):
    if CC[v1] == CC[v2]:
        print('yes')
    else:
        print('no')


makeCC(0)


q = int(input())

for i in range(q):
    s, t = map(int, input().split())
    isConnected(s, t)

### FIXED CODE ###

n, m = map(int, input().split())

adj = [[] for i in range(n)]

for i in range(m):
    s, t = map(int, input().split())
    adj[s].append(t)
    adj[t].append(s)

groups = [None] * n


def dfs(u, group_num):
    path = []
    path.append(u)
    groups[u] = group_num
    while path:
        u = path[-1]
        if adj[u]:
            v = adj[u].pop(0)
            if not groups[v]:
                groups[v] = group_num
                path.append(v)
        else:
            path.pop()


g_n = 1
for i in range(n):
    if not groups[i]:
        dfs(i, g_n)
        g_n += 1

def isConnected(v1, v2):
    if groups[v1] == groups[v2]:
        print('yes')
    else:
        print('no')


q = int(input())

for i in range(q):
    s, t = map(int, input().split())
    isConnected(s, t)
while available > 1:
    for i in range(available / 2):
    nums[i] = nums[2 * i] * nums[2 * i + 1]
    if(ans > 1000000000000000000):
        print(-1)
        quit()
    if isOdd:
        nums[available / 2 + 1] = nums[-1]
        available //= 2
    if isOdd:
        available += 1
    if a == 0:
        print(0)
        quit()
print(ans)
quit()

### FIXED CODE ###

num = int(input())
str2 = input().split(" ")
nums = [int(s) for s in str2]
nums.sort()

ans = 1

for i in range(len(nums)):
    ans = ans * nums[i]
    if(ans > 1000000000000000000):
        print(-1)
        quit()
print(ans)
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,n.count(l[i])-m.count(l[i]) for i in range(len(l))))


### FIXED CODE ###

n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))
pi=3.1415926535
r = int(input())
print("{0:.6f} {1:.6f}".format(float(r*r*pi), float(2*r*pi)))

### FIXED CODE ###

from math import pi
r = float(input())
print("{0:.6f} {1:.6f}".format(float(r*r*pi), float(2*r*pi)))
#!/usr/bin/env python3
import sys
INF = float("inf")
import numpy as np
from collections import Counter
from itertools import permutations


def solve(N: int, C: int, D: "List[List[int]]", c: "List[List[int]]"):
    D = np.array(D)
    onedim = [[], [], []]
    for i in range(N):          # O(N^2)
        for j in range(N):
            onedim[(i+j) % 3].append(c[i][j])
    # print(onedim)
    counters = [Counter(onedim[i]) for i in range(C)]  # O(C*N*N)
    arr = np.empty((C, C))
    for i in range(C):          # O(C*C)
        for j in range(C):
            arr[i][j] = counters[j][i+1]
    # print("arr", arr)
    # print("D", D)
    hint = D.T.dot(arr)         # O(C*C*3)
    # print("D.T@arr\n", hint)
    print(int(min([hint[0][a] + hint[1][b]+hint[2][c]
                   for a, b, c in permutations(range(C), 3)])))
    # O(C*(C-1)*(C-2))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = [[int(next(tokens)) for _ in range(C)]
         for _ in range(C)]  # type: "List[List[int]]"
    c = [[int(next(tokens)) for _ in range(N)]
         for _ in range(N)]  # type: "List[List[int]]"
    solve(N, C, D, c)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
INF = float("inf")
import numpy as np
from collections import Counter
from itertools import permutations


def solve(N: int, C: int, D: "List[List[int]]", c: "List[List[int]]"):
    D = np.array(D)
    onedim = [[], [], []]
    for i in range(N):          # O(N^2)
        for j in range(N):
            onedim[(i+j) % 3].append(c[i][j])
    # print(onedim)
    counters = [Counter(onedim[i]) for i in range(3)]  # O(3*N*N)
    arr = np.empty((C, C))
    for i in range(3):          # O(C*C)
        for j in range(C):
            arr[i][j] = counters[i][j+1]
    # print("arr", arr)
    # print("D", D)
    hint = arr.dot(D)         # O(C*C*3)
    # print("arr@D\n", hint)
    print(int(min([hint[0][a] + hint[1][b]+hint[2][c]
                   for a, b, c in permutations(range(C), 3)])))
    # O(C*(C-1)*(C-2))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = [[int(next(tokens)) for _ in range(C)]
         for _ in range(C)]  # type: "List[List[int]]"
    c = [[int(next(tokens)) for _ in range(N)]
         for _ in range(N)]  # type: "List[List[int]]"
    solve(N, C, D, c)


if __name__ == '__main__':
    main()
n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
print(l[0] + l[1] + l[2])

### FIXED CODE ###

n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
price = 0
for i in range(k) :
    price += l[i]
print(price)
import math
import _collections
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N=int(input())
strings=[str(sorted(input())) for a in range(N)]
c=_collections.Counter(strings)
tp=c.most_common()
sums=0
for thing in tp:
    if tp[1]!=1:
        sums=sums+combinations_count(tp[1],2)
    else:break
    
print(sums)

### FIXED CODE ###

import math
import collections
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N=int(input())
strings=[str(sorted(input())) for a in range(N)]
c=collections.Counter(strings)
tp=c.most_common()
sums=0
for thing in tp:
    if thing[1]!=1:
        sums=sums+combinations_count(thing[1],2)
    else:break

print(sums)
import sys

input = sys.stdin.readline
N,K=map(int,input().rstrip().split())
D=list(map(int,input().rstrip().split()))

def dfs(N):
    for i in range(K):
        if(str(N).find(str(D[i]))!=-1):
            dfs(N+1)
            return
    else:
        print(N)
    
    


def resolve():
    dfs(N)


from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """1000 8
1 3 4 5 6 7 8 9"""
        output = """2000"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """9999 1
0"""
        output = """9999"""
        self.assertIO(input, output)

if __name__ == "__main__":
    #unittest.main()
    resolve()

### FIXED CODE ###

import sys
 
input = sys.stdin.readline
N,K=map(int,input().rstrip().split())
D=list(map(int,input().rstrip().split()))
sys.setrecursionlimit(10**6)

def dfs(N):
    for i in range(K):
        if(str(N).find(str(D[i]))!=-1):
            dfs(N+1)
            return
    else:
        print(N)
    
    

dfs(N)
array_length = raw_input()
unsorted_array = list(map(int, raw_input().split()))

for i in range(1, array_length):
    v = unsorted_array[i]
    j = i - 1
    while j >= 0 and unsorted_array[j] > v:
        unsorted_array[j + 1] = unsorted_array[j]
        j -= 1
    unsorted_array[j + 1] = v
    print(" ".join(str(i) for i in unsorted_array))

### FIXED CODE ###

#!/usr/bin/env python
# encoding: utf-8

from __future__ import print_function


class Solution:
    """
    @param prices: Given an integer array
    @return: Maximum profit
    """

    @staticmethod
    def insertion_sort():
        # write your code here
        array_length = int(input())
        unsorted_array = [int(x) for x in input().split()]

        for i in range(array_length):
            v = unsorted_array[i]
            j = i - 1
            while j >= 0 and unsorted_array[j] > v:
                unsorted_array[j + 1] = unsorted_array[j]
                j -= 1
            unsorted_array[j + 1] = v
            print(" ".join(map(str, unsorted_array)))


if __name__ == '__main__':
    solution = Solution()
    solution.insertion_sort()
L=int(input())
R=int(input())

if R - L >= 672:
    ans = 0
elif R * L < 2019:
    ans = L*(L+1)
else:
    ans = 2018
    for i in range(L, R):
        for j in range(L+1, R+1):
            mod=(i*j)%2019
            if mod < ans:
                ans = mod
print(ans)
    

### FIXED CODE ###

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


if R - L >= 672:
    ans = 0
elif R * L < 2019:
    ans = L*(L+1)
else:
    ans = 2018
    for i in range(L, R):
        for j in range(L+1, R+1):
            mod=(i*j)%2019
            if mod < ans:
                ans = mod
print(ans)