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: Time Limit Exceeded

Solution code:
from sys import stdin
 

L,R = [int(x) for x in stdin.readline().rstrip().split()]

min = 2018
for i in range(L,R+1):
    for j in range(i+1, R+1):
        i2 = i%2019
        j2 = j%2019
        if i2 > 673:
            ans = 673*(j2%3)+(i2%673)*j2
            ans = ans%2019
        elif j2 > 673:
            ans = 673*(i2%3)+(j2%673)*i2
            ans = ans%2019
        else:
            ans = (i2*j2)%2019
        
        if ans < min:
            min = ans

    
print(min)

Submission status: Time Limit Exceeded

Solution code:
L,R = map(int,input().split())
list1 = []
i = L
j = L + 1
jcount = 0
while True:
    if i < R:
        list1.append(i*j%2019)
        if j < R:
            j += 1
        else:
            jcount += 1
            j = L+1 + jcount
            i += 1
    else:
        break

if len(list1) == 0:
    print(i*j%2019)

list1.sort()
print(list1[0])

Submission status: Time Limit Exceeded

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

r1 = 2018
for i3 in range(n2 - n1):
    n4 = i3 + n1

    t1 = n2 -n4
    if t1 >= 2019:
        t1 = 2019
    for i5 in range(t1):
        n5 = i5 + n4 + 1

        if ((n4 * n5) % 2019)  < r1:
            r1 = ((n4 * n5) % 2019)

print(r1)

Submission status: Time Limit Exceeded

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
L,R = map(int,input().split())
#divisor = [2019,673,3]
x = 2019
if L-R >= 2019:
    x=0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            #x = min(x,(i%2019)*(j%2019))
            x = min(x,(i*j)%2019)

print(x)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
s = input().rstrip().split(' ')
L = int(s[0])
R = int(s[1])
cnt = (L*(L+1)) % 2019
 
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if ans < cnt:
            cnt = ans
            if cnt == 0:
        	    break
    if cnt == 0:
      break
 
print(cnt)

Submission status: Time Limit Exceeded

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

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

ans = 2 * (10**9)

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: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
from collections import defaultdict, deque
import math
from math import factorial
import re

def main():
    L, R = map(int, input().split())
    diff = (L - R) / 2019
    if L % 2019 == 0 or R % 2019 == 0 or diff >= 1:
        print(0)
        return

    min_mod = 2019
    i_mods = {i: i % 2019 for i in range(L, R+1)}
    j_mods = {j: j % 2019 for j in range(L, R+1)}
    for i in range(L, R):
        for j in range(i+1, R+1):
            mod = (i_mods[i] * j_mods[j]) % 2019
            if min_mod > mod:
                min_mod = mod
    print(min_mod)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

ans = 2018

if  R-L > 2018:
    print(0)
    
else:
    R = R % 2019
    L = L % 2019

    if L > R:
        R += 2019
        
    for i in np.arange(L, R+1):
        for j in np.arange(i+1, R+1):
            i = i % 2019
            j = j % 2019
            k = i * j % 2019
            ans = np.amin(np.array([k, ans]))
    print(ans)

Submission status: Time Limit Exceeded

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

min = 2019
diff = r-l+1

for i in range(diff):
  for j in range(diff):
    if j > i:
      total = (i+l)*(j+l)
      if total > 2019:
        mod = total % 2019
        if min > mod:
           min = mod
      else:
        if min > total:
          min = total
print(min)

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
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: Time Limit Exceeded

Solution code:
# coding: utf-8
# 133C
"""
L<=i<=j<=R
(i×j)mod 2019
0≤L<R≤2×10^9
"""

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

min2019 = 2019
for i in range(L, R):
    for j in range(R, i, -1):
        if (i * j) % 2019 < min2019:
            min2019 = (i * j) % 2019
print(min2019)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(a)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin

L, R = [int(x) for x in stdin.readline().rstrip().split()]

