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:
i,j=map(int,input().split())
a=i%2019
b=j%2019
if (j-i)<2019:
    print(a*(a+1))
else:
    print(0)

Submission status: Wrong Answer

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

ans=2019
if r-l>=2019:
      print(0)
else:
      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())
mL = L % 2019
mR = R % 2019
if (mL >= mR) :print(0)
else:
    m = 2019
    for i in range(mL,mR):
        for j in range(i+1,mR+1):
            s = (i*j)%2019
            if m > s : m = s
    print(m)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
mL = L % 2019
mR = R % 2019
if (mL > mR)|((mL == 0)&(mR == 0)):print(0)
else:
    m = 2019
    for i in range(mL,mR):
        for j in range(i+1,mR+1):
            s = (i*j)%2019
            if m > s : m = s
    print(m)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
mL = L % 2019
mR = R % 2019
if (mL > mR):print(0)
else:
    m = 2019
    for i in range(mL,mR):
        for j in range(i+1,mR+1):
            s = (i*j)%2019
            if m > s : m = s
    print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
m = 2019*2019
for i in range(L,R-1):
    for j in range(i+1,R):
        s = (i*j)%2019
        if (m > s):
            m = s
        if (m == 0):
            break

print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = (int(i) for i in input().split())
if l // 2019 < r // 2019: 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:
    if (R//2019>L//2019):
        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:
    if (R//2019>L//2019):
        print(0)
    else:
        print((L*L+1)%2019)

Submission status: Wrong Answer

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

def repeat_division(n):
    while True:
        if n < 2019:
            break
        n %= 2019
    return n

l = repeat_division(L)
r = repeat_division(R)

if R - L  >= 2019:
    print(0)
elif l > r:
    print(0)
else:
    min = 2019
    for k in range(l, r):
        for i in range(k,r+1):
            if min > repeat_division(k * i):
                min = repeat_division(k * i)
    print(min)

Submission status: Wrong Answer

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

def repeat_division(n):
    while True:
        if n < 2019:
            break
        n %= 2019
    return n

l = repeat_division(L)
r = repeat_division(R)

if R - L  >= 2019:
    print(0)
elif l > r:
    print(0)
else:
    min = 2019
    for l in range(1,l+1):
        for k in range(1,r+1):
            if min > repeat_division(k *l):
                min = repeat_division(k *l)

    print(min)

Submission status: Wrong Answer

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

def repeat_division(n):
    while True:
        if n < 2019:
            break
        n %= 2019
    return n

l = repeat_division(L)
r = repeat_division(R)

if R - L  >= 2019:
    print(0)
elif l > r:
    print(0)
else:
    if repeat_division(l * (l + 1)) < repeat_division(r * (r - 1)):
        print(repeat_division(l * (l + 1)))
    else:
        print(repeat_division(r * (r - 1)))

Submission status: Wrong Answer

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

def repeat_division(n):
    while True:
        if n < 2019:
            break
        n %= 2019
    return n

l = repeat_division(L)
r = repeat_division(R)

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

Submission status: Wrong Answer

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

def repeat_division(n):
    while True:
        if n < 2019:
            break
        n %= 2019
    return n

l = repeat_division(L)
r = repeat_division(R)

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

Submission status: Wrong Answer

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

def repeat_division(n):
    while True:
        if n < 2019:
            break
        n %= 2019
    return n

l = repeat_division(L)
r = repeat_division(R)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l = lr[0]
r = lr[1]

ans=2019
l_2019 = l % 2019
r_2019 = r % 2019

if l_2019 == 0 or r_2019 == 0:
    print(0)
else:

    for i in range(l_2019,r_2019):
        for j in range(i+1, r_2019+1):
            new_ans = (i * j) % 2019
            if new_ans < ans:
                a= i
                b=j
                ans = new_ans

    print(ans)

Submission status: Wrong Answer

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


l = lr[0]
r = lr[1]

ans=2019
l_2019 = l % 2019
r_2019 = r % 2019

for i in range(l_2019,r_2019):
    for j in range(i+1, r_2019+1):
        new_ans = (i * j) % 2019
        if new_ans < ans:
            ans = new_ans
        
print(ans)

Submission status: Wrong Answer

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

l = lr[0]
r = lr[1]

ans=2018
l_2019 = l % 2019
r_2019 = r % 2019

for i in range(l_2019,r_2019):
    for j in range(i+1, r_2019+1):
        new_ans = (i * j) % 2019
        if new_ans < ans:
            ans = new_ans
        
print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
ans = 2020
if ((l//2019) != (r//2019)) or l%2019 == 0:
         print(0)
else:
         for i in range(l%2019,r%2019):
                  for j in range(i+1,r%2019+1):
                           if (i*j)%2019 < ans:
                                    ans = (i*j)%2019
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if (R - L) >= 2018:
    print(0)
else:
    answer = 2018
    for x in range(L, R):
        for y in range(x + 1, R + 1):
            answer = min(answer, x * y)
    print(answer)

Submission status: Wrong Answer

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

r_limit = R if R <= L + 2019 else L + 2019

li_w = sorted(list(x % 2019 for x in range(L, r_limit + 1)))[0:2]
print(li_w[0] * li_w[1])

Submission status: Wrong Answer

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

r_limit = R if R <= L + 2019 else L + 2019

li_w = sorted(list(set(x % 2019 for x in range(L, r_limit + 1))))[0:2]
print(li_w[0] * li_w[1])

Submission status: Wrong Answer

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

li_w = sorted(list(set(x % 2019 for x in range(L, R + 1))))[0:2]
print(li_w[0] * li_w[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
ans = 0
if (R-L < 2019):
    Lm = L%2019
    Rm = R%2019
    if (Lm < Rm):
        ans = Lm*(Lm+1)
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
l = L % 2019
p = int((R-L+1)/2019)
q = (R-L+1) % 2019

if p == 0 and l + q<2019:
    res = l*(l+1)%2019
else:
    res = 0
print(res)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
l = L % 2019
p = int((R-L+1)/2019)
q = (R-L+1) % 2019

if p == 0 and l + q<=2019:
    res = l*(l+1)%2019
else:
    res = 0
print(res)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
l = L % 2019
p = int((R-L+1)/2019)
q = (R-L+1) % 2019

if p == 0 and l + q<=2019:
    res = l*(l+1)
else:
    res = 0
print(res)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
p = int((R-L+1)/2019)

if p == 0 and l + r<=2019:
    res = l*(l+1)
else:
    res = 0
print(res)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
l = L % 2019
p = (R-L+1)//2019
q = (R-L+1)%2019

if p == 0 and l + q<2019:
    res = l*(l+1)
else:
    res = 0
print(res)

Submission status: Wrong Answer

Solution code:
l, r =map(int, input().split())
if l%2019==0 or r%2019==0:
    print(0)
else:
    l=l%2019
    r-=int(l/2019)*2019
    if r>=2019:
        print(0)
    else:
        r=r%2019
        if r<l:
            r+=2019
        minimum=999999999999999999
        for i in range(l,r):
            for j in range(i+1, r):
                minimum=min(minimum, i*j)

        print(minimum)

Submission status: Wrong Answer

Solution code:
l, r =map(int, input().split())
if l%2019==0 or r%2019==0:
    print(0)
elif r-l>=2019:
    print(0)
else:
    l=l%2019
    r=r%2019
    if r<l:
        r+=2019
    minimum=999999999999999999
    for i in range(l,r):
        for j in range(i+1, r):
            minimum=min(minimum, i*j)

    print(minimum)

Submission status: Wrong Answer

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

print(minimum)

Submission status: Wrong Answer

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

print(minimum)

Submission status: Wrong Answer

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

print(minimum)

Submission status: Wrong Answer

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

mod = 2019
minij = l * (l + 1)

for i in range(l, r-1):
    for j in range(i+1, r):
        if (i * j) % mod < minij:
            minij = (i*j) % mod

print(minij)

Submission status: Wrong Answer

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

mod = 2019
ij = [l * (l+1)]

a = l
b = l+1
while(a > mod and b > mod):
    a = a % mod
    b = b % mod
c = a * b
while(c > mod):
    c = c % mod
ij.append(c)

print(min(ij))

Submission status: Wrong Answer

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

mod = 2019
ij = [l * (l+1)]

for i in range(l, r-1):
    for j in range(i+1, r):
        a = i
        b = j
        while(a > mod and b > mod):
            a = a % mod
            b = b % mod
        c = a * b
        while(c > mod):
            c = c % mod
        if c < min(ij):
            ij.append(c)

print(min(ij))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
l,r=map(int,input().split())
s=np.array(range(l,r+1))
ans=[2018]
for i in range(r-l):
    for j in range(i+1,r-l+1):
        ans=min((s[i]%2019)*(s[j]%2019),ans)
        if ans==0:
            break
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if R - L >= 2018 or L % 2019 == 0 or L % 2019 > R % 2019:
    print(0)
else:
    print((L * -~L) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if R - L >= 2018 or L % 2019 == 0 or L % 2019 > R % 2019:
    print(0)
else:
    print((L % 2019) * (-~L % 2019))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
A=[]
for i in range(L,R+1):
  for j in range(i,R+1):
    A.append(i*j)
print(min(A))

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
if L%2019==0 or R%2019==0:
  print(0)
else:
  start=L%2019
  end=R%2019
  if start>=end or R-L>=2018: #中に2019の倍数が含まれるとき
    print(0)
  else:
    r=L%2019
    print((r*(r+1))%2019)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
if L%2019==0 or R%2019==0:
  print(0)
else:
  start=L%2019
  end=R%2019
  if start>=end or R-L>=2018: #中に2019の倍数が含まれるとき
    print(0)
  else:
    r=L%2019
    print(r*(r+1))

Submission status: Wrong Answer

Solution code:
import math
L, R = map(int,input().split())
MOD = 2019
if math.floor(L / MOD) * MOD >= L and math.floor(L / MOD) * MOD <= R:
  print(0)
else:
  print(L * (L+1) % MOD, )

Submission status: Wrong Answer

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

l=L%2019
r=R%2019

ans=0

if R-L<2019 and l<r:
    D=[]
    for i in range(l,r):
        for j in range(i+1,r+1):
            D.append((i*j)%2019)

print(ans)

Submission status: Wrong Answer

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

l=L%2019
r=R%2019

ans=0

if R-L<2019 and l<r:
    D=[]
    for i in range(l,r):
        for j in range(i+1,r+1):
            D.append(i*j)
    ans=min(D)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import bisect
L, R = map(int, input().split())
l = [i for i in range(L, R+1)]
l.sort()
list_len = R-L+1
max_mod, min_mod = l[-1] % 2019, l[0] % 2019
if list_len == max_mod-min_mod+1:
    print((l[0] * l[1]) % 2019)
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ans=0
a=0
count=0
for i in range(1000000):
    tmp=a
    a+=2019
    if l<a and a<r:
        ans=0
        break
    elif tmp<l and tmp<r and l<a and r<a:
        ans=(l*(l+1))%2019
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ansL = []
for i in range(5020):
    if L + i > R:
        break

    ansL.append((L + i) % 2019)

ansL = sorted(ansL)

print((ansL[0] * ansL[1]) % 2019)

Submission status: Wrong Answer

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

ansL = []
for i in range(5020):
    if L + i > R:
        break

    ansL.append((L + i) % 2019)

ansL = sorted(ansL)

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

Submission status: Wrong Answer

Solution code:
MOD = 2019
L,R = list(map(int,input().split()))
R = min(R, L + MOD)
nums = range(L,R+1)
answer = MOD
for i in range(L,R+1):
    for j in range(max(i+1,L), R+1):
        c = (i*j)%MOD
        if c < answer:
            print(c,i,j)
        answer = min(c,answer)
print(answer)

Submission status: Wrong Answer

Solution code:
MOD = 2019
L,R = list(map(int,input().split()))
R = min(R, L + MOD)
L %= MOD
R %= MOD
nums = range(L,R+1)
answer = MOD
for i in range(L,R+1):
    for j in range(max(i,L), R+1):
        c = (i*j)%MOD
        answer = min(c,answer)
print(answer)

Submission status: Wrong Answer

Solution code:
MOD = 2019
L,R = list(map(int,input().split()))
R = min(R, L + MOD)
L %= MOD
R %= MOD
nums = range(L,R+1)
answer = MOD
for i in range(L,R+1):
    for j in range(max(i+1,L), R+1):
        c = (i*j)%MOD
        answer = min(c,answer)
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
input = input().split()
L = int(input[0])
R = int(input[1])
memo = 100000000
for l_i in range(L,R-1):
  for r_i in range(l_i+1,R):
    result = (l_i*r_i)%2019
    if memo > result:
      memo = result
print(memo)

Submission status: Wrong Answer

Solution code:
import heapq
L,R = map(int,input().split())
if R - L >= 2019 :
    print(0)
else:
    heap = []
    for i in range(L,R+1,1):
        a = i % 2019
        heapq.heappush(heap,a)
    a = heapq.heappop(heap)
    b = heapq.heappop(heap)
    print(a*b%2019)

Submission status: Wrong Answer

Solution code:
import heapq
L,R = map(int,input().split())
if L - R >= 2019 :
    print(0)
else:
    heap = []
    for i in range(L,R+1,1):
        a = i % 2019
        heapq.heappush(heap,a)
    a = heapq.heappop(heap)
    b = heapq.heappop(heap)
    print(a*b%2019)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
# L <= i < j <= R
# (i*j)%2019 の最小値
M=[]
for i in range(L, R):
    for j in range(i+1, R+1):
        #print(i,j)
        M.append((i*j)%20119)
        if M[-1]==0:
            print(0)
            exit()
print(min(M))

Submission status: Wrong Answer

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

    print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

def f(i, j):
    if j - i >= MOD:
        return 0
    i %= MOD
    j %= MOD
    if i > j:
        return 0
    ans = 2018
    for a in range(i, j):
        for b in range(a+1, j+1):
            ans = min(ans, a*b%MOD)

print(f(L,R))

Submission status: Wrong Answer

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

def f(i, j):
    if j - i >= MOD:
        return 0
    i %= MOD
    j %= MOD
    if i > j:
        return 0
    return i*(i+1)%MOD

print(f(L,R))

Submission status: Wrong Answer

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

def f(i, j):
    if j - i >= 2019:
        return 0
    i %= MOD
    j %= MOD
    if i > j:
        return 0
    return i*(i+1)

print(f(L,R))

Submission status: Wrong Answer

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

    mi = l * r
    for i in range(l, r-1):
        for j in range(i+1, r):
            mod = (i*j) % 2019
            mi = min([mi, mod])
            if mod == 0:
                break

    print(mi)

cc133()

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
y = 2019
lmod = l % y
a = [float("inf")]*y
if r-l > y:
  print(0)
else:
  for i in range(r-l):
    a[i] = lmod * (lmod+i+1) % y
  print(min(a))

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
y = 2019
lmod = l % y
a = [float("inf")]*y
if r-l > y:
  for i in range(y):
    a[i] = lmod * i % y
  print(min(a))
else:
  for i in range(lmod+1, r-l+1):
    a[i] = lmod * i % y
  print(min(a))

Submission status: Wrong Answer

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

l = L // 2019
r = R // 2019

mi = 2019
if l == r:
	L = L % 2019
	R = R % 2019
	for i in range(L, R):
		for j in range(i+1, R+1):
			mi = min((i*j)%2019, mi)
else:
	L = L % 2019
	for i in range(L, 2018):
		for j in range(i+1, 2019):
			mi = min((i*j)%2019, mi)
print(mi)

Submission status: Wrong Answer

Solution code:
l,r = [int(i) for i in input().split()]
d = (r-l) % 2019
if d == 0: d = 2019
l = l % 2019
r = l + d

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 = [int(i) for i in input().split()]
d = (r-l) % 2019
l = l % 2019
r = l + d
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 = [int(i) for i in input().split()]
d = (r-l) % 2019
l = l % 2019
r = l + d

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())
ans=2018
d=r-l
if d>2019:
    d=2019

for i in range(l%2019,l%2019+d):
    for j in range(i+1,l%2019+d+1):
        a=i*j
        if a<ans:
            ans=a
print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ans=2018
d=r-l
if d>=2019:
    d=2019

for i in range(l%2019,l%2019+d):
    for j in range(i+1,l%2019+d+1):
        a=i*j
        if a<ans:
            ans=a
print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ans=0
d=r-l
if d>=2019:
    d=2019

for i in range(l%2019,(l+d)%2019):
    for j in range(i+1,(l+d)%2019+1):
        a=(i*j)%2019
        if a<ans:
            a=ans
print(ans)

Submission status: Wrong Answer

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

if R - L >= 2018: # R - L + 1 >= 2019
  out = 0
else:
  l = L%2019
  r = R%2019
  if r >= l:
    out = min(l*(l+1), l*(l+1)%2019)
    
  else:
    out = 0

print(out)

Submission status: Wrong Answer

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

if R - L >= 2018: # R - L + 1 >= 2019
  out = 0
else:
  l = L - (L//2019)*2019 # <- mod(L, 2019)
  r = R - (R//2019)*2019 # <- mod(R, 2019)
  if r >= l:
    out = l*(l+1) - (l*(l+1)//2019)*2019
  
  else:
    out = 0

print(out)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if r-l >= 2018:
  answer = 0
else:
  l = [i%2019 for i in range(l, r+1)]
  l.sort()
  answer = (l[0]*l[1])%2019

print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
MOD = 2019
flg = False
for i in range(L,R+1):
  if i % MOD == 0:
    flg = True
    break
print(0 if flg else L * (L + 1) % MOD)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
MOD = 2019
flg = False
for i in range(L,R+1):
  if i % MOD == 0:
    flg == True
    break
print(0 if flg else L * (L + 1) % MOD)

Submission status: Wrong Answer

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

l_2019 = L % 2019
r_2019 = R % 2019

min = 2019
if l_2019 >= r_2019:
    min = 0
for i in range(l_2019, r_2019):
    for j in range(i+1, r_2019+1):

        ij = i*j
        #print(i, j, ij, ij%2019, min)                                                                                 
        if ij % 2019 < min:
            min = ij % 2019
        if min == 0:
            break
print(min)

Submission status: Wrong Answer

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

l_2019 = L % 2019
r_2019 = R % 2019

min = 2019
if l_2019 > r_2019:
    min = 0
for i in range(l_2019, r_2019):
    for j in range(i+1, r_2019+1):

        ij = i*j
        #print(i, j, ij, ij%2019, min)                                                                                 
        if ij % 2019 < min:
            min = ij % 2019
        if min == 0:
            break
print(min)

Submission status: Wrong Answer

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

l_2019 = L % 2019
r_2019 = R % 2019

min = 2019
for i in range(l_2019, r_2019):
    for j in range(i+1, r_2019+1):
        ij = i*j
        if ij % 2019 < min:
            min = ij % 2019
        if min == 0:
            break
print(min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
l1 = -(-l//2019)
r1 = l//2019

if l1 <= r1:
    print(0)
else:
    if l%2019 < r%2019:
        print((l*(l+1))%2019)
    else:
        print(((r-1)*r)%2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
l1 = -(-l//2019)
r1 = l//2019

if l1 <= r1:
    print(0)
else:
    if l%2019 < r%2019:
        print((l*(l+1))%2019)
    else:
        print((r*(r+1))%2019)