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())

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

print(answer)

Submission status: Wrong Answer

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

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

print(answer)

Submission status: Wrong Answer

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

if R - L == 1:
    print((L * R) % MOD)
else:
    print((L * (L + 1)) % MOD)

Submission status: Wrong Answer

Solution code:
L, R = [int(i) for i in input().split()]
R = min(R, L + 4038)
ans = 2018
for i in range(L, R):
    for j in range(i + 1, R):
        x = (i * j) % 2019
        ans = min(ans, x)
print(ans)

Submission status: Wrong Answer

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

mod=2019
ans=mod

l=L%mod
r=R%mod
if r<=l:
    ans=0
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans=min(ans,i*j%mod)
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = [int(i) for i in input().split()]
R = min(R, L + (2019 * 2))
diff = R - L
ans = 2019
if diff == 1:
    x = (L * (L + 1)) % 2019
    print(min(x, ans))
else:
    for i in range(diff):
        for j in range(i, diff):
            x = ((L + i) * (L + j)) % 2019
            ans = min(x, ans)
            if x == 0:
                break
    print(ans)

Submission status: Wrong Answer

Solution code:
L, R = [int(i) for i in input().split()]
R = min(R, L + (2019 * 2))
diff = R - L
ans = 2019
if diff == 1:
    x = (L * (L + 1)) % 2019
    print(min(x, ans))
else:
    for i in range(diff):
        for j in range(i + 1, diff):
            x = ((L + i) * (L + j)) % 2019
            ans = min(x, ans)
            if x == 0:
                break
    print(ans)

Submission status: Wrong Answer

Solution code:
L, R = [int(i) for i in input().split()]
diff = R - L
ans = 2019
if diff == 1:
    x = (L * (L + 1)) % 2019
    print(min(x, ans))
else:
    for i in range(diff):
        for j in range(i + 1, diff):
            x = ((L + i) * (L + j)) % 2019
            ans = min(x, ans)
            if x == 0:
                break
    print(ans)

Submission status: Wrong Answer

Solution code:
L, R = [int(i) for i in input().split()]
diff = R - L
ans = 2019
for i in range(1, diff + 1):
    ans = min((L * (L + i)) % 2019, ans)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

R = min(R, L+4038)

ans =  2018

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

Submission status: Wrong Answer

Solution code:
'''
*問題文*
非負整数L,Rが与えられます。
2つの整数i,jをL≤i<j≤Rを満たすように選びます。

(i×j)mod2019の最小値を求めてください。

*制約*
入力は全て整数
0≤L<R≤2×10^9

'''

'''

入力例 1 Copy
2020 2040
出力例 1
2
( i , j ) = ( 2020 , 2021 ) とすると、
( i × j ) mod 2019 = 2 となります。

(2019+1) * (2019+2)  % 2019 = 2

(2019(2019 + 1 + 2 ) + 2 )  % 2019 = 2

LR%2019

1: R <= 2019
    (i,j) = (R-1,R)
2: L <= 2019 <= R
    (i,j) = (2019,2020), (2018,2019) = 1
3: 2019 <= L
    (i,j) = 2019*

1: 2019*n < L,R < 2019*m
    (i,j) = (L,L+1)

2: 2019*(n-1) <= L <= 2019*n <= R <= 2019*(n+1)
    (i,j) = (1)

3: 2019*(k) <= L <= 2019*n <= R <= 2019*(m)
    (i,j) = 2019*n * 2019*m = 0

abs(R-L+1) > 2019で判断

2019  4038
2018  4037    - > 2019,2020


'''

L, R = map(int, input().split())
modL = L%2019
modR = R%2019
ans = 0
if L < R:
    ans = modL*(modL+1)
elif L > R:
    ans = 1
else:
    ans = 0

print(ans)

Submission status: Wrong Answer

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

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

    mods = []
    for x in range(L, R+1):
        mods.append(x % 2019)

    somods = sorted(mods)

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

main()

Submission status: Wrong Answer

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

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

    mods = []
    for x in range(L, R+1):
        mods.append(x % 2019)

    somods = sorted(mods)

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

main()

Submission status: Wrong Answer

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

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

    mods = []
    for x in range(L, R+1):
        mods.append(x % 2019)

    somods = sorted(mods)

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

main()

Submission status: Wrong Answer

