Problem:


Score : 300 points

Problem Statement

You are given two non-negative integers L and R.
We will choose two integers i and j such that L \leq i < j \leq R.
Find the minimum possible value of (i \times j) \mbox{ mod } 2019.

Constraints

All values in input are integers.

0 \leq L < R \leq 2 \times 10^9

Input

Input is given from Standard Input in the following format:

L R

Output

Print the minimum possible value of (i \times j) \mbox{ mod } 2019 when i and j are chosen under the given condition.

Sample Input 1

2020 2040

Sample Output 1

2

When (i, j) = (2020, 2021), (i \times j) \mbox{ mod } 2019  = 2.

Sample Input 2

4 5

Sample Output 2

20

We have only one choice: (i, j) = (4, 5).



Sample input:
2020 2040


Sample output:
2

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
ans = float('inf')
if r - l + 1> 2019:
    print(0)
    exit()
num = list([i%2019 for i in range(l,r+1)])

num.sort()
ans = num[0]*num[1]

print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
ans = float('inf')
if r - l + 1> 2019:
    print(0)
    exit()
num = list([i%2019 for i in range(l,r+1)])
print(list([i for i in range(l,r+1)]))
num.sort()
ans = num[0]*num[1]

print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
ans = float('inf')
if r - l > 2019:
    print(0)
    exit()
num = list([i%2019 for i in range(l,r+1)])
num.sort()
ans = num[0]*num[1]

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
YEAR = 2019  # 3 * 673
l, r = map(int, input().split())

ans = 10e8

for sr in range(l + 1, r + 1):
    for sl in range(l, sr + 1):
        ans = min(ans, sl * sr % YEAR)
        if ans == 0:
            break
    if ans == 0:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
YEAR = 2019  # 3 * 673
l, r = map(int, input().split())

ans = 10e8

for sr in range(l + 1, r + 1):
    for sl in range(l, sr + 1):
        ans = min(ans, sl * sr % YEAR)
        if ans == 0:
            break

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

YEAR = 2019  # 3 * 673
l, r = map(int, input().split())
l, r = l % YEAR, r % YEAR

if l > r:  # l>r ならば, 途中で 0を含むため ans = 0
    print(0)
    sys.exit(0)

assert l < r  # 問題文よりl =r も発生しない

sl = l
sr = l + 1

ans = 10e8
while sr <= r:
    while sl < sr:
        ans = min(ans, sl * sr % YEAR)
        sl += 1
    sr += 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if L % 2019 == 0:
    low = L // 2019
else:
    low = L // 2019 + 1
high = R // 2019
if low <= high:
    # 2019の倍数が範囲内に存在する
    print(0)
