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())
ans = float("inf")
mod = []
for i in range(l, r + 1):
    if i == (l + 2020):
        break
    mod.append(i % 2019)
mod.sort()
print(mod[0] * mod[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ed=min(l+2019+1,r+1)

s={}
while l<ed:
  if l%2019 in s:
    s[l%2019].append(l)
  else:
    s[l%2019]=[l]
  l+=1
d=sorted(s.keys())
#print(d)
#print(s)
print((s[d[0]][0]*s[d[1]][0])%2019)

Submission status: Wrong Answer

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

ed=min(l+2019*2+1,r+1)

s=[]
while l<ed:
  s.append(l%2019)
  l+=1
  
s.sort()
print(s[0]*s[1])

Submission status: Wrong Answer

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

for i in range(l,r+1):
  for j in range(i+1,r+1):
    mod = min(mod,(i*j)%2)
    if mod == 0:
      break
  if mod == 0:
    break
      
print(mod)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
if L//2019<R//2019:
  print(0)
else:
  L,R=L%2019,R%2019
  if L > R:
    print(0)
  import heapq
  l=[]
  for i in range(L,R+1):
    heapq.heappush(l,i%2019)
  a=heapq.heappop(l)
  b=heapq.heappop(l)
  print(a*b)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
import heapq
l=[]
for i in range(L,R+1):
  heapq.heappush(l,i%2019)
a=heapq.heappop(l)
b=heapq.heappop(l)
print(a*b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l %= 2019
r %= 2019

if l >= r:
    print(0)
else:
    m = 2019
    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:
# -*- coding: utf-8 -*-

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

end = min(R, L + mod*2)

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

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

mod = 2019

ans = 2018

end = min(R, L + mod*2)

for i in range(L, end):
    for j in range(i+1, end):
        if i==j:
            continue
        else:
            ans = min(ans, (i*j)%mod)

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

mod = 2019

ans = 2018

if R > L + mod*2:
    end = L + mod*2
else:
    end = R
for i in range(L, end):
    for j in range(i+1, end):
        if i==j:
            continue
        else:
            ans = min(ans, (i*j)%mod)

print(ans)

Submission status: Wrong Answer

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

for h in range(0,2):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0 and (r-l)>=2:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0 and (r-l)>=2:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))

Submission status: Wrong Answer

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

for h in range(0,3):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0 and (r-l)>=2:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0 and (r-l)>=2:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))

Submission status: Wrong Answer

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

for h in range(0,20):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0 and (r-l)>=2:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0 and (r-l)>=2:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))

Submission status: Wrong Answer

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

for h in range(0,673):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0 and (r-l)>=2:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0 and (r-l)>=2:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))

Submission status: Wrong Answer

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

for h in range(0,10):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0 and (r-l)>=2:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0 and (r-l)>=2:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))

Submission status: Wrong Answer

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

for h in range(0,10):
	for i in range(l,r+1):
		if i % (2019+h) == 0:
			print(h)
			exit()
		elif i % (673+h) == 0:
			print(h)
			exit()
		elif i % (2019-h) == 0:
			print(h)
			exit()
		elif i % (673-h) == 0:
			print(h)
			exit()
			
lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))

Submission status: Wrong Answer

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

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

lst = []

for i in range(l,r):
	for j in range(l+1,r+1):
		lst.append((i*j)%2019)

print(min(lst))

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

r={}
for item in range(a,b+1):
  if item%2019 in r:
    r[item%2019].append(item)
  else:
    r[item%2019]=[item]

keys = sorted(list(r.keys()))
#print(keys)

print(r[keys[0]][0]*r[keys[0]][1]%2019 if len(r[keys[0]])>1 else r[keys[0]][0]*r[keys[1]][0]%2019)
  

#print(r)

Submission status: Wrong Answer

Solution code:
#lとrの範囲内に2019の倍数があれば、最小値は0になる
#そうでなければ、余りは0<=lの余り<=rの余りなので、小さい方から取れば良い
#lとrの商が同じ、を直接表すと、四捨五入の関係で一緒じゃなくても等しいとされることがある

l,r = map(int, input().split())
if r-l >= 2018: #ただ単に、ミスでここのl
  print(0)
elif r-l==r%2019-l%2019:
  print((l*(l+1))%2019)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
