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())
amari = (l*(l+1))%2019
amari_o = amari
for i in range(l+1,r+1):
    amari = min((l*i)%2019,amari)
    if amari == amari_o:
        break
print(amari)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
ls = []
for i in range(l, min(r+1, l+4040)):
    ls.append(i%2019)
l = sorted(ls)
if len(l) == 1:
    print(l[0]*l[0])
    exit()
print(l[0]*l[1])

Submission status: Wrong Answer

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

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):
        for j in range(i+1,r+1):
            temp = (i*j) % 2019
            if ans > temp:
                ans = temp

print(ans)

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(i+1,r+1):
            temp = (i*j) % 2019
            if ans > temp:
                ans = temp

print(ans)

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(i+1,r+1):
            temp = (i*j) % 2019
            if ans > temp:
                ans = temp

print(ans)

Submission status: Wrong Answer

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

l_mod = l % 2019
r_mod = r % 2019

if r-l >= 2019 or l_mod >= r_mod:
    print(0)
else:
    print((l_mod * (l_mod+1)) % 2019)

Submission status: Wrong Answer

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

l_mod = l % 2019
r_mod = r % 2019

if r-l >= 2019 or l_mod >= r_mod:
    print(0)
else:
    print(l_mod * (l_mod+1))

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
ml = L % 2019
mr = R % 2019

if ml < mr:
  print((ml * (ml+1)) % 2019)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
ml = L % 2019
mr = R % 2019

if ml < mr:
  print(ml * (ml+1))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
from sys import exit
l,r=map(int,input().split())
res=1000000000000
if r-l>2020:
	print("0")
	exit()
else:
	for i in range(l%2019,r%2019):
		for j in range(i+1,r%2019+1):
			res=min(res,(i%2019)*(j%2019))
print(res)

Submission status: Wrong Answer

Solution code:
M = 2019

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

if R-L >= M or L%M >= R%M:
    ans = 0
else:
    ans = M
    L, R = L%M, R%M
    for i in range(L, R+1):
        for j in range(L+1, R+1):
            ans = min(ans, (i*j)%M)

print(ans)

Submission status: Wrong Answer

Solution code:
def myAnswer(L:int,R:int) -> int:
   if(L % 2019 > R % 2019 or (R - L) >= 2019 or L % 2019 == 0 or R % 2019 == 0):return 0
   return (L % 2019)*(L % 2019 +1)

def modelAnswer():
   return
def main():
   L,R = map(int,input().split())
   print(myAnswer(L,R))
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

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

prime = prime_factorize(l)+prime_factorize(r)

if 3 in prime and 673 in prime:
    print(0)
else:
    print((l*(l+1))%2019)

Submission status: Wrong Answer

Solution code:
import sys
L,R=map(int, sys.stdin.readline().split())
sho1=(L-1)/2019
sho2=R/2019
if 1<=sho2-sho1:
    print 0
else:
    ans=float("inf")
    for i in range(L,R):
        for j in range(i+1,R+1):
            print i,j
            ans=min(ans,i*j%2019) 
    print ans

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import sys
def rem(i,j):
    return (i*j)%2019
l, r = map(int, input().split())
cnt=2018
if (r - l >= 2019):
    print(0)
else:
    for i in range(l, r):
        for j in range(i + 1, r):
            cnt = min(rem(i, j), cnt)
if (r - l == 1):
    cnt=min(cnt,r*l%2019)
print(cnt)

Submission status: Wrong Answer

Solution code:
import math
import sys

l, r = map(int, sys.stdin.readline().rstrip().split())


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

Submission status: Wrong Answer

Solution code:
import math
import sys

l, r = map(int, sys.stdin.readline().rstrip().split())


if math.ceil(l / 2019) * 2019 < r:
    print(0)
