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:
#include<bits/stdc++.h>
using namespace std;
int main(){
        int l, r;
        cin >> l >> r;
        if(r-l>2019) r = l+2020;
        int ans = 2000000001;
        for(int i=l; i<r; i++){
                for(int j=i+1; j<=r; j++){
                        ans = min(ans, i*j%2019);
                }
        }
        cout << ans << endl;
}

Submission status: Runtime Error

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

print((a)%2019)

Submission status: Runtime Error

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

print((a*b)%2019)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
L, R = [int(i) for i in input().split()]
min = 2018
if (R-L)>=2019:
    a = (R-L)/2019
    R = R-2019*a
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j)%2019
        if(mod<min):
            min = mod
print("{}".format(min))

Submission status: Runtime Error

Solution code:
L, R = [int(i) for i in input().split()]
min = 2018
if (R-L)>=2019:
    a = R/2019
    R = R-2019*a
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j)%2019
        if(mod<min):
            min = mod
print("{}".format(min))

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
number = list(range(L, R + 1))
min = 2100
for i in range(len(number) - 1):
    j = i + 1
    while(j < len(number)):
        if(min > number[i] * number[j] % 2019):
            min =  number[i] * number[j] % 2019
        if(min == 0):
            break
        j += 1
    if(min == 0):
        break
print(min)

Submission status: Runtime Error

Solution code:
import numpy as np

inp = list(map(int, input().split()))

L = inp[0]
R = inp[1]


mod = []
for i in range(R-L):
  if(L+i >= 2019):
    break
  for j in range(R-L-i):
    if(L+i+j+1>=2019):
      break
    else:
      mod.append(((L+i)*(L+i+j+1))%2019)


print(min(mod))

Submission status: Runtime Error

Solution code:
import numpy as np

inp = list(map(int, input().split()))

L = inp[0]
R = inp[1]


mod = []
for i in range(R-L):
  	if(L+i >= 2019):
    	break
	for j in range(R-L-i):
      if(L+i+j+1>=2019):
        break
      else:
        mod.append(((L+i)*(L+i+j+1))%2019)


print(min(mod))

Submission status: Runtime Error

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

if R-L >= 2019:
    print('0')
else:
    for i in range(L, R+1):
        if (i % 2019) < mini:
            mini = i % 2019
            ans = i
            if i % 2019 == 0:
                ans = 0
                print('0')
                break

        for j in range(L, R+1):
            if j == ans:
                continue
            if (j % 2019) < minib:
                minib = j % 2019
                sansb = j

    calc = ((ans%2019) * (ansb%2019)) % 2019
    print(calc)

Submission status: Runtime Error

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 :
            if M=0:
                sys.exit()
            M = (i*j)%2019
    
 print(M)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int l,r; cin >> l >> r;
    int ans = 2018;

    if (r-l <= 2019)
    {
        for (int i = l; i <= r; ++i)
        {
            for (int j = i+1; j <= r; ++j)
                ans = min(ans, ((i%2019)*(j%2019))%2019);
        }
        cout << ans;
        return 0;
    }

    cout << 0;
  	return 0;
}

Submission status: Runtime Error

Solution code:
import sys
import math
import numpy as np
INF = 1000000000
MOD = 2019


def input():
    return sys.stdin.readline().rstrip()


def main():
    l, r = [int(e) for e in input().split()]
    ans = INF
    for i in range(l, min(l + MOD, r + 1)):
        for j in range(j + 1, min(l + MOD, r + 1)):
            ans = min(ans, ((i % MOD) * (j % MOD)) % MOD)
    print(ans)


main()

Submission status: Runtime Error

Solution code:
import math
import sys
import itertools
import queue
from fractions import gcd
import numpy as np


def lcm(a, b):
    return a * b // gcd(a, b)

mod = 2019

if __name__ == "__main__":
    L,R= map(int, sys.stdin.readline().split())
    if R-L>=2018:
        print(0)
    else:
        ans=2019
        for i in range(L,R):
            for j in range(i+1,R+1):
                ans=min(ans,(j*i)%mod)
    print(ans)

Submission status: Runtime Error

