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())
if r-l >= 2017:
	print (0)
	exit()
else:
	for i in range(l,r+1):
		for j in range(i+1,r+1):
			a = min(a,i*j%2019)
print (a)

Submission status: Runtime Error

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

#define ll long long
            
int main() {
    int L, R;
    cin >> L >> R;
  
    int range = R - L;
    vector<int> mod;
  
    if (range >= 2019) {
        cout << 0 << endl;
    } else {
        for (int i = 0; i < (range + 1); i++) {
            for (int j = 1; j <= (range - i); j++) {
                int ij = (L + i) * (L + i + j);
                mod.push_back(ij % 2019);
            }
        }
        vector<int>::iterator iter = min_element(mod.begin(), mod.end());
        cout << *iter << endl;
    }
  
    return 0;
}

Submission status: Runtime Error

Solution code:
import heapq
L,R = map(int, input().split())
if R - L >= 672:
    print(0)
    exit()
else:
    hq3 = []
    hq673 = []
    hq2019 = []
    for i in range(L, R+1):
        heapq.heappush(hq2019, i%2019)
        heapq.heappush(hq673, i%673)
        heapq.heappush(hq3, i%3)
    a = heapq.heappop(hq2019)
    b = heapq.heappop(hq673)
    c = heapq.heappop(hq3)
    if a == 0:
        print(0)
        exit()
    elif b == 0 and c == 0:
        print(0)
        exit()
    else:
        print(heapq.heappop(hq) * a % 2019)

Submission status: Runtime Error

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

flag=True
if (R - L) >= 2019:
  print(0)
else:
  min_mod = 2019
  for i in range(L, R):
    for j in range(i+1, R+1):
      tmp = (i*j) % 2019
      if tmp == 0:
        print(0)
        flag=False
        break
      elif tmp < min_mod:
        min_mod = tmp
    if flag==False:
      break

if flag==True:
  print(min_mod)

Submission status: Runtime Error

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

flag=True
if (R - L) >= 2019:
  print(0)
else:
  min_mod = 2019
  for i in range(L, R):
    for j in range(i+1, R+1):
      tmp = (i*j) % 2019
      if tmp == 0:
        print(0)
        flag=False
        break
      elif tmp < min_mod:
        min_mod = tmp
    if flag==False:
      break

if (flag):
  print(min_mod)

Submission status: Runtime Error

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

flag=True
if (R - L) >= 2019:
  print(0)
else:
  min_mod = 2020
  for i in range(L, R):
    for j in range(i+1, R+1):
      tmp = (i*j) % 2019
      if tmp == 0:
        print(0)
        flag=False
        break
      elif tmp < min_mod:
        min_mod = tmp

if (flag):
  print(min_mod)

Submission status: Runtime Error

Solution code:
L,R=map(int, input().split())
from itertools import permutations, combinations,combinations_with_replacement,product
for 
if (R+1-L)<2019:
  LR = range(L,R+1)
  LRA = []
  for i in LR:
    LRA.append(i%2019)
  LRAA = set(LRA)
  C = combinations(LRAA, 2)
  Ret = 2019
  for i in list(C):
    Ret = min(Ret,(i[0]*i[1])%2019)
else:
  Ret = 0
print(Ret)

Submission status: Runtime Error

Solution code:
L,R=map(int, input().split())
LR = range(L,R+1)
from itertools import permutations, combinations,combinations_with_replacement,product
C = combinations(LR, 2)
Ret = 2019
for i in C:
  Ret = min(Ret,(i[0]*i[1])%2019)
print(Ret)

Submission status: Runtime Error

Solution code:
import math

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

Submission status: Runtime Error

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

if r-l>=2019:
    print(0)
else:
    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())
min1=2018
if r-l>=2018:
  print(0)
  exit()
else:
  for i in range(l,r):
    for j in range(i+1,r+1):
      min=min(i*j%2019,min1)
print(min1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
tmp = list(map(int,input().split()))
L = tmp[0] % 2019
R = tmp[1] % 2019
l = tmp[0]//2019
r = tmp[1]//2019
if l == r:
  num_list = []
  for i in range(tmp[0],tmp[1]+1,1):
    for k in range(i+1,tmp[1],1):
      num_list.append((i*k) % 2019)
  print(min(num_list))
else:
  print(0)

Submission status: Runtime Error

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

LR = np.arange(L, R+1, dtype="int64")
LR %= 2019
LR.sort

print(LR[0] * LR[1])

Submission status: Runtime Error

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

LR = np.arange(L, R+1, dtype="int")
LR %= 2019
LR.sort

print(LR[0] * LR[1])

Submission status: Runtime Error

Solution code:
L,R = map(int,input().split())
tmp = list(range(L,R+1))
mod = []
rem = []
for i in tmp:
    if i%2019 not in mod:
        mod.append(i%2019)
        rem.append(i)
    if len(mod) == 2019:
        break
ans = 2019
for i in rem:
    for j in rem:
        if i*j%2019 < ans and i < j:
            ans = i*j%2019
        if ans == 0:
            break
print(ans)

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split(' '))
l,r=L%2019,R%2019
D=R-L
d=r-l
if D<2019:
  if D==d:
    if 
    print( (l*(l+1))%2019 )
  else:
    print(0)