#lとrの範囲内に2019の倍数があれば、最小値は0になる
#そうでなければ、余りは0<=lの余り<=rの余りなので、小さい方から取れば良い
#lとrの商が同じ、を直接表すと、四捨五入の関係で一緒じゃなくても等しいとされることがある
 
l,r = map(int, input().split())
if l >= 2018+r:
  print(0)
elif l+r%2019==l%2019+r:
  d = l%2019
  print(d*(d+1))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
#lとrの範囲内に2019の倍数があれば、最小値は0になる
#そうでなければ、余りは0<=lの余り<=rの余りなので、小さい方から取れば良い
#lとrの商が同じ、を直接表すと、四捨五入の関係で一緒じゃなくても等しいとされることがある

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

Submission status: Wrong Answer

Solution code:
#lとrの範囲内に2019の倍数があれば、最小値は0になる
#そうでなければ、余りは0<=lの余り<=rの余りなので、小さい方から取れば良い

l,r = map(int, input().split())
l_div = l//2019
r_div = r//2019
if l_div!=r_div:
  print(0)
else:
  print((l*(l+1))%2019)

Submission status: Wrong Answer

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

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

# if a[-1] == 0:
#     print(0)
# else:
#     mn = min(a[:-1])
#     print((mn * (mn + 1)) % 2019)

mn = min(a)
if mn == 0:
    print(0)
else:
    ans = (mn * (mn + 1)) % 2019
    print(ans)

Submission status: Wrong Answer

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

# max_loop = 2019 * 2 + 1
max_loop = 2019 + 1
count = 0
ans = 2019
for i in range(L, R):
    if count > max_loop:
        break
    ans = min(ans, (i * (i + 1)) % 2019)
    count += 1

print(ans)

Submission status: Wrong Answer

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

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

if a[-1] == 0:
    print(0)
else:
    mn = min(a[:-1])
    print((mn * (mn + 1)) % 2019)

Submission status: Wrong Answer

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

# max_loop = 2019 * 2 + 1
max_loop = 2019 ** 2
count = 0
a = []
for i in range(L, R + 1):
    # print(i)
    if count > max_loop:
        break
    a.append(i % 2019)
    count += 1

if a[-2] == 0:
    print(0)
else:
    mn = min(a[:-1])
    ans = (mn * (mn + 1)) % 2019
    print(ans)

Submission status: Wrong Answer

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

# max_loop = 2019 * 2 + 1
max_loop = 2019 ** 2
count = 0
a = []
for i in range(L, R + 1):
    # print(i)
    if count > max_loop:
        break
    a.append(i % 2019)
    count += 1

# print(a)
mn = min(a[:-1])
if a[-1] == 0:
    print(0)
else:
    ans = (mn * (mn + 1)) % 2019
    print(ans)

Submission status: Wrong Answer

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

# max_loop = 2019 * 2 + 1
max_loop = 2019 ** 2
count = 0
a = []
for i in range(L, R + 1):
    # print(i)
    if count > max_loop:
        break
    a.append(i % 2019)
    count += 1

# print(a)
mn = min(a[:-1])
if mn == 2018:
    print(0)
else:
    ans = (mn * (mn + 1)) % 2019
    print(ans)

Submission status: Wrong Answer

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

# max_loop = 2019 * 2 + 1
max_loop = 2019 ** 2
count = 0
a = []
for i in range(L, R + 1):
    print(i)
    if count > max_loop:
        break
    a.append(i % 2019)
    count += 1

# print(a)
mn = min(a[:-1])
if mn == 2018:
    print(0)
else:
    ans = (mn * (mn + 1)) % 2019
    print(ans)

Submission status: Wrong Answer

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

# max_loop = 2019 * 2 + 1
max_loop = 10 ** 7
count = 0
a = []
for i in range(L, R + 1):
    print(i)
    if count > max_loop:
        break
    a.append(i % 2019)
    count += 1

# print(a)
mn = min(a[:-1])
if mn == 2018:
    print(0)
else:
    ans = (mn * (mn + 1)) % 2019
    print(ans)

Submission status: Wrong Answer

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

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

# print(a)
mn = min(a[:-1])
if mn == 2018:
    print(0)
else:
    ans = (mn * (mn + 1)) % 2019
    print(ans)

Submission status: Wrong Answer

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

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

# print(a)
mn = min(a[:-1])
ans = (mn * (mn + 1)) % 2019
print(ans)

Submission status: Wrong Answer

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

