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:
from goto import goto, label

S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)

flg = 0

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

print(min)

Submission status: Runtime Error

Solution code:
from goto import goto, label

S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)

flg = 0

for i in range(L, R, 1):
    if flg == 0:
        for j in range(i+1, R+1, 1):
            mod = (i*j) % 2019
            if mod < min:
                min = mod
                if min == 0:
                    flg = 1
                    break
    elif:
        break
print(min)

Submission status: Runtime Error

Solution code:
from goto import goto, label

S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)

for i in range(L, R, 1):
    for j in range(i+1, R+1, 1):
        mod = (i*j) % 2019
        if mod < min:
            min = mod
            if min == 0:
                goto .END
label .END
print(min)

Submission status: Runtime Error

Solution code:
#abc133c

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math

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

if r-l > 2019:
    ans = 0
else:
    lst = list(range(l,r+1))
    lst2 = [i%2019 for i in lst]
    lst2.sort()
    ans = int(lst2[0] * lst2[1] / math.gcd(lst2[0], lst2[1]))

print(ans)

Submission status: Runtime Error

Solution code:
import math

l,r = map(int, input().split())
lst = list(range(l,r+1))

ans = 0

lst2 = [i%2019 for i in lst]
lst2.sort()

ans = int(lst2[0] * lst2[1] / math.gcd(lst2[0], lst2[1]))

print(ans)

Submission status: Runtime Error

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

