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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
a = float("inf")
if (r-l)>=2019:
  print("0")
else:
  for i in range(l,r+1):
    if i%2019 == 0:
      print("0")
      break
    else:
      for j in range(i+1,r+1):
        a = min(a,i*j%2019)
print(a)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
a = float("inf")
if (r-l)>=2019:
  print("0")
else:
  l %= 2019
  r %= 2019
  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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
p = 2019
L, R = [x % p for x in list(map(int, input().split()))]

def main():
  if L < R:
    ans = L * (L+1)
  else:
    ans = 0
  print(ans)
  
main()

Submission status: Wrong Answer

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

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

for i in range(R-L+1):
  A = L + i
  if A % 2019 == 0:
    print(0)
    exit()
  if A % 637 == 0:
    if R-L > 2 or L%3 == 0 or R%3 == 0:
      print(0)
      exit()

print((L*(L+1))% 2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
a = float("inf")
if (r-l)>=2019:
  print("0")
else:
  for i in range(l,r+1):
    if a > i % 2019:
      a = i % 2019
  print(a*(a+1)%2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
a = float("inf")
if (r-l)>=2019:
  print("0")
else:
  for i in range(l,r+1):
    if a > i % 2019:
      a = i % 2019
  print(a*(a+1))

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
a = float("inf")
if (r-l)>=2019:
  print("0")
else:
  for i in range(l,r+1):
    if (i % 2019)== 0:
      print("0")
      break
    elif a > i % 2019:
      a = i % 2019
  print(a*(a+1))

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
a = float("inf")
if (r-l)>=2019:
  print(0)
else:
  for i in range(l,r+1):
    if i == 0:
      print(0)
      break
    elif a > i % 2019:
      a = i % 2019
  print(a*(a+1))

Submission status: Wrong Answer

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

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

for i in range(R-L+1):
  A = L + i
  if A % 2019 == 0:
    print(0)
    exit()

print((L*(L+1))% 2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
a = float("inf")
if (r-l)>=2019:
  print(0)
else:
  for i in range(l,r+1):
    if i == 0:
      print(0)
      break
    elif a > i % 2019:
      a = i
  print(i*(i+1))

Submission status: Wrong Answer

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

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

for i in range(R-L):
  A = L + i
  if A % 2019 == 0:
    print(0)
    exit()

print((L*(L+1))% 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = input().strip().split(" ")
L = int(l)
R = int(r)
minimum = float("inf")
if L == R or L == R+1 or R == L+1:
    minimum = (L*R) % 2019
else:
    for i in range(L, R):
        for o in range(i+1, R):
            if (i*o) % 2019 < minimum:
                minimum = (i*o) % 2019
print(minimum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input().split()
i = int(n[0])
j = int(n[1])
print(i*j%2019)

Submission status: Wrong Answer

Solution code:
n = input().split()
i = int(n[0])
j = int(n[1])
print((i%2019)*(j%2019)%2019)

Submission status: Wrong Answer

Solution code:
n = input().split()
i = int(n[0])
j = int(n[1])
print((i%2019*j%2019)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, (input().split()))
Lmod, Rmod = L%2019, R%2019
print(L,R,Lmod,Rmod)

if Lmod < Rmod and (R - L >= 2019):
    print(0)
elif Lmod < Rmod and (R - L < 2019):
    ch_list =[]
    for i in range(L,R,1):
        for j in range(i+1, R+1, 1):
            ch_list.append((i*j)%2019)
    print(ch_list)
    print(min(ch_list))
elif Lmod > Rmod:
    print(0)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
Lmod, Rmod = (L % 2019, R % 2019)

if Lmod < Rmod:
	print(Lmod * (Lmod+1))
elif Lmod > Rmod:
	print(0)

Submission status: Wrong Answer

Solution code:
import sys

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

num_list = list()
for i in range(L,R+1):
	if i == 2019:
		print(0)
		sys.exit()
	num_list.append(i%2019)
num_list.sort()
print(num_list[0]*num_list[1])

Submission status: Wrong Answer

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

num_list = list()
for i in range(L,R+1):
	num_list.append(i%2019)
num_list.sort()
print(num_list[0]*num_list[1])

Submission status: Wrong Answer

Solution code:
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

print(mod)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

l = L%2019
r = R%2019
answer = 0

if l-r >= 0 or R - L >= 2018:
    print(answer)
else:
    for i in range(r-l):
        for j in range(r-l-i):
            k = i + l
            m = j + l + i + 1
            if i == 0 and j == 0:
                answer = (k*m)%2019
            if answer >= (k*m)%2019:
                answer = (k*m)%2019
print(answer)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

l = L%2019
r = R%2019
answer = 0

if l-r >= 0 or R - L >= 2019:
    print(answer)
else:
    for i in range(r-l):
        for j in range(r-l-i):
            k = i + l
            m = j + l + i + 1
            if i == 0 and j == 0:
                answer = (k*m)%2019
            if answer >= (k*m)%2019:
                answer = (k*m)%2019
print(answer)

Submission status: Wrong Answer

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

ans = L * (L + 1) % 2019

for i in range(L,R+1):
    if i % 2019 == 0:
        ans = 0
        break

print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if R - L >= 2019:
    ans = 0
else:
    tmp_min = 10 ** 7
    li = [i for i in range(L, R+1)]
    for i in li:
        for j in li:
            if i == j:
                pass
            else:
                tmp = (i % 2019) * (j % 2019)
                if tmp < tmp_min:
                    tmp_min = tmp

    ans = tmp_min
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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)
else:
    N = R - L
    A = []
    if(N == 1):
        print((L * R) % 2019)
    else:
        for i in range(N - 1):
            for j in range(i):
                A.append(((L + i) * (L + j)) % 2019)
        print(min(A))

Submission status: Wrong Answer

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)
else:
    N = R - L
    A = []
    if(N >= 1):
        print(L * R % 2019)
    else:
        for i in range(N - 1):
            for j in range(i):
                A.append((L + i) * (L + j) % 2019)
        print(min(A))

Submission status: Wrong Answer

Solution code:
def C_RemainderMinimization2019():
    L, R = map(int, input().split())
    ans = (L * R) % 2019
    if R - L < 2019:
        for i in range(L, R - 1):
            for j in range(i + 1, R ):
                ans = min(ans, (i * j) % 2019)
    else:
        for i in range(L, L + 2018):
            for j in range(i + 1, L + 2019):
                ans = min(ans, (i*j) % 2019)
                if ans == 0:
                    break
    print(ans)
if __name__ == "__main__":
    C_RemainderMinimization2019()

Submission status: Wrong Answer

Solution code:
def C_RemainderMinimization2019():
    L, R = map(int, input().split())
    L_div = L // 2019
    R_div = R // 2019
    L_mod = L % 2019
    R_mod = R % 2019
    ans = 0
    if L_div == R_div:
        if R_mod >= 46 and L_mod <= 45:
            ans = 51
        else:
            ans = (L * (L + 1)) % 2019
    print(ans)
if __name__ == "__main__":
    C_RemainderMinimization2019()

Submission status: Wrong Answer

Solution code:
def C_RemainderMinimization2019():
    L, R = map(int, input().split())
    L_div = L // 2019
    R_div = R // 2019
    L_mod = L % 2019
    R_mod = R % 2019
    ans = 0
    if L_div == R_div:
        if R_mod >= 46 and L_mod <= 45:
            ans = 2
        else:
            ans = (L * (L + 1)) % 2019
    print(ans)
if __name__ == "__main__":
    C_RemainderMinimization2019()

Submission status: Wrong Answer

Solution code:
def C_RemainderMinimization2019():
    L, R = map(int, input().split())
    L_div = L // 2019
    R_div = R // 2019
    L_mod = L % 2019
    R_mod = R % 2019
    ans = 0
    if L_div == R_div:
        if R_mod > 46:
            ans = 2
        else:
            ans = (L * (L + 1)) % 2019
    print(ans)
if __name__ == "__main__":
    C_RemainderMinimization2019()

Submission status: Wrong Answer

Solution code:
def C_RemainderMinimization2019():
    L, R = map(int, input().split())
    L_mod = L // 2019
    R_mod = R // 2019
    ans = 0
    if L_mod == R_mod:
        ans = (L * (L + 1)) % 2019
    print(ans)
if __name__ == "__main__":
    C_RemainderMinimization2019()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import fractions

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] / fractions.gcd(lst2[0], lst2[1]))

print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split(' '))
MIN = 2018
for i in range(L,R+1):
  for j in range(i+1,R):
    A = i * j
    if L <= i and j <= R:
      MIN = min(A%2019,MIN)
