Problem:
 Score : 300 points    Problem Statement You are given two non-negative integers L and R .
We will choose two integers i and j such that L \leq i < j \leq R .
Find the minimum possible value of (i \times j) \mbox{ mod } 2019 .      Constraints  All values in input are integers.  0 \leq L < R \leq 2 \times 10^9         Input Input is given from Standard Input in the following format:  L  R       Output Print the minimum possible value of (i \times j) \mbox{ mod } 2019 when i and j are chosen under the given condition.        Sample Input 1 2020 2040      Sample Output 1 2  When (i, j) = (2020, 2021) , (i \times j) \mbox{ mod } 2019  = 2 .       Sample Input 2 4 5      Sample Output 2 20  We have only one choice: (i, j) = (4, 5) .

Solution (Python):
MOD = 2019  
L, R = list(map(int, input().split()))


if (R - L) >= MOD:
    print(0)
    exit()


L %= MOD

R %= MOD
if R <= L:
    R += MOD


ans = 114514
for i in range(L, R):  
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)
print(ans)

Solution (Python):
MOD = 2019  
L, R = list(map(int, input().split()))


if (R - L) >= MOD:
    print(0)
    exit()


L %= MOD

R %= MOD
if R <= L:
    R += MOD


ans = 2019
for i in range(L, R+1):  
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)
print(ans)

Solution (Python):
MOD = 2019  
L, R = list(map(int, input().split()))


if (R - L) >= MOD:
    print(0)
    exit()


L %= MOD

R %= MOD
if R <= L:
    R += MOD


ans = 2019
for i in range(L, R):  
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)
print(ans)

Solution (Python):





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

if (R - L) >= MOD:
    print(0)
    exit()


L %= 2019

R %= 2019
if R <= L:
    R += MOD

ans = 2019
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)
print(ans)

Solution (Python):
L, R = map(int, input().split())
mod = 2019
mini = 2019 
count1 = 0

for i in range(L,R):
    count2 = 0
    for j in range(i+1, R+1):
        
        
        
        if mini > (((i % mod) * (j % mod)))%mod:
            mini = (((i % mod) * (j % mod))%mod)
        count2 += 1
        if count2 == mod:
            break
    count1 += 1
    if count1 == mod:
        break
print(mini)

Solution (Python):
l, r = map(int, input().split())
mod = 2019
lm, rm = l % mod, r % mod
if l + 2019 <= r:
    ans = 0
elif lm < rm:
    ans = 2019
    for i in range(lm, rm):
        for j in range(i+1, rm+1):
            ans = min(ans, i * j % mod)
elif lm > rm:
    ans = 2019
    for i in range(0, rm+1):
        for j in range(lm, 2019):
            ans = min(ans, i*j%mod)
print(ans)

Solution (Python):
L, R = map(int, input().split())
ans = 2019
for i in range(L, min(R+1, L+2019)):
    for j in range(i+1, min(R+1, L+2019)):
        ans = min(ans, (i*j)%2019)
print(ans)

Solution (Python):
def examA():
    N, A, B = LI()
    ans = min(A*N,B)
    print(ans)
    return

def examB():
    N, D = LI()
    X = [LI() for _ in range(N)]
    ans = 0
    for i,j in itertools.combinations(X,2):
        cur = 0
        for k in range(D):
            cur += (i[k]-j[k])**2
        cur **=0.5
        if cur==int(cur):
            ans +=1
    print(ans)
    return

def examC():
    L, R = LI()
    cur = []; ans = 10**9
    for i in range(L,min(2019+L,R)+1):
        if i%2019==0:
            ans = 0
            break
        else:
            cur.append(i%2019)
    if ans==0:
        print(ans)
        return
    N = len(cur)
    for i,j in itertools.combinations(cur,2):
        ans = min(ans,(i*j)%2019)
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examC()

Solution (Python):
L, R = map(int, input().split())

for x in range(L, R + 1):
    if x % 2019 == 0:
        print(0)
        exit()

import itertools
list_ij = list(itertools.combinations(range(L, R + 1), 2))

list_mod = []
for x in list_ij:
    list_mod.append(x[0] * x[1] % 2019)

print(min(list_mod))