Solution code:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd
import numpy as np


def lcm(a, b):
    return a * b // gcd(a, b)

mod = 2019

if __name__ == "__main__":
    L,R= map(int, sys.stdin.readline().split())
    if R-L>=2018:
        R=L+2018
    else:
        ans=2019
        for i in range(L,R):
            if i%mod==0:
                pass
            else:
                for j in range(i+1,R+1):
                    ans=min(ans,(j*i)%mod)
                # l=[(j*i)%mod for j in range(L+1,R)]
    print(ans)

Submission status: Runtime Error

Solution code:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd
import numpy as np


def lcm(a, b):
    return a * b // gcd(a, b)

mod = 2019

if __name__ == "__main__":
    l=[]
    L,R= map(int, sys.stdin.readline().split())
    if R-L>2019:
        print(0)
    else:
        ans=2019
        for i in range(L,R):
            for j in range(i+1,R+1):
                ans=min(ans,(j*i)%mod)
            # l=[(j*i)%mod for j in range(L+1,R)]
    print(ans)

Submission status: Runtime Error

Solution code:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd
import numpy as np


def lcm(a, b):
    return a * b // gcd(a, b)

mod = 2019

if __name__ == "__main__":
    l=[]
    L,R= map(int, sys.stdin.readline().split())
    if R-L>2019:
        R=L+2018
    else:
        ans=2019
        for i in range(L,R):
            if i%mod==0:
                pass
            else:
                for j in range(i+1,R+1):
                    ans=min(ans,(j*i)%mod)
                # l=[(j*i)%mod for j in range(L+1,R)]
    print(ans)

Submission status: Runtime Error

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

remainder_list = []

if r - l >= 2019:
  print(0)
else :
  for x in range(l, r):
    remainder_list.append((l * (x + 1)) % 2019)

remainder_list.sort()
print(remainder_list[0])

Submission status: Runtime Error

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

remainder_list = []

if r - l >= 2019:
	print(0)
else :
	for x in range(l, r):
    	remainder_list.append((l * (x + 1)) % 2019)

remainder_list.sort()
print(remainder_list[0])

Submission status: Runtime Error

Solution code:
A=[int(x) for x in input().spilt()]

N=[i for i in range(A[0],A[1]+1)]

N.sort()
print((N[0]*N[1])%2019)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import itertools
L , R  = map(int,input().split())
num_list = list(range(L,R+1))
mod = None
for j in itertools.combinations(num_list,2):
	if mod == None or mod >= (j[0]*j[1])%2019:
		mod=(j[0]*j[1])%2019
	if (j[0]*j[1])%2019 == 0:
		mod=(j[0]*j[1])%2019
		break
print(mod)

Submission status: Runtime Error

Solution code:
import itertools
L , R  = map(int,input().split())
num_list = list(range(L,R+1))
mod = None
for j in itertools.combinations(num_list,2):
	if mod == None or mod >= (j[0]*j[1])%2019:
		mod=(j[0]*j[1])%2019
print(mod)

Submission status: Runtime Error

Solution code:
import itertools
L , R  = map(int,input().split())
num_list = list(range(L,R+1))
mod = None
for j in itertools.combinations(num_list,2):
	if mod == None or mod >= (j[0]*j[1])%2019
	mod=(j[0]*j[1])%2019
print(mod)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

if R-L >2019:
  l = L%2019
  for i in range(2019):
    ln = []
    for j in range(2019):
    	ln1 = []
    	ln1[j] = (l+j)*(l+i+1)%2019
        ln[i] = min(ln1)
  print(min(ln))
else:
  l = L%2019
  r = l+R-L
  n = r-l
  for i in range(n):
    ln = []
    for j in range(n):
      ln1[j] = (l+j)*(l+i+1)%2019
      ln[i] = min(ln1)
  print(min(ln))

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

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

    ret = 2020
    for i in itertools.combinations(range(l,r+1,1),2):
        ret = min(ret,(i[0]*i[1])%2019)
        print(i,ret)
print(ret)

Submission status: Runtime Error

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

print(m)

Submission status: Runtime Error

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