else:
    print(L*(L+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = (int(x) for x in input().split())
tmpmin = 2020
if l*r < 2018:
    print(l*(l+1))
else:
    for i in range(l, r+1):
        for j in range(l+1, r+1):
            tmp = (i*j)%2019
            if tmp < tmpmin:
                tmpmin = tmp
            if i == 2019 or j == 2019:
                tmpmin = 0
                break
    print(tmpmin)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = (int(x) for x in input().split())
tmpmin = 2019
for i in range(l, r+1):
    for j in range(l+1, r+1):
        tmp = (i*j)%2019
        if tmp < tmpmin:
            tmpmin = tmp
print(tmpmin)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

n,m = input().split()
n = int(n) % 2019
m = int(m) % 2019

min_ar = [min(n,m)%2019,(min(n,m)+1)%2019]

for i in range(n,m):
    if i % 2019 < min_ar[0]:
        min_ar[1] = min_ar[0]
        min_ar[0] = i % 2019

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

Submission status: Wrong Answer

Solution code:
#c.py


l,r = map(int,input().split())
mi = max(l%2019,(l+1)%2019) 
mii = min(l%2019,(l+1)%2019)
for x in range(l,r+1):
    
    if x %2019 > mi:
        continue
    else:
        if mi > x%2019 > mii:
            mi = x%2019
        elif mii>x%2019:
            mii = x%2019
    if mi == 0 and mii == 0:
      break
print((mi*mii)%2019)

Submission status: Wrong Answer

Solution code:
#c.py
mi = 10**10
mii = 10**10
l,r = map(int,input().split())
for x in range(l,r+1):
    if x %2019 > mi:
        continue
    else:
        if x%2019 > mii:
            mi = x%2019
        else:
            mii = x%2019
    if mi == 0 and mii == 0:
      break
print((mi*mii)%2019)

Submission status: Wrong Answer

Solution code:
#c.py
mi = 10**10
mii = 10**10
l,r = map(int,input().split())
for x in range(l,r+1):
    if x %2019 > mi:
        continue
    else:
        if x%2019 > mii:
            mi = x%2019
        else:
            mii = x%2019
print((mi*mii)%2019)

Submission status: Wrong Answer

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

if r-l >= 2019 :
  print(0)
else :
  mods = []
  for i in range(l, r+1, 1):
    mods.append(i % 2019)
  mins = heapq.nsmallest(2, mods)
  print((mins[0] * mins[1]) % 2019)

Submission status: Wrong Answer

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

if r-l >= 2019 :
  print(0)
else :
  mods = []
  for i in range(l, r+1, 1):
    mods.append(i % 2019)
  print(mods)
  mins = heapq.nsmallest(2, mods)
  print((mins[0] * mins[1]) % 2019)

Submission status: Wrong Answer

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

if l - r >= 2019 :
  print(0)
else :
  mods = []
  for i in range(l, r+1, 1):
    mods.append(i % 2019)
  mins = heapq.nsmallest(2, mods)
  print((mins[0] * mins[1]) % 2019)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
nmin = 2018
frag2 = 0
frag4 = 0
frag5 = 0
frag10 = 0
frag20 = 0
frag101 = 0
frag202 = 0
frag404 = 0
frag505 = 0
frag1010 = 0
for i in range(l, min(l+2019, r+1)):
    if(i%2019==0):
        nmin = 0
    else:
        nmin = min(nmin, i%2019)
    if(i%2019==1010):
        frag1010 = 1
    elif(i%2019==505):
        frag505 = 1
    elif(i%2019==101):
        frag101 = 1
    elif(i%2019==2):
        frag2 = 1
    elif(i%2019==4):
        frag4 = 1
    elif(i%2019==20):
        frag20 = 1
    elif(i%2019==404):
        frag404 = 1
    elif(i%2019==202):
        frag202 = 1
    elif(i%2019==10):
        frag10 = 1
    elif(i%2019==5):
        frag5 = 1
    if(nmin==0):
        break

if((frag2 == 1 and frag1010 == 1) or (frag4 == 1 and frag505 == 1) or (frag5 == 1 and frag404 == 1) or (frag10 == 1 and frag202 == 1) or (frag20 == 1 and frag101 == 1)):
    ans = 1
else:
    ans = nmin * (nmin+1) % 2019
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

inf = 2019
L, R = map(int, input().split())
ans = 2018
L = L % 2019
R = R % 2019
if L >= R:
    print(0)
    sys.exit()
for i in range(L, R):

    for j in range(i + 1, R + 1):
        tmp = int((i * j) % inf)
        ans = min(ans, tmp)
        if ans == 0:
            break
    if ans == 0:
        break

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
inf = 2019
L, R = map(int, input().split())
ans = 2018
L = L % 2019
R = R % 2019
if L >= R:
    print(0)
    sys.exit()
for i in range(L, R ):

    for j in range(i + 1, R +1):
        tmp = int((i * j) % inf)
        ans = min(ans, tmp)
        
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
inf = 2019
L, R = map(int, input().split())
ans = 2018
L = L % 2019
R = R % 2019
if L >= R:
    print(0)
    sys.exit()
for i in range(L, R - 1):

    for j in range(i + 1, R + 1):
        tmp = int((i * j) % inf)
        ans = min(ans, tmp)
        
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
inf = 2019
L, R = map(int, input().split())
ans = 2018
L = L % 2019
R = R % 2019
if L >= R:
    print(0)
    sys.exit()
for i in range(L, R):

    for j in range(i + 1, R):
        tmp = int((i * j) % inf)
        ans = min(ans, tmp)
        
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
inf = 2019
L, R = map(int, input().split())
ans = 2018
L = L % 2019
R = R % 2019
if L >= R:
    print(0)
    sys.exit()
for i in range(L, R - 1):

    for j in range(i + 1, R):
        tmp = int((i * j) % inf)
        ans = min(ans, tmp)
        
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
inf = 2019
L, R = map(int, input().split())
ans = 2018
L = L % 2019
R = R % 2019
if L >= R:
    print(0)
    sys.exit()
for i in range(L, R):
    if i > R:
      break
      
    for j in range(i + 1, R + 1):
        tmp = int((i * j) % inf)
        ans = min(ans, tmp)
        
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
inf = 2019
L, R = map(int, input().split())
ans = 2019
L = L % 2019
R = R % 2019
if L >= R:
    print(0)
    sys.exit
for i in range(L, R):
    if i > R:
      break
      
    for j in range(i + 1, R + 1):
        tmp = int((i * j) % inf)
        ans = min(ans, tmp)
        
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
inf = 2019
L, R = map(int, input().split())
ans = 2018
L = L % 2019
R = R % 2019
if L >= R:
    print(0)
    sys.exit
for i in range(L, R):
    if i > R:
      break
      
    for j in range(i + 1, R + 1):
        tmp = int((i * j) % inf)
        ans = min(ans, tmp)
        
print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin

r,l = [int(x) for x in stdin.readline().strip().split()]
print( (r+1+r+2)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
ans = 1145141919810
for i in range(L,R):
  for j in range(L,R):
    if  (i*j)%2019 < ans:
      if (i*j)%2019 == 0:
        ans = 0
        break
      else:
        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 % 2019 > r % 2019:
    print(0)
else:
    x = l % 2019
    print(x * (x + 1) % 2019)

Submission status: Wrong Answer

Solution code:
import sys
L,R=map(int,input().split())
modifyed=[]
flag=0
for i in range(L,R+1):
    modifyed.append(i%2019)
    if i%2019==0:
        print(0)
        sys.exit()
ans=[]
for m in range(len(modifyed)):
    for j in range(m+1,len(modifyed)):
        ans.append(modifyed[m]*modifyed[j]%2019)
        if modifyed[m]*modifyed[j]%2019==1:
          print(1)
          sys.exit()
print(min(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
modifyed=[]
flag=0
for i in range(L,R+1):
    modifyed.append(i%2019)
    if i%2019==0:
        flag=1
modifyed_set=set(modifyed)
modifyed_list=list(modifyed_set)
ans=[]
if flag==1:
    print(0)
else:
    for m in range(len(modifyed)):
        for j in range(m+1,len(modifyed)):
            ans.append(modifyed[m]*modifyed[j])
    print(min(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
if R-L>=673:
    print(0)
else:
    x=[]

    for i in range(L,R):
        for j in range(i+1,R+1):
            x.append((i*j)%2019)

            print(min(x))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if m-n>=2018:
  print(0)
else:
  l=[]
  for i in range(n,m+1):
    l.append(i%2019)
  t=10000
  for i in range(len(l)):
    for j in range(len(l)):
      if t>(l[i]*l[j])%2019:
        t=(l[i]*l[j])%2019
  print(t)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
 
lm = L % 2019
rm = R % 2019
 
if (R - L > 2018):
  print(0)
elif (lm == 0 or rm == 0 or lm >= rm):
  print(0)
else:
  print(min((lm * (lm + 1)) % 2019, ((rm - 1) * rm) % 2019))

Submission status: Wrong Answer

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

lm = L % 2019
rm = R % 2019

if (R - L >= 2018):
  print(0)
elif (lm == 0 or rm == 0 or lm >= rm):
  print(0)
else:
  print(min((lm * (lm + 1)) % 2019, ((rm - 1) * rm) % 2019))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int,input().split())
a=l%2019
b=r%2019
m=2018
for i in range(a,b):
    for j in range(i+1,b+1):
        if m>(i*j)%2019:
            m=(i*j)%2019
print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l=list(map(int,input().split()))
s=2017*2018
for i in range(l[0],l[1]):
    for j in range(i+1,l[1]+1):
        if (i%2019)*(j%2019)<=s:
            s=(i%2019)*(j%2019)
print(s)

Submission status: Wrong Answer

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

#if R-L > 2019:
#  print (0)
#else:
#  mod1 = L%2019
#  mod2 = R%2019
#  if mod2 < mod1:
#    print (0)
#    sys.exit()
#  else:
modmin =2019 -1
for i in range(L,R):
  for j in range(i+1,R):
    mod3 = (i*j)%2019
    if mod3 == 0:
      print(0)
      sys.exit()
    elif modmin > mod3:
      modmin = mod3

print(modmin)

Submission status: Wrong Answer

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

if R-L > 2019:
  print (0)
else:
  mod1 = L%2019
  print ("mod1", mod1)
  mod2 = R%2019
  print("mod2", mod2)
  if mod2 < mod1:
    print (0)
  else:
    modmin =2019 -1
    for i in range(L,R+1):
      for j in range(i+1,R+1):
        mod3 = (i*j)%2019
#        print (i,j,mod3)
        if mod3 == 0:
          print(0)
          sys.exit()
        elif modmin > mod3:
          modmin = mod3
    
    print(modmin)

Submission status: Wrong Answer

Solution code:
# -*- coding utf-8 -*-
L, R = map(int, input().split())

L = L % 2019
R = R % 2019 + (2019 if R >= 2019 else 0)

ans = 10000


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:
# -*- coding utf-8 -*-
L, R = map(int, input().split())

L = L % 2019
R = R % 2019 + 2019

ans = 10000


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:
# -*- coding utf-8 -*-
L, R = map(int, input().split())

L = L % 2019
R = R % 2019

ans = 10000

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
l, r = map(int, input().split())
r = r%2019
l = l%2019
result=2018
if r==l:
  print("0")
  sys.exit()
for i in range(min(l,r), max(l,r)):
  for j in range(i+1, max(l,r)+1):
    if (i*j)%2019 < result:
      result = (i*j)%2019
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
l,r=map(int,sys.stdin.readline().split())
r=min(r,l+673)
ans=2019
for i in range(l,r+1):
    for j in range(i,r+1):
        ans=min(ans,i*j&2019)
print(min)

Submission status: Wrong Answer

Solution code:
import sys
l,r=map(int,sys.stdin.readline().split())
r_m=r%2019
l_m=l%2019
min=2019
retu=range(l_m,r_m+1)

for i in range(len(retu)):

    for j in range(i+1,len(retu)):
        s=retu[i]*retu[j]%2019
        if s<min:
            min=s
print(min)

Submission status: Wrong Answer

Solution code:
import sys
l,r=map(int,sys.stdin.readline().split())
r_m=r%2019
l_m=l%2019
min=2019
retu=range(l_m,r_m+1)

for i in range(len(retu)):

    for j in range(i+1,len(retu)):
        s=retu[i]*retu[j]%2019
        print(i,j)
        if s<min:
            min=s
print(min)

Submission status: Wrong Answer

Solution code:
import sys
l,r=map(int,sys.stdin.readline().split())
r_m=r%2019
l_m=l%2019
min=2019
if r-l>2019-l_m:
    print(0)
else:
    retu=range(l_m,r_m+1)

    for i in range(len(retu)):

        for j in range(i+1,len(retu)):
            s=retu[i]*retu[j]%2019
            print(i,j)
            if s<min:
                min=s
print(min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
l,r=map(int,sys.stdin.readline().split())
r_m=r%2019
l_m=l%2019
min=2019
if r-l>2019-r_m:
    print(0)
else:
    retu=range(l_m,r_m+1)

    for i in range(len(retu)):
        for j in range(i+1,len(retu)):
            s=retu[i]*retu[j]%2019
            if s<min:
                min=s
print(min)

Submission status: Wrong Answer

Solution code:
import sys
l,r=map(int,sys.stdin.readline().split())
r_m=r%2019
l_m=l%2019
min=2019
if r-l>2019-r_m:
    print(0)
else:
    retu=range(l_m,r_m+1)

    for i in range(len(retu)):
        for j in range(i+1,len(retu)):
            s=retu[i]*retu[j]%2019
            if s<min:
                min=s
print("min=",min)

Submission status: Wrong Answer

Solution code:
import sys
l,r=map(int,sys.stdin.readline().split())
r_m=r%2019
l_m=l%2019
min=2019
if r-l>2019-r_m:
    print(0)
else:
    retu=range(l_m,r_m+1)

    for i in range(len(retu)):
        for j in range(i+1,len(retu)):
            s=retu[i]*retu[j]%2019
            print(s)
            if s<min:
                min=s
print("min=",min)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

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

n = R - L
value_list = []
for i in range(n+1):
    lsei = (L+i) // 2019
    a = (L+i) - lsei*2019
    value_list.append(a)

first_min = min(value_list)
value_list.remove(value_list[value_list.index(min(value_list))])
second_min = min(value_list)

ans = first_min * second_min
print(ans)

Submission status: Wrong Answer

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

if R * (R - 1) < 2019:
    print(L * (L + 1))
    exit()

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

print(ans)

Submission status: Wrong Answer

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

if L * (L + 1) < 2019:
    print(L * (L + 1))
    exit()

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

print(ans)

Submission status: Wrong Answer

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

min = 100000

for i in range(L,R+1):
    for j in range(i+1,R+1):
        dev = i*j
        A = dev%2019
#        print("積は{}".format(dev))
#        print("Aは{}".format(A))
        if min>A and A!=0:
            min = A
print(min)

Submission status: Wrong Answer

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

min = 1000

for i in range(R-L):
    for j in range(i+1, R-L):
        dev = i*j
        A = dev%2019
        if min>A and A!=0:
            min = A
print(min)

Submission status: Wrong Answer

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

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

ans = 10 ** 18
for i in range(L, R):
    ans = min(ans, i * (i + 1) % 2019)
    
    if ans == 0:
        break
        
print(ans)

Submission status: Wrong Answer

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

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

l = L // 2019
ll = L % 2019

r = R // 2019
rr = R % 2019

if l < r:
    r -= 1
    rr *= 2019

ans = 10000000
for i in range(ll, rr):
    ans = min(ans, (i % 2019) * ((i + 1) % 2019))
    
print(ans)

Submission status: Wrong Answer

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

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

l = L // 2019
ll = L % 2019

r = R // 2019
rr = R % 2019

if l < r and ll < rr:
    l = r

ans = 10000000
for i in range(ll, rr):
    ans = min(ans, i * (i + 1))
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# # 
# l = 2020
# r = 2040
r = min(r, l + 2019)

min = -1
for tl in range(l, r + 1):
  for tr in range(l + 1, r + 1):
    tmp = (tl * tr) % 2019
    if min == -1 or min > tmp:
      min = tmp

print(min)

Submission status: Wrong Answer

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

min = 3000
for tl in range(l, r + 1):
  for tr in range(l + 1, r + 1):
    tmp = (tl * tr) % 2019
    if min > tmp:
      min = tmp

print(min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
k1 = 2019
a = l % 2019
b = r % 2019
if r - l > 2019:
    k1 = 0

elif b < a:
    k1 = 0

else:
    #k = a * b
    k1 = a * (a+1)

print(k1)

Submission status: Wrong Answer

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

elif b < a:
    k1 = 0

else:
    k = a * b
    k1 = k % 2019

print(k1)