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())
if r-l >= 2019:
    print(0)
else:
    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())
if r-l >= 2018:
    print(0)
else:
    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())
ans = 2019
if r-l+1 >= 2019:
    print(0)
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            print("i,j,",i,j)
            ans = min( (i*j) % 2019, ans)
    print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
L,R=map(int,input().split())
if L%2019==0 or R%2019==0:
	ans=0
else:
	L%=2019
	R%=2019
	ans=2020
	for c in itertools.combinations(range(min(L,R),max(L,R)+1),2):
		ans=min(ans,(c[0]*c[1])%2019)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
L,R=map(int,input().split())
if L%2019==0 or R%2019==0:
	ans=0
else:
	L%=2019
	R%=2019
	INF=10*9
	ans=INF
	for c in itertools.combinations(range(min(L,R),max(L,R)),2):
		ans=min(ans,(c[0]*c[1])%2019)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
L,R=map(int,input().split())
if L%2019==0 or R%2019==0:
	ans=0
else:
	L%=2019
	R%=2019

	print(L,R)
	INF=10*9
	ans=INF
	for c in itertools.combinations(range(min(L,R),max(L,R)),2):
		ans=min(ans,(c[0]*c[1])%2019)
print(ans)

Submission status: Wrong Answer

Solution code:
L,R=map(int,input().split())
if L%2019==0 or R%2019==0:
	ans=0
else:
	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%=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())
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:

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
a,b=n1()

if b-a>=2019:
    print(0)
else:
    c=[i%2019 for i in range(a,b+1)]
    c.sort()
    print(c[0]*c[1])

Submission status: Wrong Answer

Solution code:

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
a,b=n1()


c=[i%2019 for i in range(a,b+1)]
c.sort()
print(c[0]*c[1])

Submission status: Wrong Answer

Solution code:

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
a,b=n1()

if b-a>=2019*2:
    print(1)
else:
    c=[i%2019 for i in range(a,b+1)]
    c.sort()
    print(c[0]*c[1])

Submission status: Wrong Answer

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

ans = 10 ** 9
for i in range(L, R+1):
    for j in range(i, R):
        mod = i * j % 2019
        if ans > mod:
            ans = mod
        if ans == 0:
            break
    else:
        continue
    break
print(ans)

Submission status: Wrong Answer

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

ans = 10 ** 9
for i in range(L, R+1):
    for j in range(i, R):
        mod = i * j % 2019
        if ans > mod:
            ans = mod
        elif mod == 0:
            ans = 0
            break
    else:
        continue
    break
print(ans)

Submission status: Wrong Answer

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

MOD = 2019
L = L%MOD
R = R%MOD
if L > R:
    L, R = R, L

MIN = 2018
if L == R:
    MIN = 0
for i in range(L, R):
    for j in range(i+1, R+1):
        buf = (i*j) % MOD
        #print(i, j)
        MIN = min(buf, MIN)

print(MIN)

Submission status: Wrong Answer

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

MOD = 2019
L = L%MOD
R = R%MOD
if L > R:
    L, R = R, L

MIN = 2018
if L == R:
    MIN = 0
for i in range(L, R):
    for j in range(i+1, R+1):
        buf = (i*j) % MOD
        print(i, j)
        MIN = min(buf, MIN)

print(MIN)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

MOD = 2019
L = L%MOD
R = R%MOD
if L > R:
    L, R = R, L

MIN = float('inf')
if L == R:
    MIN = 0
for i in range(L, R):
    for j in range(i+1, R+1):
        buf = (i*j) % MOD
        #print(buf)
        MIN = min(buf, MIN)

print(MIN)

Submission status: Wrong Answer

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

MOD = 2019
L = L%MOD
R = R%MOD
if L > R:
    L, R = R, L

MIN = float('inf')
for i in range(L, R):
    for j in range(i+1, R+1):
        buf = (i*j) % MOD
        #print(buf)
        MIN = min(buf, MIN)

print(MIN)

Submission status: Wrong Answer

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

d=[int(i) for i in range(2019)]

