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:
l,r=map(int,input().split())
an=(l*(l+1))%2019

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

print(an)

Submission status: Time Limit Exceeded

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

for i in range(L, R):
	for j in range(i+1,R+1):
		a.append((i*j)%2019)
		if 0 in a:
			print(0)
			sys.exit()
print(min(a))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

min_value = 2019

for i in range(L, R+1):
	for j in range(L, R+1):
		if i >= j:
			continue

		value = (i * j) % 2019
		if value < min_value:
			min_value = value

print(min_value)

Submission status: Time Limit Exceeded

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

m = 2018
for l in range(L,R):
    for r in range(l+1,R+1):
        m = min(m,l*r%2019)

print(m)

Submission status: Time Limit Exceeded

Solution code:
# import atexit
# import io
import sys
#
# _INPUT_LINES = sys.stdin.read().splitlines()
# input = iter(_INPUT_LINES).__next__
# _OUTPUT_BUFFER = io.StringIO()
# sys.stdout = _OUTPUT_BUFFER
#
#
# @atexit.register
# def write():
#     sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

import math
R = lambda : map(int,input().split())
import math
ans = sys.maxsize
n,k = R()
for i in range(n,k+1):
    for j in range(i+1,k+1):
        ans = min(ans,(i*j)%2019)

print(ans)

Submission status: Time Limit Exceeded

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

print(mini)

Submission status: Time Limit Exceeded

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

print(min)

Submission status: Time Limit Exceeded

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

print(min)

Submission status: Time Limit Exceeded

Solution code:
from itertools import combinations as f
l,r=map(int,input().split())
s=set(map(lambda x:x%2019,range(l,r+1)))
print(min([i*j%2019 for i,j in f(s,2)]))

Submission status: Time Limit Exceeded

Solution code:
from itertools import combinations as f
l,r=map(int,input().split())
print(min([i*j%2019 for i,j in f(set(map(lambda x:x%2019,range(l,r+1))),2)]))

Submission status: Time Limit Exceeded

Solution code:
l,r=map(int,input().split())
m=l*r%2019
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:
def main():
    l, r = map(int, input().split())
    res = 1 << 30
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = min(res, (i * j) % 2019)
            if res == 0:
                break
    print(res)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(min(new_list))

Submission status: Time Limit Exceeded

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

new_list = []
for i in range(L,R):
    for j in range(i+1, R+1):
        k = i*j
        A = [k%2019]
        mi = min(A)
        new_list.append(mi)

print(min(new_list))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
div = 2019
min_mod = div - 1

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

Submission status: Time Limit Exceeded

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

_min = 2018
_init = L%2019

for g in range(R-L):
	plus = _init + g
	_start = (plus*(plus+1))
	if _start >= 2019:
		_start = _start%2019
	for i in range(R-L-g):
		_min = min(_min, _start)
		_start += plus
		if _start >= 2019:
			_start = _start%2019
	if g == 2019:
		break

print(_min)

Submission status: Time Limit Exceeded

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

_min = 2018
_init = L%2019

for g in range(R-L):
	plus = _init + g
	_start = (plus*(plus+1))%2019
	for i in range(R-L-g):
		_min = min(_min, _start)
		_start += plus
		_start = _start%2019
	if g == 2019:
		break

print(_min)

Submission status: Time Limit Exceeded

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

_min = 2018

for g in range(R-L):
	plus = (L+g)%2019
	_start = (plus*(plus+1))%2019
	for i in range(R-L-g):
		_min = min(_min, _start)
		_start += plus
		_start = _start%2019
	if g == 2019:
		break

print(_min)

Submission status: Time Limit Exceeded

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

_min = 2018

for g in range(R-L):
	_start = (L+g)*(L+g+1)
	for i in range(R-L-g):
		_min = min(_min, _start%2019)
		_start += L+g
	if g == 2019:
		break

print(_min)

Submission status: Time Limit Exceeded

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

M = []
for i in range(L, R+1):
  i2 = i % 2019
  for j in range(i+1, R+1):
    M.append( i2 * (j % 2019) % 2019)
if len(M) == 0:
  print(L)
elif L < 0 and R > 0:
  print (0)
else:
  print (min(M))

Submission status: Time Limit Exceeded

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

M = []
for i in range(L, R+1):
  for j in range(i+1, R+1):
    M.append((i % 2019) * (j % 2019) % 2019)
if len(M) == 0:
  print(L)
else:
  print (min(M))

Submission status: Time Limit Exceeded

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

M = []
for i in range(L, R+1):
  for j in range(i+1, R+1):
    M.append(i * j % 2019)
if len(M) == 0:
  print(L)
else:
  print (min(M))

Submission status: Time Limit Exceeded

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