print(MIN)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mod = 2019
ans = 10 ** 7
results = [False for _ in range(2019)]
for low in range(L, R+1):
    for up in range(low+1, R+1):
        ans = min(ans, low * up % mod)
        if ans == 0:
            exit()
        # results[low * up % mod] = True
        # if all(results):
        #     print(ans)
        #     exit()
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

A = []
for i in range(L,R+1):
	A.append(i%2019)

B = sorted(A)
print(A[0]*A[1])

Submission status: Wrong Answer

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

if L == 0:
    print(0)
    print('a')
elif not L // 2019 == R // 2019:
    print(0)
    print('b')
else:
    L %= 2019
    R %= 2019
    ans = 2020
    for i in range(L, R):
        for j in range(i+1, R+1):
            tmp = (i * j) % 2019
            if tmp < ans:
                ans = tmp
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
l, r = (int(x) for x in input().split())
tmpmin = 2019
if r-l >= 2019:
    print(0)
else:
    for i in range(l, r):
        for j in range(l+1, r+1):
            tmp = (i*j)%2019
            if tmp < tmpmin:
                tmpmin = tmp
                if tmpmin == 0:
                    sys.exit()
    print(tmpmin)

Submission status: Wrong Answer

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


if r-l >= 2019:
    print(0)
    sys.exit()

