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())
s=[]
if ((r//673)!=(r//673)):#(((l<=672)&(r>=673))|((l<=1346)&(r>=1347))|((l<=673*3)&(r>=673*3))):
    a=0
    s.append(a)
elif((r-l!=1)):
    for i in range(l,r-1):
        for j in range(l+1,r):
            #print(i,j)
            a=(i*j)%2019
            #print(a)
            s.append(a)
            if (a==0):
                break
else:
    a=(l*r)%2019
    s.append(a)
print(min(s))

Submission status: Wrong Answer

Solution code:
A = [int(x)  for x in input().split()]
if A[1] - A[0] < (2019 - A[1]%2019)-1:
  print((A[0]*(A[0] +1)) %2019)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
L,R= map(int,input().split())
#境界条件
bool = True
l = L % 2019
r = R % 2019
if l == 0:
    ans = 0
#一個違い
elif r == l+1:
    ans = (L*R) % 2019
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            temp = (i * j) % 2019
            if bool:
                min = temp
                bool = False
            elif min > temp:
                min = temp
    ans = min
print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
#divisor = [2019,673,3]
x = 10e9
if L-R > 2019:
    x=0
else:   
    if L%2019 > R%2019:
        x=0
    else:
        for i in range(L,R):
            for j in range(i+1,R+1):
                #print(x,(i%2019)*(j%2019))
                x = min(x,(i%2019)*(j%2019))
                if x == 0:
                    break
    
print(x)

Submission status: Wrong Answer

Solution code:
import sys

a1=list(input().split( ))
a=list(map(int, a1))
b= a[1] - a[0]
d=2018

for j in range(b):
 for k in range(b-j):
  c=((a[0] + j ) * (a[0] + j  + k + 1)) % 2019
  if c<=d:
   d=c
  if d==0:
   sys.exit() 

print(d)

Submission status: Wrong Answer

Solution code:
L,R=map(int, input().split())
if R//2019-L//2019>0:
  print(0)
elif R//3-L//3>0 and R//673-L//673>0:
  print(0)
else:
  print((L*(L+1))%2019)

Submission status: Wrong Answer

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



if(R<=(r-l)%2019 or r-l>=2019):
    print(0)
elif(2019<=r):
    Min=2019
    for i in range(l,r):
        tmp=i*(i+1)%2019
        if(tmp<Min):
            Min=tmp
    print(Min)
else:
    print(l*r%2019)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
l=L//2019
ll=L%2019
r=R//2019
lll=L//673
rrr=R//673
if l<r or ll==0:
  print(0)
elif lll>=1 and R-L>=3:
  print(0)
else:
  print(ll*(ll+1))

Submission status: Wrong Answer

Solution code:
L,R= [int(i) for i in input().split()]
a = 2019
if (R-L+1)>=2019:
    print(0)
    exit(0)
l = L % 2019
r = R % 2019
M = L+(2019-l)

i = L
j = -1
if M<R:
    i = M
else:
    if l<r:
        i = L
    else:
        j = R
if -1==j:
    j = i+1
else:
    i = j-1
print((i*j)%2019)

Submission status: Wrong Answer

Solution code:
print(2018 * 2017 % 2019)
a, b = map(int, input().split())
c = 0
d = -1
for i in range(a + 1, b + 1):
    if d == -1:
        d = (i * (i-1)) % 2019
    elif d > (i * (i-1)) % 2019:
        d = (i * (i-1)) % 2019
    c += 1
    if d == 0:
        print(i)
    if c > 2019 * 3:
        break
c = 0
for i in range(b, a):
    if d > (i * (i-1)) % 2019:
        d = (i * (i-1)) % 2019
    c += 1
    if d == 0:
        print(i)
    if c > 2019 * 3:
        break
print(d)

Submission status: Wrong Answer

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

a = R//2019*2019
b = (R//2019+1)*2019
if L <= a <= R:
  print((a * (a+1))%2019)
else:
  if (L-a) == (b-R):
    print((L*R)%2019) 
  elif (L-a) > (b-R):
    print((R * (R-1))%2019) 
  else:
    print((L * (L+1))%2019)

Submission status: Wrong Answer

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

s = []
for i in range(l,r):
    s.append(i%mod)

sorted(s)
if(l+1==r):
    ans = l*r%mod
else:
    ans=s[0]*s[1]

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

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

    if L == 0:
        return 0

    if (R // 2019) > ((L-1) // 2019):
        return 0

    if (R // 673) > ((L-1) // 673):
        if R - L >= 2:
            return 0
        if (R % 3) == 0 or (L % 3) == 0:
            return 0

    left = L % 2019
    return left * (left + 1)


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

Submission status: Wrong Answer

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

mod = 2019
for i in range(20):
  if L <= 3**i <= R or L <= 673**i <= R or L <= 3*673*i <= R or L <= 3*i <= R or L <= 673*i <= R or L <= 3*673**i <= R:
    print(0)
    exit()
else:
  print(min((L*(L+1))%mod, R*(R-1)%mod, R*L%mod))

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    l,r  = list(map(int, input().split(" ")))

    n = l // 2019
    if l <= 2019 * n and 2019 * n <= r:
        print(0)
    else:
        print(((l % 2019) * ((l+1) % 2019)) % 2019)

Submission status: Wrong Answer

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

ans = 0

if R < 2019:
    ans = (L % 2019) * ((L + 1) % 2019)
elif R - L >= 2019:
    ans = 0
elif L <= 2019 <= R:
    ans = 0
else:
    ans = (L % 2019) * ((L + 1) % 2019)


print(ans)

Submission status: Wrong Answer

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

I = 0
J = 0
now = 0
mod = 2019
for i in range(R-L):
    if(i % 2019 == 0):
        mod = 0
        break
    for j in range(R-L-i):
        if (j % 2019 == 0):
            mod = 0
            break
        I = L + i
        J = L + i + j + 1
        now = (I * J) % 2019
        if(now < mod):
            mod = now

print(mod)

Submission status: Wrong Answer

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

minimum = l%2019
maximum = r%2019

ans = 10000
if r-l >= 2019:
    print(0)    
elif r-l < 2019 and (r - l) != (maximum - minimum):
    print(0)
elif r-l < 2019 and maximum == (minimum + r - l):
    for i in range(l,r):
        ans = min(i*(i+1)%2019,ans)
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys

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

min_i = 2018
i_3 = -1
i_673 = -1
for i in range(l, r+1):
    if i % 2019 < min_i % 2019:
        min_i = i
    if i % 2019 == 3:
        i_3 = i
    if i % 2019 == 673:
        i_673 = i

if i_3 != -1 and i_673 != -1:
    print(0)
else:
    print((min_i * (min_i+1)) % 2019)

Submission status: Wrong Answer

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

if l_mod > r_mod:
    print(0)
else:
    mod = (l_mod*(l_mod+1)) % 2019
    for i in range(l_mod,r_mod):
        for j in range(i+1,r_mod+1):
            if mod > (i*j)%2019:
                mod = (i*j)%2019
    print(mod)

Submission status: Wrong Answer

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

if l >= r or l == 0 or r == 0:
    ans = 0
else:
    for i in range(l, r):
        for j in range(l + 1, r + 1):
            if j <= i:
                continue
            else:
                ans = min(ans, i * j % MOD)

print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
ls = []
if L*R < 2019:
    print(L*R)
elif R - L > 2019:
    print(1)
else:
    print(1)

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

Solution code:
L, R = (int(x) for x in input().split())

temp = []

for i in range(L, R+1):
    if not ((i%2019) in temp):
        temp.append(i%2019)
    else:
        break

temp.sort()

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
#divisor = [2019,673,3]
x = 10e9
if L-R > 2019:
    x=0
else:   
    if L%2019 > R%2019:
        x=0
    else:
        for i in range(L,R):
            for j in range(i+1,R+1):
                print(x,(i%2019)*(j%2019))
                x = min(x,(i%2019)*(j%2019))
                if x == 0:
                    break
    
print(x)

Submission status: Wrong Answer

Solution code:
l, r = (int(_) for _ in input().split())

if abs(l - r) == 1:
    print(l * r % 2019)
else:
    lower = l // 2019
    upper = r // 2019
    start = l % 2019
    stop = r % 2019
    if start == 0:
        print(0)
    elif stop == 0:
        print(0)
    elif stop < start:
        print(0)
    elif stop > start or start == stop:
        print(start * (start + 1) % 2019)

Submission status: Wrong Answer

Solution code:
from sys import stdin

if __name__ == '__main__':

    L, R = [int(x) for x in stdin.readline().rstrip().split()]

    exist_0 = False
    mods = list()
    for i in range(R - L + 1):
        if (R - i) % 2019 == 0:
            exist_0 = True
            break

        mods.append((R - i) % 2019)

    if exist_0:
        print(0)
    else:
        min = 2018
        for x in mods:
            for y in mods:
                if x == y:
                    continue
                else:
                    tmp = (x * y) % 2019
                    if tmp < min:
                        min = tmp
                if tmp == 1:
                    break
            if tmp == 1:
                break

        print(min)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod = []
count = 0
diff = R-L
if diff > 2019:
    ret = 0
else:
    mod = [x % 2019 for x in range(L,R+1)] 
    ret = mod[0]*mod[1]
print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# n mod 2019 の答えは 0 ~ 2018 のいずれか
# それぞれのmodを取った積のmodでも同じ答えになる


def get_ans():
    # 差が2018以上なら積が0の組み合わせが存在する
    if R - L >= 2018:
        return 0
    # mod後の最小値コンビを十分大きな値で初期化しておく
    nums = [2019, 2020]
    for n in range(L, R + 1):
        mod = n % 2019
        # 新しい値を加えて昇順ソートして先頭から2つの値で更新
        nums.append(mod)
        nums = sorted(nums)[:2]

    # ループ終わったら最小値コンビの積のmodを取る
    return (nums[0] * nums[1]) % 2019


print(get_ans())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ans=0
if l%2019>r%2019 or r-l>=2018:
    ans=0
else:
    if l%673>r%673 or r-l>=672:
        ans=0
    else:
        ll=l%2019
        rr=r%2019
        ans=min((rr*(rr-1))%2019,(ll*(ll+1))%2019)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
#from pprint import pprint
import numpy as np
def myinput_int():
    return list(map(int, input().split()))
def myinput_str():
    return list(input().split())

L,R = myinput_int()

if 2019<=R-L :
    print(0)
    exit(0)

a = np.arange(L,R+1)%2019
b = np.sort(a)

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
# print("debug: " + str(L*R%2019))
if R - L >= 2019:
    print(0)
elif L <= 2019 and R <= 2019:
    print(L*R%2019)
else:
    ans = 2020
    L_mod = L % 2019
    R_mod = R % 2019
    for i in range(min(L_mod,R_mod),max(L_mod,R_mod)):
        for j in range(i+1,max(L_mod,R_mod)):
            # print((i*j)%2019, i, j)
            ans = min(ans, (i*j)%2019)
    print(ans)

Submission status: Wrong Answer

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

temp = 2019
for i in range(0,min(r-l+1,2020)):
    temp = min(temp,(l+i)%2019)
    
print(temp*(temp+1))

Submission status: Wrong Answer

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

ans = 2018

ml = l % 2019
mr = r % 2019

t = mr - ml

ch = 0
while t < 0:
    t += 2019
    ch += 1
mr += ch * 2019

for i in range(t):
    for j in range(t - i):
        p = ((ml + i) * (ml + i + j + 1)) % 2019
        if p < ans:
            ans = p

print(ans)

Submission status: Wrong Answer

Solution code:
L,R= [int(i) for i in input().split()]
a = 2019
if (R-L+1)>=2019:
    print(0)
    exit(0)
l = L % 2019
r = R % 2019
M = L+(2019-l)

i = L
j = -1
if M<R:
    i = M
else:
    if l<R:
        i = L
    else:
        j = R
if -1==j:
    j = i+1
else:
    i = j-1
print((i*j)%2019)

Submission status: Wrong Answer

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

minnum = 3000
lastnum = 0
count = 0
for i in range(4050):
    if  l + i == r:
        break
    elif (l+i % 2019) <= minnum:
        if (l+i % 2019) < minnum:
            count = 0
            minnum = (l+i) % 2019
            lastnum = l+i
        else:
            count += 1

if count > 0:
    print((lastnum**2)%2019)
else:
    print((lastnum*(lastnum+1))%2019)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
# m = 2 * (10 ** 9) + 1
# n = 2 * (10 ** 9) + 2
flag = 0
for i in range(l, r+1):
    if i % 2019 == 0:
        flag = 1
        break
#     a = m
#     m = min(m, i % 2019)
#     if a == m:
#         n = min(n, i % 2019)
#     else:
#         n = min(n, a)
#
# print('m', m)
# print('n', n)
if flag == 0:
    print((l % 2019) * (l+1 % 2019) % 2019)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
list_=[]
l,r=map(int,input().split())
i,j=0,1
while i < r-l-1:
 while j < r-l:
  list_.append((l+i*l+j)%2019)
  j+=1
 i+=1
 j=i+1
if r-l == 1:
 list_.append(r*l%2019)
print(min(list_))

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
mod = 2019
if R-L==1:
    print((L*R)%mod)
    exit()

li = [i%mod for i in range(L,R+1)]
li.sort()
if li[0]==0:
    print(li[1]*li[2])
else:
    print(li[0]*li[1])

Submission status: Wrong Answer

Solution code:
import math
[l,r] = [int(i) for i in input().split()]
i = 0
check = 1
ans = 0
p = l % 2019
q = r % 2019
# 2019の倍数が挟まっている
# lの方があまりが大きい → 挟まってる
# 差が2019以上 → 挟まってる
if p >= q or r - l >= 2019:
    print(0)
elif math.floor(q / 673)-math.floor((p-1) / 673) > 0 and math.floor(q/3) - math.floor((p-1)/3) > 0:
    print(0)
else:
    #p < q かつ r - l < 2019
    #すなわち 2020 2040みたいな状況
    print((p * (p+1))% 2019)

Submission status: Wrong Answer

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

print(val)

Submission status: Wrong Answer

Solution code:
L,R=(int(x) for x in input().split())
L_mod=L%2019
R_mod=R%2019
c=0
for n in range(2019):
    if L+n>=R:
        break
    if (L+n)%2019==0:
        c=1
        break
if c==1:
    print(0)
else:
    print(L_mod*(L_mod+1))

Submission status: Wrong Answer

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

np1 = np.array(range(L,R+1))
print(np1)
#np2 = np.multiply.outer(np1,np1)
#print(np2)
#np2[R-L-1,R-L-1] = 2019
#np3 = np2%2019
#np3[0,0] = 2019
#np3[R-L,R-L]=2019
np2 = (np1*np1)%2019
np2[0] =2019
np2[R-L]=2019
print(np2)
print(np.amin(np2))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
if r-l+1>2020:
  x=list(range(l,l+2020))
else:
  x=list(range(l,r+1))
y=list()
for n in x:
  y=y+[n%2019]
y.sort()
k=len(y)
print(min((y[0]*y[1])%2019,y[k-1]*y[k-2]%2019))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
rl=r-l
a=l//673
b=r//673
c=l%673
d=r%673
if rl==1:
  print(l*r%2019)
elif b-a>=1:
  print(0)
else :
  print((c*(c+1))%2019)

Submission status: Wrong Answer

Solution code:
import bisect
from operator import itemgetter
import math
import copy
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

L,R = IL()


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

Submission status: Wrong Answer

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

if L//2019==R//2019:
    m=L%2019
    ans=(m*(m+1))%2019
else:
    ans=0
print(ans)

Submission status: Wrong Answer

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

#i*jmodk=(imodk*jmodk)modk

#l以上r以下の整数で2019の倍数を含むものがあれば、imod2019=0となるiを選ぶことでijmod2019=0になり、最小

#r-lが2018以上ならかならず、imod2019=0となるiか、jmod2019=0となるjが存在する

if r-l>=2018:
    print(0)
else:
    #場合2、l~r-1を全探索。
    i_l=[]
    for i in range(l,r):
        i_l.append(i%2019)
    ans_l=min(i_l)
    ans=((ans_l%2019) * ((ans_l+1)%2019))%2019
    print(ans)

Submission status: Wrong Answer

Solution code:
L,R =(int(x) for x in input().split())
if(L<2019<R):
    print(1)
elif(L<2 and R<672):
    print(0)
else:
    if((L%2019)^2 < (R%2019)^2):
        print((L*(L+1))%2019)
    else:
        print(((R-1)*R)%2019)

Submission status: Wrong Answer

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

if l_mod > r_mod:
    print(0)
else:
    mod = (l_mod*(l_mod+1)) % 2019
    for i in range(l_mod,r_mod):
        for j in range(l_mod+i+1,r_mod+1):
            if mod > (i*j) %2019:
                mod = (i*j) %2019
    print(mod)

Submission status: Wrong Answer

Solution code:
import itertools

L, R = map(int, input().split())
A = [L+i for i in range(R-L+1)]
abs_A = []

for x in itertools.combinations(A, 2):
    if (x[0]<2019)&(x[1]<2019):
        abs_A.append(x[0]*x[1])
    else:
        abs_A.append((x[0]*x[1])%2019)

print(sorted(abs_A)[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 2018

l %= 2019
r %= 2019

if l > r:
	s = l
	l = r
	r = s
	
for i in range(l,r):
	for j in range(i+1,r+1):
		if i*j > 2019:
			rem = (i*j)%2019
		else:
			rem = i*j
		if rem < ans:
			ans = rem

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    l, r = map(int, input().split())

    n = r // 2019 - l // 2019

    if n >= 2:
        print(0)
    elif n == 1:
        print(l % 2019)
    else:
        print(l * (l+1) % 2019)

Submission status: Wrong Answer

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

if R-L > 2019:
    print('0')
else:
    for i in range(L, R):
        if (i % 2019) < mini:
            mini = i % 2019
            ans = i

    for j in range(L, R+1):
        if j == ans:
            continue
        if (j % 2019) < minib:
            minib = j % 2019
            ansb = j

    calc = ((ans%2019) * (ansb%2019)) % 2019
    print(calc)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
if r-l+1<=2019:
	lst=list(range(l,r+1))
	modlist=[]
	for i in lst:
		q,mod = divmod(i,2019)
		modlist.append(mod)
	sor = sorted(modlist)
	if sor[0]==0:
		print(0)
	else:
		if 672 in sor and 673 in sor:
			print(0)
		elif 675 in sor and 673 in sor:
			print(0)
		else:
			print(sor[0]*sor[1])
else:
	lst=list(range(l,l+2019))
	modlist=[]
	for i in lst:
		q,mod = divmod(i,2019)
		modlist.append(mod)
	sor = sorted(modlist)
	print(sor[0]*sor[1])

Submission status: Wrong Answer

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

if l >= r:
    l = 0
    r = 2018

for i in range(l, r):
    for j in range(l, r + 1):
        if j <= i:
            continue
        else:
            ans = min(ans, i * j % MOD)

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

s = input().split()
min=2019
if int(s[0])-int(s[1])<=1:
    min = (int(s[0])*int(s[1])) % 2019
else:
    for i in range(int(s[0]),int(s[1])-1):
        for j in range(i+1,int(s[1])):
            if (i*j)%2019<min:
                min = (i*j) % 2019
                print(i,j)

print(min)

Submission status: Wrong Answer

Solution code:
from fractions import gcd


l, r = map(int, input().split())
lr_ans = []
if r - l + 1 >= 2019:
    print(0)
    exit()
for i in range(l, min(l+2019+1, r+1)):
    lr_ans.append(i%2019)
lr_ans.sort()
print(int((lr_ans[0]*lr_ans[1])/gcd(lr_ans[0], lr_ans[1])))

Submission status: Wrong Answer

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

if l_mod > r_mod:
    print(0)
else:
    mod = (l_mod*(l_mod+1)) % 2019
    for i in range(l_mod,r_mod):
        for j in range(l_mod+i+1,r_mod+1):
            print(i)
            if mod > (i*j) %2019:
                mod = (i*j) %2019
    print(mod)

Submission status: Wrong Answer

Solution code:
import sys

n, r = map(int, input().split())
if abs(n - r) == 1:
  print((n * r) % 2019)
  sys.exit(0)
min = 2019
nM = n % 2019
rM = r % 2019
for i in range(nM, rM):
  for j in range(i+1, rM):
    iM = i % 2019
    jM = j % 2019
    if ((iM * jM) % 2019) < min:
      min = (iM * jM) % 2019
print(min)

Submission status: Wrong Answer

Solution code:
def main():
    L,R=map(int,input().split())
    
    min_n=L*(L+1)
    max_n=R*(R+1)
    
    
    flag=True
    if flag:
        for i in range(L,R+1):
            if i%2019 ==0:
                flag=False
                print(0)
                    
    if flag:
        print(min_n%2019)    

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
  min_max=0
  f_1=2019
  f_2=2019
  min_d=2019
  L,R=map(int,input().split())
  for i in range(L,R+1):
    a=i%2019
    if a<=min_d:
      min_d=a
      f_2=f_1
      f_1=i
    if min_d==0:
      break
  print((f_1*f_2)%2019)
  
main()

Submission status: Wrong Answer

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

ans = 10 ** 7

L=L%2019
R=R%2019

di = R//2019 - L//2019

if(L<=R and di == 0):
    for i in range(L,R):
        for j in range(i+1,R+1):
            ans = min(ans, ((i%2019)*(j%2019))%2019)

elif(L<=R and di != 0):
    R += 2019
    for i in range(L,R):
        for j in range(i+1,R+1):
            ans = min(ans, ((i%2019)*(j%2019))%2019)

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

print(ans)

Submission status: Wrong Answer

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

flag = 0
for i in range(L,R+1):
    if i % 2019 == 0:
        flag = 1
        break
        
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())
ans = 2019
for i in range((r-l)%2019):
  ne = (((l+i)%2019)*((l+i+1)%2019))%2019
  ans = min(ans, ne)
  
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np 
def minimize():
    L, R=map(int,input().split())
    lis=[]
    for i in range(L,R):
        for j in range(i+1, R+1):
            x=(i*j) %2019
            lis.append(x)
        if len(np.unique(lis))==2018:
            break
    lis=np.array(lis)
    ans=lis.min()
    print(ans)

minimize()

Submission status: Wrong Answer

Solution code:
n = list(map(int, input().rstrip().split(" ")))
if n[1] - n[0] >= 2019:
    print(0)
elif n[0]%2019!=0 and 2019 - n[0]%2019 < n[1] - n[0]:
    print(0)
elif 2019 - n[0]%2019 == 2019:
    print(0)
else:
    n1 = (n[0] * (n[0]+1))%2019
    n2 = (n[1] * (n[1]-1))%2019
    if n1 < n2:
        print(n1)
    elif n1 > n2:
        print(n2)
    elif n[1] - n[0] == 1:
        print(n1)
    else:
        llim = n[0]
        lim = n[1]
        ans = 2019
        for a in range(llim, lim):
            for b in range(a+1,lim):
                n = a * (b) % 2019
                if n < ans:
                    ans = n
        print(ans)

Submission status: Wrong Answer

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

if l >= r:
    l = 0
    r = 2018

for i in range(l, r + 1):
    for j in range(l + 1, r + 1):
        if j <= i:
            continue
        else:
            ans = min(ans, i * j % MOD)

print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

    if not L or R - L > 2018:
        print(0)
        return

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

input = lambda: stdin.readline()
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
x = []
y = []
 
for i in range(l, r):
  for j in range(i+1, r+1):
    m = i * j % 2019
    x.append(m)
    y.append(i*j)
print(y[x.index(min(x))])

Submission status: Wrong Answer

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

if l >= r:
    l = 0
    r = 2018

for i in range(l, r):
    for j in range(l + 1, r + 1):
        if j < i:
            continue
        else:
            ans = min(ans, i * j % MOD)

print(ans)

Submission status: Wrong Answer

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

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

print(minv)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

band = (R // 2019) - (L // 2019)
if (L % 2019 == 0) or (R % 2019 == 0):
    print(0)
elif band >=1:
    #この中に一個必ず2019の倍数がある
    print(0)
else:
    print((L % 2019 * (L+1) % 2019) % 2019)

Submission status: Wrong Answer

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

ans = 2018
if l-n >= 672:
    ans = 0
else:
    for i in range(l,n+1):
        ii = i % 2019
        for j in range(l,n+1):
            jj = j % 2019
            ansss = ii*jj%2019
            if ansss == 0:
                ans = 0
                break
            elif ansss < ans:
                ans = ansss

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

s = input().split()
min=2019
if int(s[0])-int(s[1])<=1:
    min = (int(s[0])*int(s[1])) % 2019
for i in range(int(s[0]),int(s[1])-1):
    for j in range(i+1,int(s[1])):
        if (i*j)%2019<min:
            min = (i*j) % 2019
            print(i,j)

print(min)

Submission status: Wrong Answer

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

list2019 = []
list673 = []
for i in range(1000000):
    list2019.append(2019 * i)

for i in range(3):
    list673.append(673 * i)

answer = (L * (L + 1)) % 2019
for l2019 in list2019:
    if L <= l2019 and l2019 <= R:
        answer = 0

if L <= 673 and 673 <= R and (L <= 673 - 1 or 673 + 2 <= R):
    answer = 0

if L <= 1346 and 1346 <= R and (L <= 1346 - 2 or 1346 + 1 <= R):
    answer = 0

print(answer)

Submission status: Wrong Answer

Solution code:
import sys

l, r = [int(i) for i in input().split()]

ans = 2020
for i in range(l, r+1):
	for k in range(i, r+1):
		mod = (i * k) % 2019
	if mod==0:
		print(0)
		sys.exit()

	ans = min(mod, ans)
 
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

tmp = 0
ans = 2019
if L * R < 2019:
	i = L
	j = R
	tmp = i * j % 2019
	if tmp < ans:
		ans = tmp

elif (L + 2019 - L%2019) + 1 <= R:
	if L <= L + 2019 - L % 2019 and L + 2019 - L % 2019 + 1 <= R:
		i =  L + 2019 - L % 2019
		j = i+1
		tmp = i * j % 2019
		if tmp < ans:
			ans = tmp

elif L % 2019 < R % 2019:
	i = L
	j = i+1
	tmp = i * j % 2019
	if tmp < ans:
		ans = tmp

elif R % 2019 > L % 2019:
	j = R
	i = j-1
	tmp = i * j % 2019
	if tmp < ans:
		ans = tmp
else:
	i = L
	j = R
	tmp = i * j % 2019
	if tmp < ans:
		ans = tmp

ans = (i * j) % 2019

print(ans)

Submission status: Wrong Answer

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

if R-L >= 2019:
    print('0')
else:
    for i in range(L, R):
        if (i % 2019) < mini:
            mini = i % 2019
            ans = i

    for j in range(L, R+1):
        if j == ans:
            continue
        if (j % 2019) < minib:
            minib = j % 2019
            ansb = j

    calc = ((ans%2019) * (ansb%2019)) % 2019
    print(calc)

Submission status: Wrong Answer

Solution code:
import numpy as np
L, R= list(map(int, input().split()))
# array = np.arange(L, R+1)

def get_flg3():
    if R-L >= 3:
        return True
    elif R//3 != L//3:
        return True
    else:
        return False
    

def get_flg673():
    if R-L >= 673:
        return True
    elif R//673 != L//673:
        return True
    else:
        return False
        
        
print('{}'.format(0 if get_flg3() & get_flg673() else L*(L+1)%2019))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if R-L >= 2019:
    ans = 0
else:
    ans = 4000
    for i in range(L,R):
        for j in range(i+1,R):
            p = ((i%2019) * (j%2019))%2019
            if p < ans:
                ans = p

print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
if R//2019 - (L-1)//2019 > 0:
    print(0)
elif R//673 - (L-1)//673 > 0 and R-L > 2:
    print(0)
else:
    l = L%673
    r = R%673
    shou = (L//673)%3
    print((l*(l+1))%2019)