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):
l, r = map(int, input().split())
ans = 2018**2
ll = min(l+2019, r)+1
for i in range(l, ll):
    for j in range(i+1, ll):
        ans = min(ans, i*j%2019)
        if ans == 0:
            break
print(ans)

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

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

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

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

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

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

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

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

Solution (Python):

MOD = 2019
def main():
    l, r = map(int, input().split())
    if r - l >= MOD:
        print(0)
        return
    ans = 2018
    for i in range(l, r):
        for j in range(i+1, r+1):
            v = (i*j)%MOD
            ans = min(ans, v) 
    print(ans)
main()

Solution (Python):

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

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

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

Solution (Python):
import math

div1 = 3
div2 = 673

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

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

min_v = 2018

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

print(min_v)

Solution (Python):
import math

div1 = 3
div2 = 673

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

min_v = 2018

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

print(min_v)

Solution (Python):
def main():
    L, R = (int(i) for i in input().split())
    if R - L >= 2018:
        return print(0)
    MOD = 2019
    ans = 2019
    for i in range(L, R):
        for j in range(i+1, R+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:
  print(0)
else:
  ans = 2019
  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())

count_limit = 0 
min_num = 2020
for i in range(L, R+1):

    count_limit_j = 0
    for j in range(i+1, R+1):
        min_num = min(min_num, (i*j)%2019)
        count_limit_j = count_limit_j + 1
        if count_limit_j>2020:
            break

    
    count_limit = count_limit + 1
    if count_limit>2020:
        break

print(min_num)

Solution (Python):
ll, rr = map(int, input().split())
if rr - ll >= 2019:
    print(0)
    exit()

l = ll % 2019
r = rr % 2019

if l > r:
    print(0)
    exit()

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

print(ans)

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

Solution (Python):
l, r = map(int, input().split())
if r-l+1 >= 2019:
    print(0)
else:
    l %= 2019
    r %= 2019
    if l <= r:
        ans = float('inf')
        for i in range(l, r):
            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())
mod=2019
ans=2018
if r-l+1>=2019 or r%mod<l%mod:
    ans=0
else:
    for i in range(l%mod,r%mod):
        for j in range(i+1,r%mod+1):
            temp=(i*j)%mod
            ans=min(ans,temp)

print(ans)

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

LENGTH = (R-L+1) / MOD
if LENGTH < 1:
    ans = float("inf")
    for i in range(L, R):
        for j in range(i+1, R+1):
            ans = min(ans, (i * j) % MOD)
    print(ans)
else:
    print(0)

Solution (Python):
l,r = list(map(int,input().split()))
a = 201900000
if r-l > 2018:
    a= 0

l %= 2019
r %= 2019

L = min(l,r)
R = max(l,r)


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











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    L,R=MI()
    ans = inf
    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)
if __name__ == '__main__':
    main()

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

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

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

dl, ml = divmod(L, 2019)
dr, mr = divmod(R, 2019)

if dl < dr:
    ans = 0
else:
    ans = 10 ** 18
    for x in range(L, R):
        for y in range(x + 1, R + 1):
            ans = min(ans, (x * y) % 2019)

print(ans)

Solution (Python):
L, R = map(int, input().split())
M = (L+2019-1)//2019*2019

if M<=R:
    print(0)
    exit()

ans = 10**18

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

print(ans)

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    L, R = map(int, input().split())
    if R - L >= 2019: print(0)
    else:
        minMod = 2019
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                minMod = min((i * j) % 2019, minMod)
        print(minMod)

    return 0

if __name__ == "__main__":
    solve()

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(i+1,R+1):
        ans = min(ans, (i*j)%2019)
print(ans)

Solution (Python):
l, r = map(int, input().split())
min_score = 2019
found = False
for i in range(l, r + 1):
  for j in range(i + 1, r + 1):
    if (i * j) % 2019 == 0:
      print(0)
      found = True
      break
    elif (i * j) % 2019 < min_score:
      min_score = (i * j) % 2019
  if found:
    break
if not found:
  print(min_score)

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

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

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

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

