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:
# -*- coding:utf8 -*-

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
mod = 2019
num = (R - L) + 1
ans = 10**9 + 10

for i in range(num):
    for j in range(1+i, num):
        l = L + i
        r = L + j
        if l < r:
            check = (l * r) % mod
            if ans > check:
                ans = check
        else:
            break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
lis=list(map(int,input().split()))
lis2=[i%2019 for i in range(lis[0],lis[1]+1)]
ans=[]
for i in range(len(lis2)):
  for f in range(len(lis2)):
    if i!=f:
      ans+=[(lis2[i]*lis2[f])%2019]
print(min(ans))

Submission status: Time Limit Exceeded

Solution code:
def main():
    a,b = map(int,input().split())
    if a-b+1>=673:
        print(0)
    else:
        mini = 2020
        for i in range(a,b+1):
            for j in range(a,i):
                joke = i*j%2019
                if joke<mini:
                    mini = joke
        print(mini)
main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    a,b = map(int,input().split())
    if a-b+1>=2019:
        print(0)
    else:
        mini = 2020
        for i in range(a,b+1):
            for j in range(a,i):
                joke = i*j%2019
                if joke<mini:
                    mini = joke
        print(mini)
main()

Submission status: Time Limit Exceeded

Solution code:
a,b = map(int,input().split())
if a-b+1>=2019:
    print(0)
else:
    mini = 2020
    for i in range(a,b+1):
        for j in range(a,i):
            joke = i*j%2019
            if joke<mini:
                mini = joke
    print(mini)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
l,r = map(int,input().split())
ans = l*(l+1)
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())
mod_min = 2020
mod_set = set()

for i in range(l,r+1):
  mod = i % 2019
  mod_set.add(mod)

mod_list = list(mod_set)
l = len(mod_list)
for i in mod_list:
  for j in mod_list[mod_list.index(i)+1:l]:
    mod_ij = (i*j)%2019
    if mod_ij < mod_min:
      mod_min = mod_ij
    else:
      pass
    
print(mod_min)

Submission status: Time Limit Exceeded

Solution code:
l, r = [int(x) for x in input().split(' ')]
if (r-l) > 2019:
  print(0)
else:
  a = sorted([x for x in range(l, r+1)])
  res = sorted([i*j%2019 for i in a for j in a if i!=j])
  print(res[0])

Submission status: Time Limit Exceeded

Solution code:
l,r = map(int,input().split())
mod_min = 2020
for i in range(l,r+1):
  for j in range(i+1,r+1):
    mod = (i*j) % 2019
    if mod <= mod_min:
      mod_min = mod
    else:
      pass

print(mod_min)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

R = min(R, L+(2019*2)) # 長さを制限しても同じ
MOD = 2019
ans = 2018

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = (i*j)%MOD
        ans = min(n, ans)

print(ans)

Submission status: Time Limit Exceeded

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

R = min(R, L+2019*2) # 長さを制限しても同じ
MOD = 2019
ans = 2018

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = i*j%MOD
        ans = min(n, ans)

print(ans)

Submission status: Time Limit Exceeded

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

R = min(R, L+2019*2) # 長さを制限しても同じ
MOD = 2019
ans = 2020

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = ((i%MOD) * (j%MOD))%MOD
        if n < ans:
            ans = n

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
from copy import deepcopy
from collections import deque
sys.setrecursionlimit(20000000)


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

    ans = 200000000

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

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(l,r+1):
        if i%2019 == 0 or j % 2019==0:
            c = 0
            break
        elif i == j:
            pass
        else:
            c = min(i*j%2019,c)

print(c)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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):
        mod = i * j % 2019
        x.append(mod)
print(min(x))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans=10**9
c=0
for i in range(l,r+1):
    for j in range(l,r+1):
        if i!=j:
            ans=min(ans,(i*j)%2019)
        c+=1
        if c>2019**2:
            continue
print(ans)

Submission status: Time Limit Exceeded

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

