Problem: 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.

Submission attempts (in order):
x,y = map(int,input().split())
min = 2019
for i in range(y - x):
  s = (x + i) % 2019
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
for j in range(y -x):
  g = (x + i) % 2019
  if g == 0:
    break
  elif min2 > g and g == s:
    min2 =g

if s != 0:
  z = (s*g)%2019
  print(z)


x,y = map(int,input().split())
x = x % 2019
y = y % 2019
min = 2019
n = y-x
i=0
while i<n:
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
j=0
while j<n:
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif min2 > g and g != min:
    min2 =g

if min != 0:
  z = (min*min2)%2019
  print(z)


x,y = map(int,input().split())
min = 2019
n = y-x
i=0
while(i<n):
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
j=0
while(j<n):
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif min2 > g and g == s:
    min2 =g

if s != 0:
  z = (s*g)%2019
  print(z)


x,y = map(int,input().split())
min = 2019
n = y-x
i=0
while(i<n):
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
j=0
while(j<n):
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif min2 > g and g != min:
    min2 =g

if s != 0:
  z = (min*min2)%2019
  print(z)


x,y = map(int,input().split())
x = x % 2019
y = y % 2019
min = 2019
n = y-x
i=0
while(i<n):
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
j=0
while(j<n):
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif min2 > g and g != min:
    min2 =g

if min != 0:
  z = (min*min2)%2019
  print(z)


x,y = map(int,input().split())
min = 2019
n = y-x
for i in range(n):
  s = (x + i) % 2019
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
for j in range(n):
  g = (x + j) % 2019
  if g == 0:
    break
  elif min2 > g and g == s:
    min2 =g

if s != 0:
  z = (s*g)%2019
  print(z)


x,y = map(int,input().split())
min1 = 2019
n = y-x
i=0
while(i<n):
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min1 > s:
    min1 = s:
minmin = 2019
j=0
while(j<n):
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif minmin > g and g == s:
    minmin =g

if s != 0:
  z = (min1*minmin)%2019
  print(z)


x,y = map(int,input().split())
min = 2019
n = y-x
i=0
while(i<n):
  s = (x + i) % 2019
  i = i +1
  if s == 0:
    print(s)
    break
  elif min > s:
    min = s:
min2 = 2019
j=0
while(j<n):
  g = (x + j) % 2019
  j=j+1
  if g == 0:
    break
  elif min2 > g and g == s:
    min2 =g

if s != 0:
  z = (min*min2)%2019
  print(z)


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

min = 2019

for i in range(l, r+1):
    for j in range(i+1, r+1):
        p = (i % 2019)*(j % 2019) % 2019
        if p < min:
            min = p

        if min == 0:
            print("0")
            exit()

print(min)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted