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: Runtime Error

Solution code:
a,b=map(int,input().split())
c=[]
for i in range(a,b+1):
  for j in range(i):
    d=(i*j)%2019
    c.append(d)
print(min(d))

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
la = l % 2019
ra = r % 2019
diff = ra - la
if diff <= 0:
  diff+=2019
ans = None
for i in range(la, la+diff):
  for j in range(i+1, la+diff+1):
    mul = (i*j) % 2019
    if mul < ans:
      ans = mul
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

ans = (l*(l+1))%2019
print(error)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
L,R=map(int, sys.stdin.readline().split())
sho1=L/2019
sho2=R/2019
if 1<=sho2-sho1:
    print 0
else:
    ans=float("inf")
    for i in range(L,R):
        for j in range(i+1,R+1):
            ans=min(ans,i*j%2019)

print ans

Submission status: Runtime Error

Solution code:
# C - Remainder Minimization 2019
import numpy as np

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

a = np.arange(l, r+1)
a = a%2019
#print(a)
b = np.copy(a)
b = 2019 - b
#print(b)
c = np.minimum(a, b)
c = np.sort(c)
#print(c)

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

Submission status: Runtime Error

Solution code:
# C - Remainder Minimization 2019
import numpy as np

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

a = np.arange(l, r+1)
a = a%2019
a = np.sort(a)

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

Submission status: Runtime Error

Solution code:
# C - Remainder Minimization 2019
import numpy as np

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

a = np.arange(l, r+1)
a = a%2019
a = np.sort(a)

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

Submission status: Runtime Error

Solution code:
# C - Remainder Minimization 2019
import numpy as np

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

a = np.arange(l, r+1)
a = a%2019
np.sort(a)

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

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
MOD = 2019
# L = 2020
# R = 2040
diff = (R - L) % MOD
new_L = L % MOD
new_R = new_L + diff
# print("diff:{}, new_L:{}, new_R:{}".format(diff, new_L, new_R))

ans = L*R%MOD
for i in range(new_L, new_R):
    for j  in range(i+1, new_R+1):
        count += 1
        if ans > i*j%MOD:
            ans = i*j%MOD
print(ans)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

import numpy as np

L, R = map(int, input().split())
if (L - R) > 2020:
    print(0)
    exit()
else:
    k = np.arange(L, R + 1, dtype=np.int64)
    k = k % 2019
    k = sorted(k)
    print(k[0] * k[1])

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

import numpy as np

L, R = map(int, input().split())
if (L - R) > 2019:
    k = np.arange(L, L + 2019, dtype=np.int64)
else:
    k = np.arange(L, R + 1, dtype=np.int64)

k = k % 2019
print(k[0] * k[1])

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

import numpy as np

INF = float('inf')
NIL = - 1

L, R = map(int, input().split())
k = np.arange(L, R + 1, dtype=np.int64)
k = k % 2019
print(k[0] * k[1])

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

import numpy as np

L, R = map(int, input().split())
k = np.arange(L, R + 1, dtype=np.int64)
k = k % 2019
# print(k)
# print(sorted(k))
print(k[0] * k[1])









# def main():

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l,r = map(int,input().split())
if l%2019<=r%2019:
  print(l%2019*(l+1)%2019)
else:
  a = sorted(list(l%2019,(l+1)%2019,r%2019,(r-1)%2019))
  print(a[0]*a[1])

Submission status: Runtime Error

Solution code:
if r-l >= 2019:  # 2019の倍数がある
    ans = 0
elif r-l >= 673:  # 673の倍数,3の倍数がある
    ans = 0
elif l <= 2019 and 2019 <= r:  # 2019がある
    ans = 0
elif l <= 673 and 673 <= r and r-l >= 3:  # 673があって,3の倍数もある
    ans = 0
elif r-l >= (r % 2019):  # lとrの間に2019の倍数がある
    ans = 0
elif r-l >= (r % 673) and r-l >= 3:  # lとrの間に673の倍数があって,3の倍数もある
    ans = 0
else:
    ans = (l*(l+1)) % 2019

print(ans)

Submission status: Runtime Error

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

L_q = L // 2019
R_q = R // 2019
mod = 2018