ans=float('inf')
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:
# -*- coding: utf-8 -*-
L, R = map(int, input().split())
end = min(R, L + 4038)

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

Submission status: Time Limit Exceeded

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

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

mod = 2019

ans = 2018

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
import copy
# import numpy as np

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

a = getInputListInt()
min = a[0]
max = a[1]

ans_max = 2019
ans = ans_max

flg = False

for i in range(min, max):
    for j in range(i+1, max+1):
        tmp = (i*j) % ans_max

        if ans > tmp:
            ans = tmp

        if ans == 0:
            flg = True
    
    if flg:
        break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
import copy
# import numpy as np

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

a = getInputListInt()
min = a[0]
max = a[1]

ans_max = 2019
ans = ans_max

for i in range(min, max):
    for j in range(i+1, max+1):
        tmp = (i*j) % ans_max

        if ans > tmp:
            ans = tmp
        
        if ans == 0:
            break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
import copy
# import numpy as np

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

a = getInputListInt()
min = a[0]
max = a[1]

ans_max = 2019
ans = ans_max

for i in range(min, max):
    for j in range(i+1, max+1):
        tmp = (i*j) % ans_max

        if ans > tmp:
            ans = tmp

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
import copy
import sys
import numpy as np

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

a = getInputListInt()
min = a[0]
max = a[1]

ans_max = 2019
ans = ans_max

for i in range(min, max):
    for j in range(i+1, max+1):
        tmp = (i*j) % ans_max

        if ans > tmp:
            ans = tmp

print(ans)

Submission status: Time Limit Exceeded

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

import itertools

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

if l - r >= 2019:
    print(0)

elif r % 2019 <= l % 2019:
    print(0)

else:
    m = 2018
    lmod = l%2019
    list = [lmod + i for i in range(r-l+1)]
    list2 = itertools.combinations(list,2)
    list3 = [(i[0]*i[1])%2019 for i in list2]
    print(min(list3))

Submission status: Time Limit Exceeded

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

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

if l - r >= 2019:
    print(0)

elif r % 2019 <= l % 2019:
    print(0)

else:
    m = 2018
    for i in range(l, r+1):
        for j in range(i, r+1):
            if i == j:
                continue
            else:
                i %= 2019
                j %= 2019
                mm = min(m, ((i*j)%2019))
                m = mm
    print(m)

Submission status: Time Limit Exceeded

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

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

if l - r >= 2019:
    print(0)

elif r % 2019 <= l % 2019:
    print(0)

else:
    m = 2018
    for i in range(l, r+1):
        for j in range(i, r+1):
            if i == j:
                continue
            else:
                mm = min(m, (i*j)%2019)
                m = mm
    print(m)

Submission status: Time Limit Exceeded

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

# max_loop = 2019 * 2 + 1
max_loop = 2019 ** 2
count = 0
ans = 2019
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        x = (i * j) % 2019
        ans = min(ans, x)
    if ans == 0:
        break
print(ans)

Submission status: Time Limit Exceeded

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

# max_loop = 2019 * 2 + 1
max_loop = 2019 ** 2
count = 0
ans = 2019
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        x = (i * j) % 2019
        ans = min(ans, x)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
a,b = map(int,input().split())
moda=np.mod(a,2019)
modb=np.mod(b,2019)
if (modb<=moda)or((b-a)>=2018):
    print(0)
    exit()

num =list(range(moda,modb+1))
ans = 10000
for i,l in enumerate(num):
    if i == len(num)-1:
        break
    for r in num[i+1:]:
        ans = min(np.mod(l*r,2019),ans)
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
l,r=map(int,input().split())
if r>l+4040:
    r=l+4040
minimum=1000000000
for i in range(l,r+1):
    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())
a = []
b = []
flag = False
if R - L >= 2019:
    print(0)
else:
    for i in range(L,R):
        for j in range(i+1, R+1):
            mod = (i*j)%2019
            a.append(mod)
        b.append(min(a))
    print(min(b))

Submission status: Time Limit Exceeded

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

