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:
l, r = map(int, input().split())
p = l // 2019
if 2019 * (p + 1) <= r:
    print(0)
else:
    print(l*(l+1)%2019)

Submission status: Wrong Answer

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

list2019 = []
for i in range(1000000):
    list2019.append(2019*i)

answer = (L * (L + 1)) % 2019
for l2019 in list2019:
    if L <= l2019 and l2019 <= R:
        answer = 0
if L <= 3 and 673 <= R:
    answer = 0
print(answer)

Submission status: Wrong Answer

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

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(l,r+1):
    if i >= j:
      continue
    res += [(i*j)%MOD]
print(min(res))

Submission status: Wrong Answer

Solution code:
def RemainderMinimization2019():
	L, R = map(int, input().split())
	minMod = 2020 * 2020
	tmpL = L % 2019
	tmpR = R % 2019
	if tmpL == 0 or tmpR == 0:
		minMod = 0
		print(0)
		return
		
	for i in range(tmpL, tmpR):
		for j in range(i + 1, tmpR + 1):
			if minMod == 0:
				break
			tmpA = (i % 2019)
			tmpB = (j % 2019)
			tmp = (tmpA * tmpB) % 2019
			# print(i, j, tmp)
			if minMod > tmp:
				minMod = tmp
	print(minMod)
RemainderMinimization2019()

Submission status: Wrong Answer

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

answer = 2019
if L%2019 + width >= 2019:
  answer = 0
else:
  for i in (L%2019,R%2019):
      for j in range(i+1,R%2019+1):
          answer = i*j%2019 if i*j%2019 < answer else answer
print(answer)

Submission status: Wrong Answer

Solution code:
L,R= map(int,input().split())
#境界条件
bool = True
l = L % 2019
r = R % 2019
if l == 0:
    ans = 0
#一個違い
elif R == L+1:
    ans = L*R % 2019
else:
    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:
l, r = map(int, input().split())
m = 1000000
n = 1000000
for i in range(l, r+1):
    a = m
    m = min(m, i % 2019)
    if a == m:
        n = min(n, i % 2019)

print((n*m) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:



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

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

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

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

Submission status: Wrong Answer

Solution code:
lr = list(map(int, input().split()))
l = lr[0]
r = lr[1]
lmod = l%2019

def minfunc(x, y):
    if x > y:
        return y
    else:
        return x

if r - l >= 2019:
    print(0)
elif 2019 <= r - l + lmod:
    print(0)
else:
    min = 9999999
    for i in list(map(lambda x: x%2019,range(l,r))):
        for j in list(map(lambda x: x%2019, range(i,r+1))):
            min = minfunc((i*j)%2019,min)
    print(min)

Submission status: Wrong Answer

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

L %= mod
R %= mod

while L > R:
    R += mod

for i in range(L, R):
    for j in range(i+1, R+1):
        if i * j % mod < ans:
            ans = i * j % mod

print(ans)

Submission status: Wrong Answer

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

l %= 2019
r %= 2019

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

if l>=r:
    min = 0

print(min)

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

    modl = L % 2019
    modr = R % 2019
    min_ = min(modl, modr)
    print(min_ * (min_ + 1))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if L == R:
    print((L * R) % 2019)

Submission status: Wrong Answer

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

list2019 = []
for i in range(1000000):
    list2019.append(2019*i)

print(list2019)
answer = (L * (L + 1)) % 2019
for l2019 in list2019:
    if L <= l2019 and l2019 <= R:
        answer = 0
if L <= 3 and 673 <= R:
    answer = 0
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
if R*(R-1)<2019:
  print(L*(L+1))
else:
  val=(L+R)//2
  if (val+1)%2019<val%2019:
    p=val
    while (p+1)%2019<p%2019 and p<=R-1:
      p+=1
    print((p*(p-1))%2019)
  else:
    p=val
    while (p-1)%2019<p%2019 and p>=L+1:
      p-=1
    print(p*(p+1)%2019)

Submission status: Wrong Answer

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

vlist = []

for x in range(gap+1):
    v = (l+x) % 2019
    vlist.append(v)

vlist.sort()
#print(vlist)

#res = i*j % 2019
print(vlist[0]*vlist[1])

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
            if res == 0:
                break

            
print(res)

Submission status: Wrong Answer

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

print(val)

Submission status: Wrong Answer

Solution code:
i,j = map(int,input().split())
print((i*(i+1))%2019 if j-i<2019 else 0)

Submission status: Wrong Answer

Solution code:
l, r = list(map(int,input().split()))
mod = 2019
min = 2019
if 2019 in range(l, r + 1):
    print(0)
    exit()
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        if min > (i * j) % mod:
            min = (i * j) % mod
        if min == 1:
            print(1)
            exit()
print(min)

Submission status: Wrong Answer

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


while l // 2019 > 0 or r // 2019 > 0:
  l = l % 2019
  r = r % 2019

mini = 2*(1e+9)

if l < r:
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      mini = min(mini, (i*j) % 2019)
elif l > r:
  for i in range(r,l+1):
    for j in range(i+1,l+1):
      mini = min(mini, (i*j) % 2019)
elif l == r:
  print(l*r% 2019)
  exit(0)
print(mini)

Submission status: Wrong Answer

Solution code:
import math
l,r=map(int,input().split())
a=l%2019
b=r%2019
if l-r>=2018:
    print(0)
elif b-a<=0:
    print(0)
elif (a<672)&(b>674):
    print(0)
elif (a<1345)&(b%3>1347):
    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):
            print(i,j)
            ans=min(ans,i*j%2019)
    print(ans)

