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:
I, J = map(int, input().split())

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

Submission status: Wrong Answer

Solution code:
l,r=[int(i) for i in input().split()]
ss=2019
ans=200000000
c=0
if r-l<2019:
    for j in range(l,r+1):
        for k in range(l,r+1):
            if j==k:
                cnt=0
            else:
                ans=min(ans,j*k%2019)
                if c==0 and ans==0:
                    print(ans,j,k)
                    c=1
    print(ans)
else:
    for i in range(1,10**9):
        ss=2019*i
        if l<=ss<=r:
            for j in range(ss,r):
                for k in range(ss,r):
                    if j==k:
                        cnt=0
                    else:
                        ans=min(ans,j*k%2019)
            print(ans)
            break

Submission status: Wrong Answer

Solution code:
from sys import stdin
L,R = [int(x) for x in stdin.readline().rstrip().split()]
ans = 2019
#if L + 2019 >= R:
#    ans = 0
#else:
for i in range(L,R+1):
  ans = min((L*(L+1)) % 2019,ans)
  if ans == 0:
    break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 20:47:47 2019

@author: Owner
"""

import numpy as np
import sys
import collections
import scipy.misc
import math
from operator import itemgetter
import itertools
import copy
import bisect
import heapq

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]
    

"""
N, X = map(int, input().split())

x = list(map(int, input().split()))

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())

# 多次元配列の宣言（あとでintにすること。）（タプルにすること。）
dp = np.zeros((N+1, 4,4,4))
    
all(nstr.count(c) for c in '753')

# 複数配列を並び替え
ABT = zip(A, B, totAB)
result = 0
# itemgetterには何番目の配列をキーにしたいか渡します
sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)

# 2進数のbit判定
(x >> i) & 1

# dp最小化問題
dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break
# 累積和
add = 1 # 問題によって決まる
res = 0
sums = [0]*(len(nums)+1)
for i in range(len(nums)):
    sums[i+1] = sums[i] + nums[i]
for i in range(0, len(nums), 2):
    left = i
    right = min(i+add, len(nums))
    tmp = sums[right] - sums[left]
    res = max(tmp, res)

#２分探索
li, ri = bisect.bisect_left(p_ac, l[i]-1), bisect.bisect_right(p_ac, r[i]-1)    

#ソート関数
org_list = [3, 1, 4, 5, 2]
new_list = sorted(org_list)
print(org_list)
print(new_list)
# [3, 1, 4, 5, 2]
# [1, 2, 3, 4, 5]

#Distance Transformation
    for h in range(0,H):
        for w in range(0,W):
            if h == 0 and w == 0:
                pass
            elif h == 0:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h-1][W-w]+1)
            elif w == 0:   
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1)
            else:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1, D[H-h-1][W-w]+1, D[H-h][W-w]+2)
            d_max = max(D[H-h-1][W-w-1], d_max)

