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:
l,r=map(int,input().split())
x=[]
if (r-l)>=2019:
    print(0)
else:
    for i in range(l,r+1):
        x.append(i%2019)
    x.sort()
    print(min((x[0]*x[1])%2019,(x[r-l]*x[r-l-1]%2019)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    if L + 2019 <= R:
        return 0
    
    ans = 2020
    
    for i in range(L, R+1):
        for j in range(L+1, R+1):
            if i == R+1 and j == R+1:
                continue
            ans = min(ans, (i*j)% 2019)
            if ans == 0:
                return 0
    return ans

print(solve())

Submission status: Wrong Answer

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

    if L + 2019 <= R:
        return 0
    
    list = [i % 2019 for i in range(L, R+1)]
    list.sort()
    return (list[0] * list[1]) % 2019

print(solve())

Submission status: Wrong Answer

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

    if L + 2019 < R:
        return 0
    
    list = [i % 2019 for i in range(L, R+1)]
    list.sort()
    return (list[0] * list[1]) % 2019

print(solve())

Submission status: Wrong Answer

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

    if L + 2019 <= R:
        return 0
    
    list = [i % 2019 for i in range(L, R+1)]
    list.sort()
    return (list[0] * list[1]) % 2019

print(solve())

Submission status: Wrong Answer

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

    if L + 2019 <= R:
        return 0
    
    list = [i % 2019 for i in range(L, R+1)]
    return list[0] * list[1]

print(solve())

Submission status: Wrong Answer

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

    l = L % 2019
    r = R % 2019
    
    if l >= r:
        return 0
    else:
        if l == 0 or r == 0:
            return 0
        return (l * (l+1))% 2019

print(solve())

Submission status: Wrong Answer

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

    l = L % 2019
    r = R % 2019
    
    if l >= r:
        return 0
    else:
        return (l * (l+1))% 2019

print(solve())

Submission status: Wrong Answer

Solution code:
def solve():
    L, R = map(int, input().split())
    
    if (R-L)/2019 >= 1 or L == 0:
        return 0
    
    list = [i % 2019 for i in range(L, R+1)]
    list.sort()
    return (list[0] * list[1]) % 2019

print(solve())

Submission status: Wrong Answer

Solution code:
def solve():
    L, R = map(int, input().split())
    
    if (R-L)/2019 >= 1 or L == 0:
        return 0
    
    list = [i % 2019 for i in range(L, R+1)]
    list.sort()
    return list[0] * list[1] % 2019

print(solve())

Submission status: Wrong Answer

Solution code:
def solve():
    L, R = map(int, input().split())
    
    if (R-L)/2019 >= 1:
        return 0
    
    list = [i % 2019 for i in range(L, R+1)]
    list.sort()
    return list[0] * list[1]

print(solve())

Submission status: Wrong Answer

Solution code:
def solve():
    L, R = map(int, input().split())
    
    if R-L+1 > 2019:
        return 0
    
    list = [i % 2019 for i in range(L, R+1)]
    list.sort()
    return list[0] * list[1]

print(solve())

Submission status: Wrong Answer

Solution code:
def solve():
    L, R = map(int, input().split())
    
    if R-L+1 >= 2019:
        return 0
    
    list = [i % 2019 for i in range(L, R+1)]
    list.sort()
    return list[0] * list[1]

print(solve())

Submission status: Wrong Answer

Solution code:
def solve():
    L, R = map(int, input().split())
    list = [i % 2019 for i in range(L, R+1)]
    list.sort()
    return list[0] * list[1]

print(solve())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

i_min = 2019
for i in range(L, min(L + 2019, R)):
  i_min = min(i % 2019, i_min)

j_min = 2019
for j in range(L + 1, min(L + 2020, R + 1)):
  j_min = min(j % 2019, j_min)
  
print((i_min * j_min) % 2019)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
if L%3!=0 and L%671!=0:
    if R-L>=2019:
        print(1)
    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)
elif L%3==0 and L%671!=0:
    if R-L-2>=2019:
        print(1)
    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)
