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: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
from functools import reduce
import sys
import math
import bisect
import random
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return list(map(float, sys.stdin.readline().split()))
def LS():return sys.stdin.readline().split()
def SR(n): return [list(sys.stdin.readline())[:-1] for i in range(n)]
def IR(n): return [int(sys.stdin.readline()) for i in range(n)]
def LIR(n): return [list(map(int, sys.stdin.readline().split())) for i in range(n)]
def LSR(n): return [list(map(list, sys.stdin.readline().split())) for i in range(n)]
_gcd = lambda x, y: _gcd(y, x%y) if (x%y) else y
_lcm = lambda x, y: x*y // _gcd(x, y)
def gcd(*numbers):
    return reduce(_gcd, numbers)
def lcm(*numbers):
    return reduce(_lcm, numbers)
sys.setrecursionlimit(1000000)
INF = float('inf')
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]

L, R = LI()

ret = INF

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

print(ret)

Submission status: Accepted

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

for i in range(l, min(l + 2040, r + 1)):
        if i % 2019 == 0:
                print(0)
                exit()

res = 10 ** 100
for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
                res = min(res, i * j % 2019)
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import queue

"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
(N,M) = (int(i) for i in input().split(" "))

m = 3000
if M-N >= 2019:
	print(0)
else:
	for i in range(N,M):
		for j in range(i+1,M+1):
			k=i*j
			k%=2019
			if k < m:
				m=k
	print(m)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

l, r = na()
if r//2019*2019 >= l:
    print(0)
else:
    mn = 9999999
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            mn = min(mn, i*j%2019)
    print(mn)

Submission status: Accepted

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

Submission status: Runtime Error

Solution code:
#ABC133 C

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

Submission status: Runtime Error

Solution code:
#ABC133 C

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

Submission status: Runtime Error

Solution code:
#ABC133 C

L,R = map(int,input().split())
A = []
if R - L > 2019:
    print(0)
else:
    for i in range(L,R):
        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())

mod = 2019
a = l%2019
b = l%2019

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

else:
  if a < b:
    print(a*a+1)
  else:
    print(0)

Submission status: Runtime Error

Solution code:
import itertools

L,R = map(int,input().split())
N_List = list(range(L,R+1))
N = len(N_List)
if N >= 2019:
    ans = 0
else:
    F = N_List[0] % 2019
    L = N_List[-1] % 2019
    if F < L:
        ans = 2019
        Amari_List = list(range(F,L+1))
        for v1,v2 in itertools.combinations(Amari_List, 2):
            ca = v1*v2 % 2019 
            if  ca < ans:
                ans = ca
    else:
        ans = 0

print(ans)

Submission status: Runtime Error

Solution code:
import itertools

L,R = map(int,input().split())
N_List = list(range(L,R+1))
N = len(N_List)
if N >= 2019:
    ans = 0
else:
    F = N_List[0] % 2019
    L = N_List[-1] % 2019
    if F < L:
        ans = 2019
        Amari_List = list(range(F,L+1))
        for v1,v2 in itertools.combinations(Amari_List, 2):
            if v1*v2 < ans:
                ans = v1*v2
    else:
        ans = 0

print(ans)

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
l=L%2019
r=R%2019
l1=L//2019
r1=R//2019
if l1<r1:
  print(0)
elif l1==r1:
  res=[]
  for i in range(l,r):
    for j in range(i+1,r+1):
      if (i*j)%2019 not in res:
        res.append((i*j)%2019)
print(min(res))

Submission status: Runtime Error

Solution code:
from itertools import combinations
l, r = map(int, input().split())
n = list(combinations(range(l, r+1), 2))
ans=[]
for N in n:
    ans.append(N[0]*N[1]%2019)
print(min(set(ans)))

Submission status: Runtime Error

Solution code:
from itertools import combinations
l, r = map(int, input().split())
n = list(combinations(range(l, r+1), 2))
ans=[]
for N in n:
    ans.append(N[0]*N[1]%2019)
print(min(ans))

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
dif = r - l
ans = 0
if dif >= 2019:
    ans = 0
else:
    mod_l = l % 2019
    mod_r = r % 2019
    if mod_l < mod_r:
        if 3 >= mod_l and mod_r <= 673:
            ans = 0
        else:
            ans = mod_l * (mod_l + 1)
    else:
        ans = 0
print(dif, mod_l, mod_r)
print(ans%2019)

Submission status: Runtime Error

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

i = max(R - R%2019, L)
mod_i = 2019//(i%2019)
j = max(R - R%mod_i, L+1)

print(i*j%2019)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if R - L >2019:
  print(2)