else:
    print((l % 2019) * ((l+1) % 2019))

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    l, r = map(int, input().split())
    tmp = []
    for i in range(l, min(r + 1, l + 4029)):
        tmp.append(i % 2019)
    tmp.sort()
    print(tmp[0] * tmp[1] % 2019)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    l, r = map(int, input().split())
    tmp = []
    for i in range(l, min(r + 1, l + 4029)):
        print(i)
        tmp.append(i % 2019)
    tmp.sort()
    print(tmp[0] * tmp[1] % 2019)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    l, r = map(int, input().split())
    tmp = []
    for i in range(l, min(r + 1, l + 4029)):
        tmp.append(i % 2019)
    tmp.sort()
    print(tmp[0] * tmp[1])

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
mod = 2019
l_n = l//mod
r_n = r//mod
ans = float("inf")
if l_n == r_n:
    for i in range(l, r):
        for j in range(i, r+1):
            if ans >= i*j % mod:
                ans = i*j % mod
    print(ans % mod)
elif l_n < r_n:
    print(0)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
mod = 2019
l_n = l//mod
r_n = r//mod
ans = float("inf")
if l_n == r_n:
    for i in range(l, r):
        for j in range(i, r+1):
            if ans >= i*j % mod:
                ans = i*j % mod
    print(ans)
elif l_n < r_n:
    print(0)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
mod = 2019
l_n = l//mod
r_n = r//mod
#print(l_n, r_n)
if l_n == r_n:
    l_mod = l % mod
    l1_mod = (l_mod + 1) % mod
    ans = l_mod*l1_mod % mod
    print(ans)
elif l_n < r_n:
    print(0)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
mod = 2019
l_n = l//mod
r_n = r//mod
#print(l_n, r_n)
if l_n == r_n:
    print((l % mod)*((l+1) % mod) % mod)
elif l_n < r_n:
    print(0)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
mod = 2019
l_n = l//mod
r_n = r//mod
#print(l_n, r_n)
if l_n == r_n:
    print((l % mod)*((l+1) % mod))
elif l_n < r_n:
    print(0)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
mod = 2019
l_n = l//mod
r_n = r//mod
#print(l_n, r_n)
if l_n == r_n:
    if l_n == 0:
        print(l*(l+1))
    else:
        print((l % mod)*((l+1) % mod))
elif l_n < r_n:
    print(0)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
tmp = [0 for _ in range(R - L + 1)]
res = 10 ** 15
for i in range(L, R + 1):
    tmp[i - L] = i % 2019

tmp.sort()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
ml = L // 2019
mr = R // 2019

for i in range(ml, mr+1):
  print(i)
  if L <= 2019 * i <= R:
    print(0)
    exit()

L %= 2019
R %= 2019
ans = float('inf')
if L > R:
  L, R = R, L
elif L == R:
  R += 2019
if L == 0 or R == 0:
  print(0)
  exit()

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())
L %= 2019
R %= 2019
ans = float('inf')
if L > R:
  L, R = R, L
elif L == R:
  R += 2019

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

print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
L %= 2019
R %= 2019
ans = float('inf')
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())
if l%2019==0 or r%2019==0:print(0)
elif r < 2019: print((l*(l+1))%2019)
else:
    n = 2019
    i = 1
    while l > n:
        n *= i
        i += 1
    n = [n-2019, n]
    if l <= n[0] <= r or l<= n[1] <= r: print(0)
    else:
        if l-n[0]<n[1]-r: print((l-n[0])*(l-n[0]+1))
        else: print((n[1] - r)*(n[1] - r + 1))

Submission status: Wrong Answer

