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:
import math
l, r = map(int, input().split())

flag = False
if l % 2019 == 0 or r // 2019 - l // 2019 != 0:
    flag = True

if flag:
    print(0)
else:
    lmod = l % 2019
    rmod = r % 2019
    root = math.sqrt(2019)

    n1, n2 = math.inf, math.inf
    p = lmod // 45
    q = rmod // 44
    for m in range(p, q+1):
        for i in range(lmod, rmod+1):
            if i - m * root > 0 and i - m * root < n1:
                tmp = n1
                n1 = i
                n2 = tmp
            elif i - m * root > 0 and i - m * root < n2:
                n2 = i

    print((n1 * n2) % 2019)

    # lmod = l % 2019
    # print((lmod * (lmod + 1)) % 2019)

Submission status: Runtime Error

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

listX = []
sw = 0
for i in range(99050):
  listX.append(i*2019)

for n in range(len(listX)):
  if L < listX[n] and R > listX[n]:
    sw += 1

if sw > 0:
  print(0)

else:      
  L_1 = L % 2019
  R_1 = R % 2019
  
  idx1 = 0
  listA = []
  for idx1 in range(L_1, R_1):
    idx2 = idx1 + 1
    for idx2 in range(idx1 + 1, R_1 + 1):
      listA.append(idx1 * idx2)
 
  print(min(listA))

Submission status: Runtime Error

Solution code:
input_arr = [int(x) for x in input().split()]
 
L = input_arr[0]
R = input_arr[1]
 
min_ans = 10**18
for i in range(L,R):
    for j in range(i+1,R+1):
      	ans = (i*j)%2019
        if ans < min_ans:
            min_ans = ans
        if min_ans == 0:
          break
print(min_ans)

Submission status: Runtime Error

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

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


