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

D = []

for i in range(L,R+1):
    D.append(i%2019)
    if len(D)>=4038:
        break

ans = 2019
for i in range(len(D)):
    for j in range(i+1,len(D)):
        a = (D[i]*D[j]) % 2019
        if ans > a:
            ans = a
            
print(ans)

Submission status: Time Limit Exceeded

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

module = []
for i in range(L, R):
    for j in range(i+1, R+1):
       # print("({} * {}) % 2019:{}".format(i, j, (i * j) % 2019))
        module.append((i * j) % 2019)

if not module:
    print("0")
else:
    print(min(module))

Submission status: Time Limit Exceeded

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

module = []
for i in range(L, R):
    for j in range(i+1, R+1):
       # print("({} * {}) % 2019:{}".format(i, j, (i * j) % 2019))
        module.append((i * j) % 2019)

print(min(module))

Submission status: Time Limit Exceeded

Solution code:

L,R=map(int,input().split())
M=2019
import sys
for i in range(L,R):
    for j in range(i+1,R+1) :
        if (i*j)%2019 < M :
            M = (i*j)%2019
    if M == 0:
       break
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) :
        if (i*j)%2019 < M :
            M = (i*j)%2019
            if M == 0:
                break
print (M)

Submission status: Time Limit Exceeded

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

ans = 0 if l - r >= 2019 else 2018

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

Submission status: Time Limit Exceeded

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

ans = 2018

for i in range(r, l):
    for j in range(i+1, l+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())
mod = 2019
nums = list(set([i % 2019for i in range(L, R+1)]))

res = []
for i in range(len(nums)):
    for j in range(i+1, len(nums)):
       res.append((nums[i]*nums[j])%mod)
print(min(res))

Submission status: Time Limit Exceeded

Solution code:
import sys
 
L, R = map(int, input().split())
t = 2019
 
if L == 0:
    print(0)
    sys.exit()
 
temp = R // t
temp2 = L // t
kouho = []
if temp != temp2:
    print(0)
    sys.exit()
else:
    for i in range(L, R+1):
        for j in range(L, R+1):
            if i != j:
                kouho.append((i * j)%t)
    kouho.sort()
    print(kouho[0])

Submission status: Time Limit Exceeded

Solution code:
i = input().split(" ")
l = int(i[0])
r = int(i[1])
if r - l > 2019:
    print("0")
res = 3000
for a in range(l, r+1):
    for b in range(l, a+1):
        if a == b:
            continue
        c = (a*b)%2019
        if c < res:
            res = c
print(res)

Submission status: Time Limit Exceeded

Solution code:
i = input().split(" ")
l = int(i[0])
r = int(i[1])
if r - l > 2019:
    print("0")
res = 3000
for a in range(l, r+1):
    for b in range(l, r+1):
        if a == b:
            continue
        c = (a*b)%2019
        if c < res:
            res = c
print(res)

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

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations
l, r = map(int,input().split())
a = []
for i in range(l,r+1):
    tmp = i%2019
    if tmp not in a:
        a.append(tmp)
a.sort()
perm = permutations(a,2)
min = 2019
for i in list(perm):
    tmp = i[0]*i[1]%2019
    if tmp == 0:
        min = tmp
        break
    if min > tmp:
        min = tmp
print(min)

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations
l, r = map(int,input().split())
a = []
for i in range(l,r+1):
    tmp = i%2019
    if tmp not in a:
        a.append(tmp)
perm = permutations(a,2)
min = 2019
for i in list(perm):
    tmp = i[0]*i[1]%2019
    if tmp == 0:
        min = tmp
        break
    if min > tmp:
        min = tmp
print(min)

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations
l, r = map(int,input().split())
a = []
for i in range(l,r+1):
    tmp = i%2019
    if tmp not in a:
        a.append(tmp)
perm = permutations(a,2)
min = 2019
for i in list(perm):
    tmp = i[0]*i[1]%2019
    if min > tmp:
        min = tmp
print(min)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

mod = 2019
R = min(R, R + mod + 1)

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

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:
inf = 2019
L, R = map(int, input().split())
ans = 2018

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
l, r = map(int, input().split())
mod = 2019  # 素数ではない (素数は 673)
r = min(r, l+mod*2)

res = mod
for i in range(l, r):
    for j in range(r, l-1, -1):
        if i == j:
            break
        tmp = i*j % mod
        if tmp < res:
            res = tmp

print(res)

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

Submission status: Time Limit Exceeded

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

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

            if min == 0:
                break

        else:
            if min == 0:
                break

    print(min)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