ans = 1.0e100
for i in range(l, r):
    for j in range(i + 1, r):
        ans = min(ans, i * j % 2019)
print(int(ans))

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
y = 2019
l1 = L // y
l2 = L % y
r1 = R // y
r2 = R % y
ans = 0 if l1 < r1 else l2 * (l2 + 1)
print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
a = (l-1)//2019
b = r//2019
if a!=b:
  print('0')
  exit()
l=l%2019
r=r%2019
res=2019
for i in range(l, r+1):
  for j in range(i, r+1):
    temp = (i*j)%2019
    if temp<res:
      res=temp
print(res)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
a = (l-1)//2019
b = r/2019
if a!=b:
  print('0')
  exit()
l=l%2019
r=r%2019
res=10000000000
for i in range(l, r+1):
  for j in range(i, r+1):
    temp = (i*j)%2019
    if temp<res:
      res=temp
print(res)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
a = (l-1)//2019
b = r/2019
if a!=b:
  print('0')
  exit()
if l<2019:
  a = l%2019
elif l>2019:
  a = l%2019
  b=(l+1)%2019
if r<2019:
  b = (l+1)%2019
elif r>2019 and l<2019:
  print('0')
  exit()
print((a*b)%2019)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
a=1
b=1
if l<2019:
  a = l%2019
elif l>2019:
  a = l%2019
  b=(l+1)%2019
if r<2019:
  b = (l+1)%2019
elif r>2019 and l<2019:
  print('0')
  exit()
print(a*b%2019)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
l1=l%2019
lm=l+2019-l1

if r>lm:
    ans=0
else:
    r1=r%2019
    ans=4072324
    for x in range(l1,r1+1):
        for z in range(x+1,r1+1):
            ansnow=x*z
            
            if ansnow<ans:
                ans=ansnow
print(ans)

Submission status: Wrong Answer

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

print(mod)

Submission status: Wrong Answer

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

print(mod)

Submission status: Wrong Answer

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input133c.txt')

#+++++

i,j= map(int, input().split())
modi = i % 2019
modj = j % 2019
if j - i > 2019:
	print(0)
elif j - i == 1:
	print(modi * modj % 2019)
else:
	num = 2019
	for n in range(modi, modj):
		for m in range(modi+1,modj):
			mod = n * m % 2019
			if mod < num:
				num = mod
		
	print(num)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
a = L - 2019
b = R - 2019

if b <= 0:
    i = R - 1
    j = R
    print((i * j) % 2019)
elif a >= 0:
    i = L
    j = L + 1
    print((i * j) % 2019)
else:
    print(1)

Submission status: Wrong Answer

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input133c.txt')

#+++++

i,j= map(int, input().split())
modi = i % 2019
modj = j % 2019
if j - i > 2019:
	print(0)
elif j - i == 1:
	print(i * j % 2019)
else:
	num = 2019
	for n in range(modi, modj):
		for m in range(modi+1,modj):
			mod = n * m % 2019
			if mod < num:
				num = mod
		
	print(num)

Submission status: Wrong Answer

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input133c.txt')

#+++++

i,j= map(int, input().split())
modi = i % 2019
modj = j % 2019
if j - i >= 2019:
	print(0)
elif j - i == 1:
	print(i * j % 2019)
else:
	num = 2019
	for n in range(modi, modj):
		for m in range(modi+1,modj):
			mod = n * m % 2019
			if mod < num:
				num = mod
		
	print(num)

Submission status: Wrong Answer

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input133c.txt')

#+++++

i,j= map(int, input().split())

if j - i >= 2019:
	print(0)
elif j - i == 1:
	print(i * j % 2019)
else:
	num = 2019
	for n in range(i, j):
		for m in range(i+1,j):
			mod = n * m % 2019
			if mod < num:
				num = mod
		
	print(num)

Submission status: Wrong Answer

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input133c.txt')

#+++++

i,j= map(int, input().split())

if j - i >= 2019:
	print(0)
elif j - i == 1:
	print(i * j % 2019)