Solution (Python):
l,r=map(int,input().split())
if r-l>=2018:
  ans=0
else:
  x=l%2019
  y=r%2019
  ans=10**4
  for i in range(x,y+1):
    for j in range(i+1,y+1):
      z=(i*j)%2019
      if z<ans:
        ans=z
print(ans)

Solution (Python):
from __future__ import print_function

import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return




















































def crange(l,r):
    return range(l,r+1)


def main():
    l,r = map(int, input().strip().split())

    if l//2019 < r//2019:
        print(0)
    else:
        l=l % 2019
        r=r%2019
        ans=sys.maxsize
        for i in crange(l,r):
            for j in crange(i+1,r):
                ans=min(ans,(i*j)%2019)
        print(ans)
    return

if __name__ == '__main__':
    main()

Solution (Python):
L,R = map(int,input().split())
sa = R - L
ans = 2020
if sa > 673:
	print("0")
else:
	for i in range (L,R):
		for j in range (i+1,R+1):
			tmp = (i * j) % 2019
			if ans > tmp:
				ans = tmp
	print(ans)

Solution (Python):
L,R = map(int,input().split())
sa = R - L
ans = 2020
if sa > 2019:
	print("0")
else:
	for i in range (L,R):
		for j in range (i+1,R+1):
			tmp = (i * j) % 2019
			if ans > tmp:
				ans = tmp
	print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    mod = 2019
    l, r = map(int, input().split())
    l_div = l // mod
    if mod * (l_div + 2) < r:
        print(0)
        quit()
    elif mod * (l_div + 1) < r:
        print(1)
        quit()
    ans = 2020
    r_mod_1 = r % mod + 1
    for i in range(l % mod, r_mod_1):
        for j in range(i+1, r_mod_1):
            ij_mod = i * j % mod
            if ans > ij_mod:
                ans = ij_mod
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    mod = 2019
    l, r = map(int, input().split())
    l_div = l // mod
    if mod * (l_div + 2) < r:
        print(0)
        quit()
    elif mod * (l_div + 1) < r:
        print(1)
        quit()
    ans = 2020
    r_mod = r % mod
    for i in range(l % mod, r_mod + 1):
        for j in range(i+1, r_mod + 1):
            ans = min(ans, i * j % mod)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
L, R = map(int, input().split())
if R - L >= 2019:
    can = list(range(2019))
else:
    L = L%2019
    R = R%2019
    can = []
    if R - L >= 2019:
        can = list(range(2019))
        print(1)
    elif L < R:
        can = list(range(L, R+1))
    elif L==R:
        print(L%2019)
        exit(0)
    else:
        can = list(range(L, 2019))+list(range(0, R+1))

ans = float('inf')
for i in range(len(can)-1):
    for j in range(i+1, len(can)):
        tmp = can[i]*can[j]%2019
        if ans >= tmp:
            ans = tmp
        if ans==0:
            print(0)
            exit(0)
ans = max(ans, 0)
print(ans%2019)

Solution (Python):
l,r=map(int,input().split())
if (l-1)//2019!=r//2019:
    print(0)
else:
    t=[]*(r-l+1)
    for i in range(l,r):
        for j in range(l+1,r+1):
            t.append(i*j%2019)
    print(min(t))

Solution (Python):
l, r  = map(int, input().split())
ans = 10000
for i in range(l, min(r, l + 2030)):
    for j in range(i + 1, min(r + 1, l + 2030)):
        ans = min(ans, (i * j) % 2019)
        if ans == 0:
            print(ans)
            exit()
print(ans)

Solution (Python):
l, r  = map(int, input().split())
ans = 10000
for i in range(l, min(r, l + 2030)):
    for j in range(i + 1, min(r + 1, l + 2030)):
        ans = min(ans, (i * j) % 2019)
print(ans)

Solution (Python):
l, r  = map(int, input().split())
ans = 10000
for i in range(l, min(r, l + 2019)):
    for j in range(i + 1, min(r + 1, l + 2019)):
        ans = min(ans, (i * j) % 2019)
print(ans)

Solution (Python):
l, r = map(int, input().split())
if r-l>= 2019:
	print(0)
