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 slove():
    import sys
    input = sys.stdin.readline
    l, r = list(map(int, input().rstrip('\n').split()))
    mmod = 10 ** 10
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            print((i * j) % 2019)
            mmod = min(mmod, (i * j) % 2019)
            if mmod == 0:
                break
        if mmod == 0:
            break
    print(mmod)


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

Solution code:
def main():
    L, R = map(int, input().split())
    # 60 の相異なる素因数は 3, 673 の 2つ
    if L + 672 <= R:
        print(0)
        return
    elif 0 in (L % 2019, R % 2019):
        print(0)
        return
    elif R % 673 <= L % 673 and L + 2 <= R:
        print(0)
        return
    ans = (L ** 2 + L) % 2019
    print(ans)
    return


main()

Submission status: Wrong Answer

Solution code:
def main():
    L, R = map(int, input().split())
    # 60 の相異なる素因数は 3, 673 の 2つ
    if L + 672 <= R:
        print(0)
        return
    lst = []
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            if i * j % 2019 == 0:
                print(0)
                return
            elif i * j % 2019 == 1:
                break
            lst.append(i * j % 2019)
        if i * j % 2019 == 1:
            break
    print(min(lst))
    return


main()

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

l_mod = l % 2019
r_mod = r % 2019
if l != r and l_mod >= r_mod:
    r_mod += 2019

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

print(ans)

Submission status: Wrong Answer

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

l_mod = l % 2019
r_mod = r % 2019
if l != r and l_mod >= r_mod:
    r_mod += 2019

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

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    L, M = map(int, input().split())
    if L + 2018 <= M:
        print(0)
        return
    for i in range(L, M + 1):
        if i % 2019 == 0:
            print(0)
            return
    print((L ** 2 + L) % 2019)
    return


main()

Submission status: Wrong Answer

Solution code:
def main():
    L, M = map(int, input().split())
    if L + 2018 <= M:
        print(0)
        return
    for i in range(L, M + 1):
        if L % 2019 == 0:
            print(0)
            return
    print((L ** 2 + L) % 2019)
    return


main()

Submission status: Wrong Answer

Solution code:
def main():
    L, M = map(int, input().split())
    for i in range(L, M + 1):
        if L % 2019 == 0:
            print(0)
            return
    print((L ** 2 + L) % 2019)
    return


main()

Submission status: Wrong Answer

Solution code:
def main():
    L = int(input().split()[0])
    if L % 2019 in (2018, 2019):
        print(0)
    else:
        print((L ** 2 + L) % 2019)
    return


main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans=2019
for i in range(l,r):
    for k in range(i+1,r+1):
        ans=min(ans,(i%2019)*(k%2019))
print(ans)

Submission status: Wrong Answer

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

for i in range(l,r+1):
    if i%2019==0:
        print(0)
        exit()
    li.append(i%2019)

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

Submission status: Wrong Answer

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

for i in range(l,r+1):
    if i%2019==0:
        print(0)
        exit()
    li.append(i%2019)

li.sort()
print(li[0]*li[1])

Submission status: Wrong Answer

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

for i in range(l+1,r):
    t=min(t,i%2019)