a=l%2019
b=r%2019

if a<b:
    d=d[a:b+1]
elif a==b:
    d=d
else:
    d=d[b:a+1]
    
ans=10**9
for i in range(len(d)):
    for j in range(i+1,len(d)):
        ans=min(ans,(d[i]*d[j])%2019)
print(ans)

Submission status: Wrong Answer

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

d=[int(i) for i in range(2019)]

a=l%2019
b=r%2019

if a<b:
    d=d[a:b+1]
else:
    d=d[b:a+1]
    
ans=10**9
for i in range(len(d)):
    for j in range(i+1,len(d)):
        ans=min(ans,(d[i]*d[j])%2019)
print(ans)

Submission status: Wrong Answer

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


def main():
    L, R = map(int, input().split())
    if R - L > 2017:
        print(0)
        return
    ans = min([n % 2019 for n in range(L, R + 1)])
    ans = ans * (ans + 1)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
rL = L % 2019
rR = R % 2019

if R-L > 2019 or rL > rR:
    print(0)
else:
    print((L*(L+1)) % 2019)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
rL = L % 2019
rR = R % 2019

if rL < rR and R-L < 2019:
    ans = 2018
    for i in range(rL, rR):
        ans = min(ans, (i*(i+1))%2019)
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
rL = L % 2019
rR = R % 2019

if rL < rR and R-L < 2019:
    ans = 2018
    for i in range(rL, rR):
        ans = min(ans, i*(i+1))
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
rL = L % 2019
rR = R % 2019

if rL < rR and R-L < 2019:
    print((rL * (rL+1))%2019)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
L, R = map(int, input().split())
rL = L % 2019
rR = R % 2019

if rL < rR and R-L < 2019:
    print(rL * (rL+1))
else:
    print(0)

Submission status: Wrong Answer

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

l_mod = L % 2019
r_mod = R % 2019

ans = 0
if l_mod <= r_mod:
    ans = l_mod * (l_mod + 1)

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
l, r = map(int, input().split())
if l == 0:
    print(0)
    sys.exit()

div_l, mod_l = divmod(l, 2019)
div_r, mod_r = divmod(r, 2019)
if div_l != div_r:
    print(0)