Solution code:
def main():
    L, R = map(int, input().split(" "))
    if R - L >= 2019:
        # 部屋割り論法でn%2019=0なるnが存在
        print(0)
    else:
        l = []
        for i in range(L, R + 1):
            l.append(i % 2019)
        l.sort()
        print(l[0] * l[1] % 2019)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
x, y = 0, 0
m = 2018

flg = False
for i in range(l, r+1):
    if i%2019 == 0:
        x, y = 0, 0
        flg = True
        break
    elif i%2019 < m:
        m = i%2019
if flg != True:
    x, y = m, m+1

print(x*y%2019)

Submission status: Wrong Answer

Solution code:
l,r = list(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())
if r-l+(l%2019)<2019:
  print(l%2019*((l%2019)+1))
else:
  print(0)

Submission status: Wrong Answer

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

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

if r//mod != l//mod:
    print(0)
    exit()

li = []

for i in range(l,r+1):
    li.append(i%mod)
li.sort()
print(li[0]*li[1])

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split())
lst = [i%2019 for i in range(L,R+1)]
lst = set(lst)
lst = list(lst)
N = len(lst)
ans = 10*8
for i in range(N-1):
    for j in range(i+1,N):
        if ans>(lst[i]*lst[j])%2019:
            ans = (lst[i]*lst[j])%2019
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int,(input().split()))
if(R-L >= 2019):
  print("0")
else:
  pass

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 a<b or c==0:
    print(0)
else:
    print(c*(c+1))

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 a<b:
    print(0)
else:
    print(c*(c+1))

Submission status: Wrong Answer

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

A = []
k = L % 2019
for _ in range(min(R - L + 1, 2019 * 2)):
    A.append(k)
    k = (k + 1) % 2019

A.sort()
print((A[0] * A[1]) % 2019)

Submission status: Wrong Answer

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

A = []
k = L % 2019
for _ in range(min(R - L + 1, 2019)):
    A.append(k)
    k = (k + 1) % 2019

