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:
import numpy as np
import copy

def main():
    l, r = map(int, input().split())
    
    ans_tmp = 2019
    for j in range(r-l):
        for k in range(r-l):
            ans = ((l+j)*(l+(k+1)))% 2019
            if ans < ans_tmp:
                ans_tmp = ans
                if ans == 0:
                    break
        
    print(ans_tmp)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
l, r = map(int, input().split())
a = 10**5
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:
L, R = map(int, input().split())
ans = 2018
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:
import itertools
L,R=map(int,input().split())

A=[]
D=[]

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

if A.count(1)>=2:
    B=set(A)
    B.add(1)
else:
    B=set(A)

C=list(itertools.combinations(B,2))
for j in range(len(C)):
    D.append(C[j][0]*C[j][1]%2019)
    if 0 in D:
        break
E=sorted(D)
print(E[0])

Submission status: Time Limit Exceeded

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

A=[]
D=[]

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

if A.count(1)>=2:
    B=set(A)
    B.add(1)
else:
    B=set(A)

C=list(itertools.combinations(B,2))
for j in range(len(C)):
    D.append(C[j][0]*C[j][1]%2019)
E=sorted(D)
print(E[0])

Submission status: Time Limit Exceeded

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

A=[]
D=[]

for i in range(R-L+1):
    A.append((i+L)%2019)
B=sorted(A)
C=list(itertools.combinations(A,2))
for j in range(len(C)):
    D.append(C[j][0]*C[j][1]%2019)
E=sorted(D)
print(E[0])

Submission status: Time Limit Exceeded

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

A=[]

for i in range(R-L+1):
    for j in range(R-i-L):
        A.append((i+L)*(j+i+L+1)%2019)
print(min(A))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
L,R = map(int,input().split())
array = []
array2 = []
for i in range(L,R+1):
    array2.append(i%2019)
array2 = list(set(array2))
for i in range(len(array2)):
    for j in range(len(array2)):
        if i < j:
            m = (array2[i]%2019)*(array2[j]%2019)
            array.append(m%2019)
print(min(array))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
MOD = 2019
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) % MOD)
        if ans == 0:
            break
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
mi = lambda : map(int, input().split())

l, r = mi()

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

n = min(l+4048, r)

ans = 2018
tmp = 2018

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
l, r = map(int, input().split(' '))
ary = [num for num in range(l, r+1)]
# print(ary)
ans = 10000

for i in range(len(ary) -1):
  for j in range(i+1, len(ary)):
    tmp = (ary[i] * ary[j]) % 2019
    if tmp < ans:
      ans = tmp
    if ans == 0:
      break

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
def print_ans(L, R):
    """Test Case
    >>> print_ans(2020, 2040)
    2
    >>> print_ans(4, 5)
    20
    """
    tmp = R - L
    L = L % 2019
    R = L + tmp
    ans = 2019
    for i in range(L, R):
        for k in range(i + 1, R + 1):
            ans = min(ans, (i * k) % 2019)
            if ans == 0:
                break
    print(ans)



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

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
def print_ans(L, R):
    """Test Case
    >>> print_ans(2020, 2040)
    2
    >>> print_ans(4, 5)
    20
    """
    ans = 2019
    for i in range(L, R):
        for k in range(i + 1, R + 1):
            ans = min(ans, (i * k) % 2019)
            if ans == 0:
                break
    print(ans)



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

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(L, R):
    """Test Case
    >>> print_ans(2020, 2040)
    2
    >>> print_ans(4, 5)
    20
    """
    ans = 2019
    for i in range(L, R):
        for k in range(i + 1, R + 1):
            ans = min(ans, (i * k) % 2019)
    print(ans)



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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
input = stdin.readline
L, R = map(int, input().split())
min_mod = 2020
for i in range(L, R):
    for j in range(i + 1, R + 1):
        min_mod = min(min_mod, (i * j) % 2019)
print(min_mod)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

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

ans = 2019

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

print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
L,R = map(int, input().split())
mod_min=2020

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(min(mods))

Submission status: Time Limit Exceeded

Solution code:
import math
L,R = map( int,input().split() )
ans = ( L * (L+1) ) % 2019  
for i in range(L,R):
    if ans == 0:
        break
    j = i + 1
    a = ( i * j ) % 2019
    ans = min(a, ans)
    plus = i % 2019
    while(True):
        over = math.ceil( ( 2019 - a ) / plus )
        j = j + over
        if j > R:
            break
        a = ( i * j) % 2019
        ans = min(a,ans)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