else:
  print(0)

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
lst=list(range(l,r+1))
lst1=lst[:min(2020,r-l+2)]
def div(n):
  return n%2019
lst1=list(map(div,lst1))
lst1.sort()
print(lst1[0]*lst1[1])

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
lst=list(range(l,r+1))
lst1=lst[:min(2020,r-l+2)]
def div(n):
  return n%2019
lst1=map(div,lst1)
lst1.sort()
print(lst1[0]*lst1[1])

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
lst=list(range(l,r+1))
def div(n):
  return n%2019
lst1=map(div,lst)
lst1.sort()
print(lst1[0]*lst1[1])

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
lst=range(l,r+1)
def div(n):
  return n%2019
lst=map(div,lst)
lst.sort()
print(lst[0]*lst[1])

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
lst=[range(l,r+1)]
def div(n):
  return n%2019
lst=map(div,lst)
lst.sort()
print(lst[0]*lst[1])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
list(combinations([i for i in range(_[0],_[1]+1)],2)if _[1]-_[0]<2019else combinations([i for i in range(_[0],_[0]+2020)],2))

Submission status: Runtime Error

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

l_mod = l % 2019
r_mod = r % 2019
li = []

if r - l > 2018:
    ans = 0
else:
    for i in range(l,r):
        for j in range(i + 1,r + 1):
            li.append((i * j) % 2019)

ans = min(li)

print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
l = lr[0]
r = lr[1]
 
ans=2019
l_2019 = l % 2019
r_2019 = r % 2019
 
for i in range(l_2019,r_2019):
    for j in range(i+1, r_2019+1):
        new_ans = (i * j) % 2019
        if new_ans < ans:
            ans = new_ans
        
print(ans)

Submission status: Runtime Error

Solution code:
l = lr[0]
r = lr[1]
 
ans=2019
l_2019 = l % 2019
r_2019 = r % 2019
 
for i in range(l_2019,r_2019):
    for j in range(i+1, r_2019+1):
        new_ans = (i * j) % 2019
        if new_ans < ans:
            ans = new_ans
        
print(ans)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
m = []
if l == r:
  print(l%2019 * l%2019)
else:
  if r - l < 2019:
    for i in range(l, r+1):
      m.append(i%2019)
  else:
    for i in range(l, l+2020):
      m.append(i%2019)
  m = sorted(m)
  print(

Submission status: Runtime Error

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

li_w = sorted(x % 2019 for x in range(L, R))[0:2]
print(li_w[0] * li_w[1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

l=L%2019
r=R%2019

ans=0

if R-L<2019 and l<r:
    D=[]
    for i in range(l,r):
        for j in range(i+1,r+1):
            D.append((i*j)%2019)

ans=min(D)

print(ans)

Submission status: Runtime Error

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

if r-l > 3000:
    print(0)
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:
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*j)%2019)

print(min(a))

Submission status: Runtime Error

Solution code:
def solve():
    x = int(input())
    l = [i**j for i in range(1,x+1) for j in range(1,x+1) if i**j<=x]
    return max(l)
        
if __name__ == '__main__':
    print(solve())

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
# L <= i < j <= R
# (i*j)%2019 の最小値
M=[]
for i in range(L, R):
    for j in range(i+1, R+1):
        #print(i,j)
        M.append((i*j)%20119)
        if M[-1]==0:
			print(0)
		exit()
print(min(M))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
l,r = map(int,input().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,(i*j)%2019)
    print(ans)

Submission status: Runtime Error

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

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

for i in range(l,r-1):
    for j in range(l+1,r):
        if i == l and j == l+1:
            ans = (i*j)%2019
        else:
            res = (i*j)%2019
            ans = min(ans,res)
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
lr = [list(map(int,input().split())) for _ in range(m)]
min2 = 1
max2= n

for llrr in lr:
  min2 = max(min2, llrr[0])
  max2 = min(max2, llrr[1])

if max2-min2 >= 0:
  print(max2-min2+1)
else:
  print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]

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