if L_q + R_q == 0:
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            mod = min(i * j % 2019, mod)

    print(mod)

else:
    if R_q - L_q > 1:
        print(0)

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

    print(mod)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
L,r = map(int,input().split())
nums = list(range(L, r+1))
i = min(nums, key=lambda x: x%2019)
nums.remove(i)
i = i%2019
j = min(nums, key=lambda x: x%2019)
j = j%2019
print(i*j)

Submission status: Runtime Error

Solution code:
L,r = map(int,input().split())
nums = list(range(L, r+1))
i = min(nums, key=lambda x: x%2019)
nums.remove(i)
j = min(nums, key=lambda x: x%2019)
print(i*j % 2019)

Submission status: Runtime Error

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

num_list = list(range(L, R + 1))

num_list = [i % 2019 for i in num_list]
num_list.sort()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
k=min(l%2019,(r+1)%2019)
m=max(l%2019,(r+1)%2019)
a=list(range(k,m))
a.sort()
print(a[0]*a[1])

Submission status: Runtime Error

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

num_list = list(range(L, R + 1))

num_list = [i % 2019 for i in num_list]
num_list.sort()

if 3 in set(num_list) and 673 in set(num_list):
    print(0)
else:
    print(num_list[0] * num_list[1])

Submission status: Runtime Error

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

num_list = list(range(L, R + 1))

num_list = [i % 2019 for i in num_list]
num_list.sort()

if 1 in num_list and 673 in num_list:
    print(0)
else:
    print(num_list[0] * num_list[1])

Submission status: Runtime Error

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

num_list = list(range(L, R + 1))
num_list.sort()

if 1 in num_list and 673 in num_list:
    print(0)
else:
    print(num_list[0] * num_list[1])

Submission status: Runtime Error

Solution code:
x, y = map(int,input().split())
print([x, -1][x%y])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
import itertools
L,R = map(int,input().split())
if 2019 <= (R - L) + 1:
  print(0)
  exit()
  
lst = list(range(L,R+1))
md = [x * y % 2019 for x,y in itertools.combination(lst,2)]
md.sort()
print(md[0])

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
if r-l>=2019: print(0)
else:
    ans=2018
    mod_l=l%2019
    mod_r=r%2019
    for i in range(min(mod_l,mod_r),max(mod_l,mod_r)+1):
        for j in range(i+1,max(mod_l,mod_r)+1):
            mod=(i*j)%2019
            if mod<ans: ans=mod
            else: ans=ans
print(ans)

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
if r-l>=2019: print(0)
else:
    ans=2018
    mod_l=l%2019
    mod_r=r%2019
    for i in range(min(mod_l,mod_r),max(mod_l,mod_r)+1):
        for j in range(i+1,max(mod_l,mod_r)+1):
            mod=(i*j)%2019
            if mod<ans: ans=mod
            else: continue
print(ans)

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
if r-l>=2019: print(0)
else:
    ans=2018
    mod_l=l%2019
    mod_r=r%2019
    for i in range(min(mod_l,mod_r),max(mod_l,mod_r)+1):
        for j in range(i+1,max(mod_l,mod_r)+1):
            mod=(i*j)%2019
            if mod<ans: ans=mod
print(ans)

Submission status: Runtime Error

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

if r - l >= 2020:
    print(0)
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            p.append((i*j)%2019)
    print(min(p))

Submission status: Runtime Error

Solution code:
DEVISOR = 2019

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

if R // DEVISOR > L // DEVISOR:
    print(0)

L %= DEVISOR
R %= DEVISOR

print(min(i * j % DEVISOR for i in range(L, R) for j in range(i+1, R+1)))

Submission status: Runtime Error

Solution code:
DEVISOR = 2019

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

if R // DEVISOR > L // DEVISOR:
    print(0)

L %= DEVISOR
R %= DEVISOR

print(min(i * j for i in range(L, R) for j in range(i+1, R+1)))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print(best)

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
N, D = map(int, input().split())
x = [list(map(int,input().split())) for i in range(N)]
tmp = 0
ans = 0
for i in range(N):
    for j in range(i + 1,N):
        for d in range(D):
            tmp += (x[i][d] - x[j][d])**2
        tmp = math.sqrt(tmp)
        if tmp.is_integer():
            ans += 1
        tmp = 0
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

