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())
d=R-L
ans=2019
if d>=2019:print(0)
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            a = (i*j)%2019
            if a < ans:ans=a
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#133C
import sys
L, R = map(int, sys.stdin.readline().split())

M =[]
f = False
for i in range(L, R+1):
    tmp = i%2019
    if tmp==0:
        print(0)
        f=True
        break
    M.append(tmp)

ans =2020
if f == False:
    for i in range(len(M)):
        for j in range(i+1, len(M)):
            tmp2 = (M[i]*M[j])%2019
            if ans > tmp2:
                ans = tmp2
print(ans)

Submission status: Wrong Answer

Solution code:
#133C
import sys
L, R = map(int, sys.stdin.readline().split())

M =[]
f = False
for i in range(L, R+1):
    tmp = i%2019
    if tmp==0:
        print(2019)
        f=True
        break
    M.append(tmp)

if f == False:
    M.sort()
    print(M[0]*M[1])

Submission status: Wrong Answer

Solution code:
#133C
import sys
L, R = map(int, sys.stdin.readline().split())

M =[]
f = False
for i in range(L, R+1):
    tmp = i%2019
    if tmp==0:
        print(0)
        f=True
        break
    M.append(tmp)

if f == False:
    M.sort()
    print(M[0]*M[1])

Submission status: Wrong Answer

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

M = 2019
L, R = map(int, input().split())
L %= M
R %= M
if L>=R:
    R += M

res = 2222
for i in range(L,R):
    for j in range(i+1,R+1):
        res = min(res, i*j%M)

print(res)

Submission status: Wrong Answer

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

switch = (R-L+1)/2019
if switch < 1:
    answer = [float("inf")] * 2019
    k = 0
    for i in range(L,R+1):
        answer[k] = i % 2019
        k += 1
    answer.sort()
    print((answer[0]*answer[1])%2019)
else:
    print(0)

Submission status: Wrong Answer

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

switch = (R-L+1)/2019
if switch < 1:
    answer = [float("inf")] * 2019
    k = 0
    for i in range(L,R+1):
        answer[k] = i % 2019
        k += 1
    answer.sort()
    print(answer[0]*answer[1])
else:
    print(0)

Submission status: Wrong Answer

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

switch = (R-L+1)/2019
if switch < 1:
    answer = [float("inf")] * 2019
    k = 0
    for i in range(L,R+1):
        answer[k] = i % 2019
        k += 1
    answer.sort()
    print(answer[0]*answer[1])
elif switch == 1:
    print(2)
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#133C
import sys
L, R = map(int, sys.stdin.readline().split())

M =[]
for i in range(L, R+1):
    tmp = i%2019
    if not tmp in M:
        M.append(i%2019)
        
M.sort()
print(M[0]*M[1])

Submission status: Wrong Answer

Solution code:
#133C
import sys
L, R = map(int, sys.stdin.readline().split())

M =[]
for i in range(L, R+1):
    tmp = i%2019
    if not tmp in M:
        M.append(i%2019)
    else:
        break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
i,j=map(int,input().split())

i%=2019;j%=2019

j+=2019
  
ans=2019

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

Submission status: Wrong Answer

Solution code:
i,j=map(int,input().split())

i%=2019;j%=2019

if(i>=j):j+=2019
  
ans=2019

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

Submission status: Wrong Answer

Solution code:
i,j=map(int,input().split())

i%=2019;j%=2019

if(i>j):j+=2019
  
ans=2019

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

Submission status: Wrong Answer

Solution code:
i,j=map(int,input().split())

i%=2019;j%=2019

if(i>j):j+=2019
  
ans=2019

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

Submission status: Wrong Answer

Solution code:
def resolve():
    l, r = list(map(int, input().split()))
    if r-l >=2019:
        print(0)
    else:
        ml = l % 2019
        mr = r % 2019
        if ml < mr:
            print(ml*(ml+1))
        else:
            print(0)
resolve()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L, R = [int(x) % 2019 for x in input().strip().split()]

if L < R:
  print(min([(i * j) % 2019 for i in range(L, R) for j in range(i+1, R+1)]))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L, R = [int(x) % 2019 for x in input().strip().split()]

if L < R:
  print(min([i * j for i in range(L, R) for j in range(i+1, R+1)]))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
L, R = [int(x) % 2019 for x in input().strip().split()]

if L < R:
  print(L * (L + 1))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ans=2019
