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:
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10

# 0<= L < R <= 2*10^9 
L, R = [int(x) for x in stdin.readline().rstrip().split()]
MODN = 2019

if R < 2019:
    print(L*R)
    exit()

ans = INF
for i in range(L, L + 2019 + 1):
    if (i+1) > R:
        break
    tmp = (i * (i+1)) % MODN
    ans = min(ans, tmp)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


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


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


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def slv(L, R):
    m = []
    M = 2019
    for i in range(L, min(R+1, L+2*M+1)):
        m.append(i%M)
    m.sort()
    return (m[0] * m[1]) % M

@mt
def slv2(L, R):
    ans = sys.maxsize
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ans = min((i*j)%2019, ans)
    return ans

def main():
    L, R = read_int_n()
    print(slv(L, R))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
a %= 2019
b %= 2019
if b <= a:
    b += 2019
ans = 10 ** 10
for i in range(a,b):
    for j in range(i+1,b+1):
        ans = min(ans,(i * j) % 2019)
print(ans)

Submission status: Wrong Answer

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

import fractions

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def calc(n, x):
    return n // x

def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)

def main():
    l, r = rli()
    mod = [[2019 for _ in range(2019)] for _ in range(2019)]
    for i in range(2019):
        for j in range(i+1, 2019):
            mod[i][j] = i*j % 2019
    if l - r >= 2019:
        print(0)
        return
    l_mod = l % 2019
    r_mod = r % 2019
    if l_mod < r_mod:
        cand = list(range(l_mod, r_mod+1))
    else:
        cand = list(range(l_mod, 2019)) + list(range(0, r_mod+1))
    ans = 2018
    for i in cand:
        for j in cand:
            if i >= j:
                continue
            ans = min(ans, mod[i][j])
    print(ans)



if __name__ == '__main__':
    main()

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)
print(ans)

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(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:
L, R = map(int, input().split())
ans = 10 ** 9
c = 0
for i in range(L, R + 1):
    ans = min(ans, i * (i + 1) % 2019)
    if ans == 0:
        break
print(ans)

Submission status: Wrong Answer

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

# 2019 = 3*673
answer = 2019

if R - L + 1 >= 2019:
    print(0)
else:
    for x in range(L,R+1):
        for y in range(x+1,R+1):
            sumple = x * y
            test = sumple % 2019 
            if test < answer:
                answer = test

print(answer)

Submission status: Wrong Answer

Solution code:
#C問題
L,R = map(int,input().split())
r = R%2019
l = L%2019
MIN = 2019
if R-L >= 2019:
    MIN = 1
else:
    for i in range(r-l+1):
        I = i+l
        for j in range(r-l):
            J = j+l+1
            kari = I*J%2019
            MIN = min(MIN,kari)
print(MIN)

Submission status: Wrong Answer

Solution code:
mod=2019

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

l=l%mod
r=r%mod

maxi=max(l, r)
mini=min(l, r)

ans=-1

for i in range(mini, maxi):
    for j in range(i+1, maxi+1):
        if ans==-1:
            ans=(i*j)%mod
        else:
            if ans>(i*j)%mod:
                ans=(i*j)%mod
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

MOD = 2019

def main():
    L, R = i2nn()
    LM = L % MOD
    RM = R % MOD
    LM2 = min(LM, RM)
    RM2 = max(LM, RM)
    if LM2 == RM2:
        n = (LM2 * RM2) % MOD
        print(n)
    else:
        n = int(1e+9)
        for i in range(LM2, RM2):
            for j in range(i+1, RM2+1):
                t = (i * j) % MOD
                if n > t:
                    n = t
        print(n)

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ls = []

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

    if len(ls)==6000:
        break
ls = sorted(ls)

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

Solution code:
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

# import numpy as np
# from scipy.misc import perm
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 # 10^9 + 7

########

L, R = l_inpl()
L %= 2019
R %= 2019

if R<=L:
    R += 2019

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

print(ans)

Submission status: Wrong Answer

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

left = L // 2019
right = R // 2019

if left < right:
    print(0)
else:
    print((L % 2019) * ((L + 1) % 2019) % 2019)

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)
    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(v) for v in input().split() ]



if l % 2019 == 0:
    ans = 0
elif r % 2019 == 0:
    ans = 0
elif l // 2019 == r // 2019:
    ans = ((l%2019)*((l+1)%2019)) % 2019
elif l // 2019 != r // 2019:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

# import numpy as np
# from scipy.misc import perm
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 # 10^9 + 7

########

L, R = l_inpl()
L %= 2019
R %= 2019

if R<=L:
    R += 2019

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

print(ans)

Submission status: Wrong Answer

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

x = L // 2019

l = (x + 1) * 2019

if (l+1) > R:
    print(L * (L+1) % 2019)
else:
    print(l * (l+1) % 2019)

Submission status: Wrong Answer

Solution code:
import sys

l, r = [ int(x) for x in sys.stdin.readline().split() ]

lm = l % 2019

if lm + (r-l)>=2019:
    print(0)
    exit(0)
#
print( ( lm * (lm+1) ) % 2019 )

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()
  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()))
L=L%2019
R=R%2019