L,R = map( int,input().split() )
ans = ( L * (L+1) ) % 2019  
for i in range(L,R):
    if ans == 0:
        break
    j = i + 1
    a = ( i * j ) % 2019
    ans = min(a, ans)
    plus = i % 2019
    while(True):
        over = int( ( 2019 - a ) / plus )
        j = j + over
        if j >= R:
            break
        a = ( i * j) % 2019
        ans = min(a,ans)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

mod = 2019
minij = l * (l + 1)

for i in range(l, r):
    for j in range(i+1, r+1):
        if (i * j) % mod < minij:
            minij = (i*j) % mod
            if minij == 0:
                print(minij)
                exit(0)

print(minij)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int,input().split())
MOD = 2019
ans = float("inf")
for i in range(L,min(L+2019,R+1)):
  for j in range(i+1,min(i+2019,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())
ans = []
for i in range(l, r+1):
    for j in range(i+1, r+1):
        if j == i+1:
            start = (i*j) % 2019
        tmp = (i*j) % 2019
        if j != i+1 and tmp == start:
            break
        else:
            ans.append(tmp)
print(min(ans))

Submission status: Time Limit Exceeded

Solution code:
L,R = map(int,input().split())
a=R-L+1
Y=2019

for i in range(L,R+1):
  for j in range(L,R+1):
    if Y>(i*j)%2019 and i!=j:
      Y= (i*j)%2019
print(Y)

Submission status: Time Limit Exceeded

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

ansL = []
for i in range(5020):
    if L + i > R:
        break

    ansL.append((L + i) % 2019)

ans = []
for i in range(len(ansL)):
    for j in range(len(ansL)):
        if i == j:
            continue
        
        ans.append((ansL[i] * ansL[j]) % 2019)
        

ans = sorted(ans)
print(ans[0])

Submission status: Time Limit Exceeded

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

    mi = l * r
    for i in range(l, r):
        for j in range(i+1, r+1):
            mod = (i*j) % 2019
            mi = min([mi, mod])
            if mod == 0:
                break

    print(mi)

cc133()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
l,r=map(int,input().split())
if l==0:
    print(0)
elif r*(r-1)<2019:
    print(l*(l+1))
else:
    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())
ans=2018
for i in range(l,r):
    for j in range(i+1,r+1):
        if i*j%2019<ans:
            ans=i*j%2019
        if ans==0:
            break
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    l, r = list(map(int, input().rstrip('\n').split()))
    mmod = 10 ** 10
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            mmod = min(mmod, (i * j) % 2019)
            if mmod == 0:
                break
    print(mmod)


if __name__ == '__main__':
    slove()

Submission status: Time Limit Exceeded

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

l_mod = l % 2019
r_mod = r - (l - l_mod)
if l_mod >= r_mod:
    r_mod += 2019

ans = 2019
for i in range(l_mod, r_mod):
    for j in range(i + 1, r_mod + 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=2018
for i in range(l,r):
    for j in range(i+1,r+1):
        a = (i*j) % 2019
        ans = min(ans,a)
        #print(i,j,ans)
print(ans)

Submission status: Time Limit Exceeded

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

m = 2000000001
for i in range(l,r+1):
      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 = map(int,input().split(" "))

m = 2019
for i in range(l, r):
  for j in range(i + 1, r + 1):
    x = (i * j) % 2019
    m = min(m, x)
    #print("{} {} {} {}".format(i,j,x,m))

print(m)

Submission status: Time Limit Exceeded

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

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

if len(delim_list) >= 2019:
  print(0)
  exit()

ans_list = []

for x in range(L, R):
  for y in range(x+1, R+1):   
    ans_list.append((x * y) % 2019)
    
print(min(ans_list))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
L , R = map(int,input().split())
if R - L >= 2019 or L == 0:
    print("0")
min = 2020
for i in range(L , R):
    for j in range(i + 1 , R + 1):
        tmp_min = ( i * j) % 2019
        if tmp_min < min:
            min = tmp_min
print(min)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

l = L//2019
r = R//2019

if((l-r >= 1)or(L%2019 == 0)or(R%2019 == 0)):
  ans = 0
  
else:
 A = []
 ans = 2018
 judge = 0
 for i in range(L,R+1):
    i = i%2019
    if(i%673 == 0): judge += 673
    if(i%3 == 0): judge += 3 
    A.append(i)

 if(judge == 673+3): #3, 673(mod 2019) あり
   ans = 0
 else: #len(A) <673 (なぜならば0~672 or 673 ~ 1346 or ...)
   A_comb = list(itertools.combinations(A,2))
   for i in range(len(A_comb)):
     tmp = list(A_comb[i])
     ans = min(ans,(tmp[0]*tmp[1])%2019)
 
print(ans)

Submission status: Time Limit Exceeded

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

tmp = 2019
ans = 2019

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

minimum = 2020

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

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
min_l = []
ij = list(set([_ % 2019 for _ in range(L, R+1)]))


for i in ij:
    for j in ij:
        if i < j:
            min_l.append((i*j) % 2019)
        else:
            continue
print(min(min_l))

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
min_l = []
ij = [_ % 2019 for _ in range(L, R+1)]
ij_s = list(set(ij))
for i in ij_s:
    for j in ij_s:
        if i < j:
            min_l.append((i*j) % 2019)
print(min(min_l))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import itertools

l,r = [int(x) for x in stdin.readline().rstrip().split()]


li = [x for x in range(l,r+1)]
m = 2020
for i in range(len(li)-1):
    for j in range(i+1,len(li)):
        if li[i]*li[j]%2019 == 0:
            print(0)
            exit()
        else:
            if m >= li[i]*li[j]%2019:
                m = li[i]*li[j]%2019
print(m)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import itertools

l,r = [int(x) for x in stdin.readline().rstrip().split()]


li = [x for x in range(l,r+1)]
m = 2020
for i in range(len(li)-1):
    for j in range(i+1,len(li)):
        if li[i]*li[j]%2019 == 0:
            print(0)
            exit()
        else:
            m = min(m,li[i]*li[j]%2019)
print(m)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import itertools

l,r = [int(x) for x in stdin.readline().rstrip().split()]


li = [x%2019 for x in range(l,r+1)]
m = 2020
for i in range(len(li)-1):
    for j in range(i+1,len(li)):
        if li[i]*li[j]%2019 == 0:
            print(0)
            exit()
        else:
            m = min(m,li[i]*li[j]%2019)
print(m)

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):
        a = (i*j)%2019
        ans = min(ans,a)
        if a == 0:
            break
        else:
            continue
        break
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys

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

