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())
i = 2017
j = 2018
i_mod = 2017
j_mod = 2018
end = min(R, L + 2019)

for n in range(L, (end + 1)):
    n_mod = n % 2019
    if n_mod == 0:
        continue
    elif n_mod < i_mod:
        i, j = n, i
        i_mod = n_mod
    elif n_mod < j_mod:
        j = n
        j_mod = n_mod

print((i * j) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
i = 2017
j = 2018
i_mod = 2017
j_mod = 2018

for n in range(L, R + 1):
    n_mod = n % 2019
    if n_mod < i_mod:
        i, j = n, i
        i_mod = n_mod
    elif n_mod < j_mod:
        j = n
        j_mod = n_mod

print((i * j) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod = 2019
ans = mod + 100

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mod_L = L % mod
mod_R = R % mod

if mod_L >= mod_R:
    print(0)
else:    
    if mod_R - mod_L < R - L:
        print(0)
    else:
        print(mod_L * (mod_L + 1) % mod)

Submission status: Wrong Answer

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

mod_L = L % mod
mod_R = R % mod

if mod_L >= mod_R:
    print(0)
else:    
    if L + (mod_R - mod_L) < R:
        print(0)
    else:
        print(mod_L * (mod_L + 1) % mod)

Submission status: Wrong Answer

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

mod_L = L % mod
mod_R = R % mod

if mod_L >= mod_R:
    print(0)
else:    
    if L + (mod_R - mod_L) < R:
        print(0)
    else:
        print(mod_L * (mod_L + 1))

Submission status: Wrong Answer

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

mod_L = L % mod
mod_R = R % mod

if mod_L > mod_R:
    print(0)
else:
    if L + (mod_R - mod_L) < R:
        print(0)
    else:
        print(mod_L * (mod_L + 1))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
L, R = map(int, input().split(' '))
R = min(R, L + 2019 * 2)
mods = [i % 2019 for i in range(L, R+1)]

n = [m1 * m2 for i, m1 in enumerate(mods)
        for m2 in mods[i+1:]]

n.sort()
print(n[0])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
L, R = map(int, input().split(' '))
mods = [i % 2019 for i in range(L, R+1)]
mods.sort()
print(mods[0] * mods[1])

Submission status: Wrong Answer

Solution code:
import numpy as np
a, b = map(int, input().split())
if b - a > 2019 * 2:
  print(0)
else:
  all_ = np.mod([i for i in range(a, b+1)], 2019)

  f1 = min(all_)
  f2 = min(np.delete(all_, np.argmin(all_)))

  print(f1 * f2)

Submission status: Wrong Answer

Solution code:
import numpy as np
a, b = map(int, input().split())
if b - a < 2019 * 2:
  all_ = np.mod([i for i in range(a, b+1)], 2019)

  f1 = min(all_)
  f2 = min(np.delete(all_, np.argmin(all_)))

  print(f1 * f2)
  
else:
  print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
i=0
j=0
l=0
r=0
if R-L>=2019:
    print("0")
else:
    l=L%2019
    r=R%2019
    if l<r:
        print(l*(l+1))
    elif l>r:
        print("0")

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
i=0
j=0
l=0
r=0
if L-R>=2019:
    print("0")
else:
    l=L%2019
    r=R%2019
    if l<r:
        print(l*(l+1))
    elif l>r:
        print("0")

Submission status: Wrong Answer

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

Lmod = L%2019
Rmod = R%2019

if (R-L+1) < 2019 and Lmod < Rmod:
    print((L*(L+1))%2019)
elif (R-L+1) < 2019 and Lmod > Rmod:
    print(0)
elif (R-L+1) >= 2019:
    print(0)

Submission status: Wrong Answer

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

Lmod = L%2019
Rmod = R%2019

if (R-L+1) <= 2019 and Lmod < Rmod:
    print((L*(L+1))%2019)
elif (R-L+1) <= 2019 and Lmod > Rmod:
    print(0)
elif (R-L+1) > 2019:
    print(0)

Submission status: Wrong Answer

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

Lmod = L%2019
Rmod = R%2019

if (L-R+1) <= 2019 and Lmod < Rmod:
    print((L*(L+1))%2019)
elif (L-R+1) <= 2019 and Lmod > Rmod:
    print(0)
elif (L-R+1) > 2019:
    print(0)

Submission status: Wrong Answer

Solution code:
l, r = [int(i) for i in input().split()]
ln = l // 2019
rn = r // 2019
if ln == rn:
	print ((l * (l + 1)) % 2019)
else:
	print (0)

Submission status: Wrong Answer

Solution code:
l, r = [int(i) for i in input().split()]
ln = l // 2019
rn = r // 2019
if ln == rn:
	l = l % 2019
	print (l * (l + 1))
else:
	print (0)

Submission status: Wrong Answer

Solution code:
l, r = [int(i) for i in input().split()]
ln = l // 2019
rn = r // 2019
if ln == rn and l < r:
	l = l % 2019
	print (l * (l + 1))
else:
	print (0)

Submission status: Wrong Answer

Solution code:
L, R = [int(s) for s in input().split(' ')]

i = L
j = R
ret = (L * R % 2019)
for x in range(4000):
    ii = L + x
    jj = L + x + 1
    if ii > R or jj > R:
        break
    ij = ((ii * jj) % 2019) 
    ret = min(ret, ij)
for x in range(4000):
    ii = R - x
    jj = R - x - 1
    if ii < L or jj < L:
        break
    ij = ((ii * jj) % 2019) 
    ret = min(ret, ij)

print(ret)

Submission status: Wrong Answer

Solution code:
L, R = [int(s) for s in input().split(' ')]

i = L
j = R
ret = (L * R % 2019)
for x in range(2020):
    ii = L + x
    jj = L + x + 1
    if ii > R or jj > R:
        break
    ij = ((ii * jj) % 2019) 
    ret = min(ret, ij)
for x in range(2020):
    ii = R - x
    jj = R - x - 1
    if ii < L or jj < L:
        break
    ij = ((ii * jj) % 2019) 
    ret = min(ret, ij)

print(ret)

Submission status: Wrong Answer

Solution code:
L, R = [int(s) for s in input().split(' ')]

i = L
j = R
ret = (L * R % 2019)
for x in range(2020):
    ii = L + x
    jj = L + x + 1
    if ii > R or jj > R:
        break
    ij = (ii * jj % 2019) 
    ret = min(ret, ij)
for x in range(2020):
    ii = R - x
    jj = R - x - 1
    if ii < L or jj < L:
        break
    ij = (ii * jj % 2019) 
    ret = min(ret, ij)

print(ret)

Submission status: Wrong Answer

Solution code:
l, r = [int(i) % 2019 for i in input().split()]
if l < r:
	print ((l * (l + 1)) % 2019)
else:
	print (0)

Submission status: Wrong Answer

Solution code:
L, R = [int(s) for s in input().split(' ')]

i = L
j = R
ret = 2019
for x in range(2020):
    ii = L + x
    jj = L + x + 1
    if ii > R or jj > R:
        break
    ij = (ii * jj % 2019) 
    ret = min(ret, ij)
for x in range(2020):
    ii = R - x
    jj = R - x - 1
    if ii < L or jj < L:
        break
    ij = (ii * jj % 2019) 
    ret = min(ret, ij)

print(ret)

Submission status: Wrong Answer

Solution code:
l, r = [int(i) % 2019 for i in input().split()]
if l < r:
	print (l * (l + 1))
else:
	print (0)

Submission status: Wrong Answer

Solution code:
L, R = [int(s) for s in input().split(' ')]

i = L
j = R
ret = 2019
for x in range(2020):
    ii = L + x
    jj = L + x + 1
    if ii > R or jj > R:
        break
    ij = (ii % 2019) * (jj % 2019) 
    ret = min(ret, ij)
for x in range(2020):
    ii = R - x
    jj = R - x - 1
    if ii < L or jj < L:
        break
    ij = (ii % 2019) * (jj % 2019) 
    ret = min(ret, ij)

print(ret)

Submission status: Wrong Answer

Solution code:
l, r = list(map(int, input().split()))
MOD = 2019
#print(l // MOD)
#print(r // MOD)
#print(l % MOD)
#print(r % MOD)
result = 1 << 31
for i in range(l, r + 1):
  i %= MOD
  if i == 0:
    result = 0
    break
  for j in range(l + 1, r + 1):
    result = min(result, (i * j) % MOD)
print(result)

Submission status: Wrong Answer

Solution code:
l, r = [int(i) % 2019 for i in input().split()]
print (l * (l + 1))

Submission status: Wrong Answer

Solution code:
import math
L, R = [int(s) for s in input().split(' ')]

i = L
j = R
ret = 2019
for x in range(2019):
    ii = L + x
    jj = L + x + 1
    if ii > R or jj > R:
        break
    ij = (ii % 2019) * (jj % 2019) 
    ret = min(ret, ij)
for x in range(2019):
    ii = R - x
    jj = R - x - 1
    if ii < L or jj < L:
        break
    ij = (ii % 2019) * (jj % 2019) 
    ret = min(ret, ij)

print(ret)

Submission status: Wrong Answer

Solution code:
l, r = list(map(int, input().split()))
MOD = 2019
#print(l // MOD)
#print(r // MOD)
#print(l % MOD)
#print(r % MOD)
d = r // MOD - l // MOD
if r % MOD == 0 or l % MOD == 0:
    print(0)
elif d == 0:
  if l % MOD <=3 and r % MOD >= 673:
    print(0)
  else:
    print((l * (l + 1)) % MOD)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
import os, sys, re, math

(L, R) = [int(n) for n in input().split()]

result = None
for i in range(L, R + 1):
    if i % 2019 == 0:
        result = 0
        break

if result is None:
    if abs(2019 - L % 2019) < abs(2019 - R % 2019):
        result = (L * (L + 1)) % 2019
    else:
        result = ((R - 1) * R) % 2019

print(result)

Submission status: Wrong Answer

Solution code:
l, r = list(map(int, input().split()))
MOD = 2019
d = r // MOD - l // MOD
if r % MOD == 0 or l % MOD == 0:
    print(0)
elif d == 0:
  print(l * (l + 1) % MOD)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
import os, sys, re, math

(L, R) = [int(n) for n in input().split()]

result = None
for i in range(L, R + 1):
    if i % 2019 == 0:
        result = 0
        break

if not result:
    if abs(2019 - L % 2019) < abs(2019 - R % 2019):
        result = (L * (L + 1)) % 2019
    else:
        result = ((R - 1) * R) % 2019

print(result)

Submission status: Wrong Answer

Solution code:
import os, sys, re, math

(L, R) = [int(n) for n in input().split()]

result = None
for i in range(L, R + 1):
    if i % 2019 == 0:
        result = 0
        break

if not result:
    if L % 2019 < R % 2019:
        result = (L * (L + 1)) % 2019
    else:
        result = ((R - 1) * R) % 2019

print(result)

Submission status: Wrong Answer

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


if w>2019:
    print(0)
else:
    List = [int(i) for i in range(L,R+1)]
    print(List)
    Min = 2018
    for i in range(len(List)-1):
        for j in range(i+1,len(List)):
            l = (List[j]*List[i])%2019
            if l<Min:
                Min = l
    print(Min)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split(" "))
w = R-L
List = [int(i)%2019 for i in range(L,R+1)]

if w>2019:
    print(0)
else:
    Min = 2018
    for i in range(len(List)-1):
        for j in range(i+1,len(List)):
            l = List[j]*List[i]
            if l<Min:
                Min = l
    print(Min)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split(" "))
