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:
#!/usr/bin/env python3
l, r = map(int, input().split())
l %= 2019
r %= 2019
if l >= r:
    print(0)
    exit()
m = 1e9
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        m = min(m, i * j % 2019)
print(m)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
d = list(map(int, input().split()))
L = d[0]
R = d[1]

if L >= 2019:
    L = L%2019
if R >= 2019:
    R = R%2019

list = []
if L < R :
  for i in range(L,R):
      for j in range(i+1,R+1):
          list.append(i*j%2019)

else :
  for i in range(0,2018):
    for j in range(i+1,2019):
        list.append(i*j%2019) 

print(min(list))

Submission status: Wrong Answer

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

if R - L >= 2050:
    print(0)
else:
    ans = 2000
    for i in range(L, R):
        for j in range(i+1, R+1):
            x = i * j % 2019
            if ans > x:
                ans = x
    print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
l, r = l%2019, r%2019
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):
            if (i*j)%2019!=0:
                mi = min(mi, (i*j)%2019)
    print(mi)

Submission status: Wrong Answer

Solution code:
num = input().split()
l, r = int(num[0]), int(num[1])
ans = 0
if r-l+1>2019:
  ans = 2
else:
  if l+(2020-l%2019) > r:
    ans = l%2019*(l+1)%2019
  else:
    ans = 2
    
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = list(map(int, input().split()))
m = R//2019
if R-L>=2019 or (m*2019<=R and m*2019>=L):
  print(0)
else:
  l = L%2019
  r = R%2019
  min_c = 2019
  for i in range(l,r):
    for j in range(i+1, r):
      score = i*j%2019
      if i*j%2019<min_c:
        min_c = score
  print(min_c)

Submission status: Wrong Answer

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

mod_list = []
min1 = 2019
min2 = 2019

for i in range(L, R+1):
    tmp = i % 2019

    if tmp == 0:
        break
    
    elif tmp < min1:
        min2 = min1
        min1 = tmp
    
    elif tmp < min2:
        min2 = tmp


