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:
# coding: utf-8
import sys
# import bisect
# import math
# import numpy as np
# from fractions import gcd

"""Template"""


class IP:
    """
    入力を取得するクラス
    """
    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x//y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)

    def lcm(self, x, y):
        return (x * y) // self.gcd(x, y)


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    l, r = ip.IL()
    a = l % 2019
    b = r % 2019
    # print(a, b)
    memo1 = id.ceil(l, 2019) * 2019
    # print(memo1)
    if memo1 <= r:
        print(0)
    else:
        memo2 = l // 2019 * 2019
        memo3 = id.ceil(r, 2019) * 2019
        #  print(memo2, memo3)
        memo4 = l // 673 * 673
        if memo4 <= r and (memo4+2 <= r or memo4-1 >= l):
            print(0)
        elif l - memo2 <= memo3 - r:
            # print("koko")
            print((l * (l + 1)) % 2019)
        else:
            print((r * (r - 1)) % 2019)


main()

Submission status: Wrong Answer

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

x = r // mod
line = x * mod
print(line)

if l < line < r:
    print(0)

else:
    y = l % 2019
    print((y*(y+1))%mod)

Submission status: Wrong Answer

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

#LかRが2019以上だったら割り切れる
if L <= 2019 and R >= 2019:
  print(0)

#Rが2019未満だったらできるだけ小さいやつ
elif R < 2019:
  print((L*(L+1))%2019)
#Lが2019以上だったらできるだけ小さいやつ
elif L > 2019:
  print((L*(L+1))%2019)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

L, R = map(int, input().split())
L_mod = L % 2019
R_mod = R % 2019
min_mod = pow(2018,2)
num = 0

if L_mod < R_mod:
    for i in range(L_mod, R_mod):
        for j in range(L_mod + 1, R_mod + 1):
            num = (i * j) % 2019
            if min_mod > num:
                min_mod = num
elif L_mod > R_mod:
    for i in range(R_mod, L_mod):
        for j in range(R_mod + 1, L_mod + 1):
            num = (i * j) % 2019
            if min_mod > num:
                min_mod = num
else:
    min_mod = L_mod * R_mod % 2019
print(min_mod)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
target = 2019
L_mod = L % target
R_mod = R % target
#print(L_mod,'L',R_mod,'R')
if L_mod > R_mod:
    print(0)
    exit(0)
if L_mod == R_mod and L < R:
    print(0)
    exit(0)
if L_mod == R_mod:
    print(L_mod)
    exit(0)
if L+1 == R:
    print(L * R % target)
    exit(0)

ans = 2019
for i in range(R_mod-L_mod):
    for j in range(i+1,R_mod-L_mod):
        if ((L+i) * (L+j)) % target < ans:
            #print(L+i,'Li')
            #print(L+j,'Lj')
            ans = ((L+i) * (L+j)) % target
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
from math import *
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

num = 2019
l, r = na()
li = []
if r < num:
    print((l * r) % num)
elif l <= num <= r:
    print(0)