A.sort()
print((A[0] * A[1]) % 2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
ans = 10**20
if r-l>=2019:
    print(0)
elif r-l<2019:
    for i in range(l,r):
        for j in range(i,r+1):
            ans = min(ans,i*j%2019)
            if i*j%2019 == 0:
                break
print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
ans = 10**20
if r-l>=2019:
    print(0)
elif r-l<2019:
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans = min(ans,i*j%2019)
            if i*j%2019 == 0:
                break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
    print((L % 2019) * (L % 2019 + 1))

Submission status: Wrong Answer

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

lt = []
for i in range(l, r+1):
    lt.append(i%2019)
        
lt.sort()
print(lt[0]*lt[1])

Submission status: Wrong Answer

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

lt = []
for i in range(l, r+1):
    lt.append(i%2019)
        
print(lt[0]*lt[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if r - l > 2019:
    r = l + 2020

n = sorted([num%2019 for num in list(range(l, r+1))])

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

Submission status: Wrong Answer

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

if r - l > 2019:
    r = l + 2019

n = sorted([num%2019 for num in list(range(l, r+1))])

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

Submission status: Wrong Answer

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

if r-l != c2-c1:
    print(0)
    exit(0)
else:
    print((l*(l+1))%2019)

Submission status: Wrong Answer

Solution code:
l,r=map(int, open(0).read().split())
if r-l>=2019:
    print(0)
    exit()
l=l%2019
r=r%2018
a=2018
for i in range(l,r):
    for j in range(i+1,r+1):
        a=min(a,i*j%2019)
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

#区間の両端を除いた数=2017より長ければ2019の倍数が含まれているので0が解

ans = 2019 ** 2

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

Submission status: Wrong Answer

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

ans = 2019 ** 2

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

Submission status: Wrong Answer

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

#区間の両端を除いた数=2017より長ければ2019の倍数が含まれているので0が解

ans = 2019 ** 2

if R - L >= 2018:
  ans = 0
  print(ans)
else: 
  for i in range(L,R):
    for j in range(L + 1,R):
      mod = (i * j) % 2019 
      if mod < ans:
        ans = mod
      elif mod == 0:
        ans = 0
        break
  print(ans)

Submission status: Wrong Answer

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

#区間の両端を除いた数=2017より長ければ2019の倍数が含まれているので0が解

ans = 2018 ** 2

if R - L >= 2018:
  ans = 0
  print(ans)
else:
  
  for i in range(L,R):
    for j in range(L + 1,R):
      mod = (i * j) % 2019 
      if mod < ans:
        ans = mod
      elif mod == 0:
        ans = 0
        break
  print(ans)

Submission status: Wrong Answer

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

ans = 2018 * 2018

for i in range(L,R):
  l = i
  r = i + 1
  mod = (l * r) % 2019
  if mod < ans:
    ans = mod
  if mod == 0:
    ans = 0
    break
    
print(ans)

Submission status: Wrong Answer

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

##mod2019 = [0 ~ 2018]

#区間の両端を除いた数=2017より長ければ2019の倍数が含まれているので0が解
if R - L >= 2018:
  print(0)
  
else:
  #そうでなければ、区間の中に2019の倍数が含まれていれば、0が解
  nums = [i for i in range(L,R + 1)]
  for i in nums:
    if i % 2019 == 0:
      print(0)
      break
  #2019の倍数が含まれていなければ、区間の最初の2数の積が解
  else:
    l = nums[0]
    r = nums[1]
    print((l * r )% 2019)

Submission status: Wrong Answer

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

ans = 2019 * 2019

for i in range(L,R):
  l = i % 2019
  r = (i + 1) % 2019
  if l * r < ans:
    ans = l * r
  if r == 0:
    ans = 0
    break
    
print(ans)

Submission status: Wrong Answer

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

ans = 2019 * 2019

for i in range(L,R + 1):
  l = i % 2019
  r = (i + 1) % 2019
  if l * r < ans:
    ans = l * r
  if r == 0:
    ans = 0
    break
    
print(ans)

Submission status: Wrong Answer

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

##mod2019 = [0 ~ 2018]

#区間の両端を除いた数=2017より長ければ2019の倍数が含まれているので0が解
if R - L >= 2018:
  print(0)
  
else:
  #そうでなければ、区間の中に2019の倍数が含まれていれば、0が解
  nums = [i for i in range(L,R + 1)]
  for i in nums:
    if i % 2019 == 0:
      print(0)
      break
  #2019の倍数が含まれていなければ、区間の最初の2数の積が解
  else:
    l = nums[0]
    r = nums[1]
    print((l % 2019) * (r % 2019))

Submission status: Wrong Answer

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

##mod2019 = [0 ~ 2018]

#区間が2019より長ければ2019の倍数が含まれているので0が解
if R - L >= 2019:
  print(0)
  
else:
  #そうでなければ、区間の中に2019の倍数が含まれていれば、0が解
  nums = [i for i in range(L,R + 1)]
  for i in nums:
    if i % 2019 == 0:
      print(0)
      break
  #2019の倍数が含まれていなければ、区間の最初の2数の積が解
  else:
    l = nums[0]
    r = nums[1]
    print((l % 2019) * (r % 2019))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
L = L % 2019
R = R % 2019
R = R + 2019 if L >= R else R

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
L = L % 2019
R = R % 2019
R = R + 2019 if L > R else R

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
mod = set()
for i in range(min(r+1,2020)):
    mod.add(i+l % 2019)
mod = sorted(list(mod))
print(mod[0] * mod[1])

Submission status: Wrong Answer

Solution code:
MOD = 2019  # これなにげに3の倍数だからいつも見たいなMODの演算が通用しない笑
L, R = list(map(int, input().split()))

# このコーナーケースに注意
if (R - L) >= MOD:
    print(0)
    exit()

# Lをなるべく0に近づける
L %= MOD
# RをなるべくLに近づけてみる
R %= MOD
if R <= L:
    R += MOD

# print(L, R)
ans = 2 * 16
for i in range(L, R):  # i<jが成り立つ範囲に注意
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)
print(ans)

Submission status: Wrong Answer

Solution code:
MOD = 2019  # これなにげに3の倍数だからいつも見たいなMODの演算が通用しない笑
L, R = list(map(int, input().split()))

# このコーナーケースに注意
if (R - L + 1) >= MOD:
    print(0)
    exit()

# Lをなるべく0に近づける
L %= MOD
# RをなるべくLに近づけてみる
R %= MOD
if R <= L:
    R += MOD

# print(L, R)
ans = 2 * 16
for i in range(L, R + 1):  # i<jが成り立つ範囲に注意
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)
print(ans)

Submission status: Wrong Answer

Solution code:
MOD = 2019  # これなにげに3の倍数だからいつも見たいなMODの演算が通用しない笑
L, R = list(map(int, input().split()))

# このコーナーケースに注意
if (R - L + 1) >= MOD:
    print(0)
    exit()

# Lをなるべく0に近づける
L %= MOD
# RをなるべくLに近づけてみる
R %= MOD
if R <= L:
    R += MOD

# print(L, R)
ans = 2 * 16
for i in range(L, R):  # i<jが成り立つ範囲に注意
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)
print(ans)