else:
	a = 10**9
	for i in range(l,r+1):
		for j in range(i+1,r+1):
			a = min((i*j)%2019,a)
	print (a)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

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

if R - L > 1000:
    print(0)
    exit()
x = np.arange(L, R + 1)
x = x[:, None] * x[None, :] % 2019
np.fill_diagonal(x, 2019)
answer = x.min()
print(answer)

Solution (Python):

import sys

MOD = 2019  

def solve(L: int, R: int):
    if R-L >= 2018:
        print(0)
        return 
    
    lr_all = list(range(L,R+1))
    answer = 2019
    for i in range(R-L+1):
        for j in range(i+1,R-L+1):
            answer = min(lr_all[i]*lr_all[j]%MOD,answer)
    
    print(answer)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  
    R = int(next(tokens))  
    solve(L, R)

if __name__ == '__main__':
    main()

Solution (Python):


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

ans=2019

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

Solution (Python):
l,r=map(int,input().split())
count=2019
for i in range(l,r):
    for j in range(i+1,r+1):
        count=min(count,(i*j)%2019)
        if i*j%2019==0:
            break
    if i*j%2019==0:
        break
print(count)

Solution (Python):
l, r = map(int, input().split())

if r - l >= 2019:
    print(0)
else:
    ans = 2018
    for i in range(l, r + 1):
        for j in range(l, r + 1):
            if i >= j:
                continue
            else:
                ans = min(ans, i * j % 2019)

    print(ans)

Solution (Python):


L, R = map(int, input().split())
ans = 10 ** 10

for i in range(L, R+1):
    if ans == 0:
        break
    for j in range(i+1, R+1):
        ans = min(ans, (i * j) % 2019)
        if ans == 0:
            break

print(ans)

Solution (Python):
l, r = map(int, input().split())
if r - l >= 2019:
    print(0)
    exit()
minn = 2*(10**9)*2
for i in range(l, r+1):
    for j in range(i+1, r+1):
        minn = min(minn, i * j % 2019)
print(minn)

Solution (Python):
L, R = map(int, input().split())
M = 2019


def solve():
    if (R - L) > M:
        return 0

    ans = M
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min((i * j) % M, ans)
    return ans


print(solve())

Solution (Python):
L, R = map(int, input().split())
M = 2019


def solve():
    if (R - L) > M:
        return 0

    m = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            if (i * j) % 2019 < m:
                m = (i * j) % 2019
    return m


print(solve())

Solution (Python):
L,R=map(int,input().split())
l=L%2019
r=R%2019
if R-L>2018:
  print(0)
else:
  if l>r:
    print(0)
  else:
    ans=2019
    for i in range(r-l):
      for j in range(r-l-i):
        x=((l+i)*(l+i+j+1))%2019
        ans=min(ans,x)
    print(ans)

Solution (Python):
l,r = map(int,input().split())

if r-l >= 2019:
    ans = 0
else:
    ans = 2018
    for i in range(r-l):
        for j in range(i+1,r-l+1):
            mod = ((l+i)*(l+j))%2019
            if ans > mod:
                ans = mod

print(ans)

Solution (Python):
import numpy as np
import copy

def main():
    l, r = map(int, input().split())
    
    ans_tmp = 2019
    if r-l >= 2019:
        ans_tmp = 0
    else:
        for j in range(r-l):
            for k in range(j,r-l):
                ans = ((l+j)*(l+(k+1)))% 2019
                if ans == 0:
                    ans_tmp = 0
                    break
                elif ans < ans_tmp:
                    ans_tmp = ans
                
        
    print(ans_tmp)

if __name__ == '__main__':
    main()

Solution (Python):
l,r = map(int,input().split())

if r-l >= 2019:
    ans = 0
else:
    ans = 2018
    for i in range(r-l):
        for j in range(i+1,r-l+1):
            mod = ((l+i)*(l+j))%2019
            if ans > mod:
                ans = mod

print(ans)

Solution (Python):
l,r = map(int,input().split())
r = min(l+2019,r)

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

Solution (Python):
import numpy as np

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

if R - L >= 2019:
    ans = 0
else:
    A = np.arange(L, R + 1) % 2019
    B = A.reshape(1, -1)
    C = (A.reshape(-1, 1) * B) % 2019
    r = np.arange(len(A))
    C[r, r] = 2019
    ans = np.min(C)