ans = pow(10,9)+7
for i in range(L,R):
  for j in range(i+1,R+1):
    val = ((i%mod) * (j%mod))%mod
    ans = min(ans, val)
    if ans == 0:
      break
  if ans == 0:
    break

print(ans)

Solution (Python):

L, R = map(int, input().split())
mod = 2019
ans = float("inf")
for i in range(L, R + 1):
    i_mod = i % mod
    if i_mod == 0:
        ans = 0
        break
    for j in range(i + 1, R + 1):
        j_mod = j % mod
        if j_mod == 0:
            ans = 0
            break
        else:
            ans = min(ans, i * j % mod)
print(ans)

Solution (Python):



def main():
  l, r = map(int, input().strip().split())
  x = 2019
  remains = [l%x]
  for i in range(l+1, r+1):
    remain = i % x
    if remains[0] == remain:
      break
    remains.append(remain)
    
  min = x
  for i in range(len(remains)-1):
    for j in range(i+1, len(remains)):
      remain = (remains[i] * remains[j]) % x
      if remain < min:
        min = remain
  print(min)

if __name__=='__main__':
  main()

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 + 1):
        for j in range(i + 1, r + 1):
            t = min(t, i * j % 2019)
            if t == 0:
                break
        if t == 0:
            break
    print(t)


if __name__ == '__main__':
    solve()

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

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

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

Solution (Python):
l,r = map(int, input().split())
if r - l > 2019:
    ans = 0
else:
    ans = 2018
    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):
l,r = map(int,input().split())
ml = l % 2019
mr = r % 2019
if mr <= ml:
    print(0)
else:
    if r-l >= 2019:
        print(0)
    else:
        ans = float('inf')
        for i in range(ml,mr+1):
            for j in range(i+1,mr+1):
                ans = min(ans,(i*j)%2019)
        print(ans)

Solution (Python):
i,j=map(int,input().split())
if j-i>=2019:
  print(0)
elif j%2019<i%2019:
  print(0)
else:
  min=2018
  for p in range(i,j):
    for q in range(p+1,j+1):
      if ((p%2019)*(q%2019))%2019<min:
        min=((p%2019)*(q%2019))%2019
  print(min)

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

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

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

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(i+1, r+1):
            ret = (i * j) % 2019
            ans = min(ans, ret)

    print(ans)

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(i+1,r+1):
            ans=min(ans,(i*j)%2019)
    print(ans)

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

Solution (Python):
import sys
import itertools as it
L, R = map(int, input().split())
if R-L > 2017: print(0); sys.exit()

DL = L % 2019
DR = R % 2019
if DL > DR: print(0); sys.exit()

print(min(x*y%2019 for x,y in it.combinations(range(DL, DR+1), 2)))

Solution (Python):
L,R=map(int,input().split())
if (R-L)>=2018:
  print(0)
else:
  ans=2019
  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())
miner = 2020
r = min(r,l+2020)
for i in range(l,r):
    for j in range(i+1,r+1):
        miner = min(miner,i*j%2019)
print(miner)

Solution (Python):
l,r = map(int,input().split())
ans = 1000000000000000000000000
if r-l >= 2019:
    print(0)
    exit()
else:
    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):
L, R = map(int, input().split())
min_rad = 2019
R_max = min(L+2019, R)
for i in range(L, R_max):
    for j in range(i+1, R_max+1):
        temp = i%2019 * j%2019
        if temp < min_rad:
            min_rad = temp
print(min_rad)

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

R_alt = min(L+2018, R)

ans = 2018 ** 2

for i in range(L, R_alt):
  for j in range(i+1, R_alt+1):
    tmp = i%2019 * j%2019
    if ans > tmp:
      ans = tmp

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 2019
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





l,r =mii()

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod
ans = 10**100
for i in range(l,r):
    for j in range(i+1,r+1):
        ans = min(ans,mul(i,j))
        if ans ==0:
            print(0)
            exit()
print(ans)

Solution (Python):
L, R = map(int, input().split())
L_mod = L % 2019
R_mod = R % 2019

if R - L >= 2019:
    Ans = 0
elif R_mod < L_mod:
    Ans = 0