Submission status: Wrong Answer

Solution code:
MOD = 2019  # これなにげに3の倍数だからいつも見たいなMODの演算が通用しない笑
L, R = list(map(int, input().split()))
# Lをなるべく0に近づける
L %= MOD
# RをなるべくLに近づけてみる
R %= MOD
if R <= L:
    R += MOD

ans = 2 * 16
for i in range(L, R):  # i<jが成り立つ範囲に注意
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)
print(ans)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc133/tasks/abc133_c
# MODって掛け算でも分解できなかったっけ？って気づけばO(n)となり終わり?
# いや、O(n)だと2*10**9なのでpythonだと間に合わない！
# mod 2019 の計算結果は2019ごとに繰り返すことに気がつくと一気に計算が少なくなる

MOD = 2019  # これなにげに3の倍数だからいつも見たいなMODの演算が通用しない笑
L, R = list(map(int, input().split()))
# Lをなるべく0に近づける
L %= 2019
# RをなるべくLに近づけてみる
R %= 2019
if R <= L:
    R += MOD

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

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc133/tasks/abc133_c
# MODって掛け算でも分解できなかったっけ？って気づけばO(n)となり終わり?
# いや、O(n)だと2*10**9なのでpythonだと間に合わない！
# mod 2019 の計算結果は2019ごとに繰り返すことに気がつくと一気に計算が少なくなる

MOD = 2019  # これなにげに3の倍数だからいつも見たいなMODの演算が通用しない笑
L, R = list(map(int, input().split()))
# Lをなるべく0に近づける
L %= 2019
# RをなるべくLに近づけてみる
baisuu = (R - L) // 2019
R = R - baisuu * MOD

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

Submission status: Wrong Answer

Solution code:
MOD = 2019
L, R = list(map(int, input().split()))
# RをなるべくLに近づけてみる
baisuu = (R - L) // 2019
R = R - baisuu * MOD


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

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc133/tasks/abc133_c
# MODって掛け算でも分解できなかったっけ？って気づけばO(n)となり終わり?
# いや、O(n)だと2*10**9なのでpythonだと間に合わない！
# mod 2019 の計算結果は2019ごとに繰り返すことに気がつくと一気に計算が少なくなる

MOD = 2019
L, R = list(map(int, input().split()))
# RをなるべくLに近づけてみる
baisuu = (R - L) // 2019
R = R - baisuu * MOD


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

Submission status: Wrong Answer

Solution code:
MOD = 2019
L, R = list(map(int, input().split()))
if (R - L + 1) >= MOD:
    print(0)
    exit()

baisuu = L // MOD
L = L - baisuu * MOD
R = R - baisuu * MOD

# print(L, R, baisuu)
att = []
for i in range(L, R + 1):
    att.append(i % 2019)
att.sort()
print(att[0] * att[1])

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc133/tasks/abc133_c
# MODって掛け算でも分解できなかったっけ？って気づけばO(n)となり終わり?
# いや、O(n)だと2*10**9なのでpythonだと間に合わない！
# mod 2019 の計算結果は2019ごとに繰り返すことに気がつくと一気に計算が少なくなる

MOD = 2019
L, R = list(map(int, input().split()))
if (R - L + 1) >= MOD:
    print(0)
    exit()

baisuu = L // MOD
L = L - baisuu * MOD
R = R - baisuu * MOD

# print(L, R, baisuu)
att = []
for i in range(L, R + 1):
    att.append(i % 2019)
att.sort()
print(att[0] * att[1])

Submission status: Wrong Answer

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

baisuu = L // MOD
L = L - baisuu * MOD
R = R - baisuu * MOD

# print(L, R, baisuu)
att = []
for i in range(L, R + 1):
    att.append(i % 2019)
att.sort()
print(att[0] * att[1])

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc133/tasks/abc133_c
# MODって掛け算でも分解できなかったっけ？って気づけばO(n)となり終わり?
# いや、O(n)だと2*10**9なのでpythonだと間に合わない！
# mod 2019 の計算結果は2019ごとに繰り返すことに気がつくと一気に計算が少なくなる

MOD = 2019
L, R = list(map(int, input().split()))
if (R - L) >= MOD:
    print(0)