if R - L >= mod:
  print(0)
else:
  s = []
  for i in range(L, R):
    for j in range(i+1, R+1):
      s.append((i*j) % mod)
    s.sort()
  print(s[0])

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
ans = 10 ** 9 + 7
if (L - R + 1) >= 2019:
    print(0)
else:
    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:
# -*- coding: utf-8 -*-
L, R = map(int, input().split())

ans = 2018
tmp = 0

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

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

result = 0

for i in range(L,R+1):
  for j in range(i+1, R+1):
    modResult = (i * j) % 2019 
    if i == L and j == L+1:
      result = modResult
    elif result > modResult:
      result = modResult

print(result)

Submission status: Time Limit Exceeded

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

min=2019
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j) % 2019
#        print(str(i)+' '+str(j)+' '+str(mod))
        if mod == 0:
            min = 0
            break
        if mod < min:
            min = mod
print(min)

Submission status: Time Limit Exceeded

Solution code:
l, r = list(map(int, input().split()))
count = 0
amari_list = []

for i in range(l, r+1):
    count_j = 0
    for j in range(i+1, r+1):
        amari_list.append(i * j % 2019)
        if count == 2019:
            break
        count_j += 1

    if count == 2019:
        break
    count += 1

ans = min(amari_list)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

#n = int(input())
l, r= [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for j in range(n)]
#table = [list(input()) for n in range(h)]
#list = [int(i) for i in input().split()]
#num = [int(i) for i in range(n)]
#s = [input() for i in range(n)]
#s = input()
#list = list(s)
#temp = [[0 for _ in range(13)] for _ in range(13)]

ans = 2019

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

print(ans)

Submission status: Time Limit Exceeded

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

print(b)

Submission status: Time Limit Exceeded

Solution code:
l, r = map(int, input().split())
mi = 2*10e9
for i in range(l, r+1):
    for j in range(i+1, r+1):
        tmp = (i%2019 * j%2019)%2019
        if tmp < mi:
            mi = tmp
print(mi)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math
import numpy as np
#input
L, R = map(int, input().split())
mod = []
for i in range(L, R+1):
  for j in range(i+1, R+1):
    mod += [(i*j) % 2019]
    if [(i*j) % 2019] == 0:
    	break
  else:
    continue
  break
print(np.amin(mod))

Submission status: Time Limit Exceeded

Solution code:
import math
import numpy as np
#input
L, R = map(int, input().split())
mod = []
for i in range(L, R+1):
  for j in range(i+1, R+1):
    mod += [(i*j) % 2019]
    if mod == 0:
    	break
  else:
    continue
  break
print(np.amin(mod))

Submission status: Time Limit Exceeded

Solution code:
import math
import numpy as np
#input
L, R = map(int, input().split())
mod = []
for i in range(L, R+1):
  for j in range(i+1, R+1):
    mod += [(i*j) % 2019]
    if mod == 0:
    	break
print(np.amin(mod))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split(' '))
if L - R >= 2018:
    print(0)
ans = 2018
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:
#C
L, R = list(map(int, input().split()))
if (R - L) == 2019:
    result = 0
else:
    result = 2018
    for i in range(L,R+1):
        for s in range(i+1,R+1):
            x = (i*s)%2019
            if x == 0:
                result = 0
                break
            elif result > x:
                result = x
print(result)

Submission status: Time Limit Exceeded

Solution code:
#C
L, R = list(map(int, input().split()))
if (R - L) == 2019:
    result = 0
else:
    result = 2018
    for i in range(L,R+1):
        for s in range(i+1,R+1):
            x = (i*s)%2019
            if x == 0:
                result = 0
            elif result > x:
                result = x
print(result)

Submission status: Time Limit Exceeded

Solution code:
#C
L, R = list(map(int, input().split()))
if (R - L) == 2019:
    result = 0
else:
    result = 2018
    for i in range(L,R+1):
        for s in range(i+1,R+1):
            x = (i*s)%2019
            if x == 0:
                result = 0
            if result > x:
                result = x
print(result)

Submission status: Time Limit Exceeded

Solution code:
#C
L, R = list(map(int, input().split()))
result = 2018
for i in range(L,R+1):
    for s in range(i+1,R+1):
        x = (i*s)%2019
        if x == 0:
            result = 0
        if result > x:
            result = x
print(result)

Submission status: Time Limit Exceeded

Solution code:
#C
L, R = list(map(int, input().split()))
result = 2018
for i in range(L,R+1):
    for s in range(i+1,R+1):
        x = (i*s)%2019
        if result >= x:
            result = x
            if result == 0:
                break
print(result)

Submission status: Time Limit Exceeded

Solution code:
#C
L, R = list(map(int, input().split()))
result = 2018



