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)
        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:
import numpy as np

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ret=(L%2019)*(L%2019+1)

if(L==0):
  ret=0
  
if(R-L>=2019):
  ret=0
  
if(L%2019 > R%2019):
  ret=0
  

    
print(ret)

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)
else:
	T=range(L,2019)+range(R)
	l=len(T)

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

print ans

Submission status: Wrong Answer

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

l = L % 2019
r = R % 2019

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:
import numpy as np

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

if R - L > 2019:
  print(0)
else:
  l = sorted(np.array(range(L, R + 1)) % 2019)
  print((l[0] * l[1]) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int,input().split(' '))
l = []
if L % 2019 == 0 or R % 2019 == 0:
    print('0')
    exit()

for i in range(L,R+1):
    l.append(i % 2019)
l_s = sorted(l)

print('{}'.format( (l_s[0] * l_s[1]) % 2019 ))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:



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

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

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

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

    elif n <= 2019:
        print(0)

Submission status: Wrong Answer

Solution code:

S=input()

tmp=S.split()

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

result=100000000000
flag=False
for i in range(L,R+1):
    for j in range(i+1,R+1):
        if i>=j:
            flag=True
            break
        n=(i*j)%2019
        if result>n:
            result=n
            break
    if(flag):
        break

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
L=L%2019
min_mod = 2019
flg=[0]*2019
flg2=[0]*2019
for i in range(L,R):
    idx=i%2019
    if flg[idx]==0:
        for j in range(i+1,R+1):
            mod  = (i*j)%2019
            if flg2[mod]==1:
                break
            flg2[mod]=1
            if min_mod > mod:
                min_mod=mod
        flg[idx]=1
print(min_mod)

Submission status: Wrong Answer

Solution code:
str = input()

L, R = map(int, str.split(" "))

min = 2019

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

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

print(min)

Submission status: Wrong Answer

Solution code:
A=[int(i) for i in input().split()]
L=A[0]
R=A[1]
num=L-1
am=2020
se=2021
n=0
while True:
	num+=1
	if num>R:
		break
	n=num%2019
	if	n<=se:
		if n<=am:
			se=am
			am=n
		else:
			se=n	
	if num-L>2020:
		break
	
ans=am*se
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
diff = R - L
if diff >= 2018:
  print(0)
else:
  L %= 2019
  R %= 2019
  ans = sorted([(L + i)%2019 for i in range(diff+1)]) 

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

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

print(a*(a+1))

Submission status: Wrong Answer

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

Lmod = L%2019
Rmod = R%2019

i = Lmod
j = i + 1

if i == 2018:
  print(0)
else:
  print((i*j)%2019)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    l,r  = list(map(int, input().split(" ")))

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

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
dif=R-L
l=L%2019
arr=[]
while(dif):
    arr.append(l)
    l+=1
    if(l==2019):
        l=0
    dif-=1
arr.sort()
if(len(arr)==1):
    arr.append(l)