a_min = ((l**2) // 2019)
a_max = ((r**2) // 2019 + 1)

#print(a_min, a_max)

x = 2019

for n in range(2019):
    for a in range(a_min, a_max):
        result = a * 2019 + n

        for j in range(l, l + (r - l + 1) // 2 + 1):
            amari = result / j
            if l <= amari <= r:
                if amari.is_integer() and int(amari) != j:
                    x = n
                    break
    
    if x != 2019:
        break

print(n)

Submission status: Runtime Error

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

flag = False
if l % 2019 == 0 or r // 2019 - l // 2019 != 0:
    flag = True

if flag:
    print(0)
else:
    lmod = l % 2019
    rmod = r % 2019
    root = math.sqrt(2019)

    n1, n2 = math.inf, math.inf
    p = lmod // root
    q = rmod // root + 1
    for m in range(p, q+1):
        for i in range(lmod, rmod+1):
            if i - m * root > 0 and i - m * root < n1:
                tmp = n1
                n1 = i
                n2 = tmp
            elif i - m * root > 0 and i - m * root < n2:
                n2 = i

    print((n1 * n2) % 2019)

    # lmod = l % 2019
    # print((lmod * (lmod + 1)) % 2019)

Submission status: Runtime Error

Solution code:
import itertools

def ij(m):
    return m[0] < m[1]

def main():
    (l, r) = list(map(int, input().split()))

    min = 2018
    for (i, j) in filter(ij, itertools.product(range(l, r + 1), range(l, r + 1))):
        mod = i * j % 2019
        if mod <= min:
            min = mod

    print(min)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
L,R = map(int, input().split())
for i in range(L,R+1):
    i % 2019 ＃あまりを出してリストに入れる
    ＃リストをソート
    ＃最小値から２つをかけて出力

Submission status: Runtime Error

Solution code:
import numpy as np
L, R = map(int, input().split(" "))
arr = np.array(np.arange(L, R+1))
mod_list = []
min_mod_list = []
if (0 in (arr % 2019)) or (0 in arr):
  print(0)
else:
  for i in arr:
    
    for j in arr[arr != i]:
      mod_list.append(((i * j) % 2019))
    
    min_mod_list.append(min(mod_list))
    del mod_list
    mod_list = []
  
  
  print(min(min_mod_list))

Submission status: Runtime Error

Solution code:
input_arr = [int(x) for x in input().split()]
 
L = input_arr[0]
R = input_arr[1]
 
min_ans = 10**18
for i in range(L,R):
    for j in range(i+1,R+1):
        if (i*j)%2019 < min_ans:
            min_ans = ans
print(min_ans)

Submission status: Runtime Error

Solution code:
l,r=map(int,raw_input().split())
if l<2019 and r<2019:
  print(((i%2019)*(j%2019))%2019)
else:
  if (r-l)>=2019:
    print('0')
  else:
  	print(((l%2019)*((l+1)%2019))%2019)

Submission status: Runtime Error

Solution code:
import itertools

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

a = list(range(L,R))

def moduloMultiplication(a, b, mod): 
  
    res = 0;
    a = a % mod; 
  
    while (b): 
        if (b & 1): 
            res = (res + a) % mod; 
        a = (2 * a) % mod; 
  
        b >>= 1;
      
    return res; 

pairs = [(a[i], a[j+i+1]) for i in range(len(a)) for j in range(len(a[i+1:]))]

print(min([moduloMultiplication(p[0], p[1], 2019) for p in pairs]))

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
a=list(range(l,r+1))
b=[]
for i in range(r+1-l):
  b.append(a[i]%2019)
  
c=sorted(enumerate(b), key=lambda x: x[1])
print(int(a[c[0][0]])*int(a[c[1][0]]))

Submission status: Runtime Error

Solution code:
import itertools
L, R = map(int, input().split())
 
remainder_list = []
for N in range(L, R+1):
  remainder_list.append(N%2019)

for i, j in list(itertools.combinations(remainder_list, 2)):
  all_list.append((i*j)%2019)
  
print(min(all_list))

Submission status: Runtime Error

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

mod = 2019
for i in range(100):
  if L <= (3**i)%(1e9+7) <= R or L <= (673**i)%(1e9+7) <= R or L <= (3*673*i)%(1e9+7) <= R or L <= (3*i)%(1e9+7) <= R or L <= (673*i)%(1e9+7) <= R or L <= ((3*673)**i)%(1e9+7) <= R:
    print(0)
    exit()
else:
  print(min((L*(L+1))%mod, R*(R-1)%mod, R*L%mod))

Submission status: Runtime Error

Solution code:
import itertools

n = list(map(int,input().split()))

answer = 2019

mylist = []
for i in range(n[1]-n[0]+1):
    mylist.append(n[0]+i)

#list(itertools.combinations(mylist,2))

#if(((n[0]*(n[0]+1))<2019) and (((n[1]-1)*n[1])< 2019)):
 #   print(n[0]*(n[0]+1))
  #  sys.exit()

for element in itertools.combinations(mylist,2):
    mod = (element[0] * element[1]) % 2019
    if(mod < answer):
	answer = mod

print(answer)

Submission status: Runtime Error

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

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


a_min = ((l**2) // 2019)
a_max = ((r**2) // 2019 + 1)

#print(a_min, a_max)

x = 2019

for n in range(2019):
    for a in range(a_min, a_max):
        result = a * 2019 + n

        for j in range(l, r):
            amari = result / j
            if l <= amari <= r:
                if amari.is_integer() and int(amari) != j:
                    x = n
                    break
    
    if x != 2019:
        break

print(n)

Submission status: Runtime Error

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

ret = 2019

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

Submission status: Runtime Error

Solution code:
import numpy as np
L, R = map(int, input().split(" "))
arr = np.array(np.arange(L, R+1))
mod_list = []
min_mod_list = []
if (0 in (arr % 2019)) or (0 in arr):
  print(0)
else:
  for i in arr:
    
    for j in arr[arr != i]:
      mod_list.append(((i * j) % 2019))
    
    min_mod_list.append(min(mod_list))
    mod_list = []
  
  
  print(min(min_mod_list))

Submission status: Runtime Error

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

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


a_min = ((l**2) // 2019)
a_max = ((r**2) // 2019 + 1)

print(a_min, a_max)

x = 2019

for n in range(2019):
    for a in range(a_min, a_max):
        result = a * 2019 + n

        for j in range(l, r):
            amari = result / j
            if l <= amari <= r:
                if amari.is_integer() and int(amari) != j:
                    x = n
                    break
    
    if x != 2019:
        break

print(n)

Submission status: Runtime Error

Solution code:
import itertools
l,r = map(int, input().split())
a = (l-1)//2019
b = r//2019
x = [0]*(r-l+1)
if b-a>0:
    print(0)
else:
    for i in range(r-l+1):
        x[i] = (l+i)%2019
    y = list(itertools.combinations(x, 2)) 
    z = [0]*len(y)
    for j in range(len(y)):
        z[j] = (y[j][0]*y[j][1])%2019
    print(min(z))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

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

if R-L >= 2019:
    print(0)
else:
    tmp = np.array(range(L, R+1))
    tmp = tmp % 2019
    tmp = np.sort(tmp)

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

Submission status: Runtime Error

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

mod = 2019
for i in range(500):
  if L <= 3**i%(1e9+7) <= R or L <= 673**i%(1e9+7) <= R or L <= 3*673*i%(1e9+7) <= R or L <= 3*i%(1e9+7) <= R or L <= 673*i%(1e9+7) <= R or L <= 3*673**i%(1e9+7) <= R:
    print(0)
    exit()
else:
  print(min((L*(L+1))%mod, R*(R-1)%mod, R*L%mod))

Submission status: Runtime Error

Solution code:
import itertools
import sys

n = list(map(int,input().split()))

answer = 2019

mylist = []
for i in range(n[1]-n[0]+1):
    mylist.append(n[0]+i)

#list(itertools.combinations(mylist,2))

if(((n[0]*(n[0]+1))<2019) and (((n[1]-1)*n[1])< 2019)):
    print(n[0]*(n[0]+1))
    sys.exit()

for element in itertools.combinations(mylist,2):
    mod = (element[0] * element[1]) % 2019
    if(mod < answer):
	answer = mod

print(answer)

Submission status: Runtime Error

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

if l >= r or l == 0 or r == 0　or (R - L) >= 2019:
    ans = 0
else:
    for i in range(l, r):
        for j in range(l + 1, r + 1):
            if j <= i:
                continue
            else:
                ans = min(ans, i * j % MOD)

print(ans)

Submission status: Runtime Error

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

mod = 2019
for i in range(1000):
  if L <= 3**i%(1e9+7) <= R or L <= 673**i%(1e9+7) <= R or L <= 3*673*i%(1e9+7) <= R or L <= 3*i%(1e9+7) <= R or L <= 673*i%(1e9+7) <= R or L <= 3*673**i%(1e9+7) <= R:
    print(0)
    exit()
else:
  print(min((L*(L+1))%mod, R*(R-1)%mod, R*L%mod))

Submission status: Runtime Error

Solution code:
import itertools
l,r = map(int, input().split())
a = (l-1)//2019
b = r//2019
x = [0]*(r-l+1)
if b-a>0:
    print(0)
else:
    for i in range(r-l+1):
        x[i] = (l+i)%2019
    y = list(itertools.combinations(x, 2)) 
    z = [0]*len(y)
    for j in range(len(y)):
        z[j] = y[j][0]*y[j][1]
    print(min(z))

Submission status: Runtime Error

Solution code:
import numpy as np
L, R = map(int, input().split(" "))
arr = np.array(np.arange(L, R+1))
mod_list = []

if (0 in (arr % 2019)) or (0 in arr):
  print(0)
else:
  for i in arr:
    for j in arr[arr != i]:
      mod_list.append(((i * j) % 2019))
      
  print(min(mod_list))

Submission status: Runtime Error

Solution code:
import numpy as np


l, r = map(int, input().split())
#if l <= 2019 <= r:
#    print(0)
#    exit()
#elif r*(r-1) <= 2019:
#    print(l*(l+1))
#    exit()

lr = np.arange(l,r+1)
lr = np.reshape(lr, (1,len(lr)))
lr_t = lr.T
mod = (lr*lr_t)%2019
mod = np.triu(mod, k=1)
mod = mod[np.triu_indices(len(mod),k=1)]
print(mod.min())

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
x = x % 2019
y = y % 2019
min = 2019
n = y-x
i=0
while(i<n):
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
j=0
while(j<n):
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif min2 > g and g != min:
    min2 =g

if min != 0:
  z = (min*min2)%2019
  print(z)

Submission status: Runtime Error

Solution code:
import numpy as np
L, R = (int(i) for i in input().split())

array = np.array([[i for i in range(L, R)]])

array_2d = np.dot(array.T, array)
for i in range(len(array_2d[0])):
   array_2d[i][i] = 2019 - 1
(array_2d % 2019).min()

Submission status: Runtime Error

Solution code:
from math import sqrt, inf

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

flag = False
if l % 2019 == 0 or r // 2019 - l // 2019 != 0:
    flag = True

if flag:
    print(0)
else:
#     lmod = l % 2019
#     rmod = r % 2019
#     root = sqrt(2019)

#     n1, n2 = inf, inf
#     p = lmod // root
#     q = rmod // root + 1
#     for m in range(p, q+1):
#         for i in range(lmod, rmod+1):
#             if i - m * root > 0 and i - m * root < n1:
#                 tmp = n1
#                 n1 = i
#                 n2 = tmp
#             elif i - m * root > 0 and i - m * root < n2:
#                 n2 = i

#     print((n1 * n2) % 2019)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

array = np.array([[i for i in range(L, R)]])

array_2d = np.dot(array.T, array)
for i in range(len(array_2d[0])):
   array_2d[i][i] = 2019 - 1
(array_2d % 2019).min()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

lst = range(L,R+1)

lst2 = list(itertools.combinations(lst,2))

result = []
tmp1 = 0
tmp2 = 10000000000

for i in lst2:
    tmp1 = i[0]*i[1] % 2019
    if tmp2 > tmp1:
        result.append(tmp1)
        tmp2 = tmp1

print(min(result))

Submission status: Runtime Error

Solution code:
mod = 2019
for i in range(100):
  if L <= 3**i <= R or L <= 673**i <= R or L <= 3*673*i <= R or L <= 3*i <= R or L <= 673*i <= R or L <= 3*673**i <= R:
    print(0)
    exit()
else:
  print(min((L*(L+1))%mod, R*(R-1)%mod, R*L%mod))

Submission status: Runtime Error

Solution code:
import itertools

def ij(m):
    return m[0] < m[1]

def main():
    (l, r) = list(map(int, input().split()))

    min = 2020
    for (i, j) in filter(ij, itertools.product(range(l, r + 1), range(l, r + 1))):
        mod = i * j % 2019
        if mod <= min:
            min = mod

    print(min)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
l,r = map(int,input().split())
ln = l // 2019
rn = r // 2019
if ln != rn :
    ams = 0
else :
    l = l % 2019
    r = r % 2019
    ld = min(l,abs(1010-l))
    rd = min(r,abs(1010-r))
    i = min(ld,rd)
    ans = i*(i+1)
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
l,r = map(int, input().split())
if ((l-1//2019)<(r//2019))|(((l-1//673)<(r//673))&((l-1//3)<(r//3))):
  print(0)
else:
  arr1 = np.array(range(l,r+1))
  arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
  arr = arr1*arr2%2019 + (np.identity(r-l+1)*2019)
  print(int(np.min(arr)))

Submission status: Runtime Error

Solution code:
import math
n, d= (int(c) for c in input().split())

x = []

for i in range(n): 
    x.append(input().split())

sum_ans = 0
count=0
for j in range(0,n-2):
    for k in range(j+1,n-1):
        for n in range(d):
            sum_ans = sum_ans+(x[j][n] - x[k][n]) **2
        if math.sqrt(sum_ans)%1==0:
            count=count+1
        sum_ans=0
print(sum_ans)

Submission status: Runtime Error

Solution code:
import numpy as np
L, R = list(map(int, input().split(' ')))
x = []
x.append(L % 2019)
for i in range(L+1, R+1):
    m = i % 2019
    if s == m:
        break
    x.append(m)
min_v = 2018
for i in range(0, len(x)-1):
    tmp = np.amin(np.mod([x[i]*x[j] for j in range(i+1, len(x))], 2019))
    if tmp < min_v:
        min_v = tmp

print(min_v)

Submission status: Runtime Error

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

if R-L > 2019:
    print('0')
else:
    for i in range(L, R):
        if (i % 2019) < mini:
            mini = i % 2019
            ans = i

    for j in range(L, R):
        if j == ans:
            continue
        if (j % 2019) < minib:
            minib = j % 2019
            ansb = j

    calc = ((ans%2019) * (ansb%2019)) % 2019
    print(calc)

Submission status: Runtime Error

Solution code:
L,R = map(int,input().split())
amr =[]
if R-L > 2019:
  amari = sorted([i%2019 for i in range(L,L+2019)])
  if 0 in amari:
    print(0)
  else:
    for i,j in enumerate(amari):
      for k in amari[i+1::]:
        amr.append(j*k%2019)
else:
  amari = sorted([i%2019 for i in range(L,R+1)])
  if 0 in amari:
    print(0)
  else:
    for i,j in enumerate(amari):
      for k in amari[i+1::]:
        amr.append(j*k%2019)
        
print(min(amr))

Submission status: Runtime Error

Solution code:
from math import sqrt, inf

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

flag = False
if r // 2019 - l // 2019 != 0:
    flag = True

if flag:
    print(0)
else:
    lmod = l % 2019
    rmod = r % 2019
    root = sqrt(2019)

    n1, n2 = inf, inf
    p = lmod // root
    q = rmod // root + 1
    for m in range(p, q+1):
        for i in range(lmod, rmod+1):
            if i - m * root > 0 and i - m * root < n1:
                tmp = n1
                n1 = i
                n2 = tmp
            elif i - m * root > 0 and i - m * root < n2:
                n2 = i

    print((n1 * n2) % 2019)

    # lmod = l % 2019
    # print((lmod * (lmod + 1)) % 2019)

Submission status: Runtime Error

Solution code:
import numpy

L, R = map(int, input().split())
l, r = L % 2019, R % 2019

if l > r or (R - L) >= 2019:
    print(0)
else:
    print(numpy.min([(i * j) % 2019 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())

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

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
min = 2019
n = y-x
i=0
while(i<n):
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
j=0
while(j<n):
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif min2 > g and g != min:
    min2 =g

if s != 0:
  z = (min*min2)%2019
  print(z)

Submission status: Runtime Error

Solution code:
import numpy as np
import itertools
import sys

num=list(map(int,input().split()))
poi=list(itertools.combinations((range(num[0],num[1]+1)), 2))
a=[]
if poi==[]:
    print((num[0]*num[1])%2019)
    sys.exit()

for i in range(len(poi)):
    a.append((poi[i][0]*poi[i][1])%2019)
print(min(a))

Submission status: Runtime Error

Solution code:
def main():
    L,R=map(int,input().split())
    
    min_n=L*(L+1)
    max_n=R*(R+1)
    
    else:
        flag=True
        if flag:
            for i in range(L,R+1):
                if i%2019 ==0:
                    flag=False
                    print(0)
                    
        if flag:
            print(min_n%2019)    

if __name__=="__main__":
    main()

Submission status: Runtime Error

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

vlist = []
mini = 2019
xlist = []

for x in range(gap+1):
    v = (l+x) % 2019
    vlist.append(v)

mini = min(vlist)
for x in vlist:
    if v <= mini+1:
        xlist.append(x)
        

xlist.sort()
#print(vlist)

#res = i*j % 2019
print((xlist[0]*xlist[1])%2019)

Submission status: Runtime Error

Solution code:
import sys
import numpy as np 
def minimize():
    L, R=map(int,input().split())
    lis=[]
    for i in range(L,R):
        for j in range(i+1, R+1):
            x=(i*j) %2019
            lis.append(x)
        if len(np.uniq(lis))==2018:
            break
    lis=np.array(lis)
    ans=lis.min()
    print(ans)

minimize()

Submission status: Runtime Error

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

list2019 = []
list673 = []
for i in range(1000000):
    list2019.append(2019 * i)

for i in range(3):
    list673.append(673 * i)

answer = (L * (L + 1)) % 2019
for l2019 in list2019:
    if L <= l2019 and l2019 <= R:
        answer = 0

if L <= 673 and 673 <= R and L <= 673 - 1 or l673 + 2 <= R:
    answer = 0

if L <= 1346 and 1346 <= R and L <= 1346 - 2 or l673 + 1 <= R:
    answer = 0

print(answer)

Submission status: Runtime Error

Solution code:
import numpy as np

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

minMOD = 2019

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

print(minMOD)

Submission status: Runtime Error

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

check = 0
lm = min(2020, r)
for i in range (lm):
  check = l+i
  if check % 2019 == 0:
    key = True
#print(check)
if key:
  print(0)
else:
  print((l*(l+1))%2019)

Submission status: Runtime Error

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

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

print(a)

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
min = 2019
n = y-x
i=0
while(i<n):
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
j=0
while(j<n):
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif min2 > g and g == s:
    min2 =g

if s != 0:
  z = (min*min2)%2019
  print(z)

Submission status: Runtime Error

Solution code:
inp = input().split()
l = int(inp[0])
r = int(inp[1])

int_list_pre = list(range(l,r+1))
int_list = [s%2019 for s in int_list_pre]
l = len(int_list)
min_mod = 2018

for i in range(l):
    for j in range(l):
        if j > i:
            compare = (int_list[i] * int_list[j])%2019
            if compare < min_mod:
                min_mod = compare


print(min_mod)

Submission status: Runtime Error

Solution code:
from math import sqrt, inf

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

flag = False
if r // 2019 - l // 2019 != 0:
    flag = True

if flag:
    print(0)
else:
    lmod = l % 2019
    rmod = r % 2019
    root = int(sqrt(2019))

    n1, n2 = inf, inf
    p = lmod // root
    q = rmod // root + 1
    for m in range(p, q+1):
        for i in range(lmod, rmod+1):
            if i - m * root > 0 and i - m * root < n1:
                tmp = n1
                n1 = i
                n2 = tmp
            elif i - m * root > 0 and i - m * root < n2:
                n2 = i

    print((n1 * n2) % 2019)

Submission status: Runtime Error

Solution code:
l,r = list(map(int,input().split()))
f = [0]*2020
x = []
if r-l == 1:
    print(((r%2019)*(l%2019))%2019)
    exit()
for i in range(l,r+1):
    n = i%2019
    if f[n] == 0:
        x.append(n)
        f[n] = 1
    else:
        break
x.sort()

print(min(x[0]*x[1]%2019,x[-1]*x[-2]%2019)

Submission status: Runtime Error

Solution code:
inp = input().split()
l = int(inp[0])
r = int(inp[1])

int_list_pre = list(range(l,r+1))
int_list = [s%2019 for s in int_list_pre]
print(int_list)
l = len(int_list)
min_mod = 2018

for i in range(l):
    for j in range(l):
        if j > i:
            compare = (int_list[i] * int_list[j])%2019
            if compare < min_mod:
                min_mod = compare


print(min_mod)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
l,r = map(int, input().split())
if ((l-1//2019)<(r//2019))|(((l-1//673)<(r//673))&((l-1//3)<(r//3))):
  print(0)
else:
  arr1 = np.array(range(l,r+1))
  arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
  arr = arr1*arr2%2019
  for i in range(r-l+1):
    arr[i][i] = 2019
  print(np.min(arr))

Submission status: Runtime Error

Solution code:
def get_mod(i, j):
    return (i * j) % 2019

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

    results =[]
    l = list(range(L, R+1))
    for _ in range(len(l)):
        head = l.pop(0)
        for i in l:
            result = get_mod(head, i)
            results.append(result)
    
    print(min(results))

main()

Submission status: Runtime Error

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

if L < 2019 and R > 2019:
  print(0)

else:
  L_1 = L % 2019
  R_1 = R % 2019
  
  idx1 = 0
  listA = []
  for idx1 in range(L_1, R_1):
    idx2 = idx1 + 1
    for idx2 in range(idx1 + 1, R_1 + 1):
      listA.append(idx1 * idx2)
 
  print(min(listA))

Submission status: Runtime Error

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

#f = 0
l = []

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

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

if 3 in l and 673 in l:
    print(0)
elif 3 in l:
    print(min(l),637))
elif 637 in l:
    print(min(l),3))
else:
    print(min(l))

Submission status: Runtime Error

Solution code:
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	lr := strings.Fields(nextLine())
	l, _ := strconv.Atoi(lr[0])
	r, _ := strconv.Atoi(lr[1])
	nums := []int{}
	if l < r+2019 {
		for i := l; i <= r; i++ {
			nums = append(nums, i%2019)
		}
	} else {
		for i := l; i <= l+2019; i++ {
			nums = append(nums, i%2019)
		}
	}
	sort.Ints(nums)
	fmt.Println(nums[0] * nums[1])
}

Submission status: Runtime Error

Solution code:
import numpy as np
L, R= list(map(int, input().split()))
array = np.arange(L, R+1)

div_3 = array / 3
np.mod(div_3,1,div_3)
flg_3 = np.any(div_3 == 0)

div_673 = array / 673
np.mod(div_673,1,div_673)
flg_673 = np.any(div_673 == 0)

print('{}'.format(0 if flg_3 & flg_673 else L*(L+1)%2019))

Submission status: Runtime Error

Solution code:
import numpy as np
l,r = map(int, input().split())
if (l-1//2019)<(r//2019):
  print(0)
else:
  arr1 = np.array(range(l,r+1))
  arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
  arr = arr1*arr2%2019
  for i in range(r-l+1):
    arr[i][i] = 2019
  print(np.min(arr))

Submission status: Runtime Error

Solution code:
"""
#include <stdio.h>
int main(){
  int l, r, ans=99999;
  int lst[99999];
  scanf("%d",&l);
  scanf("%d",&r);
  for(int i=l;i<r;i++){
    for(int j=i+1;j<r+1;j++){
      if(ans>(i*j)%2019){
        ans = (i*j)%2019;
        //printf("%d\n",ans);
      }
    }
  }
  printf("%d\n",ans);

}
"""
l, r = map(int, input().split())
l %= 2019
r %= 2019

lst = []

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

Submission status: Runtime Error

Solution code:
import numpy as np
import itertools

num=list(map(int,input().split()))
poi=list(itertools.combinations((range(num[0],num[1]+1)), 2))
a=[]
if poi==[]:
    print((num[0]*num[1])%2019)
    break

for i in range(len(poi)):
    a.append((poi[i][0]*poi[i][1])%2019)
print(min(a))

Submission status: Runtime Error

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

ans = []

if l > 2019:
	l %= 2019
	
if r > 2019:
	r %= 2019
	
for i in range(l,r):
	for j in range(i+1,r+1):
		rem = i*j%2019
		ans.append(rem)

print(min(ans))

Submission status: Runtime Error

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

for i in range(len(m)):
	for j in range(i+1,len(m)):
		tmp = (m[i]*m[j])%2019
		if ans> tmp:
			ans = tmp
		if tmp = 0:
			break				
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import bisect
import sys

l, r = map(int, input().split())
ls = list(range(l,r+1))

i = 1
while 2019 * i < r:
    if bisect.bisect_left(ls, 2019*i) != 0:
        print(0)
        sys.exit()
    i += 1
print((l % 2019) * ((l+1) % 2019))

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
import itertools

def main():
    (l, r) = list(map(int, input().split()))

    min = 2020
    for (i, j) in itertools.product(range(l, r + 1), range(l, r + 1)):
        if i < j:
            mod = i * j % 2019
            if mod <= min:
                min = mod

    print(min)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import numpy as np
l,r = map(int, input().split())
arr1 = np.array(range(l,r+1))
arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
arr = arr1*arr2%2019
for i in range(r-l+1):
  arr[i][i] = 2019
print(np.min(arr))

Submission status: Runtime Error

Solution code:
inp = input().split()
l = int(inp[0])
r = int(inp[1])

int_list = list(range(l,r+1))
l = len(int_list)
min_mod = 2018

for i in range(l):
    for j in range(l):
        if j > i:
            mod_1 = int_list[i]%2019
            mod_2 = int_list[j]%2019
            compare = (mod_1 * mod_2)%2019
            if compare < min_mod:
                min_mod = compare


print(min_mod)

Submission status: Runtime Error

Solution code:
import numpy as np
n, r = [int(i) for i in input().split()]
l = [i*j%2019 for i in range(n,r+1) for j in range(n,i)]
res = min(l)
print(res)

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
min1 = 2019
n = y-x
i=0
while(i<n):
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min1 > s:
    min1 = s:
minmin = 2019
j=0
while(j<n):
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif minmin > g and g == s:
    minmin =g

if s != 0:
  z = (min1*minmin)%2019
  print(z)

Submission status: Runtime Error

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

ans = []

if l > 2019:
	l %= 2019
	
if r > 2019:
	r %= 2019
	
if l+1 == r:
	print(l*r%2019)

else:
	for i in range(l,r):
		for j in range(i+1,r+1):
			rem = i*j%2019
			ans.append(rem)

	print(min(ans))

Submission status: Runtime Error

Solution code:
import numpy as np

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

# mod 2019 の答えは 0 ~ 2018 のいずれか
# それぞれのmodを取った積のmodでも同じ
np_nums = np.sort(np.mod(np.arange(L, R + 1), 2019))


def get_ans():
    # mod後の最小値コンビを十分大きな値で初期化しておく
    nums = [2019, 2020]
    for n in range(L, R + 1):
        mod = n % 2019
        # 0が来た瞬間終了
        if mod == 0:
            return 0

        # 最小値コンビの内どっちかより小さいなら置き換える
        if nums[0] > n:
            nums[0] = n
        elif nums[1] > n:
            nums[1] = n

    # ループ終わったら最小値コンビの積のmodを取る
    return (nums[0] * nums[1]) % 2019


print(get_ans())