elif R_mod > L_mod:
    Ans = 2019
    for i in range(L_mod, R_mod):
        for k in range(L_mod+1,R_mod+1):
            Ans = min(Ans,i*k % 2019)
        
print(Ans)

Solution (Python):
import sys

l, r = [int(_) for _ in input().split()]

res = 2019

res_l = l % 2019
res_r = r % 2019

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

print(res)

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

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

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

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

Solution (Python):
def main():
  
  L,R=map(int,input().split())
  x,y=L//2019,R//2019
  
  if y-x>=1:
    print(0)
    
  else:
    i=R
    k=1
    ans=float("inf")
    while(L<i):
      ans=min(ans,i*(i-k)%2019)
      if ans==0:
        print(0)
        break        
      k+=1
      if i-k<L:
        k=1
        i-=1
        
    else:
      print(ans)
      
if __name__=="__main__":
  main()

Solution (Python):
l,r=map(int,input().split())
ans=int(10000000)
if r-l>2019:
    print(0)
    exit()

for i in range(l,r):
    for j in range(i+1,r+1):
        now=int((i*j)%2019)
        if ans>now:
            ans=now

print(ans)

Solution (Python):
l,r=map(int,input().split())
ans=int(10000000)
if r-l>2019:
    print(0)
    exit()

for i in range(l,r):
    for j in range(i+1,r+1):
        now=int((i*j)%2019)
        if ans>now:
            ans=now

print(ans)

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

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

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

if r-l>=2018:
    print(0)

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

L, R = MAP()

if R < 2019:
	li = [i for i in range(L, (R + 1))]
	co = list(combinations(li, 2))
	mi = INF
	for x in co:
		mi = min(mi, (x[0]*x[1])%2019)
	print(mi)
	exit()
if R == 2019:
	print(0)
	exit()
if R > 2019:
	if R - L < 2019:
		li = [i for i in range(L, (R + 1))]
		co = list(combinations(li, 2))
		mi = INF
		for x in co:
			mi = min(mi, (x[0]*x[1])%2019)
		print(mi)
		exit()
	else:
		print(0)
		exit()

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

if R-L >= 672:
    print(0)
    
elif R-L == 1:
    print((L*R) % 2019)

elif R-L >= 2:
    for i in range(L//673, R//673 + 1):
        if L <= 673 * i <= R:
            print(0)
            break
    else:
        ans = 2018
        for i in range(L, R):
            for j in range(i+1, R+1):
                k = (i*j) % 2019
                if k < ans:
                    ans = k
        print(ans)

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

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

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

Solution (Python):
import sys

MOD = 2019

l, r = map(int, sys.stdin.readline().split())

def main():
    if r - l >= MOD - 1:
        return 0
    lm = l % MOD
    rm = r % MOD
    if lm == 0 or lm > rm:
        return 0
    else:
        res = MOD - 1
        for i in range(l, r):
            for j in range(i+1, r+1):
                res = min(res, i % MOD * j % MOD)
        return res
        
if __name__ == '__main__':
    ans = main()
    print(ans)

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

print(ans)

Solution (Python):
def main():
    import sys
    input=sys.stdin.readline
    L,R=map(int,input().split())

    if R-L>=2019:
        print(0)
    else:
        flag=False
        min_number=2019
        for i in range(L,R+1):
            for j in range(i+1,R+1):
                min_number=min(min_number,((i%2019)*(j%2019))%2019)
                if min_number==0:
                    print(0)
                    flag=True
                    break
            if flag:
                break
        if flag==False:
            print(min_number)
if __name__=="__main__":
    main()

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 = map(int, input().split())
ans = 2020
if l <= (l // 2019 + 1) * 2019 <= r:
    ans = 0
else:
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            tmp = i * j % 2019
            ans = tmp if tmp < ans else ans
            if ans == 0:
                break
print(ans)

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

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

Solution (Python):


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

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

MOD = 2019

if R - L >= MOD or L%MOD == 0 or R%MOD == 0:
    print(0)
else:
    LR = list(range(L, R+1))
    minimum = 2*10**9
    for i in range(len(LR)):
        l = LR[i]
        for r in LR[i+1:]:
            minimum = min(l*r%MOD, minimum)
    print(minimum)

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

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

print(ans)

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

Solution (Python):
L,R = [int(i) for i in input().split()]
if R - L > 2019:
    print(0)
    exit()
else:
    li = list(range(L,R+1))
    n = len(li)
ans = 10**9+7
for i in range(n-1):
    for j in range(i+1,n):
        count = (li[i]*li[j]) % 2019
        ans = min(ans,count)
        if ans == 0:
            print(0)
            exit()
print(ans)

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

if r-l>2019:
    print(0)
    exit(0)
else:
    a = list(range(l, r+1))

num = 0
ans = 2019

for i in range(len(a)):
    for j in range(len(a)):
        if a[i]<a[j]:
            num = (a[i]*a[j])%2019
            ans = min(ans, num)
            if ans == 0:
                print(0)
                exit(0)

print(ans)

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

ans = 10**9
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):
l,r = map(int,input().split())
minv = 2019
if r-l > 2019:
    minv = 0
else:  
    for i in range(l,r):
        for j in range(i+1,r+1):
            if minv > (i*j)%2019:
                minv = (i*j)%2019
            
        
print(minv)

Solution (Python):
L, R = (int(lr) for lr in input().split())
min_mod = 2019
has_found = False
for l in range(L, R):
    for r in range(l+1, R+1):
        mod = (l*r) % 2019
        if mod == 0:
            min_mod = 0
            has_found = True
            break
        else:
            min_mod = min(min_mod, mod)
    if has_found:
        break

print(min_mod)

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

Solution (Python):
import sys
from collections import deque, Counter, defaultdict
from fractions import gcd
input = sys.stdin.readline

def eprint(s):
    if type(s) != type('str'):
        s=str(s)

    sys.stderr.write(s+'\n')
    return

def main():
    l, r = map(int, input().split())
    if l <= 2019 and 2019 <= r:
        print(0)
        return 
    if r-l >= 2019:
        print(0)
        return

    m = 10**9

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

if __name__ == '__main__':
    main()

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

ans_list = []
for i in range(l, min(l+2019, r)):
  for j in range(i + 1, min(i + 2019, r + 1)):
    ans = (i * j) % 2019
    ans_list.append(ans)
    if ans == 0:
      break
print(min(ans_list))

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

print(solve())

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

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

Solution (Python):
l, r = list(map(int, input().split()))
ls = []
for i in range(l, (min((r + 1), (l + 2019)) - 1)):
    for j in range(i + 1, min((r + 1), (l + 2019))):
        ls.append(((i * j) % 2019))
print(min(ls))

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

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

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

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

print(ans)

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

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

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

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

Solution (Python):
L, R = list(map(int,input().split(" ")))
l = L % 2019
r = R % 2019

ans = 2019

if R - L >= 2018 or L > R:
    print("0")
else:
    array = list(range(l,r+1))
    for i in array:
        for j in array:
            if i == j:
                continue
            temp = i * j % 2019
            if ans > temp:
                ans = temp
    print(ans)

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

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

dif = R - L
_L, _R = L%2019,R%2019

if _R < _L:
  print(0)
elif _L < _R and dif >= 2018: 
  print(0)
elif _L < _R and dif < 2018:
  _m = (L*(L+1)%2019)
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      _m = min(_m,(i*j)%2019)
  print(_m)

Solution (Python):
l, r = map(int,input().split())
if  r - l >= 2019:
    print(0)
else:
    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):
i, j = map(int, input().split())
MOD = 2019
ans = float("inf")
for x in range(i, min(j+1, i+MOD)):
    for y in range(x+1, min(j+1, i+MOD)):
        ans = min(ans, x%MOD * y%MOD)
print(ans)

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

print(ans)

Solution (Python):
l, r = [int(x) for x in input().split()]

ans = 2200
for i in range(l, r):
    if i % 2019 == 0:
        ans = 0
        break
    else:
        for j in range(i+1, r+1):
            if i == j:
                continue
            elif j % 2019 == 0:
                ans = 0
                break
            else:
                tmpans = (i * j) % 2019
            ans = min(ans, tmpans)


print(ans)