else:
  ans = 2019
  for i in range(L,R-1):
    a = ((i%2019)*((i%2019)+1))%2019
    ans = min(ans,a)
  print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ls = [i % 2019 for i in range(L,min(R,L+2019**2))]
ls.sort()

print(ls[0]*ls[1]%2019)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=n//2019
b=m//2019
if n*m%2019==0 or b-a>=1:
  print(0)
else:
  best=2018
  for c in range(n%2019,m%2019):
    for d in range(c+1,m%2019+1):
      if c*d%2019<best:
        best=c*d%2019
print(best)

Submission status: Runtime Error

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

cnt=[]


for i in range(l,r+1):
  if i%2019==0:
    print('0')
    break
  if i%2019!=0:
    for j in range(l,r+1):
      if j%2019>=0:
        a=(l*(l+1)%2019)
        cnt.append(a)
        break
      else:
        b=(j*(j-1)%2019)
        cnt.appnd(b)
        break

print(min(cnt))

Submission status: Runtime Error

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

if R-L >= 2019:
    print(0)
    sys.exit()
elif R-L == 1:
    print((i*j)%2019)
    sys.exit()

ans = 4000

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

print(ans)

Submission status: Runtime Error

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

if R-L >= 2019:
    print(0)
    sys.exit()
elif R-L == 1:
    print((i*j)%2019)
    sys.exit()

ans = 100*100

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

print(ans)

Submission status: Runtime Error

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

if R-L >= 2019:
    print(0)
    sys.exit()
elif R-L == 1:
    print((i*j)%2019)
    sys.exit()

ans = float('inf')

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

print(ans)

Submission status: Runtime Error

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

if R-L >= 2019:
    print(0)
    sys.exit()
elif R-L == 1:
    print((i*j)%2019)
    sys.exit()

ans = 10**1000

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

print(ans)

Submission status: Runtime Error

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

if r//673 > (l-1)//673 and r-l = 2:
  print('0')

else:
    print((l%2019) * ((l+1)%2019))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from itertools import combinations

l, r = map(lambda s: int(s) % 2019, input().split())
print(min((i * j) % 2019 for i, j in combinations(range(l, r + 1), 2)))

Submission status: Runtime Error

Solution code:
from itertools import combinations

l, r = map(lambda s: int(s) % 2019, input().split())
print(
    (min((i * j) % 2019 for i, j in combinations(range(l, r + 1), 2)), 0)[
        r < l or l == 0
    ]
)

Submission status: Runtime Error

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

L_mod = L % 2019
mod_list = []

for i in range(L_mod,L_mod + (R-L) + 1):
  tmp = i % 2019
  if tmp == 0:
    mod_list.append(i % 2019)
    break
  else:
    mod_list.append(i % 2019)

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

Submission status: Runtime Error

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

t = []

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

print(min(t))

Submission status: Runtime Error

Solution code:
from collections import Counter
inp=list(map(int,input().split()))
l=inp[0]
r=inp[1]
c=Counter([])
arr=[]
for i in range(l,r+1):
  if c[i]==0:
    c[i]+=1
    arr.append(i)
    continue
  else:
    break
if c[0]!=0:
  print (0)
ans=99999999999
for i in range(len(arr)):
  for j in range(i+1,len(arr)):
    ans=min(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())

rem_l = l%2019
rem_r = r%2019

ans = -1

if r - l >= 2019:
    ans = 0

elif rem_l >= rem_r:
    ans = 0

else:
    ans = float('INF')
    for i in range(l, r):
        for j in raneg(i, r):
            temp = (i * j) % 2019
            if temp < ans:
                ans = temp

print(ans)

Submission status: Runtime Error

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

print(min_ij)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
l,r = map(int,input().split())
if r-l >=2019:
    print(0)
else:
    ans = 2019
    for i in raneg(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())
ans=float('inf')
for i in range(L,R+1):
  for j in range(L,R+1):
    s=(i*j)%2019
    if s==0:
      print(0)
      exit()
    else:
      ans=min(s,ans)
      
print(ans)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 13, 2020 06:30:41 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"


from sys import stdin
input = stdin.readline


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

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


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

Submission status: Runtime Error

Solution code:
n = int(input())
d = list(map(int, input().split()))
d.sort()

half = int(n/2)

n1 = d[half-1]
n2 = d[half]

if n2-n1 == 0:
    print(0)
    exit()
else: 
    print(n2-n1)

Submission status: Runtime Error

Solution code:
A,B,C,D = map(int,input().split())

count = 0

