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)
    if a <= b:
        print((l*(l+1) % 2019))
        # print(l*(l+1))
    else:
        print((r*(r-1) % 2019))


main()

Submission status: Wrong Answer

Solution code:
def main():

    """ convenient functions
    # for i, a in enumerate(iterable)
    # q, mod = divmod(a, b)
    # divmod(x, y) returns the tuple (x//y, x%y)
    # Higher-order function: reduce(operator.mul, xyz_count, 1)
    # manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc127_f
    """

    """convenient decorator
    # @functools.lru_cache():
    # to facilitate use of recursive function
        # ex:
        # from functools import lru_cache
        # import sys
        # sys.setrecursionlimit(10**9)
        # @lru_cache(maxsize=None)
        # def fib(n):
        #     if n < 2:
        #         return n
        #     return fib(n-1) + fib(n-2)
        # print(fib(1000))
    """
    
    # import numpy as np
    import sys
    sys.setrecursionlimit(10**7)
    from itertools import accumulate, combinations, permutations, product # https://docs.python.org/ja/3/library/itertools.html
    # accumulate() returns iterator! to get list: list(accumulate())
    from math import factorial, ceil, floor, sqrt
    def factorize(n):
        """return the factors of the Arg and count of each factor
        
        Args:
            n (long): number to be resolved into factors
        
        Returns:
            list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
        """
        fct = []  # prime factor
        b, e = 2, 0  # base, exponent
        while b * b <= n:
            while n % b == 0:
                n = n // b
                e = e + 1
            if e > 0:
                fct.append((b, e))
            b, e = b + 1, 0
        if n > 1:
            fct.append((n, 1))
        return fct
    def combinations_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        # TODO: How should I do when n - r is negative?
        if n < 0 or r < 0:
            raise Exception('combinations_count(n, r) not defined when n or r is negative')
        if n - r < r: r = n - r
        if r < 0: return 0
        if r == 0: return 1
        if r == 1: return n
        numerator = [n - r + k + 1 for k in range(r)]
        denominator = [k + 1 for k in range(r)]
        for p in range(2,r+1):
            pivot = denominator[p - 1]
            if pivot > 1:
                offset = (n - r) % p
                for k in range(p-1,r,p):
                    numerator[k - offset] /= pivot
                    denominator[k] /= pivot
        result = 1
        for k in range(r):
            if numerator[k] > 1:
                result *= int(numerator[k])
        return result
    def combinations_with_replacement_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        if n < 0 or r < 0:
            raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
        elif n == 0:
            return 1
        else:
            return combinations_count(n + r - 1, r)
    from bisect import bisect_left, bisect_right
    from collections import deque, Counter, defaultdict # https://docs.python.org/ja/3/library/collections.html#collections.deque
    from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest # https://docs.python.org/ja/3/library/heapq.html
    from copy import deepcopy, copy # https://docs.python.org/ja/3/library/copy.html
    import operator
    from operator import itemgetter
    # ex1: List.sort(key=itemgetter(1))
    # ex2: sorted(tuples, key=itemgetter(1,2))
    from functools import reduce, lru_cache
    def chmin(x, y):
        """change minimum
        if x > y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current minimum value
            y (long): potential minimum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x > y:
            x = y
            return (x, True)
        else:
            return (x, False)
    def chmax(x, y):
        """change maximum
        if x < y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current maximum value
            y (long): potential maximum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x < y:
            x = y
            return (x, True)
        else:
            return (x, False)

    from fractions import gcd # Deprecated since version 3.5: Use math.gcd() instead.
    def gcds(numbers):
        return reduce(gcd, numbers)
    def lcm(x, y):
        return (x * y) // gcd(x, y)
    def lcms(numbers):
        return reduce(lcm, numbers, 1)

    # first create factorial_list
    # fac_list = mod_factorial_list(n)
    INF = 10 ** 18
    MOD = 10 ** 9 + 7
    modpow = lambda a, n, p = MOD: pow(a, n, p) # Recursive function in python is slow!
    def modinv(a, p = MOD):
        # evaluate reciprocal using Fermat's little theorem:
        # a**(p-1) is identical to 1 (mod p) when a and p is coprime
        return modpow(a, p-2, p)
    def modinv_list(n, p = MOD):
        if n <= 1:
            return [0,1][:n+1]
        else:
            inv_t = [0,1]
            for i in range(2, n+1):
                inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
            return inv_t
    def modfactorial_list(n, p = MOD):
        if n == 0:
            return [1]
        else:
            l = [0] * (n+1)
            tmp = 1
            for i in range(1, n+1):
                tmp = tmp * i % p
                l[i] = tmp
            return l
    def modcomb(n, k, fac_list = [], p = MOD):
        # fac_list = modfactorial_list(100)
        # print(modcomb(100, 5, modfactorial_list(100)))
        from math import factorial
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        if len(fac_list) <= n:
            a = factorial(n) % p
            b = factorial(k) % p
            c = factorial(n-k) % p
        else:
            a = fac_list[n]
            b = fac_list[k]
            c = fac_list[n-k]
        return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p
    def modadd(a, b, p = MOD):
        return (a + b) % MOD
    def modsub(a, b, p = MOD):
        return (a - b) % p
    def modmul(a, b, p = MOD):
        return ((a % p) * (b % p)) % p
    def moddiv(a, b, p = MOD):
        return modmul(a, modpow(b, p-2, p))

    """ initialize variables and set inputs
    # initialize variables
        # to initialize list, use [0] * n
        # to initialize two dimentional array, use [[0] * N for _ in range(N)]
    # set inputs
        # open(0).read() is a convenient method:
        # ex) n, m, *x = map(int, open(0).read().split())
        #     min(x[::2]) - max(x[1::2])
        # ex2) *x, = map(int, open(0).read().split())
        #     don't forget to add comma after *x if only one variable is used
    # preprocessing
        # transpose = [x for x in zip(*data)]
        # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [(1, 4, 7), (2, 5, 8), (3, 6, 9)]
        # flat = [flatten for inner in data for flatten in inner]
        # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [1, 2, 3, 4, 5, 6, 7, 8, 9]
    # calculate and output
        # output pattern
        # ex1) print(*l) => when l = [2, 5, 6], printed 2 5 6
    """

    # functions used
    r = lambda: sys.stdin.readline().strip()
    r_int = lambda: int(r())
    R = lambda: list(map(int, r().split()))
    Rmap = lambda: map(int, r().split())
    Rfloat = lambda: list(map(float, r().split()))
    Rtuple = lambda: tuple(map(int, r().split()))

    """ how to treat input
    # single int: int(r())
    # single string: r()
    # single float: float(r())
    # line int: R()
    # line string: r().split()
    # line (str, int, int): [j if i == 0 else int(j) for i, j in enumerate(r().split())]
    # lines int: [R() for _ in range(n)]
    """

    if __name__ != '__main__':
        # for test
        sys.stdin = open('sample.txt')

    # ----------------------------------
    # main
    inputL, inputR = R()
    md = 2019
    modl = inputL % md
    modr = inputR % md
    
    if inputR - inputL >= 2018 or modl > modr:
        print(0)
        exit()
    
    print(modl*(modl+1))
    # print(min(modl*(modl+1), modr*(modr+1)))
    # if inputL > inputR:
    #     print(inputL * (inputL+1))
    # else:
    #     print(inputR * (inputR+1))
        
        
    # end of main
    # ----------------------------------

    """memo: how to use defaultdict of list
    # initialize
    Dic = defaultdict(list)
    # append / extend
    Dic[x].append(y)
    # for
    for k, v in Dic.items():
    """

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Lm = L%2019
Rm = R%2019