l,r = map(int,input().split())
r = min(r,l+4038)
mod = 0
ans = 2018

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

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    L, R = read_h()

    if R % 2019 == 0 or L % 2019 == 0 or (R - L) % 2019 == 0:
        print(0)
        return

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
L,R = [int(x) for x in input().split()]
 
min_ans = 10**18
if R-L>=2019:
  min_ans=0

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def exam(L, R):
    min = 2019
    if L-R > 2019:
        return 0
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            modval = i*j % 2019
            if modval < min:
                min = modval
    return min


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

Submission status: Time Limit Exceeded

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

ll = l % 2019
ans = 2018
if l-n >= 672:
    ans = 0
elif l-n > 2:
    for i in range(ll,ll + n-l +1):
        if i % 673 == 0:
            ans = 0
            break
        else:
            for j in range(ll,ll + n-l +1):
                if i != j:
                    ansss = i*j%2019
                    if ansss == 0:
                        ans = 0
                        break
                    elif ansss < ans:
                        ans = ansss
else:
    for i in range(ll,ll + n-l +1):
        for j in range(ll,ll + n-l +1):
            if i != j:
                ansss = i*j%2019
                if ansss == 0:
                    ans = 0
                    break
                elif ansss < ans:
                    ans = ansss

print(ans)

Submission status: Time Limit Exceeded

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

P = 2019

R = min(R, L+4038)

tmp = 3000
for i in range(L, R):
    for j in range(L+1, R+1):
        tmp = min((i*j)%P, tmp)
        
print(tmp)

Submission status: Time Limit Exceeded

Solution code:
import sys

def main():
    input = sys.stdin.readline
    L, R = map(int, input().split())
    R = min(R, L + 2019*2)

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

    return ans


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

Submission status: Time Limit Exceeded

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

P = 2019

def mul(a, b):
    return ((a % P) * (b % P)) % P

R = min(R, L+4038)

tmp = 10**9
for i in range(L, R):
    for j in range(L+1, R+1):
        tmp = min(mul(i, j), tmp)
        
print(tmp)

Submission status: Time Limit Exceeded

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

R = min(R, L+2019*2)
ans = 2018
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())
s=[]
i=0
j=0
if (r-l)>4038:
    while i!=(r-l)+1 and i!=2019:
        while j!=(r-l)+1 and j!=2019:
            s.append(((l+i)*(l+j))%2019)
            j+=1
        j=0
        i+=1
    print(min(s))
else:
    while i!=(r-l)+1:
        while j!=(r-l)+1:
            if i!=j:
                s.append(((l+i)*(l+j))%2019)
            j+=1
        j=0
        i+=1
    #print(s)
    print(min(s))

Submission status: Time Limit Exceeded

Solution code:
import math;

def swap(a,b):
    return (b,a)

def gcd(a,b):
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def main():
    l,r = map(int,input().split())
    mod = 2019
    r = min(r,l+mod*2)
    ans = 2018
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            x = i * j % mod
            ans = min(ans,x)
    print(ans)
    return

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+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:
def exam(L, R):
    min = 2019
    if L-R > 2019:
        return 0
    for i in range(L, R):
        for j in range(i + 1, R+1):
            modval = i*j % 2019
            if modval < min:
                min = modval
    return min


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

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(L+1,R+1,1):
        ans = min(ans, i*j % 2019)
        if ans==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(L+1,R+1,1):
        ans = min(ans, i*j % 2019)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
L, R = map(int, input().split())
i = L
min = 2020
while(i < R):
  j = i + 1
  while(j <= R):
    tmp = i * j % 2019
    if(min > tmp):
      min = tmp
    j += 1
  i += 1
print(min)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
L,R= map(int,input().split())
#境界条件
bool = True
for i in range(L,R):
    for j in range(i+1,R+1):
        temp = (i * j) % 2019
        if bool:
            min = temp
            ans = min
            bool = False
        elif min > temp:
            min = temp
            ans = min
        if min == 0:
            break
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import itertools
L, R = map(int, input().split())
 
remainder_list = [N%2019 for N in range(L, R+1)]
remainder_list = list(set(remainder_list))
all_list = [(i*j)%2019 for i, j in list(itertools.combinations(remainder_list, 2))]
print(min(all_list))

Submission status: Time Limit Exceeded

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


MOD=[0] * (2019*2019)

def myidx(i,j):
    return i * 2019 + j

for i in range(2019):
    for j in range(2019):
        idx = myidx(i,j)
        MOD[idx] = (i*j) % 2019

for i in range(2019):
    idx = myidx(i,i)
    MOD[idx] = 2019

MMM = []
MIN = 2019
Lmod = L % 2019
Rmod = R % 2019