else:
    if r - l > num:
        print(0)
    else:
        for i in range(l, r+1):
            li.append(i%num)
        li.sort()
        print((li[0] * li[1]) % num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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



#print(L%2019, R%2019)

#print((L + 2019 - L%2019))

tmp = 0

if L * R < 2019:
	i = L
	j = R
elif (L + 2019 - L%2019) + 1 <= R:
	if L < L + 2019 - L % 2019 and L + 2019 - L % 2019 + 1 < R:
		i =  L + 2019 - L % 2019
		j = i+1

else:
	i = L
	j = i+1
'''
if L < R:
	i = L
	j = L+1

	if tmp > i*j:
		tmp = i * j % 2019

'''

ans = i * j % 2019

print(ans)

Submission status: Wrong Answer

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

def main(l, r, y):
    if r < y:
        return l * r
    if l >= y:
        return l - y + 1
    if l < y <= r:
        return l

print(main(L, R, Y))

Submission status: Wrong Answer

Solution code:
a = input().split()
a = [int(i) for i in a]
if (a[0] < 2019 and a[1] >= 2019) or (a[0] <= 2019 and a[1] >= 2019):
    print(0)
else:
    print((a[0] % 2019) * (a[1] % 2019) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = (int(i) for i in input().split())
X = L
Y = L + 1
for i in range(L,R+1):
  a = i % 2019
  if a < X:
    X = a
    Y = a + 1
print((X*Y)%2019)

Submission status: Wrong Answer

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

l_2019 = L % 2019
r_2019 = R % 2019

if R - L >= 2017 or L == 0:
    print(0)
else:
    if l_2019 >= r_2019:
        print(0)
    else:
        if l_2019 >= 2019 - r_2019:
            if r_2019 % 3 == 0:
                print((r_2019-1)*(r_2019-2)%2019)
            elif r_2019 % 3 == 1:
                print((r_2019)*(r_2019-2)%2019)
            else:
                print((r_2019)*(r_2019-1)%2019)
        else:
            if l_2019 % 3 == 0:
                print(((l_2019+1)*(l_2019+2))%2019)
            elif l_2019 % 3 == 1:
                print(((l_2019*(l_2019+2))%2019))
            else:
                print(((l_2019*(l_2019+1))%2019))

Submission status: Wrong Answer

Solution code:
import math;

def swap(a,b):
    return (b,a)

def gcd(a,b):
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def main():
    l,r = map(int,input().split())
    mod = 2019
    mi = l*(l+1)
    ma = r*(r-1)
    ans = min(mi%mod,ma%mod)
    print(ans)
    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def RemainderMinimization2019():
	L, R = map(int, input().split())
	minMod = 2020 * 2020
	for i in range(L, R):
		for j in range(i + 1, R + 1):
			tmpA = (i % 2019)
			tmpB = (j % 2019)
			tmp = tmpA * tmpB
			# print(i, j, tmp)
			if minMod > tmp:
				minMod = tmp
	print(minMod)
RemainderMinimization2019()

Submission status: Wrong Answer

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

a = 2020


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

print(a)

Submission status: Wrong Answer

Solution code:
def main():
  sum=0
  L,R=map(int,input().split())
  if L+2019-L%2019<=R:
    print(0)
  else:
    L_e=L%2019
    R_e=R%2019
    a=min(L_e,R_e)
    print((a*(a+1))%2019)
      
main()

Submission status: Wrong Answer

Solution code:
s = input().split()
L = int(s[0])
R = int(s[1])

L = L%2019
R = R%2019
MIN = 2020

for i in range(L,R+1):
    for j in range(i,R+1):
        if i != j:
            mod = i*j
            MIN = min(MIN,mod%2019)
if R == 0 or L == 0:
    print(0)
elif R - L == 1:
    print((R*L)%2019)
else:
    print(MIN)

Submission status: Wrong Answer

Solution code:
def main():
    l,r = map(int,input().split(' '))
    tmp = 2019
    res = 0
    if l//2019 < r//2019:
        print(0)
    else:
        print((l*(l+1))%2019)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l = L % 2019
r = R % 2019
if (l > r):
  r += 2019

if (0 == l):
  print(0)
  exit()

ans = 2019
for j in range(l,r+1):
  for i in range(l,j):
    tmp = (i * j) % 2019
    if (ans > tmp):
      ans = tmp
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
L1 = L%2019
R1 = R%2019
L2 = L//2019
R2 = R//2019
if L2 != R2:#LとRの間に0でなるとき
  ans = 0
else:
  ans = (L1*(L1+1))%2019
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

L, R = map(int, input().split())
modL = L % 2019
modR = R % 2019

if L - R >= 2019:
  print(0)
else:
	min_ = min([(L + i) % 2019 for i in range(min(2019, R-L))])
	print(min_ * (min_ + 1))

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
l, r = l%2019, r%2019
if (l/3).is_integer() and (r/673).is_integer():
    l, r = l/3, r/673
if (l/673).is_integer() and (r/3).is_integer():
    l, r = l/673, r/3
mi = 9999
if r*(r-1)<2019:
    print(l*(l+1))
elif r==0 or l==0:
    print(0)
else:
    for i in range(l, r-1):
        for j in range(i+1, r):
            mi = min(mi, (i*j)%2019)
    print(mi)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

list2019 = []
for i in range(1000000):
    list2019.append(2019*i)

answer = (L * (L + 1)) % 2019
for l2019 in list2019:
    if L < l2019 and l2019 < R:
        answer = 0
print(answer)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
mod = 2019
mod_min = 2100

s = l % mod
e = r % mod

for i in range(s,e):
    for j in range(i+1,e+1):
        if i <= 0:
            m = j
        else:
            m = ((i % mod) * (j % mod)) % mod
        #m = (i * j) % mod
        #print(i,j,m)

        if m < mod_min:
            mod_min = m

print(mod_min)

Submission status: Wrong Answer

Solution code:
import sys
import math
#from pprint import pprint
import numpy as np
def myinput_int():
    return list(map(int, input().split()))
def myinput_str():
    return list(input().split())

L,R = myinput_int()

if 2019<=R-L :
    print(0)
    exit(0)

a = np.arange(L,R+1)%2019
b = np.sort(a)

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

Submission status: Wrong Answer

Solution code:
parents = list(map(int,input().split(' ')))

a = parents[0] % 2019
if (2019-a)<=1010:
    a = (2019-a)
b = parents[1] % 2019
if (2019-b)<=1010:
    b = (2019-b)
diff = parents[1]-parents[0]
if (parents[0]%2019 + diff) >= 2019:
    print(0)
elif a==b:
    res = a*a % 2019
    if (2019-res)<=1010:
         res = (2019-res)
    print(res)
elif a<b:
    res = a*(a+1) % 2019
    if (2019-res)<=1010:
         res = (2019-res)
    print(res)
else:
    res = b*(b+1) % 2019
    if abs(2019-res)<=1010:
        res = abs(2019-res)
    print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#入力
i, j = map(int, input().split())
#前処理
i_mod = i % 2019


pool = []
for value in range(j-i):
  J = value + 1 + i
  j_mod = J % 2019 
  pool.append((i_mod*j_mod)%2019)
  if value > 2019:
    break

print(min(pool))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = (int(x) for x in input().split())
 
min = 2020

counter1 = 0
counter2 = 0

for i in range(L, R):
    counter1 += 1
    if counter1 > 2019:
        break
    for j in range(i + 1, R + 1):
        counter2 += 1
        if counter2 > 2019:
            break
        i_ = i % 2019
        j_ = j % 2019
        mod_ij = i_ * j_ % 2019
        if min > mod_ij:
            min = mod_ij
        
 
print(min)

Submission status: Wrong Answer

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

#f = 0
l = []

if R-L>=2019:
    #f = 1
    print(0)
    exit()

for i in range(L,R+1):
    l.append(i%2019)
else:
    l.sort()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x_min = 2018
if L // 2019 != R // 2019:
  print(0)
else:
  L = L % 2019
  R = R % 2019
  for i in range(1, R):
    for j in range(i+1, R+1):
      if x_min > (i*j)%2019:
        x_min = (i*j)%2019
  print(x_min)

Submission status: Wrong Answer

Solution code:


if __name__ == "__main__":
    n, a = map(int, input().split())

    if n < 2019 and a < 2019:
        print(n * a % 2019)

    elif n < 2019 and 2019 <= a:
        print(0)

    elif 2019 < n and 2019 < a:
        print(n * n+1 % 2019)

    elif n <= 2019:
        print(0)

Submission status: Wrong Answer

Solution code:
L,R= map(int,input().split())
#境界条件
if L == 0:
    ans = 0
#一個違い
elif R == L+1:
    ans = L*R % 2019
else:
    l = L % 2019
    r = R % 2019
    for i in range(1,r-1):
        for j in range(i+1,r):
            temp = (i * j) % 2019
            if i == 1 and j==2:
                min = temp
            elif min > temp:
                min = temp
    ans = min
print(ans)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
b=L%2019
d=R%2019
if b>d:
  d=d+2019
f=(b*d)%2019
for i in range(b,d):
  for j in range(i+1,d+1):
    e=(i*j)%2019
    if e<f:
      f=e
    j=j+1
  i=i+1
print(f)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
i,j=sorted([n%2019 for n in range(l,r+1)])[0:2]
print(i*j)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    print(val)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

ls = input().split()
l = int(ls[0])
r = int(ls[1])
mod = l*r%2019

for i in range(l, r - 1):
	for j in range(i + 1, r):
		if mod > i*j%2019:
			mod = i*j%2019

print(mod)

Submission status: Wrong Answer

Solution code:
l,r = map(int, input().split())
import numpy as np
MOD = 2019
if r-l+1 >= 673:
  print(0)
else:
  k = np.array([i for i in range(l,r+1)])
  if (0 in np.mod(k,3)) and (0 in np.mod(k,673)):
    print(0)
  else:
    k = sorted(k)
    print((k[0] * k[1]) % MOD)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


#def xcheck(n):
#	
#    m = int(n**.5)
#    return 1 if abs(m*m - n) < 1e-6 else 0
#	if(1):
#		#兵法数なら
#		return 1
#	return 0

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
l=hoge[0]
r=hoge[1]
l=l%2019
r=((r-1)%2019)+1
if(l>r):
	r+=2019

###
#print(l)
#print(r)

minans=2018
for i in range(l,r):
	for j in range(i+1,r+1):
		tmp = (i*j)%2019
		if tmp < minans:
			minans = tmp


#		print("{} {} minans {}".format(i,j,minans))
print(minans)





#print(min(n*a,b))

#print(n)
#print(a)
#print(b)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import sys
# import bisect
# import math
# import numpy as np
# from fractions import gcd

"""Template"""


class IP:
    """
    入力を取得するクラス
    """
    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x//y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)

    def lcm(self, x, y):
        return (x * y) // self.gcd(x, y)


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    l, r = ip.IL()
    a = l % 2019
    b = r % 2019
    # print(a, b)
    memo1 = id.ceil(l, 2019) * 2019
    # print(memo1)
    if memo1 <= r:
        print(0)
    else:
        memo2 = l // 2019 * 2019
        memo3 = id.ceil(r, 2019) * 2019
        #  print(memo2, memo3)
        memo4 = l // 673 * 673
        if memo4 <= r and memo4+2 <= r or memo4-1 >= l:
            print(0)
        elif l - memo2 <= memo3 - r:
            # print("koko")
            print((l * (l + 1)) % 2019)
        else:
            print((r * (r - 1)) % 2019)


main()

Submission status: Wrong Answer

Solution code:
import numpy as np

S=input()

tmp=S.split()

L=int(tmp[0])
R=int(tmp[1])

L_list=np.sort(np.array(range(L,R+1),dtype=np.int32)%2019)
R_list=L_list.copy()

print(L_list[0]*R_list[1])

Submission status: Wrong Answer

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

Lmod = L%2019
Rmod = R%2019

i = Lmod
j = i + 1

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

Submission status: Wrong Answer

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

if R - L >= 2018:
    print(0)
elif R - L == 1:
    print(((L % mod) * (R % mod)) % mod)
else:
    list_ij = []
    for i in range(L, R):
        list_ij.append(i % mod)
    list_ij = sorted(list_ij)
    print(list_ij[0] * list_ij[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
Y = 2019
L, R = [int(i) for i in input().split()]

L2, R2 = L % Y, R % Y
dist = (R - L) // Y

if L2 == 0 or R2 == 0 or R2 <= L2 or 1 <= dist:
    res = 0
else:
    res = L2 * (L2+1)

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = (int(i) for i in input().split())


while l // 2019 > 0 or r // 2019 > 0:
  l = l % 2019
  r = r % 2019

mini = 1e+13
for i in range(l,r+1):
  for j in range(i+1,r+1):
    mini = min(mini, (i*j) % 2019)
print(mini)

Submission status: Wrong Answer

Solution code:
import sys
from math import *
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

num = 2019
l, r = na()
li = []
if r < num:
    print(l * r)
elif l <= num <= r:
    print(0)
else:
    if r - l > num:
        print(0)
    else:
        for i in range(l, r+1):
            li.append(i%num)
        li.sort()
        print(li[0] * li[1])

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
left = L%2019
right = R%2019
if left > right:
    print(0)
else:
    left = min(L%2019, R%2019)
    right = max(L%2019, R%2019)
    l = [i for i in range(left, right+1)]
    ans = 9999
    for i in range(len(l)-1):
        for j in range(i+1, len(l)):
            mo = l[i]*l[j]%2019
            ans = min(ans, mo)
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n = 2019
ans = 2*10**9 + 1


for i in range(l, r + 1):
    for j in range(l + 1 , r + 1):
        tmp = ans
        x = i * j
        ans = min(x % 2019, ans)
        if tmp != ans:
            print(ans)
            exit()

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))
base = 2019
L,R = LI()
l = L % base
r = R % base
if l >= r:
    ans = 0
else:
    ans = mod
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans = min(ans,i * j % base)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# Setup
import sys
sys.setrecursionlimit(4100000)

l,r = [int(i) for i in input().split()]
a = {}
for i in range(l,r+1):
    a[i] = i%2019
temp = float('inf')
for i in range(l,r+1):
    for k in range(i+1,r+1):
        if a[i]*a[k] < temp:
            temp = a[i]*a[k]
print(temp%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
I, J = map(int, input().split())

if 2019 <= J - I or I == 0 or J == 0:
    print(0)
    exit(0)
else:
    a = min([i%2019 for i in range(I, J+1)])

print(a*(a+1))

Submission status: Wrong Answer

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

x_min = 2018
for i in range(l,n+1):
    x = i % 2019
    if x < x_min:
        x_min = x

print(x_min*(x_min+1))

Submission status: Wrong Answer

Solution code:
import numpy as np
L, R = (int(i) for i in input().split())
X = L
Y = L + 1
for i in range(L,R+1):
  a = abs(2019-i)
  if a < X:
    X = a
    Y = a + 1
print((X*Y)%2019)

Submission status: Wrong Answer

Solution code:
str = input()
str = str.split()
N = [int(i) for i in str]

min = (N[0]*N[1]) % 2019

for i in range(N[0], N[1]-1):
    for j in range(i+1, N[1]):
        if min > (i*j) % 2019:
            min = (i*j) % 2019
print(min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#入力
i, j = map(int, input().split())
#前処理
i_mod = i % 2019


pool = []
for value in range(j-i):
  J = value + 1 + i
  j_mod = J % 2019 
  pool.append((i_mod*j_mod)%2019)

print(min(pool))

Submission status: Wrong Answer

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