int main()
{
    int l,r,c;
    cin>>l>>r;

    c=((l*(l+1))%2019);
    cout<<c<<endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
c=((a)*(a+1))%2019
print(c)

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
c=((a)*(a+1))%2019
print(c

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
def main(L, R):
    if 0 <= L <= R <= 2*10**9 : 
        num_list = [x for x in range(L, R+1)]
        row_comb = list(itertools.combinations(num_list, 2))
        mod_list = []
        for x in row_comb:
            mod = divmod(x[0]*x[1], 2019)
            mod_list.append(mod[1])
        goal = min(mod_list)
        return goal


if __name__ == '__main__':
    s = list(map(int, input().split()))
    huga = main(s[0],s[1])
    print(huga)

Submission status: Runtime Error

Solution code:
def main(L, R):
    num_list = [x for x in range(L, R+1)]
    row_comb = list(itertools.combinations(num_list, 2))
    mod_list = []
    for x in row_comb:
        mod = divmod(x[0]*x[1], 2019)
        mod_list.append(mod[1])
    goal = min(mod_list)
    return goal

if __name__ == '__main__':
    s = list(map(int, input().split()))
    huga = main(s[0],s[1])
    print(huga)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l,r = map(int, input().split())
n = r - l + 1
if 2019<=n:
    print(0)
elif 3<=n and n<2019:
	mod = 2019
    for i in range(l,r):
        for j in range(l+1,r+1):
            mod_new = (i*j)%2019
            mod = min(mod,mod_new)
    print(mod)                             
else:
    print((l*r)%2019)

Submission status: Runtime Error

Solution code:
z = [int(i) for i in input().split()]
l = z[0]
r = z[1]
if l == 2019 or r == 2019 :
  print(0)
elif r < 2019 :
  max1 = 0 
  for i in range(l,r+1):
    for j in range(i,r+1):
      	temp = (i%2019)*(j%2019)
        if temp > max1:
          max1 = temp
  print(max1)        
                   
    
elif r > 2019 and l > 2019 :
  flag = 0 
  if l - r >= 2019:
    print(0)
  else:
    max1 = 0 
    for i in range(l,l+2020):
      for j in range(i,l+2020):
          temp = (i%2019)*(j%2019)
          if temp > max1:
            max1 = temp
    print(max1)

Submission status: Runtime Error

Solution code:
z = [int(i) for i in input().split()]
l = z[0]
r = z[1]
if l == 2019 or r == 2019 :
  print(0)
elif r < 2019 :
  print(l*(l+1))
elif r > 2019 and l > 2019 :
  flag = 0 
  if l - r >= 2019:
    for i in range(l,l+2020):
      if i%2019 == 0:
        number = i 
        flag = 1 
        break
	if flag == 1 :
		print(0)
	else :
    	print((number%2019)*((number+1)%2019)    
  else :
    for i in range(l,r+1):
      if i % 2019 == 0 :
       	flag = 1 
        break
	  if flag == 1 :
	    print(0)
	  else :
	    print( (l%2019)*((l+1)%2019))

Submission status: Runtime Error

Solution code:
z = [int(i) for i in input().split()]
l = z[0]
r = z[1]
if l == 2019 or r == 2019 :
  print(0)
elif r < 2019 :
  print(l*(l+1))
elif r > 2019 and l > 2019 :
  flag = 0 
  if l - r >= 2019:
    for i in range(l,l+2020):
      if i%2019 == 0:
        number = i 
        flag = 1 
        break
  else :
    for i in range(l,r+1):
      if i % 2019 == 0 :
       	flag = 1 
        break
  if flag == 1 :
    print(0)
  else :
    print(l*(l+1)

Submission status: Runtime Error

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

minimum = L * R
for i in range(L, min(R, L+2020)):
    for j in range(i+1, min(R+1, i+2020):
        
        minimum = min(minimum, i * j // 2019)
        

print(minimum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
    L, R = map(int, input().split())
    start = time.time()
    if R // 2019 > L // 2019:
        print(0)
        return
    retval = 2019
    for i in range(L, R):
        for j in range(i+1, R+1):
            retval = min(retval, (i % 2019 * j % 2019) % 2019)
            if retval == 0:
                print(0)
                return
            
    print(retval)
    return
    
if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l, r = (int(x) for x in input().split())
tmpmin = 2020
tmprem = i*r%2019
if l*r<2019:
    print(l*(l+1))
else:
    for i in range(l, r+1):
        for j in range(l+1, r+1):
            tmp = (i*j)%2019
            tmpnxt = (i*(j+1))%2019
            if tmp < tmpmin:
                tmpmin = tmp
            if tmp < tmpnxt:
                break
    print(tmpmin)

Submission status: Runtime Error

Solution code:
import sys

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

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

ans = 2019

if L >= R:
   
for i in range(L, R):

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

print(ans)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
nmin = 2018
frag2 = 0
frag4 = 0
frag5 = 0
frag10 = 0
frag20 = 0
frag101 = 0
frag202 = 0
frag404 = 0
frag505 = 0
frag101 = 0
for i in range(l, min(l+2019, r+1)):
    if(i%2019==0):
        nmin = 0
    else:
        nmin = min(nmin, i%2019)
    if(i%2019==1010):
        frag1010 = 1
    elif(i%2019==505):
        frag505 = 1
    elif(i%2019==101):
        frag101 = 1
    elif(i%2019==2):
        frag2 = 1
    elif(i%2019==4):
        frag4 = 1
    elif(i%2019==20):
        frag20 = 1
    elif(i%2019==404):
        frag404 = 1
    elif(i%2019==202):
        frag202 = 1
    elif(i%2019==10):
        frag10 = 1
    elif(i%2019==5):
        frag5 = 1
    if(nmin==0):
        break

if((frag2 == 1 and frag1010 == 1) or (frag4 == 1 and frag505 == 1) or (frag5 == 1 and frag404 == 1) or (frag10 == 1 and frag202 == 1) or (frag20 == 1 and frag101 == 1)):
    ans = 1
else:
    ans = nmin * (nmin+1) % 2019
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
L,R = map(int,input().split())
for i in range(L,R+1):
    if i%2019 = 0:
        print(0)
        sys.exit()
for i in range(l,r):
    for j in range(i+1,r+1):
            a = (i*j)%2019
            c.append(a)
print(min(c))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

#if R-L > 2019:
#  print (0)
#else:
#  mod1 = L%2019
#  mod2 = R%2019
#  if mod2 < mod1:
#    print (0)
#    sys.exit()
#  else:
  modmin =2019 -1
  for i in range(L,R):
    for j in range(i+1,R+1):
      mod3 = (i*j)%2019
      if mod3 =0:
        print(0)
        sys.exit()
      elif modmin > mod3:
        modmin = mod3

  print(modmin)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
li=[]
for i in range(L,R):
  for j in range(i+1,R+1):
    while i*j<2019**2:
      mod=(i*j)%2019
      li.append(mod)
      if mod==0:
        break
print(min(li))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

if R-L>=2019:
    print(0)
else:
    L %= 2019
        R %= 2019
            if L<R:
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)
        else:
print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import itertools

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

if c<2019:
  print(L*(L+1))

else:  
  l = list(range(L,R+1))
  l = list(itertools.combinations(l, 2))

  mod_list=[]

  for i in range(len(l)):
    a = l[i][0]
    b = l[i][1]
    t = a*b
    q, mod = divmod(t, 2019)
    mod_list.append(mod)


  print(min(mod_list))

Submission status: Runtime Error

Solution code:
import itertools

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

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

mod_list=[]

for i in range(len(l)):
  a = l[i][0]
  b = l[i][1]
  t = a*b
  q, mod = divmod(t, 2019)
  mod_list.append(mod)

    
print(min(mod_list))

Submission status: Runtime Error

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

if R - L >= 2018:
      mod = 0
else:
    tempL = L%2019
    tempR = R%2019
    if tempR - tempL < R-L-1:
        temp = tempL
        tempL = 0
        X = list(range(tempL,temp))
        Y = list(range(tempR,2018+1))
        Z = X + Y
    else:
        Z = list(range(tempL,tempR+1))

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

Submission status: Runtime Error

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

if R - L >= 2018:
      mod = 0
else:
    tempL = L%2019
    tempR = R%2019
    if tempR - tempL < R-L-1:
        temp = tempL
        tempL = 0
        X = range(tempL,temp)
        Y = range(tempR,2018)
        Z = extend(X,Y+1)
    else:
        Z = range(tempL,tempR+1)

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

Submission status: Runtime Error

Solution code:
n, m = map(int, raw_input().split(" "))
zantei = 888

for cnt1 in range(n,m+1):
  for cnt2 in range(n+1,m+1):
    amari = cnt1*cnt2%2019
    if zantei > amari: 
      zantei=amari
print (zantei)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

if R - L >= 2019:
    print(0)
else:
    mod_l = L%2019
    mod_r = R%2019
    ans = 2019
    for i in range(mod_l, mod_r):
        for j in range(i+1, mod_r+1):
            if (i * j)%2019 == 0:
                ans = 0
                break
            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:
    mod_l = L%2019
    mod_r = R%2019
    ans = 2019
    for i in range(mod_l, mod_r+1):
        for j in range(i+1, mod_r+1):
            if (i * j)%2019 == 0:
                ans = 0
                break
            ans = min(ans, (i * j)%2019)
print(ans)

Submission status: Runtime Error

Solution code:
L2, R2= map(int, input().split())

L=L2%2019
R=R2%2019

hasamu=R2-L2
kotae=10000
if hasamu>2017:
  kotae=0
if L>R:
  kotae=0
else:
  for i in range(L,R):
    for j in range(i+1,R+1):
      seki=i*j
      amari=seki%2019
        if amari<kotae:
          kotae=amari
print(kotae)

Submission status: Runtime Error

Solution code:
L2, R2= map(int, input().split())

L=L2%2019
R=R2%2019

hasamu=R2-L2
kotae=10000
if hasamu>2017:
  kotae=0
if L>R:
  kotae=0
else:
  for i in range(L,R):
  	for j in range(i+1,R+1):
    	seki=i*j
    	amari=seki%2019
    	if amari<kotae:
     		kotae=amari
print(kotae)

Submission status: Runtime Error

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

hasamu=R-L
kotae=10000
if hasamu>2017:
  kotae=0

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

div_l = L//2019
div_r = R//2019
div_ll = L//673
div_rr = R//673

ans = 0
if div_l == div_r and div_ll == dir_rr:
  mod_l = L%2019
  mod_r = R%2019
  ans = mod_l * (mod_l+1)
print(ans)

Submission status: Runtime Error

Solution code:
l,r = input().split()
l = int(l)
r = int(r)
N = int(2019)
  
ans = (l * (l + 1)) % N
count = 0
for i in range(l,r):
  for j in range(l+1,r+1):
    if(count >= (N - 1)):
      flag = True
      break
    else if(ans > (i * j) % N):
      ans = (i * j) % N
    count += 1
  if flag:
    break
    
print(ans)

Submission status: Runtime Error

Solution code:
l,r = input().split()
l = int(l)
r = int(r)
N = int(2019)
  
ans = (l * (l + 1)) % N
count = 0
for i in range(l,r-1):
  for j in range(l+1,r):
    if(count >= (N - 1)):
      flag = True
      break
    if(ans > (i * j) % N):
      ans = (i * j) % N
    count += 1
  if flag:
    break
    
print(ans)

Submission status: Runtime Error

Solution code:
l,r = input().split()
N = 2019
  
ans = (l * (l + 1)) % N;
count = 0;
for i in range(l,r-1):
  if(count >= (N - 1)) break
  for j in range(l+1,r):
    if(count >= (N - 1)) break
    if(ans > (i * j) % N) ans = (i * j) % N
    count++;
    
printf("%lu\n",ans);
return 0

Submission status: Runtime Error

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

if L-R > 2018:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):

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

Submission status: Runtime Error

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

if L-R > 672:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if minMod > tmp:
                minMod = tmp
            elif tmp == 0:
                minMod = 0 
                break
    print(minMod)

Submission status: Runtime Error

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

if L-R > 672:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if minMod > tmp:
                minMod = tmp
                
            elif tmp == 0:
                minMod = 0 
                break
    print(minMod)

Submission status: Runtime Error

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

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

if L-R > 672:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if minMod > tmp:
                minMod = tmp
                
            elif tmp == 0:
                minMod = 0 
                break
    print(minMod)

Submission status: Runtime Error

Solution code:

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

if L-R > 672:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if minMod > tmp:
                minMod = tmp
                
            else if tmp == 0:
                minMod = 0 
                break
    print(minMod)

Submission status: Runtime Error

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

if(L%2019==0 or R%2019==0 or (L<2019 and 2019<R)):
	print(0)
elif(L>2019):
	count = 2
	while(2019*count<L):
		coun+=1
	if(count==2):
		print((L*(L+1)%2019))
	else:
		print(0)
else:
	print((L*(L+1)%2019))

Submission status: Runtime Error

Solution code:
mod=[]
answer = 2018
count = 0
sub=0
mod = [int(i) for i in input().split()]
if(i+1==mod[1]):
    answer = (mod[0]*mod[1])%2019

for i in range(mod[0],mod[1]+1):
    for j in range(i+1,mod[1]+1):
        sub = (i*j)%2019
        if sub<answer:
            answer = sub
            print(answer)
    if count == 2018:
        break
    count = count + 1
print(answer)

Submission status: Runtime Error

Solution code:
import itertools

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

comb = itertools.combinations(range(L, R + 1), 2)
result = float('inf')
for a, b in comb:
    mod = a * b % 2019
    if mod == 0:
        result = 0
        break
    elif mod < result:
        result = mod
print(result)

Submission status: Runtime Error

Solution code:
import itertools

L, R = map(int, input().split())
comb = itertools.combinations(range(L, R + 1), 2)
result = float('inf')
for a, b in comb:
    mod = a * b % 2019
    if mod == 0:
        result = 0
        break
    elif mod < result:
        result = mod
print(result)

Submission status: Runtime Error

Solution code:
import itertools

L, R = map(int, input().split())
comb = itertools.combinations(range(L, R + 1), 2)
result = float('inf')
for a, b in comb:
    mod = a * b % 2019
    if mod == 0:
        result = 0
        break
    else mod < result:
        result = mod
print(result)

Submission status: Runtime Error

Solution code:
import itertools

L, R = map(int, input().split())
comb = itertools.combinations(range(L, R + 1), 2)
result = float('inf')
for a, b in comb:
    mod = a * b % 2019
    if mod < result:
        result = mod
print(result)

Submission status: Runtime Error

Solution code:
import itertools

L, R = map(int, input().split())
comb = itertools.combinations(range(L, R + 1), 2)
mods = []
for a, b in comb:
    mods.append(a * b % 2019)
print(min(mods))

Submission status: Runtime Error

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

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

print(minimum)

Submission status: Runtime Error

Solution code:
lr = input().split()
l = int(lr[0])
r = int(lr[1])

mini = 2020
for i in range(l, r+1):
  j = i+1
  while j>i and j<=r:
    q = (i*j)%2019
    j = j + (2018-q)//i
    mini = min(mini, q)
    
print(mini)

Submission status: Runtime Error

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

yakusuu2019 = [3,673]

def mod2019(L, R):
  if R-L == 1:
    return L*R
  else:
    tmp = [(i,j,i*j,i*j%2019) for j in range(L,R+1) for i in range(L,R+1)].sort(key=lambda x:x[3])
    return tmp[0][2]
  
print(mod2019(L,R))

Submission status: Runtime Error

Solution code:
A=list(map(int,input().split()))
t=True
C=2019
if t:
    for i in range(A[1]):
        for t in range(A[1]+1):
            if t>i and i>=A[0]:
                if i-t>2019:
                  	C=0
                    t=False
                    break
                else:
                    if t*i%2019<C:
                        C=t*i%2019
print(C)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,d = map(int,input().split(" "))
ar = []
br = []
count = 0
for i in range(40):
    br.append(i ** 2)
for i in range(n):
    l = list(map(int,input().split(" ")))
    ar.append(l)
for i in range(n):
    for j in range(i+1,n):
        c = 0
        for k in range(d):
            c += (ar[i][k] - ar[j][k]) ** 2
        if c in br:
            count += 1
print(count)

Submission status: Runtime Error

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

l = L // mod
r = R // mod

if l != r:
    print(0)
else:
   l_ = L % mod
   r_ = R % mod
   ans = 2019
   for i in range(l_, r_):
       for j in range(i+1, r_+1):
           a = i * j % mod
           ans = min(ans, a)
           if ans == 1:
               break
        if ans == 1:
            break
   print(ans)

Submission status: Runtime Error

Solution code:
L, R = map(int,input().split())
l , r = L//2019, R//2019
if R - L >= 2019:
    print(0)
else:
    flag=0
    Amari=[]
    for i in range(L,R-1):
        amari = i % 2019
        if i %3 == 0:
            flag = True
        Amari.append(amari)
    if 673 in Amari and flag:
        print(0)
    else:
        print(min(Amari)*(min(Amari)+1))