l=min(L,R)
r=max(L,R)
x=[]
for i in range(l,(r+1)) :
    for j in range(i+1,r+1):
        x.append((i*j)%2019)
if L==0 or R==0:
    print(0)
else:
    print(min(x))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(100000000)
input=lambda : sys.stdin.readline().rstrip()

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

x=l%2019
y=r%2019

if x>=y or l-r>=2019 or x==0:
    print(0)
else:
    ans=99999
    for i in range(x,y+1):
        for j in range(x+1,y+1):
            ans=min(ans,i*j)
    print(ans)

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

Submission status: Wrong Answer

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

mods = sorted([i % 2019 for i in range(L, R + 1)])
print(mods[0] * mods[1])

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)

# debug = True
# debug = False
#
# def dprint(*objects):
#     if debug == True:
#         print(*objects)

def solve():
    L, R = map(int, input().split())

    l = L % 2019
    r = R % 2019
    if r <= l:
        r = min(r+2019, R)

    mn = 2019
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            md = i * j % 2019
            #print(i, j, md, mn)
            if md < mn:
                mn = md
    print(mn)
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)
sorted(l)
print(l[0]*l[1])

Submission status: Wrong Answer

Solution code:

def solve(L, R):
    M = 2019
    I = 0
    for i in range(L, R):
        m = i % 2019 
        if m == 0:
            return 0
        if m == M:
            I = i
            break
        if m < M:
            M = m
            I = i
    M = 2019
    J = I+1
    for i in range(I+1, R+1):
        m = i % 2019 
        if m == 0:
            return 0
        if m == M:
            J = i
            break
        if m < M:
            M = m
            J = i
    print(I, J)
    return (I * J) % 2019

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

    print(solve(L, R))

main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if 0 <= l < r:
    min = (l * r) % 2019
    for c in range(l, r+1):
        s = (l * r) % 2019

        if s < min:
            min = s
else:
    min = l * r

print(min)

Submission status: Wrong Answer

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

L = l%2019
R = r%2019
ans = float('inf')
for i in range(L,R+1):
    for j in range(L,R+1):
        temp = (i*j)%2019
        if temp < ans and i != j:
            ans = temp
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)
# print (l, ml)
# print (r, mr)
if (l==r):
  print((ml*(ml+1))%2019)
elif (l < r):
  print(0)

Submission status: Wrong Answer

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



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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

amari = []

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

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

Submission status: Wrong Answer

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

minMod= 2019

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

print(minMod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc133/tasks/abc133_c

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop

def main():
    l, r = map(int, input().split())
    ans = l * r % 2019

    for k in range(l, min(r, l + 2020)):
        ans = min(ans, k * (k + 1) % 2019)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if L % MOD < R % MOD:
    a = [n for n in range(L % MOD, R % MOD + 1)]
elif L % MOD > R % MOD:
    a = [n for n in range(L % MOD, 2019)] + [n for n in range(R % MOD + 1)]
else:
    a = list(range(2019))

ans = MOD - 1
for i in range(len(a)):
    for j in range(i + 1, len(a)):
        ans = min(ans, (a[i] * a[j]) % MOD)

print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
e = 2019
if r < e:
    print(divmod(r,e)[-1] * divmod(r-1,e)[-1])
elif e < l:
    print(divmod(l,e)[-1] * divmod(l+1,e)[-1])
else:
    print(0)

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]
    for i in range(2, R-L):
        m = min(m, (tmp[i]*tmp[i-1])%2019)
    print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

rr = min(r, l + 2019)

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

Submission status: Wrong Answer

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

L, R = L % 2019, R % 2019

if L >= R:
    R += 2019

ans = float('inf')

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

Submission status: Wrong Answer

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


#L, Rの間に2019の倍数が入っている時-->答え0(2019の倍数にできる)
if (R%2019 == 0) or (L%2019 == 0):
    print (0)
    exit()
if R//2019 > L//2019:
    print (0)
    exit()


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
def ddprint(x):
  if DBG:
    print(x)

l,r = inm()
if r-l >= 2018:
    print(0)
    exit()
mn = 2020
for i in range(l,r):
    for j in range(i+1,r+1):
        r = (i*j)%2019
        if r < mn:
            mn = r
print(mn)

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

if l>r: l,r = r,l

a=l%mod
b=a+1

ans=(a*b)%mod

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


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


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


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def slv(L, R):
    ans = sys.maxsize
    m = []
    M = 2019
    for i in range(L, min(R+1, L+2*M)):
        m.append(i%M)
    m.sort()
    return (m[0] * m[1]) % M

@mt
def slv2(L, R):
    ans = sys.maxsize
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ans = min((i*j)%2019, ans)
    return ans

def main():
    L, R = read_int_n()
    print(slv(L, R))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
x = [i % 2019 for i in range(L, min(R + 1, L + 2020))]
x.sort()
print((x[0] * x[1]) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
A = 2019
M = min(R+1, L+A)

a = min(i % A for i in range(L, M))
if a == 0:
    print(0)
else:
    print(a*(a+1))

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)
print (l, ml)
print (r, mr)
if (l==r):
  print((ml*(ml+1))%2019)
elif (l < r):
  print(0)

Submission status: Wrong Answer

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