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())
mod=2019
a=l%mod
b=l//mod
c=r%mod
d=r//mod
if d-b!=0:
  print(0)
else:
  ans=float('inf')
  for i in range(a,c):
    for j in range(i+1,c+1):
      ans=min(ans,i*j)
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

import sys
minimum = sys.maxsize
for i in range(L, min(L + 2019, R)):
  for j in range(i+1, min(i + 1 + 2019, R)):
    minimum = min(minimum, i * j % 2019)
print(minimum)

Submission status: Wrong Answer

Solution code:
print(1)

Submission status: Wrong Answer

Solution code:
#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
#mod = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    l,r=INTM()
    mods=[]
    for i in range(l,min(l+3000,r+1)):
        mods.append(i%2019)
    
    mods=sorted(mods)
    print(min((mods[0]*mods[1])%2019,(mods[-1]*mods[-2])%2019))
    #print(mods)
if __name__=='__main__':
    do()

Submission status: Wrong Answer

Solution code:
#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
#mod = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    l,r=INTM()
    mods=[]
    for i in range(l,min(l+3000,r+1)):
        mods.append(i%2019)
    
    mods=sorted(mods)
    print((mods[0]*mods[1])%2019)

if __name__=='__main__':
    do()

Submission status: Wrong Answer

Solution code:
#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
#mod = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    l,r=INTM()
    mods=[]
    for i in range(l,min(l+2020,r+1)):
        mods.append(i%2019)
    
    mods=sorted(mods)
    print((mods[0]*mods[1])%2019)

if __name__=='__main__':
    do()

Submission status: Wrong Answer

Solution code:
import sys
L,R = map(int,input().split())
mod = 2019
if R - L >= 2019:
    print(0)
else:
    m = 10**5
    for i in range(L+1,R+1):
        if L * i % mod == 0:
            print(0)
            sys.exit()
    print(min((L * i) % mod, 2018))

Submission status: Wrong Answer

Solution code:
import sys
L,R = map(int,input().split())
mod = 2019
if R - L >= 2019:
    print(0)
else:
    m = 10**5
    for i in range(L+1,R+1):
        if L * i % mod == 0:
            print(0)
            sys.exit()
    print((L * i) % mod)

Submission status: Wrong Answer

Solution code:
import sys
L,R = map(int,input().split())
mod = 2019
if R - L >= 2019:
    print(0)
else:
    m = 10**5
    for i in range(L,R+1):
        if i % mod == 0:
            print(0)
            sys.exit()
    print((L * (L + 1)) % mod)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
mod = 2019
if R - L >= 2019:
    print(0)