print(arr[0]*arr[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def hantei3(w,L,R):
    if w>=2:
        return True
    for i in range(L,R+1):
        if i%3==0:
            return True
    return False

def hantei673(w,L,R):
    if w>=672:
        return True
    for i in range(L,R+1):
        if i in [673,1346]:
            return True
    return False

L,R=map(int,input().split())
w=R-L
L%=2019
R%=2019
if w>=2018 or L>R:
    print(0)
else:
    if hantei3(w,L,R) and hantei673(w,L,R):
        print(0)
    else:
        print(L * (L + 1))

Submission status: Wrong Answer

Solution code:
L, R = [int(x) for x in input().strip().split()]
num_range = R - L
if num_range >= 2019:
    print(0)
else:
    delim_L = L % 2019
    delim_R = R % 2019
    if num_range == 1: print(delim_L*delim_R)
    else:
        if delim_L > delim_R: print(delim_R*(delim_R - 1))
        else: print(delim_L*(delim_L + 1))

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if a <= 2019 and 2019 <= b:
  if b > 2019:
    print(0)
else:
  if b-a==1:
    print(a*b/2019)
  else:
    c = 2018
    d = 2018
    for i in range(a,b+1):
      if c > i%2019:
        c=i%2019
      elif d > i%2019:
        d=i%2019
    print(c*d%2019)

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 = sorted(np.mod(np.array([i for i in range(l,r+1)]),MOD))
  print(k)
  print((k[0]*k[1])%MOD)

Submission status: Wrong Answer

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

L = L % 2019
R = R % 2019

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if R-L > 2019:
    print('0')
else:
    for i in range(L, R):
        if i % 2019 < mini:
            mini = i % 2019
    
    calc = (mini * (mini+1)) % 2019
    print(calc)

Submission status: Wrong Answer

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

#i*jmodk=(imodk*jmodk)modk

#l以上r以下の整数で2019の倍数を含むものがあれば、imod2019=0となるiを選ぶことでijmod2019=0になり、最小
#場合１、r-l+1が2019より大きければかならずimod2019=0となるiを選べる
if r-l+1>=2019:
    print(0)
else:
    #場合2、r-lが2019より小さいが、imod2019=0となるiがある　ijmod2019=0になり、最小
    for i in range(l,r+1):
        if i%2019==0:
            print(0)
            sys.exit(0)
    #場合3、r-lが2019より小さく、中にimod2019=0となるiがない　i=l,j=l+1のときijmod2019は最小値をとる
    ans=(l%2019 * (l+1)%2019)%2019
    print(ans)

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:
            print(r_2019*(r_2019-1)%2019)
        else:
            print((l_2019*(l_2019+1))%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

diff = R//2019 - L//2019

if L % 2019 == 0:
    answer = 0
elif diff > 0:
    answer = 0
else:
    L = L % 2019
    R = R % 2019
    _min = 2019
    for i in range(L, R+1):
        for j in range(i, R+1):
            _min = min(_min, (i * j) % 2019)
    answer = _min

print(answer)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

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

def main():
    N = R - L + 1
    if N >= 2019:
        ans = 0
    else:
        ansLi = L % 2019
        ansLj = (L+1) % 2019
        ansL = ansLi * ansLj

        ansRi = R % 2019
        ansRj = (R-1) % 2019
        ansR = ansRi * ansRj

        ans = min(ansL, ansR)

    return int(ans)

print(main())

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"
 
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    L, R = list(map(int,input().split()))
    m=2020
    for i in range(L,R):
        if i%2019<m:
            m=i%2019
    if R%2019==0:
        print(0)
    else:
        print(m*(m+1))
    # print(A,B)
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

mod = 2019

l %= mod
r %= mod

if r <= l:
    r += 2019

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

print(ans)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    l,r=MAP()

    if l//2019==r//2019:
        l%=2019
        print((l*(l+1))%2019)
    else:
        print(0)


if  __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

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

lm = (l // 2019)
rm = (r // 2019)

if lm != rm:
    print(0)
else:
    li = l % 2019
    print((li * (li + 1)) % 2019)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

MOD = 2019  # type: int

def solve(L: int, R: int):
    # L = min(L,MOD-1)
    # R = min(R,MOD-1)
    L = L % MOD
    R = R % MOD
    if(R <= L):
        R += MOD

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

    print(ans)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
ans = 2020
a = l // 2019
b = r // 2019
ans = []
# print(a)
# print(b) # 2019 num
if a != b:
    print(0)
else:
    for i in range(l, r+1):
        ans.append(i % 2019)
    
    ans.sort()
    print(ans[0] * ans[1])
    #l.append()
# print(a, b)


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

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




    #print(i)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
counter = []
ite = 0
for i in range(L, R+1):
    counter.append(i % 2019)
    ite += 1
    if ite > 2021:
        break
counter = sorted(counter)
ans = counter[0]*counter[1]
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

a = L // 2019
b = R // 2019
if L > R:
  ans = 0
  print(ans)
  exit()

c = L // 3
d = R // 3
e = L // 673
f = R // 673
if d > c and f > e:
  ans = 0
else:
  ans = (L*(L+1))%2019
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
#s = ("2020 2040")
#print(s) 
s = s.split(" ")

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


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

print(result)

Submission status: Wrong Answer

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

mv = 2019

# lとrの範囲がmvより大きかったら0
if (r + 1 - l) >= mv:
    print(0)
# 範囲が小さかったら
else:
    # 端を調べる
    lMod = l % mv
    rMod = r % mv
    # 0を含まない場合
    if lMod <= rMod:
        print(lMod * (lMod + 1))
    # lrの大小が逆転してれば0ですね
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
l, r = [int(i) for i in input().split()]
if r//3 - (l-1)//3 >= 1 and r//673 - (l-1)//673 >= 1:
    print(0)
elif r//2019 - (l-1)//2019 >= 1:
    print(0)
else:
    print((l*(l+1))%2019)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
a=L-1//2019
b=L%2019
c=R//2019
d=R%2019
if a!=c:
  print("0")
else:
  f=(b*d)%2019
  for i in range(b,d-1):
    for j in range(i+1,d):
      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())
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:
hoge = input().split()
L = int(hoge[0])
R = int(hoge[1])
ans = None
if L > 2018 and R - L > 2019:
  for i in range(L,R):
    if i % 2019 == 0:
      ans = i
      break
min_ = 2019
for i in range(L,R):
  if i % 2019 < min_:
    min_ = i % 2019
L = min_
  
if ans is not None:
  print(1)
else:
  print((L*(L+1)) % 2019)

Submission status: Wrong Answer

Solution code:
l,r =  list(map(int,input().split()))
res=2019
is_end=False
for i in range(l, r):
    for j in range(i+1,r+1):

        if (i*j)%2019 < res:
            res = (i*j)%2019
        if(res == 1):
            is_end = True
            break
    if(is_end):
        break
print(res)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

MOD = 2019  # type: int

def solve(L: int, R: int):
    if R - L >= 2019 - 1:
        print(0)
    else:
        result = (L  * (L + 1)) % 2019
        print(result)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)

if __name__ == '__main__':
    main()

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
  elif l+(2020-l%2019) == r:
    ans = l%2019
  else:
    ans = 2
    
print(ans)

Submission status: Wrong Answer

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

m = sys.float_info.max
for i in range(r-l):
    for j in range(l+i,r):
        if m > ((l+i+1)*j) % 2019:
            m = ((l+i+1)*j) % 2019
print(m)

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 * (l+1)) % 2019
            print(k)


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = [int(i) for i in input().split()]
r=r%2019
l=l%2019
if(r<=l):r+=2019
m=10**10
for i in range(l,r):
  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 R - L >= 2019:
    print(0)
else:
    ans = float("inf")
    for i in range(L, R):
        ans = min(i * (i + 1) % 2019, ans)
    print(ans)

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(L*(L+1) % 2019)

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

r = float('inf')
for i in range(L, min(R + 1, L + 45)):
    for j in range(i + 1, min(R + 1, i+46)):
        t = (i * j)%MOD
        if t < r:
            r = t
print(r)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
dl, ml = divmod(l, 2019)
dr, mr = divmod(r, 2019)
if ml == 0 or mr == 0 or dr - dl != 0 or ml >= mr:
  print(0)
else:
  print(ml*(ml+1))

Submission status: Wrong Answer

Solution code:
#C問題
L,R = map(int,input().split())
r = R%2019
l = L%2019
if R-L>=2019:
    print(0)
else:
    if r <= l:
        print(0)
    else:
        print(l*(l+1)%2019)

Submission status: Wrong Answer

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

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,r+1):
            # print(i,j)
            ans = min(ans,i * j % base)
            if ans == 0:
                break
        else:
            continue
        break
else:
    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())
