Problem:


Score : 300 points

Problem Statement

You are given two non-negative integers L and R.
We will choose two integers i and j such that L \leq i < j \leq R.
Find the minimum possible value of (i \times j) \mbox{ mod } 2019.

Constraints

All values in input are integers.

0 \leq L < R \leq 2 \times 10^9

Input

Input is given from Standard Input in the following format:

L R

Output

Print the minimum possible value of (i \times j) \mbox{ mod } 2019 when i and j are chosen under the given condition.

Sample Input 1

2020 2040

Sample Output 1

2

When (i, j) = (2020, 2021), (i \times j) \mbox{ mod } 2019  = 2.

Sample Input 2

4 5

Sample Output 2

20

We have only one choice: (i, j) = (4, 5).



Sample input:
2020 2040


Sample output:
2

Submission status: Wrong Answer

Solution code:
# import numpy as np
# import copy

def main():
    l,r = [ int(i) for i in input().split(' ')]
    count = 0
    lst = []
    for i in range(l,r):
        lst.append(i%2019)
        if(count > 2019):
            break
        count = count + 1

    print(min(lst))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

L=L%2019
R=L+d
if d>=2019:
  print(0)
  
else:
  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:
left, right = map(int, input().split())
imod = []
jmod = []
jleft = left + 1

for i in range(left, right):
    imod.append(i % 2019)
    if i % 2019 == 0:
        jleft = i + 1

for i in range(jleft, right+1):
    jmod.append(i % 2019)

print((min(imod) * min(jmod)) % 2019)

Submission status: Wrong Answer

Solution code:
left, right = map(int, input().split())
imod = []
jmod = []

for i in range(left, right+1):
    imod.append(i % 2019)

for i in range(imod.index(min(imod))+1, len(imod)):
    jmod.append(imod[i])

print(min(imod) * min(jmod) % 2019)

Submission status: Wrong Answer

Solution code:
left, right = map(int, input().split())
imod = []
jmod = []

for i in range(left, right+1):
    imod.append(i % 2019)

for i in range(imod.index(min(imod))+1, len(imod)):
    jmod.append(imod[i])

print(min(imod) * min(jmod))

Submission status: Wrong Answer

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

print(b)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
a = 0
b = 2019
for i in range(L, R + 1):
    a = i % 2019
    if a <= b:
        b = a