print(t*(t+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if R - L > N:
    print(0)
else:
    tmp_i = tmp_j = 0
    num = -1
    for i in range(L, R):
        if num == -1:
            num = i * (i + 1) % N
        else:
            num = min(num, i*(i+1)%N)
    print(num)

Submission status: Wrong Answer

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

l = L // N
r = R // N

if l < r:
    print(0)
else:
    t = L % N
    print((t * (t + 1)) % N)

Submission status: Wrong Answer

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

l = L % N
r = R % N

if l >= r:
    print(0)
elif L + 2019 <= R:
    print(0)
else:
    print((l * (l + 1)) % N)

Submission status: Wrong Answer

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

l = L % N
r = R % N

if l >= r:
    print(0)
elif L + 2019 <= R:
    print(0)
else:
    t = min(l , r)
    print(t * (t + 1))

Submission status: Wrong Answer

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

i = L % 2019
j = R % 2019

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

Submission status: Wrong Answer

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

i = L % 2019
j = R % 2019

if(R - L >= 2019 or j < i): print(0)
else: print(i * (i + 1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from heapq import heapify, heappop

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

a = [v%2019 for v in range(L, R+1)]
heapify(a)

x = heappop(a)
y = heappop(a)
print(x*y)

Submission status: Wrong Answer

Solution code:
from heapq import heapify, heappop

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

a = [v%2019 for v in range(L, R+1)]
heapify(a)

print(heappop(a)*heappop(a))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

m = 2000000001
if r-l >= 2019:
    print(0)
else:
      for i in range(l,r+1):
            for j in range(l+1,r+1):
                  if (i*j)%2019<m:
                        m = (i*j)%2019
      print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = (int(x) for x in input().split())
ans = 2020
if r - l > 2019: print(0)
elif r * l < 2019: print(r*l)
else:
    for i in range(l, r-1):
        for j in range(i+1, r):
            if ((i*j) % 2019 < ans): ans = (i*j) % 2019
            if ((i*j) % 2019 == 0):
                ans = 0
                break

    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,s=map(int,input().split())
if s-a<2019:
  ans=0
  for i in range(a,s):
      for f in range(i+1,s+1):
        ans=max(ans,((i%2019)*(f%2019))%2019)
  print(ans)
else:
  print(2018)

Submission status: Wrong Answer

Solution code:
a,s=map(int,input().split())
if s-a<2019:
  ans=0
  for i in range(a,s):
      for f in range(i+1,s+1):
        ns=max(ans,((i%2019)*(f%2019))%2019)
  print(ans)
else:
  print(2018)

Submission status: Wrong Answer

Solution code:
a,s=map(int,input().split())
if s-a<2019:
  ans=0
  for i in range(a,s):
      for f in range(i+1,s+1):
        ns=max(ans,((i%2019)*(f%2019))%2019)
  print(a)
else:
  print(2018)

Submission status: Wrong Answer

Solution code:
a,s=map(int,input().split())
if s-a<2019:
  a=0
  for i in range(a,s):
      for f in range(i+1,s+1):
        a=max(a,((i%2019)*(f%2019))%2019)
  print(a)
else:
  print(2018)

Submission status: Wrong Answer

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

delim_list = [x % 2019 for x in range(L, R+1)]

if len(delim_list) >= 2019:
  print(0)
  exit()

ans_list = []

for x in delim_list:
  for y in delim_list:
    if x >= y:
      continue
    
    ans_list.append(x * y)
    
print(min(ans_list))

Submission status: Wrong Answer

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

delim_list = [x % 2019 for x in range(L, R+1)]
delim_set = set(delim_list)
delim_list2 = list(delim_set)

ans_list = []

for x in delim_list2:
  for y in delim_list2:
    if x == y:
      continue
    
    ans_list.append(x * y)
    
print(min(ans_list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def main():
    l, r = map(int, open(0).read().split())
    MOD = 2019
    l %= MOD
    r %= MOD
    if l > r:
        r += MOD

    ans = float('inf')
    for i in range(l, r):
        for j in range(i+1, r+1):
            ans = min(ans, i * j % MOD)

    print(ans)
    return()

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
l,r= list(map(int, input().split()))
if (r-l)//2019>1:
    print(0)
else:
    mi=1000000000
    for i in range(l,r):
        for j in range(i+1,r+1):
            I=i%2019
            J=j%2019
            mi=min(mi,I*J)
    print(mi)

Submission status: Wrong Answer

Solution code:
l,r= list(map(int, input().split()))
if (r-l)//2019>1:
    print(0)
else:
    li=[0]*(r-l+1)
    for i in range(r-l+1):
        li[i]=(i+l)%2019
    li.sort()
    print(li[0]*li[1])

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
a = L % 2019
b = R % 2019
if ((int(L/2019)) >= (int(R/2019))):
  print((a * (a+1)) % 2019)
else:
  print((a * b) % 2019)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
a = L % 2019
b = R % 2019
if ((int(L/2019)) >= (int(R/2019))):
  print(a * (a+1))
else:
  print(a*b)

Submission status: Wrong Answer

Solution code:
def solve():
    L,R = map(int, input().split())
    L %= 2019
    if L >= R%2019:
        R = 2018
    else:
        R %= 2019

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

solve()

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
if r-l >= 2019:
    print(0)
else:
    ret_val =2019
    for left_val in range(l, r-1):
        for right_val in range(left_val+1, r):
            ret_val = min(ret_val, (left_val * right_val) % 2019)
    print(ret_val)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
b, c = map(int, input().split())
if c-b >=2018:
    print(0)
else:
    t = b%2019
    if t+(c-b+1) >= 2019:
        print(0)
    else:
        import numpy as np
        ind = [t+i for i in range(c-b+1)]
        print(np.min(ind*np.array(ind).reshape((len(ind),-1))%2019))

Submission status: Wrong Answer

Solution code:
L, R = list(map(int, input().split()))
I = 2018
J = 2018
for i in range (L,R+1):
    for N in range(2019): 
        if i % 2019 == N:
            I = i % 2019
            break
    break
ansA = I * I -1
ansB = I * I+1
if ansA < ansB and ansA != 0:
    print(ansA)
else:
    print(ansB)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=list(map(int,input().split()))
a=int(s[0])
b=int(s[1])
list=[]
list.append(a%2019)
list.append(b%2019)
e=100000
if a+2018<=b:
  print(0)
else:
  if list[0]<list[1]:
    for i in range(list[0],list[1]):
      d=(i*(i+1))%2019
      e=min(e,d)
    print(e)
  else:
    print(0)

Submission status: Wrong Answer

Solution code:
s=list(map(int,input().split()))
a=int(s[0])
b=int(s[1])
list=[]
list.append(a%2019)
list.append(b%2019)
if a+2018<=b:
  print(0)
else:
  if list[0]<list[1]:
    d=(list[0]*(list[0]+1))%2019
    print(d)
  else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
l,r=map(int,input().split())

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
l,r=map(int,input().split())

if r-l>=2018:
    print(0)
else:
    s=[i for i in range(l,r+1)]
    for i in range(len(s)):
        s[i]=s[i]%2019
    s.sort()
    print((s[0]*s[1])%2019)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
l,r=map(int,input().split())

if r-l>=2019:
    print(0)
else:
    s=[i for i in range(l,r+1)]
    for i in range(len(s)):
        s[i]=s[i]%2019
    s.sort()
    print(s[0]*s[1])

Submission status: Wrong Answer

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

minimum = 2020

for i in range(L,R-1):
    for j in range(i+1,R):
        mod = (i*j)%2019
        if minimum > mod:
            minimum = mod
        
print(minimum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
print(l * (l + 1) % 2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
lr = [l]
n = 2019
v = 2019
i = 2
while n < 10**9:
    if l < n and n < r:
        lr.append(n)
    n = v * i
    i += 1
lr.append(r)
if len(set(lr)) > 2:
    ans = 1
else:
    ans = (l*(l+1))%2019
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin

l,r = [int(x) for x in stdin.readline().rstrip().split()]
m = 2020
le = r-l+1
for i in range(le-1):
    for j in range(i+1,le):
        if i*j%2019 == 0:
            print(0)
            exit()
        else:
            m = min(m,i*j%2019)
print(m)

Submission status: Wrong Answer

Solution code:
from sys import stdin
import itertools

l,r = [int(x) for x in stdin.readline().rstrip().split()]

if r-l >= 2019:
    print(0)
else:
    li = [x%2019 for x in range(l,r+1)]
    li.sort()
    print(li[0]*li[1]%2019)

Submission status: Wrong Answer

Solution code:
from sys import stdin
import itertools

l,r = [int(x) for x in stdin.readline().rstrip().split()]

if r-l >= 2019:
    print(0)
else:
    li = [x%2019 for x in range(l,r+1)]
    li.sort()
    print(li[0]*li[1])

Submission status: Wrong Answer

Solution code:
import heapq

l,r = map(int,input().split())
n = r - l + 1
if n >= 2019:
	print(0)
else:
	l_to_r = []
	for i in range(l,r+1):
		l_to_r.append(i % 2019)
	heapq.heapify(l_to_r)
	minimum1 = heapq.heappop(l_to_r)
	minimum2 = heapq.heappop(l_to_r)
	print(minimum1*minimum2 % 2019)

Submission status: Wrong Answer

Solution code:
import heapq

l,r = map(int,input().split())
n = r - l + 1
if n >= 2019:
	print(0)
else:
	l_to_r = []
	for i in range(l,r+1):
		l_to_r.append(i % 2019)
	heapq.heapify(l_to_r)
	minimum1 = heapq.heappop(l_to_r)
	minimum2 = heapq.heappop(l_to_r)
	print(minimum1*minimum2)

Submission status: Wrong Answer

Solution code:
import heapq

l,r = map(int,input().split())
n = r - l + 1
l_to_r = []
for i in range(l,r+1):
	l_to_r.append(i % 2019)

heapq.heapify(l_to_r)
minimum1 = heapq.heappop(l_to_r)
minimum2 = heapq.heappop(l_to_r)

print(minimum1*minimum2)

Submission status: Wrong Answer

Solution code:
from sys import stdin

l,r = [int(x) for x in stdin.readline().rstrip().split()]

li  = [x for x in range(l,r+1)]

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

lin = []
for i in range(len(li)-1):
    kai = li[i]*li[i+1]%2019
    if kai == 0:
        print(0)
        exit()
    lin.append(kai)
print(min(lin))

Submission status: Wrong Answer

Solution code:
from sys import stdin

l,r = [int(x) for x in stdin.readline().rstrip().split()]

li  = [x for x in range(l,r+1)]

lin = []
for i in range(len(li)-1):
    kai = li[i]*li[i+1]%2019
    if kai == 0:
        print(0)
        exit()
    lin.append(kai)
print(min(lin))

Submission status: Wrong Answer

Solution code:
from sys import stdin

l,r = [int(x) for x in stdin.readline().rstrip().split()]

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

li  = [x for x in range(l,r+1)]
lin = []
for i in range(len(li)-1):
    lin.append(li[i]*li[i+1]%2019)
print(min(lin))

Submission status: Wrong Answer

Solution code:
from sys import stdin

l,r = [int(x) for x in stdin.readline().rstrip().split()]

li = [x for x in range(l,r+1)]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
lmod = L % 2019
rmod = R % 2019
if lmod < rmod:
    print(lmod * (lmod + 1))
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
b, c = map(int, input().split())
if c-b >=2018:
    print(0)
else:
    t = b%2019
    if t+(c-b+1) >= 2019:
        print(0)
    else:
        import numpy as np
        ind = [t+i for i in range(c-b+1)]
        print(np.dot(ind, np.array(ind).T)%2019)

Submission status: Wrong Answer

Solution code:
b, c = map(int, input().split())
if c-b >=2018:
    print(0)
else:
    t = b%2019
    if t+(c-b+1) >= 2019:
        print(0)
    else:
        print(t*(t+1)%2019)

Submission status: Wrong Answer

Solution code:
b, c = map(int, input().split())
if c-b >=2018:
    print(0)
else:
    t = b%2019
    if t+(c-b+1) >= 2019:
        print(0)
    else:
        print(t*(t+1))

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
list_LR = range(L,R+1)

list_aaa =[]

for i in range(R-L):
    list_aaa.append((list_LR[i]*list_LR[i+1])%2019)


print(min(list_aaa))

Submission status: Wrong Answer

Solution code:
import sys
from itertools import combinations
l, r = [int(i) for i in sys.stdin.readline().split()]
l %= 2019
r %= 2019
flg = r - l >= 2019
res = 1e9
if l >= r or flg:
    print(0)
else:
    for (_l, _r) in combinations(list(range(l,r+1)), 2):
        if _l == _r:
            continue
        res = _l * _r % 2019 if _l * _r % 2019 < res else res
    print(res)

Submission status: Wrong Answer

Solution code:
import sys
from itertools import combinations
l, r = [int(i) for i in sys.stdin.readline().split()]
l %= 2019
r %= 2019
res = 1e9
if l > r:
    print(0)
else:
    for (_l, _r) in combinations(list(range(l,r+1)), 2):
        if _l == _r:
            continue
        res = _l * _r if _l * _r < res else res
    print(res)

Submission status: Wrong Answer

Solution code:
import sys
l, r = [int(i) for i in sys.stdin.readline().split()]
l %= 2019
r %= 2019
res = 1e9
for _l in range(l, r):
    for _r in range(min(_l+1, r), r+1):
        res = _l * _r if _l * _r < res else res
print(res)

Submission status: Wrong Answer

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

a = l % 2019
b = r % 2019

if b - a == r - l:
    print(a*(a+1)%2019)
else:
    print(0)

Submission status: Wrong Answer

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

a = l % 2019
b = r % 2019

if b - a == r - l:
    print(a*(a+1))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
x,y = map(int,input().split())
a=[2019*i for i in range(1000000)]
q=((x//2019))*2019+1
w=q+1
if (not x in a) and (not y in a):
	if x>=2019:
		print((q*w)%2019)
	elif x<2019:
		print(x*y)
else:
  print(0)

Submission status: Wrong Answer

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

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

print(temp)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
temp = 2 * 10 ^ 9 + 1

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

print(temp)