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



Sample input:
2020 2040


Sample output:
2

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)

def main():
    L, R = map(int, sys.stdin.readline().rstrip().split())

    R = (L + R % 2019)
    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)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)

def main():
    L, R = map(int, sys.stdin.readline().rstrip().split())

    L %= 2019
    R %= 2019
    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)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)

def main():
    L, R = map(int, sys.stdin.readline().rstrip().split())

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

L_q = L // 2019
R_q = R // 2019
mod = 2018

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

    print(mod)

else:
    if R_q - L_q > 1:
        print(0)

    else:
        print(L * (L + 1) % 2019)

Submission status: Wrong Answer

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

L_q = L // 2019
R_q = R // 2019

if R_q - L_q > 1:
    print(0)

else:
    print(L * (L + 1) % 2019)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
if r-l >= 2019:
  print(0)
else:
	l = l%2019
	r = r%2019
	if l >= r:
  		print(0)
	else:
  		print(l*(l+1))

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
if l-r >= 2019:
  print(0)
else:
	l = l%2019
	r = r%2019
	if l >= r:
  		print(0)
	else:
  		print(l*(l+1))

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
l = l%2019
r = r%2019
if l >= r:
  print(0)
else:
  print(l*(l+1))

Submission status: Wrong Answer

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

l_mod = L % MOD
r_mod = R % MOD
if r_mod < l_mod:
    print(0)
