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(" "))

list_1 = []
for i in range(R - L):
    a = L + i
    b = a + 1
    c = a % 2019 * b % 2019
    list_1.append(c)
print(min(list_1))

Submission status: Wrong Answer

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

if r-l+1 >= 2019 or L>R:
    ans = 0

if r-l+1 >= 3:
    ans = l*(l+1)%673
    if r-l+1 >= 673 or l%673 > r%673:
        ans = 0

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from heapq import nsmallest
l, r = map(int, input().split())

ans = 0
if r - l > 2019:
    ans = 0
else:
    mod_list = list(map(lambda x: x % 2019, range(l, r + 1)))
    minimum = min(mod_list)
    second_min = nsmallest(2, mod_list)[-1]
    ans = minimum * second_min
print(ans)

Submission status: Wrong Answer

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

l = l%2019
r = r%2019

if l == 0 or r == 0 :
    print(0)
    exit()

if l > r:
    r += 2019

# print(l, r)

list_score = []
for i in range(l+1, r+1):
    for j in range(l, i):
        # print(i, j)
        list_score.append(i*j%2019)
# print(list_score)
print(int(min(list_score)))

Submission status: Wrong Answer

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

l = l%2019
r = r%2019

if l == 0 or r == 0 :
    print(0)
    exit()

if l > r:
    r += 2019

# print(l, r)

list_score = []
for i in range(l, r+1):
    for j in range(i+1, r+1):
        # print(i, j)
        list_score.append(i*j%2019)
# print(list_score)
print(int(min(list_score)))

Submission status: Wrong Answer

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

l = l%2019
r = r%2019

if l > r:
    r += 2019

# print(l, r)

list_score = []
for i in range(l, r+1):
    for j in range(i+1, r+1):
        # print(i, j)
        list_score.append(i*j%2019)
# print(list_score)
print(int(min(list_score)))

Submission status: Wrong Answer

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

l = l%2019
r = r%2019

if l > r:
    r += 2019

# print(l, r)

list_score = []
for i in range(l, r+1):
    for j in range(i+1, r+1):
        print(i, j)
        list_score.append(i*j%2019)
# print(list_score)
print(int(min(list_score)))

Submission status: Wrong Answer

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

l = l%2019
r = r%2019

if l > r:
    r += 2019

list_score = []
for i in range(l+1, r+1):
    for j in range(i, r+1):
        list_score.append(i*j%2019)