if R <= 45:
    print(R*(R-1))
    sys.exit()
else:
    for i in range(L,R):
        for v in range(i+1,R+1):
            a = (i*v)%2019
            ans = min(ans,a)
            if a == 0:
                break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys

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

if R <= 45:
    print(R*(R-1))
    sys.exit()
else:
    for i in range(L,R):
        for v in range(i+1,R+1):
            a = (i*v)%2019
            ans = min(ans,a)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# TLE
L,R = map(int,input().split())
list_LR = range(L,R+1)

list_aaa =[]

ans = 2019

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
L,R = map(int,input().split())
list_LR = range(L,R+1)

list_aaa =[]

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


print(min(list_aaa))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(temp)

Submission status: Time Limit Exceeded

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

list_1 = []
for i in range(R - L):
    a = L + i
    # print("a:", a)
    for j in range(R - a):
        b = (a + 1) + j
        # print("    b:", b)
        list_1.append(a % 2019 * b % 2019)
print(min(list_1))

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
l, r = map(int, input().split())
if l - r >= 2019:
    print(0)
else:
    n = range(l, r+1)
    min_x = 2018
    for i in range(len(n)-1):
        for j in range(i+1, len(n)):
            cur_x = ((n[i]%2019)*(n[j]%2019))%2019
            min_x = min(cur_x, min_x)
            if min_x == 0:
                break
    print(min_x)

Submission status: Time Limit Exceeded

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

if l - r >= 2019:
    print(0)
else:
    n = range(l, r+1)
    min_x = 2018
    for i in range(len(n)-1):
        for j in range(i+1, len(n)):
            cur_x = n[i]*n[j] % 2019
            min_x = min(cur_x, min_x)
            if min_x == 0:
                break
    print(min_x)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

ans = float('inf')
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())
n = range(l, r+1)
x = []
for i in range (len(n)-1):
    for j in range (i+1, len(n)):
        x.append(n[i]*n[j] % 2019)
        if min(x) == 0:
            break
print(min(x))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

min = 1000000000000000000000000000

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

print(min)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding:utf8 -*-

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding:utf8 -*-

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding:utf8 -*-

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding:utf8 -*-

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding:utf8 -*-

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

Submission status: Time Limit Exceeded

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

minv = 2019
for i in range(L,R):
  for j in range(i+1,R+1):
    x = i % 2019
    y = j % 2019
    val = (x * y) % 2019
    if minv > val:
      minv = val
    
print(minv)

Submission status: Time Limit Exceeded

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

rem = []
for i in range(L,R):
  for j in range(i+1,R+1):
    x = i % 2019
    y = j % 2019
    val = (x * y) % 2019
    rem.append(val)
    
print(min(rem))