print(ans)

Solution (Python):
L, R = map(int, input().split())

if R - L >= 2019:
    ans = 0
else:
    ans = 2019
    for i in range(L, R):
        x = i % 2019
        for j in range(i + 1, R + 1):
            a = x * j
            ans = min(a % 2019, ans)

print(ans)

Solution (Python):
l,r=map(int,input().split())
n=r-l if r-l < 2019 else 2019
ans=(r*l)%2019
for i in range(l, l+n+1):
  for j in range(i+1, l+n+1):
    ans=min(ans, (i*j)%2019)
print(ans)

Solution (Python):
l,r = map(int,input().split())
if r-l>=2019 :
    print(0)
else :
    x=[i*j%2019 for i in range(l, r) for j in range(i+1, r+1)]
    print(min(x))

Solution (Python):
L,R=[int(s) for s in input().split()]
if R-L>2018:
  print(0)
else:
  Lmod=L%2019
  Rmod=R%2019
  if Rmod<Lmod:
    print(0)
  else:
    ans=set()
    for i in range(Lmod,Rmod):
      for j in range(i+1,Rmod+1):
        ans.add(i*j%2019)
    print(min(ans))

Solution (Python):
from itertools import combinations
L, R = map(int, input().split())
for i in range(L, R+1):
    if i % 2019 == 0:
        print(0)
        break
else:
    print(min(i * j % 2019 for i, j in combinations(range(L, R+1), 2)))

Solution (Python):
L,R=map(int, input().split())

mod=2019
if L//mod != R//mod:
    print(0)
else:
    ans=2018
    for i in range(L,R):
        for j in range(i+1,R+1):
            ans=min(ans,(i*j)%mod)
            if ans==0:
                break
        else:
            continue
        break
    print(ans)

Solution (Python):

l,r = map(int,input().split())
if r-l > 2019:
    print(0)
    exit(0)
m = 2019
for i in range(l,r):
    for j in range(l,r+1):
        if i != j and (i*j)%2019 < m:
            m = (i*j)%2019
print(m)

Solution (Python):
l, r = map(int, input().split())
a = 10**5
for i in range(l,r+1):
	for j in range(i+1,r+1):
		a = min(a,i*j%2019)
		if a == 0:
			print (0)
			exit()
print (a)

Solution (Python):
l, r = map(int, input().split())
a = 10**5
if r - l >= 2017:
	print (0)
	exit()
else:
	for i in range(l,r+1):
		for j in range(i+1,r+1):
			a = min(a,i*j%2019)
print (a)

Solution (Python):
l,r = map(int,input().split())
a = 2019
for i in range(l,r+1) :
    if a == 0:
        break
    else :
        for j in range(i+1,r+1) :
            x = (i*j)%2019
            if x == 0 :
                a = x
                break
            else :
                if x<=a:
                    a = x
print(a)

Solution (Python):

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

ans = 2019
if R-L>2019:
    print(0)
else:
    for l in range(L, R):
        for r in range(l + 1, R+1):
            tmp = (l * r) % 2019
            
            ans = min(ans, tmp)
            if ans == 0:
                break
    print(ans)

Solution (Python):
def calculate(l,r):
    K = 2019

    min = r*r

    if r > l + K * 2:
        r = l + K * 2

    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ret = (i*j) % K
            if ret < min:
                min = ret
                if min == 0:
                    return min

    return min

S = input().split()

L = int(S[0])
R = int(S[1])

print(calculate(L,R))

Solution (Python):
L,R = map(int,input().split())
if R - L > 2019:
        print(0)
else:
    ans = 10**9
    for i in range(L,R):
        for j in range(i+1,R+1):
            if ans > i*j%2019:
                ans = i*j%2019
                if ans == 0:
                    break
    print(ans)

Solution (Python):
l, r = map(int, input().split())

a = 2018

for i in range(l, r):

    for j in range(i + 1, r + 1):
        a = min(a, (i * j) % 2019)
        if a == 0:
            print(a)
            exit()

print(a)

Solution (Python):
L, R = map(int, input().split())
ans = 2018
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % 2019)
        if ans == 0:
            print(ans)
            exit()