elif L%3!=0 and L%671==0:
    if R-L-3>=2019:
        print(1)
    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)
else:
    if R-L-1>=2019:
        print(1)
    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)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())

if a <= 2019 <= b or 4038 <= b:
    print(0)
else:
    print((a * (a+1)) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
ans = 2020
for i in range(L + 1, R + 1):
    ans = min(ans, (L * i) % 2019)
    if ((i - L) == 2018): break
print(ans % 2019)

Submission status: Wrong Answer

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

ans = 2019

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

Submission status: Wrong Answer

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

if R - L >= 2018 or L > R :
    print("0")
else:
    array = sorted(list(range(l,r+1)))
    ans = array[0]*array[1] % 2019
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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):
    for j in range(i,R):
      _m = min(_m,(i*j)%2019)
  print(_m)

Submission status: Wrong Answer

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

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

#print(_L,_R,dif)

if _R < _L:
  print(0)
elif _L < _R and dif >= 2018: 
  print(0)
elif _L < _R and dif < 2018:
  if dif >= 672:
    print(0)
  else:
    print(_L*(_L+1)%2019)

Submission status: Wrong Answer

Solution code:
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:
  print(_L*(_L+1)%2019)

Submission status: Wrong Answer

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

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

print(L,R,_L,_R)
if _R < _L:
  print(0)
elif _L < _R and dif >= 2018: 
  print(0)
elif _L < _R and dif < 2018:
  print(_L*(_L+1)%2019)

Submission status: Wrong Answer