Solution code:
l,r = map(int, input().split())
if l%2019==0 or r%2019==0:print(0)
elif r < 2019: print((l*(l+1))%2019)
else:
    n = 2019
    i = 1
    while l > n:
        n *= i
        i += 1
    n = [n-2019, n]
    if l <= n[0] <= r or l<= n[1] <= r: print(0)
    else:
        print(min(l - n[0], n[1] - r)+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if (a==2019)or(b==2019):
    ans=0
elif (a<2019)and(b>2019):
    ans=0
else:
    ans=(a*(a+1))%2019
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import sys
l, r = map(int, input().split())
mod=2018
for i in range(l, r):
    for j in range(l + 1, r):
        if (i * j % 2019 < mod):
            mod = i * j % 2019
if (r - l == 1 and r * l % 2019 < mod):
    mod=r*l%2019
print(mod)

Submission status: Wrong Answer

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

c=[]

for i in range(a,b+1):
  c.append(i%2019)
d=sorted(c)
print(d[0]*d[1])

Submission status: Wrong Answer

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



main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# C - Remainder Minimization 2019
import numpy as np

l, r = map(int, input().split())
r = (r-l)%2019 + l

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())
amari = 2018
for i in range(l, l+2020):
  for j in range(i+1, l+2020):
    temp = (i*j)%2019
    if temp < amari:
      amari = temp
print(amari)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = il()
    ret = 2019
    for i in range(L, R+1):
        for j in range(i + 1, R + 1):
            ret = min(ret, (i * j) % 2019)
            if ret == 0:
                break
        else:
            continue
        break
    else:
        print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = il()
    ret = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ret = min(ret, (i * j) % 2019)
        if ret == 0:
            break
    else:
        print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = il()
    ret = 2019
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            ret = min(ret, (i * j) % 2019)
        if ret == 0:
            break
    else:
        print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if abs(L-R) == 1:
    print((L*R) % 2019)
    exit()

s = list(map(int, range(L+1, R)))

s = np.array(s)

print(min(s % 2019))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = [int(x) for x in input().split()]

a = l % 2019
temp = r % 2019
b = temp if a < temp else temp + 2019

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

Submission status: Wrong Answer

Solution code:
l, r = [int(x) for x in input().split()]

l %= 2019
temp = r % 2019
r = temp if temp > l else temp + 2019

ans = 2019
for i in range(l, r):
    for j in range(i + 1, r + 1):
        temp = (i * j) % 2019
        if temp < ans:
            ans = temp
            if ans == 0:
                print(0)
                exit()
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
MOD = 2019
# L = 2020
# R = 2040
diff = (R - L) % MOD if (R - L) % MOD != 0 else MOD
new_L = L % MOD
new_R = new_L + diff
# print("diff:{}, new_L:{}, new_R:{}".format(diff, new_L, new_R))

ans = L*R%MOD
for i in range(new_L, new_R):
    for j  in range(i+1, new_R+1):
        if ans > i*j%MOD:
            ans = i*j%MOD
            if ans == 0:
                break
    if ans == 0:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
MOD = 2019
# L = 2020
# R = 2040
diff = (R - L) % MOD if (R - L) % MOD != 0 else MOD
new_L = L % MOD
new_R = new_L + diff
# print("diff:{}, new_L:{}, new_R:{}".format(diff, new_L, new_R))

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
MOD = 2019
# L = 2020
# R = 2040
diff = (R - L) % MOD
new_L = L % MOD
new_R = new_L + diff
# print("diff:{}, new_L:{}, new_R:{}".format(diff, new_L, new_R))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
m = 673
if l//m != r//m:
    print(0)
else:
    ans = 673
    l = l%m
    r = r%m
    for i in range(l, r):
        for j in range(i+1, r+1):
            ans = min(ans, (i*j)%m)
            if ans <= 2:
              break
        if ans <= 2:
            break
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    print(ans)