if L+2019 <= R:
    for i in range(2019):
        for j in range(i+1,2019):
            idx = myidx(i,j)
            MIN = min(MIN, MOD[idx])
            #MMM.append(MOD[idx])
elif Lmod <= Rmod:
    for i in range(Lmod, Rmod+1):
        for j in range(i+1, Rmod+1):
            idx = myidx(i,j)
            MIN = min(MIN, MOD[idx])
            #MMM.append(MOD[idx])

elif Lmod > Rmod:
    for i in list(range(0,Rmod+1)) + list(range(Lmod, 2019)):
        for j in list(range(i+1,Rmod+1)) + list(range(max(Lmod,i+1), 2019)):
            idx = myidx(i,j)
            MIN = min(MIN, MOD[idx])
            #MMM.append(MOD[idx])

#MMM=list(set(MMM))
#MMM.sort()
#print(MMM.pop(0))
print(MIN)

Submission status: Time Limit Exceeded

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

a, b = readmi()
t = 0xFFFFFFFF
for i in range(a, b + 1):
    for j in range(a, b + 1):
        if i == j:
            continue
        t = min(t, i * j % 2019)
        if t == 0:
            break
print(t)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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

def f(L,R):
    mod_min = L*R % 2019
    for i in range(L, R):
        for j in range(i+1, R+1):
            mod = (i * j) % 2019
            if mod < mod_min:
                mod_min = mod
                if mod_min == 0:
                    break
    return mod_min
print(f(L,R))

Submission status: Time Limit Exceeded

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


MOD=[0] * (2019*2019)

def myidx(i,j):
    return i * 2019 + j

for i in range(2019):
    for j in range(2019):
        idx = myidx(i,j)
        MOD[idx] = (i*j) % 2019

for i in range(2019):
    idx = myidx(i,i)
    MOD[idx] = 2019

MMM = []
Lmod = L % 2019
Rmod = R % 2019

if L+2019 <= R:
    for i in range(2019):
        for j in range(i+1,2019):
            idx = myidx(i,j)
            MMM.append(MOD[idx])
elif Lmod <= Rmod:
    for i in range(Lmod, Rmod+1):
        for j in range(i+1, Rmod+1):
            idx = myidx(i,j)
            MMM.append(MOD[idx])

elif Lmod > Rmod:
    for i in list(range(0,Rmod+1)) + list(range(Lmod, 2019)):
        for j in list(range(i+1,Rmod+1)) + list(range(max(Lmod,i+1), 2019)):
            idx = myidx(i,j)
            MMM.append(MOD[idx])

MMM=list(set(MMM))
MMM.sort()
print(MMM.pop(0))

Submission status: Time Limit Exceeded

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

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
        
        if MIN > mod:
            MIN = mod
 
print(MIN)

Submission status: Time Limit Exceeded

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

if l - r < 2019:
    for i in range(l, r):
        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())
if l <= 2019 <= r:
    print(0)
    exit()
elif r*(r-1) <= 2019:
    print(l*(l+1))
    exit()

a = 2019
for i in range(l, r):
    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())

list_b = []
for i in range(l,r+1):
    list_b.append(i%2019)
#print(list_b)

if min(list_b)==0:
    print(0)
else:
    list_c = []
    for i in range(len(list_b)-1):
        for j in range(i+1,len(list_b)):
               list_c.append(((list_b[i])*(list_b[j]))%2019)
    #print(list_c)
    print(min(list_c))

Submission status: Time Limit Exceeded

Solution code:
l, r = list(map(int,input().split()))
Set = set([l%2019])
for i in range(r-l):
	Set.add((l+1+i)%2019)
List = list(Set)
if(0 in List):
	print(0)
else:
	answer = (l * r) % 2019
	k = 0
	for i in range(len(List)):
		for j in range(len(List)):
			if(i < j):
					if(answer > (List[i] * List[j])% 2019):
						answer = (List[i] * List[j])% 2019
						k = 1
	print(answer)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

a = 2019
for i in range(l, r):
    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())
MIN = 2019
for i in range(L,R):
    for j in range(i+1, R+1):
        mod = i*j % 2019

        if MIN > mod:
            MIN = mod
 
print(MIN)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

m = 2019
mod_min = m

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

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 ans == 0:
            break
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

if R-L >= 2019:
    print(0)
else:
    tmp = np.array(range(L, R+1))
    tmp2 = []
    for i in range(len(tmp)):
        for j in range(i+1, len(tmp)):
            tmp2.append((tmp[i] * tmp[j]) % 2019)
    print(min(tmp2))

Submission status: Time Limit Exceeded

Solution code:
l,r = map(int,input().split())
 