print(min1 * min2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

min1 = 10000
border = 4039
ancker = 99999

for i in range(L, min(R+1, L + border)) :
    if i % 2019 < min1 :
        min1 = i % 2019
        ancker = i

min2 = 100000

for i in range(L, min(R+1, L + border)) :
    if i % 2019 < min2 and i != ancker:
        min2 = i % 2019

print(min1 * min2)

Submission status: Wrong Answer

Solution code:


L, R = (int(i) for i in input().split())  


l = L % 2019
r = R % 2019

x = list(range(min(l, r+1), max(l, r+1)))

ans = 3000
for i in range(len(x)):
    for j in range(len(x)):
        if ans > (i*j)%2019:
            ans = (i*j)%2019






print(ans)

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:
        if memo1 + 2019 <= r:
            print(0)
        else:
            print(2)
    else:
        memo2 = l // 2019 * 2019
        memo3 = id.ceil(r, 2019) * 2019
        #  print(memo2, memo3)
        if 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 = [int(x) for x in input().split()]
if R-L >= 2019:
  print(0)
if L%2019 > R%2019:
  print(0)
else:
  s = min([i%2019 for i in range(L,R)])
  print(s*(s+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
mod = 2019
L_mod = L%mod
R_mod = R%mod
sa = R-L
if sa >= mod*2:
    ans = 1
elif sa >= mod:
    ans = 2
    if L_mod == 1:
        ans = 1
else:
    if R_mod < L_mod:
        ans = 2
    else:
        ans = (L_mod*(L_mod+1))%mod
    if R_mod == 1:
        ans = L_mod
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
L,R = list(map(int,input().split()))
if R-L >= 2019*2:
    import sys
    print(1)
    sys.exit()
ij_list = list(map(lambda x:x%2019,[i for i in range(L,R+1)]))
print(ij_list[0]*ij_list[1])

Submission status: Wrong Answer

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

if L*R < 2019:
    print(L*(L+1))
elif R-L >= 673:
    print(0)
elif (L%673) > (R%673):
    print(0)
elif (R%673) != 1:
    print(2)
else:
    print(L*R%673)

Submission status: Wrong Answer

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

tmp = []
if L+2019 <R:
    for i in range(L+1, L+2019+1):
        tmp.append((L * i) % 2019)
else:
    for i in range(L+1, R+1):
        tmp.append((L * i) % 2019)

print(min(tmp))

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
c = []
d = 0
for i in range(a, b + 1):
    c.append([abs(i % 2019), i])
    c.append([abs(2019 - i % 2019), i])
    d += 1
    if d > 2019 * 3:
        break
c.sort()
print((c[0][0] * c[1][0]) % 2019)

Submission status: Wrong Answer

Solution code:
L = 2*(10**2)
R = 2*(10**5)

if L >= 2019:
    L = L%2019
if R >= 2019:
    R = R%2019

print(L)
print(R)

list = []
if L < R :
  for i in range(L,R):
      for j in range(i+1,R+1):
          list.append(i*j%2019)

else :
  for i in range(0,2018):
    for j in range(i+1,2019):
        list.append(i*j%2019) 

print(min(list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ls = []

for i in range(l,r+1):
    ls.append(int(int(i)%2019))

    if len(ls)==10000:
        break
ls = sorted(ls)
print(int(ls[0]*ls[1]))

Submission status: Wrong Answer

Solution code:
L, R = [int(x) for x in input().split(' ')]

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if L <= 2019:
    R1 = L % 2019
    R2 = R % 2019
else:
    R1 = L % 2019
    R2 = (L + 1) % 2019

R3 = R1 * R2
print(R3)

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:
    r += 2019

ans = mod
for i in range(l,r):
    for j in range(i+1,r+1):
        # print(i,j)
        ans = min(ans,i * j % base)
        if ans == 0:
            break
    else:
        continue
    break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if 2019 < L - R:
    print(0)

else:
    tmp = (L * (L + 1)) % 2019
    if 2019 - tmp < L - R - 1:
        print(0)
    else:
        print(tmp)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
l,r=map(int,input().split())
l%=2019
print((l)*(l+1))

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):

        m = ((i % mod) * (j % mod)) % mod

        if m < mod_min:
            mod_min = m

print(mod_min)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
X = L * R
while X>2019:
    X = (X+2019) // 2019
print(X)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
X=2019
I=-1
for i in range(L,min(L+X,R)):
    if i%X==0:
        I=i
        break
if I==-1:
    x=range(L,R)
    print((min(x)*(min(x)+1))%X)
else:
    if L+i+X<=R:
        print(0)
    else:
        print(1)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
start = L % 2019
end = R % 2019
dist = abs(end - start)

if end < start:
    print(0)
if dist == 1:
    print((start * end) % 2019)
    exit()

ra = 3000
for i in range(dist):
    for j in range(1, dist-1):
        r = (i + start) * (j + start)
        if ra > r:
            ra = r

print(ra)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
li = []
for i in range(l,r+1):
    li.append(i%2019)
m1 = min(li)
li.remove(m1)
ans = (m1 * min(li)) % 2019
print(ans)

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

min_i = 2020
for i in range(L, R + 1):
    mod_i = i % 2019
    if min_i > mod_i:
        min_i = mod_i
        Li = i
        if min_i == 0:
            break

min_j = (min_i + 1) % 2019
for j in range(Li + 1, R + 1):
    mod_j = j % 2019
    if min_j > mod_j:
        min_j = mod_j
        if min_j == 0:
            break

print(min_i * min_j)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
Z = 2 * 10 ** 9
X = [2019 * i for i in range(990590)]
if L == 0:
    print(0)
    exit()

for i in X:
    if R < i:
        break

    if L <= i <= R:
        print(0)
        exit()

print((L * (L + 1)) % 2019)

Submission status: Wrong Answer

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

def gcd(m,n):
    temp=0
    while m%n!=0:
        temp=n
        n=m%n
        m=temp
    return n
def lcm(m,n):
    return m*n/gcd(m,n)


temp=[]
for j in range(L,min([L+2*2019,R])):
    temp.append([(L*i)%2019 for i in range(j+1,min([j+2*2019,R+1]))])

#print(temp)
print(min([min(e) for e in temp]))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
lst=[]
for i in range(l,l+min(4038,r-l+1)):
    lst.append(i%2019)
ans=0
for i in range(len(lst)-1):
    for j in range(i+1,len(lst)):
        tmp=lst[i]*lst[j]%2019
        if tmp>ans:ans=tmp
print(ans)

Submission status: Wrong Answer

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

a = l % 2019
for n in range(l+1, r):
    a = min(a, n % 2019)

print(a * (a + 1))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
l,r=map(int,input().split())
flg=0
m=10*20
for i in range(10**6):
    if l<=2019*i<=r:
        flg=1
        m=0

for i in range(l,r): 
    if flg==1:
        break
    for j in range(l+1,r+1):
        if (i*j)%2019<m and i!=j:
            m=(i*j)%2019

print(m)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

flag = True
ans = 2020
for i in range(L, L+2020):
    if flag:
        for j in range(i+1, L+2020):
            if j > R:
                flag = False
                break
            ans = min(((i % 2019) * (j % 2019)) % 2019, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

l, r = map(int, input().split())
ll = min(l%2019, r%2019)
rr = max(l%2019, r%2019)

if rr-ll == 1:
    print((ll*rr)%2019)
    exit()

ans = 10**9

for i in range(ll, rr):
    for j in range(i+1, rr):
        ans = min(ans, (i*j)%2019)
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = [int(item) for item in input().split()]
l, ml = divmod(L, 2019)
r, mr = divmod(R, 2019)
if (l==r):
  res = min((ml*(ml+1))%2019, ((2019-mr+1)*(2019-mr))%2019)
  print(res)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
left = min(L%2019, R%2019)
right = max(L%2019, R%2019)
l = [i for i in range(left, right+1)]
ans = 2018
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())

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

Submission status: Wrong Answer

Solution code:
import sys

l,r=map(int,input().split())
minimum=2019
if r-l>=2019:
	print(0)
	sys.exit()
else:
	l,r=l%2019,r%2019
	if l>r:
		print(0)
		sys.exit()
	elif r-l==1:
		print((l*r)%2019)
	else:
		for i in range(l,r):
			for j in range(l,r+1):
				print(i,j)
				if minimum==0:
					print(0)
					sys.exit()
				if i>=j:
					pass
				else:
					if minimum>(i*j)%2019:
						minimum=(i*j)%2019
		print(minimum)

Submission status: Wrong Answer

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

if R - L >= 2019:
    print(0)
else:
    m = 2020
    index = -1
    for i in range(L, R+1):
        b = m
        m = min(m, i % 2019)
        a = m
        if b != a:
            index = i
    if index + 1 <= R:        
        print((m * (m+1)) % 2019)
    else:
        print((m * (m-1)) % 2019)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
a=sorted(list(x%2019 for x in range(l,r+1)))
print(a[0]*a[1]%2019)

Submission status: Wrong Answer

Solution code:
print(2018 * 2017 % 2019)
a, b = map(int, input().split())
c = []
d = 0
for i in range(a, b + 1):
    c.append([abs(i % 2019), i])
    c.append([abs(2019 - i % 2019), i])
    d += 1
    if d > 2019 * 3:
        break
c.sort()
print((c[0][0] * c[1][0]) % 2019)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
setA = set()
num = r
for i in range(l,r):
    for j in range(i+1,r+1):
        next = (i*j)%2019
        if next not in setA:
            setA.add(next)
            if next ==0:
                print(0)
                exit()
        else:
            print(min(setA))
            exit()
# print(setA)
print(min(setA))

Submission status: Wrong Answer

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

l = []
for i in range(L,min(R,L+MOD)+1):
    l.append(i%MOD)
l = sorted(l)
print((l[0]*l[1])%MOD)

Submission status: Wrong Answer

Solution code:
L,R=map(int, raw_input().split())
L%=2019
R%=2019

T=[]
ans=float("inf")
if L<R:
	T=range(L,R+1)
	l=len(T)
	for i in range(l):
		for j in range(i+1,l):
			#print i,j, T[i]*T[j]
			ans=min(ans, (T[i]*T[j])%2019 )
	print ans
else:
	print 0

Submission status: Wrong Answer

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

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:
l, r = map(int, input().split())
mod = 2019

l = l % mod
r = r % mod

if r <= l:
  print(0)
else:
  print(l * (l + 1))

Submission status: Wrong Answer

Solution code:
import math
def solve():
    l, r = map(int, input().split())
    min_int = l % 2019
    diff = r - l + 1
    if diff >= 2019:
        print(0)
    else:
        l_div = math.floor(l / 2019)
        r_div = math.floor(r / 2019)
        if(l_div != r_div):
            print(0)
        else:
            k = l % 2019
            print(k * (k+1))


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
list1 = []
i = L
j = L + 1
jcount = 0
while True:
    if i < R:
        list1.append(i*j%2019)
        if j < R:
            j += 1
        else:
            jcount += 1
            j = L + jcount
            i += 1
    else:
        break

if len(list1) == 0:
    print(i*j%2019)

list1.sort
print(list1[0])

Submission status: Wrong Answer

Solution code:
L,R = [int(i) for i in input().split()]
min_i = L
min_j = L
min_mod1 = 1000000
min_mod2 = 100000000
for i in range(L,R+1):
    if i % 2019 < min_mod1:
        min_mod1 = i%2019
        min_i = i
    elif i % 2019 < min_mod2:
        min_mod2 = i%2019
        min_j = i
print(min_i*min_j%2019)

Submission status: Wrong Answer

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

if L % 2019 >= R % 2019:
    print(0)
else:
    L = L % 2019
    R = R % 2019
    min_m = 1000000000000
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            m = (i * j) % 2019 
            if m < min_m:
                min_m = m
    print(min_m)

Submission status: Wrong Answer

Solution code:
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
L,R = map(int, input().split())		# 5 7 2

mod=2019


l = L % mod
r = R % mod



while l>r:
	r+=mod

a=0
b=0
ans=mod

p("l,r,a,b,ans",l,r,a,b,ans)

for a in range(l,r):
	for b in range(a+1, r+1):
		ans = min(ans, (a*b)%mod)

#a=l%mod
#b=a+1
#ans=(a*b)%mod

p("l,r,a,b,ans",l,r,a,b,ans)
print(ans%mod)

Submission status: Wrong Answer

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

L = L % 2019
R = R % 2019

if L >R:
    print(0)
else:
    mi = (L*(L+1)) %2019
    for i in range(L, R-1):
        for j in range(i+1, R):
            tmp = (i*j) % 2019
            if tmp < mi:
                mi = tmp
                
    print(mi)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
print(min([l * x % 2019 for x in range(l + 1, min(l + 2019, r) + 1)]))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

import copy
import math
import itertools

from functools import lru_cache
#@lru_cache(maxsize = None)

PPP = 1000000007

# 整数の入力
#n = int(input())

# スペース区切りの整数の入力
#a = [int(x) for x in input().split()]
l, r = map(int, input().split())
#print("sp", n, k, file=sys.stderr)
#p, q, r = map(int, input().split())
#s = [int(x) for x in input().split()]
#t = [int(x) for x in input().split()]

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))
#  a.append([int(x) for x in input().split()])
#p = [int(x) for x in input().split()]
#a.sort()
#print(l, file=sys.stderr)

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

#cache = dict()

import re
import fractions

def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)
  
def count(c):
  r = b // c - (a - 1) // c;
  print(c, r, file=sys.stderr)
  return r

print(l, r, file=sys.stderr)
l = l % 2019
r = r % 2019
if r < l:
  r += 2019
print(l, r, file=sys.stderr)

def doit():
  res = 2019
  for x in range(l, r):
    for y in range(l + 1, r + 1):
      #print(x, y, file=sys.stderr)
      res = min(res, (x * y) % 2019)
  return res % 2019

#print(doit([0] * 4))
#doit(s)
#print(doit())
try:
  print(doit())
except Exception as e:
  print("e", e, file=sys.stderr)

Submission status: Wrong Answer

Solution code:
import sys

L, R = map(int, sys.stdin.readline().split())
mod = 2019

mod_L = L%2019
mod_R = R%2019

if R - L > 2019:
    temp_i = mod_L
    temp_j = 2018
else:
    temp_i = mod_L
    temp_j = mod_R

min_mod = 9999
for i in range(mod_L, mod_R):
    print(i + 2019)
    for j in range(i + 1, mod_R + 1):
        if ((i*j)%mod) < min_mod:
            min_mod = (i*j)%mod
print(min_mod)

Submission status: Wrong Answer

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


main()

Submission status: Wrong Answer

Solution code:
LR = list(map(int,input().split()))
L = LR[0]%2019
R = LR[1]%2019
K = 2018
if R >= L:
    for j in range(L,R+1):
        for i in range(L,j):
            if K > (i*j)%2019:
                K =  (i*j)%2019
else:
    for j in range(R,L+1):
        for i in range(R,j):
            if K > (i*j)%2019:
                K =  (i*j)%2019
if R == L and R == 0:
    print(0)
else:
    print(K)

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod_n = 2019
if (mod_n*2) < (R - L + 1):
    R = L + mod_n*2

v = []
for i in range(L,R+1):
    #v.append(i % mod_n)
    v.append(i)
v.sort()
#print(v)
ans = (v[0] * v[1]) % mod_n
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    input = sys.stdin.readline
    L, R = map(int, input().split())

    if L == 0:
        return 0

    if R // 2019 > (L-1) // 2019:
        return 0

    if R - L >= 2 and R // 673 > (L-1) // 673:
        return 0

    if R // 673 > (L-1) // 673 and (R % 3 == 0 or L % 3 == 0):
        return 0

    left = L % 2019
    return left * (left + 1)


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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())  # 複数数値入力