else:
    print((mod_l * (mod_l + 1)) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(b-a+1):
        if (i+a)%2019 == 0:
            print(0)
            exit()
        
print((a%2019) * (a%2019+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if R-L>=2019:
    print(0)
else:
    range_i = np.array(list(range(L, R)))
    range_j = np.array(list(range(L+1, R+1)))
    mod_2019_i = range_i % 2019
    mod_2019_j = range_j % 2019
    mod_3_i = range_i % 3
    mod_3_j = range_j % 3
    mod_673_i = range_i % 673
    mod_673_j = range_j % 673

    if (0 in mod_2019_i) or (0 in mod_2019_j) or (0 in mod_3_i and 0 in mod_673_j) or (0 in mod_3_j and 0 in mod_673_i):
        print(0)
    else:
        print(L*(L+1) % 2019)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if R-L>=2019:
    print(0)
else:
    range_i = np.array(list(range(L, R)))
    range_j = np.array(list(range(L, R)))
    mod_2019_i = range_i % 2019
    mod_2019_j = range_j % 2019
    mod_3_i = range_i % 3
    mod_3_j = range_j % 3
    mod_673_i = range_i % 673
    mod_673_j = range_j % 673

    if (0 in mod_2019_i) or (0 in mod_2019_j) or (0 in mod_3_i and 0 in mod_673_j) or (0 in mod_3_j and 0 in mod_673_i):
        print(0)
    else:
        print(L*(L+1) % 2019)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if R-L>=2019:
    print(0)
else:
    range_L_R = np.array(list(range(L, R+1)))
    range_mod_2019 = range_L_R % 2019
    range_mod_3 = range_L_R % 3
    range_mod_673 = range_L_R % 673

    if (0 in range_mod_2019) or (0 in range_mod_3 and 0 in range_mod_673):
        print(0)
    else:
        print(L*(L+1) % 2019)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if R-L>=2019:
    print(0)
else:
    range_L_R = np.array(list(range(L, R+1)))
    range_mod_2019 = range_L_R % 2019
    range_mod_3 = range_L_R % 3
    range_mod_673 = range_L_R % 673

    if (0 in range_mod_2019) or (0 in range_mod_3 and 0 in range_mod_673):
        print(0)
    else:
        print(L*(L+1))

Submission status: Wrong Answer

Solution code:
import numpy as np

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

if R-L>=2019:
    print(0)
else:
    range_L_R = np.array(list(range(L, R+1)))
    range_L_R = range_L_R % 2019
    if ((R>=673) and (L<=672)) or ((R>=675) and (L<=673)) or 0 in range_L_R:
        print(0)
    else:
        print(L*(L+1) % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

d = 10 ** 10

if R -L > 2019:
  print(0)
else:
  N = R -L 
  for i in range(N):
    for j in range(N):
      
      a = L+i
      b = L+j
      
      c = a * b % 2019
      d = min(c,d)
  print(d)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
p=l%2019
q=r%2019
a=2018
if p>q:
    print(0)
else:
    for i in range(p,q):
        for j in range(p+1,q+1):
            c=(i*j)%2019
            if a>c:
                a=c
    print(a)

Submission status: Wrong Answer

Solution code:
l,r=map(int,input().split())
p=l%2019
q=r%2019
a=2018
if p>q:
    print(0)
else:
    for i in range(p,q+1):
        for j in range(p+1,q+1):
            c=(i*j)%2019
            if a>c:
                a=c
    print(a)

Submission status: Wrong Answer

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

for i in range(l,r+1):
    if ans == 0:
        break
    ans = min(ans,i%2019)

print(ans*(ans+1))

Submission status: Wrong Answer

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

if l == 0:print(0);quit()

for i in range(l,r+1):
    if ans == 0:
        break
    ans = min(ans,i*(i+1)%2019)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(l,r+1):
    m = min(m,i%2019)
    if m == 0:
        break

print(m*(m+1))

Submission status: Wrong Answer

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

for i in range(l,r+1):
    if flag1 and flag2:
        print(0)
        quit()
    if i%3 == 0:
        flag1 = True
    if i%613 == 0:
        flag2 = True

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

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
a = r-l-1
print((l*r%2019)-a)

Submission status: Wrong Answer

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
L,R = (int(x) for x in input().split())

mod_L =L %2019
mod_R =R %2019
ans =0
xx=[]
if 2019 <= R -L:
    ans =0
elif mod_R < mod_L:
    ans =0
elif mod_L==0 :
    ans =0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            x =(i %2019) * (j%2019)
            xx.append(x)
    ans =min(xx)
print(ans)

Submission status: Wrong Answer

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
L,R = (int(x) for x in input().split())

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

Submission status: Wrong Answer

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
L,R = (int(x) for x in input().split())

mod_L =L %2019
mod_R =R %2019
ans =0
if 2018 <= R -L:
    ans =0
elif mod_R < mod_L:
    ans =0
else:
    a =min(mod_L,mod_R)
    ans =a *(a +1)
print(ans)

Submission status: Wrong Answer

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
L,R = (int(x) for x in input().split())

mod_L =L %2019
mod_R =R %2019
ans =0
if 2019 <= R -L:
    ans =0
elif mod_R < mod_L:
    ans =0
else:
    a =min(mod_L,mod_R)
    ans =a *(a +1)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
L,R = (int(x) for x in input().split())

mod_L =L %2019
mod_R =R %2019
ans =0
if 2019 <= R -L:
    ans =0
elif mod_R < mod_L:
    ans =0
else:
    ans =mod_L *(mod_L +1)
print(ans)

Submission status: Wrong Answer

Solution code:
l,r = map(int,input().split())
m = [0] * 2019
for i in range(l,r+1):
    m[i % 2019] = 1
    if m[1] == 1 and m[2] == 1:
        print(2)
        exit()
ans = m.index(1)
print((ans) * (ans+1))

Submission status: Wrong Answer

Solution code:
import sys

a, b = map(int,input().split())
num = int(a*b%2019)

for i in range(1, b - a + 1):
  for j in range(1, b - a + 1):
    if(i >= j):
      continue
    num = min(num, (i*j)%2019)
    if(num == 0):
      print(0)
      sys.exit()

print(num % 2019)

Submission status: Wrong Answer

Solution code:
import sys

a, b = map(int,input().split())
num = int(a*b%2019)

for i in range(1, b - a + 1):
  for j in range(i + 1, b - a + 1):
    num = min(num, (i*j)%2019)
    if(num == 0):
      print(0)
      sys.exit()

print(num % 2019)

Submission status: Wrong Answer

Solution code:
import sys

a, b = map(int,input().split())
num = int(4*5%2019)

for i in range(1, b - a + 1):
  for j in range(i + 1, b - a + 1):
    num = min(num, (i*j)%2019)
    if(num == 0):
      print(0)
      sys.exit()

print(num % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

a, b = map(int,input().split())
num = int(4*5%2019)

for i in range(1, b - a + 1):
  if(i % 2019 == 0):
    print(0)
    sys.exit()
  for j in range(i + 1, b - a + 1):
    if(j  % 2019 == 0):
      print(0)
      sys.exit()
    num = min(num, (i*j)%2019)

print(num % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

a, b = map(int,input().split())
num = int(4*5%2019)

for i in range(1, b - a):
  if(i % 2019 == 0):
    print(0)
    sys.exit()
  for j in range(i + 1, b - a):
    if(j  % 2019 == 0):
      print(0)
      sys.exit()
    num = min(num, (i*j)%2019)

print(num % 2019)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

a, b = map(int,input().split())
num = [a%2019]
num.append(num[0] + 1)

if(a%2019 == 0 or b%2019 == 0):
  print(0)
  sys.exit()

for i in range(a + 1,b):
  if(i % 2019 == 0):
    print(0)
    sys.exit()

print((num[0] * num[1])%2019)

Submission status: Wrong Answer

Solution code:
import sys

a, b = map(int,input().split())
num = [a%2019]
num.append(b%2019)

if(a%2019 == 0 or b%2019 == 0):
  print(0)
  sys.exit()

for i in range(a + 1,b):
  if(max(num) > (i % 2019)):
    num.remove(max(num))
    num.append(i%2019)
  elif(i % 2019 == 0):
    print(0)
    sys.exit()

print((num[0] * num[1])%2019)

Submission status: Wrong Answer

Solution code:
import sys

a, b = map(int,input().split())
num = [a%2019]
num.append(b%2019)

if(a%2019 == 0 or b%2019 == 0):
  print(0)
  sys.exit()

for i in range(a + 1,b):
  if(max(num) > (i % 2019)):
    num.remove(max(num))
    num.append(i%2019)
  elif(i % 2019 == 0):
    print(0)
    sys.exit()

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

Submission status: Wrong Answer

Solution code:
import sys

a, b = map(int,input().split())
num = [a%2019]
num.append(b%2019)

if(a%2019 == 0 or b%2019 == 0):
  print(0)
  sys.exit()

for i in range(a + 1,b):
  if(min(num) > (i % 2019)):
    num.remove(max(num))
    num.append(i%2019)
  elif(i % 2019 == 0):
    print(0)
    sys.exit()

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

Submission status: Wrong Answer

Solution code:
import sys

a, b = map(int,input().split())
num = [a%2019]
num.append(b%2019)

for i in range(a + 1,b):
  if(max(num) > (i % 2019)):
    num.remove(max(num))
    num.append(i%2019)
  elif(i % 2019 == 0):
    print(0)
    sys.exit()

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

Submission status: Wrong Answer

Solution code:
import sys

a, b = map(int,input().split())
num = [a%2019]
num.append(b%2019)

for i in range(a + 1,b):
  if(max(num) > (i % 2019)):
    num.append(i%2019)
    num.remove(max(num))
  elif(i % 2019 == 0):
    print(0)
    sys.exit()

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

Submission status: Wrong Answer

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

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

Submission status: Wrong Answer

Solution code:
a, b = map(int,input().split())
num = [a%2019]
num.append(b%2019)

for i in range(a + 1,b):
  if(max(num) > (i % 2019)):
    num.append(i%2019)
    num.remove(max(num))
  elif(i % 2019 == 0):
    print(0)
    break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
i, j = map(int, input().split())
a = i%2019
a_r = i//2019
 
b = j%2019
b_r = j//2019
 
if a_r == b_r:
  print((a*(a+1))%2019)
else:
  print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
i, j = map(int, input().split())
a = i%2019
a_r = i//2019
 
b = j%2019
b_r = j//2019
 
if a_r == b_r:
  print(a*(a+1)%2019)
elif b_r > a_r or b<=a:
  print(0)

Submission status: Wrong Answer

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

result=float("inf")
for i in range(l,r):
  result=min(result,(i*(i+1))%2019)

print(result)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from sys import exit

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

if l%673 == 0 or r%673 == 0:
    if l%3 == 0 or r%3 == 0:
        print(0)
        exit()
    else:
        for i in range(l, min(r,l+2)+1):
            if i%3 == 0:
                print(0)
                exit()
elif l//673 != r//673:
    for i in range(l, min(r,l+2)+1):
        if i%3 == 0:
            print(0)
            exit()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
i, j = map(int, input().split())
a = i%2019
a_r = i//2019

b = j%2019
b_r = j//2019

if a_r == b_r:
  print(a*(a+1))
elif b_r > a_r or b<=a:
  print(0)

Submission status: Wrong Answer

Solution code:
i, j = map(int, input().split())
a = i%2019
a_r = i//2019

b = j%2019
b_r = j//2019

if a_r == b_r:
  print(a*(a+1))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
i, j = map(int, input().split())

print((i%2019)*(j%2019))

Submission status: Wrong Answer

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

ans = 2018**2
if L-R >= 2019:
    ans = 0
else:
    l, r = L % 2019, R % 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())

ans = 10**9
if L-R >= 2019:
    ans = 0
else:
    l, r = L % 2019, R % 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())

ans = 10**10
for i in range(L, R+1):
    for j in range(i, R+1):
        if not(i < j):
            continue

        tmp = (i*j) % 2019
        if tmp == 0:
            exit(0)
        else:
            ans = min(ans, tmp)
print(ans)

Submission status: Wrong Answer

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

ans = 10**9
for i in range(L, R+1):
    for j in range(i, R+1):
        if not(i < j):
            continue

        tmp = (i*j) % 2019
        if tmp == 0:
            print(ans)
            exit(0)
        else:
            ans = min(ans, tmp)
print(ans)

Submission status: Wrong Answer

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

ans = 10**9
for i in range(L, R):
    for j in range(i+1, R+1):
        tmp = (i*j) % 2019
        if tmp == 0:
            print(ans)
            exit(0)
        else:
            ans = min(ans, tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
mod = 2019
k = 2018
limit = R-L
for i in range(limit):
  s = (L * (L + i +1)) % mod
  if k>s:
    k = s
  if k == 0:
    break
    
print(k)

Submission status: Wrong Answer

Solution code:
L,R = map(int,input().split())
mod = 2019
k = 2018
limit = R-L
if (limit > 100000):
  limit = 100000
for i in range(limit):
  s = (L * (L + i +1)) % mod
  if k>s:
    k = s
  if k == 0:
    break
    
print(k)

Submission status: Wrong Answer

Solution code:
import collections
import numpy as np
import sys
sys.setrecursionlimit(10000000)
import copy
#N=int(input())
L,R=map(int,input().split())
l=[]
for i in range(2021):
    l.append(L%2019)
    if L==R:
        break
    L+=1
ans=2019999
for i in range(len(l)):
    for j in range(len(l)-i):
        ans=min(l[i]*l[j]%2019,ans)
print(ans)