List = sorted([i%2019 for i in range(L,R+1)])

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

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split(" "))
List = [i%2019 for i in range(L,R+1)]
Min = 2018
for j in range(len(List)-1):
    l = List[j]*List[j+1]
    if l<Min:
        Min = l
print(Min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(2018)

Submission status: Wrong Answer

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

def rem(L, R):
  if (R//2019) - (L//2019) > 0:
    return 0
  L = L % 2019
  R = R % 2019
  return (L*(L+1))
    
print(rem(L, R) % 2019)

Submission status: Wrong Answer

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

def rem(L, R):
  if (R//2019) - (L//2019) > 0:
    return 0
  L = L % 2019
  R = R % 2019
  return (L*(L+1))
    
print(rem(L, R))

Submission status: Wrong Answer

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

def rem(L, R):
  if R - L >= 2019:
    return 0
  L = L % 2019
  R = R % 2019
  return (L*(L+1))
    
print(rem(L, R))

Submission status: Wrong Answer

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

L = L % 2019
R = R % 2019
print (L*(L+1))

Submission status: Wrong Answer

Solution code:
#abc133 c
L,R=map(int,input().split())
ans=0
R=min(R,L+2019*2)
ans=2018
amari=[]
for i in range(L,R+1):
    tmp=i%2019
    amari.append(tmp)
    if len(amari)==2019*2:
        break
for i in range(len(amari)):
    for j in range(len(amari)):
        if i==j:
            continue
        ans=min(ans,(amari[i]*amari[j]*2019))
        if ans==0:
            break
print(ans)

Submission status: Wrong Answer

Solution code:
#abc133 c
L,R=map(int,input().split())
ans=0
R=min(R,L+2019*2)
ans=2018
amari=[]
for i in range(L,R+1):
    tmp=i%2019
    amari.append(tmp)
    if len(amari)==2019*2:
        break
for i in range(len(amari)):
    for j in range(len(amari)):
        if i==j:
            continue
        ans=min(ans,(amari[i]*amari[j]))
print(ans)

Submission status: Wrong Answer

Solution code:
#abc133 c
L,R=map(int,input().split())
x=R-L
ans=0
hidari=L%2019
if L==0:
    hidari=0
migi=R%2019
if R%2019==0:
    migi=0

if x>=2019:
    ans=0
elif hidari==0 or migi==0:
    ans=0
else:
    ans=hidari*(hidari+1)
print(ans)

Submission status: Wrong Answer

Solution code:
#abc133 c
L,R=map(int,input().split())
x=R-L
ans=0
hidari=L%2019
migi=R%2019

if x>=2019:
    ans=0
else:
    ans=hidari*(hidari+1)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
r = min(r, l+(2019*2))
ans = 2018

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

print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
r = min(r, l+(2019*2))
ans = 2018

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

print(ans)

Submission status: Wrong Answer

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

ans = divmod(l*r, 2019)[1]
for i in range(l+1, r+1):
  q, mod = divmod(l*i, 2019)
  ans = min(ans, mod)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cand = []
for i in range(l,r+1):
  cand.append(i%2019)
  if len(cand) == 2020*2:
    break
    
cand.sort()
print(cand[0]*cand[1])

Submission status: Wrong Answer

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

cand = []
for i in range(l,r+1):
  cand.append(i%2019)
  if len(cand) == 2019*2:
    break
    
cand.sort()
print(cand[0]*cand[1])

Submission status: Wrong Answer

Solution code:
from math import sqrt

L, R = map(int, input().split())
if R-L>=2019:
    print(0)
else:
    modMin = 2019
    for _ in range(L, R):
        mod2019 = _%2019
        if mod2019 < modMin:
            modMin = mod2019
        if mod2019 == 2018:
            if _+1 <=R:
                modMin = 0
            else:
                pass
    print(modMin*(modMin+1))

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if R-L>=2019:
    print(0)
else:
    modMin = 2019
    for _ in range(L, R):
        mod2019 = _%2019
        if mod2019 < modMin:
            modMin = mod2019
        if mod2019 == 2018:
            modMin = 0
    print(modMin*(modMin+1))

Submission status: Wrong Answer

Solution code:
from math import sqrt

L, R = map(int, input().split())
if R-L>=2019:
    print(0)
else:
    modMin = 2019
    for _ in range(L, R+1):
        mod2019 = _%2019
        if mod2019 < modMin:
            modMin = mod2019
    print(modMin*(modMin+1))

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
ans = 20000000
a = a % 2019
b = b % 2019

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


if a == b:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
ans = 20000000
a = a % 2019
b = b % 2019

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


if a == 0 and b == 0:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
ans = 0
a = a % 2019
b = b % 2019

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

print(ans)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
ans = 200000
a = a % 2019
b = b % 2019

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

print(ans)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
k = a
ans = 2019
while k+1 <= b:
    ans = min(ans, k*(k+1)%2019)
    k += 1
    if ans == 0:
        break


print(ans)

Submission status: Wrong Answer

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

min_value = a*(a+1)%2019
max_value = (b-1)*b%2019
ans = 0

if min_value >= max_value and a+1 != b:
    ans = 0
else:
    ans = min_value

print(ans)

Submission status: Wrong Answer

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

min_value = a*(a+1)%2019
max_value = (b-1)*b%2019
ans = 0

if min_value > max_value:
    ans = 0
else:
    ans = min_value

print(ans)

Submission status: Wrong Answer

Solution code:
INF = 400000000

import sys
L, R = list(map(lambda x: int(x), input().split()))
# この場合は0,1,2,~~2018の数字がmodで出てくる。ので最小値は決まっている。
if R - L >= 2019:
  print(0)
  sys.exit()

m = INF

for l in range(R - L):
  for r in range(1, R - L - l + 1):
    a = (L+l) % 2019
    b = (L+l+r) % 2019
    m = min(m, a*b)

print(m)

Submission status: Wrong Answer

Solution code:
import sys
L, R = list(map(lambda x: int(x), input().split()))
# この場合は0,1,2,~~2018の数字がmodで出てくる。ので最小値は決まっている。
if R - L >= 2018:
  print(0)
  sys.exit()

start = L % 2019
to_zero = 2018 - start
if R - L > to_zero:
  print(0)
  sys.exit()

print(start * (start+1))

Submission status: Wrong Answer

Solution code:
import sys
L, R = list(map(lambda x: int(x), input().split()))
# この場合は0,1,2,~~2018の数字がmodで出てくる。ので最小値は決まっている。
if R - L >= 2018:
  print(0)
  sys.exit()

one = L % 2019
two = (L + 1) % 2019

print(one * two)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

r%=2019
l%=2019

if l>=r: 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)

Submission status: Wrong Answer

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

r%=2019
l%=2019

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

if R - L > 2019:
    print(0)

ans = float('inf')
for i in range(L,R):
    for j in range(i+1,R+1):
        ans = min(ans,(i*j)%MOD)
        if ans == 0:
            break
print(ans)

Submission status: Wrong Answer

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

if L == 0 or R == 0:
    print(0)
    exit()

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)

Submission status: Wrong Answer

Solution code:
MOD = 2019
L, R = map(int, input().split())
L, R = min(L%MOD,R%MOD), max(L%MOD,R%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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if L%mod < R%mod and R-L < 2019 :
    ans = (L%mod)*((L+1)%mod)
elif L%mod > R%mod and R-L < 2019 :
    ans = (R%mod)*((R+1)%mod)
else :
    ans = 0

print(ans)

Submission status: Wrong Answer

Solution code:

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

mini = (L * R) % 2019

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



print(mini)

Submission status: Wrong Answer

Solution code:

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

mini = min(L % 2019, R % 2019)
mini_sec = max(L % 2019, R % 2019)

for i in range(L + 1, R + 1):
    if i % 2019 < mini_sec:
        if i % 2019 < mini:
            mini_sec = mini
            mini = i % 2019
        else:
            mini_sec = i % 2019



print((mini * mini_sec) % 2019)

Submission status: Wrong Answer

Solution code:

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

mini = min(L % 2019, R % 2019)
mini_sec = max(L % 2019, R % 2019)

for i in range(L + 1, R + 1):
    if i % 2019 < mini_sec:
        if i % 2019 < mini:
            mini_sec = mini
            mini = i % 2019
        else:
            mini_sec = i % 2019



print(mini * mini_sec)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
l,r=L%2019,R%2019
x,y=L//2019,R//2019
if x<y:
  print(0)
else:
  ans=10**9
  for i in range(l,r):
    for j in range(i,r+1):
      ans=min(ans,(i*j)%2019)

Submission status: Wrong Answer

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

if (r / 673 - l /673 >= 1) and (r / 673 >= 3 or l / 673 >= 3 or r - l >= 3):
    print(0)
    exit()
print(min((l * (l + 1)) % 2019, (r * (r - 1)) % 2019))

Submission status: Wrong Answer

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

if (r % 673 == 0 or l % 673 == 0) and (r / 673 >= 3 or l / 673 >= 3 or r - l >= 3):
    print(0)
    exit()
print(min((l * (l + 1)) % 2019, (r * (r - 1)) % 2019))

Submission status: Wrong Answer

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

cnt = 0
tank = []
for i in range(l,r+1):
    tank.append(i%mod)
    cnt += 1
    if cnt >= 2020:
        break

res = 2019

n = len(tank)
for i in range(n):
    for j in range(n):
        res = min(res,tank[i]*tank[j]%mod)
print(res)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
ans=[]
i=0
while i<1000 and a+i<=b:
    ans.append((a+i)%2019)
    i+=1
ans.sort()
print(ans)
minn=10**6
for i in range(len(ans)):
    for j in range(i+1,len(ans)):
        minn=min(minn,(ans[i]*ans[j])%2019)
print(minn)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
ans=[]
i=0
while i<100000 and a+i<=b:
    ans.append((a+i)%2019)
    i+=1
z=ans.pop(ans.index(min(ans)))
print(z*min(ans))

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
ans=[]
i=0
while i<4096 and a+i<=b:
    ans.append((a+i)%2019)
    i+=1
z=ans.pop(ans.index(min(ans)))
print(z*min(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
if r-l+1 >= 2019:
    print(0)
else:
    x = []
    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())
if l%2019 < r%2019:
    print((l%2019 * (l+1)%2019)%2019)
else:
    print((r%2019 * (r-1)%2019)%2019)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
left=L%2019
right=R%2019
length=R-L
print(left*(left+1) if left<right and length<2019 else 0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(1%2019)
print(2020%1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
lmod = min(l%2019, (2019-l)%2019)
ldiv = l//2019
rmod = min(r%2019, (2019-r)%2019)
rdiv = r//2019
if ldiv==rdiv:
    print(min(lmod, rmod)*(min(lmod, rmod)+1)%2019)
elif ldiv<rdiv:
    print(0)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
lmod = l%2019
ldiv = l//2019
rmod = r%2019
rdiv = r//2019
if ldiv==rdiv:
    print(lmod*(lmod+1)%2019)
elif ldiv<rdiv:
    print(0)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
lmod = l%2019
ldiv = l//2019
rmod = r%2019
rdiv = r//2019
if ldiv==rdiv:
    print(lmod*(lmod+1))
elif ldiv<rdiv:
    print(0)

Submission status: Wrong Answer

Solution code:
#python3
MOD = 2019
def main():
    l, r = map(int, input().split())
    i = 0
    while MOD*i <= r: 
        v = MOD*i
        if (l <= v) and (v <= r):
            print(0)
            return
        i += 1
    p = []
    L = l%MOD
    for i in range(2019):
        v = L + i
        if v < 2019: 
            p.append((v%MOD))
    p.sort()
    print((p[0]*p[1])%MOD)
main()

Submission status: Wrong Answer

Solution code:
#python3
MOD = 2019
def main():
    l, r = map(int, input().split())
    i = 0
    while MOD*i <= r: 
        v = MOD*i
        if (l <= v) and (v <= r):
            print(0)
            return
        i += 1
    L = l%MOD
    print((L*(L+1))%MOD)
main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
l, r = map(int,input().split()) 

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