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:
mod = 10 ** 9 + 7
mod2 = 2 ** 61 + 1
from collections import deque
import heapq
from bisect import bisect_left, insort_left, bisect_right

_NUMINT_ALL = list(range(10))


def main():
    ans = solve()
    if ans is not None:
        print(ans)


def solve():
    L, R = iip(False)
    L %= 2019
    R %= 2019

    mm = 114514

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

    return mm



#####################################################ライブラリ集ここから

def iip(listed=True, num_only=True):
    if num_only:
        ret = [int(i) for i in input().split()]
    else:
        ret = [int(i) if i in _NUMINT_ALL else i for i in input().split()]

    if len(ret) == 1 and not listed:
        return ret[0]
    return ret


def sort_tuples(l, index):
    if isinstance(l, list):
        l.sort(key=lambda x: x[index])
        return l
    else:
        l = list(l)
        return sorted(l, key=lambda x: x[index])


def count_elements(l):
    d = {}
    for i in l:
        if i in d:
            d[i] += 1
        else:
            d[i] = 1
    return d


def safeget(l, index, default="exception"):
    if index >= len(l):
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。配列の長さは", len(l), "です"]))
        else:
            return default
    elif index < 0:
        if default == "exception":
            raise Exception("".join(["safegetに不正な値 ", index, "が渡されました。負の値は許可されていません"]))
        else:
            return default
    else:
        return l[index]


def iipt(l, listed=False, num_only=True):
    ret = []
    for i in range(l):
        ret.append(iip(listed=listed, num_only=num_only))
    return ret


def sortstr(s):
    return "".join(sorted(s))


def iip_ord(startcode="a"):
    if isinstance(startcode, str):
        startcode = ord(startcode)
    return [ord(i) - startcode for i in input()]


def YesNo(s):
    if s:
        print("Yes")
    else:
        print("No")


def fprint(s):
    for i in s:
        print(i)


def bitall(N):
    ret = []
    for i in range(2 ** N):
        a = []
        for j in range(N):
            a.append(i % 2)
            i //= 2
        ret.append(a)
    return ret


def split_print_space(s):
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def koenai_saidai_x_index(sorted_list, n):
    l = 0
    r = len(sorted_list)
    if len(sorted_list) == 0:
        return False
    if sorted_list[0] > n:
        return False

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] == n:
            return x
        elif sorted_list[x] > n:
            r = x
        else:
            l = x
    return l


def searchsorted(sorted_list, n, side="left"):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        # print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        # print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod - 2)


def power(n, p, mod_=mod):
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
l, r = [int(i) for i in input().split()]
mn = [2019, 2019]
for i in range(l, r + 1):
    t = i % 2019
    if mn[0] > t: mn[0] = t
    elif mn[1] > t: mn[1] = t 
    if mn[0] == 0 and mn[1] == 0:
      break
print((mn[0] * mn[1]) % 2019)

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())

kleine = 2018

if b-a == 1:
	print((a*b)%2019)
else:
	for i in range (a, b-1):
		for j in range (i+1, b):
			k = (i*j)%2019
			if k < kleine:
				kleine = k
			else:
				continue
	print(kleine)

Submission status: Wrong Answer

Solution code:
l, r = [int(i) for i in input().split()]
mn = [2019, 2019]
for i in range(l, r + 1):
    t = i % 2019
    if mn[0] > t: mn[0] = t
    elif mn[1] > t: mn[1] = t 
print((mn[0] * mn[1]) % 2019)

Submission status: Wrong Answer

Solution code:
l, r = [int(i) for i in input().split()]
mn = [r, r]
for i in range(l, r + 1):
    t = i % 2019
    if mn[0] > t: mn[0] = t
    elif mn[1] > t: mn[1] = t 
print((mn[0] * mn[1]) % 2019)

Submission status: Wrong Answer

Solution code:
l , r = map(int,input().split())
lt = l % 2019
rt = r % 2019
p = []

if rt - lt <= 0:
    print(0)
else:
    for i in range(lt,rt):
        for j in range(i+1,rt+1):
            p.append((i*j)%2019)
    print(min(p))

Submission status: Wrong Answer

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

if rt - lt <= 0 or r - l >= 2018:
    print(0)
else:
    print(min(lt*(lt+1),(2019-rt)*(2020-rt)))

Submission status: Wrong Answer

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

if rt - lt <= 0:
    print(0)
