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())
MOD = 2019

nl = l%MOD
diff = r-l
li1 = []
li2 = []

print(nl)

if diff>2018:
  print(0)
else:
  for i in range(diff+1):
    li1.append(nl+i)
  for j in range(len(li1)):
    for k in range(j+1,len(li1)):
      li2.append(li1[j]*li1[k]%MOD)
  print(min(li2))

Submission status: Wrong Answer

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

nl = l%MOD
diff = r-l
li = []

if diff>2018:
  print(0)
else:
  for i in range(diff+1):
    li.append(nl+i)
  li.sort()
  print(li[0]*li[1])

Submission status: Wrong Answer

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

flag = 0
if ( r + 1 - l ) > 2019:
    flag = 1 
else:
    for n in range( l, r+1 ):
        if n % 2019 == 0:
            flag = 1

if flag == 1:
    print( "0" )
else:
    print( (l % 2019) * ( ( l + 1 ) % 2019 ) % 2019 )

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
a=range(l,r)
m=float('inf')
for i in a:
    i%=2019
    m=min(m,i)
print((m*(m+1))%2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
x = l%2019
if (l//673 < r//673 or l%673==0) and (l//3 < r//3 or l%3==0):
    ans = 0
else:
    ans = l*(l+1)%2019
print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
x = l%2019
if l//673 < r//673 or l%673==0 and l//3 < r//3 or l%3==0:
    ans = 0
else:
    ans = l*(l+1)%2019
print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
x = l%2019
y = min(r,l+2018)%2019
if r//2019 > l//2019:
    ans = 0
else:
    ans = l*(l+1)%2019
print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
x = l%2019
y = min(r,l+2018)%2019
if r//2019 > l//2019:
    ans = 0
else:
    ans = x*(x+1)
print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
x = l%2019
y = min(r,l+2018)%2019
if x<y:
    ans = x*(x+1)
else:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
A = [i for i in range(L, R + 1)]
B = [a % 2019 for a in A]
cand_i = A[B.index(min(B))]
A.pop(B.index(min(B)))
B.pop(B.index(min(B)))
cand_j = A[B.index(min(B))]
print((cand_i * cand_j) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
A = [i for i in range(L, R + 1)]
B = [a % 2019 for a in A]
cand_i = A[B.index(min(B))]
A.pop(B.index(min(B)))
B.remove(min(B))
cand_j = A[B.index(min(B))]
print((cand_i * cand_j) % 2019)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
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 LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): return k.join(list(map(str, lst)))
INF = float('inf')

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

    lst = []
    pre = l % mod
    for i in range(l+1, min(l+4028, r+1)):
        # print(i % mod)
        lst.append((pre * i % mod) % mod)
        pre = i % mod


    # print(lst)
    print(min(lst))

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
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 LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): return k.join(list(map(str, lst)))
INF = float('inf')

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

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

    lst = sorted(lst)
    # print(lst)
    print(lst[0] * lst[1] % mod)
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
c=[]
for i in range(a,b+1):
    for j in range(a,i):
        if i*j%2019!=0:
            c.append(i*j%2019)
        else:
            break
print(min(c))

Submission status: Wrong Answer

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

c=list(set(c))
for i in range(len(c)):
    min=i
    for j in range(i+1,len(c)):
        if c[i]>c[j]:
            min=j
    c[i],c[min]=c[min],c[i]

print(c[0])

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
l=L%2019
r=R%2019
if l<r:
  c=2020
  a=list(range(l,r+1))
  for i in range(len(a)-1):
    for j in range(i+1,len(a)):
      s_=a[i]*a[j]
      s=s_%2019
      c=min(c,s)
else:
  r+=2019
  c=2020
  a=list(range(l,r+1))
  for i in range(len(a)-1):
    for j in range(i+1,len(a)):
      s_=a[i]*a[j]
      s=s_%2019
      c=min(c,s)
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


L, R = Is()
mod = 2019
a = (L // mod)*mod
if L <= a <= R:
    print(0)
else:
    print(((L%mod)*(L+1))%mod)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
max_len = 2019
j = 0
ans = []
for i in range(L,R+1):
    j += 1
    if j>=max_len:
        break
    ans.append(i%2019)
ans.sort()
print((ans[0]*ans[1])%2019)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
max_len = 2019
j = 0
ans = []
for i in range(L,R+1):
    if j>=max_len:
        break
    j += 1
    ans.append(i%2019)
ans.sort()
print((ans[0]*ans[1])%2019)

Submission status: Wrong Answer

Solution code:
import numpy as np

L, R = map(int, input().split())
x = sorted(np.array(range(L, R+1)) % 2019)

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

Submission status: Wrong Answer

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

def calc_mod(x, y):
    return x * y % 2019

left = L % 2019
right = (R-L) % 2019 + left

if left==0 or right==0:
    print(0)
    sys.exit(0)

for i in range(left, right):
    for j in range(i+1, right+1):
        ans.append(calc_mod(i, j))

print(min(ans))

Submission status: Wrong Answer

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

def calc_mod(x, y):
    return x * y % 2019

left = L % 2019
right = R % 2019

if left==0 or right==0:
    print(0)
    sys.exit(0)

elif left > right:
    right += 2019

for i in range(left, right):
    for j in range(1, right+1):
        ans.append(calc_mod(i, j))

print(min(ans))

Submission status: Wrong Answer

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

def calc_mod(x, y):
    return x * y % 2019

left = L % 2019
right = R % 2019

if left==0 or right==0:
    print(0)
    sys.exit(0)

elif left > right:
    right += 2019

for i in range(left, right):
    for j in range(i+1, right+1):
        ans.append(calc_mod(i, j))

print(min(ans))

Submission status: Wrong Answer

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

def calc_mod(x, y):
    return x * y % 2019

left = L % 2019
right = R % 2019

if left==0:
    print(0)
    sys.exit(0)

elif left > right:
    right += 2019

elif right==0:
    right = 2019

for i in range(left, right):
    for j in range(i+1, right+1):
        ans.append(calc_mod(i, j))

print(min(ans))

Submission status: Wrong Answer

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

def calc_mod(x, y):
    return x * y % 2019

left = L % 2019
right = R % 2019

if left > right:
    right += 2019

elif right==0:
    right = 2019

for i in range(left, right):
    for j in range(i+1, right+1):
        ans.append(calc_mod(i, j))

print(min(ans))

Submission status: Wrong Answer

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

def calc_mod(x, y):
    return x * y % 2019

left = L % 2019
right = R % 2019

if left > right:
    right += 2019

for i in range(left, right):
    for j in range(i+1, right+1):
        ans.append(calc_mod(i, j))

print(min(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
L,R = map(int, stdin.readline().rstrip().split())
#S = [list(stdin.buffer.readline().decode().rstrip()) for _ in range(h)]

lsho, lmod = divmod(L,2019)
rsho, rmod = divmod(R,2019)

if rsho - lsho == 0:
    print(int((lmod*(lmod+1))%2019))
    exit()



if R-L > 2019:
    print(0)
    exit()

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

print(ans)

Submission status: Wrong Answer

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

mod_List=[]
count=0
for i in range(L,R+1):
    mod_List.append(i%2019)
    count+=1
    if count>=2019:
        break

mod_List.sort()
if L!=R:
    if 673 in mod_List and R-L>3:
        print(0)
    else:
        print(mod_List[0]*mod_List[1])
else:
    print((mod_List[0]*mod_List[0])%2019)

Submission status: Wrong Answer

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

mod_List=[]
count=0
for i in range(L,R+1):
    mod_List.append(i%2019)
    count+=1
    if count>=2019:
        break

mod_List.sort()
if L!=R:
    if 673 in mod_List and 3 in mod_List:
            print(0)
    else:
        print(mod_List[0]*mod_List[1])
else:
    print((mod_List[0]*mod_List[0])%2019)

Submission status: Wrong Answer

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

mod_List=[]
count=0
for i in range(L,R+1):
    mod_List.append(i%2019)
    count+=1
    if count>=2019:
        break

mod_List.sort()
if L!=R:
    if 673 in mod_List:
        if 3 in mod_List:
            print(0)
    else:
        print(mod_List[0]*mod_List[1])
else:
    print((mod_List[0]*mod_List[0])%2019)

Submission status: Wrong Answer

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

mod_List=[]
count=0
for i in range(L,R+1):
    mod_List.append(i%2019)
    count+=1
    if count>=2019:
        break

print(mod_List)
mod_List.sort()
if L!=R:
    if 673 in mod_List:
        if 3 in mod_List:
            print(0)
    else:
        print(mod_List[0]*mod_List[1])
else:
    print((mod_List[0]*mod_List[0])%2019)

Submission status: Wrong Answer

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

mod_List=[]
count=0
for i in range(L,R+1):
    mod_List.append(i%2019)
    count+=1
    if count>=2019:
        break
        
mod_List.sort()
if 673 in mod_List:
    if 3 in mod_List:
        print(0)
elif L!=R:
    print(mod_List[0]*mod_List[1])
else:
    print(mod_List[0])

Submission status: Wrong Answer

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

mod_List=[]
count=0
for i in range(L,R+1):
    mod_List.append(i%2019)
    count+=1
    if count>=2019:
        break
        
mod_List.sort()
if 673 and 3 in mod_List:
    print(0)
elif L!=R:
    print(mod_List[0]*mod_List[1])
else:
    print(mod_List[0])

Submission status: Wrong Answer

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


#mod(L)*mod(R)>=2019の場合を入れる
mod_List=[]
count=0
for i in range(L,R+1):
    mod_List.append(i%2019)
    count+=1
    if count>=2019:
        break
        
mod_List.sort()
if mod_List[-1]*mod_List[-2]>=2019:
    print(0)
elif L!=R:
    print(mod_List[0]*mod_List[1])
else:
    print(mod_List[0])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if (R//2019-L//2019)>0: 
  print(0)
  exit(0)
  
if (R//673-L//673)>0:
  print(0)
  exit(0)
  
ll, rr = L//2019, R//2019
for i in range(1, 2018):
  for j in range(ll,rr+1):
    l_, r_ = j*2019+i,j*2019+i+1
    print('%d %d'%(l_,r_))
    if L<=l_ and r_<=R:
      print(((j*2019+i)*(j*2019+i+1))%2019)
      exit(0)

Submission status: Wrong Answer

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

if rr-ll>1: 
  print(0)
  exit(0)
  
for i in range(1, 2018):
  for j in range(ll,rr+1):
    l_, r_ = j*2019+i,j*2019+i+1
    if L<=l_ and r_<=R:
      print(((j*2019+i)*(j*2019+i+1))%2019)
      exit(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys, heapq, bisect, math, fractions
from collections import deque

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

res = 10 ** 15
if R - L >= 2019:
    print(0)
else:
    for l in range(L, R):
        for r in range(l + 1, R + 1):
            res = min(res, (l * r) % mod)

print(res)

Submission status: Wrong Answer

Solution code:
import sys, heapq, bisect, math, fractions
from collections import deque

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

modL = L % mod
modR = R % mod

if R - L >= 2018:
    print(0)
else:
    if modL > modR:
        print(0)
    else:
        print(modL * ((modL + 1) % mod) % mod)

Submission status: Wrong Answer

Solution code:
import sys, heapq, bisect, math, fractions
from collections import deque

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

modL = L % mod
modR = R % mod

if R - L >= 2019:
    print(0)
else:
    if modL > modR:
        print(0)
    else:
        print(modL * (modL + 1) % mod)

Submission status: Wrong Answer

Solution code:

"""
参照URL:https://drken1215.hatenablog.com/entry/2019/07/07/233700

単純な全探索は二重ループでできそうだが、
L,R≤2×109 とかなので、このままだとダメ。
そこで工夫を考えることになる。
例えば L=10, R=3000 とかだったら、
x=2019 とかにすれば、xy は 2019 で割り切れる。
「2019 個以上の整数が連続すると、その中に必ず 2019 の倍数がある」
よってR−L≥2019 のときは答えが 0
それ以外のときは、全探索できる！候補数は多く見積もっても (R−L)^2 程度
"""

import sys
read = sys.stdin.buffer.read # 全読み込み
readline = sys.stdin.buffer.readline # 一行読み込み
readlines = sys.stdin.buffer.readlines # 一行ずつ全読み込み
sys.setrecursionlimit(10**7) # 再帰限界変更（デフォルトは1000）

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

min_2019=2019
ll=l%2019
lr=(r+1)%2019

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

else:
    for i in range(ll,lr):
        for j in range(i+1,lr):
            min_2019=min(min_2019,(i*j)%2019)

print(min_2019)

Submission status: Wrong Answer

Solution code:

"""
参照URL:https://drken1215.hatenablog.com/entry/2019/07/07/233700

単純な全探索は二重ループでできそうだが、
L,R≤2×109 とかなので、このままだとダメ。
そこで工夫を考えることになる。
例えば L=10, R=3000 とかだったら、
x=2019 とかにすれば、xy は 2019 で割り切れる。
「2019 個以上の整数が連続すると、その中に必ず 2019 の倍数がある」
よってR−L≥2019 のときは答えが 0
それ以外のときは、全探索できる！候補数は多く見積もっても (R−L)^2 程度
"""

import sys
read = sys.stdin.buffer.read # 全読み込み
readline = sys.stdin.buffer.readline # 一行読み込み
readlines = sys.stdin.buffer.readlines # 一行ずつ全読み込み
sys.setrecursionlimit(10**7) # 再帰限界変更（デフォルトは1000）

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

min_2019=2019

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

else:
    for i in range(l%2019,(r+1)%2019):
        for j in range(i+1,(r+1)%2019):
            min_2019=min(min_2019,(i*j)%2019)

print(min_2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
diff = ra - la
if diff <= 0:
  print("0")
  exit()
elif diff == 1:
  print((la*ra)%2019)
  exit()
ans = 2019
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = (i*j) % 2019
    if mul <= ans:
      ans = mul
print(int(ans))

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = int(l % 2019)
ra = int(r % 2019)
diff = int(ra - la)
if diff <= 0:
  print("0")
  exit()
ans = int(2019)
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = int(i*j)
    mul %= 2019
    if mul <= ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = int(l % 2019)
ra = int(r % 2019)
diff = int(ra - la)
if diff <= 0:
  print("0")
  exit()
ans = int(2019)
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = int((i*j) % 2019)
    if mul <= ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
diff = ra - la
if diff <= 0:
  print("0")
  exit()
ans = 2019
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = (i*j) % 2019
    if mul <= ans:
      ans = mul
if ans == 2019:
  raise ValueError
print(ans)

Submission status: Wrong Answer

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

if r - l >= 2019:
  print(0)
  
else:
  ll = l % 2019
  rr = r % 2019
  if rr < ll:
    print(0)
    
  else:
    keep = 2020
    for i in range(ll, rr+1):
      for j in range(ll, rr+1):
        keep = min((i*j)%2019, keep)
    print(keep)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
diff = ra - la
if diff <= 0:
  print("0")
  exit()
ans = 2019
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = (i*j) % 2019
    if mul <= ans:
      ans = mul
print(int(ans))

Submission status: Wrong Answer

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

mins = 10**9
for i in range(l, r):
  mins = min( (i * (i+1))%2019, mins)
  if mins == 0:
    break
    
print(mins)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
diff = ra - la
if diff <= 0:
  print("0")
  exit()
ans = 2019
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = (i*j) % 2019
    if mul <= ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
diff = ra - la
if diff <= 0:
  print("0")
  exit()
ans = 2019
for i in range(la, la+diff):
  for j in range(i+1, la+diff+1):
    mul = (i*j) % 2019
    if mul < ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
diff = ra - la
if diff <= 0:
  diff+=2019
ans = 2019
for i in range(la, la+diff):
  for j in range(i+1, la+diff+1):
    mul = (i*j) % 2019
    if mul < ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
diff = ra - la
if diff <= 0:
  diff+=2019
ans = 2018
for i in range(la, la+diff):
  for j in range(i+1, la+diff+1):
    mul = (i*j) % 2019
    if mul < ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
diff = ra - la
if diff==0:
  print("0")
  exit()
elif diff < 0:
  diff+=2019
ans = 2018
for i in range(la, la+diff):
  for j in range(i+1, la+diff+1):
    mul = (i*j) % 2019
    if mul < ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
if ra <= la:
  ra += 2019
ans = 2018
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = ((i%2019)*(j%2019)) % 2019
    if mul < ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
if ra <= la:
  ra += 2019
ans = 2018
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = (i*j) % 2019
    if mul < ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
if ra < la:
  ra += 2019
ans = 2018
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = ((i%2019)*(j%2019)) % 2019
    if mul < ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
if ra < la:
  ra += 2019
ans = 2018
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = ((i//2019)*(j//2019)) % 2019
    if mul < ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
if ra < la:
  ra += 2019
diff = ra - la
ans = 2018
for i in range(la, ra):
  for j in range(i+1, ra+1):
    mul = (i*j) % 2019
    if mul < ans:
      ans = mul
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
lb = l // 2019
ra = r % 2019
rb = r // 2019
ans = (la * ra) % 2019
# (la + lb) * (ra * rb) // 2019
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
la = l % 2019
lb = l // 2019
ra = r % 2019
rb = r // 2019
ans = (la * ra) // 2019
# (la + lb) * (ra * rb) // 2019
print(ans)

Submission status: Wrong Answer

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

if R<L+2019:
  end=R+1
else:
  end=L+2019

mod=2019
num=0
for i in range(L,end):
  if i%2019<mod:
    mod=i%2019
    num=i

if num==R:
  print((num%2019)*(num-1)%2019)
else:
  print((num%2019)*(num+1)%2019)

Submission status: Wrong Answer

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

if R<L+2019:
  end=R+1
else:
  end=L+2019

mod=2019
num=0
for i in range(L,end):
  if i%2019<mod:
    mod=i%2019
    num=i

print(num,num+1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
tmp = 2018
for i in range(l, min(r + 1, l + 2019)):
    if i % 2019 < tmp:
        tmp = i % 2019
        min_1 = i

tmp = 2018
for i in range(min_1 + 1, min(r + 1, min_1 + 2019)):
    if i % 2019 < tmp:
        tmp = i % 2019
        min_2 = i

mod = 2019
print(min_1 % mod * min_2 % mod)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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


def convert(LL,LR):
    LL = LL % 2019
    LR = LR % 2019

    return LL,LR

def kansu(LL,LR):

    ans = 2020

    for ll in range(LL,LR):
        for lr in range(ll+1,LR+1):
            print(lr)
            tmp  = (ll * lr) % 2019
            if ans > tmp:
                ans = tmp

    print(ans)

ML,MR = nyu()
#ML,MR = convert(ML,MR)
kansu(ML,MR)

Submission status: Wrong Answer

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


def convert(LL,LR):
    LL = LL % 2019
    LR = LR % 2019

    return LL,LR

def kansu(LL,LR):

    ans = 2020

    for ll in range(LL,LR):
        for lr in range(ll+1,LR+1):
    #        print(ll,"  ",lr)
            tmp  = (ll * lr) % 2019
            if ans > tmp:
                ans = tmp

    print(ans)

ML,MR = nyu()
ML,MR = convert(ML,MR)
kansu(ML,MR)

Submission status: Wrong Answer

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


def convert(LL,LR):
    LL = LL % 2019
    LR = LR % 2019

    return LL,LR

def kansu(LL,LR):

    ans = 2020

    for ll in range(LL,LR):
        for lr in range(ll+1,LR+1):
            print(ll,"  ",lr)
            tmp  = (ll * lr) % 2019
            if ans > tmp:
                ans = tmp

    print(ans)

ML,MR = nyu()
ML,MR = convert(ML,MR)
kansu(ML,MR)

Submission status: Wrong Answer

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


def convert(LL,LR):
    LL = LL % 2019
    LR = LR % 2019

    return LL,LR

def kansu(LL,LR):

    ans = 2020

    for ll in range(LL,LR):
        for lr in range(LL+1,LR+1):
            tmp  = (ll * lr) % 2019
            if ans > tmp:
                ans = tmp

    print(ans)

ML,MR = nyu()
ML,MR = convert(ML,MR)
kansu(ML,MR)

Submission status: Wrong Answer

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

if r < 2019:
    print(l*(l+1)%2019)
    exit()

for i in range(l,r+1):
    if i%2019 == 0:
        print(0)
        exit()

#ここのケースで間違ってんのがいくつかある
# ans = (l*(l+1))%2019
# print(ans)

Submission status: Wrong Answer

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

if r < 2019:
    print(l*(l+1)%2019)
    exit()

for i in range(l,r+1):
    if i%2019 == 0:
        print(0)
        exit()

ans = (l*(l+1))%2019
print(ans)

Submission status: Wrong Answer

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

if r < 2019:
    print(l*(l+1))
    exit()

for i in range(l,r+1):
    if i%2019 == 0:
        print(0)
        exit()

ans = (l*(l+1))%2019
print(ans)

Submission status: Wrong Answer

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

if r < 2019:
    print(l*(l+1))
    exit()

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

for i in range(l,r+1):
    if i%2019 == 0:
        print(0)
        exit()

ans = (l*(l+1))%2019
print(ans)

Submission status: Wrong Answer

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

if r < 2019:
    print(l*(l+1))
    exit()

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

for i in range(l,r+1):
    if i%2019 == 0:
        print(0)
        exit()

ans = (l%2019)*((l+1)%2019)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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