else:
	num = 2019
	for n in range(i, j):
		print(n)
		for m in range(i+1,j):
			print(m)
			mod = n * m % 2019
			if mod < num:
				num = mod
		
	print(num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
l=L%2019
r=R%2019
if l<r:
  print(l*(l+1))
elif r>=l:
  print(0)

Submission status: Wrong Answer

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


if r-l >= 2019:
    print(0)
    sys.exit()

lm = l % 2019
rm = r % 2019

mods = sorted(list(range(lm, rm + 1)))
print(mods[0]*mods[1])

Submission status: Wrong Answer

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

lm = l % 2019
rm = r % 2019

if lm >= rm:
    print(0)
    sys.exit()

mods = sorted(list(range(lm, rm + 1)))
print(mods[0]*mods[1])

Submission status: Wrong Answer

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

if R-L == 1:
    print(R%2019 * L%2019)
    exit()

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

Submission status: Wrong Answer

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

if R-L == 1:
    print(R%2019 * L%2019)
    exit()

min_ = 10000
min_second = 100000
for i in range(L, min(R+1, L+2020)):
    if i%2019 < min_:
        min_second = min_
        min_ = i%2019
        if min_ == 0:
            print(0)
            exit()
    elif i%2019 < min_second:
        min_second = i%2019

print(min_ * min_second % 2019)

Submission status: Wrong Answer

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

if R-L == 1:
    print(R%2019 * L%2019)
    exit()

min_ = 10000
min_second = 100000
for i in range(L, min(R+1, L+2020)):
    if i%2019 < min_:
        min_second = min_
        min_ = i%2019
        if min_ == 0:
            print(0)
            exit()
    elif i%2019 < min_second:
        min_second = i%2019

print(min_ * min_second)

Submission status: Wrong Answer

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

if R-L == 1:
    print(R%2019 * L%2019)
    exit()

min_ = 10000
min_second = 100000
for i in range(L, min(R, L+2019)):
    if i%2019 < min_:
        min_second = min_
        min_ = i%2019
        if min_ == 0:
            print(0)
            exit()
    elif i%2019 < min_second:
        min_second = i%2019

print(min_ * min_second)

Submission status: Wrong Answer

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

if R-L == 1:
    print(R%2019 * L%2019)
    exit()

min = 10000
min_second = 100000
for i in range(L,R):
    if i%2019 < min:
        min_second = min
        min = i%2019
    elif i%2019 < min_second:
        min_second = i%2019

print(min * min_second)

Submission status: Wrong Answer

Solution code:
L,R = list(map(int, input().split()))
if L <= 2019 and 2019 <= R:
    print(0)
elif R - (L-1) >= 2019:
    print(0)
else:
    print(L % 2019 * (L+1)%2019)

Submission status: Wrong Answer

Solution code:
L,R = list(map(int, input().split()))
if L <= 2019 and 2019 <= R:
    print(0)
elif R - L > 2019:
    print(0)
elif R * (R-1) < 2019:
    print(L*(L+1))
else:
    print(L % 2019 * (L+1)%2019)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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
            if mod_new == 1:
                print(1)
                exit()
            else:
                mod = min(mod,mod_new)
    print(mod)                             
else:
    print((l*r)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
list1 = [int(i) for i in input().split()]
l = list1[0]
r = list1[1]
if (l// 2019 != 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: Wrong Answer

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 :
    	r = number
    	print( (r% 2019)*((r+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: Wrong Answer

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 :
    	r = number
    	print( (r% 2019)*(r+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: Wrong Answer

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

Submission status: Wrong Answer

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%2019)*((l+1)%2019))

Submission status: Wrong Answer

Solution code:
l,r = map(int, input().split())
 
mod = 2019
for j in range(r,l,-1):
    for i in range(j-1,l-1,-1):
        mod_new = (i*j)%2019
        ans = min(mod,mod_new)

print(ans)

Submission status: Wrong Answer

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+2021)):
        
        minimum = min(minimum, i * j // 2019)
        

print(minimum)

Submission status: Wrong Answer

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: Wrong Answer

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

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

print(minimum)

Submission status: Wrong Answer

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

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

print(minimum)

Submission status: Wrong Answer

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

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

print(minimum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if R-L+1<2019:
    a = 2018
    for i in range(L, R):
        m = (i*(i+1))%2019
        if m<a:
            a = m
else:
    a = 0

print(a)

Submission status: Wrong Answer

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

if R-L<2019:
    a = 2018
    for i in range(L, R+1):
        m = (i*(i+1))%2019
        if m<a:
            a = m
else:
    a = 0

print(a)

Submission status: Wrong Answer

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

if R-L<2019:
    a = 2018
    for i in range(L, R):
        m = (i*(i+1))%2019
        if m<a:
            a = m
else:
    a = 0

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = map(int, input().split())
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: Wrong Answer

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

Submission status: Wrong Answer

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