lm = l % 2019
rm = r % 2019

if (r - l) + lm < 2019:  # 間に2019の倍数はない
    if lm >= rm:
        print(rm*(rm-1))
    else:
        print(lm * (lm + 1))
else:
    print(0)


# li = [2019, 2019]
# for i in range(l, r + 1):
#     if li[1] > i % 2019:
#         li[1] = i % 2019

#     if li[1] < li[0]:
#         li[0], li[1] = li[1], li[0]

# print(li)
# print(li[0]*li[1])

Submission status: Wrong Answer

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

d = R - L
if d >= 2019:
    ans = 0
else:
    l = L % 2019
    r = R % 2019
    
    if l + d >= 2019:
        ans = 0
    else:
        ans = l * (l+1)
        for i in range(l,l+d):
            for j in range(i+1,d):
                now = i * j % 2019
                ans = min(ans, now)

print(ans)

Submission status: Wrong Answer

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

lis = []
for i in range(l, r+1):
    lis += [i % 2019]
lis.sort()

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

Submission status: Wrong Answer

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

tmp = R - L + 1
if tmp >= 2019:
    print(0)
    exit()
else:
    start = L % 2019
    end = R % 2019
    candidate = []
    for i in range(start, end + 1):
        candidate.append(i % 2019)
    candidate.sort()
    print(candidate[0] * candidate[1])