print(ans)

Solution (Python):
L, R = map(int, input().split())
ans = 2018
for i in range(L, min(L + 2019, R) + 1):
    for j in range(i + 1, min(L + 2019, R) + 1):
        ans = min(ans, (i * j) % 2019)
print(ans)

Solution (Python):
import itertools
L,R=map(int,input().split())

A=[]
D=[]

if R-L+1<2019:
    for i in range(R-L+1):
        A.append((i+L)%2019)

    if A.count(1)>=2:
        B=set(A)
        B.add(1)
    else:
        B=set(A)

    C=list(itertools.combinations(B,2))
    for j in range(len(C)):
        D.append(C[j][0]*C[j][1]%2019)
    E=sorted(D)
    print(E[0])
else:
    print(0)

Solution (Python):
l,r=map(int,input().split())
if r - l >= 2019:
    print(0)
    exit()
g = list([i%2019 for i in range(l,r+1)])
m=[]
for i in range(len(g)-1):
    for j in range(i+1,len(g)):
        m.append(g[i]*g[j]%2019)
print(min(m))

Solution (Python):
def main():
    lr = list(map(int, input().split()))
    divmod_lr = [divmod(x, 2019) for x in lr]

    if divmod_lr[0][1] == 0 or divmod_lr[1][1] == 0 or divmod_lr[0][0] != divmod_lr[1][0]:
        ans = 0
    else:
        ans = (2 * (10**9) + 10)**2
        for i in range(lr[0], lr[1]+1):
            for j in range(i+1, lr[1]+1):
                temp = (i * j) % 2019
                ans = min(ans, temp)

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
l, r = map(int, input().split())
if r - l >= 2019:
    print(0)
    exit()
ans1 = []
for i in range(l, r + 1):
    ans1.append(i % 2019)
ans2 = []
for i in range(len(ans1) - 1):
    for j in range(i + 1, len(ans1)):
        ans2.append((ans1[i]* ans1[j]) % 2019)
print(min(ans2))

Solution (Python):
L,R = map(int, input().split())
if R - L >= 2018:
    print(0)
    exit()
else:
    ans = 2019**2
    for i in range(L, R):
        for j in range(i+1, R+1):
            i %= 2019
            j %= 2019
            k = (i*j) % 2019
            ans = min(ans, k)
    print(ans)

Solution (Python):
L,R = map(int, input().split())
if R - L >= 2018:
    print(0)
    exit()
else:
    ans = 2019**2
    for i in range(L, R):
        for j in range(i+1, R+1):
            
            
            k = (i*j) % 2019
            ans = min(ans, k)
    print(ans)

Solution (Python):
L,R = map(int, input().split())

ANS = 2020
if R - L <= 2019:
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      
      
      ANS = min(ANS, (i * j) % 2019)
        
else:
  ANS = 0
print(ANS)

Solution (Python):
L,R=map(int,input().split())
ans=2019
if R-L>=2019:
    ans=0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            if (i*j)%2019<ans:
                ans=(i*j)%2019
print(ans)

Solution (Python):
l, r = map(int, input().split())

ans = 2019
if r - l >= 2019:
    ans = 0
    pass
else:
    for i in range(l, r):
        for j in range(i+1, r+1):
            if (i*j) % 2019 < ans:
                ans = (i*j) % 2019
            
print(ans)

Solution (Python):
L, R = map(int, input().split())
ql = L//2019
qr = R//2019
rl = L%2019
rr = R%2019
if ql != qr:
    print(0)
else:
    listans = []
    for i in range(rl,rr):
        for j in range(i+1,rr+1):
            ans = (i*j)%2019
            listans.append(ans)
    print(min(listans))

Solution (Python):
import itertools

l, r = map(int, input().split())

if l // 2019 != r // 2019:
    print(0)
else:
    min_value = 2 * 10 ** 9
    for i in itertools.permutations(range(l, r + 1), 2):
        ixj = i[0] * i[1]
        min_value = min(min_value, ixj % 2019)
    print(min_value)

Solution (Python):
L,R=map(int, input().split())  