minimum = 2018

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    L, R = map(int, input().split())
    d = dict()
    for i in range(L, R+1):
        v = i % 2019
        if v not in d: d[v] = 1
        else: d[v] += 1

    min_r = 2018
    for i in range(2019):
        if i in d and d[i] > 1:
            min_r = min(min_r, (i*i) % 2019)
    for i in range(2018):
        for j in range(i+1, 2019):
            if i in d and j in d:
                min_r = min(min_r, (i*j) % 2019)

    return min_r



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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#from heapq import nsmallest as hp
l,r = map(int,input().split())
tmp = 2019
tmp2 = 0
for i in range(l,min(r+1,l+2018)):
  
  for j in range(i+1,r+1):
    tmp = min(tmp,i*j%2019)
    
  if tmp == 0:
    break

print(tmp)

Submission status: Time Limit Exceeded

Solution code:
#from heapq import nsmallest as hp
l,r = map(int,input().split())
tmp = 2019
tmp2 = 0
for i in range(l,min(r+1,l+2018)):
  
  for j in range(i+1,r+1):
    tmp = min(tmp,i*j%2019)
    
  if tmp == 0:
    break

print(tmp)

Submission status: Time Limit Exceeded

Solution code:
#from heapq import nsmallest as hp
l,r = map(int,input().split())
tmp = 2019
tmp2 = 0
for i in range(l,min(r+1,l+4038)):
  
  for j in range(i+1,r+1):
    tmp = min(tmp,i*j%2019)
    
  if tmp == 0:
    break

print(tmp)

Submission status: Time Limit Exceeded

Solution code:
#from heapq import nsmallest as hp
l,r = map(int,input().split())
tmp = 2019**2
tmp2 = 0
for i in range(l,r+1):
  
  for j in range(i+1,r+1):
    tmp = min(tmp,i*j%2019)
    
  if tmp == 0:
    break

print(tmp)

Submission status: Time Limit Exceeded

Solution code:
#from heapq import nsmallest as hp
l,r = map(int,input().split())
tmp = 2019**2
tmp2 = 0
for i in range(l,r+1):
  
  for j in range(i+1,r+1):
    tmp = min(tmp,i*j%2019)
    
  if tmp == 0:
    break

print(tmp)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

def mod(x,y):
    return (x*y)%2019

ans = 2020
if l-r >= 2019:
    ans = 0
elif l-r < 2019:
    for i in range(l,r,1):
        for j in range(i+1,r+1,1):
            temp = mod(i,j)
            ans = min(temp,ans)
            if ans == 0:
                break

print(ans)

Submission status: Time Limit Exceeded

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

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

print(mod)

Submission status: Time Limit Exceeded

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

r = min(r, r+4038)

min = 99999999
for i in range(l,r):
  for j in range(i+1,r+1):
    value = (i*j)%2019
    if min > value:
      min = value
print(min)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

min = 99999999
for i in range(l,r):
  for j in range(i+1,r+1):
    value = (i*j)%2019
    if min > value:
      min = value
print(min)

Submission status: Time Limit Exceeded

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

a = []
#r = min(r,l+2019)
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())

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())

num_list = []
for i in range(l, r):
  for j in range(i+1, r+1):
    num_list.append( (i*j) % 2019)

print(min(num_list))

Submission status: Time Limit Exceeded

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

sc = list(itertools.combinations(range(l,r+1),2))

print(min([s[0]*s[1]%2019 for s in sc]))

Submission status: Time Limit Exceeded

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

min = 20000000
hantei1 = 0

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

print(min)

Submission status: Time Limit Exceeded

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

min = 20000000
hantei1 = 0

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

print(min)

Submission status: Time Limit Exceeded

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

min = 20000000

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

Submission status: Time Limit Exceeded

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

    for i in count_dict.values():
        count_list.append(i)

    sort_list = sorted(count_list)
    print(sort_list[0])

Submission status: Time Limit Exceeded

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

min = 20000000

for i in range(L,R):
    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:
L, R = map(int, input().split())