Submission status: Wrong Answer

Solution code:
import math

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

ls = l % 2019
rs = r % 2019

dif = r // 2019 - l // 2019

#print("dif = {}".format(dif))

if (dif != 0):
    print(0)
elif (rs - ls == 1):
    print(ls*rs % 2019)
else:
    mini = []
    for i in range(ls, rs):
        mini.append(min(i * j % 2019 for j in range(ls + 1, rs)))
    print(min(mini))

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
i=0
s=[]
if (r-l)>10000:
    print(0)
else:
    while i!=(r-l)+1:
        s.append(((l+i)%2019))
        i+=1
    s.sort()
    #print(s)
    print((s[0]*s[1])%2019)
    #print((1000000*1000001)%2019)

Submission status: Wrong Answer

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

for i in range(l, r+1):
    if i % 2019 < min_remainder:
        min_remainder = i % 2019
        if min_remainder == 0:
            print(0)
            exit()

print(min_remainder*(min_remainder+1))

Submission status: Wrong Answer

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

answer = 0
if L%2019 + width >= 2019:
  pass
else:
  answer = L%2019*(L%2019+1)
print(answer)

Submission status: Wrong Answer

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

l = []
for i in range(L,min(R,L+MOD)+1):
    l.append(i%MOD)
l = sorted(l)
print(l)
print((l[0]*l[1])%MOD)