def calc(l, r):
    return ((l % 2019) * (r % 2019)) % 2019

diff = R - L + 1


ans = calc(L, L+1)

dp = [[calc(L+i, L+i+1)] * diff for i in range(diff-1)]

for l in range(diff-1):
    for r in range(1, diff):
        dp[l][r] = (dp[l][0] * r) % 2019
        if ans > dp[l][r]:
            ans = dp[l][r]

print(ans)

Submission status: Runtime Error

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

if r-l >= 2019:
      print(0)
else:
      m = 2019
      for i in range(l,r):
            for j in range(i+1,r+1):
                  m = min(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 = 2019
      for i in range(l,r+1):
            for j in range(i+1,r+1):
                  m = min(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 = float('inf')
      for i in range(l,r+1):
            for j in range(i+1,r+1):
                  m = min(m,(i*j)%2019,)
print(m)

Submission status: Runtime Error

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


from itertools import combinations

A = list(range(l,r+1))

ans_L = [i[0]*i[1]%2019 for i in combinations(A,2)]
print(sorted(ans_L)[0])

Submission status: Runtime Error

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

l_mod = l % 2019
r_mod = l_mod + (r - l + 1) % 2019 - 1

for i in range(l_mod, r_mod):
    for j in range(i + 1, r_mod + 1):
        tmp = (i * j) % 2019
        if (i = l_mod and j = i + 1) or tmp < ans:
            ans = tmp

print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
import sys
L,R = map(int,input().split())
a = np.zeros(R-L+1,dtype="int64")
b = 2018
if R - L >= 2018:
  print("0")
  sys.exit()
else:
  for i in range (L,R):
    for j in range (i+1,R+1):
      x = (i * j) % 2019
      b = min(b,x)
  print(b)

Submission status: Runtime Error

Solution code:
import numpy as np
import sys
L,R = map(int,input().split())
a = np.zeros(R-L+1,dtype="int64")
b = 2018
if R - L >= 2018:
  print("0")
  sys.exit()
else:
  for i in range (L,R+1):
    for j in range (L+1,R+1):
      x = (i * j) % 2019
      b = min(b,x)
  print(b)

Submission status: Runtime Error

Solution code:
import numpy as np
import sys
L,R = map(int,input().split())
a = np.zeros(R-L+1,dtype="int64")
b = 2019
if R - L >= 2018:
  print("0")
  sys.exit()
else:
  for i in range (L,R+1):
    for j in range (L+1,R+1):
      x = (i * j) % 2019
      b = min(b,x)
  print(b)

Submission status: Runtime Error

Solution code:
import numpy as np
import sys
L,R = map(int,input().split())
a = np.zeros(R-L+1,dtype="int64")
b = 2019
if R - L >= 2018:
  print("0")
  sys.exit()
else:
  for i in range (0,R-L+1):
    d = (L + i) % 2019
    a[i] = d
for i in range (0,R-L+1):
  for j in range (i+1,R-L+1):
    x = (a[i] * a[j]) % 2019
    b = min(b,x)
print(b)

Submission status: Runtime Error

Solution code:
import numpy as np
import sys
L,R = map(int,input().split())
a = np.zeros(R-L+1,dtype="int64")
b = 2019
if R - L >= 2018:
  print("0")
  sys.exit()
else:
  for i in range (0,R-L+1):
    d = (L + i) % 2019
    a[i] = d
  for i in range (0,R-L+1):
    for j in range (i+1,R-L+1):
      x = (a[i] * a[j]) % 2019
      b = min(b,x)
print(b)

Submission status: Runtime Error

Solution code:
import numpy as np
L,R = map(int,input().split())
a = np.zeros(R-L+1,dtype="int64")
b = []
if R - L >= 2018:
  print("0")
else:
  for i in range (0,R-L+1):
    d = (L + i) % 2019
    a[i] = d
  for i in range (0,R-L+1):
    for j in range (i+1,R-L+1):
      x = (a[i] * a[j]) % 2019
      b.append(x)
print(min(b))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
r,l=map(int,input().split())
v1,v2=r//2019,l//2019
if v2-v1>=1 or r%2019==0 or l%2019==0:
    print(0)
else:
    ans=2018
    for i in range(r,l):
        for j in range(i+1,l+1):
            ans=min(ans,(i*j)%2019)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

m = 2019
for i, j in combinations(range(l, r+1),2):
      tmp = i*j % 2019
      if m > tmp:
            m = tmp
print(m)

Submission status: Runtime Error

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

# L <= i,j <== R の中で、i*j mod 2019の最小値を求めよ

# L,R は 0 ~ 2*10^9

# (i*j) mod 2019 = (i mod 2019) * (j mod 2019)

if(R <= 2019):
    ans = (R%2019)* ((R-1)%2019)

if(L >= 2019):
    if(L % 2019 < R % 2019):
        ans = (L % 2019)* ((L+1)%2019) % 2019
    else:
        ans = (R%2019)* ((R-1)%2019) % 2019
print(ans)

Submission status: Runtime Error

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

# L <= i,j <== R の中で、i*j mod 2019の最小値を求めよ

# L,R は 0 ~ 2*10^9

# (i*j) mod 2019 = (i mod 2019) * (j mod 2019)

if(R <= 2019):
    ans = (R%2019)* ((R-1)%2019)

if(L >= 2019):
    if(L % 2019 < R % 2019):
        ans = (L % 2019)* ((L+1)%2019)
    else:
        ans = (R%2019)* ((R-1)%2019)
print(ans)

Submission status: Runtime Error

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

# L <= i,j <== R の中で、i*j mod 2019の最小値を求めよ

# L,R は 0 ~ 2*10^9

# (i*j) mod 2019 = (i mod 2019) * (j mod 2019)

if(R <= 2019):
    ans = (R%2019)* ((R-1)%2019)

if(L >= 2019):
    ans = min(ans,(L%2019)* ((L+1)%2019))
print(ans)

Submission status: Runtime Error

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

# L <= i,j <== R の中で、i*j mod 2019の最小値を求めよ

# L,R は 0 ~ 2*10^9

# (i*j) mod 2019 = (i mod 2019) * (j mod 2019)

if(R <= 2019):
    ans = (R%2019)* ((R-1)%2019)

if(L >= 2019):
    ans = (L%2019)* ((L+1)%2019)
print(ans)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
if R - L >= 2019 :
    print(0)

else :
    t = []
    for i in range(L, R):
        for j in range(i + 1, R + 1) :
            list.append((i * j) % 2019)
    print(min(t))

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
if R - L >= 2019 :
    print(0)

else :
    t = []
    for i in range(L, R):
        for j in range(i+1, R+1) :
            list.append((i*j) % 2019)
    print(min(t))

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
if R - L >= 2019 :
    print(0)

else :
    t = []
    for i in range(L, R+1):
        for j in range(i+1, R+1) :
            list.append((i*j) % 2019)
    print(min(t))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
ijlist = list(range(l,r+1))
modlist = []
for i in range(len(ijlist)):
  modlist.append(ijlist[i] % 2019)
  if ijlist[i] % 2019 == 0:
    break
if len(modlist) == 1:
  modlist.append(1)
modlist.sort()
ans = (modlist[0] * modlist[1]) % 2019
print(ans)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
ijlist = list(range(l,r+1))
modlist = []
for i in range(len(ijlist)):
  modlist.append(ijlist[i] % 2019)
  if ijlist[i] % 2019 == 0:
    break
if len(modlist) == 1:
  modlist.append(1)
modlist.sort()
ans = modlist[0] * modlist[1]
print(ans)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
ijlist = list(range(l,r+1))
modlist = []
for i in range(len(ijlist)):
  modlist.append(ijlist[i] % 2019)
  if ijlist[i] % 2019 == 0:
    break
modlist.sort()
ans = modlist[0] * modlist[1]
print(ans)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
ijlist = list(range(l,r+1))
modlist = []
for i in range(len(ijlist)):
  modlist.append(ijlist[i] % 2019)
modlist.sort()
ans = modlist[0] * modlist[1]
print(ans)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
ij = [_ % 2019 for _ in range(L, R+1)]
ij_s = sorted(ij)
if ij_s in 3 and 673:
    print(0)
else:
    print((ij_s[0]*ij_s[1]))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l,r = map(int,input().split())
L = l%2019
R = r%2019  #2019 = 3*673
N = r-l+1

if N >= 2019 or L>R:
    print(0)
else:
    ans = l*(l+1)%2019
    for i in range(L,R):  #この時点でL<Rは決定済み
        for j in range(i+1,R+1):
            ans = min(ans,(j*i)%2019)
        if ans == 0:
            break

print(ans)

Submission status: Runtime Error

Solution code:
l,r = map(int,input().split())
L = l%2019
R = r%2019  #2019 = 3*673
N = r-l+1

if N >= 2019 or L>R:
    print(0)
else:
    ans = l*(l+1)%2019
    for i in range(L,R):  #この時点でL<Rは決定済み
        for j in range(i+1,R+1):
            if (i*j)%2019 < ans:
                ans = (i*j)%2019
                if ans == 0:
                    break
        if ans == 0:
            break

print(ans)

Submission status: Runtime Error

Solution code:
l,r = map(int,input().split())
L = l%2019
R = r%2019  #2019 = 3*673
N = r-l+1

if N >= 2019 or L>R:
    print(0)
else:
    ans = l*(l+1)%2019
    for i in range(L,R):  #この時点でL<Rは決定済み
        for j in range(i+1,R+1):
            if (i*j)%2019 < ans:
                ans = (i*j)%2019
                if ans == 0:
                    break

print(ans)

Submission status: Runtime Error

Solution code:
l,r=list(map(int, input().split()))
c=[0]*(r-l+1)
for i in range(l,r+1):
	c[i-l]=i%2019
minc=min(c)
print((minc*(minc+1))%2019)

Submission status: Runtime Error

Solution code:
l,r=list(map(int, input().split()))
c=[0]*(r-l+1)
for i in range(l,r+1):
	c[i-l]=i%2019
minc=min(c)
print(minc*(minc+1)%2019)

Submission status: Runtime Error

Solution code:
l,r=list(map(int, input().split()))
c=[0]*(r-l+1)
for i in range(l,r+1):
	c[i-l]=i%2019
minc=min(c)
print(minc*(minc+1))

Submission status: Runtime Error

Solution code:
l,r=list(map(int, input().split()))
c=[0]*(r-l+1)
for i in range(l,r+1):
	c[i-l]=i%2019
minc=min(c)
print(minc*minc+1))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

l = l%2019
r = r%2019

if l == 0 or r == 0 :
    print(0)
    exit()

if l > r:
    r += 2019

# print(l, r)

list_score = []
for i in range(l+1, r+1):
    for j in range(l, j):
        # print(i, j)
        list_score.append(i*j%2019)
# print(list_score)
print(int(min(list_score)))

Submission status: Runtime Error

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

l = l%2019
r = r%2019

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

print(int(min(list_score)))

Submission status: Runtime Error

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

l = l%2019
r = r%2019

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

print(int(min(list_score)))

Submission status: Runtime Error

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

l = l%2019
r = r%2019

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

print(int(min(list_score)))

Submission status: Runtime Error

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

l = l%2019
r = r%2019

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

print(min(list_score))

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
Lmin = L % 2019
Rmin = R % 2019
anlis = []

if L-R >= 2019 or Lmin > Rmin:
    print(0)
    
else:
    for j in range(Lmin, Rmin+1):
        for i in range(Lmin, j):
            anlis.append((i * j) % 2019)



print(min(anlis))

Submission status: Runtime Error

Solution code:
l,r = map(int,(input().split()))
if r-l>=2018:
    print(0)
    sys.exit()

else:
    if l%2019>r%2019:
        l=l%2019
        r=r%2019+2019
    else:
        l=l%2019
        r=r%2019

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

    print(m)

Submission status: Runtime Error

Solution code:
l,r = map(int,(input().split()))
if r-l>=2018:
    print('0')
    sys.exit()

else:
    if l%2019>r%2019:
        l=l%2019
        r=r%2019+2019
    else:
        l=l%2019
        r=r%2019

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

    print(m)

Submission status: Runtime Error

Solution code:
l,r = map(int,(input().split()))
if r-l>=2018:
    print(0)
    sys.exit()

else:
    if l%2019>r%2019:
        l=l%2019
        r=r%2019+2019
    else:
        l=l%2019
        r=r%2019

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

    print(m)

Submission status: Runtime Error

Solution code:
first, second = input.split()
first, second = int(first), int(second)

print(first*second % 2019)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
a=l%2019
b=j%2019
answer=10000000
if a>b:
    b+=2019
for i in range(a,b+1):
    for j in range(a,b+1):
        if i!=j:
            answer=min(answer,(i*j)%2019)
print(answer)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
import heapq

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

l=list(range(L,R+1))
q=[]

for item in l:
   heapq.heappush(q,item%2019)

print(heapq.heappop(q)*heapq.heappop(q))

Submission status: Runtime Error

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

if L+1 == R:
  print(
L_low = L % 2019
R_low = R % 2019
#if L_low >= R_low:
#  R_low += 2019
R_low += 2019

result = 2019
for i in range(L_low, R_low): 
  for j in range(i+1, R_low+1):
#    print( 'j_' + str(j))
    result= min(result, (i * j) % 2019)
    if result == 0:
      print(0)
      exit()

print(result)

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