for i in range(A,B+1):
    if not i % C == 0:
        if not i % D ==0:
            count += 1

print(count)

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
i=l//2019
d=list(range(l,r+1))
for j in range(len(d)):
    d[j]%=2019
    d2=sorted(d)
    print(d2[0]*d2[1])

Submission status: Runtime Error

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

if r-l > 2018:
    print(0)
    eixt()
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())
res = 2018

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
import sys
mod=2019
ans=float('inf')

for i in range(l,r+1):
  for j in range(j+1,r+1):
    ans=min((i*j)%mod,ans)
    if ans==0:
      print(0)
      sys.exit()
print(ans)

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
import sys
mod=2019
ans=float('inf')

for i in range(l,r):
  for j in range(j+1,r+1):
    ans=min((i%mod)*(j%mod),ans)
    if ans==0:
      print(0)
      sys.exit()
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
from itertools import combinations
L,R=map(int,input().split())
ans=L*R%2019
for i in combinations(range(L,R+1),2):
    if L!=0 and R!=0:
        if ans>=i[0]*i[1]%2019:
            ans=i[0]*i[1]%2019
    else:
        ans=0
print(ans)

Submission status: Runtime Error

Solution code:
from itertools import combinations
L,R=map(int,input().split())
ans=L*R%2019
for i in combinations(range(L,R+1),2):
    if ans>=i[0]*i[1]%2019:
        ans=i[0]*i[1]%2019
    elif L==0 or R==0:
        ans=0
print(ans)

Submission status: Runtime Error

Solution code:
from itertools import combinations
L,R=map(int,input().split())
ans=L*R%2019
for i in combinations(range(L,R+1),2):
    if ans>=i[0]*i[1]%2019:
        ans=i[0]*i[1]%2019
print(ans)

Submission status: Runtime Error

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

 if R - L >= 2019:
        print(0)
        exit()
 
ans = float('inf')
for i in range(L, R):
    for j in range(i+1, R+1):
        t = i*j%2019
        ans = min(ans,t)
print(ans)

Submission status: Runtime Error

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

l = l%2019
r = r%2019

if l >= r:
    print(0)
else:
    ans = float('inf')
    for left in range(l, r+1):
        for right in range(left+1, r+1):
            # ans = min(ans, (left*right)%2019)
            score = (left*right)%2019
            if score < ans:
                print(f'{left}, {right}: {score}')
                ans = score
    print(ans)

Submission status: Runtime Error

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

ans =[]
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            ans.append(i*j%2019)
            if i*j% 2019== 0 :
                exit()

print(min(ans))

Submission status: Runtime Error

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

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

print(min(ans))

Submission status: Runtime Error

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

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

print(min(ans))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**6)

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

MOD = 2019

#n = 2019
#pf = {}
#
#for i in range(2,int(n**0.5)+1):
#    while n % i == 0:
#        pf[i] = pf.get(i,0) + 1
#        n //= i
#if n > 1: pf[n] = 1
#print(pf)
## 2019=3*673

import itertools

l_mod = l%MOD
r_mod = r%MOD

if r-l > 2019:
    ans = 0
else:
    if l_mod < r_mod:
    	li = [i for i in range(l_mod, r_mod+1)]
    	ans = 2018
    	for v in itertools.combinations(li, 2):
      	ans = min(ans, v[0]*v[1]%MOD)        
    else:
        ans = 0

print(ans)

Submission status: Runtime Error

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

if r//2019 != l//2019:
    print(0)
else:
    l = list()
    for i in range(l, r):
        for j in range(i+1, r+1):
            l.append((i*j)%2019)
    print(min(l))

Submission status: Runtime Error

Solution code:
import sys

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

if R-L >= 2019:
  print('0')
  sys.exit()

L = L % 2019
R = R % 2019
if L > R:
  print('0')

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

Submission status: Runtime Error

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

N = 2019


ans = 2019

for i in range(L, R):
    for j in range(i + 1, R + 1):
        mod = (i * j) % N
        if ans > mod:
            ans = mod
        if ans = 0:
            print(ans)
            exit(0)

print(ans)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
length = R - L + 1
if length >= 673:
    print(0)
else:
    l = L % 673
    if l = 0:
        print(0)
    elif l + length > 673:
        if length >= 3:
            print(0)
        elif l == 672:
            print(0)
        else:
            print(L*(L+1)%2019)
    else:
        print(L*(L+1)%2019)

Submission status: Runtime Error

Solution code:
import collections
l,r = map(int, raw_input().split(' '))
cc = collections.Counter([n % 2019 for n in range(l, r+1) ])

