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

print(a)

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().strip().split(' ')))
L = s[0]
R = s[1]
ans = 2020

for i in range(1, 100):
    a = 2019 * i
    if L < a:
        i = i - 1
        L = L - a
        break
for i in range(1, 100):
    a = 2019 * i
    if R < a:
        i = i - 1
        R = R - a
        break
if R == 0 or L == 0:
    print(0)

if L > R:
    temp = R
    R = L
    L = temp

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for i in range(L, R + 1):
    mod = i % 2019
    if mod == 0:
        L = 0
        break

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

Submission status: Wrong Answer

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

x_min = 2018
for i in range(l,n):
    x = i % 2019
    if x < x_min:
        x_min = x

print(x_min*(x_min+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

MOD = 2019
minMOD = 2019
minMOD2 = 2019

for i in range(L, R+1):
    tmp = i % MOD
    if tmp == 0:
        minMOD = 0
        break

    if tmp < minMOD:
        minMOD = tmp
    elif tmp < minMOD2:
        minMOD2 = tmp

print(minMOD * minMOD2)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
str = input()

L, R = map(int, str.split(" "))

min = 2019

L = L % 2019
R = R % 2019
if L > R:
    t = L
    L = R
    R = t

for i in range(L, R):
    for j in range(i + 1, R + 1):
        k = i * j
        if min > k:
            min = k

print(min)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
i=0
s=[]
if (r-l)>1000000:
    print(0)
else:
    while i!=(r-l)+1:
        s.append(((l+i)%2019))
        i+=1
    s.sort()
    #print(s)
    print((s[0]*s[1])%2019)

Submission status: Wrong Answer

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

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

if not flag:
  if lm <= rm :
    print((lm * (lm+1))%2019)
  else :  
    print(((rm-1) * rm)%2019)

Submission status: Wrong Answer

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

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

elif (l//673+1)*673 < r:
    print(0)

else:
    print(min((l * (l + 1)) % 2019, (r * (r - 1)) % 2019))

Submission status: Wrong Answer

Solution code:
def main():
  sum=0
  L,R=map(int,input().split())
  L_e=L%2019
  R_e=R%2019
  a=min(L_e,R_e)
  print((a*(a+1))%2019)
      
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
mod = 2019
L_mod = L%mod
R_mod = R%mod
sa = R-L
if sa >= mod*2:
    ans = 1
elif sa >= mod:
    ans = 1
else:
    ans = mod
    for i in range(L,R-1):
        for j in range(i+1,R):
            x = i%mod * j%mod
            ans = min(ans,x%mod)
        
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
m = []
for i in range(l, r+1):
    m.append(i % 2019)

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

Submission status: Wrong Answer

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

def main():
    l, r = map(int, input().split())
    mod = []
    mn = 10 ** 10
    for i in range(l, r + 1):
        mod.append(i % 2019)
        if mn > i % 2019:
            mn = i % 2019
            tmp = i
    if min(mod) == 0:
        print(0)
    else:
        print((tmp * (tmp + 1)) % 2019)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

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

def main():
    N = R - L + 1
    m = L // 2019
    if N >= 2019:
        ans = 0
    elif R // 2019 <= m + 1:
        ans = 0
    else:
        ansLi = L % 2019
        ansLj = (L+1) % 2019
        ansL = ansLi * ansLj

        ansRi = R % 2019
        ansRj = (R-1) % 2019
        ansR = ansRi * ansRj

        ans = min(ansL, ansR)

    return int(ans)

print(main())

Submission status: Wrong Answer

Solution code:
# coding: utf-8
l, r = map(int, input().split())
mod = 2019
modl = l // mod
modr = r // mod
l_mod = l % mod
r_mod = r % mod
# print(modl, modr)
# if l <= mod*modl <= r or l <= mod * modr <= r:
if modl != modr:
    print(0)
else:
    print(l_mod * (l_mod+1))

Submission status: Wrong Answer

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

ret=int((L%2019)*(L%2019+1))

if(L==0):
  ret=0
  
if(R-L>=2019):
  ret=0
  
if(L%2019 > R%2019):
  ret=0
  

    
print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

elif (l//673+1)*673 < r:
    print(0)

else:
    print(l * (l + 1) % 2019,r * (r - 1) % 2019)
    print(min((l * (l + 1)) % 2019, (r * (r - 1)) % 2019))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
L,R=map(int,input().split())
mod=2019
if R-L>2017:
    print(0)
elif L%mod>R%mod:
    print(0)
else:
    print(L*(L+1)%mod)

Submission status: Wrong Answer

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

l = L // mod
r = R // mod

if l != r:
    print(0)
else:
    u = L * R % mod
    print(u-(R-L-1))

Submission status: Wrong Answer

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

ans = 3000

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


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
l, r = map(int, input().split())

# prime_factor = 3, 673
mod = 2019

min_div = mod
last_div = l
for i in range(l + 1, r + 1):
    div = i % mod
    min_div = min(min_div, (last_div * div) % mod)
    last_div = div

    if min_div == 0:
        break
print(min_div)

Submission status: Wrong Answer

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

if R - L >= 2019:
    print(0)
else:
    L = L % 2019
    R = R % 2019
    
    if L >R:
        print(0)
    else:
        mi = (L*(L+1)) %2019
        for i in range(L, R):
            for j in range(i+1, R+1):
                print(i, j)
                tmp = (i*j) % 2019
                if tmp < mi:
                    mi = tmp
                    
        print(mi)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
I,J = 10000000000000000,100000000000000000
for i in range(L,R):
    I = min(I,abs(i-2019))
for i in range(L+1,R+1):
    J = min(J,abs(i-2019))
print(I*J%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = input().split()
a = [int(i) for i in a]

yojyou_list = []
if a[0] > a[1]:
    for i in range(a[0] - a[1] + 1):
        yojyou_list.append((a[1] + i) % 2019)
else:
    for i in range(a[1] - a[0] + 1):
        
        yojyou_list.append((a[0] + i) % 2019)

yojyou_list = sorted(yojyou_list)

if yojyou_list[0] * yojyou_list[1] >= 2019:
    print((yojyou_list[0] * yojyou_list[1]) % 2019)
else:
    print(yojyou_list[0] * yojyou_list[1])

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
i=0
s=[]
if (r-l)>100000:
    print(0)
else:
    while i!=(r-l)+1:
        s.append(((l+i)%2019))
        i+=1
    s.sort()
    #print(s)
    print((s[0]*s[1])%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if (673<=R and L-R>=2) or (L<=2019 and 2019<=R):
    ans = 0
else:
    for i in range(L,R+1):
        c = i%2019
        if c < a:
            b = a
            a = c
        else:
            if c < b:
                b = c
    ans = a*b
print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
if L * R < 2019:
        print(L * R)
        exit()

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

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

Submission status: Wrong Answer

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

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

print(ans % 2019)

Submission status: Wrong Answer

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

cnt = 0
for i in range(L, R+1, 2019):
    cnt += 1

if cnt == 0:
    print(0)
else:
    a = R % 2019
    b = L % 2019
    
    if a > 2019 // 2:    
        a = 2019 - a
    if b > 2019 // 2:
        b = 2019 - b

    print(min(a * (a+1) % 2019, b * (b+1) % 2019))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def RemainderMinimization2019():
	L, R = map(int, input().split())
	minMod = 10000
	for i in range(L, R):
		for j in range(i + 1, R + 1):
			tmpA = (i % 2019)
			tmpB = (j % 2019)
			tmp = tmpA * tmpB
			# print(i, j, tmp)
			if minMod > tmp:
				minMod = tmp
	print(minMod)
RemainderMinimization2019()

Submission status: Wrong Answer

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))
base = 2019
L,R = LI()
l = L % base
r = R % base
if l >= r:
    ans = 0
else:
    ans = mod
    for i in range(l,r):
        for j in range(i+1,r+1):
            # print(i,j)
            ans = min(ans,i * j % base)
            if ans == 0:
                break
        else:
            continue
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

L, R = map(int, input().split())
modL = L % 2019
modR = R % 2019

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

Submission status: Wrong Answer

Solution code:
import sys
from math import *
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

num = 2019
l, r = na()
li = []
if r < num:
    print(l * r)
elif l <= num <= r:
    print(0)
elif l > num:
    if r - l >= num:
        print(0)
    else:
        for i in range(l, r+1):
            li.append(i%num)
        li.sort()
        print(li[0] * li[1])

Submission status: Wrong Answer

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

    flag=True
    for i in range(L,R+1):
        if i//2019 ==0:
            print(0)
            flag=False
            break
    if flag:
        print(L*(L+1)%2019)


if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mods = []

for num in range(2019):
	i = num + L
	if i > R:
		break
	mods.append(i%2019)

mods.sort()

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

Submission status: Wrong Answer

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

if (r-l+1)>=2019:
    print(0)
else:
    m = [-1]*(r-l+1)
    for i in range(r-l+1):
        m[i] = (l+i)%2019
    sm = sorted(m)
    print((sm[0]*sm[1])%2019)

Submission status: Wrong Answer

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

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


print(ans)

Submission status: Wrong Answer

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

s = l % mod
e = r % mod

for i in range(s,e):
    for j in range(i+1,e+1):
        #m = ((i % mod) * (j % mod)) % mod
        #m = (i * j) % mod
        m = i * j
        #print(i,j,m)

        if m < mod_min:
            mod_min = m

print(mod_min)

Submission status: Wrong Answer

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

K=R-L+1
min=3000
if K>=2019:
    print(0)
else:
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            if min>=(i*j)%2019:
                min=(i*j)%2019

print(min)

Submission status: Wrong Answer

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

from itertools import combinations
mod = 2019
l, r = L % mod, R % mod

mini = mod
for i, j in combinations(range(l, r+1), 2):
    val = i*j % mod
    if val < mini:
        mini = val
        if mini == 0:
            break

print(mini)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
lr = list(map(int, input().split()))
l = lr[0]
r = lr[1]
lmod = l%2019

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

i_mod = 2020
i = L

for x in range(L, min((R+1, L+2019))):
    if x % 2019 < i_mod:
        i = x
        i_mod = x % 2019
if i + 2019 > R:
    if i == R:
        j = L 
        j_mod = L % 2019
    else:
        j = i + 1
        j_mod = (i+1) % 2019
else:
    j = i + 2019
    j_mod = i_mod

print(i_mod*j_mod)

Submission status: Wrong Answer

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

ans = -1
now = 0
for i in range(l,r+1):
    for j in range(i+1,r+1):
        now = (i*j)%MOD
        ans = min(ans,now)


print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
mod = 2019
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod
L,R = map(int,input().split())
LL = L % 2019
RR = R % 2019
if (R//2019) == (L//2019):
    g = 9999999999999
    for i in range(L,R+1):
        for j in range(L,R+1):
            if i<j:
                g = min(g,mul(i,j))
    print(g)
else:
    RR = 2018
    g = 99999999999999999
    for i in range(LL,RR+1):
        for j in range(LL,RR+1):
            if i < j:
                g = min(g,mul(i,j))
    print(g)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
dif=R-L
if(dif>2019*2):
    dif=2019*2
l=L%2019
arr=[]
while(dif):
    arr.append(l)
    l+=1
    if(l==2019):
        l=0
    dif-=1
arr.sort()
if(len(arr)==1):
    arr.append(l)
print(arr[0]*arr[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#C問題
L,R = map(int,input().split())
r = R%2019
l = L%2019
if R-L>=2019:
    print(0)
else:
    if r <= l:
        print(0)
    else:
        MIN = 2019
        for i in range(r-l):
            I = i+l
            for j in range(r-l+1):
                J = j+l+1
                kari = I*J%2019
                MIN = min(MIN,kari)
        print(MIN)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if r//mod - l//mod >= 1:
  print(0)
  exit()
  
l = l%mod
r = r%mod

if r < l:
  print(0)
  exit()

for i in range(l,r):
  ans = min(ans,i*(i+1)%mod)
print(ans)

Submission status: Wrong Answer

Solution code:
def calc(ell: int, r: int) -> int:
    best_min = (ell * (ell + 1)) % 2019
    curr_ell = 2019
    while curr_ell < r - 1:
        if curr_ell > ell:
            continue
        curr_min = curr_ell * (curr_ell + 1)
        best_min = min(curr_min, best_min)
        curr_ell += 2019
    return best_min


def load_input_as_int_array():
    return [int(v) for v in input().split(" ")]


ell, r = load_input_as_int_array()
print(calc(ell, r))

Submission status: Wrong Answer

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

if ml >= mr:
  print(0)
elif R - L >= 2019:
  print(0)
else:
  temp = 2 * 10 ** 9
  for i in range(ml, mr + 1):
    for j in range(ml + 1, mr + 1):
      temp = min(temp, (i * j) % mod)
  print(temp)

Submission status: Wrong Answer

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

D = R - L
Ans = {2018}
J_Set = {2018}
def cal(a, b):
    return int((a*b)%2019)

for i in range(min(D, 2019)):
    for j in range(D):
        J_Set.add((L+i+j+1)%2019)
        if j > 2019:
            break
    Ans.add(cal(L+i, min(J_Set)))

print(min(Ans))

Submission status: Wrong Answer

Solution code:
L, R = [int(x) for x in input().split()]
if R-L >= 2019:
  print(0)
elif L%2019 > R%2019:
  print(0)
else:
  s = 2018
  for i in range(L,R+1):
    for j in range(L,R+1):
      if i < j:
        t = (i*j)%2019
        if s < t:
          s = t
  print(s*(s+1))

Submission status: Wrong Answer

Solution code:
n = list(map(int, input().rstrip().split(" ")))
if n[1] - n[0] >= 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

if R - L >= 2018:
    print(0)
elif R - L == 1:
    print(((L % mod) * (R % mod)) % mod)
else:
    list_ij = []
    for i in range(L, R):
        list_ij.append(i % mod)
    sorted(list_ij)
    print(list_ij[0] * list_ij[1])

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
list = []
d = 2018
for i in range(L, R+1):
    for j in range(i+1, R+1):
        mal = i * j
        a = mal % 2019
        if a == 0:
            print(0)
            break
        if a < d:
            list.append(a)
        d = a
if a == 2018:
    print(2018)
else:
    print(min(list))

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:



L, R = (int(i) for i in input().split())  



l = L % 2019
r = R % 2019

x = list(range(min(l, r+1), max(l, r+1)))

ans = 3000
for i in range(len(x)):
    for j in range(len(x)):
        if ans > (x[i]*x[j])%2019:
            ans = (x[i]*x[j])%2019





print(ans)

Submission status: Wrong Answer

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

lis = []
if r - l > 9999:
    r = l + 5000
for i in range(l, r+1):
    if i % 2019 != 0:
        lis += [i % 2019]
lis.sort()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math

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

ls = l % 2019
rs = r % 2019

dif = r / 2019 - l / 2019

#print("dif = {}".format(dif))

if (dif != 0):
    print(0)
elif (rs - ls == 1):
    print(ls*rs % 2019)
else:
    mini = []
    for i in range(ls, rs):
        mini.append(min(i * j % 2019 for j in range(ls + 1, rs)))
    print(min(mini))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(minv)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
parents = list(map(int,input().split(' ')))

a = parents[0] % 2019
if (2019-a)<=1010:
    a = (2019-a)
b = parents[1] % 2019
if (2019-b)<=1010:
    b = (2019-b)
diff = parents[1]-parents[0]
if (parents[0]%2019 + diff) >= 2019:
    print(0)
elif a<b:
    res = a*(a+1) % 2019
    if (2019-res)<=1010:
         res = (2019-res)
    print(res)
else:
    res = b*(b+1) % 2019
    if abs(2019-res)<=1010:
        res = abs(2019-res)
    print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

x=0
y=2019

for i in range(l,r+1):
    for j in range(i+1,r+1):
        print(i,j)
        x=(i*j)%2019
        if y > x:
            y=x
print(y)

Submission status: Wrong Answer

Solution code:
L,R=(int(x) for x in input().split())
mod_list=[]
minimum=10000000000
index=0
for i in range(L,R+1):
    if(index>2019):
        break
    else:
        mod_list.append(i%2019)
        index+=1

mod_list.sort()
can_a=mod_list[0]
can_b=mod_list[1]
print(can_a*can_b)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
ll = l % 2019
rr = r % 2019
start = min(ll, rr)
end = max(ll, rr)
mod_2019 = [x for x in range(0, 2 * (10 ** 9), 2019)]
for m in mod_2019:
    if l <= m <= r:
        print(0)
        exit()
mod = [x for x in range(start, end + 1)]
print(mod[0] * mod[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
str = input()

L, R = map(int, str.split(" "))

min = 2019

L = L % 2019
R = R % 2019
if L > R:
    t = L
    L = R
    R = t

for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        k = i * j
        if min > k:
            min = k

print(min)

Submission status: Wrong Answer

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

mv = 2019

# lとrの範囲がmvより大きかったら0
if (r + 1 - l) >= mv:
    print(0)
# 範囲が小さかったら
else:
    # 端を調べる
    lMod = l % mv
    rMod = r % mv
    # 0を含まない場合
    if lMod < rMod:
        print(lMod * (lMod + 1))
    # lrの大小が逆転してれば0ですね
    else:
        print(0)

Submission status: Wrong Answer

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

s = l % mod
e = r % mod

print(s,e)

for i in range(s,e):
    for j in range(i+1,e+1):
        #m = ((i % mod) * (j % mod)) % mod
        #m = (i * j) % mod
        m = i * j
        #print(i,j,m)

        if m < mod_min:
            mod_min = m

print(mod_min)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
start = L % 2019
end = R % 2019
dist = abs(end - start)

if end < start:
    print(0)
    exit()

if dist == 1:
    print((start * end) % 2019)
    exit()

ra = 3000
for i in range(dist):
    for j in range(i+1, dist-(i+1)):
        r = (i + start) * (j + start)
        if ra > r:
            ra = r

print(ra % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

diff = R//2019 - L//2019

if L % 2019 == 0:
    answer = 0
elif diff > 0:
    answer = 0
else:
    _min = 2019
    for i in range(L, R+1):
        for j in range(i, R+1):
            _min = min(_min, (i * j) % 2019)
    answer = _min

print(answer)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

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

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

r = np.array(list(i for i in range(L, R+1)))

r = np.sort(np.mod(r, 2019))

# print(r)
print(np.mod(r[0] * r[1], 2019))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
L,R=map(int,input().split())
mod=2019
if R-L>2017:
    print(0)
elif L%mod>R%mod:
    print(0)
else:
    print(((L%mod)*((L+1)%mod))%mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

y=2019

if l//y != r//y:
    print(0)
else:
    a=l%y
    print(a*(a+1))

Submission status: Wrong Answer

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

res = 1000000007

if R - L + 1 > 2019:
    print(0)
else:
    for i in range(L, R + 1):
        a = i % 2019
        for j in range(i + 1, R + 1):
            b = j % 2019
            res = min(res, a * b % 2019)

print(res)