if Lm*Rm == 0 or R-L > 2017 or Rm <= Lm:
    print(0)
    exit()

print(Lm*(Lm+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 = list(map(int, input().split()))
ans = 2*10**9
for i in range(l, r+1):
  for j in range(i+1, r+1):
    if ans > (i*j)%2019:
      ans = (i*j)%2019
print(ans)
print(min([(i*j)%2019 for i in range(l, r) for j in range(i, r+1)]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np
a, b = map(int, input().split())
lst = []
for i in range(1, b - a + 1):
    x = a * (a + i)
    lst.append(x)
y = np.array(lst)
r = np.mod(y, 2019)
print(min(r))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def min_mod(l, r):
    tmp = [i % 2019 for i in range(l, min(l + 5000, r + 1))]
    tmp.sort()
    return (tmp[0] * tmp[1]) % 2019


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

Submission status: Wrong Answer

Solution code:

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

l %= 2019
r %= 2019

if r-l <= 0:
    r += 2019

lr_min = 2019

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

print(lr_min)

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left, bisect_right; from collections import Counter, defaultdict, deque, OrderedDict; from copy import deepcopy; from fractions import gcd; from functools import lru_cache, reduce; from math import ceil, floor; from sys import stdin, setrecursionlimit
import heapq as hq; import itertools as its; import operator as op


# globals
inf = float('inf')
input = stdin.readline
MOD = 2019


def main():
    l, r = get_li()
    if r - l >= MOD:
        print(0)
        return
    a, b = inf, inf
    for i in range(l, r + 1):
        x = i % MOD
        if x < a:
            a, b = x, a
        elif x < b:
            b = x
    print(a * b % MOD)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def gets(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


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

Submission status: Wrong Answer

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

length = min(2019, R-L)

m = (L % 2019) * (R % 2019)
for i in range(L, L+length) :
    for k in range(i+1,L+length) :
        # tmp = (i*k) % 2019

        l = i % 2019
        r = k % 2019
        tmp = (l*r)
        if (tmp < m) :
            m = tmp

print(m)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split()) # 横に2個

l = L // 2019
r = R // 2019
ll = L % 2019
rr = R % 2019

if l < r:
    ans = 2
else:
    ans = 2019
    for i in range(ll, rr+1):
        for j in range(i+1, rr+1):
            k = i * j % 2019
            ans = min(ans, k)

print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
mod = 2019
li = list(set([i%mod for i in range(l,r+1)]))
li.sort()
print(li[0]*li[1]%mod)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())

l,r=intinput()
mod=2019
if r-l>=mod:
    print(0)
    sys.exit()
s=l%mod
t=r%mod
if s>t: print(0)
else: print(s*(s+1))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
# 2019 = 3 * 673

rr = min(r, l + 2020)

res = 1000000
for i in range(l, rr+1):
    for j in range(l + 1, rr + 1):
        if l >= r:
            continue
        #print("{0}, {1}".format(i, j))
        if res > i*j % 2019:
            #print("{0}, {1}".format(i, j))
            res = i*j % 2019
print(res)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

print(min)

Submission status: Wrong Answer

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


circle = round((R- L)/ 2019)
if circle >=5:
    R = R-2019*(circle-5)

mod_list = []
for i in range(L,R+1):
    mod_list.append(i%2019)
    
mod_list.sort()
print(mod_list[0]*mod_list[1])

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-


MOD = 2019

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


modset = []
i = L
while len(modset)<=MOD*2+1 and i<=R:
  modset.append(i%MOD)
  i+=1
modset = sorted(modset)
print((modset[0]*modset[1])%MOD)

Submission status: Wrong Answer

Solution code:
def main():
	import sys
	input = sys.stdin.readline
	L, R = list(map(int, input().split()))
	if R - L >= 2019:
		ans = 0
	else:
		modL = L % 2019
		modR = R % 2019
		if modR <= modL:
			ans = 0
		else:
			ans = (modL * (modL + 1)) % 2019

	print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

L = L % 2019
R = R % 2019

print(L * (L + 1))

Submission status: Wrong Answer

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

num_list = []

for i in range(L, R+1):
    for j in range(i+1, R+1):
        num_list.append((i*j)%2019)
        print(i,j,(i*j)%2019)

print(min(num_list))

Submission status: Wrong Answer

Solution code:
def solve():
  l,r = (int(i) for i in input().split())
  mod = 2019
  l %= mod
  r %= mod
  ans = 10**15
  if l > r :
    print(0)
    exit()
  elif l == 0 or r == 0:
    print(0)
    exit()
  else:
    for i in range(l,r):
      for j in range(l+1,r+1):
        if i<j:
         ans = min(ans,(i*j)%mod)
  print(ans%mod)

solve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(min_)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
mod=2019
A=L%mod
B=(L+1)%mod
print((A*B)%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

l, r = na()
if l > 2019:
    print(2)
elif l <= 2019 and r > 2019:
    print(0)
elif r <= 2019:
    print(l * r)

Submission status: Wrong Answer

Solution code:


S=input()

tmp=S.split()

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

n=L*R

print(n%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
mod = 2019
amari = []
for i in range(L,R+1):
    amari.append(i%mod)
amari.sort()
print("{}".format(amari[0]*amari[1]))

Submission status: Wrong Answer

Solution code:

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

l %= 2019
r %= 2019

if r-l < 0:
    r += 2019

lr_min = 2019

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

print(lr_min)

Submission status: Wrong Answer

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

if l == r:
    l = 0
    r = 2018
else:
    tmp = min(l, r)
    r = max(l, r)
    l = tmp
    

for i in range(l, r):
    for j in range(l + 1, r + 1):
        if j <= i:
            continue
        else:
            ans = min(ans, i * j % MOD)

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
l, r = map(int, input().split())

if r-l > 2019:
        l = l%2019
        r = r%2019
        if l > r:
                r += 2019

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

print(ans)

Submission status: Wrong Answer

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

L, R = map(int, input().split())
if R - L > 2018:
    print(0)
else:
    tmp = []
    for i in range(L, R+1):
        tmp.append(i%2019)
    m = (tmp[0]*tmp[1])%2019
    for i in range(2, R-L+1):
        m = min(m, (tmp[i]*tmp[i-1])%2019)
    print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = L%2019
b = R%2019

if (a-2019)*(b-2019) <= 0:
	print(0)
else:
	print(a*(a+1))

Submission status: Wrong Answer

Solution code:
import sys

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

    if R // 2019 > L // 2019:
        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())

_L = L % 2019
_R = R % 2019

print(_L*(_L+1))

Submission status: Wrong Answer

Solution code:
def min_mod(l, r):
    tmp = [i % 2019 for i in range(l, min(l + 5000, r + 1))]
    tmp.sort()
    return tmp[0] * tmp[1]


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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
ans = float('inf')

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-


MOD = 2019

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


modset = []
i = L
while len(modset)<=MOD*2+1 and i<=R:
  modset.append(i%MOD)
  i+=1
modset = sorted(modset)
print(modset[0]*modset[1])

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [L, R] = string_to_int(inputs[0])
    left = L % 2019
    right = R % 2019

    min = left * right
    for i in range(left, right-1):
        for j in range(left+1, right):
            if min > i*j:
                min = i*j
    return min


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
min2019 = L
while True:
    if min2019 % 2019 == 0:
        break
    else:
        min2019 -= 1

if min2019 + 2019 < R:
    max2019 = 2018
else:
    max2019 = R

min2019 = L

print(min2019, max2019)

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

Submission status: Wrong Answer

Solution code:
#!venv/bin/python
#from collections import defaultdict 
from itertools import combinations
import math
import datetime
L, R = [int(x) for x in input().split()]
MOD = 2019

l = L
r = min(l + MOD, R)

ans = MOD
for i in range(l, r):
    for j in (i + 1, r + 1):
        mod = (i * j) % MOD
        if mod < ans:
            ans = mod
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

lmod=l%2019
rmod=r%2019

if r-l>=2019:
    print(0)
elif lmod > rmod:
    print(0)
else:
    if lmod < rmod:
        print((l*(l+1))%2019)
    else:
        print((r*(r-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)


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mod = [(i*j)%2019 for i in range(L, R-1) for j in range(i+1, R)]

if len(mod)==0:
    print((L*R)%2019)
else:
    print(min(mod))

Submission status: Wrong Answer

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

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()
    l%=2019
    r%=2019

    st=min(l,r)
    print((st*(st+1))%2019)


if  __name__=='__main__':
    main()

Submission status: Wrong Answer

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

if r - l >= 2018:
    print(0)
elif (l % MOD) >= (r% MOD):
    print(0)
else:
    print((l % MOD) * ((l % MOD) + 1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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