m = +float('inf')
for a in cc:
	for b in cc:
		if a!=b or cc[a] > 1:
			m = min(m,(a*b) % 2019)
print m

Submission status: Runtime Error

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

Submission status: Runtime Error

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


if L == 0 or R-L >= 2019:
    ans = 0
else:
    flag = True
    for i in range(L, R+1):
        if i % 2019 == 0:
            ans = 0
            flag = False
            break
    if flag:
        raise
        ans = (L*(L+1))%2019

print(ans)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
w = R - L
if s + w >= 2019:
  print(0)
else:
  print(min((s * (s + 1))% 2019, (l * (l - 1)) % 2019)

Submission status: Runtime Error

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

check = list(itertools.combinations(range(L, R + 1, 1), 2))

minmod = 2020
for x in check:
    minmod = min(minmod, (x[0] * x[1]) % 2019)

print(minmod)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

if l==0 or l//m>r//m or r%m==0:
  print(0)
  exit()

import numpy as np
lr=m
for ii in np.arange(l,r):
  for jj in np.arange(ii+1,r+1):
    t=((ii%m)*(jj%m))%m
    if t==0:
        print(0)
        exit()
    if t<lr:
      lr=t
print(lr)

Submission status: Runtime Error

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

if l==0 or l%m>r%m or m*(r%m)==r:
  print(0)
  exit()

import numpy as np
si=set()
for ii in np.arange(l,r):
  si.add(ii%m)
sj=set()
for jj in np.arange(l+1,r+1):
  sj.add(jj%m)

lr=m
for ii in si:
  for jj in sj:
    t=(ii*jj)%m
    if t==0:
        print(0)
        exit()
    if t<lr:
      lr=t
      
print(lr)

Submission status: Runtime Error

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

if l==0 or l%m>r%m or m*(r%m)==r:
  print(0)
  exit()

import numpy as np
lr=m
for ii in np.arange(l,r):
  for jj in np.arange(ii+1,r+1):
    t=((ii%m)*(jj%m))%m
    if t==0:
        print(0)
        exit()
    if t<lr:
      lr=t
print(lr)

Submission status: Runtime Error

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

if l==0 or l%m>r%m or m*(r%m)==r:
  print(0)
  exit()

import numpy as np
lr=m
for ii in np.arange(l,r):
  for jj in np.arange(ii+1,r+1):
    t=(ii*jj)%m
    if t==0:
        print(0)
        exit()
    if t<lr:
      lr=t
print(lr)

Submission status: Runtime Error

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

if l%m>r%m or m*(r%m)==r:
  print(0)
  exit()

import numpy as np
lr=m
for ii in np.arange(l,r):
  for jj in np.arange(ii+1,r+1):
    t=(ii*jj)%m
    if t==0:
        print(0)
        exit()
    if t<lr:
      lr=t
print(lr)

Submission status: Runtime Error

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

if l%m>r%m or m*(r%m)==r:
  print(0)
  exit()

import numpy as np
lr=m
for ii in np.arange(l,r):
  for jj in np.arange(ii+1,r+1):
    t=(ii*jj)%m
    if t<lr:
      lr=t
print(lr)

Submission status: Runtime Error

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

import numpy as np
s=set()
lr=m
for ii in np.arange(l,r):
  for jj in np.arange(ii+1,r+1):
    t=(ii*jj)%m
    if t==0:
      print(t)
      exit()
    if t<lr:
      lr=t
print(lr)

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(i*j%2019,ans)
print(ans)

Submission status: Runtime Error

Solution code:
import itertools
L,R=map(int,input().split())
ans=2019
for c in itertools.combinations(range(L,R+1),2):
	if (c[0]*c[1])%2019==0:
		print(0)
		exit()
	else:
		ans=min(ans,(c[0]*c[1])%2019)
print(ans)

Submission status: Runtime Error

Solution code:
import itertools
L,R=map(int,input().split())
if L%2019==0 or R%2019==0:
	ans=0
else:
	L%=2019
	R%=2019
	INF=10*9
	ans=INF
	for i in itertools.combinations(range(L,R+1),2):
		ans=min(ans,(i*j)%2019)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = 10 ** 9
for i range(L, R+1):
    for j range(i, R):
        mod = i * j % 2019
        if ans > mod:
            ans = mod
        elif mod == 0:
            ans = 0
            break
    else:
        continue
    break
print(ans)

Submission status: Runtime Error

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

MIN = 2018
if R-L > 4039:
    MIN = 0


MOD = 2019
L = L%MOD
R = R%MOD
if L > R:
    L, R = R, L
else if L == R:
    MIN = 0


for i in range(L, R):
    for j in range(i+1, R+1):
        buf = (i*j) % MOD
        #print(i, j)
        MIN = min(buf, MIN)

print(MIN)

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np

L, R = map(int, input().split())
range_L_R = np.array(list(range(L, R+1)))
range_L_R = range_L_R % 2019


if ((R>=673) and (L<=672)) or ((R>=675) and (L<=673)) or 0 in range_L_R:
    print(0)
else:
    print(L*(L+1) % 2019)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
lis = list(range(L, R + 1))
lis = sorted([i % 2019 for i in lis])
print(lis[0] * lis[1])

Submission status: Runtime Error

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
L,R = (int(x) for x in input().split())

mod_L =L %2019
mod_R =R %2019
ans =0
if 2018 <= R -L:
    ans =0
elif mod_R < mod_L:
    ans =0
elif:
    mod_L==0 :
    ans =0
else:
    ans =mod_L *(mod_L +1)
print(ans)

Submission status: Runtime Error

Solution code:
a, b = list(map(int, input().split()))
lis = list(range(a, b+1))
lis2 = list(map(lambda x: x%2019, lis))
lis2.sort()
#print(lis2)
min1 = lis2.pop(0)
min2 = lis2.pop(0)
#print(min1)
#print(min2)
print((min1*min2)%2019)

Submission status: Runtime Error

Solution code:
from itertools import combinations

# input
L, R = map(int, input().split())
mod0 = [n for n in range(0, R + 1, 2019) if L <= n <= R]
# check
target_num = list(range(L, R + 1))
if mod0:
    print(0)
else:
    nC2 = list(combinations(target_num, 2))
    mods_ans = [(i * j) % 2019 for i, j in nC2]

    print(min(mods_ans))

Submission status: Runtime Error

Solution code:
from itertools import combinations

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

# check
target_num = list(range(L, R + 1))
nC2 = list(combinations(target_num, 2))
mods_ans = [(i * j) % 2019 for i, j in nC2]

print(min(mods_ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l,r=map(int,input.split())
ll=l%2019
rr=r%2019
if ll>rr:
  print(0)
else:
  print(ll*(ll+1))

Submission status: Runtime Error

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


if R-L>=L:
    print(0)
else:
    for l in range(L,R):
        for r in range(l+1, R+1):
            z = min(z, ((l % 2019) * (r % 2019)) % 2019)
    print(z)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
if L <= 2019 <= R:
    print(0)
else:
    lista = []
    int1 = min(L % 2019, 2019 - (L % 2019))
    int2 = min(R % 2019, 2019 - (R % 2019))
    lista.append(int1)
    lista.append(int2)
    lista.append(int1 + 1)
    lista.append(int2 + 1)
    lista.sort()
print(lista[0] * lista[1])

Submission status: Runtime Error

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

L, R = MAP()

if L-R+1 >= 2019:
	print(0)
	exit()

a = list(range(L, R+1))
ans = 2019

for x, y in combinations(a, 2):
	ans = min(ans, (x*y)%2019)

print(ans)

Submission status: Runtime Error

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

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

left = L % 2019
right = R % 2019

for i in range(left, right):
    for j in range(i+1, right+1):
        ans.append(calc_mod(i, j))

print(min(ans))

Submission status: Runtime Error

Solution code:
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
L,R = map(int, stdin.readline().rstrip().split())
#S = [list(stdin.buffer.readline().decode().rstrip()) for _ in range(h)]

lsho, lmod = divmod(L,2019)
rsho, rmod = divmod(R,2019)

if rsho - lsho == 0:
    print(int((lmod*(lmod+1))%2019))
    exit()

u = [0]*2019
for l in range(lsho,2019):
    u[l] += 1
for r in range(rsho):
    u[r] += 1

for i,v in enumerate(u):
    if v == 0:
        pass
    if v == 1:
        if u[i+1] != 0:
            print(int((i*(i+1))%2019))
            exit()
        else:
            for j in range(i+1,2019):
                if u[j] == 1:
                    print(int((i*j%2019)))
                    exit()
    if v == 2:
        print(int((i*i)%2019))
        exit()

Submission status: Runtime Error

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


#mod(L)*mod(R)>=2019の場合を入れる
mod_List=[]
count=0
for i in range(L,R+1):
    mod_List.append(i%2019)
    count+=1
    if count>=2019:
        break
        
mod_List.sort()
if mod_List[-1]*mod_List[-2]>=2019:
    print(0)
elif if L!=R:
    print(mod_List[0]*mod_List[1])
else:
    print(mod_List[0])