if r-l>=2019:
    print(0)
else:
    for i in range(l,r):
        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 r-l>=2019:
    print(0)
    exit()

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
m1=2019
m2=2019
if R-L>=2020:
  print(0)
elif L<=2019<=R:
  print(0)
else:
  for i in range(L,R+1):
    if m2 > i%2019:
      m2=m1
      m1=i%2019

  print(m2*m1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b = map(int,input().split())
d = b - a
if d >= 2019:
  print(0)
else:
  print((a*b)%2019)

Submission status: Wrong Answer

Solution code:
a, b = map(int,input().split())
d = b - a
if d >= 2019:
  print(0)
else:
  print(d)

Submission status: Wrong Answer

Solution code:
a, b = map(int,input().split())
m = 100000
for i in range(a, b + 1):
  m = min(m, i % 2019)
print(m * (m + 1))

Submission status: Wrong Answer

Solution code:
a, b = map(int,input().split())
a = a % 2019
print(a * (a + 1))

Submission status: Wrong Answer

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

print(out)

Submission status: Wrong Answer

Solution code:
import numpy as np
L, R = map(int, input().split())
if R - L > 2019:
    print(0)
else:
    LR = np.arange(L, R+1, dtype="int64")
    LR %= 2019
    LR.sort

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
a=2019
lpre=l//a
rpre=r//a
if lpre==rpre:
    l=l%a
    r=r%a
else:
    l=l%a
    r=r%a
my_min=float("INF")
for i in range(l,r+1):
    for j in range(i+1,r+1):
        b=(i*j)%a
        if b<my_min:
            my_min=b

print(my_min)

Submission status: Wrong Answer

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

if r - l > 2019:
    print(0)
    exit()

elif l < 2019 and r >= 2019:
    print(0)
    exit()

else:
    a = l % 2019
    b = (l+1) % 2019
    print(a * b)
    exit()

Submission status: Wrong Answer

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

if r - l > 2019:
    print(0)
    exit()

elif l < 2019 and r >= 2019:
    print(0)
    exit()

else:
    print(l % 2019 * (l + 1) % 2019)
    exit()

Submission status: Wrong Answer

Solution code:
import sys

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

# if R - L >= 2018:
#     print(0)
#     sys.exit()
#
# l = L % 2019
# r = R % 2019
# if l < r:
#     print(l * (l + 1))
# else:
#     print(0)

ret = (L % 2019) * ((L + 1) % 2019)
for i in range(2020):
    if L + i > R: break
    if (L + i) % 2019 == 0:
        ret = 0

print(ret)

Submission status: Wrong Answer

Solution code:
import sys

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

if R - L >= 2018:
    print(0)
    sys.exit()

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

Submission status: Wrong Answer

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

if (r-1) * r < 2019:
    print(l * (l+1))
elif l >= 2019:
    ans = ((l % 2019) * ((l + 1) % 2019)) % 2019
    print(ans)
else:
    ans = 2019
    for i in range(l, r):
        for k in range(i+1, r+1):
            a = ((i % 2019) * (k % 2019)) % 2019
            if a < ans:
                ans = a
    print(ans)

Submission status: Wrong Answer

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

if (r-1) * r < 2019:
    print(l * (l+1))
elif l >= 2019:
    ans = ((l % 2019) * ((l + 1) % 2019)) % 2019
    print(ans)
else:
    ans = 2019
    for i in range(l, r):
        for k in range(i+1, r+1):
            a = ((i % 2019) * (k % 2019)) % 2019
            if a < ans:
                ans = a
    print(a)

Submission status: Wrong Answer

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

if (r-1) * r < 2019:
    print(l * (l+1))
elif l >= 2019:
    ans = ((l % 2019) * ((l + 1) % 2019)) % 2019
    print(ans)
else:
    ans = 2019
    for i in range(l, r):
        for k in range(l+1, r+1):
            a = ((i % 2019) * (k % 2019)) % 2019
            if a < ans:
                ans = a
    print(a)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
def print_ans(L, R):
    """Test Case
    >>> print_ans(2020, 2040)
    2
    >>> print_ans(4, 5)
    20
    """
    l = L % 2019
    r = R % 2019
    max_range = max(l, r)
    min_range = min(l, r)
    ans = 2019
    for i in range(min_range, max_range):
        for k in range(i + 1, max_range + 1):
            ans = min(ans, (i * k))
    print(ans)



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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque, Counter
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

[L,R] = inpl()
rL, rR = L%2019, R%2019

if R-L>= 2018 or rL > rR : ans = 0
else:
    ans = (rL*rR)%2019
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
L,R=map(int,input().split(' '))
l,r=L%2019,R%2019
D=R-L
d=r-l
print(L,l,R,r)
if D<2019:
  if D==d:
    res=[]
    for i in range(L,R+1):
      for j in range(i+1,R+1):
        res.append((i*j)%2019)
    print(min(res))
  else:
    print(0)
else:
  print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
L,R=map(int,input().split(' '))
l,r=L%2019,R%2019
D=R-L
d=r-l
if D<2019:
  if D==d:
    res=[]
    for i in range(l,r+1):
      for j in range(l,r+1):
        res.append(i*j)
    res=np.array(res)%2019
    print(min(res))
  else:
    print(0)
else:
  print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

flg = False

for i in range(l, (r + 1), 1):
    if ((i % mod) == 0):
        flg = True
        break

if (flg):
    print(0)
else:
    print((l % mod) * ((l + 1) % mod) % mod)

Submission status: Wrong Answer

Solution code:
import math

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

ans = 2019

for i, j in zip(range(2019), range(L, R)):
    for k in range(j+1, L + 2019*2):
        lr_mod = (j * k) % 2019
        if lr_mod < ans:
            ans = lr_mod
        if ans==0:break
    if ans==0:break

print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

ans = 2019

for i, j in zip(range(2019), range(L, R)):
    for k in range(j+1, L + 2019):
        lr_mod = (j * k) % 2019
        if lr_mod < ans:
            ans = lr_mod

print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

ans = 2019

for i, j in zip(range(2019), range(L, R + 1)):
    lr_mod = (j * (j + 1)) % 2019
    if lr_mod < ans:
        ans = lr_mod

print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
m=2019
lst=list(range(l,min(r+1,l+2019)))
def div(n):
  return n%2019
def sub(n):
  return (n%2019)-2019
lst1=list(map(div,lst))
lst2=list(map(sub,lst))
lst1.sort()
lst2.sort(reverse=True)
print(min(min(lst1[0]*lst1[1],lst2[0]*lst2[1]),min(2019-abs(lst1[len(lst1)-1]*lst2[0]),2019-abs(lst2[len(lst2)-1]*lst1[0]))))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
m=2019
lst=list(range(l,min(r+1,l+2019)))
def div(n):
  return n%2019
def sub(n):
  return (n%2019)-2019
lst1=list(map(div,lst))
lst2=list(map(sub,lst))
for i in range(len(lst1)):
  for j in range(i+1,len(lst1)):
    m=min(m,min(min(lst1[i]*lst1[j],2019-abs(lst1[i]*lst2[j])),min(lst2[i]*lst1[j],2019-lst2[i]*lst2[j])))
print(m)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
m=2019
lst=list(range(l,min(r+1,l+2019)))
def div(n):
  return n%2019
lst1=list(map(div,lst))
lst1.sort()
for i in range(len(lst1)):
  for j in range(i+1,len(lst1)):
    m=min(m,min(min(2019-abs(lst1[i]*(lst1[j]-2019)),2019-abs(lst1[j]*(lst1[i]-2019))),min(lst1[i]*lst1[j],(2019-lst1[i])*(2019-lst1[j]))))
print(m)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
lst=list(range(l,min(r+1,l+2019)))
def div(n):
  return n%2019
lst1=list(map(div,lst))
lst1.sort()
for i in range(len(lst1)):
  for j in range(i+1,len(lst1)):
    print(min(min(2019-abs(lst1[i]*(lst1[j]-2019)),2019-abs(lst1[j]*(lst1[i]-2019))),min(lst1[i]*lst1[j],(2019-lst1[i])*(2019-lst1[j]))))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
lst=list(range(l,min(r+1,l+2019)))
def div(n):
  return n%2019
lst1=list(map(div,lst))
lst1.sort()
print(min(min(2019-abs(lst1[0]*(lst1[1]-2019)),2019-abs(lst1[1]*(lst1[0]-2019))),min(lst1[0]*lst1[1],(2019-lst1[0])*(2019-lst1[1]))))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
lst=list(range(l,min(r+1,l+2019)))
def div(n):
  return n%2019
lst1=list(map(div,lst))
lst1.sort()
print(min(min(lst1[0]*(2019-lst1[1]),lst1[1]*(2019-lst1[0])),min(lst1[0]*lst1[1],(2019-lst1[0])*(2019-lst1[1]))))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
lst=list(range(l,min(r+1,l+2019)))
def div(n):
  return n%2019
lst1=list(map(div,lst))
lst1.sort()
print(lst1[0]*lst1[1])

Submission status: Wrong Answer

Solution code:
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    L, R = map(int, input().split())

    R_r = R%2019
    if (R - L) >= R_r :
        print(0)
    else:
        L_r = L%2019
        ans = (L_r*(L_r+1))%2019
        for l in range(L_r, R_r):
            for r in range(l+1, R_r+1):
                ans = min(ans, (l*r)%2019)
                print(l*r%2019, ans)
        print(ans)

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

# %%
# from atcoder_test import doTest
# doTest("abc133","c",main)

Submission status: Wrong Answer

Solution code:
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    L, R = map(int, input().split())

    R_r = R%2019
    if (R - L) > R_r :
        print(0)
    else:
        L_r = L%2019
        print(L_r*(L_r+1))


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

# %%
# from atcoder_test import doTest
# doTest("abc133","c",main)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
lst=list(range(l,min(r+1,l+2020)))
def div(n):
  return n%2019
lst1=list(map(div,lst))
lst1.sort()
print(lst1[0]*lst1[1])

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
lst=list(range(l,min(r+1,l+4039)))
def div(n):
  return n%2019
lst1=list(map(div,lst))
lst1.sort()
print(lst1[0]*lst1[1])

Submission status: Wrong Answer

Solution code:
import heapq

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

if L <= 2019 and R <= 2019:
    answer = 5000
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            if (i * j) % 2019 < answer:
                answer = (i * j) % 2019
    print(answer)
elif R - L >= 2019:
    print(2)
else:
    mod_list = []
    for i in range(L, R + 1):
        mod_list.append(i % 2019)

    heapq.heapify(mod_list)

    a = heapq.heappop(mod_list)
    b = heapq.heappop(mod_list)
    # print(a, b)

    print(a * b % 2019)

Submission status: Wrong Answer

Solution code:
import heapq

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

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

heapq.heapify(mod_list)

a = heapq.heappop(mod_list)
b = heapq.heappop(mod_list)
# print(a, b)

print(a*b%2019)

Submission status: Wrong Answer

Solution code:
import heapq

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

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

sorted(mod_list)

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

Submission status: Wrong Answer

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

l_mod = l % 2019
r_mod = r % 2019
li = []

if r - l > 2018:
    ans = 0
for i in range(l,r):
    for j in range(l,r):
        li.append((i * j) % 2019)

ans = min(li)

print(ans)

Submission status: Wrong Answer

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

l_mod = l % 2019
r_mod = r % 2019

if abs(l-r) > 2018:
    ans = 0
elif l_mod > r_mod:
    ans = 0
elif l_mod < r_mod:
    ans = (l_mod * (l_mod + 1)) % 2019

print(ans)

Submission status: Wrong Answer

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

l_mod = l % 2019
r_mod = r % 2019

if abs(l-r) >= 2018:
    ans = 0
elif l_mod > r_mod:
    ans = 0
elif l_mod < r_mod:
    ans = l_mod * (l_mod + 1)

print(ans)

Submission status: Wrong Answer

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

l_mod = l % 2019
r_mod = r % 2019

if abs(l-r) >= 2019:
    ans = 0
elif l_mod > r_mod:
    ans = 0
elif l_mod < r_mod:
    ans = l_mod * (l_mod + 1)

print(ans)

Submission status: Wrong Answer

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

l_mod = l % 2019
r_mod = r % 2019

if (l - r) <= -2019 or (l - r) >= 2019:
    ans = 0
elif l_mod > r_mod:
    ans = 0
elif l_mod <= r_mod:
    ans = l_mod * (l_mod + 1)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mod_list = []
mul_list = []
if R >= L + 2019:
    print(0)
else: 
    for i in range(L, R+1):
        if i % 2019 == 0:
            print(0)
            break
        else:
            mod_list.append(i)
    else:
        for i in range(len(mod_list)-1):
            mul_list.append((mod_list[i] * mod_list[i+1]) % 2019)
        print(min(mul_list))

Submission status: Wrong Answer

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

mod_list = []
mul_list = []
if R >= L + 2018:
    print(0)
else: 
    for i in range(L, R+1):
        if i % 2019 == 0:
            print(0)
            break
        else:
            mod_list.append(i)
    else:
        for i in range(len(mod_list)-1):
            mul_list.append((mod_list[i] * mod_list[i+1]) % 2019)
        print(min(mul_list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
li = []
c = min(L+4038, R+1, 2000000000)
for i in range(L, c):
  li.append(i%2019)
a = min(li)
li.remove(min(li))
b = min(li)
li.remove(min(li))
d = a*b
while d >2019:
  d = d%2019
print(d)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
li = []
c = min(L+4038, R+1, 2000000000)
for i in range(L, c):
  li.append(i%2019)
a = min(li)
li.remove(min(li))
b = min(li)
li.remove(min(li))
d = a*b
while d >2019:
  d %= 2019
print(d)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
li = []
c = min(L+4038, R+1, 2000000000)
for i in range(L, c):
  li.append(i%2019)
#print(li)
a = min(li)
li.remove(min(li))
b = min(li)
li.remove(min(li))
print(a*b)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
li = []
for i in range(L, min(L+4039, 2000000000, R+1)):
  li.append(i%2019)
a = min(li)
li.remove(min(li))
b = min(li)
li.remove(min(li))
print(a*b)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
li = []
for i in range(L, min(L+4038, 2000000000, R+1)):
  li.append(i%2019)
a = min(li)
li.remove(min(li))
b = min(li)
li.remove(min(li))
print(a*b)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
li = []
for i in range(L, min(L+10000, 2000000000)):
  li.append(i%2019)
a = min(li)
li.remove(min(li))
b = min(li)
li.remove(min(li))
print(a*b)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
li = []
for i in range(L, min(L+4038, 2000000000)):
  li.append(i%2019)
a = min(li)
li.remove(min(li))
b = min(li)
li.remove(min(li))
print(a*b)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
li = []
for i in range(L, min(L+2019, 2000000000)):
  li.append(i%2019)
a = min(li)
li.remove(min(li))
b = min(li)
li.remove(min(li))
print(a*b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mod_list = []
if R >= L + 2018:
    print(0)
else: 
    for i in range(L, R+1):
        if i % 2019 == 0:
            print(0)
            break
        else:
            mod_list.append(i % 2019)
    else:
        mod_list.sort() 
        print((mod_list[0] * mod_list[1]) % 2019)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

# できるだけ整数値を使う
# 2019で大きい数を割ると丸め誤差が無視できない
mod_list = []
if R >= L + 2019:
    print(0)
else: 
    for i in range(L, R+1):
        if i % 2019 == 0:
            print(0)
            break
        else:
            mod_list.append(i % 2019)
    else:
        print((mod_list[0] * mod_list[1]) % 2019)

Submission status: Wrong Answer

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

m = L // 2019
M = R // 2019 

if m == M:
    ans = ((L % 2019) * ((L + 1) % 2019)) % 2019
    print(ans)
else: # m<Mで区間内に2019の倍数がある時
    print(0)

Submission status: Wrong Answer

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

m = L // 2019
M = R // 2019 

if m == M:
    ans = ((L - (2019 * m)) * (L- (2019 * m) + 1)) % 2019
    print(ans)
else: # m<Mで区間内に2019の倍数がある時
    print(0)

Submission status: Wrong Answer

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

m = L // 2019
M = R // 2019 
print(m, M)

if m == M:
    ans = ((L - (2019 * m)) * (L- (2019 * m) + 1)) % 2019
    print(ans)
else: # m<Mで区間内に2019の倍数がある時
    print(0)

Submission status: Wrong Answer

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

m = L // 2019
M = R // 2019 

if m != M:
    print(0)
else: #2019の倍数が区間内に入らないような時
    ans = (L - (2019 * m)) * (L- (2019 * m) + 1)
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
L,R = map( int,input().split() )
ans = ( L * (L+1) ) % 2019  
for i in range(L,R):
    if ans == 0:
        break
    j = i + 1
    a = ( i * j ) % 2019
    ans = min(a, ans)
    plus = i % 2019
    while(True):
        over = math.ceil( ( 2019 - a ) / plus )
        j = j + over
        if j >= R:
            break
        a = ( i * j) % 2019
        ans = min(a,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
i,j=map(int,input().split())
a=i%2019
b=j%2019
if (j-i)<2019 and a<=b:
    print(a*(a+1))
else:
    print(0)