v_min = 2019
for i in range(L, R+1):
    if i+1 == R:
        j = i+1
        v = (i*j) % 2019
        if v <= v_min:
            v_min = v
            break
    for j in range(i+1, R+1):
        v = (i*j) % 2019
        if v <= v_min:
            v_min = v

print(v_min)

Submission status: Time Limit Exceeded

Solution code:
s=input()
#s = ("2020 2040")
#print(s) 
s = s.split(" ")
 
L = int( s[0] )
R = int( s[1] )
 
 
result =4.0e9  
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = i*j % 2019
        #print(i,j,i*j,mod)
        if result > mod:
            result = mod
 
print(result)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8

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

output = 10**8
for i in range(R-L):
    i += L
    for j in range(R-i):
        j += i+1
        #print(i, j)
        output = min(output, (i*j) % 2019)

print(output)

Submission status: Time Limit Exceeded

Solution code:
import bisect
import sys
import math


def get_iv():
    args = sys.stdin.readline()
    argv = args.split()
    iargv = [int(arg) for arg in argv]
    return iargv


def min_mod_prod(L, R):
    min_rem = 2019
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            tst = (i * j) % 2019
            if tst < min_rem:
                minij = [i, j]
                min_rem = tst
    minij.append(min_rem)
    return minij


def main():
    specs = get_iv()
    L = specs[0]
    R = specs[1]
    rv = min_mod_prod(L, R)
    #print(rv)
    print(rv[2])


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

A = []

ans = 2019

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

a = min(A)
b = max(A)

for j in range(a+1,b+1):
        for k in range(a,j):
            ans = min(ans,(j*k)%2019)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

    print(min)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
min_s = 2019
for i in range(L, R):
    for j in range(i + 1, R+1):
        ij = i * j
        m = ij % 2019
        if min_s > m:
            min_s = m
print("{}".format(min_s))

Submission status: Time Limit Exceeded

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

print(MIN)

Submission status: Time Limit Exceeded

Solution code:

S=input()

tmp=S.split()

L=int(tmp[0])
R=int(tmp[1])

result=100000000000
flag=False
for i in range(L,R+1):
    for j in range(i+1,R+1):
        if i>=j:
            flag=True
            break
        n=(i*j)%2019
        if result>n:
            result=n
            
    if(flag):
        break

print(result)

Submission status: Time Limit Exceeded

Solution code:

ans = []

tmp = input()
tmp = tmp.split(' ')
L = int(tmp[0])
R = int(tmp[1])

for i in range(L, R + 1):
    for j in range(L, R + 1):
        if not L <= i or not i < j or not j <= R:
            continue
        else:
            ans.append((i * j) % 2019)

print(min(ans))

Submission status: Time Limit Exceeded

Solution code:
import itertools
def resolve():
    l,r=map(int,input().split())
    k=min(r+1,l+4020)
    lst=list(itertools.combinations(range(l,k),2))
    print(min([(i[0]*i[1])%2019 for i in lst]))

resolve()

Submission status: Time Limit Exceeded

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

res=2019

for i in range(x, y):
	for j in range(i+1,y+1):
		res=min(res,(i*j)%2019)

print(res)

Submission status: Time Limit Exceeded

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

a = []
for i in range(l,r+1):
  p = [((i%2019)*j)%2019 for j in set([u%2019 for u in range(i+1,r+1)])]
  if len(p)>0:
    a.append(min(p))
print(min(a))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-


from sys import stdin
import math

L,R  = [int(x) for x in stdin.readline().rstrip().split()]

diff = R - L

min_val = 2019

for i in range(L,R+1):
    for j in range(i+1,R+1):
        amari = (i * j) % 2019
        if ( min_val > amari ):
            min_val = amari

print(min_val)

Submission status: Time Limit Exceeded

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

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

print(result)

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
list = []
d = 2018
for i in range(L, R+1):
    for j in range(i+1, R+1):
        mal = i * j
        a = mal % 2019
        if a < d:
            list.append(a)
        d = a
if a == 2018:
    print(2018)
else:
    print(min(list))