ans = 2019
for i in range(L,R+1):
    for j in range(i+1, R+1):
        ans = min(ans, (i*j)%2019)
        if (ans == 0):
            print(0)
            exit()
print(ans)

Solution (Python):
import itertools
L,R = map(int,input().split())
if R-L >= 2018:
    ans = 0
else:
    a = min(L+2019, R+1)
    ij = [i%2019 for i in range(L, a)]
    ans = 2018
    for v in itertools.combinations(ij, 2):
        ans = min(ans, (v[0]*v[1])%2019)
print(ans)

Solution (Python):
import itertools
L,R = map(int,input().split())
if R-L >= 2018:
    ans = 0
else:
    ij = [i%2019 for i in range(L, min(L+2019, R+1))]
    ans = 2018
    for v in itertools.combinations(ij, 2):
        ans = min(ans, (v[0]*v[1])%2019)
print(ans)

Solution (Python):
import itertools
L,R = map(int,input().split())
if R-L >= 2018:
    ans = 0
else:
    ij = []
    for i in range(L, min(L+2019, R+1)):
        ij.append(i%2019)
    ans = 2018
    for v in itertools.combinations(ij, 2):
        ans = min(ans, (v[0]*v[1])%2019)
print(ans)

Solution (Python):
l,r=map(int,input().split())
if r-l>=2019 :
    print(0)
else:
    min=float("INF")
    for i in range(r-l):
        for j in range(i+1,r-l+1):
            if (l+i)*(l+j)%2019<min:
                min=(l+i)*(l+j)%2019
    print(min)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

L, R = MAP()
l = L/2019
r = R/2019

if R-L>2019:
	print(0)
	sys.exit()
elif str(l)[0]!=str(r)[0]:
	print(0)
	sys.exit()
else:
	min = float('INF')
	l = 0
	r = 0
	for i in range(L, R+1):
		for j in range(i, R+1):
			if i==j: continue
			mo = (i*j) % 2019
			if mo < min:
				min = mo
				l = i
				r = j
print(min)

Solution (Python):
l,r=map(int,input().split())
if r-l>=2019:
      print(0)
      exit()
ans=2019
for i in range(l,r):
      for j in range(l+1,r+1):
            ans=min(ans,(i*j)%2019)
print(ans)

Solution (Python):
L,R = map(int,input().split())
array = []
array2 = []
if R+1 - L <= 2019:
    for i in range(L,R+1):
        if i%2019 not in array2:
            array2.append(i%2019)

    for i in range(len(array2)):
        for j in range(len(array2)):
            if i < j:
                array.append((array2[i]*array2[j])%2019)
    print(min(array))
else:
    for i in range(1,2020):
        if i%2019 not in array2:
            array2.append(i%2019)

    for i in range(len(array2)):
        for j in range(len(array2)):
            if i < j:
                array.append((array2[i]*array2[j])%2019)
    print(min(array))

Solution (Python):
L, R = map(int, (input().split()))

ans = 2018
for i in range(L, min(R, L + 2018)):
    for j in range(i + 1, min(R + 1, L + 2019)):
        ans = min(ans, (i * j) % 2019)

print(ans)

Solution (Python):
L, R = map(int, input().split())
MOD = 2019

ans = 2019
if R - L >= MOD:
  ans = 0
else:
  r = R % MOD
  l = L % MOD
  if l > r:
    ans = 0
  else:
    for i in range(l, r):
      for j in range(i+1, r+1):
        ans = min(ans, (i * j)%MOD)
print(ans)

Solution (Python):
MOD = 2019
L, R = map(int, input().split())
ans = 2020
for i in range(L, R):
    for j in range(i+1, R+1):
        ans = min(ans, (i*j) % MOD)
        if ans == 0:
            break
    else:
        continue
    break
print(ans)

Solution (Python):
l,r=map(int,input().split())
m=2018*2019
for i in range(l,r+1):
  for j in range(i+1,r+1):
    m=min(m,(i*j)%2019)
    if m==0:
      print(m)
      exit()
print(m)

Solution (Python):
L,R = (int(i) for i in input().split())

num_list = []
if R-L >= 2019:
  num_list = [int(i) for i in range(0,2)]
else:
  num_list = [int(i) for i in range(L,R+1)]