"""


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

    
def main(): 
    nL = L//2019
    nR = nL+1
    A, B = 0, 0
    if 2019*nR <= R:
        return print(0)
    else:
        if L%2019 < R%2019:
            A = L
            if (L+1)%2019 < R%2019:
                B = L+1
            else:
                B = R 
        else:
            A = R
            if L%2019 < (R-1)%2019:
                B = L
            else:
                B = R-1
    return print((A*B)%2019)
                
            
            
                

    
if __name__ == '__main__':
    main()

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()
mod_2019 = lambda x:x%2019
ret = 2020
ij_list = list(map(mod_2019,[i for i in range(L,R+1)]))
for i in range(len(ij_list)):
    for j in range(i):
        k = mod_2019(ij_list[i]*ij_list[j])
        print(k)
        if k < ret:
            ret = k
print(ret)

Submission status: Wrong Answer

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

if r-l == 1:
    print(r*l%mod)
else:
    mod1 = l%mod
    mod2 = (l+1)%mod
    for i in range(l+2, r+1):
        t_mod = i%mod
        if mod1<mod2:
            if t_mod < mod2:
                mod2 = t_mod
        else:
            if t_mod < mod1:
                mod1 = t_mod
    print(mod1*mod2)

Submission status: Wrong Answer

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

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


print(ans)

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
            ans = i
    # print(ans)
    calc = (ans * (ans+1)) % 2019
    print(calc)

Submission status: Wrong Answer

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

mod = 673

if r-l >= mod-1:
    print(0)
    exit()
    
l_s = l % mod
r_s = r % mod


ans = 673

if r_s > l_s:
    for i in range(abs(l_s - r_s)):
        for j in range(1,abs(l_s - r_s)+2):
            if l_s+i+j > r_s:
                break
            tmp = (l_s+i)*(l_s+i+j) % mod
            if ans > tmp:
                ans = tmp
    print(ans)
    exit()
else:
    print(0)
    exit()

Submission status: Wrong Answer

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

"""Template"""


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

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

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

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

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

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

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

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

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


class Idea:
    def __init__(self):
        pass

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

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

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

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

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

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

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

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

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

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

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


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


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

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


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = r // mod
line = x * mod

if l < line < r:
    print(0)

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
L=l%2019
R=r%2019
tmp=min(L,R)
k=min(l,r)+min(L,R)
j=k-1

if(2019<=r):
    print(k*j%2019)
else:
    print(l*r%2019)

Submission status: Wrong Answer

Solution code:
# C - Remainder Minimization 2019



def remind2019(L, R):
    # 0 2019の倍数がある
    if (R-L)>= 2018:
        return 0

    if (R%2019 == 0) or (L%2019==0):
        return 0
    else:
        qL, mL = divmod(L,2019)
        qR, mR = divmod(R, 2019)

        if mR <= mL: #１周している
            return 0
        else:
            return (mL*(mL+1))



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

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
li = []
ans = 2019
for i in range(l,r+1):
    li.append(i%2019)
i = 0
while i < len(li):
    for j in range(len(li)):
        if i != j:
            ans = min(ans,li[i]*li[j])
    i += 1
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
min = 2018
if l == 0 or r == 0:
  min = 0
else:
  for i in range(l, r):
    for j in range(i+1,r+1):
      mod = (i*j) % 2019
      if mod < min:
        min = mod
print(min)

Submission status: Wrong Answer

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

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

ans = 2 * (10**9)

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

print(ans)

Submission status: Wrong Answer

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

min = 2019

ans = (L * (L + 1)) % 2019
min = ans

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

print(min)

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
    if R%2019==0:
        print(0)
    elif R-L>2020:
        print(0)
    else:
        for i in range(L,R):
            t=(i*(i+1))%2019
            # print(t)
            if t<m:
                m=t
        print(m)

    # print(A,B)
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
x = L % 2019
dist = R - L
min = 2018
for i in range(dist):
    x += 1
    if x>=2019:
        x = x % 2019
    if x < min:
        min = x
print(min)

Submission status: Wrong Answer

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

if r-l >= 2019:
    print(0)
else:
    print(l*(l+1))

Submission status: Wrong Answer

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

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

print(min_i * (min_i + 1))

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import bisect
from operator import itemgetter
import math
import copy
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

L,R = IL()

if R-L >= 2019:
  print(0)
else:
  ans = MAX_INT
  for i in range(L,R,3):
    ans = min(ans,(i*(i+1))%2019)
  print(ans)

Submission status: Wrong Answer

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

i=s[0]+1
j=s[0]
a = i*j
b0 = a%2019

for i in range(s[0]+2,s[1]+1):
    for j in range(s[0],i-1):
        a = i*j
        b1 = a%2019
        if b1<b0:
            b0=b1
        else:
            pass

Submission status: Wrong Answer

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

res = 2019
doit = True

if L == 0:
    res = 0
    doit = False

if (R - L) >=2019:
    res = 0
    doit = False

for k in range(L,R+1,1):
    if (k % 2019) == 0:
        res = 0
        doit = False

if (R-L) ==1:
    res = (R*L) % 2019
    doit = False
    
if doit:
    for i in range(L,R-1,1):
        for j in range(i+1,R,1):
            tmp = (i * j) % 2019
            if tmp < res:
                res = tmp

            
print(res)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().strip().split(' '))
if (R-L+1) >= 2019 or L%2019 >= R%2019:
  print(0)
else:
  print(min((L*(L+1))%2019, (R*(R-1))%2019, (R*L)%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(L == R):
        print(0)
        exit()
    if(R < L):
        R += MOD

    ans = MOD-1
    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:
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、l~r-1を全探索
    i_l=[]
    for i in range(l,r):
        i_l.append(i%2019)
    ans_l=min(i_l)
    ans=(ans_l%2019 * (ans_l+1)%2019)%2019
    print(ans)

Submission status: Wrong Answer

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

if (r-l)>=2019:
    print("0")
else:
    if (l % 2019) < (r % 2019):
        ans= l * r % 2019
        print(int(ans))
    else:
        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 = R * R - 1
  for x, y in itertools.combinations(range(L, R + 1), 2):
      ans = min((x % 2019) * (y % 2019), ans)
  print(ans)

Submission status: Wrong Answer

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

x = range(L, R + 1)

n = 0
for i in range(len(x)):
  if x[i] % 2019 == 0:
    n = i
    break

print(x[n] * x[n + 1] % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
min = 2018
if l == 0 or r == 0:
  min = 0
else:
  for i in range(l, r):
    for j in range(i+1,r+1):
      print(i,j)
      mod = (i*j) % 2019
      if mod < min:
        min = mod
print(min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

if r//673-l//673>0 and r//3-l//3>0:
    print(0)
else:
    print((l*(l+1))%2019)

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)%2019)
    else:
        if delim_L > delim_R: print((delim_R*(delim_R - 1))%2019)
        else: print((delim_L*(delim_L + 1))%2019)

Submission status: Wrong Answer

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

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

for i in range(l, l+gen+1):
    if i%gen == 0:
        check = i - l

if r-l>check:
    print(0)
    exit()

ll = min(l%gen, r%gen)
rr = max(l%gen, r%gen)

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

ans = 10**9

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
l,r=map(int,input().split())
a=l%2019
b=r%2019
if l-r>=2019:
    print(0)
elif b-a<=0:
    print(0)
elif (a%3==0)&(b%673==0):
    print(0)
elif (a%3==0)&(b%3==0):
    print(0)
elif a<=20&b>=101:
    print(1)
else:
    ans=2018
    for i in range(a,b+1):
        for j in range(i+1,b+1):
            ans=min(ans,i*j%2019)
    print(ans)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    l, r = map(int, input().split())
    modr = r % 2019
    if modr < l:
        modr = 2019 + modr
    m = 2020
    for i in range(l, modr):
        res_i = i % 2019
        for j in range(l + 1, modr + 1):
            res_j = j % 2019
            res = (res_i * res_j) % 2019
            if m > res:
                m = res
    print(m)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
l,r = map(int,input().split(" "))

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

Submission status: Wrong Answer

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

# スペース区切りの整数の入力
l,r = map(int, input().split())

tmp_ans = 0
ans = -1

for i in range(r-l):
    tmp_ans = l * (l+1) % 2019
    if tmp_ans < ans:
        ans = tmp_ans
    elif ans ++ -1:
        ans = tmp_ans

# 出力
print(ans)

Submission status: Wrong Answer

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

counter1 = 0
counter2 = 0

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

Submission status: Wrong Answer

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

min_value = arg[0]*arg[1]
for i in range(arg[0], arg[1]):
  for j in range(i+1, arg[1]):
    value = (i*j) % 2019
    if value < min_value:
      min_value = value
      
print(min_value)

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().strip().split(' ')))
L = s[0]
R = s[1]
ans = 2020

for i in range(1, 100):
    a = 2019 * i
    if L < a:
        i = i - 1
        L = L - a
        break
for i in range(1, 100):
    a = 2019 * i
    if R < a:
        i = i - 1
        R = R - a
        break
if R == 0 or L == 0:
    print(0)

if L > R:
    temp = R
    R = L
    L = temp

for i in range(0, R - L):
    j = L + i
    k = L + 1 + i
    p = (j * k) % 2019
    if p < ans:
        ans = p

if R == 0 or L == 0:
    print(0)
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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


print(ans)

Submission status: Wrong Answer

Solution code:
hoge = input().split()
L = int(hoge[0])
R = int(hoge[1])
ans = None
if (R - L) > 2019:
  for i in range(L,R+1):
    print(i)
    if i % 2019 == 0:
      ans = i
      break
min_ = 2019
if ans is None:
  for i in range(L,R):
    hoge = (i * (i+1)) % 2019
    if hoge < min_:
      min_ = hoge
  
if ans is not None:
  print(1)
else:
  print(min_)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = []
imax = R - L + 1

for i in range(L , R):
    a = (i * (i + 1)) % 2019
    if a == 0:
        print(0)
        exit()
    ans.append(a)

print(min(ans))

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

inp = list(map(int, input().split()))

L = inp[0]
R = inp[1]


for i in range(R-L+1):
	for j in range(R-L+1-i):
		if(i==0 and j==0):
			mini = ((L+i)*(L+i+j+1))%2019
		else:
			mod = ((L+i)*(L+i+j+1))%2019
			if(mini>mod):
				mini = mod

print(mini)