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:
#　あまりの問題は周期性がある
#  R-Lが201９を超えたら必ず2019の倍数のものが存在するのでR-Lが2019より小さい時に絞って考えればいい
#  小さい時では高々要素数は2019より小さいので全部探索すればいい
l,r=list(map(int,input().split()))
if r-l>=2019:
  print(0)
else:
  ans=2019
  for i in range(l,r):
    for j in range(i+1,r+1):
      ans=min(ans,(i%2019)*(j%2019))
      
      
  print(ans)

Submission status: Wrong Answer

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

for n in range(L,R+1):
    x=n%2019
    if i>=j:
        if i>x:
            i=x
        elif j>x:
            j=x
    else:
        if j>x:
            j=x
        elif i>x:
            i=x
    if i*j==0:
        print(0)
        break
else:
    print((i*j)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l = L % 2019
r = R % 2019

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

print(min_mod)

Submission status: Wrong Answer

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

l = L % 2019
r = R % 2019

min_mod = 2018
for a in range(l, r):
    for b in range(a+1, r+1):
        min_mod = min(min_mod, (a * b) % 2019)

print(min_mod)

Submission status: Wrong Answer

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

l = L % 2019
r = R % 2019

min_mod = 2018
for a in range(l, r):
    for b in range(l+1, r+1):
        min_mod = min(min_mod, (a * b) % 2019)

print(min_mod)

Submission status: Wrong Answer

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

t = []

for i in range(l,r+1):
    s = i%2019
    t.append(s)

u = sorted(t)
print(u[0]*u[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
inp=list(map(int,input().split()))
l=inp[0]
r=inp[1]
c=Counter([])
arr=[]
for i in range(l,r+1):
    if c[(i%2019)]==0:
        c[(i%2019)]+=1
        arr.append((i%2019))
        continue
    else:
        break
if c[0]!=0:
    print (0)
ans=99999999999
for i in range(len(arr)):
    for j in range(i+1,len(arr)):
        ans=min(ans,(arr[i]*arr[j])%2019)
        if ans==0:
            break
    if ans==0:
        break
print (ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

#N = int(input())
alp = [chr(i) for i in range(97, 97+26)]
L = []
l, r = map(int,input().split())
ans = float('inf')
if r-l+1 > 2019:
    ans = 0
else:
    for i in range(l, r+1):
        L.append(i%2019)
    for i in range(r-l):
        for j in range(i+1, r-l+1):
            ans = min(ans, L[i]*L[j])
print(ans)
#print(L)

Submission status: Wrong Answer

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

rem_l = l%2019
rem_r = r%2019

ans = -1

if r - l >= 2019:
    ans = 0

elif rem_l >= rem_r:
    ans = 0

else:
    ans = float('INF')
    for i in range(l, r):
        for j in range(i, r):
            temp = (i * j) % 2019
            if temp < ans:
                ans = temp

print(ans)

Submission status: Wrong Answer

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

rem_l = l%2019
rem_r = r%2019

ans = -1

if r - l >= 2019:
    ans = 0

elif rem_l >= rem_r:
    ans = 0

else:
    ans = rem_l * (rem_l + 1)
    ans %= 2019

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

#N = int(input())
alp = [chr(i) for i in range(97, 97+26)]
L = []
l, r = map(int,input().split())

if r-l+1 > 2019:
    ans = 0
else:
    for i in range(l, r+1):
        L.append(i%2019)
    L = list(set(L))
    L.sort()
    ans = (L[0]*L[1])%2019
print(ans)
#print(L)

Submission status: Wrong Answer

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

rem_l = l%2019
rem_r = r%2019

ans = -1

if r - l >= 2019:
    ans = 0

elif rem_l >= rem_r:
    ans = 0

else:
    ans = rem_l * (rem_l + 1)

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

#N = int(input())
alp = [chr(i) for i in range(97, 97+26)]
L = []
l, r = map(int,input().split())

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

#N = int(input())
alp = [chr(i) for i in range(97, 97+26)]
L = []
l, r = map(int,input().split())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


L, R = zz()
mod = 2019

range_ = min(R-L+1, 2019)
kouho = []
for i in range(L, L + range_):
    kouho.append(i % mod)
kouho = sorted(kouho)
print((kouho[0]*kouho[1]) % mod)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


L, R = zz()
mod = 2019

range_ = min(R-L+1, 2019)
kouho = []
for i in range(L, L + range_):
    kouho.append(i % mod)
kouho = sorted(kouho)
print(kouho[0]*kouho[1])

Submission status: Wrong Answer

Solution code:
l,r = map(int, input().split())
n = l+1
m = 2019
for s in range(l,r):
    for t in range(n,r+1):
        st = (s*t)%2019
        if st < m:
            m = st
        n += 1
print(m)

Submission status: Wrong Answer

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

L = L % 2019
R = R % 2019

if(R <= L):
    R += 2019

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
if r < 2019:
  box = [x for x in range(l,r+1)]
  print(box[0]*box[1])
elif r == 2019:
  print(l)
else:
  box = [x for x in range(l,r+1)]
  print(int((box[0]*box[1])%2019))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = float("inf")

for i in range(min(l, r), max(l, r)):
    for j in range(i+1, max(l, 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(min(l, r), max(l, r)):
    for j in range(min(l, r)+1, max(l, r)+1):
        if i!=j:
            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(min(l, r), max(l, r)):
    for j in range(min(l, r)+1, max(l, 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

if l < r:
    print(l*(l+1))
elif r > 1:
    print(r*(r-1))
else:
    print(0)

Submission status: Wrong Answer

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

min_value = 10 ** 9

for j in range(l, r+1):
  for i in range(l, j):
    min_value = min(min_value, i * j)

print(min_value)

Submission status: Wrong Answer

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

for i in range(l+1, r+1):
    a = (l * i) % 2019
    if ans > a:
        ans = a
    if a == 0:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
num_L, num_R = L // 2019, R // 2019
sup_L, sup_R = L % 2019, R % 2019
if num_R - num_L >= 1:
    print(0)
else:
    L %= 2019
    print((L*(L+1))%2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
num_L, num_R = L // 2019, R // 2019
sup_L, sup_R = L % 2019, R % 2019
if abs(num_L - num_R) >= 1:
    print(0)
else:
    print((L*(L+1))%2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
num_L, num_R = L // 2019, R // 2019
sup_L, sup_R = L % 2019, R % 2019
if abs(num_L - num_R) >= 1:
    print(0)
else:
    if not sup_R:
        print(0)
        exit()
    print(L*(L+1)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    l, r = MI()

    if r - l >= 2018:
        print(0)
        return

    mod_l = l % 2019
    mod_r = r % 2019

    candidates = []

    if mod_l < mod_r:
        candidates.extend(range(mod_l, mod_r + 1))
    else:
        candidates.extend(range(0, mod_r + 1))
        candidates.extend(range(mod_l, 2019))
    min_ans = 2019

    for i in range(len(candidates) - 1):
        tmp = (candidates[i] * candidates[i + 1]) % 2019
        if tmp < min_ans:
            min_ans = tmp

    print(min_ans)


main()

Submission status: Wrong Answer

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


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    l, r = MI()

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

    mod_l = l % 2019
    mod_r = r % 2019

    candidates = []

    if mod_l < mod_r:
        candidates.extend(range(mod_l, mod_r + 1))
    else:
        candidates.extend(range(0, mod_r + 1))
        candidates.extend(range(mod_l, 2019))
    min_ans = 2019

    for i in range(len(candidates) - 1):
        tmp = (candidates[i] * candidates[i + 1]) % 2019
        if tmp < min_ans:
            min_ans = tmp

    print(min_ans)


main()

Submission status: Wrong Answer

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


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    l, r = MI()

    mod_l = l % 2019
    mod_r = r % 2019

    candidates = []

    if mod_l < mod_r:
        candidates.extend(range(mod_l, mod_r + 1))
    else:
        candidates.extend(range(0, mod_r + 1))
        candidates.extend(range(mod_l, 2019))
    min_ans = 2019
    for i in range(len(candidates) - 1):
        tmp = (candidates[i] * candidates[i + 1]) % 2019
        if tmp < min_ans:
            min_ans = tmp

    print(min_ans)


main()

Submission status: Wrong Answer

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


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    l, r = MI()

    mod_l = l % 2019
    mod_r = r % 2019

    candidates = []

    if mod_l < mod_r:
        candidates.extend(range(mod_l, mod_r + 1))
    else:
        candidates.extend(range(0, mod_r))
        candidates.extend(range(mod_l, 2019))
    min_ans = 2019
    for i in range(len(candidates) - 1):
        tmp = (candidates[i] * candidates[i + 1]) % 2019
        if tmp < min_ans:
            min_ans = tmp

    print(min_ans)


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=list(map(int,input().split()))
s=[]
import sys

if r-l>2050:
  print(0)
  sys.exit()
else:
  for i in range(l,r+1):
    s.append(i%2019)

n=len(s)
ans=30000
for i in range(n-1):
  for j in range(i+1,n):
    ans=min(ans,(i*j)%2019)

print(ans)

Submission status: Wrong Answer

Solution code:
l,r=list(map(int,input().split()))
s=[]
import sys

if r-l>2050:
  print(0)
else:
  for i in range(l,r+1):
    s.append(i%2019)

n=len(s)
ans=30000
for i in range(n-1):
  for j in range(i+1,n):
    ans=min(ans,(i*j)%2019)

print(ans)

Submission status: Wrong Answer

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

if r-l>2050:
  print(0)
else:
  for i in range(l,r+1):
    s.append(i%2019)
  s.sort()
  print((s[0]%2019)*(s[1]%2019))

Submission status: Wrong Answer

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

if r-l>2050:
  print(0)
else:
  for i in range(l,r+1):
    s.append(i%2019)
  s.sort()
  print((s[0]*s[1])%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if lst[0] == 0:
  print(0)
  exit()
  
rlt = 2020
for i in range(len(lst)):
  for j in range(i,len(lst)):
    rlt = min(rlt, (lst[i]*lst[j])%2019)
    
print(rlt)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
ama=[]
for i in  range(L,R+1):
    amari = i%2019
    ama.append(amari)
list.sort(ama, reverse=False)
Ama =ama[0]*ama[1]
print(Ama)

Submission status: Wrong Answer

Solution code:
# abc133_c.py
# https://atcoder.jp/contests/abc133/tasks/abc133_c

# C - Remainder Minimization 2019 /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 300点

# 問題文
# 非負整数 L,Rが与えられます。 2 つの整数 i,j を L≤i<j≤R を満たすように選びます。 (i×j) mod 2019の最小値を求めてください。

# 制約
#     入力は全て整数
#     0≤L<R≤2×109

# 入力
# 入力は以下の形式で標準入力から与えられる。
# L R

# 出力
# 条件を満たすように i,jを選んだ時の、(i×j) mod 2019の最小値を出力せよ。

# 入力例 1
# 2020 2040

# 出力例 1
# 2

# (i,j)=(2020,2021)とすると、(i×j) mod 2019=2となります。

# 入力例 2
# 4 5

# 出力例 2
# 20

# 選び方は (i,j)=(4,5)の 1 通りしか存在しません。


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    # N = int(lines[0])
    L, R = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(6):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(M):
    #     valueses.append(list(map(int, lines[i+1].split())))

    l = L % 2019
    r = R % 2019

    ma = None

    for i in range(1, l+1):
        for j in range(2, r+1):
            s = i*j % 2019
            if ma is None:
                ma = s
            elif ma > s:
                ma = s

    return [ma]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['2020 2040']
        lines_export = [2]
    if pattern == 2:
        lines_input = ['4 5']
        lines_export = [20]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
l %= 2019
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 l-r>=2019:print(0)
else:
  rlist = [i%2019 for i in range(l,r+1)]
  rlist = sorted(rlist)
  print(rlist[0]*rlist[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
a =[i for i in range(L,R+1)]
x = []
s = 10**5
for i in a:
  
  if i%2019==0:
    print(0)
    exit()
  else:
    x.append(i%2019)
    x = sorted(x)
    if len(x)>=2:
      s = min(s,x[0]*x[1])
  
print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
L, R = list(map(int, input().split()))
if math.ceil(L / 2019) <= R // 2019:
    print(0)
else:
    res = 0
    for i in range(L % 2019, R % 2019):
        for j in range(L % 2019 + 1, R % 2019 + 1):
            res = min(res, (i * j) % 2019)
    print(res)

Submission status: Wrong Answer

Solution code:
import math
L, R = list(map(int, input().split()))
if math.ceil(L / 2019) <= R // 2019:
    print(0)
else:
    print(min((L % 2019) * ((L + 1) % 2019) % 2019, (R % 2019) * ((R - 1) % 2019) % 2019))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int, input().split())
 
A = a%2019
B = b%2019
 
c = max(A,B)
d = min(A,B)
 
C = 2018
 
if A == 0 or B == 0 or A == B:
    print(0)
    exit()
else:
    for i in range(d,c):
        for j in range(i+1,c+1):
            C = min(C,i*j%2019)
print(C)

Submission status: Wrong Answer

Solution code:
a,b=map(int, input().split())
 
A = a%2019
B = b%2019
 
c = max(A,B)
d = min(A,B)
 
C = 2018
 
if c == 0 or d == 0 or c == d:
    print(0)
    exit()
else:
    for i in range(d,c):
        for j in range(i+1,c+1):
            C = min(C,i*j%2019)
print(C)

Submission status: Wrong Answer

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

A = a%2019
B = b%2019

c = max(A,B)
d = min(A,B)

C = 2018

if c == 0 or d == 0:
    print(0)
    exit()
else:
    for i in range(d,c):
        for j in range(i+1,c+1):
            C = min(C,i*j%2019)
print(C)

Submission status: Wrong Answer

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

A = a%2019
B = b%2019

c = max(A,B)
d = min(A,B)

C = 2018

for i in range(d,c):
    for j in range(i+1,c+1):
        C = min(C,i*j%2019)
print(C)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
s=10000
for i in range(l,r+1):
    if i%2019==0:
        s=0
        break
    elif (i%673==0 and r-l!=1) or (i%673==0 and (r%3==0 or l%3==0)):
        s=0
        break
if s==0:
    print(0)
else:
    print(((l%2019)*((l+1)%2019))%2019)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
s=10000
for i in range(l,r+1):
    if i%2019==0:
        s=0
    elif (i%673==0 and r-l!=1) or (i%673==0 and (r%3==0 or l%3==0)):
        s=0
if s==0:
    print(0)
else:
    print(((l%2019)*((l+1)%2019))%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
if l - r >= 2018:
    print(0)
    exit()
l %= 2019
r %= 2019

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

print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if R - L > 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())
i = -(-l//2019)
if 2019*i<=r:
    print(0)
else:
    if r%2019<l%2019:
        print(r%2019*(r-1)%2019)
    else:
        print(l%2019*(l+1)%2019)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
n = r-l+1
ans1 = 0
ans2 = 0
min1 = 1000000000
min2 = 10000000000


for i in range(min(n, 2024)):
   # print(l+i)
    if (l+i) % 2019 == 0:
        print(0)
        break
else:
    ans = 10000000000
    for i in range(min(n, 2019)):
        for j in range(i+1, min(n, 2020)):
            if ((l+i)*(r+j)) % 2019 < ans:
                ans = ((l+i)*(r+j)) % 2019
                # print(ans, l+i, r+j)
    print(ans)

Submission status: Wrong Answer

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


mod = 2019
a = l//mod
b = r//mod

if b-a > 0:
    print(0)
else:
    m = 50000000
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            a = (i % mod)*(j % mod)
            if a < m:
                m = a

    print(m)

Submission status: Wrong Answer

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


mod = 2019
a = l//mod
b = r//mod

if b-a > 0:
    print(0)
else:
    m = 2020
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            a = (i % mod)*(j % mod)
            if a < m:
                m = a

    print(m)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
n = r-l+1
ans1 = 0
ans2 = 0
min1 = 1000000000
min2 = 10000000000


for i in range(min(n, 2024)):
   # print(l+i)
    if (l+i) % 2019 == 0:
        print(0)
        break
else:
    print((l*(l+1)) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mod = 2019
a = l//mod
b = r//mod

if b-a > 0:
    print(0)
else:
    m = 2020
    for i in range(l, r):
        k = (i % mod)*((i+1) % mod)
        if k < m:
            m = k
    print(m)