print(m)

Submission status: Runtime Error

Solution code:
L,R = map(int,input()split())
 
x = 2019**2
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if x > ans:
            x = ans
            if x == 0:
        	    break
    if x == 0:
      break
print(x)

Submission status: Runtime Error

Solution code:
L,R = map(int,input()split())
 
x = 2019**2
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if x > ans:
            x = ans
            if x == 0:
        	    break
    if x == 0:
      break

Submission status: Runtime Error

Solution code:
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if x > ans:
            x = ans
            if x == 0:
        	    break
    if x == 0:
      break

Submission status: Runtime Error

Solution code:
def main(L,R):
    mod_min = 2019
    if L // mod_min == R // mod_min:
        L %= mod_min
        R %= mod_min
        for i in range(L,R):
            for j in range(i+1, R+1):
                Y = i*j % 2019
                if Y < mod_min:
                    mod_min = Y
    else:
        mod_min = 0
    return mod_min
print(main(L,R))

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
from itertools import combinations
 
mod = 2019
mini = mod - 1
for i, j in combinations(range(L, R+1), 2):
    x, y = i%mod, j%mod
    mini = min(mini, x*y % mod)
    if mini == 0:
        break
print(mini)

Submission status: Runtime Error

Solution code:
s = input().rstrip().split(' ')
L = int(s[0])
R = int(s[1])
cnt = (L*(L+1)) % 2019
 
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if ans < cnt:
            cnt = ans
        if cnt == 0:
          print(0)
        	exit()   
print(cnt)

Submission status: Runtime Error

Solution code:
L,R = (int(i) for i in input().split()) 
n = [i for i in range(L,R)]
l = len(n)
m =(n[0]*n[1]) %2019
for i in range(1,l-1):
  for j in range(i+1,l+1):
    if (n[i]*n[j]) %2019< m:
      m = (n[i]*n[j]) %2019
      
print(m)

Submission status: Runtime Error

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

mod = 2019
mini = mod - 1
for i, j in combinations(range(L, R+1), 2):
    i, j = i%mod, j%mod
    mini = min(mini, i*j % mod)
    if mini == 0:
        break
print(mini)

Submission status: Runtime Error

Solution code:
L,R = (int(i) for i in input().split()) 
n = [i for i in range(L,R)]
l = len(n)
m =(n[0]*n[1]) %2019
for i in range(1,l-1):
  for j in range(i+1,l):
    if (n[i]*n[j]) %2019< m:
      m = (n[i]*n[j]) %2019
      
print(m)

Submission status: Runtime Error

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

mod = 2019

for i, j in combinations(range(L, R+1), 2):
    i, j = i%mod, j%mod
    mini = min(mini, i*j % mod)
    if mini == 0:
        break
print(mini)

Submission status: Runtime Error

Solution code:
from itertools import combinations

mod = 2019

for i, j in combinations(range(L, R+1), 2):
    i, j = i%mod, j%mod
    mini = min(mini, i*j % mod)
    if mini == 0:
        break
print(mini)

Submission status: Runtime Error

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

Solution code:
import numpy as np

L, R = map(int, input().split(" "))
arr = np.array(np.arange(L, R+1))
mod_list = []
min_mod_list = []

if (0 in (arr % 2019)) or (0 in arr):
  print(0)
else:
  for i in arr:
    mod_list = []
    index_ = np.where(arr==i)
    if i == arr[-1]:
      break

    for j in arr[int(index_[0])+1:]:
      mod_list.append((i * j) % 2019)
     
    min_mod_list.append(min(mod_list))
    if min(mod_list) == 0:
      break
    
    
  print(min(min_mod_list))

Submission status: Runtime Error