mod_l = l % 2019  
mod_r = r % 2019
l_list=[]
a = list(range(mod_l, mod_r+1))
for i in range(len(a)):
  ai = a[i]
  for j in range(i+1,len(a)):
    aj = a[j]
    t = (ai*aj) % 2019
    l_list.append(t)
    ans1 = min(l_list)
  
if r-l >= 2019:
  ans = 0
else:
  if mod_r < mod_l:
    ans = 0
  elif mod_l * mod_r == 0:
    ans = 0
  else:
    ans = ans1
   
print(ans)

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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

mod = 2019
tar = []
for i in range(1, 10 ** 6):
    tar.append(673 * i)

ans = float("inf")
f = -1
for t in tar:
    if L <= t <= R:
        f = t
        break

s = -1
for i in range(L, R + 1):
    if i != f and i % 3 == 0:
        s = i
        break

if f != -1 and s != -1:
    print(0)
else:
    ans = float("inf")
    for i in range(L, R + 1):
        for j in range(L, R + 1):
            if i == j:
                continue
            else:
                ans = min(ans, (i * j) % 2019)
    print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import itertools

L, R = map(int, input().split())
A = [L+i for i in range(R-L+1)]
abs_A = []

for x in itertools.combinations(A, 2):
    y = (x[0]*x[1])%2019
    if y!=0:
        abs_A.append(y)
    else:
        abs_A.append(y)
        break
print(sorted(abs_A)[0])

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

Submission status: Time Limit Exceeded

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

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

            if min == 0:
                break

        else:
            if min == 0:
                break

    print(min)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

print(min)

Submission status: Time Limit Exceeded

Solution code:
S=input().split()
L=int(S[0])
R=int(S[1])
list=2018
L1=L
L2=L
while list != 1:
  while L2 <= R:
    while L1 < L2:
      if (L1*L2)%2019 <= list:
        list = (L1*L2)%2019
      L1 += 1
    L1 =int(L)
    L2 += 1
print(list)

Submission status: Time Limit Exceeded

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

print(solve())

Submission status: Time Limit Exceeded

Solution code:
in_ = [int(i) for i in input().split()]
L = in_[0]
R = in_[1]
mod_min = 100000
# L = L % 2019
# R = R % 2019
# tab = [[-1 for r in range(R+1)] for l in range(L+1)]
# print(tab)
i_list = []
j_list = []
for i in range(L, R):
    i_mod = i % 2019
    for j in range(i+1, R+1):
            j_mod = j % 2019
            mod = i_mod * j_mod % 2019
            if mod < mod_min:
                mod_min = mod
                if mod_min == 0:
                    break
print(mod_min)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

min_val = 2019
for i in range(L, R):
  for j in range(i+1, R+1):
    val = np.mod(i*j, 2019)
    if min_val > val:
      min_val = val
print(min_val)

Submission status: Time Limit Exceeded

Solution code:
L,R= map(int,input().split())
#境界条件
bool = True
l = L % 2019
r = R % 2019
if l == 0 or r == 0:
    ans = 0
else:
    r+=2019
    for i in range(L,R):
        for j in range(i+1,R+1):
            temp = (i * j) % 2019
            if bool:
                min = temp
                ans = min
                bool = False
            elif min > temp:
                min = temp
                ans = min
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
def main():
    L,R = map(int,input().split())
    LR = R-L
    M = []
    if L <= 2019 <= R:
        print(0)
        exit()
    for i in range(LR):
        for j in range(LR):
            M.append(((L+i)*(L+1+j))%2019)
    print(min(M))
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
l,r = map(int,input().split())
 
if r-l >= 2019:
  ans = 0
else:
  mod_l = l % 2019  
  mod_r = r % 2019
  if mod_r < mod_l:
    ans = 0
  elif mod_l * mod_r == 0:
    ans = 0
    
  else:
    l_list=[]
    a = list(range(mod_l, mod_r+1))
    for i in range(len(a)):
      ai = a[i]
      for j in range(i+1,len(a)):
        aj = a[j]
        l = (ai*aj) % 2019
        l_list.append(l)
        ans = min(l_list)
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
L,R= map(int,input().split())
#境界条件
bool = True
l = L % 2019
r = R % 2019
if l == 0 or r == 0:
    ans = 0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            temp = (i * j) % 2019
            if bool:
                min = temp
                ans = min
                bool = False
            elif min > temp:
                min = temp
                ans = min
print(ans)

Submission status: Time Limit Exceeded

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

i = l-1
j = l
mod = l * (l+1)

while i < r:
  i += 1
  while j <= r:
    if i*j < 2019:
      break
    if i < j :
      result = (i * j) % 2019
      if result <= mod:
        mod = result
    j += 1
    if j > r or mod == 0:
      j = i
      break
    
print(mod)