Submission status: Wrong Answer

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

    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    l, r = MI()
    mod = 2019

    if r - l >= 2019:
        print(0)
    else:
        lst = []
        for i in range(l, r+1):
            lst.append(i % mod)
        lst = sorted(lst)
        print(lst[0] * lst[1] % mod)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    l, r = MI()
    mod = 2019

    if r - l >= 2019:
        print(0)
    else:
        lst = []
        for i in range(l, r+1):
            lst.append(i % mod)
        lst = sorted(lst)
        print(lst[0] * lst[1])


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    l, r = MI()
    mod = 2019

    lst = []
    for i in range(0, min(pow(2019, 2), r-l)+1):
        t = (l + i) % mod
        lst.append(t)
        # print(t)
    lst.sort()
    print(lst[0] * lst[1])


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    l, r = MI()
    mod = 2019

    lst = []
    for i in range(0, min(2019, r-l)+1):
        t = (l + i) % mod
        lst.append(t)
        # print(t)
    lst.sort()
    print(lst[0] * lst[1])


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

import numpy as np

L, R = map(int, input().split())
if (R - L) > 2020:
    print(0)
    exit()
else:
    k = np.arange(L, R + 1, dtype=np.int64)
    k = k % 2019
    k = sorted(k)
    print(k[0] * k[1])

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1


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

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





# def main():

# if __name__ == '__main__':
#     main()

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
# r = min(r, l + MOD - 1)
MOD=2019

if l > 2019:
    l=l%2019+2019

if r > 2019:
    r=r%2019+2019+2019
    # if r < l:
    #     r+=2019
    #     r+=2019


# print(l,r)
# exit()

def main():
    res = MOD - 1
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = min(res, (i % MOD) * (j % MOD) % MOD)
    print(res)
 
if __name__ ==  '__main__':
    main()

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
# r = min(r, l + MOD - 1)
MOD=2019

if l > 2019:
    l=l%2019+2019

if r > 2019:
    r=r%2019+2019
    if r < l:
        r+=2019


# print(l,r)
# exit()

def main():
    res = MOD - 1
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = min(res, (i % MOD) * (j % MOD) % MOD)
    print(res)
 
if __name__ ==  '__main__':
    main()

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
# r = min(r, l + MOD - 1)
MOD=2019

if l > 2019:
    l=l%2019+2019


if r > 2019:
    r=r%2019+2019


def main():
    res = MOD - 1
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = min(res, (i % MOD) * (j % MOD) % MOD)
    print(res)
 
if __name__ ==  '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
a = sorted(set(list([l%2019,(l+1)%2019,r%2019,(r-1)%2019])))
print(a[0]*a[1])

Submission status: Wrong Answer

Solution code:
l, r = list(map(int, input().split()))
# b = list(map(int, input().split()))
# 2019=3*673

if r-l >= 2019:  # 2019の倍数がある
    ans = 0
elif r-l >= 673:  # 673の倍数,3の倍数がある
    ans = 0
elif l <= 2019 and 2019 <= r:  # 2019がある
    ans = 0
elif l <= 673 and 673 <= r and r-l >= 3:  # 673があって,3の倍数もある
    ans = 0
elif r-l >= (r % 2019):  # lとrの間に2019の倍数がある
    ans = 0
elif r-l >= (r % 673) and r-l >= 3:  # lとrの間に673の倍数があって,3の倍数もある
    ans = 0
else:
    ans = (l*(l+1)) % 2019

print(0)

Submission status: Wrong Answer

Solution code:
l, r = list(map(int, input().split()))
# b = list(map(int, input().split()))
# 2019=3*673

if r-l >= 2019:  # 2019の倍数がある
    ans = 0
elif r-l >= 673:  # 673の倍数,3の倍数がある
    ans = 0
elif l <= 2019 and 2019 <= r:  # 2019がある
    ans = 0
elif l <= 673 and 673 <= r and r-l >= 3:  # 673があって,3の倍数もある
    ans = 0
elif r-l >= (r % 2019):  # lとrの間に2019の倍数がある
    ans = 0
elif r-l >= (r % 673) and r-l >= 3:  # lとrの間に673の倍数があって,3の倍数もある
    ans = 0
else:
    ans = (l*(l+1)) % 2019

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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