max_loop = 2019 * 2 + 1
count = 0
st = set()
for i in range(L, R + 1):
    if count > max_loop:
        break
    st.add(i % 2019)
    count += 1

a = sorted(list(st))
# print(a)
ans = (a[0] * a[1]) % 2019
print(ans)

Submission status: Wrong Answer

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


# max_loop = 2019 * 2 + 1
max_loop = 2019 * 10
count = 0
a = []
for i in range(L, R + 1):
    if count > max_loop:
        break
    a.append(i % 2019)
    count += 1

a.sort()
ans = (a[0] * a[1]) % 2019
print(ans)

Submission status: Wrong Answer

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


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

a.sort()
ans = (a[0] * a[1]) % 2019
print(ans)

Submission status: Wrong Answer

Solution code:
a=input().split(" ")
L=int(a[0])
R=int(a[1])
if R-L>=672:
    print(0)
else:
    list=[]
    for p in range(0,R-L):
        for q in range(p+1,R-L+1):
            list.append(((L+p)*(L+q-p))%2019)
    print(min(list))

Submission status: Wrong Answer

Solution code:
a=input().split(" ")
L=int(a[0])
R=int(a[1])
if R-L>=672 or L%673>R%673:
    print(0)
else:
    print((L%2019)*(L%2019+1))

Submission status: Wrong Answer

Solution code:
a=input().split(" ")
L=int(a[0])
R=int(a[1])
if R-L>=2018 or L%2019>R%2019:
    print(0)
else:
    print((L%2019)*(L%2019+1))

Submission status: Wrong Answer

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

def _resolve():
    counter = 0
    res = 1

    for i in range(0, MOD):
        for j in range(ldiv, rdiv + 1):
            a = j * MOD + i
            if l <= a <= r:
                res *= i
                counter += 1
                if counter > 1:
                    return res % MOD

print(int(_resolve()))

Submission status: Wrong Answer

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

queue = []

for i in range(0, MOD):
    counter = 0
    for j in range(ldiv, rdiv + 1):
        if l <= j * MOD + i <= r:
            counter += 1
    if counter > 0:
        queue.append((i, counter))

res = 1
choosed = 0
for a in queue:
    c = a[1]
    while c > 0 and choosed < 2:
        res *= a[0]
        choosed += 1
        c -= 1
    if choosed > 2:
        break

print(int(res % MOD))

Submission status: Wrong Answer

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

from heapq import heappop, heappush
queue = []

for i in range(MOD - 1, -1, -1):
    counter = 0
    for j in range(ldiv, rdiv + 1):
        if l <= j * MOD + i <= r:
            counter += 1
    if counter > 0:
        heappush(queue, (i, counter))

res = 1
choosed = 0
while choosed < 2:
    a = heappop(queue)
    res *= a[0]
    choosed += 1
    c = a[1] - 1
    if c > 0:
        heappush(queue, (a[0], c))

print(int(res % MOD))

Submission status: Wrong Answer

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

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

min_num = 2019

for i in range(l, r+1):
    for j in range(l+1, r+1):
        if i >= j:
            continue
        if (i%2019) * (j%2019) <= min_num:
            min_num = (i%2019) * (j%2019)

print(min_num)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
ans = 2019
if R-L<673:
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = i*j%2019
            ans = min(ans,tmp)

print (ans)

Submission status: Wrong Answer

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

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

print((min_num_2 * min_num)%2019)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
min_num = 2019
min_num_2 = 2019
for i in range(l, r+1):
    if i % 2019 <= min_num:
        min_num = i % 2019
        continue
    if i % 2019 <=  min_num_2:
        min_num_2 = i % 2019

