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:
l, r = map(int, input().split())
n = l-r+1
ans1 = 0
ans2 = 0
min1 = 1000000000
min2 = 10000000000


for i in range(min(n, 2024)):
    if (l+i) % 2019 == 0:
        print(0)
        break
else:
    print((l*(l+1)) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    l, r = [int(x) for x in input().split()]
    if r - l + 1 >= 5000:
        print(0)
    else:
        M = 2019
        mn = []
        for i in range(l, r + 1):
            mn.append(i%M)

        mn.sort()
        print((mn[0]*mn[1])%M)
        



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    l, r = [int(x) for x in input().split()]
    # if r - l + 1 >= 5000:
    #     print(0)
    # else:
    mn = []
    for i in range(l, r + 1):
        mn.append(i % 2019)

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



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    l, r = [int(x) for x in input().split()]
    if r - l + 1 >= 5000:
        print(0)
    else:
        mn = []
        for i in range(l, r + 1):
            mn.append(i % 2019)

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



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    l, r = [int(x) for x in input().split()]
    if r - l + 1 >= 2019:
        print(0)
    else:
        mn = []
        for i in range(l, r + 1):
            mn.append(i % 2019)

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



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

t = 4000
for i in range(l,r):
    for j in range(l+1,r+1):
        ans = min(i * j % 2019,t)
        #print(i,j)
        if ans == 0:
            exit()
            print(0)
        t = ans

print(ans)

Submission status: Wrong Answer

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

L %= 2019
R %= 2019

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

print(ans)

Submission status: Wrong Answer

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


from sys import stdin
input = stdin.readline


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

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


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

Submission status: Wrong Answer

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

if L > R:
    res = 0
else:
    res = float("inf")
    L = L % 2019
    R = R % 2019
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            res = min(res, (i * j) % 2019)
print(res)

Submission status: Wrong Answer

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

res = float("inf")
L = L % 2019
R = R % 2019
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        res = min(res, (i * j) % 2019)
print(res)

Submission status: Wrong Answer

Solution code:
def main():
    mod = 2019
    l,r = map(int,input().split())
    m1 = 10**9
    m2 = 10**9
    for i in range(l,r+1):
        tmp = i%mod
        if m1>tmp:
            m2 = m1
            m1 = tmp
        elif m2>tmp:
            m2 = tmp
    print(m1*m2)
main()

Submission status: Wrong Answer

Solution code:
def main():
    mod = 2019
    l,r = map(int,input().split())
    kouho = []
    for i in range(l,r+1):
        kouho.append(i%mod)
    kouho.sort()
    print(kouho[0]*kouho[1])
    #print((2019*2021)%mod)
main()

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    mod  =2019
    L,R = map(int,input().split())
    if R //mod - (L-1) //mod >1:
        print(0)
        exit()
    ans = 0
    for i in range(L,R):
        for j in range(i,R+1):
            a = (i * j ) %mod
            ans = max(a,ans)
    print(ans)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[12]:


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


# In[17]:


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


# In[ ]:

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[9]:


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


# In[11]:


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


# In[ ]:

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[5]:


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


# In[6]:


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


# In[ ]:

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = 2018
cnt = 0
for i in range(l, r+1):
    a = i%2019
    if a == 0:
        print(0)
        exit()
    x = min(a, x)
print(x*(x+1)%2019)

Submission status: Wrong Answer

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

x = 2018
cnt = 0
for i in range(l, r+1):
    a = i%2019
    if a == 0:
        print(0)
        exit()
    x = min(a, x)
print(x*(x+1))

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
if r-l >=4040:
    print(0)
    exit()
x = 2019
cnt = 0
for i in range(l, r+1):
    a = i%2019
    if a == 0:
        print(0)
        exit()
    x = min(a, x)
print(x*(x+1))

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
if r-l >=4040:
    print(1)
    exit()
x = 2019
for i in range(l, r+1):
    a = i%2019
    x = min(a, x)
print(x*(x+1))

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
if r-l >=2020:
    print(1)
    exit()
x = 2019
for i in range(l, r+1):
    a = i%2019
    x = min(a, x)
print(x*(x+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
min1 = 2019
min2 = 2020
for i in range(l, min(r+1, l+2019+1)):
    candidate = i % 2019
    if min1 > candidate:
        min1 = candidate
    elif min2 > candidate:
        min2 = candidate
print ((min1 * min2) % 2019)

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):
			if min >= i*j%2019:
				min = i*j%2019
	print(min)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0
inf = float("inf")

l,r = I()
if r< 2019:
    a = r*(r-1) % 2019
    print(a)
    sys.exit()
if l > 2019:
    a = l*(l+1) % 2019
    print(a)
    sys.exit()

print(0)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input().split()

def main():
    L, R = mi()

    min_mod = 2019
    if R - L >= 2019:
        print(0)
        return
    
    for i in range(L, R+1):
        if i % 2019 < min_mod:
            min_mod = i % 2019
        if (2019 - i) % 2019 < min_mod:
            min_mod = (2019 - i) % 2019
    
    print((min_mod * (min_mod+1)) % 2019)

    return

main()

Submission status: Wrong Answer

Solution code:
import sys
from operator import itemgetter

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input().split()

def main():
    L, R = mi()

    min_mod = 2019
    if R - L >= 2019:
        print(0)
        return
    
    for i in range(L, R+1):
        if i % 2019 < min_mod:
            min_mod = i % 2019
    
    print((min_mod * (min_mod+1)) % 2019)

    return

main()

Submission status: Wrong Answer

Solution code:
import sys
from operator import itemgetter

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input().split()

def main():
    L, R = mi()

    min_mod = 2019
    if R - L >= 2019:
        print(0)
        return
    
    for i in range(L, R):
        if i % 2019 < min_mod:
            min_mod = i % 2019
    
    print((min_mod * (min_mod+1)) % 2019)

    return

main()

Submission status: Wrong Answer

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

min_val = 2019
flag = 1
for i in range(L,R):
  tmp = (i*(i+1)) % 2019
  if tmp == 0:
    flag = 0
    break
  elif tmp < min_val:
    min_val = tmp
if flag == 0:
  print(0)
else:
  print(min_val)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

l,r=input2()

left=l%2019
right=r%2019
if (left==0)  or (right==0):
	print(0)
elif right<left:
	print(0)
else:
	print(left*(left+1))

Submission status: Wrong Answer

Solution code:

def solve():
    i = L//2019
    ans = 0
    is_ok = False
    while L <= 2019*i <= R:
        i += 1
        is_ok = True
#    print(i)
    if is_ok:
        print(ans)
    else:
        ans = (L*(L+1)) % 2019
        print(ans)


if __name__ == "__main__":
    L,R = list(map(int, input().split()))
    solve()

Submission status: Wrong Answer

Solution code:

def solve():
    i = L//2019
    ans = 0
    while L <= 2019*i <= R:
        i += 1
#    print(i)
    if i >= 1:
        print(ans)
    else:
        ans = (L*(L+1)) % 2019
        print(ans)


if __name__ == "__main__":
    L,R = list(map(int, input().split()))
    solve()

Submission status: Wrong Answer

Solution code:

def solve():
    i = L//2019
    ans = 0
    while L <= 2019*i <= R:
        i += 1
#    print(i)
    if i >= 1:
        print(ans)
    else:
        ans = 2019
        for n in range(L,R):
            for m in range(n+1, R+1):
                ans = min(ans, ((n*m)%2019))
        print(ans)


if __name__ == "__main__":
    L,R = list(map(int, input().split()))
    solve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans = 2018

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

print(ans)

Submission status: Wrong Answer

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

ans = 2019

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

Submission status: Wrong Answer

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    L, R = LI()

    L %= 2019
    R %= 2019
    if R <= L:
        R += 2019

    ans = 2018    
    for i, j in itertools.combinations(range(L, R + 1), 2):
        ans = min(i * j % 2019, ans)

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    L, R = LI()

    L %= 2019
    R %= 2019
    if R < L:
        R += 2019

    ans = 2018    
    for i, j in itertools.combinations(range(L, R + 1), 2):
        ans = min(i * j % 2019, ans)

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
L, R = map(int, input().split())
if R - L < 2019:
    print(min(i * (i + 1) % 2019 for i in range(L, R)))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
if R - L < 2019 and r > l:
    print(min(i*(i+1)%2019 for i in range(l,r)))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
if R - L < 2019 and r > l and (r< 673 or l>3):
    print(min(i*(i+1)for i in range(l,r)))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
if R - L >= 2019:
    print(0)
elif r >= 673 and l <= 3:
    print(0)
elif r > l:
    print(l * (l + 1) % 2019)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
L,R=map(int,input().split())
l = L%2019
r = R%2019
if R-L >= 2019:
    print(0)
elif r > l:
    print(l*(l+1)%2019)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
L,R=map(int,input().split())
l = L%2019
r = R%2019
if R-L >= 2019:
    print(0)
elif r > l:
    print(l*(l+1))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
i=l//2019
if 2019*i<l and r<2019*(i+1):
    d=list(range(l,r+1))
    d2=list(map(lambda x:x%2019,d))
    i=min(d2)
    d2.remove(i)
    j=min(d2)
    print(i*j)
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if l + 2019 <= r:
  print(0)
else:
  res = []
  for i in range(l, r+1):
      res.append(i%2019)
  res.sort()
  print(res[0]*res[1])

Submission status: Wrong Answer

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

res = []
for i in range(l, r+1):
    res.append(i%2019)
res.sort()
print(res[0]*res[1])

Submission status: Wrong Answer

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

res = []
for i in range(l, r+1):
  if i%2019 not in res:
    res.append(i%2019)
res.sort()
print(res[0]*res[1])

Submission status: Wrong Answer

Solution code:
def resolve():
    L, R = list(map(int, input().split()))
    MOD = 2019
    ans = float("inf")
    L = L % MOD
    R = R % MOD
    import itertools
    for i, j in itertools.combinations(list(range(min(L, R), max(L, R)+1)), 2):
        ans = min(ans, i*j%MOD)
    print(ans)

if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

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

l = L % 2019
r = R % 2019

if r <= l:
    r += 2019

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

Submission status: Wrong Answer

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

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

l = L % 2019
r = R % 2019

if r < l:
    r += 2019

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

Submission status: Wrong Answer

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

right = min(r+1, l+2019)
ans = 2019
for i in range(l, right):
    for j in range(l+1, right):
        rem = (i*j)%2019
        ans = min(ans, rem)

print(ans)

Submission status: Wrong Answer

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

if R-L >= 2018:
  ans = 0
else:
  for i in range(L, R+1):
    l = i % 2019
    li.append(l)
  li.sort()
  ans = li[0]*li[1]
  
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
ans = 2019
    
if L//2019 != R//2019:
    print(0)
    exit(0)
else:
    L = L%2019
    R = R%2019

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

print(ans)

Submission status: Wrong Answer

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

ans = 0

if L > 2020:
    print(0)
    exit(0)
else:
    ans = (L*(L+1))%2019
    print(ans)

Submission status: Wrong Answer

Solution code:

l,r = map(int,input().split())
 
x = []
 
if r-l >4038:
    print(0)
else:
    for i in range(l,r+1):
        x.append(i%2019)
        
    x.sort()
    
    ans = x[0]*x[1]%2019
    
    x = list(set(x))
    
    for s in range(len(x)-1):
        ans = min(ans,x[s]*x[s+1]%2019)
    
    print(ans)

Submission status: Wrong Answer

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

x = []

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

Submission status: Wrong Answer

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

x = []

for i in range(l,r+1):
    x.append(i%2019)
    
x.sort()
    
print(x[0]*x[1]%2019)

Submission status: Wrong Answer

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

x = []

for i in range(l,r+1):
    x.append(i%2019)
    
x.sort()
    
print(x[0]*x[1])

Submission status: Wrong Answer

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

cnt = 0

a,b = 2020,2020

for i in range(l,r+1):
    if a % 2019 < 1010:
        b = a+1
    else:
        b = a-1
    a = min(i%2019,a)
    
print(a*b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
d = (r -l)%2019
if r -l >=2018:
    print(0)
ans = 2018
for i in range(l, l+d):
    for j in range(i+1, l+d+1):
        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())
Sort = sorted(x%2019 for x in range(L,min(L+2019,R+1)))[:2]
print(Sort[0]*Sort[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
m, n = map(int, input().split(" "))
if n - m >= 673:
    print(0)
else:
    score = m * n % 2019
    for i in range(n, m + 1):
        for j in range(i + 1, n + 1):
            if i * j % 2019 < score:
                score = i * j % 2019
    print(score)

Submission status: Wrong Answer

Solution code:
m, n = input().split(" ")
m = int(m)
n = int(n)
if n - m >= 2019:
    print(0)
else:
    score = m * n % 2019
    for i in range(n - m - 1):
        for j in range(n - m - 1):
            if (m + i) * (m + j + 1) % 2019 < score:
                score = (m + i) * (m + j + 1) % 2019
    print(score)

Submission status: Wrong Answer

Solution code:
m, n = input().split(" ")
m = int(m)
n = int(n)
if n - m >= 674:
    print(0)
else:
    score = m * n % 2019
    for i in range(n - m - 1):
        for j in range(n - m - 1):
            if (m + i) * (m + j + 1) % 2019 < score:
                score = (m + i) * (m + j + 1) % 2019
    print(score)

Submission status: Wrong Answer

Solution code:
m, n = input().split(" ")
m = int(m)
n = int(n)
if n - m >= 673:
    print(0)
else:
    score = m * n % 2019
    for i in range(n - m - 1):
        for j in range(n - m - 1):
            if (m + i) * (m + j + 1) % 2019 < score:
                score = (m + i) * (m + j + 1) % 2019
    print(score)

Submission status: Wrong Answer

Solution code:
m, n = input().split(" ")
m = int(m)
n = int(n)
if n - m >= 673:
    print(0)
else:
    score = m * n // 2019
    for i in range(n - m - 1):
        for j in range(n - m - 1):
            if (m + i) * (m + j + 1) % 2019 < score:
                score = (m + i) * (m + j + 1) % 2019
    print(score)

Submission status: Wrong Answer

Solution code:
L, R = map(int, open(0).read().split())

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

print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, open(0).read().split())

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

print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
dif = (R-L)%2019
R = R%2019+dif
L %= 2019

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    mod = 2019
    L, R = il()
    L = L % mod
    R = R % mod
    ret = MAX
    for l in range(L, R + 1):
        for r in range(l + 1, R + 1):
            ret = min(ret, (l * r)%MOD)
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    mod = 2019
    L, R = il()
    L = L % mod
    R = R % mod
    ret = MAX
    for l in range(L, R + 1):
        for r in range(l + 1, R + 1):
            ret = min(ret, l * r)
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
dp=float('inf')
for i in range(2020):
  for k in range(2020):
    test=((l+i)*(r+k))%2019
    dp=min(dp,test)
print(dp)

Submission status: Wrong Answer

Solution code:
print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = [int(_) for _ in input().split()]
if L//2019 != R//2019:
    mod_min=0
else:
    mod_list=[]

    mod_min = 10**10
    for i in range(L,R):
        for j in range(i,R+1):
            if mod_min >= i*j%2019:
                mod_min = i*j%2019
                
            if mod_min == 0:
                break
        if mod_min == 0:
                break
#                 print(i,j,mod_min)
print(mod_min)