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: Runtime Error

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

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
a = [int(i) % 2019 for i in range(l,r+1)]
c = []
for x in range(300)
  if l <= 673*x <= r:
    print(0)
    exit()
  else:  
    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: Runtime Error

Solution code:
from sys import exit, stderr, stdin
input = stdin.readline
def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    L, R = [int(n) for n in input().split()]
    if (L//2019)<(R//2019):
        print(0)
    else:
        l = L%2019
        r = R%2019
        res = 2019**2
        for i in range(l,r+1):
            for j in range(i+1,r+1):
                res = min(res,(i*j)%MOD)
        print(res)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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


if ( 2019 // ( r * ( r - 1 ) ) ) == ( 2019 // ( l * (l + 1) ) ):
    print( l * (l + 1) % 2019 )
else:
    print( 0 )

Submission status: Runtime Error

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

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

print(mod_min)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
nums_of_2019 = r//2019 - (l-1)//2019
if nums_of_2019 >= 2:
    print(0)

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

Submission status: Runtime Error

Solution code:
def main():
    a,b = map(int,input().split())
    if a+(a-a%673)%a:
        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
                    if mini == 0:
                        print(0)
                        return 0
        print(mini)
main()

Submission status: Runtime Error

Solution code:
import sys
l, r = map(int, input().split())
m = 2019

if r - l + 1 >= 2019 or l == 0:
    print(0)
else:
    min = (l%m * (l+1)%m)%m
    for i in range(l, r):
        if i%m == 0:
            print(0)
            sys.exit()
        for j in range(i+1, r+1):
            else:
                if min > (i%m * j%m)%m:
                    min = (i%m * j%m)%m
print(min)

Submission status: Runtime Error

Solution code:
l,r = map(int,input().split())
if r-l > 2017:
  print(0)
else:
  mod_min = 2019
  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: Runtime Error

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

MOD = 2019
ans = 2018

if R - L + 1 >= 2019:
    print(0)
else:
    for i in range(L, R):
        for j in range(i+1, R+1):
            n = (i*j)%MOD
            ans = min(n, ans)
    print(ans)

"""
# TLEギリギリ
R = min(R, L+(2019)) # 長さを制限しても同じ2019をyoutube通りに2019*2にするとTLE
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: Runtime Error

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

if l%2019 >= r%2019:
    print(0)
elif l%2019 == 0 or r%2019 == 0:
    print(0)
else:
    h = []
    for i in range(1, (r-l)%2019):
        h.append((l%2019)*((l+i)%2019)%2019)
    print(min(h))

Submission status: Runtime Error

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((i*j)%2019)
        c+=1
        if c>2019**2:
            continue
print(ans)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
num = 2019
if (l<=673<=r and r-l>=3) or (r-l>=673):
  print(0)
else:
  mods = []
  for i in range(l, r):
    for j in range(i+1, r+1):
      m = (i*j) % num
      mods.append(m)
      if m == 1:
        print(1)
        exit()
print(min(mods))

Submission status: Runtime Error

Solution code:
L=int(input())
R=int(input())

if R - L >= 672:
    ans = 0
elif R * L < 2019:
    ans = L*(L+1)
else:
    ans = 2018
    for i in range(L, R):
        for j in range(L+1, R+1):
            mod=(i*j)%2019
            if mod < ans:
                ans = mod
print(ans)

Submission status: Runtime Error

Solution code:

LR = input().split()
L = int(LR[0])
R = int(LR[1])
S = []

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

Submission status: Runtime Error

Solution code:

LR = input().split()
L = int(LR[0])
R = int(LR[1])
S = []

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
L,R = map(int,input().split())
x = np.arange(L,R+1)
m = sorted(np.mod(x,2019))
print(m[0]*m[1])

Submission status: Runtime Error

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
            if mod != 1:
                 a.append(mod)
            else:
                flag = True
                break
        if flag:
            break
        else:
            b.append(min(a))
    if flag:
        print(1)
    else:
        print(min(b))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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 range(L):
    for k in range(R):
      if j!=k:
        if (j*k)%2019<m:
          m=(j*k)%2019
  print(m)

Submission status: Runtime Error

Solution code:
import itertools
LR = input().split(' ')
L = int(LR[0])
R = int(LR[1])

min_num = 2000000001
store = [0,0]
num_list = range(L,R+1)
combination_list = list(itertools.combinations(num_list,2))

for comb in combination_list:
    mod = (comb[0]% 2019) * (comb[1]% 2019 ) 
    if mod < min_num:
        min_num = mod
        if mod == 0:
            break

print(min_num)

Submission status: Runtime Error

Solution code:
import itertools
LR = input().split(' ')
L = int(LR[0])
R = int(LR[1])

min_num = 2000000001
store = [0,0]
num_list = range(L,R+1)
combination_list = list(itertools.combinations(num_list,2))

for comb in combination_list:
    mod = (comb[0] * comb[1] ) % 2019
    if mod < min_num:
        min_num = mod
        if mod == 0:
            break

print(min_num)

Submission status: Runtime Error

Solution code:
import itertools
LR = input().split(' ')
L = int(LR[0])
R = int(LR[1])

min_num = 2000000001
store = [0,0]
num_list = range(L,R+1)
combination_list = list(itertools.combinations(num_list,2))

for comb in combination_list:
    mod = (comb[0] * comb[1] ) % 2019
    if mod < min_num:
        min_num = mod
        store[0] = comb[0]
        store[1] = comb[1]

print(' '.join(map(str,store)))

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
c=r-l
if c>=2018:
    print(0)
else:
    for i in range(l,r-1):
        for k in range(l+1,r):
            d=2018
            if (i*k)%2019<d:
                d=(i*k)&2019
    print(d)

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
c=r-l
if c>=2018:
    print(0)
else:
    for i in range(l,r-1):
        for k in range(l+1,n):
            d=2018
            if (i*k)%2019<d:
                d=(i*k)&2019
    print(d)

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
c=r-l
if c>=2018:
    print(0)
else:
    for i in range(l,r-1):
        for k in range(l+1,n):
            c=2018
            if (i*k)%2019<c:
                c=(i*k)&2019
    print(c)

Submission status: Runtime Error

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

l = l%2019
r = r%2019

for n in range(l,r+1):
    for m in range(n+1,r+1):
        tmp = n*m%2019
        if tmp == 0:
            print(0)
            exit()
        ans.append(tmp)
print(min(ans))

Submission status: Runtime Error

Solution code:
L, R = map(lambda x: int(x),input().split(" "))
num_list = []

while L > 2019:
  L = int(L%2019)
  R = int(R%2019)

if R < 2019:
  for i in range(L,R):
    for j in range(L+1,R+1):
      num_list.append((i*j)%2019)
  print(min(num_list))
elif L <= 2019 and R >= 2019:
  print(0)

Submission status: Runtime Error

Solution code:
if(modR <= modL):
    modMin = 0
else:
    modMin = 2018

for i in range(modL,modR):
    for j in range(i+1,modR+1):
        modIJ = (i*j)%2019
        # print(i)
        # print(j)
        # print('----')
        #print(modMin)
        #print(modIJ)
        #print('---')
        if modIJ < modMin:
            modMin = modIJ
print(modMin)

Submission status: Runtime Error

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

if r-l+1 >= 2019:
    print(0)
else:
    ans = 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
        if ans == 0:
            break

print(ans)

Submission status: Runtime Error

Solution code:
#######################################
p = 2019

l,r = map(int, input().split())
n = r-l+1

if n==1:
  mini = (l*r)%p
elif n<2*p:
  tmps = [(i*j)%p for i in range(l,r) for j in range(i+1,r+1)]
  mini = min(tmps)

else:
  lis = list(range(l,r+1))[:p+1]
  lis = list(set([li%p for li in lis]))
  tmps = [(i*j)%p for i in lis for j in lis]
  mini = min(tmps)
  #mini = 0

print(mini)

Submission status: Runtime Error

Solution code:
#######################################
p = 2019

l,r = map(int, input().split())
n = r-l+1

if n<2*p:
  tmps = [(i*j)%p for i in range(l,r) for j in range(i+1,r+1)]
  mini = min(tmps)

else:
  lis = list(range(l,r+1))[:p+1]
  lis = list(set([li%p for li in lis]))
  tmps = [(i*j)%p for i in lis for j in lis]
  mini = min(tmps)
  #mini = 0

print(mini)

Submission status: Runtime Error

Solution code:
#######################################
import numpy as np
import math
import copy
import re
import sys
#sys.exit(0)

inf = float("inf")

def check_print(check_flag, text, end="\n"):
  if check_flag:
    print(text, end=end)

def c2i(x):
    if str.isdecimal(x):
        return int(x)
    else:
        return x

def cout(*args):
  arglist = []
  for arg in args:
    if hasattr(arg, "__iter__"):
      arglist.extend(arg)
    else:
      arglist.append(arg)
      
  arglist = list(map(str, arglist))
  print(" ".join(arglist))

#or
#print(" ".join(list(map(str, lis))))
  
def count2(num):
  count=0
  while num%2==0:
    num/=2
    count+=1
  return count

def ketasum(num):
  nums = [int(s) for s in str(num)]
  return sum(nums)

#math
def gcd(a, b): #最大公約数
  while b:
    a, b = b, a % b
  return a

def lcm(a, b): #最小公倍数
  return a * b // gcd (a, b)

def gcd3(lis): #最大公約数(3over)
  ans = lis[0]
  for li in lis:
    ans = gcd(ans,li)

def lcm3(lis): #最小公倍数(3over)
  ans = lis[0]
  for li in lis:
    ans = lcm(ans,li)

def divisor(n): #nの約数を全て求める
  i = 1
  table = []
  while i * i <= n:
    if n%i == 0:
      table.append(i)
      table.append(n//i)
    i += 1
  table = list(set(table))
  return table

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

def is_prime(n):
  for i in range(2, n + 1):
    if i * i > n:
      break
    if n % i == 0:
      return False
  return n != 1

#input stock
"""
n = int(input())

#list
a = list(map(int, input().split()))
a,b = map(int, input().split())

d=[]
for i in range(n):
  d[i]=int(input())

#2dim-list
a = [list(map(int, input().split())) for i in range(n)]

s = input()
ss =  [int(si) for si in s]
"""

#processing stock
"""
a = sorted(a)
a = sorted(a, reverse=True)

"""

#regex
"""
pattern = ""
result = re.search(pattern, s)

result = re.fullmatch(pattern, s)

result = re.finditer(pattern, s)
for res in result:
    print res.group()   # 1回目: ca      2回目: ca   
    print res.start()   # 1回目: 0       2回目: 6      
    print res.end()     # 1回目: 2       2回目: 8      
    print res.span()    # 1回目: (0, 2)  2回目: (6, 8)
"""


#math
"""
#切り捨て
math.floor()
# 切り上げ
math.ceil()
"""

#######################################
p = 2019

l,r = map(int, input().split())
n = r-l+1

if n<2*p:
  mini = 9999999999
  for i in range(l,r):
    for j in range(i+1,r+1):
      tmp = (i*j)%p
      if tmp<mini:
        mini=tmp
else:
  lis = list(range(l,r+1))[:p+1]
  lis = list(set([li%p for li in lis]))
  mini = 9999999999
  for i in lis:
    for j in lis:
      tmp = (i*j)%p
      if tmp<mini:
        mini=tmp

print(mini)

Submission status: Runtime Error

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

tmp=2019//L
ans=0
for i in range(1,tmp+1):
  if i*2019>=L and i*2019<=R:
    print(0)
    break
  if i==tmp:
    print((L%2019*(L+1)%2019)%2019)

Submission status: Runtime Error

Solution code:
import math

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

if r-l > 2019:
    s=list(range(0, 2019))
else:
    s=set()
    for i in range(l, r+1):
        s.add(i%2019)
    s=list(s)

ans=math.inf
for i in range(len(s)):
    for j in range(i+1, len(s)):
        ans=min(ans, (s[i]*s[j])%2019)

print(ans)

Submission status: Runtime Error

Solution code:
import math

l,r=map(int, input().split())
s=set()
for i in range(l+1, r):
    s.add(i%2019)
s=list(s)

ans=math.inf
for i in range(len(s)):
    for j in range(i+1, len(s)):
        ans=min(ans, (s[i]*s[j])%2019)

print(ans)

Submission status: Runtime Error

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

sc = list(combinations(range(l%2019,(r+1)%2019),2))

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
     
    l, r = list(map(int, input().split()))
     
    ans = 2018
     
    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:
          print(ans)
          exit()
     
    print(ans)

Submission status: Runtime Error

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

    for i, j in itertools.combinations(range(l, r+1), 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: Runtime Error

Solution code:
import sys
import itertools

input = sys.stdin.readline

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

    mod_min = 2019

    for i, j in itertools.combinations(range(l, r+1), 2):
        mod = (i*j % 2019)
        if mod < mod_min:
            mod_min = mod
            
    print(mod_min)

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

Submission status: Runtime Error

Solution code:
import heapq
L,R = map(int,input().split())
numMap=[10**19]*(R-L+1)
numheap=[]
k=0

AnsA=0
AnsB=0
for i in range(L,R+1):
    num=i%2019
    heapq.heappush(numheap,num)
    if(num==3):AnsA=1
    if(num==673):AnsB=1
    k+=1

if(AnsA!=0 & AnsB!=0):
    print("0")
else:
    print(heapq.heappop(numheap)*heapq.heappop(numheap))

Submission status: Runtime Error

Solution code:
import heapq
L,R = map(int,input().split())
numMap=[10**19]*(R-L+1)
numheap=[]
k=0

AnsA=0
AnsB=0
for i in range(L,R+1):
    heapq.heappush(numheap,i%2019)
    if(numMap[k]==3):AnsA=i
    if(numMap[k]==673):AnsB=i
    k+=1

if(AnsA!=0 & AnsB!=0):
    print("0")
else:
    print(heapq.heappop(numheap)*heapq.heappop(numheap))

Submission status: Runtime Error

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

if (n // 2019) - (l // 2019) > 0:
	print(0)
else:
	l_s = (l * (l + 1)) % 2019
	n_s = (s * (s - 1)) % 2019
	
	if l_s <= n_s:
		print(l_s)
	else:
		print(n_s)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
X = list(range(L, R+1))
ans = 2020

if (R-L) >= 2018:
    print(0)
else:
    for i in X[:len(X)-1]:
        for j in X[1:]:
            a = ((i%2019)*(j%2019))%2019
            if ans > a:
                ans = a
    print(ans)

Submission status: Runtime Error

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

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

print(min(a))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# import atexit
# import io
import sys
#
 _INPUT_LINES = sys.stdin.read().splitlines()
 input = iter(_INPUT_LINES).__next__
 _OUTPUT_BUFFER = io.StringIO()
 sys.stdout = _OUTPUT_BUFFER
#

 @atexit.register
 def write():
     sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import itertools
L,R=map(int, input().split())
a = range(L, R+1, 1)
b= list(itertools.combinations(a,2))
result = []
for i in b:
  c = (i[0]*i[1])%2019
  result.append(c)
print(min(result))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from itertools import combinations
import math


def solve():
    l, r = map(int, input().split())
    a = 2018
    for i, j in combinations(range(l, r + 1), 2):
        amari = (i * j) % 2019
        if amari == 0:
            return 0
        elif amari < a:
            a = amari
    return a


if __name__ == "__main__":
    print(solve())

Submission status: Runtime Error

Solution code:
def remainder_min(l,r):
    sml = 2*(10**9)**2+1
    lsml = 2*(10**9)**2+1
    rsml = 2*(10**9)**2+1
    for i in range(l,r):
        lrem = i % 2019

        if lsml > lrem:
            lsml = lrem
            break
        else:
            break

    for j in range(l+1,r+1):
        rrem = j % 2019

        if rsml > rrem:
            rsml = rrem
            break
        else:
            break

    return lrem*rrem


if __name__ == '__main__':
    l,r = map(int,raw_input().split())
    print remainder_min(l,r)

Submission status: Runtime Error

Solution code:
def remainder_min(l,r):
    opt = 0
    gt = 2*(10**9)**2+1
    for j in range(l,r+1):
        for i in range(l,j):
            opt = (i * j) % 2019
#            print("i = %d, j = %d, opt = %d" %(i,j,opt))
            if gt > opt:
                gt = opt
    return gt
if __name__ == '__main__':
    l,r = map(int,raw_input().split())
    print remainder_min(l,r)

Submission status: Runtime Error

Solution code:
    opt = 0
    gt = 2*(10**9)**2+1
    for j in range(l,r+1):
        for i in range(l,j):
            opt = (i * j) % 2019
            if gt > opt:
                gt = opt
    return gt
if __name__ == '__main__':
    l,r = map(int,raw_input().split())
    print remainder_min(l,r)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# import numpy as np
# import copy

def main():
    l,r = [ int(i) for i in input().split(' ')]
    count = 0
    lst = []
    for i in range(l + 1,r):


        lst.append(i%2019)
        if(count > 2020):
            break
        count = count + 1

    print(min(lst))

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
left, right = map(int, input().split())
imod = []
jmod = []

for i in range(left, right):
    imod.append(i % 2019)

for i in range(imod.index(min(imod))+1, len(imod)):
    jmod.append(imod[i])

print((min(imod) + min(jmod)) % 2019)

Submission status: Runtime Error

Solution code:
left, right = map(int, input().split())
imod = []
jmod = []

for i in range(left, right):
    imod.append(i % 2019)

for i in range(imod.index(min(imod))+1, len(imod)):
    jmod.append(imod[i])

print(min(imod) * min(jmod) % 2019)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
m = 2019
l, r = l%m, l%m+(r-l)
if r-l >= m-1:
    print(0)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# set environment
import numpy as np
 
# input
L, R = map(int, input().split())
 
# matrix multiplication
R += 1
a = np.arange(L,R).reshape(1, R-L)
b = np.arange(L,R).reshape(R-L,1)
result = np.dot(b, a) % 2019
result[np.eye(R-L, dtype=bool)] = 2019
ans = np.amin(result)
print(ans)
#print(result)

Submission status: Runtime Error

Solution code:
# set environment
import numpy as np

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

# matrix multiplication
R += 1
a = np.arange(L,R).reshape(1, R-L)
b = np.arange(L,R).reshape(R-L,1)
result = np.dot(b, a)
np.amax(result)
result = result % 2019
result[np.eye(R-L, dtype=bool)] = 2019
ans = np.amin(result)
print(ans)
#print(result)

Submission status: Runtime Error

Solution code:
# set environment
import numpy as np

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

# matrix multiplication
a = np.arange(L,R+1).reshape(1, R-L+1)
b = np.arange(L,R+1).reshape(R-L+1,1)
result = np.dot(b, a)
np.amax(result)
result = result % 2019
result[np.eye(R-L+1, dtype=bool)] = 2019
ans = np.amin(result)
print(ans)
#print(result)

Submission status: Runtime Error

Solution code:
# set environment
import numpy as np

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

# matrix multiplication
a = np.arange(L,R+1).reshape(1, R-L+1)
b = np.arange(L,R+1).reshape(R-L+1,1)
result = np.dot(b, a)
np.amax(result)
result = result % 2019
result[np.eye(12-6+1, dtype=bool)] = 2019
ans = np.amin(result)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(min([(i*j)%2019 for i in range(L, R-1) for j in range(i, R)]))

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
c = [0]*(b-a+1)
j = 0
for i in range(a,b+1):
    c[j] = i%2019
    j += 1
x = min(c)
c.remove(x)
y = min(c)
print((x*y)%2019)

Submission status: Runtime Error

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

main()

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
mod = 2019
if r - l > 3000:
  print(0)
else:
  ans = mod
  for i in range(l, r + 1):
    for j in range(r, l, -1):
      #print(str(i) + ' ' + str(j))
      if j <= i: break
      ans = min(ans, (i * j) % mod)
print(ans)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
if r - l > 3000:
  print(0)
else:
  ans = 2000
  for i in range(l, r + 1):
    for j in range(r, l, -1):
      #print(str(i) + ' ' + str(j))
      if j <= i: break
      ans = min(ans, (i * j) % 2019)
print(ans)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
if r - l > 3000:
  print(0)
else:
  ans = 2000
  for i in range(l, r + 1):
    for j in reversed(range(l, r + 1)):
      #print(str(i) + ' ' + str(j))
      if j <= i: break
      ans = min(ans, (i * j) % 2019)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019
min = 2019


for i in range(LL, RR+1):
	for j in range(i+1, RR+1):
    	if (i*j)%2019 == 0:
        	min = 0
        	break
        elif (i*j)%2019 < min:
            min= (i*j)%2019


print(min)

Submission status: Runtime Error

Solution code:
import numpy as np
L = int(input())
R = int(input())

ans = 2019*2019

if(R-L >=2019):
    print(0)
else:
    for i in range(L,R-1):
        for j in range(i+1,R):
            ans = np.minimum(ans,(i*j)%2019)
            if(ans == 0):
                print(0)
                exit()
    print(ans)

Submission status: Runtime Error

Solution code:
def solve(left, right):
    if right - left >= 2019:
        return 0
    l_mod = left % 2019
    r_mod = right % 2019
    if r_mod < l_mod:
        return 0
    ans = 2019
    for i in range(l_mod, r_mod + 1):
        for j in range(i + 1, r_mod + 1):
            ans = min(ans, i * j % 2019)
    return ans
 L, R = map(int, input().split())
 print(solve(L, R))

Submission status: Runtime Error

Solution code:
def main():

p = 2019
L, R = list(map(int, input().split()))
if (R - L) >= (p -1):
  ans = 0
  print(ans)
else:
  L, R = 
  if L < R:
    ans = L * (L+1)
  else:
    ans = 0
  print(ans)
  
main()

Submission status: Runtime Error

Solution code:
def main():

p = 2019
L, R = list(map(int, input().split()))
if (R - L) >= (p -1):
  ans = 0
  print(ans)
else:
  L, R = [x % p for x in [L, R]]
  if L < R:
    ans = L * (L+1)
  else:
    ans = 0
  print(ans)
  
main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
if r - l > 3000:
  print(0)
else:
  ans = 3000
  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: Runtime Error

Solution code:
N = R - L
A = []
A.append(10000)
if(L >= R):
    print(0)
elif(L == 0):
    print(0)
else:
    if(N = 1):
        print((L * R) % 2019)
    else:
        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: Runtime Error

Solution code:
#abc133c

l,r=map(int,raw_input().split())
if r-l>3000:
 print 0
 sys.exit()
res=-1
for i in xrange(l,r):
 for j in xrange(i+1,r+1):
  res=min(res,(i*j)%2019)
print res