Submission status: Time Limit Exceeded

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

ll = l % 2019
rr = r % 2019
mini = 1e+10
for i in range(l,r+1):
  for j in range(i+1,r+1):
    mini = min(mini, (i*j) % 2019)
print(mini)

Submission status: Time Limit Exceeded

Solution code:

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

m = 2019
mod_min = m

for j in range(l,r+1,1):
    j_ = j % m
    for i in range(l,j,1):
        i_ = i % m
        i_j = (i_ * j_) % m
        
        if i_j < mod_min:
            mod_min = i_j
            
print(mod_min)

Submission status: Time Limit Exceeded

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

l = int(x)
r = int(y)

all_mod = []

for i in range(l, r, 1): # l <= i < r - 1

    for j in range(l + 1, r + 1, 1):

        p = i * j
        mod = p % 2019
        all_mod.append(mod)


print(min(all_mod))

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

if  R-L > 2019:
    print(0)
    
else:
    ans = 2018
    for i in np.arange(L, R+1):
        for j in np.arange(i+1, R+1):
            i = i % 2019
            j = j % 2019
            ans = np.amin(np.array([i * j % 2019, ans]))
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np


def main():
	L, R = [int(x) for x in input().split()]
	tmp_min = np.inf
	for i in range(L, R+1):
		for j in range(i+1, R+1):
			if (i * j) % 2019 < tmp_min:
				tmp_min = (i * j) % 2019
	print(tmp_min)

if __name__ == "__main__":
	main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    import sys
    input = sys.stdin.readline
 
    l, r = [int(i) for i in input().split()]
    
    minmod = float('inf')

    for i in range(l, r):
        for j in range(i+1, r+1):
            temp = (i*j)%2019
            if(temp < minmod):
                minmod = temp
 
            #print("i = {}, j = {}, temp = {}, minmod = {}".format(i, j, temp, minmod))
 
    print(minmod)
 
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
l,r = map(int,input().split())
mod = 2019
arr = np.array(list(set([i%mod for i in range(l,r+1)])))
ans = 10**9

for left in range(len(arr)-1):
    ans = min(min(arr[left]*arr[left+1:]%mod),ans)
    left +=1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = []
if l+1 == r:
	print(l*r%2019)

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

	print(min(ans))

Submission status: Time Limit Exceeded

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

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

ans = 2 * (10**9)

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: Time Limit Exceeded

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

mini = 1e+10
for i in range(l,r+1):
  for j in range(i+1,r+1):
    ii = i % 2019
    jj = j % 2019
    mini = min(mini, (ii*jj) % 2019)
print(mini)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

if  R-L > 2019:
    print(0)
    
else:
    ans = 2019
    for i in np.arange(L, R+1):
        for j in np.arange(i+1, R+1):
            ans = np.amin(np.array([i * j % 2019, ans]))
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
s = input().rstrip().split(' ')
L = int(s[0])
R = int(s[1])
cnt = (L*(L+1)) % 2019

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
 

L, R = [int(x) for x in stdin.readline().rstrip().split()]

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

    
print(min)

Submission status: Time Limit Exceeded

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

def gcd(m,n):
    temp=0
    while m%n!=0:
        temp=n
        n=m%n
        m=temp
    return n
def lcm(m,n):
    return m*n/gcd(m,n)


temp=[]
for j in range(L,min([L+2*2019+1,R])):
    temp.append([(j*i)%2019 for i in range(j+1,min([j+2*2019+1,R+1]))])

#print(temp)
print(min([min(e) for e in temp]))

Submission status: Time Limit Exceeded

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

min_x = 2018
for i in range(l, r+1):
    for j in range(i+1, r+1):
        x = (i*j) % 2019
        if x < min_x:
            min_x = x
print(min_x)

Submission status: Time Limit Exceeded

Solution code:
def RemainderMinimization2019():
	L, R = map(int, input().split())
	minMod = 10000
	for i in range(L, R):
		for j in range(i + 1, R + 1):
			tmp = i * j % 2019
			# print(i, j, tmp)
			if minMod > tmp:
				minMod = tmp	
	print(minMod)