print(b * (b + 1) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
a = 0
b = 2019
for i in range(L, R + 1):
    a = i % 2019
    if a <= b:
        b = a

print(b * (b + 1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
m = 2019
l, r = l%m, l%m+(r-l)
if r-l >= m-1:
    print(0)
else:
    for mod in range(m):
        for i in range(l, r):
            if i%m == 0:
                print(0)
                exit()
            else:
                if (mod/i%m).is_integer():
                    if i < mod/(i%m) <= r:
                        print(mod)
                        exit()

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
m = 2019
l, r = l%m, l%m+(r-l)
if r-l >= m:
    print(0)
    exit()
else:
    for mod in range(m):
        for i in range(l, r+1):
            if i%m == 0:
                print(0)
                exit()
            else:
                if not (mod/i%m).is_integer():
                    continue
                else:
                    if i < mod/(i%m) <= r:
                        print(mod)
                        exit()

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
a = 10**10
for i in range(L,min(R,L+2019)+1):
    for j in range(i+1,min(R,L+2019)+1):
        a = min(a,(i*j)%2019)
        if a == 1:
            print(a)
            exit()
print(a)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
a = 10**10
for i in range(L,min(R,L+2019)):
    for j in range(i+1,min(R,L+2019)+1):
        a = min(a,(i*j)%2019)
        if a == 1:
            print("1")
            exit()
print(a)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
a = 1000000000000000000000000000000000
for i in range(L,R+1):
    for j in range(i+1,R+1):
        a = min(a,(i*j)%2019)
        if a == 1:
            print("1")
            exit()
print(a)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
a = 100000000000
for i in range(L,R+1):
    for j in range(i+1,R+1):
        a = min(a,(i*j)%2019)
        if a == 1:
            print("1")
            exit()
print(a)

Submission status: Wrong Answer

Solution code:
import math
#input
L, R = map(int, input().split())
ans = 2019
for i in range(L, R+1):
  for j in range(i+1, R+1):
    mod = i*j % 2019
    if mod == 0:
    	break
    if mod < ans:
      ans = mod
print(ans)

Submission status: Wrong Answer

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

min_mod = 2018

for i in range(l, r+1):
  min_mod = min(min_mod, i%2019)

print((min_mod*(min_mod+1))%2019)

Submission status: Wrong Answer

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

p, q = L%2019, R%2019
z = R - L

if (p == 0) or (q == 0) or (z > 2019) or (p >= q):
    print(0)
else:
    answer = []
    for i in range(z):#669
        for j in range(z-i):#669-i
            k1 = p + i#3
            k2 = j + i + 1
            X = k1 * k2 % 2019
            if X == 0:
                print(i,j,X)
            answer.append(X)
    A = min(answer, key=int)
    print(A)

Submission status: Wrong Answer

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

p, q = L%2019, R%2019
z = R - L

if (p == 0) or (q == 0) or (z > 2019) or (p >= q):
    print(0)
else:
    answer = []
    for i in range(z):
        for j in range(z-i):
            i = p + i
            j = j + i + 1
            X = i * j % 2019
            answer.append(X)
    A = min(answer, key=int)
    print(A)

Submission status: Wrong Answer

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

p, q = L%2019, R%2019
z = R - L

if (p == 0) or (q == 0) or (z >= 2019):
    print(0)
else:
    answer = []
    for i in range(z):
        K = q - i
        i = p + i
        for j in range(K-1):
            j = j + i + 1
            X = i * j % 2019
            answer.append(X)
    A = min(answer, key=int)
    print(A)

Submission status: Wrong Answer

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

p, q = L%2019, R%2019
z = R - L

if p == 0 or q == 0 or z >= 2019:
    print(0)
else:
    answer = []
    L, R = L%2019, R%2019
    for i in range(z):
        K = R - i
        i = L + i
        for j in range(K):
            j = j + i + 1
            X = i * j % 2019
            answer.append(X)
    A = min(answer, key=int)
    print(A)

Submission status: Wrong Answer

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

diff = R - L
min_mod = 2020
second_min_mod = 2021
for i in range(L, min(L+2019*2, L+(diff)+1)):
    new_mod = i % 2019
    if new_mod < min_mod:
        min_mod = new_mod
    elif new_mod < second_min_mod:
        second_min_mod = new_mod

print((min_mod * second_min_mod) % 2019)

Submission status: Wrong Answer

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

diff = R - L
min_mod = 2020
second_min_mod = 2021
for i in range(L, min(L+2019*2, L+(diff)+1)):
    new_mod = i % 2019
    if new_mod < min_mod:
        min_mod = new_mod
    elif new_mod < second_min_mod:
        second_min_mod = new_mod

print(min_mod * second_min_mod)

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


def main():
	l,r = map(int,input().split())
	l %= 2019
	r %= 2019
	mx = 2020
	l,r = min(l,r),max(l,r)
	for i in range(l,r+1):
		for j in range(i+1,r+1):
			t = i*j%2019
			if(t<mx):
				mx = t
	print(mx)

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Submission status: Wrong Answer

Solution code:
#C
L, R = list(map(int, input().split()))
result = 2018

if ((R/2019)-(L/2019)) >= 2:
    print(0)
else:
    for i in range(L,R+1):
        for s in range(i+1,R+1):
            a = 0
            b = 0
            a = i%2019
            b = s%2019
            x = (i*s)%2019
            if result >= x:
                result = x
print(result)

Submission status: Wrong Answer

Solution code:
#C
L, R = list(map(int, input().split()))
result = 2018

if ((R//2019)-(L//2019)) >= 2:
    print(0)
else:
    for i in range(L,R+1):
        for s in range(i+1,R+1):
            a = 0
            b = 0
            a = i%2019
            b = s%2019
            x = (i*s)%2019
            if result >= x:
                result = x
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
temp=input().split()
L=int(temp[0])
R=int(temp[1])

print(min([(i*j)%2019 for i in range(L, R) for j in range(i, R+1)]))

Submission status: Wrong Answer

Solution code:
import numpy as np
def min_mod2019(L, R):
    min_mod = 2019
    mod_list = [i for i in range(2019)]

    if L%2019 < R%2019:
        mod_list = mod_list[L%2019:R%2019+1]
    elif R%2019 < L%2019:
        mod_list = mod_list[R%2019:]+mod_list[:L%2019+1]

    for i in range(len(mod_list)):
        for j in range(i+1, len(mod_list)):
            min_mod = min(min_mod, (mod_list[i]*mod_list[j])%2019)
    return min_mod

if __name__ == '__main__':
    L, R =map(int,input().split(' '))
    print(min_mod2019(L, R))

Submission status: Wrong Answer

Solution code:
import numpy as np
l,r =  map(int,input().split())
MOD= 2019
ans = 10**10
if r-l+1 >= MOD:
  print(0)
else:
  for x in range(l,r-1):
    for y in range(x+1,r):
      ans = min((x*y)%MOD,ans)
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
l,r =  map(int,input().split())
MOD= 2019
ans = 10**10
if r-l+1 >= MOD:
  print(0)
else:
  i = l % MOD
  j = r % MOD
  for x in range(i,j-1):
    for y in range(x+1,j):
      ans = min((x*y)%MOD,ans)
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
l,r =  map(int,input().split())
MOD= 2019
ans = 10**10
if r-l+1 >= MOD:
  print(0)
else:
  i = l % MOD
  j = r % MOD
  for x in range(i+1,j):
    for y in range(x+1,j):
      ans = min((x*y)%MOD,ans)
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
l,r =  map(int,input().split())
MOD= 2019
ans = 10**10
if r-l+1 >= MOD:
  print(0)
else:
  i = l % MOD
  j = r % MOD
  for x in range(i,j):
    for y in range(x+1,j):
      ans = min((x*y)%MOD,ans)
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
l,r =  map(int,input().split())
MOD= 2019
if r-l+1 >= MOD:
  print(0)
else:
  i = (l+1) % MOD
  j = r % MOD
  x = np.array((i,j),dtype=np.int32)
  m = np.min(x)
  ans = m * (m+1)
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
l,r =  map(int,input().split())
MOD= 2019
if r-l >= MOD:
  print(0)
else:
  i = l % MOD
  j = r % MOD
  x = np.array((i,j),dtype=np.int32)
  m = np.min(x)
  ans = m * (m+1)
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
l,r =  map(int,input().split())
MOD= 2019
if r-l+1 >= MOD:
  print(0)
else:
  i = l % MOD
  j = r % MOD
  x = np.array((i,j),dtype=np.int32)
  m = np.min(x)
  ans = m * (m+1)
  print(ans)

Submission status: Wrong Answer

Solution code:
N=list(map(int,input().split()))
#A=list(map(int,input().split()))
print((N[0]%2019)*(N[1]%2019)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mod_L = L % 2019
mod_R = R % 2019

if (mod_L >= mod_R):
  min = 0
else:
  for i in range(mod_L, mod_R):
    for j in range(mod_L + 1, mod_R + 1):
      result = (i * j) % 2019
      if (result < min):
      	min = result

print(min)

Submission status: Wrong Answer

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

for i in range(L, R):
  for j in range(i+1, R+1):
    if (j - i >= 2019):
      break
    
    result = (L * j) % 2019

    if (result < min):
      min = result
      if (min == 0):
        break
            
print(min)

Submission status: Wrong Answer

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

for j in range(L+1, R+1):
  if (j - L >= 2019):
    break
    
  result = (L * j) % 2019

  if (result < min):
      min = result

print(min)

Submission status: Wrong Answer

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

    if (result < min):
        min = result

print(min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

L, R = map(int, input().split())
min = 2019
for i in range(L, R):
  for j in (i+1, R+1):
    ans = (i*j) % 2019
    if ans == 0:
      print(0)
      exit()
    elif ans < min:
      min = ans

print(min)

Submission status: Wrong Answer

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

L, R = map(int, input().split())
min = 2019
for i in range(L, R):
  for j in (i+1, R+1):
    ans = i*j % 2019
    if ans == 0:
      print(0)
      exit()
    elif ans < min:
      min = ans

print(min)

Submission status: Wrong Answer

Solution code:
def main():
    L, R = list(map(int, input().split()))
    ans = 2018
    end = min(R+1, L+2019)
    for i in range(L, end-1):
        for j in range(i+1, end):
            print(ans, (i*j)%2019)
            ans = min(ans, (i*j)%2019)
    print(ans)

main()

Submission status: Wrong Answer

Solution code:
def main():
    # L, R = list(map(int, input().split()))
    L, R = 2020, 2040
    ans = 2018
    end = min(R+1, L+2019)
    for i in range(L, end-1):
        for j in range(i+1, end):
            ans = min(ans, (i*j)%2019)
    print(ans)

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    l, r = map(int, input().split())
    ans = solve(l, r)
    print(ans)


def solve(l, r):
    N = 2019

    if l%N==0 or r%N==0:
        return 0

    n = (l//N+1)*N
    if l <= n <= r:
        return 0

    return l * (l+1) % N


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 28 20:37:55 2019

@author: avina
"""

l,r = map(int, input().split())
k = 2020

for i in range(l,r):
   k = min(i%2019,k)
   if k ==0:
       break
if k*(k+1) <2019:
    print(k*(k+1))
else:
    print((k*(k+1))%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
a = (n%2019) * (m%2019)
print(a%2019)

Submission status: Wrong Answer

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

# L, R = [1, 2019]
LR_res = [L % 2019, R % 2019]
LR_res.sort()
l, r = LR_res
ans = 2018
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        ans = min(ans, (i * j) % 2019)
        # print(i,j)
        if ans == 0:
            print(ans)
            exit()

print(ans)

Submission status: Wrong Answer

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

# L, R = [2019 * 2 - 2014, 2019 * 2 + 1]
LR_res = [L % 2019, R % 2019]
LR_res.sort()
l, r = LR_res
print(l, r)
ans = 2018
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        ans = min(ans, (i * j) % 2019)
        # print(i,j)
        if ans == 0:
            print(ans)
            exit()

print(ans)

Submission status: Wrong Answer

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

# L, R = [4,6]
LR_res = [L % 2019, R % 2019]
LR_res.sort()
l, r = LR_res
# print(l, r)
ans = 2018
for i in range(l, r + 1):
    # print(i)
    for j in range(i + 1, r + 1):
        res = (i * j) % 2019
        # print(i,j,res)
        if res < ans:
            ans = res

print(ans)

Submission status: Wrong Answer

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

# L, R = [2020, 2040]
LR_res = [L % 2019, R % 2019]
LR_res.sort()
l, r = LR_res
# print(l, r)
ans = 2018
for i in range(l, r + 1):
    # print(i)
    for j in range(i + 1, r + 1):
        res = (i * j) % 2018
        # print(i,j,res)
        if res < ans:
            ans = res

print(ans)

Submission status: Wrong Answer

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

# L, R = [4,6]
LR_res = [L % 2019, R % 2019]
LR_res.sort()
l, r = LR_res
ans = 2018
for i in range(l, r + 1):
    for j in range(l, i):
        res = (i * j) % 2018
        if res < ans:
            ans = res

print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019

min = 2019
if LL >= RR:
    min = 0
else:
    for i in range(LL, RR+1):
        for j in range(i+1, RR+1):
            if (i*j)%2019 < min:
                min = (i*j)%2019
            if (i*j)%2019 == 0:
                min = 0
                break
        else:
            continue
        break


print(min)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019
min = 2019


for i in range(LL, RR+1):
    for j in range(i+1, RR+1):
        if (i*j)%2019 < min:
            min= (i*j)%2019
        if (i*j)%2019 == 0:
            min = 0
            break
    else:
        continue
    break


print(min)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019
min = 2019

if R-L >= 2018 or RR < LL:
    min= 0
elif RR*(RR-1)<2019:
    min = LL*(LL-1)
else:
    for i in range(LL, RR+1):
        for j in range(i+1, RR+1):
            if (i*j)%2019 < min:
                min= (i*j)%2019


print(min)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019
min = 2019

if R-L >= 2018 or RR <= LL:
    min= 0
elif RR*(RR-1)<2019:
    min = LL*(LL-1)
else:
    for i in range(LL, RR+1):
        for j in range(i+1, RR+1):
            if (i*j)%2019 < min:
                min= (i*j)%2019


print(min)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019
min = 2019

if R-L >= 2018 or RR <= LL:
    min= 0
elif RR*(RR-1)<2019:
    min = LL*(LL-1)
else:
    for i in range(LL, RR+1):
        for j in range(i+1, RR+1):
            if (i*j)%2019 < min:
                min= (i*j)


print(min)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
import numpy as np
L = L%2019
R = R%2019
min = 2019

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


print(min)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
import numpy as np
L = L%2019
R = R%2019
min = 2019

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


print(min)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
import numpy as np
min = 2019
for i in range(L+1, R+1):
    for j in range(i+1, R+1):
        if (i*j)%2019 < min:
            min = (i*j)%2019

print(min)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
import numpy as np
min = 2019
for i in range(L+1, R+1):
    for j in range(L+1, R+1):
        if (i*j)%2019 < min:
            min = (i*j)%2019

print(min)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
import numpy as np
ans = -1
for k in range(L+1, R+1):
    if k % 2019 == 0:
        ans = 0
        break

if ans == -1:
    ans = L*(L+1) % 2019

print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
import numpy as np
ans = -1
for k in range(L+1, R+1):
    if k % 2019 == 0:
        ans = 0
        break

if ans == -1:
    ans = L*(L+1)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
flg=0
if R>L+2019:flg=1
L%=2019
R%=2019
print([(L*(L+1))%2019,0][R<=L or flg==1])

Submission status: Wrong Answer

Solution code:
L,R=input().split()
L=int(L)%2019
R=int(R)%2019
print([(L*(L+1))%2019,0][R<=L])

Submission status: Wrong Answer

Solution code:
L,R=input().split()
L=int(L)%2019
R=int(R)%2019
print([L*(L+1),0][R<=L])

Submission status: Wrong Answer

Solution code:
L,R=input().split()
L=int(L)%2019
R=int(R)%2019
print([L*L+1,0][R<=L])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
mi = 10 ** 9
mii = 10 ** 9
for x in range(l,min(r+1,l+2019**2)):
    if x%2019 < mii:
        mii = x%2019
        mi1 = x
    elif mii < x%2019 < mi:
        mi = x%2019
        mi2 = x
    else:
        pass
print((mi1*mi2)%2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
mi = 10 ** 9
mii = 10 ** 9
for x in range(l,min(r+1,l+2019**2)):
    if x%2019 < mii:
        mii = x%2019
    elif mii < x%2019 < mi:
        mi = x%2019
    else:
        pass
print((mi*mii)%2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
mi = 10 ** 9
mii = 10 ** 9
for x in range(l,min(r+1,l+4500)):
    if x%2019 <= mii:
            mii = x%2019
    elif mii < x%2019 <= mi:
        mi = x%2019 
    else:
        pass
print((mi*mii)%2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
mi = 10 ** 9
mii = 10 ** 9
for x in range(l,min(r+1,l+4500)):
    if mii < x%2019 <= mi:
        mi = x%2019 
    elif x%2019 <= mii:
        mii = x%2019
    else:
        pass
print((mi*mii)%2019)

Submission status: Wrong Answer

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input133c.txt')

#+++++

i,j= map(int, input().split())

num = 2019

if i + 1 <= j:
    print(i * j % 2019)
    exit()

for n in range(i, j):
    for m in range(i+1,j):
        mod = (n % 2019) * (m % 2019) % 2019
        if mod < num:
            num = mod
	
        if num == 0:
            print(0)
            exit()
        
print(num)

Submission status: Wrong Answer

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input133c.txt')

#+++++

i,j= map(int, input().split())

num = 2019

if i + 1 <= j:
    print(i * j % 2019)
    exit()

for n in range(i, j):
    for m in range(i+1,j):
        mod = n * m % 2019
        if mod < num:
            num = mod
	
        if num == 0:
            print(0)
            exit()
        
print(num)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if (R - L) // 2019 >= 1:
  print(0)
elif R == L+1:
  print((R*L)%2019)
else:
  m, m_ = 2019, 2019
  for i_ in range(L, R+1, 1):
    m__ = i_ % 2019
    if m__ < m:
      m_ = m
      m = m__
    elif m__ < m_:
      m_ = m__
  print((m*m_) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
S = input().split() 
L = int(S[0])
R = int(S[1])
ans = 2019*2019

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

MOD = 2019  # type: int

def solve(L: int, R: int):
    if R - L + 1 >= 2019:
        print(0)
    else:
        m = 2019
        for i in range(L, R+1):
            if m > (i % 2019):
                m = i % 2019
        print((m * (m + 1)) % 2019)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def solve(left, right):
    if right - left >= 2019:
        return 0
    if 2019 * (left // 2019 + 1) <= right:
        return 0
    l_mod = left % 2019
    r_mod = right % 2019
    if l_mod < 2019 - r_mod:
        return (l_mod * (l_mod + 1)) % 2019
    else:
        return ((r_mod - 1) * r_mod) % 2019


if __name__ == '__main__':
    L, R = map(int, input().split())
    print(solve(L, R))