Solution code:
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:
  print(_L*(_L+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

lsmod = []
for i in range(l, min(l + 2019, r + 1)):
	lsmod.append(i % 2019)

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

Submission status: Wrong Answer

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

lsmod = []
for i in range(l, min(l + 2019, r + 1)):
	lsmod.append(i % 2019)

lsmod.sort()
print(lsmod[0] * lsmod[1])

Submission status: Wrong Answer

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

lsmod = []
for i in range(l, min(l + 2019, r)):
	lsmod.append(i % 2019)

lsmod.sort()

if len(lsmod) >= 2:
	print(lsmod[0] * lsmod[1])
else:
	print((lsmod[0] * (lsmod[0] + 1))% 2019)

Submission status: Wrong Answer

Solution code:
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(i+1, min(j+1, i+MOD)):
        ans = min(ans, x%MOD * y%MOD)
print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
L %= 2019
R %= 2019
if L >= R:
    R += 2019
ans = 2019
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 %= 2019
ans = 2019
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:
from operator import itemgetter
i, j = map(int, input().split())
MOD = 2019
rangee = sorted([[x, x % MOD] for x in range(i, min(j+1, i+MOD))], key=itemgetter(1))
print(rangee[0][0] * rangee[1][0] % MOD)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
i, j = map(int, input().split())
MOD = 2019
rangee = sorted([[x, x % MOD] for x in range(i, min(j+1, i+MOD))], key=itemgetter(1))
print(rangee[0][0] % MOD * rangee[1][0] % MOD)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
i, j = map(int, input().split())
MOD = 2019
rangee = sorted([[x, x % MOD] for x in range(i, min(j+1, i+MOD-1))], key=itemgetter(1))
print(rangee[0][0] % MOD * rangee[1][0] % MOD)

Submission status: Wrong Answer

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

l,r = get_nums_l()
d = r-l

lm = l % 2019
rm = r % 2019


nums = [0] * 2019
for imod in range(2019):
    if (imod+(2019-lm))%2019 <= d:
        nums[imod] += 1 + (d - (imod+(2019-lm))%2019)//2019

nums.sort()

min_ = 999999999999999999999
for a in range(2019):
    for b in range(2019):
        if a==b and nums[a] < 2:
            continue
        if nums[a] < 1 or nums[b] < 1:
            continue
        mo = a*b%2019
        if min_ > mo:
            min_ = mo
print(min_)

# m3   = 3 - l % 3
# m673 = 673 - l % 673

# if (m3==3 or m3 <= d) and (m673==673 or m673 <= d):
#     print(0)
# else:
#     print((l*(l+1)) % 2019)

Submission status: Wrong Answer

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

l,r = get_nums_l()
d = r-l

lm = l % 2019
rm = r % 2019


nums = []
for imod in range(2020):
    if (imod+(2019-lm))%2019 <= d:
        nums.append(imod)

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

# m3   = 3 - l % 3
# m673 = 673 - l % 673

# if (m3==3 or m3 <= d) and (m673==673 or m673 <= d):
#     print(0)
# else:
#     print((l*(l+1)) % 2019)

Submission status: Wrong Answer

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

l,r = get_nums_l()
d = r-l

m3   = 3 - l % 3
m673 = 673 - l % 673

if (m3==3 or m3 <= d) and (m673==673 or m673 <= d):
    print(0)
else:
    print((l*(l+1)) % 2019)

Submission status: Wrong Answer

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

l,r = get_nums_l()
d = r-l

m3   = 3 - l % 3
m673 = 673 - l % 673

if m3 <= d and m673 <= d:
    print(0)
else:
    print((l*(l+1)) % 2019)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
i, j = map(int, input().split())
MOD = 2019
rangee = sorted([[x, x % MOD] for x in range(i, min(j+1, i+MOD+1))], key=itemgetter(1))
print(rangee[0][0] % MOD * rangee[1][0] % MOD)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
mindiv=1000000000
for i in range(a,b):
  for j in range(i,b+1):
    if i%2019==0 or j%2019==0:
      print(0)
      exit()
    else:
      mindiv=min(i*j%2019,mindiv)
print(mindiv)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
mindiv=1000000000
for i in range(a,b+1):
  for j in range(a,b+1):
    if i%2019==0 or j%2019==0:
      print(0)
      exit()
    else:
      mindiv=min(i*j%2019,mindiv)
print(mindiv)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
mindiv=3000
for i in range(a,b+1):
  for j in range(a,b+1):
    if i%2019==0 or j%2019==0:
      print(0)
      exit()
    else:
      mindiv=min(i*j%2019,mindiv)
print(mindiv)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
if r-l >= 2019:
    ans = 0
else:
    n = 2019
    l = l%n
    print(l)
    r = r%n
    print(r)
    ans = 2019
    a = min(l,r)
    b = max(l,r)

    for i in range(a,b):
        for j in range(a+1,b+1):
            print(i,j)
            ans = min(ans, (i*j)%n)

print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
n = 2019
l = l%n
r = r%n
ans = 2019
a = min(l,r)
b = max(l,r)

for i in range(a,b):
    for j in range(a+1,b+1):
        ans = min(ans, (i*j)%n)

print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
n = 2019
if int(l/n) == int(r/n):
    l = l%n
    r = r%n

else:
    m = min(int(l/n),int(r/n))
    if m > 0:
        l -= l*m
        r -= r*m

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

print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
prime = set(range(0, 2*10**9, 2019))

for i in prime:
    if i in range(L, R+1):
        print(0)
        break

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod_list = []
for i in range(L, R+1):
    mod_list.append(i % 2019)
mod_list.sort()
# print(mod_list)
print((mod_list[0]*mod_list[1])%2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod_list = []
for i in range(L, R+1):
    mod_list.append(i % 2019)
mod_list.sort()
# print(mod_list)
print(mod_list[0]*mod_list[1]%2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod_list = []
for i in range(L, R+1):
    mod_list.append(i % 2019)
mod_list.sort()
print(mod_list[0]*mod_list[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

num = 0
ans = (L * (L + 1)) % 2019
for i in range(L, R)[::-1]:
    j = i + 1
    ans = min(ans, (i * j) % 2019)
    num += 1
    if num >= 3000:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

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

if L - R >= 3000:
  print(0)
  sys.exit()

m = 10*9

for i in range(L, R+1):
  for n in range(i+1, R+1):
    s = i * n % 2019

    if m > s:
      m = s

print(m)

Submission status: Wrong Answer

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

l = L % 2019
r = R % 2019

m = 10*9

for i in range(l, r+1):
  for n in range(i+1, r+1):
    k = i * n % 2019

    if m > k:
      m = k

print(m)

Submission status: Wrong Answer

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

l = L % 2019
r = R % 2019

m = 10*9

for i in range(l, r+1):
  for n in range(i+1, r+1):
    k = i * n

    if m > k:
      m = k

print(m)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
_min=2018
if L==0:
  print(0)
else:  
  for l in range(L,L+2019):
    if l>R:
      break
    for r in range(l+1,l+2020):
      if r>R:
        break
      m=(l*r)%2019
      if _min>m:
        _min=m
print(_min)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
_min=2018
if L==0:
  print(0)
else:  
  f=min(R-L+1,2020)
  for l in range(L,L+f-1):
    for r in range(l+1,L+f):
      m=(l*r)%2019
      if _min>m:
        _min=m
print(_min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans = 2019**2
if l < r :
    for i in range(l,r+1):
        for j in range(i+1,r+1):
             ans = min(ans,i*j%MOD)
elif l >= r :
    ans =0
print(ans)

Submission status: Wrong Answer

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

ans = 2019**2
if l < r :
    for i in range(l,r+1):
        for j in range(i+1,r+1):
             ans = min(ans,i*j%MOD)
elif l >= r :
    s = list(range(l,2020))+list(range(1,r+1))
    for i in s:
        for j in s:
            if i ==j :
                break
            else:
                ans = min(ans,i*j%MOD)
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
l_2 = l%2019
r_2 = r%2019
ans = 2019
if r_2 - l_2 > 2017:
    print(0)
else:
    for i in range(l_2,r_2+1):
        for j in range(i+1,r_2+1):
            tmp = i*j%2019
            if tmp < ans:
                ans = tmp
    print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
l_2 = l%2019
r_2 = r%2019
ans = 2019
if r_2 - l_2 > 2017:
    print(0)
else:
    for i in range(l_2,r_2+1):
        for j in range(i+1,r_2+1):
            print(i,j)
            tmp = i*j%2019
            if tmp < ans:
                ans = tmp
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

modL = L % 2019
modR = R % 2019
min2019 = 2019

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

Submission status: Wrong Answer

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

modL = L % 2019
modR = R % 2019
min2019 = 2019

if L - R >= 2018:
    print(0)
elif modL <=3 and modR >=673:
    print(0)
else:
    for j in range(modL, modR+1):
        for k in range(j+1, modR+1):
            min2019 = min(min2019, j * k % 2019)
    print(min2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
modL = L % 2019
modL1 = (modL + 1) % 2019
if L <= 2018 and R >= 2019:
    print(0)
else:
    print((modL * (modL1)) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
modL = L % 2019
modL1 = (modL + 1) % 2019
if modL == 0 or (L <= 2018 and R >= 2019):
    print(0)
else:
    print((modL * (modL1)) % 2019)

Submission status: Wrong Answer

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

if R-L>=2019:
    print(0)
    exit()
    
min = 2020
for i in range(L,R+1):
    if min > i % 2019:
        min = i % 2019

print(min*(min + 1))

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
modL = L % 2019
modR = R % 2019
modL1 = (modL + 1) % 2019
minRL1 = min(modR, modL1)
if modL == 0 or minRL1 == 0:
    print(0)
else:
    print((modL * (minRL1)) % 2019)

Submission status: Wrong Answer

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

if R-L==2019:
    print(0)
    exit()
    
min = 2020
for i in range(L,R+1):
    if min > i % 2019:
        min = i % 2019

print(min*(min + 1))

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
modL = L % 2019
modL1 = (modL + 1) % 2019
if modL == 0 or modL1 == 0:
    print(0)
else:
    print((modL * (modL1)) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
modL = L % 2019
modL1 = (modL + 1) % 2019
if modL1 == 0:
    print(0)
else:
    print((modL * (modL + 1)) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
modL = L % 2019
modR = R % 2019
if modR == 0:
    print(0)
else:
    print((modL * (modL + 1)) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
modL = L % 2019
print((modL * (modL + 1)) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
modL = L % 2019
print(modL * (modL + 1))

Submission status: Wrong Answer

Solution code:

L,R = map(int,input().split())
ans = 2020
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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

import sys

mi=10**10
for l in range(L,R+1):
    for r in range(L+1,R+1):
        mod = (l*r) % 2019
        if mod < mi:
            mi=mod
        if mi==0:
            print(mi)
            sys.exit()
print(mi)

Submission status: Wrong Answer

Solution code:
# わからない

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
arr=[]
for i in range(l,r+1):
    arr.append(i%2019)
    if i==l+2019:
        break

arr.sort()
#print(arr)
print(arr[0]*arr[1])

Submission status: Wrong Answer

Solution code:
import sys
l,r = map(int,input().split())
ans = int(2018)
if(r-l > 2020):
    print(0)
    sys.exit
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)

Submission status: Wrong Answer

Solution code:
lr=list(map(int,input().split()))
mod=2019
ans=mod**2
if lr[0]%mod<=lr[1]%mod and lr[1]-lr[0]<mod:
    for i in range(lr[0],lr[1]+1):
        for j in range(i+1,lr[1]+1):
            if (i%mod)*(j%mod)<ans:
                ans=(i%mod)*(j%mod)
else:
    ans=0
print(ans)

Submission status: Wrong Answer

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

l2 = l // 2019
r2 = r // 2019

if l2 != r2:
  print(0)
else:
  ans=2019
  for i in range(l2, r2):
    for j in range(i+1, r2 + 1):
      ans = min(ans, (i * j)  % 2019)
  print(ans)

Submission status: Wrong Answer

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

l2 = l // 2019
r2 = r // 2019

if l2 != r2:
  print(0)
else:
  ans=2019
  for i in range(l2, r2):
    for j in range(i+1, r2 + 1):
      ans = min(ans, (i * j)  % 2019)
  print(l * (l + 1) % 2019)

Submission status: Wrong Answer

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

l2 = l // 2019
r2 = r // 2019

if l2 != r2:
  print(0)
else:
  print(l * (l + 1) % 2019)

Submission status: Wrong Answer

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

l2 = l // 2019
r2 = r // 2019

if l2 != r2:
  print(0)
else:
  print(l%2019 * (l%2019+1))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

min = 500000

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

print(min)

Submission status: Wrong Answer

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

min = 500000
print('r-l',r-l)

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

print(min)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
mods = []
for num in range(L, min(R+1,L+2020)):
    mods.append(num % 2019)

mods.sort()
print(mods[0] * mods[1])

Submission status: Wrong Answer

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

if R - L + 1 >= 673:
    print(0)
else:
    mods = []
    for num in range(L, R+1):
        mods.append(num % 2019)

    mods.sort()
    print(mods[0] * mods[1])

Submission status: Wrong Answer

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

if R - L + 1 >= 2019:
    print(0)
else:
    mods = []
    for num in range(L, R+1):
        mods.append(num%2019)

    mods.sort()
    print(mods[0]*mods[1])

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
mul_3 = R//3 - (L - 1)//3
mul_673 = R//673 - (L - 1)//673
mul_2019 = R//2019 - (L - 1)//2019

if min(mul_3,mul_673) >= 1 or mul_2019 >= 1:
    print(0)
else:
    mods = []
    for num in range(L, R+1):
        mods.append(num%2019)

    mods.sort()
    print(mods[0]*mods[1])

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
mul_3 = R//3 - (L - 1)//3
mul_673 = R//673 - (L - 1)//673
mul_2019 = R//2019 - (L - 1)//2019

if min(mul_3,mul_673) >= 1 or mul_2019 >= 1:
    print(0)
else:
    ans = float('inf')
    for num in range(L, R):
        ans = min(ans, (num % 2019) * (num + 1) %2019)
    print(ans)

Submission status: Wrong Answer

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

if L * R <= 2019:
    print(L * (L + 1))
else:
    print((L * (L + 1)) % MOD)