Submission status: Wrong Answer

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

MOD = 2019  # type: int

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

    if(R < L):
        R += MOD-1

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

minnum = 3000
for i in range(4050):
    if  l + i == r:
        break
    elif (l+i % 2019) < minnum:
        minnum = (l+i) % 2019

print(minnum*(minnum+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

m1,m2 = L, R
for i in range(L,R+1):
    d_i = i % 2019
    if m1 > d_i: m1 = m2; m2 = d_i

print('{}'.format( (m1 * m2) % 2019))

Submission status: Wrong Answer

Solution code:
a,b=input().split()
a=int(a)
b=int(b)
c=0
for i in range(a,b):
  if b-a==673:
    c=1
    break
  
  elif i%673==0:
    c=1
ll=[]
if b-a==1:
  print(a*b%2019)
elif c==1:
  print(0)
elif b-a==102:
  print(1)
elif b-a==48:
  print(2)
else:
  for i in range(a,b):
    for j in  range(i+1,b):
      ll.append(i*j%2019)
      
  print(min(ll))

Submission status: Wrong Answer

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

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)
    if ans < R:
        calc = (ans * (ans+1)) % 2019
        print(calc)
    elif ans == R:
        calc = (ans * (ans - 1)) % 2019

Submission status: Wrong Answer

Solution code:
l, r = list(map(int,input().split()))
mod = 2019
min = 2019
if 2019 in range(l, r + 1):
    print(0)
    exit()
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        if min > (i * j) % mod:
            min = (i * j) % mod
        if min == 1:
            print(1)
print(min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
s=2019+l
if r>s:r=s
i,j=sorted([n%2019 for n in range(l,r+1)])[0:2]
print(i*j)

Submission status: Wrong Answer

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

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

mod_list.sort()
print((mod_list[0] * mod_list[1])%2019)

Submission status: Wrong Answer

Solution code:
from enum import Enum
from queue import Queue
import collections
import numpy as np


import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

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

Submission status: Wrong Answer

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

#f = 0
l = []

if R-L>=2019:
    #f = 1
    print(0)
    exit()

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

if 3 in l and 673 in l:
    print(0)
else:
    print(l[0]*l[1])

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
a=[]
for i in range(l,min(r+1,l+2020)):
    a.append(i%2019)
a=sorted(a)
t=a[0]
a=a[1:]
a=map(lambda x:x*t%2019,a)
print(min(a))

Submission status: Wrong Answer

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

mod = 2019
if L <= mod and R <= mod:
  print(L*R%mod)
else:
  print(2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


while l // 2019 > 0 or r // 2019 > 0:
  l = l % 2019
  r = r % 2019

mini = 2*(1e+9)

if l < r:
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      mini = min(mini, (i*j) % 2019)
elif l > r:
  for i in range(r,l+1):
    for j in range(i+1,l+1):
      mini = min(mini, (i*j) % 2019)
elif l == r:
  print(l*r)
  exit(0)
print(mini)

Submission status: Wrong Answer

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

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

between_list = []
for lr in range(L, R+1):
    between_list.append(lr % 2019)

sorted_between_list = sorted(between_list)

i = sorted_between_list[0]
j = sorted_between_list[1] if len(sorted_between_list) > 1 else sorted_between_list[0]

print((i * j) % 2019)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

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

if l == 2019:
    print(0)
elif l < 2019 and r >= 2019:
    print(0)
elif l * r < 2019:
    print(l * (l + 1))
else:
    s = 2020
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            print(i, j)
            if (i * j) % 2019 < s:
                s = (i * j) % 2019
    print(s)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
L1 = L%2019
R1 = R%2019
L2 = L//2019
R2 = R//2019
ans = 2018
if L2 != R2:#LとRの間に0でなるとき
  ans = 0
elif (L1*(L1+1)) < 2019:
  ans = L1*(L1+1)
else:
  for i in range(L+1,R):
    for j in range(i+1,R):
      x = (i*j)%2019
      ans = min(ans,x)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
target = 2019
L_mod = L % target
R_mod = R % target
#print(L_mod,'L',R_mod,'R')
if L_mod > R_mod:
    print(0)
    exit(0)
if L_mod == R_mod and L < R:
    print(0)
    exit(0)
if L_mod == R_mod:
    print(L_mod)
    exit(0)
if L+1 == R:
    print(L * R % target)
    exit(0)
if L_mod < R_mod and R-L >= target:
    print(0)
    exit(0)

ans = 2019
for i in range(R_mod-L_mod):
    for j in range(i+1,R_mod-L_mod):
        if ((L+i) * (L+j)) % target < ans:
            #print(L+i,'Li')
            #print(L+j,'Lj')
            ans = ((L+i) * (L+j)) % target
print(ans)

'''
2020 3000
2020 4040
2018 2020
'''

Submission status: Wrong Answer

Solution code:
MOD = 2019

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

if l // MOD != r // MOD:
    ans = 0
else:
    ans = (l * (l + 1)) % MOD

print(ans)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
if r-l+1>4038:
  x=list(range(l,l+4039))
else:
  x=list(range(l,r+1))
y=list()
for n in x:
  y=y+[n%2019]
y.sort()
print((y[0]*y[1])%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
lr = list(map(int, input().split()))
l = lr[0]
r = lr[1]
lmod = l%2019

def minfunc(x, y):
    if x > y:
        return y
    else:
        return x

if r - l >= 2019:
    print(0)
elif 2019 <= r - l + lmod:
    print(0)
else:
    min = 9999999
    for i in list(map(lambda x: x%2019,range(l,r))):
        for j in list(map(lambda x: x%2019, range(i,r+1))):
            min = minfunc(minfunc(i,j),min)
    print(min)

Submission status: Wrong Answer

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

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

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:
        m = (ml * (ml + 1)) % 2019
    else:
        m = 0
print(m)

Submission status: Wrong Answer

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

mod_arr = []

i = l-1
j = l
while i < r:
  i += 1
  while j <= r:
    if i >= l and i < j:
      mod = (i * j) % 2019
      mod_arr.append(mod)
    j += 1
    
print(min(mod_arr))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
rem_list = []
for i in range(r-l+1):
    rem = (l+i)%2019
    if rem == 0:
        continue
    rem_list.append(rem)
min1 = min(rem_list)
rem_list.remove(min1)
min2 = min(rem_list)
print((min1*min2)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def main():
    s, e = map(int, input().split())
    mn = 2000000000
    for i in range(s, e+1): mn = min(mn, i%2019)
    print(mn*(mn+1)%2019)
if __name__=="__main__": main()

Submission status: Wrong Answer

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

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

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

mod_list.sort()
print((mod_list[0]*mod_list[1])%2019)

Submission status: Wrong Answer

Solution code:



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

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

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

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

    elif n <= 2019:
        print(0)

Submission status: Wrong Answer

Solution code:
str = input()
str = str.split()
N = [int(i) for i in str]

min = (N[0]*N[1]) % 2019
count = 0
for i in range(N[0], N[1]-1):
    count = 0
    for j in range(i+1, N[1]):
        if min > (i*j) % 2019:
            min = (i*j) % 2019
            count = 0
        else:
            count += 1
            if(count >= 2019):
                break
print(min)

Submission status: Wrong Answer

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

l %= 2019
r = r+(r-l)%2019

if l>=r:
    r += 2019

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

print(min)

Submission status: Wrong Answer

Solution code:
l,r = (int(i) for i in input().split())
mod = 2019
if l>=mod and not r < mod*2:
    print(0)
else:
    if l>=mod:
        print(l*(l+1)%mod)
    else:
        print(r*(r-1)%mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# 133C
"""
L<=i<=j<=R
(i×j)mod 2019
0≤L<R≤2×10^9
"""

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

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

Submission status: Wrong Answer

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

hoge_min = l // 2019
hoge_max = r // 2019

i_min = max(hoge_min * 2019, l)
i_max = min((hoge_min + 1) * 2019, r-1)
i_mod1 = i_min - hoge_min * 2019
i_mod2 = (hoge_min + 1) * 2019 - i_max
i_mod = min(i_mod1, i_mod2) + hoge_min * 2019

j_min = max(hoge_max * 2019, i_mod+1)
j_max = min((hoge_max + 1) * 2019, r)
# j_mod1 = j_min - (hoge_max - 1) * 2019
# j_mod2 = hoge_max * 2019 - j_max
j_mod1 = j_min - hoge_max * 2019
j_mod2 = (hoge_max + 1) * 2019 - j_max
j_mod = min(j_mod1, j_mod2) + hoge_max * 2019

ans = i_mod * j_mod % 2019

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = L%2019
b = R%2019

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
if r-l+1>4038:
  x=list(range(l,l+4039))
else:
  x=list(range(l,r+1))
y=list()
for n in x:
  y=y+[n%2019]
y.sort()
print((y[0]*y[1])%2019)
print(y)

Submission status: Wrong Answer

Solution code:
L,R=map(int, input().split())
S=[]
flag=0
if R- L >2018:
    print(1)
else:
    for i in range(L,R+1):
        if i % 2019 == 0:
            print(0)
            break
    else:
        for i in range(L,R):
            for j in range(i+1,R+1):
                #print(i,j)
                A=i % 2019
                B=j % 2019
                C=A*B % 2019
                if C == 0:
                    flag=1
                    #print("%d %d"%(i,j))
                    print(0)
                    break
                else:
                    S.append(C)
            else:
                continue
            break
        if flag !=1:
            print(min(S))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

ans = 2 * (10**9)

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

print(ans)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
ans = []
flag = False
for i in range(l, r + 1):
    if i % 2019 > 0:
        ans.append(i % 2019)
    else:
        flag = True

if flag == False:
    print(ans[0] * ans[1])
else:
    ans.sort()
    print(0)
    


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


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

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




    #print(i)

Submission status: Wrong Answer

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

mod = 2019
print(min(L*R%mod, 2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = l*r%2019
for i in range(l,r-1) :
    for j in range(i+1,r):
        if (a > i*j%2019) :
            a = i*j%2019


print(a)

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline()[:-1]


def main():
    l, r = map(int, input().split())
    if r-l >= 2018:
        print(0)
    else:
        n = [i % 2019 for i in range(l, r+1)]
        n.sort(reverse=True)
        print(n.pop()*n.pop() % 2019)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

MOD = 2019  # type: int

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

    ans = MOD-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:
L,R = map(int, raw_input().split())

if 2019 <= R - L:
    print(0)
else:
    l_mod = L % 2019
    r_mod = R % 2019
    if l_mod < r_mod:
        print(l_mod * (l_mod+1))
    else:
        print(0)

Submission status: Wrong Answer

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

if l==0 or r//mod - (l-1)//mod >= 1:
  print(0)
else:
  st,end = l%mod, r%mod #L,R
  ans = st*(st+1)%mod
  
  while st<end:
    num = st*end
    if num > 2019:
      ans = min(ans,num % mod)
      end -= 1
    elif num == 2019:
      ans = 0
      break
    else:
      st += 1
  print(ans)

Submission status: Wrong Answer

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

if R > L + 5000:
    R = L + 5000
t = [i % 2019 for i in range(L, R + 1)]
t.sort()
if (3 in t and 673 in t) or (0 in t):
    print(0)
else:
    print(t[0] * t[1] % 2019)
    # print(t)

Submission status: Wrong Answer

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

if l > mod and r >= (l-mod)+l:
    r = (l-mod)+l

res = (l*r) % mod
print(res)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

from itertools import combinations
mod = 2019
l, r = L % mod, R % mod

if l != r:
    mini = mod
    for i, j in combinations(range(l, r+1), 2):
        val = i*j % mod
        if val < mini:
            mini = val 
    print(mini)
else:
    print(l*r % mod)

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
l, r = l%2019, r%2019
mi = 9999
if r*(r-1)<2019:
    print(l*(l+1))
elif r==0 or l==0:
    print(0)
else:
    for i in range(l, r-1):
        for j in range(i+1, r):
            if (i/3).is_integer() and (j/673).is_integer():
                mi = (i/3)*((i/3)+1)
            elif (i/673).is_integer() and (j/3).is_integer():
                mi = (i/673)*((i/673)+1)
            else:
                mi = min(mi, (i*j)%2019)
    print(mi)

Submission status: Wrong Answer

Solution code:



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

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

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

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

    elif n <= 2019:
        print(0)

Submission status: Wrong Answer

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

L %= mod
R %= mod

while L > R:
    R += mod
print(L, R)
for i in range(L, R):
    for j in range(i+1, R+1):
        if i * j % mod < ans:
            ans = i * j % mod

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    l,r = map(int,input().split(' '))
    tmp = 2019
    if l//2019 < r//2019:
        print(0)
    else:
        for i in range(l,r):
            if tmp > (i*(i+1))%2019:
                tmp = (i*(i+1))%2019
        print(tmp)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import heapq
A = [int(x)  for x in input().split()]
N = [i%2019 for i in range(A[0],A[1] + 1)]
a,b =  heapq.nsmallest(2, N)
print(a*b)