Solution code:
import sys

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

    if L == 0:
        return 0

    if (R // 2019) > ((L-1) // 2019):
        return 0

    if (R // 673) > ((L-1) // 673):
        if R - L >= 2:
            return 0
        if (R % 3) == 0 or (L % 3) == 0:
            return 0

    left = L % 2019
    return (left * (left + 1)) % MOD


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

Submission status: Runtime Error

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

mod = 2019

mini = mod-1
for i, j in combinations(range(L, R+1), 2):
    mini = min(mini, i*j % mod)
    if mini == 0:
        break
print(mini)

Submission status: Runtime Error

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

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

print(min(mod))

Submission status: Runtime Error

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

if r-l > 2019:
    print(0)
else:
    import itertools
    ret = 2020
    for i in itertools.combinations(list(range(l,r+1,1)),2):
        ret = min(ret,(i[0]*i[1])%2019)
       #print(i,ret)

print(ret)

Submission status: Runtime Error

Solution code:
L,R= map(int,input().split())
#境界条件
bool = True
l = L % 2019
r = R % 2019
if L ==0:
    ans = 0
elif R = L+1:
    ans = R*L%2019
else:
    if L == R:
        ans = L * R %2019
    if l >= r:
        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: Runtime Error

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

Submission status: Runtime Error

Solution code:
L,R= map(int,input().split())
#境界条件
bool = True
l = L % 2019
r = R % 2019
# if L == R:
#     ans = L * R %2019
# if l >= r:
#     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: Runtime Error

Solution code:
s = input().split()
L = int(s[0])
R = int(s[1])
 
L = L%2019
R = R%2019
MIN = 2020
if R - L >= 2019:
    flag = True

for i in range(min(L,R),max(L,R)+1):
    for j in range(i,max(L,R)+1):
        if i != j:
            mod = i*j
            MIN = min(MIN,mod%2019)
if R == 0 or L == 0 or flag:
    print(0)
elif abs(R - L) == 1:
    print((R*L)%2019)
elif R == L:
    print((R*L)%2019)
else:
    print(MIN)

Submission status: Runtime Error

Solution code:
import numpy as np

L, R = list(map(int, input().split()))
data = np.array([x for x in range(L, R+1)]) % 2019
data = np.unique(data)
length = R - L

min_mod = 2018
for t in range(length):
    i = length - t
    for j in range(i):
        mod = data[i] * data[j] % 2019
        min_mod = mod if min_mod > mod else min_mod
        if min_mod == 0:
            break
        
print(min_mod)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if r-l > 2019:
    print(0)
else:
    ret = 2020
    for i in range(l,r+1,1):
        for j in range(l,r+1,1):
            if i == j:
                continue
            ret = min(ret,(i*j)%2019)
print(ret)

Submission status: Runtime Error

Solution code:
import numpy as np

L, R = list(map(int, input().split()))
data = np.array([x for x in range(L, R+1)]) % 2019
data = np.unique(data)
length = R - L

min_mod = 2018
for t in range(length):
    i = length - t
    for j in range(i):
        mod = data[i] * data[j] % 2019
        min_mod = mod if min_mod > mod else min_mod
        
print(min_mod)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

mod = 2019

for i, j in combinations(range(L, R+1), 2):
    mini = min(mini, i*j % mod)
    if mini == 0:
        break
print(mini)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
 
L, R = map(int, input().split())
modL = L % 2019
modR = R % 2019
 
if R - L > 2019:
  print(0)
else:
	modlist = [(L + i) % 2019 for i in range(min(2019, R-L))]
    min_ = pop(modlist(0))
	print(min_ * min(modlist))

Submission status: Runtime Error

Solution code:
import numpy as np

L, R = list(map(int, input().split()))
data = np.array([x for x in range(L, R+1)]) % 2019
data = np.unique(data)
length = R - L

min_mod = 2018
for t in range(length):
    i = length - t
    for j in range(i):
        mod = data[i]* data[j]
        min_mod = mod if min_mod > mod else min_mod
        
print(min_mod)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if r-l > 2019:
    print(0)
else:
    ret = 2020
    for i in range(l,r+1,1):
        for j in range(l,r+1,1):
            ret = min(ret,(i*j)%2019)

print(ret)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys
import numpy as np
from itertools import combinations


def answer(L, R):
    return min([np.mod(i*j, 2019) for i, j in combinations(range(L, R+1, 1), 2)])


if __name__ == '__main__':
    args = sys.stdin.read().split()
    print(answer(int(args[0]), int(args[1])))

Submission status: Runtime Error

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

if r-l > 2019:
    print(0)
else:
    ret = 2020
    for i in range(l,r+1,1):
        for j in range(l,r+1,1):
            ret = min(ret,i*j%2019)

print(ret)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
c = 2019

for i in range(a, b):
  for j in range(a + 1 , b + 1):
    c = min(c, i * j % 2019)
    if c == 0:
    	print(c)
        exit()
print(c)

Submission status: Runtime Error

Solution code:
def main():
  min_max=0
  f_1=2+10**9
  f_2=2+10**9
  min_d=2019
  min_d2=2019
  L,R=map(int,input().split())
  for i in range(L,R+1):
    a=i%2019
    if a<=min_d and a<=min_d2:
      min_d2=min_d
      min_d=a
      f_2=f_1
      f_1=i
    elif a<=min_d2:
      f_2=i
      min_d2=a
    if a==0:
      break
  print((f_1*f_2)%2019)
  
main()
def main():
  min_max=0
  f_1=2+10**9
  f_2=2+10**9
  min_d=2019
  min_d2=2019
  L,R=map(int,input().split())
  for i in range(L,R+1):
    a=i%2019
    if a<=min_d and a<=min_d2:
      min_d2=min_d
      min_d=a
      f_2=f_1
      f_1=i
    elif a<=min_d2:
      f_2=i
      min_d2=a
    if a==0:
      break
  print((min_d*min_d2)%2019)
  
main()

Submission status: Runtime Error

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 = ij % 2019

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

Submission status: Runtime Error

Solution code:
L,R = list(map(int,input().split()))
Y = []
for i in range(L, R):
    if i == 0:
        j = 1
        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: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys
from itertools import combinations


def answer(L, R):
    return min([divmod(i*j, 2019)[1] for i, j in combinations(range(L, R+1, 1), 2)])


if __name__ == '__main__':
    args = input().split()
    print(answer(int(args[0]), int(args[1])))

Submission status: Runtime Error

Solution code:

L,R = list(map(int,input().split()))
Y = []
for i in range(L, R):
    if i == 0:
        j = 1
        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: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import numpy as np

L, R = map(int, input().split(" "))
arr = np.array(np.arange(L, R+1))
mod_list = []
min_mod_list = []

if (0 in (arr % 2019)) or (0 in arr):
  print(0)
else:
  for i in arr:
    mod_list = []
    index_ = np.where(arr==i)
    if i == arr[-1]:
      break

    for j in arr[int(index_[0])+1:]:
      mod_list.append((i * j) % 2019)
    
    min_mod_list.append(min(mod_list))
    
  
  print(min(min_mod_list))

Submission status: Runtime Error

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

if l*r < 2019:
    print(l*r)
else:
    c = r - l
    for i in range(l, l + c):
        for j in range(i+1, l + c):
            v.append(i*j%2019)
            if v[-1] == 0:
                break
        else:
            continue
        break

    print(min(v))

Submission status: Runtime Error

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

print(min(a))

Submission status: Runtime Error

Solution code:
from itertools import combinations

mod = 2019
l, r = L % mod, R % mod
if l > r:
    l, r = r, l

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

Submission status: Runtime Error

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

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

Solution code:
L,R = [int(x) for x in input().split()]
 
#L = input_arr[0]
#R = input_arr[1]
 
min_ans = 10**18
for i in range(L+1,R+1):
  if ans < min_ans:
    min_ans = ans
  if min_ans == 0:
    break

print(min_ans)

Submission status: Runtime Error

Solution code:
import itertools
L,R = map(int, input().strip().split(' '))
min_m = float('inf')
for i,j in itertools.combinations(range(L,R+1), 2):
  min_m = min((i*j)%2019, min_m)
  if min_m == 0:
    break
print(min_m)

Submission status: Runtime Error

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

    ans = L * R % 2019
    if R - L >= 2019
        ans = 0
    else:
        l = L % 2019
        r = R % 2019
        if l == r:
            ans = 2*l
        else:
            ans = min(l*(l+1), l*r)

    print(ans)


if __name__ == '__main__':
    main()