else:
    min = (l_mod * (l_mod + 1)) % MOD
    for i in range(l_mod, r_mod):
        for j in range(i + 1, r_mod + 1):
            if ((i * j) % MOD) < min:
                min = (i * j) % MOD
    print(min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
if r-l>=2019:
  print(0)
  exit()
m0=l%2019
m1=r%2019
if m1<m0:
  print(0)
  exit()
else:
  print(m0*(m0+1)%2019)

Submission status: Wrong Answer

Solution code:
#C
l,r = map(int,input().split())
tmp = []
if r*(r-1) < 2019:
    print(r*(r-1))
    
else:
    if r - l > 2019 or l <= (r//2019) * 2019 <= r :
        print(0)       
    else:
        for i in range(l,r+1):
            for j in range(i,r+1):
                m = (i*j) % 2019
                tmp.append(m)
        print(min(tmp))

Submission status: Wrong Answer

Solution code:
#C
l,r = map(int,input().split())

if r*(r-1) < 2019:
    print(r*(r-1))
    
else:
    if r - l > 2019:
        print(0)
    elif l <= (r//2019) * 2019 <= r:
        print(0)
        
    else:    
        print(min((l*(l+1))%2019,(r*(r-1))%2019))

Submission status: Wrong Answer

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

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

A = []
for i in range(L, R + 1):
    A.append(i % 2019)

A.sort()
print((A[0] * A[1]) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if R - L >= 2019:
    print(0)
elif L <= 3 and R >= 673:
    print(0)
else:
    num_list = sorted(list(range(L, R + 1)))
    print((num_list[0] * num_list[1]) % 2019)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    l,r=map(int,input().split())
    l_m=l%2019
    r_m=r%2019
    if l//2019==r//2019:
        print(l_m*(l_m+1)%2019)
    else:print(0)

if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    l,r=map(int,input().split())
    l_m=l%2019
    r_m=r%2019
    if l//2019==r//2019:
        print(l_m*(l_m+1))
    else:print(0)

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
L = L % 2019

print(L * (L + 1))

Submission status: Wrong Answer

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

min = 4* (10**18)

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

        if min == 0:
            print("0")
            exit()

print(min)

Submission status: Wrong Answer

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

min = [2 * (10**9), 2 * (10**9)]

if r-l > 2019 * 2 + 1:
        print("0")
        exit()

for i in range(l, r + 1):
    if min[0] == 0:
        if min[1] == 0:
            print("0")
            exit()

        if i % 2019 < min[1]:
            min[1] = i % 2019
    else:
        if i % 2019 < min[0]:
            min.pop(0)
            min.append(i % 2019)

print(min[0]*min[1])

Submission status: Wrong Answer

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

min = [2 * (10**9), 2 * (10**9)]

for i in range(l, r + 1):
    if min[0] == 0:
        if min[1] == 0:
            print("0")
            exit()

        if i % 2019 < min[1]:
            min[1] = i % 2019
    else:
        if i % 2019 < min[0]:
            min.pop(0)
            min.append(i % 2019)

print(min[0]*min[1])

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
L %= 2019
R = R % 2019 if R - L < 2019 else R % 2019 + 2019
# print(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)
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
L %= 2019
R = R % 2019 if R - L < 2019 else R % 2019 + 2019
print(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)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
def main():
    l, r = map(int,input().split())
    if r - l >= 637:
        print(0)
        return
    l_mod = l % 2019
    r_mod = r % 2019
    ans = []
    if l_mod > r_mod :
        ans = [i for i in range(l_mod,2019)]
        ans.extend([i for i in range(r_mod+1)])
    else:
        ans = [i for i in range(l_mod,r_mod+1)]
    ans.sort()
    a = 2019
    for i in range(len(ans)):
        for j in range(len(ans)):
            a = min(a,(ans[i] * ans[j]) % 2019)
    print(a)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
def main():
    l, r = map(int,input().split())
    if r - l >= 637:
        print(0)
        return
    l_mod = l % 2019
    r_mod = r % 2019
    ans = []
    if l_mod > r_mod :
        ans = [i for i in range(l_mod,2019)]
        ans.extend([i for i in range(r_mod+1)])
    else:
        ans = [i for i in range(l_mod,r_mod+1)]
    ans.sort()
    print((ans[0] * ans[1]) % 2019)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
def main():
    l, r = map(int,input().split())
    if r - l >= 637:
        print(0)
        return
    l_mod = l % 2019
    r_mod = r % 2019
    ans = []
    if l_mod > r_mod :
        ans = [i for i in range(l_mod,2019)]
        ans.extend([i for i in range(r_mod+1)])
    else:
        ans = [i for i in range(l_mod,r_mod+1)]
    print(ans)
    ans.sort()
    print((ans[0] * ans[1]) % 2019)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
def main():
    l, r = map(int,input().split())
    l_mod = l % 2019
    r_mod = r % 2019
    ans = []
    if l_mod > r_mod :
        ans = [i for i in range(l_mod,2019)]
        ans.extend([i for i in range(r_mod+1)])
    else:
        ans = [i for i in range(l_mod,r_mod+1)]
    ans.sort()
    print((ans[0] * ans[1]) % 2019)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod = 2019
for i in range(L, R+1):
    for k in range(L+1, R+1):
        if (i*k)%2019 <= mod:
            mod = (i*k)%2019
print(mod)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
l=l%2019
r=r%2019
if r<=l:
  print(0)
  exit()
L=[]
for i in range(l,r+1):
  for k in range(i+1,r+1):
    L.append((i*k)%2019)
print(min(L))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
l=l%2019
r=r%2019
if r<l:
  print(0)
  exit()
L=[]
for i in range(l,r+1):
  for k in range(i+1,r+1):
    L.append((i*k)%2019)
print(min(L))

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
MOD = 2019
l = L%MOD
r = R%MOD
if l < r:
    print(l*(l+1))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
if R - L >= 2019:
    print(0)
else:
    if R//2019 - L//2019 == 1:
        print(0)
    else:
        l = L % 2019
        print(l*(l+1))

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
cnt = 0
mod_list = []
for i in range(l,r+1):
    mod_list.append(i%2019)
    cnt += 1
    if cnt == 5000:
        break
mod_list.sort()
print(mod_list[0]*mod_list[1]%2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
cnt = 0
mod_list = []
for i in range(l,r+1):
    mod_list.append(i%2019)
    cnt += 1
    if cnt == 5000:
        break
mod_list.sort()
print(mod_list[0]*mod_list[1])

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
cnt = 0
mod_list = []
for i in range(l,r+1):
    mod_list.append(i%2019)
    if cnt == 4000:
        break
mod_list.sort()
print(mod_list[0]*mod_list[1])

Submission status: Wrong Answer

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

if (2019-(L%2019))+L <= R:
  print(0)

else:
  print((L * (L+1))%2019)

Submission status: Wrong Answer

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

if (2019-(L%2019))+L <= R or L%2019 == 0:
  print(0)

else:
  print((L%2019) * ((L+1)%2019))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ll=2019*(l//2019)
rl=2019*(r//2019)
li=l%2019
ans=0
if ll==rl:
  ans=(li*(li+1)) % 2019
else:
  ans=0
print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ll=2019*(l//2019)
rl=2019*(r//2019)
ans=0
if ll==rl:
  ans=(l*(l+1))%2019
else:
  ans=0
print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ll=2019*(l//2019)
rl=2019*(r//2019)
ans=0
if ll==rl:
  ans=(l%2019)*((l+1)%2019)
else:
  ans=0
print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ll=2019*(l//2019)
rl=2019*(r//2019)
ans=0
if ll==rl:
  ans=l*(l+1)%2019
else:
  ans=0
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
import math

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

l,r=MI()
mod=[]
if r-l>=2019:
    rm=0
else:
    for i in range(l,r+1):
        mod.append(i%2019)
#print(mod)
mn=10**7
for i in range(len(mod)-1):
    for j in range(i+1,len(mod)):
        #print(mod[i],end=" ")
        #print(mod[j])
        ans=(mod[i]*mod[j])%2019
        if ans<mn:
            mn=ans
print(mn)

Submission status: Wrong Answer

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

if r-l >= 2018:
  print(0)
elif r%2019 - l%2019 == r-l:
  l %= 2019
  print((l*(l+1))%2019)
else:
  print(0)

Submission status: Wrong Answer

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

if r-l >= 2019:
  print(0)
elif l%2019 + (r-l) >= 2019:
  print(0)
else:
  l %= 2019
  print((l*(l+1))%2019)

Submission status: Wrong Answer

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

l %= 2019
r %= 2019

if l >= r:
  print(0)
else:
  print((l*(l+1))%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
l = L%2019
r = R%2019
Min_Answer = 2018

if l<r:
    for i in range(l,r+1):
        for j in range (i,r+1):
            if i ==j and L//2019 == R//2019:
                continue
            Answer = (i*j) % 2019
            Min_Answer = min(Answer,Min_Answer)
else:
    for i in range(r,l+1):
        for j in range (i,l+1):
            if i ==j and L//2019 == R//2019:
                continue
            Answer = (i*j) % 2019
            Min_Answer = min(Answer,Min_Answer)


print(Min_Answer)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
l = L%2019
r = R%2019
Min_Answer = 2018

if l<r:
    for i in range(l,r+1):
        for j in range (i+1,r+1):
            if i ==j and L//2019 == R//2019:
                continue
            Answer = (i*j) % 2019
            Min_Answer = min(Answer,Min_Answer)
else:
    for i in range(r,l+1):
        for j in range (i+1,l+1):
            if i ==j and L//2019 == R//2019:
                continue
            Answer = (i*j) % 2019
            Min_Answer = min(Answer,Min_Answer)


print(Min_Answer)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
l = L%2019
r = R%2019
Min_Answer = 2018

if l<r:
    for i in range(l,r+1):
        for j in range (i+1,r+1):
            if i ==j:
                continue
            Answer = (i*j) % 2019
            Min_Answer = min(Answer,Min_Answer)
else:
    for i in range(r,l+1):
        for j in range (i+1,l+1):
            if i ==j:
                continue
            Answer = (i*j) % 2019
            Min_Answer = min(Answer,Min_Answer)


print(Min_Answer)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
l = L%2019
r = R%2019
Min_Answer = 2018


for i in range(l,r+1):
    for j in range (i+1,r+1):
        if i ==j:
            continue
        Answer = (i*j) % 2019
        Min_Answer = min(Answer,Min_Answer)

print(Min_Answer)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
l = L%2019
r = R%2019
Min_Answer = 2018


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

print(Min_Answer)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
dif = 2020 if R-L+1 > 2020 else R-L+1
ans = [0]*dif
index = 0
for i in range(L, L+dif):
  ans[index] = i%2019
  index += 1
ans.sort()
print(ans[0]*ans[1])

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
dif = 2019 if R-L+1 > 2019 else R-L+1
ans = [0]*dif
index = 0
for i in range(L, L+dif):
  ans[index] = i%2019
  index += 1
ans.sort()
print(ans[0]*ans[1])

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
x = l % 2019
y = r % 2019
print(x*(x+1) if 0<x and x<y and r-l<2019 else 0)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
x = l % 2019
y = r % 2019
print(x*(x+1) if 0<x and x<y and l-r<2019 else 0)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
x = l % 2019
y = r % 2019
print(0 if x >= y else x*(x+1))

Submission status: Wrong Answer

Solution code:
l, r = [int(i) for i in input().split()]
if r - l >= 2018:
    print(0)
    exit()

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

print(mn)

Submission status: Wrong Answer

Solution code:
l, r = [int(i) for i in input().split()]
mn = [2019, 2019]
for i in range(l, r + 1):
    t = i % 2019
    if mn[0] > t: mn[0] = t
    elif mn[1] > t: mn[1] = t 
    if mn[0] == 0:
      break
print((mn[0] * mn[1]) % 2019)

Submission status: Wrong Answer

Solution code:
mod = 10 ** 9 + 7
mod2 = 2 ** 61 + 1
from collections import deque
import heapq
from bisect import bisect_left, insort_left, bisect_right

_NUMINT_ALL = list(range(10))


def main():
    ans = solve()
    if ans is not None:
        print(ans)


def solve():
    L, R = iip(False)
    L %= 2019
    R %= 2019

    if L >= R or L == 0 or R == 0:
        return 0

    if L + 1 == R:
        return (L*R) % 2019

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

    return mm % 2019



#####################################################ライブラリ集ここから

def iip(listed=True, num_only=True):
    if num_only:
        ret = [int(i) for i in input().split()]
    else:
        ret = [int(i) if i in _NUMINT_ALL else i for i in input().split()]

    if len(ret) == 1 and not listed:
        return ret[0]
    return ret


def sort_tuples(l, index):
    if isinstance(l, list):
        l.sort(key=lambda x: x[index])
        return l
    else:
        l = list(l)
        return sorted(l, key=lambda x: x[index])


def count_elements(l):
    d = {}
    for i in l:
        if i in d:
            d[i] += 1
        else:
            d[i] = 1
    return d


def safeget(l, index, default="exception"):
    if index >= len(l):
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。配列の長さは", len(l), "です"]))
        else:
            return default
    elif index < 0:
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。負の値は許可されていません"]))
        else:
            return default
    else:
        return l[index]


def iipt(l, listed=False, num_only=True):
    ret = []
    for i in range(l):
        ret.append(iip(listed=listed, num_only=num_only))
    return ret


def sortstr(s):
    return "".join(sorted(s))


def iip_ord(startcode="a"):
    if isinstance(startcode, str):
        startcode = ord(startcode)
    return [ord(i) - startcode for i in input()]


def YesNo(s):
    if s:
        print("Yes")
    else:
        print("No")


def fprint(s):
    for i in s:
        print(i)


def bitall(N):
    ret = []
    for i in range(2 ** N):
        a = []
        for j in range(N):
            a.append(i % 2)
            i //= 2
        ret.append(a)
    return ret


def split_print_space(s):
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def koenai_saidai_x_index(sorted_list, n):
    l = 0
    r = len(sorted_list)
    if len(sorted_list) == 0:
        return False
    if sorted_list[0] > n:
        return False

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] == n:
            return x
        elif sorted_list[x] > n:
            r = x
        else:
            l = x
    return l


def searchsorted(sorted_list, n, side="left"):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        # print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        # print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod - 2)


def power(n, p, mod_=mod):
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
mod = 10 ** 9 + 7
mod2 = 2 ** 61 + 1
from collections import deque
import heapq
from bisect import bisect_left, insort_left, bisect_right

_NUMINT_ALL = list(range(10))


def main():
    ans = solve()
    if ans is not None:
        print(ans)


def solve():
    L, R = iip(False)
    L %= 2019
    R %= 2019

    if L >= R or L == 0 or R == 0:
        return 0

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

    return mm % 2019



#####################################################ライブラリ集ここから

def iip(listed=True, num_only=True):
    if num_only:
        ret = [int(i) for i in input().split()]
    else:
        ret = [int(i) if i in _NUMINT_ALL else i for i in input().split()]

    if len(ret) == 1 and not listed:
        return ret[0]
    return ret


def sort_tuples(l, index):
    if isinstance(l, list):
        l.sort(key=lambda x: x[index])
        return l
    else:
        l = list(l)
        return sorted(l, key=lambda x: x[index])


def count_elements(l):
    d = {}
    for i in l:
        if i in d:
            d[i] += 1
        else:
            d[i] = 1
    return d


def safeget(l, index, default="exception"):
    if index >= len(l):
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。配列の長さは", len(l), "です"]))
        else:
            return default
    elif index < 0:
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。負の値は許可されていません"]))
        else:
            return default
    else:
        return l[index]


def iipt(l, listed=False, num_only=True):
    ret = []
    for i in range(l):
        ret.append(iip(listed=listed, num_only=num_only))
    return ret


def sortstr(s):
    return "".join(sorted(s))


def iip_ord(startcode="a"):
    if isinstance(startcode, str):
        startcode = ord(startcode)
    return [ord(i) - startcode for i in input()]


def YesNo(s):
    if s:
        print("Yes")
    else:
        print("No")


def fprint(s):
    for i in s:
        print(i)


def bitall(N):
    ret = []
    for i in range(2 ** N):
        a = []
        for j in range(N):
            a.append(i % 2)
            i //= 2
        ret.append(a)
    return ret


def split_print_space(s):
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def koenai_saidai_x_index(sorted_list, n):
    l = 0
    r = len(sorted_list)
    if len(sorted_list) == 0:
        return False
    if sorted_list[0] > n:
        return False

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] == n:
            return x
        elif sorted_list[x] > n:
            r = x
        else:
            l = x
    return l


def searchsorted(sorted_list, n, side="left"):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        # print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        # print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod - 2)


def power(n, p, mod_=mod):
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


if __name__ == "__main__":
    main()