mn = 4038

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

Submission status: Runtime Error

Solution code:

L,R = map(int,input().split())
if R-L >= 2019:
    print(0)
else:
    ans = []
    for i in range(L,R):
        ans.append(i*j*2019)
    print(min(ans))

Submission status: Runtime Error

Solution code:

L,R = map(int,input().split())
if R-L >= 2019:
    print(a)
else:
    ans = []
    for i in range(L,R):
        ans.append(i*j*2019)
    print(min(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
M=2019;l,r=L%M,R%M
print([min(i*j%M for i in range(l+1,r+1) for j in range(l,i)),0][R//M-L//M>0])

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
M=2019;l,r=L%M,R%M
print([min(i*j%M for i in range(l,r) for j in range(i+1,r+1)),0][R//M-L//M>0])

Submission status: Runtime Error

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

if R - L> 2019:
    print("0")
else:
    A =[]
    for i in range(L ,R):
            for j in range(L+1,R+1):
                b = i*j % 2019
                A.append(b)
ans = min(A) 
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

D.sort()
print(D[n//2] -D[n//2-1])

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
ls=[]
LS=[]
if L-R>=672 or L==0:
  print(0)
else:
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      if i>=j:
        exit()
      x=(i*j)%2019
      ls.append(x)
      X=min(ls)
    LS.append(X)
    y=min(LS)
print(y)

Submission status: Runtime Error

Solution code:

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

mini = (L * R) % 2019

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

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



print(mini)

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
l,r=L%2019,R%2019
x,y=L//2019,R//2019
if x<y:
  print(0)
else:
  ans=10**9
  for i in range(l,r):
    for j in range(i+1,r+1):
      ans=min(ans,(i*j)%2019)
print(ans)

Submission status: Runtime Error

Solution code:
from sys import maxsize
from itertools import combinations

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

min = maxsize
for i, k in combinations(range(l, r+1), 2):
    mod = i * k % 2019
    if mod < min:
        min = mod
    if mod == 0:
        break

print(min)

Submission status: Runtime Error

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

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

print(m)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
num = list(range(l, r+1))
num_map = list(map(lambda j: j % 2019, num)) 
num_map.sort()
print(num_map[0]*num_map[1])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
list=[]
if (R-L)>=2018 or L==0:
  print(0)
else:
  for i in range(L,R):
    for j in range(i+1,R+1):
      s=i*j
      m=s%2019
      list.append(m)
print(min(list))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if R - L >= 2019:
    Ans = 0
elif R_mod < L_mod:
    Ans = 0
elif R_mod > L_mod:
    for i in range(L_mod, R_mod-1):
        Ans = 2019
        Ans = min(Ans,i*(i+1) % 2019)
        
print(Ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
  import itertools
  
  L,R=map(int,input().split())
  if R<45:
    print(L*(L+1))
    exit()
  elif L<=2019 and 2019<=R:
    print(0)
    exit()
  else:
    z=range(L,R+1)
    ans=float("inf")
    for i,j in itertools.combinations(z,2):
      if (i*j)%2019==0:
        print(0)
        break
      else:
        ans=min(ans,(i*j)%2019)
    else:
      print(ans)
  
if __name__=="__main__":
  main()

Submission status: Runtime Error

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

ans=int(10000000)
for i in range(l,r):
    for j in range(j+1,r+1):
        if ans>i*j:
            ans=i*j

print(ans)

Submission status: Runtime Error

Solution code:
if r-l>=3000: print(0)
else:
    min_mod=2018
    for i in range(l,r):
        for j in range(i+1,r+1):
            min_mod = min(min_mod, (i*j)%2019)
    print(min_mod)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if r-l>=2019: print(0)
else:
    min_mod=2018
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            min_mod = min(min_mod, i*j%2019)
print(min_mod)

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
ls=[]
LS=[]
if L-R>=672 or L==0:
  print(0)
else:
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      if i>=j:
        exit()
      x=(i*j)%2019
      ls.append(x)
      X=min(ls)
    LS.append(X)
print(min(LS))

Submission status: Runtime Error

Solution code:
from math import inf

l, r = map(int, input().split())
ans = inf
for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = i * j % 2019
        ans = tmp if tmp < ans else ans
        if ans == 0:
            break

print(ans)

Submission status: Runtime Error

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

a = list(range(l, r+1))

if len(a)>2019:
    a = a[:2019]

num = 0
ans = 2019

for i in range(len(a)):
    for j in range(len(a)):
        if a[i]<a[j]:
            num = (a[i]*a[j])%2019
            ans = min(ans, num)
            if ans == 0:
                print(0)
                exit(0)

print(ans)

Submission status: Runtime Error

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

a = list(range(l, r+1))

if len(a)>2019:
    a = a[:2019]

print(a)

num = 0
ans = 2019

for i in range(len(a)):
    for j in range(len(a)):
        if a[i]<a[j]:
            num = (a[i]*a[j])%2019
            ans = min(ans, num)
            if ans == 0:
                print(0)
                exit(0)

print(ans)

Submission status: Runtime Error

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

a = list(range(l, r+1))
a_len = len(a)
if a_len>2019:
    a = a[:2019]

num = 0
ans = 2019

for i in range(a_len):
    for j in range(a_len):
        if a[i]<a[j]:
            num = (a[i]*a[j])%2019
            ans = min(ans, num)
            if ans == 0:
                print(0)
                exit(0)

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

array = sorted(list(range(l,r+1)))

ans = array[0]*array[1] % 2019
print(ans)

Submission status: Runtime Error

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

array = sorted(list(range(l,r+1)))

ans = array[0]*array[1]
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
mod = 2019
ans = 10**9 + 7
for i in range(L, min(L + mod, R)):
  for j in range(i + 1, min(i + mod, R)):
    ans = min((i * J) % mod, ans)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import itertools
L,R=map(int,input().split())
c=list(itertools.combinations(range(L,R+1),2))
_min=2018
for i in c:
  a=(i[0]*i[1])%2019
  if a<_min:
    _min=a
print(_min)

Submission status: Runtime Error

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

mi=10**10
for l in range(L,new_R+1):
    for r in range(L+1,new_R+1):
        mod = (l*r) % 2019
        if mod < mi:
            mi=mod
        if mi==0:
            print(mi)
            import sys
            sys.exit()
print(mi)

Submission status: Runtime Error

Solution code:
L, R = [int(input()) 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: Runtime Error

Solution code:
L, R = [int(input()) for i in input().split()]
diff = R - L
ans = 2 * (10 ** 9)
if diff == 1:
    print((L * (L + 1)) % 2019)
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: Runtime Error

Solution code:
L, R = [int(input()) for i in input().split()]
diff = R - L
ans = 2019
if diff == 1:
    print((L * (L + 1)) % 2019)
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: Runtime Error

Solution code:
import itertools

i,j=map(int,input().split())
l=list(range(i,j+1))
l2=list(itertools.combinations(l,2))
l3=[(i[0]*i[1])%2019 for i in l2]

print(min(l3))

Submission status: Runtime Error

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

#区間の両端を除いた数=2017より長ければ2019の倍数が含まれているので0が解
if R - L >= 2018:
  print(0)
else:
  ans = 2018 ** 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: Runtime Error

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

ans = 2020

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: Runtime Error

Solution code:
L, R = list(map(int, input().split()))
MOD = 2019
from itertools import product
ans = 2019
for i, j in product(range(L, R + 1), range(L, R + 1)):
    if i >= j:
        continue
    ans = min(ans, (i * j) % MOD)
    if ans == 0:
        break
print(ans)

Submission status: Runtime Error

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)

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])
# 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)

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: Runtime Error

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

else:
    print(0)

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
if r - l >= 2019:
    print(0)
    exit()
minn = 2*(10**9)*2
for i in range(l, r+1):
    for j in range(i+1, r+1):
        if minn > i * j % 2019:
        minn = min(minn, i * j % 2019)
print(minn)

Submission status: Runtime Error

Solution code:
import numpy as np

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

if L - R >= 2019:
    ans = 0
else:
    A = np.arange(L, R + 1)
    A = np.sort(A % 2019)
    ans = A[0] * A[1]

print(ans % 2019)