baisuu = L // MOD
L -= baisuu * MOD
R -= baisuu * MOD

# print(L, R, baisuu)
att = []
for i in range(L, R + 1):
    att.append(i % 2019)
att.sort()
print(att[0] * att[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

else:
    print(0)

Submission status: Wrong Answer

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

else:
    print(0)

Submission status: Wrong Answer

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

else:
    print(0)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod = 2019
mini = 2019 #最大値2019
count1 = 0

for i in range(L,R):
    count2 = 0
    for j in range(i+1, R+1):
        if mini > ((i % mod) * (j % mod)):
            mini = ((i % mod) * (j % mod))
        count2 += 1
        if count2 == mod:
            break
    count1 += 1
    if count1 == mod:
        break
print(mini)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod = 2019
mini = 2019 #最大値2019
count1 = 0

for i in range(L,R):
    count2 = 0
    for j in range(i+1, R+1):
        print((i % mod) * (j % mod))
        if mini > ((i % mod) * (j % mod)):
            mini = ((i % mod) * (j % mod))
        count2 += 1
        if count2 == mod:
            break
    count1 += 1
    if count1 == mod:
        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)
if (R - L) >= 2019:
    print(0)
elif R%2019 >L%2019:
    print((L%2019)*(L+1)%2019)

else:
    print(0)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod = 2019
mini = 2019 #最大値2019
count1 = 0
count2 = 0
for i in range(L,R):
    for j in range(i+1, R+1):
        print((i % mod) * (j % mod))
        if mini > ((i % mod) * (j % mod)):
            mini = ((i % mod) * (j % mod))
        count2 += 1
        if count2 == mod:
            break
    count1 += 1
    if count1 == mod:
        break
print(mini)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod = 2019
mini = 2019 #最大値2019

for i in range(L,R):
    for j in range(i+1, R+1):
        if mini > ((i % mod) * (j % mod)):
            mini = ((i % mod) * (j % mod))

print(mini)

Submission status: Wrong Answer

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

else:
    print(0)

Submission status: Wrong Answer

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

else:
    print(0)

Submission status: Wrong Answer

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

else:
    print(0)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod = 2019
mini = 2019 #最大値2019

for i in range(L,R):
    for j in range(i+1, R+1):
        if mini > (i % mod) * (j % mod):
            mini = (i % mod) * (j % mod)

print(mini)

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:
a, b = map(int, input().split())

a = a % 2019
b = b % 2019

if b<a:
    print(0)
elif a+1 == b:
    print(a*b)
else:
    print(a*2)

Submission status: Wrong Answer

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

if int(L//2019) < int(R*L//2019):
    print(0)
else:
    print((L*(L+1))%2019)

Submission status: Wrong Answer

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

if int(L//2019) < int(R//2019):
    print(0)
else:
    print((L*(L+1))%2019)

Submission status: Wrong Answer

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

mod = 2019

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

print(min)

Submission status: Wrong Answer

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

mod = 2019

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

Submission status: Wrong Answer

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

mod = 2019

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
L,R=map(int,input().split())
l=L%2019
r=R%2019

if R-L>=2019 or l>=r:
    print(0)
else:
    print((L*(L+1))%2019)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
L,R=map(int,input().split())
l=L%2019
r=R%2019

if R-L>=2019 or l>=r:
    print(0)
else:
    print((l*(l+1))%2019)

Submission status: Wrong Answer

Solution code:
from __future__ import print_function

import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd

# def lcm(n,m):
#     return int(n*m/gcd(n,m))

# import re
# import array
# import copy
# import functools
# import operator

# import collections
# import itertools
# import bisect
# import heapq


# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace

# from queue import PriorityQueue as pq

# def reduce(p, q):
#     common = fractions.gcd(p, q)
#     return (p//common , q//common )
# # from itertools import accumulate
# # from collections import deque

# from operator import mul
# from functools import reduce

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

# import random

# def round_lower(n, m_modulo):
#     n % modulo
#     return


def crange(l,r):
    return range(l,r+1)
        
        
def main():
    l,r = map(int, input().strip().split())
    l=l % 2019
    r = (r % 2019) if (l//2019==r//2019) else 2018
    # r = 2018 if r > ((l//2018)+1)*2019 else r % 2019

    ans=sys.maxsize
    for i in crange(l,r):
        for j in crange(i+1,r):
            ans=min(ans,(i*j)%2019)
    print(ans)
        
    return

if __name__ == '__main__':
    main()