print(int(min(list_score)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
Lmin = L % 2019
Rmin = R % 2019
anlis = []

if L-R >= 2018 or Lmin > Rmin:
    print(0)
    
else:
    for j in range(Lmin+1, Rmin+1):
        for i in range(Lmin, j):
            anlis.append((i * j) % 2019)
    print(min(anlis))

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
Lmin = L % 2019
Rmin = R % 2019
anlis = []

if L-R >= 2019 or Lmin > Rmin:
    print(0)
    
else:
    for j in range(Lmin, Rmin+1):
        for i in range(Lmin, j):
            anlis.append((i * j) % 2019)
    print(min(anlis))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x,y = map(int,input().split())
ans=y*y
x=x%2019
y=y%2019
if(x>=y):
    y+=2019

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

lm = l % 2019
rm = r % 2019

ll = min(lm,rm)
rr = max(lm,rm)

min_mod = 9999

for i in range(ll,rr+1):
    for j in range(i+1,rr+1):
        c = (i*j) % 2019
        if c < min_mod:
            min_mod = c

print(min_mod)

Submission status: Wrong Answer

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

lm = l % 2019
rm = r % 2019

ll = min(lm,rm)
rr = max(lm,rm)

min_mod = 9999

for i in range(ll,rr):
    for j in range(i+1,rr+1):
        c = (i*j) % 2019
        if c < min_mod:
            min_mod = c

print(min_mod)

Submission status: Wrong Answer

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

lm = l % 2019
rm = r % 2019

ll = min(lm,rm)
rr = max(lm,rm)

min_mod = 9999

for i in range(ll,rr):
    for j in range(i+1,rr):
        c = (i*j) % 2019
        if c < min_mod:
            min_mod = c

print(min_mod)

Submission status: Wrong Answer

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

lm = l % 2019
rm = r % 2019

ll = min(lm,rm)
rr = max(lm,rm)

print(ll*(ll+1))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

ans = float('inf')
for i in range(L, R):
    for j in range(L+1, R+1):
        ans = min(ans, i*j)

print(ans)

Submission status: Wrong Answer

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

print(L *(L+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import math
L,R = map(int, input().split())
#L,R = 4,5
#L,R = 2019,4037

l_mod = L % 2019
l_div = L // 2019
r_mod = R % 2019
r_div = R // 2019

if r_div - l_div >= 1:
    ans = 0
else:
    if l_mod == 0:
        ans = 0
    else:
        ans = (l_mod * (l_mod + 1)) % 2019
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
L,R = map(int, input().split())
#L,R = 4,5
#L,R = 2019,4037

l_mod = L % 2019
l_div = L // 2019
r_mod = R % 2019
r_div = R // 2019

if r_div - l_div >= 1:
    ans = 0
else:
    if l_mod == 0:
        ans = 0
    else:
        ans = l_mod * (l_mod + 1) % 2019
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
#L,R = map(int, input().split())
#L,R = 4,5
L,R = 2019,4037

l_mod = L % 2019
l_div = L // 2019
r_mod = R % 2019
r_div = R // 2019

if r_div - l_div >= 1:
    ans = 0
else:
    if l_mod == 0:
        ans = 0
    else:
        ans = l_mod * (l_mod + 1) % 2019
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
#L,R = map(int, input().split())
#L,R = 4,5
L,R = 2019,4037

l_mod = L % 2019
l_div = L // 2019
r_mod = R % 2019
r_div = R // 2019

if r_div - l_div >= 1:
    ans = 0
else:
    if l_mod == 0:
        ans = 0
    else:
        ans = l_mod * (l_mod + 1)
print(ans)

Submission status: Wrong Answer

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

l_mod = L % 2019
l_div = L // 2019
r_mod = R % 2019
r_div = R // 2019

if r_div - l_div >= 2:
    ans = 0
elif r_div - l_div == 1:
    if r_mod == 0:
        ans = l_mod
    else:
        ans = 1
else:
    ans = l_mod * (l_mod + 1)
print(ans)

Submission status: Wrong Answer

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

l_mod = L % 2019
next_zero = L + (2019 - l_mod)

if R < next_zero:
    print(l_mod * (l_mod + 1))
    sys.exit(0)
elif R == next_zero:
    print(l_mod)
    sys.exit(0)
elif R >= next_zero + 2019:
    print(0)
    sys.exit(0)
else:
    print(1)
    sys.exit(0)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
M=[0]*2019
A=[-1]*2019

if R-L>=2019:
  print(0)
else:
  for i in range(L,R+1):
    M[i%2019]=1
  for i in range(2019):
    a=2019
    for j in range(i+1,2019):
      if M[i] and M[j]:
        a=min(a,i*j%2019)
    A[i]=a
print(min(A))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

L = L%2019
R = R%2019
ans = 2019
for i in range(L, R):
    for j in range(i+1, R+1):
        mod_num = (i*j)%2019
        if ans > mod_num:
            ans = mod_num
print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

if L%2019 < 2019//2:
    if (2019-L%2019) < R-L:
        L = L%2019
        R = 0
    else:
        L = L%2019
        R = L + 1
elif (2019-L%2019) < R-L:
    L = 0
    R = L + 1
elif (2019-L%2019) >= R-L:
    L = L%2019
    R = R%2019

print((L*R)%2019)

Submission status: Wrong Answer

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

if L%2019 < 2019//2:
    if (2019-L%2019) < R-L:
        L = L%2019
        R = 0
    else:
        L = L%2019
        R = L + 1
elif (2019-L%2019) <= R-L:
    L = 0
    R = R%2019
elif (2019-L%2019) > R-L:
    L = L%2019
    R = R%2019

print((L*R)%2019)

Submission status: Wrong Answer

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

if L%2019 < 2019//2:
    if (2019-L%2019) < R-L:
        L = L%2019
        R = 0
    else:
        L = L%2019
        R = L + 1
elif (2019-L%2019) <= R-L:
    L = 0
    R = R%2019
elif (2019-L%2019) > R-L:
    L = L%2019
    R = L + 1

print((L*R)%2019)

Submission status: Wrong Answer

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

if L%2019 < 2019//2:
    if (2019-L%2019) < R-L:
        L = L%2019
        R = 0
    else:
        L = L%2019
        R = L + 1
elif (2019-L%2019) < R-L:
    L = 0
    R = R%2019
elif (2019-L%2019) >= R-L:
    L = L%2019
    R = R%2019

print((L*R)%2019)

Submission status: Wrong Answer

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

print(ans)

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(1)

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(2)

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(2)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
a=l%2019
b=r%2019
answer=10000000
if a>=b:
    b+=2019
for i in range(a,b+1):
    for j in range(a,b+1):
        if i!=j:
            answer=min(answer,(i*j)%2019)
print(answer)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
a=l%2019
b=r%2019
answer=10000000
if a>b:
    b+=2019
for i in range(a,b+1):
    for j in range(a,b+1):
        if i!=j:
            answer=min(answer,(i*j)%2019)
print(answer)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf8 -*-

l, r = map(int, input().split())
if (l - r) >= 2019:
    ans = 0
elif 0 in [n % 673 for n in range(l, r+1)] and 0 in [n % 3 for n in range(l, r+1)]:
    ans = 0
else:
    mo = sorted([n % 2019 for n in range(l, r + 1)])
    m = mo[0] * mo[1]
    ans = m if m < 2019 else m % 2019
print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

val.sort()

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

rem = []
for i in range(L,R):
  for j in range(i+1,R+1):
    x = i % 2019
    y = j % 2019
    rem.append(x*y)
    
print(min(rem))

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf8 -*-

l, r = map(int, input().split())
m = sorted([n % 2019 for n in range(l, r+1)])
print(m[0] * m[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if R*(R-1)<2019:
  print(R*(R-1))
  
else:
  if R == L+1:
    print((R*L)%2019)
    exit(0)
  else:
    r =673 - L % 673
    if L+r <= R:
      print("0")
      exit(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
            if ans == 0:
              break
print(ans)

Submission status: Wrong Answer

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

if L*(L+1)<2019:
  print(L*(L+1))
  
else:
  if R == L+1:
    print((R*L)%2019)
    exit(0)
  else:
    r =673 - L % 673
    if L+r <= R:
      print("0")
      exit(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
            if ans == 0:
              break
print(ans)

Submission status: Wrong Answer

Solution code:
def main(): 

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

    f_v = s_v = 2018 

    range_t = min(2019, R-L)

    for i in range(range_t + 1):
       if f_v % 2019 > (L + i) % 2019:
           s_v = f_v
           f_v = (L + i)
       elif s_v % 2019 > (L + i) % 2019:
           s_v = (L + i)


    print(s_v * f_v % 2019)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main(): 

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

    f_v = s_v = 2018 

    range_t = min(2019, R-L)

    print(range_t)

    for i in range(range_t + 1):
       if f_v % 2019 > (L + i) % 2019:
           s_v = f_v
           f_v = (L + i)
       elif s_v % 2019 > (L + i) % 2019:
           s_v = (L + i)


    print(s_v * f_v % 2019)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

solve()

Submission status: Wrong Answer

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

solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
lr = [i % 2019 for i in range(l, r + 1)]
a = min(lr)
b = sorted(lr)[1]
print(a*b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import heapq
 
L,R=map(int,input().split())
 
ans=2018*2017
if (R-L)>=2300:
    print("0")
else:
    l=list(range(L,R+1))
    for i in range(len(l)):
        for j in range(i+1,len(l)):
            #print(l[i],l[j],(l[i]*l[j])%2019)
            ans=min(ans,(l[i]*l[j])%2019)
            

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import heapq
 
L,R=map(int,input().split())
 
ans=2018*2017
if (R-L)>=2025:
    print("0")
else:
    l=list(range(L,R+1))
    for i in range(len(l)):
        for j in range(i+1,len(l)):
            #print(l[i],l[j],(l[i]*l[j])%2019)
            ans=min(ans,(l[i]*l[j])%2019)
            

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import heapq
 
L,R=map(int,input().split())
 
ans=2018*2017
if (R-L)>=2019:
    print("0")
else:
    l=list(range(L,R+1))
    for i in range(len(l)):
        for j in range(i+1,len(l)):
            #print(l[i],l[j],(l[i]*l[j])%2019)
            ans=min(ans,(l[i]*l[j])%2019)
            

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import heapq
 
L,R=map(int,input().split())
 
ans=2018*2017
if (R-L)>=2019:
    print("0")
else:
    l=list(range(L,R+1))
    for i in range(len(l)):
        for j in range(i+1,len(l)):
            print(l[i],l[j])
            ans=min(ans,(l[i]*l[j])%2019)
            

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import heapq
 
L,R=map(int,input().split())
 
ans=2018*2017
if (R-L)>=2019:
    print("0")
else:
    l=list(range(L,R+1))
    for i in range(len(l)):
        for j in range(i,len(l)):
            ans=min(ans,(l[i]*l[j])%2019)

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import heapq

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

q=[]
if (R-L)>=2019:
    print("0")
else:
    l=list(range(L,R+1))
    for item in l:
       heapq.heappush(q,item%2019)

    print(heapq.heappop(q)*heapq.heappop(q))

Submission status: Wrong Answer

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

if r - l > 2019:
    result = 0
else:
    for i in range(l, r):
        tmp_r = (i * (i+1))%base
        if tmp_r < result:
            result = tmp_r

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def module2019(m):
    if m <= 2018:
        return m
    else:
        return module2019(m%2019)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

L_low = L % 2019
R_low = R % 2019

    
if L_low >= R_low:
  R_low += 2019
R_low += 2019

result = 2019
for i in range(L_low, R_low): 
  for j in range(i+1, R_low+1):
#    print( 'j_' + str(j))
    result= min(result, (i * j) % 2019)
    if result == 0:
      print(0)
      exit()

print(result)

Submission status: Wrong Answer

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

L_low = L % 2019
R_low = R % 2019

    
#if L_low >= R_low:
#  R_low += 2019
R_low += 2019

result = 2019
for i in range(L_low, R_low): 
  for j in range(i+1, R_low+1):
#    print( 'j_' + str(j))
    result= min(result, (i * j) % 2019)
    if result == 0:
      print(0)
      exit()

print(result)

Submission status: Wrong Answer

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

L_low = L % 2019
R_low = R % 2019
if L_low >= R_low:
  R_low += 2019


result = 2019
for i in range(L_low, R_low): 
  for j in range(i+1, R_low+1):
#    print( 'j_' + str(j))
    result= min(result, (i * j) % 2019)
    if result == 0:
      print(0)
      exit()

print(result)

Submission status: Wrong Answer

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

L_low = L % 2019
R_low = R % 2019
if L_low >= R_low:
  R_low += 2019

if R == L:
  print(R % 2019)
  exit()

result = 2019
for i in range(L_low, R_low): 
  for j in range(i+1, R_low+1):
    result= min(result, (i * j) % 2019)

print(result)

Submission status: Wrong Answer

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

L_low = L % 2019
R_low = R % 2019
if R_low <= L_low:
  R_low += 2019

result = 2019
for i in range(L_low, R_low): 
  for j in range(i+1, R_low+1):
    result= min(result, (i * j) % 2019)

print(result)

Submission status: Wrong Answer

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

L_low = L % 2019
R_low = R % 2019

result = 2019
for i in range(L_low, R_low): 
  for j in range(i+1, R_low+1):
    result= min(result, (i * j) % 2019)

print(result)

Submission status: Wrong Answer

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

L_low = L % 2019
R_low = R % 2019

result = 2019
for i in range(L_low, R_low): 
  for j in range(L_low+1, R_low+1):
    result= min(result, (i * j) % 2019)

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
while True:
    try:
        L, R = map(int, input().split())
        if L%2019==0 or R%2019==0 or L<=2019<=R or R-L+1>=2019:
            print(0)
            continue
        mod = []
        for i in range(L, R+1):
            mod.append(i%2019)
            if len(mod) >= 2019:
                break
        mod.sort()
        print(mod[0]*mod[1])
    except:
        break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())

rA=A%2019
rB=B%12019
if rA>rB:
  ans=0
elif rA<rB:
  ans=min(rA,rB)*(min(rA,rB)+1)
print(ans)

Submission status: Wrong Answer

Solution code:
A,B=map(int,input().split())

if B-A>=2019:
  ans=0
else:
  low = A%2019
  high = B%2019
  if low>high:
    ans=0
  else:
    ans = (A%2019)*((A+1)%2019)
    ans%=2019
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
a = [int(i) % 2019 for i in range(1,l+1)]
b = [int(i) % 2019 for i in range(l,r+1)]
c = []
for i in range(l):
  for j in range(len(b)):
    s = a[i] * b[j] % 2019
    c.append(s)
print(min(c))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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