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:
if __name__ == '__main__':
    l,r  = list(map(int, input().split(" ")))

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

Submission status: Wrong Answer

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

if (R - L) >=  673:
  print(0)

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

Submission status: Wrong Answer

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

if R-L > 2018:
    print(0)
else:
    if (L//2019) != (R//2019):
        print(0)
    else:
        c = 2019
        for i in range(L, R+1):
            c = min((L*(L+1))%2019, c)
        print(c)

Submission status: Wrong Answer

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

tmp = L % 2019
param_res1 = 0
param_res2 = 0

if tmp == 0:
    param_res1 = L
    param_res2 = L + 1
else:
    if L + tmp <= R:
        param_res1 = L
        param_res2 = L + tmp
    elif tmp < 1010:
        param_res1 = L
        param_res2 = L + 1
    else:
        param_res1 = R
        param_res2 = R - 1

res = (param_res1 * param_res2) % 2019
print(res)

Submission status: Wrong Answer

Solution code:
L,R=(int(x) for x in input().split())
L_mod=L%2019
R_mod=R%2019
c=0
c3=0
c673=0
for n in range(2019):
    if L+n>=R:
        break
    if (L+n)%2019==0:
        c=1
    if (L+n)%673==0:
        c673=1
    if (L+n)%3==0:
        c3=1
if c==1:
    print(0)
else:
    if c673==1:
        if c3==1:
            print(0)
    else:
        print(L_mod*(L_mod+1))

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math
input = [int(x) for x in stdin.readline().rstrip().split()]

L=input[0]
R=input[1]


output=0

if R//673 != L//673 and R//3 != L//3:
    output=0
#elif  R//673 != L//673:
    #output=0
else:
    output=(L*(L+1)%2019)


print(output)

Submission status: Wrong Answer

Solution code:
a1=list(input().split( ))
a=list(map(int, a1))
b= a[1] - a[0]
d=2018

for j in range(b):
 for k in range(b-j):
  c=((a[0] + j )%2019) * ( (a[0] + j  + k + 1) % 2019)
  if c<=d:
   d=c
  if d==0:
   break

print(d)

Submission status: Wrong Answer

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

#i*jmodk=(imodk*jmodk)modk

#l以上r以下の整数で2019の倍数を含むものがあれば、imod2019=0となるiを選ぶことでijmod2019=0になり、最小

#r-lが2018以上ならかならず、imod2019=0となるiか、jmod2019=0となるjが存在する

if r-l>2020:
    print(0)
elif l%2019==0:
    print(0)
elif r%2019==0:
    print(0)
else:
    i_l=[]
    for i in range(l,r):
        i_l.append(i%2019)
    if min(i_l)==0:
        print(0)
    else:
        ans=((min(i_l)%2019) * ((min(i_l)+1)%2019))%2019
        print(ans)

Submission status: Wrong Answer

Solution code:
l, r = [int(x) for x in input().split()]
m = 2019

ml = (l % 2019)
mr = (r % 2019)
t = l + 2019
if r > t:
    m = 0
else:
    if ml < mr:
        for x in range(ml,mr):
            m = min(m, (ml * mr) % 2019)
    else:
        m = 0
print(m)

Submission status: Wrong Answer

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


if (r<2019): print(l*(l+1))

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

Submission status: Wrong Answer

Solution code:
#C問題
L,R = map(int,input().split())
r = R%2019
l = L%2019
if R-L>=2019:
    print(0)
else:
    if r <= l:
        print(0)
    else:
        MIN = 2018
        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:
L, R = map(int, input().split())

NUM = 2019

if L < 3 and 673 <= R:
    print(0)
else:
    a = R // NUM

    i = max(NUM * a, L)
    j = i + 1

    print((i * j) % NUM)

Submission status: Wrong Answer

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

a = R % 2019
b = L % 2019

if a > 2019 // 2:
    a = 2019 - a
if b > 2019 // 2:
    b = 2019 - b

print(min(a * (a+1) % 2019, b * (b+1) % 2019))

Submission status: Wrong Answer

Solution code:
def main():
    l, r = map(int, input().split(' '))
    if (r - l) >= 2019:
        ans = 0
    else:
        ml = l % 2019
        mr = r % 2019
        if ml >= mr:
            ans = 0
        elif ml <= 673 <= mr and mr - ml >= 2:
            ans = 0
        else:
            ans = (l * (l + 1)) % 2019
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
m = 2020
i = 0
for a in range(l, min(l+2019, r)):
    if a % 2019 < m:
        i = a
        m = a % 2019
        
print((i * (i+1)) % 2019)

Submission status: Wrong Answer

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

ans = 10 ** 7

L=L%2019
R=R%2019

di = R//2019 - L//2019

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

else:
    ans = 0


print(ans)

Submission status: Wrong Answer

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

    ans = L * R % 2019
    if L // 2019 < R // 2019:
        ans = 0
    else:
        l = L % 2019
        r = R % 2019
        ans = l * r
        for i in range(l+1, r+1):
            ans = min(ans, l*i)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np
l,r = map(int, input().split())
if (((l-1)//2019)<(r/2019))|((((l-1)/673)<(r//673))&(((l-1)//3)<(r//3))):
  print(0)
else:
  arr1 = np.array(range(l,r+1))
  arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
  arr = arr1*arr2%2019 + (np.identity(r-l+1)*2019)
  print(int(np.min(arr)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A = [int(x)  for x in input().split()]
if A[1] - A[0] < (2019 - A[0]%2019):
  print((A[0]*(A[0] +1)) %2019)
else:
  print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
MOD=2019

l,r=map(int,input().split()) #l<=i<i+1<=j<=r
res=2020
l=l%MOD
r=r%MOD
l,r=min(l,r),max(l,r)

for i in range(l,r+1):
  for j in range(i+1,r+1):
    res =min((i*j)%MOD,res)
print(res)

Submission status: Wrong Answer

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

ans = (L * R) % 2019
print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int, input().split())
if r < 2019:
	print((l*(l+1)) % 2019)
	exit()
elif r-l >=  2019:
	print(0)
	exit()
elif r-l < 2019:
	if r % 2019 == 0 or l % 2019 == 0:
		print(0)
		exit()
	else:
		mini = 2018
		for i in range(r-l+1):
			mod = (l*(l+1)) % 2019
			if mod < mini:
				mini = mod
			l += 1
			if l > r-2:
				break
print(mini)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
syol = l//2019
syor = r//2019
if syol != syor:
    print(0)
else:
    flag673 = 0
    flag3 = 0
    for i in range(l,r+1):
        if i%673 == 0:
            flag673 = 1
            if flag3 == 1:
                break
        if i%3 == 0:
            flag3 = 1
            if flag673 == 1:
                break
    if (flag673==1)and(flag3==1):
        print(0)
    else:
        print(l*(l+1)%2019)

Submission status: Wrong Answer

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

ans = 0
if L > inf and R > inf:
    ans = (L * (L + 1)) % inf
else:
    ans = (L * (L + 1)) % inf
    for i in range(L, R - 1):
        for j in range(i + 1, R):
            ans = min(ans, int(i * j))
print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

mod = 2019

l = L % 2019
r = R % 2019


if l > r:
    print(0)
    exit()
else:
    _min = 1000000000+5
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            _min = min(_min, i*j%mod)

print(_min)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
ans = 0
dis_modL = L%2019
dis_modR = abs(2019 - R%2019)
if(dis_modL < dis_modR):
    ans = (L*(L+1))%2019
elif(dis_modL == dis_modR):
    ans = (L*R)%2019
elif(dis_modL > dis_modR):
    ans = (R*(R-1))%2019

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

Submission status: Wrong Answer

Solution code:
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
inf = 10**9


def main():
    l, r = list(map(int, input().split()))
    a = l % 2019
    b = r % 2019

    if a >= b:
        print(0)
        return

    ans = 2018

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
S = set()
T = set()
if (R-L)>=673:
    print(0)
else:
    l = L%2019
    for i in range(R-L+1):
        S = S | {l+i}
    for i in S:
        for j in S:
                T = T | {(i*j)%2019}
    print(min(T))

Submission status: Wrong Answer

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

while i <= R:
  if i % 2019 == 0:
    print(0)
    m=1
    break
  else:
    i += 1
if m==1:
  m=2
else:
  print(L*(L+1))

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
y = 2018
for i in range(l,r+1):
  for j in range(i+1,r+1):
    x = (i*j) % 2019 
    if x <= y:
      y = x
      break
print(y)

Submission status: Wrong Answer

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

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

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

    elif 2019 < n:
        print((n % 2019) * ((n+1) % 2019) if (n % 2019) * ((n+1) % 2019) < (a % 2019) * ((a-1) % 2019) else print((a % 2019) * ((a-1) % 2019)))

Submission status: Wrong Answer

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


gap = y-x
F = 0
t = x%2019
e = y%2019

tq = x%673
eq = y%673

m = min(t,e)
M = max(t,e)

mq = min(tq,eq)
Mq = max(tq,eq)

t2 = 2200
t1 = (m*(m+1))%2019
if gap > 672:
    t2 = 0
if gap > 2 and (eq < tq):
    t2 = 0

k = 2200 
if gap <= 2:
    k = 1
    for i in range(x,y+1):
        k*=i
    k = k%2019

print(min(t1,t2,k))
# print((t1,t2,k))

Submission status: Wrong Answer

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

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, R+1):
        m.append(i%M)
        if i % M == 0:
            return 0
    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())

#i*jmodk=(imodk*jmodk)modk

#l以上r以下の整数で2019の倍数を含むものがあれば、imod2019=0となるiを選ぶことでijmod2019=0になり、最小

#r-lが2018以上ならかならず、imod2019=0となるiか、jmod2019=0となるjが存在する

if r-l>=2018:
    print(0)
elif l%2019==0:
    print(0)
elif r%2019==0:
    print(0)
else:
    i_l=[]
    for i in range(l,r):
        i_l.append(i%2019)
    if min(i_l)==0:
        print(0)
    else:
        ans=((min(i_l)%2019) * ((min(i_l)+1)%2019))%2019
        print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0

if R < 2019:
    ans = (L % 2019) * ((L + 1) % 2019)
    if ans >= 2019:
        ans = ans % 2019
elif R - L >= 2018:
    ans = 0
elif L <= 2019 <= R:
    ans = 0
else:
    ans = (L % 2019) * ((L + 1) % 2019)
    if ans >= 2019:
        ans = ans % 2019


print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
diff = r - l
l = l % 2019
r = l + diff
if r >= 2019 or ((l % 673 + diff) >= 673 and (l % 3 + diff) >= 3) :
  print(0)
else:
  print(l * (l + 1))

Submission status: Wrong Answer

Solution code:
import numpy as np

l, r = (int(i) for i in input().split())

if r - l > 4040:
    print(1)
else:
    LR = np.arange(l, r + 1)
    LR = LR % 2019
    idx_1 = LR.argmin()
    min_1 = LR[idx_1]
    LR[idx_1] = 2018
    min_2 = LR.min()

    print(min_1 * min_2)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
l, r = map(int, input().split())
mod = 2019
modl = l // mod
modr = r // mod
l_mod = l % mod
r_mod = r % mod
# print(modl, modr)
# if l <= mod*modl <= r or l <= mod * modr <= r:
# if modl != modr or l_mod == 0 or r_mod == 0:
# # if modl != modr:
#     print(0)
# else:
#     print((l*(l+1))%mod)
    
if modl == modr:
    print((l*(l+1)) % mod)
else:
    print(0)

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

if R == 2019:
    print(0)
    exit()

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

if (R - L) < 2019:
    temp1 = float("inf")
    for i in range(R - L):
        temp2 = ((R - i) * (R - i - 1)) % 2019
        if temp2 < temp1:
            temp1 = temp2
    print(temp1)
else:
    temp1 = float("inf")
    for i in range(2019):
        temp2 = ((R - i) * (R - i - 1)) % 2019
        if temp2 < temp1:
            temp1 = temp2
    print(temp1)

Submission status: Wrong Answer

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

minimum = l%2019
maximum = r%2019

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

Submission status: Wrong Answer

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

x = 2020

for i in range(R+1)[L:]:
    if x == 2:
        break
    for j in range(R+1)[i+1:]:
        mod = i * j % 2019

        if mod != 0:
            x = min(mod, x)

print(x)

Submission status: Wrong Answer

Solution code:
MOD=2019

l,r=map(int,input().split()) #l<=i<i+1<=j<=r
res=[]

l=l%MOD
r=r%MOD
l,r=min(l,r),max(l,r)

for i in range(l,r+1):
  for j in range(i+1,r+1):
    res += [(i*j)%MOD]
print(min(res))

Submission status: Wrong Answer

Solution code:
l,r = (int(i) for i in input().split())
mod = 2019
t,i = 0,1
lim = 10**9
while t<=lim:
    t = mod*i
    if l<=mod<=r:
        print(0)
        exit()
    i+=1
print(l*(l+1)%mod)

Submission status: Wrong Answer

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

a, b = readmi()
t = 0xFFFFFFFF
for i in range(a, b):
    t = min(t, i * (i + 1) % 2019)
    if i % 2019 == 0:
        break
print(t)

Submission status: Wrong Answer

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


gap = y-x
F = 0
t = x%2019
e = y%2019

tq = x%673
eq = y%673

m = min(t,e)
M = max(t,e)

mq = min(tq,eq)
Mq = max(tq,eq)

t2 = 2200
t1 = (m*(m+1))%2019
if gap > 672:
    t2 = 0
if gap > 2 and (eq < tq):
    t2 = 0

k = 2200 
if gap <= 2:
    k = 1
    for i in range(x,y+1):
        k*=i
k = k%2019

print(min(t1,t2,k))

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

    if R - L > 2018:
        print(0)
        return

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

input = lambda: stdin.readline()
main()

Submission status: Wrong Answer

Solution code:
import sys

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

if r-l+1 <3:
    imin = 10**9+7
    for i in range(r-l):
        for j in range(i+1,r-l+1):
            if imin > ((l+i)*(l+j))%2019:
                imin = ((l+i)*(l+j))%2019
    print(imin)
elif r-l+1 <673:
    if (l % 673)+r-l > 672:
        print(0)
    else:
        print((l % 673)*((l+1)% 673))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
#l<i
#j<r
s=list()
if l+1==r:
    print(l*r)
else:
    for i in range(l,r):
        s.append([i*(i+1)%2019])
    s=sorted(s)
    print(s[0][0])

Submission status: Wrong Answer

Solution code:
import sys

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

if R-L>673:
    print(0)
else:
    A =[]
    for i in range(R-L+1):
        n = (L+i)
        if n % 673 == 0 and (R-L+1) >= 3:
            print(0)
            sys.exit()
        else:
            A.append(n%2019)
    A.sort()
    print((A[0]*A[1])%2019)

Submission status: Wrong Answer

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

NUM = 2019

if L < 3 and 673 < R:
    print(0)
else:
    a = R // NUM

    i = max(NUM * a, L)
    j = i + 1

    print((i * j) % NUM)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
mod = []
count = 0
diff = R-L
if diff > 2019:
    ret = 0
else:
    mod = [x % 2019 for x in range(L,R+1)] 
    mod = sorted(mod)
    ret = mod[0]*mod[1]
print(ret)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

m = 2018
cont = 0

if L//2019 == R//2019:
    for i in range(L, R+1):
        for j in range(L+1, R+1):
            cont = min((j * i)%2019, m)
            m = cont
    print(m)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
if r-l >= 2019:
    temp = 0

temp = 2019
for i in range((r-l+1)%2019):
    temp = min(temp,(l+i)%2019)
    
temp = temp%2019
print(temp*(temp+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(1,10**6):
    if i * 2019 >= L and i*2019 <= R:
        print(0)
        exit()

ans = 10**20

for i in range(L,L+100):
    if i < L or i > R:
        break
    ans = min(ans,(i*(i+1))%2019)
for i in range(R-100,R-1):
    if i < L or i > R:
        break
    ans = min(ans,(i*(i+1))%2019)
print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
ls = []
if L == 0:
    print(2019)
elif L*R < 2019:
    print(L*R)
elif R - L > 4037:
    print(0)
elif R - L > 2018:
    print(1)
elif (R%2019) > (L%2019):
    print(L%2019 + 1)
else:
    print(R%2019 + 1)

Submission status: Wrong Answer

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

minNum = 0
maxNum = 0
ans = 9999

tempL = int(L / 2019)
tempR = int(R / 2019)
if(tempL != tempR):
    ans = 0
else:
    for i in range( max((tempL) * 2019 + 1, L), R):
        ans = min(ans, (((i % 2019) * ((i + 1) % 2019)) % 2019))

print(ans)

Submission status: Wrong Answer

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

if R * (R - 1) < 2019:
    print(L * (L + 1))
elif L <= 2019 and R >= 2019:
    print(0)
else:
    d1 = 3 - L % 3
    d2 = 673 - L % 673
    if L + d1 <= R and L + d2 <= R:
        print(0)
    else:
        print(L * (L + 1) % 2019)

Submission status: Wrong Answer

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

flag = False
if l % 2019 == 0 or r // 2019 - l // 2019 != 0:
    flag = True

if flag:
    print(0)
else:
#     lmod = l % 2019
#     rmod = r % 2019
#     root = sqrt(2019)

#     n1, n2 = inf, inf
#     p = lmod // root
#     q = rmod // root + 1
#     for m in range(p, q+1):
#         for i in range(lmod, rmod+1):
#             if i - m * root > 0 and i - m * root < n1:
#                 tmp = n1
#                 n1 = i
#                 n2 = tmp
#             elif i - m * root > 0 and i - m * root < n2:
#                 n2 = i

#     print((n1 * n2) % 2019)

    lmod = l % 2019
    print((lmod * (lmod + 1)) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
I = range(L, R)
J = range(L + 1, R + 1)

ans = []
count = 0
if L == 0:
    print(0)
else:
    for i in I:
        for j in J:
            ans.append(i * j % 2019)
            count += 1
            if count > 2019:
                break
            
    print(min(ans))

Submission status: Wrong Answer

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

for i in range(L,R+1):
    c = i%2019
    if c < a:
        b = a
        a = c
    else:
        if c < b:
            b = c
ans = a*b
if a%2019 == 0:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
L, R = (int(j) for j in input().split())
C = 0
Z = 2019
for l in range(L,R):
	for m in range(L,R):
		if l!=m:
			S = l*m%2019
			if Z>S:
				Z = S

print(Z)

Submission status: Wrong Answer

Solution code:
import numpy as np
L,R=map(int,input().split())
listX=[]
for i in range(0,R-L):
  X=min(np.outer(L,L+i+1)%2019)
  listX.append(X)
print(int(min(listX)))

Submission status: Wrong Answer

Solution code:
import sys

MOD = 2019

def solve(L, R):
    if L%MOD > R%MOD:
        L, R = R%MOD, L%MOD
    else:
        L, R = L%MOD, R%MOD
    a, b = list(range(L, R+1))[0:2]
    ans = a*b
    print(ans)


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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
MOD = 2019

L, R = map(int, input().split())
minx = float("inf")
iset = set()
for i in range(L, R):
    im = i % MOD
    if im in iset:
        break
    iset.add(im)
    jset = set()
    for j in range(i + 1, R + 1):
        jm = j % MOD
        if jm in jset:
            break
        jset.add(jm)
        minx = min(minx, im * jm)
print(minx)

Submission status: Wrong Answer

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



def divisors(num):
    """
    約数全列挙
    """
    divisors = []
    for i in range(1, int(num ** 0.5) + 1):
        if num % i == 0:
            divisors.append(i)
            if i != num // i:
                divisors.append(num // i)

    return divisors


mod = 2019
tar = []
for i in range(1, 10 ** 6):
    tar.append(673 * i)

ans = float("inf")
f = -1
for t in tar:
    if L <= t <= R:
        f = t
        break

s = -1
for i in range(L, R + 1):
    if i != f and i % 3 == 0:
        s = i
        break

if f == -1 and f == -1:
    print((L * (L + 1)) % mod)
elif f == -1:
    t = -1
    for i in range(L, R + 1):
        if i != s:
            t = i
            break
    print((s * t) % mod)

elif s == -1:
    t = -1
    for i in range(L, R + 1):
        if i != f:
            t = i
            break
    print((f * t) % mod)
else:
    print((f * s) % mod)

Submission status: Wrong Answer

Solution code:
L,R =(int(x) for x in input().split())
if(L<2019<R):
    print(1)
elif(L<=3 and R>=673):
    print(0)
else:
    if((L%2019)^2 < (R%2019)^2):
        if(((L+1)%2019)^2 < (R%2019)^2):
            print((L*(L+1))%2019)
        else:
            print((L*R)%2019)
    else:
        if((L%2019)^2 < ((R-1)%2019)^2):
            print((R*L%2019))
        else:
            print(((R+1)*R)%2019)

Submission status: Wrong Answer

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

ans = []

l %= 2019
r %= 2019

if l > r:
	a = r
	b = l
else:
	a = l
	b = r
	
if l == r:
	c = l**2%2019
	print(c)
	
else:	
	for i in range(a,b):
		for j in range(i+1,b+1):
			rem = i*j%2019
			ans.append(rem)

	print(min(ans))

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
ans = 0
dis_modL = min(abs(2019 - L%2019),L%2019)
dis_modR = min(abs(2019 - R%2019),R%2019)
if(dis_modL < dis_modR):
    ans = (L*(L+1))%2019
elif(dis_modL == dis_modR):
    ans = (L*R)%2019
elif(dis_modL > dis_modR):
    ans = (R*(R-1))%2019

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

Submission status: Wrong Answer

Solution code:
L,R= map(int,input().split())
#境界条件
bool = True
l = L % 2019
r = R % 2019

for i in range(l,r):
    for j in range(i+1,r+1):
        temp = (i * j) % 2019
        if bool:
            min = temp
            bool = False
        elif min > temp:
            min = temp
ans = min
print(ans)

Submission status: Wrong Answer

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

list673 = []
for i in range(3000000):
    list673.append(673 * i)

answer = (L * (L + 1)) % 2019
for l673 in list673:
    if L <= l673 and l673 <= R:
        answer = 0
'''        for i in [1, 2, 3]:
            if (l673 * (l673 - i) % 2019 == 0) and L <= l673 - i:
                answer = 0
            elif (l673 * (l673 + i) % 2019 == 0) and l673 + i <= R:
                answer = 0
'''
if L == 0:
    answer = 0

print(answer)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

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

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

Submission status: Wrong Answer

Solution code:
def main():
  min_max=0
  f_1=2+10**9
  f_2=2+10**9
  min_d=2019
  min_d2=2019
  L,R=map(int,input().split())
  for i in range(L,R+1):
    a=i%2019
    if a<=min_d and a<=min_d2:
      min_d2=min_d
      min_d=a
      f_2=f_1
      f_1=i
    elif a<=min_d2:
      f_2=i
      min_d2=a
    if a==0:
      break
  print((f_1*f_2)%2019)
  
main()

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
ans = 10 ** 12
if l > r:
    ans = 0
else:
    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:
from sys import stdin
 
 
L,R = [int(x) for x in stdin.readline().rstrip().split()]
 
L = L % 2019
R = R % 2019
if R < L:
    R += 2019

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

Submission status: Wrong Answer

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

minimum = 2019

start = L % 2019
end   = (R+1) % 2019

for i in range(start, end):
    for j in range(i+1, end):
        v = (i * j) % 2019
        minimum = min([v, minimum])

print(minimum)

Submission status: Wrong Answer

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

mod = 2019
for i in range(100):
  if L <= 3**i%(1e9+7) <= R or L <= 673**i%(1e9+7) <= R or L <= 3*673*i%(1e9+7) <= R or L <= 3*i%(1e9+7) <= R or L <= 673*i%(1e9+7) <= R or L <= 3*673**i%(1e9+7) <= R:
    print(0)
    exit()
else:
  print((L*(L+1))%mod)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
# m = 2 * (10 ** 9) + 1
# n = 2 * (10 ** 9) + 2
flag = 0
for i in range(l, r+1):
    if i % 2019 == 0:
        flag = 1
        break
#     a = m
#     m = min(m, i % 2019)
#     if a == m:
#         n = min(n, i % 2019)
#     else:
#         n = min(n, a)
#
# print('m', m)
# print('n', n)

if l == 0:
    flag = 2

if flag == 0:
    print((l % 2019) * (l+1 % 2019) % 2019)
elif flag == 1:
    print(0)
else:
    print(2019)

Submission status: Wrong Answer

Solution code:
L,R = map(int, input().split())
MOD = 2019
MOD2 = 2027
mL = L%MOD2
mR = R%MOD2
if mL>=mR:
    mR +=MOD2

min_mod = MOD
for i in range(mL, mR):
    for j in range(i+1, mR+1):
        min_mod=min((i*j)%MOD, min_mod)
        #print(i, j, (i*j)%MOD)
print(min_mod)

Submission status: Wrong Answer

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

i=s[0]+1
j=s[0]
i0= i%2019
j0= j%2019

for i in range(s[0]+2,s[1]+1):
        i1 = i%2019
        if i1<i0:
            i0=i1
        else:
            pass
        
        for j in range(s[0],i):
            j1 = j%2019
            if j1<j0:
                j0=j1
            else:
                pass
        
b0 = (j0*i0)

print(b0)