RemainderMinimization2019()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def solve():
  L, R = map(int, input().split())
  ans = 2019
  for _i in range(L, R + 1):
    i = _i % 2019
    if i == 0: return 0
    v = i * (i + 1) % 2019
    for _j in range(_i + 1, R + 1):
      ans = min(ans, v)
      v += i
      v %= 2019
  return ans

print(solve())

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

r = float('inf')
for i in range(L, min(R + 1, L + 45)):
    for j in range(i + 1, R + 1):
        t = (i * j)%MOD
        if t < r:
            r = t
print(r)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8

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

output = 10**8
for i in range(R-L):
    i += L
    for j in range(R-i):
        j += i+1
        #print(i, j)
        mod = (i*j) % 2019
        if output > mod:
            output = mod
            #print("mod", mod)
        
print(output)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
from collections import defaultdict, deque
import math
from math import factorial
import re

def main():
    L, R = map(int, input().split())
    diff = (L - R) / 2019
    if L % 2019 == 0 or diff >= 1:
        print(0)
        return

    min_mod = 2019
    for i in range(L, R):
        i_mod = i % 2019
        for j in range(i+1, R+1):
            mod = (i_mod * (j % 2019)) % 2019
            if min_mod > mod:
                min_mod = mod
    print(min_mod)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

min = 2*1000000000

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

print(min)

Submission status: Time Limit Exceeded

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

ans = 2018	
if abs(l-r) == 1:
	print(l*r%2019)

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

	print(ans)

Submission status: Time Limit Exceeded

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

mods = [(i * j) % 2019 for i in range(l, r) for j in range(i + 1, r + 1)]

print(min(mods))

Submission status: Time Limit Exceeded

Solution code:
from enum import Enum
from queue import Queue
import collections
import numpy as np


import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

L,R = map(int,input().split())
min = BIG_NUM
for i in range(L,R+1):
    for j in range(i+1,R+1):
        tmp = (i*j)%2019
        if tmp < min:
            min = tmp
        if min == 0:
            break

print(min)

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
min_mod = 2019
flg=[0]*2019
flg2=[0]*2019
for i in range(L,R):
    idx=i%2019
    if flg[idx]==0:
        for j in range(i+1,R+1):
            mod  = (i*j)%2019
            if flg2[mod]==1:
                break
            flg2[mod]=1
            if min_mod > mod:
                min_mod=mod
        flg[idx]=1
print(min_mod)

Submission status: Time Limit Exceeded

Solution code:
str = input()

L, R = map(int, str.split(" "))

min = 2019

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

print(min)

Submission status: Time Limit Exceeded

Solution code:
l, r = list(map(int, input().split()))
MOD = 2019
diff = r - l
l = l%MOD
r = l + diff
ans = 2018
for i in range(l,r):
    for j in range(i+1, r+1):
        ans = min(ans, (i%MOD*j%MOD)%MOD )
      
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

L_list = []
for i in range(L, R):
    L_list.append(i)

R_list = []
for i in range(L + 1, R + 1):
    R_list.append(i)

ans = []
for l in np.array(L_list):
    ans.append((l * np.array(R_list) % 2019).min())
    
print(min(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from enum import Enum
from queue import Queue
import collections
import numpy as np


import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

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

print(min)

Submission status: Time Limit Exceeded

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

r1 = 2018
for i3 in range(n2 - n1):
    n4 = i3 + n1

    for i5 in range(n2 - n4):
        n5 = i5 + n4 + 1

        if ((n4 * n5) % 2019)  < r1:
            r1 = ((n4 * n5) % 2019)

print(r1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
l,r=map(int,input().split())
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: Time Limit Exceeded

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

mod=2018
for i in range(r-l):
    x=r-l-i
    for j in range(x):
        a=(l+j)*(r-i)
        b=a%2019
        if b<mod:
            mod=b

print(mod)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

def solve():
  md = 2019
  for i in range(l, r+1):
    for j in range(i+1, r+1):
      md = min((i * j) % 2019, md)
  return md

print(solve())

Submission status: Time Limit Exceeded

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+1)]))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