else:
    m = 10**5
    for i in range(L,R+1):
        if m >= i % mod:
            m = i % mod

    print((m * (m + 1)) % mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mod_l = l%2019

if r-l>2019:
    print(0)
else:
    m = mod_l
    cnt = 0
    while cnt <= r-l:
        mod_l += 1
        mod_l %= 2019
        m = min(m, mod_l)
        cnt += 1
    print(m*(m+1)%2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
result = R*R
if R - L + 1 > 2019:
    R = L + 2018
for i in range(L,R+1):
    print("i="+str(i))
    for j in range(i+1,R+1):
        print("j="+str(j))
        if (i * j) % 2019 < result:
            result = (i * j) % 2019
print(result)

Submission status: Wrong Answer

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

A = {}

for i in range(L, R+1):
    A[i] = i%MOD

print(A[sorted(A)[0]]*A[sorted(A)[1]])

Submission status: Wrong Answer

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

if (r-l)//2019 >= 1:
    print(0)
else:
    mod = []
    for i in range(l, r+1):
        mod.append(i%2019)
    mod.sort()
    print(mod[0]*mod[1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if l//2019 < r//2019:
    print(0)
else:
    mod = min(l%2019, r%2019)
    print(mod*(mod+1))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if (r-l)//2019 >= 1:
    print(2)
else:
    mod = min(l%2019, r%2019)
    print(mod*(mod+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r = map(int, input().split())
ans = 2019
if r-l >= 2018:
  print(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:
l,r = map(int, input().split())
m = []
if r-l >= 2018:
  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())
m = []
if r-l >= 2018:
  print(0)
else:
  for i in range(l,r+1):
    m.append(i%2019)
  m.sort()
  print(m[0]*m[1])

Submission status: Wrong Answer

Solution code:
l, r = map(int, input().split())
ans = 4070306
if l <= 2019 <= r:
    print(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:

def main():

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

    tl = L % 2019
    tr = R % 2019
    c1 = (tl <= 673) & (673 <= tr)
    c2 = False
    for i in range(L, min(L + 3, R+1)):
        if i % 3 == 0:
            c2 = True
            break

    if ((L//2019) < (R//2019)) | (c1&c2):
        ans = 0
    else:
        t = L % 2019
        ans = t * (t+1)
    print(ans % 2019)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():

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

    tl = L % 2019
    tr = R % 2019
    c1 = (tl <= 673) & (673 <= tr)
    c2 = False
    for i in range(L, min(L + 3, R+1)):
        if i % 3 == 0:
            c2 = True
            break

    if ((L//2019) < (R//2019)) | (c1&c2):
        ans = 0
    else:
        t = L % 2019
        ans = t * (t+1)
    print(ans)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():

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

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

a = l%mod
b = r%mod

if r - l >= 2018:
  print(0)
  
else:
  if a > b:
    print(0)
    
  else:
    t = (a*(a+1))%mod
    for x in range(b-a):
      if ((a+x)*(a+x+1))%mod < t:
        t = ((a+x)*(a+x+1))%mod
    print(t)

Submission status: Wrong Answer

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

a = l%mod
b = r%mod


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

Submission status: Wrong Answer

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

mod = 2019
a = l%2019
b = r%2019

if r-l >= 2018:
  print(0)

else:
  if a < b:
    print((a*(a+1))%mod)
  else:
    print(0)

Submission status: Wrong Answer

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

mod = 2019
a = l%2019
b = r%2019

if r-l >= 2018:
  print(0)

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

Submission status: Wrong Answer

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

mod = 2019
a = l%2019
b = r%2019

if r-l >= 2018:
  print(0)

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

Submission status: Wrong Answer

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

L1 = L%2019
L2 = (L+1)%2019

if R-L >= 672:
  ans = 0
  print(ans)
  quit()

else:
  ans = L1*L2
  print(ans)
  quit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
l = a*b%2019
m = a%2019
n = b%2019
#print(l,m,n)
if m>n:
  print(0)
elif l+(b-a-1)>=2019:
  print(0)
elif l+(b-a-1)<2019:
  if l-(b-a-1)<=0:
    print(0)
  elif l-(b-a-1)>0:
    print(l-b+a+1)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
l = a*b%2019
#print(l)
if l+(b-a-1)>=2019:
  print(0)
elif l+(b-a-1)<2019:
  if l-(b-a-1)<=0:
    print(0)
  elif l-(b-a-1)>0:
    print(l-b+a+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L,R = (int(x) for x in input().split())
if (R-L)//2019:
  R -= (R-L)//2019*2019
ans = 2018
for i in range(L,R):
  for j in range(i+1,R+1):
    ans = min(ans,(i*j)%2019)
print(ans)

Submission status: Wrong Answer

Solution code:
L,R = (int(x) for x in input().split())
if (L-R)//2019:
  R -= (L-R)//2019*2019
ans = 2018
for i in range(L,R):
  for j in range(i+1,R+1):
    ans = min(ans,(i*j)%2019)
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans = 10**10
for i in range(l, r+1):
    for j in range(i+1, r+1):
            ans = min(ans, (i*j)%2019)
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if R - L >= 2019:
    print(0)
    
else:
    lis = []
    for i in range(L, R+1):
        lis.append(i%2019)
    lis = sorted(lis)
    print(lis[0]*lis[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def LI():
    return list(map(int, input().split()))


L, R = LI()
ans = 2020
for i in range(L, R+1):
    x = (i*i) % 2019
    for j in range(i, R+1):
        y = (i*j) % 2019
        ans = min(ans, y)
        if ans == 0:
            break
print(ans)

Submission status: Wrong Answer

Solution code:
def LI():
    return list(map(int, input().split()))


L, R = LI()
ans = 2020
for i in range(L, R+1):
    x = (i*i) % 2019
    for j in range(i, R+1):
        y = (i*j) % 2019
        ans = min(ans, y)
        if x == y:
            break
    if ans == 0:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
def LI():
    return list(map(int, input().split()))


L, R = LI()
ans = 2020
for i in range(L, R+1):
    x = (i*i) % 2019
    for j in range(i, R+1):
        y = (i*j) % 2019
        ans = min(ans, x)
        if x == y:
            break
    if ans == 0:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
def LI():
    return list(map(int, input().split()))


L, R = LI()
ans = 2020
for i in range(L, min(R, L+L)):
    x = (i*i) % 2019
    for j in range(i, R+1):
        y = (i*j) % 2019
        ans = min(ans, x)
        if x == y:
            break
    if ans == 0:
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def LI():
    return list(map(int, input().split()))


L, R = LI()
ans = 2020
for i in range(L, min(R, L+L)):
    x = (i*(i+1)) % 2019
    for j in range(i+1, R+1):
        y = (i*j) % 2019
        ans = min(ans, x)
        if x == y:
            break
print(ans)

Submission status: Wrong Answer

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

cnt = 0
i = 0
ans = 1
while cnt < 2:
    if res[i] == 1:
        ans *= i
        cnt += 1
    i += 1
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def main():
    l, r = map(int, input().split())
    mi = 2019

    for i in range(l, r):
        a = (i*i) % 2019
        for _ in range(r-l):
            a = (a+i) % 2019

            if a < mi:
                mi = a
                if a == 0:
                    break

    print(mi)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    l, r = map(int, input().split())
    mi = 2019

    for i in range(l, r):
        a = (i*i) % 2019
        for _ in range(i, r+1):
            a = (a+i) % 2019

            if a < mi:
                mi = a
                if a == 0:
                    break

    print(mi)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
res = float('inf')
L, R = map(int, input().split())
length = min(R - L, 3000)
for i in range(L, L + length-1):
  for j in range(i+1, L + length):
    temp = (i * j) % 2019
    if temp < res:
      res = temp
print(res)

Submission status: Wrong Answer

Solution code:
import math
res = float('inf')
L, R = map(int, input().split())
length = min(R - L, 2019)
for i in range(L, L + length-1):
  for j in range(i+1, L + length):
    temp = (i * j) % 2019
    if temp < res:
      res = temp
print(res)

Submission status: Wrong Answer

Solution code:
import math
res = float('inf')
L, R = map(int, input().split())
length = min(R - L, 2018)
for i in range(L, L + length-1):
  for j in range(i+1, L + length):
    temp = (i * j) % 2019
    if temp < res:
      res = temp
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-09-10 18:36:43 +0900
# LastModified: 2020-09-11 01:53:36 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    L, R = map(int, input().split())
    cool = R // 2019 - L // 2019
    if cool == 0:
        print(L*(L+1) % 2019)
    else:
        print(0)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 10 11:33:13 2020

@author: liang
"""

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 10 11:33:13 2020

@author: liang
"""

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b

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

    for i in range(1, 990589):
        if L <= 2019*i <= R:
            print(0)
            exit()

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b

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

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

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b

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

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
l=L%2019
r=R%2019
l1=L//2019
r1=R//2019
if l1<r1:
  print(0)
elif l1==r1:
  print(min((l*(l+1))%2019,(r*(r-1))%2019))

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
l=L%2019
r=R%2019
l1=L//2019
r1=R//2019
if l1<r1:
  print(0)
  exit()
print((l*(l+1))%2019)

Submission status: Wrong Answer

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

def main():
    l, r = map(int, input().split())
    ans = 2018
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            ans = min(ans,min(abs(i % 2019), abs(i % 2019 - 2019)) * min(abs(j % 2019), abs(j % 2019 - 2019)))
            if ans == 0:
                break
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

def main():
    l, r = map(int, input().split())
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            if i != j:
                ans = (i * j) % 2019
                if ans == 0:
                    break
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

def main():
    l, r = map(int, input().split())
    for i in range(l, r):
        for j in range(l + 1, r + 1):
            ans = (i * j) % 2019
            if ans == 0:
                break
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

def main():
    l, r = map(int, input().split())
    for i in range(l, r):
        for j in range(l, r + 1):
            ans = (i * j) % 2019
            if ans == 0:
                break
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

def main():
    l, r = map(int, input().split())
    cnt = 0
    ans = 2018
    for i in range(l, r + 1):
        for j in range(l + 1, r + 1):
            ans = min(ans, (i * j) % 2019)
            if cnt == 2019:
                break
        cnt += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
tmp1 = [int(i)%2019 for i in range(r+1)]
#print(tmp1)
#tmp2 = []
#for i in range(2019):
#    tmp = []
#    for j in range(2019):
#        tmp.append(i*j%2019)
#    tmp2.append(tmp)
#lst = tmp1[l:r+1]
#print(lst)

if r-l>=2018:
    print(0)
else:
    if min(tmp1[l:r+1])==0:
        print(0)
    else:
        print(999)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
tmp1 = [int(i)%2019 for i in range(r+1)]
#print(tmp1)
#tmp2 = []
#for i in range(2019):
#    tmp = []
#    for j in range(2019):
#        tmp.append(i*j%2019)
#    tmp2.append(tmp)
lst = tmp1[l:r+1]
print(lst)

if r-l>=2018:
    print(0)
else:
    if min(tmp1[l:r+1])==0:
        print(0)
    else:
        print(999)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
tmp1 = [int(i)%2019 for i in range(r+1)]
#print(tmp1)
#tmp2 = []
#for i in range(2019):
#    tmp = []
#    for j in range(2019):
#        tmp.append(i*j%2019)
#    tmp2.append(tmp)
lst = tmp1[l:r+1]
print(lst)

if min(tmp1[l:r+1])==0:
    print(0)
else:
    print(999)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

min_rem = (l * r) % 2019

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

print(min_rem)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math
L, R = map(int, input().split( ))
mod = 2019
#(i*j mod) = (i mod)*(j mod)
s, t = L%2019, R%2019
if R -L  >= 2018:
  print(0)
  exit()
ans = 2018
if s > t:
  print(0)
  exit()
for i in range(1, L):
  for j in range(L+1, R):
    ans = min(ans, (i*j)%mod)
    if ans == 0:
      print(0)
      exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import math
L, R = map(int, input().split( ))
mod = 2019
#(i*j mod) = (i mod)*(j mod)
s, t = L%2019, R%2019
if R -L  >= 2018:
  print(0)
  exit()
ans = 2018
if s > t:
  print(0)
  exit()
for i in range(1, L):
  for j in range(L+1, R):
    ans = min(ans, (i+j)%mod)
    if ans == 0:
      print(0)
      exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import math
L, R = map(int, input().split( ))
mod = 2019
#(i*j mod) = (i mod)*(j mod)
s, t = L%2019, R%2019
if R -L  >= 2018:
  print(0)
  exit()
ans = 2018
if s > t:
  print(0)
  exit()
for i in range(1, L):
  for j in range(L+1, R):
    ans = min(ans, (i+j)%mod)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
L, R = map(int, input().split( ))
mod = 2019
#(i*j mod) = (i mod)*(j mod)
m = 2018
s, t = L%2019, R%2019
if R -L  >= 2018:
  print(0)
  exit()
if t < s:
  print(0)
else:
  print(s*(s+1))

Submission status: Wrong Answer

Solution code:
import math
L, R = map(int, input().split( ))
mod = 2019
#(i*j mod) = (i mod)*(j mod)
m = 2018
s, t = L%2019, R%2019
d = (R - L)//2019
if d >= 1:
  print(0)
  exit()
if t < s:
  print(0)
else:
  print(s*(s+1))

Submission status: Wrong Answer

Solution code:
# AtCoder Beginner Contest 133
# C - Remainder Minimization 2019
L,R=map(int,input().split())

mod=2019
ans=10**18+7


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

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if L + 2019 < R:
  tmp = 10**9
  for l in range(L,R):
    for r in range(l+1, R+1):
      if (l*r)%2019 < tmp:
        tmp = (l*r)%2019
  print(tmp)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
if L + 2019 < R:
  tmp = 10**9
  for l in range(L,R):
    for r in range(l+1, R+1):
      if (l*r)%2019 < tmp:
        tmp = (l*r)%2019
  print(tmp)
else:
  print("0")