for i in range(L,R+1):
    for s in range(i+1,R+1):
        a = 0
        b = 0
        a = i%2019
        b = s%2019
        x = (i*s)%2019
        if result >= x:
            result = x
            if result == 0:
                break
print(result)

Submission status: Time Limit Exceeded

Solution code:
#C
L, R = list(map(int, input().split()))
result = 2018
for i in range(L,R+1):
    for s in range(i+1,R+1):
        a = 0
        b = 0
        a = i%2019
        b = s%2019
        x = (i*s)%2019
        if result >= x:
            result = x
print(result)

Submission status: Time Limit Exceeded

Solution code:
a = input().split()

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

mm = 2018

for i in range(L , R + 1):
  for j in range(L , R + 1):
    if i < j:
      n = (i * j) % 2019
      if n < mm:
        mm = n
print (mm)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
temp=input().split()
L=int(temp[0])
R=int(temp[1])

#print(min([(i*j)%2019 for i in range(L, R) for j in range(i+1, R+1)]))
temp=2019
for i in range(L, R):
  for j in range(i+1, R+1):
    if (i*j)%2019<temp:
      temp=(i*j)%2019
      
print(temp)

Submission status: Time Limit Exceeded

Solution code:
temp=input().split()
L=int(temp[0])
R=int(temp[1])

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:
import numpy as np
def min_mod2019(L, R):
    min_mod = 2019
    imin=0
    jmin=0
    for i in range(L, R):
        for j in range(i+1, R+1):
            #min_mod = min(min_mod, (i%2019)*(j%2019)%2019)
            if min_mod > (i%2019)*(j%2019)%2019:
                min_mod = (i%2019)*(j%2019)%2019
                imin=i
                jmin=j
    return min_mod

if __name__ == '__main__':
    L, R =map(int,input().split(' '))
    print(min_mod2019(L, R))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

    if (result < min):
      min = result
      if (min == 0):
        break
            
print(min)

Submission status: Time Limit Exceeded

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

    if (result < min):
        min = result

print(min)

Submission status: Time Limit Exceeded

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

    if (result < min):
        min = result

print(min)

Submission status: Time Limit Exceeded

Solution code:
import sys

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

ans = sys.maxsize

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
L,R=map(int,input().split())
A=0
B=0
ans=float('inf')
for i in range(L,R):
  for j in range(1,R-i+1):
    A=i*(i+j)
    B=A%2019
    ans=min(ans,B)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
L, R = (int(i) for i in input().split())  
unko = []
flag = True
if flag:
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      n = (i*j) % 2019
      unko.append((i*j) % 2019)
      if n == 0:
        flag = False
print(min(unko))

Submission status: Time Limit Exceeded

Solution code:
L, R = (int(i) for i in input().split())  
unko = []
flag = True
if flag:
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      n = (i*j) % 2019
      unko.append((i*j) % 2019)
      if n == 0:
        flag = False
print(min(unko))

Submission status: Time Limit Exceeded

Solution code:
# +2019までを調べれば十分

l, r = map(int, input().split())
ans = 10**9

for li in range(l, l+2020):
  for ri in range(li, r+1):
    if li < ri:
      ans = min(ans, (li*ri)%2019)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 28 20:37:55 2019