mod = 2019

lm = l % mod
rm = r % mod

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

Submission status: Wrong Answer

Solution code:
L, R = list(map(int, input().split()))
L_mod = L%2019
L_shou = L//2019
R_shou = R//2019
if L_shou == R_shou:
    print(L_mod*(L_mod+1))
else:
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:



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



    if n == 2019 or a == 2019:
        print(0)


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


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


    elif n <= 2019:
        print(0)

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import itertools

L, R = (int(i) for i in input().split()) 
if R - L >= 2019: 
  print(0)
else:
  ans = 2019
  for x, y in itertools.combinations(range(L, R + 1), 2):
      ans = min((x % 2019) * (y % 2019), ans)
  if ans == 2019:
    print(0)
  else:
    print(ans)

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) % 2019)

Submission status: Wrong Answer

Solution code:
from random import randint

def solve0(L, R):
    m = 2019
    for i in range(L, R):
        for j in range(i+1, R+1):
            t = (i*j) % 2019
            if t < m:
                m = t
                I = i
                J = j
    print("solve0", I, J, I%2019, J%2019, "m=%d"%((I*J)%2019))
    return m

def solve(L, R):
    M = 2019
    I = L
    mi = []
    mj = []
    for i in range(L, R):
        m = i % 2019 
        if m == 0:
            return 0
        mi.append(i)
        I = i

    for i in range(I+1, R+1):
        m = i % 2019 
        if m == 0:
            return 0
        mj.append(i)

    m = 2019
    for a in range(0, len(mi)):
        i = mi[a]
        for b in range(a+1, len(mi)):
            j = mi[b]
            t = (i*j)%2019 
            if t < m:
                m = t

    return m

if 0==1:
    N = 10000
    while True:
        l = randint(0, N)
        r = randint(l+1, N)
        if solve(l,r) != solve0(l,r):
            print(l, r)
            break


def main():
    L, R =[int(x) for x in input().split()]
    answer = solve(L, R)
    #print("solve ", answer)
    print(answer)

main()

Submission status: Wrong Answer

Solution code:
n, k = tuple([int(s) for s in input().split()])

n = n % 2019
k = k % 2019

min_val = 2019

for i in range(n, k):
    for j in range(i+1, k+1):
        if (i*j)%2019 < min_val:
            min_val = (i*j)%2019

print(min_val)

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+1):
    for j in range(i+1, r+1):
      score = i*j%2019
      print(i,j)
      if i*j%2019<min_c:
        print('change')
        min_c = score
  print(min_c)

Submission status: Wrong Answer

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

for i in range((a[1]-a[0]+1)%2019):
  for j in range(i):
    c = ((i+a[0])%2019)*((j+a[0])%2019)
    b.append(c)
else:
  print(min(b))

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)]))
ij_list.sort()
print(ij_list[0]*ij_list[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

minm = 100000000

for i in range(L,R-1):
    for j in range(i+1, R):
        if minm > (i*j) % 2019:
            minm = (i*j) % 2019
if minm == 100000000:
    print(L*R)
    sys.exit()
print(minm)

Submission status: Wrong Answer

Solution code:

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


mod = 2019

ans = 0
if l//mod == r//mod: # !( l<= x*mod <= r)
    
    lm = l%mod
    ans = lm*(1+lm)%mod
    
print(ans)