ans = 2018
for i in range(len(num_list)):
  for j in range(i+1,len(num_list)):
    ans = min(ans,(num_list[i]*num_list[j])%2019)
print(ans)

Solution (Python):
L, R = map(int, input().split())

ans = 2019
mod = 2019

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

print(ans)

Solution (Python):
l, r = map(int, input().split())
ans = 100000000000000000
if r -l > 2019:
  print('0')
else:
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      if (i*j)%2019 <= ans:
        ans = (i*j)%2019
  print(ans)

Solution (Python):

import math
import heapq
import bisect

MOD = 2019

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

if R-L+1 >= MOD:
    ans=0
else:
    L = L%MOD
    R = R%MOD
    if R < L:
        ans=0
    else:
        ans=MOD
        for l in range(L,R):
            for r in range(l+1,R+1):
                ans=min(ans,l*r%MOD)

print(ans)

Solution (Python):
L, R = [int(i) for i in input().split(" ")]

flag=True
if (R - L) >= 2019:
  flag=False
  print(0)
else:
  min_mod = 2019
  for i in range(L, R):
    for j in range(i+1, R+1):
      tmp = (i*j) % 2019
      if tmp == 0:
        print(0)
        flag=False
        break
      elif tmp < min_mod:
        min_mod = tmp
    if flag==False:
      break

if flag==True:
  print(min_mod)

Solution (Python):
L,R=map(int,input().split())
ans=2019
if R-L>=2018:ans=0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            a = (i*j)%2019
            if a < ans:ans=a
print(ans)

Solution (Python):
l,r=map(int,input().split())
a=[]
if r-l>=2018:
  print(0)
else:
  for i in range(l,r):
    for j in range(i+1,r+1):
      a.append(i*j%2019)
  print(min(a))

Solution (Python):

import sys
L, R = map(int, sys.stdin.readline().split())

M =[]
f = False
for i in range(L, R+1):
    tmp = i%2019
    if tmp==0:
        print(0)
        f=True
        break
    M.append(tmp)

ans =2020
if f == False:
    for i in range(len(M)):
        for j in range(i+1, len(M)):
            tmp2 = (M[i]*M[j])%2019
            if ans > tmp2:
                ans = tmp2
    print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

M = 2019
L, R = map(int, input().split())
if R-L > M//3:
    print(0)
    exit(0)

L %= M
R %= M
if L>=R:
    R += M

res = 2222
for i in range(L,R):
    for j in range(i+1,R+1):
        res = min(res, i*j%M)

print(res)

Solution (Python):
L,R = map(int,input().split())

switch = (R-L+1)/2019
if switch < 1:
    answer = 2019
    for i in range(L,R):
        for j in range(i+1,R+1):
            answer = min(answer, (i*j)%2019)
    print(answer)
else:
    print(0)

Solution (Python):
def main():
    L, R = map(int, input().split())
    
    if L + 672 <= R:
        print(0)
        return
    lst = []
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            lst.append(i * j % 2019)
            m = i * j % 2019
            if m == 0:
                break
        if m == 0:
            break
    print(min(lst))
    return


main()

Solution (Python):
L, R = list(map(int, input().split()))
ans = 2018
for i in range(L, min(R, L + 2019) + 1):
    for j in range(i + 1, min(R, L + 2019) + 1):
        ans = min(ans, ((i % 2019) * (j % 2019)) % 2019)
print(ans)

Solution (Python):
import sys
l,r = map(int, input().split())
if r-l >= 2019:
    print(0)
    sys.exit()
ans = 10 ** 9
for i in range(l,r):
    for j in range(i+1,r+1):
        ans = min(ans,(i*j)%2019)
print(ans)

Solution (Python):
L,R=map(int, input().split())
from itertools import permutations, combinations,combinations_with_replacement,product
if (R+1-L)<2019:
  LR = range(L,R+1)
  LRA = []
  for i in LR:
    LRA.append(i%2019)
  LRAA = set(LRA)
  C = combinations(LRAA, 2)
  Ret = 2019
  for i in list(C):
    Ret = min(Ret,(i[0]*i[1])%2019)
else:
  Ret = 0
print(Ret)