print(min_num_2 * min_num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
small1 = L % 2019
small2 = R % 2019
for i in range(L, R+1):
    ans = i % 2019
    if  ans < small1:
        small2 = small1
        small1 = ans
    elif ans < small2:
        small2 = ans
    if small1 == 0:
        break
print(small1 * small2)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
small1 = 2018
small2 = 2018
for i in range(L, R+1):
    ans = i % 2019
    if  ans < small1:
        small2 = small1
        small1 = ans
    elif ans < small2:
        small2 = ans
    if small1 == 0:
        break
print(small1 * small2)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
small1 = 2018
small2 = 2018
for i in range(L, R+1):
    ans = i % 2019
    if  ans < small1:
        small2 = small1
        small1 = ans
    elif ans < small2:
        small2 = ans
    elif ans == 0:
        small1 = 0
        break
print(small1 * small2)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
small1 = 2018
small2 = 2018
for i in range(L, R+1):
    ans = i % 2019
    if  ans < small1:
        small2 = small1
        small1 = ans
    elif ans < small2:
        if small2 > small1:
            small2 = ans
        else:
            small2 = small1
            small1 = ans
    elif ans == 0:
        break
print(small1 * small2)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
small1 = 2018
small2 = 2018
for i in range(L, R+1):
    ans = i % 2019
    if  ans < small1:
        small1 = ans
    elif ans < small2:
        if small2 > small1:
            small2 = ans
        else:
            small2 = small1
            small1 = ans
    elif ans == 0:
        break
print(small1 * small2)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
small1 = 2018
small2 = 2018
for i in range(L, R+1):
    ans = i % 2019
    if  ans < small1:
        small1 = ans
    elif ans < small2:
        if small2 > small1:
            small2 = ans
        else:
            small2 = small1
            small1 = ans
print(small1 * small2)

Submission status: Wrong Answer

Solution code:
s = input().split() #s_1 s_2を分割して取得し、sに値を入れる
print(s) #出力：['s_1', 's_2']
print(s[0]) #出力：s_1
print(s[1]) #出力：s_2

a = int(s[0])
b = int(s[1])
m = 2019

for i in range(a,b+1):
    for j in range(i+1,b+1):
        m = min((i*j)%2019 ,m)
        if m == 0: 
            break
    if m == 0:
        break

print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(4040):
    if l+i>r:
        break
    if l+i%2019<mi_1:
        mi_2=mi_1
        mi_1=l+i%2019
    elif l+i%2019<mi_2:
        mi_2=l+1%2019
print((mi_1*mi_2)%2019)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
l%=2019
r%=2019
ma=max(l,r)
mi=min(l,r)
minimum=100000000
for i in range(mi,ma+1):
    for j in range(i+1,ma+1):
        minimum=min(minimum,(i*j)%2019)
print(minimum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

minMod = L % 2019
for i in range(L, min(L+10000, R+1)):
    minMod = min(i % 2019, minMod)

print(minMod % 2019 * (minMod + 1) % 2019);

Submission status: Wrong Answer

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

minMods = []
minMod = L % 2019
for i in range(L, min(L+10000, R+1)):
    minMods.append(i % 2019)

minMods.sort()
print(minMods[0] * minMods[1]);

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ll = l % mod
rr = r % mod

if rr < ll:
    print(0)
else:
    print(ll*(ll+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ri=lambda:map(int,input().split(' '))

l,r=ri()
l%=2019
r%=2019
if l>r:
  print(0)
else:
  best = 2020
  for x in range(l,r+1):
    for y in range(l,r+1):
      if x!=y:
        cur = (x*y)%2019
        best=min(best,cur)
  print(best)

Submission status: Wrong Answer

Solution code:
ri=lambda:map(int,input().split(' '))

l,r=ri()
l%=2019
r%=2019
if l>r:
  print(0)
else:
  best = 2020
  for x in range(l,r):
    best = min(best, (x*(x+1))%2019)
  print(best)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
a = []
b = []
flag = False
if R - L >= 2019:
    print(0)
else:
    for i in range(L,R):
        for j in range(i+1, R+1):
            mod = (i*j)%2019
            if mod != 1:
                 a.append(mod)
            else:
                flag = True
                break
        if flag:
            break
        else:
            b.append(min(a))
    if flag:
        print(1)
    else:
        print(min(b))

Submission status: Wrong Answer

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

m = sorted(list(set([i%mod for i in range(l,r+1)])))
a = m[0]*m[1]

if 3 in m and 673 in m:
    print(0)
elif a < 2019:
    print(a)
else:
    print(a%mod)

Submission status: Wrong Answer

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

m = sorted([i%mod for i in range(l,r+1)])
a = m[0]*m[1]

if  a< mod:
    print(a)
else:
    print(a%mod)

Submission status: Wrong Answer

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

m = sorted([i%mod for i in range(l,r+1)])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l, r = map(int, input().split())
if r - l >= 2020:
	print(0)
else:
	ans = 2010
	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:
ri=lambda:map(int,input().split(' '))
l,r=ri()
l%=2019
r%=2019
if l>r:
  print(0)
else:
  print(l*(l+1))

Submission status: Wrong Answer

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

def han(L,R,N):
    p=0
    if (R-L)/N>=1 or R%N==0 or L%N==0:
        p=1
    return p
ans=0
n1=han(L,R,2019)
n2=han(L,R,3)
n3=han(L,R,673)
if n1==1:
    ans=0
elif (n2+n3)==2:
    ans=0
else:
    nu1=L%2019
    nu2=(L+1)%2019
    ans=(nu1*nu2)%2019
print(ans)

Submission status: Wrong Answer

Solution code:

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

L_mod = L % 2019
R_mod = R % 2019

L_waru = L // 2019
R_waru = R // 2019

#両方同じ商のとき
if L_waru == R_waru :
    print( (L * (L + 1) % 2019 ))
#商が違うときは割り切れる数が間にある
else:
    print(0)

Submission status: Wrong Answer

Solution code:

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

L_mod = L % 2019
R_mod = R % 2019

L_waru = L // 2019
R_waru = R // 2019

#両方同じ商のとき
if L_waru == R_waru :
    print( ((L_mod) * (L_mod + 1) % 2019 ))
else:
    print(0)

Submission status: Wrong Answer

Solution code:

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

L_mod = L % 2019
R_mod = R % 2019

L_waru = L // 2019
R_waru = R // 2019

#両方同じ商のとき
if L_waru == R_waru :
    print( (L_mod) * (L_mod + 1))
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

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

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

Submission status: Wrong Answer

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

if R - L > 2019:
    print(0)
else:
    mod = [i % 2019 for i in range(L, R + 1)]
    m1, m2 = sorted(mod)[:2]
    print((m1 * m2) % 2019)

Submission status: Wrong Answer

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

if R - L >= 2019:
    print(0)
else:
    mod = [i % 2019 for i in range(L, R + 1)]
    m1, m2 = sorted(mod)[:2]
    print((m1 * m2) % 2019)

Submission status: Wrong Answer

Solution code:
##C
l,r=map(int,input().split())
c=(r-l)
d=2018
if c>=2018:
    print(0)
else:
    for i in range(l,r-1):
        for k in range(l+1,r):
            
            if (i*k)%2019<d:
                d=(i*k)%2019
    print(d)

Submission status: Wrong Answer

Solution code:
##C
l,r=map(int,input().split())
c=(r-l)
d=2018
if c>=2018:
    print(0)
else:
    for i in range(l,r-1):
        for k in range(l+1,r):
            
            if (i*k)%2019<d:
                d=(i*k)&2019
            
    print(d)

Submission status: Wrong Answer

Solution code:
def main():
    L, R = map(int, input().split())
    if R - L >= 2019:
        print(0)
    else:
        left_rest = L % 2019
        right_rest = R % 2019
        start = min(left_rest, right_rest)
        last = max(left_rest, right_rest)
        rest_list = list(range(start, last+1))

        ans = 100000
        for i in range(len(rest_list)-1):
            ans = min(
                ans,
                (rest_list[i] * rest_list[i+1]) % 2019
            )
        ans = min(
            ans,
            (rest_list[-1] * rest_list[0]) % 2019
        )
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

l_q, l_mod = divmod(l, 2019)
r_q, r_mod = divmod(r, 2019)

if l_q == r_q:
    mul = l_mod * (l_mod + 1)
else:
    mul = 0

print(mul % 2019)

Submission status: Wrong Answer

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

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

l_q, l_mod = divmod(l, 2019)
r_q, r_mod = divmod(r, 2019)

if l_q == r_q:
    mul = l_mod * (l_mod + 1)
else:
    mul = 0

print(mul)

Submission status: Wrong Answer

Solution code:
from heapq import nsmallest as hp
import sys
l,r = map(int,input().split())
tmp = []
if r-l < 2018:
  for i in range(l,r+1):
    tmp.append(i%2019)
else:
  print('0')
  sys.exit()

tmp = hp(2,tmp)
  
print(tmp[0]*tmp[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

tmp = 2020
if r-l < 2018:
  for i in range(l,r+1):
    if i%2019 < tmp:
      tmp = i%2019
else:
  tmp = 0
print(tmp*(tmp+1))

Submission status: Wrong Answer

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

l = l%2019
r = r%2019 + 2019

for n in range(l,r+1):
    for m in range(n+1,r+1):
        tmp = n*m%2019
        if tmp == 0:
            print(0)
            exit()
        ans.append(tmp)
print(min(ans))