else:
    print(min(lt*(lt+1),(2019-rt)*(2020-rt)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

     if s + r - l >= 2019:
          print(0)
     else:
          print(s*(s+1))

Submission status: Wrong Answer

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

     if s + l - r >= 2019:
          print(0)
     else:
          print(s*(s+1))

Submission status: Wrong Answer

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

b1=2019
b2=2019

for i in range(l, r+1):
	if i % 2019 <= b1:
		b2 = b1
		b1 =  i % 2019
	elif i % 2019 <= b2:
		b2 = i % 2019
print((b1 *b2) % 2019)

Submission status: Wrong Answer

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

if 2018 <= r-l:
  ans = 0
elif r-l <= 2017:
  r_mod = r%2019
  l_mod = l%2019
  ans = 2019
  
  if l_mod < r_mod:
    for i in range(r_mod-l_mod):
      for j in range(1,r_mod-l_mod-i+1):
        temp = (l_mod+i)*(l_mod+i+j)
        
        if temp < ans:
          ans = temp
      
      
  elif r_mod < l_mod:
    ans = 0
    
print(ans)

Submission status: Wrong Answer

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

if 2018 <= r-l:
  ans = 0
elif r-l <= 2017:
  r_mod = r%2019
  l_mod = l%2019
  
  if l_mod < r_mod:
    ans = l_mod*(l_mod + 1)
  elif r_mod < l_mod:
    ans = 0
    
print(ans)

Submission status: Wrong Answer

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

if 2019 < r-l:
  ans = 0
elif r-l <= 2017:
  r_mod = r%2019
  l_mod = l%2019
  
  if l_mod < r_mod:
    ans = l_mod*(l_mod + 1)
  elif r_mod < l_mod:
    ans = 0
    
print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
L, R = list(map(int, input().split()))
l = L%2019
r = R%2019
ans = 2020
if abs(L-R)>=4040:
    print(0)
else:
    for i in range(L, R):
        ans = min(ans, (i*(i+1))%2019)

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  l, r = map(int, readline().split())
  if r-l>=2018:
    print(0)
  else:
    mod = []
    for i in range(l, r+1):
      mod.append(i%2019)
    mod.sort()
    print(mod[0]*mod[1])
  
  
  
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
MOD=2019
l=L//MOD
r=R//MOD
if l!=r:
  print(0)
else:
  l=L%MOD
  r=MOD-R%MOD
  a=min(l,r)
  print((a*(a+1))%MOD)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
MOD=2019
l=L//MOD
r=R//MOD
if l!=r:
  print(0)
else:
  l=L%MOD
  print(l*(l+1))

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
ans=100100100
for i in range(R-L,R):
  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:
L, R = map(int, input().split())
if (R//2019)-(L// 2019)>1:
    print(0)
print((L%2019*(L%2019+1)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if (R//2019) != (L//2019) or L%2019==0 or R%2019==0:
    result = 0
else:
    R %= 2019
    L %= 2019
    result = 2018
    for i in range(L, R):
        for j in range(i+1, R+1):
            if result > i*j:
                result = i*j
print(result)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if (R//2019) != (L//2019):
    result = 0
else:
    R %= 2019
    L %= 2019
    result = 2018
    for i in range(L, R):
        for j in range(i+1, R+1):
            if result > i*j:
                result = i*j
print(result)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
MOD = 2019
INF = 10*5
ans = INF


if 2019 <= R-L:
    print(0)
else:
    x = L % MOD
    y = R % MOD
    if x < y:
        for i in range(x, y):
            for j in range(i+1, y+1):
                ans = min(ans, (i*j) % MOD)
        else:
            print(ans)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
MOD = 2019
x = L % MOD
y = R % MOD

if -(-L//MOD) == (R-1)//MOD:
    print(0)
elif x <= 3 and 693 <= y:
    print(0)
else:
    print(x*(x+1) % MOD)

Submission status: Wrong Answer

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

if -(-L//MOD) == (R-1)//MOD:
    print(0)
else:
    x = L % MOD
    print(x*(x+1) % MOD)

Submission status: Wrong Answer

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

if -(-L//MOD) == (R-1)//MOD:
    print(0)
else:
    x = L % MOD
    print(x*(x+1))

Submission status: Wrong Answer

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

if -(-L//MOD) == R//MOD:
    print(0)
else:
    x = L % MOD
    print(x*(x+1))

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    L, R = input_nums()
    MOD = 2019
    a = L%MOD
    b = R%MOD
    if a < b and (R-L < 2019):
        print((a*(a+1))%MOD)
    else:
        print(0)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    L, R = input_nums()
    MOD = 2019
    a = L%MOD
    b = R%MOD
    if a < b:
        print((a*(a+1))%MOD)
    else:
        print(0)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
MOD = 2019
if R//MOD - L//MOD == 1:
    print(0)
else:
    x = min(L % MOD, R % MOD)
    print(x*(x+1))

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    L, R = input_nums()
    MOD = 2019
    a = L - (L//MOD) * MOD
    b = R - (R//MOD) * MOD
    if a < b:
        print((a*(a+1))%MOD)
    else:
        if b == 0:
            print(0)
        elif b == 1:
            print((a*b)%MOD)
        else:
            print((b*(b-1))%MOD)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

q1, mod1 = divmod(L, 2019)
q2, mod2 = divmod(R, 2019)

if q1 == q2:
    answer = L*(L+1) % 2019
elif q1 < q2:
    print(0)
    exit()

print(answer)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
MOD = 2019
L %= MOD
R = min(L+1, R % MOD)
print(L*R)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
MOD = 2019
L %= MOD
print(L*(L+1))

Submission status: Wrong Answer

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

ll = l % 2019
rr = r % 2019
#if rr < ll
tmp=2020
for i in range(ll,rr+1):
  for j in range(i+1,rr+1):
    tmp = min(tmp,(i*j) % 2019)
if tmp == 2020:
  print(0)
else:
  print(tmp)

Submission status: Wrong Answer

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

ll = l % 2019
rr = r % 2019
tmp=2020
for i in range(ll,rr+1):
  for j in range(i+1,rr+1):
    tmp = min(tmp,(i*j) % 2019)

print(tmp)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    l,r = map(int, input().split())
    res = 10**10
    if r-l>=2019:
        print(0)
        exit()
    else:
        for i in range(l, r):
            n = i % 2019
            for j in range(i, r+1):
                p = j % 2019
                res = min(res, (n*p)%2019)
    print(res)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    l,r = map(int, input().split())
    res = 10**10
    if r-l>=2019:
        print(0)
        exit()
    else:
        for i in range(l, r):
            n = i % 2019
            res = min(res, (n*(n+1))%2019)
    print(res)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
mtx = [[0] * 2019 for _ in range(2019)]

for i in range(len(mtx)):
    for j in range(len(mtx)):
        mtx[i][j] = (i * j) % 2019

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

min_val = 10000000

for i in range(l, r):
    for j in range(i+1 , r + 1):
        a = i % 2019
        b = j % 2019
        ret = mtx[a][b]
        min_val = min(min_val, ret)
        if b % 2019 == (i+1) % 2019:
            break
        if min_val == 0:
            print(0)
            exit()

print(min_val)

Submission status: Wrong Answer

Solution code:
mtx = [[0] * 2019 for _ in range(2019)]

for i in range(len(mtx)):
    for j in range(len(mtx)):
        mtx[i][j] = (i * j) % 2019

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

min_val = 10000000

l_mod = l % 2019
r_mod = r % 2019

if l_mod >= r_mod:
    r_mod += 2019

for i in range(l_mod, r_mod):
    for j in range(i+1 , r_mod + 1):
        a = i % 2019
        b = j % 2019
        ret = mtx[a][b]
        min_val = min(min_val, ret)

print(min_val)

Submission status: Wrong Answer

Solution code:
mtx = [[0] * 2019 for _ in range(2019)]

for i in range(len(mtx)):
    for j in range(len(mtx)):
        mtx[i][j] = (i * j) % 2019

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

min_val = 10000000

l_mod = l % 2019
r_mod = r % 2019

if l_mod > r_mod:
    r_mod += 2019

for i in range(l_mod, r_mod):
    for j in range(i+1 , r_mod + 1):
        a = i % 2019
        b = j % 2019
        ret = mtx[a][b]
        min_val = min(min_val, ret)

print(min_val)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
a = r*(r-1)
b = l*(l+1)
if r-l >= 2018:
  print(0)
else:
  for i in range(l,r+1):
    if i % 2019 == 0:
      print(0)
      break
  else:
    a = r*(r-1)%2019
    b = l*(l+1)%2019
    c = max(a,b)
    print(a+b-c)

Submission status: Wrong Answer

Solution code:
x,y=list(map(int, input().split()))

if y>x+2020:
	y=x+2020

ans=2019
for i in range (x,y+1):
	for j in range (x+1,y+1):
		if (i*j)%2019<ans:
			ans=(i*j)%2019
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

L, R = map(int, input().split())
mod = 2019
ans = []
if R-L >= 2019:
    print(0)
    sys.exit()
elif R-L < 2019:
    for i in range(L, R + 1):
        for j in range(L, R + 1):
            tmp = (i * j) % mod
            if tmp == 0:
                print(0)
                sys.exit()
            ans.append(tmp)
print(min(ans))

Submission status: Wrong Answer

Solution code:
import sys

L, R = map(int, input().split())
mod = 2019
ans = []
if R-L >= 2019:
    print(0)
    sys.exit()
elif R-L < 2019:
    for i in range(L, R + 1):
        for j in range(L, R + 1):
            tmp = (i * (i + 1)) % mod
            if tmp == 0:
                print(0)
                sys.exit()
            ans.append(tmp)
print(min(ans))

Submission status: Wrong Answer

Solution code:
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  L, R = input_list()
  ans = 10**10
  for x in range(L+1, R+1):
    ans = min(ans, x%2019)
  
  print((L%2019)*ans)
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()

Submission status: Wrong Answer

Solution code:
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  L, R = input_list()
  ans = []
  for x in range(L, R+1):
    ans.append(x%2019)
  sa = sorted(ans)
  l = sa[0]
  r = sa[1]
  print(l*r)
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()

Submission status: Wrong Answer

Solution code:
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  L, R = input_list()
  #ans = []
  #for x in range(L, R+1):
    #for y in range(x+1, R+1):
      #ans.append((x*y)%2019)
  print((L*(L+1))%2019)
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()

Submission status: Wrong Answer

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

for i in range(L,R+1):
    for j in range(L,R+1):
        if i == j:
            pass
        else:
            x = (i*j)%2019
            if x < n:
                n = x
            
            if x == 0:
                print (x)
                exit ()
print (x)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
l = []
if R < L+2019:
    for i in range(L,R+1):
        l.append(i%2019)
else:
    for i in range(L,L+2019):
        l.append(i%2019)

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
l = []
if R < L+2019:
    for i in range(L,R+1):
        l.append(i%2019)
else:
    for i in range(L,L+2019):
        l.append(i%2019)

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
l = []
if R < L+2019:
    for i in range(L,R+1):
        l.append(i%2019)
else:
    for i in range(L,L+2019):
        l.append(i%2019)

print (l[0]*l[1])

Submission status: Wrong Answer

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

if 2019 <= l:
    print (l%2019*(l%2019+1))
else:
    print (l*(l+1))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

l = (L*(L+1))%2019
r = (R*(R-1))%2019

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

Submission status: Wrong Answer

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

l = (L*(L+1))%2019
r = (R*(R-1))%2019

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

Submission status: Wrong Answer

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

l = (L*(L+1))%2019
r = (R*(R-1))%2019

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if R - L >= 2019:
    res = 0
else:
    mod_list = sorted([e % 2019 for e in range(L, R+1)])
    res = mod_list[0] * mod_list[1]

print(res)

Submission status: Wrong Answer

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

l = (L*(L+1))%2019
r = (R*(R-1))%2019

ans = 10**10
if(R//2019 != L//2019):
    print(0)
else:
    for i in range(L, R):
        ans = min(ans, (i*(i+1))%2019)
    print(ans)

Submission status: Wrong Answer

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

if R - L > 2019:
    res = 0
else:
    mod_list = sorted([e % 2019 for e in range(L, R+1)])
    res = mod_list[0] * mod_list[1]

print(res)

Submission status: Wrong Answer

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

l = (L*(L+1))%2019
r = (R*(R-1))%2019

if(l >= r and L-R > 1):
    print(0)
else:
    print(l)

Submission status: Wrong Answer

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

if(R//2019 == L//2019):
    ans = min((L*(L+1))%2019, (R*(R-1))%2019)
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
ll=l%2019
rr=r%2019
if  l//2019==r//2019:
    print((ll*(ll+1))%2019)
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number_list = (lambda: list(map(int, input_list())))

    L, R = input_number_list()
    l = L % 2019
    r = R % 2019
    if L // 2019 > R // 2019:
        print(0)
    else:
        print((l * (l + 1)) % 2019)


if __name__ == '__main__':
    main()