Solution (Python):
L,R=map(int, input().split())
LR = range(L,R+1)
from itertools import permutations, combinations,combinations_with_replacement,product
if (R+1-L)<2019:
  C = combinations(LR, 2)
  Ret = 2019
  for i in list(C):
    Ret = min(Ret,(i[0]*i[1])%2019)
else:
  Ret = 0
print(Ret)

Solution (Python):
L, R = map(int, input().split())
ans = float('inf')
for i in range(L, R+1):
    for j in range(i+1, R+1):
        ans = min(ans, i * j % 2019)
        if ans == 0:
            print(0)
            exit()
print(ans)

Solution (Python):
l,r=map(int,input().split())

a=0
if r-l<2019:
  a=min([x*y%2019 for x in range(l,r+1) for y in range(x+1,r+1)])
print(a)

Solution (Python):
def resolve():
    l, r = list(map(int, input().split()))
    if r-l >=2018:
        print(0)
    else:
        ans = 2020
        for i in range(l,r):
            for j in range(l+1,r+1):
                ans = min(ans, (i*j) % 2019)
        print(ans)
resolve()

Solution (Python):
l,r=map(int,input().split())
if r-l>=2019:
    print(0)
    exit()
mini=2019
for i in range(l,r):
    for j in range(i+1,r+1):
        tmp=i*j%2019
        mini=min(mini,tmp)
print(mini)

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    l, r = list(map(int, readline().split()))
    t = 10 ** 20
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            t = min(t, (i * j) % 2019)
            if t == 0:
                print(t)
                exit()
    print(t)


if __name__ == '__main__':
    solve()

Solution (Python):
import sys
input = sys.stdin.readline
L, R = [int(x) for x in input().strip().split()]
MODL, MODR = L % 2019, R % 2019
if R - L >= 2019 or MODL > MODR:
  print(0)
else:
  print(min([(i * j) % 2019 for i in range(L, R) for j in range(i+1, R+1)]))

Solution (Python):
l,r=map(int,input().split())

ans=2019
if r-l>=2019:
    print(0)
    exit()
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans=min(ans,(i*j)%2019)

print(ans)

Solution (Python):
mi = lambda : map(int, input().split())

l, r = mi()

if r-l>2019:
    r = l+2019

ans = 2018
for i in range(l, r+1):
    for j in range(l, r+1):
        if i<j and ans>(i*j)%2019:
            ans = (i*j)%2019
print(ans)

Solution (Python):
l,r=map(int,input().split())
min1=2018
if r-l>=2018:
  print(0)
  exit()
else:
  for i in range(l,r):
    for j in range(i+1,r+1):
      min1=min(i*j%2019,min1)
print(min1)

Solution (Python):
L,R = map(int, input().split())
if (R-L) > 2019:
    R = L+2019
ans = 2019**2
for i in range(L,R+1):
    for j in range(L,R+1):
        if i == j:
            continue
        elif ans > (i*j)%2019:
            ans = (i*j)%2019
            if ans == 0:
                print(ans)
                quit()
print(ans)

Solution (Python):
L, R = map(int, input().split())
min_mod = 10**9
for i in range(L, min(L + 2019, R + 1)):
    for j in range(i + 1, min(L + 2019, R + 1)):
        min_mod = min(min_mod, (i * j) % 2019)
print(min_mod)

Solution (Python):
tmp = list(map(int,input().split()))
L = tmp[0] % 2019
R = tmp[1] % 2019
l = tmp[0]//2019
r = tmp[1]//2019
if l == r:
  if tmp[1] - tmp[0] > 673:
    print(0)
  else:
    num_list = []
    for i in range(tmp[0],tmp[1]+1,1):
      for k in range(i+1,tmp[1]+1,1):
        num_list.append((i*k) % 2019)
    print(min(num_list))
else:
  print(0)

Solution (Python):
L,R=map(int,input().split())
cnt=0
c=L//2019
d=R//2019+1
for i in range(c,d+1):
    if L<=2019*i<=R:
        cnt+=1
        break
if cnt==1:
    print(0)
else:
    ans=100000
    for i in range(L,R+1):
        for j in range(L,R+1):
            if i==j:
                continue
            else:
                if ans>i*j%2019:
                    ans=i*j%2019
    print(ans)