mod = 2019

ans = 2020

for left in range(l, r+1):
    lr = [(left*i)%mod for i in range(left+1, r+1)]
    if lr:
        if ans > min(lr):
            ans = min(lr)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
l,r = map(int,input().split())
mod = 2019
li = list(set([i%mod for i in range(l,r+1)]))
li.sort()
ans = 10**9

for left in range(len(li)-1):
    ans = min(min(list(map(lambda x: li[left]*x%mod, li[left+1:]))),ans)
    left +=1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
l,r = [int(i) for i in input().split()]
dr = r//2019
lr = l//2019
r=r%2019
r+=2019*(dr-lr)
l=l%2019
m=10**10
for i in range(l,r):
  for j in range(i+1,r+1):
    m=min(m,(i*j)%2019)
print(m)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
min_mod = 2019
flg=[0]*2018
for i in range(L,R):
    idx=i%2019
    if flg[idx]==0:
        for j in range(i+1,R+1):
            mod  = (i*j)%2019
            if min_mod > mod:
                min_mod=mod
        flg[idx]=1
print(min_mod)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
l, r = map(int, input().split())
mod = 2019
mod_min = 2100
for i in range(l,r):
    for j in range(i+1,r+1):

        m = ((i % mod) * (j % mod)) % mod
        
        if m < mod_min:
            mod_min = m

print(mod_min)

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    l, r = map(int, input().split())
    min = 2020
    for i in range(l, r):
        res_i = i % 2019
        for j in range(i + 1, r + 1):
            res_j = j % 2019
            res = (res_i * res_j) % 2019
            if min > res:
                min = res
    print(min)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

min = 2019

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

print(min)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

min = 2020

for i in range(L, R):
    for j in range(i + 1, R + 1):
        i_ = i % 2019
        j_ = j % 2019
        mod_ij = i * j % 2019
        if min > mod_ij:
            min = mod_ij

print(min)

Submission status: Time Limit Exceeded

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

mod=2018
for i in range(r-l):
    x=r-l-i
    for j in range(x):
        a=(l+j)*(r-i)
        b=a%2019
        if b<mod:
            mod=b


print(mod)

Submission status: Time Limit Exceeded

Solution code:
left, right = map(int, input().split())

min = 2019
for i in range(left, right+1):
    for j in range(i+1, right+1):
        tmp = (i * j) % 2019
        if tmp < min:
            min = tmp

print(min)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
in_ = [int(i) for i in input().split()]
L = in_[0]
R = in_[1]
mod_min = 100000
for i in range(L, R):
    for j in range(i+1, R+1):
        mod = i * j % 2019
        if mod < mod_min:
            mod_min = mod

print(mod_min)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

dp.sort()
print(dp[0])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

from itertools import combinations

ans = 2019

for (x1, x2) in combinations(range(l, r+1), 2):
    ans = min((x1 * x2) % 2019, ans)

print(ans)

Submission status: Time Limit Exceeded

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

min_mod = 2*10**9
for i in range(l, r):
    for j in range(i+1, r+1):
        mod = i*j % 2019
        if mod < min_mod:
            min_mod = mod

print(min_mod)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

minimum=10000000000
for i in range(L,R):
    for j in range(i+1,R+1):
        candidate=(i*j)%2019
        if(minimum>candidate):
            minimum=candidate
print(minimum)

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    l, r = map(int, input().split())
    min = 2020
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = (i * j) % 2019
            if min > res:
                min = res
    print(min)

Submission status: Time Limit Exceeded

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


# なんこか入力
l,r = map(int, input().split())

answer = 9999
for j in range(l,r+1):
    for i in range(l,j):
        a = i % 2019
        b = j % 2019
        answer = min(answer,(a*b)%2019)

print(answer)