res = 10 ** 9
flag = False

for i in range(L, R+1):
    for j in range(L, R+1):
        if i%2019 == 0 or j%2019 == 0:
            res = 0
            flag = True
            break

        if i != j:

            res = min(res, i*j%2019)

    if flag:
        break

print(res)

Submission status: Time Limit Exceeded

Solution code:
# tle
L,R=map(int,input().split())
while True:
  if L==R: print(L%2019); break
  if R%2019<=L%2019 or L-R>2018: print(0); break
  ans=3333
  for i in range(L,R):
    for j in range(i+1,R+1): ans=min(ans,(i*j)%2019)
  print(ans);break

Submission status: Time Limit Exceeded

Solution code:
L,R=map(int,input().split())
while True:
  if L==R: print(L%2019); break
  if R%2019<=L%2019 or L-R>2018: print(0); break
  ans=3333
  for i in range(L,R):
    for j in range(i+1,R+1): ans=min(ans,(i*j)%2019)
  print(ans);break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
l, r = map(int, input().split())
rest = l*(l+1) % 2019
ans = rest

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
L, R = map(int, input().split())
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:
import sys
import itertools

input = sys.stdin.readline

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

    mod = 0
    mod_min = 2019
    num_list = [num for num in range(l, r+1)]
    for i, j in itertools.combinations(num_list, 2):
        mod = (i*j % 2019)
        if mod == 0:
            print(mod)
            exit()
        elif mod < mod_min:
            mod_min = mod
            
    print(mod_min)

# main関数呼び出し
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
import itertools

input = sys.stdin.readline

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

    num_list = [num for num in range(l, r+1)]

    mod = 0
    mod_min = 2019

    for i, j in itertools.combinations(num_list, 2):
        mod = (i*j % 2019)
        if mod < mod_min:
            mod_min = mod
            
    print(mod_min)
    
# main関数呼び出し
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
import itertools
from math import factorial

input = sys.stdin.readline

def func(l, r):
    num_list = tuple([num for num in range(l, r+1)])
    mod = 0
    mod_min = 2019
    for i, j in itertools.combinations(num_list, 2):
        mod = (i*j % 2019)
        if mod < mod_min:
            mod_min = mod
    print(mod_min)


def main():
    l, r = [int(i) for i in input().split()] 
    func(l, r)
    
# main関数呼び出し
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
import itertools
from math import factorial

input = sys.stdin.readline

def func(l, r):
    num_list = [num for num in range(l, r+1)]
    mod = 0
    mod_min = 2019
    for i, j in itertools.combinations(num_list, 2):
        mod = (i*j % 2019)
        if mod < mod_min:
            mod_min = mod
    print(mod_min)


def main():
    l, r = [int(i) for i in input().split()] 
    func(l, r)
    
# main関数呼び出し
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
import itertools
input = sys.stdin.readline

def func(l, r):
    num_list = [num for num in range(l, r+1)]
    mod = 0
    mod_min = 2019
    for i, j in itertools.combinations(num_list, 2):
        mod = (i*j % 2019)
        if mod < mod_min:
            mod_min = mod
    print(mod_min)


def main():
    l, r = [int(i) for i in input().split()] 
    func(l, r)
    
# main関数呼び出し
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
import itertools
input = sys.stdin.readline

def func(l, r):
    num_list = [num for num in range(l, r+1)]
    mod = []
    for i, j in itertools.combinations(num_list, 2):
        mod.append(i*j % 2019)
    print(str(min(mod)))


def main():
    l, r = [int(i) for i in input().split()] 
    func(l, r)
    
# main関数呼び出し
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
l, r = map(int, input().split())
mod1 = []
mod2 = []
for i in range(l,r+1):
  mod1.append(i%2019)

for i in range(len(mod1)-1):
  for j in range(i+1,len(mod1)):
    mod2.append((mod1[i]*mod1[j])%2019)

print(min(mod2))

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)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: 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:
L, R = map(int, input().split())
ans = []

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

print(min(ans))