@author: avina
"""

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

for i in range(l,r+1):
   for j in range(i+1,r+1):
       k = min(k, (i*j)%2019)
       if k == 0:
           break
print(k)

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
import numpy as np
min = 2019
for i in range(L, R+1):
    for j in range(i+1, R+1):
        if (i*j)%2019 < min:
            min = (i*j)%2019

print(min)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
L,R = map(int,input().split())
l = L
m = (L *(L + 1)) % 2019
while l < R:
  r = l + 1
  while r <= R:
  	n = (l * r) % 2019 
  	m = min(m,n)
  	r = r + 1
  l = l + 1
print(m)

Submission status: Time Limit Exceeded

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

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):
        p = (i * j) % 2019
        ans = min(p,ans)
print(ans)

Submission status: Time Limit Exceeded

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

_min = 2019
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        buf = i*j % 2019
        if buf < _min:
            _min = buf
print(_min)

Submission status: Time Limit Exceeded

Solution code:
S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)

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

print(min)

Submission status: Time Limit Exceeded

Solution code:
S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)
for i in range(L, R, 1):
    for j in range(i+1, R+1, 1):
        mod = (i*j) % 2019
        if mod < min:
            min = mod

print(min)

Submission status: Time Limit Exceeded

Solution code:
a=(list(map(int,input().split())))
l=a[0]
r=a[1]
if(l-r>2021):
	print(0)
else:
	mini=2019
	i=l
	while(i<=r-1):
		j=i+1
		while(j<=r):
			p=(i*j)%2019
			mini=min(mini,p)	
			j+=1

		i+=1
	print(mini)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

mod = 2019
ans = 10 ** 7
results = [False for _ in range(2019)]
for low in range(L, R+1):
    for up in range(low+1, R+1):
        ans = min(ans, low * up % mod)
        results[low * up % mod] = True
        if all(results):
            print(ans)
            exit()
print(ans)

Submission status: Time Limit Exceeded

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

mod = 2019
ans = 10 ** 7
for low in range(L, R+1):
    for up in range(low+1, R+1):
        ans = min(ans, low * up % mod)

print(ans)

Submission status: Time Limit Exceeded

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

n =set([x%2019 for x in range(L,R+1)])

min_=10000
for a in n:
    m=set(n)-{a}
    for b in m:
        if a*b%2019 < min_:
            min_=a*b%2019
            if min_==0:
                break
print(min_)

Submission status: Time Limit Exceeded

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

n =set([x%2019 for x in range(L,R+1)])

min_=10000
for a in n:
    m=set(n)-{a}
    for b in m:
        if a*b%2019 < min_:
            min_=a*b%2019
print(min_)

Submission status: Time Limit Exceeded

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

n =[x for x in range(L,R+1)]

l=[]
for a in n:
    c=set(n)-{a}
    for b in c:
        l.append(a*b%2019)
print(min(l))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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


print(r)

Submission status: Time Limit Exceeded

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

ans = 2018
for i in range(L,R):
    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 = map(int, input().split())
ans = []
if r < 2019:
    print((l*(l+1))%2019)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans.append((i*j)%2019)
    print(min(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import itertools

num = list(map(int,input().split()))
num_list=[]
per = []

for i in range(num[0],num[1]+1):
    num_list.append(i)
    
num_list = list(itertools.combinations(num_list, 2))

for i,j in num_list:
    per.append((i*j)%2019)
    if (i*j)%2019 == 0:
        break

per.sort()

print(per[0])

Submission status: Time Limit Exceeded

Solution code:
num = list(map(int,input().split()))
per = []

for i in range(num[0],num[1]+1):
    for j in range(num[0],num[1]+1):
        if i != j:
            per.append((i*j)%2019)
per.sort()

print(per[0])

Submission status: Time Limit Exceeded

Solution code:
l,r = map(int, input().split())
 
mod = 2019
for j in range(r,l,-1):
    for i in range(j-1,l-1,-1):
        mod_new = (i*j)%2019
        mod = min(mod,mod_new)

print(mod)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

l,r = map(int, input().split())
 
seki = []
for j in range(r,l,-1):
    for i in range(j-1,l-1,-1):
        seki.append(i*j)

mod = np.array(seki) % 2019
print(mod.min())

Submission status: Time Limit Exceeded

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

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

print(minimum)

Submission status: Time Limit Exceeded

Solution code:
l,r = map(int, input().split())
modl = l % 2019
modr = r % 2019
if l - r >=2019:
    print(0)
else:
    if modl >= modr:
        print(0)
    else:
        ans = 2018
        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:
L, R = [int(i) for i in(input().split(' '))]
minn=2019
for i in range(L,R):
    for j in range(i+1,R+1):
        mo = i*j
        amari = mo%2019
        minn = min(amari,minn)
        if minn==0:
          break
print(minn)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

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

    for i in range(L, R+1):
        L_init = i+1
        for j in range(L_init, R+1):
            a = i%2019
            c = (a*j)%2019
            if c < minimum:
                minimum = c
    print(minimum)
        
    return

def dist(a_list, b_list):
    total = 0.0
    for a,b in zip(a_list, b_list):
        total = total + pow((a-b),2)
    total = math.sqrt(total)
    return total

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import math

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

    for i in range(L, R+1):
        L_init = i+1
        for j in range(L_init, R+1):
            c = (i*j)%2019
            if c < minimum:
                minimum = c
    print(minimum)
        
    return

def dist(a_list, b_list):
    total = 0.0
    for a,b in zip(a_list, b_list):
        total = total + pow((a-b),2)
    total = math.sqrt(total)
    return total

if __name__ == '__main__':
    main()

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):
        temp = i * j % 2019
        if temp < ans:
            ans = temp
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
inf = 2019
L, R = map(int, input().split())
ans = 2018

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
inf = 2019
L, R = map(int, input().split())
ans = 2018

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
x=[]
for i in range(a, b):
    for j in range(i+1, b+1):
        x.append((i*j)%2019)
print(min(x))

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
mod = 2020
for i in range(a, b):
    for j in range(i+1, b+1):
        if i*j%2019 < mod:
            mod = i*j%2019
print(mod)

Submission status: Time Limit Exceeded

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